@agenit/cli 1.0.3 → 1.1.0

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 (4) hide show
  1. package/CHANGELOG.md +306 -16
  2. package/README.md +10 -2
  3. package/cli.js +37790 -33397
  4. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,9 +3,310 @@
3
3
  All notable changes to `@agenit/cli` are documented here. The project
4
4
  follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
- ## [1.0.3] - 2026-05-07
6
+ ## [1.1.0] - 2026-05-08
7
+
8
+ A minor bump because this batch is dominated by new user-facing
9
+ flows: an interactive `/init` walkthrough, a Codex-style `/goal start`
10
+ gate with plan generation + speckit pipeline, a Claude-style advisor
11
+ mechanism the agent can call mid-tick, per-goal model pinning, and an
12
+ end-of-session summarizer that finally populates the project memory
13
+ files. None of these were in 1.0.5.
14
+
15
+ ### Added
16
+
17
+ - **Interactive `/init` flow.** When `/init` runs without `--profile`
18
+ and the REPL is attached, a modal walks the user through:
19
+ - Profile picker (arrow-key nav over `automotive` / `embedded` /
20
+ `web` / `generic`, with the auto-detected option marked).
21
+ - `r` key triggers a Gemini classification call that scans the
22
+ project's high-signal files (`package.json`, `CMakeLists.txt`,
23
+ `Cargo.toml`, etc.) and recommends a profile.
24
+ - Custom-agent gate after profile selection — if Y, Gemini
25
+ drafts a project-tailored `SKILL.md` and writes it to
26
+ `.gemini/skills/<project>-agent/`. Verifier confirms Gemini-CLI
27
+ sees it on the next session start.
28
+ - GEMINI.md seeder added alongside AGENTS.md (Gemini-CLI's
29
+ auto-loaded persona file). Both files now include a
30
+ `## Recommended skills` section listing per-profile skills.
31
+ - **Interactive `/goal start` gate.** When `[goal]
32
+ interactive_planning = true` (default), `/goal start` opens a
33
+ sequence of modals before spawning the runner:
34
+ - **Plan-first gate**: Y to plan via the speckit pipeline, N to
35
+ start the runner immediately, Esc to cancel.
36
+ - **Plan-model picker** (arrow-key nav): pick the model the
37
+ speckit specify+plan calls run on. Shows tier (smart / fast /
38
+ cheap / default) + the resolved model + provider per row.
39
+ - **Streaming plan loader**: speckit-specify runs first, then
40
+ speckit-plan. Phase headers stream in (`## phase: speckit-plan`)
41
+ so the user sees what's currently happening. Output is the
42
+ `plan.md` speckit wrote to `.specify/specs/<fid>/`.
43
+ - **Plan approval modal**: shows the on-disk plan.md. Y to
44
+ approve, E to drop into `$EDITOR` on the file, N/Esc to cancel.
45
+ - **Optional `clarify` gate** — runs the new two-pass clarify
46
+ (see below) when Y.
47
+ - **Optional `tasks` gate** — runs `speckit-tasks`, captures
48
+ `tasks.md`, injects it into every tick's prompt under
49
+ `## Task list`.
50
+ - **Worker-model picker**: same picker, different purpose —
51
+ pins the model the autonomous runner uses for every tick.
52
+ - The chosen models + speckit fid + tasks body live on
53
+ `GoalSpec` so the run is reproducible.
54
+ - **Two-pass clarify flow.** The original `speckit-clarify` skill
55
+ expected interactive Q&A inside the model context, which doesn't
56
+ work in headless dispatch (it usually no-ops). The new flow:
57
+ - Pass 1: `extractClarifyQuestions` asks the model for ≤5
58
+ numbered questions about the spec. Streams.
59
+ - User walks the questions one at a time via a `ClarifyQAModal`
60
+ with text input. Esc skips a question; Ctrl-C cancels the whole
61
+ flow; empty Enter is treated as skip.
62
+ - Pass 2: `applyClarifications` sends the original spec + Q&A
63
+ pairs back, asks for a complete updated `spec.md` body, writes
64
+ it to disk. Streams.
65
+ - **Advisor side-call mechanism.** The autonomous runner's main
66
+ model can emit `[[ADVISOR: <question>]]` mid-tick; the driver
67
+ detects the marker (top-level only — markers inside fenced code
68
+ blocks are ignored), side-calls a `tier: "smart"` GeminiClient
69
+ with the audit context, persists the reply to
70
+ `goal-turns/turn-NNN-advisor.md`, and injects it into the next
71
+ turn's user prompt under `## Advisor reply (consult #N)`. New
72
+ `[advisor]` config section: `enabled`, `tier` (default `smart`),
73
+ `max_consults_per_goal` (default 5), `redact_paths` (default
74
+ true — replaces absolute paths in the audit-note context with
75
+ `<path>` placeholders before sending to the smart model).
76
+ Recursive markers in the reply are stripped to keep the loop
77
+ terminating. Advisor cost entries land in `costs.json` with
78
+ `kind: "advisor"` (matching turn integer to the tick that emitted
79
+ the marker; the existing tick entries gain `kind: "tick"`). New
80
+ `/goal advisor [<turn>]` subcommand prints a stored reply.
81
+ - **Per-goal model pinning.** `GoalSpec.workerModel` overrides
82
+ routing rules + `cfg.gemini.model` for every tick of the run.
83
+ Set via the worker-model picker; saved into `goal.json` so the
84
+ pin survives restarts.
85
+ - **End-of-session summarizer.** New `[session]` config section
86
+ (`summarize_on_end`, `tier`, `min_turns`). On `/exit` / Ctrl-C /
87
+ `/quit` (or via the `/session summarize` slash command), the
88
+ REPL reads back the session's JSONL turns, asks the model for
89
+ durable signal in four buckets (`context` / `decisions` /
90
+ `requirements` / `soul updates`), and appends each non-empty
91
+ bucket to its target file: `memory/projects/<p>/{context,
92
+ decisions, requirements}.md` and the global
93
+ `<flowHome>/.flow/soul.md` (under a per-project section).
94
+ Resolves the long-standing "soul-keeper sees 0 bullets" symptom
95
+ — once `context.md` has content, soul-keeper's distillation
96
+ loop has work to do. Skipped for sessions shorter than
97
+ `min_turns` (default 3) so trivial lookups don't churn pro for
98
+ nothing.
99
+ - **Streaming everything.** Plan generation, speckit phases
100
+ (specify / plan / clarify / tasks), advisor side-calls, and the
101
+ session summarizer all use `chatStreamJson` with text-delta
102
+ forwarding. The loader modals render the model's output live —
103
+ no more frozen spinner.
104
+ - **Tier-aware routing primitive promoted.** `pickRoutedModel` and
105
+ the new `pickByTier` live in a shared `routing.ts` module
106
+ (extracted from `commands/goal.ts`). `GeminiClient` accepts an
107
+ optional `routingRules` config + per-call `tier` option;
108
+ `chosenModel(opts)` resolves model name without spawning. Four
109
+ call sites tagged with intent: `profile-recommend` (fast),
110
+ `App.tsx` free-form chat (fast), `plan-generation` (smart, when
111
+ used as a one-shot fallback), `agent-generate` (smart). The
112
+ remaining 8 hardcoded sites (squad helpers, debug, cve, etc.)
113
+ are flagged for a follow-up.
114
+ - **Lazy memoised model probe.** `model-probe.ts` resolves the
115
+ fast / smart / cheap models per (account, flowHome) and caches
116
+ the result at `~/.config/agenit/model-cache.json` with a 7-day
117
+ TTL. New `--reprobe` flag busts the cache after a Gemini-CLI
118
+ upgrade or account switch.
119
+ - **`/session` slash command.** `/session` shows status (id,
120
+ file, turns); `/session summarize` triggers the summarizer
121
+ manually mid-session.
122
+ - **`/goal output [<turn>]` and `/goal advisor [<turn>]`.** Both
123
+ print stored per-turn artefacts (full assistant response or
124
+ advisor reply) so users can audit what the agent saw at any
125
+ step.
126
+ - **Goal driver liveness updates.** During a streaming Gemini
127
+ call, the driver throttle-pushes "thinking …" snippets to the
128
+ rail card every ~1.5s. Card no longer goes stale (`?` glyph)
129
+ during long ticks; it shows actual text from the model.
130
+ - **JobDetailPanel "Advisor consults" section.** Lists every
131
+ consult by turn number, with a hint pointing at `/goal advisor
132
+ <N>` for the body.
133
+ - ~50 new tests across routing, model probe, advisor marker /
134
+ redaction / parser, prompt injection, session summary parse and
135
+ apply, clarify question parser, layout solver, and pool
136
+ snapshot fidelity. Total: 510 (up from 462 at 1.0.5).
137
+
138
+ ### Fixed
139
+
140
+ - **Card "stale" override during ticking.** The right-rail card
141
+ was rendering the `?` (stale) glyph during legitimate long
142
+ Gemini calls because `now - lastEventAt > 60s` triggered even
143
+ while the model was actively producing tokens. Stale now only
144
+ applies to `active` / `blocked` states — `ticking` is exempt
145
+ and shows the spinner instead.
146
+ - **Card width math.** Card content was overflowing because
147
+ `paddingX={1}` (2 cols) wasn't being subtracted from the
148
+ computed `innerWidth`. Fixed; "0s ago" no longer renders as "s
149
+ ago" with the leading character clipped.
150
+ - **Plan-loader frozen spinner.** Plan generation used
151
+ `gemini.chat()` (blocking text mode) — the user stared at a
152
+ spinner for the entire 20-60s pro call. Now uses
153
+ `chatStreamJson` with deltas forwarded into the modal buffer.
154
+ - **Speckit-clarify file detection.** The pipeline expected a
155
+ separate `clarification.md` file but speckit-clarify writes
156
+ back to `spec.md`. The detector now checks for a
157
+ `## Clarifications` section or moved mtime instead.
158
+
159
+ ### Changed
160
+
161
+ - **`Session.end()` no longer just writes a meta marker.** When
162
+ `[session] summarize_on_end` is true and the session has enough
163
+ turns, exit prompts the user to run the summarizer first.
164
+ - **`GoalSpec` schema additions** — `plan`, `workerModel`,
165
+ `speckitFid`, `tasksPath`, `tasksBody`, `advisorConsultCount`,
166
+ `lastAdvisorReply`. All optional; on-disk goal.json from 1.0.5
167
+ loads without changes.
168
+ - **`CostEntry` gains optional `kind: "tick" | "advisor"`** so
169
+ `costs.json` can attribute advisor consults separately while
170
+ keeping the integer turn key.
171
+ - **Plan persistence path** — when speckit runs, the plan lives
172
+ at `<project>/.specify/specs/<fid>/plan.md`. Approval modal
173
+ reads from there and the `[E]dit` action drops into `$EDITOR`
174
+ on that file directly (no sidecar copy). One-shot
175
+ `generatePlan` still writes to `.agenit-plans/` as a fallback
176
+ when speckit isn't used.
177
+
178
+ ### Out of scope (follow-ups)
179
+
180
+ - True interactive Q&A passed through to a single `speckit-clarify`
181
+ skill call (the two-pass approach replaces that pattern).
182
+ - Tagging the remaining 8 hardcoded model call sites
183
+ (squad helpers, debug, cve, stages, print-mode, speckit-internal,
184
+ etc.).
185
+ - Auto-summarizer that walks every session JSONL in
186
+ `.flow/sessions/` for a one-time backfill on long-lived projects.
187
+ - `/speckit chain <feature>` non-interactive variant for scripted
188
+ pipelines.
189
+
190
+ ## [1.0.5] - 2026-05-08
191
+
192
+ ### Added
193
+
194
+ - **Background-jobs dashboard.** A new right-rail in the REPL shows
195
+ one card per active background worker (autonomous goal runner,
196
+ soul-keeper, future scanners). Each card surfaces the worker's
197
+ state (`active` / `ticking` / `blocked` / `done` / `aborted`),
198
+ progress (`12/50 turns`, `7 bullets`), last event, and age.
199
+ Width-adaptive: wide rail at ≥140 cols, narrow at 120-139, single
200
+ horizontal strip at 100-119, hidden below 80 (jobs reachable via
201
+ the new `/jobs` command).
202
+ - **New `/jobs` slash command.** Lists / inspects / stops background
203
+ jobs. `/jobs` lists all, `/jobs <id>` shows detail, `/jobs stop <id>`
204
+ stops a pool worker. Goal runners route to `/goal stop` per the
205
+ existing API.
206
+ - **Init verification.** `/init` now finishes with a verification
207
+ step that confirms (a) skills directory non-empty, (b)
208
+ `.gemini/settings.json` valid JSON with all hook paths resolvable,
209
+ (c) `AGENTS.md` present, (d) Gemini-CLI binary works, and (e)
210
+ `gemini skills list` reports the seeded skills including a
211
+ sentinel name (proves end-to-end discovery, not just file
212
+ presence). Output uses `✓ / ✗ / -` icons with `↳ fix:` hints on
213
+ failure. `--no-verify` skips the step.
214
+ - **`JobSnapshot` + pool snapshot API.** `LoopWorker.snapshot()`,
215
+ `LoopWorkerHandle.getSnapshot()`, and `LoopWorkerPool.onChange()`
216
+ let any worker publish rich card data to the bus without coupling
217
+ to UI code. The TUI bus republishes pool spawns/evicts to the
218
+ rail automatically.
219
+ - 31 new tests covering job-layout solver, TUI bus batching, pool
220
+ snapshots, goal-snapshot mapping, init-verify checks, and
221
+ hook-path rewrites.
7
222
 
8
223
  ### Fixed
224
+
225
+ - **`/goal start` no longer spins on empty model output.** Four
226
+ intertwined bugs that caused goal runs to log dozens of zero-work
227
+ turns:
228
+ - The auditor ran `git status --porcelain` against
229
+ `cfg.flow.flowHome` (the install root) instead of the user's
230
+ project directory. It now uses `cfg.gemini.workingDir`, the
231
+ same directory the spawned Gemini-CLI subprocess writes to.
232
+ - When the user's project wasn't a git repo, the auditor
233
+ silently reported zero file changes. `/goal tick` and
234
+ `/goal start` now run `git init --quiet` if `.git/` is
235
+ missing.
236
+ - The Gemini stream-json parser silently dropped responses when
237
+ the CLI used the newer `{type:"content", text:"..."}` event
238
+ shape instead of the older `{type:"message", role:"assistant",
239
+ delta:true, content:"..."}`. Both shapes are now accepted.
240
+ Empty responses on clean exit (auth errors, schema drift) now
241
+ throw an error including stderr + a stdout sample, instead of
242
+ looping indefinitely.
243
+ - `/goal status` reported `runner: running` after the autonomous
244
+ loop had exited on its own (completion / budget exhaustion /
245
+ error). The `activeRunner` reference now nulls itself when the
246
+ `stopped` event fires.
247
+ - **Stale relative hook paths in existing `settings.json` are now
248
+ refreshed.** A user who ran `/init` before the 1.0.4 path-rewriter
249
+ shipped had `./.flow/hooks/foo.py` tokens that fail at hook-fire
250
+ time because the user's project doesn't ship `.flow/hooks/`.
251
+ Re-running `/init` now re-rewrites those tokens to absolute paths
252
+ under flowHome while preserving any user customisations elsewhere
253
+ in the file. The fix is idempotent and only writes when something
254
+ actually changed.
255
+ - Backend errors during a goal tick (auth failures, model rejections)
256
+ now write an audit row with the error in `note` + `errors[]`,
257
+ mark the goal `Aborted`, and stop the runner cleanly. Previously
258
+ the runner could die without trace.
259
+
260
+ ### Changed
261
+
262
+ - `LoopWorkerHandle.done()` and `.stop()` now resolve only after
263
+ pool eviction completes — `pool.list()` is consistent with
264
+ `await handle.done()`.
265
+ - `tuiBus` updates are coalesced via microtask flush so producers
266
+ firing many concurrent `setJob()` calls cause one re-render per
267
+ event-loop tick instead of strobing the rail. `flushSync()` is
268
+ exposed for deterministic tests.
269
+ - `tuiBus.setJob()` and `removeJob()` now allocate a fresh
270
+ `backgroundJobs` array on every change so React's referential
271
+ equality fires for memoised consumers.
272
+
273
+ ## [1.0.4] - 2026-05-08
274
+
275
+ ### Added
276
+
277
+ - **`agenit init` now seeds `.gemini/` for the user's project.** Copies
278
+ every skill from `<flowHome>/.gemini/skills/` into
279
+ `<project>/.gemini/skills/` and writes a `<project>/.gemini/settings.json`
280
+ derived from TheFlow's, with all relative hook paths
281
+ (`./.flow/hooks/foo.py`) rewritten to absolute paths so the hooks
282
+ fire correctly regardless of cwd. Without this step the cwd fix
283
+ introduced in 1.0.3 left Gemini-CLI unable to discover any skills or
284
+ hooks when running from the user's project — `/feature` runs would
285
+ silently degrade to a generic persona. Use `--no-skills` to opt out;
286
+ an existing `<project>/.gemini/settings.json` is preserved.
287
+ - New `tests/gemini-assets.test.ts` covers skill copying, hook-path
288
+ rewriting, and existing-settings preservation.
289
+
290
+ ## [1.0.3] - 2026-05-08
291
+
292
+ ### Added
293
+
294
+ - **Cross-platform Gemini CLI discovery.** `binary` in `flow.toml` can
295
+ now be a bare command name (`"gemini"` is the new default) — agenIT
296
+ searches `PATH` (with `PATHEXT` extensions on Windows) and falls
297
+ back to well-known install dirs per OS:
298
+ - macOS: `/opt/homebrew/bin`, `/usr/local/bin`, `~/.npm-global/bin`
299
+ - Linux: `/usr/local/bin`, `/usr/bin`, `/home/linuxbrew/.linuxbrew/bin`,
300
+ `~/.npm-global/bin`, `~/.local/bin`
301
+ - Windows: `%APPDATA%\npm`, `%ProgramFiles%\nodejs`,
302
+ `%LOCALAPPDATA%\Programs\gemini-cli`
303
+
304
+ Absolute paths are still honoured verbatim. On Windows the spawned
305
+ process uses `shell: true` so `.cmd` / `.bat` shims execute correctly
306
+ when invoked without their extension.
307
+
308
+ ### Fixed
309
+
9
310
  - **Artefacts now land in the user's project, not in the install repo.**
10
311
  Previously every relative path in `flow.toml` (gemini `working_dir`,
11
312
  `memory_dir`, `codedigest_dir`, `mempalace`, sona/reasoning/rvf)
@@ -25,29 +326,18 @@ follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
25
326
  shows "Spec-Kit (specify → plan → tasks)" and "Export spec → SWE.1"
26
327
  before the V-Model nodes start firing their own stage updates.
27
328
 
28
- ### Added
29
- - **Cross-platform Gemini CLI discovery.** `binary` in `flow.toml` can
30
- now be a bare command name (`"gemini"` is the new default) — agenIT
31
- searches `PATH` (with `PATHEXT` extensions on Windows) and falls
32
- back to well-known install dirs per OS:
33
- - macOS: `/opt/homebrew/bin`, `/usr/local/bin`, `~/.npm-global/bin`
34
- - Linux: `/usr/local/bin`, `/usr/bin`, `/home/linuxbrew/.linuxbrew/bin`,
35
- `~/.npm-global/bin`, `~/.local/bin`
36
- - Windows: `%APPDATA%\npm`, `%ProgramFiles%\nodejs`,
37
- `%LOCALAPPDATA%\Programs\gemini-cli`
38
-
39
- Absolute paths are still honoured verbatim. On Windows the spawned
40
- process uses `shell: true` so `.cmd` / `.bat` shims execute correctly
41
- when invoked without their extension.
42
-
43
329
  ### Changed
330
+
44
331
  - Default `flow.toml` ships `binary = "gemini"` (was the macOS
45
332
  Homebrew absolute path) and drops the leading `../` from
46
333
  `memory_dir` / `codedigest_dir` so artefacts land *inside* the
47
334
  user's project.
48
335
 
49
336
  ### Tests
337
+
50
338
  - New `tests/config-paths.test.ts` pins the install vs project anchor
51
339
  split and the absolute-path passthrough.
52
340
  - New `tests/binary-resolver.test.ts` covers PATH walking, absolute
53
341
  path probing, and missing-binary handling.
342
+ - New `tests/gemini-assets.test.ts` covers skill copying, hook-path
343
+ rewriting, and existing-settings preservation.
package/README.md CHANGED
@@ -39,9 +39,9 @@ agenit run
39
39
  ## Commands
40
40
 
41
41
  | Command | Description |
42
- |---|---|
42
+ | --- | --- |
43
43
  | `agenit` | Interactive REPL |
44
- | `agenit init [dir]` | Scaffold project memory and `.agenit_project` marker |
44
+ | `agenit init [dir]` | Scaffold project memory + `.gemini/` assets + `.agenit_project` marker. Verifies Gemini-CLI can see the seeded skills before returning. Pass `--no-verify` to skip. |
45
45
  | `agenit run` | Run the full V-Model pipeline |
46
46
  | `agenit audit` | Show traceability registry |
47
47
  | `agenit projects` | List all projects in memory |
@@ -49,6 +49,14 @@ agenit run
49
49
  | `agenit sessions` | List recent sessions |
50
50
  | `agenit completions <shell>` | Print shell completion script (bash / zsh / fish) |
51
51
 
52
+ Selected REPL slash commands (full list in `/help`):
53
+
54
+ | Command | Description |
55
+ | --- | --- |
56
+ | `/goal <objective>` | Codex-style autonomous loop. `/goal start` runs ticks back-to-back; the right-rail card shows turn budget + last decision live. |
57
+ | `/jobs` | List active background jobs (goal runner, soul-keeper, scanners). Useful when the terminal is too narrow for the right-rail. |
58
+ | `/init` | Re-seed `.gemini/` skills + settings; verifies Gemini-CLI can see the result. |
59
+
52
60
  ## Configuration
53
61
 
54
62
  Place a `flow.toml` (or `agenit.toml`) in your project root, or pass `--config <path>`. See the [project documentation](https://github.com/muhammed-eldabea/flow) for the full schema.