ai-spec-dev 0.33.0 → 0.35.0

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 (50) hide show
  1. package/.claude/commands/add-lesson.md +34 -0
  2. package/.claude/commands/check-layers.md +65 -0
  3. package/.claude/commands/installed-deps.md +35 -0
  4. package/.claude/commands/recall-lessons.md +40 -0
  5. package/.claude/commands/scan-singletons.md +45 -0
  6. package/.claude/commands/verify-imports.md +48 -0
  7. package/.claude/settings.local.json +11 -1
  8. package/README.md +531 -213
  9. package/RELEASE_LOG.md +305 -0
  10. package/cli/commands/create.ts +1233 -0
  11. package/cli/commands/dashboard.ts +62 -0
  12. package/cli/commands/init.ts +45 -8
  13. package/cli/commands/mock.ts +175 -0
  14. package/cli/commands/scan.ts +99 -0
  15. package/cli/commands/types.ts +69 -0
  16. package/cli/commands/vcr.ts +70 -0
  17. package/cli/index.ts +34 -2517
  18. package/core/combined-generator.ts +13 -3
  19. package/core/dashboard-generator.ts +340 -0
  20. package/core/design-dialogue.ts +124 -0
  21. package/core/dsl-feedback.ts +34 -4
  22. package/core/error-feedback.ts +46 -2
  23. package/core/project-index.ts +301 -0
  24. package/core/reviewer.ts +84 -6
  25. package/core/run-logger.ts +109 -3
  26. package/core/run-trend.ts +24 -4
  27. package/core/self-evaluator.ts +39 -11
  28. package/core/spec-generator.ts +14 -8
  29. package/core/task-generator.ts +17 -0
  30. package/core/types-generator.ts +219 -0
  31. package/core/vcr.ts +210 -0
  32. package/dist/cli/index.js +7297 -5640
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/cli/index.mjs +8728 -7071
  35. package/dist/cli/index.mjs.map +1 -1
  36. package/dist/index.d.mts +19 -5
  37. package/dist/index.d.ts +19 -5
  38. package/dist/index.js +420 -224
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mjs +418 -224
  41. package/dist/index.mjs.map +1 -1
  42. package/docs-assets/purpose/architecture-overview.svg +64 -0
  43. package/docs-assets/purpose/create-pipeline.svg +113 -0
  44. package/docs-assets/purpose/task-layering.svg +74 -0
  45. package/package.json +1 -1
  46. package/prompts/codegen.prompt.ts +97 -9
  47. package/prompts/design.prompt.ts +59 -0
  48. package/prompts/spec.prompt.ts +8 -1
  49. package/prompts/tasks.prompt.ts +27 -2
  50. package/purpose.md +600 -174
package/README.md CHANGED
@@ -1,20 +1,25 @@
1
1
  # ai-spec
2
2
 
3
- GitHub: https://github.com/hzhongzhong/ai-spec
3
+ <details open>
4
+ <summary>中文</summary>
5
+
6
+ GitHub: <https://github.com/hzhongzhong/ai-spec>
4
7
 
5
8
  > AI 驱动的功能开发编排工具 — 从一句话需求到可运行代码的完整流水线,支持单 Repo 及多 Repo 跨端联动
6
9
 
7
10
  **单 Repo 模式:**
11
+
8
12
  ```
9
- 需求描述 → 项目宪法 → 项目感知 → Spec+Tasks → 交互式润色(Diff预览) → Spec质量预评估 → Approval Gate → DSL提取+校验 → Git 隔离 → 代码生成(同层并行) → TDD测试(--tdd) / 测试骨架 → 错误反馈自动修复 → 3-pass 代码审查 → 经验积累(宪法§9)
13
+ 需求描述 → 项目宪法 → 项目感知 → Spec+Tasks → 交互式润色(Diff预览) → Spec质量预评估 → Approval Gate → DSL提取+校验 → DSL Gap Feedback(稀疏时定向补全文档) → Git 隔离 → 代码生成(同层并行) → TDD测试(--tdd) / 测试骨架 → 错误反馈自动修复 → 3-pass 代码审查 → Review→DSL Loop(结构性问题反写契约) → Harness Self-Eval → 经验积累(宪法§9)
10
14
  ```
11
15
 
12
16
  **多 Repo 模式(工作区):**
17
+
13
18
  ```
14
19
  一句需求 → AI 拆分职责+UX决策 → [后端流水线 → DSL契约] → [前端流水线(注入后端契约)] → 全链路完成
15
20
  ```
16
21
 
17
- ---
22
+ ***
18
23
 
19
24
  ## 目录
20
25
 
@@ -29,7 +34,7 @@ GitHub: https://github.com/hzhongzhong/ai-spec
29
34
  - [项目结构](#项目结构)
30
35
  - [Release Log](RELEASE_LOG.md)
31
36
 
32
- ---
37
+ ***
33
38
 
34
39
  ## 快速开始
35
40
 
@@ -72,6 +77,9 @@ ai-spec create "给用户模块增加登录功能"
72
77
  Behaviors : 1
73
78
  POST /api/v1/auth/login → 200
74
79
  ...
80
+ [DSL+] DSL Gap feedback... ← DSL 稀疏时出现
81
+ Found gap: missing_errors
82
+ 🔧 Refine spec / ⏭ Skip
75
83
  [4/6] Setting up git worktree...
76
84
  [5/6] ✔ Spec saved : specs/feature-user-login-v1.md (v1)
77
85
  ✔ DSL saved : specs/feature-user-login-v1.dsl.json
@@ -81,11 +89,11 @@ ai-spec create "给用户模块增加登录功能"
81
89
  [████░░░░░░░░░░░░░░░░] 20% → TASK-001 💾 Add schema
82
90
  [████████░░░░░░░░░░░░] 40% → TASK-002 🔧 Service 层
83
91
  ✔ Task-based generation: 8/8 files written across 5 tasks.
84
- [7/9] Test skeleton generation... ← --skip-tests 可跳过
92
+ [7/10] Test skeleton generation... ← --skip-tests 可跳过
85
93
  + tests/auth.test.ts ← --tdd 时改为 TDD 真实断言
86
94
  + tests/auth.service.test.ts
87
95
  ✔ 2 test file(s) generated.
88
- [8/9] Error feedback loop... ← --skip-error-feedback 可跳过
96
+ [8/10] Error feedback loop... ← --skip-error-feedback 可跳过
89
97
  [cycle 1/2] Running tests: npm test
90
98
  ✘ Tests failed (3 error(s) captured)
91
99
  Attempting auto-fix (3 error(s))...
@@ -98,6 +106,15 @@ ai-spec create "给用户模块增加登录功能"
98
106
  Pass 2/3: Implementation review...
99
107
  Pass 3/3: Impact & complexity assessment...
100
108
  🌊 影响等级: 中 🧮 复杂度等级: 低
109
+ [9.5/10] Review → DSL feedback...
110
+ Found 1 structural issue that should be fixed in Spec/DSL
111
+ Suggested next step: ai-spec update "补充错误码与鉴权约束" --codegen
112
+ [10/10] Harness Self-Eval...
113
+ ─── Harness Self-Eval ───────────────────────────
114
+ Score : [████████░░] 7.8/10
115
+ DSL : 8/10 Compile: pass Review: 7.2/10
116
+ Detail : Models: 3/4 (75%) Endpoints: 5 Files: 9
117
+ Prompt : a3f2c1d8
101
118
  ─── Knowledge Memory ─────────────────────────────
102
119
  ✔ 2 lesson(s) appended to constitution (§9).
103
120
  Run ID: 20260326-143022-ab3f in 94.3s · 8 files written
@@ -105,37 +122,38 @@ ai-spec create "给用户模块增加登录功能"
105
122
  To undo changes: ai-spec restore 20260326-143022-ab3f
106
123
  ```
107
124
 
108
- ---
125
+ ***
109
126
 
110
127
  ## 支持的模型
111
128
 
112
- | Provider | 关键词 | API Key 环境变量 | 默认模型 |
113
- |---|---|---|---|
114
- | MiMo (Xiaomi) | `mimo` | `MIMO_API_KEY` | `mimo-v2-pro` |
115
- | Google Gemini | `gemini` | `GEMINI_API_KEY` | `gemini-2.5-pro` |
116
- | Anthropic Claude | `claude` | `ANTHROPIC_API_KEY` | `claude-opus-4-6` |
117
- | OpenAI | `openai` | `OPENAI_API_KEY` | `o3` |
118
- | DeepSeek | `deepseek` | `DEEPSEEK_API_KEY` | `deepseek-chat` |
119
- | 通义千问 | `qwen` | `DASHSCOPE_API_KEY` | `qwen3-235b-a22b` |
120
- | 智谱 GLM | `glm` | `ZHIPU_API_KEY` | `glm-5` |
121
- | MiniMax | `minimax` | `MINIMAX_API_KEY` | `MiniMax-Text-2.7` |
122
- | 豆包 Doubao | `doubao` | `ARK_API_KEY` | `doubao-pro-256k` |
129
+ | Provider | 关键词 | API Key 环境变量 | 默认模型 |
130
+ | ---------------- | ---------- | ------------------- | ------------------ |
131
+ | MiMo (Xiaomi) | `mimo` | `MIMO_API_KEY` | `mimo-v2-pro` |
132
+ | Google Gemini | `gemini` | `GEMINI_API_KEY` | `gemini-2.5-pro` |
133
+ | Anthropic Claude | `claude` | `ANTHROPIC_API_KEY` | `claude-opus-4-6` |
134
+ | OpenAI | `openai` | `OPENAI_API_KEY` | `o3` |
135
+ | DeepSeek | `deepseek` | `DEEPSEEK_API_KEY` | `deepseek-chat` |
136
+ | 通义千问 | `qwen` | `DASHSCOPE_API_KEY` | `qwen3-235b-a22b` |
137
+ | 智谱 GLM | `glm` | `ZHIPU_API_KEY` | `glm-5` |
138
+ | MiniMax | `minimax` | `MINIMAX_API_KEY` | `MiniMax-Text-2.7` |
139
+ | 豆包 Doubao | `doubao` | `ARK_API_KEY` | `doubao-pro-256k` |
123
140
 
124
141
  **各 provider 可用模型:**
125
142
 
126
- | Provider | 模型列表 |
127
- |---|---|
128
- | mimo | `mimo-v2-pro` |
129
- | gemini | `gemini-2.5-pro` · `gemini-2.5-flash` · `gemini-2.0-flash` · `gemini-2.0-flash-lite` · `gemini-1.5-pro` |
130
- | claude | `claude-opus-4-6` · `claude-sonnet-4-6` · `claude-haiku-4-5` · `claude-3-7-sonnet-20250219` |
131
- | openai | `o3` · `o3-mini` · `o1` · `o1-mini` · `gpt-4o` · `gpt-4o-mini` |
132
- | deepseek | `deepseek-chat`(V3)· `deepseek-reasoner`(R1) |
133
- | qwen | `qwen3-235b-a22b` · `qwen3-72b` · `qwen3-32b` · `qwen3-8b` · `qwen-max` · `qwen-plus` |
134
- | glm | `glm-5` · `glm-5-flash` · `glm-z1`(推理)· `glm-z1-flash` · `glm-4-plus` · `glm-4-flash` |
135
- | minimax | `MiniMax-Text-2.7` · `MiniMax-Text-01` · `abab6.5s-chat` |
136
- | doubao | `doubao-pro-256k` · `doubao-pro-128k` · `doubao-pro-32k` · `doubao-lite-128k` |
143
+ | Provider | 模型列表 |
144
+ | -------- | ------------------------------------------------------------------------------------------------------- |
145
+ | mimo | `mimo-v2-pro` |
146
+ | gemini | `gemini-2.5-pro` · `gemini-2.5-flash` · `gemini-2.0-flash` · `gemini-2.0-flash-lite` · `gemini-1.5-pro` |
147
+ | claude | `claude-opus-4-6` · `claude-sonnet-4-6` · `claude-haiku-4-5` · `claude-3-7-sonnet-20250219` |
148
+ | openai | `o3` · `o3-mini` · `o1` · `o1-mini` · `gpt-4o` · `gpt-4o-mini` |
149
+ | deepseek | `deepseek-chat`(V3)· `deepseek-reasoner`(R1) |
150
+ | qwen | `qwen3-235b-a22b` · `qwen3-72b` · `qwen3-32b` · `qwen3-8b` · `qwen-max` · `qwen-plus` |
151
+ | glm | `glm-5` · `glm-5-flash` · `glm-z1`(推理)· `glm-z1-flash` · `glm-4-plus` · `glm-4-flash` |
152
+ | minimax | `MiniMax-Text-2.7` · `MiniMax-Text-01` · `abab6.5s-chat` |
153
+ | doubao | `doubao-pro-256k` · `doubao-pro-128k` · `doubao-pro-32k` · `doubao-lite-128k` |
137
154
 
138
155
  > **兼容说明:**
156
+ >
139
157
  > - MiMo:Anthropic messages 格式,自定义 `api-key` 鉴权头(非标准 Bearer),通过 axios 直接调用
140
158
  > - DeepSeek / Qwen / GLM / MiniMax / Doubao:OpenAI 兼容接口
141
159
  > - OpenAI o1/o3:自动切换为 `developer` role(不使用 `system`)
@@ -147,7 +165,7 @@ ai-spec create "给用户模块增加登录功能"
147
165
  ai-spec model --list
148
166
  ```
149
167
 
150
- ---
168
+ ***
151
169
 
152
170
  ## 命令总览
153
171
 
@@ -158,7 +176,9 @@ ai-spec create [idea] 完整工作流:宪法 → context → spec → ta
158
176
  ai-spec update [change] 增量更新:修改现有 Spec → 重提取 DSL → 识别受影响文件 → 可选重新生成代码
159
177
  ai-spec learn [lesson] 零摩擦知识注入:直接将工程决策或教训写入宪法 §9(无需运行 review)
160
178
  ai-spec export DSL → OpenAPI 3.1.0 YAML/JSON(可导入 Postman / Swagger UI / openapi-generator)
179
+ ai-spec types DSL → TypeScript 类型文件(models / endpoint request types / API_ENDPOINTS 常量)
161
180
  ai-spec mock 从 DSL 生成 Mock Server / 前端 Proxy 配置 / MSW Handlers(联调利器)
181
+ ai-spec dashboard 生成静态 HTML Harness Dashboard(评分趋势 / prompt 版本对比 / 阶段耗时 / 错误统计)
162
182
  ai-spec review [file] 对当前 git diff 运行 3-pass AI 代码审查(架构层 + 实现层 + 影响面/复杂度),并打印评分趋势
163
183
  ai-spec restore <runId> 回滚指定 run 修改的所有文件至原始状态(配合 Run ID 使用)
164
184
  ai-spec model 交互式切换 AI provider / model,写入 .ai-spec.json
@@ -222,6 +242,7 @@ ai-spec create # 省略 idea 时交互式询问
222
242
  ```
223
243
 
224
244
  > **Worktree 自动策略:**
245
+ >
225
246
  > - 后端项目(Node.js / Go / PHP 等):默认创建 worktree 隔离分支
226
247
  > - 前端项目(React / Vue / Next / React-Native):**自动跳过 worktree**,直接在当前仓库生成代码
227
248
  > - 原因:worktree 不含 `node_modules`,前端 dev server 无法启动
@@ -257,8 +278,9 @@ ai-spec config --reset # 清空配置文件
257
278
  ```
258
279
 
259
280
  > **Spec 质量门槛(minSpecScore)**
281
+ >
260
282
  > - 设置后,`create` 在 Approval Gate 前会运行质量评估,`overallScore` 低于阈值时阻断流程
261
- > - **`--auto` 模式同样生效**:CI 环境中配置了门槛则强制执行,避免低质量 Spec 静默通过
283
+ > - **`--auto`** **模式同样生效**:CI 环境中配置了门槛则强制执行,避免低质量 Spec 静默通过
262
284
  > - `--force` 可临时绕过(输出黄色警告)
263
285
  > - 未配置(默认 0)时评估仅为建议性,不阻断
264
286
 
@@ -315,7 +337,7 @@ ai-spec mock --serve --frontend <path> # 生成后直接启动 Mock 服
315
337
  ai-spec mock --restore --frontend <path> # 撤销 Proxy patch,停止 Mock 服务器
316
338
  ```
317
339
 
318
- ---
340
+ ***
319
341
 
320
342
  ## 命令详解
321
343
 
@@ -354,15 +376,15 @@ ai-spec init --force
354
376
 
355
377
  **选项:**
356
378
 
357
- | 选项 | 说明 |
358
- |---|---|
359
- | `--provider <name>` | 使用的 AI provider |
360
- | `--model <name>` | 使用的模型 |
361
- | `-k, --key <key>` | API Key |
362
- | `--force` | 覆盖已有宪法文件 |
363
- | `--global` | 生成团队级全局宪法(`.ai-spec-global-constitution.md`)而非项目宪法 |
364
- | `--consolidate` | 整合宪法:将 §9 提炼归并到 §1–§8,清理冗余 |
365
- | `--dry-run` | 配合 `--consolidate`:预览不写入 |
379
+ | 选项 | 说明 |
380
+ | ------------------- | -------------------------------------------------- |
381
+ | `--provider <name>` | 使用的 AI provider |
382
+ | `--model <name>` | 使用的模型 |
383
+ | `-k, --key <key>` | API Key |
384
+ | `--force` | 覆盖已有宪法文件 |
385
+ | `--global` | 生成团队级全局宪法(`.ai-spec-global-constitution.md`)而非项目宪法 |
386
+ | `--consolidate` | 整合宪法:将 §9 提炼归并到 §1–§8,清理冗余 |
387
+ | `--dry-run` | 配合 `--consolidate`:预览不写入 |
366
388
 
367
389
  > **全局宪法 vs 项目宪法**:全局宪法定义团队通用规范(错误码体系、认证模式、日志格式);项目宪法定义本项目特有规范(数据模型、路由前缀、特定限制)。运行时自动合并,项目宪法优先。
368
390
 
@@ -381,13 +403,14 @@ ai-spec init --consolidate
381
403
  ```
382
404
 
383
405
  整合过程:
406
+
384
407
  1. AI 逐条审阅 §9,决定每条教训的去向:**LIFT**(提升至 §1–§8)/ **KEEP**(保留,最多 5 条)/ **DROP**(删除重复/已失效)
385
408
  2. 展示彩色 diff,显示前后对比
386
409
  3. 自动创建备份(`.ai-spec-constitution.backup-YYYY-MM-DD-HH-MM-SS.md`)后写入
387
410
 
388
411
  典型效果:§9 从 14 条压缩到 4 条,宪法总行数减少 10–20%,核心章节获得新的精确规则。
389
412
 
390
- ---
413
+ ***
391
414
 
392
415
  ### `ai-spec create [idea]`
393
416
 
@@ -419,36 +442,36 @@ ai-spec create "小功能" --skip-tasks
419
442
 
420
443
  **完整选项:**
421
444
 
422
- | 选项 | 说明 | 默认值 |
423
- |---|---|---|
424
- | `--provider <name>` | Spec 生成使用的 provider | `gemini` |
425
- | `--model <name>` | Spec 生成使用的模型 | provider 默认模型 |
426
- | `-k, --key <key>` | API Key(优先级高于环境变量) | — |
427
- | `--codegen <mode>` | 代码生成模式:`claude-code` / `api` / `plan` | `claude-code` |
428
- | `--codegen-provider <name>` | 代码生成使用的 provider | 同 `--provider` |
429
- | `--codegen-model <name>` | 代码生成使用的模型 | — |
430
- | `--codegen-key <key>` | 代码生成的 API Key | — |
431
- | `--skip-worktree` | 跳过 git worktree 创建 | — |
432
- | `--skip-review` | 跳过最终代码审查 | — |
433
- | `--skip-tasks` | 跳过 Tasks 分解(只生成 Spec) | — |
434
- | `--auto` | 非交互模式:用 `claude -p` 执行,同时跳过 Approval Gate(节省 token) | — |
435
- | `--fast` | 跳过交互式 Spec 润色,直接进入代码生成(适合全自动流水线) | — |
436
- | `--resume` | 续跑模式:跳过 tasks.json 中已标记为 `done` 的任务 | — |
437
- | `--skip-dsl` | 跳过 DSL 提取步骤(适合简单功能或快速迭代) | — |
438
- | `--skip-tests` | 跳过测试骨架生成(需要 DSL;`--skip-dsl` 时自动跳过) | — |
439
- | `--skip-error-feedback` | 跳过错误反馈自动修复循环 | — |
440
- | `--tdd` | TDD 模式:代码生成前先写含真实断言的测试,error feedback loop 驱动实现让测试通过(最多 3 轮)。仅支持后端项目 | — |
441
- | `--skip-assessment` | 跳过 Approval Gate 前的 Spec 质量预评估(节省一次 AI 调用) | — |
442
-
443
- **`--codegen` 三种模式:**
444
-
445
- | 模式 | 说明 |
446
- |---|---|
445
+ | 选项 | 说明 | 默认值 |
446
+ | --------------------------- | -------------------------------------------------------------------- | -------------- |
447
+ | `--provider <name>` | Spec 生成使用的 provider | `gemini` |
448
+ | `--model <name>` | Spec 生成使用的模型 | provider 默认模型 |
449
+ | `-k, --key <key>` | API Key(优先级高于环境变量) | — |
450
+ | `--codegen <mode>` | 代码生成模式:`claude-code` / `api` / `plan` | `claude-code` |
451
+ | `--codegen-provider <name>` | 代码生成使用的 provider | 同 `--provider` |
452
+ | `--codegen-model <name>` | 代码生成使用的模型 | — |
453
+ | `--codegen-key <key>` | 代码生成的 API Key | — |
454
+ | `--skip-worktree` | 跳过 git worktree 创建 | — |
455
+ | `--skip-review` | 跳过最终代码审查 | — |
456
+ | `--skip-tasks` | 跳过 Tasks 分解(只生成 Spec) | — |
457
+ | `--auto` | 非交互模式:用 `claude -p` 执行,同时跳过 Approval Gate(节省 token) | — |
458
+ | `--fast` | 跳过交互式 Spec 润色,直接进入代码生成(适合全自动流水线) | — |
459
+ | `--resume` | 续跑模式:跳过 tasks.json 中已标记为 `done` 的任务 | — |
460
+ | `--skip-dsl` | 跳过 DSL 提取步骤(适合简单功能或快速迭代) | — |
461
+ | `--skip-tests` | 跳过测试骨架生成(需要 DSL;`--skip-dsl` 时自动跳过) | — |
462
+ | `--skip-error-feedback` | 跳过错误反馈自动修复循环 | — |
463
+ | `--tdd` | TDD 模式:代码生成前先写含真实断言的测试,error feedback loop 驱动实现让测试通过(最多 3 轮)。仅支持后端项目 | — |
464
+ | `--skip-assessment` | 跳过 Approval Gate 前的 Spec 质量预评估(节省一次 AI 调用) | — |
465
+
466
+ **`--codegen`** **三种模式:**
467
+
468
+ | 模式 | 说明 |
469
+ | ------------- | ---------------------------------------------------------------------------- |
447
470
  | `claude-code` | 启动 Claude Code CLI。`--auto` 时改为逐 task 运行 `claude -p`(增量执行,失败可 `--resume` 续跑) |
448
- | `api` | 调用 AI API 自动规划文件并逐文件生成。有 Tasks 文件时按 task 顺序生成,支持 `--resume` 续跑 |
449
- | `plan` | 仅输出实施方案,不写任何代码 |
471
+ | `api` | 调用 AI API 自动规划文件并逐文件生成。有 Tasks 文件时按 task 顺序生成,支持 `--resume` 续跑 |
472
+ | `plan` | 仅输出实施方案,不写任何代码 |
450
473
 
451
- ---
474
+ ***
452
475
 
453
476
  ### `ai-spec review [specFile]`
454
477
 
@@ -495,7 +518,7 @@ ai-spec review --provider glm --model glm-5
495
518
 
496
519
  > 提示:先执行 `git add .` 再运行 `ai-spec review`,确保所有变更都被纳入审查。
497
520
 
498
- ---
521
+ ***
499
522
 
500
523
  ### `ai-spec model`
501
524
 
@@ -509,7 +532,7 @@ ai-spec model
509
532
  ai-spec model --list
510
533
  ```
511
534
 
512
- ---
535
+ ***
513
536
 
514
537
  ### `ai-spec config`
515
538
 
@@ -522,17 +545,17 @@ ai-spec config --codegen-provider glm --codegen-model glm-5
522
545
  ai-spec config --reset
523
546
  ```
524
547
 
525
- | 选项 | 说明 |
526
- |---|---|
527
- | `--provider <name>` | 默认 spec provider |
528
- | `--model <name>` | 默认 spec model |
529
- | `--codegen <mode>` | 默认代码生成模式 |
548
+ | 选项 | 说明 |
549
+ | --------------------------- | ------------------- |
550
+ | `--provider <name>` | 默认 spec provider |
551
+ | `--model <name>` | 默认 spec model |
552
+ | `--codegen <mode>` | 默认代码生成模式 |
530
553
  | `--codegen-provider <name>` | 默认 codegen provider |
531
- | `--codegen-model <name>` | 默认 codegen model |
532
- | `--show` | 打印当前配置 |
533
- | `--reset` | 清空配置文件 |
554
+ | `--codegen-model <name>` | 默认 codegen model |
555
+ | `--show` | 打印当前配置 |
556
+ | `--reset` | 清空配置文件 |
534
557
 
535
- ---
558
+ ***
536
559
 
537
560
  ### `ai-spec workspace`
538
561
 
@@ -549,7 +572,7 @@ ai-spec workspace init
549
572
  ai-spec workspace status
550
573
  ```
551
574
 
552
- **`workspace init` 输出示例:**
575
+ **`workspace init`** **输出示例:**
553
576
 
554
577
  ```
555
578
  ✔ Detected 2 repos:
@@ -572,12 +595,12 @@ ai-spec workspace status
572
595
 
573
596
  初始化完成后,在同一目录运行 `ai-spec create` 会自动进入**多 Repo 联动模式**(参见[多 Repo 工作区模式](#多-repo-工作区模式))。
574
597
 
575
- | 选项 | 说明 |
576
- |---|---|
577
- | `--name <name>` | 工作区名称(默认取父目录名) |
598
+ | 选项 | 说明 |
599
+ | --------------- | -------------------------------------------------------------------------------------------------------- |
600
+ | `--name <name>` | 工作区名称(默认取父目录名) |
578
601
  | `--repos <a,b>` | 只纳入指定目录(逗号分隔),不指定则自动扫描所有含 `package.json` / `go.mod` / `Cargo.toml` / `pom.xml` / `requirements.txt` 的子目录 |
579
602
 
580
- ---
603
+ ***
581
604
 
582
605
  ### `ai-spec update [change]`
583
606
 
@@ -613,20 +636,21 @@ ai-spec update "修复描述文字" --skip-affected
613
636
  → --codegen 时自动重新生成这些文件
614
637
  ```
615
638
 
616
- | 选项 | 说明 |
617
- |---|---|
618
- | `--codegen` | 识别受影响文件后自动重新生成 |
619
- | `--spec <path>` | 指定要更新的 Spec 文件(默认自动找最新) |
620
- | `--skip-affected` | 跳过受影响文件识别 |
621
- | `--provider <name>` | Spec 更新使用的 provider |
622
- | `--codegen-provider <name>` | 代码生成使用的 provider |
639
+ | 选项 | 说明 |
640
+ | --------------------------- | ----------------------- |
641
+ | `--codegen` | 识别受影响文件后自动重新生成 |
642
+ | `--spec <path>` | 指定要更新的 Spec 文件(默认自动找最新) |
643
+ | `--skip-affected` | 跳过受影响文件识别 |
644
+ | `--provider <name>` | Spec 更新使用的 provider |
645
+ | `--codegen-provider <name>` | 代码生成使用的 provider |
623
646
 
624
- > **`--codegen` 附带行为(v0.29.0+)**:
647
+ > **`--codegen`** **附带行为(v0.29.0+)**:
648
+ >
625
649
  > - 每次 update 自动生成独立 Run ID,运行摘要(耗时、写入文件数)在结束时打印
626
650
  > - 写每个受影响文件前先快照原始内容(`.ai-spec-backup/<runId>/`),可用 `ai-spec restore <runId>` 精确回滚
627
651
  > - 完成后自动对更新后的 Spec 运行代码审查,结论写入宪法 §9(与 `create` 的知识积累机制一致)
628
652
 
629
- ---
653
+ ***
630
654
 
631
655
  ### `ai-spec export`
632
656
 
@@ -666,14 +690,14 @@ openapi-generator generate -i openapi.yaml -g go -o sdk/go/
666
690
  npx @stoplight/prism-cli mock openapi.yaml
667
691
  ```
668
692
 
669
- | 选项 | 说明 |
670
- |---|---|
671
- | `--format yaml\|json` | 输出格式(默认 yaml) |
672
- | `--server <url>` | OpenAPI servers[0].url(默认 http://localhost:3000 |
673
- | `--output <path>` | 输出文件路径(默认 openapi.yaml) |
674
- | `--dsl <path>` | 指定 DSL 文件(默认自动寻找最新) |
693
+ | 选项 | 说明 |
694
+ | --------------------- | --------------------------------------------------- |
695
+ | `--format yaml\|json` | 输出格式(默认 yaml) |
696
+ | `--server <url>` | OpenAPI servers\[0].url(默认 <http://localhost:3000)> |
697
+ | `--output <path>` | 输出文件路径(默认 openapi.yaml) |
698
+ | `--dsl <path>` | 指定 DSL 文件(默认自动寻找最新) |
675
699
 
676
- ---
700
+ ***
677
701
 
678
702
  ### `ai-spec mock`
679
703
 
@@ -703,9 +727,10 @@ ai-spec mock --serve --frontend ../my-frontend
703
727
  ai-spec mock --restore --frontend ../my-frontend
704
728
  ```
705
729
 
706
- **`--serve` 详解:**
730
+ **`--serve`** **详解:**
707
731
 
708
732
  `--serve` 做以下三件事:
733
+
709
734
  1. 在后台启动 `node mock/server.js`(PID 记录在 `.ai-spec-mock.lock.json`)
710
735
  2. 根据前端框架自动 patch Proxy 配置:
711
736
  - **Vite**:生成 `vite.config.ai-spec-mock.ts`(mergeConfig 方式,非破坏性),在 `package.json` 添加 `dev:mock` 脚本
@@ -717,17 +742,17 @@ ai-spec mock --restore --frontend ../my-frontend
717
742
 
718
743
  **生成的文件:**
719
744
 
720
- | 文件 | 说明 |
721
- |---|---|
722
- | `mock/server.js` | 独立 Express Mock 服务器,每个 DSL 端点对应一个路由,返回 fixture 数据 |
723
- | `mock/README.md` | 启动指南和端点表 |
724
- | `mock/proxy.vite.comment.txt` | Vite proxy 配置片段(检测到 vite.config.* 时生成) |
725
- | `mock/proxy.next.comment.txt` | Next.js rewrites 配置片段(检测到 next.config.* 时生成) |
726
- | `mock/proxy.webpack.comment.txt` | webpack devServer.proxy 配置片段(默认 fallback) |
727
- | `src/mocks/handlers.ts` | MSW 请求拦截 handlers(`--msw`) |
728
- | `src/mocks/browser.ts` | MSW browser worker 初始化(`--msw`) |
729
- | `vite.config.ai-spec-mock.ts` | 前端临时 Vite 配置(`--serve`,非破坏性,`--restore` 后删除) |
730
- | `.ai-spec-mock.lock.json` | Proxy patch 记录 + Mock 服务器 PID(`--restore` 后删除) |
745
+ | 文件 | 说明 |
746
+ | -------------------------------- | ------------------------------------------------- |
747
+ | `mock/server.js` | 独立 Express Mock 服务器,每个 DSL 端点对应一个路由,返回 fixture 数据 |
748
+ | `mock/README.md` | 启动指南和端点表 |
749
+ | `mock/proxy.vite.comment.txt` | Vite proxy 配置片段(检测到 vite.config.\* 时生成) |
750
+ | `mock/proxy.next.comment.txt` | Next.js rewrites 配置片段(检测到 next.config.\* 时生成) |
751
+ | `mock/proxy.webpack.comment.txt` | webpack devServer.proxy 配置片段(默认 fallback) |
752
+ | `src/mocks/handlers.ts` | MSW 请求拦截 handlers(`--msw`) |
753
+ | `src/mocks/browser.ts` | MSW browser worker 初始化(`--msw`) |
754
+ | `vite.config.ai-spec-mock.ts` | 前端临时 Vite 配置(`--serve`,非破坏性,`--restore` 后删除) |
755
+ | `.ai-spec-mock.lock.json` | Proxy patch 记录 + Mock 服务器 PID(`--restore` 后删除) |
731
756
 
732
757
  **Mock Server 特性:**
733
758
 
@@ -775,7 +800,7 @@ ai-spec create "用户登录功能" --serve
775
800
  # 完成后自动:生成 Mock → 启动服务器 → patch 前端 Proxy → 打印 dev 命令
776
801
  ```
777
802
 
778
- ---
803
+ ***
779
804
 
780
805
  ## 工作流详解
781
806
 
@@ -800,13 +825,13 @@ ai-spec create "用户登录功能" --serve
800
825
 
801
826
  ContextLoader 会自动扫描以下类别的"单例配置文件",并将其路径和内容片段注入所有 Spec/Codegen prompt:
802
827
 
803
- | 类别 | 扫描路径 |
804
- |---|---|
805
- | i18n | `src/locales/**`, `src/i18n/**`, `locales/**`, `public/locales/**` |
806
- | constants | `src/constants/**`, `src/**/constants.{ts,js}` |
807
- | enums | `src/enums/**`, `src/**/enums.{ts,js}` |
808
- | config | `src/config/**` |
809
- | route-index | `src/routes/**/index.{ts,js}`, `src/router/index.{ts,js}` |
828
+ | 类别 | 扫描路径 |
829
+ | ----------- | ------------------------------------------------------------------ |
830
+ | i18n | `src/locales/**`, `src/i18n/**`, `locales/**`, `public/locales/**` |
831
+ | constants | `src/constants/**`, `src/**/constants.{ts,js}` |
832
+ | enums | `src/enums/**`, `src/**/enums.{ts,js}` |
833
+ | config | `src/config/**` |
834
+ | route-index | `src/routes/**/index.{ts,js}`, `src/router/index.{ts,js}` |
810
835
 
811
836
  这些文件会被标记为 **Append-Only**,AI 在规划阶段会收到明确指令:
812
837
 
@@ -814,7 +839,7 @@ ContextLoader 会自动扫描以下类别的"单例配置文件",并将其路
814
839
 
815
840
  **项目宪法 §8** 也会自动记录这些文件路径,确保 `ai-spec init --force` 重跑后约束持久化。
816
841
 
817
- ---
842
+ ***
818
843
 
819
844
  ### Step 2 — Spec 生成 + Tasks 分解
820
845
 
@@ -860,7 +885,7 @@ Spec 保存后自动生成 `specs/feature-xxx-tasks.json`,包含按实施层
860
885
 
861
886
  代码生成时(`api` 模式)如果检测到 Tasks 文件,自动切换为 **task-by-task 模式**,逐任务生成代码,精度更高。
862
887
 
863
- ---
888
+ ***
864
889
 
865
890
  ### Step 3 — 交互式 Spec 润色
866
891
 
@@ -887,7 +912,7 @@ Spec 保存后自动生成 `specs/feature-xxx-tasks.json`,包含按实施层
887
912
  ────────────────────────────────────────────
888
913
  ```
889
914
 
890
- ---
915
+ ***
891
916
 
892
917
  ### Step 3.4 — Spec 质量预评估
893
918
 
@@ -895,11 +920,11 @@ Approval Gate 之前,系统对 Spec 进行一次 AI 质量检查,给出**建
895
920
 
896
921
  **三个评分维度(0-10):**
897
922
 
898
- | 维度 | 衡量内容 |
899
- |---|---|
900
- | **Coverage(覆盖度)** | 错误处理、边界条件、auth 规则是否都有描述? |
901
- | **Clarity(清晰度)** | API 契约是否清晰到可以可靠提取 DSL?response 结构是否明确? |
902
- | **Constitution(一致性)** | 是否与项目宪法保持一致?命名、错误码、约定有没有冲突? |
923
+ | 维度 | 衡量内容 |
924
+ | --------------------- | -------------------------------------- |
925
+ | **Coverage(覆盖度)** | 错误处理、边界条件、auth 规则是否都有描述? |
926
+ | **Clarity(清晰度)** | API 契约是否清晰到可以可靠提取 DSL?response 结构是否明确? |
927
+ | **Constitution(一致性)** | 是否与项目宪法保持一致?命名、错误码、约定有没有冲突? |
903
928
 
904
929
  ```
905
930
  [3.4/6] Spec quality assessment...
@@ -925,7 +950,7 @@ Approval Gate 之前,系统对 Spec 进行一次 AI 质量检查,给出**建
925
950
  - **DSL 可提取性预警**:Clarity < 6 且无结构化 API 章节时,提示 DSL 提取可能不准确
926
951
  - `--skip-assessment` 跳过此步骤(节省一次 AI 调用);`--auto` 模式下自动跳过
927
952
 
928
- ---
953
+ ***
929
954
 
930
955
  ### Step 3.5 — Approval Gate(人工确认)
931
956
 
@@ -955,7 +980,7 @@ Approval Gate 之前,系统对 Spec 进行一次 AI 质量检查,给出**建
955
980
 
956
981
  > `--auto` 模式自动选 Proceed,跳过此步骤。
957
982
 
958
- ---
983
+ ***
959
984
 
960
985
  ### Step DSL — DSL 提取与校验
961
986
 
@@ -1012,12 +1037,12 @@ Approval Gate 通过后,系统自动将 Spec Markdown 转换为 **结构化 JS
1012
1037
 
1013
1038
  系统根据项目的 `package.json` 依赖自动检测是否为前端项目(`react` / `vue` / `next` / `react-native` / `expo`),并切换到对应的 DSL 提取策略:
1014
1039
 
1015
- | 项目类型 | DSL 输出重心 |
1016
- |---|---|
1017
- | 后端(Node/Express/Prisma)| `endpoints[]` + `models[]` + `behaviors[]` |
1018
- | 前端(React/Vue/Next)| `endpoints[]`(本前端调用的接口)+ `components[]`(ComponentSpec) |
1040
+ | 项目类型 | DSL 输出重心 |
1041
+ | ----------------------- | ------------------------------------------------------ |
1042
+ | 后端(Node/Express/Prisma | `endpoints[]` + `models[]` + `behaviors[]` |
1043
+ | 前端(React/Vue/Next) | `endpoints[]`(本前端调用的接口)+ `components[]`(ComponentSpec) |
1019
1044
 
1020
- **`ComponentSpec` 结构(前端专属):**
1045
+ **`ComponentSpec`** **结构(前端专属):**
1021
1046
 
1022
1047
  ```json
1023
1048
  {
@@ -1041,9 +1066,34 @@ Approval Gate 通过后,系统自动将 Spec Markdown 转换为 **结构化 JS
1041
1066
 
1042
1067
  **用于 codegen:** DSL(含 `components[]`)被转换为紧凑文本摘要注入 codegen prompt,提供精确的组件接口定义和端点签名。
1043
1068
 
1069
+ **用于下游产物:**
1070
+
1071
+ - `ai-spec types`:DSL → TypeScript 类型文件(models、endpoint request types、`API_ENDPOINTS` 常量)
1072
+ - `ai-spec export`:DSL → OpenAPI
1073
+ - `ai-spec mock`:DSL → Mock Server / MSW / Proxy
1074
+ - 工作区模式:后端 DSL 契约可直接注入前端流水线
1075
+
1076
+ ### Step DSL+ — DSL Gap Feedback
1077
+
1078
+ DSL 校验通过后,系统还会做一次**纯启发式的丰富度检查**,判断当前 DSL 是否“合法但过于稀疏”。
1079
+
1080
+ 当前会检测几类典型缺口:
1081
+
1082
+ - 没有 models 也没有 endpoints
1083
+ - endpoint 描述过于泛化
1084
+ - 多个 endpoint 全部没有 `errors`
1085
+ - model 只有极少字段
1086
+
1087
+ 交互模式下,如果检测到缺口,会给出两个选择:
1088
+
1089
+ - `🔧 Refine spec`:AI 定向补全 Spec 中缺失的结构细节,然后自动重新提取 DSL
1090
+ - `⏭ Skip`:保留当前 DSL,继续后续流水线
1091
+
1092
+ > 这个反馈环只在 DSL 提取完成后、进入 worktree 之前运行;`--auto`、`--fast`、`--skip-dsl` 下会跳过。
1093
+
1044
1094
  > `--skip-dsl` 跳过此步骤,`--auto` 模式下提取失败时自动跳过(不中断流水线)。
1045
1095
 
1046
- ---
1096
+ ***
1047
1097
 
1048
1098
  ### Step 4 — Git Worktree(隔离工作区)
1049
1099
 
@@ -1056,7 +1106,7 @@ worktree: ~/code/my-app-add-user-login/ ← 独立分支 feature/add-user-logi
1056
1106
  - 不是 git 仓库时跳过,在原目录继续
1057
1107
  - `--skip-worktree` 强制跳过
1058
1108
 
1059
- ---
1109
+ ***
1060
1110
 
1061
1111
  ### Step 5 — 代码生成(增量 · 断点续传)
1062
1112
 
@@ -1070,10 +1120,10 @@ specs/
1070
1120
  └── feature-user-login-v2-tasks.json
1071
1121
  ```
1072
1122
 
1073
- **`claude-code` 模式(默认)**
1123
+ **`claude-code`** **模式(默认)**
1074
1124
 
1075
1125
  - **交互模式**(默认):在 worktree 目录启动 Claude Code CLI,有 Tasks 文件时将任务列表注入 `.claude-prompt.txt`
1076
- - **`--auto` 增量模式**:改为对每个 task 单独运行 `claude -p`,每个 task 完成后写入 checkpoint,进度实时显示:
1126
+ - **`--auto`** **增量模式**:改为对每个 task 单独运行 `claude -p`,每个 task 完成后写入 checkpoint,进度实时显示:
1077
1127
 
1078
1128
  ```
1079
1129
  [████░░░░░░░░░░░░░░░░] 20% → TASK-001 💾 Add UserFavorite Prisma model
@@ -1084,7 +1134,7 @@ specs/
1084
1134
 
1085
1135
  检测到 `rtk` 已安装时自动切换为 `rtk claude` 执行。
1086
1136
 
1087
- **`api` 模式**
1137
+ **`api`** **模式**
1088
1138
 
1089
1139
  有 Tasks 文件时按 task 顺序生成,每个 task 单独 AI 调用:
1090
1140
 
@@ -1112,17 +1162,17 @@ ai-spec create "用户收藏功能" --auto
1112
1162
  ai-spec create "用户收藏功能" --auto --resume
1113
1163
  ```
1114
1164
 
1115
- **`plan` 模式**
1165
+ **`plan`** **模式**
1116
1166
 
1117
1167
  仅输出实施方案,不写入任何文件。
1118
1168
 
1119
- ---
1169
+ ***
1120
1170
 
1121
1171
  ### Step 7 — 测试生成
1122
1172
 
1123
1173
  测试生成有两种模式:**普通骨架模式**(默认)和 **TDD 模式**(`--tdd`)。
1124
1174
 
1125
- ---
1175
+ ***
1126
1176
 
1127
1177
  #### 普通骨架模式(默认)
1128
1178
 
@@ -1146,7 +1196,7 @@ ai-spec create "用户收藏功能" --auto --resume
1146
1196
  > 测试骨架只生成 `describe/it` 结构,不实现断言(用 TODO 注释标出),供开发者补全。
1147
1197
  > `--skip-tests` 跳过此步骤;`--skip-dsl` 时自动跳过。
1148
1198
 
1149
- ---
1199
+ ***
1150
1200
 
1151
1201
  #### TDD 模式(`--tdd`)
1152
1202
 
@@ -1195,11 +1245,12 @@ ai-spec create "任务管理功能" --tdd --codegen api
1195
1245
  ```
1196
1246
 
1197
1247
  **注意事项:**
1248
+
1198
1249
  - 仅支持**后端项目**(使用 supertest 做 HTTP 集成测试)
1199
1250
  - 依赖 DSL 提取成功(Spec 需要有清晰的 API 设计章节);DSL 为空时退化为普通骨架模式
1200
1251
  - error feedback loop 在 TDD 模式下最多运行 **3 轮**(普通模式 2 轮)
1201
1252
 
1202
- ---
1253
+ ***
1203
1254
 
1204
1255
  ### Step 8 — 错误反馈自动修复
1205
1256
 
@@ -1230,15 +1281,15 @@ Attempting auto-fix (3 error(s))...
1230
1281
 
1231
1282
  > `--skip-error-feedback` 跳过此步骤。
1232
1283
 
1233
- ---
1284
+ ***
1234
1285
 
1235
1286
  ### Step 9 — 代码审查 + 经验积累
1236
1287
 
1237
1288
  与 Spec 一起发送给 AI,输出结构化审查报告:
1238
1289
 
1239
- | 代码生成模式 | 审查方式 |
1240
- |---|---|
1241
- | `api` | 直接读取生成的文件内容(不依赖 git diff,生成后立即可审查) |
1290
+ | 代码生成模式 | 审查方式 |
1291
+ | ------------- | --------------------------------------- |
1292
+ | `api` | 直接读取生成的文件内容(不依赖 git diff,生成后立即可审查) |
1242
1293
  | `claude-code` | 抓取 worktree 中的 git diff(需先 `git add .`) |
1243
1294
 
1244
1295
  审查完成后,系统自动从审查报告的 **⚠️ 问题** 章节提取可操作 issue,追加到项目宪法的 **§9 积累教训** 中:
@@ -1257,17 +1308,35 @@ Attempting auto-fix (3 error(s))...
1257
1308
 
1258
1309
  > 审查每运行一次,宪法就"学到"一些新东西,随项目迭代持续进化。
1259
1310
 
1260
- ---
1311
+ ### Step 9.5 — Review→DSL Loop
1312
+
1313
+ 从 v0.33.0 开始,审查阶段不再只是“找问题并记到 §9”。如果 review 里发现的是**结构性问题**,例如:
1314
+
1315
+ - Spec 缺失错误码 / 鉴权要求
1316
+ - DSL 中 endpoint / model 信息过于稀疏
1317
+ - 当前实现问题本质上来自契约不完整
1318
+
1319
+ 系统会把这些发现整理成对 Spec / DSL 的改进建议,而不是直接把问题留给下一次人工返工。
1320
+
1321
+ 推荐动作是:
1322
+
1323
+ ```bash
1324
+ ai-spec update "补充缺失的结构约束" --codegen
1325
+ ```
1326
+
1327
+ 也就是说,流水线从“单向生成”升级成了“review 之后还能反向修契约,再定向重生代码”的闭环。
1328
+
1329
+ ***
1261
1330
 
1262
1331
  ### Step 10 — Harness Self-Eval
1263
1332
 
1264
1333
  代码审查完成后自动执行,**零 AI 调用**,纯确定性评分:
1265
1334
 
1266
- | 维度 | 评分逻辑 |
1267
- |------|---------|
1268
- | DSL Coverage (0-10) | 生成文件是否覆盖 DSL 声明的 endpoint 层和 model 层 |
1335
+ | 维度 | 评分逻辑 |
1336
+ | -------------------- | ------------------------------------ |
1337
+ | DSL Coverage (0-10) | 生成文件是否覆盖 DSL 声明的 endpoint 层和 model 层 |
1269
1338
  | Compile Score (0-10) | error feedback 全通过 → 10;未通过 / 跳过 → 5 |
1270
- | Review Score (0-10) | 从 3-pass review 文本提取 `Score: X/10` |
1339
+ | Review Score (0-10) | 从 3-pass review 文本提取 `Score: X/10` |
1271
1340
 
1272
1341
  **Harness Score** = 加权平均(DSL 40% + Compile 30% + Review 30%)
1273
1342
 
@@ -1281,9 +1350,9 @@ Attempting auto-fix (3 error(s))...
1281
1350
 
1282
1351
  - `harnessScore` 和 `promptHash` 写入 RunLog(`.ai-spec-logs/<runId>.json`)
1283
1352
  - 每次改动 prompt 文件后,`promptHash` 自动变化,结合 `harnessScore` 可量化 prompt 改动的效果
1284
- - 后续可通过脚本聚合多个 RunLog,绘制 harnessScore × promptHash 的趋势图
1353
+ - `ai-spec logs` / `trend` / `dashboard` 会直接消费这些 RunLog,做运行回看、趋势对比和可视化报告
1285
1354
 
1286
- ---
1355
+ ***
1287
1356
 
1288
1357
  ## 多 Repo 工作区模式
1289
1358
 
@@ -1351,69 +1420,69 @@ ai-spec create "实现用户点赞功能"
1351
1420
 
1352
1421
  ### 核心设计
1353
1422
 
1354
- | 能力 | 说明 |
1355
- |---|---|
1356
- | **需求自动拆分** | AI 将一句需求分解为每个 repo 的职责描述 |
1357
- | **UX 决策注入** | 前端自动获得:节流/防抖时间、是否乐观更新、失败回滚策略、成功后需 re-fetch 的接口列表 |
1358
- | **基于真实代码的 UX 决策** | 分解时注入前端已有的 hook/store/API wrapper 文件列表,AI 的 specIdea 会直接引用真实文件名而非泛泛描述 |
1359
- | **Contract Bridge** | 后端 DSL → TypeScript 接口定义 → 注入前端 Spec 生成 prompt,确保路径/方法/类型严格对齐 |
1360
- | **前端 Codegen 上下文** | API 模式代码生成时自动注入前端项目的 hook/store/API wrapper 现有代码,附注"extend, do NOT recreate" |
1361
- | **依赖顺序执行** | 按 backend → shared → frontend → mobile 顺序运行,后端先出产 contract |
1362
- | **容错隔离** | 单个 repo 失败不影响其他 repo;失败时打印错误并继续 |
1363
- | **优雅降级** | 未找到 `.ai-spec-workspace.json` 时静默退回单 repo 模式,无需任何配置 |
1423
+ | 能力 | 说明 |
1424
+ | ------------------- | ---------------------------------------------------------------------------- |
1425
+ | **需求自动拆分** | AI 将一句需求分解为每个 repo 的职责描述 |
1426
+ | **UX 决策注入** | 前端自动获得:节流/防抖时间、是否乐观更新、失败回滚策略、成功后需 re-fetch 的接口列表 |
1427
+ | **基于真实代码的 UX 决策** | 分解时注入前端已有的 hook/store/API wrapper 文件列表,AI 的 specIdea 会直接引用真实文件名而非泛泛描述 |
1428
+ | **Contract Bridge** | 后端 DSL → TypeScript 接口定义 → 注入前端 Spec 生成 prompt,确保路径/方法/类型严格对齐 |
1429
+ | **前端 Codegen 上下文** | API 模式代码生成时自动注入前端项目的 hook/store/API wrapper 现有代码,附注"extend, do NOT recreate" |
1430
+ | **依赖顺序执行** | 按 backend → shared → frontend → mobile 顺序运行,后端先出产 contract |
1431
+ | **容错隔离** | 单个 repo 失败不影响其他 repo;失败时打印错误并继续 |
1432
+ | **优雅降级** | 未找到 `.ai-spec-workspace.json` 时静默退回单 repo 模式,无需任何配置 |
1364
1433
 
1365
1434
  ### UxDecision 字段说明
1366
1435
 
1367
1436
  需求拆分时 AI 会为前端/移动端 repo 生成 `uxDecisions`:
1368
1437
 
1369
- | 字段 | 类型 | 说明 |
1370
- |---|---|---|
1371
- | `throttleMs` | `number?` | 按钮点击节流(ms),适用于频繁操作如点赞 |
1372
- | `debounceMs` | `number?` | 输入防抖(ms),适用于搜索框 |
1373
- | `optimisticUpdate` | `boolean` | 是否在服务端确认前先更新 UI |
1374
- | `reloadOnSuccess` | `string[]?` | 成功后需 re-fetch 的接口路径列表 |
1375
- | `errorRollback` | `boolean` | 乐观更新失败时是否回滚 UI 状态 |
1376
- | `loadingState` | `boolean` | 请求期间是否显示加载指示器 |
1377
- | `notes` | `string?` | 补充协调说明 |
1438
+ | 字段 | 类型 | 说明 |
1439
+ | ------------------ | ----------- | --------------------- |
1440
+ | `throttleMs` | `number?` | 按钮点击节流(ms),适用于频繁操作如点赞 |
1441
+ | `debounceMs` | `number?` | 输入防抖(ms),适用于搜索框 |
1442
+ | `optimisticUpdate` | `boolean` | 是否在服务端确认前先更新 UI |
1443
+ | `reloadOnSuccess` | `string[]?` | 成功后需 re-fetch 的接口路径列表 |
1444
+ | `errorRollback` | `boolean` | 乐观更新失败时是否回滚 UI 状态 |
1445
+ | `loadingState` | `boolean` | 请求期间是否显示加载指示器 |
1446
+ | `notes` | `string?` | 补充协调说明 |
1378
1447
 
1379
- ---
1448
+ ***
1380
1449
 
1381
1450
  ## 多语言后端支持
1382
1451
 
1383
1452
  ai-spec 不绑定特定后端语言。`workspace init` 和 `detectRepoType()` 会自动识别以下项目类型:
1384
1453
 
1385
- | 语言 / 框架 | 识别依据 | RepoType | Role |
1386
- |---|---|---|---|
1387
- | Node.js / Express | `package.json` 含 `express` | `node-express` | backend |
1388
- | Node.js / Koa | `package.json` 含 `koa` | `node-koa` | backend |
1389
- | Go | 根目录存在 `go.mod` | `go` | backend |
1390
- | Rust | 根目录存在 `Cargo.toml` | `rust` | backend |
1391
- | Java (Maven) | 根目录存在 `pom.xml` | `java` | backend |
1392
- | Java (Gradle) | 根目录存在 `build.gradle` / `build.gradle.kts` | `java` | backend |
1454
+ | 语言 / 框架 | 识别依据 | RepoType | Role |
1455
+ | ----------------- | ----------------------------------------- | -------------- | ------- |
1456
+ | Node.js / Express | `package.json` 含 `express` | `node-express` | backend |
1457
+ | Node.js / Koa | `package.json` 含 `koa` | `node-koa` | backend |
1458
+ | Go | 根目录存在 `go.mod` | `go` | backend |
1459
+ | Rust | 根目录存在 `Cargo.toml` | `rust` | backend |
1460
+ | Java (Maven) | 根目录存在 `pom.xml` | `java` | backend |
1461
+ | Java (Gradle) | 根目录存在 `build.gradle` / `build.gradle.kts` | `java` | backend |
1393
1462
 
1394
1463
  > **Java 上下文提取**:`ContextLoader` 会解析 `pom.xml`(正则提取 `<artifactId>` 依赖列表 + `<maven.compiler.source>` Java 版本)并推断技术栈(Spring Boot、MyBatis、Dubbo、RocketMQ、Redis、OpenFeign 等);扫描 `**/src/main/java/**/*Controller.java` 作为 API 结构;读取 `application.properties/yml` 作为路由摘要。workspace `[W1]` 阶段会正常显示 `Java, Java 11, Spring Boot, RocketMQ... (N deps)` 而非 `unknown (0 deps)`。
1395
- | Python | 根目录存在 `requirements.txt` / `pyproject.toml` / `setup.py` | `python` | backend |
1396
- | **PHP / Lumen / Laravel** | **根目录存在 `composer.json`** | **`php`** | **backend** |
1397
- | React | `package.json` 含 `react` | `react` | frontend |
1398
- | Next.js | `package.json` 含 `next` | `next` | frontend |
1399
- | Vue | `package.json` 含 `vue` | `vue` | frontend |
1400
- | React Native / Expo | `package.json` 含 `react-native` / `expo` | `react-native` | mobile |
1464
+ > \| Python | 根目录存在 `requirements.txt` / `pyproject.toml` / `setup.py` | `python` | backend |
1465
+ > \| **PHP / Lumen / Laravel** | **根目录存在** **`composer.json`** | **`php`** | **backend** |
1466
+ > \| React | `package.json` 含 `react` | `react` | frontend |
1467
+ > \| Next.js | `package.json` 含 `next` | `next` | frontend |
1468
+ > \| Vue | `package.json` 含 `vue` | `vue` | frontend |
1469
+ > \| React Native / Expo | `package.json` 含 `react-native` / `expo` | `react-native` | mobile |
1401
1470
 
1402
1471
  **错误反馈自动修复** (`error-feedback.ts`) 也针对各语言自动选择测试/Lint 命令:
1403
1472
 
1404
- | 语言 | 测试命令 | Lint 命令 |
1405
- |---|---|---|
1406
- | Node.js | `npm test` / `npx vitest run` | `npm run lint` / `npx eslint .` |
1407
- | Go | `go test ./...` | `go vet ./...` |
1408
- | Rust | `cargo test` | `cargo clippy -- -D warnings` |
1409
- | Java (Maven) | `mvn test -q` | — |
1410
- | Java (Gradle) | `./gradlew test` | — |
1411
- | Python | `pytest` | `ruff check .` / `flake8 .` |
1412
- | **PHP** | **`./vendor/bin/phpunit`** 或 **`php artisan test`** | **`./vendor/bin/phpstan analyse`**(如已安装) |
1473
+ | 语言 | 测试命令 | Lint 命令 |
1474
+ | ------------- | --------------------------------------------------- | ---------------------------------------- |
1475
+ | Node.js | `npm test` / `npx vitest run` | `npm run lint` / `npx eslint .` |
1476
+ | Go | `go test ./...` | `go vet ./...` |
1477
+ | Rust | `cargo test` | `cargo clippy -- -D warnings` |
1478
+ | Java (Maven) | `mvn test -q` | — |
1479
+ | Java (Gradle) | `./gradlew test` | — |
1480
+ | Python | `pytest` | `ruff check .` / `flake8 .` |
1481
+ | **PHP** | **`./vendor/bin/phpunit`** 或 **`php artisan test`** | **`./vendor/bin/phpstan analyse`**(如已安装) |
1413
1482
 
1414
- > **代码生成 Prompt 策略**:`ai-spec create` 和 `ai-spec update --codegen` 会根据自动检测的 `RepoType` 选择对应语言的 system prompt(`getCodeGenSystemPrompt(repoType)`)。Go 使用 Go 惯用写法,Python 匹配 FastAPI/Flask/Django,Java 使用 Spring Boot 分层模式,Rust 使用 Result<T,E> 风格,**PHP 匹配 Lumen/Laravel 路由约定,使用 Eloquent ORM,PSR-12 规范**。
1483
+ > **代码生成 Prompt 策略**:`ai-spec create` 和 `ai-spec update --codegen` 会根据自动检测的 `RepoType` 选择对应语言的 system prompt(`getCodeGenSystemPrompt(repoType)`)。Go 使用 Go 惯用写法,Python 匹配 FastAPI/Flask/Django,Java 使用 Spring Boot 分层模式,Rust 使用 Result\<T,E> 风格,**PHP 匹配 Lumen/Laravel 路由约定,使用 Eloquent ORM,PSR-12 规范**。
1415
1484
 
1416
- ---
1485
+ ***
1417
1486
 
1418
1487
  ## 配置文件
1419
1488
 
@@ -1433,10 +1502,10 @@ ai-spec 不绑定特定后端语言。`workspace init` 和 `detectRepoType()`
1433
1502
 
1434
1503
  项目根目录还有两个自动生成的文件:
1435
1504
 
1436
- | 文件 | 说明 |
1437
- |---|---|
1438
- | `.ai-spec-constitution.md` | 项目宪法,`init` 生成,所有命令自动读取 |
1439
- | `.ai-spec.json` | 模型配置,`config` / `model` 命令管理 |
1505
+ | 文件 | 说明 |
1506
+ | -------------------------- | ---------------------------- |
1507
+ | `.ai-spec-constitution.md` | 项目宪法,`init` 生成,所有命令自动读取 |
1508
+ | `.ai-spec.json` | 模型配置,`config` / `model` 命令管理 |
1440
1509
 
1441
1510
  ### 共享宪法(跨项目规范)
1442
1511
 
@@ -1488,11 +1557,11 @@ ai-spec init --global
1488
1557
  Project rules take priority over global rules.
1489
1558
  ```
1490
1559
 
1491
- ---
1560
+ ***
1492
1561
 
1493
1562
  ## RTK 集成
1494
1563
 
1495
- > RTK 仅对 **`claude-code` 模式**有效,不影响 `api` 模式下对 GLM / Qwen / Gemini 等 provider 的直接 API 调用。
1564
+ > RTK 仅对 **`claude-code`** **模式**有效,不影响 `api` 模式下对 GLM / Qwen / Gemini 等 provider 的直接 API 调用。
1496
1565
 
1497
1566
  RTK(Rust Token Killer)作为 Claude Code 的 hook 运行,拦截 Claude Code 会话中的 shell 命令输出(`git diff`、`git status`、`npm` 等),压缩后再返回给 Claude,从而减少 context 中的 token 消耗。
1498
1567
 
@@ -1509,7 +1578,7 @@ RTK(Rust Token Killer)作为 Claude Code 的 hook 运行,拦截 Claude Cod
1509
1578
  ai-spec create "功能描述" --auto
1510
1579
  ```
1511
1580
 
1512
- ---
1581
+ ***
1513
1582
 
1514
1583
  ## 全局安装
1515
1584
 
@@ -1527,15 +1596,31 @@ ai-spec review # 代码审查
1527
1596
  ai-spec model --list # 查看所有模型
1528
1597
  ```
1529
1598
 
1530
- ---
1599
+ ***
1531
1600
 
1532
1601
  ## 项目结构
1533
1602
 
1534
1603
  ```
1535
1604
  ai-spec-dev-poc/
1536
1605
  ├── cli/
1537
- │ ├── index.ts # CLI 入口,定义所有命令
1538
- └── welcome.ts # 欢迎界面(无参数运行时展示)
1606
+ │ ├── index.ts # CLI 入口(42 行),组装所有命令
1607
+ ├── utils.ts # 共享工具:loadConfig / resolveApiKey / AiSpecConfig
1608
+ │ └── commands/
1609
+ │ ├── create.ts # create — 完整单/多 Repo 流水线
1610
+ │ ├── review.ts # review — AI 代码审查
1611
+ │ ├── init.ts # init — 项目/全局宪法生成
1612
+ │ ├── config.ts # config — 项目默认配置
1613
+ │ ├── model.ts # model — 交互式 Provider/Model 选择
1614
+ │ ├── workspace.ts # workspace — 多 Repo 工作区管理
1615
+ │ ├── update.ts # update — Spec 变更增量代码生成
1616
+ │ ├── export.ts # export — DSL → OpenAPI 导出
1617
+ │ ├── mock.ts # mock — 独立 Mock Server 生成与启动
1618
+ │ ├── learn.ts # learn — 直接向宪法 §9 追加经验
1619
+ │ ├── restore.ts # restore — 回滚上次 run 写入的文件
1620
+ │ ├── trend.ts # trend — Harness 评分趋势报表
1621
+ │ ├── logs.ts # logs — 运行日志列表 / 阶段详情
1622
+ │ ├── types.ts # types — DSL → TypeScript 类型文件
1623
+ │ └── dashboard.ts # dashboard — 静态 HTML Harness Dashboard
1539
1624
  ├── core/
1540
1625
  │ ├── spec-generator.ts # 所有 AI Provider + SpecGenerator
1541
1626
  │ ├── context-loader.ts # 项目上下文 + 宪法加载
@@ -1579,3 +1664,236 @@ ai-spec-dev-poc/
1579
1664
  ├── README.md
1580
1665
  └── RELEASE_LOG.md # 版本变更记录
1581
1666
  ```
1667
+
1668
+ </details>
1669
+
1670
+ <details>
1671
+ <summary>English</summary>
1672
+
1673
+ # ai-spec
1674
+
1675
+ GitHub: <https://github.com/hzhongzhong/ai-spec>
1676
+
1677
+ > An AI-driven feature delivery orchestrator that turns a short requirement into runnable code, with support for both single-repo development and multi-repo cross-stack workflows.
1678
+
1679
+ **Single-repo pipeline**
1680
+
1681
+ ```text
1682
+ Requirement → Project Constitution → Project Context → Spec + Tasks → Interactive Refinement (with diff preview) → Spec Quality Assessment → Approval Gate → DSL Extraction + Validation → DSL Gap Feedback → Git Isolation → Code Generation (parallel by dependency layer) → TDD / Test Skeleton → Error Feedback Auto-Fix → 3-pass Review → Review→DSL Loop → Harness Self-Eval → Lesson Accumulation (§9)
1683
+ ```
1684
+
1685
+ **Workspace pipeline**
1686
+
1687
+ ```text
1688
+ One requirement → AI decomposition + UX decisions → [Backend pipeline → DSL contract] → [Frontend pipeline with injected contract] → End-to-end delivery
1689
+ ```
1690
+
1691
+ ---
1692
+
1693
+ ## Table of Contents
1694
+
1695
+ - [Quick Start](#quick-start)
1696
+ - [Supported Models](#supported-models)
1697
+ - [Command Overview](#command-overview)
1698
+ - [Workflow](#workflow)
1699
+ - [Multi-Repo Workspace Mode](#multi-repo-workspace-mode)
1700
+ - [Multi-language Backend Support](#multi-language-backend-support)
1701
+ - [Configuration](#configuration)
1702
+ - [Global Installation](#global-installation)
1703
+ - [Project Structure](#project-structure)
1704
+ - [Release Log](RELEASE_LOG.md)
1705
+
1706
+ ---
1707
+
1708
+ ## Quick Start
1709
+
1710
+ ```bash
1711
+ # 1. Install dependencies and build
1712
+ npm install
1713
+ npm run build
1714
+
1715
+ # 2. Set an API key (Gemini example)
1716
+ export GEMINI_API_KEY=your_key_here
1717
+
1718
+ # 3. Optional first run: generate a project constitution
1719
+ ai-spec init
1720
+
1721
+ # 4. Start developing from a natural-language requirement
1722
+ ai-spec create "add login support to the user module"
1723
+ ```
1724
+
1725
+ `ai-spec create` runs a structured pipeline: context loading, spec generation, interactive refinement, DSL extraction, optional DSL gap feedback, isolated git worktree setup, code generation, optional tests, error-feedback repair, review, contract feedback, and harness self-evaluation.
1726
+
1727
+ ## Supported Models
1728
+
1729
+ - Supports 9 AI providers: Gemini, Claude, OpenAI, DeepSeek, Qwen, GLM, MiniMax, Doubao, and MiMo
1730
+ - Allows separate providers/models for spec generation and code generation
1731
+ - Exposes interactive model switching through `ai-spec model`
1732
+ - Adapts provider-specific request behavior internally
1733
+
1734
+ ## Command Overview
1735
+
1736
+ Core commands:
1737
+
1738
+ - `ai-spec init` — generate or regenerate the project constitution
1739
+ - `ai-spec create [idea]` — run the end-to-end generation pipeline
1740
+ - `ai-spec review [specFile]` — run an independent 3-pass code review
1741
+ - `ai-spec update [change]` — update the latest spec and regenerate impacted files
1742
+ - `ai-spec export` — export OpenAPI and SDK artifacts
1743
+ - `ai-spec mock` — generate mock servers, proxies, and MSW handlers
1744
+ - `ai-spec workspace` — initialize and inspect workspace orchestration
1745
+ - `ai-spec model` / `config` — manage provider and project defaults
1746
+ - `ai-spec trend` / `logs` / `dashboard` — inspect harness-quality history
1747
+ - `ai-spec types` — generate TypeScript types from DSL
1748
+
1749
+ Important execution options:
1750
+
1751
+ - Provider and model selection for spec/codegen
1752
+ - Codegen mode selection: `claude-code`, `api`, `plan`
1753
+ - Flow control flags such as `--auto`, `--fast`, `--skip-*`
1754
+ - Worktree control for isolated generation
1755
+ - Enhanced modes such as `--tdd`
1756
+
1757
+ ## Workflow
1758
+
1759
+ ### Step 1 — Constitution + Context
1760
+
1761
+ - Loads `.ai-spec-constitution.md` if present
1762
+ - Auto-generates one when missing
1763
+ - Extracts project context such as dependencies, routes, schema, and structure
1764
+
1765
+ ### Step 2 — Spec + Tasks
1766
+
1767
+ - Generates a structured feature spec in Markdown
1768
+ - Produces tasks that preserve dependency order
1769
+ - Keeps the spec as the high-level human-readable contract
1770
+
1771
+ ### Step 3 — Interactive Refinement
1772
+
1773
+ - Lets the user inspect AI edits before code generation
1774
+ - Shows a diff preview
1775
+ - Supports a fast path for non-interactive execution
1776
+
1777
+ ### Step 3.4 — Spec Quality Assessment
1778
+
1779
+ - Scores coverage, clarity, and constitution alignment before codegen
1780
+ - Highlights weak spots that may cause DSL or implementation drift
1781
+
1782
+ ### Step 3.5 — Approval Gate
1783
+
1784
+ - Requires explicit approval before code generation unless auto mode is enabled
1785
+ - Keeps humans in the loop at the highest-leverage decision point
1786
+
1787
+ ### Step DSL — DSL Extraction and Validation
1788
+
1789
+ - Converts the spec into a structured DSL
1790
+ - Validates endpoint, model, and behavior declarations
1791
+ - Provides a stable, machine-readable contract for downstream stages
1792
+ - Also powers downstream outputs such as TypeScript types, OpenAPI export, mock generation, and workspace contract injection
1793
+
1794
+ ### Step DSL+ — DSL Gap Feedback
1795
+
1796
+ - Detects “valid but too sparse” DSL structures after extraction
1797
+ - Lets the user refine the spec before entering code generation
1798
+ - Prevents weak contracts from flowing into later stages unchanged
1799
+
1800
+ ### Step 4 — Git Worktree
1801
+
1802
+ - Creates an isolated worktree for safer generation
1803
+ - Reduces the risk of polluting the main working directory
1804
+
1805
+ ### Step 5 — Code Generation
1806
+
1807
+ - Generates code incrementally
1808
+ - Runs tasks in dependency-aware layers
1809
+ - Uses frontend and backend context to reduce hallucination
1810
+
1811
+ ### Step 7 — Test Generation
1812
+
1813
+ - Can generate test skeletons or run in TDD mode
1814
+ - Reuses the project’s testing conventions when possible
1815
+
1816
+ ### Step 8 — Error Feedback Auto-Fix
1817
+
1818
+ - Detects compile, lint, and test failures
1819
+ - Feeds real errors back into the repair loop
1820
+ - Includes dependency-order fixes and project-aware remediation
1821
+
1822
+ ### Step 9 — Review + Lesson Accumulation
1823
+
1824
+ - Uses a 3-pass review strategy: architecture, implementation, and impact/complexity
1825
+ - Writes recurring issues back into Constitution §9 as accumulated lessons
1826
+
1827
+ ### Step 9.5 — Review→DSL Loop
1828
+
1829
+ - Turns structural review findings into contract-level follow-up actions
1830
+ - Encourages updating Spec / DSL first, then regenerating with `ai-spec update --codegen`
1831
+ - Upgrades the pipeline from one-way generation to a corrective loop
1832
+
1833
+ ### Step 10 — Harness Self-Eval
1834
+
1835
+ - Computes deterministic quality signals with zero extra AI calls
1836
+ - Records `harnessScore` and `promptHash`
1837
+ - Feeds `logs`, `trend`, and `dashboard` for historical observability
1838
+
1839
+ ## Multi-Repo Workspace Mode
1840
+
1841
+ Workspace mode is designed for backend + frontend or multi-service repositories:
1842
+
1843
+ - Detects or configures multiple repos under one workspace
1844
+ - Runs backend repos first when they provide contracts
1845
+ - Injects backend DSL contracts into downstream frontend spec generation
1846
+ - Adds UX decisions so cross-repo work remains consistent
1847
+
1848
+ Typical use cases:
1849
+
1850
+ - Backend API + Web frontend
1851
+ - Backend API + Mobile app
1852
+ - Shared contract packages + multiple product surfaces
1853
+
1854
+ ## Multi-language Backend Support
1855
+
1856
+ The tool is not limited to one backend language. Current repo detection and context support cover:
1857
+
1858
+ - Node.js / Express / Koa
1859
+ - Java (Maven / Gradle)
1860
+ - PHP / Lumen / Laravel
1861
+ - Go
1862
+ - Rust
1863
+ - Python
1864
+
1865
+ Code generation prompts are selected according to detected repo type so each stack receives stack-appropriate conventions.
1866
+
1867
+ ## Configuration
1868
+
1869
+ Supported configuration layers:
1870
+
1871
+ - Project-level `.ai-spec.json`
1872
+ - Workspace-level `.ai-spec-workspace.json`
1873
+ - Project constitution `.ai-spec-constitution.md`
1874
+ - Shared global constitution for cross-project rules
1875
+
1876
+ The global constitution mechanism lets teams define reusable API, naming, and architectural rules once, then merge them into project-specific constitutions.
1877
+
1878
+ ## Global Installation
1879
+
1880
+ ```bash
1881
+ npm install -g .
1882
+ ai-spec
1883
+ ```
1884
+
1885
+ Running without arguments shows the welcome screen, current provider/model, and recent specs.
1886
+
1887
+ ## Project Structure
1888
+
1889
+ Main directories:
1890
+
1891
+ - `cli/` — command entrypoints
1892
+ - `core/` — orchestration, generation, review, validation, logging, and harness modules
1893
+ - `prompts/` — provider-facing system prompts
1894
+ - `specs/` — generated specs, DSL files, and task files
1895
+ - `git/` — worktree management
1896
+
1897
+ Key modules include constitution generation, DSL extraction, code generation, error feedback, self-evaluation, workspace loading, frontend context loading, logs/trend/dashboard reporting, and type generation.
1898
+
1899
+ </details>