@c4a/context-cli 0.7.0 → 0.7.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.
Files changed (219) hide show
  1. package/README.md +18 -39
  2. package/README.zh-CN.md +13 -27
  3. package/cli.js +59230 -80555
  4. package/indexers/bundles/context-code-indexer/SKILL.md +30 -3
  5. package/indexers/bundles/context-code-indexer/context-indexer.yaml +3 -8
  6. package/indexers/bundles/context-code-indexer/references/indexer.md +110 -7
  7. package/indexers/bundles/context-code-indexer/references/metrics.md +143 -37
  8. package/indexers/bundles/context-code-indexer/templates/adapter-integration.md +2 -2
  9. package/indexers/bundles/context-code-indexer/templates/component-library.md +8 -0
  10. package/indexers/bundles/context-code-indexer/templates/gateway-facade.md +16 -0
  11. package/indexers/bundles/context-markdown-indexer/SKILL.md +13 -3
  12. package/indexers/bundles/context-markdown-indexer/context-indexer.yaml +20 -7
  13. package/indexers/bundles/context-markdown-indexer/references/indexer.md +33 -4
  14. package/indexers/bundles/context-markdown-indexer/references/semantic-planning.md +30 -14
  15. package/indexers/bundles/context-markdown-indexer/references/structure-and-artifacts.md +6 -0
  16. package/indexers/bundles/context-markdown-indexer/tests/fixtures/anonymous.json +1 -1
  17. package/indexers/bundles/context-markdown-indexer/tests/fixtures/profiles.json +13 -13
  18. package/indexers/bundles/context-markdown-indexer/tests/fixtures/routing.json +122 -0
  19. package/indexers/contracts/operator-contract.json +2 -2
  20. package/indexers/contracts/profile-contract.json +3819 -454
  21. package/indexers/release-manifest.json +22 -22
  22. package/package.json +13 -3
  23. package/plugins/VERSION +1 -1
  24. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  25. package/plugins/claude/commands/context.md +44 -85
  26. package/plugins/codex/.codex-plugin/plugin.json +2 -2
  27. package/plugins/codex/skills/context/SKILL.md +44 -85
  28. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  29. package/plugins/cursor/commands/c4a-context.md +44 -85
  30. package/plugins/skills/context/SKILL.md +44 -85
  31. package/plugins/skills/context-code-indexer/SKILL.md +30 -3
  32. package/plugins/skills/context-code-indexer/context-indexer.yaml +3 -8
  33. package/plugins/skills/context-code-indexer/references/indexer.md +110 -7
  34. package/plugins/skills/context-code-indexer/references/metrics.md +143 -37
  35. package/plugins/skills/context-code-indexer/templates/adapter-integration.md +2 -2
  36. package/plugins/skills/context-code-indexer/templates/component-library.md +8 -0
  37. package/plugins/skills/context-code-indexer/templates/gateway-facade.md +16 -0
  38. package/plugins/skills/context-markdown-indexer/SKILL.md +13 -3
  39. package/plugins/skills/context-markdown-indexer/context-indexer.yaml +20 -7
  40. package/plugins/skills/context-markdown-indexer/references/indexer.md +33 -4
  41. package/plugins/skills/context-markdown-indexer/references/semantic-planning.md +30 -14
  42. package/plugins/skills/context-markdown-indexer/references/structure-and-artifacts.md +6 -0
  43. package/plugins/skills/context-markdown-indexer/tests/fixtures/anonymous.json +1 -1
  44. package/plugins/skills/context-markdown-indexer/tests/fixtures/profiles.json +13 -13
  45. package/plugins/skills/context-markdown-indexer/tests/fixtures/routing.json +122 -0
  46. package/providers/context/actions/advance-current-indexer-lifecycle.yaml +6 -0
  47. package/providers/context/actions/configure-indexer-providers.yaml +1 -1
  48. package/providers/context/actions/materialize-indexer-workset-view.yaml +7 -0
  49. package/providers/context/actions/run-indexer-lifecycle.yaml +7 -0
  50. package/providers/context/actions/run-indexer-post-author-composer.yaml +1 -1
  51. package/providers/context/codes.yaml +9 -49
  52. package/providers/context/graphs/indexer.yaml +75 -592
  53. package/providers/context/graphs/workspace.yaml +25 -500
  54. package/providers/context/manifest.json +110 -1199
  55. package/providers/context/provider.yaml +2 -2
  56. package/providers/context/resources/diagnostics/projection-stale.md +0 -1
  57. package/providers/context/resources/dialogue/human-gates.md +3 -3
  58. package/providers/context/resources/manuals/reference/package-templates.md +2 -3
  59. package/providers/context/resources/manuals/reference/project-api.md +52 -985
  60. package/providers/context/resources/procedures/close-and-build.md +8 -23
  61. package/providers/context/resources/procedures/knowledge-review.md +13 -4
  62. package/providers/context/resources/procedures/source-capture-detailed.md +6 -8
  63. package/providers/context/resources/views/authorized-indexer-workset-view.yaml +15 -0
  64. package/providers/context/resources/views/package-current.yaml +1 -1
  65. package/providers/context/resources/views/resolved-indexer-instructions.yaml +1 -1
  66. package/providers/context/resources/views/review-current.yaml +1 -1
  67. package/providers/context/resources/views/source-boundary.yaml +1 -1
  68. package/providers/context/resources/views/source-current.yaml +1 -1
  69. package/providers/context/resources/views/verification-current.yaml +1 -1
  70. package/providers/context/resources/views/workspace-current.yaml +1 -1
  71. package/providers/context/schemas/indexer-agent-step-input.schema.json +2 -2
  72. package/providers/context/schemas/indexer-agent-step-result.schema.json +298 -32
  73. package/providers/context/schemas/indexer-authorized-workset-view.schema.json +65 -0
  74. package/providers/context/schemas/indexer-contract-overlay-validation-input.schema.json +0 -42
  75. package/providers/context/schemas/indexer-contract-overlay-validation-result.schema.json +27 -122
  76. package/providers/context/schemas/indexer-lifecycle-continuation.schema.json +15 -0
  77. package/providers/context/schemas/indexer-main-lifecycle-input.schema.json +13 -20
  78. package/providers/context/schemas/indexer-main-lifecycle-output.schema.json +17 -2
  79. package/providers/context/schemas/indexer-materialized-resource.schema.json +8 -1
  80. package/providers/context/schemas/indexer-overlay-question-proposal-input.schema.json +55 -6
  81. package/providers/context/schemas/indexer-overlay-question-rebind-input.schema.json +4 -4
  82. package/providers/context/schemas/indexer-workset-view-materialization-request.schema.json +32 -0
  83. package/providers/context/skills/configure-indexer-providers/SKILL.md +40 -27
  84. package/providers/context/skills/run-indexer-agent-step/SKILL.md +34 -8
  85. package/providers/context/skills/run-indexer-lifecycle/SKILL.md +37 -0
  86. package/providers/context/skills/run-indexer-post-author-composer/SKILL.md +38 -9
  87. package/docs/document-optimization.md +0 -82
  88. package/docs/document-optimization.zh-CN.md +0 -70
  89. package/indexers/capability-manifest.json +0 -40
  90. package/indexers/contracts/hard-rule-conformance.json +0 -2644
  91. package/providers/context/actions/accept-main-index-run.yaml +0 -7
  92. package/providers/context/actions/accept-material-answer-run.yaml +0 -7
  93. package/providers/context/actions/accept-post-author-composer-run.yaml +0 -7
  94. package/providers/context/actions/actualize-material-answer-bindings.yaml +0 -8
  95. package/providers/context/actions/align-next.yaml +0 -6
  96. package/providers/context/actions/apply-code-index-guidance.yaml +0 -5
  97. package/providers/context/actions/apply-document-optimization-guidance.yaml +0 -5
  98. package/providers/context/actions/apply-structure-confirmation.yaml +0 -5
  99. package/providers/context/actions/audit-material-gap-state.yaml +0 -8
  100. package/providers/context/actions/audit-projected-artifact-fan-out.yaml +0 -8
  101. package/providers/context/actions/authorize-indexer-contract-overlay.yaml +0 -7
  102. package/providers/context/actions/build-main-index-author-worksets.yaml +0 -7
  103. package/providers/context/actions/build-main-index-catalog-fallback.yaml +0 -7
  104. package/providers/context/actions/build-main-index-partition-worksets.yaml +0 -7
  105. package/providers/context/actions/build-material-question-workset.yaml +0 -7
  106. package/providers/context/actions/build-post-author-composer-worksets.yaml +0 -7
  107. package/providers/context/actions/build-question-target-inventory.yaml +0 -7
  108. package/providers/context/actions/build-subject-catalog.yaml +0 -7
  109. package/providers/context/actions/build-target-resolution-views.yaml +0 -7
  110. package/providers/context/actions/checkpoint-material-answer-review.yaml +0 -8
  111. package/providers/context/actions/checkpoint-material-gaps.yaml +0 -8
  112. package/providers/context/actions/close-indexer-approved-knowledge.yaml +0 -8
  113. package/providers/context/actions/compile-next.yaml +0 -5
  114. package/providers/context/actions/compose-indexer-post-author-fragments.yaml +0 -7
  115. package/providers/context/actions/configure-code-extraction.yaml +0 -5
  116. package/providers/context/actions/configure-prose-lifecycle.yaml +0 -5
  117. package/providers/context/actions/converge-main-index-partition-run.yaml +0 -7
  118. package/providers/context/actions/evaluate-material-gaps.yaml +0 -8
  119. package/providers/context/actions/extract-next.yaml +0 -5
  120. package/providers/context/actions/fail-main-index-run.yaml +0 -7
  121. package/providers/context/actions/fail-material-answer-run.yaml +0 -7
  122. package/providers/context/actions/fail-post-author-composer-run.yaml +0 -7
  123. package/providers/context/actions/inspect-code-extraction.yaml +0 -5
  124. package/providers/context/actions/inspect-document-classification.yaml +0 -5
  125. package/providers/context/actions/inspect-index-candidate-review-readiness.yaml +0 -8
  126. package/providers/context/actions/inspect-index-profile-failure.yaml +0 -7
  127. package/providers/context/actions/inspect-material-answer-review.yaml +0 -8
  128. package/providers/context/actions/inspect-structure.yaml +0 -5
  129. package/providers/context/actions/migrate-codeindex.yaml +0 -5
  130. package/providers/context/actions/observe-main-index-run-ledger.yaml +0 -7
  131. package/providers/context/actions/observe-material-answer-runs.yaml +0 -7
  132. package/providers/context/actions/observe-post-author-composer-worksets.yaml +0 -7
  133. package/providers/context/actions/optimize-documents.yaml +0 -6
  134. package/providers/context/actions/override-index-profile-audit.yaml +0 -7
  135. package/providers/context/actions/prepare-main-index-run-ledger.yaml +0 -7
  136. package/providers/context/actions/prepare-material-answer-runs.yaml +0 -7
  137. package/providers/context/actions/preview-extraction-batch.yaml +0 -5
  138. package/providers/context/actions/reconcile-indexer-results.yaml +0 -7
  139. package/providers/context/actions/reconcile-review-identities.yaml +0 -5
  140. package/providers/context/actions/record-index-profile-revision.yaml +0 -7
  141. package/providers/context/actions/report-index-profile-failure.yaml +0 -7
  142. package/providers/context/actions/resolve-effective-composers.yaml +0 -7
  143. package/providers/context/actions/review-material-answer-candidate.yaml +0 -8
  144. package/providers/context/actions/revise-code-index-audit.yaml +0 -5
  145. package/providers/context/actions/revise-document.yaml +0 -5
  146. package/providers/context/actions/revise-index-output.yaml +0 -7
  147. package/providers/context/actions/run-material-answer-indexers.yaml +0 -7
  148. package/providers/context/actions/start-main-index-run.yaml +0 -7
  149. package/providers/context/actions/start-material-answer-run.yaml +0 -7
  150. package/providers/context/actions/start-post-author-composer-run.yaml +0 -7
  151. package/providers/context/actions/submit-code-index-audit.yaml +0 -6
  152. package/providers/context/resources/dialogue/code-extraction.md +0 -87
  153. package/providers/context/resources/dialogue/document-classification.md +0 -33
  154. package/providers/context/resources/dialogue/structure-confirmation.md +0 -44
  155. package/providers/context/resources/dialogue/workflow-mode-after-capture.md +0 -25
  156. package/providers/context/resources/manuals/reference/code-extractors.md +0 -152
  157. package/providers/context/resources/procedures/code-extraction.md +0 -188
  158. package/providers/context/resources/procedures/code-index-audit.md +0 -113
  159. package/providers/context/resources/procedures/document-classification.md +0 -22
  160. package/providers/context/resources/procedures/document-optimization.md +0 -110
  161. package/providers/context/resources/procedures/document-revision.md +0 -36
  162. package/providers/context/resources/procedures/prose-align.md +0 -68
  163. package/providers/context/resources/procedures/prose-compile.md +0 -23
  164. package/providers/context/resources/semantic/align/candidate-resolution.md +0 -106
  165. package/providers/context/resources/semantic/align/density-profile.md +0 -41
  166. package/providers/context/resources/semantic/align/gates.md +0 -276
  167. package/providers/context/resources/semantic/align/structure-planning.md +0 -337
  168. package/providers/context/resources/semantic/code-index/classification.md +0 -270
  169. package/providers/context/resources/semantic/code-index/templates/adapter.md +0 -118
  170. package/providers/context/resources/semantic/code-index/templates/api-service.md +0 -116
  171. package/providers/context/resources/semantic/code-index/templates/background-runtime.md +0 -109
  172. package/providers/context/resources/semantic/code-index/templates/cli-tool.md +0 -129
  173. package/providers/context/resources/semantic/code-index/templates/contract-source.md +0 -73
  174. package/providers/context/resources/semantic/code-index/templates/contracts-and-chains.md +0 -81
  175. package/providers/context/resources/semantic/code-index/templates/cross-module-chain.md +0 -78
  176. package/providers/context/resources/semantic/code-index/templates/derived-source.md +0 -116
  177. package/providers/context/resources/semantic/code-index/templates/domain-service.md +0 -109
  178. package/providers/context/resources/semantic/code-index/templates/event-flow.md +0 -62
  179. package/providers/context/resources/semantic/code-index/templates/monorepo-container.md +0 -124
  180. package/providers/context/resources/semantic/code-index/templates/persistence-boundary.md +0 -56
  181. package/providers/context/resources/semantic/code-index/templates/plugin-extension.md +0 -52
  182. package/providers/context/resources/semantic/code-index/templates/protocol-boundary.md +0 -88
  183. package/providers/context/resources/semantic/code-index/templates/sdk-library.md +0 -132
  184. package/providers/context/resources/semantic/code-index/templates/web-application.md +0 -145
  185. package/providers/context/resources/semantic/compile/index.md +0 -31
  186. package/providers/context/resources/views/code-index-audit.yaml +0 -6
  187. package/providers/context/resources/views/document-optimization-current.yaml +0 -6
  188. package/providers/context/resources/views/extraction-preview.yaml +0 -6
  189. package/providers/context/resources/views/structure-current.yaml +0 -6
  190. package/providers/context/schemas/code-index-audit-decision.schema.json +0 -94
  191. package/providers/context/schemas/document-optimization-decisions.schema.json +0 -57
  192. package/providers/context/schemas/indexer-candidate-review-readiness-input.schema.json +0 -46
  193. package/providers/context/schemas/indexer-candidate-review-readiness-output.schema.json +0 -104
  194. package/providers/context/schemas/indexer-contract-overlay-authorization-input.schema.json +0 -32
  195. package/providers/context/schemas/indexer-contract-overlay-authorization-result.schema.json +0 -121
  196. package/providers/context/schemas/indexer-material-answer-lifecycle-input.schema.json +0 -90
  197. package/providers/context/schemas/indexer-material-answer-lifecycle-output.schema.json +0 -80
  198. package/providers/context/schemas/indexer-material-answer-review-inspection-input.schema.json +0 -32
  199. package/providers/context/schemas/indexer-material-answer-review-inspection-output.schema.json +0 -32
  200. package/providers/context/schemas/indexer-material-answer-review-resolution-input.schema.json +0 -19
  201. package/providers/context/schemas/indexer-material-answer-review-resolution-output.schema.json +0 -87
  202. package/providers/context/schemas/indexer-material-gap-lifecycle-input.schema.json +0 -86
  203. package/providers/context/schemas/indexer-material-gap-lifecycle-output.schema.json +0 -19
  204. package/providers/context/schemas/indexer-post-author-fragment-result.schema.json +0 -18
  205. package/providers/context/schemas/indexer-post-author-lifecycle-input.schema.json +0 -94
  206. package/providers/context/schemas/indexer-post-author-lifecycle-output.schema.json +0 -72
  207. package/providers/context/schemas/indexer-profile-failure-inspection-input.schema.json +0 -13
  208. package/providers/context/schemas/indexer-profile-failure-inspection-result.schema.json +0 -19
  209. package/providers/context/schemas/indexer-profile-failure-report-input.schema.json +0 -22
  210. package/providers/context/schemas/indexer-profile-failure-report-result.schema.json +0 -49
  211. package/providers/context/schemas/indexer-profile-override-decision.schema.json +0 -20
  212. package/providers/context/schemas/indexer-profile-override-result.schema.json +0 -49
  213. package/providers/context/schemas/indexer-profile-revision-agent-input.schema.json +0 -18
  214. package/providers/context/schemas/indexer-profile-revision-record-input.schema.json +0 -31
  215. package/providers/context/schemas/indexer-profile-revision-record-result.schema.json +0 -45
  216. package/providers/context/schemas/indexer-result-reconciliation-input.schema.json +0 -59
  217. package/providers/context/schemas/indexer-result-reconciliation-output.schema.json +0 -43
  218. package/providers/context/schemas/prose-structure-batch.schema.json +0 -35
  219. package/providers/context/skills/revise-index-output/SKILL.md +0 -12
@@ -1,270 +0,0 @@
1
- ---
2
- id: semantic.code-index.classification
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Classify code modules before choosing a template
8
-
9
- This procedure is the first semantic step for code extraction. Start from the
10
- Route-selected batch inspection. Do not open an archetype template and then fit
11
- the module to it. First classify every confirmed module from inspected evidence,
12
- then read only the matching templates.
13
-
14
- Classification determines which reader questions the index must answer. It
15
- does not grant access to undeclared sources, prove a relationship, or override
16
- the measured extraction preview.
17
-
18
- ## 1. Use one batch evidence pass
19
-
20
- Use the inspection result for every confirmed module before opening more files.
21
- It already reports manifests, maintained documentation, entry candidates,
22
- protocol locators, lifecycle signals, and generic structural capabilities.
23
- Open source files only for unresolved facts, and follow stable registration or
24
- executable wiring rather than scanning the whole tree.
25
-
26
- Confirm, where applicable:
27
-
28
- - the module manifest or workspace registration;
29
- - its README or nearest maintained operating documentation;
30
- - build, executable, application, service, or library entrypoints;
31
- - route, command, service, event, job, plugin, or export registries;
32
- - authoritative protocol/schema locations and concrete consumer call sites;
33
- - generated, mirrored, vendored, legacy, test, fixture, and mock boundaries;
34
- - development, configuration, deployment, and release entrypoints owned by the
35
- module.
36
-
37
- A language, framework dependency, exported symbol, or folder name does not by
38
- itself prove a module type.
39
-
40
- ## 2. Record classification before reading templates
41
-
42
- Produce one batch table first:
43
-
44
- | module | primary type | additional types | facets | evidence paths | gaps |
45
- | --- | --- | --- | --- | --- | --- |
46
- | `customer-portal` | `web-application` | — | `page-routing`, `protocol-consumer` | `package.json`, `src/routes.ts` | upstream schema is external |
47
- | `edge-gateway` | `api-service` | `adapter` | `protocol-provider`, `protocol-consumer` | `cmd/server.go`, `api/openapi.yaml` | — |
48
-
49
- Each module must have:
50
-
51
- - one primary `moduleType` for concise reports;
52
- - every additional applicable type in `moduleTypes`;
53
- - relevant behavior and boundary `facets`;
54
- - concrete inspected paths in `moduleTypeEvidence`;
55
- - exact source-relative Markdown paths already read in `documents`;
56
- - an explicit gap when available source cannot support a reliable claim.
57
-
58
- Choose the primary type from the boundary through which a reader most often
59
- enters the module. A gateway is normally `api-service`, a plugin-hosting command
60
- application is normally `cli-tool`, and a generated client is normally
61
- `sdk-library`; their translation or provenance roles remain additional types.
62
-
63
- Supported types are:
64
-
65
- - `web-application`: browser, native mobile, desktop, embedded, or cross-platform
66
- interactive applications with routes, pages, screens, or host integration;
67
- - `api-service`: an HTTP, RPC, GraphQL, message-request, or similar inbound
68
- protocol surface with dispatch to handlers;
69
- - `service`: a stable domain/use-case or reusable service boundary whose public
70
- operations coordinate implementation or persistence;
71
- - `background-runtime`: workers, consumers, schedulers, pipelines, functions,
72
- or long-running processes driven by triggers rather than interactive calls;
73
- - `sdk-library`: a reusable package with a deliberately supported consumer API;
74
- - `cli-tool`: an executable tool organized around commands, flags,
75
- configuration, outputs, and exit behavior;
76
- - `adapter`: a bridge that translates protocols, identities, models, lifecycle,
77
- or host capabilities between boundaries;
78
- - `monorepo-container`: a workspace whose stable value is its child-module,
79
- ownership, dependency, build, or release topology;
80
- - `derived-source`: generated, mirrored, vendored, or legacy source whose
81
- authority lives elsewhere;
82
- - `contract-source`: an authoritative IDL, API description, schema, or contract
83
- registry used by providers, consumers, generators, or validators;
84
- - `unknown`: the source is insufficient to classify without guessing.
85
-
86
- `unknown` cannot be combined with a known type. A hybrid module may combine
87
- several known types. Independent infrastructure definitions, migration sets,
88
- or data-model projects that do not fit a supported type remain `unknown` and
89
- use a project-owned inspection/extraction adapter; do not force them into an
90
- unrelated application type.
91
-
92
- ## 3. Add composable facets
93
-
94
- Facets identify behavior that may cross the primary type:
95
-
96
- - `page-routing`: concrete route, page, screen, or navigation registration;
97
- - `public-api`: a deliberately supported programmatic consumer surface;
98
- - `protocol-provider` / `protocol-consumer`: inbound or outbound operation
99
- boundaries with authoritative locators;
100
- - `event-producer` / `event-consumer`: asynchronous trigger and delivery flow;
101
- - `persistence`: repository, datastore, cache, or durable-state boundary;
102
- - `plugin-extension`: discovery, activation, contribution, or host extension;
103
- - `configuration-runtime`: configuration or runtime selection that changes
104
- observable behavior;
105
- - `build-release`: module-owned build, packaging, deployment, or release entry;
106
- - `cross-module-chain`: an evidenced flow joins two or more registered modules;
107
- - `generated-contract`: generated code represents or locates an upstream
108
- schema but is not automatically authoritative.
109
-
110
- Require a registration, call site, schema locator, or runtime entry. A matching
111
- dependency alone is not evidence.
112
-
113
- ## 4. Read matching templates
114
-
115
- After the batch table is complete, read every applicable type template and only
116
- the applicable facet template:
117
-
118
- | Type or facet | Template path |
119
- | --- | --- |
120
- | `web-application` | `resources/semantic/code-index/templates/web-application.md` |
121
- | `api-service` | `resources/semantic/code-index/templates/api-service.md` |
122
- | `service` | `resources/semantic/code-index/templates/domain-service.md` |
123
- | `background-runtime` | `resources/semantic/code-index/templates/background-runtime.md` |
124
- | `sdk-library` | `resources/semantic/code-index/templates/sdk-library.md` |
125
- | `cli-tool` | `resources/semantic/code-index/templates/cli-tool.md` |
126
- | `adapter` | `resources/semantic/code-index/templates/adapter.md` |
127
- | `monorepo-container` | `resources/semantic/code-index/templates/monorepo-container.md` |
128
- | `derived-source` | `resources/semantic/code-index/templates/derived-source.md` |
129
- | `contract-source` | `resources/semantic/code-index/templates/contract-source.md` |
130
- | `protocol-provider`, `protocol-consumer`, `generated-contract` | `resources/semantic/code-index/templates/protocol-boundary.md` |
131
- | `event-producer`, `event-consumer` | `resources/semantic/code-index/templates/event-flow.md` |
132
- | `persistence` | `resources/semantic/code-index/templates/persistence-boundary.md` |
133
- | `plugin-extension` | `resources/semantic/code-index/templates/plugin-extension.md` |
134
- | `cross-module-chain` | `resources/semantic/code-index/templates/cross-module-chain.md` |
135
-
136
- `page-routing` and `public-api` refine their matching application or library
137
- template. `configuration-runtime` and `build-release` add chapter expectations
138
- to the selected type template. They do not require duplicate pages.
139
-
140
- Templates are question sets and chapter blueprints. Omit unsupported sections,
141
- merge overlapping output, and retain concrete identifiers and source locators
142
- for every kept claim.
143
-
144
- ## 5. Match the plan to the extractor
145
-
146
- Extractor shape is part of the plan, not an implementation detail:
147
-
148
- - `extractTs()` projects each selected symbol to its own candidate page. It is
149
- suitable for a deliberately granular public reference, but it does not
150
- produce an aggregated module map, registry, protocol index, or chain page.
151
- - `extractTs()` assigns ownership by source. A source can belong to only one
152
- index unit in a phase. Splitting one source into several units or adding an
153
- overlapping cross-source unit causes `ownership-ambiguous`.
154
- - Use `extractCustom()` for aggregate pages or multiple units over one source.
155
- Every candidate must declare its owning `module`, and its evidence must cover
156
- the Route-reported structural probes. The custom-candidate contract has no
157
- page-level Markdown fallback: every candidate must provide at least one
158
- evidence-scoped `section`, and each section declares a coverage kind and the
159
- exact source evidence supporting that part of the page. Resolve source roots
160
- from the extractor context's `sources[].absolutePath`; never embed a
161
- machine-specific checkout path.
162
- - Register independently visible monorepo children as separate sources before
163
- giving them separate `extractTs()` units. An `include` pattern filters files;
164
- it does not create a source boundary.
165
-
166
- Do not wait for an expensive preview to discover that the chosen extractor
167
- cannot produce the planned page shape.
168
-
169
- ## 6. Produce one deduplicated plan
170
-
171
- Create one `CodeIndexUnitPlan` per user-visible module or independently useful
172
- custom cross-module flow. A minimal plan has this shape:
173
-
174
- ```ts
175
- {
176
- module: "customer-portal",
177
- moduleType: "web-application",
178
- moduleTypes: ["web-application"],
179
- facets: ["page-routing", "protocol-consumer"],
180
- moduleTypeEvidence: ["package.json", "src/routes.ts"],
181
- documents: ["README.md", "docs/architecture.md"],
182
- outputOwner: "customer-portal",
183
- outputProfile: "application-map",
184
- inputSources: ["repo:customer-portal"],
185
- entries: ["src/bootstrap.ts", "src/routes.ts"],
186
- protocols: ["api/openapi.yaml"],
187
- excludes: ["dist/**", "**/*.test.ts"],
188
- lifecycle: "source",
189
- pageKinds: ["application-map", "route-registry", "protocol-boundary"],
190
- capability: "complete"
191
- }
192
- ```
193
-
194
- `outputProfile` is a closed value and selects structural coverage expectations:
195
-
196
- | Profile | Intended output |
197
- | --- | --- |
198
- | `module-map` | stable module responsibility and entry map |
199
- | `application-map` | application entry, route, state, and boundary map |
200
- | `protocol-index` | provider/consumer operations anchored to contracts |
201
- | `service-boundary` | service operations, orchestration, and dependencies |
202
- | `runtime-map` | triggers, processing, state, effects, and recovery |
203
- | `public-api-reference` | deliberately supported consumer API |
204
- | `command-map` | commands, options, effects, outputs, and recovery |
205
- | `adapter-contract` | inbound-to-outbound translation contract |
206
- | `module-registry` | workspace child modules, ownership, and topology |
207
- | `cross-module-flow` | evidenced handoffs across registered modules |
208
- | `provenance-only` | source identity, derivation, consumers, and authority |
209
-
210
- The preview also requires these evidence-scoped section kinds:
211
-
212
- | Profile | Required section coverage |
213
- | --- | --- |
214
- | `module-map` | `responsibility`, `entrypoint` |
215
- | `application-map` | `entrypoint`, `operation`, `handoff` |
216
- | `protocol-index` | `contract`, `operation`, `handoff` |
217
- | `service-boundary` | `operation`, `handoff` |
218
- | `runtime-map` | `entrypoint`, `operation`, `failure-recovery` |
219
- | `public-api-reference` | `contract` |
220
- | `adapter-contract` | `contract`, `handoff` |
221
- | `command-map` | `entrypoint`, `operation`, `failure-recovery` |
222
- | `module-registry` | `responsibility`, `source-authority` |
223
- | `cross-module-flow` | `operation`, `handoff`, plus at least one structured edge |
224
- | `provenance-only` | `source-authority` |
225
-
226
- The `build-release`, `persistence`, `configuration-runtime`, and
227
- `generated-contract` facets additionally require `delivery`, `state-boundary`,
228
- `state-boundary`, and `source-authority` respectively. A heading without an
229
- evidence-scoped section does not satisfy coverage.
230
-
231
- The profile affects structural probes and advisory risks. `pageKinds` remains
232
- free-form so projects can name useful page families, but use stable kebab-case
233
- tokens consistently within a project. Type templates provide recommended
234
- tokens.
235
-
236
- For a multi-module round, finish all classifications first, read the union of
237
- matching templates once, and revise affected plans together. Do not create a
238
- copy of the same operation or plugin record for each selected template.
239
-
240
- ## 7. Capability gaps and preview
241
-
242
- Use `capability: "material-required"` when an unsupported parser, missing
243
- project adapter, absent evidence, or unresolved source boundary prevents the
244
- promised output. This typed capability is valid in ordinary and fully managed
245
- flows and stops both at the same Route Gate.
246
-
247
- Missing authority does not always block all output. For generated or mirrored
248
- source whose upstream schema cannot be located, a `provenance-only` unit may
249
- still record source identity, known derivation facts, and evidenced consumers.
250
- Keep field semantics and compatibility claims material-required. Stop the
251
- whole unit only when those semantics are the confirmed knowledge goal.
252
-
253
- Run the Route-selected batch preview after every plan is evidence-backed. Its
254
- projected Markdown count is authoritative per index unit:
255
-
256
- - up to 100 pages: continue;
257
- - 101–300 pages: report an advisory and continue;
258
- - more than 300 pages: block and revise, including in fully managed mode.
259
-
260
- A large batch also reports a batch-total advisory even when each unit remains
261
- within its limit. Advisory risks describe quality or cost; they do not become a
262
- new human Gate. `scale-limit-exceeded`, `ownership-ambiguous`, and
263
- `material-required` capability gaps remain blocking.
264
-
265
- Legal recovery includes narrowing `include`, excluding generated or mirrored
266
- areas, using `exportedOnly`, changing a symbol catalog into an aggregated
267
- `extractCustom()` output, or registering real child sources. Splitting one
268
- `extractTs()` source into overlapping units is not a valid workaround. Group all
269
- affected modules into one plan revision instead of creating one Gate per
270
- module.
@@ -1,118 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.adapter
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Adapter, bridge, and integration template
8
-
9
- Use for `adapter`: BFFs, protocol bridges, host integrations, plugin adapters,
10
- compatibility layers, gateways, and translators whose stable responsibility is
11
- to connect two boundaries. An ordinary internal helper that converts one object
12
- is not automatically an adapter module.
13
-
14
- Recommended `outputProfile`: `adapter-contract`. For an inbound gateway whose
15
- reader goal is the provided operation surface, use `protocol-index` instead.
16
-
17
- ## Evidence pass
18
-
19
- Locate both sides of the boundary and the code that joins them:
20
-
21
- - inbound operation, event, command, host hook, or extension registration;
22
- - outbound operation, client, plugin contribution, or runtime capability;
23
- - authoritative input and output contract locations;
24
- - identity, field, enum, version, and lifecycle mappings;
25
- - authentication, authorization, credential, and context propagation;
26
- - validation, normalization, batching, caching, fallback, and compatibility;
27
- - timeout, retry, partial failure, and error/status translation;
28
- - configuration, feature selection, ownership, and release entrypoints;
29
- - generated DTOs/clients and converter helpers that should remain evidence.
30
-
31
- Sample representative paths from each mapping family. Do not claim a mapping
32
- from matching field names alone.
33
-
34
- ## Questions the knowledge must answer
35
-
36
- 1. Which two boundaries does the adapter connect, and who owns each one?
37
- 2. What triggers the mapping and where is it registered?
38
- 3. Which fields, identities, versions, or lifecycle states are transformed?
39
- 4. Which values pass through unchanged, default, or intentionally disappear?
40
- 5. How are credentials, context, errors, retries, and fallbacks translated?
41
- 6. Which contracts are authoritative and which artifacts are generated?
42
- 7. What compatibility obligation makes the adapter stable knowledge?
43
-
44
- ## Suggested knowledge units
45
-
46
- - **Adapter contract**: responsibility, inbound/outbound boundaries,
47
- registration, ownership, and authoritative contracts.
48
- - **Operation mapping registry**: use the canonical operation record from
49
- `protocol-boundary.md` and add only adapter-specific transformation fields.
50
- - **Data or identity mapping**: only stable, non-trivial mappings that readers
51
- must understand; summarize generated field copies.
52
- - **Lifecycle and failure translation**: when activation, cancellation,
53
- retries, partial failure, or compatibility behavior is material.
54
- - **Cross-module execution path**: when both connected modules are registered
55
- sources and the chain is source-backed.
56
-
57
- ## Chapter blueprints
58
-
59
- ```markdown
60
- # <Adapter> contract
61
- ## Responsibility and connected boundaries
62
- ## Activation or registration
63
- ## Inbound contracts
64
- ## Outbound contracts
65
- ## Data, identity, and lifecycle mapping
66
- ## Authentication and context propagation
67
- ## Error, retry, fallback, and compatibility behavior
68
- ## Configuration, ownership, and release
69
- ## Evidence and exclusions
70
- ```
71
-
72
- For adapter-specific detail attached to a canonical operation record:
73
-
74
- ```markdown
75
- ## Adapter transformation
76
- - Mapper/handler entry:
77
- - Field/identity/default transformations:
78
- - Context and credential propagation:
79
- - Error and fallback mapping:
80
- ```
81
-
82
- ## Granularity and relationships
83
-
84
- Group mappings that share the same boundary pair and transformation policy.
85
- Split when protocol authority, ownership, lifecycle, or failure semantics
86
- differ. Do not publish every DTO, converter, generated client, or transport
87
- helper separately.
88
-
89
- Add structured edges only for concrete registration and call paths. Keep a
90
- narrative locator when dynamic dispatch prevents an unambiguous edge.
91
-
92
- Return `identityGroups` when several target identities share one explained
93
- adapter responsibility. Return every source-backed adjacency in
94
- `chainCandidates`, then provide one `chainCandidateDecisions` record for each
95
- candidate. A documented decision names the reader-facing view and emits its
96
- structured edge; an equivalent candidate merges into that canonical candidate;
97
- false positives and missing external material use `exclude` or `request-input`
98
- with a concrete reason. Read `contracts-and-chains.md` for the complete generic
99
- contract.
100
-
101
- ## Template composition examples
102
-
103
- - An HTTP endpoint backed by an RPC client is `api-service` + `adapter`; combine
104
- one operation registry with one mapping contract rather than duplicating the
105
- route facts.
106
- - A host plugin bridge reads `plugin-extension.md` and may also be `sdk-library`
107
- when consumers import
108
- a supported extension API.
109
- - A compatibility wrapper over generated clients also reads
110
- `derived-source.md` and identifies the authoritative schemas.
111
-
112
- ## Revise or stop when
113
-
114
- - either side of the adapter cannot be identified;
115
- - mappings are inferred only from same-named types or fields;
116
- - credential, identity, or error behavior would be guessed;
117
- - generated DTOs are replacing authoritative contracts in the plan;
118
- - the adapter page would merely say that one module “calls” another.
@@ -1,116 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.api-service
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # API service and gateway template
8
-
9
- Use after classifying an inbound HTTP, RPC, GraphQL, message-request, or similar
10
- surface as `api-service`. A module that only calls a remote API is a protocol
11
- consumer, not automatically an API service. Gateways that translate to another
12
- protocol normally also select `adapter`.
13
-
14
- Recommended `outputProfile`: `protocol-index`. If the reader goal is primarily
15
- the transformation between inbound and outbound boundaries, use
16
- `adapter-contract` instead and retain one canonical operation registry.
17
-
18
- ## Evidence pass
19
-
20
- Locate and connect:
21
-
22
- - process/server entry and service startup;
23
- - route, method, resolver, or service registration;
24
- - middleware, authentication, authorization, validation, and request context;
25
- - handler dispatch and the first stable domain/downstream boundary;
26
- - authoritative IDL, OpenAPI, schema, service definition, or registration;
27
- - response/error mapping, retry, timeout, and compatibility behavior;
28
- - configuration, local run, test, deployment, and release entrypoints;
29
- - generated models or clients and their actual source of truth.
30
-
31
- Prefer explicit registrations over handler filenames. Sample enough operations
32
- from each registration family to verify that the proposed aggregation is real.
33
-
34
- ## Questions the knowledge must answer
35
-
36
- 1. What protocol does the module provide, and where is it registered?
37
- 2. Which operations are stable and who handles each one?
38
- 3. What authentication, validation, middleware, or request context applies?
39
- 4. Where does each operation hand off to domain logic or a downstream system?
40
- 5. How are successful responses and failures translated?
41
- 6. Which schema is authoritative, and which files are generated projections?
42
- 7. How is the service run, configured, observed, and released?
43
-
44
- ## Suggested knowledge units
45
-
46
- - **Service boundary**: responsibility, startup, supported protocols,
47
- middleware order, downstream systems, and ownership.
48
- - **Operation registry**: use the canonical operation record from
49
- `protocol-boundary.md`, adding handler and middleware detail from this
50
- template rather than creating a second registry.
51
- - **Dispatch and dependency map**: route/service registration to handler to
52
- domain/RPC/repository boundary, grouped by coherent operation family.
53
- - **Error and compatibility contract**: only when status/error mapping,
54
- versioning, fallback, or compatibility is stable and source-backed.
55
- - **Runtime and delivery guide**: configuration, startup, diagnostics,
56
- deployment, and release entrypoints owned by this service.
57
-
58
- Do not create a page per generated request/response model, constant, converter,
59
- pack/unpack helper, or handler-local function.
60
-
61
- ## Chapter blueprints
62
-
63
- A service-boundary page may use:
64
-
65
- ```markdown
66
- # <Service> boundary
67
- ## Responsibility and consumers
68
- ## Startup and protocol registration
69
- ## Middleware and request lifecycle
70
- ## Operation families
71
- ## Domain and downstream dependencies
72
- ## Error, timeout, and compatibility behavior
73
- ## Configuration, observability, and release
74
- ## Exclusions and authoritative schemas
75
- ```
76
-
77
- A focused execution-path page may use:
78
-
79
- ```markdown
80
- # <Operation> execution path
81
- ## Inbound contract
82
- ## Middleware and validation
83
- ## Handler orchestration
84
- ## Domain/downstream handoff
85
- ## Response and error mapping
86
- ## Source-backed edges
87
- ```
88
-
89
- ## Granularity and relationships
90
-
91
- Aggregate operations that share registration, middleware, handler family, and
92
- downstream ownership. Split when operation families have different contracts,
93
- owners, or execution paths—not merely because they are separate methods.
94
-
95
- Record a route-to-handler or handler-to-downstream edge only when the route
96
- table, registration, call site, or parser evidence is unambiguous. Generated
97
- types can locate fields but do not prove runtime behavior.
98
-
99
- ## Template composition examples
100
-
101
- - A gateway that receives HTTP and calls RPC reads `adapter.md` and
102
- `protocol-boundary.md` in addition to this template.
103
- - An RPC service containing stable domain orchestration also reads
104
- `domain-service.md`.
105
- - An event-triggered endpoint may require `event-flow.md`; background consumers
106
- use `background-runtime.md`.
107
-
108
- ## Revise or stop when
109
-
110
- - no registration or authoritative operation identity is available;
111
- - the plan lists handlers without connecting them to provided operations;
112
- - the only contract source is generated code with an unknown upstream schema;
113
- - security or error behavior would be guessed from names;
114
- - scan mode would expand models and helpers into hundreds of pages.
115
-
116
- Mark unavailable protocol semantics as `material-required` before preview.
@@ -1,109 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.background-runtime
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Background runtime template
8
-
9
- Use for `background-runtime`: queue or stream consumers, scheduled jobs,
10
- pipelines, functions, controllers, watchers, and long-running agents activated
11
- by a trigger instead of an interactive request.
12
-
13
- Recommended `outputProfile`: `runtime-map`.
14
-
15
- ## Evidence pass
16
-
17
- Locate:
18
-
19
- - process/runtime bootstrap and worker/job registration;
20
- - trigger identity: topic, queue, schedule, hook, file, controller event, or
21
- platform invocation;
22
- - payload/schema locator and producer when available;
23
- - handler dispatch, concurrency, partitioning, ordering, and state changes;
24
- - downstream services, persistence, emitted events, and side effects;
25
- - retry, timeout, checkpoint, idempotency, dead-letter, and recovery behavior;
26
- - configuration, scaling, health, observability, deployment, and ownership;
27
- - replay/test fixtures and generated payload types that are not authoritative.
28
-
29
- Distinguish code defaults from runtime configuration. Do not describe delivery
30
- guarantees unless registration, framework configuration, or maintained
31
- documentation proves them.
32
-
33
- ## Questions the knowledge must answer
34
-
35
- 1. What activates the runtime and where is that trigger registered?
36
- 2. What input contract is consumed, and who produces it?
37
- 3. How does work move from dispatch through orchestration and side effects?
38
- 4. What are the concurrency, ordering, retry, and idempotency boundaries?
39
- 5. How does the runtime checkpoint, recover, or surface failed work?
40
- 6. How is it configured, operated, observed, scaled, and deployed?
41
-
42
- ## Suggested knowledge units
43
-
44
- - **Runtime map**: bootstrap, trigger families, handler registry, dependencies,
45
- state boundaries, and operating model.
46
- - **Trigger/workflow registry**: stable trigger identity, input contract,
47
- handler, downstream effects, retry/idempotency, and source locator.
48
- - **Processing flow**: focused end-to-end path for a high-value workflow family.
49
- - **Recovery and operations guide**: checkpointing, failed work, observability,
50
- configuration, local execution, deployment, and safe replay where evidenced.
51
- - **Producer-consumer chain**: only when both registered modules and the event
52
- identity are source-backed.
53
-
54
- ## Chapter blueprints
55
-
56
- ```markdown
57
- # <Background runtime> map
58
- ## Responsibility and activation model
59
- ## Bootstrap and trigger registration
60
- ## Workflow or handler families
61
- ## State and downstream side effects
62
- ## Concurrency, ordering, retry, and idempotency
63
- ## Failure recovery and observability
64
- ## Configuration, scaling, and deployment
65
- ## Contract sources and exclusions
66
- ```
67
-
68
- For a trigger family:
69
-
70
- ```markdown
71
- ## <Trigger or workflow>
72
- - Trigger identity and registration:
73
- - Input contract and producer:
74
- - Dispatch and handler:
75
- - State changes and downstream effects:
76
- - Retry/idempotency/checkpoint behavior:
77
- - Failure destination and operator action:
78
- - Source evidence:
79
- ```
80
-
81
- ## Granularity and relationships
82
-
83
- Prefer one record per stable trigger or coherent workflow family. Do not create
84
- one page per handler helper, event field, retry branch, or generated payload
85
- type. Split a page when triggers have different contracts, ownership, delivery,
86
- or recovery semantics.
87
-
88
- Every retained page must name concrete trigger, handler, state, side-effect,
89
- and recovery identities with source locators. A runtime page that only lists
90
- directories or says a worker “processes events” is too thin.
91
-
92
- Connect producers and consumers only through a concrete topic/trigger/schema
93
- identity. A shared type name or import is insufficient.
94
-
95
- ## Template composition examples
96
-
97
- - A consumer that invokes a domain boundary reads `domain-service.md`.
98
- - A scheduler that calls external APIs selects `protocol-consumer` and reads
99
- `protocol-boundary.md`.
100
- - A controller exposing administrative commands may combine this template with
101
- `cli-tool.md` or `api-service.md`, but should still produce one runtime map.
102
-
103
- ## Revise or stop when
104
-
105
- - no trigger registry or executable worker entry can be found;
106
- - delivery, ordering, retry, or idempotency would be guessed;
107
- - the producer or authoritative payload contract is required but unavailable;
108
- - the plan expands generated event structures or helpers one symbol per page;
109
- - runtime configuration cannot be distinguished from test setup.