Rework config store with better file handling. Expand heartbeat-run command with richer output and error reporting. Improve configure and onboard commands. Update doctor checks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
949 B
TypeScript
33 lines
949 B
TypeScript
import { readConfig, configExists, resolveConfigPath } from "../config/store.js";
|
|
import type { CheckResult } from "./index.js";
|
|
|
|
export function configCheck(configPath?: string): CheckResult {
|
|
const filePath = resolveConfigPath(configPath);
|
|
|
|
if (!configExists(configPath)) {
|
|
return {
|
|
name: "Config file",
|
|
status: "fail",
|
|
message: `Config file not found at ${filePath}`,
|
|
canRepair: false,
|
|
repairHint: "Run `paperclip onboard` to create one",
|
|
};
|
|
}
|
|
|
|
try {
|
|
readConfig(configPath);
|
|
return {
|
|
name: "Config file",
|
|
status: "pass",
|
|
message: `Valid config at ${filePath}`,
|
|
};
|
|
} catch (err) {
|
|
return {
|
|
name: "Config file",
|
|
status: "fail",
|
|
message: `Invalid config: ${err instanceof Error ? err.message : String(err)}`,
|
|
canRepair: false,
|
|
repairHint: "Run `paperclip configure --section database` (or `paperclip onboard` to recreate)",
|
|
};
|
|
}
|
|
}
|