aodw-skill 0.7.13 → 0.7.17

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 (127) hide show
  1. package/.aodw-next/01-core/ai-interaction-rules-summary.md +37 -0
  2. package/.aodw-next/01-core/ai-interaction-rules.md +20 -6
  3. package/.aodw-next/01-core/ai-knowledge-rules-summary.md +25 -0
  4. package/.aodw-next/01-core/ai-knowledge-rules.md +19 -21
  5. package/.aodw-next/01-core/ai-project-overview-rules.md +11 -11
  6. package/.aodw-next/01-core/aodw-constitution.md +7 -414
  7. package/.aodw-next/01-core/csf-thinking-framework.md +14 -14
  8. package/.aodw-next/01-core/git-discipline-summary.md +36 -0
  9. package/.aodw-next/01-core/git-discipline.md +129 -73
  10. package/.aodw-next/01-core/module-doc-rules.md +2 -2
  11. package/.aodw-next/02-workflow/rt-id-generation-rules.md +16 -259
  12. package/.aodw-next/02-workflow/rt-manager-summary.md +1 -1
  13. package/.aodw-next/02-workflow/rt-manager.md +73 -344
  14. package/.aodw-next/02-workflow/spec-full-profile.md +149 -307
  15. package/.aodw-next/02-workflow/spec-lite-profile.md +170 -253
  16. package/.aodw-next/02-workflow/ui-workflow-rules-summary.md +39 -0
  17. package/.aodw-next/02-workflow/ui-workflow-rules.md +57 -292
  18. package/.aodw-next/03-standards/ai-coding-rules-common.md +1 -1
  19. package/.aodw-next/03-standards/ai-coding-rules.md +91 -25
  20. package/.aodw-next/03-standards/stacks/java-springboot/ai-coding-rules-backend.md +9 -9
  21. package/.aodw-next/03-standards/stacks/python-fastapi/ai-coding-rules-backend.md +13 -13
  22. package/.aodw-next/03-standards/stacks/react-typescript/ai-coding-rules-frontend.md +10 -10
  23. package/.aodw-next/03-standards/stacks/rust-axum/ai-coding-rules-backend.md +4 -4
  24. package/.aodw-next/03-standards/stacks/vue2/ai-coding-rules-frontend.md +9 -9
  25. package/.aodw-next/04-auditors/aodw-development-auditor-rules.md +15 -10
  26. package/.aodw-next/04-auditors/aodw-full-auditor-rules.md +14 -14
  27. package/.aodw-next/04-auditors/aodw-requirement-auditor-rules.md +130 -338
  28. package/.aodw-next/05-tooling/ai-tools-init-rules.md +74 -367
  29. package/.aodw-next/06-project/README.md +16 -0
  30. package/.aodw-next/07-optimization/token-usage-analysis.md +2 -2
  31. package/.aodw-next/README.md +53 -20
  32. package/.aodw-next/SKILL.md +32 -0
  33. package/.aodw-next/config.yaml +2 -2
  34. package/.aodw-next/manifest.yaml +64 -57
  35. package/.aodw-next/project.yaml +1 -0
  36. package/.aodw-next/templates/TEMPLATE-APPLICATION-GUIDE.md +21 -157
  37. package/.aodw-next/templates/ai-overview.template.md +72 -0
  38. package/.aodw-next/templates/aodw-kernel-loader-template.md +19 -19
  39. package/.aodw-next/templates/checklists/coding-standards-template.md +24 -4
  40. package/.aodw-next/templates/modules-index.template.yaml +13 -0
  41. package/.aodw-next/templates/plan-lite-template.md +9 -0
  42. package/.aodw-next/templates/rt-intake-template.md +2 -2
  43. package/.aodw-next/templates/rt-meta-template.yaml +2 -2
  44. package/.aodw-next/templates/spec-lite-template.md +9 -0
  45. package/.aodw-next/templates/tools-config/README.md +1 -1
  46. package/.aodw-next/templates/tools-config/backend/clippy.config.template.toml +5 -0
  47. package/.aodw-next/templates/tools-config/backend/rustfmt.config.template.toml +4 -0
  48. package/.aodw-next/tools-status.yaml +51 -0
  49. package/AODW_Adapters/antigravity/.agent/rules/aodw-next.md +2 -2
  50. package/AODW_Adapters/claude/CLAUDE.md +2 -2
  51. package/AODW_Adapters/cursor/.cursor/rules/aodw-next.mdc +2 -2
  52. package/AODW_Adapters/gemini/.agent/rules/aodw-next.md +2 -2
  53. package/AODW_Adapters/gemini/GEMINI.md +6 -5
  54. package/AODW_Adapters/general/AGENTS.md +2 -2
  55. package/README.md +62 -45
  56. package/bin/aodw.js +44 -16
  57. package/bin/commands/init-overview.js +3 -3
  58. package/bin/commands/init-tools.js +34 -51
  59. package/bin/utils/config.js +1 -1
  60. package/package.json +1 -1
  61. package/.aodw-next/.aodw-next/01-core/ai-interaction-rules.md +0 -218
  62. package/.aodw-next/.aodw-next/01-core/ai-knowledge-rules.md +0 -302
  63. package/.aodw-next/.aodw-next/01-core/ai-project-overview-rules.md +0 -284
  64. package/.aodw-next/.aodw-next/01-core/aodw-constitution-summary.md +0 -20
  65. package/.aodw-next/.aodw-next/01-core/aodw-constitution.md +0 -419
  66. package/.aodw-next/.aodw-next/01-core/csf-thinking-framework.md +0 -373
  67. package/.aodw-next/.aodw-next/01-core/git-discipline.md +0 -226
  68. package/.aodw-next/.aodw-next/01-core/module-doc-rules.md +0 -90
  69. package/.aodw-next/.aodw-next/02-workflow/aodw-development-stages.md +0 -235
  70. package/.aodw-next/.aodw-next/02-workflow/rt-id-generation-rules.md +0 -267
  71. package/.aodw-next/.aodw-next/02-workflow/rt-manager-summary.md +0 -15
  72. package/.aodw-next/.aodw-next/02-workflow/rt-manager.md +0 -399
  73. package/.aodw-next/.aodw-next/02-workflow/spec-full-profile-summary.md +0 -13
  74. package/.aodw-next/.aodw-next/02-workflow/spec-full-profile.md +0 -391
  75. package/.aodw-next/.aodw-next/02-workflow/spec-lite-profile.md +0 -313
  76. package/.aodw-next/.aodw-next/02-workflow/ui-workflow-rules.md +0 -334
  77. package/.aodw-next/.aodw-next/03-standards/ai-coding-rules-common.md +0 -89
  78. package/.aodw-next/.aodw-next/03-standards/ai-coding-rules.md +0 -370
  79. package/.aodw-next/.aodw-next/03-standards/stacks/java-springboot/ai-coding-rules-backend.md +0 -231
  80. package/.aodw-next/.aodw-next/03-standards/stacks/python-fastapi/ai-coding-rules-backend.md +0 -612
  81. package/.aodw-next/.aodw-next/03-standards/stacks/react-typescript/ai-coding-rules-frontend.md +0 -291
  82. package/.aodw-next/.aodw-next/03-standards/stacks/rust-axum/ai-coding-rules-backend.md +0 -134
  83. package/.aodw-next/.aodw-next/03-standards/stacks/vue2/ai-coding-rules-frontend.md +0 -220
  84. package/.aodw-next/.aodw-next/03-standards/ui-kit/ui-kit.md +0 -163
  85. package/.aodw-next/.aodw-next/04-auditors/aodw-development-auditor-rules.md +0 -470
  86. package/.aodw-next/.aodw-next/04-auditors/aodw-full-auditor-rules.md +0 -365
  87. package/.aodw-next/.aodw-next/04-auditors/aodw-requirement-auditor-rules.md +0 -408
  88. package/.aodw-next/.aodw-next/05-tooling/ai-tools-init-rules.md +0 -676
  89. package/.aodw-next/.aodw-next/06-project/ai-overview.md +0 -116
  90. package/.aodw-next/.aodw-next/06-project/modules-index.yaml +0 -11
  91. package/.aodw-next/.aodw-next/07-optimization/token-usage-analysis.md +0 -253
  92. package/.aodw-next/.aodw-next/README.md +0 -26
  93. package/.aodw-next/.aodw-next/RELEASE-CHECKLIST.md +0 -144
  94. package/.aodw-next/.aodw-next/config.yaml +0 -2
  95. package/.aodw-next/.aodw-next/manifest.yaml +0 -98
  96. package/.aodw-next/.aodw-next/templates/SOURCE-TO-DISTRIBUTION-GUIDE.md +0 -276
  97. package/.aodw-next/.aodw-next/templates/TEMPLATE-APPLICATION-GUIDE.md +0 -246
  98. package/.aodw-next/.aodw-next/templates/aodw-kernel-loader-template.md +0 -70
  99. package/.aodw-next/.aodw-next/templates/audit-report-template.md +0 -232
  100. package/.aodw-next/.aodw-next/templates/changelog-template.md +0 -16
  101. package/.aodw-next/.aodw-next/templates/checklists/coding-standards-template.md +0 -110
  102. package/.aodw-next/.aodw-next/templates/csf-review-template.md +0 -201
  103. package/.aodw-next/.aodw-next/templates/impact-template.md +0 -17
  104. package/.aodw-next/.aodw-next/templates/invariants-template.md +0 -12
  105. package/.aodw-next/.aodw-next/templates/module-readme-template.md +0 -39
  106. package/.aodw-next/.aodw-next/templates/plan-lite-template.md +0 -11
  107. package/.aodw-next/.aodw-next/templates/rt-decision-template.md +0 -13
  108. package/.aodw-next/.aodw-next/templates/rt-intake-template.md +0 -33
  109. package/.aodw-next/.aodw-next/templates/rt-meta-template.yaml +0 -43
  110. package/.aodw-next/.aodw-next/templates/spec-lite-template.md +0 -17
  111. package/.aodw-next/.aodw-next/templates/tests-template.md +0 -13
  112. package/.aodw-next/.aodw-next/templates/tools-config/README.md +0 -112
  113. package/.aodw-next/.aodw-next/templates/tools-config/backend/black.config.template.toml +0 -6
  114. package/.aodw-next/.aodw-next/templates/tools-config/backend/pre-commit.config.template.yaml +0 -16
  115. package/.aodw-next/.aodw-next/templates/tools-config/backend/ruff.config.template.toml +0 -23
  116. package/.aodw-next/.aodw-next/templates/tools-config/frontend/eslint.config.template.json +0 -113
  117. package/.aodw-next/.aodw-next/templates/tools-config/frontend/prettier.config.template.json +0 -10
  118. package/.aodw-next/.aodw-next/templates/tools-config/frontend/tsconfig.paths.template.json +0 -11
  119. package/.aodw-next/.aodw-next/workflow-guide.md +0 -51
  120. package/.aodw-next/01-core/aodw-constitution-summary.md +0 -20
  121. package/.aodw-next/02-workflow/aodw-development-stages.md +0 -235
  122. package/.aodw-next/02-workflow/spec-full-profile-summary.md +0 -13
  123. package/.aodw-next/06-project/ai-overview.md +0 -116
  124. package/.aodw-next/06-project/modules-index.yaml +0 -11
  125. package/.aodw-next/RELEASE-CHECKLIST.md +0 -144
  126. package/.aodw-next/templates/SOURCE-TO-DISTRIBUTION-GUIDE.md +0 -276
  127. package/.aodw-next/workflow-guide.md +0 -51
@@ -1,676 +0,0 @@
1
- # AI 工具初始化规则
2
-
3
- > **注意**:本文件定义 AI 如何引导用户完成开发工具的初始化配置。
4
-
5
- **适用场景**:
6
- - 用户说"初始化工具"、"设置开发工具"、"配置工具"等
7
- - 用户说"检查工具配置"、"验证工具"等
8
- - 编码前检测到工具未初始化
9
-
10
- **必须与以下规范配合使用**:
11
- - `.aodw/03-standards/ai-coding-rules.md`(主文件)
12
- - `.aodw/03-standards/stacks/react-typescript/ai-coding-rules-frontend.md`(前端规范)
13
- - `.aodw/03-standards/stacks/python-fastapi/ai-coding-rules-backend.md`(后端规范)
14
-
15
- ---
16
-
17
- ## 1. 触发条件
18
-
19
- 当用户表达以下意图时,AI 必须执行工具初始化流程:
20
-
21
- **明确命令**:
22
- - "初始化工具"
23
- - "设置开发工具"
24
- - "配置工具"
25
- - "检查工具配置"
26
- - "验证工具"
27
- - "工具初始化"
28
-
29
- **隐含意图**:
30
- - "ESLint 怎么配置?"
31
- - "Ruff 怎么安装?"
32
- - "工具还没设置好"
33
-
34
- ---
35
-
36
- ## 2. 执行流程
37
-
38
- ### Step 0: 前置检查(强制)
39
-
40
- **AI 必须**:
41
- 1. 检查 `.aodw/06-project/ai-overview.md` 是否存在且内容完整(非初始模板状态)。
42
-
43
- **如果文件不存在或不完整**:
44
- - AI 必须停止当前流程。
45
- - AI 必须提示用户:"**检测到项目概览尚未初始化。为了更准确地配置工具,请先执行项目概览初始化。**"
46
- - 建议运行命令:"初始化项目概览"(`aodw init-overview`)。
47
-
48
- ### Step 1: 读取项目配置
49
-
50
-
51
- **AI 必须优先从 `ai-overview.md` 读取信息**:
52
- - 读取 `## 1. 技术栈` 章节
53
- - 确定项目技术栈(React / Vue / Python / Java 等)
54
- - 确定项目类型(Frontend / Backend / Fullstack)
55
-
56
- **仅在 `ai-overview.md` 信息不足时的回退策略**:
57
- - 检查目录结构
58
- - 检查配置文件
59
- - 询问用户确认
60
-
61
- ### Step 2: 检测工具状态
62
-
63
- AI 必须检测以下工具的状态:
64
-
65
- **前端工具**(如果项目包含前端):
66
- - **React/TypeScript 项目**:
67
- - ESLint:是否安装?配置文件是否存在?
68
- - Prettier:是否安装?配置文件是否存在?
69
- - TypeScript Path Alias:是否配置?
70
- - **Vue 2 项目**:
71
- - ESLint:是否安装?配置文件是否存在?是否支持 Vue 2?
72
- - Prettier:是否安装?配置文件是否存在?
73
- - PostCSS:是否配置?兼容性配置是否正确?
74
-
75
- **后端工具**(如果项目包含后端):
76
- - **Python 项目**:
77
- - **uv + pip-tools**:是否安装?requirements.in 是否存在?
78
- - Ruff:是否安装?配置文件是否存在?
79
- - Black:是否安装?配置文件是否存在?
80
- - pre-commit:是否安装?配置文件是否存在?hooks 是否安装?
81
- - **Rust 项目**:
82
- - **rustfmt**:是否安装?rustfmt.toml 是否存在?
83
- - **clippy**:是否安装?clippy.toml 或 Cargo.toml 中的 clippy 配置是否存在?
84
- - **cargo**:是否安装?Cargo.toml 是否存在?
85
- - pre-commit:是否安装?配置文件是否存在?hooks 是否安装?
86
- - **Java 项目**:
87
- - **Maven**:是否安装?pom.xml 是否存在?
88
- - **Checkstyle**:是否安装?配置文件是否存在?(如果使用)
89
- - **Spotless**:是否安装?配置文件是否存在?(如果使用)
90
- - pre-commit:是否安装?配置文件是否存在?hooks 是否安装?
91
-
92
- **检测方法**:
93
- - 检查 `package.json`(前端工具)
94
- - 运行版本命令(`npx eslint --version`、`ruff --version` 等)
95
- - 检查配置文件是否存在
96
- - 读取 `.aodw/tools-status.yaml`(如果存在)
97
-
98
- ### Step 3: 交互式引导
99
-
100
- #### 3.1 工具未安装时的处理
101
-
102
- **AI 必须**:
103
- 1. 说明工具的作用和必要性
104
- 2. 提供安装命令
105
- 3. 询问用户是否立即安装
106
-
107
- **交互格式**(遵循 `ai-interaction-rules.md`):
108
-
109
- ```
110
- Q1. ESLint 未安装,是否立即安装?
111
-
112
- A. 立即安装(推荐)
113
- B. 稍后手动安装
114
- C. 跳过
115
-
116
- Recommended: A(理由:ESLint 是必需的代码质量检查工具,建议立即安装)
117
-
118
- 请回复:A/B/C
119
- ```
120
-
121
- **如果用户选择 A(立即安装)**:
122
- - AI 执行安装命令(`npm install -D eslint ...` 或 `pip install ruff`)
123
- - 等待安装完成
124
- - 继续下一步
125
-
126
- **如果用户选择 B 或 C**:
127
- - AI 记录用户选择
128
- - 提醒用户稍后需要安装
129
- - 继续检测其他工具
130
-
131
- #### 3.2 配置文件已存在时的处理
132
-
133
- **AI 必须**:
134
- 1. 读取现有配置文件
135
- 2. 读取配置模板(`.aodw/templates/tools-config/`)
136
- 3. 对比差异,给出合并建议
137
- 4. 询问用户如何处理
138
-
139
- **交互格式**:
140
-
141
- ```
142
- 检测到 .eslintrc.json 已存在,但缺少以下配置项:
143
- - max-lines 规则(文件大小限制)
144
- - complexity 规则(复杂度限制)
145
- - import/order 规则(import 排序)
146
-
147
- Q1. 如何处理配置文件?
148
-
149
- A. 合并配置(推荐)- 保留现有配置,添加缺失的配置项
150
- B. 覆盖配置 - 使用 AODW 标准配置替换现有配置
151
- C. 跳过 - 保持现有配置不变
152
-
153
- Recommended: A(理由:合并配置可以保留您的自定义设置,同时添加必要的规范配置)
154
-
155
- 请回复:A/B/C
156
- ```
157
-
158
- **如果用户选择 A(合并配置)**:
159
- - AI 读取现有配置
160
- - AI 读取配置模板
161
- - AI 合并配置(保留现有,添加缺失)
162
- - AI 保存合并后的配置
163
- - 更新状态文件
164
-
165
- **如果用户选择 B(覆盖配置)**:
166
- - AI 备份现有配置文件(添加 `.backup` 后缀)
167
- - AI 使用模板生成新配置
168
- - AI 保存新配置
169
- - 更新状态文件
170
-
171
- **如果用户选择 C(跳过)**:
172
- - AI 记录用户选择
173
- - 提醒用户配置可能不符合 AODW 规范
174
- - 继续检测其他工具
175
-
176
- #### 3.3 配置文件不存在时的处理
177
-
178
- **AI 必须**:
179
- 1. 说明需要生成配置文件
180
- 2. 询问用户是否生成
181
-
182
- **交互格式**:
183
-
184
- ```
185
- Q1. ESLint 配置文件不存在,是否生成?
186
-
187
- A. 立即生成(推荐)
188
- B. 稍后手动生成
189
- C. 跳过
190
-
191
- Recommended: A(理由:配置文件是必需的,建议立即生成)
192
-
193
- 请回复:A/B/C
194
- ```
195
-
196
- **如果用户选择 A(立即生成)**:
197
- - AI 读取配置模板
198
- - AI 生成配置文件
199
- - 更新状态文件
200
-
201
- ### Step 4: 验证工具配置
202
-
203
- **AI 必须**:
204
- 1. 运行工具验证命令(`npx eslint --version`、`ruff check .` 等)
205
- 2. 检查配置文件语法是否正确
206
- 3. 如果验证失败,提示用户修复
207
-
208
- ### Step 5: 更新状态文件
209
-
210
- **AI 必须**:
211
- 1. 更新 `.aodw/tools-status.yaml`
212
- 2. 记录:
213
- - 工具安装状态
214
- - 配置文件状态
215
- - 配置来源(generated / merged / existing)
216
- - 初始化时间
217
-
218
- ### Step 6: 输出总结
219
-
220
- **AI 必须**:
221
- 1. 输出工具初始化总结
222
- 2. 列出已安装和配置的工具
223
- 3. 列出未完成的项目(如果有)
224
- 4. **提供下一步建议**:
225
- - "项目概览与工具链均已就绪,您可以开始进行 RT 开发任务。"
226
- - "推荐运行:`aodw intake` 创建第一个需求。"
227
-
228
- ---
229
-
230
- ## 3. 配置文件合并策略
231
-
232
- ### 3.1 ESLint 配置合并
233
-
234
- **现有配置 + 模板配置**:
235
- - 保留现有的 `extends`、`plugins`、`rules`(如果存在)
236
- - 添加模板中的必需规则(`max-lines`、`max-lines-per-function`、`complexity`)
237
- - 合并 `settings`(保留现有,添加模板中的)
238
-
239
- ### 3.2 Prettier 配置合并
240
-
241
- **现有配置 + 模板配置**:
242
- - 如果现有配置存在,询问用户是否覆盖
243
- - 如果不存在,直接使用模板
244
-
245
- ### 3.3 TypeScript Path Alias 合并
246
-
247
- **现有 tsconfig.json + 模板配置**:
248
- - 保留现有的 `compilerOptions`
249
- - 合并 `paths` 配置(保留现有,添加模板中的)
250
-
251
- ### 3.4 pyproject.toml 合并(Ruff、Black)
252
-
253
- **现有 pyproject.toml + 模板配置**:
254
- - 读取现有的 `[tool.ruff]` 和 `[tool.black]` 配置
255
- - 合并配置项(保留现有,添加缺失的)
256
- - 如果配置冲突,询问用户选择
257
-
258
- ### 3.5 pre-commit 配置合并
259
-
260
- **现有 .pre-commit-config.yaml + 模板配置**:
261
- - 读取现有的 hooks
262
- - 添加模板中的 hooks(如果不存在)
263
- - 如果 hooks 冲突,询问用户选择
264
-
265
- ---
266
-
267
- ## 4. 安装命令参考
268
-
269
- ### 4.1 前端工具安装命令
270
-
271
- **ESLint 完整安装**:
272
- ```bash
273
- npm install -D eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-import eslint-plugin-jsx-a11y eslint-config-prettier
274
- ```
275
-
276
- **Prettier 安装**:
277
- ```bash
278
- npm install -D prettier
279
- ```
280
-
281
- ### 4.2 后端工具安装命令
282
-
283
- **依赖管理工具(uv + pip-tools)安装**:
284
- ```bash
285
- # 安装 uv
286
- curl -LsSf https://astral.sh/uv/install.sh | sh
287
-
288
- # 使用 uv 安装 pip-tools
289
- uv pip install pip-tools
290
-
291
- # 创建 requirements.in 和 requirements-dev.in(如果不存在)
292
- touch requirements.in requirements-dev.in
293
-
294
- # 编译依赖(如果存在 Makefile)
295
- make compile-deps
296
-
297
- # 或手动编译
298
- uv pip compile requirements.in -o requirements.txt
299
- uv pip compile requirements-dev.in -o requirements-dev.txt
300
- ```
301
-
302
- **Ruff 安装**(通过 uv + pip-tools):
303
- ```bash
304
- # 1. 编辑 requirements-dev.in
305
- echo "ruff>=0.1.0,<1.0.0" >> requirements-dev.in
306
-
307
- # 2. 编译依赖
308
- make compile-deps
309
- # 或: uv pip compile requirements-dev.in -o requirements-dev.txt
310
-
311
- # 3. 同步环境
312
- make sync
313
- # 或: uv pip sync requirements-dev.txt
314
- ```
315
-
316
- **Black 安装**(通过 uv + pip-tools):
317
- ```bash
318
- # 1. 编辑 requirements-dev.in
319
- echo "black>=23.0.0,<24.0.0" >> requirements-dev.in
320
-
321
- # 2. 编译依赖
322
- make compile-deps
323
-
324
- # 3. 同步环境
325
- make sync
326
- ```
327
-
328
- **pre-commit 安装**(通过 uv + pip-tools):
329
- ```bash
330
- # 1. 编辑 requirements-dev.in
331
- echo "pre-commit>=3.0.0,<4.0.0" >> requirements-dev.in
332
-
333
- # 2. 编译依赖
334
- make compile-deps
335
-
336
- # 3. 同步环境
337
- make sync
338
-
339
- # 4. 安装 hooks
340
- pre-commit install
341
- ```
342
-
343
- **⚠️ 重要**:所有 Python 后端工具必须通过 `uv + pip-tools` 安装,禁止使用 `pip install` 直接安装。
344
-
345
- ### 4.3 Rust 后端工具安装命令
346
-
347
- **rustfmt 和 clippy**(Rust 工具链自带):
348
- ```bash
349
- # rustfmt 和 clippy 是 Rust 工具链的一部分,通常随 Rust 安装
350
- # 检查是否已安装
351
- rustfmt --version
352
- cargo clippy --version
353
-
354
- # 如果未安装,安装 Rust 工具链
355
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
356
- source $HOME/.cargo/env
357
-
358
- # 安装 rustfmt 和 clippy(如果未包含)
359
- rustup component add rustfmt
360
- rustup component add clippy
361
- ```
362
-
363
- **rustfmt 配置**:
364
- ```bash
365
- # 从模板生成 rustfmt.toml
366
- cp .aodw/templates/tools-config/backend/rustfmt.config.template.toml rustfmt.toml
367
- ```
368
-
369
- **clippy 配置**:
370
- ```bash
371
- # 方式 1:创建独立的 clippy.toml 文件
372
- cp .aodw/templates/tools-config/backend/clippy.config.template.toml clippy.toml
373
-
374
- # 方式 2:在 Cargo.toml 中添加配置
375
- # [lints.clippy]
376
- # warn = "all"
377
- # deny = ["warnings"]
378
- # cognitive_complexity_threshold = 15
379
- # cyclomatic_complexity_threshold = 15
380
- # too_many_lines_threshold = 400
381
- ```
382
-
383
- **pre-commit 配置(Rust 项目)**:
384
- ```bash
385
- # 1. 安装 pre-commit(如果未安装)
386
- cargo install pre-commit-hook
387
-
388
- # 2. 在 .pre-commit-config.yaml 中添加 Rust hooks
389
- # repos:
390
- # - repo: https://github.com/doublify/pre-commit-rust
391
- # rev: v1.0
392
- # hooks:
393
- # - id: fmt
394
- # - id: clippy
395
- # - id: cargo-check
396
- ```
397
-
398
- **验证工具配置**:
399
- ```bash
400
- # 验证 rustfmt
401
- cargo fmt -- --check
402
-
403
- # 验证 clippy(零警告策略)
404
- cargo clippy -- -D warnings
405
-
406
- # 运行测试
407
- cargo test
408
- ```
409
-
410
- ### 4.4 Java 后端工具安装命令
411
-
412
- **Maven**(依赖管理,必须):
413
- ```bash
414
- # 检查是否已安装
415
- mvn --version
416
-
417
- # 如果未安装,安装 Maven
418
- # macOS
419
- brew install maven
420
-
421
- # Linux
422
- sudo apt-get install maven # Debian/Ubuntu
423
- sudo yum install maven # CentOS/RHEL
424
-
425
- # 或使用 Maven Wrapper(推荐)
426
- mvn wrapper:wrapper
427
- ```
428
-
429
- **Checkstyle**(代码风格检查,推荐):
430
- ```bash
431
- # 在 pom.xml 中添加 Checkstyle 插件
432
- # <plugin>
433
- # <groupId>org.apache.maven.plugins</groupId>
434
- # <artifactId>maven-checkstyle-plugin</artifactId>
435
- # <version>3.3.0</version>
436
- # <configuration>
437
- # <configLocation>checkstyle.xml</configLocation>
438
- # </configuration>
439
- # </plugin>
440
-
441
- # 从模板生成 checkstyle.xml(如果模板存在)
442
- # cp .aodw/templates/tools-config/backend/checkstyle.config.template.xml checkstyle.xml
443
-
444
- # 验证 Checkstyle
445
- mvn checkstyle:check
446
- ```
447
-
448
- **Spotless**(代码格式化,推荐):
449
- ```bash
450
- # 在 pom.xml 中添加 Spotless 插件
451
- # <plugin>
452
- # <groupId>com.diffplug.spotless</groupId>
453
- # <artifactId>spotless-maven-plugin</artifactId>
454
- # <version>2.40.0</version>
455
- # <configuration>
456
- # <java>
457
- # <googleJavaFormat>
458
- # <version>1.17.0</version>
459
- # <style>GOOGLE</style>
460
- # </googleJavaFormat>
461
- # </java>
462
- # </configuration>
463
- # </plugin>
464
-
465
- # 格式化代码
466
- mvn spotless:apply
467
-
468
- # 检查格式
469
- mvn spotless:check
470
- ```
471
-
472
- **pre-commit 配置(Java 项目)**:
473
- ```bash
474
- # 1. 安装 pre-commit(如果未安装)
475
- # 通过 pip 或 npm 安装
476
- pip install pre-commit
477
- # 或
478
- npm install -g pre-commit
479
-
480
- # 2. 在 .pre-commit-config.yaml 中添加 Java hooks
481
- # repos:
482
- # - repo: https://github.com/checkstyle/checkstyle
483
- # rev: checkstyle-10.12.0
484
- # hooks:
485
- # - id: checkstyle
486
- # - repo: https://github.com/diffplug/spotless
487
- # rev: v2.40.0
488
- # hooks:
489
- # - id: spotless
490
- ```
491
-
492
- **验证工具配置**:
493
- ```bash
494
- # 验证 Maven
495
- mvn clean compile
496
-
497
- # 验证 Checkstyle(如果使用)
498
- mvn checkstyle:check
499
-
500
- # 验证 Spotless(如果使用)
501
- mvn spotless:check
502
-
503
- # 运行测试
504
- mvn test
505
-
506
- # 验证 pre-commit(如果使用)
507
- pre-commit run --all-files
508
- ```
509
-
510
- ---
511
-
512
- ## 5. 配置模板位置
513
-
514
- **前端配置模板**:
515
- - ESLint:`.aodw/templates/tools-config/frontend/eslint.config.template.json`
516
- - Prettier:`.aodw/templates/tools-config/frontend/prettier.config.template.json`
517
- - TypeScript Path Alias:`.aodw/templates/tools-config/frontend/tsconfig.paths.template.json`
518
-
519
- **后端配置模板**:
520
- - 依赖管理:`.aodw/templates/tools-config/backend/requirements.in.template`(如果存在)
521
- - Ruff:`.aodw/templates/tools-config/backend/ruff.config.template.toml`
522
- - Black:`.aodw/templates/tools-config/backend/black.config.template.toml`
523
- - pre-commit:`.aodw/templates/tools-config/backend/pre-commit.config.template.yaml`
524
-
525
- **依赖管理配置**:
526
- - 项目必须使用 `uv + pip-tools` 管理依赖
527
- - 必须存在 `requirements.in` 和 `requirements-dev.in` 文件
528
- - 必须存在 `Makefile` 或相关编译脚本(推荐)
529
-
530
- ---
531
-
532
- ## 6. 状态文件格式
533
-
534
- **位置**:`.aodw/tools-status.yaml`
535
-
536
- **格式**:
537
- ```yaml
538
- tools_init:
539
- initialized: true
540
- initialized_at: "2025-01-15T10:30:00Z"
541
- last_updated_at: "2025-01-15T10:30:00Z"
542
- initialized_by: "ai-rule" # 或 "cli"
543
- project_type: "fullstack"
544
-
545
- frontend:
546
- eslint:
547
- installed: true
548
- configured: true
549
- config_file: ".eslintrc.json"
550
- config_source: "merged" # generated | merged | existing
551
- prettier:
552
- installed: true
553
- configured: true
554
- config_file: ".prettierrc.json"
555
- config_source: "generated"
556
- typescript_path_alias:
557
- configured: true
558
- config_file: "tsconfig.json"
559
- config_source: "merged"
560
-
561
- backend:
562
- # Python 项目工具
563
- dependency_manager:
564
- uv_installed: true
565
- pip_tools_installed: true
566
- configured: true
567
- requirements_in_exists: true
568
- requirements_dev_in_exists: true
569
- makefile_exists: true
570
- ruff:
571
- installed: true
572
- configured: true
573
- config_file: "pyproject.toml"
574
- config_source: "merged"
575
- black:
576
- installed: true
577
- configured: true
578
- config_file: "pyproject.toml"
579
- config_source: "merged"
580
- # Rust 项目工具
581
- rustfmt:
582
- installed: true
583
- configured: true
584
- config_file: "rustfmt.toml"
585
- config_source: "generated"
586
- clippy:
587
- installed: true
588
- configured: true
589
- config_file: "clippy.toml" # 或 Cargo.toml 中的 [lints.clippy]
590
- config_source: "generated"
591
- cargo:
592
- installed: true
593
- cargo_toml_exists: true
594
- # Java 项目工具
595
- maven:
596
- installed: true
597
- configured: true
598
- pom_xml_exists: true
599
- checkstyle:
600
- installed: true
601
- configured: true
602
- config_file: "checkstyle.xml" # 或 pom.xml 中的插件配置
603
- config_source: "generated"
604
- spotless:
605
- installed: true
606
- configured: true
607
- config_file: "pom.xml" # Spotless 配置在 pom.xml 中
608
- config_source: "generated"
609
- pre_commit:
610
- installed: true
611
- configured: true
612
- hooks_installed: true
613
- config_file: ".pre-commit-config.yaml"
614
- config_source: "generated"
615
- ```
616
-
617
- ---
618
-
619
- ## 7. 交互规范
620
-
621
- AI 在执行工具初始化时,必须严格遵守 `.aodw/01-core/ai-interaction-rules.md` 中的规范:
622
-
623
- 1. **问题类型**:决策型问题(提供选项 + 推荐)
624
- 2. **问题格式**:Q1. <问题> / A. <选项1> / B. <选项2> / Recommended: A(理由)
625
- 3. **问题数量**:每轮最多 3 个问题
626
- 4. **节奏控制**:逐步推进,等待用户回答后再继续
627
-
628
- ---
629
-
630
- ## 8. 错误处理
631
-
632
- ### 8.1 工具安装失败
633
-
634
- - AI 必须显示错误信息
635
- - AI 提供故障排查建议
636
- - AI 询问用户是否重试或跳过
637
-
638
- ### 8.2 配置文件生成失败
639
-
640
- - AI 必须显示错误信息
641
- - AI 提供手动配置建议
642
- - AI 提供配置模板位置
643
-
644
- ### 8.3 配置验证失败
645
-
646
- - AI 必须显示验证错误
647
- - AI 提供修复建议
648
- - AI 询问用户是否继续
649
-
650
- ---
651
-
652
- ## 9. 完成后的提示
653
-
654
- 工具初始化完成后,AI 必须:
655
-
656
- 1. **输出总结**:
657
- ```
658
- ✅ 工具初始化完成
659
-
660
- 已安装和配置:
661
- - ✅ ESLint (已安装并配置)
662
- - ✅ Prettier (已安装并配置)
663
- - ✅ Ruff (已安装并配置)
664
- - ✅ Black (已安装并配置)
665
- - ✅ pre-commit (已安装并配置)
666
-
667
- 状态已保存到: .aodw/tools-status.yaml
668
- ```
669
-
670
- 2. **提供下一步建议**:
671
- - "现在可以开始开发了"
672
- - "如果遇到工具相关问题,可以再次运行工具初始化"
673
-
674
- 3. **提醒编码规范**:
675
- - "工具已初始化,编码时将自动检查工具状态"
676
- - "如果工具状态异常,编码将被阻止"