内容
源代码路径(又称:代码库映射器)
## 免责声明
本作品受方法论的限制和承诺的约束,如 [@DISCLAIMER.md](./DISCLAIMER.md) 中所述。
> 没有任何陈述或前提是未经实际逻辑定义或可验证参考支持的,不应被视为理所当然。
将源代码仓库映射到 RDF 图谱(turtle + JSON 侧边栏)。主机对文件进行分类,提取每种语言的 AST 摘要,解析导入,
并推断测试/依赖边。管道通过可插拔的扩展点注册;配套插件分层区块/嵌入和概念图。
## 目标
**完全支持 TIOBE 指数前 50 名语言,自 2026 年起累计。**
自 2026 年开始,任何出现在 TIOBE 前 50 名的语言都会永久加入目标集([docs/goals/tiobe-top50.yaml](./docs/goals/tiobe-top50.yaml)
— 基线:2026 年 7 月指数)。 "完全支持" 意味着每个 [docs/SPEC_FIRST_CLASS_LANGUAGE.md](./docs/SPEC_FIRST_CLASS_LANGUAGE.md):
检测,AST 分析器,导入解析器,符号级分块,LLM 摘要资格和测试套件。
进度不会在散文中声称 — 它是被衡量的。 `make check` 机械地探测代码库,并将其与已提交的账本进行对比,如果支持不实,账本条目过期和已经发布的语言回归,则失败:
```bash
make check # 语言目标账本 + 偏移 + 模式形状验证器
```
## 布局
```
codebase_mapper/ 主机包
├── inspection/ 分类,仓库来源,AST 提取,导入
│ ├── languages/ 每种语言的分析器和导入解析器
│ └── pipeline.py map_codebase() — 驱动检查注册表
├── emission/ 包发射,重建,重生
│ ├── application/ 使用案例服务,如 emit_bundle 和 regenerate
│ └── infrastructure/ RDF,存储和受控词汇适配器
├── shared_kernel/ 扩展协议,注册表,常量,命名空间
├── cli.py, __main__.py 命令行界面入口
└── ...
plugins/
├── chunks_embeddings/ 源区块 + 句子变换器/哈希嵌入
├── concept_graph/ 标识 + 规范概念集 + SKOS
├── symbol_xrefs/ 符号级交叉引用边(cbmxr:Edge)
└── llm_enrich/ L4 LLM 编著注释(cbml4:* 三元组)— 可选
scripts/
├── run_l2.py 主机 + chunks_embeddings 注册
├── run_l3.py 主机 + chunks_embeddings + 概念图(--no-l2 跳过 L2)
├── run_xrefs.py 主机 + chunks_embeddings + 符号交叉引用(+ --concepts 可选)
└── run_l4.py 主机 + L2 + L3 + L4 llm_enrich(Ollama 支持;完整 L1+L2+L3+L4)
frontend/
├── backend/ FastAPI 服务,读取输出包并为 UI 提供
│ 摘要/图表/区块/概念 JSON
├── mcp_server/ 只读 MCP 工具/资源/提示信息
└── ui/ React UI(脚手架中,正在进行中)
tests/
├── verify_l2.py chunks_embeddings 契约套件
├── verify_l3.py 概念图契约 + 跨层(带/不带 L2)
├── verify_xrefs.py 符号交叉引用模式/词汇/侧边栏
├── verify_llm_enrich*.py L4 llm_enrich 契约套件(9 个验证器:基本,
│ 缓存,提示,文件摘要,RDF,聚合器,
│ 确定性,离线,命令行,CI-确定性)
└── verify_drift_p*.py 文档和契约偏移防护
static/
├── schemas/ 授权行业标准 XSD(IEEE 12207/29148,
│ IEC 5055,EIC,DDD v3,C4,AST,python-metacode,
│ ddd-python-bridge);用作分类器固定装置和
│ 未来词汇种子。参见 static/schemas/ 获取完整清单。
└── proto/dsl/v2/ 来自 requirements.engineering.dsl.v2 家族的授权 protobuf 契约
(兄弟项目 repo-intel);类型模式固定装置与
static/schemas/ 平行。
```
## 安装
```bash
pip install -e .
```
## 运行
```bash
# 仅主机
python -m codebase_mapper --repo /path/to/repo --out /tmp/out
# 主机 + 区块/嵌入
python scripts/run_l2.py --repo /path/to/repo --out /tmp/out --backend sbert
# 主机 + 区块/嵌入 + 概念图
python scripts/run_l3.py --repo /path/to/repo --out /tmp/out --backend sbert
# 主机 + 区块/嵌入 + 概念图 + 符号交叉引用
python scripts/run_xrefs.py --repo /path/to/repo --out /tmp/out --backend hash --concepts
# 完整 L1+L2+L3+L4(通过 Ollama 可选 LLM 增强;参见下面的警告和 PALS 定律框架)。
python scripts/run_l4.py --repo /path/to/repo --out /tmp/out
```
`--backend sbert` 在进程中使用 `sentence-transformers/all-MiniLM-L6-v2`;
`--backend ollama` 通过运行的 Ollama 服务器嵌入到 `$OLLAMA_HOST`
(默认模型 `nomic-embed-text`,覆盖 `--ollama-embed-model`)以获取真实向量,无需 torch 堆栈;
`--backend hash` 使用确定性 SHA-256 假(无语义,有助于契约测试)。参见
[docs/analyze.md](docs/analyze.md#embedding-backends) 获取权衡。
`--repo` 接受本地路径或 Git URL。支持 GitHub HTTPS、 `github.com/OWNER/REPO` 简写。远程仓库被克隆到临时目录,分析后删除。
```bash
python scripts/run_xrefs.py \
--repo https://github.com/OWNER/REPO.git \
--out _tmp/repo-map \
--backend hash \
--concepts
python scripts/run_xrefs.py \
--repo git@github.com:OWNER/REPO.git \
--out _tmp/repo --backend sbert \
--concepts
python scripts/run_xrefs.py \
--repo github.com/OWNER/REPO \
--out _tmp/repo-map \
--backend hash \
--concepts
```
有关完整的操作指南,包括 Docker 使用、分支选择、排除和包检查,请参阅 [docs/analyze.md](docs/analyze.md)。
### Docker
构建隔离的分析器镜像:
```bash
docker build -t codebase-mapper .
```
在 GitHub URL 上运行所有层:
```bash
mkdir -p _tmp
docker run --rm -v "$PWD/_tmp:/work" codebase-mapper \
https://github.com/OWNER/REPO.git --out /work/repo-map
```
默认镜像针对 `--backend hash` 进行了优化。只有需要时才构建语义嵌入依赖:
```bash
docker build --build-arg WITH_SBERT=1 -t codebase-mapper:sbert .
```
### 排除文件
每次调用:`--exclude PATTERN`(可重复;POSIX glob;裸名称如 `.repo` 也排除后代)。在主机 CLI 和 `scripts/run_l2.py` / `scripts/run_l3.py` / `scripts/run_xrefs.py` 上可用。
每个仓库:在仓库根放置一个 `.cbmignore`。每行一个模式,`#` 注释,空白行可以。模式与 `--exclude` 合并并出现在 `run_manifest.json` 的 `exclude_patterns` 中。
```
# .cbmignore
.repo
vendor/**
docs/_build/**
```
### MCP 服务器
为 MCP 客户端(如 Claude Code)注册只读包服务器,并在仓库根目录下使用项目范围的 `.mcp.json`(按设计为机器本地 — `.gitignore` 排除它检出创建自己的):
```json
{
"mcpServers": {
"cbm": {
"command": ".venv/bin/python",
" ["-m", "frontend.mcp_server"],
"env": { "_BUNDLES_ROOT": "_tmp" }
}
}
}
```
服务器使用标准输入/输出,并为 `_tmp/<name>` 下的每个包提供服务。首先生成一个(参见上面的命令),例如:
```bash
python scripts/run_l3.py --repo . --out _tmp/sourcepath --name sourcepath
```
工具表面、资源、提示、身份验证模式和 HTTP 传输在 [frontend_server/README.md](frontend/mcp_server/README.md) 中记录。
## 可视化
`frontend/backend` 是一个 FastAPI 服务,读取输出包并公开 JSON 端点:
| 端点 | 目的 |
|---|---|
| `GET /api/bundles` | 列出可发现的包和选定的包。 |
| `GET /api/summary` | 清单计数,语言/类型分解,嵌入后端。 |
| `GET /api/file-graph` | 按导入度和导入边排名的顶级文件。 |
| `GET /api/symbol-graph` | 符号级交叉引用图。 |
| `GET /api/concept-graph` | 概念共现图。 |
| `GET /api/chunks` | 浏览或按词典搜索区块。 |
| `POST /api/chunks/search` | 语义最近邻或词典备用。 |
| `GET /api/chunk-blob/{sha}` | 原始区块文本块。 |
| `GET /api/concept/{name}` | 概念详情。 |
| `GET /api/file}` | 文件详情。 |
| `GET /impact/{path}` | 文件影响图。 |
| `GET /api/chunk/{idx}` | 区块详情。 |
| `GET /api/healthz` | 健康检查。 |
```bash
# 指向包含 run_manifest.json + inventory.ttl +
# embeddings.npz + embeddings_meta.json + concepts.json 的任意输出目录。
# API 关闭:选择匿名访问以进行本地开发(如下)
# 或设置 CBM_API_TOKEN=<secret> 并使用 `Authorization: Bearer` 进行身份验证。
CBM_OUTPUT_DIR=_tmp/usl-ng-core-map CBM_ALLOW_ANONYMOUS=1 \
.venv/bin/uvicorn frontend.backend.app:app --port 8000 --reload
```
语义搜索(`POST /api/chunks/search`)在包的嵌入后端是句子变换器时使用余弦 NN;在哈希后端则回落到子字符串匹配。包在每个进程中加载一次 — 重新启动以选取新输出目录。参见 [frontend/backend/README.md](frontend/backend/README.md) 获取端点详情。
## 报告
每个报告生成器的一个入口(每个工具也可以独立运行;其自己的 `--help` 是事实来源):
```bash
python scripts.py report --tmp/out # 结构 X 光:HTML / MD / JSON
python scripts/cbm.py report-rs _tmp/out # Rust 渲染的 PDF(多 GB 包)
python scripts/cbm.py dossier --bundle _tmp/out # 100+ 页类型设置 A4 PDF
python scripts/cbm.py pdf docs/reports/<name>.md # 编著 Markdown -> 主题 PDF
python scripts/cbm.py site --bundle _tmp/out # 离线静态网站(树)
python scripts/cbm.py repair --bundle _ # 事后数据质量修复
python scripts/cbm.py cartogram _tmp/out # 交互式 D3 地图(区域 + 流)
python scripts/cbm.py terrain --bundle _tmp/out # 3D 代码地形图(一个 HTML 文件)
python scripts/cbm.py walkthrough --bundle _tmp/out # 讲述的五场景演示页面
```
每个生成器写入 `CBM_REPORTS_DIR`(默认 `reports/`,gitignored非您式输出路径。名称标准化 —
`<source>__<kind>__<UTC-timestamp>[.ext]`,并且 `site` 使用与其树根相同的词干。因此,包目录仅保留测量的工每个派生的渲染都位于一个可预测的位置。例外是 `repair`,它重建包的侧车并写入 `inventory.ttl` 旁边。
两种结构化读取路径按设计存在:`report`ossier`(Python)通过每个包的持久 pyoxigraph 存储加载图并执行图分析;`report([tools/cbm-report](tools-report/README.md),Rust)从磁盘流式传输 `inventory.jsonld` 并独立重新计算 — 适用于包的图瓶颈( `cargo build --manifest-pathbm-report/Cargo.toml`)。
`cartogram`([tools/cbm-cartogram/cbm/README.md))渲染一个自包含的 D3 HTML 地图,适用于任何仓库 — 目录区域具有导入和测试投影 — 来自包inventory.jsonld`。
`terrain` 渲染一个自包含的 WebGL2 HTML 地图:地理是每个目录的平均区块嵌入的种子 t-SNE 投影,高度是区块密度,L1 导入图提供道路、构建顺序层、影响洪水、依赖路径跟踪和压力(强导入 × 语义距离)断。目录滚动自动适应大型包(内核规模 ≈ 2 分钟脚显示每个截断并标记派生视图。保持 `--seed` 固定每个仓库,以便其地理在再生过程中保持可识别。
through` 将五个实时的 MCP (方向 →
关键 辐射半径 → 概念邻域 → 语义问题)冻结到一个自包含的演示页面 — 讲述的 `report` 证据优先的 X 光的伴侣。每个场景都命名 MCP 工具,该工具实时回答它;唯一的 LLM 编著行(当包具有一个时,L4 文件摘要)显示带有模型/提示出处,从不作为事实。
每个生成器在共享的“证据基础和置信度下分离证据机械事实 vs. 派生计算 vs. 未验证的 LLM声明性报告合同存在于 [docs/reporting/](docs/reporting30 组件目录 +架构,由 `tests/verify_report_spec.py固定)。编著的叙述报告及其存在于 `docs/reports/`(gitignored成果)。
## 分解与重组器读取一个包并发出置信度分解 — 部件和角色,马丁不稳定性,架构假设门和拓顺序;重组器使用该 YAML(原始包)并发出有序的自然语言重建计划。仅限包导出的证据;decomposer/README.mdcomposer/README.mdbash
python -m decomposer _tmp d.yaml --report d.md #.yaml]
python recomposer d plan.md yaml plan.yaml 再生
base_mapper` 仅从.ttl`cbm:astSummary` **单独**需 `blobs。伴随 `reconstruct`,具有真度模型:
| 路径 | 真相来源 | 保 |
|---|---|---|
| `reconstruct` | `inventory.ttl`blobs/`字节相同**文件 |
| `reg(新) | `inventory.ttl` + `cbm:astSummary` | Python语义**(重新相同的 AST);TS/JS +**字节相同** 通过叶文本 CST |
目前 `regenerate` 支持:Python,TypeScript(`.ts`,`.tsx`,`.cts`,`.mts`),JavaScript(`.js`,`.jsx`,`.mjs`,`.cjs`),Rust
(`.xlsx`)。其他文件(markdown,configs,lockfiles文件)被报告在 `ast` / `no_ast_summary` 下,不会写入磁盘。
```bash
codebase-mapper --regenerate \
--inventory _tmp/out/inventory.ttl \
--out _tmp/regen \
--report _tmp/regen-report.json
```
报告记录 `files_regenerated`,每个语言的 `ok`/`failed` 计数,以及跳过或错误的文件列表。
### 丢失的内容
- **Python**(完美语义):注释,空白行,字符串引号样式,尾随逗号。重新生成的源代码重新解析为相同的 `ast.dump`,但字节不同。如果需要字节相同的 Python 从 TTL+AST,交换基于 `ast` 的提取器为基于 `libcst` 的提取器 — `libcst` 保留混凝土语法树(注释 + 空白)。
- **TS**(字节完美):无 — 每个叶令牌加上间隙和任何头部/页脚字节都被捕获。Tree-sitter 没有 `unparse`,器存储足够的 CST 以回走至源。
- **Rust**():无 — 与 TS/JS 相同的方法。Rust 提取器在 `ast_summary.cst_json`(模式版本 1)下存储完整的叶文本 CST 加上可选的 `header` / `footer` 字节(罕见,但在解析器根范围之外可能存在)。
### 大小成本
`cbm:astSummary` 随着完整主体捕获而增长。测量的比率:
| 语言 | `ast_summary` JSON / 源代码 |
|---|---|
| Python | ~6.6× |
| TypeScript | ~12.5× |
| Rust | ~10×(典型;密度变化) |
`run_manifest 报告 `counts.ast_full_bodies_python`、`counts.ast_full_bodies_tsjs`、`counts.ast_full_bodies_rust` 和 `counts.ast_summary_total_bytes`,因此每次运行的成本都是可衡量的。如果 TTL 大小成为问题,短期解决方案是将完整主体文字由 `cbm:contentSha 索引的侧车 `ummaries.jsonl`,并从 `inventory.ttl` 中的 URI 引用它们。
### 添加新语言
有关完整契约的详细信息,请参阅 [docs/regenerate.md](docs/regenerate.md):`ast_summary` 形状,`regenerate_<lang>_source(summary) -> str` 签名, `_REGENERATORS` 中的注册以及新语言必须满足的 `verify_regenerate.py` 测试用例。 文档以 **“Rust 工作示例(第 1-8 阶段)”** 附录结束,将每个合同部分映射到一个具体的树状文件 — 从此处复制添加下一个树状语言。
## 清单模式
`inventory.ttl` 有一个类型化的定义,具有三个表面:
SHACL 形状** — `build_shacl_graph()` 在 [`ib_emitter.py`](codebase_mapper/infrastructure/rdf/rdflib_em) 中是执行机构:每个发射验证库存对抗它,并将其序列化到包中作为 `shapes.shacl.ttl- **规范的antic 模式** —
[`codebase_mapper/emission/domain/in`](codebase_mapper/emission/domain/inventory_schema.py) 是 Python 消费者的类型化镜像:相同的基数,数据类型,模式,封闭词汇和边目标类,由antic 验证。
[`inventory_reader.py`](codebase_mapper/emission/infrastructure/rdf/inventory_reader.py)(`read_inventory()`)将包的库存图谱解析为它,提高任何形状违反内容的 `ValidationError`。
- **偏移 [`_inventory_schema.py`](_schema.py两个定义保持一致的谓词注册表必须等于实时形状图的 `sh:path` 集,`FileType`/`Phase` 枚举 [`shared_kernel.py`](codebase/shared_kernel/vocabulary.py) 中的受控通过真正的发射必须验证。 树运行make test-units`)。
扩展模型
`codebase_mapper.extensions` 暴露了七种协议 `LanguageAnalyzer`提取文件的 AST 摘要(按 `.matches()` 优先匹配)。
- `ImportResolver` — 将记录的导入解析为和外部包 `RecordEnricher` — 在 AST 提取后,对每个 `FileRecord` 运行一次。
- `Aggregator` — 在每个管道上运行一次,具有完整的记录可见性;输出存储在 `ctx.indices[self.name]`。
- `GraphContributor` —添加三元组。
- `ShapeContributor` — 为引入的类/属性添加 SHACL 形状。
-` — 编写附带文件;返回一个清单每个注册表都按 `.name` 排序顺序迭代,因此插件作者使用 `l20_embeddings` / `l3_20_concepts` 等前缀来控制跨层的加载顺序(L2 必须在 L之前运行,因为 L3 读取 L2 的索引条目)。内置的 `LanguageAnalyzer` / `ImportResolver` 包装器在导入时自动注册到主机中;`reset_registries()` 在清除后重新注册它们。一流语言(检测 + 分析器 + 解析器 + 分块器 + L4 摘要 + 验证器)— TIOBE-50 一流语言集在 [docs/goiobe-top50.yaml](docs/goals/tiobe-top50.yaml) 中跟踪,加上配置格式 — 是:
<!-- first-class-langsPython、C、C++、JavaScript、TypeScript、Rust、Go、Swift、Ruby、Kotlin、Objective-C、Dart、CFML、PHP、SQL、HTML、CSS/SCSS、JSON、YAML、Shell
<!-- first-class-langs:end -->
`tests/verify_readme_coverage.py` 如果列表与账本不符,则会失败 `make check`;新增一流语言不能被静默地无文档化。
## 受控词汇
L3 的概念图配备了一套精选的约 40 个原子术语,涵盖意图优先的领域原语(`intent`、`、`contract`、`effect通用代码结构(`module`、`class`、`method`、`function` 等)和边/关系原语(`edge`、`block_edge`、`data_flow_edge` 等)。与精选术语匹配的概念会被标记为 `cbml3:conceptKind`(`domain-primitive` / `structural-primitive` / `relational-primitive` 之一)以及 `cbml3:broader 链接到每种类型的 `skos:。别名在规范化时会被折叠为规范形式(`behaviour` → `behavior`、`func` → `function`、`params` → `parameter` 等)。
词汇会自动加载;可以通过以下方式选择退出或覆盖:
```bash 默认 — 捆绑的 software_primitives效。
python scripts/run_l3.py --repo //repo --out/out
# 用 覆盖。
python scripts3.py --repoout … --concept my_vocab.yaml
# 完全禁用精选标记(捆绑包类似于 v 之前的版本 scripts/run_l3.py --repo … --out … --no-builtin-vocabMCP 服务器通过_detail`(返回精选概念的 `kind`/`broader`)和 `concept_neighborhood`(接受可选的 `kind` 过滤每个邻居的类型)来显示类型。为SHACL 扩展/稳定性规则和文件映射,请参见 [docs/vocabulary.md](docs/vocabulary.md)。
## LLM 丰富
L4的 LLM 丰富层。它调用本地 Ollama新的 `cbml命名空间中附加 LLM 作者的注释。三种丰富类型:
-ml4:file — 每个源cbm: 的一句摘要。
- `cbml4:conceptDescription` — 每个精选 `skos:Concept` 的一段描述。
- `cbml4:schemaPurpose` — `static/schemas/` 下每个文件的段描述。
每个三元组都带有出处(`cbml4:*Model`、`cbml4:*Prompt、`cbmlAt`),每个输出都在 `~/cbm-ll 中按内容寻 重新发出未更改的存储库是字节相同的(暖缓存确定性)。 无法访问 → 捆绑包地降级为+L2+L3 保持绿色关闭;通过标志默认模型 `q5-coder`([docs/llm-baselinedocs/lleline-results.md)测试获胜者):
```bash
# 安装拉取默认ollama pull q5-coderb
# 旋钮的完整+L2+L4 入口点。
python scripts/run_l4.py --repo/to/repo --tmp/out
# 或_l3/run_xrefs 上选择加入。
python scripts.py --repoout … --llmpython scripts/run.py --repo … -- --llm-en # 意味着 --con# 限制丰富类型(默认为全部三种)。
python scripts/run_l4.py -- --out … ---scope files
python scripts4.py --repoout … --llm,concepts
```
MCP 服务器在 `filem_summary`、`m_schema_purpose_detail.llm 上显示丰富内容,以及 `repository_summary.central_files[*m_summary` 和_summary.key_concepts[*m_description` 短文本。React UI可折叠“AI 丰富片。为 RDF 模式 形状、缓存布局、提示版本控制规则过程和文件映射 [docs/llrich.md](docs/llm-enrich.md)。
## 验证
```bash
pythonverify_roundtrip.py # 基于 blob 的字节完美往返
python tests/verify_regenerate.py # TTL+AST 再生(Python 语义 + TS/JS 字节)
python tests/verify_cpp.py # C++ 分类器/分析器/xref 覆盖 tests/.py 器/x文件覆盖python tests/ygiene.py依赖卫生回归防护
python tests/.py #BE-50 目标账本 vs 探测语言支持
python testsme_coverage # README 语言工具列表 vs 账本/工具(漂)
python tests/_hygiene.py README 免责声明 + 活动 Markdown 本
python tests/verify_excludes.py # 标志 + .ignore 行为
python tests_java.py 分析器/x率
python tests/verify_objc.py -C / Objective-C覆盖率
pythonverify_clojure.py lojure 分析器块器/导入率
python tests/obol.py BOL 分析器/器/xref 覆盖率(固定 + 自由 tests/verify_go.py # Go 分析器/xref 覆盖率
/verify_sql.py 分析器/分块器一率
python tests_html.py #树分析器器/分块器python tests/ # CSS规则分析器器/分块率
python tests/.py # JSON下降 AST 分析器/解析器/分块器python tests/.py # YAML 节点 AST/解析器/器覆盖率
python tests/verify_shell.py # Shell 函数 AST(/quote/comment 安全器/解析器/分块器
python testsphp.py 声明 AST +R-4 ` 解析
python tests_source.py 地路径 + Git 处理
/verify_timestamps # atime/mctime + gitCommitTime
python tests/verify_l2.py --backend hash # chunks_embeddings 契约
python tests/verify_l3.py # 概念图契约 + 跨层
python tests/verify_ast_coverage.py # 每个语言的 AST 提取覆盖率防护
python tests/verify_golden_repo # 多语言端到端
python tests/ # map_code度报告钩子
/verify_dimension # SPDX/ACL 形状 tests/verify_vocab.py # 受控词汇
python tests/verify_vocab_emission.py #词汇 RDF + SHpython tests/verifyiring.py #词汇聚合器
python tests/verify_vocab_pipeline.py #端到端python tests/verifyrich.py L4 向后点(无 L4 与 L4 注册的字节身份)
python tests/verify_llm_enrich_cache.py # L + OllamaClient
python tests/verify_enrich_prom # L4文件 SHA 完整 tests/verify_enrich_file_summary.py # L4 file丰富器(需要)
python tests/verify_enrich_rdf # L4 RDF + SHACL + 侧边栏(需要)
python tests/m_enrich_ # L_description + schema_purpose Ollama)
/verify_llm_enism.py # L4 暖缓存(需要 Ollama tests/verify_llm_enrich_offline.py # Ollama 无法 L4 优雅降级
python testsm_enrich_degradation.py # L4 自我禁用披露(ctx.scratch 中的降级条目)
python tests/verify_llm_enrich_cli.py # L4 CLI 表面(scripts/run_l4 + --llm-enrich 标志)
python tests/verify_llm_enrich_ci_determinism.py # 通过提交的缓存固定进行 L4 暖缓存确定性(无需 Ollama)
python tests/verify_bench_llm_models.py # L4 模型基准测试套件契约
python tests/verify_xrefs.py # 符号交叉引用模式/词汇/侧边栏(第 1 阶段)
python tests/verify_xsd_fixture # static/schemas/覆盖率
python_proto_fixture static/proto/ + 导入覆盖python tests/verify_repository_summary.py # MCP 工具契约
python tests/verify_r.py # Rust 深度 AST 项 + 分块器(第 1 阶段)
python tests/verify_rust_xrefs.py # Rust 文件内/文件间调用边(第 2 python tests/verify_rust_tests_edges.py # Rust 测试边使用分析 + 内联 #[test](第 3 阶段)
python tests/verify_rust_attribute_query.py # Rust 属性查询表面(第 4 阶段)
python tests/verify_rust_super_self.py # Rust self::/super:: 使用路径解析(第 5 阶段)
python tests/verify_rust_regenerate.py # Rust 字节相同再生(第 6 阶段 tests/verify_rust_ast_body_count.py Rust ast_full_bodies 计数器(第 7 阶段)
python tests/verify_shape_coverage.py # 风险漂移 #4/#5 — 发出的 RDF 谓词 ⊆ SHACL 形状
python tests/verify_report_spec.py # 报告契约 — 模式有效,示例文档目录 ↔ 模式枚举
python tests/verify_api_field_parity.py # 后端 Pydantic 模型 ↔ ui/src/api.ts — 字段级一致性(漂移 C1)
python tests/verify_report_predicates.py # 报告/查询的 RDF 谓词 ⊆ 发射(漂移 C3)
python tests/_rs_contract.py # Rust cbm-report键 ⊆ 发射的包工件(漂移 C2)
python tests/verify_requirements_mirror.py # requirements.txt 固定 == pyproject 固定 — 一个已解析的世界(漂移 H8)
python tests/verify_ci_live_bundle.py # CI 不能跳过后端套件并报告绿色(BL-024)
python tests/verify_backend_image.py # 后端镜像复制每个第一方模块 app.py 导入(BL-029)
python tests/verify_docker_deps.py # CLI 镜像安装 CLI 导入的内容 — 无 --no-deps,无影子列表
python tests/verify_cli_layers.py # 已安装的控制台脚本访问已发货的插件(轮子)
python tests/verify_resolver_coverage.py # 每个分析器语言都有一个 ImportResolver — 无导入边丢失
python tests/verify_grammar_disclosure.py # 缺失的 tree-sitter 语法会披露,绝不会静默降级(BL-036)
python tests/verify_make_wiring.py # 磁盘测试/验证器都由 make 目标执行(漂移 H9)
python tests/verify_drift_p1.py # 风险漂移发现 — 端口/环境/响应模型/概念.json/版本
/verify_d2.py # 风险漂移 中等 — README↔验证器,CLI↔README,语言,插件名称,MCP 工具
python tests/verify_drift_p3 # 风险漂移 低 发现 — 引用的防护 + 强化元存在
```
所有验证器都从其自身的 `__file__`repo_root`,因此无论调用者的 cwd 如何,它们都正确运行。
### 文件时间戳
每个 `cbm:File` 携带四个可选的 `xsd:dateTime` 谓词:
| 谓词 | 来源 | 注释 |
|---|---|---|
| `cbm:atime`os.lstat(repo/path).st_atime` | 最后访问 |
cbm:mtime `os.lstat(repo/path).st_mtime` | 最后内容更改 |
| `cbm:ctime` | `os.lstat(repo/path).st_ctime` | inode 更改(Linux)/ 创建(Win) |
| `cbm:gitCommitTime` | 触摸路径的最后提交的作者时间戳 |确定;重命名都会捕获。`os.lstat` 不会ime,因此在未触摸上连续两次会产生字节相同的 `inventory.ttl`(现有的确定性保证 HEAD 映射树可能与映射匹配;在这种系统时间内容,而 `cbm:gitCommitTime映射的提交仍然正确。
## 设计文档设计工作位于 [docs/](docs/)
- [docs/regenerate.md](docs/reg) — 的契约,用于添加到 `_REGENERATORS`。
-analyze.md](docs/analyze.md) —路径、Git、Docker 和包。
- [ocabulary.md](ocabulary.md) — 受控词汇:种类、R谓词、SHACL、扩展规则、文件映射。
- [docs/llm-enrich.md](docs/llm-en) — L4 LLM 丰富层: 谓词、SHACL 形状、提示版本扩展程序、。
- [llm-baseline](docs/-baseline-results 选择 qwen2.5-coder:7b 作为默认模型的 5 模型。
历史实现计划和生成的快照报告docs/archive/](docs/archive/) 下。它们是出处记录,而不是主动。
## 本项目根据 MIT授权 — 请参LICENSE](./LICENSE) 获取全文。`tools/cbm-report` 包在 `Cargo.toml` 中声明相同的许可证。
MCP 配置
以下是此 MCP Server 的配置信息,可直接复制到 Cursor 或其他 MCP 客户端中使用。
mcp.json
连接信息
猜你喜欢
暂无推荐服务器