Module Layout
Package dependencies
flowchart BT
core["@c4a/core"]
extract["@c4a/extract"]
ts["@c4a/extract-ts"]
go["@c4a/extract-go"]
catalogs["Catalog parsers"]
sdk["@c4a/context"]
ag["@c4a/agent-graph"]
cli["@c4a/context-cli"]
extract --> core
ts --> extract
go --> extract
catalogs --> core
cli --> sdk
cli --> ag
cli --> extract
cli --> ts
cli --> go
cli --> catalogsArrows point from a package to what it depends on; catalog parsers are extract-rush, -mdx, -proto, -thrift, -contract, -sql and -style. @c4a/context-cli is the only package users install; the SDK, extractors and Agent Graph come with it.
What each package does
| Package | Responsibility |
|---|---|
@c4a/context | Declarative SDK for a Context knowledge workspace's src/index.ts: sources, phases and package outputs, plus the versioned Indexer contracts |
@c4a/context-cli | The context command: knowledge workspace lifecycle, source capture, validation, review, close, build, the documentation website builder, the bundled workflow Provider and the Agent plugin |
@c4a/core | Shared extraction types, schemas and utilities |
@c4a/extract | Language-plugin framework and repository runner for code evidence |
@c4a/extract-ts, @c4a/extract-go | TypeScript/JavaScript and Go extraction plugins: symbols, spans, imports and exports |
@c4a/extract-rush, -mdx, -proto, -thrift, -contract, -sql, -style | Lightweight catalogs for Rush workspaces, MDX components, Protocol Buffers, Thrift, OpenAPI/GraphQL contracts, SQL and CSS/SCSS |
context-evidence-wasm | Builds the optional context-evidence.sourcegraph.wasm plugin for Source Graph |
@c4a/agent-graph | External, model-free workflow-contract runtime used only by the bundled Provider |
Parser packages materialize structural facts; they never write approved knowledge. See Code Extraction.
Inside the CLI package
| Path | Contents |
|---|---|
src/project/ | Knowledge workspace observation, sources, Indexer lifecycle, review, close, verify and package build |
src/project/workflow/ | Observes facts and binds the selected graph action to a revisioned command |
context-workflow/ | The Provider source: graphs, actions, resources, schemas and route tests |
plugins/context/ (repository root) | The only maintained source of the Agent plugin: four public entry Skills (context, context-plan, context-inspect-search, context-repo-content), four Indexer Provider Skills and context-indexer-create; host-specific entries are generated at build |
The build emits one bundle: the CLI binary, the immutable Provider under dist/providers/context, the plugin projections, the Indexer skills, the diagram viewer and the evidence plugin.
Where a change lands
@c4a/contextchanges affect knowledge workspace declarations and phase plans.@c4a/context-clichanges affect commands, Agent workflows, knowledge workspace file formats, review behavior and package output.@c4a/extractand the extractor and catalog packages (extract-ts,extract-go,extract-rush,-mdx,-proto,-thrift,-contract,-sql,-style) affect only the code facts of their languages and formats; see Code Extraction.context-evidence-wasmchanges affect only how Source Graph enriches remote code reads; local retrieval and knowledge production stay unchanged.- Agent Graph is a pinned external dependency; Context owns its Provider and host bindings.
模块划分
包依赖关系
flowchart BT
core["@c4a/core"]
extract["@c4a/extract"]
ts["@c4a/extract-ts"]
go["@c4a/extract-go"]
catalogs["目录解析器"]
sdk["@c4a/context"]
ag["@c4a/agent-graph"]
cli["@c4a/context-cli"]
extract --> core
ts --> extract
go --> extract
catalogs --> core
cli --> sdk
cli --> ag
cli --> extract
cli --> ts
cli --> go
cli --> catalogs箭头从一个包指向它所依赖的包;目录解析器包括 extract-rush、-mdx、-proto、-thrift、-contract、-sql 和 -style。用户只需安装 @c4a/context-cli,SDK、提取器和 Agent Graph 会随它一起安装。
各个包的职责
| 包 | 职责 |
|---|---|
@c4a/context | 用于 Context 知识工作区 src/index.ts 的声明式 SDK:来源、阶段和知识包输出,以及带版本的 Indexer 契约 |
@c4a/context-cli | context 命令:知识工作区生命周期、来源采集、校验、审核、close、构建、文档站点构建器、内置的工作流 Provider 和 Agent 插件 |
@c4a/core | 共享的抽取类型、Schema 和工具函数 |
@c4a/extract | 语言插件框架,以及抽取代码证据的仓库运行器 |
@c4a/extract-ts、@c4a/extract-go | TypeScript/JavaScript 和 Go 抽取插件:符号、代码范围、导入和导出 |
@c4a/extract-rush、-mdx、-proto、-thrift、-contract、-sql、-style | 轻量目录解析:Rush 工作区、MDX 组件、Protocol Buffers、Thrift、OpenAPI/GraphQL 契约、SQL 和 CSS/SCSS |
context-evidence-wasm | 构建供 Source Graph 使用的可选插件 context-evidence.sourcegraph.wasm |
@c4a/agent-graph | 外部的、不依赖模型的工作流契约运行时,仅供内置 Provider 使用 |
解析器包只产出结构化事实,从不写入已批准的知识。参见代码抽取。
CLI 包内部
| 路径 | 内容 |
|---|---|
src/project/ | 知识工作区观测、来源、Indexer 生命周期、审核、close、验证和知识包构建 |
src/project/workflow/ | 观测 Facts,并把选中的图动作绑定到带修订号的命令 |
context-workflow/ | Provider 源码:图、动作、资源、Schema 和 Route 测试 |
plugins/context/(仓库根目录) | Agent 插件唯一维护的源码:四个公开入口技能(context、context-plan、context-inspect-search、context-repo-content)、四个 Indexer Provider 技能和 context-indexer-create;各宿主的入口在构建时生成 |
构建只产出一个发行包:CLI 可执行文件、位于 dist/providers/context 的不可变 Provider、插件投影、Indexer 技能、图表查看器和证据插件。
改动会影响哪里
- 改动
@c4a/context会影响知识工作区声明和阶段计划。 - 改动
@c4a/context-cli会影响命令、Agent 工作流、知识工作区文件格式、审核行为和知识包输出。 - 改动
@c4a/extract以及各提取器和目录包(extract-ts、extract-go、extract-rush、-mdx、-proto、-thrift、-contract、-sql、-style)只影响对应语言和格式的代码事实;参见代码提取。 - 改动
context-evidence-wasm只影响 Source Graph 如何为远程代码读取补充证据;本地检索和知识生产不受影响。 - Agent Graph 是固定版本的外部依赖;Provider 和宿主绑定由 Context 自己维护。