@c4a/context-cli 0.6.0-alpha.6 → 0.6.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +5288 -8006
- package/package.json +2 -1
- package/plugin/skills/skill-prose-align/SKILL.md +23 -9
- package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugin/skills/skill-prose-compile/SKILL.md +17 -8
- package/plugin/skills/skill-review-gate/SKILL.md +5 -5
- package/plugin/skills/skill-source-scope/SKILL.md +91 -68
- package/plugin/skills/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/VERSION +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/skills/skill-prose-align/SKILL.md +23 -9
- package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugins/claude/skills/skill-prose-compile/SKILL.md +17 -8
- package/plugins/claude/skills/skill-review-gate/SKILL.md +5 -5
- package/plugins/claude/skills/skill-source-scope/SKILL.md +91 -68
- package/plugins/claude/skills/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/codex/.codex-plugin/plugin.json +2 -2
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +23 -9
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +17 -8
- package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +5 -5
- package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +91 -68
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +23 -9
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +17 -8
- package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +5 -5
- package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +91 -68
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor/skills/skill-prose-align/SKILL.md +23 -9
- package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugins/cursor/skills/skill-prose-compile/SKILL.md +17 -8
- package/plugins/cursor/skills/skill-review-gate/SKILL.md +5 -5
- package/plugins/cursor/skills/skill-source-scope/SKILL.md +91 -68
- package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +23 -9
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +17 -8
- package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +5 -5
- package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +91 -68
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning/references/gates.md +44 -10
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +32 -1
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +23 -9
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +17 -8
- package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +5 -5
- package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +12 -11
- package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +91 -68
- package/babel.cjs +0 -257
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c4a/context-cli",
|
|
3
|
-
"version": "0.6.0-
|
|
3
|
+
"version": "0.6.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"context": "./cli.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
+
"@c4a/context": "0.6.0-beta.2",
|
|
9
10
|
"commander": "^11.0.0",
|
|
10
11
|
"handlebars": "^4.7.8",
|
|
11
12
|
"ink": "^5.0.0",
|
|
@@ -23,10 +23,14 @@ Turn captured document evidence into confirmed structure.
|
|
|
23
23
|
and view set returned by the CLI.
|
|
24
24
|
- Write and validate `context.structure.v1` into `unapproved/structure.yaml`.
|
|
25
25
|
Stop for user confirmation before compile.
|
|
26
|
-
- Before classifying nodes, section plans, edges,
|
|
26
|
+
- Before classifying nodes, section plans, edges, support strength, duplicates,
|
|
27
27
|
conflicts, ownership, or unresolved items, read the current procedure
|
|
28
28
|
references listed by the CLI as `semantic_reference_files`. These references
|
|
29
29
|
are the current structure judgment rules, not summaries.
|
|
30
|
+
- Plan source evidence as Sections before promoting any heading to a Node/View.
|
|
31
|
+
Local FAQ, decision, incident, warning, or reference fragments normally stay
|
|
32
|
+
under the owning View unless source evidence proves independent retrieval
|
|
33
|
+
identity.
|
|
30
34
|
- Do not produce or validate a structure payload from this entry file alone. If
|
|
31
35
|
the relevant `semantic_reference_files` have not been read in the current
|
|
32
36
|
turn, stop and read them first.
|
|
@@ -195,15 +199,23 @@ Validate:
|
|
|
195
199
|
context run align:<type>:<source>:<collection> --validate --input <structure.yaml> --format json
|
|
196
200
|
```
|
|
197
201
|
|
|
198
|
-
Validation returns `structure_summary` and writes a temporary
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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.
|
|
206
|
+
If the user needs a focused view, run:
|
|
202
207
|
|
|
203
208
|
```bash
|
|
204
209
|
context run align:<type>:<source>:<collection> --view structure-summary --input <structure.yaml> --format json
|
|
205
210
|
```
|
|
206
211
|
|
|
212
|
+
The CLI response may include a large full `structure_summary` for debugging and
|
|
213
|
+
report rendering. For user confirmation, prioritize the first-screen fields:
|
|
214
|
+
`review_notice`, `structure_report`, and `structure_summary_compact`. A valid
|
|
215
|
+
user-facing confirmation prompt must include the report `file_url`, the absolute
|
|
216
|
+
path fallback, and a compact summary of collections/views/unresolved/diagnostics.
|
|
217
|
+
Do not ask the user to confirm from counts alone.
|
|
218
|
+
|
|
207
219
|
Repair diagnostics by routing them to the right decision:
|
|
208
220
|
|
|
209
221
|
- source ref or snapshot mismatch -> reread evidence views or refresh capture;
|
|
@@ -228,13 +240,15 @@ After validation, and again after a draft structure is staged, show the user:
|
|
|
228
240
|
- expected compile order;
|
|
229
241
|
- downstream impact: these choices freeze paths, section ownership, and
|
|
230
242
|
relationships for this compile round.
|
|
231
|
-
- the `structure_report.
|
|
232
|
-
structure-summary
|
|
243
|
+
- the `structure_report.file_url` generated by validate or `--view
|
|
244
|
+
structure-summary`;
|
|
245
|
+
- the `structure_report.absolute_path` fallback in case the host cannot click
|
|
246
|
+
file URLs.
|
|
233
247
|
|
|
234
248
|
If the CLI stage result includes `next_action.human_gate: true`, treat it as a
|
|
235
249
|
hard stop for structure review. Do not ask for a blind "confirm structure"
|
|
236
|
-
reply. Surface the report path and enough structured
|
|
237
|
-
inspect what will be confirmed.
|
|
250
|
+
reply. Surface the report `file_url`, absolute path, and enough structured
|
|
251
|
+
summary for the user to inspect what will be confirmed.
|
|
238
252
|
|
|
239
253
|
Use the host's multi-choice question tool when available. If unavailable, use a
|
|
240
254
|
short Markdown fallback. Good options are:
|
|
@@ -22,12 +22,10 @@ Answer in this order and stop at the first match:
|
|
|
22
22
|
1. **Action?** A large executable event / process with both:
|
|
23
23
|
- scale: can support `planned_sections` with at least two distinct Section kinds, or contains at least one child Action;
|
|
24
24
|
- process evidence: explicit steps, phases, trigger -> handling -> result, role collaboration, or repeatable plan. Parallel lists such as "three API modes" are not process evidence.
|
|
25
|
-
Single-section
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
scenario, or tracking evidence; otherwise keep the material as a Section
|
|
30
|
-
under the owning Node.
|
|
25
|
+
Single-section user-story / scenario / incident records may be meaningful to
|
|
26
|
+
a human reader, but the CLI does not infer that exception from source prose.
|
|
27
|
+
If the structure cannot express at least two distinct Section kinds or a
|
|
28
|
+
child Action, keep the material as a Section under the owning Node.
|
|
31
29
|
2. **Entity?** A concrete independent subject with retrieval value: deployable code, product/application/system, library/module/CLI/symbol, or an atomic term/pattern.
|
|
32
30
|
3. **Domain?** A container/scope that groups at least one child Node.
|
|
33
31
|
4. Otherwise do not create a Node; leave the material for compile as a Section under the owning Node.
|
|
@@ -75,6 +73,36 @@ scope/process suffixes.
|
|
|
75
73
|
|
|
76
74
|
For no-write placeholder summaries, describe only the preserved page identity and unresolved navigation clues. Do not say the Node "provides navigation/links/relations to X" unless those targets are resolved graph children or rendered links; say the source contains deferred navigation clues instead.
|
|
77
75
|
|
|
76
|
+
## Section Promotion Gate
|
|
77
|
+
|
|
78
|
+
Classify local evidence as a Section before creating a child Node/View. A
|
|
79
|
+
heading, table row, FAQ label, or short sub-topic does not by itself establish a
|
|
80
|
+
standalone page.
|
|
81
|
+
|
|
82
|
+
Promote a Section to a child View only when at least one condition is supported
|
|
83
|
+
by source evidence:
|
|
84
|
+
|
|
85
|
+
1. The title is a concrete product/code object/system/module/library, not just a
|
|
86
|
+
local heading.
|
|
87
|
+
2. The item is an atomic term or pattern that answers standalone lookup
|
|
88
|
+
questions outside the parent page.
|
|
89
|
+
3. The item clears the Action Gate or Domain Gate.
|
|
90
|
+
4. The source gives it independent article identity: owner/date, lifecycle,
|
|
91
|
+
timeline, tracking record, or cross-cutting support scope.
|
|
92
|
+
|
|
93
|
+
Hard repairs:
|
|
94
|
+
|
|
95
|
+
| Pattern | Repair |
|
|
96
|
+
|---|---|
|
|
97
|
+
| One local Q&A under a product/system page | `faq` Section under the owning View |
|
|
98
|
+
| One-off conclusion or trade-off note | `decision` Section under the owning View |
|
|
99
|
+
| Warning/failure note without incident identity | `warning` or `incident` Section under the owning View |
|
|
100
|
+
| Reference/link bucket with no body | `unresolved[]` or omit, not an Entity page |
|
|
101
|
+
| Many same-source, single-section child Entities under one parent | Merge them into parent Sections unless each child has standalone lookup identity |
|
|
102
|
+
|
|
103
|
+
The CLI treats section-like child Views as invalid unless the payload provides
|
|
104
|
+
source-backed independent identity through the surrounding structure.
|
|
105
|
+
|
|
78
106
|
## Entity Tag Rules
|
|
79
107
|
|
|
80
108
|
Use `tags` to state what the Entity is. Legal combinations:
|
|
@@ -88,6 +116,11 @@ Use `tags` to state what the Entity is. Legal combinations:
|
|
|
88
116
|
|
|
89
117
|
`term` is mutually exclusive with A/B tags. React is `[lib]`, not `[lib, term]`; if a separate term entry is useful, create another Entity tagged `[term]` and let the structure plan express the relation as a typed edge or unresolved relation with `source_refs[]`.
|
|
90
118
|
|
|
119
|
+
Do not inherit scope tags mechanically. If a parent Entity is tagged `system` or
|
|
120
|
+
`application`, a child Entity should repeat that tag only when it is itself an
|
|
121
|
+
independent system/application. Local aspects under that parent should either
|
|
122
|
+
use their own shape tag or remain Sections.
|
|
123
|
+
|
|
91
124
|
## Action Gate
|
|
92
125
|
|
|
93
126
|
Use `node_type: action` only after the Node Type Order says action. Fill the
|
|
@@ -105,7 +138,7 @@ bar is:
|
|
|
105
138
|
| `is_repeatable_or_planned` | The work is repeatable, scheduled, policy-like, or intentionally planned. | May be inferred; record the source. |
|
|
106
139
|
| `queries_answerable_with_refs` | The Node can answer how/when/who/what-to-do questions from cited spans. | May be inferred; record the source. |
|
|
107
140
|
|
|
108
|
-
Do not emit an Action for a single sentence, a one-off conclusion, a short operation, or a parallel enumeration. Those become Sections under the owning Entity or Domain. The
|
|
141
|
+
Do not emit an Action for a single sentence, a one-off conclusion, a short operation, or a parallel enumeration. Those become Sections under the owning Entity or Domain. The CLI does not infer single-Section Action exceptions from source prose; represent the material with enough structure or keep it as a Section.
|
|
109
142
|
|
|
110
143
|
Action anti-examples:
|
|
111
144
|
|
|
@@ -209,7 +242,7 @@ Each source must include `rationale` when inferred and at least one of `source_r
|
|
|
209
242
|
## Final Reflection
|
|
210
243
|
|
|
211
244
|
- Entity cannot pick a legal tag, or depends on its upstream title to make sense -> write it as a Section under the upstream Node or change type before submit.
|
|
212
|
-
- Action only supports one Section -> write it as a Section instead of an Action,
|
|
245
|
+
- Action only supports one Section -> write it as a Section instead of an Action, or add source-backed structure that reaches at least two distinct Section kinds / one child Action. The CLI does not use source prose keywords to grant an exception.
|
|
213
246
|
- Action "steps" are parallel options/configs -> route to Entity `comparison` / `spec` / `description`.
|
|
214
247
|
- Domain has no children -> delete it or merge it into a larger Domain.
|
|
215
248
|
|
|
@@ -225,11 +258,12 @@ checks as deterministic diagnostics:
|
|
|
225
258
|
| `tags.term_conflict` | An Entity uses `term` together with concrete runtime/product tags such as `lib`, `service`, `application`, or `system`. | Split the term from the concrete object, or remove the conflicting tag before staging. |
|
|
226
259
|
| `node.description_dominates` | A non-Action Node has at least half of its planned Sections as `description`. | Re-run kind precision. Keep it only when source evidence is genuinely narrative; otherwise split into `example`, `spec`, `comparison`, `faq`, `incident`, `decision`, `warning`, or `principle`. |
|
|
227
260
|
| `node.thin_concrete_entity` | A concrete Entity has one Section and no child Nodes. | Keep it only when it has stable standalone retrieval value; otherwise merge it into the owning Node. |
|
|
261
|
+
| `node.children_should_be_sections` | One parent contains many same-source, single-section child Entities with no stable shape tag. | Merge those children into parent Sections unless the user confirms each child has standalone lookup value. |
|
|
228
262
|
| `node.term_expanded_beyond_definition` | A `term` Entity has grown past a compact definition or owns children. | Move rules, procedures, designs, and examples to the owning Node; keep the term entry narrow. |
|
|
229
|
-
| `node.action_too_thin` | An Action has fewer than two distinct planned Section kinds and no child Action. | Downgrade it to a Section under the owning Node
|
|
263
|
+
| `node.action_too_thin` | An Action has fewer than two distinct planned Section kinds and no child Action. | Downgrade it to a Section under the owning Node, add a distinct Section kind, or add a child Action; the CLI does not infer a single-section exception from source text. |
|
|
230
264
|
| `node.domain_without_children` | A Domain has no source-backed `contains` child edge. | Add supported children, keep an explicitly confirmed no-write placeholder, or reclassify the Node. |
|
|
265
|
+
| `tags.child_inherits_system` | A child Entity repeats its parent `system` / `application` scope tag. | Retag by the child’s own shape/scope, or keep the child as a Section if it is only a local aspect. |
|
|
231
266
|
| `edge.confidence_invalid` | An edge declares a confidence value outside the current schema. | Use only `possible` or `hypothesis`, or omit the field for source-certain relations. |
|
|
232
|
-
| `edge.confidence_required` | The cited relation sentence contains source-level uncertainty such as "可能", "疑似", "may", or "might". | Preserve source-authored uncertainty with `confidence: possible` / `confidence: hypothesis`, or move the relation to `unresolved[]`. |
|
|
233
267
|
|
|
234
268
|
Warnings are not automatic blockers, but they are not suggestions to ignore.
|
|
235
269
|
Resolve them or include the user-confirmed rationale when confirming structure.
|
package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md
CHANGED
|
@@ -151,6 +151,24 @@ the shared evidence.
|
|
|
151
151
|
|
|
152
152
|
Source titles and headings are ordinary evidence, not structural authority. Choose titles and summaries that fit the final Node type and the CLI-provided generation policy.
|
|
153
153
|
|
|
154
|
+
Plan source material as Sections first. A source heading only becomes a child
|
|
155
|
+
Node/View when the cited evidence names a concrete independent subject, an
|
|
156
|
+
atomic term, a gated Action, or a child-bearing Domain. A `contains` edge only
|
|
157
|
+
states hierarchy; it does not prove that a thin child page has standalone
|
|
158
|
+
retrieval value.
|
|
159
|
+
|
|
160
|
+
Avoid same-source fragmentation. If one parent would contain many single-section
|
|
161
|
+
child Entities from the same source document, keep them as Sections unless each
|
|
162
|
+
child has an independent product/code object, atomic term, Action, or Domain
|
|
163
|
+
identity. Also avoid copying the parent `system` / `application` scope tag onto
|
|
164
|
+
local child aspects; tag a child by what it independently is.
|
|
165
|
+
|
|
166
|
+
Do not promote local support fragments into child pages. FAQ, decision, and
|
|
167
|
+
incident snippets under an owning topic stay as `faq`, `decision`, or
|
|
168
|
+
`incident` Sections unless the source proves an independent article, lifecycle,
|
|
169
|
+
timeline, owner/date, or cross-cutting retrieval scope. The CLI will reject
|
|
170
|
+
section-like child views before confirmation.
|
|
171
|
+
|
|
154
172
|
For `node.title` and `node.summary`, follow the workspace/source language
|
|
155
173
|
surfaced by the current view or the user's instruction. In Chinese workspaces,
|
|
156
174
|
translate descriptive scaffold words such as architecture, strategy, lifecycle,
|
|
@@ -188,6 +206,19 @@ structure gate. Current compile writes approved knowledge by mirroring source
|
|
|
188
206
|
spans; it does not use rewritten multi-ref sections to compress unrelated
|
|
189
207
|
evidence.
|
|
190
208
|
|
|
209
|
+
Validate will surface source mirror blockers before confirmation. Treat
|
|
210
|
+
`section.source_mirror_split_required`,
|
|
211
|
+
`section.source_mirror_repair_required`, and
|
|
212
|
+
`section.source_mirror_source_refs_missing` as structure problems, not compile
|
|
213
|
+
drafting problems. Use the returned `repair.suggested_splits[]` when present;
|
|
214
|
+
otherwise repair source refs from CLI evidence views or move unsupported
|
|
215
|
+
material to `unresolved[]`.
|
|
216
|
+
|
|
217
|
+
For pure suggested-split repairs, prefer the CLI repair view before hand-editing:
|
|
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.
|
|
221
|
+
|
|
191
222
|
When the cited source sentence itself is uncertain, preserve that uncertainty on
|
|
192
223
|
the edge with `confidence: possible` or `confidence: hypothesis`. This is only
|
|
193
224
|
for source-authored uncertainty such as "可能", "疑似", "may", or "might". If
|
|
@@ -220,7 +251,7 @@ There is no parallel candidate-body authoring path. Emit only the
|
|
|
220
251
|
|
|
221
252
|
### Step 6 — Validate And Submit
|
|
222
253
|
|
|
223
|
-
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 and `structure_report.
|
|
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`.
|
|
224
255
|
|
|
225
256
|
After stage succeeds, do not rerun the same write command to confirm success.
|
|
226
257
|
Use `context status --format json` or the returned result for read-only
|
|
@@ -21,9 +21,12 @@ Compile confirmed document structure into reviewable draft knowledge.
|
|
|
21
21
|
- The input is already confirmed `context.structure.v1`; do not redesign node
|
|
22
22
|
ownership, page paths, or relationships here. Return to prose align if those
|
|
23
23
|
are wrong.
|
|
24
|
-
- Read compile context through CLI views only: `
|
|
25
|
-
`schema`.
|
|
26
|
-
|
|
24
|
+
- Read compile context through CLI views only: `blockers`, `read-plan`,
|
|
25
|
+
`node-context`, and `schema`. Start with `blockers` for large or recently
|
|
26
|
+
repaired structures; if it returns section blockers, return to prose align
|
|
27
|
+
instead of drafting compile actions. Use align evidence views only when the
|
|
28
|
+
compile view or validation output gives a specific source ref that needs exact
|
|
29
|
+
text.
|
|
27
30
|
- Emit `context.compile-actions.v1`; the CLI mirrors source spans, derives
|
|
28
31
|
`content_mode`, writes review candidates, and enforces source-bound evidence.
|
|
29
32
|
- The `summary` field in each action is the Agent-authored behavior half only:
|
|
@@ -88,14 +91,17 @@ Use semantic labels, not SDK function names:
|
|
|
88
91
|
Recommended read order:
|
|
89
92
|
|
|
90
93
|
```bash
|
|
94
|
+
context run compile:<type>:<source>:<collection> --view blockers --format json
|
|
91
95
|
context run compile:<type>:<source>:<collection> --view read-plan --format json
|
|
92
96
|
context run compile:<type>:<source>:<collection> --view node-context --source <view-ref> --format json
|
|
93
97
|
context run compile:<type>:<source>:<collection> --view schema --format json
|
|
94
98
|
```
|
|
95
99
|
|
|
96
100
|
Use CLI-returned `available_view_refs`, `planned_sections`, `local_sources`, and
|
|
97
|
-
`next_action.command`.
|
|
98
|
-
|
|
101
|
+
`next_action.command`. If `blockers.section_blockers[]` is non-empty, repair the
|
|
102
|
+
structure through align first; do not inspect every node or hand-split compile
|
|
103
|
+
actions. Do not reconstruct the structure by opening `unapproved/structure.yaml`
|
|
104
|
+
or `knowledge/structure.yaml` directly.
|
|
99
105
|
|
|
100
106
|
## Procedure References
|
|
101
107
|
|
|
@@ -134,12 +140,15 @@ relationship reference blocks.
|
|
|
134
140
|
Run:
|
|
135
141
|
|
|
136
142
|
```bash
|
|
143
|
+
context run compile:<type>:<source>:<collection> --view blockers --format json
|
|
137
144
|
context run compile:<type>:<source>:<collection> --view read-plan --format json
|
|
138
145
|
```
|
|
139
146
|
|
|
140
|
-
Use the returned node list, source overview, and next action. If the
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
Use the returned blockers, node list, source overview, and next action. If the
|
|
148
|
+
blockers view reports section blockers, return to prose align and repair the
|
|
149
|
+
confirmed structure before compile. If the CLI says the structure is missing,
|
|
150
|
+
unconfirmed, stale, frozen against the wrong snapshot, or invalid, return to
|
|
151
|
+
prose align or source capture as indicated.
|
|
143
152
|
|
|
144
153
|
### Step 2 — Inspect One Node
|
|
145
154
|
|
|
@@ -20,8 +20,8 @@ Run the human review gate. The user decides approval or rejection.
|
|
|
20
20
|
- `<collection>` is an internal production collection such as `architecture`,
|
|
21
21
|
`sop`, `decision`, or `standards`; it is not an OKF package root such as
|
|
22
22
|
`wikis`, `guides`, or `rules`.
|
|
23
|
-
-
|
|
24
|
-
`
|
|
23
|
+
- Always surface the CLI-printed `file_url`. If browser opening fails or the
|
|
24
|
+
host cannot make a path clickable, also provide `absolute_path`.
|
|
25
25
|
- Apply only the JSONL payload copied by the user from the review UI.
|
|
26
26
|
- Do not parse `unapproved/entities.jsonl`, `.tmp`, or HTML internals with
|
|
27
27
|
scripts to synthesize decisions.
|
|
@@ -40,9 +40,9 @@ For the internal collection reported by status, run:
|
|
|
40
40
|
context review html <collection> --open
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Tell the user where the page opened
|
|
44
|
-
`
|
|
45
|
-
|
|
43
|
+
Tell the user where the page opened and include the CLI-printed `file_url` as a
|
|
44
|
+
clickable link plus `absolute_path` as a copyable fallback. Do not assume a
|
|
45
|
+
fixed review filename; review scope is collection or `--all`.
|
|
46
46
|
Do not substitute OKF package roots (`wikis`, `guides`, `rules`) for this
|
|
47
47
|
argument; review scope is the internal collection namespace.
|
|
48
48
|
|
|
@@ -21,22 +21,21 @@ Choose and validate what may become draft knowledge.
|
|
|
21
21
|
file source, or Lark/Feishu document. Current CLI can execute repo sources,
|
|
22
22
|
local file sources, and Lark document capture through the declared flow.
|
|
23
23
|
- Treat source registration as a knowledge-boundary decision, not a parameter
|
|
24
|
-
prompt.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
prompt. Do not invent semantic source names from paths, filenames, or source
|
|
25
|
+
body content. By default, omit the source name and let the CLI use today's
|
|
26
|
+
date (`YYYYMMDD`) as the source namespace. Explain that this namespace appears
|
|
27
|
+
in source refs, phase ids, and package naming; approved knowledge paths are
|
|
28
|
+
derived later from collection, containment, and slug.
|
|
29
|
+
- If the default date source name already exists, stop and ask the user which
|
|
30
|
+
explicit date name to use. Do not auto-append sequence numbers and do not
|
|
31
|
+
summarize the source theme as a fallback.
|
|
32
32
|
- Do not infer a source from cwd, parent directories, package names, monorepo
|
|
33
33
|
layout, or git remote.
|
|
34
34
|
- In monorepos, one source may conceptually be the whole repo/subspace or one
|
|
35
35
|
package/subdirectory. If the user wants one package manual, prefer the
|
|
36
36
|
package/subdirectory. If the user wants one unified knowledge product across
|
|
37
|
-
modules, explain that the source
|
|
38
|
-
|
|
39
|
-
extraction rules derive those refs. Current repo extraction
|
|
37
|
+
modules, explain that the date source namespace can be used in codegraph
|
|
38
|
+
NodeRefs when extraction rules derive grouped refs. Current repo extraction
|
|
40
39
|
still requires choosing a concrete single-module extraction boundary before
|
|
41
40
|
running extraction; do not run extraction against an ambiguous multi-module
|
|
42
41
|
source.
|
|
@@ -74,11 +73,29 @@ Ask for a knowledge source in plain language and map it to the supported path:
|
|
|
74
73
|
|
|
75
74
|
| User source | What to ask for | Current handling |
|
|
76
75
|
|---|---|---|
|
|
77
|
-
| Local code repo | knowledge boundary
|
|
78
|
-
| Local monorepo package/module | whether the source is the whole repo/subspace or one package/subdir;
|
|
79
|
-
| Remote Git repo | knowledge boundary,
|
|
80
|
-
| Local Markdown / document file or folder | document boundary,
|
|
81
|
-
| Lark / Feishu document | document URL/token, intended collection, and permission to read remotely | Register with `context source add lark
|
|
76
|
+
| Local code repo | knowledge boundary and local repo path | Register with `context source add repo --local <path>` unless the user explicitly provides a date source name. CLI records git root + optional `subpath`; `sources/repo/YYYYMMDD` becomes an ignored symlink to the chosen repo/subdir view. |
|
|
77
|
+
| Local monorepo package/module | whether the source is the whole repo/subspace or one package/subdir; chosen path | Register the chosen boundary as the repo source. If the user wants one package manual, register that package/subdir. If the user wants a unified subspace manual, register the subspace. Do not use `extractTs.include` as a package selector. |
|
|
78
|
+
| Remote Git repo | knowledge boundary, remote URL, pinned commit/ref, desired package/subdir, and permission to clone | CLI does not clone automatically. After explicit user approval, the agent may clone/checkout to an ignored local path, then register that local checkout. Cloned source content must not be committed. |
|
|
79
|
+
| Local Markdown / document file or folder | document boundary, local path, include glob or include-list if needed, and permission to read the source body | Register with `context source add file --local <path>`, declare the matching capture phase, then hand off to material investigation and structure drafting after capture. Do not run capture before the user confirms read permission. |
|
|
80
|
+
| Lark / Feishu document | document URL/token, intended collection, and permission to read remotely | Register with `context source add lark` plus exactly one of `--url`, `--doc-token`, or `--wiki-token`; declare the matching capture phase, then hand off to material investigation and structure drafting after capture. Explain that capture writes a committed snapshot under `sources/lark/YYYYMMDD/`, supports offline verify/fresh clone reproduction, and does not write credentials. Do not fetch through ad hoc scripts. |
|
|
81
|
+
|
|
82
|
+
When asking for a document mainline collection, do not ask only "which
|
|
83
|
+
collection?". Explain every available option in product language:
|
|
84
|
+
|
|
85
|
+
| Collection | Use when the source is mainly about |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `business` | 业务域、业务对象、行业/组织概念、非技术的领域知识 |
|
|
88
|
+
| `product` | PRD、用户故事、产品行为、需求说明、验收口径 |
|
|
89
|
+
| `architecture` | 系统架构、组件/模块设计、技术方案、工具链、平台能力 |
|
|
90
|
+
| `sop` | SOP、操作流程、排障步骤、oncall/runbook、巡检维护 |
|
|
91
|
+
| `faq` | 问答集合、常见问题、按问题检索的解释和处理建议 |
|
|
92
|
+
| `standards` | 规范、标准、约束、检查清单、合规/质量规则 |
|
|
93
|
+
| `decision` | 明确的方案选择、取舍理由、ADR、决策记录 |
|
|
94
|
+
| `incident` | 事故复盘、故障时间线、影响面、根因、处置和预防措施 |
|
|
95
|
+
| `test` | 测试计划、测试场景、验证矩阵、验收用例 |
|
|
96
|
+
|
|
97
|
+
Do not offer `codegraph` or `feats` for prose document alignment. `codegraph`
|
|
98
|
+
comes from code extraction, and `feats` is a later feature namespace.
|
|
82
99
|
|
|
83
100
|
</reference>
|
|
84
101
|
|
|
@@ -92,48 +109,48 @@ choice:
|
|
|
92
109
|
|
|
93
110
|
```text
|
|
94
111
|
You are choosing what one source means for this knowledge workspace.
|
|
95
|
-
The source name becomes part of source refs and phase ids. Approved knowledge
|
|
112
|
+
The date source name becomes part of source refs and phase ids. Approved knowledge
|
|
96
113
|
paths are derived later from collection, containment, and slug. NodeRef and
|
|
97
114
|
ViewRef are identity fields, not path strings.
|
|
98
115
|
|
|
99
116
|
If the source is one package:
|
|
100
|
-
knowledge/codegraph/
|
|
101
|
-
repo:
|
|
102
|
-
capture:file:
|
|
103
|
-
dist/
|
|
117
|
+
knowledge/codegraph/YYYYMMDD/...
|
|
118
|
+
repo:YYYYMMDD#symbol:...
|
|
119
|
+
capture:file:YYYYMMDD
|
|
120
|
+
dist/YYYYMMDD-kb/
|
|
104
121
|
|
|
105
122
|
If the source is one document source:
|
|
106
123
|
knowledge/architecture/entity/example.md
|
|
107
|
-
file:
|
|
108
|
-
align:file:
|
|
109
|
-
dist/
|
|
124
|
+
file:YYYYMMDD/getting-started.md#span:...
|
|
125
|
+
align:file:YYYYMMDD:architecture
|
|
126
|
+
dist/YYYYMMDD-kb/
|
|
110
127
|
|
|
111
128
|
If the source is a parent monorepo/subspace namespace, later multi-module
|
|
112
129
|
outputs can be shaped like:
|
|
113
|
-
knowledge/codegraph/
|
|
114
|
-
knowledge/codegraph/
|
|
130
|
+
knowledge/codegraph/YYYYMMDD/component-web/...
|
|
131
|
+
knowledge/codegraph/YYYYMMDD/component-lynx/...
|
|
115
132
|
```
|
|
116
133
|
|
|
117
|
-
If the source already points at one package/module root, the
|
|
118
|
-
|
|
119
|
-
chosen source boundary intentionally covers multiple modules. In the
|
|
120
|
-
parent source as a planning/inspection boundary
|
|
121
|
-
package/subdirectory source before real extraction.
|
|
134
|
+
If the source already points at one package/module root, the source namespace
|
|
135
|
+
is still the date name. An extra module/package segment is only expected when
|
|
136
|
+
the chosen source boundary intentionally covers multiple modules. In the
|
|
137
|
+
current workflow, treat that parent source as a planning/inspection boundary
|
|
138
|
+
first; choose a concrete package/subdirectory source before real extraction.
|
|
122
139
|
|
|
123
140
|
When the user has already provided a path, describe the current interpretation
|
|
124
|
-
|
|
141
|
+
and use the CLI date default:
|
|
125
142
|
|
|
126
143
|
```text
|
|
127
144
|
I am treating this path as the source boundary:
|
|
128
145
|
<path>
|
|
129
146
|
|
|
130
|
-
If this path is one package/module, the source name will be used
|
|
131
|
-
source refs such as repo
|
|
147
|
+
If this path is one package/module, the date source name will be used in
|
|
148
|
+
source refs such as repo:YYYYMMDD#...
|
|
132
149
|
|
|
133
150
|
If this path is a parent monorepo/subspace that contains multiple modules, the
|
|
134
|
-
source name becomes the parent source namespace for grouped codegraph NodeRefs
|
|
151
|
+
date source name becomes the parent source namespace for grouped codegraph NodeRefs
|
|
135
152
|
when extraction derives those refs:
|
|
136
|
-
knowledge/codegraph/<
|
|
153
|
+
knowledge/codegraph/YYYYMMDD/<module-name>/...
|
|
137
154
|
|
|
138
155
|
For the current extraction flow, a multi-module parent source is used for
|
|
139
156
|
inspection/planning first. Before reading code, we still need a concrete
|
|
@@ -148,8 +165,9 @@ Then ask for one of:
|
|
|
148
165
|
- Lark/Feishu document URL.
|
|
149
166
|
|
|
150
167
|
Do not ask "what is the source name?" as the first or only question. Ask what
|
|
151
|
-
they want the knowledge source to cover, then
|
|
152
|
-
|
|
168
|
+
they want the knowledge source to cover, then use the date default. Ask for an
|
|
169
|
+
explicit date name only when today's source name already exists or the user
|
|
170
|
+
asks to override it.
|
|
153
171
|
|
|
154
172
|
Good user-facing wording:
|
|
155
173
|
|
|
@@ -158,22 +176,22 @@ Next we need to add a knowledge source.
|
|
|
158
176
|
|
|
159
177
|
If you only want a manual for the component package, choose that package
|
|
160
178
|
directory as the source boundary, for example:
|
|
161
|
-
name:
|
|
179
|
+
name: YYYYMMDD
|
|
162
180
|
path: /repo/packages/component-lib
|
|
163
181
|
|
|
164
182
|
If you want one manual for the whole subspace, choose the subspace root:
|
|
165
|
-
name:
|
|
183
|
+
name: YYYYMMDD
|
|
166
184
|
path: /repo/subspaces/product-ui
|
|
167
185
|
|
|
168
|
-
The name is not just a label. It will appear in source refs such as
|
|
169
|
-
repo:
|
|
186
|
+
The date name is not just a label. It will appear in source refs such as
|
|
187
|
+
repo:YYYYMMDD#... and in phase ids such as extract:YYYYMMDD:codegraph.
|
|
170
188
|
Approved paths are derived from collection, containment, and slug. NodeRef and
|
|
171
189
|
ViewRef are identity fields, not path strings.
|
|
172
190
|
|
|
173
|
-
For a unified subspace package shape,
|
|
191
|
+
For a unified subspace package shape, the date source name
|
|
174
192
|
lets the output group child modules under that namespace:
|
|
175
|
-
knowledge/codegraph/
|
|
176
|
-
knowledge/codegraph/
|
|
193
|
+
knowledge/codegraph/YYYYMMDD/component-web/...
|
|
194
|
+
knowledge/codegraph/YYYYMMDD/component-lynx/...
|
|
177
195
|
|
|
178
196
|
Current extraction can inspect a parent source, but it should extract from a
|
|
179
197
|
confirmed single package/subdirectory source. If this path is a parent source,
|
|
@@ -186,14 +204,14 @@ a supported repo source.
|
|
|
186
204
|
|
|
187
205
|
For a local repo source, ask for:
|
|
188
206
|
|
|
189
|
-
- source boundary
|
|
207
|
+
- source boundary;
|
|
190
208
|
- local repo or package/subdirectory path;
|
|
191
209
|
- remote/ref only when not inferable or when the user wants an explicit pin.
|
|
192
210
|
|
|
193
211
|
After the user provides the choice, run:
|
|
194
212
|
|
|
195
213
|
```bash
|
|
196
|
-
context source add repo
|
|
214
|
+
context source add repo --local <repo-or-subdir>
|
|
197
215
|
context source ensure
|
|
198
216
|
```
|
|
199
217
|
|
|
@@ -207,34 +225,39 @@ cloned source content.
|
|
|
207
225
|
For local Markdown/MDX document sources, after the user confirms the boundary, run:
|
|
208
226
|
|
|
209
227
|
```bash
|
|
210
|
-
context source add file
|
|
228
|
+
context source add file --local <file-or-folder>
|
|
211
229
|
```
|
|
212
230
|
|
|
231
|
+
Use an explicit `<name>` only when the user has approved a non-default date
|
|
232
|
+
source name. Otherwise run `context source add file --local <file-or-folder>`.
|
|
233
|
+
|
|
213
234
|
Default file capture handles Markdown. If `context source add file`,
|
|
214
235
|
`context source inspect`, `context status`, or capture output reports that the
|
|
215
236
|
source looks like an MDX documentation site, stop at the source boundary gate
|
|
216
237
|
and ask the user to confirm that interpretation before changing `src/index.ts`.
|
|
217
238
|
For MDX documentation sites that use `_meta.json` route metadata, declare
|
|
218
|
-
`captureFile({ source: source("<name>"), processor: mdxJsonDocs() })` in
|
|
239
|
+
`captureFile({ source: source("<date-name>"), processor: mdxJsonDocs() })` in
|
|
219
240
|
`src/index.ts`; included `_meta.json` files are route metadata, and the CLI
|
|
220
241
|
generates `__context_route_metadata.md` as mechanical route evidence. Use
|
|
221
|
-
`--include` only when the approved boundary is narrower than the folder.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
242
|
+
`--include` only when the approved boundary is narrower than the folder. For a
|
|
243
|
+
long fixed batch, prefer `--include-list <file>` with one include per line;
|
|
244
|
+
blank lines and `#` comments are ignored. Then explain that the next operation
|
|
245
|
+
reads the approved document files and writes a committed snapshot under
|
|
246
|
+
`sources/file/YYYYMMDD/`. After the user confirms read permission, summarize the
|
|
247
|
+
`src/index.ts` change or show an equivalent diff summary, and run the capture
|
|
248
|
+
phase.
|
|
226
249
|
Apply [references/capture-source.md](references/capture-source.md) for route
|
|
227
250
|
selection, dependency recovery, output handling, and final reporting, using the
|
|
228
251
|
current capture phase command returned by `context status`.
|
|
229
252
|
|
|
230
253
|
For Lark/Feishu document sources, register the source but do not fetch content
|
|
231
254
|
with ad hoc scripts. Explain which remote document or wiki token will be read,
|
|
232
|
-
that the snapshot is written under `sources/lark
|
|
255
|
+
that the snapshot is written under `sources/lark/YYYYMMDD/`, that committed
|
|
233
256
|
snapshots enable offline verify and fresh-clone reproduction, that whether to
|
|
234
257
|
add extra ignore rules is a business repository decision, and that access
|
|
235
258
|
credentials are not written to the workspace. Use the declared capture/align
|
|
236
259
|
flow only after the user confirms remote reading. After declaring
|
|
237
|
-
`captureLark({ source: source("<name>") })`, summarize the `src/index.ts`
|
|
260
|
+
`captureLark({ source: source("<date-name>") })`, summarize the `src/index.ts`
|
|
238
261
|
change or show an equivalent diff summary.
|
|
239
262
|
Apply [references/capture-source.md](references/capture-source.md) for route
|
|
240
263
|
selection, dependency recovery, output handling, and final reporting, using the
|
|
@@ -254,14 +277,14 @@ the choices without exposing internal API names first:
|
|
|
254
277
|
- for the current executable flow, register one package/subdirectory as its
|
|
255
278
|
own source when the user wants a focused package manual;
|
|
256
279
|
- if the user is designing a unified subspace knowledge base, keep the
|
|
257
|
-
|
|
258
|
-
the concrete module extraction boundary is confirmed.
|
|
280
|
+
date source namespace as the namespace decision, but do not run extraction
|
|
281
|
+
until the concrete module extraction boundary is confirmed.
|
|
259
282
|
|
|
260
283
|
Wait for the user to choose. If the user chooses `packages/button`, register it
|
|
261
284
|
as a separate source such as:
|
|
262
285
|
|
|
263
286
|
```bash
|
|
264
|
-
context source add repo
|
|
287
|
+
context source add repo --local <repo>/packages/button
|
|
265
288
|
```
|
|
266
289
|
|
|
267
290
|
Do not model a monorepo package choice as `include: ["packages/button/src/**"]`
|
|
@@ -276,7 +299,7 @@ the capture summary first:
|
|
|
276
299
|
- document count;
|
|
277
300
|
- title tree, heading tree, or source span distribution from the CLI output;
|
|
278
301
|
- available reading budget and evidence views;
|
|
279
|
-
- snapshot path under `sources/file|lark
|
|
302
|
+
- snapshot path under `sources/file|lark/YYYYMMDD/`;
|
|
280
303
|
- the fact that approved pages are planned through
|
|
281
304
|
`unapproved/structure.yaml` before compile;
|
|
282
305
|
- whether the source is local file/folder evidence or Lark/Feishu evidence.
|
|
@@ -338,11 +361,11 @@ I will first generate a preview without writing candidates. The preview will
|
|
|
338
361
|
show counts plus the planned `knowledge/` tree.
|
|
339
362
|
```
|
|
340
363
|
|
|
341
|
-
Only after the user confirms this product-level scope, declare the chosen
|
|
342
|
-
with `source("
|
|
343
|
-
review phase. Use `include` only for a file-level filter within the
|
|
344
|
-
source boundary. Mention the internal API names only in code-change
|
|
345
|
-
or when the user asks for implementation details.
|
|
364
|
+
Only after the user confirms this product-level scope, declare the chosen date
|
|
365
|
+
source with `source("YYYYMMDD")`, add the TypeScript extraction phase, and add
|
|
366
|
+
the human review phase. Use `include` only for a file-level filter within the
|
|
367
|
+
chosen source boundary. Mention the internal API names only in code-change
|
|
368
|
+
summaries, or when the user asks for implementation details.
|
|
346
369
|
|
|
347
370
|
### Step 5 — Show The Pre-extraction Preview
|
|
348
371
|
|
|
@@ -366,12 +389,12 @@ containment, and slug; NodeRef/ViewRef are identity fields, not path strings:
|
|
|
366
389
|
knowledge/<collection>/<containment>/<slug>.md
|
|
367
390
|
```
|
|
368
391
|
|
|
369
|
-
If source name, package name, module list, candidate estimate, or path shape is
|
|
370
|
-
not what the user expects, stop and repair the source boundary or
|
|
392
|
+
If date source name, package name, module list, candidate estimate, or path shape is
|
|
393
|
+
not what the user expects, stop and repair the source boundary or explicit date name
|
|
371
394
|
before extraction.
|
|
372
395
|
|
|
373
396
|
For a single-module code source, a repeated path like
|
|
374
|
-
`knowledge/codegraph/<source-name>/<package-name>/...` is usually a schema
|
|
397
|
+
`knowledge/codegraph/<date-source-name>/<package-name>/...` is usually a schema
|
|
375
398
|
problem or a wrong source boundary. Stop before extraction if the preview shows
|
|
376
399
|
that shape unexpectedly.
|
|
377
400
|
|