Files
paperclip/cli/src/checks/log-check.ts
Dotta a95e38485d 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>
2026-03-04 09:58:30 -06:00

31 lines
904 B
TypeScript

import fs from "node:fs";
import type { PaperclipConfig } from "../config/schema.js";
import type { CheckResult } from "./index.js";
import { resolveRuntimeLikePath } from "./path-resolver.js";
export function logCheck(config: PaperclipConfig, configPath?: string): CheckResult {
const logDir = resolveRuntimeLikePath(config.logging.logDir, configPath);
const reportedDir = logDir;
if (!fs.existsSync(logDir)) {
fs.mkdirSync(reportedDir, { recursive: true });
}
try {
fs.accessSync(reportedDir, fs.constants.W_OK);
return {
name: "Log directory",
status: "pass",
message: `Log directory is writable: ${reportedDir}`,
};
} catch {
return {
name: "Log directory",
status: "fail",
message: `Log directory is not writable: ${logDir}`,
canRepair: false,
repairHint: "Check file permissions on the log directory",
};
}
}