@c4a/context-cli 0.6.0-beta.5 → 0.6.0-beta.6

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 (56) hide show
  1. package/README.md +12 -2
  2. package/cli.js +3498 -2057
  3. package/package.json +2 -2
  4. package/plugin/skills/skill-continue-workflow/SKILL.md +22 -2
  5. package/plugin/skills/skill-prose-align/SKILL.md +25 -9
  6. package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  7. package/plugin/skills/skill-prose-compile/SKILL.md +17 -5
  8. package/plugin/skills/skill-review-gate/SKILL.md +33 -10
  9. package/plugin/skills/skill-source-scope/SKILL.md +165 -105
  10. package/plugin/skills/skill-source-scope/references/capture-source.md +32 -12
  11. package/plugins/VERSION +1 -1
  12. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  13. package/plugins/claude/skills/skill-continue-workflow/SKILL.md +22 -2
  14. package/plugins/claude/skills/skill-prose-align/SKILL.md +25 -9
  15. package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  16. package/plugins/claude/skills/skill-prose-compile/SKILL.md +17 -5
  17. package/plugins/claude/skills/skill-review-gate/SKILL.md +33 -10
  18. package/plugins/claude/skills/skill-source-scope/SKILL.md +165 -105
  19. package/plugins/claude/skills/skill-source-scope/references/capture-source.md +32 -12
  20. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  21. package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +22 -2
  22. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  23. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +25 -9
  24. package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +17 -5
  25. package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +33 -10
  26. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
  27. package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +165 -105
  28. package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +22 -2
  29. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  30. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +25 -9
  31. package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +17 -5
  32. package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +33 -10
  33. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
  34. package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +165 -105
  35. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  36. package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +22 -2
  37. package/plugins/cursor/skills/skill-prose-align/SKILL.md +25 -9
  38. package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  39. package/plugins/cursor/skills/skill-prose-compile/SKILL.md +17 -5
  40. package/plugins/cursor/skills/skill-review-gate/SKILL.md +33 -10
  41. package/plugins/cursor/skills/skill-source-scope/SKILL.md +165 -105
  42. package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +32 -12
  43. package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +22 -2
  44. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  45. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +25 -9
  46. package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +17 -5
  47. package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +33 -10
  48. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
  49. package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +165 -105
  50. package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +22 -2
  51. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
  52. package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +25 -9
  53. package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +17 -5
  54. package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +33 -10
  55. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
  56. package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +165 -105
@@ -54,7 +54,7 @@ Use semantic labels, not SDK function names:
54
54
 
55
55
  Use these rules in the current phase-runner flow:
56
56
 
57
- - Follow the top-level state, `routing.next_commands`, CLI `next_action`, and
57
+ - Follow the top-level state, `routing.command_plan`, CLI `next_action`, and
58
58
  CLI-returned `next_command` values for every write. Treat `allowed_actions[]`
59
59
  as permission for read-only insertions; it is not a menu of alternate write
60
60
  paths.
@@ -200,9 +200,12 @@ context run align:<type>:<source>:<collection> --validate --input <structure.yam
200
200
  ```
201
201
 
202
202
  Validation returns `structure_summary` and writes a temporary HTML report under
203
- `.tmp/context-runtime/reports/`. Use `structure_report.file_url` as the primary
204
- user-facing link, and include `structure_report.absolute_path` as a copyable
205
- fallback. Do not ask the user to confirm a structure they cannot click or open.
203
+ `.tmp/context-runtime/reports/`. A validation report with
204
+ `confirmation_ready=false` is an Agent repair artifact, not a user review gate:
205
+ do not ask the user to approve it. The staged report produced after
206
+ `confirmation_ready=true` is the final review surface; use its
207
+ `structure_report.file_url` as the primary user-facing link and include
208
+ `structure_report.absolute_path` as a copyable fallback.
206
209
  If the user needs a focused view, run:
207
210
 
208
211
  ```bash
@@ -225,14 +228,21 @@ Repair diagnostics by routing them to the right decision:
225
228
  structure or keep the relation unresolved;
226
229
  - stale structure -> regenerate from the current snapshot hash.
227
230
 
228
- When validation returns a new `next_action.command`, follow that exact command.
229
- When it returns blocking diagnostics without a write command, repair and
230
- validate again. Do not stage a structure just because the YAML shape looks
231
- valid.
231
+ When validation returns `repair_confirmation_blockers`, follow its exact repair
232
+ route without stopping for human confirmation. `--repair suggested-splits`
233
+ mechanically splits non-contiguous source mirror Sections; write its
234
+ `repaired_payload` to a scratch YAML file and validate again. For oversized
235
+ Views, use the returned child-View and contains-edge suggestions, but classify
236
+ each child Node from evidence instead of mechanically inheriting the parent
237
+ type. Repair other diagnostics from evidence and validate again. Ask the user only when evidence
238
+ supports multiple incompatible semantic choices, and label that question as a
239
+ structure-design choice rather than final review. Do not stage until
240
+ `confirmation_ready=true`.
232
241
 
233
242
  ### Step 4 — Review Structure Before Confirmation
234
243
 
235
- After validation, and again after a draft structure is staged, show the user:
244
+ After validation reports `confirmation_ready=true`, stage the draft. The stage
245
+ command opens the final report. Then show the user:
236
246
 
237
247
  - node list and planned paths;
238
248
  - section ownership;
@@ -250,6 +260,12 @@ hard stop for structure review. Do not ask for a blind "confirm structure"
250
260
  reply. Surface the report `file_url`, absolute path, and enough structured
251
261
  summary for the user to inspect what will be confirmed.
252
262
 
263
+ Do not turn `confirmation_blockers` into a preliminary approval round. A
264
+ validator-required page split, continuous-source split, ref repair, or
265
+ structure-spine connection is work to resolve before staging. If a genuinely
266
+ ambiguous semantic choice needs the user, ask only that choice and then resume
267
+ repair; it does not replace the final report-based confirmation.
268
+
253
269
  Use the host's multi-choice question tool when available. If unavailable, use a
254
270
  short Markdown fallback. Good options are:
255
271
 
@@ -216,8 +216,10 @@ material to `unresolved[]`.
216
216
 
217
217
  For pure suggested-split repairs, prefer the CLI repair view before hand-editing:
218
218
  `context run align:<type>:<source>:<collection> --repair suggested-splits --input <structure.yaml> --format json`.
219
- It only rewrites section ids/source_refs inside the same view. It does not
220
- create child nodes/views or decide semantic regrouping for you.
219
+ It splits non-contiguous Section mirrors. Oversized Views still require the
220
+ Agent to apply the returned child-View and contains-edge suggestions while
221
+ classifying every child Node from evidence. The repair command does not resolve
222
+ orphan ownership, unsupported evidence, or competing semantic groupings.
221
223
 
222
224
  When the cited source sentence itself is uncertain, preserve that uncertainty on
223
225
  the edge with `confidence: possible` or `confidence: hypothesis`. This is only
@@ -251,7 +253,7 @@ There is no parallel candidate-body authoring path. Emit only the
251
253
 
252
254
  ### Step 6 — Validate And Submit
253
255
 
254
- Before staging, run `context run align:<type>:<source>:<collection> --validate --input - --format json` with the `context.structure.v1` payload. If validate returns blocking diagnostics, repair the exact paths it reports and rerun validate. After validation, show the structure to the user with the structure summary, `structure_report.file_url`, and `structure_report.absolute_path`. If validation returns `confirmation_blockers[]` or `will_block_confirmation`, repair those blockers before asking the user to confirm. If you stage a draft structure first, the stage result is still a human review gate: show the returned report link/summary and ask the user to inspect it before confirming. Only write `lifecycle.state: confirmed` only after explicit confirmation; then run `context run align:<type>:<source>:<collection> --confirm --format json` or pass an explicit file with `--confirm --input <structure.yaml> --format json`.
256
+ Before staging, run `context run align:<type>:<source>:<collection> --validate --input - --format json` with the `context.structure.v1` payload. If validate returns `repair_confirmation_blockers`, follow its repair route and rerun validate without asking for preliminary approval. `--repair suggested-splits` handles non-contiguous source mirror Sections. For oversized Views, apply the returned child-View and contains-edge suggestions while classifying child Nodes from evidence. Resolve other blockers from evidence; ask the user only when evidence supports multiple incompatible semantic choices, and state that this is not final review. Stage only after `confirmation_ready=true`. The stage result opens the final HTML report and is the human review gate: show the structure to the user through `structure_report.file_url`, `structure_report.absolute_path`, and the compact summary before asking for confirmation. Only write `lifecycle.state: confirmed` only after explicit confirmation; then run `context run align:<type>:<source>:<collection> --confirm --format json` or pass an explicit file with `--confirm --input <structure.yaml> --format json`.
255
257
 
256
258
  After stage succeeds, do not rerun the same write command to confirm success.
257
259
  Use `context status --format json` or the returned result for read-only
@@ -60,7 +60,7 @@ Use semantic labels, not SDK function names:
60
60
 
61
61
  ## Runtime Discipline
62
62
 
63
- - Follow `context status`, `routing.next_commands`, compile view
63
+ - Follow `context status`, `routing.command_plan`, compile view
64
64
  `next_action`, and validation diagnostics. Treat CLI commands as the source
65
65
  of truth.
66
66
  - Use only the returned `next_action.command` for the next required write.
@@ -75,6 +75,9 @@ Use semantic labels, not SDK function names:
75
75
  views.
76
76
  - Run one write at a time. Do not parallelize compile stage, review apply,
77
77
  close, or build writes.
78
+ - One write still means one View, not one human Review. Stage every View in the
79
+ same confirmed structure sequentially, follow `continue_compile_batch`, and
80
+ open Review only after the CLI reports that the whole batch is prepared.
78
81
  - Compile does not get a second, looser rule set. If a rule conflicts with the
79
82
  current CLI schema or diagnostics, follow the CLI and repair the payload.
80
83
  - Write digest/hash flags are stale guards. Use values returned by the CLI; do
@@ -226,13 +229,21 @@ Stage only after validation has no errors:
226
229
  context run compile:<type>:<source>:<collection> --stage --input <compile-actions.yaml> --format json
227
230
  ```
228
231
 
229
- After staging, return to `context status`. If status reaches
230
- `compile-ready-for-review`, delegate review to
231
- `${CLAUDE_PLUGIN_ROOT}/skills/skill-review-gate/SKILL.md`.
232
+ After staging, follow `next_action` exactly:
233
+
234
+ - `continue_compile_batch` with `human_gate=false`: move to the returned next
235
+ View and repeat **Step 2–4**. Do not open Review yet.
236
+ - `review_candidates` with `human_gate=true`: every planned View in this
237
+ confirmed structure is prepared; return to `context status`, then delegate
238
+ one collection-level Review to
239
+ `${CLAUDE_PLUGIN_ROOT}/skills/skill-review-gate/SKILL.md`.
240
+
241
+ The CLI blocks Review and close while confirmed Views remain unprepared. Do not
242
+ turn sequential View writes into sequential user approvals.
232
243
 
233
244
  ### Step 5 — Close Handoff
234
245
 
235
- After review apply, return to `context status`. If status says
246
+ After the single batch review apply, return to `context status`. If status says
236
247
  `compile-close-needed`, run deterministic close:
237
248
 
238
249
  ```bash
@@ -257,6 +268,7 @@ Then route to package output when status reaches `ready-to-build`.
257
268
  verbatim text.
258
269
  - [ ] No direct edits were made to `sources/`, `.tmp`, `unapproved/`,
259
270
  `knowledge/`, review HTML, or `dist/`.
271
+ - [ ] Every planned View was staged before opening the one batch Review.
260
272
 
261
273
  ### Final Report
262
274
 
@@ -2,7 +2,7 @@
2
2
  name: skill-review-gate
3
3
  description: >
4
4
  Internal procedure invoked by the public Context continuation entry; not a user slash command.
5
- Opens the review UI, waits for user decisions, applies copied JSONL payloads,
5
+ Opens the review UI, waits for user decisions, applies copied review decision Payloads,
6
6
  and prevents agent-authored approval/rejection decisions unless the user
7
7
  explicitly requests the scoped quick-decision path.
8
8
  tools:
@@ -19,13 +19,16 @@ Run the human review gate. The user decides approval or rejection.
19
19
  - Enter this skill only when the preceding command returns
20
20
  `next_action.human_gate=true`. A no-delta codegraph run returns false and does
21
21
  not need Review.
22
- - Use `context review html <collection> --open` for visual review.
22
+ - For prose, enter only after every View in the confirmed compile batch is
23
+ prepared. For codegraph, enter only after all pending extract phases in the
24
+ confirmed module round are complete. The CLI blocks partial-batch Review.
25
+ - Use `context review html <collection> --open --format json` for visual review.
23
26
  - `<collection>` is an internal production collection such as `architecture`,
24
27
  `sop`, `decision`, or `standards`; it is not an OKF package root such as
25
28
  `wikis`, `guides`, or `rules`.
26
29
  - Always surface the CLI-printed `file_url`. If browser opening fails or the
27
30
  host cannot make a path clickable, also provide `absolute_path`.
28
- - Apply only the JSONL payload copied by the user from the review UI.
31
+ - Apply only the review decision Payload copied by the user from the review UI.
29
32
  - Do not parse `unapproved/entities.jsonl`, `.tmp`, or HTML internals with
30
33
  scripts to synthesize decisions.
31
34
  - If the user explicitly asks for quick or automated approval/rejection, use
@@ -34,7 +37,11 @@ Run the human review gate. The user decides approval or rejection.
34
37
  these commands still enforce the current scoped candidate-id gate.
35
38
  - `context run <extract-phase-id> --auto-promote` is a separate, explicit
36
39
  codegraph-only CI/CD policy. It may apply code add/update/remove deltas and
37
- verify them without this gate; it never applies to semantic knowledge.
40
+ refresh deterministic close, and verify them without this gate; it never
41
+ applies to semantic knowledge. Package build remains an explicit later step.
42
+ - `approved-source-ref-ambiguous` on beta.5 approved codegraph pages is an
43
+ evidence migration, not a new review decision. Rerun the declared codegraph
44
+ extraction, then run `context review migrate-codegraph-refs` and verify.
38
45
 
39
46
  <procedures>
40
47
 
@@ -43,12 +50,14 @@ Run the human review gate. The user decides approval or rejection.
43
50
  For the internal collection reported by status, run:
44
51
 
45
52
  ```bash
46
- context review html <collection> --open
53
+ context review html <collection> --open --format json
47
54
  ```
48
55
 
49
- Tell the user where the page opened and include the CLI-printed `file_url` as a
50
- clickable link plus `absolute_path` as a copyable fallback. Do not assume a
51
- fixed review filename; review scope is collection or `--all`.
56
+ Inspect the returned `opened` field. When it is `true`, tell the user the page
57
+ was opened. When it is `false`, do not claim it opened; report `open_error` and
58
+ provide `file_url` as the primary clickable link plus `absolute_path` as a
59
+ copyable fallback. Do not drop `--open`, and do not assume a fixed review
60
+ filename; review scope is collection or `--all`.
52
61
  Do not substitute OKF package roots (`wikis`, `guides`, `rules`) for this
53
62
  argument; review scope is the internal collection namespace.
54
63
 
@@ -60,7 +69,8 @@ must not choose these states.
60
69
  ### Step 2 — Wait For Payload
61
70
 
62
71
  Ask the user to review candidates in the HTML page, open Payload, copy the
63
- compact JSONL payload, and paste it into the agent chat. The payload records the
72
+ compact review decision Payload, and paste it into the agent chat. Uniform
73
+ decisions produce one JSON line; exceptions add JSONL lines. The Payload records the
64
74
  user's decisions, usually as a default decision plus exceptions, so it should
65
75
  not be expanded into pretty JSON unless the user asks.
66
76
 
@@ -68,7 +78,7 @@ The user should not need to create a payload file manually. Do not continue
68
78
  until the user supplies that payload.
69
79
 
70
80
  If the user instead explicitly asks the agent to use the quick approval or
71
- rejection path, do not synthesize JSONL. Run the scoped quick command with the
81
+ rejection path, do not synthesize a decision Payload. Run the scoped quick command with the
72
82
  candidate id shown by review/list/status and either `--collection <collection>`
73
83
  or `--all`.
74
84
 
@@ -91,6 +101,19 @@ commands to store this payload.
91
101
  Run `context status` after apply. If it reports package output choice, return to
92
102
  `${CLAUDE_PLUGIN_ROOT}/skills/skill-continue-workflow/SKILL.md`.
93
103
 
104
+ If status instead reports `approved-source-ref-ambiguous` for a pre-file-aware
105
+ codegraph ref, explain that the user's decisions remain approved. Rerun its
106
+ declared extraction phase to refresh the symbol index, then run:
107
+
108
+ ```bash
109
+ context review migrate-codegraph-refs
110
+ context verify
111
+ ```
112
+
113
+ Do not reopen Review, synthesize another payload, delete approved pages, or
114
+ filter conflicting symbols. If the ref is already file-aware, report a
115
+ duplicate extract-index defect rather than running the metadata migration.
116
+
94
117
  ### Step 5 — Self-verify Checklist
95
118
 
96
119
  - [ ] Every decision came from the user's copied payload. If not, stop and