mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-17 03:10:38 +09:00
Improve CLI check path resolution and sticky agent detail tabs
Resolve relative paths in database and log checks against the config file directory with fallback candidates. Make the AgentDetail tab bar sticky with backdrop blur for better navigation on long pages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f9abab662c
commit
5a2703a86c
3 changed files with 37 additions and 11 deletions
|
|
@ -3,27 +3,40 @@ import path from "node:path";
|
|||
import type { PaperclipConfig } from "../config/schema.js";
|
||||
import type { CheckResult } from "./index.js";
|
||||
|
||||
export function logCheck(config: PaperclipConfig): CheckResult {
|
||||
const logDir = path.resolve(config.logging.logDir);
|
||||
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];
|
||||
}
|
||||
|
||||
export function logCheck(config: PaperclipConfig, configPath?: string): CheckResult {
|
||||
const logDir = resolveConfigRelativePath(config.logging.logDir, configPath);
|
||||
const reportedDir = logDir;
|
||||
|
||||
if (!fs.existsSync(logDir)) {
|
||||
return {
|
||||
name: "Log directory",
|
||||
status: "warn",
|
||||
message: `Log directory does not exist: ${logDir}`,
|
||||
message: `Log directory does not exist: ${reportedDir}`,
|
||||
canRepair: true,
|
||||
repair: () => {
|
||||
fs.mkdirSync(logDir, { recursive: true });
|
||||
fs.mkdirSync(reportedDir, { recursive: true });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
fs.accessSync(logDir, fs.constants.W_OK);
|
||||
fs.accessSync(reportedDir, fs.constants.W_OK);
|
||||
return {
|
||||
name: "Log directory",
|
||||
status: "pass",
|
||||
message: `Log directory is writable: ${logDir}`,
|
||||
message: `Log directory is writable: ${reportedDir}`,
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue