speccrew 0.2.1 → 0.2.3

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.
@@ -0,0 +1,442 @@
1
+ ---
2
+ name: speccrew-dev-review
3
+ description: Code Review SOP for validating development outputs against design documents. Acts as an independent reviewer (separate from dev worker) to verify file completeness, code compliance, API consistency, and business logic integrity. Read-only operation - reports findings without modifying code.
4
+ tools: Read, Grep, Glob
5
+ ---
6
+
7
+ # Trigger Scenarios
8
+
9
+ - When speccrew-system-developer dispatches code review for a completed module
10
+ - When user requests "Review this module's implementation"
11
+ - When user asks "Check if code matches design" or "Verify implementation completeness"
12
+ - When incremental review is needed after partial implementation
13
+
14
+ # Input Parameters
15
+
16
+ | Parameter | Required | Description |
17
+ |-----------|----------|-------------|
18
+ | `design_doc_path` | Yes | Path to module design document (e.g., `03.system-design/module-designs/backend-spring/M6-employee-design.md`) |
19
+ | `implementation_report_path` | Yes | Path to development report (e.g., `04.dev-reports/backend-spring/M6-employee-implementation-report.md`) |
20
+ | `source_root` | Yes | Root directory of source code to review |
21
+ | `platform_id` | Yes | Platform identifier (backend-spring/web-vue/mobile-uniapp/desktop-tauri) |
22
+ | `api_contract_path` | No | Path to API contract file for endpoint validation |
23
+ | `task_id` | Yes | Task identifier from dispatch context |
24
+ | `previous_review_path` | No | Path to previous review report for incremental review (skip already passed items) |
25
+
26
+ # Workflow
27
+
28
+ ## Absolute Constraints
29
+
30
+ > **These rules apply to ALL review operations. Violation = review failure.**
31
+
32
+ 1. **READ-ONLY OPERATION** — NEVER modify any source code files. Only read and report findings.
33
+
34
+ 2. **FORBIDDEN: Code fixes** — Do NOT attempt to fix issues found. Only document them in the review report.
35
+
36
+ 3. **MANDATORY: Actionable output** — PARTIAL or FAIL results MUST include specific "Re-dispatch Guidance" with prioritized fix list.
37
+
38
+ 4. **INCREMENTAL REVIEW SUPPORT** — If `previous_review_path` is provided, skip items already marked as passed in previous review.
39
+
40
+ ## Step 1: Validate Input and Load Documents
41
+
42
+ ### 1.1 Check Required Inputs
43
+
44
+ Verify all required parameters are provided:
45
+
46
+ ```
47
+ IF design_doc_path missing → Report error, stop
48
+ IF implementation_report_path missing → Report error, stop
49
+ IF source_root missing → Report error, stop
50
+ IF platform_id missing → Report error, stop
51
+ IF task_id missing → Report error, stop
52
+ ```
53
+
54
+ ### 1.2 Read Design Document
55
+
56
+ Read the module design document at `design_doc_path`:
57
+
58
+ **Extract Required Information:**
59
+
60
+ | Section | What to Extract |
61
+ |---------|-----------------|
62
+ | Module Overview | Module name, description, responsibilities |
63
+ | File Structure | Complete list of required files (DO, VO, Mapper, Service, Controller, Convert, Enums, etc.) |
64
+ | Class Specifications | Class names, inheritance requirements, annotations required |
65
+ | API Endpoints | Endpoint definitions, HTTP methods, paths |
66
+ | Business Logic | Service methods, business rules, transaction requirements |
67
+
68
+ **Error Handling:**
69
+ - If design document not found → Report `DEPENDENCY_MISSING` error
70
+ - If design document malformed → Report `VALIDATION_ERROR` error
71
+
72
+ ### 1.3 Read Implementation Report
73
+
74
+ Read the development report at `implementation_report_path`:
75
+
76
+ **Extract Information:**
77
+
78
+ | Field | Purpose |
79
+ |-------|---------|
80
+ | Completed Files | List of files claimed to be implemented |
81
+ | Implementation Status | Which tasks were completed |
82
+ | Known Issues | Any documented deviations or issues |
83
+
84
+ ### 1.4 Read API Contract (if provided)
85
+
86
+ If `api_contract_path` is provided, read the API contract document:
87
+
88
+ **Extract for Validation:**
89
+
90
+ | Item | Validation Purpose |
91
+ |------|-------------------|
92
+ | Endpoint Definitions | Verify Controller implements all defined endpoints |
93
+ | Request/Response Schemas | Verify VO classes match contract fields |
94
+ | HTTP Methods | Verify correct HTTP method annotations |
95
+ | Error Codes | Verify consistent error handling |
96
+
97
+ ### 1.5 Load Previous Review (if incremental)
98
+
99
+ If `previous_review_path` is provided:
100
+
101
+ 1. Read previous review report
102
+ 2. Extract items marked as "PASSED" or "VERIFIED"
103
+ 3. These items can be skipped in current review (already validated)
104
+
105
+ ## Step 2: File Completeness Check
106
+
107
+ ### 2.1 Build Expected File List
108
+
109
+ From design document, extract complete file inventory:
110
+
111
+ **Backend-Spring File Categories:**
112
+
113
+ | Category | Pattern | Example |
114
+ |----------|---------|---------|
115
+ | Enums | `enums/*.java` | `enums/ErrorCodeConstants.java` |
116
+ | DO (Data Object) | `dal/dataobject/**/*.java` | `dal/dataobject/employee/EmployeeDO.java` |
117
+ | VO (View Object) | `controller/admin/vo/**/*.java` | `controller/admin/vo/EmployeeRespVO.java` |
118
+ | Mapper | `dal/mapper/**/*.java` | `dal/mapper/employee/EmployeeMapper.java` |
119
+ | Service Interface | `service/**/*.java` | `service/employee/EmployeeService.java` |
120
+ | Service Impl | `service/**/*.java` | `service/employee/EmployeeServiceImpl.java` |
121
+ | Controller | `controller/admin/**/*.java` | `controller/admin/employee/EmployeeController.java` |
122
+ | Convert | `convert/**/*.java` | `convert/employee/EmployeeConvert.java` |
123
+
124
+ **Other Platforms:**
125
+ Adapt file patterns based on `platform_id` conventions.
126
+
127
+ ### 2.2 Scan Actual Files
128
+
129
+ Use `Glob` to scan `source_root` for implemented files:
130
+
131
+ ```
132
+ FOR each category:
133
+ - Glob search for actual files matching category pattern
134
+ - Record found files
135
+ ```
136
+
137
+ ### 2.3 Compare and Calculate Completeness
138
+
139
+ Generate completeness matrix:
140
+
141
+ ```markdown
142
+ | Category | Required | Created | Missing |
143
+ |----------|----------|---------|---------|
144
+ | Enums | {count} | {count} | {count} |
145
+ | DO | {count} | {count} | {count} |
146
+ | VO | {count} | {count} | {count} |
147
+ | Mapper | {count} | {count} | {count} |
148
+ | Service | {count} | {count} | {count} |
149
+ | Controller | {count} | {count} | {count} |
150
+ | Convert | {count} | {count} | {count} |
151
+ | **Total** | **{total}** | **{total}** | **{total}** |
152
+ ```
153
+
154
+ **Completeness Percentage:**
155
+ ```
156
+ completeness_pct = (created_files / required_files) * 100
157
+ ```
158
+
159
+ ### 2.4 List Missing Files
160
+
161
+ Generate detailed list of missing files with expected paths:
162
+
163
+ ```markdown
164
+ ### Missing Files
165
+ 1. `{expected_path_1}`
166
+ 2. `{expected_path_2}`
167
+ ...
168
+ ```
169
+
170
+ ## Step 3: Code Compliance Check
171
+
172
+ ### 3.1 DO Class Compliance
173
+
174
+ For each found DO class, verify:
175
+
176
+ | Check | Rule | Severity |
177
+ |-------|------|----------|
178
+ | Base Class | Must extend correct base class (e.g., `TenantBaseDO`) | ERROR |
179
+ | @TableName | Must have `@TableName` annotation with correct table name | ERROR |
180
+ | @Schema | Must have `@Schema` annotation for documentation | WARN |
181
+ | Field Annotations | Required fields must have `@NotNull` or similar | WARN |
182
+ | Package | Must match design document package structure | ERROR |
183
+
184
+ ### 3.2 VO Class Compliance
185
+
186
+ For each found VO class, verify:
187
+
188
+ | Check | Rule | Severity |
189
+ |-------|------|----------|
190
+ | @Schema | All fields should have `@Schema` annotation | WARN |
191
+ | Validation | Required fields must have validation annotations | ERROR |
192
+ | Desensitization | Sensitive fields must have desensitization (e.g., phone, ID card) | ERROR |
193
+ | Package | Must match design document package structure | ERROR |
194
+
195
+ ### 3.3 Service Compliance
196
+
197
+ For each found Service, verify:
198
+
199
+ | Check | Rule | Severity |
200
+ |-------|------|----------|
201
+ | Interface | Must have Service interface and implementation separation | WARN |
202
+ | @Service | Implementation must have `@Service` annotation | ERROR |
203
+ | @Transactional | Methods with DB writes must have `@Transactional` | ERROR |
204
+ | Method Coverage | All methods defined in design must be implemented | ERROR |
205
+ | Data Permission | Must check data permissions where required | ERROR |
206
+
207
+ ### 3.4 Controller Compliance
208
+
209
+ For each found Controller, verify:
210
+
211
+ | Check | Rule | Severity |
212
+ |-------|------|----------|
213
+ | @RestController | Must have `@RestController` annotation | ERROR |
214
+ | @RequestMapping | Must have base `@RequestMapping` annotation | ERROR |
215
+ | @Operation | Endpoints should have `@Operation` for documentation | WARN |
216
+ | @PreAuthorize | Must have permission annotations where required | ERROR |
217
+ | Valid | Request VO parameters must have `@Valid` | ERROR |
218
+
219
+ ### 3.5 Naming Convention Check
220
+
221
+ Verify naming follows conventions:
222
+
223
+ | Element | Convention | Example |
224
+ |---------|------------|---------|
225
+ | Class Name | PascalCase, descriptive | `EmployeeServiceImpl` |
226
+ | Method Name | camelCase, verb-first | `createEmployee` |
227
+ | Variable Name | camelCase | `employeeList` |
228
+ | Constant | UPPER_SNAKE_CASE | `MAX_PAGE_SIZE` |
229
+
230
+ ## Step 4: API Consistency Check
231
+
232
+ ### 4.1 Endpoint Coverage
233
+
234
+ If `api_contract_path` provided, verify:
235
+
236
+ | Check | Description | Severity |
237
+ |-------|-------------|----------|
238
+ | All Endpoints Implemented | Every endpoint in contract exists in Controller | ERROR |
239
+ | HTTP Method Correct | `GET/POST/PUT/DELETE` matches contract | ERROR |
240
+ | Path Correct | URL path matches contract exactly | ERROR |
241
+ | Path Variables | `{id}` placeholders match contract | ERROR |
242
+
243
+ ### 4.2 Request/Response Consistency
244
+
245
+ Verify VO classes match API contract:
246
+
247
+ | Check | Description | Severity |
248
+ |-------|-------------|----------|
249
+ | All Fields Present | VO must have all fields defined in contract | ERROR |
250
+ | Field Types Match | Data types must match contract specification | ERROR |
251
+ | Required Fields | Non-nullable contract fields must be required in VO | ERROR |
252
+ | Field Names Match | JSON property names must match contract | ERROR |
253
+
254
+ ## Step 5: Business Logic Integrity Check
255
+
256
+ ### 5.1 Service Method Coverage
257
+
258
+ Compare Service implementation against design document:
259
+
260
+ | Check | Description | Severity |
261
+ |-------|-------------|----------|
262
+ | All Methods Implemented | Every method in design must exist in Service | ERROR |
263
+ | Method Signatures Match | Parameters and return types match design | ERROR |
264
+ | Business Rules Implemented | Key business rules from design are coded | ERROR |
265
+
266
+ ### 5.2 Critical Implementation Checks
267
+
268
+ | Aspect | What to Verify | Severity |
269
+ |--------|----------------|----------|
270
+ | Transaction Management | DB write operations in `@Transactional` | ERROR |
271
+ | Data Permission | Tenant/user isolation implemented | ERROR |
272
+ | Input Validation | Service layer validates inputs | ERROR |
273
+ | Error Handling | Proper exception handling and error codes | WARN |
274
+
275
+ ## Step 6: Generate Review Report
276
+
277
+ ### 6.1 Determine Review Result
278
+
279
+ Based on findings, determine overall result:
280
+
281
+ | Result | Criteria |
282
+ |--------|----------|
283
+ | **PASS** | All files created, no ERROR-level issues |
284
+ | **PARTIAL** | 50-99% files created, or has ERROR issues but not critical blockers |
285
+ | **FAIL** | <50% files created, or has critical blockers preventing functionality |
286
+
287
+ ### 6.2 Write Review Report
288
+
289
+ Generate review report at:
290
+ ```
291
+ speccrew-workspace/iterations/{number}-{type}-{name}/04.development/{platform_id}/[module]-review-report.md
292
+ ```
293
+
294
+ **Report Structure:**
295
+
296
+ ```markdown
297
+ ## Dev Review Report
298
+
299
+ ### Summary
300
+ - **Task ID**: {task_id}
301
+ - **Platform**: {platform_id}
302
+ - **Module**: {module_name}
303
+ - **Review Result**: PASS | PARTIAL | FAIL
304
+ - **Completeness**: {completed_files}/{total_files} ({percentage}%)
305
+
306
+ ### File Completeness
307
+ | Category | Required | Created | Missing |
308
+ |----------|----------|---------|---------|
309
+ | Enums | {n} | {n} | {n} |
310
+ | DO | {n} | {n} | {n} |
311
+ | VO | {n} | {n} | {n} |
312
+ | Mapper | {n} | {n} | {n} |
313
+ | Service | {n} | {n} | {n} |
314
+ | Controller | {n} | {n} | {n} |
315
+ | Convert | {n} | {n} | {n} |
316
+ | **Total** | **{n}** | **{n}** | **{n}** |
317
+
318
+ ### Missing Files
319
+ 1. `{path}`
320
+ 2. `{path}`
321
+ ...
322
+
323
+ ### Code Compliance Issues
324
+ 1. [{severity}] `{file}`: {issue_description}
325
+ 2. [{severity}] `{file}`: {issue_description}
326
+ ...
327
+
328
+ ### API Consistency Issues
329
+ 1. [{severity}] {issue_description}
330
+ ...
331
+
332
+ ### Business Logic Issues
333
+ 1. [{severity}] {issue_description}
334
+ ...
335
+
336
+ ### Verdict
337
+ {Detailed verdict explanation}
338
+
339
+ ### Re-dispatch Guidance
340
+ Priority items for next dev worker:
341
+ 1. {priority_item_1}
342
+ 2. {priority_item_2}
343
+ ...
344
+ ```
345
+
346
+ ## Step 7: Task Completion Report
347
+
348
+ Output structured Task Completion Report:
349
+
350
+ ### Success Report
351
+
352
+ ```markdown
353
+ ## Task Completion Report
354
+ - **Status**: SUCCESS
355
+ - **Task ID**: review-{original_task_id}
356
+ - **Platform**: {platform_id}
357
+ - **Module**: {module_name}
358
+ - **Output Files**:
359
+ - {review_report_path}
360
+ - **Summary**: Review {result}: {completed}/{total} files, {error_count} errors, {warn_count} warnings
361
+ ```
362
+
363
+ ### Failure Report
364
+
365
+ If review cannot be completed:
366
+
367
+ ```markdown
368
+ ## Task Completion Report
369
+ - **Status**: FAILED
370
+ - **Task ID**: review-{original_task_id}
371
+ - **Platform**: {platform_id}
372
+ - **Module**: {module_name}
373
+ - **Output Files**: None
374
+ - **Summary**: Review failed during {step}
375
+ - **Error**: {detailed error description}
376
+ - **Error Category**: DEPENDENCY_MISSING | VALIDATION_ERROR | BLOCKED
377
+ - **Partial Outputs**: None
378
+ - **Recovery Hint**: {suggestion for recovery}
379
+ ```
380
+
381
+ **Error Category Definitions:**
382
+ - `DEPENDENCY_MISSING`: Design document or implementation report not found
383
+ - `VALIDATION_ERROR`: Input parameters invalid or documents malformed
384
+ - `BLOCKED`: Cannot access source code directory or other blocking issue
385
+
386
+ # Key Rules
387
+
388
+ | Rule | Description |
389
+ |------|-------------|
390
+ | **Read-Only** | NEVER modify any source code - only report findings |
391
+ | **Blueprint-Driven** | Validate against design document specifications |
392
+ | **Actionable Output** | PARTIAL/FAIL must include specific fix guidance |
393
+ | **Incremental Support** | Skip already-passed items when previous review provided |
394
+ | **Severity Classification** | ERROR = must fix, WARN = should fix |
395
+ | **No Code Fixes** | Do NOT attempt to fix issues - only document them |
396
+ | **Completeness First** | File existence is primary check before content validation |
397
+
398
+ # Severity Levels
399
+
400
+ | Level | Definition | Action Required |
401
+ |-------|------------|-----------------|
402
+ | **ERROR** | Critical issue blocking functionality or violating core requirements | Must be fixed before PASS |
403
+ | **WARN** | Non-critical issue, best practice violation, or missing documentation | Should be fixed but not blocking |
404
+
405
+ # Checklist
406
+
407
+ - [ ] All required input parameters validated
408
+ - [ ] Design document successfully loaded and parsed
409
+ - [ ] Implementation report successfully loaded
410
+ - [ ] File completeness check completed with category breakdown
411
+ - [ ] Missing files list generated
412
+ - [ ] DO classes checked for base class and annotations
413
+ - [ ] VO classes checked for validation and desensitization
414
+ - [ ] Service classes checked for @Transactional and permissions
415
+ - [ ] Controller classes checked for annotations and endpoints
416
+ - [ ] API contract validated against implementation (if provided)
417
+ - [ ] Business logic coverage verified against design
418
+ - [ ] Review report written with clear verdict
419
+ - [ ] Re-dispatch guidance provided for PARTIAL/FAIL
420
+ - [ ] Task Completion Report output
421
+
422
+ # Platform-Specific Adaptations
423
+
424
+ ## backend-spring
425
+
426
+ - Check for Spring annotations: `@Service`, `@RestController`, `@Mapper`
427
+ - Verify MyBatis XML mappers exist alongside Mapper interfaces
428
+ - Check for Lombok `@Data` or similar on DO/VO classes
429
+ - Validate `@PreAuthorize` for permission control
430
+
431
+ ## web-vue / mobile-uniapp
432
+
433
+ - Check for Vue component file structure
434
+ - Verify API client methods match contract
435
+ - Check for Pinia/Vuex store implementations
436
+ - Validate route definitions
437
+
438
+ ## desktop-tauri
439
+
440
+ - Check for Rust module structure
441
+ - Verify command handlers registered
442
+ - Check for type-safe API bindings
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {