@lumenflow/cli 4.11.0 → 4.12.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.
@@ -130,27 +130,42 @@ you want to refresh docs without upgrading packages (e.g., after manually editin
130
130
 
131
131
  ## WU Lifecycle
132
132
 
133
- | Command | Description |
134
- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
135
- | `pnpm wu:create --lane <Lane> --title "..." ..` | Create new WU spec (ID auto-generated; see fields below) |
136
- | `pnpm wu:claim --id WU-XXX --lane <Lane>` | Claim WU and create worktree (default) |
137
- | `pnpm wu:claim --id WU-XXX --lane <L> --cloud` | Claim WU in cloud/branch-pr mode (no worktree) |
138
- | `pnpm wu:prep --id WU-XXX [--full-tests]` | Run gates, prep for wu:done (`tests.unit` scoped by default) |
139
- | `pnpm wu:done --id WU-XXX` | Complete WU (merge or PR, stamp, cleanup) |
140
- | `pnpm wu:edit --id WU-XXX --description "..."` | Edit WU spec fields (run --help for all flags) |
141
- | `pnpm wu:escalate --id WU-XXX` | Show escalation status for a WU |
142
- | `pnpm wu:escalate --resolve --id WU-XXX` | Resolve escalation (sets resolved_by/resolved_at) |
143
- | `pnpm approval:request --type <type> --subject <json>` | Request control-plane approval for an action |
144
- | `pnpm approval:review --id <approvalId> --decision <decision>` | Resolve an approval decision (`approved`/`rejected`/`expired`) |
145
- | `pnpm approval:list [--status <status>]` | List approvals with optional status/type filters |
146
- | `pnpm wu:block --id WU-XXX --reason "..."` | Block WU with reason (ownership-guarded, v3.19.0) |
147
- | `pnpm wu:unblock --id WU-XXX` | Unblock WU (ownership-guarded, v3.19.0) |
148
- | `pnpm wu:release --id WU-XXX --reason "..."` | Release orphaned WU (ownership-guarded, v3.19.0) |
149
- | `pnpm wu:status --id WU-XXX` | Show WU status, location, valid commands |
150
- | `pnpm wu:brief --id WU-XXX --client <client>` | **MANDATORY after wu:claim.** Generate handoff prompt + record evidence. wu:done blocks without this (WU-2379) |
151
- | `pnpm wu:brief --id WU-XXX --no-context` | Generate prompt without memory context injection |
152
- | `pnpm wu:delegate --id WU-XXX --parent-wu <P>` | Generate prompt, record lineage, and store brief hash attestation |
153
- | `pnpm wu:sandbox --id WU-XXX -- <cmd>` | Run command through hardened WU sandbox backend |
133
+ | Command | Description |
134
+ | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
135
+ | `pnpm wu:create --lane <Lane> --title "..." ..` | Create new WU spec (ID auto-generated; see fields below) |
136
+ | `pnpm wu:claim --id WU-XXX --lane <Lane>` | Claim WU and create worktree (default) |
137
+ | `pnpm wu:claim --id WU-XXX --lane <L> --cloud` | Claim WU in cloud/branch-pr mode (no worktree) |
138
+ | `pnpm wu:prep --id WU-XXX [--full-tests]` | Run gates, prep for wu:done (`tests.unit` is scoped only when the active preset supports path-scoped execution) |
139
+ | `pnpm wu:done --id WU-XXX` | Complete WU (merge or PR, stamp, cleanup) |
140
+ | `pnpm wu:edit --id WU-XXX --description "..."` | Edit WU spec fields (run --help for all flags) |
141
+ | `pnpm wu:escalate --id WU-XXX` | Show escalation status for a WU |
142
+ | `pnpm wu:escalate --resolve --id WU-XXX` | Resolve escalation (sets resolved_by/resolved_at) |
143
+ | `pnpm approval:request --type <type> --subject <json>` | Request control-plane approval for an action |
144
+ | `pnpm approval:review --id <approvalId> --decision <decision>` | Resolve an approval decision (`approved`/`rejected`/`expired`) |
145
+ | `pnpm approval:list [--status <status>]` | List approvals with optional status/type filters |
146
+ | `pnpm wu:block --id WU-XXX --reason "..."` | Block WU with reason (ownership-guarded, v3.19.0) |
147
+ | `pnpm wu:unblock --id WU-XXX` | Unblock WU (ownership-guarded, v3.19.0) |
148
+ | `pnpm wu:release --id WU-XXX --reason "..."` | Release orphaned WU (ownership-guarded, v3.19.0) |
149
+ | `pnpm wu:status --id WU-XXX` | Show WU status, location, valid commands |
150
+ | `pnpm wu:brief --id WU-XXX --client <client>` | **MANDATORY after wu:claim.** Generate handoff prompt + record evidence. wu:done blocks without this (WU-2379) |
151
+ | `pnpm wu:brief --id WU-XXX --no-context` | Generate prompt without memory context injection |
152
+ | `pnpm wu:delegate --id WU-XXX --parent-wu <P>` | Generate prompt, record lineage, and store brief hash attestation |
153
+ | `pnpm wu:sandbox --id WU-XXX -- <cmd>` | Run command through hardened WU sandbox backend |
154
+
155
+ Common surgical `wu:edit` patterns:
156
+
157
+ ```bash
158
+ # Rename one code_path entry without rewriting the full array
159
+ pnpm wu:edit --id WU-123 \
160
+ --rename-code-paths "docs/08_concepts.md=docs/08_crosscutting_concepts.md"
161
+
162
+ # Remove one stale code_path entry
163
+ pnpm wu:edit --id WU-123 --remove-code-paths "docs/old-path.md"
164
+
165
+ # Rename one scoped unit test path without replacing all test paths
166
+ pnpm wu:edit --id WU-123 \
167
+ --rename-test-paths-unit "tests/old-name.test.ts=tests/new-name.test.ts"
168
+ ```
154
169
 
155
170
  ### WU Maintenance
156
171
 
@@ -210,11 +225,9 @@ only run when matching files change. Supports `error` (blocks), `warn` (logs), a
210
225
  severity levels. See workspace-spec.mdx for schema.
211
226
 
212
227
  **Formatting: always scope to changed files only.**
213
- Use `{{format_fix_command}}` — never unscoped `pnpm format`.
228
+ Use `pnpm prettier --write <changed-files...>` — never unscoped `pnpm format`.
214
229
  Running `pnpm format` reformats every file in the repo, creating hundreds of
215
230
  dirty YAML/initiative changes that pollute the worktree and block `wu:done`.
216
- The command above is resolved at init time from your gate preset (WU-2547), so
217
- `.NET` repos get `dotnet format`, Python repos get `ruff format`, etc.
218
231
 
219
232
  ---
220
233
 
@@ -467,6 +480,22 @@ For the complete orchestration workflow (delegation, memory coordination, failur
467
480
  | `pnpm docs:generate` | Generate CLI documentation |
468
481
  | `pnpm docs:validate` | Validate CLI documentation |
469
482
 
483
+ ### Documentation Decision Rule
484
+
485
+ For behavior changes, make an explicit docs decision instead of assuming generated reference docs
486
+ cover everything:
487
+
488
+ - **Internal docs**: agent workflow, maintainer workflow, onboarding, or repo-specific operating
489
+ rules changed.
490
+ - **Starlight docs**: public CLI behavior, pack behavior, language guidance, or user-facing
491
+ workflow changed.
492
+ - **Both**: the same behavior change affects agents internally and users externally.
493
+ - **None**: no user-facing or agent-facing guidance changed.
494
+
495
+ `pnpm docs:generate` only covers generated reference pages. Narrative workflow docs in
496
+ `AGENTS.md`, `LUMENFLOW.md`, onboarding docs, and `apps/docs/src/content/docs/**` still need
497
+ manual updates when behavior changes.
498
+
470
499
  ---
471
500
 
472
501
  ## Release
@@ -240,34 +240,48 @@ The workflow:
240
240
  1. Installs D2 (`astro-d2` prerequisite)
241
241
  2. Builds docs with `pnpm --filter @lumenflow/docs build`
242
242
  3. Uploads `apps/docs/dist` as a workflow artifact
243
- 4. Deploys to Vercel when `VERCEL_TOKEN`, `VERCEL_ORG_ID`, and `VERCEL_PROJECT_ID` secrets are configured
243
+ 4. Deploys to Vercel when `VERCEL_TOKEN`, `VERCEL_ORG_ID`, and `VERCEL_PROJECT_ID` Actions secrets are configured and valid
244
+ 5. Skips deploy cleanly when those secrets are absent, while still preserving the build artifact for inspection
244
245
 
245
246
  ### Deployment
246
247
 
247
- Production deploy is still manual via Vercel CLI:
248
+ Production deploy normally happens through `.github/workflows/docs.yml` on a release tag push. When the workflow reaches the Vercel step successfully, it runs these commands against `apps/docs/`:
248
249
 
249
250
  ```bash
250
- cd apps/docs
251
- pnpm build
252
- vercel --prod
251
+ pnpm dlx vercel pull --yes --environment=production --cwd apps/docs --token "$VERCEL_TOKEN"
252
+ pnpm dlx vercel build --prod --cwd apps/docs --token "$VERCEL_TOKEN"
253
+ pnpm dlx vercel deploy --prebuilt --prod --cwd apps/docs --token "$VERCEL_TOKEN"
254
+ ```
255
+
256
+ Use a manual Vercel CLI deploy only as a recovery path when the GitHub Actions run needs to be replayed outside a tag push or `workflow_dispatch`. In that case, export the same values used by Actions:
257
+
258
+ ```bash
259
+ export VERCEL_TOKEN=<token>
260
+ export VERCEL_ORG_ID=<team-id>
261
+ export VERCEL_PROJECT_ID=<project-id>
253
262
  ```
254
263
 
255
264
  ### When to Deploy
256
265
 
266
+ - Release tags (`v*`) automatically trigger the docs workflow
267
+ - Use `workflow_dispatch` when you need to rebuild or redeploy docs without cutting a new release tag
257
268
  - After any changes to `apps/docs/src/content/docs/**`
258
269
  - After version bumps (to update any version references)
259
270
  - After adding new features documented in Starlight
260
271
 
261
- ### Vercel Project
272
+ ### Required Secrets
273
+
274
+ - **`VERCEL_TOKEN`**: deploy token used by the workflow's Vercel CLI steps
275
+ - **`VERCEL_ORG_ID`**: Vercel team/org that owns the production docs project
276
+ - **`VERCEL_PROJECT_ID`**: Vercel project that serves `lumenflow.dev`
262
277
 
263
- - **Project**: `lumenflow-docs` (ID: `prj_myK4BzfHKctGhxfvALJaMOXVLx4g`)
264
- - **Domain**: lumenflow.dev
265
- - **Team**: lumenflow
278
+ Treat those GitHub Actions secrets as the source of truth for automated docs deploys. Do not rely on the repo-root `.vercel/project.json` for docs releases; it may be linked to a different Vercel project such as the monorepo preview app.
266
279
 
267
280
  ### Important Notes
268
281
 
269
282
  - **No private repo links**: Starlight docs are public; never link to `github.com/hellmai/lumenflow`
270
283
  - **Link to npm**: Use <https://www.npmjs.com/org/lumenflow> for package links
284
+ - **Secret failures are explicit**: if `VERCEL_TOKEN` is invalid, the workflow will fail at `vercel pull`; rotating the Actions secret and rerunning `docs.yml` is the correct fix
271
285
 
272
286
  ---
273
287
 
@@ -394,7 +408,7 @@ pnpm release --release-version 1.3.0 --skip-publish --dry-run
394
408
  pnpm release --release-version 1.3.0 --skip-publish
395
409
  ```
396
410
 
397
- This handles version bump and tag locally; GitHub Actions handles npm publish, docs build, and GitHub release creation.
411
+ This handles version bump and tag locally; GitHub Actions handles npm publish, GitHub release creation, and the docs build/deploy path when the Vercel secrets are configured correctly.
398
412
 
399
413
  ### Release Steps (Manual)
400
414
 
@@ -423,16 +437,21 @@ If you need more control:
423
437
  gh release view v1.3.0
424
438
  ```
425
439
 
426
- 4. **Verify docs workflow** (if docs changed)
440
+ 4. **Verify docs workflow** (if docs changed or the release should refresh public docs)
427
441
 
428
442
  ```bash
429
443
  gh run list --workflow=docs.yml --limit 1
430
444
  ```
431
445
 
432
- 5. **Deploy Starlight docs** (if content changed and you are deploying manually)
446
+ 5. **Manual Starlight recovery deploy** (only if you need to replay deploy outside the normal workflow)
433
447
 
434
448
  ```bash
435
- cd apps/docs && pnpm build && vercel --prod
449
+ export VERCEL_TOKEN=<token>
450
+ export VERCEL_ORG_ID=<team-id>
451
+ export VERCEL_PROJECT_ID=<project-id>
452
+ pnpm dlx vercel pull --yes --environment=production --cwd apps/docs --token "$VERCEL_TOKEN"
453
+ pnpm dlx vercel build --prod --cwd apps/docs --token "$VERCEL_TOKEN"
454
+ pnpm dlx vercel deploy --prebuilt --prod --cwd apps/docs --token "$VERCEL_TOKEN"
436
455
  ```
437
456
 
438
457
  ### After Release
@@ -445,13 +464,13 @@ If you need more control:
445
464
 
446
465
  ## Keeping Components in Sync
447
466
 
448
- | Change Type | npm | Docs | Packs |
449
- | ---------------- | ------------- | ----------------------- | ------- |
450
- | Bug fix in CLI | Tag + publish | Auto\* | No |
451
- | New CLI command | Tag + publish | Auto\* | No |
452
- | Pack changes | Tag + publish | No | Publish |
453
- | Docs-only update | No | Build workflow + deploy | No |
454
- | Full release | Tag + publish | Build workflow + deploy | Publish |
467
+ | Change Type | npm | Docs | Packs |
468
+ | ---------------- | ------------- | ------------------------------- | ------- |
469
+ | Bug fix in CLI | Tag + publish | Auto\* | No |
470
+ | New CLI command | Tag + publish | Auto\* | No |
471
+ | Pack changes | Tag + publish | No | Publish |
472
+ | Docs-only update | No | `workflow_dispatch` + deploy | No |
473
+ | Full release | Tag + publish | Tag-triggered workflow + deploy | Publish |
455
474
 
456
475
  \* CLI/config reference docs regenerate automatically during `wu:done` when trigger files change. See [Automatic Docs Generation](./docs-generation.md).
457
476
 
@@ -467,9 +486,10 @@ If you need more control:
467
486
 
468
487
  ### Vercel deploy fails
469
488
 
470
- 1. Check build locally: `cd apps/docs && pnpm build`
471
- 2. Check Vercel CLI auth: `vercel whoami`
472
- 3. Check project link: `vercel link`
489
+ 1. Check build locally: `pnpm --filter @lumenflow/docs build`
490
+ 2. Check the `VERCEL_TOKEN` GitHub Actions secret is valid; an invalid token fails at `vercel pull`
491
+ 3. Check `VERCEL_ORG_ID` and `VERCEL_PROJECT_ID` still target the production docs project for `lumenflow.dev`
492
+ 4. If you must replay deploy locally, export the same `VERCEL_*` values and run the same `vercel pull/build/deploy` sequence used in `docs.yml`
473
493
 
474
494
  ---
475
495
 
@@ -197,13 +197,14 @@ LUMENFLOW_CLOUD=1 pnpm wu:claim --id WU-XXXX --lane "Lane Name"
197
197
  These are the mistakes agents make most often. Memorize these before reading anything else:
198
198
 
199
199
  1. **wu:done deletes the worktree.** After it completes, your shell CWD is invalid. Immediately `cd` back to the project root.
200
- 2. **When wu:done reports branch drift or a non-fast-forward error, rerun it from main.** It auto-rebases by default when it can. Never manually `git rebase` on main.
200
+ 2. **When wu:done reports branch drift, a non-fast-forward error, or patch-equivalent local-main catch-up, rerun it from main first.** It auto-rebases the lane branch when it can and now reconciles patch-equivalent local-main divergence after atomic push. Never manually `git rebase` on main.
201
201
  3. **Always run `--help` before first use of any command.** Don't guess flags — 30 seconds reading help saves 5 minutes of failed attempts.
202
202
  4. **Never `pnpm update @lumenflow/*` directly.** Use `pnpm lumenflow:upgrade --latest` (uses micro-worktree isolation).
203
203
  5. **State files are auto-generated.** Never manually edit `wu-events.jsonl`, `backlog.md`, or `status.md` — lifecycle commands manage them.
204
- 6. **wu:edit requires a clean worktree.** Commit `wu-events.jsonl` and other changes before running `wu:edit`.
204
+ 6. **Structural `wu:edit` changes require a clean worktree.** Metadata-only edits such as `--notes`, `--acceptance`, and scoped test-path updates can run on a dirty worktree, but scope-changing edits like `--code-paths`, `--remove-code-paths`, `--rename-code-paths`, `--lane`, or `--plan` still require a clean state.
205
205
  7. **Don't edit on main then stash to a worktree.** If a hook blocks you on main, that means you need a WU. Create one and work in the worktree from the start.
206
206
  8. **Don't modify another agent's WU to free a lane.** `wu:block`, `wu:unblock`, `wu:release`, and `wu:recover` enforce ownership guards (v3.19.0). If you hit a `SESSION OWNERSHIP VIOLATION`, wait for the owning WU to complete or block itself — never use `--override-owner` without explicit human instruction.
207
+ 9. **Behavior changes need a docs decision.** Update internal docs, Starlight docs, or both when behavior changes. Generated reference docs alone do not cover narrative workflow changes.
207
208
 
208
209
  ---
209
210
 
@@ -289,7 +290,7 @@ When gates fail, read the error and fix it. Common failures and fixes:
289
290
 
290
291
  | Failure | Cause | Fix |
291
292
  | -------------- | ----------------------- | -------------------------------------- |
292
- | `format:check` | Formatter check failed | `{{format_fix_command}}` |
293
+ | `format:check` | Prettier formatting | `pnpm prettier --write <file>` |
293
294
  | `backlog-sync` | WU missing from backlog | Regenerate backlog or add WU reference |
294
295
  | `typecheck` | TypeScript errors | Fix the type errors |
295
296
  | `lint` | ESLint violations | `pnpm lint --fix` or manual fix |
@@ -461,18 +462,26 @@ Do not use `git stash`, switch local main, or otherwise mutate main just to prov
461
462
 
462
463
  ### Scenario 6: wu:done reports branch drift or a non-fast-forward error
463
464
 
464
- **Cause:** Another agent or process pushed to main between your fetch and push (race condition).
465
+ **Cause:** Another agent or process pushed to main between your fetch and push (race condition), or
466
+ your local `main` needs to catch up after the atomic push path.
465
467
 
466
- **Fix:** Rerun `wu:done` from main. It has built-in auto-rebase for this case. If the rerun still fails with a real conflict, resolve the conflict in the worktree, rerun `wu:prep` if needed, then return to main and rerun `wu:done`.
468
+ **Fix:** Rerun `wu:done` from main first. It has built-in lane auto-rebase for branch drift and
469
+ automatic local-main reconciliation for patch-equivalent divergence after a successful atomic push.
470
+ If the rerun still fails with a real conflict, resolve the conflict in the worktree, rerun
471
+ `wu:prep` if needed, then return to main and rerun `wu:done`.
467
472
 
468
473
  ```bash
469
474
  # WRONG - never manually rebase main
470
475
  git rebase origin/main # DON'T DO THIS
471
476
 
472
- # RIGHT - just rerun the command
477
+ # RIGHT - just rerun the command from main first
473
478
  pnpm wu:done --id WU-XXX
474
479
  ```
475
480
 
481
+ If the rerun still reports a true local-main mismatch after a completed atomic push, treat that as
482
+ an abnormal recovery case and use the surfaced recovery guidance or `pnpm wu:recover --id WU-XXX`
483
+ instead of rebasing `main` manually.
484
+
476
485
  ---
477
486
 
478
487
  ## Delegating Sub-Agents with wu:brief / wu:delegate
@@ -597,6 +606,7 @@ Before reporting a WU complete, verify:
597
606
  - [ ] `pnpm wu:done --id WU-XXX` ran successfully
598
607
  - [ ] Output shows "Marked done, pushed, and cleaned up"
599
608
  - [ ] Worktree was removed (check `ls worktrees/`)
609
+ - [ ] Required docs updates were made, or you can explicitly justify `Internal docs`, `Starlight docs`, `Both`, or `None`
600
610
 
601
611
  ---
602
612
 
@@ -66,7 +66,8 @@ cd /path/to/main && pnpm wu:done --id WU-XXX
66
66
  ```
67
67
 
68
68
  If `wu:done` reports branch drift, parallel completions, or a non-fast-forward push, rerun it from
69
- main. It auto-rebases by default when possible. Do not manually rebase `main`.
69
+ main. It auto-rebases the lane branch when possible and also catches up patch-equivalent local-main
70
+ divergence after atomic push. Do not manually rebase `main`.
70
71
 
71
72
  ---
72
73
 
@@ -131,7 +132,7 @@ Feature WUs **must** include `spec_refs` (use `pnpm wu:create --plan` if the pla
131
132
  ### "non-fast-forward" or "branch is behind main"
132
133
 
133
134
  If `wu:done` reports branch drift or a non-fast-forward push, another completion landed while your
134
- WU was in progress.
135
+ WU was in progress or your local `main` needs to catch up after the atomic push path.
135
136
 
136
137
  ```bash
137
138
  # Retry from main first
@@ -142,6 +143,9 @@ pnpm wu:done --id WU-XXX
142
143
  - If the rerun succeeds, you are done.
143
144
  - If the rerun reports an auto-rebase conflict, return to the worktree, resolve the conflict there,
144
145
  rerun `pnpm wu:prep --id WU-XXX` if needed, then retry `wu:done` from main.
146
+ - If the rerun still reports a true local-main mismatch after a completed atomic push, stop and use
147
+ the surfaced recovery guidance or `pnpm wu:recover --id WU-XXX` rather than manually rebasing
148
+ `main`.
145
149
  - Do **not** manually `git rebase` the main checkout.
146
150
 
147
151
  ---