@aragon-agent/cli 0.6.77 → 0.6.79

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.
Files changed (93) hide show
  1. package/README.md +89 -21
  2. package/dist/agent/controller.d.ts +36 -0
  3. package/dist/agent/controller.js +108 -0
  4. package/dist/agent/system-prompt.d.ts +10 -0
  5. package/dist/agent/system-prompt.js +6 -0
  6. package/dist/app/App.js +108 -27
  7. package/dist/app/index-console.d.ts +59 -0
  8. package/dist/app/index-console.js +99 -0
  9. package/dist/cli.js +80 -4
  10. package/dist/commands/builtins.js +4 -2
  11. package/dist/commands/catalog.js +7 -1
  12. package/dist/commands/index-build.js +10 -1
  13. package/dist/commands/index-command.d.ts +43 -0
  14. package/dist/commands/index-command.js +244 -0
  15. package/dist/commands/index-copy.d.ts +50 -0
  16. package/dist/commands/index-copy.js +82 -0
  17. package/dist/commands/kit-command.d.ts +10 -0
  18. package/dist/commands/kit-command.js +8 -2
  19. package/dist/commands/kits-command.d.ts +35 -0
  20. package/dist/commands/kits-command.js +137 -0
  21. package/dist/commands/registry.d.ts +10 -0
  22. package/dist/compaction/memory-agent.js +61 -0
  23. package/dist/config/env.d.ts +30 -0
  24. package/dist/config/env.js +47 -0
  25. package/dist/config/launch-notice.d.ts +61 -0
  26. package/dist/config/launch-notice.js +138 -0
  27. package/dist/config/load.d.ts +20 -0
  28. package/dist/config/load.js +72 -2
  29. package/dist/diagnostics/info.d.ts +28 -0
  30. package/dist/diagnostics/info.js +41 -0
  31. package/dist/exec/cli-commands.d.ts +24 -0
  32. package/dist/exec/cli-commands.js +48 -1
  33. package/dist/exec/index.js +9 -0
  34. package/dist/exec/options.d.ts +12 -0
  35. package/dist/host/index-build.d.ts +38 -7
  36. package/dist/host/index-build.js +74 -20
  37. package/dist/indexer/commit.d.ts +77 -0
  38. package/dist/indexer/commit.js +145 -0
  39. package/dist/indexer/discover.d.ts +50 -0
  40. package/dist/indexer/discover.js +147 -0
  41. package/dist/indexer/engine.d.ts +51 -0
  42. package/dist/indexer/engine.js +477 -0
  43. package/dist/indexer/errors.d.ts +62 -0
  44. package/dist/indexer/errors.js +86 -0
  45. package/dist/indexer/finalize.d.ts +30 -0
  46. package/dist/indexer/finalize.js +19 -0
  47. package/dist/indexer/fingerprint.d.ts +41 -0
  48. package/dist/indexer/fingerprint.js +49 -0
  49. package/dist/indexer/ignore.d.ts +59 -0
  50. package/dist/indexer/ignore.js +140 -0
  51. package/dist/indexer/index.d.ts +21 -0
  52. package/dist/indexer/index.js +21 -0
  53. package/dist/indexer/l0.d.ts +55 -0
  54. package/dist/indexer/l0.js +168 -0
  55. package/dist/indexer/limits.d.ts +75 -0
  56. package/dist/indexer/limits.js +106 -0
  57. package/dist/indexer/link.d.ts +68 -0
  58. package/dist/indexer/link.js +220 -0
  59. package/dist/indexer/lock.d.ts +115 -0
  60. package/dist/indexer/lock.js +270 -0
  61. package/dist/indexer/parse.d.ts +68 -0
  62. package/dist/indexer/parse.js +163 -0
  63. package/dist/indexer/paths.d.ts +99 -0
  64. package/dist/indexer/paths.js +198 -0
  65. package/dist/indexer/plan.d.ts +48 -0
  66. package/dist/indexer/plan.js +80 -0
  67. package/dist/indexer/rank.d.ts +42 -0
  68. package/dist/indexer/rank.js +125 -0
  69. package/dist/indexer/read/cache.d.ts +28 -0
  70. package/dist/indexer/read/cache.js +54 -0
  71. package/dist/indexer/read/query.d.ts +48 -0
  72. package/dist/indexer/read/query.js +361 -0
  73. package/dist/indexer/scanner/extract.d.ts +36 -0
  74. package/dist/indexer/scanner/extract.js +134 -0
  75. package/dist/indexer/scanner/mask.d.ts +44 -0
  76. package/dist/indexer/scanner/mask.js +198 -0
  77. package/dist/indexer/scanner/py-extract.d.ts +29 -0
  78. package/dist/indexer/scanner/py-extract.js +164 -0
  79. package/dist/indexer/scanner/refs.d.ts +31 -0
  80. package/dist/indexer/scanner/refs.js +116 -0
  81. package/dist/indexer/scanner/ts-extract.d.ts +39 -0
  82. package/dist/indexer/scanner/ts-extract.js +277 -0
  83. package/dist/indexer/store.d.ts +88 -0
  84. package/dist/indexer/store.js +309 -0
  85. package/dist/indexer/tools.d.ts +120 -0
  86. package/dist/indexer/tools.js +132 -0
  87. package/dist/indexer/types.d.ts +225 -0
  88. package/dist/indexer/types.js +44 -0
  89. package/dist/indexer/wiring.d.ts +45 -0
  90. package/dist/indexer/wiring.js +42 -0
  91. package/dist/tools/index.d.ts +16 -2
  92. package/dist/tools/index.js +23 -0
  93. package/package.json +3 -3
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The index console's side effects, kept OUT of `App.tsx` (spec 6.4 / R7).
3
+ *
4
+ * WHY THIS MODULE EXISTS: `App.tsx` is a documented oversize file and the
5
+ * convention it records is that a feature only WIRES into it. Everything that
6
+ * calls the engine - reading status before the first paint, starting a build,
7
+ * aborting one, turning a batch event into a reducer action - lives here, so the
8
+ * App holds one reducer and four one-line callbacks.
9
+ *
10
+ * THE TWO RULES ENCODED HERE:
11
+ *
12
+ * 1. A build started by this process owns an `AbortController`; `Esc` aborts it.
13
+ * A build owned by ANOTHER process has no controller here, so `Esc` only closes
14
+ * the panel and says who is building (spec P1-5: one rule, no second dialog).
15
+ * 2. Progress is reduced, never accumulated: the engine emits a full snapshot per
16
+ * batch and `reduceIndexPanel` merges it, so a dropped frame cannot make the bar
17
+ * walk backwards.
18
+ *
19
+ * ASCII ONLY: `app/**` is inside the glyph scanner's scope.
20
+ */
21
+ import type { IndexResult } from '@aragon-agent/tui/model/index-build/types';
22
+ import type { IndexConfig } from '@aragon-agent/tui/model/index-build/config';
23
+ import { renderL0 } from '../indexer/l0.js';
24
+ import { idleState, type IndexPanelEvent, type IndexPanelState } from '@aragon-agent/tui/ui/overlays/index-panel-state';
25
+ /** What the adapter needs from the App, all plain values or callbacks. */
26
+ export interface IndexConsoleDeps {
27
+ /** Working directory of this session. */
28
+ readonly cwd: string;
29
+ /** Live, clamped index config. */
30
+ readonly config: Partial<IndexConfig>;
31
+ /** Send one reducer action. */
32
+ readonly send: (event: IndexPanelEvent) => void;
33
+ /** One user-visible line. */
34
+ readonly notify: (level: 'info' | 'warn' | 'error', text: string) => void;
35
+ /** Structured log sink (the CLI logger, never a new channel). */
36
+ readonly log: (event: string, fields?: Record<string, unknown>) => void;
37
+ /** True when no model is configured, which makes the prose stage unavailable. */
38
+ readonly proseUnavailable: boolean;
39
+ }
40
+ /** Open the console: read the current status first, so the first paint is complete (HCI rule 7). */
41
+ export declare function openIndexConsole(deps: IndexConsoleDeps, confirmOnBuild: boolean): Promise<void>;
42
+ /**
43
+ * Start a build and stream its progress into the reducer.
44
+ *
45
+ * `signal` is owned by the caller so `Esc` can abort it; the controller is passed
46
+ * back through `onStart` so the App can keep it for the cancel path.
47
+ */
48
+ export declare function startIndexBuild(deps: IndexConsoleDeps, options: {
49
+ readonly astOnly: boolean;
50
+ readonly runId: string;
51
+ readonly signal: AbortSignal;
52
+ readonly reason: 'key' | 'command' | 'host';
53
+ }): Promise<IndexResult>;
54
+ /** Render the completion card. Kept here so the App learns nothing about formatting. */
55
+ export declare function resultCardLines(result: Extract<IndexResult, {
56
+ ok: true;
57
+ }>): readonly string[];
58
+ /** Re-exported so the App imports one module for the console's data shapes. */
59
+ export { idleState, renderL0, type IndexPanelEvent, type IndexPanelState };
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The index console's side effects, kept OUT of `App.tsx` (spec 6.4 / R7).
3
+ *
4
+ * WHY THIS MODULE EXISTS: `App.tsx` is a documented oversize file and the
5
+ * convention it records is that a feature only WIRES into it. Everything that
6
+ * calls the engine - reading status before the first paint, starting a build,
7
+ * aborting one, turning a batch event into a reducer action - lives here, so the
8
+ * App holds one reducer and four one-line callbacks.
9
+ *
10
+ * THE TWO RULES ENCODED HERE:
11
+ *
12
+ * 1. A build started by this process owns an `AbortController`; `Esc` aborts it.
13
+ * A build owned by ANOTHER process has no controller here, so `Esc` only closes
14
+ * the panel and says who is building (spec P1-5: one rule, no second dialog).
15
+ * 2. Progress is reduced, never accumulated: the engine emits a full snapshot per
16
+ * batch and `reduceIndexPanel` merges it, so a dropped frame cannot make the bar
17
+ * walk backwards.
18
+ *
19
+ * ASCII ONLY: `app/**` is inside the glyph scanner's scope.
20
+ */
21
+ import { createIndexer } from '../indexer/wiring.js';
22
+ import { renderL0 } from '../indexer/l0.js';
23
+ import { formatResultCard } from '@aragon-agent/tui/model/index-build/format';
24
+ import { foreignBuildNotice, idleState, } from '@aragon-agent/tui/ui/overlays/index-panel-state';
25
+ /** Open the console: read the current status first, so the first paint is complete (HCI rule 7). */
26
+ export async function openIndexConsole(deps, confirmOnBuild) {
27
+ const probe = createIndexer({ cwd: deps.cwd, config: deps.config, log: deps.log });
28
+ let status;
29
+ try {
30
+ status = await probe.engine.status();
31
+ }
32
+ catch {
33
+ // An unreadable artifact is exactly the situation the panel exists to explain:
34
+ // open with no status rather than refusing to open.
35
+ status = undefined;
36
+ }
37
+ deps.send({
38
+ type: 'open',
39
+ ...(status ? { status } : {}),
40
+ proseUnavailable: deps.proseUnavailable,
41
+ confirmOnBuild,
42
+ });
43
+ }
44
+ /**
45
+ * Start a build and stream its progress into the reducer.
46
+ *
47
+ * `signal` is owned by the caller so `Esc` can abort it; the controller is passed
48
+ * back through `onStart` so the App can keep it for the cancel path.
49
+ */
50
+ export async function startIndexBuild(deps, options) {
51
+ const { engine } = createIndexer({ cwd: deps.cwd, config: deps.config, log: deps.log });
52
+ const result = await engine.build({
53
+ astOnly: options.astOnly,
54
+ reason: options.reason,
55
+ signal: options.signal,
56
+ onProgress: (progress) => deps.send({ type: 'progress', progress }),
57
+ });
58
+ if (result.ok) {
59
+ deps.send({ type: 'done', resultLines: resultCardLines(result) });
60
+ }
61
+ else if (result.code === 'E_INDEX_CANCELLED') {
62
+ deps.send({ type: 'cancelled' });
63
+ }
64
+ else if (result.code === 'E_INDEX_BUSY') {
65
+ // The lock belonged to someone else: our build never started, so the panel
66
+ // closes with the holder named instead of pretending we were cancelled.
67
+ deps.send({ type: 'give-up', notice: busyNotice(result.message) });
68
+ }
69
+ else {
70
+ deps.send({ type: 'failed', error: `${result.code}: ${result.message}` });
71
+ }
72
+ return result;
73
+ }
74
+ /** Render the completion card. Kept here so the App learns nothing about formatting. */
75
+ export function resultCardLines(result) {
76
+ return formatResultCard({
77
+ generation: result.generation,
78
+ files: result.files,
79
+ symbols: result.symbols,
80
+ refs: result.refs,
81
+ durationMs: result.durationMs,
82
+ failures: result.failures,
83
+ ...(result.reparsed !== undefined ? { reparsed: result.reparsed } : {}),
84
+ ...(result.unchanged === true ? { unchanged: true } : {}),
85
+ ...(result.reparsed !== undefined && result.files >= result.reparsed
86
+ ? { reused: result.files - result.reparsed }
87
+ : {}),
88
+ });
89
+ }
90
+ /**
91
+ * The sentence shown when the lock is held elsewhere. The engine's own message is
92
+ * already actionable; this only guarantees the pid-bearing wording from spec 5.9.
93
+ */
94
+ function busyNotice(message) {
95
+ const pid = /\bpid (\d+)\b/.exec(message)?.[1];
96
+ return pid ? foreignBuildNotice(Number.parseInt(pid, 10)) : message;
97
+ }
98
+ /** Re-exported so the App imports one module for the console's data shapes. */
99
+ export { idleState, renderL0 };
package/dist/cli.js CHANGED
@@ -19,6 +19,8 @@ import { getRedTeamWaiverVersion, isRedTeamEnvOff } from './config/ui-state.js';
19
19
  import { COMPACTION_CONFIG_SET_KEYS, FAST_CONFIG_SET_KEYS, LOG_CONFIG_SET_KEYS, RETRY_CONFIG_SET_KEYS, TEAM_CONFIG_SET_KEYS, GOVERNANCE_CONFIG_SET_KEYS, MEMORY_CONFIG_SET_KEYS, applyMemoryConfigSet, GENE_CONFIG_SET_KEYS, applyGeneConfigSet, JOBS_CONFIG_SET_KEYS, TASK_SUMMARY_CONFIG_SET_KEYS, UPDATE_CONFIG_SET_KEYS, applyCompactionConfigSet, applyFastConfigSet, applyLogConfigSet, applyRetryConfigSet, applyTeamConfigSet, applyGovernanceConfigSet, applyJobsConfigSet, applyTaskSummaryConfigSet, applyUpdateConfigSet, runConfigEdit, runConfigGet, runConfigHome, runConfigList, warnIfRedactionDisabled, } from './config/cli-commands.js';
20
20
  import { attachAgentEvents, attachTeamEvents, installLogging, setScreenRestore, setSignalTerminator, } from './logging/install.js';
21
21
  import { getLogger } from './logging/logger.js';
22
+ import { formatLaunchNotice, shouldAnnounce } from './config/launch-notice.js';
23
+ import { isKitFlagConflict } from '@aragon-agent/tui/model/config/launch-selection';
22
24
  import { runLogsCommand } from './logging/cli-commands.js';
23
25
  import { ADAPTER_PROVIDERS, clampDensity, clampTheme, clampThinkingLevel, clampHumanTimeout, clampSkillsIntegrity, clampSkillsToolPolicy, clampContextWindow, clampMaxRenderInterval, clampScrollMode, clampScrollResumeMs, clampTranscriptRetain, clampTranscriptWindow, coercePositiveInt, isAdapterProvider, isAutoToken, parseMaxTokensInput, RETIRED_CONFIG_KEYS, DEFAULT_MAX_RENDER_INTERVAL_MS, DEFAULT_MAX_TOKENS, DEFAULT_PLAN_HUMAN_TIMEOUT_MS, DEFAULT_SCROLL_MODE, DEFAULT_SCROLL_RESUME_MS, DEFAULT_SKILLS_CONFIG, DEFAULT_TRANSCRIPT_RETAIN, DEFAULT_TRANSCRIPT_WINDOW, toRunResumePolicy, } from '@aragon-agent/tui/model/config/schema';
24
26
  import { makeGetApiKey } from './config/load.js';
@@ -32,6 +34,7 @@ import { registerExecCommand } from './exec/cli-commands.js';
32
34
  import { registerSessionsCommand } from './session/cli-commands.js';
33
35
  import { registerGeneCliCommand } from './gene/cli-commands.js';
34
36
  import { registerDoctorCommand, registerInfoCommand } from './diagnostics/cli-commands.js';
37
+ import { registerKitsCommand } from './commands/kits-command.js';
35
38
  import { App } from './app/App.js';
36
39
  import { createSessionWriter, makeController, readCliVersion, } from './host/controller-factory.js';
37
40
  import { readSessionView, publishSessionView } from './app/session-bridge.js';
@@ -160,6 +163,21 @@ function toFlags(opts) {
160
163
  // here; miss this one and the flag is inert with no compile or runtime error.
161
164
  retry: opts.retry,
162
165
  retryMax: opts.retryMax,
166
+ // Site three of four for the six launch-selection flags (3.6). The pair on
167
+ // the first two lines is ONE commander option: `--no-kit` arrives folded as
168
+ // `kit: false`, so the split happens here rather than in a field that could
169
+ // never be populated. All six are LAUNCH-ONLY, so unlike `--fast`/
170
+ // `--update` there is no persisted value for a default to overwrite.
171
+ kit: typeof opts.kit === 'string' ? opts.kit : undefined,
172
+ noKit: opts.kit === false ? true : undefined,
173
+ // C-3: the ONE fact commander destroys. \`--kit a --no-kit\` parses to the same
174
+ // \`kit: false\` as a lone \`--no-kit\`, so the pair is undetectable from options
175
+ // and is read from argv instead.
176
+ kitConflict: isKitFlagConflict(process.argv) ? true : undefined,
177
+ profile: opts.profile,
178
+ fastProfile: opts.fastProfile,
179
+ subagentModel: opts.subagentModel,
180
+ subagentProfile: opts.subagentProfile,
163
181
  // Site three of three for the four `--fast*` flags — SIX features, one trap
164
182
  // (`mouse` P1-2, `team` P1-4, `todo` C-9, render L4, retry, now fast). It
165
183
  // bites hardest here: the tier is OFF by default, so a missing line would
@@ -385,6 +403,37 @@ function forceVtInputForThisConsole() {
385
403
  * and between it and `render()` there is no other suspension point, so making the
386
404
  * function async introduces no new interleaving.
387
405
  */
406
+ /**
407
+ * Turn a refused launch selection into the documented exit `2` (2.4 / P1-2).
408
+ *
409
+ * WHY THIS IS NOT A THROW: `loadConfig()` runs inside the commander action, so a
410
+ * throw would print a stack trace where the exit-code table promises ONE sentence
411
+ * and an empty stdout. It is also why `--kit` / `--no-kit` use no
412
+ * `.conflictsWith()`: commander answers a conflict with exit 1, and 2 is the code
413
+ * `exit-codes.mjs` already defines as "usage or session error, empty stdout".
414
+ *
415
+ * Returns `true` when the caller must stop before creating a controller.
416
+ */
417
+ function failOnLaunchFatal(config) {
418
+ if (!config.launchFatal)
419
+ return false;
420
+ process.stderr.write(`${config.launchFatal.message}\n`);
421
+ process.exitCode = 2;
422
+ return true;
423
+ }
424
+ /**
425
+ * Print the "Kit applied" line, once, on stderr (2.5).
426
+ *
427
+ * STDERR, ALWAYS: `-p` and `exec` keep stdout for the answer and for NDJSON, and
428
+ * the notice is a human aside. Two independent gates keep a pipe clean without
429
+ * anyone remembering a flag - `--quiet`, and a non-TTY stdout.
430
+ */
431
+ function announceLaunchSelection(config, quiet) {
432
+ const notice = formatLaunchNotice(config.launchSelection, process.stdout.columns);
433
+ if (!shouldAnnounce({ quiet, isTTY: Boolean(process.stdout.isTTY), notice }))
434
+ return;
435
+ process.stderr.write(`${notice}\n`);
436
+ }
388
437
  async function runInteractive(flags, extras = {}) {
389
438
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
390
439
  process.stderr.write('Interactive UI requires a TTY. Use -p "<prompt>", exec, or config list / config set.\n');
@@ -430,6 +479,11 @@ async function runInteractive(flags, extras = {}) {
430
479
  const redTeamResumeNotice = startup.apply(controller);
431
480
  void controller.refreshModelMetadata();
432
481
  const config = controller.getConfig();
482
+ if (failOnLaunchFatal(config)) {
483
+ controller.dispose();
484
+ return;
485
+ }
486
+ announceLaunchSelection(config, extras.quiet === true);
433
487
  const caps = resolveTuiCapabilities({}, config.color);
434
488
  const logger = getLogger();
435
489
  const scrollMode = config.scrollMode ?? DEFAULT_SCROLL_MODE;
@@ -1299,6 +1353,11 @@ async function runOneShot(flags, prompt, quiet) {
1299
1353
  // install. The gate must know that up front rather than discovering a null
1300
1354
  // handler and defaulting to "yes" (§7.4 / AC-13).
1301
1355
  const { controller } = makeController(flags, { interactive: false });
1356
+ if (failOnLaunchFatal(controller.getConfig())) {
1357
+ controller.dispose();
1358
+ return;
1359
+ }
1360
+ announceLaunchSelection(controller.getConfig(), quiet);
1302
1361
  startup.apply(controller);
1303
1362
  void controller.refreshModelMetadata();
1304
1363
  const logger = getLogger();
@@ -2062,6 +2121,19 @@ function buildProgram() {
2062
2121
  .option('--provider <id>', 'anthropic | openai | google')
2063
2122
  .option('--model <id>', 'Model id')
2064
2123
  .option('--base-url <url>', 'Override the provider base URL')
2124
+ // --- launch-time model / kit selection (launch-model-and-kit-flags 4.1) ---
2125
+ // `--kit` takes the whole three-slot package for THIS session; the single
2126
+ // slot flags below outrank it, because "use cheap, but I have my own main
2127
+ // model" is what a user means when they type both (2.2).
2128
+ .option('--kit <name|#id|id>', 'Run this session on that kit (dev pack); not saved')
2129
+ // DELIBERATELY NOT `.conflictsWith()`: commander's conflict error exits 1,
2130
+ // while 2.4 promises exit 2 with an empty stdout (P1-2). The exclusion is
2131
+ // checked by `resolveLaunchSelection` and mapped by `failOnLaunchFatal`.
2132
+ .option('--no-kit', 'Ignore the saved default kit for this session')
2133
+ .option('--profile <name|#id|id>', 'Main slot: use a saved connection')
2134
+ .option('--fast-profile <name|#id|id>', 'Fast slot: use a saved connection')
2135
+ .option('--subagent-model <main|fast|profile>', 'Subagent slot: how it picks a model')
2136
+ .option('--subagent-profile <name|#id|id>', 'Subagent slot: connection for profile mode')
2065
2137
  .option('--managed-config', 'Use saved Aragon connections and keys; skip project .env and inherited model credentials')
2066
2138
  .option('--api-key <key>', 'One-shot API key override (not persisted)')
2067
2139
  .option('--thinking <level>', 'off|minimal|low|medium|high|xhigh')
@@ -2070,7 +2142,7 @@ function buildProgram() {
2070
2142
  .option('--confirm', 'Confirm each mutating tool call')
2071
2143
  .option('--tool-timeout <ms>', 'Per-tool executor ceiling (default 180000)')
2072
2144
  .option('--idle-timeout <ms>', 'Watchdog idle timeout (auto-raised to >= tool-timeout+30s)')
2073
- .option('--theme <name>', 'auto|warm|cool|light ("dark" is an alias for "cool")')
2145
+ .option('--theme <name>', 'auto|cool|graphite|oat|warm|light ("dark" is an alias for "cool")')
2074
2146
  .option('--compact', 'Compact transcript density (no blank rows between turns)')
2075
2147
  .option('--no-compact', 'Comfortable transcript density')
2076
2148
  .option('--hints', 'Always show the composer hint row')
@@ -2215,7 +2287,7 @@ function buildProgram() {
2215
2287
  .option('--sync-output', 'Ask the terminal to present each repaint atomically (the default)')
2216
2288
  .option('--no-sync-output', 'Do not emit DEC 2026 begin/end synchronized update')
2217
2289
  .option('--no-color', 'Disable ANSI color')
2218
- .option('--quiet', '(print mode) suppress tool/usage lines on stderr')
2290
+ .option('--quiet', 'Suppress non-essential stderr notices (tool lines, launch notice)')
2219
2291
  .action(async (prompt, opts) => {
2220
2292
  const flags = toFlags(opts);
2221
2293
  const piped = !process.stdin.isTTY;
@@ -2244,7 +2316,7 @@ function buildProgram() {
2244
2316
  }
2245
2317
  return;
2246
2318
  }
2247
- void runInteractive(flags, { initialPrompt: prompt });
2319
+ void runInteractive(flags, { initialPrompt: prompt, quiet: !!opts.quiet });
2248
2320
  });
2249
2321
  program.hook('preAction', (root) => {
2250
2322
  if (root.opts().managedConfig)
@@ -2297,7 +2369,7 @@ function buildProgram() {
2297
2369
  .command('config')
2298
2370
  .description('Open the settings screen')
2299
2371
  .action(() => {
2300
- void runInteractive(toFlags(program.opts()), { initialOverlay: 'settings' });
2372
+ void runInteractive(toFlags(program.opts()), { initialOverlay: 'settings', quiet: !!program.opts().quiet });
2301
2373
  });
2302
2374
  configCmd
2303
2375
  .command('set <key> <value>')
@@ -2411,6 +2483,10 @@ function buildProgram() {
2411
2483
  registerGeneCliCommand(program);
2412
2484
  registerInfoCommand(program, toFlags, VERSION);
2413
2485
  registerDoctorCommand(program, toFlags);
2486
+ // `aragon kits list | show` (launch-model-and-kit-flags 3.11): the
2487
+ // discoverability half of `--kit`, so the feature is not locked inside the
2488
+ // TUI. Read-only by design - no `set-default`, no `rm` (R-3).
2489
+ registerKitsCommand(program, toFlags);
2414
2490
  return program;
2415
2491
  }
2416
2492
  async function main() {
@@ -24,6 +24,7 @@ import { runSessionCommand } from './session-command.js';
24
24
  import { runBranchCommand } from './branch-command.js';
25
25
  import { getLogger } from '../logging/logger.js';
26
26
  import { registerQueueCommand } from './queue-command.js';
27
+ import { registerIndexCommand } from './index-command.js';
27
28
  import { registerRetryCommand } from './retry-command.js';
28
29
  import { registerPromptCommands } from '../prompts/command.js';
29
30
  import { registerMemoryCommands } from '../memory/command.js';
@@ -357,12 +358,12 @@ const COMMANDS = [
357
358
  },
358
359
  {
359
360
  name: 'theme',
360
- description: 'Switch the color theme (auto|warm|cool|light)',
361
+ description: 'Switch the color theme (auto|cool|graphite|oat|warm|light)',
361
362
  run: (ctx) => {
362
363
  const arg = ctx.args.trim().toLowerCase();
363
364
  const current = ctx.controller.getConfig().theme;
364
365
  if (!arg) {
365
- ctx.notify('info', `Theme: ${current}. Use /theme <auto|warm|cool|light>.`);
366
+ ctx.notify('info', `Theme: ${current}. Use /theme <auto|cool|graphite|oat|warm|light>.`);
366
367
  return;
367
368
  }
368
369
  // Validate BEFORE clamping. The old `arg !== clampTheme(arg)` test would
@@ -1313,6 +1314,7 @@ export function registerBuiltinCommands(registry) {
1313
1314
  for (const command of COMMANDS)
1314
1315
  registry.register(command);
1315
1316
  registerQueueCommand(registry);
1317
+ registerIndexCommand(registry);
1316
1318
  // The command BODY lives in its own module (builtins.ts is already 1.5k lines);
1317
1319
  // this line is the whole registration (agent-model-kits §4.9).
1318
1320
  registerKitCommand(registry);
@@ -15,7 +15,7 @@ export const BUILTIN_COMMAND_CATALOG = [
15
15
  { name: 'settings', aliases: [], description: 'Open the settings screen' },
16
16
  { name: 'thinking', aliases: [], description: 'Set the thinking level' },
17
17
  { name: 'max-tokens', aliases: [], description: 'Show or set the output token cap (<n> | auto | default)' },
18
- { name: 'theme', aliases: [], description: 'Switch the color theme (auto|warm|cool|light)' },
18
+ { name: 'theme', aliases: [], description: 'Switch the color theme (auto|cool|graphite|oat|warm|light)' },
19
19
  { name: 'plan', aliases: [], description: 'Toggle plan mode (on | off | status)' },
20
20
  { name: 'fast', aliases: [], description: 'Fast model tier: status | on | off | model <id> | provider <id> | same | review <n|off> | budget <n>' },
21
21
  { name: 'update', aliases: [], description: 'Auto-update: status | now | skip | off' },
@@ -45,6 +45,12 @@ export const BUILTIN_COMMAND_CATALOG = [
45
45
  { name: 'prompts', aliases: [], description: 'Quick prompt library: pick, list, add, edit, remove, reorder' },
46
46
  { name: 'memory', aliases: ['mem'], description: 'Memory manager: list, save, show, remove, mount, auto-load, agent writes, undo' },
47
47
  { name: 'gene', aliases: ['genes'], description: 'Gene Bank: status, search, show, explain, pin, archive, rollback, queue, stats, export, import, import-memory' },
48
+ // tui-ctrl-i-ast-index 6.4: the deterministic AST index console (`Ctrl+I` / `Alt+I` / `/index`).
49
+ // The description is a LITERAL for the reason this file's header gives - it is pure data served to
50
+ // the host composer menu, and importing the command module would drag the indexer into that
51
+ // closure. `command-catalog.test.ts` compares this string against the registry byte for byte, so
52
+ // the two cannot drift. Aliases stay empty: `/idx` would be a second name for a destructive verb.
53
+ { name: 'index', aliases: [], description: 'Project index: status | rebuild | clean | open [ast] | on | off | confirm on|off' },
48
54
  { name: 'agents', aliases: [], description: 'Open the subagent board: every child, its facts and its timeline' },
49
55
  { name: 'subagent', aliases: [], description: 'Deprecated alias of /team - same arguments' },
50
56
  {
@@ -61,8 +61,17 @@ export function buildIndexConfirmSummary(input) {
61
61
  const existing = input.hasExistingIndex
62
62
  ? '\nThe existing .claude-index/config.md preferences are reused.'
63
63
  : '\nThe bundled skill asks a few configuration questions first.';
64
+ // THE EXISTING SENTENCES STAY VERBATIM (spec R12: a pre-existing assertion is never
65
+ // relaxed), and the AST stage is DISCLOSED AHEAD OF THEM (spec 6.4 / AC-26). Before this
66
+ // line the dialog named only index.md / config.md / CLAUDE.md / AGENTS.md, which stopped
67
+ // describing what a build writes once the deterministic engine added
68
+ // `.claude-index/ast/generations/<n>/` and the `current` pointer.
64
69
  return (`${action} the project index for this workspace?\n` +
65
- `\nRuns the bundled "${INDEX_SKILL_NAME}" skill as a normal agent turn:` +
70
+ `\nFirst, the deterministic AST index (no model, a few seconds):` +
71
+ `\n- writes .claude-index/ast/generations/<n>/ (symbols, references, imports, file graph)` +
72
+ `\n- moves .claude-index/ast/current only after a complete, verified build` +
73
+ `\n- a failed or cancelled build leaves the previous index untouched` +
74
+ `\nThen the bundled "${INDEX_SKILL_NAME}" skill as a normal agent turn:` +
66
75
  `\n- scans the workspace (exclusions apply), extracts exported symbols` +
67
76
  `\n- writes .claude-index/index.md and .claude-index/config.md` +
68
77
  `\n- writes matching CLAUDE.md and AGENTS.md (project index + optional Clean Code Guidelines)` +
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `/index`: the slash-command family for the deterministic AST index (spec 7.1).
3
+ *
4
+ * THREE ENTRY POINTS, ONE ENGINE. `Ctrl+I` / `Alt+I` (keys), this family, and the
5
+ * host bridge all resolve an `IndexEngine` through `createIndexer`, so the console,
6
+ * the status line and the desktop app cannot disagree about which workspace is
7
+ * indexed or what the settings are.
8
+ *
9
+ * THE GUARD ORDER IS A CONTRACT, the same one `/gov` and `/team` use:
10
+ *
11
+ * status / open / on / off / confirm - questions and switches, answerable in ANY
12
+ * session, including one where a build could
13
+ * not run (that is where users ask why).
14
+ * clean - takes the lock first: deleting a generation
15
+ * another process is writing is the only
16
+ * operation here that can truly corrupt an index.
17
+ * rebuild - STILL ASKS (P1-6). A destructive write does not
18
+ * become safe because the user can type; a user who
19
+ * wants no prompt sets `index.confirmOnBuild=false`,
20
+ * which is visible, reversible and announces itself.
21
+ *
22
+ * THE ROOT IS DISCOVERED, NEVER ASSUMED. Every path below comes from
23
+ * `indexPathsFor(discoverRoot(cwd).root)` - the SAME call `createIndexEngine` makes -
24
+ * because in a monorepo the git root is not the working directory. Reading
25
+ * `<cwd>/.claude-index/ast` while the engine writes `<root>/.claude-index/ast` made
26
+ * `/index clean` report "nothing to clean" and `/index open ast` report "not built"
27
+ * with a complete index on disk.
28
+ *
29
+ * ASCII ONLY: `commands/**` is inside `glyphs.test.ts::inScope`.
30
+ */
31
+ import type { CommandContext, CommandRegistry } from './registry.js';
32
+ import { indexPathsFor } from '../indexer/paths.js';
33
+ /** Split `args` into a subcommand and the rest, lower-cased for matching only. */
34
+ export declare function parseIndexArgs(args: string): {
35
+ sub: string;
36
+ rest: string[];
37
+ };
38
+ /** The one definition of "where this workspace's artifacts live" (see the file header). */
39
+ export declare function indexArtifactPaths(cwd: string): ReturnType<typeof indexPathsFor>;
40
+ /** Register `/index` (spec 6.4). */
41
+ export declare function registerIndexCommand(registry: CommandRegistry): void;
42
+ /** Dispatch one `/index` invocation. Exported so the tests can call it without a registry. */
43
+ export declare function runIndexCommand(ctx: CommandContext): void;