kiro-spec-engine 1.4.4 → 1.5.2
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.
- package/CHANGELOG.md +62 -1
- package/README.md +16 -0
- package/README.zh.md +380 -0
- package/bin/kiro-spec-engine.js +102 -44
- package/docs/adoption-guide.md +53 -0
- package/docs/document-governance.md +864 -0
- package/docs/spec-numbering-guide.md +348 -0
- package/docs/spec-workflow.md +65 -0
- package/docs/troubleshooting.md +339 -0
- package/docs/zh/spec-numbering-guide.md +348 -0
- package/lib/adoption/adoption-strategy.js +22 -6
- package/lib/adoption/conflict-resolver.js +239 -0
- package/lib/adoption/diff-viewer.js +226 -0
- package/lib/backup/selective-backup.js +207 -0
- package/lib/commands/adopt.js +95 -10
- package/lib/commands/docs.js +717 -0
- package/lib/commands/doctor.js +141 -3
- package/lib/commands/status.js +77 -5
- package/lib/governance/archive-tool.js +231 -0
- package/lib/governance/cleanup-tool.js +237 -0
- package/lib/governance/config-manager.js +186 -0
- package/lib/governance/diagnostic-engine.js +271 -0
- package/lib/governance/execution-logger.js +243 -0
- package/lib/governance/file-scanner.js +285 -0
- package/lib/governance/hooks-manager.js +333 -0
- package/lib/governance/reporter.js +337 -0
- package/lib/governance/validation-engine.js +181 -0
- package/package.json +1 -1
package/docs/troubleshooting.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
- [Command Issues](#command-issues)
|
|
19
19
|
- [Integration Issues](#integration-issues)
|
|
20
20
|
- [Watch Mode Issues](#watch-mode-issues)
|
|
21
|
+
- [Document Governance Issues](#document-governance-issues)
|
|
21
22
|
- [Platform-Specific Issues](#platform-specific-issues)
|
|
22
23
|
- [Getting More Help](#getting-more-help)
|
|
23
24
|
|
|
@@ -566,6 +567,337 @@ kse context export 01-00-user-login
|
|
|
566
567
|
|
|
567
568
|
---
|
|
568
569
|
|
|
570
|
+
## Document Governance Issues
|
|
571
|
+
|
|
572
|
+
### Diagnostic not finding violations
|
|
573
|
+
|
|
574
|
+
**Symptoms:**
|
|
575
|
+
```bash
|
|
576
|
+
$ kse docs diagnose
|
|
577
|
+
✅ Project is compliant
|
|
578
|
+
# But you know there are temporary files
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
**Cause:** Files don't match temporary patterns or are in unexpected locations
|
|
582
|
+
|
|
583
|
+
**Solutions:**
|
|
584
|
+
|
|
585
|
+
**1. Check what patterns are configured:**
|
|
586
|
+
```bash
|
|
587
|
+
kse docs config
|
|
588
|
+
# Look at "Temporary Patterns" section
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
**2. Add custom patterns if needed:**
|
|
592
|
+
```bash
|
|
593
|
+
kse docs config --set temporary-patterns "*-SUMMARY.md,SESSION-*.md,*-COMPLETE.md,TEMP-*.md,WIP-*.md,MVP-*.md,DRAFT-*.md"
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
**3. Manually check for violations:**
|
|
597
|
+
```bash
|
|
598
|
+
# Check root directory
|
|
599
|
+
ls *.md
|
|
600
|
+
|
|
601
|
+
# Should only see: README.md, README.zh.md, CHANGELOG.md, CONTRIBUTING.md
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
### Cleanup not removing files
|
|
607
|
+
|
|
608
|
+
**Symptoms:**
|
|
609
|
+
```bash
|
|
610
|
+
$ kse docs cleanup
|
|
611
|
+
Deleted 0 file(s)
|
|
612
|
+
# But temporary files still exist
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
**Possible Causes & Solutions:**
|
|
616
|
+
|
|
617
|
+
**1. Files don't match temporary patterns:**
|
|
618
|
+
```bash
|
|
619
|
+
# Check file names
|
|
620
|
+
ls *.md
|
|
621
|
+
|
|
622
|
+
# If file is "notes.md" (doesn't match patterns)
|
|
623
|
+
# Either rename it to match pattern or delete manually
|
|
624
|
+
mv notes.md TEMP-notes.md
|
|
625
|
+
kse docs cleanup
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
**2. Files are in subdirectories:**
|
|
629
|
+
```bash
|
|
630
|
+
# Cleanup only checks root and Spec directories
|
|
631
|
+
# Check subdirectories manually
|
|
632
|
+
find . -name "*-SUMMARY.md"
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
**3. Permission issues:**
|
|
636
|
+
```bash
|
|
637
|
+
# Check file permissions
|
|
638
|
+
ls -la *.md
|
|
639
|
+
|
|
640
|
+
# Fix if needed
|
|
641
|
+
chmod u+w filename.md
|
|
642
|
+
kse docs cleanup
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
### Archive moving files to wrong subdirectory
|
|
648
|
+
|
|
649
|
+
**Symptoms:**
|
|
650
|
+
```bash
|
|
651
|
+
$ kse docs archive --spec my-spec
|
|
652
|
+
# Files moved to unexpected subdirectories
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
**Cause:** File type classification based on filename
|
|
656
|
+
|
|
657
|
+
**Solution:**
|
|
658
|
+
|
|
659
|
+
**Understand classification rules:**
|
|
660
|
+
- **scripts/** - `.js`, `.py`, `.sh`, "script" in name
|
|
661
|
+
- **reports/** - "report", "analysis", "summary" in name
|
|
662
|
+
- **tests/** - `.test.js`, `.spec.js`, "test" in name
|
|
663
|
+
- **results/** - "result", "output" in name
|
|
664
|
+
- **docs/** - Everything else
|
|
665
|
+
|
|
666
|
+
**Rename files to match intended subdirectory:**
|
|
667
|
+
```bash
|
|
668
|
+
# Want file in reports/
|
|
669
|
+
mv data.md analysis-report.md
|
|
670
|
+
|
|
671
|
+
# Want file in scripts/
|
|
672
|
+
mv tool.js test-script.js
|
|
673
|
+
|
|
674
|
+
# Then archive
|
|
675
|
+
kse docs archive --spec my-spec
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
### Git hooks not blocking commits
|
|
681
|
+
|
|
682
|
+
**Symptoms:**
|
|
683
|
+
```bash
|
|
684
|
+
$ git commit -m "Add feature"
|
|
685
|
+
# Commit succeeds even with violations
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
**Possible Causes & Solutions:**
|
|
689
|
+
|
|
690
|
+
**1. Hooks not installed:**
|
|
691
|
+
```bash
|
|
692
|
+
# Check status
|
|
693
|
+
kse docs hooks status
|
|
694
|
+
|
|
695
|
+
# If not installed
|
|
696
|
+
kse docs hooks install
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
**2. Hook file not executable:**
|
|
700
|
+
```bash
|
|
701
|
+
# Check permissions (macOS/Linux)
|
|
702
|
+
ls -la .git/hooks/pre-commit
|
|
703
|
+
|
|
704
|
+
# Make executable
|
|
705
|
+
chmod +x .git/hooks/pre-commit
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
**3. Using --no-verify flag:**
|
|
709
|
+
```bash
|
|
710
|
+
# This bypasses hooks
|
|
711
|
+
git commit --no-verify -m "message"
|
|
712
|
+
|
|
713
|
+
# Remove --no-verify to enable validation
|
|
714
|
+
git commit -m "message"
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
**4. Not a git repository:**
|
|
718
|
+
```bash
|
|
719
|
+
# Check if .git exists
|
|
720
|
+
ls -la .git/
|
|
721
|
+
|
|
722
|
+
# If not, initialize git
|
|
723
|
+
git init
|
|
724
|
+
kse docs hooks install
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
### Validation failing for valid structure
|
|
730
|
+
|
|
731
|
+
**Symptoms:**
|
|
732
|
+
```bash
|
|
733
|
+
$ kse docs validate --spec my-spec
|
|
734
|
+
❌ Missing required file: requirements.md
|
|
735
|
+
# But the file exists
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
**Possible Causes & Solutions:**
|
|
739
|
+
|
|
740
|
+
**1. File in wrong location:**
|
|
741
|
+
```bash
|
|
742
|
+
# Check exact path
|
|
743
|
+
ls -la .kiro/specs/my-spec/requirements.md
|
|
744
|
+
|
|
745
|
+
# Should be directly in Spec directory, not in subdirectory
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
**2. Wrong Spec name:**
|
|
749
|
+
```bash
|
|
750
|
+
# Check Spec directory name
|
|
751
|
+
ls .kiro/specs/
|
|
752
|
+
|
|
753
|
+
# Use exact name
|
|
754
|
+
kse docs validate --spec 01-00-my-feature
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
**3. Case sensitivity (Linux/macOS):**
|
|
758
|
+
```bash
|
|
759
|
+
# File is "Requirements.md" but should be "requirements.md"
|
|
760
|
+
mv Requirements.md requirements.md
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
---
|
|
764
|
+
|
|
765
|
+
### Configuration changes not taking effect
|
|
766
|
+
|
|
767
|
+
**Symptoms:**
|
|
768
|
+
```bash
|
|
769
|
+
$ kse docs config --set root-allowed-files "README.md,CUSTOM.md"
|
|
770
|
+
✅ Configuration updated
|
|
771
|
+
|
|
772
|
+
$ kse docs diagnose
|
|
773
|
+
# Still reports CUSTOM.md as violation
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
**Cause:** Configuration file not being read or cached
|
|
777
|
+
|
|
778
|
+
**Solutions:**
|
|
779
|
+
|
|
780
|
+
**1. Verify configuration was saved:**
|
|
781
|
+
```bash
|
|
782
|
+
# Check config file
|
|
783
|
+
cat .kiro/config/docs.json
|
|
784
|
+
|
|
785
|
+
# Should show your changes
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
**2. Check for typos in key name:**
|
|
789
|
+
```bash
|
|
790
|
+
# Wrong: root-files
|
|
791
|
+
# Correct: root-allowed-files
|
|
792
|
+
|
|
793
|
+
kse docs config --set root-allowed-files "README.md,CUSTOM.md"
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
**3. Restart any running processes:**
|
|
797
|
+
```bash
|
|
798
|
+
# If watch mode is running
|
|
799
|
+
kse watch stop
|
|
800
|
+
kse watch start
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
---
|
|
804
|
+
|
|
805
|
+
### "Permission denied" when installing hooks
|
|
806
|
+
|
|
807
|
+
**Symptoms:**
|
|
808
|
+
```bash
|
|
809
|
+
$ kse docs hooks install
|
|
810
|
+
Error: EACCES: permission denied, open '.git/hooks/pre-commit'
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
**Cause:** Insufficient permissions for .git/hooks directory
|
|
814
|
+
|
|
815
|
+
**Solutions:**
|
|
816
|
+
|
|
817
|
+
**1. Check directory permissions:**
|
|
818
|
+
```bash
|
|
819
|
+
ls -la .git/hooks/
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
**2. Fix permissions:**
|
|
823
|
+
```bash
|
|
824
|
+
# Make hooks directory writable
|
|
825
|
+
chmod u+w .git/hooks/
|
|
826
|
+
|
|
827
|
+
# Try again
|
|
828
|
+
kse docs hooks install
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
**3. Check if file is read-only:**
|
|
832
|
+
```bash
|
|
833
|
+
# If pre-commit already exists
|
|
834
|
+
ls -la .git/hooks/pre-commit
|
|
835
|
+
|
|
836
|
+
# Remove read-only flag
|
|
837
|
+
chmod u+w .git/hooks/pre-commit
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
---
|
|
841
|
+
|
|
842
|
+
### Stats showing no data
|
|
843
|
+
|
|
844
|
+
**Symptoms:**
|
|
845
|
+
```bash
|
|
846
|
+
$ kse docs stats
|
|
847
|
+
⚠️ No execution history found
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
**Cause:** No governance commands have been run yet
|
|
851
|
+
|
|
852
|
+
**Solution:**
|
|
853
|
+
|
|
854
|
+
**Run some governance commands:**
|
|
855
|
+
```bash
|
|
856
|
+
# Run diagnostic
|
|
857
|
+
kse docs diagnose
|
|
858
|
+
|
|
859
|
+
# Run cleanup
|
|
860
|
+
kse docs cleanup --dry-run
|
|
861
|
+
|
|
862
|
+
# Now check stats
|
|
863
|
+
kse docs stats
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
**Note:** Only actual operations are logged (not --dry-run for cleanup/archive)
|
|
867
|
+
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
### Report generation fails
|
|
871
|
+
|
|
872
|
+
**Symptoms:**
|
|
873
|
+
```bash
|
|
874
|
+
$ kse docs report
|
|
875
|
+
Error: ENOENT: no such file or directory, open '.kiro/reports/...'
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
**Cause:** Reports directory doesn't exist
|
|
879
|
+
|
|
880
|
+
**Solution:**
|
|
881
|
+
|
|
882
|
+
**Create reports directory:**
|
|
883
|
+
```bash
|
|
884
|
+
mkdir -p .kiro/reports
|
|
885
|
+
|
|
886
|
+
# Try again
|
|
887
|
+
kse docs report
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
**Or let kse create it:**
|
|
891
|
+
```bash
|
|
892
|
+
# Run diagnostic first (creates directory structure)
|
|
893
|
+
kse docs diagnose
|
|
894
|
+
|
|
895
|
+
# Then generate report
|
|
896
|
+
kse docs report
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
---
|
|
900
|
+
|
|
569
901
|
## Platform-Specific Issues
|
|
570
902
|
|
|
571
903
|
### Windows Issues
|
|
@@ -771,6 +1103,7 @@ Error: EINVAL: invalid filename
|
|
|
771
1103
|
3. **Spec name format** - Use XX-YY-feature-name format
|
|
772
1104
|
4. **Context too large** - Use task-specific prompts
|
|
773
1105
|
5. **Watch mode** - Restart or check configuration
|
|
1106
|
+
6. **Document governance** - Check patterns and permissions
|
|
774
1107
|
|
|
775
1108
|
**Quick Fixes:**
|
|
776
1109
|
```bash
|
|
@@ -785,6 +1118,12 @@ ls -la .kiro/specs/
|
|
|
785
1118
|
|
|
786
1119
|
# Test context export
|
|
787
1120
|
kse context export spec-name
|
|
1121
|
+
|
|
1122
|
+
# Check document compliance
|
|
1123
|
+
kse docs diagnose
|
|
1124
|
+
|
|
1125
|
+
# Clean up temporary files
|
|
1126
|
+
kse docs cleanup --dry-run
|
|
788
1127
|
```
|
|
789
1128
|
|
|
790
1129
|
**Still stuck?** → [Create an issue](https://github.com/kiro-spec-engine/kse/issues/new)
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Spec 编号策略指南
|
|
2
|
+
|
|
3
|
+
> 为你的 Spec 选择合适编号策略的完整指南
|
|
4
|
+
|
|
5
|
+
## 概述
|
|
6
|
+
|
|
7
|
+
Kiro Spec Engine 使用两部分编号系统:`{主序号}-{从序号}-{描述}`
|
|
8
|
+
|
|
9
|
+
- **主序号**:代表功能领域或主题(01, 02, 03, ...)
|
|
10
|
+
- **从序号**:代表该领域内的迭代或子功能(00, 01, 02, ...)
|
|
11
|
+
- **描述**:使用 kebab-case 格式的 Spec 描述
|
|
12
|
+
|
|
13
|
+
**示例**:
|
|
14
|
+
- `01-00-user-authentication`(用户认证)
|
|
15
|
+
- `01-01-add-oauth-support`(添加 OAuth 支持)
|
|
16
|
+
- `02-00-payment-system`(支付系统)
|
|
17
|
+
|
|
18
|
+
## 何时使用主序号 vs 从序号
|
|
19
|
+
|
|
20
|
+
### 策略 1:简单项目(推荐大多数情况)
|
|
21
|
+
|
|
22
|
+
**适用场景**:少于 20 个独立功能的项目
|
|
23
|
+
|
|
24
|
+
**方法**:只使用主序号,从序号始终为 `00`
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
01-00-user-authentication # 用户认证
|
|
28
|
+
02-00-payment-integration # 支付集成
|
|
29
|
+
03-00-notification-system # 通知系统
|
|
30
|
+
04-00-reporting-dashboard # 报表仪表板
|
|
31
|
+
05-00-api-gateway # API 网关
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**优点**:
|
|
35
|
+
- ✅ 简单清晰
|
|
36
|
+
- ✅ 一目了然
|
|
37
|
+
- ✅ 无需提前规划分组
|
|
38
|
+
- ✅ 适合独立功能
|
|
39
|
+
|
|
40
|
+
**何时使用**:
|
|
41
|
+
- 构建工具或库
|
|
42
|
+
- 功能相对独立
|
|
43
|
+
- 项目处于早期阶段
|
|
44
|
+
- 小团队(< 5 人)
|
|
45
|
+
|
|
46
|
+
### 策略 2:按主题分组的复杂项目
|
|
47
|
+
|
|
48
|
+
**适用场景**:具有明确功能领域的大型项目
|
|
49
|
+
|
|
50
|
+
**方法**:将相关 Spec 归入同一主序号
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
# 用户管理领域 (01-xx)
|
|
54
|
+
01-00-user-authentication-foundation # 用户认证基础
|
|
55
|
+
01-01-add-oauth-support # 添加 OAuth 支持
|
|
56
|
+
01-02-add-two-factor-auth # 添加双因素认证
|
|
57
|
+
01-03-add-sso-integration # 添加 SSO 集成
|
|
58
|
+
|
|
59
|
+
# 支付领域 (02-xx)
|
|
60
|
+
02-00-payment-system-mvp # 支付系统 MVP
|
|
61
|
+
02-01-add-subscription-billing # 添加订阅计费
|
|
62
|
+
02-02-add-invoice-generation # 添加发票生成
|
|
63
|
+
02-03-add-refund-workflow # 添加退款流程
|
|
64
|
+
|
|
65
|
+
# 通知领域 (03-xx)
|
|
66
|
+
03-00-notification-email # 邮件通知
|
|
67
|
+
03-01-notification-sms # 短信通知
|
|
68
|
+
03-02-notification-push # 推送通知
|
|
69
|
+
03-03-notification-in-app # 应用内通知
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**优点**:
|
|
73
|
+
- ✅ 清晰的主题分组
|
|
74
|
+
- ✅ 易于追踪功能演进
|
|
75
|
+
- ✅ 显示 Spec 之间的关系
|
|
76
|
+
- ✅ 适合大型项目扩展
|
|
77
|
+
|
|
78
|
+
**何时使用**:
|
|
79
|
+
- 构建复杂应用
|
|
80
|
+
- 功能有明确的领域(用户、支付、通知等)
|
|
81
|
+
- 每个领域预期有多次迭代
|
|
82
|
+
- 大团队且有领域负责人
|
|
83
|
+
|
|
84
|
+
### 策略 3:混合方法(灵活)
|
|
85
|
+
|
|
86
|
+
**适用场景**:从简单开始,按需添加结构
|
|
87
|
+
|
|
88
|
+
**方法**:初期只用主序号,需要时引入从序号
|
|
89
|
+
|
|
90
|
+
**阶段 1 - 早期开发**:
|
|
91
|
+
```
|
|
92
|
+
01-00-mvp-core-features # MVP 核心功能
|
|
93
|
+
02-00-user-management # 用户管理
|
|
94
|
+
03-00-data-storage # 数据存储
|
|
95
|
+
04-00-api-gateway # API 网关
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**阶段 2 - 需要迭代时**:
|
|
99
|
+
```
|
|
100
|
+
01-00-mvp-core-features
|
|
101
|
+
02-00-user-management
|
|
102
|
+
03-00-data-storage-basic
|
|
103
|
+
03-01-data-storage-add-caching ← 添加迭代
|
|
104
|
+
03-02-data-storage-add-replication ← 添加迭代
|
|
105
|
+
04-00-api-gateway
|
|
106
|
+
05-00-monitoring-system
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**优点**:
|
|
110
|
+
- ✅ 从简单开始,按需增长
|
|
111
|
+
- ✅ 无需过早规划
|
|
112
|
+
- ✅ 适应项目演进
|
|
113
|
+
- ✅ 兼具两种策略的优点
|
|
114
|
+
|
|
115
|
+
**何时使用**:
|
|
116
|
+
- 项目范围不确定
|
|
117
|
+
- 需要灵活性
|
|
118
|
+
- 敏捷开发方式
|
|
119
|
+
- 学习 Spec 工作流
|
|
120
|
+
|
|
121
|
+
## 语义化编号规则
|
|
122
|
+
|
|
123
|
+
### 规则 1:XX-00 用于首个或独立 Spec
|
|
124
|
+
|
|
125
|
+
使用 `XX-00` 表示:
|
|
126
|
+
- 某个领域的第一个 Spec
|
|
127
|
+
- 不需要迭代的独立功能
|
|
128
|
+
- 独立的功能模块
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
01-00-authentication-system # 领域首个
|
|
132
|
+
02-00-payment-integration # 独立功能
|
|
133
|
+
03-00-email-notifications # 独立模块
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 规则 2:XX-01+ 用于迭代和增强
|
|
137
|
+
|
|
138
|
+
使用 `XX-01`、`XX-02` 等表示:
|
|
139
|
+
- 与之前 Spec 相关的 bug 修复
|
|
140
|
+
- 功能增强
|
|
141
|
+
- 同一主题的迭代
|
|
142
|
+
- 相关功能
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
01-00-authentication-system
|
|
146
|
+
01-01-fix-session-timeout-bug # Bug 修复
|
|
147
|
+
01-02-add-remember-me-feature # 功能增强
|
|
148
|
+
01-03-add-password-reset # 相关功能
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 规则 3:保持相关 Spec 在一起
|
|
152
|
+
|
|
153
|
+
将以下 Spec 分组:
|
|
154
|
+
- 共享相同代码库区域
|
|
155
|
+
- 相互依赖
|
|
156
|
+
- 属于同一功能领域
|
|
157
|
+
- 由同一团队维护
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
# 好:相关通知功能分组
|
|
161
|
+
03-00-notification-email
|
|
162
|
+
03-01-notification-sms
|
|
163
|
+
03-02-notification-push
|
|
164
|
+
|
|
165
|
+
# 避免:不相关功能使用同一主序号
|
|
166
|
+
03-00-notification-email
|
|
167
|
+
03-01-payment-refunds # ❌ 与通知无关
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## 实际案例
|
|
171
|
+
|
|
172
|
+
### 案例 1:工具/库项目(kiro-spec-engine)
|
|
173
|
+
|
|
174
|
+
**项目类型**:具有独立功能的 CLI 工具
|
|
175
|
+
|
|
176
|
+
**策略**:简单编号(XX-00)
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
01-00-user-space-diagnosis # 用户空间诊断
|
|
180
|
+
02-00-oauth-api-upgrade # OAuth API 升级
|
|
181
|
+
03-00-multi-user-collaboration # 多用户协作
|
|
182
|
+
04-00-watch-mode-automation # Watch 模式自动化
|
|
183
|
+
05-00-agent-hooks-and-automation # Agent Hooks 和自动化
|
|
184
|
+
06-00-test-stability-and-reliability # 测试稳定性和可靠性
|
|
185
|
+
07-00-user-onboarding-and-documentation # 用户引导和文档
|
|
186
|
+
08-00-document-lifecycle-management # 文档生命周期管理
|
|
187
|
+
09-00-document-governance-automation # 文档治理自动化
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**原因**:每个功能都是独立且完整的
|
|
191
|
+
|
|
192
|
+
### 案例 2:电商平台
|
|
193
|
+
|
|
194
|
+
**项目类型**:复杂 Web 应用
|
|
195
|
+
|
|
196
|
+
**策略**:主题分组
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
# 用户领域
|
|
200
|
+
01-00-user-registration-and-login # 用户注册和登录
|
|
201
|
+
01-01-user-profile-management # 用户资料管理
|
|
202
|
+
01-02-user-preferences-and-settings # 用户偏好和设置
|
|
203
|
+
|
|
204
|
+
# 商品领域
|
|
205
|
+
02-00-product-catalog-foundation # 商品目录基础
|
|
206
|
+
02-01-product-search-and-filters # 商品搜索和筛选
|
|
207
|
+
02-02-product-recommendations # 商品推荐
|
|
208
|
+
|
|
209
|
+
# 订单领域
|
|
210
|
+
03-00-shopping-cart-system # 购物车系统
|
|
211
|
+
03-01-checkout-process # 结账流程
|
|
212
|
+
03-02-order-tracking # 订单追踪
|
|
213
|
+
03-03-order-history # 订单历史
|
|
214
|
+
|
|
215
|
+
# 支付领域
|
|
216
|
+
04-00-payment-gateway-integration # 支付网关集成
|
|
217
|
+
04-01-multiple-payment-methods # 多种支付方式
|
|
218
|
+
04-02-payment-security-enhancements # 支付安全增强
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**原因**:明确的领域划分,每个领域有多个相关功能
|
|
222
|
+
|
|
223
|
+
### 案例 3:SaaS 应用
|
|
224
|
+
|
|
225
|
+
**项目类型**:多租户 SaaS
|
|
226
|
+
|
|
227
|
+
**策略**:混合方法
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
# 核心功能(独立)
|
|
231
|
+
01-00-tenant-management # 租户管理
|
|
232
|
+
02-00-user-authentication # 用户认证
|
|
233
|
+
03-00-billing-system # 计费系统
|
|
234
|
+
|
|
235
|
+
# 分析领域(分组)
|
|
236
|
+
04-00-analytics-foundation # 分析基础
|
|
237
|
+
04-01-analytics-custom-dashboards # 自定义仪表板
|
|
238
|
+
04-02-analytics-export-reports # 导出报表
|
|
239
|
+
|
|
240
|
+
# 集成领域(分组)
|
|
241
|
+
05-00-api-gateway # API 网关
|
|
242
|
+
05-01-webhook-system # Webhook 系统
|
|
243
|
+
05-02-third-party-integrations # 第三方集成
|
|
244
|
+
|
|
245
|
+
# 更多独立功能
|
|
246
|
+
06-00-email-templates # 邮件模板
|
|
247
|
+
07-00-notification-center # 通知中心
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**原因**:独立功能和分组领域的混合
|
|
251
|
+
|
|
252
|
+
## 决策树
|
|
253
|
+
|
|
254
|
+
使用此流程图决定编号策略:
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
这是你的第一个 Spec 吗?
|
|
258
|
+
├─ 是 → 使用 01-00-{描述}
|
|
259
|
+
└─ 否 → 继续...
|
|
260
|
+
|
|
261
|
+
这与现有 Spec 相关吗?
|
|
262
|
+
├─ 是 → 使用相同主序号,递增从序号
|
|
263
|
+
│ 示例:01-00 已存在 → 使用 01-01
|
|
264
|
+
└─ 否 → 继续...
|
|
265
|
+
|
|
266
|
+
你预期这个领域会有多次迭代吗?
|
|
267
|
+
├─ 是 → 为该领域规划主序号
|
|
268
|
+
│ 示例:03-00, 03-01, 03-02 用于通知
|
|
269
|
+
└─ 否 → 使用下一个可用主序号配 -00
|
|
270
|
+
示例:05-00-new-feature
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 最佳实践
|
|
274
|
+
|
|
275
|
+
### ✅ 应该做
|
|
276
|
+
|
|
277
|
+
1. **从简单开始**:在需要复杂性之前使用 XX-00
|
|
278
|
+
2. **保持一致**:每个项目坚持一种策略
|
|
279
|
+
3. **记录你的方法**:在项目 README 中添加说明
|
|
280
|
+
4. **使用描述性名称**:让描述清晰明了
|
|
281
|
+
5. **预留主序号**:如果规划领域,预留范围
|
|
282
|
+
|
|
283
|
+
### ❌ 不应该做
|
|
284
|
+
|
|
285
|
+
1. **不要过度规划**:不要提前创建 50 个主序号
|
|
286
|
+
2. **不要混合不相关功能**:保持主序号的主题性
|
|
287
|
+
3. **不要跳过数字**:使用连续编号
|
|
288
|
+
4. **不要中途改变策略**:坚持你的方法
|
|
289
|
+
5. **不要压力过大**:编号是为了组织,不是追求完美
|
|
290
|
+
|
|
291
|
+
## 策略迁移
|
|
292
|
+
|
|
293
|
+
### 从简单到主题化
|
|
294
|
+
|
|
295
|
+
如果你从简单编号开始,需要添加结构:
|
|
296
|
+
|
|
297
|
+
**之前**:
|
|
298
|
+
```
|
|
299
|
+
01-00-user-auth
|
|
300
|
+
02-00-user-profile
|
|
301
|
+
03-00-payment-basic
|
|
302
|
+
04-00-payment-subscriptions
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**之后**(可选重组):
|
|
306
|
+
```
|
|
307
|
+
01-00-user-auth
|
|
308
|
+
01-01-user-profile # 与认证分组
|
|
309
|
+
02-00-payment-basic
|
|
310
|
+
02-01-payment-subscriptions # 与支付分组
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**注意**:重命名现有 Spec 是可选的。你可以保留旧编号,从现在开始使用新策略。
|
|
314
|
+
|
|
315
|
+
## 工具支持
|
|
316
|
+
|
|
317
|
+
Kiro Spec Engine 提供命令帮助编号:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# 列出所有 Spec 及其编号
|
|
321
|
+
kse status
|
|
322
|
+
|
|
323
|
+
# 按主序号分组查看 Spec
|
|
324
|
+
kse workflows
|
|
325
|
+
|
|
326
|
+
# 获取下一个可用编号建议
|
|
327
|
+
kse workflows --suggest-next
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## 总结
|
|
331
|
+
|
|
332
|
+
**根据项目复杂度选择策略**:
|
|
333
|
+
|
|
334
|
+
- **简单项目**:所有使用 `XX-00`
|
|
335
|
+
- **复杂项目**:按领域分组使用 `XX-YY`
|
|
336
|
+
- **不确定**:从简单开始,稍后添加结构
|
|
337
|
+
|
|
338
|
+
**记住**:目标是组织和清晰,而不是完美。选择适合你的团队和项目的方式。
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
**相关文档**:
|
|
343
|
+
- [Spec 工作流指南](./spec-workflow.md)
|
|
344
|
+
- [快速开始指南](./quick-start.md)
|
|
345
|
+
- [常见问题](./faq.md)
|
|
346
|
+
|
|
347
|
+
**版本**:1.0
|
|
348
|
+
**最后更新**:2026-01-24
|