fix: doctor command auto-creates directories and treats LLM as optional
Instead of showing alarming warnings on first run when storage, log, and database directories don't exist, the doctor checks now silently create them and report pass. LLM provider is treated as optional rather than a warning when not configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,15 +39,7 @@ export async function databaseCheck(config: PaperclipConfig, configPath?: string
|
|||||||
const dataDir = resolveRuntimeLikePath(config.database.embeddedPostgresDataDir, configPath);
|
const dataDir = resolveRuntimeLikePath(config.database.embeddedPostgresDataDir, configPath);
|
||||||
const reportedPath = dataDir;
|
const reportedPath = dataDir;
|
||||||
if (!fs.existsSync(dataDir)) {
|
if (!fs.existsSync(dataDir)) {
|
||||||
return {
|
fs.mkdirSync(reportedPath, { recursive: true });
|
||||||
name: "Database",
|
|
||||||
status: "warn",
|
|
||||||
message: `Embedded PostgreSQL data directory does not exist: ${reportedPath}`,
|
|
||||||
canRepair: true,
|
|
||||||
repair: () => {
|
|
||||||
fs.mkdirSync(reportedPath, { recursive: true });
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -5,20 +5,16 @@ export async function llmCheck(config: PaperclipConfig): Promise<CheckResult> {
|
|||||||
if (!config.llm) {
|
if (!config.llm) {
|
||||||
return {
|
return {
|
||||||
name: "LLM provider",
|
name: "LLM provider",
|
||||||
status: "warn",
|
status: "pass",
|
||||||
message: "No LLM provider configured",
|
message: "No LLM provider configured (optional)",
|
||||||
canRepair: false,
|
|
||||||
repairHint: "Run `paperclipai configure --section llm` to set one up",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.llm.apiKey) {
|
if (!config.llm.apiKey) {
|
||||||
return {
|
return {
|
||||||
name: "LLM provider",
|
name: "LLM provider",
|
||||||
status: "warn",
|
status: "pass",
|
||||||
message: `${config.llm.provider} configured but no API key set`,
|
message: `${config.llm.provider} configured but no API key set (optional)`,
|
||||||
canRepair: false,
|
|
||||||
repairHint: "Run `paperclipai configure --section llm`",
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,7 @@ export function logCheck(config: PaperclipConfig, configPath?: string): CheckRes
|
|||||||
const reportedDir = logDir;
|
const reportedDir = logDir;
|
||||||
|
|
||||||
if (!fs.existsSync(logDir)) {
|
if (!fs.existsSync(logDir)) {
|
||||||
return {
|
fs.mkdirSync(reportedDir, { recursive: true });
|
||||||
name: "Log directory",
|
|
||||||
status: "warn",
|
|
||||||
message: `Log directory does not exist: ${reportedDir}`,
|
|
||||||
canRepair: true,
|
|
||||||
repair: () => {
|
|
||||||
fs.mkdirSync(reportedDir, { recursive: true });
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -7,16 +7,7 @@ export function storageCheck(config: PaperclipConfig, configPath?: string): Chec
|
|||||||
if (config.storage.provider === "local_disk") {
|
if (config.storage.provider === "local_disk") {
|
||||||
const baseDir = resolveRuntimeLikePath(config.storage.localDisk.baseDir, configPath);
|
const baseDir = resolveRuntimeLikePath(config.storage.localDisk.baseDir, configPath);
|
||||||
if (!fs.existsSync(baseDir)) {
|
if (!fs.existsSync(baseDir)) {
|
||||||
return {
|
fs.mkdirSync(baseDir, { recursive: true });
|
||||||
name: "Storage",
|
|
||||||
status: "warn",
|
|
||||||
message: `Local storage directory does not exist: ${baseDir}`,
|
|
||||||
canRepair: true,
|
|
||||||
repair: () => {
|
|
||||||
fs.mkdirSync(baseDir, { recursive: true });
|
|
||||||
},
|
|
||||||
repairHint: "Run with --repair to create local storage directory",
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user