kiro-spec-engine 1.2.2 → 1.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.3] - 2026-01-23
11
+
12
+ ### Added
13
+ - **Developer Documentation**: Comprehensive guides for contributors and extenders
14
+ - `docs/developer-guide.md`: Complete developer guide with API documentation
15
+ - `docs/architecture.md`: Detailed architecture diagrams and data flow documentation
16
+ - Migration script interface documentation with examples
17
+ - Extension points for custom strategies and validators
18
+ - Testing guidelines for unit, property-based, and integration tests
19
+ - Contributing guidelines and development setup
20
+
21
+ ### Enhanced
22
+ - Improved documentation structure for developers
23
+ - Added detailed API documentation for all core classes
24
+ - Added architecture diagrams for system understanding
25
+ - Added data flow diagrams for adoption, upgrade, and backup processes
26
+
10
27
  ## [1.2.2] - 2026-01-23
11
28
 
12
29
  ### Added
@@ -0,0 +1,506 @@
1
+ # Project Adoption Guide
2
+
3
+ This guide explains how to adopt existing projects into Kiro Spec Engine (KSE).
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Before You Start](#before-you-start)
9
+ - [Adoption Modes](#adoption-modes)
10
+ - [Step-by-Step Guide](#step-by-step-guide)
11
+ - [Common Scenarios](#common-scenarios)
12
+ - [Troubleshooting](#troubleshooting)
13
+
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ The `kse adopt` command intelligently integrates KSE into your existing project. It analyzes your project structure and chooses the best adoption strategy automatically.
19
+
20
+ **Key Features**:
21
+ - ✅ Automatic project structure detection
22
+ - ✅ Three adoption modes (fresh, partial, full)
23
+ - ✅ Automatic backup before changes
24
+ - ✅ Conflict detection and resolution
25
+ - ✅ Dry-run mode to preview changes
26
+ - ✅ Easy rollback if needed
27
+
28
+ ---
29
+
30
+ ## Before You Start
31
+
32
+ ### Prerequisites
33
+
34
+ 1. **Install KSE globally**:
35
+ ```bash
36
+ npm install -g kiro-spec-engine
37
+ ```
38
+
39
+ 2. **Navigate to your project**:
40
+ ```bash
41
+ cd /path/to/your/project
42
+ ```
43
+
44
+ 3. **Check current status** (optional):
45
+ ```bash
46
+ kse status
47
+ ```
48
+
49
+ ### What Gets Created
50
+
51
+ After adoption, your project will have:
52
+
53
+ ```
54
+ your-project/
55
+ ├── .kiro/ # KSE core directory
56
+ │ ├── version.json # Version tracking
57
+ │ ├── specs/ # Spec storage
58
+ │ ├── steering/ # AI behavior rules
59
+ │ │ ├── CORE_PRINCIPLES.md
60
+ │ │ ├── ENVIRONMENT.md
61
+ │ │ ├── CURRENT_CONTEXT.md
62
+ │ │ └── RULES_GUIDE.md
63
+ │ ├── tools/ # Ultrawork tools
64
+ │ │ └── ultrawork_enhancer.py
65
+ │ ├── backups/ # Automatic backups
66
+ │ └── README.md
67
+ └── (your existing files)
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Adoption Modes
73
+
74
+ KSE automatically selects the appropriate mode based on your project structure:
75
+
76
+ ### 1. Fresh Adoption
77
+
78
+ **When**: No `.kiro/` directory exists
79
+
80
+ **What happens**:
81
+ - Creates complete `.kiro/` structure from scratch
82
+ - Initializes with default templates
83
+ - Creates `version.json` with current KSE version
84
+
85
+ **Example**:
86
+ ```bash
87
+ # Your project has no .kiro/ directory
88
+ kse adopt
89
+ ```
90
+
91
+ ### 2. Partial Adoption
92
+
93
+ **When**: `.kiro/` exists but is incomplete (no `version.json`)
94
+
95
+ **What happens**:
96
+ - Preserves existing `specs/` and `steering/`
97
+ - Adds missing components
98
+ - Creates or updates `version.json`
99
+ - Creates backup before changes
100
+
101
+ **Example**:
102
+ ```bash
103
+ # You have .kiro/specs/ but no version.json
104
+ kse adopt
105
+ ```
106
+
107
+ ### 3. Full Adoption
108
+
109
+ **When**: Complete `.kiro/` with `version.json` exists
110
+
111
+ **What happens**:
112
+ - Upgrades components to current version
113
+ - Preserves all user content
114
+ - Updates template files
115
+ - Creates backup before changes
116
+
117
+ **Example**:
118
+ ```bash
119
+ # You have complete .kiro/ from older KSE version
120
+ kse adopt
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Step-by-Step Guide
126
+
127
+ ### Basic Adoption (Interactive)
128
+
129
+ 1. **Run the adopt command**:
130
+ ```bash
131
+ kse adopt
132
+ ```
133
+
134
+ 2. **Review the analysis**:
135
+ ```
136
+ 📦 Analyzing project structure...
137
+
138
+ Project Analysis:
139
+ Project Type: nodejs
140
+ .kiro/ Directory: No
141
+ Recommended Strategy: fresh
142
+ ```
143
+
144
+ 3. **Review the adoption plan**:
145
+ ```
146
+ 📋 Adoption Plan:
147
+ Mode: fresh
148
+ Actions:
149
+ - Create .kiro/ directory structure
150
+ - Copy template files (steering, tools, docs)
151
+ - Create version.json
152
+ ```
153
+
154
+ 4. **Confirm the operation**:
155
+ ```
156
+ Proceed with adoption? (Y/n)
157
+ ```
158
+
159
+ 5. **Wait for completion**:
160
+ ```
161
+ 📦 Creating backup...
162
+ ✅ Backup created: adopt-2026-01-23-100000
163
+
164
+ 🚀 Executing adoption...
165
+
166
+ ✅ Adoption completed successfully!
167
+
168
+ Files created:
169
+ + .kiro/
170
+ + .kiro/specs/
171
+ + .kiro/steering/
172
+ + .kiro/tools/
173
+ + version.json
174
+ ```
175
+
176
+ ### Dry Run (Preview Changes)
177
+
178
+ Preview what would change without making any modifications:
179
+
180
+ ```bash
181
+ kse adopt --dry-run
182
+ ```
183
+
184
+ **Output**:
185
+ ```
186
+ 🔍 Dry run mode - no changes will be made
187
+
188
+ Files that would be created:
189
+ + .kiro/
190
+ + .kiro/specs/
191
+ + .kiro/steering/
192
+ + version.json
193
+ ```
194
+
195
+ ### Automatic Mode (No Prompts)
196
+
197
+ Skip all confirmations (use with caution):
198
+
199
+ ```bash
200
+ kse adopt --auto
201
+ ```
202
+
203
+ **Use cases**:
204
+ - CI/CD pipelines
205
+ - Automated scripts
206
+ - When you're confident about the changes
207
+
208
+ ### Force Specific Mode
209
+
210
+ Override automatic mode detection:
211
+
212
+ ```bash
213
+ # Force fresh adoption
214
+ kse adopt --mode fresh
215
+
216
+ # Force partial adoption
217
+ kse adopt --mode partial
218
+
219
+ # Force full adoption
220
+ kse adopt --mode full
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Common Scenarios
226
+
227
+ ### Scenario 1: Brand New Project
228
+
229
+ **Situation**: You just created a new project and want to use KSE.
230
+
231
+ **Solution**:
232
+ ```bash
233
+ cd my-new-project
234
+ kse adopt
235
+ ```
236
+
237
+ **Result**: Fresh adoption creates complete `.kiro/` structure.
238
+
239
+ ---
240
+
241
+ ### Scenario 2: Existing Project with Specs
242
+
243
+ **Situation**: You've been using KSE informally (manual `.kiro/` setup) and want to formalize it.
244
+
245
+ **Solution**:
246
+ ```bash
247
+ cd my-existing-project
248
+ kse adopt
249
+ ```
250
+
251
+ **Result**: Partial adoption preserves your specs and adds missing components.
252
+
253
+ ---
254
+
255
+ ### Scenario 3: Old KSE Project
256
+
257
+ **Situation**: Your project was initialized with an older KSE version.
258
+
259
+ **Solution**:
260
+ ```bash
261
+ cd my-old-kse-project
262
+ kse adopt
263
+ ```
264
+
265
+ **Result**: Full adoption upgrades to current version while preserving your content.
266
+
267
+ ---
268
+
269
+ ### Scenario 4: Conflict Resolution
270
+
271
+ **Situation**: You have custom steering files that conflict with templates.
272
+
273
+ **What happens**:
274
+ ```
275
+ ⚠️ Conflicts detected:
276
+ - steering/CORE_PRINCIPLES.md
277
+
278
+ Existing files will be preserved, template files will be skipped
279
+ ```
280
+
281
+ **Options**:
282
+ 1. **Keep existing** (default): Your files are preserved
283
+ 2. **Manual merge**: Review and merge manually after adoption
284
+ 3. **Rollback and retry**: Use `kse rollback` if needed
285
+
286
+ ---
287
+
288
+ ### Scenario 5: Multiple Projects
289
+
290
+ **Situation**: You want to adopt KSE across multiple projects.
291
+
292
+ **Solution**:
293
+ ```bash
294
+ # Create a script
295
+ for dir in project1 project2 project3; do
296
+ cd $dir
297
+ kse adopt --auto
298
+ cd ..
299
+ done
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Troubleshooting
305
+
306
+ ### Problem: "Permission denied" error
307
+
308
+ **Cause**: Insufficient file system permissions
309
+
310
+ **Solution**:
311
+ ```bash
312
+ # Check permissions
313
+ ls -la .kiro/
314
+
315
+ # Fix permissions (Unix/Mac)
316
+ chmod -R u+w .kiro/
317
+
318
+ # Or run with elevated permissions (not recommended)
319
+ sudo kse adopt
320
+ ```
321
+
322
+ ---
323
+
324
+ ### Problem: Adoption fails midway
325
+
326
+ **Cause**: File system error, disk full, or interrupted operation
327
+
328
+ **Solution**:
329
+ ```bash
330
+ # Check if backup was created
331
+ kse rollback
332
+
333
+ # Select the most recent backup
334
+ # Restore and try again
335
+ ```
336
+
337
+ ---
338
+
339
+ ### Problem: "Already adopted" message
340
+
341
+ **Cause**: Project already has `.kiro/` with current version
342
+
343
+ **Solution**:
344
+ ```bash
345
+ # Check version info
346
+ kse version-info
347
+
348
+ # If you want to re-adopt, use upgrade instead
349
+ kse upgrade
350
+ ```
351
+
352
+ ---
353
+
354
+ ### Problem: Conflicts with existing files
355
+
356
+ **Cause**: Your custom files conflict with template files
357
+
358
+ **Solution**:
359
+
360
+ **Option 1**: Keep your files (default behavior)
361
+ ```bash
362
+ kse adopt
363
+ # Your files are preserved automatically
364
+ ```
365
+
366
+ **Option 2**: Manual merge after adoption
367
+ ```bash
368
+ kse adopt
369
+ # Then manually review and merge:
370
+ # - Your file: .kiro/steering/CORE_PRINCIPLES.md
371
+ # - Template: Check KSE documentation for latest template
372
+ ```
373
+
374
+ **Option 3**: Backup and replace
375
+ ```bash
376
+ # Manually backup your custom files
377
+ cp .kiro/steering/CORE_PRINCIPLES.md ~/backup/
378
+
379
+ # Remove conflicting files
380
+ rm .kiro/steering/CORE_PRINCIPLES.md
381
+
382
+ # Adopt again
383
+ kse adopt
384
+ ```
385
+
386
+ ---
387
+
388
+ ### Problem: Python not found warning
389
+
390
+ **Cause**: Python is not installed or not in PATH
391
+
392
+ **Solution**:
393
+
394
+ **If you need Ultrawork tools**:
395
+ ```bash
396
+ # Install Python 3.8+
397
+ # Windows: Download from python.org
398
+ # Mac: brew install python3
399
+ # Linux: sudo apt install python3
400
+
401
+ # Verify installation
402
+ python --version
403
+ ```
404
+
405
+ **If you don't need Ultrawork tools**:
406
+ - Ignore the warning
407
+ - You can still use all other KSE features
408
+
409
+ ---
410
+
411
+ ### Problem: Want to undo adoption
412
+
413
+ **Cause**: Changed your mind or something went wrong
414
+
415
+ **Solution**:
416
+ ```bash
417
+ # List available backups
418
+ kse rollback
419
+
420
+ # Select the backup from before adoption
421
+ # Restore to previous state
422
+ ```
423
+
424
+ ---
425
+
426
+ ## Best Practices
427
+
428
+ ### 1. Always Review First
429
+
430
+ Use dry-run mode before actual adoption:
431
+ ```bash
432
+ kse adopt --dry-run
433
+ ```
434
+
435
+ ### 2. Commit Before Adoption
436
+
437
+ If using version control:
438
+ ```bash
439
+ git add -A
440
+ git commit -m "Before KSE adoption"
441
+ kse adopt
442
+ ```
443
+
444
+ ### 3. Check Version Info
445
+
446
+ After adoption, verify everything is correct:
447
+ ```bash
448
+ kse version-info
449
+ kse status
450
+ ```
451
+
452
+ ### 4. Keep Backups
453
+
454
+ Don't delete automatic backups immediately:
455
+ ```bash
456
+ # Backups are in .kiro/backups/
457
+ ls .kiro/backups/
458
+ ```
459
+
460
+ ### 5. Document Custom Changes
461
+
462
+ If you customize steering files, document your changes:
463
+ ```markdown
464
+ # In .kiro/steering/CUSTOM_RULES.md
465
+ ## Custom Rules for This Project
466
+ - Rule 1: ...
467
+ - Rule 2: ...
468
+ ```
469
+
470
+ ---
471
+
472
+ ## Next Steps
473
+
474
+ After successful adoption:
475
+
476
+ 1. **Create your first spec**:
477
+ ```bash
478
+ kse create-spec 01-00-my-feature
479
+ ```
480
+
481
+ 2. **Check project status**:
482
+ ```bash
483
+ kse status
484
+ ```
485
+
486
+ 3. **Read the upgrade guide**:
487
+ - See [Upgrade Guide](upgrade-guide.md) for version management
488
+
489
+ 4. **Explore Ultrawork**:
490
+ - Enhance your specs with quality assessment
491
+ ```bash
492
+ kse enhance requirements .kiro/specs/01-00-my-feature/requirements.md
493
+ ```
494
+
495
+ ---
496
+
497
+ ## Getting Help
498
+
499
+ - **Documentation**: Check README.md in your `.kiro/` directory
500
+ - **Issues**: https://github.com/heguangyong/kiro-spec-engine/issues
501
+ - **Version Info**: `kse version-info`
502
+ - **System Check**: `kse doctor`
503
+
504
+ ---
505
+
506
+ **Happy adopting! 🔥**