@c4a/context-cli 0.6.3 → 0.6.4

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.
@@ -19,6 +19,8 @@
19
19
  "agent-graph.evaluated",
20
20
  "workflow.action-started",
21
21
  "workflow.action-completed",
22
+ "workflow.scope-opened",
23
+ "workflow.scope-closed",
22
24
  "workflow.stopped"
23
25
  ]
24
26
  },
@@ -55,6 +55,9 @@ The event stream records:
55
55
  - Agent Graph evaluation revision, status, selected route, alternatives, and
56
56
  whether the observable graph position changed;
57
57
  - managed workflow action start and completion with deterministic receipts;
58
+ - execution-scope open and close events, including whether a deterministic
59
+ action ran in-process or in a child process and whether every short-lived
60
+ resource was released;
58
61
  - the reason and graph position at which a managed loop stopped.
59
62
 
60
63
  `trace_id` groups the workspace-local debug history, `sequence` defines replay order,
@@ -64,6 +67,11 @@ can animate `agent-graph.evaluated` events whose `data.transition.changed` is
64
67
  true, then associate intervening command and action events by sequence and
65
68
  invocation identity.
66
69
 
70
+ Execution-scope events are runtime evidence, not workflow facts. They make
71
+ resource ownership and cleanup observable without changing a Route or adding
72
+ workspace state. Durable knowledge mutations are still audited through the
73
+ normal action receipt, revision, close, and verify results.
74
+
67
75
  ## Inspect and export
68
76
 
69
77
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/context-cli",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "description": "Local CLI for capturing, compiling, and governing knowledge workspaces",
6
6
  "license": "MIT",
@@ -20,11 +20,11 @@
20
20
  "node": ">=20"
21
21
  },
22
22
  "bin": {
23
- "context": "dist/cli.js"
23
+ "context": "cli.js"
24
24
  },
25
25
  "dependencies": {
26
- "@c4a/agent-graph": "0.2.4",
27
- "@c4a/context": "0.6.3",
26
+ "@c4a/agent-graph": "0.2.5",
27
+ "@c4a/context": "0.6.4",
28
28
  "commander": "^11.0.0",
29
29
  "fast-xml-parser": "^5.10.1",
30
30
  "handlebars": "^4.7.8",
package/plugins/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.3
1
+ 0.6.4
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "context",
3
3
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "author": {
6
6
  "name": "c4a"
7
7
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
5
5
  "author": {
6
6
  "name": "c4a"
@@ -18,7 +18,7 @@
18
18
  "skills": "./skills/",
19
19
  "interface": {
20
20
  "displayName": "C4A Context",
21
- "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.6.3",
21
+ "shortDescription": "Initialize and advance a local, source-linked project knowledge workspace.\nv0.6.4",
22
22
  "longDescription": "Create a Context workspace and use agent-guided next steps to register sources, run extraction, review candidates, build package outputs, and verify health without silently mutating source repositories.",
23
23
  "developerName": "c4a",
24
24
  "category": "Productivity",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "context",
3
3
  "displayName": "C4A Context",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "description": "Maintain a project-local knowledge workspace through init and next-step agent guidance.",
6
6
  "author": {
7
7
  "name": "Context4AI",
@@ -0,0 +1,5 @@
1
+ schema: agent-graph.action.v1
2
+ id: inspect-code-extraction
3
+ runner: host
4
+ effect: read
5
+ handler: context.extract.inspect-capabilities
@@ -289,6 +289,7 @@ nodes:
289
289
  - id: choose-extraction-scope
290
290
  kind: gate
291
291
  reasonCode: route.extract.scope-required
292
+ inspectionAction: actions/inspect-code-extraction.yaml
292
293
  gate:
293
294
  id: extraction-scope
294
295
  prompt: Confirm which registered code modules and symbol boundaries should enter code knowledge.
@@ -318,7 +319,7 @@ nodes:
318
319
  - resources/procedures/project-configuration.md
319
320
  - resources/procedures/code-extraction.md
320
321
  - resources/views/source-current.yaml
321
- - resources/manuals/reference/project-api.md
322
+ - resources/manuals/reference/code-extractors.md
322
323
 
323
324
  - id: extract-next
324
325
  kind: action
@@ -2,14 +2,14 @@
2
2
  "schema": "agent-graph.bundle.v1",
3
3
  "provider": {
4
4
  "id": "c4a/context",
5
- "version": "0.6.3"
5
+ "version": "0.6.4"
6
6
  },
7
7
  "providerManifest": "provider.yaml",
8
8
  "graphs": [
9
9
  {
10
10
  "id": "workspace",
11
11
  "path": "graphs/workspace.yaml",
12
- "digest": "sha256:98b74bb6a59a9024978209e70c2519bd3608ea77b7576326685576184947898f"
12
+ "digest": "sha256:83c1b8feb410398a34051810cbefffe8fc86dd44211d32e049d3007ecea24d7e"
13
13
  }
14
14
  ],
15
15
  "actions": [
@@ -78,6 +78,11 @@
78
78
  "path": "actions/extract-next.yaml",
79
79
  "digest": "sha256:3d5e26cbdd912c9be666ce423b19456b31ab67da53c4e01a1a1c7a3dc1e6420a"
80
80
  },
81
+ {
82
+ "id": "inspect-code-extraction",
83
+ "path": "actions/inspect-code-extraction.yaml",
84
+ "digest": "sha256:214cf9b0f9645ec7164a779ab5779ccf5b3e3132b10f8f9f666213d048f582b1"
85
+ },
81
86
  {
82
87
  "id": "inspect-document-classification",
83
88
  "path": "actions/inspect-document-classification.yaml",
@@ -158,17 +163,17 @@
158
163
  {
159
164
  "id": "context.sdk.package-outputs",
160
165
  "path": "resources/manuals/guides/package-outputs.md",
161
- "digest": "sha256:32337aae19ba17ec01fc6da04a40cec9aab4ba4ee7561d8073e600d601b560ae"
166
+ "digest": "sha256:dd9e8c21ece757a683b9ebf219d3bd6235b9a0ada43b537f143b3f2eacbb8eb9"
162
167
  },
163
168
  {
164
169
  "id": "context.sdk.package-templates",
165
170
  "path": "resources/manuals/reference/package-templates.md",
166
- "digest": "sha256:32d5fd550304d76fe011aadce4abcb0321f656c710cbeb91d964b463316561d5"
171
+ "digest": "sha256:125c867bfc33e953541f89f1fc4f9b779680e9d994071a47dd8d6c36201a2e7a"
167
172
  },
168
173
  {
169
174
  "id": "context.sdk.project-api",
170
175
  "path": "resources/manuals/reference/project-api.md",
171
- "digest": "sha256:3dd8dfa54ba4b34a31d0a284385c77992f84ad2d7ef46583ff34683aae4081ac"
176
+ "digest": "sha256:0e21f44f9c239abf176da0bcf4094f2b1d0085f31240b97b85a8b44d4633493e"
172
177
  },
173
178
  {
174
179
  "id": "context.sdk.template-variables",
@@ -178,7 +183,7 @@
178
183
  {
179
184
  "id": "context.semantic.align.align-gates",
180
185
  "path": "resources/semantic/align/gates.md",
181
- "digest": "sha256:b3982f5104418ba9a9a9b600f362cf83dba6d0becbb4efd128fe1eea89eba727"
186
+ "digest": "sha256:517be59f675022a5d9e3fa04f9b35f801a80fc32aa42084dac8bce8a45481fea"
182
187
  },
183
188
  {
184
189
  "id": "context.semantic.align.candidate-resolution",
@@ -193,7 +198,7 @@
193
198
  {
194
199
  "id": "context.semantic.align.structure-planning",
195
200
  "path": "resources/semantic/align/structure-planning.md",
196
- "digest": "sha256:c6d8902f7f70857596d3486307bb5e58ffaac6efd6021451e487c92ceb86f87d"
201
+ "digest": "sha256:73d7d1cb49ad27691e7baa29003fa1736fc8a7036c6094f40f733e62fd3c1aad"
197
202
  },
198
203
  {
199
204
  "id": "context.semantic.compile.index",
@@ -243,7 +248,7 @@
243
248
  {
244
249
  "id": "dialogue.code-extraction",
245
250
  "path": "resources/dialogue/code-extraction.md",
246
- "digest": "sha256:367c845da3ebab0354d77918170101ee9d5e6aa19700d33db2cbeffffb6b5b70"
251
+ "digest": "sha256:5aa3b52dcf9cd9bd058baea7dadb123eead162a1ec7640cc63c7c359e71922e3"
247
252
  },
248
253
  {
249
254
  "id": "dialogue.document-capture",
@@ -273,7 +278,7 @@
273
278
  {
274
279
  "id": "dialogue.package-output",
275
280
  "path": "resources/dialogue/package-output.md",
276
- "digest": "sha256:0ca7a9e56397f9acc62d92777d91e0203e2d6caa7f08268dca8037987e5911a5"
281
+ "digest": "sha256:fcf64598b9a505c764ae4984ff4d63a7010143f749ba454e220752f737306612"
277
282
  },
278
283
  {
279
284
  "id": "dialogue.repository-source-recovery",
@@ -290,6 +295,11 @@
290
295
  "path": "resources/dialogue/structure-confirmation.md",
291
296
  "digest": "sha256:4f9667860bb555c2cf236237c5a21644b7a2b249a452337d83087fa4c389dc2d"
292
297
  },
298
+ {
299
+ "id": "manual.reference.code-extractors",
300
+ "path": "resources/manuals/reference/code-extractors.md",
301
+ "digest": "sha256:6af1a9ea24b59bd5cb2125296e04d19529c92be77910e5e768251e6c4bd7902a"
302
+ },
293
303
  {
294
304
  "id": "procedure.close-and-build",
295
305
  "path": "resources/procedures/close-and-build.md",
@@ -298,7 +308,7 @@
298
308
  {
299
309
  "id": "procedure.code-extraction",
300
310
  "path": "resources/procedures/code-extraction.md",
301
- "digest": "sha256:0563be260b3c37f1c7a1a9c831ba3a0c01a872ec3ddc64fd28d414e3c876f7e2"
311
+ "digest": "sha256:dce77b35fffbba51cbc8d6bc9d2abe2924229a6248eb9585b90e63ab9e05e37a"
302
312
  },
303
313
  {
304
314
  "id": "procedure.document-capture",
@@ -323,7 +333,7 @@
323
333
  {
324
334
  "id": "procedure.package-output",
325
335
  "path": "resources/procedures/package-output.md",
326
- "digest": "sha256:c088c2341fa64caa25a04c3cef75635b2f635a932bfc7326b35cff59fc390b29"
336
+ "digest": "sha256:5d93de483e668fe77c5eaabb3ae52d4d9c36f73b61e264fd40d53f7f4d008bf8"
327
337
  },
328
338
  {
329
339
  "id": "procedure.project-configuration",
@@ -436,6 +446,10 @@
436
446
  "path": "actions/extract-next.yaml",
437
447
  "digest": "sha256:3d5e26cbdd912c9be666ce423b19456b31ab67da53c4e01a1a1c7a3dc1e6420a"
438
448
  },
449
+ {
450
+ "path": "actions/inspect-code-extraction.yaml",
451
+ "digest": "sha256:214cf9b0f9645ec7164a779ab5779ccf5b3e3132b10f8f9f666213d048f582b1"
452
+ },
439
453
  {
440
454
  "path": "actions/inspect-document-classification.yaml",
441
455
  "digest": "sha256:973889832e3adfba4fa019b3dfadda35fe22536c44ef97efba2299e6cdd65786"
@@ -490,11 +504,11 @@
490
504
  },
491
505
  {
492
506
  "path": "graphs/workspace.yaml",
493
- "digest": "sha256:98b74bb6a59a9024978209e70c2519bd3608ea77b7576326685576184947898f"
507
+ "digest": "sha256:83c1b8feb410398a34051810cbefffe8fc86dd44211d32e049d3007ecea24d7e"
494
508
  },
495
509
  {
496
510
  "path": "provider.yaml",
497
- "digest": "sha256:42dbd41c64f6ef7cc2f22a7aeef5be12c8e8619ca31f48050a3de4e449fbf043"
511
+ "digest": "sha256:f02c4060d0a30553de73be5ada2ea3086c5e91348fd920cbf282f60bebf270b5"
498
512
  },
499
513
  {
500
514
  "path": "resources/diagnostics/projection-stale.md",
@@ -510,7 +524,7 @@
510
524
  },
511
525
  {
512
526
  "path": "resources/dialogue/code-extraction.md",
513
- "digest": "sha256:367c845da3ebab0354d77918170101ee9d5e6aa19700d33db2cbeffffb6b5b70"
527
+ "digest": "sha256:5aa3b52dcf9cd9bd058baea7dadb123eead162a1ec7640cc63c7c359e71922e3"
514
528
  },
515
529
  {
516
530
  "path": "resources/dialogue/document-capture.md",
@@ -534,7 +548,7 @@
534
548
  },
535
549
  {
536
550
  "path": "resources/dialogue/package-output.md",
537
- "digest": "sha256:0ca7a9e56397f9acc62d92777d91e0203e2d6caa7f08268dca8037987e5911a5"
551
+ "digest": "sha256:fcf64598b9a505c764ae4984ff4d63a7010143f749ba454e220752f737306612"
538
552
  },
539
553
  {
540
554
  "path": "resources/dialogue/repository-source-recovery.md",
@@ -554,15 +568,19 @@
554
568
  },
555
569
  {
556
570
  "path": "resources/manuals/guides/package-outputs.md",
557
- "digest": "sha256:32337aae19ba17ec01fc6da04a40cec9aab4ba4ee7561d8073e600d601b560ae"
571
+ "digest": "sha256:dd9e8c21ece757a683b9ebf219d3bd6235b9a0ada43b537f143b3f2eacbb8eb9"
572
+ },
573
+ {
574
+ "path": "resources/manuals/reference/code-extractors.md",
575
+ "digest": "sha256:6af1a9ea24b59bd5cb2125296e04d19529c92be77910e5e768251e6c4bd7902a"
558
576
  },
559
577
  {
560
578
  "path": "resources/manuals/reference/package-templates.md",
561
- "digest": "sha256:32d5fd550304d76fe011aadce4abcb0321f656c710cbeb91d964b463316561d5"
579
+ "digest": "sha256:125c867bfc33e953541f89f1fc4f9b779680e9d994071a47dd8d6c36201a2e7a"
562
580
  },
563
581
  {
564
582
  "path": "resources/manuals/reference/project-api.md",
565
- "digest": "sha256:3dd8dfa54ba4b34a31d0a284385c77992f84ad2d7ef46583ff34683aae4081ac"
583
+ "digest": "sha256:0e21f44f9c239abf176da0bcf4094f2b1d0085f31240b97b85a8b44d4633493e"
566
584
  },
567
585
  {
568
586
  "path": "resources/manuals/reference/template-variables.md",
@@ -574,7 +592,7 @@
574
592
  },
575
593
  {
576
594
  "path": "resources/procedures/code-extraction.md",
577
- "digest": "sha256:0563be260b3c37f1c7a1a9c831ba3a0c01a872ec3ddc64fd28d414e3c876f7e2"
595
+ "digest": "sha256:dce77b35fffbba51cbc8d6bc9d2abe2924229a6248eb9585b90e63ab9e05e37a"
578
596
  },
579
597
  {
580
598
  "path": "resources/procedures/document-capture.md",
@@ -594,7 +612,7 @@
594
612
  },
595
613
  {
596
614
  "path": "resources/procedures/package-output.md",
597
- "digest": "sha256:c088c2341fa64caa25a04c3cef75635b2f635a932bfc7326b35cff59fc390b29"
615
+ "digest": "sha256:5d93de483e668fe77c5eaabb3ae52d4d9c36f73b61e264fd40d53f7f4d008bf8"
598
616
  },
599
617
  {
600
618
  "path": "resources/procedures/project-configuration.md",
@@ -634,11 +652,11 @@
634
652
  },
635
653
  {
636
654
  "path": "resources/semantic/align/gates.md",
637
- "digest": "sha256:b3982f5104418ba9a9a9b600f362cf83dba6d0becbb4efd128fe1eea89eba727"
655
+ "digest": "sha256:517be59f675022a5d9e3fa04f9b35f801a80fc32aa42084dac8bce8a45481fea"
638
656
  },
639
657
  {
640
658
  "path": "resources/semantic/align/structure-planning.md",
641
- "digest": "sha256:c6d8902f7f70857596d3486307bb5e58ffaac6efd6021451e487c92ceb86f87d"
659
+ "digest": "sha256:73d7d1cb49ad27691e7baa29003fa1736fc8a7036c6094f40f733e62fd3c1aad"
642
660
  },
643
661
  {
644
662
  "path": "resources/semantic/compile/index.md",
@@ -696,5 +714,5 @@
696
714
  "graphDependencies": {
697
715
  "workspace": []
698
716
  },
699
- "digest": "sha256:9a4fdc41e173bd8f98d12428c0ef0f03e00a62a588bedfb58ad52ef6b589317c"
717
+ "digest": "sha256:c039063eb3d29dadd7b60279dfd97f809c007f8cbb39f1dafe47667a994cd3e7"
700
718
  }
@@ -1,6 +1,6 @@
1
1
  schema: agent-graph.provider.v1
2
2
  id: c4a/context
3
- version: 0.6.3
3
+ version: 0.6.4
4
4
  name: Context workflow
5
5
  description: Internal work contract for Context knowledge workspaces.
6
6
  graphs:
@@ -16,11 +16,22 @@ Describe the proposed code scope before SDK fields. State:
16
16
  - that the first run or later deltas produce Review candidates rather than
17
17
  approved Markdown.
18
18
 
19
+ Also state the inspected manifest signals and the chosen extractor in one
20
+ sentence. Say whether the selected capability covers the module directly or
21
+ whether a project-owned adapter supplies the missing mapping. Do not ask the
22
+ user to choose between parser package names unless two genuinely incompatible
23
+ technical choices remain.
24
+
19
25
  If a selected package lacks a standard entry, offer two Context-owned choices:
20
26
  configure source-relative API roots, or use scan mode for all declarations in
21
27
  the confirmed file scope. Do not ask the user to change source code or package
22
28
  metadata to satisfy Context.
23
29
 
30
+ For a non-TypeScript source or an aggregated repository protocol, explain that
31
+ the project will use `extractCustom()`. If an optional structural extractor is
32
+ available, use it for syntax facts and keep project-specific classification in
33
+ the project callback; do not imply that installing it adds a new CLI phase.
34
+
24
35
  Run the route-selected dry-run first. Report discovered, AST-analyzed, skipped,
25
36
  symbol, relation, and candidate counts separately, plus resolved entries,
26
37
  exported/internal counts, symbol-kind counts, and the proposed knowledge tree.
@@ -25,6 +25,15 @@ package namespace. Ask whether Skills need a short optional prefix, then
25
25
  maintain their complete final names in the template. Do not expose downstream
26
26
  layout terminology or ask for platform-specific identity fields.
27
27
 
28
+ Also ask how referenced resources should be delivered. Offer Git raw links,
29
+ bundled files, or explicit omission. Git raw may derive a commit-pinned GitHub
30
+ URL when the workspace is in Git, or use an author-provided HTTPS `urlPrefix`
31
+ for resources published from another repository. A literal branch in that
32
+ prefix is an explicit project choice, not a Context default. If neither local
33
+ Git nor an explicit prefix is available, offer only bundle or omit.
34
+ State that publishing the referenced resources and making private raw hosts
35
+ reachable are the package author's responsibility; Context does not probe them.
36
+
28
37
  Do not offer a hidden `both` shortcut. If the user wants multiple outputs,
29
38
  declare and inspect one first, then obtain confirmation for the next. Mention
30
39
  `kbPackage` and `llmsPackage` only after the semantic output choice.
@@ -96,11 +96,25 @@ task workflows. Authors may explicitly accept the generic default when it is
96
96
  intentionally sufficient.
97
97
 
98
98
  When approved pages reference materialized document resources, Context keeps
99
- their production copies in content-addressed `knowledge/assets/` paths. Build
100
- copies only the resources selected by package pages to `others/assets/` and
101
- rewrites relative Markdown links. Source audit XML and capture reports stay in
102
- the production workspace; they are not distributed as reader assets. See
103
- [Lark Resource Materialization](./lark-resources.md).
99
+ their production copies in content-addressed `knowledge/assets/` paths. New KB
100
+ setup should offer Git raw delivery first. It rewrites package links to either
101
+ an automatically derived raw prefix or an explicit author-provided prefix.
102
+ Context does not check whether resource files are committed, pushed, or
103
+ remotely readable; that is the package author's responsibility. With no
104
+ explicit prefix, supported remotes use an immutable commit URL. An explicit
105
+ prefix can contain `{commit}` when the Context workspace is in Git, or name a
106
+ mutable branch when that lifecycle is intentional; a literal prefix also works
107
+ when resources are published from a separate repository.
108
+
109
+ Workspaces without usable Git or an explicit raw prefix can choose bundled
110
+ delivery, which copies only selected resources to `others/assets/`, or explicit
111
+ omission, which does not copy resources and reports that links remain
112
+ unresolved. Bundled output may
113
+ optionally install `sharp` in the workspace and configure
114
+ `assets.optimize`; Context itself has no image dependency. Optimization changes
115
+ only `dist/`, content-addresses smaller WebP output, and leaves `sources/` and
116
+ `knowledge/assets/` unchanged. Source audit XML and capture reports are never
117
+ distributed as reader assets. See [Lark Resource Materialization](./lark-resources.md).
104
118
 
105
119
  The same inventory exposes `structure.relationship_coverage`. It records
106
120
  whether selected codegraph pages have current source-backed AST relationship
@@ -0,0 +1,94 @@
1
+ ---
2
+ id: manual.reference.code-extractors
3
+ kind: procedure
4
+ mediaType: text/markdown
5
+ ---
6
+
7
+ # Code Extractor Selection
8
+
9
+ Use this manual only when the current code-extraction Route asks the Agent to
10
+ choose or declare an extractor. The CLI reports repository facts; the Agent
11
+ chooses how those facts become source-backed code knowledge.
12
+
13
+ ## Inspect Before Declaring
14
+
15
+ Run every read-only inspection command returned by the extraction-scope Gate.
16
+ The result identifies each confirmed module and its recognized `manifests`.
17
+ Treat these as deterministic technology signals, not as product semantics:
18
+
19
+ | Signal | Technology candidate |
20
+ |---|---|
21
+ | `package.json` | TypeScript, TSX, JavaScript, or JSX |
22
+ | `go.mod` | Go |
23
+ | `Cargo.toml` | Rust |
24
+ | `pyproject.toml` or `setup.py` | Python |
25
+ | `pom.xml` or `build.gradle` | Java or JVM |
26
+ | multiple manifests | a mixed module that may need more than one extractor |
27
+
28
+ Do not select `extractTs()` merely because a repository contains some
29
+ TypeScript. Decide against the exact confirmed module and include boundary. A
30
+ mixed module may compose multiple structural passes; parser selection is not an
31
+ exclusive repository-wide switch.
32
+
33
+ ## Selection Order
34
+
35
+ Use the narrowest reusable capability that covers the confirmed source:
36
+
37
+ 1. Use a Context-owned phase when its contract matches the source.
38
+ 2. Otherwise use a reusable structural package inside `extractCustom()`.
39
+ 3. If no reusable package covers the syntax or repository protocol, implement a
40
+ project-owned adapter and keep it in the Context workspace.
41
+
42
+ Current reusable capabilities are:
43
+
44
+ | Source fact | Preferred capability | Lifecycle integration |
45
+ |---|---|---|
46
+ | TypeScript/TSX package or file scope | `extractTs()` | Context-owned phase |
47
+ | Go declarations, imports, calls, and common HTTP routes | `@c4a/extract-go` | call from `extractCustom()` |
48
+ | Rush workspace packages, tags, dependencies, entries, and owners | `@c4a/extract-rush` | call from `extractCustom()`; may complement a language extractor |
49
+ | React Router route declarations | `extractReactRouterRoutes()` from `@c4a/extract-ts` | call from `extractCustom()`; complements TypeScript symbols |
50
+ | Rust, Python, Java/JVM, or an unsupported framework/protocol | no assumed built-in parser | project-owned `extractCustom()` adapter |
51
+
52
+ An optional package does not create a new CLI phase. Add it as an explicit
53
+ workspace dependency, then map its structural facts to candidates in the
54
+ project callback. Do not add a parser package when its documented coverage does
55
+ not match the inspected source.
56
+
57
+ ## Read The Contract Before Extending
58
+
59
+ Before editing `src/index.ts`, read the relevant installed public manual or
60
+ package README. Do not infer APIs from bundled JavaScript.
61
+
62
+ - Context lifecycle and `extractCustom()`:
63
+ `node_modules/@c4a/context/docs/reference/project-api.md`
64
+ - Generic plugin protocol:
65
+ `node_modules/@c4a/extract/README.md`
66
+ - TypeScript:
67
+ `node_modules/@c4a/extract-ts/README.md`
68
+ - Go:
69
+ `node_modules/@c4a/extract-go/README.md`
70
+ - Rush:
71
+ `node_modules/@c4a/extract-rush/README.md`
72
+
73
+ If an optional package is not installed, use this capability matrix to decide
74
+ whether it is relevant, add only that dependency, and then read its shipped
75
+ README before implementing the callback.
76
+
77
+ A project-owned adapter may use an existing parser, compiler API, or command
78
+ whose output is deterministic. It must return source-backed candidates through
79
+ `extractCustom()`; it must not write lifecycle, knowledge, or Review files.
80
+ Framework-specific classification and rendering remain in the project. The CLI
81
+ and structural parser must not infer product meaning.
82
+
83
+ ## Decision To Report
84
+
85
+ Before the first extraction preview, state briefly:
86
+
87
+ - the inspected module and manifest signals;
88
+ - the selected Context phase or structural package;
89
+ - whether coverage is complete or which facts remain project-owned; and
90
+ - why another available extractor is not needed.
91
+
92
+ If no current capability can parse the source reliably, stop at configuration
93
+ and report the missing generic capability. Do not silently emit an empty
94
+ codegraph or reuse an unrelated parser.
@@ -37,6 +37,10 @@ kbPackage({
37
37
  foldDirectoryIndexes: true,
38
38
  maxInlineEntries: 50,
39
39
  },
40
+ assets: {
41
+ delivery: "git-raw",
42
+ urlPrefix: "https://code.example.com/team/knowledge/raw/{commit}",
43
+ },
40
44
  });
41
45
  ```
42
46
 
@@ -58,8 +62,56 @@ llmsPackage({
58
62
  | `template` | yes | Project-relative template directory or `{ path, vars }`. |
59
63
  | `select` | no | Approved knowledge selector. Omit to include all approved knowledge. Supports internal `collections`, OKF `okfRoots`, and `include` / `exclude` path patterns relative to `knowledge/`. |
60
64
  | `navigation` | no | KB directory-index policy. Defaults to `{ foldDirectoryIndexes: true, maxInlineEntries: 50 }`. |
65
+ | `assets` | no | Resource delivery: Git raw links, bundled files, or explicit omission. New KB setup should offer Git raw first. Omit for legacy byte-for-byte bundling. |
61
66
  | `distribution` | no | Legacy input accepted from older workspaces. It no longer changes package paths and should not be added to new declarations. |
62
67
 
68
+ Use Git raw delivery when resources are published from a Git repository.
69
+ Without `urlPrefix`, the Context workspace must be inside Git; GitHub remotes
70
+ are derived automatically and pinned to the current commit. Other hosts and
71
+ workspaces outside Git accept an explicit HTTPS prefix; Context appends the
72
+ project-relative `knowledge/assets/...` path. Context does not check whether
73
+ the resources are committed, pushed, or remotely readable; publishing them is
74
+ the package author's responsibility.
75
+ `{commit}` is replaced when present. A literal branch in the prefix is allowed
76
+ but intentionally follows that mutable branch. The configured raw host must be
77
+ reachable by the eventual package consumers.
78
+
79
+ ```ts
80
+ assets: {
81
+ delivery: "git-raw",
82
+ urlPrefix: "https://code.example.com/team/knowledge/raw/{commit}",
83
+ }
84
+ ```
85
+
86
+ When the workspace is not in Git and has no explicit raw prefix, choose bundled
87
+ delivery or explicit omission:
88
+
89
+ ```ts
90
+ assets: { delivery: "bundle" }
91
+ assets: { delivery: "omit" } // keeps unresolved links and reports them
92
+ ```
93
+
94
+ Bundled resources are copied byte-for-byte unless image optimization is
95
+ configured. When optimizable PNG/JPEG resources exceed 20 MiB, build and status
96
+ return `package.assets.optimization-recommended`. To optimize bundled output:
97
+
98
+ ```bash
99
+ bun add -D sharp
100
+ ```
101
+
102
+ ```ts
103
+ assets: {
104
+ delivery: "bundle",
105
+ optimize: { processor: "sharp", mode: "lossless-webp" },
106
+ }
107
+ ```
108
+
109
+ `optimize.mode: "webp"` additionally accepts `quality` from 1 to 100. Both modes accept
110
+ an optional positive `maxDimension`; images are never enlarged. Context adopts
111
+ a generated image only when it is smaller, uses a digest-derived `.webp` path,
112
+ and rewrites package links. A configured but missing processor blocks before
113
+ the previous `dist/` package is replaced.
114
+
63
115
  `template` is required. Do not call `kbPackage({ name })` or
64
116
  `llmsPackage({ name })`.
65
117
 
@@ -745,6 +745,41 @@ Review summary and source-backed evidence). It must not write `knowledge/`,
745
745
  Review snapshots directly. Context owns those files and preserves rejected and
746
746
  unchanged-approved decisions across reruns.
747
747
 
748
+ #### Optional structural extractors
749
+
750
+ For the manifest-to-capability decision and unsupported-language extension
751
+ boundary, read [Code Extractor Selection](./code-extractors.md) before declaring
752
+ the phase.
753
+
754
+ `extractCustom()` may consume optional community packages without making them
755
+ Context CLI dependencies:
756
+
757
+ ```ts
758
+ import { indexGoRepository } from "@c4a/extract-go";
759
+ import { extractCustom } from "@c4a/context";
760
+
761
+ extractCustom({
762
+ id: "extract:service:codegraph",
763
+ sources: [service],
764
+ collection: "codegraph",
765
+ extract: async ({ projectRoot }) => {
766
+ const facts = await indexGoRepository(resolveServiceCheckout(projectRoot));
767
+ return { candidates: buildServiceCandidates(facts) };
768
+ },
769
+ });
770
+ ```
771
+
772
+ Available structural libraries include:
773
+
774
+ - `@c4a/extract-go`: Go declarations, imports, calls, and common HTTP routes;
775
+ - `@c4a/extract-rush`: Rush projects, tags, entries, dependencies, and owners;
776
+ - `@c4a/extract-ts`: TypeScript extraction and `extractReactRouterRoutes()`.
777
+
778
+ The packages return syntax and repository facts only. They do not classify
779
+ product meaning, choose candidate identities, or write lifecycle state. The
780
+ knowledge project owns that mapping. Context CLI does not auto-install these
781
+ packages and does not expose a built-in Go or Rush phase.
782
+
748
783
  ### `reviewValidity`
749
784
 
750
785
  Declare the review step for a collection:
@@ -10,6 +10,14 @@ Code extraction operates on user-confirmed repository modules and source
10
10
  patterns. A source registration identifies the repository or module; the
11
11
  extraction declaration defines the code scope inside it.
12
12
 
13
+ Before declaring a phase, run the extraction-scope Gate's inspection Action for
14
+ every confirmed module. Read all reported `manifests`, including mixed-module
15
+ signals, then use the route-selected Code Extractor Selection manual to choose
16
+ `extractTs`, an optional structural package inside `extractCustom`, or a
17
+ project-owned adapter. Read the selected package's public SDK/README before
18
+ editing `src/index.ts`; never infer its API from bundled output. Do not silently
19
+ substitute the TypeScript extractor for Go, Rust, or another unsupported source.
20
+
13
21
  `include` filters files inside a selected source; it is not a package/module
14
22
  selector. Use source declarations to select repository modules. Use configured
15
23
  entry patterns when entry-led traversal is meaningful, or scan mode when the
@@ -48,3 +56,18 @@ declared `extractCustom` phase. The project-owned callback returns candidate
48
56
  semantics plus structured source evidence; Context owns canonical refs,
49
57
  fingerprints, candidate storage, Review snapshots, freshness, and rerun cleanup.
50
58
  Do not use a generic `customPhase` callback to write lifecycle files directly.
59
+
60
+ Prefer a reusable structural library over a project-local parser when one
61
+ matches the confirmed source: `@c4a/extract-go` for Go facts,
62
+ `@c4a/extract-rush` for Rush workspace facts, and
63
+ `extractReactRouterRoutes()` from `@c4a/extract-ts` for React Router facts.
64
+ These are optional project dependencies consumed inside `extractCustom()`;
65
+ they are not built-in CLI phases. Keep product-specific classification and
66
+ candidate rendering in the project, and do not ask the CLI or parser to infer
67
+ business meaning.
68
+
69
+ For Rust, Python, Java/JVM, or another source without a matching reusable
70
+ extractor, keep the lifecycle in `extractCustom()` and implement only the
71
+ missing project adapter. If reliable syntax facts cannot be produced, stop at
72
+ configuration and report the generic capability gap rather than emitting an
73
+ empty or guessed graph.