@c4a/context-cli 0.6.2 → 0.6.3

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 (41) hide show
  1. package/README.md +30 -3
  2. package/README.zh-CN.md +29 -3
  3. package/cli.js +23732 -20136
  4. package/docs/context-debug-event-v1.schema.json +29 -0
  5. package/docs/context-debug-replay-v1.schema.json +33 -0
  6. package/docs/debug-tracing.md +86 -0
  7. package/docs/quickstart.md +1 -1
  8. package/package.json +7 -4
  9. package/plugins/VERSION +1 -1
  10. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  11. package/plugins/claude/commands/continue.md +19 -14
  12. package/plugins/claude/commands/init.md +3 -1
  13. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  14. package/plugins/codex/skills/continue/SKILL.md +19 -14
  15. package/plugins/codex/skills/init/SKILL.md +2 -0
  16. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  17. package/plugins/cursor/commands/context-continue.md +19 -14
  18. package/plugins/cursor/commands/context-init.md +3 -1
  19. package/plugins/skills/context-continue/SKILL.md +19 -14
  20. package/plugins/skills/context-init/SKILL.md +2 -0
  21. package/providers/context/actions/inspect-repository-recovery.yaml +6 -0
  22. package/providers/context/actions/reconcile-review-identities.yaml +5 -0
  23. package/providers/context/actions/repair-verification.yaml +3 -3
  24. package/providers/context/actions/restore-repository-sources.yaml +7 -0
  25. package/providers/context/codes.yaml +2 -1
  26. package/providers/context/graphs/workspace.yaml +49 -7
  27. package/providers/context/manifest.json +94 -31
  28. package/providers/context/provider.yaml +1 -1
  29. package/providers/context/resources/dialogue/repository-source-recovery.md +23 -0
  30. package/providers/context/resources/manuals/guides/lark-resources.md +121 -0
  31. package/providers/context/resources/manuals/guides/package-outputs.md +8 -0
  32. package/providers/context/resources/manuals/reference/project-api.md +43 -7
  33. package/providers/context/resources/procedures/close-and-build.md +5 -3
  34. package/providers/context/resources/procedures/document-capture.md +5 -1
  35. package/providers/context/resources/procedures/knowledge-review.md +10 -0
  36. package/providers/context/resources/procedures/repository-source-recovery.md +43 -0
  37. package/providers/context/resources/procedures/source-capture-detailed.md +13 -0
  38. package/providers/context/resources/procedures/verify-and-repair.md +12 -0
  39. package/providers/context/resources/views/source-boundary.yaml +6 -0
  40. package/providers/context/schemas/repository-source-recovery.schema.json +40 -0
  41. package/providers/context/actions/ensure-repository-sources.yaml +0 -5
@@ -215,6 +215,13 @@ extraction phases, review gates, close/build, and packages explicitly. The CLI
215
215
  then routes work through `context status`, `context run <phase-id>`, `context
216
216
  review html/apply`, `context close`, `context verify`, and `context build`.
217
217
 
218
+ For Agent and automation output, use `context verify --format json --compact`.
219
+ It returns deterministic groups, counts, affected-scope totals, and a few
220
+ representative samples instead of repeating every issue. Read the complete,
221
+ auditable issue set only when needed with `context verify --view diagnostics
222
+ --page-size 25 --format json`; follow its executable pagination command without
223
+ inventing overlapping file ranges.
224
+
218
225
  ### Status declaration coverage
219
226
 
220
227
  `context status --format json --view full` includes a `declarationGraph` and
@@ -327,6 +334,21 @@ Markdown snapshot:
327
334
  captureLark({ source: handbook });
328
335
  ```
329
336
 
337
+ Embedded resources are materialized with deterministic defaults. Video remains
338
+ reference-only unless a project opts into bundling, and byte limits prevent an
339
+ unexpected document from expanding the workspace without bound:
340
+
341
+ ```ts
342
+ captureLark({
343
+ source: handbook,
344
+ resources: {
345
+ videos: "bundle",
346
+ maxBytesPerResource: 20 * 1024 * 1024,
347
+ maxTotalBytes: 200 * 1024 * 1024,
348
+ },
349
+ });
350
+ ```
351
+
330
352
  Phase id:
331
353
 
332
354
  ```text
@@ -340,19 +362,33 @@ one date batch; when `--module` is omitted, the CLI derives an opaque,
340
362
  credential-safe module id. Capture reads the
341
363
  remote document through the CLI runner as structured Docx XML. Context keeps a
342
364
  redacted XML audit asset, projects supported blocks deterministically into
343
- readable Markdown, and registers external resources such as document citations,
344
- images, video, whiteboards, and Base references in the snapshot manifest even
345
- when their binary content is not downloaded. The projection does not infer or
346
- summarize document meaning. Its fidelity report closes discovered blocks
365
+ readable Markdown, and materializes required inline resources such as images,
366
+ attachments, Sheets, Bases, whiteboards, diagrams, and synced blocks. Navigation
367
+ resources and default video capture remain explicit references. The projection
368
+ does not infer or summarize document meaning. Its fidelity and resource reports close discovered blocks
347
369
  against converted and intentionally skipped blocks and reports evidence
348
370
  completeness separately from Markdown projection quality. Unknown non-empty XML
349
371
  blocks receive a generic, auditable, non-interactive projection and do not block
350
- downstream work. Missing source content or unresolved external-resource identity
351
- remains an evidence error and prevents downstream Review.
372
+ downstream work. A remote whiteboard or diagram explicitly confirmed as deleted
373
+ is preserved as an unavailable-resource notice with
374
+ `document.resource.source-missing` and a warning. An embedded resource whose
375
+ export is explicitly rejected as `authorization/permission_denied` is retained
376
+ the same way with `document.resource.permission-denied`. Missing scopes,
377
+ unresolved external-resource identity, retryable failures, and unclassified
378
+ authorization errors remain evidence errors and prevent downstream Review.
352
379
  Snapshot files live under `sources/lark/<date>/` as sibling document files
353
- tracked by one date-level `manifest.json`. Access credentials and transient
380
+ tracked by one compact date-level `manifest.json`. Each module keeps one raw
381
+ `source.xml`, one consolidated `capture-report.json`, and its actual downloaded
382
+ or structured resources under `assets/<module>/materialized/`; it does not emit
383
+ one descriptor file per embedded resource. Access credentials and transient
354
384
  signed media URLs are not written into the workspace.
355
385
 
386
+ Approved resource bytes are projected to content-addressed
387
+ `knowledge/assets/<kind>/` paths. KB build copies selected resources to
388
+ `others/assets/<kind>/` inside the package and rewrites page links. See
389
+ [Lark Resource Materialization](../guides/lark-resources.md) for the complete
390
+ resource table and storage lifecycle.
391
+
356
392
  Use a typed document reference in project declarations:
357
393
 
358
394
  ```ts
@@ -8,9 +8,11 @@ mediaType: text/markdown
8
8
 
9
9
  Close deterministically derives `knowledge/structure.yaml` from approved
10
10
  Markdown and the confirmed structure snapshots. It validates the rebuilt
11
- projection; it does not rewrite approved page bodies. Before removing the
12
- transient snapshots, it retains only each closed prose target's source,
13
- collection, and consumed snapshot hash under `source_inputs`.
11
+ projection. When an approved page still points at a captured source asset,
12
+ close may mechanically replace that target with its content-addressed
13
+ `knowledge/assets` path; it does not rewrite reader-visible prose. Before
14
+ removing the transient snapshots, it retains only each closed prose target's
15
+ source, collection, and consumed snapshot hash under `source_inputs`.
14
16
 
15
17
  Build runs only after close and verification are current. It writes declared
16
18
  packages under `dist/` and records an inventory receipt with added, updated,
@@ -39,7 +39,11 @@ and continue until the graph reports the batch complete. Never treat one
39
39
  successful module as completion of the whole batch.
40
40
 
41
41
  The CLI owns normalization, snapshot identity, hashes, manifests, and
42
- idempotency. Never hand-write or repair captured snapshots. If a selected local
42
+ idempotency. For Lark sources it also owns embedded-resource download,
43
+ structured export, completeness reporting, and link projection. Required
44
+ resource failures block the next phase; reference-only resources remain
45
+ explicit in the report. Never hand-write or repair captured snapshots or their
46
+ asset links. If a selected local
43
47
  boundary is a documentation site rather than plain Markdown, use the
44
48
  Context-provided processor/configuration diagnostic; do not invent rendered
45
49
  text or scan outside the confirmed boundary.
@@ -10,6 +10,16 @@ Review is the authority boundary between candidates and approved knowledge.
10
10
  Open one report for the complete current candidate set and apply only a payload
11
11
  that matches its collection scope and candidate-set digest.
12
12
 
13
+ Before Review, Context checks both sides of approved page identity: whether a
14
+ candidate path is already owned by another `view_ref` / `node_ref`, and whether
15
+ the candidate `view_ref` is already approved at another path. Either conflict
16
+ blocks Review. Follow the returned identity-coordination route: the default
17
+ mechanical repair preserves the approved identity and approved path, then
18
+ recompiles only the affected source. It keeps the candidate batch intact while
19
+ replacing affected candidates in place. Changing an approved identity or moving
20
+ an approved path is a migration and must never run without a separate, explicit
21
+ authorization.
22
+
13
23
  Without explicit session-managed authority:
14
24
 
15
25
  - open the report returned by the route;
@@ -0,0 +1,43 @@
1
+ ---
2
+ id: procedure.repository-source-recovery
3
+ kind: procedure
4
+ mediaType: text/markdown
5
+ ---
6
+
7
+ # Repository source recovery
8
+
9
+ Repository checkout contents and materialized module links are local runtime
10
+ inputs. Git stores their recovery recipe in `sources/repo/index.yaml`; it does
11
+ not store the checkout, local aliases, or `sources/repo/<date>/<module>` links.
12
+
13
+ Run the route's inspection action first. It groups logical modules by registered
14
+ remote and pinned commit, so one physical checkout can restore every module in
15
+ that group. Do not create one clone per module. Groups already marked `ready`
16
+ need no decision; when every group is ready, the plan has no recovery action.
17
+
18
+ For each missing physical checkout, ask the user to choose one option:
19
+
20
+ 1. provide an existing local Git checkout;
21
+ 2. name a bounded directory that the Agent may scan, then choose one of the
22
+ matching checkouts shown by the Agent; or
23
+ 3. explicitly allow Context to clone the registered repository into the
24
+ suggested `.tmp/repo/` target.
25
+
26
+ Scanning and clone access are separate external authorities. Never scan an
27
+ unspecified disk root. Never infer or substitute another remote, branch, tag,
28
+ or nearby repository. A recovery clone uses the registered pinned commit so
29
+ the existing knowledge state is reproducible. Updating knowledge to a newer
30
+ upstream version is a later, explicit source update decision.
31
+
32
+ After the user decides, submit one payload matching the route-selected recovery
33
+ schema to the exact resolution command. Local mode validates origin, the pinned
34
+ commit, and every required subpath without changing the supplied checkout.
35
+ Clone mode performs a shallow partial checkout where supported, falls back to a
36
+ shallow checkout, and uses sparse checkout only when every registered source is
37
+ bounded to a subpath. Context then restores declared local aliases and
38
+ materializes module links.
39
+
40
+ Repository sources are ready only when every selected module resolves to the
41
+ registered remote and pinned commit, every registered subpath exists, no local
42
+ path was overwritten, Context materialization succeeds, and the current route
43
+ no longer reports `route.source.repository-not-ready`.
@@ -54,6 +54,19 @@ contract, so any manual edit breaks idempotency.
54
54
  Lark capture obtains the structured XML representation and produces two
55
55
  separate artifacts: XML audit evidence and a deterministic readable Markdown
56
56
  projection. Do not treat raw XML as Markdown and do not rewrite it yourself.
57
+ The CLI also materializes supported embedded resources and returns a closed
58
+ `resource_materialization` report. Required images, attachments, Sheets, Bases,
59
+ whiteboards, diagrams, and synced blocks must be materialized before downstream
60
+ Review. Polls and navigation references remain explicit non-interactive
61
+ projections; video is reference-only unless the project SDK opts into bundling.
62
+ If the remote API explicitly confirms that a referenced whiteboard or diagram
63
+ no longer exists, preserve the unresolved placeholder and the structured
64
+ `document.resource.source-missing` warning, then continue through the Route.
65
+ This is an audited source-side deletion, not successful materialization. Access,
66
+ network, parameter, and unknown resource failures still block downstream work.
67
+ Do not manually download resources or patch links. Approved resources move to
68
+ `knowledge/assets/`, and package build projects selected resources to
69
+ `others/assets/`.
57
70
  Inspect `evidence_status` and `projection_status` separately. An evidence error
58
71
  means the source body, external content, or a stable resource locator could not
59
72
  be preserved, so the workflow must not proceed to Align, Compile, or Review.
@@ -14,6 +14,18 @@ is stale, the legal repair is `context close --format json`. Otherwise, repair
14
14
  the source-bound candidate or project declaration named by the root diagnostic,
15
15
  then run verification again.
16
16
 
17
+ When every blocking finding is an approved document `source_ref` drift or an
18
+ unresolved required-resource placeholder, and each affected source already has
19
+ a declared pending structure target, the current prose align/compile round is
20
+ the repair path. Continue that Route before running verification again. This
21
+ exception does not apply to missing sources, malformed approved knowledge,
22
+ unrelated verification errors, or findings without a matching pending target.
23
+
24
+ When a complete replacement candidate batch is ready for Review, stable prose
25
+ candidate ids may intentionally match their currently approved pages. Review
26
+ that batch before deterministic close and final verification; the pending
27
+ replacement is not an approved-identity conflict.
28
+
17
29
  Do not delete candidates, approved pages, snapshots, or structure slots to make
18
30
  verification pass. Derived diagnostics should not be handled as independent
19
31
  root failures.
@@ -0,0 +1,6 @@
1
+ schema: agent-graph.resource.v1
2
+ id: context.source-boundary
3
+ kind: context-view
4
+ mediaType: text/markdown
5
+ description: Stable registered source identities and boundaries without lifecycle progress.
6
+ materializer: actions/materialize-context-view.yaml
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "context.repository-source-recovery.v1",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["schema", "repositories"],
7
+ "properties": {
8
+ "schema": {
9
+ "const": "context.repository-source-recovery.v1"
10
+ },
11
+ "repositories": {
12
+ "type": "array",
13
+ "minItems": 1,
14
+ "items": {
15
+ "oneOf": [
16
+ {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["source", "mode", "path"],
20
+ "properties": {
21
+ "source": { "type": "string", "minLength": 1 },
22
+ "mode": { "const": "local" },
23
+ "path": { "type": "string", "minLength": 1 }
24
+ }
25
+ },
26
+ {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "required": ["source", "mode"],
30
+ "properties": {
31
+ "source": { "type": "string", "minLength": 1 },
32
+ "mode": { "const": "clone" },
33
+ "path": { "type": "string", "minLength": 1 }
34
+ }
35
+ }
36
+ ]
37
+ }
38
+ }
39
+ }
40
+ }
@@ -1,5 +0,0 @@
1
- schema: agent-graph.action.v1
2
- id: ensure-repository-sources
3
- runner: command
4
- effect: external
5
- command: context source ensure --format json