caveat-cli 0.14.6 → 0.14.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  buildCodexSidecarReadOnlySmokeCommand,
11
11
  buildCodexSidecarRunCommand,
12
12
  caveatEntriesToSidecarContextBlocks,
13
+ cleanupStalePendingDirs,
13
14
  communityAdd,
14
15
  communityList,
15
16
  communityPull,
@@ -26,6 +27,7 @@ import {
26
27
  listStale,
27
28
  loadConfig,
28
29
  markHit,
30
+ maybeSweepPendingDirs,
29
31
  openDb,
30
32
  readCodexSessionSignals,
31
33
  readSessionSignals,
@@ -40,7 +42,7 @@ import {
40
42
  toolErrorReminderText,
41
43
  updateEntry,
42
44
  userPromptSubmitReminderText
43
- } from "./chunk-EH3S6X6X.js";
45
+ } from "./chunk-ECC5LJZF.js";
44
46
 
45
47
  // ../../node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js
46
48
  var require_code = __commonJS({
@@ -7070,6 +7072,17 @@ async function runInit(ctx, opts = { skipClaude: false, dryRun: false }) {
7070
7072
  } else {
7071
7073
  ctx.logger.info(`[dry-run] db path: ${ctx.paths.dbPath}`);
7072
7074
  }
7075
+ const staleDays = opts.pendingStaleDays ?? 7;
7076
+ if (opts.dryRun) {
7077
+ ctx.logger.info(`[dry-run] would sweep pending dirs older than ${staleDays}d`);
7078
+ } else {
7079
+ const swept = cleanupStalePendingDirs(ctx.caveatHome, { staleDays });
7080
+ if (swept.removed.length > 0) {
7081
+ ctx.logger.info(
7082
+ `pending dirs swept: removed ${swept.removed.length} (kept ${swept.kept}, threshold ${staleDays}d)`
7083
+ );
7084
+ }
7085
+ }
7073
7086
  ctx.logger.info(
7074
7087
  "tip: subscribe to a group repo with `caveat community add <github-url>`, then `caveat pull`."
7075
7088
  );
@@ -7345,7 +7358,7 @@ function runStats(ctx) {
7345
7358
 
7346
7359
  // src/commands/serve.ts
7347
7360
  async function runServe(opts) {
7348
- const { startServer } = await import("./server-RWVXGVXK.js");
7361
+ const { startServer } = await import("./server-YQ4DJ2H7.js");
7349
7362
  const { port, host } = startServer({ port: opts.port });
7350
7363
  process.stdout.write(`[caveat] web portal: http://${host}:${port}/
7351
7364
  `);
@@ -32050,12 +32063,15 @@ function runCodexSidecarAdvisory(input) {
32050
32063
  return { status: "failed", message: "current Caveat CLI script path is unavailable" };
32051
32064
  }
32052
32065
  const args = [
32066
+ ...process.execArgv,
32053
32067
  "--disable-warning=ExperimentalWarning",
32054
32068
  cliScript,
32055
32069
  "codex-sidecar",
32056
32070
  "run",
32057
32071
  "explore",
32058
32072
  input.prompt,
32073
+ "--preset",
32074
+ "advisory",
32059
32075
  "--query",
32060
32076
  input.searchText,
32061
32077
  "--limit",
@@ -32161,6 +32177,11 @@ async function runHook(name, arg) {
32161
32177
  process.exit(0);
32162
32178
  }
32163
32179
  if (name === "stop") {
32180
+ try {
32181
+ const ctx = buildContextSafely();
32182
+ if (ctx) maybeSweepPendingDirs(ctx.caveatHome);
32183
+ } catch {
32184
+ }
32164
32185
  if (payload.stop_hook_active === true) process.exit(0);
32165
32186
  const transcriptPath = typeof payload.transcript_path === "string" ? payload.transcript_path : "";
32166
32187
  const signals = transcriptPath ? loadSignalsSafely(transcriptPath) : null;
@@ -33046,13 +33067,26 @@ var program = new Command();
33046
33067
  program.name("caveat").description("External spec gotcha knowledge base CLI").version(CAVEAT_VERSION);
33047
33068
  program.command("init").description(
33048
33069
  "Initialize ~/.caveatrc.json, ~/.caveat/, and register Claude Code integration. Add knowledge sources later with `caveat community add <github-url>`."
33049
- ).option("--skip-claude", "skip Claude Code MCP + hook registration", false).option("--dry-run", "show planned changes without writing", false).action(async (opts) => {
33050
- const ctx = buildContext(stdoutLogger);
33051
- await runInit(ctx, {
33052
- skipClaude: opts.skipClaude,
33053
- dryRun: opts.dryRun
33054
- });
33055
- });
33070
+ ).option("--skip-claude", "skip Claude Code MCP + hook registration", false).option("--dry-run", "show planned changes without writing", false).option(
33071
+ "--pending-stale-days <days>",
33072
+ "sweep `<caveatHome>/pending/<sessionId>/` whose newest entry is older than this (default 7)",
33073
+ (raw) => {
33074
+ const n = Number.parseInt(raw, 10);
33075
+ if (!Number.isFinite(n) || n < 0) {
33076
+ throw new Error(`--pending-stale-days expects a non-negative integer (got "${raw}")`);
33077
+ }
33078
+ return n;
33079
+ }
33080
+ ).action(
33081
+ async (opts) => {
33082
+ const ctx = buildContext(stdoutLogger);
33083
+ await runInit(ctx, {
33084
+ skipClaude: opts.skipClaude,
33085
+ dryRun: opts.dryRun,
33086
+ pendingStaleDays: opts.pendingStaleDays
33087
+ });
33088
+ }
33089
+ );
33056
33090
  program.command("uninstall").description("Remove Claude Code MCP server and hooks registered by `caveat init`").option("--dry-run", "show planned changes without writing", false).action((opts) => {
33057
33091
  const ctx = buildContext(stdoutLogger);
33058
33092
  runUninstall(ctx, { dryRun: opts.dryRun });