From 5a2703a86c97051d4abe2a72fe20c0ca64170800 Mon Sep 17 00:00:00 2001 From: Forgotten Date: Wed, 18 Feb 2026 16:47:15 -0600 Subject: [PATCH] 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 --- cli/src/checks/database-check.ts | 21 +++++++++++++++++---- cli/src/checks/log-check.ts | 25 +++++++++++++++++++------ ui/src/pages/AgentDetail.tsx | 2 +- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/cli/src/checks/database-check.ts b/cli/src/checks/database-check.ts index 27fc815e..2e5fa6e4 100644 --- a/cli/src/checks/database-check.ts +++ b/cli/src/checks/database-check.ts @@ -3,7 +3,19 @@ import path from "node:path"; import type { PaperclipConfig } from "../config/schema.js"; import type { CheckResult } from "./index.js"; -export async function databaseCheck(config: PaperclipConfig): Promise { +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 async function databaseCheck(config: PaperclipConfig, configPath?: string): Promise { if (config.database.mode === "postgres") { if (!config.database.connectionString) { return { @@ -36,15 +48,16 @@ export async function databaseCheck(config: PaperclipConfig): Promise { - fs.mkdirSync(dataDir, { recursive: true }); + fs.mkdirSync(reportedPath, { recursive: true }); }, }; } diff --git a/cli/src/checks/log-check.ts b/cli/src/checks/log-check.ts index 336811bd..804bfb90 100644 --- a/cli/src/checks/log-check.ts +++ b/cli/src/checks/log-check.ts @@ -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 { diff --git a/ui/src/pages/AgentDetail.tsx b/ui/src/pages/AgentDetail.tsx index 67bacce4..4cb4a674 100644 --- a/ui/src/pages/AgentDetail.tsx +++ b/ui/src/pages/AgentDetail.tsx @@ -363,7 +363,7 @@ export function AgentDetail() { {actionError &&

{actionError}

} -
+