docs: 更新 AGENTS.md 对齐项目现状 + 新增分阶段实现时间线回溯
- AGENTS.md:命令表/四层架构/文件结构/命令前缀与项目现状对齐(08-26 tests 迁移、compile:test 等) - docs/2026-08-27-implementation-timeline.md:基于 gittea git 全量历史回溯 40 条提交的 Phase 1-6 时间线(北京时间口径) - _AI_USAGE_LOG.md:补充本轮相关日志记录
This commit is contained in:
@@ -37,27 +37,30 @@ VSCode 代码审查与规范检查一体化插件。
|
||||
|
||||
| 命令 | 说明 |
|
||||
|------|------|
|
||||
| `npm run compile` | TypeScript 编译(tsc -p ./) |
|
||||
| `npm run compile` | TypeScript 编译(tsc -p ./)+ 拷贝 webview JS(scripts/copy-webview-js.mjs) |
|
||||
| `npm run compile:test` | 测试编译(tsc -p ./tsconfig.test.json) |
|
||||
| `npm run watch` | tsc watch 模式 |
|
||||
| `npm run lint` | ESLint 检查 `src/` |
|
||||
| `npm test` | 编译 → lint → 运行测试 |
|
||||
| `npm run lint` | ESLint 检查 `src/`(eslint src) |
|
||||
| `npm test` | 测试编译 → 运行测试(compile:test && vscode-test) |
|
||||
| `npm run package-prod` | 生产打包 VSIX(scripts/package-prod.mjs) |
|
||||
| F5 (VSCode) | 启动 Extension Dev Host |
|
||||
|
||||
测试运行器:`@vscode/test-cli`,配置在 `.vscode-test.mjs`,测试文件匹配 `out/test/**/*.test.js`。
|
||||
测试运行器:`@vscode/test-cli`,配置在 `.vscode-test.mjs`,测试文件匹配 `out/tests/**/*.test.js`(测试源码位于根目录 `tests/`)。
|
||||
|
||||
验证顺序:`lint → compile → test`
|
||||
验证顺序:`lint → compile → npm test`(`npm test` 内部执行 `compile:test` + `vscode-test`)。
|
||||
|
||||
## 架构
|
||||
|
||||
三层架构,见 `docs/superpowers/specs/2026-07-10-code-reviewer-design.md`:
|
||||
四层架构,见 `docs/superpowers/specs/2026-07-10-code-reviewer-design.md`:
|
||||
|
||||
```
|
||||
UI 层 — TreeView 面板 / Inline Diagnostic / Code Action
|
||||
核心层 — Linter 管理器 + AI 审查引擎(均实现 Analyzer 接口)
|
||||
基础层 — 配置管理 / 规则管理 / 报告导出
|
||||
UI 层 — Webview 审查/设置面板(src/panel、src/views)+ Inline Diagnostic + Code Action
|
||||
核心层 — Orchestrator(编排器)+ Merger(合并)+ AI 审查引擎(src/ai)
|
||||
适配层 — Linter 适配器(统一 LinterAdapter 接口,src/adapters/adapter.ts)
|
||||
基础层 — 配置管理(src/config)/ 规则管理(src/rules)/ 报告导出(src/utils/report.ts)
|
||||
```
|
||||
|
||||
所有 linter 和 AI 审查器统一实现 `Analyzer` 接口(定义在 `src/analyzers/analyzer.ts`)。
|
||||
所有 linter 统一实现 `LinterAdapter` 接口(定义在 `src/adapters/adapter.ts`),通过 Orchestrator 调度,结果合并后通过 Webview 面板展示。
|
||||
|
||||
## 文件结构
|
||||
|
||||
@@ -65,15 +68,25 @@ UI 层 — TreeView 面板 / Inline Diagnostic / Code Action
|
||||
src/
|
||||
├── extension.ts # 入口:activate/deactivate
|
||||
├── activation/ # 注册命令、视图、CodeAction
|
||||
├── analyzers/ # Analyzer 接口 + 各 linter/AI 实现
|
||||
├── manager/linterManager.ts # Linter 管理器
|
||||
├── views/ # TreeView 提供者
|
||||
├── services/ # AI API、配置服务
|
||||
├── utils/ # 工具函数
|
||||
└── types.ts # 公共类型
|
||||
├── adapters/ # LinterAdapter 接口 + 5 个 linter 适配器(ESLint/Stylelint/SQLFluff/PMD/JSP)
|
||||
├── ai/ # AI 审查引擎 + Provider 框架(providers/)
|
||||
├── orchestrator/ # 编排器:调度适配器、聚合结果
|
||||
├── merger/ # 结果合并(静态诊断 + AI 翻译配对)
|
||||
├── fix/ # 修复链路(fixEngine/aiFixEngine/customFixEngine/fixPreview/fixPending 等)
|
||||
├── rules/ # 规则管理(builtin-rules、转换器/导入/导出/过滤/预览)
|
||||
├── scope/ # 方法级审查(method-extractor、status-cache)
|
||||
├── panel/ # 审查/设置 Webview 面板
|
||||
├── views/ # TreeView/CodeLens Provider + webview JS
|
||||
├── config/ # 配置管理(ai/linter/fixer/secret)
|
||||
├── diagnostics/ # Inline Diagnostic 标记
|
||||
├── i18n/ # 多语言消息
|
||||
├── jsp/ # JSP 源码提取
|
||||
├── services/ # auxClasspath 等辅助服务
|
||||
├── types.ts + types/ # 公共类型
|
||||
└── utils/ # 工具函数
|
||||
```
|
||||
|
||||
命令 ID 前缀统一为 `codeReviewer.`(如 `codeReviewer.analyzeFile`)。
|
||||
命令 ID 前缀统一为 `codeReviewer.`(如 `codeReviewer.review`)。
|
||||
|
||||
## 代码规范
|
||||
|
||||
@@ -87,3 +100,4 @@ src/
|
||||
|
||||
设计 spec 存放路径:`docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
|
||||
编码须严格遵循已批准的 spec,不得自作主张。
|
||||
非 spec 文档(如时间线、复盘类文档)放根目录 `docs/`。
|
||||
|
||||
Reference in New Issue
Block a user