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
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Spec Numbering Strategy Guide
|
|
2
|
+
|
|
3
|
+
> A comprehensive guide to choosing the right numbering strategy for your Specs
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Kiro Spec Engine uses a two-part numbering system: `{major}-{minor}-{description}`
|
|
8
|
+
|
|
9
|
+
- **Major number**: Represents a feature domain or theme (01, 02, 03, ...)
|
|
10
|
+
- **Minor number**: Represents iterations or sub-features within that domain (00, 01, 02, ...)
|
|
11
|
+
- **Description**: A kebab-case description of the Spec
|
|
12
|
+
|
|
13
|
+
**Examples**:
|
|
14
|
+
- `01-00-user-authentication`
|
|
15
|
+
- `01-01-add-oauth-support`
|
|
16
|
+
- `02-00-payment-system`
|
|
17
|
+
|
|
18
|
+
## When to Use Major vs Minor Numbers
|
|
19
|
+
|
|
20
|
+
### Strategy 1: Simple Projects (Recommended for Most Cases)
|
|
21
|
+
|
|
22
|
+
**Use Case**: Projects with < 20 independent features
|
|
23
|
+
|
|
24
|
+
**Approach**: Use only major numbers with minor always as `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
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Advantages**:
|
|
35
|
+
- ✅ Simple and clear
|
|
36
|
+
- ✅ Easy to understand at a glance
|
|
37
|
+
- ✅ No need to plan groupings upfront
|
|
38
|
+
- ✅ Works well for independent features
|
|
39
|
+
|
|
40
|
+
**When to use**:
|
|
41
|
+
- Building a tool or library
|
|
42
|
+
- Features are relatively independent
|
|
43
|
+
- Project is in early stages
|
|
44
|
+
- Team is small (< 5 people)
|
|
45
|
+
|
|
46
|
+
### Strategy 2: Complex Projects with Themes
|
|
47
|
+
|
|
48
|
+
**Use Case**: Large projects with clear feature domains
|
|
49
|
+
|
|
50
|
+
**Approach**: Group related Specs under the same major number
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
# User Management Domain (01-xx)
|
|
54
|
+
01-00-user-authentication-foundation
|
|
55
|
+
01-01-add-oauth-support
|
|
56
|
+
01-02-add-two-factor-auth
|
|
57
|
+
01-03-add-sso-integration
|
|
58
|
+
|
|
59
|
+
# Payment Domain (02-xx)
|
|
60
|
+
02-00-payment-system-mvp
|
|
61
|
+
02-01-add-subscription-billing
|
|
62
|
+
02-02-add-invoice-generation
|
|
63
|
+
02-03-add-refund-workflow
|
|
64
|
+
|
|
65
|
+
# Notification Domain (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
|
+
**Advantages**:
|
|
73
|
+
- ✅ Clear thematic grouping
|
|
74
|
+
- ✅ Easy to track evolution of a feature
|
|
75
|
+
- ✅ Shows relationships between Specs
|
|
76
|
+
- ✅ Scales well for large projects
|
|
77
|
+
|
|
78
|
+
**When to use**:
|
|
79
|
+
- Building a complex application
|
|
80
|
+
- Features have clear domains (user, payment, notification, etc.)
|
|
81
|
+
- Multiple iterations expected per domain
|
|
82
|
+
- Large team with domain ownership
|
|
83
|
+
|
|
84
|
+
### Strategy 3: Hybrid Approach (Flexible)
|
|
85
|
+
|
|
86
|
+
**Use Case**: Start simple, add structure as needed
|
|
87
|
+
|
|
88
|
+
**Approach**: Begin with major numbers only, introduce minor numbers when needed
|
|
89
|
+
|
|
90
|
+
**Phase 1 - Early Development**:
|
|
91
|
+
```
|
|
92
|
+
01-00-mvp-core-features
|
|
93
|
+
02-00-user-management
|
|
94
|
+
03-00-data-storage
|
|
95
|
+
04-00-api-gateway
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Phase 2 - Iteration Needed**:
|
|
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 ← Added iteration
|
|
104
|
+
03-02-data-storage-add-replication ← Added iteration
|
|
105
|
+
04-00-api-gateway
|
|
106
|
+
05-00-monitoring-system
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Advantages**:
|
|
110
|
+
- ✅ Start simple, grow as needed
|
|
111
|
+
- ✅ No premature planning required
|
|
112
|
+
- ✅ Adapts to project evolution
|
|
113
|
+
- ✅ Best of both worlds
|
|
114
|
+
|
|
115
|
+
**When to use**:
|
|
116
|
+
- Uncertain about project scope
|
|
117
|
+
- Want flexibility
|
|
118
|
+
- Agile development approach
|
|
119
|
+
- Learning the Spec workflow
|
|
120
|
+
|
|
121
|
+
## Semantic Numbering Rules
|
|
122
|
+
|
|
123
|
+
### Rule 1: XX-00 for First or Independent Specs
|
|
124
|
+
|
|
125
|
+
Use `XX-00` for:
|
|
126
|
+
- The first Spec in a domain
|
|
127
|
+
- Independent features that don't need iterations
|
|
128
|
+
- Standalone functionality
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
01-00-authentication-system # First in domain
|
|
132
|
+
02-00-payment-integration # Independent feature
|
|
133
|
+
03-00-email-notifications # Standalone
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Rule 2: XX-01+ for Iterations and Enhancements
|
|
137
|
+
|
|
138
|
+
Use `XX-01`, `XX-02`, etc. for:
|
|
139
|
+
- Bug fixes related to a previous Spec
|
|
140
|
+
- Feature enhancements
|
|
141
|
+
- Iterations on the same theme
|
|
142
|
+
- Related functionality
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
01-00-authentication-system
|
|
146
|
+
01-01-fix-session-timeout-bug # Bug fix
|
|
147
|
+
01-02-add-remember-me-feature # Enhancement
|
|
148
|
+
01-03-add-password-reset # Related feature
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Rule 3: Keep Related Specs Together
|
|
152
|
+
|
|
153
|
+
Group Specs that:
|
|
154
|
+
- Share the same codebase area
|
|
155
|
+
- Have dependencies on each other
|
|
156
|
+
- Belong to the same feature domain
|
|
157
|
+
- Will be maintained by the same team
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
# Good: Related notification features grouped
|
|
161
|
+
03-00-notification-email
|
|
162
|
+
03-01-notification-sms
|
|
163
|
+
03-02-notification-push
|
|
164
|
+
|
|
165
|
+
# Avoid: Unrelated features under same major number
|
|
166
|
+
03-00-notification-email
|
|
167
|
+
03-01-payment-refunds # ❌ Not related to notifications
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Practical Examples
|
|
171
|
+
|
|
172
|
+
### Example 1: Tool/Library Project (kiro-spec-engine)
|
|
173
|
+
|
|
174
|
+
**Project Type**: CLI tool with independent features
|
|
175
|
+
|
|
176
|
+
**Strategy**: Simple numbering (XX-00)
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
01-00-user-space-diagnosis
|
|
180
|
+
02-00-oauth-api-upgrade
|
|
181
|
+
03-00-multi-user-collaboration
|
|
182
|
+
04-00-watch-mode-automation
|
|
183
|
+
05-00-agent-hooks-and-automation
|
|
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
|
+
**Why**: Each feature is independent and complete
|
|
191
|
+
|
|
192
|
+
### Example 2: E-commerce Platform
|
|
193
|
+
|
|
194
|
+
**Project Type**: Complex web application
|
|
195
|
+
|
|
196
|
+
**Strategy**: Thematic grouping
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
# User Domain
|
|
200
|
+
01-00-user-registration-and-login
|
|
201
|
+
01-01-user-profile-management
|
|
202
|
+
01-02-user-preferences-and-settings
|
|
203
|
+
|
|
204
|
+
# Product Domain
|
|
205
|
+
02-00-product-catalog-foundation
|
|
206
|
+
02-01-product-search-and-filters
|
|
207
|
+
02-02-product-recommendations
|
|
208
|
+
|
|
209
|
+
# Order Domain
|
|
210
|
+
03-00-shopping-cart-system
|
|
211
|
+
03-01-checkout-process
|
|
212
|
+
03-02-order-tracking
|
|
213
|
+
03-03-order-history
|
|
214
|
+
|
|
215
|
+
# Payment Domain
|
|
216
|
+
04-00-payment-gateway-integration
|
|
217
|
+
04-01-multiple-payment-methods
|
|
218
|
+
04-02-payment-security-enhancements
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Why**: Clear domains with multiple related features
|
|
222
|
+
|
|
223
|
+
### Example 3: SaaS Application
|
|
224
|
+
|
|
225
|
+
**Project Type**: Multi-tenant SaaS
|
|
226
|
+
|
|
227
|
+
**Strategy**: Hybrid approach
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
# Core Features (Independent)
|
|
231
|
+
01-00-tenant-management
|
|
232
|
+
02-00-user-authentication
|
|
233
|
+
03-00-billing-system
|
|
234
|
+
|
|
235
|
+
# Analytics Domain (Grouped)
|
|
236
|
+
04-00-analytics-foundation
|
|
237
|
+
04-01-analytics-custom-dashboards
|
|
238
|
+
04-02-analytics-export-reports
|
|
239
|
+
|
|
240
|
+
# Integration Domain (Grouped)
|
|
241
|
+
05-00-api-gateway
|
|
242
|
+
05-01-webhook-system
|
|
243
|
+
05-02-third-party-integrations
|
|
244
|
+
|
|
245
|
+
# More Independent Features
|
|
246
|
+
06-00-email-templates
|
|
247
|
+
07-00-notification-center
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**Why**: Mix of independent features and grouped domains
|
|
251
|
+
|
|
252
|
+
## Decision Tree
|
|
253
|
+
|
|
254
|
+
Use this flowchart to decide your numbering strategy:
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
Is this your first Spec?
|
|
258
|
+
├─ Yes → Use 01-00-{description}
|
|
259
|
+
└─ No → Continue...
|
|
260
|
+
|
|
261
|
+
Is this related to an existing Spec?
|
|
262
|
+
├─ Yes → Use same major number, increment minor
|
|
263
|
+
│ Example: 01-00 exists → use 01-01
|
|
264
|
+
└─ No → Continue...
|
|
265
|
+
|
|
266
|
+
Do you expect multiple iterations in this domain?
|
|
267
|
+
├─ Yes → Plan major number for the domain
|
|
268
|
+
│ Example: 03-00, 03-01, 03-02 for notifications
|
|
269
|
+
└─ No → Use next available major number with -00
|
|
270
|
+
Example: 05-00-new-feature
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Best Practices
|
|
274
|
+
|
|
275
|
+
### ✅ Do
|
|
276
|
+
|
|
277
|
+
1. **Start simple**: Use XX-00 until you need complexity
|
|
278
|
+
2. **Be consistent**: Stick to one strategy per project
|
|
279
|
+
3. **Document your approach**: Add a note in your project README
|
|
280
|
+
4. **Use descriptive names**: Make the description clear
|
|
281
|
+
5. **Reserve major numbers**: If planning domains, reserve ranges
|
|
282
|
+
|
|
283
|
+
### ❌ Don't
|
|
284
|
+
|
|
285
|
+
1. **Don't over-plan**: Don't create 50 major numbers upfront
|
|
286
|
+
2. **Don't mix unrelated features**: Keep major numbers thematic
|
|
287
|
+
3. **Don't skip numbers**: Use sequential numbering
|
|
288
|
+
4. **Don't change strategy mid-project**: Stick to your approach
|
|
289
|
+
5. **Don't stress**: The numbering is for organization, not perfection
|
|
290
|
+
|
|
291
|
+
## Migration Between Strategies
|
|
292
|
+
|
|
293
|
+
### From Simple to Thematic
|
|
294
|
+
|
|
295
|
+
If you started with simple numbering and need to add structure:
|
|
296
|
+
|
|
297
|
+
**Before**:
|
|
298
|
+
```
|
|
299
|
+
01-00-user-auth
|
|
300
|
+
02-00-user-profile
|
|
301
|
+
03-00-payment-basic
|
|
302
|
+
04-00-payment-subscriptions
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**After** (optional reorganization):
|
|
306
|
+
```
|
|
307
|
+
01-00-user-auth
|
|
308
|
+
01-01-user-profile # Grouped with auth
|
|
309
|
+
02-00-payment-basic
|
|
310
|
+
02-01-payment-subscriptions # Grouped with payment
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
**Note**: Renaming existing Specs is optional. You can keep old numbers and use new strategy going forward.
|
|
314
|
+
|
|
315
|
+
## Tool Support
|
|
316
|
+
|
|
317
|
+
Kiro Spec Engine provides commands to help with numbering:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# List all Specs with their numbers
|
|
321
|
+
kse status
|
|
322
|
+
|
|
323
|
+
# View Specs grouped by major number
|
|
324
|
+
kse workflows
|
|
325
|
+
|
|
326
|
+
# Get next available number suggestion
|
|
327
|
+
kse workflows --suggest-next
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Summary
|
|
331
|
+
|
|
332
|
+
**Choose your strategy based on project complexity**:
|
|
333
|
+
|
|
334
|
+
- **Simple projects**: Use `XX-00` for everything
|
|
335
|
+
- **Complex projects**: Group by domain with `XX-YY`
|
|
336
|
+
- **Uncertain**: Start simple, add structure later
|
|
337
|
+
|
|
338
|
+
**Remember**: The goal is organization and clarity, not perfection. Choose what works for your team and project.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
**Related Documentation**:
|
|
343
|
+
- [Spec Workflow Guide](./spec-workflow.md)
|
|
344
|
+
- [Quick Start Guide](./quick-start.md)
|
|
345
|
+
- [FAQ](./faq.md)
|
|
346
|
+
|
|
347
|
+
**Version**: 1.0
|
|
348
|
+
**Last Updated**: 2026-01-24
|
package/docs/spec-workflow.md
CHANGED
|
@@ -19,6 +19,49 @@ Every Spec follows a three-stage workflow: **Requirements → Design → Tasks**
|
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
22
|
+
## Spec Naming and Numbering
|
|
23
|
+
|
|
24
|
+
Before creating a Spec, you need to choose a name following the format: `{major}-{minor}-{description}`
|
|
25
|
+
|
|
26
|
+
### Quick Numbering Guide
|
|
27
|
+
|
|
28
|
+
**Format**: `XX-YY-feature-name`
|
|
29
|
+
- `XX` = Major number (01, 02, 03, ...)
|
|
30
|
+
- `YY` = Minor number (00, 01, 02, ...)
|
|
31
|
+
- `feature-name` = kebab-case description
|
|
32
|
+
|
|
33
|
+
**Common Strategies**:
|
|
34
|
+
|
|
35
|
+
1. **Simple Projects** (recommended for most cases):
|
|
36
|
+
```
|
|
37
|
+
01-00-user-authentication
|
|
38
|
+
02-00-payment-system
|
|
39
|
+
03-00-notification-service
|
|
40
|
+
```
|
|
41
|
+
Use major numbers only (minor always `00`) for independent features.
|
|
42
|
+
|
|
43
|
+
2. **Complex Projects** (grouped by domain):
|
|
44
|
+
```
|
|
45
|
+
01-00-auth-foundation
|
|
46
|
+
01-01-auth-add-oauth
|
|
47
|
+
01-02-auth-add-2fa
|
|
48
|
+
02-00-payment-mvp
|
|
49
|
+
02-01-payment-subscriptions
|
|
50
|
+
```
|
|
51
|
+
Group related features under the same major number.
|
|
52
|
+
|
|
53
|
+
3. **Hybrid Approach** (flexible):
|
|
54
|
+
Start simple, add structure when needed. Use `XX-00` for independent features, introduce `XX-01+` when iterations are needed.
|
|
55
|
+
|
|
56
|
+
**Decision Tree**:
|
|
57
|
+
- First Spec? → Use `01-00-{name}`
|
|
58
|
+
- Related to existing Spec? → Same major, increment minor
|
|
59
|
+
- Independent feature? → Next major number with `-00`
|
|
60
|
+
|
|
61
|
+
📖 **For detailed guidance, see**: [Spec Numbering Strategy Guide](spec-numbering-guide.md)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
22
65
|
## The Spec Creation Workflow
|
|
23
66
|
|
|
24
67
|
```mermaid
|
|
@@ -262,6 +305,21 @@ kse context export 01-00-user-login
|
|
|
262
305
|
kse status
|
|
263
306
|
```
|
|
264
307
|
|
|
308
|
+
**8. Maintain Document Governance:**
|
|
309
|
+
```bash
|
|
310
|
+
# Check for document violations
|
|
311
|
+
kse docs diagnose
|
|
312
|
+
|
|
313
|
+
# Clean up temporary files
|
|
314
|
+
kse docs cleanup --spec 01-00-user-login
|
|
315
|
+
|
|
316
|
+
# Organize artifacts (reports, scripts, etc.)
|
|
317
|
+
kse docs archive --spec 01-00-user-login
|
|
318
|
+
|
|
319
|
+
# Validate final structure
|
|
320
|
+
kse docs validate --spec 01-00-user-login
|
|
321
|
+
```
|
|
322
|
+
|
|
265
323
|
---
|
|
266
324
|
|
|
267
325
|
## Workflow Variations
|
|
@@ -363,6 +421,12 @@ sequenceDiagram
|
|
|
363
421
|
3. **Include testing** - Every feature needs tests
|
|
364
422
|
4. **Be AI-friendly** - Tasks should be clear enough for AI to implement
|
|
365
423
|
|
|
424
|
+
### Document Governance
|
|
425
|
+
1. **Keep Specs clean** - Use `kse docs archive` to organize artifacts
|
|
426
|
+
2. **Remove temporary files** - Use `kse docs cleanup` regularly
|
|
427
|
+
3. **Validate structure** - Use `kse docs validate` before committing
|
|
428
|
+
4. **Install Git hooks** - Use `kse docs hooks install` to prevent violations
|
|
429
|
+
|
|
366
430
|
### Throughout
|
|
367
431
|
1. **Keep it updated** - Specs are living documents
|
|
368
432
|
2. **Use version control** - Commit Spec changes
|
|
@@ -420,6 +484,7 @@ sequenceDiagram
|
|
|
420
484
|
## Related Documentation
|
|
421
485
|
|
|
422
486
|
- **[Quick Start Guide](quick-start.md)** - Get started with your first Spec
|
|
487
|
+
- **[Document Governance](document-governance.md)** - Keep your Specs clean and organized
|
|
423
488
|
- **[Integration Modes](integration-modes.md)** - How to use Specs with AI tools
|
|
424
489
|
- **[Command Reference](command-reference.md)** - All kse commands
|
|
425
490
|
- **[Examples](examples/)** - Complete example Specs
|