@c4a/context-cli 0.7.67 → 0.7.71

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 (47) hide show
  1. package/README.md +9 -0
  2. package/README.zh-CN.md +2 -0
  3. package/cli.js +3371 -2942
  4. package/indexers/bundles/context-code-indexer/references/composers/contracts-and-chains.md +2 -2
  5. package/indexers/bundles/context-code-indexer/references/composers/cross-module-chain.md +2 -2
  6. package/indexers/bundles/context-code-indexer/references/composers/development-and-delivery.md +2 -2
  7. package/indexers/bundles/context-code-indexer/references/composers/event-flow.md +2 -2
  8. package/indexers/bundles/context-code-indexer/references/composers/examples-and-documentation.md +2 -2
  9. package/indexers/bundles/context-code-indexer/references/composers/persistence-boundary.md +2 -2
  10. package/indexers/bundles/context-code-indexer/references/composers/protocol-boundary.md +2 -2
  11. package/indexers/bundles/context-code-indexer/references/composers/public-contract.md +2 -2
  12. package/indexers/bundles/context-code-indexer/references/indexer.md +2 -2
  13. package/indexers/bundles/context-code-indexer/templates/data-sync-reconciliation.md +2 -1
  14. package/indexers/bundles/context-markdown-indexer/references/indexer.md +2 -2
  15. package/indexers/contracts/profile-contract.json +245 -245
  16. package/indexers/release-manifest.json +14 -14
  17. package/package.json +12 -12
  18. package/parserEntryWorker.js +40 -13
  19. package/plugins/VERSION +1 -1
  20. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  21. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  22. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  23. package/plugins/skills/context-code-indexer/references/composers/contracts-and-chains.md +2 -2
  24. package/plugins/skills/context-code-indexer/references/composers/cross-module-chain.md +2 -2
  25. package/plugins/skills/context-code-indexer/references/composers/development-and-delivery.md +2 -2
  26. package/plugins/skills/context-code-indexer/references/composers/event-flow.md +2 -2
  27. package/plugins/skills/context-code-indexer/references/composers/examples-and-documentation.md +2 -2
  28. package/plugins/skills/context-code-indexer/references/composers/persistence-boundary.md +2 -2
  29. package/plugins/skills/context-code-indexer/references/composers/protocol-boundary.md +2 -2
  30. package/plugins/skills/context-code-indexer/references/composers/public-contract.md +2 -2
  31. package/plugins/skills/context-code-indexer/references/indexer.md +2 -2
  32. package/plugins/skills/context-code-indexer/templates/data-sync-reconciliation.md +2 -1
  33. package/plugins/skills/context-markdown-indexer/references/indexer.md +2 -2
  34. package/providers/context/manifest.json +23 -23
  35. package/providers/context/provider.yaml +1 -1
  36. package/providers/context/resources/manuals/guides/code-indexer-skill-authoring.md +2 -1
  37. package/providers/context/resources/manuals/guides/knowledge-updates.md +15 -2
  38. package/providers/context/resources/manuals/guides/markdown-indexer-skill-authoring.md +1 -1
  39. package/providers/context/resources/manuals/guides/site-translation.md +27 -2
  40. package/providers/context/resources/manuals/reference/package-templates.md +2 -2
  41. package/providers/context/resources/procedures/approved-revision.md +16 -1
  42. package/providers/context/resources/procedures/knowledge-updates.md +15 -2
  43. package/providers/context/resources/procedures/production-stage-files.md +14 -1
  44. package/providers/context/resources/procedures/source-update.md +7 -0
  45. package/providers/context/schemas/approved-revision-result.schema.json +56 -19
  46. package/providers/context/schemas/indexer-agent-step-result.schema.json +56 -19
  47. package/providers/context/skills/translate-site-locales/SKILL.md +10 -4
@@ -1,6 +1,6 @@
1
1
  schema: agent-graph.provider.v1
2
2
  id: c4a/context
3
- version: 0.7.67
3
+ version: 0.7.71
4
4
  name: Context workflow
5
5
  description: Internal work contract for Context knowledge workspaces.
6
6
  graphs:
@@ -50,7 +50,8 @@ proof of runtime behavior. Preserve expressions without executing project code,
50
50
  distinguish declaration defaults from implementation defaults, and state unknowns.
51
51
 
52
52
  Use the current stage's Markdown and reference-file schemas. Each fragment cites
53
- at most three actual source locations; the CLI computes regional digests. Split
53
+ actual source regions from at most three files (up to eight regions); the CLI
54
+ computes regional digests. Split
54
55
  an explanation when it needs separate evidence, not to fill a fixed template.
55
56
  Reuse stable article and fragment identities when revising. Supporting documents,
56
57
  notes or sessions may contribute to the same article without becoming code facts.
@@ -338,7 +338,7 @@ changing structure, adding a page or when a section has no unambiguous ID.
338
338
  To change a fragment's citations, include `references` alongside its `section_id`:
339
339
  each entry supplies `source_ref` and `locator` (`path`, `start_line`, `end_line`).
340
340
  Context computes the region fingerprint. This uses the same revision submission,
341
- with at most three source positions per fragment. Full Markdown may include a
341
+ with at most three source files and eight regions per fragment. Full Markdown may include a
342
342
  `sections` list of reference edits; local section edits may change content,
343
343
  references, or both. Omission preserves citations; an empty list removes them.
344
344
 
@@ -703,6 +703,19 @@ Revision section edits may supply `references` as `source_ref` plus a
703
703
  `locator` containing `path`, `start_line`, and `end_line`. Context computes the
704
704
  regional digest. Omitted references preserve the current fragment's citations;
705
705
  an explicit empty list removes them, and deleting a fragment removes its
706
- citations. Each fragment may cite at most three source positions. Register and
706
+ citations. Each fragment may cite at most three source files and eight regions. Register and
707
707
  authorize new material before citing it, then follow normal Review, close and
708
708
  build. Article links alone do not authorize reading new sources or prove a claim.
709
+
710
+ ### Locating submitted references
711
+
712
+ Submission locators also accept `{path, heading}` or `{path, quote}` instead of
713
+ line numbers. Use exactly one form. A heading is the title text of an exact ATX heading
714
+ outside code fences in a Markdown source; a leading `##` marker is optional and,
715
+ when present, also selects the heading level; its region ends before the next
716
+ same-level or higher-level heading. A quote is an exact, unique, nonempty
717
+ substring (line endings are normalized). Ambiguous matches return candidate
718
+ line ranges. Both forms resolve against authorized captured text before hashing;
719
+ stored references still contain only `path`, `start_line` and `end_line`.
720
+ The per-fragment limits (three source files, eight regions) apply after
721
+ resolving and deduplicating positions.
@@ -45,7 +45,7 @@ submit the short stage-relative manifest. Title and description belong to the
45
45
  article, not an internal layout-mapping tuple.
46
46
 
47
47
  Keep stable article and fragment identities when revising. Each fragment cites
48
- at most three actual source regions. The CLI handles source digests and safety;
48
+ actual source regions from at most three files (up to eight regions). The CLI handles source digests and safety;
49
49
  the Agent judges whether the evidence supports the explanation. For a local
50
50
  failure, use the returned fragment identifier or position to repair the affected
51
51
  part. Completed independent tasks can be submitted without the rest of the batch.
@@ -60,8 +60,11 @@ map_entries:
60
60
  ```
61
61
 
62
62
  A translated article keeps every `context:section` marker, id and order, every
63
- fenced code block with its language and content (Mermaid labels may change), and
64
- every link target. Submission validates all items first and saves nothing when
63
+ fenced code block and its language marker, and every link target. Prose in
64
+ `text`, `txt`, and `plaintext` blocks may be translated; keep commands, paths,
65
+ and placeholders such as `<repository>` unchanged. Mermaid labels may change.
66
+ All other blocks, including blocks without a language marker, keep their content
67
+ unchanged. Submission validates all items first and saves nothing when
65
68
  any item fails. A digest from before an approved content change is rejected.
66
69
 
67
70
  `skip` records that the current pending items are published in the primary
@@ -76,3 +79,25 @@ an outdated notice and a button that switches to the original; a missing page
76
79
  shows the original with a notice. Navigation titles without a translation use
77
80
  the translated article title, then the primary title. Site search covers every
78
81
  language; opening a result in another language switches to it.
82
+
83
+ ## Incremental drafts
84
+
85
+ `prepare` writes a draft for each pending article and a `submission_path`
86
+ template. A stale article's draft is its current translation; a missing
87
+ article's draft is the approved source. When Git history contains the approved
88
+ version the translation was made from, `source_diff` names a diff from that
89
+ version to the current article. Without such history `source_diff` is `null`;
90
+ compare the draft with the whole approved article. Update only what changed and
91
+ submit the draft. History is missing, for example, when several approve and
92
+ translate rounds ran without a commit in between: the version each translation
93
+ was made from was never recorded. Committing approved knowledge and translations
94
+ after a round lets the next generated draft carry a diff; it does not guarantee
95
+ one, because a kept draft never has a diff.
96
+
97
+ An existing edited draft is kept (`draft: kept`) as unfinished work, with
98
+ `source_diff: null`; a draft whose body is still the unedited starting text is
99
+ regenerated with its diff. A kept draft has no diff because the source may have
100
+ changed again, even back, since it was written, so align the whole draft with
101
+ the current approved article. Delete it
102
+ to start again from the current translation. Successful submission removes the
103
+ drafts and diffs it saved.
@@ -316,8 +316,8 @@ Approved Markdown under `knowledge/` and the article index in
316
316
  and fragment `sections` with their region `references`.
317
317
  - Markdown fragment markers contain only their stable ID:
318
318
  `<!-- context:section id="usage" -->` and `<!-- /context:section -->`.
319
- Structure records each corresponding ID and at most three source positions
320
- per fragment, not three per article.
319
+ Structure records each corresponding ID and its source positions: at most
320
+ three distinct source files and eight regions per fragment, not per article.
321
321
  - A reference contains `source_ref`, `locator: { path, start_line, end_line }`
322
322
  and the Host-computed regional `content_digest`. Do not duplicate this in
323
323
  Markdown frontmatter or comments.
@@ -34,6 +34,8 @@ association. Then retry the same `task adjust` without refresh and, once materia
34
34
  is available, with `refresh: true`; reread the resulting revision. Do not invent
35
35
  module references, replace an older note, delete sources or clear the task to
36
36
  satisfy this boundary. Already imported material does not need to be imported again.
37
+ The adjusted source stays citable by the remaining pages queued in the same revision;
38
+ repeating the adjustment for an unchanged source keeps already prepared pages.
37
39
  A managed-source `base_digest` protects file replacement from conflicts; it is not
38
40
  source-scope authorization and is not interchangeable with a snapshot hash.
39
41
 
@@ -137,7 +139,7 @@ Action schema and the same source and baseline validation.
137
139
 
138
140
  When a fragment's support changes, include `references` with its actual
139
141
  `source_ref` and `locator` (`path`, `start_line`, `end_line`). Each fragment allows
140
- up to three positions; Context reads the captured region and computes its digest.
142
+ regions from up to three source files, eight regions in total; Context reads the captured region and computes its digest.
141
143
  For full Markdown, optional `sections` contains only `{ section_id, references }`
142
144
  entries; for local edits it can accompany `content` or update references alone.
143
145
  An explicit empty list removes that fragment's citations. Deleted fragments lose
@@ -170,3 +172,16 @@ If the user explicitly requires a different presentation, explain the difference
170
172
  and resolve that choice before accepting it. Do not rerun unchanged Repair to
171
173
  force a format the program deliberately omits. Check the actual resulting page;
172
174
  accepted tasks or an empty Composer result alone do not demonstrate a correction.
175
+
176
+ ### Locating submitted references
177
+
178
+ Submission locators also accept `{path, heading}` or `{path, quote}` instead of
179
+ line numbers. Use exactly one form. A heading is the title text of an exact ATX heading
180
+ outside code fences in a Markdown source; a leading `##` marker is optional and,
181
+ when present, also selects the heading level; its region ends before the next
182
+ same-level or higher-level heading. A quote is an exact, unique, nonempty
183
+ substring (line endings are normalized). Ambiguous matches return candidate
184
+ line ranges. Both forms resolve against authorized captured text before hashing;
185
+ stored references still contain only `path`, `start_line` and `end_line`.
186
+ The per-fragment limits (three source files, eight regions) apply after
187
+ resolving and deduplicating positions.
@@ -338,7 +338,7 @@ changing structure, adding a page or when a section has no unambiguous ID.
338
338
  To change a fragment's citations, include `references` alongside its `section_id`:
339
339
  each entry supplies `source_ref` and `locator` (`path`, `start_line`, `end_line`).
340
340
  Context computes the region fingerprint. This uses the same revision submission,
341
- with at most three source positions per fragment. Full Markdown may include a
341
+ with at most three source files and eight regions per fragment. Full Markdown may include a
342
342
  `sections` list of reference edits; local section edits may change content,
343
343
  references, or both. Omission preserves citations; an empty list removes them.
344
344
 
@@ -703,6 +703,19 @@ Revision section edits may supply `references` as `source_ref` plus a
703
703
  `locator` containing `path`, `start_line`, and `end_line`. Context computes the
704
704
  regional digest. Omitted references preserve the current fragment's citations;
705
705
  an explicit empty list removes them, and deleting a fragment removes its
706
- citations. Each fragment may cite at most three source positions. Register and
706
+ citations. Each fragment may cite at most three source files and eight regions. Register and
707
707
  authorize new material before citing it, then follow normal Review, close and
708
708
  build. Article links alone do not authorize reading new sources or prove a claim.
709
+
710
+ ### Locating submitted references
711
+
712
+ Submission locators also accept `{path, heading}` or `{path, quote}` instead of
713
+ line numbers. Use exactly one form. A heading is the title text of an exact ATX heading
714
+ outside code fences in a Markdown source; a leading `##` marker is optional and,
715
+ when present, also selects the heading level; its region ends before the next
716
+ same-level or higher-level heading. A quote is an exact, unique, nonempty
717
+ substring (line endings are normalized). Ambiguous matches return candidate
718
+ line ranges. Both forms resolve against authorized captured text before hashing;
719
+ stored references still contain only `path`, `start_line` and `end_line`.
720
+ The per-fragment limits (three source files, eight regions) apply after
721
+ resolving and deduplicating positions.
@@ -70,7 +70,7 @@ complete article with stable `context:section` markers. References contain
70
70
  `sections`, each with its matching `id` and `references` list. A reference is
71
71
  `source_ref` plus `locator: {path, start_line, end_line}` from actual authorized
72
72
  text. CLI computes source digests. A fragment may cite at most three distinct
73
- source positions; an article may have multiple fragments.
73
+ source files and eight regions; an article may have multiple fragments.
74
74
 
75
75
  When prose names a file, directory or Skill from a cited repository, write its
76
76
  exact repository-relative path, or the unique name of its directory such as a
@@ -104,3 +104,16 @@ build resumes the same stage; a failed build retains the pause and all tasks.
104
104
  To cancel that pause explicitly, use `context run --resume-writing --format json`.
105
105
  It preserves approved articles, candidates and existing task input handles.
106
106
  Partial delivery must include the approved articles needed by its local links.
107
+
108
+ ### Locating submitted references
109
+
110
+ Submission locators also accept `{path, heading}` or `{path, quote}` instead of
111
+ line numbers. Use exactly one form. A heading is the title text of an exact ATX heading
112
+ outside code fences in a Markdown source; a leading `##` marker is optional and,
113
+ when present, also selects the heading level; its region ends before the next
114
+ same-level or higher-level heading. A quote is an exact, unique, nonempty
115
+ substring (line endings are normalized). Ambiguous matches return candidate
116
+ line ranges. Both forms resolve against authorized captured text before hashing;
117
+ stored references still contain only `path`, `start_line` and `end_line`.
118
+ The per-fragment limits (three source files, eight regions) apply after
119
+ resolving and deduplicating positions.
@@ -26,6 +26,13 @@ Use an empty list only when existing pages cover the change or the additions
26
26
  are outside the confirmed purpose. New pages go through the same writing and
27
27
  review process as revisions; a new topic is not a no-change decision.
28
28
 
29
+ A kept page's citations whose text only moved in the updated source are
30
+ relocated when the update settles. When cited text changed or cannot be
31
+ confirmed, the completion result lists it in `reference_warnings`; those
32
+ citations keep their previous locations. The warning is a receipt for the
33
+ accepted decision, not a request to resubmit it: after the current update queue
34
+ finishes, run `context revise` on each listed page that needs a correction.
35
+
29
36
  The CLI keeps the previous processed version until every requested page has
30
37
  been approved, closed and built. If temporary progress is lost, inspect again
31
38
  from that version and preserve the pages already approved. A saved report or
@@ -30,26 +30,64 @@
30
30
  "minLength": 1
31
31
  },
32
32
  "locator": {
33
- "type": "object",
34
- "properties": {
35
- "path": {
36
- "type": "string"
33
+ "anyOf": [
34
+ {
35
+ "type": "object",
36
+ "properties": {
37
+ "path": {
38
+ "type": "string"
39
+ },
40
+ "start_line": {
41
+ "type": "integer",
42
+ "minimum": 1
43
+ },
44
+ "end_line": {
45
+ "type": "integer",
46
+ "minimum": 1
47
+ }
48
+ },
49
+ "required": [
50
+ "path",
51
+ "start_line",
52
+ "end_line"
53
+ ],
54
+ "additionalProperties": false
37
55
  },
38
- "start_line": {
39
- "type": "integer",
40
- "minimum": 1
56
+ {
57
+ "type": "object",
58
+ "properties": {
59
+ "path": {
60
+ "$ref": "#/anyOf/0/properties/sections/items/properties/references/items/properties/locator/anyOf/0/properties/path"
61
+ },
62
+ "heading": {
63
+ "type": "string",
64
+ "minLength": 1
65
+ }
66
+ },
67
+ "required": [
68
+ "path",
69
+ "heading"
70
+ ],
71
+ "additionalProperties": false
41
72
  },
42
- "end_line": {
43
- "type": "integer",
44
- "minimum": 1
73
+ {
74
+ "type": "object",
75
+ "properties": {
76
+ "path": {
77
+ "$ref": "#/anyOf/0/properties/sections/items/properties/references/items/properties/locator/anyOf/0/properties/path"
78
+ },
79
+ "quote": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ }
83
+ },
84
+ "required": [
85
+ "path",
86
+ "quote"
87
+ ],
88
+ "additionalProperties": false
45
89
  }
46
- },
47
- "required": [
48
- "path",
49
- "start_line",
50
- "end_line"
51
- ],
52
- "additionalProperties": false
90
+ ]
53
91
  }
54
92
  },
55
93
  "required": [
@@ -57,8 +95,7 @@
57
95
  "locator"
58
96
  ],
59
97
  "additionalProperties": false
60
- },
61
- "maxItems": 3
98
+ }
62
99
  }
63
100
  },
64
101
  "required": [
@@ -129,26 +129,64 @@
129
129
  "minLength": 1
130
130
  },
131
131
  "locator": {
132
- "type": "object",
133
- "properties": {
134
- "path": {
135
- "type": "string"
132
+ "anyOf": [
133
+ {
134
+ "type": "object",
135
+ "properties": {
136
+ "path": {
137
+ "type": "string"
138
+ },
139
+ "start_line": {
140
+ "type": "integer",
141
+ "minimum": 1
142
+ },
143
+ "end_line": {
144
+ "type": "integer",
145
+ "minimum": 1
146
+ }
147
+ },
148
+ "required": [
149
+ "path",
150
+ "start_line",
151
+ "end_line"
152
+ ],
153
+ "additionalProperties": false
136
154
  },
137
- "start_line": {
138
- "type": "integer",
139
- "minimum": 1
155
+ {
156
+ "type": "object",
157
+ "properties": {
158
+ "path": {
159
+ "$ref": "#/$defs/approvedRevision/anyOf/0/properties/sections/items/properties/references/items/properties/locator/anyOf/0/properties/path"
160
+ },
161
+ "heading": {
162
+ "type": "string",
163
+ "minLength": 1
164
+ }
165
+ },
166
+ "required": [
167
+ "path",
168
+ "heading"
169
+ ],
170
+ "additionalProperties": false
140
171
  },
141
- "end_line": {
142
- "type": "integer",
143
- "minimum": 1
172
+ {
173
+ "type": "object",
174
+ "properties": {
175
+ "path": {
176
+ "$ref": "#/$defs/approvedRevision/anyOf/0/properties/sections/items/properties/references/items/properties/locator/anyOf/0/properties/path"
177
+ },
178
+ "quote": {
179
+ "type": "string",
180
+ "minLength": 1
181
+ }
182
+ },
183
+ "required": [
184
+ "path",
185
+ "quote"
186
+ ],
187
+ "additionalProperties": false
144
188
  }
145
- },
146
- "required": [
147
- "path",
148
- "start_line",
149
- "end_line"
150
- ],
151
- "additionalProperties": false
189
+ ]
152
190
  }
153
191
  },
154
192
  "required": [
@@ -156,8 +194,7 @@
156
194
  "locator"
157
195
  ],
158
196
  "additionalProperties": false
159
- },
160
- "maxItems": 3
197
+ }
161
198
  }
162
199
  },
163
200
  "required": [
@@ -8,13 +8,19 @@ knowledge map title that is missing or stale for each declared locale, with the
8
8
  `expected_digest` to submit. Approved knowledge in the primary language remains
9
9
  the only source of truth; translations never change it.
10
10
 
11
- For each article, read the approved file and write a complete translation to a
12
- temporary file under `.tmp/agent-payloads/`. Keep its structure exactly:
11
+ Edit each returned draft `file` and submit the returned `submission_path`. With
12
+ `draft: generated`, a stale article's draft is its current translation; when
13
+ `source_diff` is a path, apply those source changes. A missing article's draft
14
+ is the approved source to translate in a natural tone. With `draft: kept`, or
15
+ whenever `source_diff` is `null`, align the whole draft with the current
16
+ approved article before submitting. Keep the translation's structure exactly:
13
17
 
14
18
  - frontmatter contains only a translated `title` and optional `description`;
15
19
  - keep every `context:section` marker, id and order unchanged;
16
- - keep every fenced code block, language and content unchanged; only Mermaid
17
- labels may be translated;
20
+ - keep every fenced code block and language marker; translate prose in `text`,
21
+ `txt`, and `plaintext` blocks, preserving commands, paths and placeholders such
22
+ as `<repository>`. Mermaid labels may be translated. Keep content unchanged
23
+ in every other block, including blocks without a language marker;
18
24
  - keep every link target unchanged; translate link labels only;
19
25
  - keep product names, commands, file paths, identifiers and API names as written.
20
26