mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 02:20:38 +09:00
CLI: add secrets configuration, doctor check, and path resolver extraction
Add secrets section to onboard, configure, and doctor commands. Doctor validates local encrypted provider key file and can auto-repair missing keys. Extract shared path resolution into path-resolver module used by database and log checks. Show secrets env vars in `paperclip env`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
11901ae5d8
commit
f1b558dcfb
12 changed files with 342 additions and 35 deletions
|
|
@ -1,19 +1,7 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import type { PaperclipConfig } from "../config/schema.js";
|
||||
import type { CheckResult } from "./index.js";
|
||||
|
||||
function resolveConfigRelativePath(value: string, configPath?: string): string {
|
||||
if (path.isAbsolute(value)) return value;
|
||||
const candidates = [path.resolve(value)];
|
||||
if (configPath) {
|
||||
candidates.unshift(path.resolve(path.dirname(configPath), "..", "server", value));
|
||||
candidates.unshift(path.resolve(path.dirname(configPath), value));
|
||||
}
|
||||
candidates.push(path.resolve(process.cwd(), "server", value));
|
||||
const uniqueCandidates = Array.from(new Set(candidates));
|
||||
return uniqueCandidates.find((candidate) => fs.existsSync(candidate)) ?? uniqueCandidates[0];
|
||||
}
|
||||
import { resolveRuntimeLikePath } from "./path-resolver.js";
|
||||
|
||||
export async function databaseCheck(config: PaperclipConfig, configPath?: string): Promise<CheckResult> {
|
||||
if (config.database.mode === "postgres") {
|
||||
|
|
@ -48,7 +36,7 @@ export async function databaseCheck(config: PaperclipConfig, configPath?: string
|
|||
}
|
||||
|
||||
if (config.database.mode === "embedded-postgres") {
|
||||
const dataDir = resolveConfigRelativePath(config.database.embeddedPostgresDataDir, configPath);
|
||||
const dataDir = resolveRuntimeLikePath(config.database.embeddedPostgresDataDir, configPath);
|
||||
const reportedPath = dataDir;
|
||||
if (!fs.existsSync(dataDir)) {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue