sumulige-claude 1.5.1 → 1.6.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 (223) hide show
  1. package/.claude/hooks/hook-registry.json +0 -15
  2. package/.claude/rules/coding-style.md +18 -7
  3. package/.claude/rules/hooks.md +15 -4
  4. package/.claude/rules/performance.md +15 -5
  5. package/.claude/rules/security.md +140 -4
  6. package/.claude/rules/testing.md +138 -9
  7. package/.claude/rules/web-design-standard.md +16 -5
  8. package/.claude/skills/algorithmic-art/metadata.yaml +28 -0
  9. package/.claude/skills/api-tester/SKILL.md +61 -0
  10. package/.claude/skills/api-tester/examples/basic.md +3 -0
  11. package/.claude/skills/api-tester/metadata.yaml +30 -0
  12. package/.claude/skills/api-tester/templates/default.md +3 -0
  13. package/.claude/skills/brand-guidelines/metadata.yaml +26 -0
  14. package/.claude/skills/canvas-design/metadata.yaml +27 -0
  15. package/.claude/skills/code-reviewer-123/SKILL.md +61 -0
  16. package/.claude/skills/code-reviewer-123/examples/basic.md +3 -0
  17. package/.claude/skills/code-reviewer-123/metadata.yaml +30 -0
  18. package/.claude/skills/code-reviewer-123/templates/default.md +3 -0
  19. package/.claude/skills/doc-coauthoring/metadata.yaml +27 -0
  20. package/.claude/skills/docx/metadata.yaml +30 -0
  21. package/.claude/skills/frontend-design/metadata.yaml +28 -0
  22. package/.claude/skills/internal-comms/metadata.yaml +28 -0
  23. package/.claude/skills/mcp-builder/metadata.yaml +26 -0
  24. package/.claude/skills/my-skill/SKILL.md +61 -0
  25. package/.claude/skills/my-skill/examples/basic.md +3 -0
  26. package/.claude/skills/my-skill/metadata.yaml +30 -0
  27. package/.claude/skills/my-skill/templates/default.md +3 -0
  28. package/.claude/skills/pdf/metadata.yaml +29 -0
  29. package/.claude/skills/pptx/metadata.yaml +29 -0
  30. package/.claude/skills/react-best-practices/metadata.yaml +26 -0
  31. package/.claude/skills/react-node-practices/SKILL.md +409 -0
  32. package/.claude/skills/react-node-practices/metadata.yaml +56 -0
  33. package/.claude/skills/skill-creator/metadata.yaml +25 -0
  34. package/.claude/skills/slack-gif-creator/metadata.yaml +28 -0
  35. package/.claude/skills/test-skill-name/SKILL.md +61 -0
  36. package/.claude/skills/test-skill-name/examples/basic.md +3 -0
  37. package/.claude/skills/test-skill-name/metadata.yaml +30 -0
  38. package/.claude/skills/test-skill-name/templates/default.md +3 -0
  39. package/.claude/skills/test-workflow/metadata.yaml +32 -0
  40. package/.claude/skills/theme-factory/metadata.yaml +26 -0
  41. package/.claude/skills/threejs-fundamentals/metadata.yaml +27 -0
  42. package/.claude/skills/web-artifacts-builder/metadata.yaml +30 -0
  43. package/.claude/skills/web-design-guidelines/metadata.yaml +26 -0
  44. package/.claude/skills/webapp-testing/metadata.yaml +26 -0
  45. package/.claude/skills/xlsx/metadata.yaml +29 -0
  46. package/LICENSE +21 -0
  47. package/README.md +280 -529
  48. package/cli.js +19 -3
  49. package/package.json +29 -3
  50. package/template/.codex/README.md +69 -0
  51. package/template/.codex/config.toml +56 -0
  52. package/template/AGENTS.md +94 -0
  53. package/.claude/.kickoff-hint.txt +0 -52
  54. package/.claude/.sumulige-claude-version +0 -1
  55. package/.claude/.version +0 -1
  56. package/.claude/AGENTS.md +0 -42
  57. package/.claude/ANCHORS.md +0 -40
  58. package/.claude/CLAUDE.md +0 -138
  59. package/.claude/MEMORY.md +0 -69
  60. package/.claude/PROJECT_LOG.md +0 -101
  61. package/.claude/THINKING_CHAIN_GUIDE.md +0 -287
  62. package/.claude/USAGE.md +0 -175
  63. package/.claude/boris-optimizations.md +0 -167
  64. package/.claude/handoffs/INDEX.md +0 -21
  65. package/.claude/handoffs/LATEST.md +0 -76
  66. package/.claude/handoffs/handoff_2026-01-22T13-07-04-757Z.md +0 -76
  67. package/.claude/quality-gate.json +0 -82
  68. package/.claude/rag/skill-index.json +0 -135
  69. package/.claude/settings.json +0 -99
  70. package/.claude/settings.local.json +0 -175
  71. package/.claude/templates/PROJECT_KICKOFF.md +0 -89
  72. package/.claude/templates/PROJECT_PROPOSAL.md +0 -227
  73. package/.claude/templates/TASK_PLAN.md +0 -121
  74. package/.claude/templates/hooks/README.md +0 -302
  75. package/.claude/templates/hooks/hook.sh.template +0 -94
  76. package/.claude/templates/hooks/user-prompt-submit.cjs.template +0 -116
  77. package/.claude/templates/hooks/user-response-submit.cjs.template +0 -94
  78. package/.claude/templates/hooks/validate.js +0 -173
  79. package/.claude/templates/tasks/develop.md +0 -69
  80. package/.claude/templates/tasks/research.md +0 -64
  81. package/.claude/templates/tasks/test.md +0 -96
  82. package/.claude/thinking-routes/.last-sync +0 -1
  83. package/.claude/thinking-routes/QUICKREF.md +0 -98
  84. package/.claude/workflow/document-scanner.js +0 -426
  85. package/.claude/workflow/knowledge-engine.js +0 -941
  86. package/.claude/workflow/notebooklm/browser.js +0 -1028
  87. package/.claude/workflow/phases/phase1-research.js +0 -578
  88. package/.claude/workflow/phases/phase1-research.ts +0 -465
  89. package/.claude/workflow/phases/phase2-approve.js +0 -722
  90. package/.claude/workflow/phases/phase3-plan.js +0 -1200
  91. package/.claude/workflow/phases/phase4-develop.js +0 -894
  92. package/.claude/workflow/search-cache.js +0 -230
  93. package/.claude/workflow/templates/approval.md +0 -315
  94. package/.claude/workflow/templates/development.md +0 -377
  95. package/.claude/workflow/templates/planning.md +0 -328
  96. package/.claude/workflow/templates/research.md +0 -250
  97. package/.claude/workflow/types.js +0 -37
  98. package/.claude/workflow/web-search.js +0 -278
  99. package/.claude-plugin/marketplace.json +0 -71
  100. package/.github/workflows/sync-skills.yml +0 -74
  101. package/.versionrc +0 -25
  102. package/AGENTS.md +0 -580
  103. package/CHANGELOG.md +0 -481
  104. package/CLAUDE-template.md +0 -114
  105. package/DEV_TOOLS_GUIDE.md +0 -190
  106. package/PROJECT_STRUCTURE.md +0 -266
  107. package/Q&A.md +0 -325
  108. package/config/defaults.json +0 -34
  109. package/config/official-skills.json +0 -183
  110. package/config/quality-gate.json +0 -67
  111. package/config/skill-categories.json +0 -40
  112. package/config/version-manifest.json +0 -85
  113. package/demos/power-3d-scatter.html +0 -683
  114. package/development/cache/web-search/search_1193d605f8eb364651fc2f2041b58a31.json +0 -36
  115. package/development/cache/web-search/search_3798bf06960edc125f744a1abb5b72c5.json +0 -36
  116. package/development/cache/web-search/search_37c7d4843a53f0d83f1122a6f908a2a3.json +0 -36
  117. package/development/cache/web-search/search_44166fa0153709ee168485a22aa0ab40.json +0 -36
  118. package/development/cache/web-search/search_4deaebb1f77e86a8ca066dc5a49c59fd.json +0 -36
  119. package/development/cache/web-search/search_94da91789466070a7f545612e73c7372.json +0 -36
  120. package/development/cache/web-search/search_dd5de8491b8b803a3cb01339cd210fb0.json +0 -36
  121. package/development/knowledge-base/.index.clean.json +0 -1
  122. package/development/knowledge-base/.index.json +0 -486
  123. package/development/knowledge-base/test-best-practices.md +0 -29
  124. package/development/projects/proj_mkh1pazz_ixmt1/phase1/feasibility-report.md +0 -160
  125. package/development/projects/proj_mkh4jvnb_z7rwf/phase1/feasibility-report.md +0 -160
  126. package/development/projects/proj_mkh4jxkd_ewz5a/phase1/feasibility-report.md +0 -160
  127. package/development/projects/proj_mkh4k84n_ni73k/phase1/feasibility-report.md +0 -160
  128. package/development/projects/proj_mkh4wfyd_u9w88/phase1/feasibility-report.md +0 -160
  129. package/development/projects/proj_mkh4wsbo_iahvf/development/projects/proj_mkh4xbpg_4na5w/phase1/feasibility-report.md +0 -160
  130. package/development/projects/proj_mkh4wsbo_iahvf/phase1/feasibility-report.md +0 -160
  131. package/development/projects/proj_mkh4xulg_1ka8x/phase1/feasibility-report.md +0 -160
  132. package/development/projects/proj_mkh4xwhj_gch8j/phase1/feasibility-report.md +0 -160
  133. package/development/projects/proj_mkh4y2qk_9lm8z/phase1/feasibility-report.md +0 -160
  134. package/development/projects/proj_mkh4y2qk_9lm8z/phase2/requirements.md +0 -226
  135. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/PRD.md +0 -345
  136. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/TASK_PLAN.md +0 -284
  137. package/development/projects/proj_mkh4y2qk_9lm8z/phase3/prototype/README.md +0 -14
  138. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/DEVELOPMENT_LOG.md +0 -35
  139. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/TASKS.md +0 -34
  140. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/.env.example +0 -5
  141. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/README.md +0 -60
  142. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/package.json +0 -25
  143. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/index.js +0 -70
  144. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/routes/index.js +0 -48
  145. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/health.test.js +0 -20
  146. package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/jest.config.js +0 -21
  147. package/development/projects/proj_mkh7veqg_3lypc/phase1/feasibility-report.md +0 -160
  148. package/development/projects/proj_mkh7veqg_3lypc/phase2/requirements.md +0 -226
  149. package/development/projects/proj_mkh7veqg_3lypc/phase3/PRD.md +0 -345
  150. package/development/projects/proj_mkh7veqg_3lypc/phase3/TASK_PLAN.md +0 -284
  151. package/development/projects/proj_mkh7veqg_3lypc/phase3/prototype/README.md +0 -14
  152. package/development/projects/proj_mkh8k8fo_rmqn5/phase1/feasibility-report.md +0 -160
  153. package/development/projects/proj_mkh8xyhy_1vshq/phase1/feasibility-report.md +0 -178
  154. package/development/projects/proj_mkh8zddd_dhamf/phase1/feasibility-report.md +0 -377
  155. package/development/projects/proj_mkh8zddd_dhamf/phase2/requirements.md +0 -442
  156. package/development/projects/proj_mkh8zddd_dhamf/phase3/api-design.md +0 -800
  157. package/development/projects/proj_mkh8zddd_dhamf/phase3/architecture.md +0 -625
  158. package/development/projects/proj_mkh8zddd_dhamf/phase3/data-model.md +0 -830
  159. package/development/projects/proj_mkh8zddd_dhamf/phase3/risks.md +0 -957
  160. package/development/projects/proj_mkh8zddd_dhamf/phase3/wbs.md +0 -381
  161. package/development/todos/.state.json +0 -19
  162. package/development/todos/INDEX.md +0 -63
  163. package/development/todos/active/_README.md +0 -49
  164. package/development/todos/archived/_README.md +0 -11
  165. package/development/todos/backlog/_README.md +0 -11
  166. package/development/todos/backlog/mcp-integration.md +0 -35
  167. package/development/todos/completed/_README.md +0 -11
  168. package/development/todos/completed/boris-optimizations.md +0 -39
  169. package/development/todos/completed/develop/local-knowledge-index.md +0 -85
  170. package/development/todos/completed/develop/todo-system.md +0 -47
  171. package/development/todos/completed/develop/web-search-integration.md +0 -83
  172. package/development/todos/completed/test/phase1-e2e-test.md +0 -103
  173. package/docs/DEVELOPMENT.md +0 -461
  174. package/docs/MARKETPLACE.md +0 -352
  175. package/docs/RELEASE.md +0 -93
  176. package/jest.config.js +0 -63
  177. package/lib/commands.js +0 -3588
  178. package/lib/config-manager.js +0 -441
  179. package/lib/config-schema.js +0 -408
  180. package/lib/config-validator.js +0 -330
  181. package/lib/config.js +0 -122
  182. package/lib/errors.js +0 -305
  183. package/lib/incremental-sync.js +0 -274
  184. package/lib/marketplace.js +0 -487
  185. package/lib/migrations.js +0 -154
  186. package/lib/permission-audit.js +0 -255
  187. package/lib/quality-gate.js +0 -431
  188. package/lib/quality-rules.js +0 -373
  189. package/lib/utils.js +0 -150
  190. package/lib/version-check.js +0 -169
  191. package/lib/version-manifest.js +0 -171
  192. package/project-paradigm.md +0 -313
  193. package/prompts/how-to-find.md +0 -163
  194. package/prompts/linus-architect.md +0 -71
  195. package/prompts/software-architect.md +0 -173
  196. package/prompts/web-designer.md +0 -249
  197. package/scripts/fix-hooks.mjs +0 -97
  198. package/scripts/sync-external.mjs +0 -298
  199. package/scripts/sync-to-home.sh +0 -108
  200. package/scripts/update-registry.mjs +0 -325
  201. package/sources.yaml +0 -83
  202. package/tests/README.md +0 -263
  203. package/tests/commands.test.js +0 -1086
  204. package/tests/config-manager.test.js +0 -677
  205. package/tests/config-schema.test.js +0 -425
  206. package/tests/config-validator.test.js +0 -436
  207. package/tests/config.test.js +0 -100
  208. package/tests/errors.test.js +0 -477
  209. package/tests/manual/phase1-e2e.sh +0 -389
  210. package/tests/manual/phase2-test-cases.md +0 -311
  211. package/tests/manual/phase3-test-cases.md +0 -309
  212. package/tests/manual/phase4-test-cases.md +0 -414
  213. package/tests/manual/test-cases.md +0 -417
  214. package/tests/marketplace.test.js +0 -420
  215. package/tests/migrations.test.js +0 -187
  216. package/tests/quality-gate.test.js +0 -679
  217. package/tests/quality-rules.test.js +0 -619
  218. package/tests/sync-external.test.js +0 -214
  219. package/tests/update-registry.test.js +0 -251
  220. package/tests/utils.test.js +0 -171
  221. package/tests/version-check.test.js +0 -75
  222. package/tests/web-search.test.js +0 -392
  223. package/thinkinglens-silent.md +0 -138
@@ -1,800 +0,0 @@
1
- # API Design Document
2
-
3
- **Project**: proj_mkh8zddd_dhamf (AI 代码审查工具)
4
- **Date**: 1/17/2026
5
- **Phase**: 3 - Planning
6
- **Status**: In Progress
7
-
8
- ---
9
-
10
- ## Executive Summary
11
-
12
- 本文档定义 AI 代码审查工具的 CLI 命令接口、配置文件格式和输出格式规范。
13
-
14
- **设计原则**:
15
- - **简洁**: 最少的命令完成常用任务
16
- - **直观**: 默认行为符合用户预期
17
- - **可配置**: 支持项目级和全局配置
18
- - **可扩展**: 易于添加新命令和选项
19
-
20
- ---
21
-
22
- ## 1. CLI Command Design
23
-
24
- ### 1.1 Command Overview
25
-
26
- ```
27
- smc-review <command> [options] [arguments]
28
-
29
- Commands:
30
- scan Scan code for issues
31
- init Initialize configuration in current directory
32
- config Manage configuration
33
- report Generate reports from scan results
34
- version Show version information
35
- help Show help information
36
-
37
- Global Options:
38
- -c, --config <file> Use specific config file
39
- -v, --verbose Enable verbose output
40
- -q, --quiet Suppress non-error output
41
- --no-color Disable colored output
42
- ```
43
-
44
- ### 1.2 Command Details
45
-
46
- #### 1.2.1 scan
47
-
48
- 扫描代码库中的问题。
49
-
50
- ```
51
- Usage: smc-review scan [options] [path]
52
-
53
- Arguments:
54
- path Path to scan (default: current directory)
55
- Can be a file, directory, or glob pattern
56
-
57
- Options:
58
- -o, --output <format> Output format: table, json, markdown, sarif (default: table)
59
- -r, --recursive Scan subdirectories recursively (default: true)
60
- --rules <rules> Comma-separated list of rules to run (default: all)
61
- --exclude <patterns> Comma-separated glob patterns to exclude
62
- --severity <level> Minimum severity: critical, high, medium, low (default: low)
63
- --diff Only scan changed files (git diff)
64
- --cached Use cached AST results when available
65
- --ai Enable AI-enhanced analysis (requires API key)
66
- --no-ai Disable AI analysis even if configured
67
- --timeout <seconds> Maximum scan time (default: 300)
68
- -j, --jobs <n> Number of parallel jobs (default: CPU count)
69
- --output-file <file> Write output to file instead of stdout
70
-
71
- Examples:
72
- smc-review scan ./src
73
- smc-review scan --diff --severity high
74
- smc-review scan --output json --output-file results.json
75
- smc-review scan --exclude "node_modules/**/*.js,dist/**"
76
- ```
77
-
78
- #### 1.2.2 init
79
-
80
- 初始化项目配置。
81
-
82
- ```
83
- Usage: smc-review init [options]
84
-
85
- Options:
86
- -f, --force Overwrite existing config file
87
- --template <name> Use preset template: default, strict, relaxed
88
- --interactive Interactive mode with prompts
89
-
90
- Examples:
91
- smc-review init
92
- smc-review init --template strict
93
- smc-review init --force
94
- ```
95
-
96
- #### 1.2.3 config
97
-
98
- 管理配置。
99
-
100
- ```
101
- Usage: smc-review config <subcommand> [options]
102
-
103
- Subcommands:
104
- get <key> Get configuration value
105
- set <key> <value> Set configuration value
106
- list List all configuration
107
- validate Validate current configuration
108
- reset Reset to default configuration
109
-
110
- Options:
111
- --global Operate on global config (~/.config/smc-review/)
112
- --project Operate on project config (.code-review.yml)
113
-
114
- Examples:
115
- smc-review config list
116
- smc-review config set scan.severity high
117
- smc-review config get rules.enabled
118
- smc-review config validate --project
119
- ```
120
-
121
- #### 1.2.4 report
122
-
123
- 从扫描结果生成报告。
124
-
125
- ```
126
- Usage: smc-review report [options]
127
-
128
- Options:
129
- -i, --input <file> Input scan results file (JSON format)
130
- -o, --output <file> Output report file
131
- -f, --format <fmt> Report format: markdown, html, pdf, json
132
- -t, --template <tpl> Custom report template
133
- --trend Generate trend report (requires history)
134
-
135
- Examples:
136
- smc-review report -i scan-results.json -o report.md
137
- smc-review report --input results.json --format html --output report.html
138
- smc-review report --trend --days 30
139
- ```
140
-
141
- #### 1.2.5 version
142
-
143
- 显示版本信息。
144
-
145
- ```
146
- Usage: smc-review version
147
-
148
- Output:
149
- smc-review v1.0.0
150
- Build: 2026-01-17
151
- Tree-sitter: v0.20.0
152
- Supported languages: Python, JavaScript, TypeScript
153
- ```
154
-
155
- ### 1.3 Exit Codes
156
-
157
- | Code | Meaning |
158
- |------|---------|
159
- | 0 | Success, no issues found |
160
- | 1 | Issues found (severity at or above threshold) |
161
- | 2 | Error occurred (invalid args, file not found, etc.) |
162
- | 3 | Configuration error |
163
- | 4 | Scan timeout |
164
- | 5 | LLM API error |
165
-
166
- ---
167
-
168
- ## 2. Configuration File Format
169
-
170
- ### 2.1 File Location
171
-
172
- 配置文件按优先级从高到低:
173
-
174
- 1. `--config` 指定的文件
175
- 2. 当前目录的 `.code-review.yml`
176
- 3. 项目根目录的 `.code-review.yml`
177
- 4. `~/.config/smc-review/config.yml`
178
-
179
- ### 2.2 Configuration Schema
180
-
181
- ```yaml
182
- # .code-review.yml
183
- version: "1.0"
184
-
185
- # Scan configuration
186
- scan:
187
- # Paths to include (glob patterns)
188
- include:
189
- - "**/*.py"
190
- - "**/*.js"
191
- - "**/*.ts"
192
- - "**/*.jsx"
193
- - "**/*.tsx"
194
-
195
- # Paths to exclude (glob patterns)
196
- exclude:
197
- - "node_modules/**"
198
- - "dist/**"
199
- - "build/**"
200
- - "vendor/**"
201
- - "**/*.min.js"
202
- - "**/*.test.js"
203
- - "**/*.spec.js"
204
-
205
- # Minimum severity to report
206
- min_severity: low # critical, high, medium, low
207
-
208
- # Recursive scan
209
- recursive: true
210
-
211
- # Parallel jobs
212
- jobs: 4
213
-
214
- # Cache settings
215
- cache:
216
- enabled: true
217
- ttl: 86400 # 24 hours in seconds
218
-
219
- # Rules configuration
220
- rules:
221
- # Enable/disable rule categories
222
- categories:
223
- security:
224
- enabled: true
225
- severity: high
226
- quality:
227
- enabled: true
228
- severity: medium
229
- performance:
230
- enabled: false
231
-
232
- # Specific rule settings
233
- specific:
234
- - id: sql-injection
235
- enabled: true
236
- severity: critical
237
- languages: [python, javascript]
238
-
239
- - id: xss
240
- enabled: true
241
- severity: high
242
- languages: [javascript, typescript]
243
-
244
- - id: long-function
245
- enabled: true
246
- severity: low
247
- params:
248
- max_lines: 50
249
-
250
- - id: high-complexity
251
- enabled: true
252
- severity: medium
253
- params:
254
- max_complexity: 10
255
-
256
- # Custom rules (inline definition)
257
- custom: []
258
-
259
- # AI Configuration (optional)
260
- ai:
261
- enabled: false
262
- provider: anthropic # anthropic, openai, local
263
- model: claude-3-5-sonnet-20241022
264
-
265
- # API settings
266
- api:
267
- endpoint: https://api.anthropic.com/v1/messages
268
- timeout: 30
269
- max_retries: 3
270
-
271
- # Prompt settings
272
- prompt:
273
- temperature: 0.3
274
- max_tokens: 1000
275
-
276
- # Cost control
277
- cost_control:
278
- max_requests_per_scan: 10
279
- max_tokens_per_scan: 10000
280
-
281
- # Output configuration
282
- output:
283
- # Default format
284
- format: table # table, json, markdown, sarif
285
-
286
- # Colored output
287
- color: auto # auto, always, never
288
-
289
- # Show code snippets in output
290
- show_snippets: true
291
-
292
- # Snippet context lines
293
- context_lines: 3
294
-
295
- # Ignore patterns (similar to .gitignore)
296
- ignore:
297
- # Specific files
298
- files:
299
- - "**/__pycache__/**"
300
- - "**/pyvenv/**"
301
- - "**/.venv/**"
302
-
303
- # Specific issues (by ID or pattern)
304
- issues:
305
- - id: long-function
306
- files: ["**/test_*.py", "**/*_test.py"]
307
- reason: "Test functions can be longer"
308
- - id: no-docstring
309
- files: ["**/migrations/**"]
310
-
311
- # Integration settings
312
- integrations:
313
- github:
314
- enabled: false
315
- # Auto-comment on PRs
316
- pr_comment: true
317
- # Fail checks on issues
318
- fail_on_severity: high
319
-
320
- # Report configuration
321
- reports:
322
- # History tracking
323
- history:
324
- enabled: true
325
- retention_days: 90
326
-
327
- # Trend analysis
328
- trends:
329
- enabled: true
330
- comparison_period: 7 # days
331
- ```
332
-
333
- ### 2.3 Configuration Templates
334
-
335
- #### 2.3.1 Default Template
336
-
337
- ```yaml
338
- # Balanced configuration for general use
339
- scan:
340
- min_severity: medium
341
- rules:
342
- categories:
343
- security:
344
- enabled: true
345
- quality:
346
- enabled: true
347
- ai:
348
- enabled: false
349
- ```
350
-
351
- #### 2.3.2 Strict Template
352
-
353
- ```yaml
354
- # Strict configuration for security-critical projects
355
- scan:
356
- min_severity: low
357
- rules:
358
- categories:
359
- security:
360
- enabled: true
361
- severity: critical
362
- quality:
363
- enabled: true
364
- severity: low
365
- ai:
366
- enabled: true
367
- cost_control:
368
- max_requests_per_scan: 50
369
- integrations:
370
- github:
371
- fail_on_severity: medium
372
- ```
373
-
374
- #### 2.3.3 Relaxed Template
375
-
376
- ```yaml
377
- # Relaxed configuration for learning/prototyping
378
- scan:
379
- min_severity: high
380
- rules:
381
- categories:
382
- security:
383
- enabled: true
384
- quality:
385
- enabled: false
386
- ai:
387
- enabled: false
388
- ignore:
389
- issues:
390
- - id: long-function
391
- reason: "Not enforced in relaxed mode"
392
- ```
393
-
394
- ### 2.4 Environment Variables
395
-
396
- | Variable | Description | Default |
397
- |----------|-------------|---------|
398
- | `SMC_REVIEW_CONFIG` | Path to config file | - |
399
- | `SMC_REVIEW_API_KEY` | LLM API key | - |
400
- | `SMC_REVIEW_CACHE_DIR` | Cache directory | `~/.cache/smc-review` |
401
- | `SMC_REVIEW_LOG_LEVEL` | Log level | `info` |
402
- | `SMC_REVIEW_NO_COLOR` | Disable colors | `false` |
403
- | `SMC_REVIEW_JOBS` | Default parallel jobs | CPU count |
404
-
405
- ---
406
-
407
- ## 3. Output Formats
408
-
409
- ### 3.1 Table Format (Default)
410
-
411
- ```
412
- Code Review Results
413
-
414
- Summary
415
- -------
416
- Files scanned: 47
417
- Issues found: 12
418
- Critical: 2
419
- High: 4
420
- Medium: 4
421
- Low: 2
422
-
423
- Issues
424
- ------
425
-
426
- CRITICAL src/auth/login.py:45
427
- SQL Injection: User input directly concatenated into SQL query
428
- def authenticate(username, password):
429
- query = f"SELECT * FROM users WHERE username='{username}'"
430
- ^^^^^^^^^^^^^^^^^^^^^^^^
431
-
432
- HIGH src/services/payment.js:23
433
- XSS Vulnerability: User input rendered without sanitization
434
- function renderComment(comment) {
435
- return `<div>${comment.text}</div>`;
436
- ^^^^^^^^^^^
437
-
438
- MEDIUM src/utils/helpers.py:89
439
- Long Function: Function exceeds 50 lines (67 lines)
440
- def process_data(data, options, config):
441
- ...
442
-
443
- LOW src/api/routes.py:156
444
- Missing Docstring: Public function lacks documentation
445
- def calculate_total(items):
446
-
447
- Scan completed in 3.2s
448
- ```
449
-
450
- ### 3.2 JSON Format
451
-
452
- ```json
453
- {
454
- "version": "1.0.0",
455
- "scan_id": "scan_20260117_123456",
456
- "timestamp": "2026-01-17T12:34:56Z",
457
- "summary": {
458
- "files_scanned": 47,
459
- "total_issues": 12,
460
- "by_severity": {
461
- "critical": 2,
462
- "high": 4,
463
- "medium": 4,
464
- "low": 2
465
- },
466
- "by_category": {
467
- "security": 6,
468
- "quality": 4,
469
- "performance": 2
470
- }
471
- },
472
- "issues": [
473
- {
474
- "id": "issue_001",
475
- "rule_id": "sql-injection",
476
- "severity": "critical",
477
- "category": "security",
478
- "title": "SQL Injection",
479
- "description": "User input directly concatenated into SQL query",
480
- "file": "src/auth/login.py",
481
- "line": 45,
482
- "column": 12,
483
- "end_line": 45,
484
- "end_column": 50,
485
- "code_snippet": "query = f\"SELECT * FROM users WHERE username='{username}'\"",
486
- "suggestion": "Use parameterized queries instead",
487
- "suggested_code": "cursor.execute(\"SELECT * FROM users WHERE username=%s\", (username,))",
488
- "references": [
489
- "https://owasp.org/www-community/attacks/SQL_Injection"
490
- ],
491
- "confidence": "high",
492
- "ai_enhanced": false
493
- }
494
- ],
495
- "performance": {
496
- "duration_seconds": 3.2,
497
- "files_per_second": 14.7
498
- }
499
- }
500
- ```
501
-
502
- ### 3.3 Markdown Format
503
-
504
- ```markdown
505
- # Code Review Report
506
-
507
- **Generated**: 2026-01-17 12:34:56 UTC
508
- **Scan ID**: `scan_20260117_123456`
509
-
510
- ## Summary
511
-
512
- | Metric | Value |
513
- |--------|-------|
514
- | Files Scanned | 47 |
515
- | Total Issues | 12 |
516
- | Critical | 2 |
517
- | High | 4 |
518
- | Medium | 4 |
519
- | Low | 2 |
520
-
521
- ## Critical Issues
522
-
523
- ### SQL Injection in `src/auth/login.py:45`
524
-
525
- **Severity**: Critical
526
- **Category**: Security
527
-
528
- User input directly concatenated into SQL query.
529
-
530
- ```python
531
- def authenticate(username, password):
532
- query = f"SELECT * FROM users WHERE username='{username}'"
533
- cursor.execute(query)
534
- ```
535
-
536
- **Suggestion**:
537
- Use parameterized queries to prevent SQL injection.
538
-
539
- ```python
540
- def authenticate(username, password):
541
- query = "SELECT * FROM users WHERE username=%s"
542
- cursor.execute(query, (username,))
543
- ```
544
-
545
- **References**:
546
- - [OWASP SQL Injection](https://owasp.org/www-community/attacks/SQL_Injection)
547
-
548
- ---
549
-
550
- ## High Issues
551
-
552
- ### XSS Vulnerability in `src/services/payment.js:23`
553
-
554
- ...
555
-
556
- ---
557
-
558
- ## Performance
559
-
560
- | Metric | Value |
561
- |--------|-------|
562
- | Scan Duration | 3.2s |
563
- | Files/Second | 14.7 |
564
-
565
- ---
566
-
567
- *Generated by smc-review v1.0.0*
568
- ```
569
-
570
- ### 3.4 SARIF Format
571
-
572
- ```json
573
- {
574
- "version": "2.1.0",
575
- "$schema": "https://json.schemastore.org/sarif-2.1.0.json",
576
- "runs": [
577
- {
578
- "tool": {
579
- "driver": {
580
- "name": "smc-review",
581
- "version": "1.0.0",
582
- "informationUri": "https://github.com/smc-review/smc-review"
583
- }
584
- },
585
- "results": [
586
- {
587
- "ruleId": "sql-injection",
588
- "level": "error",
589
- "message": {
590
- "text": "User input directly concatenated into SQL query"
591
- },
592
- "locations": [
593
- {
594
- "physicalLocation": {
595
- "artifactLocation": {
596
- "uri": "src/auth/login.py"
597
- },
598
- "region": {
599
- "startLine": 45,
600
- "startColumn": 12,
601
- "endLine": 45,
602
- "endColumn": 50
603
- }
604
- }
605
- }
606
- ]
607
- }
608
- ]
609
- }
610
- ]
611
- }
612
- ```
613
-
614
- ---
615
-
616
- ## 4. GitHub Actions Integration
617
-
618
- ### 4.1 Action Configuration
619
-
620
- ```yaml
621
- # .github/workflows/code-review.yml
622
- name: Code Review
623
-
624
- on:
625
- pull_request:
626
- types: [opened, synchronize, reopened]
627
- push:
628
- branches: [main, develop]
629
-
630
- permissions:
631
- contents: read
632
- pull-requests: write
633
-
634
- jobs:
635
- code-review:
636
- runs-on: ubuntu-latest
637
- steps:
638
- - name: Checkout code
639
- uses: actions/checkout@v4
640
- with:
641
- fetch-depth: 0
642
-
643
- - name: Install smc-review
644
- run: |
645
- curl -L https://github.com/smc-review/smc-review/releases/latest/download/smc-review-linux-amd64.tar.gz | tar xz
646
- sudo mv smc-review /usr/local/bin/
647
- smc-review version
648
-
649
- - name: Run code review
650
- id: review
651
- env:
652
- SMC_REVIEW_API_KEY: ${{ secrets.SMC_REVIEW_API_KEY }}
653
- run: |
654
- smc-review scan --diff --output json --output-file results.json
655
-
656
- - name: Post PR comment
657
- if: github.event_name == 'pull_request'
658
- uses: actions/github-script@v7
659
- with:
660
- script: |
661
- const fs = require('fs');
662
- const results = JSON.parse(fs.readFileSync('results.json', 'utf8'));
663
- const body = formatResults(results);
664
- github.rest.issues.createComment({
665
- issue_number: context.issue.number,
666
- owner: context.repo.owner,
667
- repo: context.repo.repo,
668
- body: body
669
- });
670
-
671
- - name: Upload results
672
- uses: actions/upload-artifact@v4
673
- with:
674
- name: code-review-results
675
- path: results.json
676
- ```
677
-
678
- ### 4.2 Action Inputs
679
-
680
- | Input | Description | Required | Default |
681
- |-------|-------------|----------|---------|
682
- | `path` | Path to scan | No | `.` |
683
- | `format` | Output format | No | `table` |
684
- | `severity` | Minimum severity | No | `low` |
685
- | `ai-enabled` | Enable AI analysis | No | `false` |
686
- | `config-file` | Custom config file | No | `.code-review.yml` |
687
-
688
- ### 4.3 Action Outputs
689
-
690
- | Output | Description |
691
- |--------|-------------|
692
- | `results-file` | Path to results JSON |
693
- | `issue-count` | Number of issues found |
694
- | `critical-count` | Number of critical issues |
695
- | `high-count` | Number of high issues |
696
-
697
- ---
698
-
699
- ## 5. Error Messages
700
-
701
- ### 5.1 Error Format
702
-
703
- ```
704
- Error: <error message>
705
- Details: <additional context>
706
- Hint: <suggested action>
707
- ```
708
-
709
- ### 5.2 Common Errors
710
-
711
- | Error | Message | Hint |
712
- |-------|---------|------|
713
- | `E001` | Configuration file not found | Run `smc-review init` to create a config file |
714
- | `E002` | Invalid configuration | Run `smc-review config validate` for details |
715
- | `E003` | No files to scan | Check include/exclude patterns |
716
- | `E004` | Parse error in file | Fix syntax errors or exclude the file |
717
- | `E005` | LLM API timeout | Increase timeout with `--ai-timeout` or disable AI |
718
- | `E006` | Cache write failed | Check disk space or disable cache |
719
- | `E007` | Rule compilation failed | Check rule syntax in config file |
720
-
721
- ---
722
-
723
- ## 6. API Reference (Internal)
724
-
725
- ### 6.1 Go Package Structure
726
-
727
- ```go
728
- // Package cli provides the command-line interface
729
- package cli
730
-
731
- // Scanner performs code scanning
732
- type Scanner struct {
733
- config *config.Config
734
- parser parser.Parser
735
- rules *ruleengine.Engine
736
- llm llm.Client
737
- }
738
-
739
- // ScanResult contains the results of a scan
740
- type ScanResult struct {
741
- ScanID string
742
- Timestamp time.Time
743
- Summary Summary
744
- Issues []Issue
745
- Performance Performance
746
- }
747
-
748
- // ScanOptions configures the scan operation
749
- type ScanOptions struct {
750
- Path string
751
- Output Format
752
- Severity Severity
753
- Diff bool
754
- AI bool
755
- Jobs int
756
- Timeout time.Duration
757
- }
758
- ```
759
-
760
- ### 6.2 CLI Handler Signatures
761
-
762
- ```go
763
- // Command handlers
764
- func NewRootCmd() *cobra.Command
765
- func NewScanCmd() *cobra.Command
766
- func NewInitCmd() *cobra.Command
767
- func NewConfigCmd() *cobra.Command
768
- func NewReportCmd() *cobra.Command
769
- func NewVersionCmd() *cobra.Command
770
-
771
- // Scan runner
772
- func RunScan(opts ScanOptions) (*ScanResult, error)
773
-
774
- // Configuration
775
- func LoadConfig(path string) (*config.Config, error)
776
- func ValidateConfig(cfg *config.Config) error
777
- ```
778
-
779
- ---
780
-
781
- ## 7. Next Steps
782
-
783
- 1. Review CLI command design with stakeholders
784
- 2. Prototype table output format
785
- 3. Implement configuration loader
786
- 4. Create GitHub Action marketplace entry
787
- 5. Proceed to data model design (data-model.md)
788
-
789
- ---
790
-
791
- ## Metadata
792
-
793
- - **Created**: 1/17/2026
794
- - **Author**: Phase 3 Design Executor
795
- - **Status**: Draft for Review
796
- - **Related Docs**: phase3/architecture.md
797
-
798
- ---
799
-
800
- *This API design document defines the external interfaces of the AI Code Review Tool.*