fix: use owner-level unidesk state
This commit is contained in:
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { createInterface } from "node:readline";
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { repoRoot } from "./config";
|
||||
import { rootPath } from "./config";
|
||||
import type { RenderedCliResult } from "./output";
|
||||
|
||||
type CodexTraceAction = "help" | "list" | "collect" | "show" | "grep" | "active";
|
||||
@@ -85,7 +85,7 @@ export function codexTraceHelp(): Record<string, unknown> {
|
||||
"bun scripts/cli.ts codex trace grep --session <id> --messages --pattern 'Playwright|web-probe'",
|
||||
"bun scripts/cli.ts codex trace grep --session <id> --failed-only [--tool exec_command]",
|
||||
"bun scripts/cli.ts codex trace grep --pattern 'playwright|auth-login-failed' [--file sessions/...jsonl] [--since ISO]",
|
||||
"bun scripts/cli.ts codex trace collect [--root ~/.codex] [--output .state/codex-trace/<timestamp>] [--limit 30]",
|
||||
"bun scripts/cli.ts codex trace collect [--root ~/.codex] [--output /root/.unidesk/.state/codex-trace/<timestamp>] [--limit 30]",
|
||||
"bun scripts/cli.ts codex trace show --session <id> [--root ~/.codex] [--tail-bytes 12000]",
|
||||
],
|
||||
safety: [
|
||||
@@ -97,7 +97,7 @@ export function codexTraceHelp(): Record<string, unknown> {
|
||||
],
|
||||
options: {
|
||||
"--root <dir>": "Codex home or another trace root. Defaults to ~/.codex.",
|
||||
"--output <dir>": "Collect destination. Defaults to .state/codex-trace/<timestamp>.",
|
||||
"--output <dir>": "Collect destination. Defaults to /root/.unidesk/.state/codex-trace/<timestamp>.",
|
||||
"--limit <n>": `Maximum included files, default ${defaultLimit}, max ${maxLimit}.`,
|
||||
"--max-depth <n>": `Recursive scan depth, default ${defaultMaxDepth}, max ${maxDepthLimit}.`,
|
||||
"--max-file-bytes <n|25MiB>": "Skip files larger than this during collect/list inclusion.",
|
||||
@@ -247,7 +247,7 @@ function codexTraceList(options: CodexTraceOptions, candidates: CodexTraceCandid
|
||||
|
||||
function codexTraceCollect(options: CodexTraceOptions, candidates: CodexTraceCandidate[]): Record<string, unknown> | RenderedCliResult {
|
||||
const selected = selectedCandidates(options, candidates);
|
||||
const outputDir = options.outputDir ?? path.join(repoRoot, ".state", "codex-trace", timestampForPath());
|
||||
const outputDir = options.outputDir ?? rootPath(".state", "codex-trace", timestampForPath());
|
||||
const copied: Record<string, unknown>[] = [];
|
||||
if (!options.dryRun) mkdirSync(outputDir, { recursive: true, mode: 0o700 });
|
||||
for (const candidate of selected) {
|
||||
|
||||
Reference in New Issue
Block a user