@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.
- package/README.md +12 -2
- package/cli.js +3498 -2057
- package/package.json +2 -2
- package/plugin/skills/skill-continue-workflow/SKILL.md +22 -2
- package/plugin/skills/skill-prose-align/SKILL.md +25 -9
- package/plugin/skills/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugin/skills/skill-prose-compile/SKILL.md +17 -5
- package/plugin/skills/skill-review-gate/SKILL.md +33 -10
- package/plugin/skills/skill-source-scope/SKILL.md +165 -105
- package/plugin/skills/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/VERSION +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/skills/skill-continue-workflow/SKILL.md +22 -2
- package/plugins/claude/skills/skill-prose-align/SKILL.md +25 -9
- package/plugins/claude/skills/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugins/claude/skills/skill-prose-compile/SKILL.md +17 -5
- package/plugins/claude/skills/skill-review-gate/SKILL.md +33 -10
- package/plugins/claude/skills/skill-source-scope/SKILL.md +165 -105
- package/plugins/claude/skills/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/codex/.codex-plugin/plugin.json +2 -2
- package/plugins/codex/skills/continue/references/internal-procedures/skill-continue-workflow.md +22 -2
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-align.md +25 -9
- package/plugins/codex/skills/continue/references/internal-procedures/skill-prose-compile.md +17 -5
- package/plugins/codex/skills/continue/references/internal-procedures/skill-review-gate.md +33 -10
- package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/codex/skills/continue/references/internal-procedures/skill-source-scope.md +165 -105
- package/plugins/codex/skills/init/references/internal-procedures/skill-continue-workflow.md +22 -2
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-align.md +25 -9
- package/plugins/codex/skills/init/references/internal-procedures/skill-prose-compile.md +17 -5
- package/plugins/codex/skills/init/references/internal-procedures/skill-review-gate.md +33 -10
- package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/codex/skills/init/references/internal-procedures/skill-source-scope.md +165 -105
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor/skills/skill-continue-workflow/SKILL.md +22 -2
- package/plugins/cursor/skills/skill-prose-align/SKILL.md +25 -9
- package/plugins/cursor/skills/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugins/cursor/skills/skill-prose-compile/SKILL.md +17 -5
- package/plugins/cursor/skills/skill-review-gate/SKILL.md +33 -10
- package/plugins/cursor/skills/skill-source-scope/SKILL.md +165 -105
- package/plugins/cursor/skills/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/skills/context-continue/references/internal-procedures/skill-continue-workflow.md +22 -2
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-align.md +25 -9
- package/plugins/skills/context-continue/references/internal-procedures/skill-prose-compile.md +17 -5
- package/plugins/skills/context-continue/references/internal-procedures/skill-review-gate.md +33 -10
- package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/skills/context-continue/references/internal-procedures/skill-source-scope.md +165 -105
- package/plugins/skills/context-init/references/internal-procedures/skill-continue-workflow.md +22 -2
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-align/references/internal-procedures/structure-planning.md +5 -3
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-align.md +25 -9
- package/plugins/skills/context-init/references/internal-procedures/skill-prose-compile.md +17 -5
- package/plugins/skills/context-init/references/internal-procedures/skill-review-gate.md +33 -10
- package/plugins/skills/context-init/references/internal-procedures/skill-source-scope/references/capture-source.md +32 -12
- package/plugins/skills/context-init/references/internal-procedures/skill-source-scope.md +165 -105
|
@@ -60,7 +60,7 @@ Use semantic labels, not SDK function names:
|
|
|
60
60
|
|
|
61
61
|
## Runtime Discipline
|
|
62
62
|
|
|
63
|
-
- Follow `context status`, `routing.
|
|
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,
|
|
230
|
-
|
|
231
|
-
|
|
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
|
+
`../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 command.
|
|
5
|
-
Opens the review UI, waits for user decisions, applies copied
|
|
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
|
-
-
|
|
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
|
|
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
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
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
|
|
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
|
`../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
|
|
@@ -21,24 +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. Repo, file, and Lark sources use today's date as a batch. Multiple
|
|
25
|
+
modules or documents share that date; never auto-append `-A/-B/-C` or ask for
|
|
26
|
+
a second flat date name. File/Lark modules may be supplied with `--module`;
|
|
27
|
+
otherwise the CLI derives a safe module from the local path or opaque
|
|
28
|
+
document identity.
|
|
29
|
+
- When the user supplies multiple sources together, register them with one
|
|
30
|
+
`context source add batch [YYYYMMDD] --input <yaml|json|->` command. Never run
|
|
31
|
+
multiple mutating `context source add` commands in parallel. Single-source
|
|
32
|
+
commands use the same project write lock and must be retried serially when
|
|
33
|
+
the CLI reports that the lock is held.
|
|
32
34
|
- Do not infer a source from cwd, parent directories, package names, monorepo
|
|
33
35
|
layout, or git remote.
|
|
34
|
-
- In monorepos,
|
|
35
|
-
package/subdirectory
|
|
36
|
-
|
|
37
|
-
modules, explain that the date source namespace can be used in codegraph
|
|
38
|
-
NodeRefs when extraction rules derive grouped refs. Current repo extraction
|
|
39
|
-
still requires choosing a concrete single-module extraction boundary before
|
|
40
|
-
running extraction; do not run extraction against an ambiguous multi-module
|
|
41
|
-
source.
|
|
36
|
+
- In monorepos, inspect the package tree, then register each selected
|
|
37
|
+
package/subdirectory as a module under the same date. Do not extract an
|
|
38
|
+
ambiguous parent module.
|
|
42
39
|
- `extractTs.include` filters files inside the selected source; it is not a
|
|
43
40
|
package/module selector.
|
|
44
41
|
- Do not ask users to add `exports`, `main`, `bin`, or a new entry file to the
|
|
@@ -51,10 +48,18 @@ Choose and validate what may become draft knowledge.
|
|
|
51
48
|
when every matched file is the intended scope.
|
|
52
49
|
- TypeScript extraction follows tsconfig/jsconfig `extends`, `baseUrl`, and
|
|
53
50
|
`paths`. Aliases such as `@/` do not require changes to the source repository.
|
|
54
|
-
- Use `context source inspect <
|
|
51
|
+
- Use `context source inspect <date>/<module> --format json` for module choices.
|
|
55
52
|
- Before first real extraction, generate a no-write preview and show module
|
|
56
53
|
counts plus `knowledgeTree` / `knowledgePathExamples` to the user. Use
|
|
57
54
|
`--dry-run` only in the command you execute, not as the user-facing label.
|
|
55
|
+
- During a declared multi-module extraction round, treat
|
|
56
|
+
`next_action.human_gate=false` as mechanical continuation: finish every
|
|
57
|
+
pending extract phase before opening one combined Review page.
|
|
58
|
+
- When captured file/Lark sources coexist with an unprocessed repo source,
|
|
59
|
+
process code first while document structure is still untouched. Follow the
|
|
60
|
+
`ready-to-extract` route and explain that document align resumes after the
|
|
61
|
+
code extraction/review round. Do not interrupt a document structure or
|
|
62
|
+
compile gate that has already started.
|
|
58
63
|
- Human-facing explanations must describe the extraction impact first: what code
|
|
59
64
|
files are read, what symbols become draft knowledge, what is skipped, and what
|
|
60
65
|
review gate follows. Do not lead with `extractTs`, `include`, `exportedOnly`,
|
|
@@ -62,6 +67,13 @@ Choose and validate what may become draft knowledge.
|
|
|
62
67
|
- Document capture has its own gate. After a file or Lark source is registered,
|
|
63
68
|
ask for permission before reading the source body, then show the capture
|
|
64
69
|
summary before handing off to material investigation and structure drafting.
|
|
70
|
+
If the user explicitly asked to capture, ingest, fetch, read, or include the
|
|
71
|
+
exact path/URL, that request already grants read permission; do not ask again
|
|
72
|
+
after registration. Mere mention, source discussion, and register-only
|
|
73
|
+
requests do not grant permission, and an explicit refusal always wins.
|
|
74
|
+
When the user requested several documents together, that confirmation covers
|
|
75
|
+
those explicit modules: declare them all, then execute every capture command
|
|
76
|
+
returned by `context status` before asking another source question.
|
|
65
77
|
Do not default to one page per document, and do not create final draft pages
|
|
66
78
|
directly from capture.
|
|
67
79
|
- For capture routing, output handling, missing dependency recovery, and final
|
|
@@ -83,11 +95,11 @@ Ask for a knowledge source in plain language and map it to the supported path:
|
|
|
83
95
|
|
|
84
96
|
| User source | What to ask for | Current handling |
|
|
85
97
|
|---|---|---|
|
|
86
|
-
| Local code repo |
|
|
87
|
-
| Local monorepo package/module |
|
|
98
|
+
| Local code repo | date batch, concrete module name, and local repo/package path | Register with `context source add repo [YYYYMMDD] --module <module> --local <path>`. CLI records git root + optional `subpath`; when the Context workspace and source share a Git root, an absolute input is stored relative to the workspace. `sources/repo/YYYYMMDD/<module>` becomes an ignored relative symlink to that module view. |
|
|
99
|
+
| Local monorepo package/module | which concrete packages/subdirs belong to this batch | Register every confirmed boundary as a module under the same date. Do not create `YYYYMMDD-A/B/C`, and do not use `extractTs.include` as a package selector. |
|
|
88
100
|
| 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. |
|
|
89
|
-
| 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
|
|
90
|
-
| Lark / Feishu document | document URL/token, intended collection, and permission to read remotely | Register with `context source add lark
|
|
101
|
+
| Local Markdown / document file or folder | date batch, document module boundary, local path, include glob or include-list if needed, and permission to read the source body | Register with `context source add file [YYYYMMDD] --module <module> --local <path>`; `--module` may be omitted when the path-derived name is sufficient. Documents from the same date are written as sibling files under `sources/file/YYYYMMDD/` and share that date's `manifest.json`. |
|
|
102
|
+
| Lark / Feishu document | date batch, document module, URL/token, intended collection, and permission to read remotely | Register each document with `context source add lark [YYYYMMDD] --module <module>` plus exactly one identity flag. Documents from the same date are written as sibling files under `sources/lark/YYYYMMDD/` and share that date's `manifest.json`. Omit `--module` when the CLI-derived opaque identity is acceptable. |
|
|
91
103
|
|
|
92
104
|
When asking for a document mainline collection, do not ask only "which
|
|
93
105
|
collection?". Explain every available option in product language:
|
|
@@ -118,34 +130,30 @@ knowledge source. Use the user's language and explain that this is a boundary
|
|
|
118
130
|
choice:
|
|
119
131
|
|
|
120
132
|
```text
|
|
121
|
-
You are choosing
|
|
122
|
-
The date
|
|
123
|
-
|
|
124
|
-
|
|
133
|
+
You are choosing which code modules belong to one dated source batch.
|
|
134
|
+
The date is the source directory/batch; each concrete module has its own
|
|
135
|
+
extraction, source ref, phase id, and stable codegraph subtree. The date is not
|
|
136
|
+
part of the knowledge path.
|
|
125
137
|
|
|
126
138
|
If the source is one package:
|
|
127
|
-
knowledge/codegraph
|
|
128
|
-
repo:YYYYMMDD
|
|
129
|
-
capture:file:YYYYMMDD
|
|
130
|
-
dist/YYYYMMDD-kb/
|
|
139
|
+
knowledge/codegraph/<module>/...
|
|
140
|
+
repo:YYYYMMDD/<module>#symbol:...
|
|
131
141
|
|
|
132
142
|
If the source is one document source:
|
|
133
143
|
knowledge/architecture/entity/example.md
|
|
134
|
-
file:YYYYMMDD/getting-started.md#span:...
|
|
135
|
-
align:file:YYYYMMDD:architecture
|
|
136
|
-
dist
|
|
137
|
-
|
|
138
|
-
If the
|
|
139
|
-
|
|
140
|
-
knowledge/codegraph/
|
|
141
|
-
knowledge/codegraph/YYYYMMDD/component-lynx/...
|
|
144
|
+
file:YYYYMMDD/getting-started/index.md#span:...
|
|
145
|
+
align:file:YYYYMMDD/getting-started:architecture
|
|
146
|
+
dist/<name>-kb/
|
|
147
|
+
|
|
148
|
+
If the date batch contains several repo modules, outputs are shaped like:
|
|
149
|
+
knowledge/codegraph/module-a/...
|
|
150
|
+
knowledge/codegraph/module-b/...
|
|
142
151
|
```
|
|
143
152
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
first; choose a concrete package/subdirectory source before real extraction.
|
|
153
|
+
Every repo source has both levels, even when the batch contains only one module.
|
|
154
|
+
The date groups capture work; the module is the extraction boundary and
|
|
155
|
+
project-wide codegraph identity. Do not register the same repo module name under
|
|
156
|
+
another date; refresh it through its existing date/module selector.
|
|
149
157
|
|
|
150
158
|
When the user has already provided a path, describe the current interpretation
|
|
151
159
|
and use the CLI date default:
|
|
@@ -154,17 +162,14 @@ and use the CLI date default:
|
|
|
154
162
|
I am treating this path as the source boundary:
|
|
155
163
|
<path>
|
|
156
164
|
|
|
157
|
-
If this path is one package/module,
|
|
158
|
-
|
|
165
|
+
If this path is one package/module, it will be registered under today's date
|
|
166
|
+
and use refs such as repo:YYYYMMDD/<module>#...
|
|
159
167
|
|
|
160
|
-
If this path
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
knowledge/codegraph/YYYYMMDD/<module-name>/...
|
|
168
|
+
If this path contains multiple modules, I will show the detected tree and
|
|
169
|
+
register each selected module under the same date. Knowledge paths stay stable:
|
|
170
|
+
knowledge/codegraph/<module-name>/...
|
|
164
171
|
|
|
165
|
-
|
|
166
|
-
inspection/planning first. Before reading code, we still need a concrete
|
|
167
|
-
package/subdirectory boundary.
|
|
172
|
+
Extraction will still run separately for each module.
|
|
168
173
|
```
|
|
169
174
|
|
|
170
175
|
Then ask for one of:
|
|
@@ -175,9 +180,8 @@ Then ask for one of:
|
|
|
175
180
|
- Lark/Feishu document URL.
|
|
176
181
|
|
|
177
182
|
Do not ask "what is the source name?" as the first or only question. Ask what
|
|
178
|
-
they want the knowledge source to cover, then use the date default.
|
|
179
|
-
|
|
180
|
-
asks to override it.
|
|
183
|
+
they want the knowledge source to cover, then use the date default. For repo
|
|
184
|
+
sources, ask which concrete module/package is being registered.
|
|
181
185
|
|
|
182
186
|
Good user-facing wording:
|
|
183
187
|
|
|
@@ -186,27 +190,21 @@ Next we need to add a knowledge source.
|
|
|
186
190
|
|
|
187
191
|
If you only want a manual for the component package, choose that package
|
|
188
192
|
directory as the source boundary, for example:
|
|
189
|
-
|
|
193
|
+
batch: YYYYMMDD
|
|
194
|
+
module: component-lib
|
|
190
195
|
path: /repo/packages/component-lib
|
|
191
196
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
The date name is not just a label. It will appear in source refs such as
|
|
197
|
-
repo:YYYYMMDD#... and in phase ids such as extract:YYYYMMDD:codegraph.
|
|
198
|
-
Approved paths are derived from collection, containment, and slug. NodeRef and
|
|
199
|
-
ViewRef are identity fields, not path strings.
|
|
197
|
+
The date is one batch, not one module. The concrete selector appears in refs
|
|
198
|
+
and phases such as repo:YYYYMMDD/component-lib#... and
|
|
199
|
+
extract:YYYYMMDD/component-lib:codegraph.
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
knowledge/codegraph/
|
|
204
|
-
knowledge/codegraph/YYYYMMDD/component-lynx/...
|
|
201
|
+
One date can group multiple registered modules while knowledge omits the date:
|
|
202
|
+
knowledge/codegraph/module-a/...
|
|
203
|
+
knowledge/codegraph/module-b/...
|
|
205
204
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
reading code.
|
|
205
|
+
Extraction still runs per concrete module. If a path contains several packages,
|
|
206
|
+
I will show the module tree first and register each chosen package under this
|
|
207
|
+
same date before reading code.
|
|
210
208
|
```
|
|
211
209
|
|
|
212
210
|
Mention the CLI command only as an implementation detail after the user chooses
|
|
@@ -221,10 +219,46 @@ For a local repo source, ask for:
|
|
|
221
219
|
After the user provides the choice, run:
|
|
222
220
|
|
|
223
221
|
```bash
|
|
224
|
-
context source add repo --local <repo-or-subdir>
|
|
225
|
-
context source ensure
|
|
222
|
+
context source add repo [YYYYMMDD] --module <module> --local <repo-or-subdir>
|
|
223
|
+
context source ensure [YYYYMMDD|YYYYMMDD/module]
|
|
226
224
|
```
|
|
227
225
|
|
|
226
|
+
For several repo/file/Lark modules confirmed in one request, prefer one batch
|
|
227
|
+
payload instead of parallel commands:
|
|
228
|
+
|
|
229
|
+
```yaml
|
|
230
|
+
sources:
|
|
231
|
+
- type: repo
|
|
232
|
+
module: module-a
|
|
233
|
+
local: ../monorepo/packages/module-a
|
|
234
|
+
- type: repo
|
|
235
|
+
module: module-b
|
|
236
|
+
local: ../monorepo/packages/module-b
|
|
237
|
+
- type: lark
|
|
238
|
+
url: https://example.larksuite.com/wiki/example
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
context source add batch [YYYYMMDD] --input <sources.yaml|json|-> --format json
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
The CLI validates batch identities, holds one project write lock, and writes
|
|
246
|
+
registries atomically. It processes items in payload order. If a runtime item
|
|
247
|
+
fails, the error reports completed items; fix it and rerun the same payload,
|
|
248
|
+
because source registration is idempotent. Do not patch registry YAML manually.
|
|
249
|
+
Repo items require `module`. File and Lark items may omit it; the CLI returns a
|
|
250
|
+
derived lowercase path-safe module. If derived identities collide, provide
|
|
251
|
+
explicit distinct modules and rerun the unchanged batch boundary.
|
|
252
|
+
|
|
253
|
+
The repo batch must be a valid calendar date. The CLI rejects suffixes such as
|
|
254
|
+
`YYYYMMDD-A`. A date-only `source ensure` or `source inspect` selector operates
|
|
255
|
+
on every repo module registered in that batch; append `/module` to target one.
|
|
256
|
+
If `--local` is absolute but the selected module and Context workspace belong
|
|
257
|
+
to the same Git repository, expect the registry to store the Git root relative
|
|
258
|
+
to the workspace plus `subpath`. The materialized source symlink also uses a
|
|
259
|
+
relative target, so moving the repository as a unit keeps it valid. A source in
|
|
260
|
+
a different Git repository may retain its absolute checkout root.
|
|
261
|
+
|
|
228
262
|
Add `--remote` / `--ref` only when the user gave explicit values.
|
|
229
263
|
|
|
230
264
|
For a remote Git repo source, ask for permission before clone/checkout. If the
|
|
@@ -235,40 +269,52 @@ cloned source content.
|
|
|
235
269
|
For local Markdown/MDX document sources, after the user confirms the boundary, run:
|
|
236
270
|
|
|
237
271
|
```bash
|
|
238
|
-
context source add file --local <file-or-folder>
|
|
272
|
+
context source add file [YYYYMMDD] --module <module> --local <file-or-folder>
|
|
239
273
|
```
|
|
240
274
|
|
|
241
|
-
|
|
242
|
-
|
|
275
|
+
The date is the batch and the module is the concrete document boundary. Multiple
|
|
276
|
+
file modules may share one date. `--module` may be omitted when the CLI-derived
|
|
277
|
+
path slug is adequate; do not stop merely because another document already uses
|
|
278
|
+
today's date.
|
|
243
279
|
|
|
244
280
|
Default file capture handles Markdown. If `context source add file`,
|
|
245
281
|
`context source inspect`, `context status`, or capture output reports that the
|
|
246
282
|
source looks like an MDX documentation site, stop at the source boundary gate
|
|
247
283
|
and ask the user to confirm that interpretation before changing `src/index.ts`.
|
|
248
284
|
For MDX documentation sites that use `_meta.json` route metadata, declare
|
|
249
|
-
`captureFile({ source: source("<date
|
|
285
|
+
`captureFile({ source: source("<date>", "<module>", { type: "file" }), processor: mdxJsonDocs() })` in
|
|
250
286
|
`src/index.ts`; included `_meta.json` files are route metadata, and the CLI
|
|
251
287
|
generates `__context_route_metadata.md` as mechanical route evidence. Use
|
|
252
288
|
`--include` only when the approved boundary is narrower than the folder. For a
|
|
253
289
|
long fixed batch, prefer `--include-list <file>` with one include per line;
|
|
254
290
|
blank lines and `#` comments are ignored. Then explain that the next operation
|
|
255
|
-
reads the approved document files and writes
|
|
256
|
-
|
|
291
|
+
reads the approved document files and writes sibling files in one date batch.
|
|
292
|
+
The CLI manages their shared capture metadata. After the user confirms read permission, summarize the
|
|
257
293
|
`src/index.ts` change or show an equivalent diff summary, and run the capture
|
|
258
294
|
phase.
|
|
259
295
|
Apply [references/capture-source.md](references/capture-source.md) for route
|
|
260
296
|
selection, dependency recovery, output handling, and final reporting, using the
|
|
261
297
|
current capture phase command returned by `context status`.
|
|
262
298
|
|
|
263
|
-
For Lark/Feishu document sources, register
|
|
299
|
+
For Lark/Feishu document sources, register every requested document under the
|
|
300
|
+
same date batch but do not fetch content
|
|
264
301
|
with ad hoc scripts. Explain which remote document or wiki token will be read,
|
|
265
|
-
that
|
|
302
|
+
that each document is written under `sources/lark/YYYYMMDD/` beside the other documents in that date batch, that one shared `manifest.json` tracks them, that committed
|
|
266
303
|
snapshots enable offline verify and fresh-clone reproduction, that whether to
|
|
267
304
|
add extra ignore rules is a business repository decision, and that access
|
|
268
305
|
credentials are not written to the workspace. Use the declared capture/align
|
|
269
306
|
flow only after the user confirms remote reading. After declaring
|
|
270
|
-
`captureLark({ source: source("<date
|
|
307
|
+
`captureLark({ source: source("<date>", "<module>", { type: "lark" }) })`, summarize the `src/index.ts`
|
|
271
308
|
change or show an equivalent diff summary.
|
|
309
|
+
When the user adds more documents to an already confirmed batch and says they
|
|
310
|
+
belong together, inherit the confirmed mainline collection and read permission
|
|
311
|
+
for those explicitly supplied URLs. Register and declare all modules before
|
|
312
|
+
capture; do not ask for another date name or repeat the same collection gate.
|
|
313
|
+
If `context status --format json` returns multiple items in
|
|
314
|
+
`routing.command_plan` while state is `needs-capture`, run every
|
|
315
|
+
`after-human-confirmation` item in order after the current conversation contains
|
|
316
|
+
permission. After one module completes, status should retain only the
|
|
317
|
+
uncaptured modules; do not reopen the batch boundary gate between them.
|
|
272
318
|
Apply [references/capture-source.md](references/capture-source.md) for route
|
|
273
319
|
selection, dependency recovery, output handling, and final reporting, using the
|
|
274
320
|
current capture phase command returned by `context status`.
|
|
@@ -278,23 +324,21 @@ current capture phase command returned by `context status`.
|
|
|
278
324
|
If a registered source may contain multiple packages, run:
|
|
279
325
|
|
|
280
326
|
```bash
|
|
281
|
-
context source inspect <
|
|
327
|
+
context source inspect <date>/<module> --format json
|
|
282
328
|
```
|
|
283
329
|
|
|
284
330
|
Present the detected module/package paths from that CLI output as a tree. Explain
|
|
285
331
|
the choices without exposing internal API names first:
|
|
286
332
|
|
|
287
|
-
-
|
|
288
|
-
|
|
289
|
-
-
|
|
290
|
-
date source namespace as the namespace decision, but do not run extraction
|
|
291
|
-
until the concrete module extraction boundary is confirmed.
|
|
333
|
+
- register each chosen package/subdirectory as a module in the current date
|
|
334
|
+
batch;
|
|
335
|
+
- extraction, Review, and verification remain independent per concrete module.
|
|
292
336
|
|
|
293
337
|
Wait for the user to choose. If the user chooses `packages/button`, register it
|
|
294
|
-
as
|
|
338
|
+
as another module in the same date batch:
|
|
295
339
|
|
|
296
340
|
```bash
|
|
297
|
-
context source add repo --local <repo>/packages/button
|
|
341
|
+
context source add repo <date> --module button --local <repo>/packages/button
|
|
298
342
|
```
|
|
299
343
|
|
|
300
344
|
Do not model a monorepo package choice as `include: ["packages/button/src/**"]`
|
|
@@ -309,7 +353,7 @@ the capture summary first:
|
|
|
309
353
|
- document count;
|
|
310
354
|
- title tree, heading tree, or source span distribution from the CLI output;
|
|
311
355
|
- available reading budget and evidence views;
|
|
312
|
-
-
|
|
356
|
+
- flat document path under `sources/file|lark/YYYYMMDD/` and the date-level `manifest.json`;
|
|
313
357
|
- the fact that approved pages are planned through
|
|
314
358
|
`unapproved/structure.yaml` before compile;
|
|
315
359
|
- whether the source is local file/folder evidence or Lark/Feishu evidence.
|
|
@@ -371,8 +415,8 @@ I will first generate a preview without writing candidates. The preview will
|
|
|
371
415
|
show counts plus the planned `knowledge/` tree.
|
|
372
416
|
```
|
|
373
417
|
|
|
374
|
-
Only after the user confirms this product-level scope, declare the chosen
|
|
375
|
-
|
|
418
|
+
Only after the user confirms this product-level scope, declare the chosen repo
|
|
419
|
+
module with `source("YYYYMMDD", "<module>")`, add the TypeScript extraction phase, and add
|
|
376
420
|
the human review phase. Use `include` only for a file-level filter within the
|
|
377
421
|
chosen source boundary. If the package has no standard detected entry, keep the
|
|
378
422
|
source repository unchanged and ask whether its intended knowledge surface is:
|
|
@@ -385,6 +429,11 @@ source repository unchanged and ask whether its intended knowledge surface is:
|
|
|
385
429
|
Mention the internal API names only in code-change summaries, or when the user
|
|
386
430
|
asks for implementation details.
|
|
387
431
|
|
|
432
|
+
When the user confirms several modules as one extraction round, declare all of
|
|
433
|
+
their source-specific extract phases before writing candidates. Preview every
|
|
434
|
+
phase first, summarize the combined scope once, and ask for one scope
|
|
435
|
+
confirmation for that round.
|
|
436
|
+
|
|
388
437
|
### Step 5 — Show The Pre-extraction Preview
|
|
389
438
|
|
|
390
439
|
Before real extraction, run the CLI no-write preview:
|
|
@@ -408,14 +457,13 @@ containment, and slug; NodeRef/ViewRef are identity fields, not path strings:
|
|
|
408
457
|
knowledge/<collection>/<containment>/<slug>.md
|
|
409
458
|
```
|
|
410
459
|
|
|
411
|
-
If date
|
|
412
|
-
not what the user expects, stop and repair the source boundary or
|
|
460
|
+
If date batch, module name, module list, candidate estimate, or path shape is
|
|
461
|
+
not what the user expects, stop and repair the source boundary or module registration
|
|
413
462
|
before extraction.
|
|
414
463
|
|
|
415
|
-
For
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
that shape unexpectedly.
|
|
464
|
+
For code sources, `knowledge/codegraph/<module>/...` is the expected shape;
|
|
465
|
+
the date remains in source refs and phase ids. An additional repeated package segment below `<module>` may indicate an
|
|
466
|
+
over-broad boundary; stop if the preview shows that unexpectedly.
|
|
419
467
|
|
|
420
468
|
Do not present this as a CLI option or as "Context default options" to the
|
|
421
469
|
user. Present it as the actual proposed knowledge impact: code area read,
|
|
@@ -431,10 +479,14 @@ matches it, run:
|
|
|
431
479
|
context run <extract-phase-id>
|
|
432
480
|
```
|
|
433
481
|
|
|
434
|
-
Read the structured result before routing.
|
|
435
|
-
|
|
482
|
+
Read the structured result before routing. A codegraph phase that produces
|
|
483
|
+
candidates returns `continue-codegraph-batch` with `human_gate=false`; run the
|
|
484
|
+
returned status command and continue any remaining confirmed extract phases.
|
|
485
|
+
Only when status has no `pendingExtractPhases` and returns `needs-review` should
|
|
486
|
+
the Agent open one collection-level Codegraph Review. The first round includes
|
|
487
|
+
all candidates across the confirmed modules; later rounds include only
|
|
436
488
|
added/updated/removed symbols, while unchanged approved symbols stay approved.
|
|
437
|
-
|
|
489
|
+
Do not open Review after each module.
|
|
438
490
|
|
|
439
491
|
Only when the user explicitly requests a non-interactive CI/CD codegraph sync,
|
|
440
492
|
run:
|
|
@@ -443,9 +495,17 @@ run:
|
|
|
443
495
|
context run <extract-phase-id> --auto-promote --format json
|
|
444
496
|
```
|
|
445
497
|
|
|
446
|
-
This applies deterministic codegraph deltas
|
|
447
|
-
|
|
448
|
-
or
|
|
498
|
+
This applies deterministic codegraph deltas, refreshes deterministic close when
|
|
499
|
+
needed, and verifies the result. Read `autoPromotion.close` and
|
|
500
|
+
`autoPromotion.verify`; a nonzero exit or close/verification issue is a pipeline
|
|
501
|
+
failure. Run `context build` separately when the pipeline publishes packages.
|
|
502
|
+
Never use `--auto-promote` for prose or semantic collections.
|
|
503
|
+
|
|
504
|
+
If an upgraded workspace reports `approved-source-ref-ambiguous` for pre-file-aware
|
|
505
|
+
beta.5 codegraph refs, preserve the existing approval decisions. Rerun the
|
|
506
|
+
declared codegraph extraction phase to produce the current file-aware symbol
|
|
507
|
+
index, then run `context review migrate-codegraph-refs` and `context verify`.
|
|
508
|
+
Tell the user this is evidence metadata migration and does not reopen Review.
|
|
449
509
|
|
|
450
510
|
If the preview reports modules outside the confirmed source boundary, do not
|
|
451
511
|
run extraction. Ask the user to choose the corrected source boundary.
|