kiro-spec-engine 1.1.0 → 1.2.1

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,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.1] - 2026-01-23
11
+
12
+ ### Added
13
+ - **Validation System**: Comprehensive project validation
14
+ - `validateProjectStructure()`: Check required files and directories
15
+ - `validateVersionFile()`: Verify version.json structure
16
+ - `validateDependencies()`: Check Node.js and Python versions
17
+ - `validateProject()`: Complete project validation
18
+ - **Automatic Version Checking**: Detect version mismatches
19
+ - VersionChecker class for automatic version detection
20
+ - Warning display when project version differs from installed kse
21
+ - `--no-version-check` flag to suppress warnings
22
+ - `kse version-info` command for detailed version information
23
+ - **Enhanced Testing**: Added tests for validation and version checking
24
+ - 7 new unit tests for validation system
25
+ - 4 new unit tests for version checker
26
+ - Total: 25 tests passing
27
+
28
+ ### Enhanced
29
+ - CLI now checks for version mismatches before command execution
30
+ - Better error messages for validation failures
31
+ - Improved user experience with version information display
32
+
33
+ ## [1.2.0] - 2026-01-23
34
+
35
+ ### Added
36
+ - **Project Adoption System**: Intelligent project adoption with three modes
37
+ - Fresh adoption: Create complete .kiro/ structure from scratch
38
+ - Partial adoption: Add missing components to existing .kiro/
39
+ - Full adoption: Upgrade existing complete .kiro/ to current version
40
+ - **Version Upgrade System**: Smooth version migration with migration scripts
41
+ - Incremental upgrades through intermediate versions
42
+ - Migration script support for breaking changes
43
+ - Automatic backup before upgrades
44
+ - **Backup and Rollback System**: Safe operations with automatic backups
45
+ - Automatic backup creation before destructive operations
46
+ - Backup validation and integrity checking
47
+ - Easy rollback to previous states
48
+ - **New CLI Commands**:
49
+ - `kse adopt`: Adopt existing projects into Kiro Spec Engine
50
+ - `kse upgrade`: Upgrade project to newer version
51
+ - `kse rollback`: Restore project from backup
52
+ - **Core Components**:
53
+ - DetectionEngine: Analyzes project structure and determines adoption strategy
54
+ - AdoptionStrategy: Implements fresh, partial, and full adoption modes
55
+ - MigrationEngine: Plans and executes version upgrades
56
+ - BackupSystem: Creates, manages, and restores backups
57
+
58
+ ### Enhanced
59
+ - Version management with upgrade history tracking
60
+ - File system utilities with backup support
61
+ - Project structure detection (Node.js, Python, mixed)
62
+ - Conflict detection and resolution
63
+
64
+ ### Infrastructure
65
+ - Created lib/adoption/ directory for adoption strategies
66
+ - Created lib/upgrade/ directory for migration engine
67
+ - Created lib/backup/ directory for backup system
68
+ - Created lib/commands/ directory for CLI commands
69
+ - Migration script template and loader system
70
+
71
+ ### Documentation
72
+ - Comprehensive adoption and upgrade system design
73
+ - Migration script interface documentation
74
+ - User guides for adoption, upgrade, and rollback workflows
75
+
10
76
  ## [1.1.0] - 2026-01-23
11
77
 
12
78
  ### Added
package/README.md CHANGED
@@ -83,12 +83,32 @@ kse enhance requirements .kiro/specs/01-00-user-authentication/requirements.md
83
83
  # Initialize project
84
84
  kse init [project-name]
85
85
 
86
+ # Adopt existing project
87
+ kse adopt # Interactive adoption
88
+ kse adopt --auto # Skip confirmations
89
+ kse adopt --dry-run # Show what would change
90
+ kse adopt --mode fresh # Force specific mode
91
+
92
+ # Upgrade project version
93
+ kse upgrade # Interactive upgrade
94
+ kse upgrade --auto # Skip confirmations
95
+ kse upgrade --dry-run # Show upgrade plan
96
+ kse upgrade --to 1.2.0 # Upgrade to specific version
97
+
98
+ # Rollback to previous state
99
+ kse rollback # Interactive rollback
100
+ kse rollback --auto # Skip confirmations
101
+ kse rollback --backup <id> # Restore specific backup
102
+
86
103
  # Check project status
87
104
  kse status
88
105
 
89
106
  # Create new spec
90
107
  kse create-spec <spec-name>
91
108
 
109
+ # System diagnostics
110
+ kse doctor
111
+
92
112
  # Set language
93
113
  kse --lang zh <command> # Chinese
94
114
  kse --lang en <command> # English (default)
@@ -143,6 +163,74 @@ kse enhance design .kiro/specs/01-00-user-auth/design.md --requirements .kiro/sp
143
163
  - **Ultrawork Motivation**: Provide Sisyphus spirit motivation and suggestions
144
164
  - **Next Steps Guidance**: Suggest specific execution strategies
145
165
 
166
+ ## 🔄 Project Adoption and Upgrade
167
+
168
+ ### Adopting Existing Projects
169
+
170
+ KSE can intelligently adopt existing projects with three modes:
171
+
172
+ **Fresh Adoption** (no `.kiro/` directory):
173
+ ```bash
174
+ kse adopt
175
+ # Creates complete .kiro/ structure from scratch
176
+ ```
177
+
178
+ **Partial Adoption** (`.kiro/` exists but incomplete):
179
+ ```bash
180
+ kse adopt
181
+ # Preserves existing specs/ and steering/
182
+ # Adds missing components
183
+ ```
184
+
185
+ **Full Adoption** (complete `.kiro/` from older version):
186
+ ```bash
187
+ kse adopt
188
+ # Upgrades components to current version
189
+ # Preserves all user content
190
+ # Creates backup before changes
191
+ ```
192
+
193
+ ### Upgrading to New Versions
194
+
195
+ When a new version of KSE is released:
196
+
197
+ ```bash
198
+ # Check current version
199
+ kse --version
200
+
201
+ # Upgrade to latest version
202
+ kse upgrade
203
+
204
+ # Upgrade to specific version
205
+ kse upgrade --to 1.2.0
206
+
207
+ # Preview upgrade plan
208
+ kse upgrade --dry-run
209
+ ```
210
+
211
+ **Incremental Upgrades**: KSE automatically handles version gaps by upgrading through intermediate versions (e.g., 1.0.0 → 1.1.0 → 1.2.0).
212
+
213
+ ### Rollback and Safety
214
+
215
+ All destructive operations create automatic backups:
216
+
217
+ ```bash
218
+ # List available backups
219
+ kse rollback
220
+
221
+ # Restore from specific backup
222
+ kse rollback --backup adopt-2026-01-23-100000
223
+
224
+ # Quick rollback (interactive)
225
+ kse rollback
226
+ ```
227
+
228
+ **Safety Features**:
229
+ - ✅ Automatic backup before adoption/upgrade
230
+ - ✅ Backup validation and integrity checking
231
+ - ✅ Easy rollback to previous states
232
+ - ✅ Dry-run mode to preview changes
233
+
146
234
  ## 🛠️ Project Structure
147
235
 
148
236
  After initialization, your project will have:
package/README.zh.md CHANGED
@@ -83,12 +83,32 @@ kse enhance requirements .kiro/specs/01-00-user-authentication/requirements.md
83
83
  # 初始化项目
84
84
  kse init [项目名称]
85
85
 
86
+ # 接管现有项目
87
+ kse adopt # 交互式接管
88
+ kse adopt --auto # 跳过确认
89
+ kse adopt --dry-run # 显示将要改变的内容
90
+ kse adopt --mode fresh # 强制指定模式
91
+
92
+ # 升级项目版本
93
+ kse upgrade # 交互式升级
94
+ kse upgrade --auto # 跳过确认
95
+ kse upgrade --dry-run # 显示升级计划
96
+ kse upgrade --to 1.2.0 # 升级到指定版本
97
+
98
+ # 回滚到之前的状态
99
+ kse rollback # 交互式回滚
100
+ kse rollback --auto # 跳过确认
101
+ kse rollback --backup <id> # 恢复指定备份
102
+
86
103
  # 检查项目状态
87
104
  kse status
88
105
 
89
106
  # 创建新 Spec
90
107
  kse create-spec <spec-名称>
91
108
 
109
+ # 系统诊断
110
+ kse doctor
111
+
92
112
  # 设置语言
93
113
  kse --lang zh <命令> # 中文
94
114
  kse --lang en <命令> # 英文
@@ -143,6 +163,74 @@ kse enhance design .kiro/specs/01-00-user-auth/design.md --requirements .kiro/sp
143
163
  - **Ultrawork 激励**:提供 Sisyphus 精神激励和建议
144
164
  - **下一步指导**:建议具体的执行策略
145
165
 
166
+ ## � 项目接管和升级
167
+
168
+ ### 接管现有项目
169
+
170
+ KSE 可以智能接管现有项目,支持三种模式:
171
+
172
+ **全新接管**(无 `.kiro/` 目录):
173
+ ```bash
174
+ kse adopt
175
+ # 从头创建完整的 .kiro/ 结构
176
+ ```
177
+
178
+ **部分接管**(`.kiro/` 存在但不完整):
179
+ ```bash
180
+ kse adopt
181
+ # 保留现有的 specs/ 和 steering/
182
+ # 添加缺失的组件
183
+ ```
184
+
185
+ **完整接管**(来自旧版本的完整 `.kiro/`):
186
+ ```bash
187
+ kse adopt
188
+ # 将组件升级到当前版本
189
+ # 保留所有用户内容
190
+ # 更改前创建备份
191
+ ```
192
+
193
+ ### 升级到新版本
194
+
195
+ 当 KSE 发布新版本时:
196
+
197
+ ```bash
198
+ # 检查当前版本
199
+ kse --version
200
+
201
+ # 升级到最新版本
202
+ kse upgrade
203
+
204
+ # 升级到指定版本
205
+ kse upgrade --to 1.2.0
206
+
207
+ # 预览升级计划
208
+ kse upgrade --dry-run
209
+ ```
210
+
211
+ **渐进式升级**:KSE 自动处理版本差距,通过中间版本升级(例如 1.0.0 → 1.1.0 → 1.2.0)。
212
+
213
+ ### 回滚和安全性
214
+
215
+ 所有破坏性操作都会自动创建备份:
216
+
217
+ ```bash
218
+ # 列出可用备份
219
+ kse rollback
220
+
221
+ # 从指定备份恢复
222
+ kse rollback --backup adopt-2026-01-23-100000
223
+
224
+ # 快速回滚(交互式)
225
+ kse rollback
226
+ ```
227
+
228
+ **安全特性**:
229
+ - ✅ 接管/升级前自动备份
230
+ - ✅ 备份验证和完整性检查
231
+ - ✅ 轻松回滚到之前的状态
232
+ - ✅ 预览模式查看更改
233
+
146
234
  ## 🛠️ 项目结构
147
235
 
148
236
  初始化后,你的项目将包含:
@@ -8,6 +8,10 @@ const path = require('path');
8
8
  const { spawn } = require('child_process');
9
9
  const { getI18n } = require('../lib/i18n');
10
10
  const doctorCommand = require('../lib/commands/doctor');
11
+ const adoptCommand = require('../lib/commands/adopt');
12
+ const upgradeCommand = require('../lib/commands/upgrade');
13
+ const rollbackCommand = require('../lib/commands/rollback');
14
+ const VersionChecker = require('../lib/version/version-checker');
11
15
 
12
16
  const i18n = getI18n();
13
17
  const t = (key, params) => i18n.t(key, params);
@@ -15,6 +19,19 @@ const t = (key, params) => i18n.t(key, params);
15
19
  // Read version from package.json
16
20
  const packageJson = require('../package.json');
17
21
 
22
+ // Create version checker instance
23
+ const versionChecker = new VersionChecker();
24
+
25
+ // Helper function to check version before command execution
26
+ async function checkVersionBeforeCommand(options = {}) {
27
+ const projectPath = process.cwd();
28
+ const noVersionCheck = options.noVersionCheck || false;
29
+
30
+ if (!noVersionCheck) {
31
+ await versionChecker.checkVersion(projectPath, { noVersionCheck });
32
+ }
33
+ }
34
+
18
35
  const program = new Command();
19
36
 
20
37
  // 版本和基本信息
@@ -24,7 +41,8 @@ program
24
41
  .version(packageJson.version, '-v, --version', 'Display version number')
25
42
  .option('-l, --lang <locale>', 'Set language (en/zh)', (locale) => {
26
43
  i18n.setLocale(locale);
27
- });
44
+ })
45
+ .option('--no-version-check', 'Suppress version mismatch warnings');
28
46
 
29
47
  // 初始化项目命令
30
48
  program
@@ -157,6 +175,38 @@ program
157
175
  doctorCommand();
158
176
  });
159
177
 
178
+ // 项目接管命令
179
+ program
180
+ .command('adopt')
181
+ .description('Adopt existing project into Kiro Spec Engine')
182
+ .option('--auto', 'Skip confirmations (use with caution)')
183
+ .option('--dry-run', 'Show what would change without making changes')
184
+ .option('--mode <mode>', 'Force specific adoption mode (fresh/partial/full)')
185
+ .action((options) => {
186
+ adoptCommand(options);
187
+ });
188
+
189
+ // 项目升级命令
190
+ program
191
+ .command('upgrade')
192
+ .description('Upgrade project to newer version')
193
+ .option('--auto', 'Skip confirmations (use with caution)')
194
+ .option('--dry-run', 'Show upgrade plan without making changes')
195
+ .option('--to <version>', 'Target version (default: current kse version)')
196
+ .action((options) => {
197
+ upgradeCommand(options);
198
+ });
199
+
200
+ // 回滚命令
201
+ program
202
+ .command('rollback')
203
+ .description('Restore project from backup')
204
+ .option('--auto', 'Skip confirmations (use with caution)')
205
+ .option('--backup <id>', 'Specific backup ID to restore')
206
+ .action((options) => {
207
+ rollbackCommand(options);
208
+ });
209
+
160
210
  // 状态检查命令
161
211
  program
162
212
  .command('status')
@@ -205,6 +255,15 @@ program
205
255
  }
206
256
  });
207
257
 
258
+ // 版本信息命令
259
+ program
260
+ .command('version-info')
261
+ .description('Display detailed version information')
262
+ .action(async () => {
263
+ const projectPath = process.cwd();
264
+ await versionChecker.displayVersionInfo(projectPath);
265
+ });
266
+
208
267
  // 更新项目配置的辅助函数
209
268
  async function updateProjectConfig(projectName) {
210
269
  const envPath = path.join(process.cwd(), '.kiro/steering/ENVIRONMENT.md');