@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,129 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.cli-tool
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # CLI and developer tool template
8
-
9
- Use for `cli-tool`: command-line applications, developer tools, administrative
10
- executables, generators, and command-driven plugin hosts. A build script used
11
- only internally does not need a CLI knowledge unit unless it is a supported
12
- operator or contributor surface.
13
-
14
- Recommended `outputProfile`: `command-map`.
15
-
16
- ## Evidence pass
17
-
18
- Locate:
19
-
20
- - executable/bin entry, runtime requirement, and command parser;
21
- - root and nested command registration;
22
- - positional arguments, flags, defaults, mutually exclusive options, and input
23
- schemas;
24
- - configuration files, environment variables, profiles, credential sources,
25
- and precedence;
26
- - interactive prompts versus non-interactive/automation behavior;
27
- - filesystem, repository, network, platform, and plugin side effects;
28
- - output formats, stdout/stderr behavior, exit codes, polling, and recovery;
29
- - local development, packaging, installation, compatibility, and release;
30
- - deprecated commands, aliases, parser helpers, and formatters to exclude.
31
-
32
- Inspect actual command registration and representative execution paths. Help
33
- text is useful evidence but may not describe hidden preconditions or effects.
34
-
35
- ## Questions the knowledge must answer
36
-
37
- 1. How is the CLI installed or invoked, and what runtime does it require?
38
- 2. What stable command families exist and what user outcomes do they produce?
39
- 3. What inputs, configuration, credentials, and precedence rules apply?
40
- 4. Which commands mutate files, repositories, remote services, or user state?
41
- 5. What output and exit behavior supports automation and diagnosis?
42
- 6. Which plugin or extension points change the command surface?
43
- 7. How does a user recover from common source-backed failure states?
44
-
45
- ## Suggested knowledge units
46
-
47
- - **Command map**: invocation model, command families, configuration,
48
- credentials, side effects, output formats, and extension points.
49
- - **Task workflow**: an end-to-end supported user goal spanning several
50
- commands, with preconditions, state transitions, and recovery.
51
- - **Command-family reference**: coherent subcommands with inputs, outputs,
52
- side effects, and examples.
53
- - **Configuration and credentials**: when precedence or environment behavior is
54
- complex and stable enough for a dedicated page.
55
- - **Plugin/extension contract**: use the single complete blueprint in
56
- `plugin-extension.md`; the command map only links commands and configuration
57
- to that contract.
58
- - **Development and release guide**: only source-backed contributor workflows
59
- owned by this module.
60
-
61
- ## Chapter blueprints
62
-
63
- ```markdown
64
- # <CLI> command map
65
- ## Purpose, installation, and invocation
66
- ## Command families
67
- ## Configuration and precedence
68
- ## Credentials and external dependencies
69
- ## Filesystem/repository/remote side effects
70
- ## Output formats and exit semantics
71
- ## Plugins, compatibility, and release
72
- ## Diagnostics, recovery, and exclusions
73
- ```
74
-
75
- For a command family:
76
-
77
- ```markdown
78
- # <Command family>
79
- ## User outcomes and preconditions
80
- ## Commands and arguments
81
- ## Configuration and credential requirements
82
- ## Execution and side effects
83
- ## Output and exit behavior
84
- ## Failure recovery
85
- ## Source-backed examples
86
- ```
87
-
88
- A workflow page may use:
89
-
90
- ```markdown
91
- # <User task>
92
- ## Starting state
93
- ## Command sequence
94
- ## State and artifact changes
95
- ## Remote operations
96
- ## Success checks
97
- ## Recovery and rollback boundaries
98
- ```
99
-
100
- ## Granularity and relationships
101
-
102
- Prefer command families and user tasks over one page per parser node, flag,
103
- prompt, formatter, or implementation function. Split only when commands have
104
- different state ownership, external systems, or safety/recovery contracts.
105
-
106
- Every retained page must name real commands, task outcomes, state changes, or
107
- extension identities with source locators. A list of command directories or
108
- parser nodes is not a command map.
109
-
110
- Connect commands to configuration, package/file outputs, plugin providers, and
111
- platform operations only when source registrations or call sites prove them.
112
-
113
- ## Template composition examples
114
-
115
- - A CLI with installable providers also reads `adapter.md` and
116
- `plugin-extension.md`.
117
- - A CLI that primarily wraps a remote protocol selects `protocol-consumer` and
118
- reads `protocol-boundary.md`.
119
- - A monorepo release tool may combine this template with
120
- `monorepo-container.md` and `build-release` without duplicating its command
121
- registry.
122
-
123
- ## Revise or stop when
124
-
125
- - no stable command registry or executable entry is found;
126
- - examples require inventing flags or commands not present in source;
127
- - side effects or credential behavior are unclear but material to safe use;
128
- - every option/parser helper is becoming an independent page;
129
- - deprecated or hidden implementation commands are presented as supported.
@@ -1,73 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.contract-source
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Authoritative contract source template
8
-
9
- Use for `contract-source`: a module whose maintained value is an authoritative
10
- IDL, OpenAPI document, schema registry, message contract, or equivalent
11
- machine-readable interface definition. It defines contracts consumed by other
12
- modules but does not need to execute or dispatch them itself.
13
-
14
- Recommended `outputProfile`: `protocol-index`. Also select
15
- `protocol-provider`, and use `generated-contract` only for generated projections
16
- that point back to this authority. The normal lifecycle is `authoritative`.
17
-
18
- ## Evidence pass
19
-
20
- Locate:
21
-
22
- - schema roots, namespaces/packages, service or message registries, and imports;
23
- - operation, event, request, response, and error identities;
24
- - versioning, compatibility, deprecation, and evolution rules;
25
- - generator configuration, target languages/packages, and generated output
26
- boundaries;
27
- - known provider and consumer registrations when those modules are registered;
28
- - ownership, validation, publication, and release entrypoints.
29
-
30
- ## Questions the knowledge must answer
31
-
32
- 1. Which contracts are authoritative in this module?
33
- 2. How are operations/messages grouped and identified?
34
- 3. What versioning and compatibility rules are declared?
35
- 4. Which generated artifacts and consumers derive from this source?
36
- 5. How is the contract validated, published, and changed?
37
-
38
- ## Suggested knowledge units
39
-
40
- - **Contract registry**: namespaces, service/message families, authority,
41
- versions, owners, and navigation.
42
- - **Operation or message-family reference**: exact identities, payload roles,
43
- errors, compatibility, and generated targets.
44
- - **Generation and publication map**: generator inputs/outputs, validation,
45
- versioning, and release boundary.
46
- - **Provider-consumer flow**: only when both runtime endpoints are registered
47
- and source-backed; use the cross-module template.
48
-
49
- ## Chapter blueprint
50
-
51
- ```markdown
52
- # <Contract module> registry
53
- ## Authority, ownership, and schema roots
54
- ## Namespaces and contract families
55
- ## Operations, messages, and error identities
56
- ## Versioning, compatibility, and deprecation
57
- ## Generated targets and active consumers
58
- ## Validation, publication, and release
59
- ## Evidence and exclusions
60
- ```
61
-
62
- Use the canonical operation record from `protocol-boundary.md` for detailed
63
- families. Do not duplicate every generated language binding or claim runtime
64
- behavior from the schema alone.
65
-
66
- ## Granularity and stop conditions
67
-
68
- Aggregate related operations/messages by authoritative family. Split when
69
- namespace, owner, version policy, or compatibility behavior differs. Every page
70
- must contain exact contract identities and source locators, not just filenames.
71
-
72
- Revise or stop when authority cannot be distinguished from a generated copy,
73
- imports or versions are unresolved, or compatibility claims are not declared.
@@ -1,81 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.contracts-and-chains
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Contracts, identity groups, and execution chains
8
-
9
- Use this resource after module classification when a code index must connect
10
- stable identities without turning the inventory into reader-facing prose. It
11
- applies to application, service, library, runtime, command, adapter, and
12
- cross-source units.
13
-
14
- ## Separate inspection facts from reader content
15
-
16
- The adapter inventory is complete machine evidence. A reader page should group
17
- members only when they share a source-backed responsibility, boundary, or
18
- lifecycle. Do not create one sentence, bullet, row, or page per discovered
19
- identity.
20
-
21
- An `identityGroups` record must provide:
22
-
23
- - a stable group `id`;
24
- - the exact target `members` from the same index-unit inventory;
25
- - one reader-facing `viewRef` that explains their common responsibility;
26
- - `sourceFiles` from the eligible-file inventory that prove membership.
27
-
28
- The referenced page must cite every declared source file. A group does not pass
29
- coverage merely because its members exist in frontmatter or evidence.
30
-
31
- ## Discover chain candidates
32
-
33
- Emit a candidate only when code structure or an authoritative declaration
34
- supports both adjacent endpoints. Supported families are:
35
-
36
- - `entry-operation`;
37
- - `operation-handler`;
38
- - `handler-downstream`;
39
- - `event-processing`;
40
- - `command-effect`;
41
- - `export-implementation`;
42
- - `cross-source-handoff`.
43
-
44
- Each candidate records a stable `id`, `from`, `to`, confidence, and the exact
45
- eligible `sourceFiles` that support the adjacency. Imports, filenames, symbol
46
- co-occurrence, or similar names alone are ambiguous evidence; mark such a
47
- candidate ambiguous or request material instead of asserting a runtime chain.
48
-
49
- ## Decide every candidate
50
-
51
- Every discovered candidate receives exactly one decision:
52
-
53
- - `document`: add a source-backed structured edge and name its reader-facing
54
- `viewRef`;
55
- - `merge`: point `canonicalChainId` at an equivalent candidate whose decision
56
- is `document`;
57
- - `exclude`: explain why the static match is not a stable runtime relation;
58
- - `request-input`: explain which external protocol, runtime registration, or
59
- authoritative material is missing.
60
-
61
- Decision coverage is 100%. Excluding all candidates does not close an external
62
- boundary family: at least one representative chain must be documented, merged
63
- into a documented chain, or explicitly require material.
64
-
65
- ## Reader-facing chain blueprint
66
-
67
- ```markdown
68
- ## <Reader goal or boundary>
69
-
70
- <Explain the starting trigger and the stable outcome.>
71
-
72
- 1. **Entry or trigger** — <identity and responsibility>.
73
- 2. **Operation or handler** — <validation, transformation, or state change>.
74
- 3. **External handoff or effect** — <contract, ownership, and next boundary>.
75
-
76
- Failure and retry boundary: <only source-backed behavior>.
77
- Evidence: <section-scoped locators for each adjacent handoff>.
78
- ```
79
-
80
- Remove stages that do not apply. Do not leave empty template headings, repeat a
81
- module inventory, or infer missing runtime behavior.
@@ -1,78 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.cross-module-chain
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Cross-module flow template
8
-
9
- Use for `cross-module-chain` only when a stable reader question cannot be
10
- answered inside one module. The chain is an independently owned index unit with
11
- `outputProfile: "cross-module-flow"`; each participating module keeps its own
12
- non-duplicated map.
13
-
14
- ## Evidence pass
15
-
16
- Establish:
17
-
18
- - an explicit start trigger and terminal outcome;
19
- - each registered module boundary in execution order;
20
- - operation, event, repository, command, or plugin identities joining adjacent
21
- modules;
22
- - transformations, ownership handoffs, state changes, and failure boundaries;
23
- - source locators on both sides of every join;
24
- - authentication, retries, fallback, observability, and recovery only where
25
- they are explicitly configured.
26
-
27
- Imports, filenames, symbol co-occurrence, and similar names do not prove a
28
- runtime chain.
29
-
30
- ## Questions the knowledge must answer
31
-
32
- 1. What reader goal and source-backed trigger start the flow?
33
- 2. Which module owns each step and boundary?
34
- 3. Which exact contract or identity joins each adjacent step?
35
- 4. What state, identity, or data is transformed at every handoff?
36
- 5. Where can the flow fail, retry, fall back, or terminate?
37
-
38
- ## Chapter blueprint
39
-
40
- ```markdown
41
- # <Cross-module flow>
42
- ## Reader goal and starting trigger
43
- ## Boundary sequence and module ownership
44
- ## Contract and transformation at each handoff
45
- ## State changes and terminal outcome
46
- ## Authentication, failure, retry, and fallback
47
- ## Source-backed edge inventory
48
- ## Known gaps and excluded implementation detail
49
- ```
50
-
51
- Examples include application-to-client-to-endpoint, endpoint-to-service-to-
52
- repository, producer-to-event-to-consumer, command-to-remote-operation, and
53
- plugin-host-to-provider.
54
-
55
- ## Extractor and ownership rule
56
-
57
- A chain normally overlaps the sources already owned by module units. Use
58
- `extractCustom()` and assign each aggregate candidate to the chain unit through
59
- its `module` field. `extractTs()` assigns ownership at source level, so it cannot
60
- represent both a per-module unit and an overlapping cross-source chain unit in
61
- the same phase.
62
-
63
- The aggregate candidate may cite evidence from every participating source. It
64
- must cover all Route-reported structural probes selected by the flow profile;
65
- one page may cover several probes when it carries each exact evidence locator.
66
- Use `operation` and `handoff` candidate sections and emit source-backed
67
- `depends_on` edges from the owning module candidate to the next registered
68
- module candidate. Narrative arrows or a textual sequence do not satisfy the
69
- structured relationship requirement.
70
-
71
- ## Granularity and stop conditions
72
-
73
- Emit one deduplicated page per coherent end-to-end flow family. Split when the
74
- trigger, terminal outcome, ownership, contract, or failure policy differs.
75
-
76
- Revise or stop when either endpoint or a joining identity is missing, the chain
77
- crosses unregistered sources, relationships depend on inference, or the output
78
- repeats module pages without adding a handoff model.
@@ -1,116 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.derived-source
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Generated, mirrored, vendored, and legacy source template
8
-
9
- Use for `derived-source` and lifecycle values `generated`, `mirrored`,
10
- `vendored`, or `legacy`. Its main purpose is to prevent derived artifacts from
11
- being mistaken for independent knowledge authority while preserving useful
12
- consumer and provenance information.
13
-
14
- ## Evidence pass
15
-
16
- Locate:
17
-
18
- - generation, sync, vendoring, migration, or deprecation markers;
19
- - authoritative repository, schema, template, source directory, or upstream
20
- package;
21
- - generator/sync command, configuration, version pin, and output boundary;
22
- - ownership and update cadence;
23
- - consumers that still import or execute the derived tree;
24
- - local modifications, compatibility wrappers, or hand-maintained overlays;
25
- - release/build artifacts and whether they are committed or reproducible;
26
- - replacement path for legacy source when one is explicitly maintained.
27
-
28
- Do not assume all files in a generated-looking directory are derived. Confirm
29
- markers, build steps, headers, manifests, or source mapping.
30
-
31
- ## Questions the knowledge must answer
32
-
33
- 1. Why does this source exist and what lifecycle category applies?
34
- 2. Where is the authoritative source of truth?
35
- 3. How is the derived content produced, synchronized, or versioned?
36
- 4. Which consumers depend on it and through what supported surface?
37
- 5. Are local edits permitted, overwritten, or layered separately?
38
- 6. What is safe to inspect here, and what knowledge belongs upstream?
39
- 7. For legacy source, what current replacement and migration status are proven?
40
-
41
- ## Suggested knowledge units
42
-
43
- - **Provenance record**: lifecycle, authority, generator/sync, version relation,
44
- ownership, output boundary, and consumer summary.
45
- - **Generated public surface**: only when this tree is the supported consumer
46
- interface; combine with `sdk-library` and keep the upstream schema explicit.
47
- - **Compatibility or migration boundary**: when maintained wrappers or legacy
48
- behavior remain operationally relevant and source-backed.
49
- - **Update/recovery procedure**: only maintained generation or synchronization
50
- commands, verification, and overwrite boundaries.
51
-
52
- Default `outputProfile` to `provenance-only` unless a supported consumer surface
53
- requires another profile. A consumer-facing derived unit should set
54
- `sourceOfTruth` to the confirmed authority locator; a missing authority remains
55
- an advisory risk rather than a reason to hide the supported consumer surface.
56
-
57
- ## Chapter blueprints
58
-
59
- ```markdown
60
- # <Derived source> provenance
61
- ## Lifecycle classification
62
- ## Authority and ownership
63
- ## Generator, sync, or vendoring mechanism
64
- ## Version and compatibility relationship
65
- ## Output boundary and local-edit policy
66
- ## Active consumers
67
- ## Update, verification, and recovery
68
- ## Reader-facing knowledge owned elsewhere
69
- ```
70
-
71
- For a generated public client:
72
-
73
- ```markdown
74
- # <Generated client> consumer surface
75
- ## Intended consumers and supported import
76
- ## Authoritative schema and generation version
77
- ## Client initialization and operation families
78
- ## Generated versus maintained behavior
79
- ## Compatibility and regeneration
80
- ## Evidence and excluded generated detail
81
- ```
82
-
83
- ## Granularity and relationships
84
-
85
- Do not duplicate pages already owned by the authoritative schema,
86
- implementation, or package. Generated files may provide exact locators and
87
- cross-checks but should not expand every model, constant, serializer, or method
88
- into reader-facing Markdown.
89
-
90
- Relate the derived unit to its authority and active consumers. A relationship
91
- to an upstream schema must use an explicit locator or generation configuration,
92
- not a naming guess.
93
-
94
- If the authority cannot be located, a narrow provenance unit may still record
95
- confirmed lifecycle markers, generator clues, output boundaries, and active
96
- consumers. Keep any separate unit that promises field semantics, compatibility,
97
- or upstream meaning as `material-required` until the missing authority is
98
- provided.
99
-
100
- ## Template composition examples
101
-
102
- - A generated API client is `sdk-library` + `derived-source` and reads
103
- `protocol-boundary.md` for protocol authority.
104
- - A vendored library with no project-owned surface remains one provenance page,
105
- not a copied API reference.
106
- - A legacy adapter still serving callers combines this template with
107
- `adapter.md`; document only proven compatibility and migration behavior.
108
-
109
- ## Revise or stop when
110
-
111
- - the authoritative source cannot be identified for semantic or compatibility
112
- claims beyond a narrow provenance record;
113
- - generated and hand-maintained files cannot be separated;
114
- - the plan duplicates upstream reference material without consumer value;
115
- - legacy replacement or deprecation claims are inferred rather than evidenced;
116
- - generated symbols dominate projected pages.
@@ -1,109 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.domain-service
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Domain service template
8
-
9
- Use for `service` modules whose stable value is a domain/use-case boundary or a
10
- reusable service contract and its first-level orchestration. Do not classify a
11
- directory as a service merely because it contains classes or functions named
12
- `Service`.
13
-
14
- Recommended `outputProfile`: `service-boundary`.
15
-
16
- ## Evidence pass
17
-
18
- Locate:
19
-
20
- - service construction, registration, dependency injection, or public entry;
21
- - supported operations and their callers or protocol handlers;
22
- - use-case/domain orchestration and the point where ownership changes;
23
- - repositories, transactions, caches, downstream clients, and event ports;
24
- - invariants, idempotency, consistency, permission, or failure boundaries;
25
- - configuration and runtime wiring that materially change the service;
26
- - generated clients/models and internal helpers that should remain evidence.
27
-
28
- Follow representative public operations through one orchestration layer. Stop
29
- at the first stable domain, persistence, or downstream protocol boundary unless
30
- the confirmed knowledge goal explicitly needs deeper implementation behavior.
31
-
32
- ## Questions the knowledge must answer
33
-
34
- 1. What responsibility and invariants does this service own?
35
- 2. Which operations form its supported boundary, and who calls them?
36
- 3. How do operations coordinate domain logic and dependencies?
37
- 4. Where are transaction, consistency, idempotency, or state boundaries?
38
- 5. What failures can cross the boundary, and how are they represented?
39
- 6. Which dependencies are stable contracts versus internal implementation?
40
-
41
- ## Suggested knowledge units
42
-
43
- - **Service boundary**: responsibility, public operations, ownership,
44
- invariants, callers, and stable dependencies.
45
- - **Operation/use-case map**: operation to orchestration to first stable
46
- downstream/persistence/event boundary.
47
- - **State and consistency contract**: only when transaction, idempotency,
48
- caching, or durable state is important and evidenced.
49
- - **Dependency map**: concrete ports/clients/repositories and why each boundary
50
- matters; avoid a raw import inventory.
51
- - **Runtime/configuration guide**: only module-owned configuration, startup,
52
- diagnostics, or release behavior.
53
-
54
- ## Chapter blueprints
55
-
56
- ```markdown
57
- # <Domain service> boundary
58
- ## Responsibility and non-responsibilities
59
- ## Supported operations and callers
60
- ## Domain rules and invariants
61
- ## Dependency and port boundaries
62
- ## State, transaction, and idempotency behavior
63
- ## Failure and recovery behavior
64
- ## Configuration and runtime wiring
65
- ## Evidence and excluded implementation detail
66
- ```
67
-
68
- For a use-case family:
69
-
70
- ```markdown
71
- ## <Use-case family>
72
- - Trigger or caller:
73
- - Supported operation:
74
- - Preconditions and invariants:
75
- - Orchestration steps:
76
- - Persistence/downstream/event boundary:
77
- - Result and failure semantics:
78
- - Source evidence:
79
- ```
80
-
81
- ## Granularity and relationships
82
-
83
- Group operations that share responsibility, invariants, and dependency paths.
84
- Split only when ownership or consistency semantics differ. Do not publish every
85
- exported method: language visibility is not proof of a supported service API.
86
- Every retained page must name supported operations, callers, ports, or state
87
- identities and include source locators; a folder/class inventory is not a
88
- service boundary.
89
-
90
- Relationships should connect supported operations to real callers, ports,
91
- repositories, or downstream operations. Do not infer a domain flow from
92
- similar names or shared models.
93
-
94
- ## Template composition examples
95
-
96
- - An RPC implementation reads `api-service.md` for its inbound registration and
97
- this template for domain orchestration.
98
- - A service backed by durable storage selects the `persistence` facet and reads
99
- `persistence-boundary.md`.
100
- - A service activated only by events also reads `background-runtime.md` and the
101
- `event-flow.md` template.
102
-
103
- ## Revise or stop when
104
-
105
- - no stable caller or public service boundary can be found;
106
- - the proposed content is a class-by-class implementation listing;
107
- - invariants or data semantics depend on unavailable documentation;
108
- - generated models are being treated as the domain source of truth;
109
- - an end-to-end chain crosses undeclared source modules.
@@ -1,62 +0,0 @@
1
- ---
2
- id: semantic.code-index.template.event-flow
3
- kind: procedure
4
- media-type: text/markdown
5
- ---
6
-
7
- # Event producer and consumer template
8
-
9
- Use for `event-producer` or `event-consumer`. This template supplements the
10
- owning runtime, service, application, or adapter page; selecting an event facet
11
- does not by itself justify a separate end-to-end page.
12
-
13
- ## Evidence pass
14
-
15
- Locate:
16
-
17
- - topic, stream, queue, hook, notification, or event identity;
18
- - authoritative schema and versioning source;
19
- - producer call and publication condition;
20
- - subscription/consumer registration and handler dispatch;
21
- - delivery, ordering, partitioning, retry, dead-letter, checkpoint, and
22
- idempotency configuration;
23
- - emitted side effects, observability, replay, and recovery entrypoints.
24
-
25
- Do not derive delivery guarantees from framework defaults.
26
-
27
- ## Questions the knowledge must answer
28
-
29
- 1. What event is emitted or consumed, under what condition, and by whom?
30
- 2. Where is publication or subscription registered?
31
- 3. What delivery and recovery behavior is actually configured?
32
- 4. What state or side effects change, and how can failed work be identified?
33
-
34
- ## Chapter blueprint
35
-
36
- ```markdown
37
- # <Event flow or family>
38
- ## Event identity and authoritative schema
39
- ## Producer and publication condition
40
- ## Delivery and routing semantics
41
- ## Consumer registration and processing
42
- ## Idempotency, retry, checkpoint, and failure destination
43
- ## Side effects and observability
44
- ## Source-backed producer-to-consumer relationship
45
- ```
46
-
47
- When only one endpoint is registered, keep an event record inside that
48
- module's runtime or service map and omit the unavailable endpoint. Create a
49
- separate event-flow page only when both sides and their shared event identity
50
- are evidenced, or when one side alone has enough delivery and recovery
51
- semantics to be a stable operator-facing topic.
52
-
53
- ## Granularity and stop conditions
54
-
55
- Group events with the same schema authority, delivery policy, ownership, and
56
- handler family. Do not create pages per event field, generated payload type,
57
- handler helper, or retry branch.
58
-
59
- Every retained record must name the event identity, registration or call site,
60
- and source locator. Revise or stop when delivery semantics would be guessed,
61
- the shared identity is missing, or the output would contain empty producer or
62
- consumer sections.