speccrew 0.5.15 โ†’ 0.5.16

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.
@@ -59,24 +59,25 @@ This skill operates in **strict sequential execution mode**:
59
59
  - Output step status after each step completion
60
60
  - Do NOT skip any step
61
61
 
62
- ## ๐Ÿšซ ABSOLUTE PROHIBITIONS (ZERO TOLERANCE)
62
+ ## ๐Ÿšซ ABSOLUTE PROHIBITIONS
63
63
 
64
- > **These rules apply to ALL steps. Violation = task failure.**
65
-
66
- 1. **FORBIDDEN: `create_file` for documents** โ€” NEVER use `create_file` to write the analysis document (`{{documentPath}}`). Documents MUST be created by copying the template (Step 5a) then filling sections with `search_replace` (Step 5b). `create_file` produces truncated output on large files.
67
-
68
- 2. **FORBIDDEN: File deletion** โ€” NEVER use `Remove-Item`, `del`, `rm`, `fs.unlinkSync`, or any delete command on generated files. If a file is malformed, fix it with `search_replace`.
69
-
70
- 3. **FORBIDDEN: Full-file rewrite** โ€” NEVER replace the entire document content in a single operation. Always use targeted `search_replace` on specific sections.
71
-
72
- 4. **MANDATORY: Template-first workflow** โ€” Step 5a (copy template) MUST execute before Step 5b (fill sections). Skipping Step 5a and writing content directly is FORBIDDEN.
64
+ - **NEVER** use `create_file` for documents - use template copy + `search_replace`
65
+ - **NEVER** delete generated files - fix with `search_replace`
66
+ - **NEVER** rewrite entire document - use targeted `search_replace`
67
+ - **ALWAYS** copy template (Step 5a) before filling sections (Step 5b)
73
68
 
74
69
  ## Output
75
70
 
76
71
  **Generated Files:**
77
72
  1. `{{documentPath}}` - Controller documentation file
78
73
  2. `{{completed_dir}}/{module}-{subpath}-{fileName}.done.json` - Completion status marker
79
- 3. `{{completed_dir}}/{module}-{subpath}-{fileName}.graph.json` - Graph data marker
74
+
75
+ **Graph Data Generation:**
76
+ Graph data (nodes, edges) construction is handled by `speccrew-knowledge-bizs-api-graph` Skill.
77
+ After completing API analysis, dispatch will invoke the graph skill to generate `.graph.json` files.
78
+
79
+ **See Also:**
80
+ - `speccrew-knowledge-bizs-api-graph` - Constructs knowledge graph data from API analysis results
80
81
 
81
82
  **Return Value:**
82
83
  ```json
@@ -297,47 +298,9 @@ public class UserController {
297
298
  - Include detailed business logic steps in Service layer
298
299
  - Mark each step with source file reference (Controller/Service/Mapper)
299
300
 
300
- 5. **Build Graph Data** (per controller):
301
-
302
- While analyzing the controller, simultaneously extract graph nodes and edges:
303
-
304
- **Nodes to Extract:**
305
-
306
- | Node Type | Source | ID Format | Context Fields |
307
- |-----------|--------|-----------|----------------|
308
- | `api` | Each public API endpoint | `api-{module}-{name}` | `method`, `path`, `params`, `tables`, `permissions` |
309
- | `service` | Each injected service | `service-{module}-{name}` | `methods`, `dependencies` |
310
- | `table` | Each database table accessed | `table-{module}-{tableName}` | `fields`, `indexes`, `engine` |
311
- | `dto` | Each request/response DTO | `dto-{module}-{name}` | `fields`, `validation` |
312
-
313
- **Edges to Extract:**
314
-
315
- | Edge Type | Direction | When to Create |
316
- |-----------|-----------|----------------|
317
- | `operates` | api โ†’ table | API endpoint reads/writes a database table |
318
- | `invokes` | api โ†’ service | Controller calls a service method |
319
- | `references` | api โ†’ dto | API endpoint uses a request/response DTO |
320
- | `depends-on` | service โ†’ service | Service depends on another service |
321
- | `maps-to` | dto โ†’ table | DO/Entity maps to database table |
322
-
323
- **Node ID Naming Convention:**
324
- ```
325
- {type}-{module}-{name}
326
- Examples:
327
- api-system-user-list
328
- api-system-user-create
329
- service-system-user-service
330
- table-system-system_user
331
- dto-system-user-create-req
332
- ```
333
-
334
- **IMPORTANT:**
335
- - `module` comes from `{{module}}` input variable
336
- - `name` should be a short, readable slug derived from the entity name
337
- - Each node must include `sourcePath` and `documentPath` (if applicable)
338
- - Edge `metadata` should include operation details (method name, SQL operation type, etc.)
301
+ **Output:** "Step 3 Status: โœ… COMPLETED - Extracted {{endpointCount}} API endpoints, {{flowCount}} business flows"
339
302
 
340
- **Output:** "Step 3 Status: โœ… COMPLETED - Extracted {{endpointCount}} API endpoints, {{flowCount}} business flows, {{nodeCount}} graph nodes, {{edgeCount}} graph edges"
303
+ > **Note:** Graph data (nodes, edges) construction is handled by the `speccrew-knowledge-bizs-api-graph` Skill. This skill focuses on API analysis and documentation only.
341
304
 
342
305
  ### Step 4: Find API Consumers
343
306
 
@@ -422,334 +385,30 @@ Fill sections in order (1 โ†’ 10), using `search_replace` for each content block
422
385
 
423
386
  ---
424
387
 
425
- #### Section 1: Content Overview
426
-
427
- **Locate anchor:** `<!-- AI-TAG: OVERVIEW -->`
428
-
429
- **Fill Basic Information Table:**
430
-
431
- Replace placeholder rows in the Basic Information table:
432
-
433
- ```
434
- original: "| Controller Name | {Fill in controller name} |"
435
- new: "| Controller Name | {{fileName}} |"
436
-
437
- original: "| Module | {e.g., Order Management Module} |"
438
- new: "| Module | {{module}} Module |"
439
-
440
- original: "| Core Function | {1-3 sentences describing core API functionality} |"
441
- new: "| Core Function | {ไปŽๆบ็ ๆๅ–็š„ๅฎž้™…ๅŠŸ่ƒฝๆ่ฟฐ} |"
442
-
443
- original: "| Base Path | {e.g., /admin-api/system/user} |"
444
- new: "| Base Path | {ไปŽ @RequestMapping ๆๅ–็š„ๅฎž้™…่ทฏๅพ„} |"
445
- ```
446
-
447
- **Fill API Scope List:**
448
-
449
- Replace placeholder list items with actual endpoints:
450
-
451
- ```
452
- original: "- [ ] {GET /page} - {Description}"
453
- new: "- [x] GET /page - ๅˆ†้กตๆŸฅ่ฏข็”จๆˆทๅˆ—่กจ"
454
- ```
455
-
456
- Repeat for each endpoint discovered in Step 3.
457
-
458
- ---
459
-
460
- #### Section 2: API Endpoint Definitions
461
-
462
- **Locate anchor:** `<!-- AI-TAG: API_ENDPOINTS -->`
463
-
464
- For each API endpoint found in Step 3, fill the corresponding subsection:
465
-
466
- **Fill Endpoint Information Table:**
467
-
468
- ```
469
- original: "| Method | {GET/POST/PUT/DELETE} |"
470
- new: "| Method | GET |"
471
-
472
- original: "| Path | {/admin-api/system/user/page} |"
473
- new: "| Path | /admin-api/system/user/page |"
474
-
475
- original: "| Description | {Brief description of what this endpoint does} |"
476
- new: "| Description | ๅˆ†้กตๆŸฅ่ฏข็”จๆˆทๅˆ—่กจ |"
477
-
478
- original: "| Permission | {Required permission code or role} |"
479
- new: "| Permission | system:user:query |"
480
- ```
481
-
482
- **Fill Request Parameters Table:**
483
-
484
- Replace placeholder rows with actual parameters:
485
-
486
- ```
487
- original: "| {param1} | {String/Integer/Long} | {Yes/No} | {Description} | {e.g., Length 1-50, Not blank} |"
488
- new: "| username | String | No | ็”จๆˆทๅ | Length 1-50 |"
489
- ```
490
-
491
- **Fill Response Data Table:**
492
-
493
- Replace placeholder rows with actual response fields:
494
-
495
- ```
496
- original: "| {id} | {Long} | {Record ID} | {No} |"
497
- new: "| id | Long | ็”จๆˆทID | No |"
498
- ```
499
-
500
- **Fill Error Codes Table:**
501
-
502
- ```
503
- original: "| {ERR_001} | {Error description} | {When this error occurs} |"
504
- new: "| 400 | ๅ‚ๆ•ฐๆ ก้ชŒๅคฑ่ดฅ | ่ฏทๆฑ‚ๅ‚ๆ•ฐไธๅˆๆณ• |"
505
- ```
506
-
507
- **Fill Business Flow Mermaid Diagram:**
508
-
509
- Replace the entire example Mermaid block with actual business flow:
510
-
511
- ```
512
- original: "```mermaid\ngraph TB\n Start([Request Received]) --> Auth{Permission Check}\n ... (ๆ•ดไธช็คบไพ‹ๅ›พ)\n```"
513
- new: "```mermaid\ngraph TB\n Start([่ฏทๆฑ‚ๅˆฐ่พพ]) --> Auth{ๆƒ้™ๆฃ€ๆŸฅ}\n Auth -->|ๆ— ๆƒ้™| Err403[่ฟ”ๅ›ž403]\n ...\n```"
514
- ```
515
-
516
- **Fill Flow Step Description Table:**
517
-
518
- ```
519
- original: "| 1 | Permission Check | Controller | {Controller} | Request + Token | Permission result | Return 403 |"
520
- new: "| 1 | ๆƒ้™ๆฃ€ๆŸฅ | Controller | UserController | Request + Token | ๆƒ้™ๆ ก้ชŒ็ป“ๆžœ | ่ฟ”ๅ›ž403 |"
521
- ```
522
-
523
- **Fill Detailed Call Chain Table:**
524
-
525
- ```
526
- original: "| 1 | Controller | {UserController} | {createUser} | Receive request, validate params, call service | [Source]({dynamic_prefix}{controllerSourcePath}) |"
527
- new: "| 1 | Controller | UserController | createUser | ๆŽฅๆ”ถ่ฏทๆฑ‚๏ผŒๆ ก้ชŒๅ‚ๆ•ฐ๏ผŒ่ฐƒ็”จๆœๅŠก | [Source](../../../../../yudao-module-system/.../UserController.java) |"
528
- // ๆณจ๏ผšdynamic_prefix ้œ€ๆ นๆฎๆ–‡ๆกฃ่ทฏๅพ„ๅŠจๆ€่ฎก็ฎ—๏ผŒ็คบไพ‹ๅ‡่ฎพๆ–‡ๆกฃๅœจ admin-api/system/user/ (6ๅฑ‚)
529
- ```
530
-
531
- **Fill Database Operations Table:**
532
-
533
- ```
534
- original: "| {INSERT} | {user} | {INSERT} | {Insert new user record} |"
535
- new: "| INSERT | system_user | INSERT | ๆ’ๅ…ฅๆ–ฐ็”จๆˆท่ฎฐๅฝ• |"
536
- ```
537
-
538
- **Fill Transaction Boundaries Table:**
539
-
540
- ```
541
- original: "| {UserService.createUser} | {User + UserRole} | {READ_COMMITTED} | {Atomic operation} |"
542
- new: "| UserService.createUser | system_user + system_user_role | READ_COMMITTED | ๅŽŸๅญๆ“ไฝœ |"
543
- ```
544
-
545
- ---
546
-
547
- #### Section 3: Data Field Definition
548
-
549
- **Locate anchor:** `<!-- AI-TAG: DATA_DEFINITION -->`
550
-
551
- **Fill Database Table Structure:**
552
-
553
- ```
554
- original: "**Table Name:** {table_name}"
555
- new: "**Table Name:** system_user"
556
-
557
- original: "| {id} | {Long} | {BIGINT} | {20} | {No} | {Auto increment} | {PRIMARY KEY} | {PRIMARY} | {Primary key} |"
558
- new: "| id | Long | BIGINT | 20 | No | Auto increment | PRIMARY KEY | PRIMARY | ไธป้”ฎID |"
559
- ```
560
-
561
- **Fill Indexes Table:**
562
-
563
- ```
564
- original: "| {idx_name} | {INDEX} | {field1} | {Query optimization} |"
565
- new: "| idx_username | UNIQUE | username | ็”จๆˆทๅๅ”ฏไธ€็ดขๅผ• |"
566
- ```
567
-
568
- **Fill Relationships Table:**
569
-
570
- ```
571
- original: "| {related_table} | {One-to-Many} | {this_table.related_id} | {Relationship description} |"
572
- new: "| system_user_role | One-to-Many | system_user.id = system_user_role.user_id | ็”จๆˆท่ง’่‰ฒๅ…ณ่” |"
573
- ```
574
-
575
- ---
576
-
577
- #### Section 4: References
578
-
579
- **Locate anchor:** `<!-- AI-TAG: REFERENCES -->`
580
-
581
- **Fill Internal Services Table:**
582
-
583
- ```
584
- original: "| {ServiceName} | {e.g., User business logic} | [Source]({dynamic_prefix}{serviceSourcePath}) |"
585
- new: "| UserService | ็”จๆˆทไธšๅŠก้€ป่พ‘ๅค„็† | [Source](../../../../../yudao-module-system/.../UserService.java) |"
586
- // ๆณจ๏ผšdynamic_prefix ้œ€ๆ นๆฎๆ–‡ๆกฃ่ทฏๅพ„ๅŠจๆ€่ฎก็ฎ—
587
- ```
588
-
589
- **Fill Data Access Layer Table:**
590
-
591
- ```
592
- original: "| {MapperName} | {EntityName} | {e.g., User CRUD operations} | [Source]({dynamic_prefix}{mapperSourcePath}) |"
593
- new: "| UserMapper | UserDO | ็”จๆˆทCRUDๆ“ไฝœ | [Source](../../../../../yudao-module-system/.../UserMapper.java) |"
594
- // ๆณจ๏ผšdynamic_prefix ้œ€ๆ นๆฎๆ–‡ๆกฃ่ทฏๅพ„ๅŠจๆ€่ฎก็ฎ—
595
- ```
596
-
597
- **Fill DTOs and Entities Table:**
598
-
599
- ```
600
- original: "| {DTOClass} | Request DTO | {e.g., Create user request} | [Source]({dynamic_prefix}{dtoSourcePath}) |"
601
- new: "| UserCreateReqVO | Request DTO | ๅˆ›ๅปบ็”จๆˆท่ฏทๆฑ‚ | [Source](../../../../../yudao-module-system/.../UserCreateReqVO.java) |"
602
- // ๆณจ๏ผšdynamic_prefix ้œ€ๆ นๆฎๆ–‡ๆกฃ่ทฏๅพ„ๅŠจๆ€่ฎก็ฎ—
603
- ```
604
-
605
- **Fill API Consumers Table:**
606
-
607
- ```
608
- original: "| {PageName} | {e.g., User management list page} | [Source]({dynamic_prefix}{pageSourcePath}) | [Doc]({dynamic_prefix}{pageDocumentPath}) |"
609
- new: "| ็”จๆˆท็ฎก็†้กต้ข | ็”จๆˆทๅˆ—่กจๅฑ•็คบไธŽ็ฎก็† | [Source](../../../../../yudao-ui-admin/src/views/system/user/index.vue) | [Doc](../../../../../speccrew-workspace/knowledges/bizs/web-vue3/src/views/system/user/index.md) |"
610
- // ๆณจ๏ผšdynamic_prefix ้œ€ๆ นๆฎๆ–‡ๆกฃ่ทฏๅพ„ๅŠจๆ€่ฎก็ฎ—๏ผŒSourceๅ’ŒDoc้“พๆŽฅไฝฟ็”จ็›ธๅŒ็š„ๅ‰็ผ€่ฎก็ฎ—ๆ–นๆณ•
611
- ```
612
-
613
- ---
614
-
615
- #### Section 5: Business Rule Constraints
616
-
617
- **Locate anchor:** `<!-- AI-TAG: BUSINESS_RULES -->`
618
-
619
- **Fill Permission Rules Table:**
620
-
621
- ```
622
- original: "| {GET /page} | Have {permission code} permission | Return 403 Forbidden |"
623
- new: "| GET /page | ้œ€่ฆ system:user:query ๆƒ้™ | ่ฟ”ๅ›ž 403 Forbidden |"
624
- ```
625
-
626
- **Fill Business Logic Rules:**
627
-
628
- ```
629
- original: "1. **{Rule 1}**: {e.g., User name must be unique across system}"
630
- new: "1. **็”จๆˆทๅๅ”ฏไธ€ๆ€ง**: ็”จๆˆทๅๅœจ็ณป็ปŸไธญๅฟ…้กปๅ”ฏไธ€๏ผŒไธ่ƒฝ้‡ๅค"
631
- ```
632
-
633
- **Fill Validation Rules Table:**
634
-
635
- ```
636
- original: "| Parameter validation | {Field} cannot be empty | Return 400 Bad Request | ERR_001 |"
637
- new: "| ๅ‚ๆ•ฐๆ ก้ชŒ | ็”จๆˆทๅไธ่ƒฝไธบ็ฉบ | ่ฟ”ๅ›ž 400 Bad Request | 400 |"
638
- ```
639
-
640
- ---
641
-
642
- #### Section 6: Dependency Analysis
643
-
644
- **Locate anchor:** `<!-- AI-TAG: DEPENDENCIES -->`
645
-
646
- **Fill Module Dependencies Table:**
647
-
648
- ```
649
- original: "| {Module A} | Strong | {Purpose description} | {Impact when unavailable} |"
650
- new: "| system | Strong | ็”จๆˆทๆƒ้™ๆ ก้ชŒ | ๆƒ้™ๅŠŸ่ƒฝไธๅฏ็”จ |"
651
- ```
652
-
653
- **Fill Service Dependencies Mermaid:**
654
-
655
- Replace example diagram with actual dependencies:
656
-
657
- ```
658
- original: "```mermaid\ngraph LR\n A[This Feature] --> B[Dependency Service 1]\n ...\n```"
659
- new: "```mermaid\ngraph LR\n A[UserController] --> B[UserService]\n B --> C[UserMapper]\n ...\n```"
660
- ```
661
-
662
- **Fill External Dependencies Table:**
663
-
664
- ```
665
- original: "| {Payment Gateway} | REST API | {Payment processing} | {Queue and retry} |"
666
- new: "| N/A | N/A | ๆ— ๅค–้ƒจไพ่ต– | N/A |"
667
- ```
668
-
669
- ---
670
-
671
- #### Section 7: Performance Considerations
672
-
673
- **Locate anchor:** `<!-- AI-TAG: PERFORMANCE -->`
674
-
675
- **Fill Performance Bottlenecks Table:**
676
-
677
- ```
678
- original: "| {List query} | {Large data volume} | {Add index, pagination} | High |"
679
- new: "| ๅˆ†้กตๆŸฅ่ฏข | ๅคงๆ•ฐๆฎ้‡ๆ—ถๆ€ง่ƒฝไธ‹้™ | ๆทปๅŠ ็ดขๅผ•๏ผŒๅผบๅˆถๅˆ†้กต | High |"
680
- ```
681
-
682
- **Fill Index Suggestions Table:**
683
-
684
- ```
685
- original: "| {table_name} | {field1, field2} | {COMPOSITE INDEX} | {Query optimization} |"
686
- new: "| system_user | username, status | INDEX | ็”จๆˆทๅๅ’Œ็Šถๆ€่”ๅˆๆŸฅ่ฏขไผ˜ๅŒ– |"
687
- ```
688
-
689
- **Fill Caching Strategy Table:**
690
-
691
- ```
692
- original: "| {User info} | {Redis} | {30 minutes} | {Write-through} |"
693
- new: "| ็”จๆˆทไฟกๆฏ | Redis | 30 minutes | ๅ†™็ฉฟ้€ |"
694
- ```
695
-
696
- **Fill Transaction Boundaries Table:**
697
-
698
- ```
699
- original: "| {Create order} | {Order + Details} | {READ_COMMITTED} | {30 seconds} |"
700
- new: "| ๅˆ›ๅปบ็”จๆˆท | system_user + system_user_role | READ_COMMITTED | 30 seconds |"
701
- ```
702
-
703
- ---
704
-
705
- #### Section 8: Troubleshooting Guide
706
-
707
- **Locate anchor:** `<!-- AI-TAG: TROUBLESHOOTING -->`
708
-
709
- **Fill Common Issues Table:**
710
-
711
- ```
712
- original: "| {Query timeout} | {Missing index} | {Check execution plan} | {Add index} |"
713
- new: "| ๆŸฅ่ฏข่ถ…ๆ—ถ | ็ผบๅฐ‘็ดขๅผ• | ๆฃ€ๆŸฅๆ‰ง่กŒ่ฎกๅˆ’ | ๆทปๅŠ ็ดขๅผ• |"
714
- ```
715
-
716
- **Fill Error Code Reference Table:**
717
-
718
- ```
719
- original: "| ERR_001 | {Required field empty} | {Form submission} | {Check required fields} |"
720
- new: "| 400 | ๅ‚ๆ•ฐๆ ก้ชŒๅคฑ่ดฅ | ่กจๅ•ๆไบค | ๆฃ€ๆŸฅๅฟ…ๅกซๅญ—ๆฎต |"
721
- ```
722
-
723
- **Fill Key Log Points Table:**
724
-
725
- ```
726
- original: "| {Service layer} | ERROR | {Exception stack trace} | {Locate error root cause} |"
727
- new: "| UserService | ERROR | ๅผ‚ๅธธๅ †ๆ ˆไฟกๆฏ | ๅฎšไฝ้”™่ฏฏๆ นๅ›  |"
728
- ```
729
-
730
- ---
731
-
732
- #### Section 9: Notes and Additional Information
733
-
734
- **Locate anchor:** `<!-- AI-TAG: ADDITIONAL_NOTES -->`
735
-
736
- **Fill Pending Confirmations:**
737
-
738
- ```
739
- original: "- [ ] **{Pending 1}**: {e.g., Whether product category dropdown needs to support fuzzy search}"
740
- new: "- [ ] **ๅพ…็กฎ่ฎค1**: ๆ˜ฏๅฆ้œ€่ฆๆ”ฏๆŒๆ‰น้‡ๅฏผๅ‡บ็”จๆˆทๆ•ฐๆฎ"
741
- ```
742
-
743
- ---
744
-
745
- #### Section 10: Appendix
746
-
747
- Fill Best Practices and Configuration Examples based on analysis:
748
-
749
- ```
750
- original: "- {Best practice 1: e.g., Use batch operations for large datasets}"
751
- new: "- ๆ‰น้‡ๆ“ไฝœ็”จๆˆทๆ—ถไฝฟ็”จไบ‹ๅŠก็กฎไฟๆ•ฐๆฎไธ€่‡ดๆ€ง"
752
- ```
388
+ #### Section 1-10: Fill Template Sections
389
+
390
+ Fill each section using `search_replace` with extracted data from source code analysis.
391
+
392
+ **Template Anchors:**
393
+ | Section | Anchor |
394
+ |---------|--------|
395
+ | 1. Content Overview | `<!-- AI-TAG: OVERVIEW -->` |
396
+ | 2. API Endpoints | `<!-- AI-TAG: API_ENDPOINTS -->` |
397
+ | 3. Data Fields | `<!-- AI-TAG: DATA_DEFINITION -->` |
398
+ | 4. References | `<!-- AI-TAG: REFERENCES -->` |
399
+ | 5. Business Rules | `<!-- AI-TAG: BUSINESS_RULES -->` |
400
+ | 6. Dependencies | `<!-- AI-TAG: DEPENDENCIES -->` |
401
+ | 7. Performance | `<!-- AI-TAG: PERFORMANCE -->` |
402
+ | 8. Troubleshooting | `<!-- AI-TAG: TROUBLESHOOTING -->` |
403
+ | 9. Notes | `<!-- AI-TAG: ADDITIONAL_NOTES -->` |
404
+ | 10. Appendix | End of document |
405
+
406
+ **Filling Guidelines:**
407
+ - Replace placeholder text with actual data extracted from source code
408
+ - Use the template's existing table structure
409
+ - Fill ALL tables, use "N/A" for unavailable data
410
+ - Generate Mermaid business flow diagrams for each API endpoint
411
+ - Preserve section headers and numbering
753
412
 
754
413
  ---
755
414
 
@@ -868,132 +527,35 @@ Write analysis results to marker files for dispatch batch processing.
868
527
  - [ ] `.done.json` JSON: `fileName` does NOT contain file extension
869
528
  - [ ] `.done.json` JSON: `sourceFile` matches `features-{platform}.json` pattern
870
529
  - [ ] `.done.json` JSON: `module` field is present and non-empty
871
- - [ ] `.graph.json` JSON: root-level `module` field is present (MANDATORY)
872
- - [ ] `.graph.json` JSON: `nodes` and `edges` are arrays (can be empty)
873
- - [ ] Both files: valid JSON (no trailing commas, all strings quoted)
530
+ - [ ] Valid JSON (no trailing commas, all strings quoted)
874
531
 
875
532
  ---
876
533
 
877
- ### **CRITICAL - Marker File Naming Convention (STRICT RULES)**
878
-
879
- **โœ… CORRECT Format - MUST USE:**
880
- ```
881
- {completed_dir}/{module}-{subpath}-{fileName}.done.json โ† Completion status marker (JSON format)
882
- {completed_dir}/{module}-{subpath}-{fileName}.graph.json โ† Graph data marker (JSON format)
883
- ```
884
-
885
- **Naming Rule Explanation:**
886
-
887
- The marker filename MUST follow the composite naming pattern `{module}-{subpath}-{fileName}` to prevent conflicts between same-named source files.
888
-
889
- **How to Extract Each Component from `{{sourcePath}}`:**
890
-
891
- 1. **module**: Use `{{module}}` input variable directly (e.g., `system`, `trade`, `ai`)
892
-
893
- 2. **subpath**: Extract the middle path between the module package root and the controller file:
894
- - For Java: Remove package prefix up to the business layer (e.g., `controller/admin/`, `controller/app/`)
895
- - Remove the file name at the end
896
- - Replace path separators (`/`) with hyphens (`-`)
897
- - If the file is at the module root directory, subpath will be empty โ†’ omit from filename
898
-
899
- 3. **fileName**: Use `{{fileName}}` input variable (Java class name WITHOUT `.java` extension)
900
-
901
- **Examples:**
534
+ ### Marker File Naming Convention
902
535
 
903
- | sourcePath | module | subpath | fileName | Marker Filename |
904
- |------------|--------|---------|----------|-----------------|
905
- | `yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java` | `system` | `controller-admin-notify` | `NotifyMessageController` | `system-controller-admin-notify-NotifyMessageController.done.json` |
906
- | `yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java` | `system` | `controller-admin-user` | `UserController` | `system-controller-admin-user-UserController.done.json` |
907
- | `yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/admin/chat/ChatConversationController.java` | `ai` | `controller-admin-chat` | `ChatConversationController` | `ai-controller-admin-chat-ChatConversationController.done.json` |
536
+ **Format:** `{completed_dir}/{module}-{subpath}-{fileName}.done.json`
908
537
 
909
- **Special Case - Empty subpath:**
910
- - If the controller is directly in the controller root directory (no subpath), use format: `{module}-{fileName}.done.json`
911
- - Example: `.../controller/admin/SystemController.java` โ†’ `system-SystemController.done.json`
538
+ **Components:**
539
+ - `module`: Use `{{module}}` input variable
540
+ - `subpath`: Extract from sourcePath, replace `/` with `-` (e.g., `controller/admin/user` โ†’ `controller-admin-user`)
541
+ - `fileName`: `{{fileName}}` WITHOUT extension
912
542
 
913
- **Full Path Examples:**
914
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-notify-NotifyMessageController.done.json`
915
- - `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/ai-controller-admin-chat-ChatConversationController.graph.json`
543
+ **Example:** `system-controller-admin-user-UserController.done.json`
916
544
 
917
- **โŒ WRONG Format - NEVER USE:**
918
- ```
919
- {fileName}.done.json โ† WRONG: missing module and subpath (causes conflicts)
920
- {fileName}.graph.json โ† WRONG: missing module and subpath (causes conflicts)
921
- {module}-{fileName}.done.json โ† WRONG: missing subpath (may still conflict)
922
- {fileName}.completed.json โ† WRONG extension
923
- {fileName}.done โ† WRONG extension (missing .json)
924
- {fileName}_done.json โ† WRONG separator and extension
925
- ```
926
-
927
- **โŒ WRONG Filename Examples - NEVER USE:**
928
- - `UserController.done.json` - WRONG: missing module and subpath (conflicts with other `UserController.java` files)
929
- - `system-UserController.done.json` - WRONG: missing subpath (if file is in `controller/admin/user/`)
930
- - `UserController.completed.json` - WRONG: uses `.completed.json` instead of `.done.json`
931
- - `UserController_done.json` - WRONG: uses underscore and wrong extension
545
+ > **Note:** Graph data (`.graph.json`) files are generated by `speccrew-knowledge-bizs-api-graph` Skill.
932
546
 
933
547
  ---
934
548
 
935
- ### **CRITICAL - Path Format Rules (STRICT RULES)**
936
-
937
- **Path Variables:**
938
- - `{{completed_dir}}` - Absolute path to marker files directory (passed from dispatch)
939
- - `{{sourcePath}}` - Relative path to source file (from features JSON)
940
- - `{{documentPath}}` - Relative path to generated document (from features JSON)
941
-
942
- **Path Format Requirements:**
943
-
944
- | Field | Format | Example |
945
- |-------|--------|---------|
946
- | `sourcePath` in `.done` | Relative path (as-is from input) | `yudao-module-system/.../UserController.java` |
947
- | `documentPath` in `.done` | Relative path (as-is from input) | `speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md` |
948
- | `sourcePath` in `.graph.json` nodes | Relative path (as-is from input) | `yudao-module-system/.../UserController.java` |
949
- | `documentPath` in `.graph.json` nodes | Relative path (as-is from input) | `speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md` |
950
-
951
- **โš ๏ธ CRITICAL: NEVER convert relative paths to absolute paths in the JSON content!**
952
-
953
- **Correct vs Wrong Example:**
954
- ```json
955
- // โœ… CORRECT - .done file content:
956
- {
957
- "fileName": "UserController",
958
- "sourcePath": "yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java",
959
- "sourceFile": "features-admin-api.json",
960
- "module": "system",
961
- "status": "success",
962
- "analysisNotes": "Successfully analyzed UserController"
963
- }
549
+ ### Path Format Rules
964
550
 
965
- // โŒ WRONG - .done file content (DO NOT DO THIS):
966
- {
967
- "fileName": "UserController",
968
- "sourcePath": "d:/dev/project/yudao-module-system/.../UserController.java", โ† WRONG: absolute path
969
- "sourceFile": "features-admin-api.json",
970
- "module": "system",
971
- "status": "success"
972
- }
973
- ```
551
+ **โš ๏ธ CRITICAL: ALWAYS use relative paths in JSON content, NEVER absolute paths.**
974
552
 
975
553
  ---
976
554
 
977
- **1. Write .done.json file (MANDATORY):**
555
+ **1. Write .done.json file:**
978
556
 
979
- > **๐Ÿšจ CRITICAL - JSON FORMAT MANDATORY**: The `.done.json` file **MUST** be valid JSON. Writing plain text, status messages, or progress updates into this file is **STRICTLY FORBIDDEN**.
980
- >
981
- > **โŒ FORBIDDEN - NEVER DO THIS:**
982
- > ```
983
- > Scanning files...
984
- > Analysis complete
985
- > ```
986
- >
987
- > **โœ… CORRECT - ONLY VALID JSON:**
988
- > ```json
989
- > {"fileName": "UserController", "status": "success", ...}
990
- > ```
557
+ Create valid JSON file at `{completed_dir}/{module}-{subpath}-{fileName}.done.json`:
991
558
 
992
- Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{fileName}.done.json`:
993
-
994
- **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-user-UserController.done.json`
995
-
996
- **Complete JSON Template (ALL fields required):**
997
559
  ```json
998
560
  {
999
561
  "fileName": "{{fileName}}",
@@ -1006,155 +568,30 @@ Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{file
1006
568
  }
1007
569
  ```
1008
570
 
1009
- **Field Descriptions:**
1010
- | Field | Required | Description | Example |
1011
- |-------|----------|-------------|---------|
1012
- | `fileName` | โœ… YES | Java class name **WITHOUT extension** | `"UserController"` |
1013
- | `sourcePath` | โœ… YES | Relative path to source file | `"yudao-module-system/.../UserController.java"` |
1014
- | `sourceFile` | โœ… YES | Source features JSON filename | `"features-admin-api.json"` |
1015
- | `module` | โœ… YES | Business module name | `"system"` |
1016
- | `documentPath` | โœ… YES | Path to generated document (same as Step 5a) | `"speccrew-workspace/knowledges/bizs/admin-api/system/user/UserController.md"` |
1017
- | `status` | โœ… YES | Analysis status | `"success"`, `"partial"`, or `"failed"` |
1018
- | `analysisNotes` | โœ… YES | Summary message | `"Analyzed 8 API endpoints"` |
1019
-
1020
- > **โš ๏ธ CRITICAL - fileName Field Rules:**
1021
- > - The `fileName` field MUST contain only the Java class name **WITHOUT file extension**
1022
- > - โœ… CORRECT: `"fileName": "UserController"`
1023
- > - โœ… CORRECT: `"fileName": "AiKnowledgeDocumentCreateListReqVO"`
1024
- > - โŒ WRONG: `"fileName": "UserController.java"` (includes extension)
1025
- > - โŒ WRONG: `"fileName": "UserController.class"` (includes extension)
1026
-
1027
- > **โš ๏ธ CRITICAL**: The `sourceFile` field is MANDATORY. It MUST be the features JSON filename (e.g., `features-admin-api.json`). Missing this field will cause pipeline failure.
1028
-
1029
- > **โš ๏ธ CRITICAL**: The `documentPath` field is MANDATORY. It MUST match the `{{documentPath}}` variable from Step 5a. This is used to verify the document was created successfully.
1030
-
1031
- โš ๏ธ **CRITICAL NAMING RULE:** Filename MUST be `{module}-{subpath}-{fileName}.done.json` to prevent conflicts between same-named files.
1032
- - โœ… CORRECT: `system-controller-admin-user-UserController.done.json` (full composite naming)
1033
- - โœ… CORRECT: `ai-controller-admin-chat-ChatConversationController.done.json` (full composite naming)
1034
- - โœ… CORRECT: `system-SystemController.done.json` (when subpath is empty, controller at root)
1035
- - โŒ WRONG: `UserController.done.json` (missing module and subpath - will conflict)
1036
- - โŒ WRONG: `UserController.done` (missing .json extension)
1037
- - โŒ WRONG: `system-UserController.done.json` (missing subpath when controller is in nested package)
1038
-
1039
- โš ๏ธ **CRITICAL:** The file MUST contain valid JSON content. Empty files or files with only whitespace will cause processing failures.
1040
-
1041
- **2. Write .graph.json file (MANDATORY):**
1042
-
1043
- > **โš ๏ธ CRITICAL FORMAT REQUIREMENT**: The `.graph.json` file MUST be valid JSON and **MUST include the root-level `module` field**. Do NOT rely on scripts to infer the module from `.done` file - the `module` field MUST be explicitly present at the root level of `.graph.json`.
1044
-
1045
- Use the Write tool to create file at `{{completed_dir}}/{module}-{subpath}-{fileName}.graph.json`:
1046
-
1047
- **Full path example:** `d:/dev/speccrew/speccrew-workspace/knowledges/base/sync-state/knowledge-bizs/completed/system-controller-admin-user-UserController.graph.json`
1048
-
1049
- ```json
1050
- {
1051
- "module": "{{module}}",
1052
- "nodes": [
1053
- {
1054
- "id": "api-{{module}}-{{endpoint-name}}",
1055
- "type": "api",
1056
- "name": "<display name>",
1057
- "module": "{{module}}",
1058
- "sourcePath": "{{sourcePath}}",
1059
- "documentPath": "{{documentPath}}",
1060
- "description": "..."
1061
- }
1062
- ],
1063
- "edges": [
1064
- {
1065
- "source": "api-...",
1066
- "target": "service-... or table-...",
1067
- "type": "operates|invokes|references|depends-on|maps-to",
1068
- "metadata": { ... }
1069
- }
1070
- ]
1071
- }
1072
- ```
1073
-
1074
- > **โš ๏ธ CRITICAL - module Field Requirement:**
1075
- > - The `.graph.json` file **MUST** have a root-level `module` field
1076
- > - Do NOT assume scripts will fall back to reading from `.done` file
1077
- > - Missing `module` field will cause the graph merge pipeline to reject this file
1078
-
1079
- โš ๏ธ **CRITICAL NAMING RULE:** Filename MUST be `{module}-{subpath}-{fileName}.graph.json` to prevent conflicts between same-named files.
1080
- - โœ… CORRECT: `system-controller-admin-user-UserController.graph.json` (full composite naming)
1081
- - โœ… CORRECT: `ai-controller-admin-chat-ChatConversationController.graph.json` (full composite naming)
1082
- - โœ… CORRECT: `system-SystemController.graph.json` (when subpath is empty, controller at root)
1083
- - โŒ WRONG: `UserController.graph.json` (missing module and subpath - will conflict)
1084
- - โŒ WRONG: `dict-UserController.graph.json` (using old featureId format)
1085
- - โŒ WRONG: `system-UserController.graph.json` (missing subpath when controller is in nested package)
1086
-
1087
- โš ๏ธ **CRITICAL:** The file MUST contain valid JSON content. Empty files or files with only whitespace will cause processing failures.
571
+ > **CRITICAL:**
572
+ > - `fileName` MUST NOT include file extension
573
+ > - All paths MUST be relative, not absolute
574
+ > - Content MUST be valid JSON (not plain text)
1088
575
 
1089
- **CRITICAL - API Endpoint Coverage Check:**
1090
- Before writing the graph.json file, verify:
1091
- - [ ] ALL public API endpoint methods in the controller are represented as `api` nodes
1092
- - [ ] Status update endpoints (updateStatus, toggleEnable) are included
1093
- - [ ] Special operation endpoints (resetPassword, export, import, batch operations) are included
1094
- - [ ] Each `api` node has proper metadata with HTTP method and path
1095
- - [ ] No public endpoint method is left without a corresponding node
576
+ **Output:** "Step 7 Status: โœ… COMPLETED - Marker file written to {{completed_dir}}"
1096
577
 
1097
- **่Š‚็‚น็ฑปๅž‹่ฏดๆ˜Ž:**
1098
- - `api`: API็ซฏ็‚น
1099
- - `service`: Service็ฑป
1100
- - `table`: ๆ•ฐๆฎๅบ“่กจ
1101
- - `dto`: ๆ•ฐๆฎไผ ่พ“ๅฏน่ฑก
578
+ > **Note:** Graph data (`.graph.json`) construction is handled by `speccrew-knowledge-bizs-api-graph` Skill. This step only writes the completion marker.
1102
579
 
1103
- **Output:** "Step 7 Status: โœ… COMPLETED - Marker files written to {{completed_dir}}"
1104
-
1105
- **โš ๏ธ IMPORTANT: If this step fails, the dispatch script will NOT be able to process your analysis results. You MUST ensure both marker files are written successfully.**
580
+ **โš ๏ธ IMPORTANT: If this step fails, the dispatch script will NOT be able to process your analysis results. You MUST ensure the marker file is written successfully.**
1106
581
 
1107
582
  ## Reference Guides
1108
583
 
1109
584
  ### Mermaid Guide
1110
585
 
1111
- When generating Mermaid diagrams, follow these compatibility guidelines from `speccrew-workspace/docs/rules/mermaid-rule.md`:
1112
-
586
+ When generating Mermaid diagrams, follow compatibility guidelines:
1113
587
  - Use `graph TB` or `graph LR` syntax (not `flowchart`)
1114
588
  - No parentheses `()` in node text
1115
589
  - No HTML tags like `<br/>`
1116
590
  - No `style` definitions
1117
- - No nested `subgraph`
1118
- - No special characters in node text
1119
-
1120
- ### Business Flow Diagram Guidelines
1121
-
1122
- When generating business flow diagrams in feature documents, follow these principles:
1123
-
1124
- **Business Flow vs Technical Call Chain:**
1125
-
1126
- | Aspect | Business Flow (Target) | Technical Call Chain (Avoid) |
1127
- |--------|----------------------|---------------------------|
1128
- | Focus | What business operations happen | What technical components are involved |
1129
- | Audience | Product managers, solution architects | Developers, system architects |
1130
- | Content | Business rules, data transformations, decisions | Method names, class names, API endpoints |
1131
- | Example | "Validate inventory โ†’ Check permissions โ†’ Create order" | "OrderController.create() โ†’ OrderService.save()" |
1132
-
1133
- **Key Principles:**
1134
-
1135
- 1. **One Diagram Per API Request**: Each API call triggered by the frontend should have its own business flow diagram
1136
- 2. **Business Perspective**: Focus on business operations, not technical implementation details
1137
- 3. **Source Traceability**: Add source file references for each business step
1138
-
1139
- **Diagram Types by Scenario:**
1140
-
1141
- | Scenario | Diagram Focus | Example Flow |
1142
- |----------|---------------|--------------|
1143
- | Page Initialization | Data loading sequence | Page Load โ†’ Parameter Fetch โ†’ Permission Check โ†’ Data Query โ†’ Render |
1144
- | User Action | Operation handling | Click Trigger โ†’ Data Validation โ†’ Business Check โ†’ Data Processing โ†’ Result Feedback |
1145
- | API Endpoint | Backend processing | Permission Check โ†’ Data Validation โ†’ Business Processing โ†’ Data Persistence |
1146
-
1147
- **For detailed diagram examples and templates, refer to:**
1148
- - `templates/FEATURE-DETAIL-TEMPLATE.md` - Section 3 (Interaction Flow Description)
1149
-
1150
- **Common Business Flow Patterns:**
1151
591
 
1152
- 1. **CRUD Operations:**
1153
- - Create: Data Validation โ†’ Permission Check โ†’ Duplicate Check โ†’ Data Creation โ†’ Related Update โ†’ Log Recording
1154
- - Read: Parameter Parsing โ†’ Permission Check โ†’ Data Query โ†’ Data Assembly โ†’ Return Result
1155
- - Update: Data Validation โ†’ Permission Check โ†’ Existence Check โ†’ Data Update โ†’ Related Update โ†’ Log Recording
1156
- - Delete: Permission Check โ†’ Existence Check โ†’ Dependency Check โ†’ Data Deletion โ†’ Log Recording
592
+ ### Business Flow Guidelines
1157
593
 
1158
- 2. **Approval Workflows:**
1159
- - Submit Application โ†’ Validate Data โ†’ Check Process Config โ†’ Create Approval Instance โ†’ Notify Approver โ†’ Record Log
594
+ - One diagram per API request
595
+ - Focus on business operations
596
+ - Refer to `templates/FEATURE-DETAIL-TEMPLATE.md`
1160
597