scene-capability-engine 3.0.0

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.
Files changed (336) hide show
  1. package/CHANGELOG.md +2513 -0
  2. package/LICENSE +21 -0
  3. package/README.md +765 -0
  4. package/README.zh.md +630 -0
  5. package/bin/kiro-spec-engine.js +796 -0
  6. package/bin/kse.js +3 -0
  7. package/bin/sce.js +3 -0
  8. package/bin/sco.js +3 -0
  9. package/docs/331-poc-adaptation-roadmap.md +156 -0
  10. package/docs/331-poc-dual-track-integration-guide.md +120 -0
  11. package/docs/331-poc-weekly-delivery-checklist.md +52 -0
  12. package/docs/OFFLINE_INSTALL.md +96 -0
  13. package/docs/README.md +279 -0
  14. package/docs/adopt-migration-guide.md +599 -0
  15. package/docs/adoption-guide.md +616 -0
  16. package/docs/agent-hooks-analysis.md +815 -0
  17. package/docs/architecture.md +733 -0
  18. package/docs/articles/ai-driven-development-philosophy-and-practice-review.md +208 -0
  19. package/docs/articles/ai-driven-development-philosophy-and-practice.en.md +459 -0
  20. package/docs/articles/ai-driven-development-philosophy-and-practice.md +492 -0
  21. package/docs/autonomous-control-guide.md +851 -0
  22. package/docs/command-reference.md +1368 -0
  23. package/docs/community.md +115 -0
  24. package/docs/cross-tool-guide.md +555 -0
  25. package/docs/developer-guide.md +619 -0
  26. package/docs/document-governance.md +865 -0
  27. package/docs/environment-management-guide.md +526 -0
  28. package/docs/examples/add-export-command/design.md +194 -0
  29. package/docs/examples/add-export-command/requirements.md +110 -0
  30. package/docs/examples/add-export-command/tasks.md +88 -0
  31. package/docs/examples/add-rest-api/design.md +855 -0
  32. package/docs/examples/add-rest-api/requirements.md +323 -0
  33. package/docs/examples/add-rest-api/tasks.md +355 -0
  34. package/docs/examples/add-user-dashboard/design.md +192 -0
  35. package/docs/examples/add-user-dashboard/requirements.md +143 -0
  36. package/docs/examples/add-user-dashboard/tasks.md +91 -0
  37. package/docs/faq.md +697 -0
  38. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.json +156 -0
  39. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.md +24 -0
  40. package/docs/images/wechat-qr.png +0 -0
  41. package/docs/integration-modes.md +529 -0
  42. package/docs/integration-philosophy.md +313 -0
  43. package/docs/knowledge-management-guide.md +263 -0
  44. package/docs/manual-workflows-guide.md +418 -0
  45. package/docs/moqui-capability-matrix.md +73 -0
  46. package/docs/moqui-template-core-library-playbook.md +109 -0
  47. package/docs/multi-agent-coordination-guide.md +553 -0
  48. package/docs/multi-repo-management-guide.md +1344 -0
  49. package/docs/quick-start-with-ai-tools.md +375 -0
  50. package/docs/quick-start.md +146 -0
  51. package/docs/release-checklist.md +121 -0
  52. package/docs/releases/README.md +13 -0
  53. package/docs/releases/v1.46.2-validation.md +45 -0
  54. package/docs/releases/v1.46.2.md +50 -0
  55. package/docs/scene-runtime-guide.md +347 -0
  56. package/docs/spec-collaboration-guide.md +369 -0
  57. package/docs/spec-locking-guide.md +225 -0
  58. package/docs/spec-numbering-guide.md +348 -0
  59. package/docs/spec-workflow.md +519 -0
  60. package/docs/steering-strategy-guide.md +196 -0
  61. package/docs/team-collaboration-guide.md +465 -0
  62. package/docs/testing-strategy.md +272 -0
  63. package/docs/tools/claude-guide.md +654 -0
  64. package/docs/tools/cursor-guide.md +706 -0
  65. package/docs/tools/generic-guide.md +446 -0
  66. package/docs/tools/kiro-guide.md +308 -0
  67. package/docs/tools/vscode-guide.md +445 -0
  68. package/docs/tools/windsurf-guide.md +391 -0
  69. package/docs/troubleshooting.md +1135 -0
  70. package/docs/upgrade-guide.md +639 -0
  71. package/docs/value-observability-guide.md +127 -0
  72. package/docs/zh/README.md +341 -0
  73. package/docs/zh/quick-start.md +764 -0
  74. package/docs/zh/release-checklist.md +121 -0
  75. package/docs/zh/releases/README.md +13 -0
  76. package/docs/zh/releases/v1.46.2-validation.md +45 -0
  77. package/docs/zh/releases/v1.46.2.md +50 -0
  78. package/docs/zh/spec-numbering-guide.md +348 -0
  79. package/docs/zh/tools/claude-guide.md +349 -0
  80. package/docs/zh/tools/cursor-guide.md +281 -0
  81. package/docs/zh/tools/generic-guide.md +499 -0
  82. package/docs/zh/tools/kiro-guide.md +342 -0
  83. package/docs/zh/tools/vscode-guide.md +449 -0
  84. package/docs/zh/tools/windsurf-guide.md +378 -0
  85. package/docs/zh/value-observability-guide.md +127 -0
  86. package/docs//344/272/244/344/273/230/346/270/205/345/215/225.md +75 -0
  87. package/lib/adoption/adoption-logger.js +487 -0
  88. package/lib/adoption/adoption-strategy.js +538 -0
  89. package/lib/adoption/backup-manager.js +420 -0
  90. package/lib/adoption/conflict-resolver.js +410 -0
  91. package/lib/adoption/detection-engine.js +275 -0
  92. package/lib/adoption/diff-viewer.js +226 -0
  93. package/lib/adoption/error-formatter.js +509 -0
  94. package/lib/adoption/file-classifier.js +385 -0
  95. package/lib/adoption/progress-reporter.js +534 -0
  96. package/lib/adoption/smart-orchestrator.js +470 -0
  97. package/lib/adoption/strategy-selector.js +218 -0
  98. package/lib/adoption/summary-generator.js +493 -0
  99. package/lib/adoption/template-sync.js +605 -0
  100. package/lib/auto/autonomous-engine.js +485 -0
  101. package/lib/auto/checkpoint-manager.js +300 -0
  102. package/lib/auto/close-loop-runner.js +2476 -0
  103. package/lib/auto/config-schema.js +176 -0
  104. package/lib/auto/decision-engine.js +344 -0
  105. package/lib/auto/error-recovery-manager.js +580 -0
  106. package/lib/auto/goal-decomposer.js +278 -0
  107. package/lib/auto/progress-tracker.js +502 -0
  108. package/lib/auto/safety-manager.js +186 -0
  109. package/lib/auto/semantic-decomposer.js +137 -0
  110. package/lib/auto/state-manager.js +126 -0
  111. package/lib/auto/task-queue-manager.js +340 -0
  112. package/lib/backup/backup-system.js +372 -0
  113. package/lib/backup/selective-backup.js +207 -0
  114. package/lib/collab/agent-registry.js +240 -0
  115. package/lib/collab/collab-manager.js +285 -0
  116. package/lib/collab/contract-manager.js +320 -0
  117. package/lib/collab/coordinator.js +370 -0
  118. package/lib/collab/dependency-manager.js +280 -0
  119. package/lib/collab/index.js +20 -0
  120. package/lib/collab/integration-manager.js +202 -0
  121. package/lib/collab/merge-coordinator.js +252 -0
  122. package/lib/collab/metadata-manager.js +233 -0
  123. package/lib/collab/multi-agent-config.js +120 -0
  124. package/lib/collab/spec-lifecycle-manager.js +304 -0
  125. package/lib/collab/sync-barrier.js +88 -0
  126. package/lib/collab/visualizer.js +208 -0
  127. package/lib/commands/adopt.js +749 -0
  128. package/lib/commands/auto.js +19559 -0
  129. package/lib/commands/collab.js +275 -0
  130. package/lib/commands/context.js +99 -0
  131. package/lib/commands/docs.js +808 -0
  132. package/lib/commands/doctor.js +273 -0
  133. package/lib/commands/env.js +420 -0
  134. package/lib/commands/knowledge.js +309 -0
  135. package/lib/commands/lock.js +235 -0
  136. package/lib/commands/ops.js +409 -0
  137. package/lib/commands/orchestrate.js +446 -0
  138. package/lib/commands/prompt.js +105 -0
  139. package/lib/commands/repo.js +118 -0
  140. package/lib/commands/rollback.js +219 -0
  141. package/lib/commands/scene.js +15549 -0
  142. package/lib/commands/spec-bootstrap.js +147 -0
  143. package/lib/commands/spec-gate.js +157 -0
  144. package/lib/commands/spec-pipeline.js +205 -0
  145. package/lib/commands/status.js +321 -0
  146. package/lib/commands/task.js +199 -0
  147. package/lib/commands/templates.js +654 -0
  148. package/lib/commands/upgrade.js +231 -0
  149. package/lib/commands/value.js +569 -0
  150. package/lib/commands/watch.js +684 -0
  151. package/lib/commands/workflows.js +240 -0
  152. package/lib/commands/workspace-multi.js +325 -0
  153. package/lib/commands/workspace.js +189 -0
  154. package/lib/context/context-exporter.js +378 -0
  155. package/lib/context/prompt-generator.js +482 -0
  156. package/lib/data/moqui-capability-lexicon.json +45 -0
  157. package/lib/environment/backup-system.js +189 -0
  158. package/lib/environment/environment-manager.js +379 -0
  159. package/lib/environment/environment-registry.js +168 -0
  160. package/lib/gitignore/gitignore-backup.js +229 -0
  161. package/lib/gitignore/gitignore-detector.js +239 -0
  162. package/lib/gitignore/gitignore-integration.js +267 -0
  163. package/lib/gitignore/gitignore-transformer.js +193 -0
  164. package/lib/gitignore/layered-rules-template.js +42 -0
  165. package/lib/governance/archive-tool.js +284 -0
  166. package/lib/governance/cleanup-tool.js +237 -0
  167. package/lib/governance/config-manager.js +186 -0
  168. package/lib/governance/diagnostic-engine.js +271 -0
  169. package/lib/governance/doc-reference-checker.js +200 -0
  170. package/lib/governance/execution-logger.js +243 -0
  171. package/lib/governance/file-scanner.js +285 -0
  172. package/lib/governance/hooks-manager.js +333 -0
  173. package/lib/governance/reporter.js +337 -0
  174. package/lib/governance/validation-engine.js +181 -0
  175. package/lib/i18n.js +79 -0
  176. package/lib/knowledge/entry-manager.js +208 -0
  177. package/lib/knowledge/index-manager.js +261 -0
  178. package/lib/knowledge/knowledge-manager.js +273 -0
  179. package/lib/knowledge/template-manager.js +191 -0
  180. package/lib/lock/index.js +21 -0
  181. package/lib/lock/lock-file.js +192 -0
  182. package/lib/lock/lock-manager.js +321 -0
  183. package/lib/lock/machine-identifier.js +135 -0
  184. package/lib/lock/steering-file-lock.js +207 -0
  185. package/lib/lock/task-lock-manager.js +345 -0
  186. package/lib/operations/audit-logger.js +293 -0
  187. package/lib/operations/feedback-manager.js +1147 -0
  188. package/lib/operations/index.js +23 -0
  189. package/lib/operations/models/index.js +170 -0
  190. package/lib/operations/operations-manager.js +151 -0
  191. package/lib/operations/operations-validator.js +280 -0
  192. package/lib/operations/permission-manager.js +354 -0
  193. package/lib/operations/template-loader.js +143 -0
  194. package/lib/orchestrator/agent-spawner.js +629 -0
  195. package/lib/orchestrator/bootstrap-prompt-builder.js +236 -0
  196. package/lib/orchestrator/index.js +19 -0
  197. package/lib/orchestrator/orchestration-engine.js +1270 -0
  198. package/lib/orchestrator/orchestrator-config.js +173 -0
  199. package/lib/orchestrator/status-monitor.js +591 -0
  200. package/lib/python-checker.js +209 -0
  201. package/lib/repo/config-manager.js +580 -0
  202. package/lib/repo/errors/config-error.js +13 -0
  203. package/lib/repo/errors/git-error.js +15 -0
  204. package/lib/repo/errors/repo-error.js +14 -0
  205. package/lib/repo/git-operations.js +181 -0
  206. package/lib/repo/handlers/.gitkeep +1 -0
  207. package/lib/repo/handlers/exec-handler.js +155 -0
  208. package/lib/repo/handlers/health-handler.js +169 -0
  209. package/lib/repo/handlers/init-handler.js +197 -0
  210. package/lib/repo/handlers/status-handler.js +176 -0
  211. package/lib/repo/output-formatter.js +184 -0
  212. package/lib/repo/path-resolver.js +178 -0
  213. package/lib/repo/repo-manager.js +514 -0
  214. package/lib/scene-runtime/audit-emitter.js +59 -0
  215. package/lib/scene-runtime/binding-plugin-loader.js +351 -0
  216. package/lib/scene-runtime/binding-registry.js +349 -0
  217. package/lib/scene-runtime/eval-bridge.js +44 -0
  218. package/lib/scene-runtime/index.js +19 -0
  219. package/lib/scene-runtime/moqui-adapter.js +620 -0
  220. package/lib/scene-runtime/moqui-client.js +606 -0
  221. package/lib/scene-runtime/moqui-extractor.js +2029 -0
  222. package/lib/scene-runtime/plan-compiler.js +208 -0
  223. package/lib/scene-runtime/policy-gate.js +58 -0
  224. package/lib/scene-runtime/runtime-executor.js +358 -0
  225. package/lib/scene-runtime/scene-loader.js +96 -0
  226. package/lib/scene-runtime/scene-ontology.js +959 -0
  227. package/lib/scene-runtime/scene-template-linter.js +852 -0
  228. package/lib/scene-runtime/templates/scene-template-erp-query-v0.1.yaml +28 -0
  229. package/lib/scene-runtime/templates/scene-template-hybrid-shadow-v0.1.yaml +34 -0
  230. package/lib/spec/bootstrap/context-collector.js +48 -0
  231. package/lib/spec/bootstrap/draft-generator.js +158 -0
  232. package/lib/spec/bootstrap/questionnaire-engine.js +70 -0
  233. package/lib/spec/bootstrap/trace-emitter.js +59 -0
  234. package/lib/spec/multi-spec-orchestrate.js +93 -0
  235. package/lib/spec/pipeline/constants.js +6 -0
  236. package/lib/spec/pipeline/stage-adapters.js +118 -0
  237. package/lib/spec/pipeline/stage-runner.js +146 -0
  238. package/lib/spec/pipeline/state-store.js +119 -0
  239. package/lib/spec-gate/engine/gate-engine.js +165 -0
  240. package/lib/spec-gate/policy/default-policy.js +22 -0
  241. package/lib/spec-gate/policy/policy-loader.js +103 -0
  242. package/lib/spec-gate/result-emitter.js +81 -0
  243. package/lib/spec-gate/rules/default-rules.js +156 -0
  244. package/lib/spec-gate/rules/rule-registry.js +51 -0
  245. package/lib/steering/adoption-config.js +164 -0
  246. package/lib/steering/compliance-auto-fixer.js +204 -0
  247. package/lib/steering/compliance-cache.js +99 -0
  248. package/lib/steering/compliance-error-reporter.js +70 -0
  249. package/lib/steering/context-sync-manager.js +273 -0
  250. package/lib/steering/index.js +92 -0
  251. package/lib/steering/spec-steering.js +230 -0
  252. package/lib/steering/steering-compliance-checker.js +73 -0
  253. package/lib/steering/steering-loader.js +144 -0
  254. package/lib/steering/steering-manager.js +289 -0
  255. package/lib/task/index.js +12 -0
  256. package/lib/task/task-claimer.js +489 -0
  257. package/lib/task/task-status-store.js +418 -0
  258. package/lib/templates/cache-manager.js +440 -0
  259. package/lib/templates/content-generalizer.js +247 -0
  260. package/lib/templates/frontmatter-generator.js +128 -0
  261. package/lib/templates/git-handler.js +471 -0
  262. package/lib/templates/metadata-collector.js +328 -0
  263. package/lib/templates/path-utils.js +144 -0
  264. package/lib/templates/registry-parser.js +505 -0
  265. package/lib/templates/spec-reader.js +216 -0
  266. package/lib/templates/template-applicator.js +249 -0
  267. package/lib/templates/template-creator.js +256 -0
  268. package/lib/templates/template-error.js +143 -0
  269. package/lib/templates/template-exporter.js +502 -0
  270. package/lib/templates/template-manager.js +782 -0
  271. package/lib/templates/template-validator.js +361 -0
  272. package/lib/upgrade/migration-engine.js +382 -0
  273. package/lib/upgrade/migrations/.gitkeep +52 -0
  274. package/lib/upgrade/migrations/1.0.0-to-1.1.0.js +78 -0
  275. package/lib/utils/file-diff.js +177 -0
  276. package/lib/utils/fs-utils.js +274 -0
  277. package/lib/utils/tool-detector.js +383 -0
  278. package/lib/utils/validation.js +324 -0
  279. package/lib/value/gate-summary-emitter.js +99 -0
  280. package/lib/value/metric-contract-loader.js +210 -0
  281. package/lib/value/risk-evaluator.js +117 -0
  282. package/lib/value/weekly-snapshot-builder.js +61 -0
  283. package/lib/version/version-checker.js +156 -0
  284. package/lib/version/version-manager.js +327 -0
  285. package/lib/watch/action-executor.js +458 -0
  286. package/lib/watch/event-debouncer.js +323 -0
  287. package/lib/watch/execution-logger.js +550 -0
  288. package/lib/watch/file-watcher.js +499 -0
  289. package/lib/watch/presets.js +266 -0
  290. package/lib/watch/watch-manager.js +533 -0
  291. package/lib/workspace/multi/global-config.js +150 -0
  292. package/lib/workspace/multi/index.js +22 -0
  293. package/lib/workspace/multi/path-utils.js +173 -0
  294. package/lib/workspace/multi/workspace-context-resolver.js +244 -0
  295. package/lib/workspace/multi/workspace-registry.js +196 -0
  296. package/lib/workspace/multi/workspace-state-manager.js +537 -0
  297. package/lib/workspace/multi/workspace.js +90 -0
  298. package/lib/workspace/workspace-manager.js +370 -0
  299. package/lib/workspace/workspace-sync.js +356 -0
  300. package/locales/en.json +114 -0
  301. package/locales/zh.json +114 -0
  302. package/package.json +102 -0
  303. package/template/.kiro/README.md +247 -0
  304. package/template/.kiro/hooks/check-spec-on-create.kiro.hook +17 -0
  305. package/template/.kiro/hooks/run-tests-on-save.kiro.hook +13 -0
  306. package/template/.kiro/hooks/sync-tasks-on-edit.kiro.hook +16 -0
  307. package/template/.kiro/specs/SPEC_WORKFLOW_GUIDE.md +134 -0
  308. package/template/.kiro/steering/CORE_PRINCIPLES.md +133 -0
  309. package/template/.kiro/steering/CURRENT_CONTEXT.md +30 -0
  310. package/template/.kiro/steering/ENVIRONMENT.md +35 -0
  311. package/template/.kiro/steering/RULES_GUIDE.md +46 -0
  312. package/template/.kiro/templates/operations/default/change-impact.md +112 -0
  313. package/template/.kiro/templates/operations/default/deployment.md +91 -0
  314. package/template/.kiro/templates/operations/default/feedback-response.md +269 -0
  315. package/template/.kiro/templates/operations/default/migration-plan.md +172 -0
  316. package/template/.kiro/templates/operations/default/monitoring.md +135 -0
  317. package/template/.kiro/templates/operations/default/operations.md +135 -0
  318. package/template/.kiro/templates/operations/default/rollback.md +143 -0
  319. package/template/.kiro/templates/operations/default/tools.yaml +364 -0
  320. package/template/.kiro/templates/operations/default/troubleshooting.md +123 -0
  321. package/template/.kiro/tools/backup_manager.py +295 -0
  322. package/template/.kiro/tools/configuration_manager.py +218 -0
  323. package/template/.kiro/tools/document_evaluator.py +550 -0
  324. package/template/.kiro/tools/enhancement_logger.py +168 -0
  325. package/template/.kiro/tools/error_handler.py +335 -0
  326. package/template/.kiro/tools/improvement_identifier.py +444 -0
  327. package/template/.kiro/tools/modification_applicator.py +737 -0
  328. package/template/.kiro/tools/quality_gate_enforcer.py +207 -0
  329. package/template/.kiro/tools/quality_scorer.py +305 -0
  330. package/template/.kiro/tools/report_generator.py +154 -0
  331. package/template/.kiro/tools/ultrawork_enhancer.py +676 -0
  332. package/template/.kiro/tools/ultrawork_enhancer_refactored.py +0 -0
  333. package/template/.kiro/tools/ultrawork_enhancer_v2.py +463 -0
  334. package/template/.kiro/tools/ultrawork_enhancer_v3.py +606 -0
  335. package/template/.kiro/tools/workflow_quality_gate.py +100 -0
  336. package/template/README.md +111 -0
@@ -0,0 +1,616 @@
1
+ # Project Adoption Guide
2
+
3
+ This guide explains how to adopt existing projects into Kiro Spec Engine (KSE) using the new **zero-interaction smart adoption system**.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Quick Start](#quick-start)
9
+ - [How It Works](#how-it-works)
10
+ - [Adoption Modes](#adoption-modes)
11
+ - [Command Options](#command-options)
12
+ - [Common Scenarios](#common-scenarios)
13
+ - [Troubleshooting](#troubleshooting)
14
+ - [Migration from Interactive Mode](#migration-from-interactive-mode)
15
+
16
+ ---
17
+
18
+ ## Overview
19
+
20
+ The `kse adopt` command now features **smart, zero-interaction adoption** that automatically handles project integration without asking any questions.
21
+
22
+ **Key Features**:
23
+ - ✅ **Zero Questions** - No user input required
24
+ - ✅ **Smart Detection** - Automatically detects project state
25
+ - ✅ **Automatic Decisions** - Intelligently resolves all conflicts
26
+ - ✅ **Mandatory Backup** - Always creates verified backups
27
+ - ✅ **Clear Feedback** - Shows exactly what happened
28
+ - ✅ **Easy Rollback** - Simple undo with one command
29
+
30
+ **Philosophy**: The system makes intelligent decisions automatically while maintaining complete safety through mandatory backups and clear communication.
31
+
32
+ ---
33
+
34
+ ## Quick Start
35
+
36
+ ### For New Users
37
+
38
+ Simply run:
39
+ ```bash
40
+ cd your-project
41
+ kse adopt
42
+ ```
43
+
44
+ That's it! The system will:
45
+ 1. Analyze your project
46
+ 2. Choose the best strategy
47
+ 3. Create a backup
48
+ 4. Apply changes
49
+ 5. Show you a summary
50
+
51
+ **Example Output**:
52
+ ```
53
+ 🔥 Kiro Spec Engine - Project Adoption
54
+
55
+ 📦 Analyzing project structure... ✅
56
+ 📋 Creating adoption plan... ✅
57
+
58
+ Adoption Plan:
59
+ Mode: Smart Update
60
+ Files to update: 5
61
+ Files to preserve: 8
62
+ Backup required: Yes
63
+
64
+ 🚀 Starting adoption...
65
+ 📦 Creating backup... ✅ backup-20260128-143022
66
+ ✓ Validating backup... ✅ 5 files verified
67
+ 📝 Updating files...
68
+ ✅ .kiro/steering/CORE_PRINCIPLES.md
69
+ ✅ .kiro/steering/ENVIRONMENT.md
70
+ ✅ .kiro/tools/ultrawork_enhancer.py
71
+ ⏭️ .kiro/specs/ (preserved)
72
+ ✅ Adoption completed successfully!
73
+
74
+ 📊 Summary:
75
+ Backup: backup-20260128-143022
76
+ Updated: 5 files
77
+ Preserved: 3 specs, 2 custom files
78
+
79
+ 💡 Your original files are safely backed up.
80
+ To restore: kse rollback backup-20260128-143022
81
+ ```
82
+
83
+ ### Preview Changes First
84
+
85
+ Want to see what would happen without making changes?
86
+ ```bash
87
+ kse adopt --dry-run
88
+ ```
89
+
90
+ ---
91
+
92
+ ## How It Works
93
+
94
+ ### Automatic Detection
95
+
96
+ The system automatically detects your project state:
97
+ - Checks for existing `.kiro/` directory
98
+ - Reads version information
99
+ - Identifies user content (specs, custom files)
100
+ - Detects potential conflicts
101
+
102
+ ### Smart Mode Selection
103
+
104
+ Based on detection, it chooses the optimal mode:
105
+
106
+ | Project State | Selected Mode | What Happens |
107
+ |--------------|---------------|--------------|
108
+ | No `.kiro/` | **Fresh** | Creates complete structure |
109
+ | `.kiro/` + same version | **Skip** | Already up-to-date |
110
+ | `.kiro/` + older version | **Smart Update** | Updates templates only |
111
+ | `.kiro/` + newer version | **Warning** | Version mismatch alert |
112
+ | `.kiro/` + no version | **Smart Adopt** | Full adoption with backup |
113
+
114
+ ### Automatic Conflict Resolution
115
+
116
+ The system automatically resolves file conflicts using smart rules:
117
+
118
+ | File Type | Resolution Strategy |
119
+ |-----------|-------------------|
120
+ | **Template files** (steering/, tools/) | Backup + Update to latest |
121
+ | **User content** (specs/, custom/) | Always preserve |
122
+ | **Config files** (version.json) | Backup + Update |
123
+ | **Special** (CURRENT_CONTEXT.md) | Always preserve |
124
+
125
+ ### Mandatory Backup
126
+
127
+ Before any modifications:
128
+ 1. Creates selective backup (only files that will change)
129
+ 2. Validates backup integrity
130
+ 3. Aborts if backup fails
131
+ 4. Provides rollback command
132
+
133
+ ---
134
+
135
+ ## Adoption Modes
136
+
137
+ ### 1. Fresh Adoption
138
+
139
+ **When**: No `.kiro/` directory exists
140
+
141
+ **Actions**:
142
+ - Creates complete `.kiro/` structure
143
+ - Copies all template files
144
+ - Creates `version.json`
145
+ - No conflicts, no backup needed
146
+
147
+ **Example**:
148
+ ```bash
149
+ $ kse adopt
150
+
151
+ Mode: Fresh
152
+ Actions:
153
+ - Create .kiro/ directory structure
154
+ - Copy template files
155
+ - Create version.json
156
+
157
+ ✅ Adoption completed successfully!
158
+ ```
159
+
160
+ ### 2. Skip Mode
161
+
162
+ **When**: Already at latest version
163
+
164
+ **Actions**:
165
+ - No changes made
166
+ - Displays current version info
167
+ - Suggests next steps
168
+
169
+ **Example**:
170
+ ```bash
171
+ $ kse adopt
172
+
173
+ ✅ Project already adopted with latest version (v1.9.0)
174
+ No changes needed.
175
+
176
+ 💡 Next steps:
177
+ - Create a spec: kse spec bootstrap --name 01-00-my-feature --non-interactive
178
+ - Check status: kse status
179
+ ```
180
+
181
+ ### 3. Smart Update
182
+
183
+ **When**: Existing `.kiro/` with older version
184
+
185
+ **Actions**:
186
+ - Backs up files that will change
187
+ - Updates template files to latest version
188
+ - Preserves all user content (specs, CURRENT_CONTEXT.md)
189
+ - Updates version.json
190
+
191
+ **Example**:
192
+ ```bash
193
+ $ kse adopt
194
+
195
+ Mode: Smart Update (v1.8.0 → v1.9.0)
196
+ Backup: backup-20260128-143022
197
+ Updated: 5 template files
198
+ Preserved: 3 specs, CURRENT_CONTEXT.md
199
+
200
+ ✅ Adoption completed successfully!
201
+ ```
202
+
203
+ ### 4. Smart Adopt
204
+
205
+ **When**: `.kiro/` exists but no version info
206
+
207
+ **Actions**:
208
+ - Backs up entire `.kiro/` directory
209
+ - Adopts with full structure
210
+ - Preserves user content
211
+ - Creates version.json
212
+
213
+ **Example**:
214
+ ```bash
215
+ $ kse adopt
216
+
217
+ Mode: Smart Adopt
218
+ Backup: backup-20260128-143022
219
+ Updated: 8 files
220
+ Preserved: 5 specs, 3 custom files
221
+
222
+ ✅ Adoption completed successfully!
223
+ ```
224
+
225
+ ### 5. Warning Mode
226
+
227
+ **When**: Local version is newer than KSE version
228
+
229
+ **Actions**:
230
+ - Displays warning message
231
+ - No changes made
232
+ - Suggests upgrading KSE
233
+
234
+ **Example**:
235
+ ```bash
236
+ $ kse adopt
237
+
238
+ ⚠️ Warning: Project version (v2.0.0) is newer than KSE version (v1.9.0)
239
+
240
+ Possible causes:
241
+ - You downgraded KSE
242
+ - Project was adopted with newer KSE version
243
+
244
+ Solutions:
245
+ 1. Upgrade KSE: npm install -g kiro-spec-engine@latest
246
+ 2. Force adopt: kse adopt --force (not recommended)
247
+
248
+ No changes made.
249
+ ```
250
+
251
+ ---
252
+
253
+ ## Command Options
254
+
255
+ ### Basic Options
256
+
257
+ ```bash
258
+ # Default: Smart, automatic, safe
259
+ kse adopt
260
+
261
+ # Preview changes without executing
262
+ kse adopt --dry-run
263
+
264
+ # Show detailed logs
265
+ kse adopt --verbose
266
+
267
+ # Force overwrite (with backup)
268
+ kse adopt --force
269
+ ```
270
+
271
+ ### Advanced Options
272
+
273
+ ```bash
274
+ # Skip backup (dangerous, not recommended)
275
+ kse adopt --no-backup
276
+
277
+ # Skip template updates
278
+ kse adopt --skip-update
279
+
280
+ # Enable interactive mode (legacy behavior)
281
+ kse adopt --interactive
282
+ ```
283
+
284
+ ### Option Details
285
+
286
+ | Option | Description | Safety |
287
+ |--------|-------------|--------|
288
+ | `--dry-run` | Preview without executing | ✅ Safe |
289
+ | `--verbose` | Show detailed logs | ✅ Safe |
290
+ | `--force` | Force overwrite with backup | ⚠️ Use with caution |
291
+ | `--no-backup` | Skip backup creation | ❌ Dangerous |
292
+ | `--skip-update` | Don't update templates | ⚠️ May cause inconsistency |
293
+ | `--interactive` | Enable legacy interactive mode | ✅ Safe |
294
+
295
+ ---
296
+
297
+ ## Common Scenarios
298
+
299
+ ### Scenario 1: First Time User
300
+
301
+ **Situation**: You just installed KSE and want to adopt your project.
302
+
303
+ **Solution**:
304
+ ```bash
305
+ cd your-project
306
+ kse adopt
307
+ ```
308
+
309
+ **What happens**: Fresh adoption creates complete structure, no questions asked.
310
+
311
+ ---
312
+
313
+ ### Scenario 2: Upgrading KSE Version
314
+
315
+ **Situation**: You upgraded KSE from v1.8.0 to v1.9.0.
316
+
317
+ **Solution**:
318
+ ```bash
319
+ kse adopt
320
+ ```
321
+
322
+ **What happens**: Smart Update backs up and updates template files, preserves your specs.
323
+
324
+ ---
325
+
326
+ ### Scenario 3: Want to Preview First
327
+
328
+ **Situation**: You want to see what would change before committing.
329
+
330
+ **Solution**:
331
+ ```bash
332
+ kse adopt --dry-run
333
+ ```
334
+
335
+ **What happens**: Shows detailed plan without making any changes.
336
+
337
+ ---
338
+
339
+ ### Scenario 4: Need Detailed Information
340
+
341
+ **Situation**: You want to see exactly what's happening.
342
+
343
+ **Solution**:
344
+ ```bash
345
+ kse adopt --verbose
346
+ ```
347
+
348
+ **What happens**: Shows detailed logs of every operation.
349
+
350
+ ---
351
+
352
+ ### Scenario 5: Undo Adoption
353
+
354
+ **Situation**: You want to revert the adoption.
355
+
356
+ **Solution**:
357
+ ```bash
358
+ kse rollback backup-20260128-143022
359
+ ```
360
+
361
+ **What happens**: Restores all files from backup.
362
+
363
+ ---
364
+
365
+ ### Scenario 6: Multiple Projects
366
+
367
+ **Situation**: You want to adopt multiple projects.
368
+
369
+ **Solution**:
370
+ ```bash
371
+ # Bash script
372
+ for dir in project1 project2 project3; do
373
+ cd $dir
374
+ kse adopt
375
+ cd ..
376
+ done
377
+ ```
378
+
379
+ **What happens**: Each project is adopted automatically without interaction.
380
+
381
+ ---
382
+
383
+ ## Troubleshooting
384
+
385
+ ### Problem: Backup Creation Failed
386
+
387
+ **Error**:
388
+ ```
389
+ ❌ Error: Backup Creation Failed
390
+
391
+ Problem: Unable to create backup of existing files
392
+
393
+ Possible causes:
394
+ - Insufficient disk space
395
+ - Permission denied for .kiro/backups/
396
+ - File system error
397
+ ```
398
+
399
+ **Solutions**:
400
+ 1. Free up disk space (need ~50MB)
401
+ 2. Check file permissions: `ls -la .kiro/`
402
+ 3. Try running with elevated permissions (if appropriate)
403
+
404
+ ---
405
+
406
+ ### Problem: Permission Denied
407
+
408
+ **Error**:
409
+ ```
410
+ ❌ Error: Permission Denied
411
+
412
+ Problem: Cannot write to .kiro/ directory
413
+ ```
414
+
415
+ **Solutions**:
416
+ ```bash
417
+ # Check permissions
418
+ ls -la .kiro/
419
+
420
+ # Fix permissions (Unix/Mac)
421
+ chmod -R u+w .kiro/
422
+
423
+ # Windows: Right-click .kiro/ → Properties → Security → Edit
424
+ ```
425
+
426
+ ---
427
+
428
+ ### Problem: Version Mismatch Warning
429
+
430
+ **Error**:
431
+ ```
432
+ ⚠️ Warning: Project version (v2.0.0) is newer than KSE version (v1.9.0)
433
+ ```
434
+
435
+ **Solutions**:
436
+ ```bash
437
+ # Upgrade KSE to latest
438
+ npm install -g kiro-spec-engine@latest
439
+
440
+ # Then adopt again
441
+ kse adopt
442
+ ```
443
+
444
+ ---
445
+
446
+ ### Problem: Want to Keep Old Behavior
447
+
448
+ **Situation**: You prefer the interactive mode.
449
+
450
+ **Solution**:
451
+ ```bash
452
+ kse adopt --interactive
453
+ ```
454
+
455
+ **What happens**: Enables legacy interactive mode with prompts.
456
+
457
+ ---
458
+
459
+ ## Migration from Interactive Mode
460
+
461
+ ### What Changed
462
+
463
+ **Old Behavior** (v1.8.0 and earlier):
464
+ - Asked multiple questions
465
+ - Required user decisions
466
+ - Manual conflict resolution
467
+ - Optional backup
468
+
469
+ **New Behavior** (v1.9.0+):
470
+ - Zero questions
471
+ - Automatic decisions
472
+ - Smart conflict resolution
473
+ - Mandatory backup
474
+
475
+ ### Comparison
476
+
477
+ | Aspect | Old (Interactive) | New (Smart) |
478
+ |--------|------------------|-------------|
479
+ | User Input | Multiple prompts | None |
480
+ | Conflict Resolution | Manual selection | Automatic |
481
+ | Backup | Optional | Mandatory |
482
+ | Speed | Slow (waits for input) | Fast (automatic) |
483
+ | Safety | Depends on user choices | Always safe |
484
+
485
+ ### Using Legacy Mode
486
+
487
+ If you prefer the old interactive behavior:
488
+ ```bash
489
+ kse adopt --interactive
490
+ ```
491
+
492
+ This enables:
493
+ - All the old prompts
494
+ - Manual conflict resolution
495
+ - Step-by-step confirmation
496
+
497
+ ### Recommended Approach
498
+
499
+ For most users, the new smart mode is recommended:
500
+ - Faster and easier
501
+ - Safer (mandatory backups)
502
+ - No learning curve
503
+ - Can always rollback
504
+
505
+ ---
506
+
507
+ ## Best Practices
508
+
509
+ ### 1. Preview First (Optional)
510
+
511
+ For peace of mind:
512
+ ```bash
513
+ kse adopt --dry-run
514
+ kse adopt
515
+ ```
516
+
517
+ ### 2. Commit Before Adoption
518
+
519
+ If using version control:
520
+ ```bash
521
+ git add -A
522
+ git commit -m "Before KSE adoption"
523
+ kse adopt
524
+ ```
525
+
526
+ ### 3. Verify After Adoption
527
+
528
+ Check everything is correct:
529
+ ```bash
530
+ kse status
531
+ kse version-info
532
+ ```
533
+
534
+ ### 4. Keep Backups
535
+
536
+ Don't delete automatic backups immediately:
537
+ ```bash
538
+ # Backups are in .kiro/backups/
539
+ ls .kiro/backups/
540
+ ```
541
+
542
+ ### 5. Use Verbose for Debugging
543
+
544
+ If something seems wrong:
545
+ ```bash
546
+ kse adopt --verbose
547
+ ```
548
+
549
+ ---
550
+
551
+ ## What Gets Created
552
+
553
+ After adoption, your project will have:
554
+
555
+ ```
556
+ your-project/
557
+ ├── .kiro/ # KSE core directory
558
+ │ ├── version.json # Version tracking
559
+ │ ├── specs/ # Spec storage
560
+ │ ├── steering/ # AI behavior rules
561
+ │ │ ├── CORE_PRINCIPLES.md
562
+ │ │ ├── ENVIRONMENT.md
563
+ │ │ ├── CURRENT_CONTEXT.md
564
+ │ │ └── RULES_GUIDE.md
565
+ │ ├── tools/ # Ultrawork tools
566
+ │ │ └── ultrawork_enhancer.py
567
+ │ ├── backups/ # Automatic backups
568
+ │ │ └── adopt-{timestamp}/
569
+ │ └── README.md
570
+ └── (your existing files) # All preserved
571
+ ```
572
+
573
+ ---
574
+
575
+ ## Next Steps
576
+
577
+ After successful adoption:
578
+
579
+ 1. **Verify .gitignore configuration**:
580
+ The adoption process automatically checks and fixes your `.gitignore` for team collaboration. If you see a warning about .gitignore, you can manually fix it:
581
+ ```bash
582
+ kse doctor --fix-gitignore
583
+ ```
584
+ Learn more: [Team Collaboration Guide](./team-collaboration-guide.md)
585
+
586
+ 2. **Create your first spec**:
587
+ ```bash
588
+ kse spec bootstrap --name 01-00-my-feature --non-interactive
589
+ ```
590
+
591
+ 3. **Check project status**:
592
+ ```bash
593
+ kse status
594
+ ```
595
+
596
+ 4. **Read the spec workflow guide**:
597
+ - See `.kiro/specs/SPEC_WORKFLOW_GUIDE.md`
598
+
599
+ 5. **Explore Ultrawork**:
600
+ ```bash
601
+ kse enhance requirements .kiro/specs/01-00-my-feature/requirements.md
602
+ ```
603
+
604
+ ---
605
+
606
+ ## Getting Help
607
+
608
+ - **Documentation**: Check README.md in your `.kiro/` directory
609
+ - **System Check**: `kse doctor`
610
+ - **Version Info**: `kse version-info`
611
+ - **Issues**: https://github.com/heguangyong/scene-capability-engine/issues
612
+
613
+ ---
614
+
615
+ **Happy adopting! 🔥**
616
+