scene-capability-engine 3.3.4 → 3.3.10

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 (252) hide show
  1. package/CHANGELOG.md +151 -78
  2. package/README.md +6 -6
  3. package/README.zh.md +6 -6
  4. package/bin/scene-capability-engine.js +129 -7
  5. package/docs/331-poc-adaptation-roadmap.md +3 -3
  6. package/docs/331-poc-dual-track-integration-guide.md +8 -8
  7. package/docs/331-poc-weekly-delivery-checklist.md +6 -6
  8. package/docs/README.md +6 -0
  9. package/docs/adopt-migration-guide.md +13 -13
  10. package/docs/adoption-guide.md +28 -28
  11. package/docs/agent-hooks-analysis.md +10 -10
  12. package/docs/agent-runtime/agent-result-summary-contract.schema.json +50 -0
  13. package/docs/agent-runtime/agent-result-summary.sample.json +11 -0
  14. package/docs/agent-runtime/capability-mapping-report.sample.json +42 -0
  15. package/docs/agent-runtime/capability-mapping-report.schema.json +136 -0
  16. package/docs/agent-runtime/failure-taxonomy-baseline.json +99 -0
  17. package/docs/agent-runtime/multi-agent-coordination-policy-baseline.json +38 -0
  18. package/docs/agent-runtime/strategy-routing-policy-baseline.json +24 -0
  19. package/docs/agent-runtime/symbol-evidence.sample.json +34 -0
  20. package/docs/agent-runtime/symbol-evidence.schema.json +128 -0
  21. package/docs/architecture.md +13 -13
  22. package/docs/articles/ai-driven-development-philosophy-and-practice.en.md +3 -3
  23. package/docs/articles/ai-driven-development-philosophy-and-practice.md +3 -3
  24. package/docs/autonomous-control-guide.md +35 -35
  25. package/docs/command-reference.md +254 -151
  26. package/docs/cross-tool-guide.md +7 -7
  27. package/docs/developer-guide.md +8 -8
  28. package/docs/document-governance.md +15 -15
  29. package/docs/environment-management-guide.md +6 -6
  30. package/docs/examples/add-export-command/design.md +1 -1
  31. package/docs/faq.md +13 -13
  32. package/docs/handoff-profile-integration-guide.md +3 -3
  33. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.json +7 -7
  34. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.md +1 -1
  35. package/docs/integration-modes.md +12 -12
  36. package/docs/integration-philosophy.md +11 -11
  37. package/docs/interactive-customization/331-poc-sce-integration-checklist.md +24 -24
  38. package/docs/interactive-customization/README.md +43 -43
  39. package/docs/interactive-customization/business-mode-policy-baseline.json +33 -0
  40. package/docs/interactive-customization/dual-ui-mode-integration-guide.md +1 -1
  41. package/docs/interactive-customization/moqui-adapter-interface.md +2 -2
  42. package/docs/interactive-customization/moqui-copilot-integration-guide.md +1 -1
  43. package/docs/interactive-customization/moqui-interactive-template-playbook.md +4 -4
  44. package/docs/interactive-customization/phase-acceptance-evidence.md +2 -2
  45. package/docs/knowledge-management-guide.md +6 -6
  46. package/docs/manual-workflows-guide.md +4 -4
  47. package/docs/moqui-capability-matrix.md +3 -3
  48. package/docs/moqui-standard-rebuild-guide.md +8 -8
  49. package/docs/moqui-template-core-library-playbook.md +27 -27
  50. package/docs/multi-agent-coordination-guide.md +19 -19
  51. package/docs/multi-repo-management-guide.md +17 -17
  52. package/docs/quick-start-with-ai-tools.md +7 -7
  53. package/docs/quick-start.md +2 -2
  54. package/docs/release-checklist.md +4 -4
  55. package/docs/sce-business-mode-map.md +103 -0
  56. package/docs/sce-capability-matrix-e2e-example.md +94 -0
  57. package/docs/sce-capability-matrix-roadmap.md +48 -0
  58. package/docs/security-governance-default-baseline.md +12 -12
  59. package/docs/spec-collaboration-guide.md +3 -3
  60. package/docs/spec-locking-guide.md +2 -2
  61. package/docs/spec-workflow.md +3 -3
  62. package/docs/starter-kit/README.md +4 -4
  63. package/docs/starter-kit/handoff-manifest.starter.json +2 -2
  64. package/docs/starter-kit/release.workflow.sample.yml +1 -1
  65. package/docs/steering-strategy-guide.md +15 -15
  66. package/docs/team-collaboration-guide.md +69 -69
  67. package/docs/testing-strategy.md +2 -2
  68. package/docs/tools/claude-guide.md +14 -4
  69. package/docs/tools/cursor-guide.md +14 -14
  70. package/docs/tools/generic-guide.md +9 -9
  71. package/docs/tools/kiro-guide.md +4 -4
  72. package/docs/tools/vscode-guide.md +13 -13
  73. package/docs/tools/windsurf-guide.md +6 -6
  74. package/docs/troubleshooting.md +22 -22
  75. package/docs/upgrade-guide.md +8 -8
  76. package/docs/value-observability-guide.md +3 -3
  77. package/docs/zh/README.md +15 -0
  78. package/docs/zh/quick-start.md +15 -15
  79. package/docs/zh/release-checklist.md +3 -3
  80. package/docs/zh/tools/claude-guide.md +16 -6
  81. package/docs/zh/tools/cursor-guide.md +11 -11
  82. package/docs/zh/tools/generic-guide.md +13 -13
  83. package/docs/zh/tools/kiro-guide.md +2 -2
  84. package/docs/zh/tools/vscode-guide.md +11 -11
  85. package/docs/zh/tools/windsurf-guide.md +11 -11
  86. package/docs/zh/value-observability-guide.md +3 -3
  87. package/lib/adoption/adoption-logger.js +1 -1
  88. package/lib/adoption/adoption-strategy.js +28 -28
  89. package/lib/adoption/backup-manager.js +3 -3
  90. package/lib/adoption/conflict-resolver.js +2 -2
  91. package/lib/adoption/detection-engine.js +8 -8
  92. package/lib/adoption/error-formatter.js +4 -4
  93. package/lib/adoption/file-classifier.js +6 -6
  94. package/lib/adoption/progress-reporter.js +1 -1
  95. package/lib/adoption/smart-orchestrator.js +10 -10
  96. package/lib/adoption/strategy-selector.js +6 -6
  97. package/lib/adoption/summary-generator.js +1 -1
  98. package/lib/adoption/template-sync.js +8 -8
  99. package/lib/auto/autonomous-engine.js +7 -7
  100. package/lib/auto/checkpoint-manager.js +1 -1
  101. package/lib/auto/close-loop-runner.js +12 -12
  102. package/lib/auto/error-recovery-manager.js +1 -1
  103. package/lib/auto/goal-decomposer.js +1 -1
  104. package/lib/auto/moqui-recovery-sequence.js +2 -2
  105. package/lib/auto/progress-tracker.js +1 -1
  106. package/lib/auto/state-manager.js +1 -1
  107. package/lib/backup/backup-system.js +10 -10
  108. package/lib/backup/selective-backup.js +4 -4
  109. package/lib/collab/agent-registry.js +2 -2
  110. package/lib/collab/contract-manager.js +1 -1
  111. package/lib/collab/coordinator.js +2 -2
  112. package/lib/collab/dependency-manager.js +1 -1
  113. package/lib/collab/integration-manager.js +1 -1
  114. package/lib/collab/metadata-manager.js +1 -1
  115. package/lib/collab/multi-agent-config.js +2 -2
  116. package/lib/collab/spec-lifecycle-manager.js +2 -2
  117. package/lib/collab/visualizer.js +1 -1
  118. package/lib/commands/adopt.js +6 -6
  119. package/lib/commands/auto.js +56 -56
  120. package/lib/commands/collab.js +2 -2
  121. package/lib/commands/docs.js +3 -3
  122. package/lib/commands/doctor.js +1 -1
  123. package/lib/commands/knowledge.js +2 -2
  124. package/lib/commands/lock.js +1 -1
  125. package/lib/commands/ops.js +1 -1
  126. package/lib/commands/orchestrate.js +3 -3
  127. package/lib/commands/rollback.js +1 -1
  128. package/lib/commands/scene.js +135 -93
  129. package/lib/commands/session.js +139 -0
  130. package/lib/commands/spec-bootstrap.js +1 -1
  131. package/lib/commands/spec-gate.js +2 -2
  132. package/lib/commands/spec-pipeline.js +1 -1
  133. package/lib/commands/status.js +4 -4
  134. package/lib/commands/steering.js +119 -0
  135. package/lib/commands/value.js +1 -1
  136. package/lib/commands/watch.js +9 -9
  137. package/lib/commands/workspace-multi.js +1 -1
  138. package/lib/context/context-exporter.js +5 -7
  139. package/lib/context/prompt-generator.js +2 -2
  140. package/lib/environment/backup-system.js +1 -1
  141. package/lib/environment/environment-manager.js +2 -2
  142. package/lib/gitignore/gitignore-backup.js +3 -3
  143. package/lib/gitignore/gitignore-detector.js +13 -13
  144. package/lib/gitignore/gitignore-integration.js +3 -3
  145. package/lib/gitignore/gitignore-transformer.js +4 -4
  146. package/lib/gitignore/layered-rules-template.js +16 -16
  147. package/lib/governance/config-manager.js +1 -1
  148. package/lib/governance/doc-reference-checker.js +4 -4
  149. package/lib/governance/execution-logger.js +1 -1
  150. package/lib/governance/file-scanner.js +3 -3
  151. package/lib/interactive-customization/moqui-interactive-adapter.js +2 -2
  152. package/lib/knowledge/knowledge-manager.js +1 -1
  153. package/lib/lock/lock-manager.js +2 -2
  154. package/lib/lock/steering-file-lock.js +5 -5
  155. package/lib/lock/task-lock-manager.js +3 -3
  156. package/lib/operations/audit-logger.js +1 -1
  157. package/lib/operations/feedback-manager.js +1 -1
  158. package/lib/operations/operations-manager.js +3 -3
  159. package/lib/operations/permission-manager.js +2 -2
  160. package/lib/operations/template-loader.js +1 -1
  161. package/lib/orchestrator/agent-spawner.js +180 -2
  162. package/lib/orchestrator/bootstrap-prompt-builder.js +9 -6
  163. package/lib/orchestrator/orchestration-engine.js +346 -2
  164. package/lib/orchestrator/orchestrator-config.js +2 -2
  165. package/lib/repo/config-manager.js +3 -3
  166. package/lib/repo/handlers/init-handler.js +1 -1
  167. package/lib/repo/repo-manager.js +2 -2
  168. package/lib/runtime/business-mode-resolver.js +240 -0
  169. package/lib/runtime/session-store.js +207 -0
  170. package/lib/runtime/steering-contract.js +338 -0
  171. package/lib/scene-runtime/audit-emitter.js +1 -1
  172. package/lib/scene-runtime/binding-plugin-loader.js +3 -3
  173. package/lib/scene-runtime/eval-bridge.js +1 -1
  174. package/lib/scene-runtime/index.js +1 -1
  175. package/lib/scene-runtime/moqui-extractor.js +1 -1
  176. package/lib/scene-runtime/plan-compiler.js +1 -1
  177. package/lib/scene-runtime/policy-gate.js +1 -1
  178. package/lib/scene-runtime/runtime-executor.js +1 -1
  179. package/lib/scene-runtime/scene-loader.js +1 -1
  180. package/lib/spec/bootstrap/context-collector.js +1 -1
  181. package/lib/spec/pipeline/stage-adapters.js +3 -3
  182. package/lib/spec/pipeline/state-store.js +1 -1
  183. package/lib/spec-gate/policy/policy-loader.js +1 -1
  184. package/lib/spec-gate/rules/default-rules.js +6 -6
  185. package/lib/steering/adoption-config.js +1 -1
  186. package/lib/steering/compliance-error-reporter.js +3 -3
  187. package/lib/steering/context-sync-manager.js +2 -2
  188. package/lib/steering/index.js +1 -1
  189. package/lib/steering/spec-steering.js +2 -2
  190. package/lib/steering/steering-compliance-checker.js +1 -1
  191. package/lib/steering/steering-loader.js +4 -5
  192. package/lib/steering/steering-manager.js +4 -4
  193. package/lib/task/task-claimer.js +5 -5
  194. package/lib/task/task-status-store.js +2 -2
  195. package/lib/templates/content-generalizer.js +1 -1
  196. package/lib/templates/spec-reader.js +2 -2
  197. package/lib/templates/template-creator.js +1 -1
  198. package/lib/templates/template-exporter.js +3 -3
  199. package/lib/templates/template-manager.js +1 -1
  200. package/lib/upgrade/migration-engine.js +3 -3
  201. package/lib/upgrade/migrations/1.0.0-to-1.1.0.js +1 -1
  202. package/lib/utils/file-diff.js +6 -6
  203. package/lib/utils/tool-detector.js +10 -10
  204. package/lib/utils/validation.js +5 -5
  205. package/lib/value/metric-contract-loader.js +1 -1
  206. package/lib/version/version-manager.js +1 -1
  207. package/lib/watch/execution-logger.js +1 -1
  208. package/lib/watch/presets.js +8 -8
  209. package/lib/watch/watch-manager.js +2 -2
  210. package/lib/workspace/legacy-kiro-migrator.js +275 -0
  211. package/lib/workspace/multi/workspace-context-resolver.js +2 -2
  212. package/lib/workspace/multi/workspace-registry.js +2 -2
  213. package/lib/workspace/multi/workspace-state-manager.js +3 -3
  214. package/lib/workspace/workspace-manager.js +1 -1
  215. package/lib/workspace/workspace-sync.js +2 -2
  216. package/locales/en.json +4 -4
  217. package/locales/zh.json +4 -4
  218. package/package.json +12 -9
  219. package/template/{.kiro → .sce}/README.md +15 -15
  220. package/template/{.kiro → .sce}/hooks/check-spec-on-create.kiro.hook +2 -2
  221. package/template/{.kiro → .sce}/steering/CORE_PRINCIPLES.md +4 -4
  222. package/template/{.kiro → .sce}/steering/CURRENT_CONTEXT.md +1 -1
  223. package/template/{.kiro → .sce}/steering/ENVIRONMENT.md +3 -3
  224. package/template/{.kiro → .sce}/tools/backup_manager.py +3 -3
  225. package/template/{.kiro → .sce}/tools/configuration_manager.py +1 -1
  226. package/template/README.md +12 -12
  227. /package/template/{.kiro → .sce}/hooks/run-tests-on-save.kiro.hook +0 -0
  228. /package/template/{.kiro → .sce}/hooks/sync-tasks-on-edit.kiro.hook +0 -0
  229. /package/template/{.kiro → .sce}/specs/SPEC_WORKFLOW_GUIDE.md +0 -0
  230. /package/template/{.kiro → .sce}/steering/RULES_GUIDE.md +0 -0
  231. /package/template/{.kiro → .sce}/templates/operations/default/change-impact.md +0 -0
  232. /package/template/{.kiro → .sce}/templates/operations/default/deployment.md +0 -0
  233. /package/template/{.kiro → .sce}/templates/operations/default/feedback-response.md +0 -0
  234. /package/template/{.kiro → .sce}/templates/operations/default/migration-plan.md +0 -0
  235. /package/template/{.kiro → .sce}/templates/operations/default/monitoring.md +0 -0
  236. /package/template/{.kiro → .sce}/templates/operations/default/operations.md +0 -0
  237. /package/template/{.kiro → .sce}/templates/operations/default/rollback.md +0 -0
  238. /package/template/{.kiro → .sce}/templates/operations/default/tools.yaml +0 -0
  239. /package/template/{.kiro → .sce}/templates/operations/default/troubleshooting.md +0 -0
  240. /package/template/{.kiro → .sce}/tools/document_evaluator.py +0 -0
  241. /package/template/{.kiro → .sce}/tools/enhancement_logger.py +0 -0
  242. /package/template/{.kiro → .sce}/tools/error_handler.py +0 -0
  243. /package/template/{.kiro → .sce}/tools/improvement_identifier.py +0 -0
  244. /package/template/{.kiro → .sce}/tools/modification_applicator.py +0 -0
  245. /package/template/{.kiro → .sce}/tools/quality_gate_enforcer.py +0 -0
  246. /package/template/{.kiro → .sce}/tools/quality_scorer.py +0 -0
  247. /package/template/{.kiro → .sce}/tools/report_generator.py +0 -0
  248. /package/template/{.kiro → .sce}/tools/ultrawork_enhancer.py +0 -0
  249. /package/template/{.kiro → .sce}/tools/ultrawork_enhancer_refactored.py +0 -0
  250. /package/template/{.kiro → .sce}/tools/ultrawork_enhancer_v2.py +0 -0
  251. /package/template/{.kiro → .sce}/tools/ultrawork_enhancer_v3.py +0 -0
  252. /package/template/{.kiro → .sce}/tools/workflow_quality_gate.py +0 -0
package/README.md CHANGED
@@ -94,7 +94,7 @@ Install sce and use it to manage this project with Spec-driven development.
94
94
  **Your AI will:**
95
95
  1. Install sce globally (`npm install -g scene-capability-engine`)
96
96
  2. Adopt it in your project (`sce adopt`)
97
- 3. Read the methodology guide (`.kiro/README.md`)
97
+ 3. Read the methodology guide (`.sce/README.md`)
98
98
  4. Start working according to Spec-driven approach
99
99
 
100
100
  **That's it!** Your AI handles everything. No manual steps needed.
@@ -126,7 +126,7 @@ cd your-project
126
126
  sce adopt
127
127
  ```
128
128
 
129
- This creates a `.kiro/` directory with:
129
+ This creates a `.sce/` directory with:
130
130
  - `README.md` - Project development guide for AI
131
131
  - `specs/` - Where your Specs live
132
132
  - `steering/` - Development rules (optional)
@@ -136,7 +136,7 @@ This creates a `.kiro/` directory with:
136
136
  **In your AI tool (Cursor, Claude, Windsurf, etc.), say:**
137
137
 
138
138
  ```
139
- Please read .kiro/README.md to understand how this project works.
139
+ Please read .sce/README.md to understand how this project works.
140
140
  ```
141
141
 
142
142
  **Your AI will learn:**
@@ -393,7 +393,7 @@ Structure your work with Requirements → Design → Tasks workflow
393
393
  - **Retry Mechanism**: Configurable automatic retry for failed Specs
394
394
  - **Real-Time Monitoring**: Track per-Spec status and overall orchestration progress
395
395
  - **Graceful Termination**: Stop all sub-agents cleanly (SIGTERM → SIGKILL)
396
- - **Configurable**: Codex command, args, parallelism, timeout, retries via `.kiro/config/orchestrator.json`
396
+ - **Configurable**: Codex command, args, parallelism, timeout, retries via `.sce/config/orchestrator.json`
397
397
 
398
398
  **Quick Start**:
399
399
  ```bash
@@ -409,7 +409,7 @@ sce orchestrate stop
409
409
 
410
410
  Tip: `sce spec bootstrap|pipeline run|gate run --specs ...` now defaults to this orchestrate mode automatically.
411
411
 
412
- **Recommended Codex-Orchestrator config (`.kiro/config/orchestrator.json`)**:
412
+ **Recommended Codex-Orchestrator config (`.sce/config/orchestrator.json`)**:
413
413
  ```json
414
414
  {
415
415
  "agentBackend": "codex",
@@ -548,7 +548,7 @@ sce auto close-loop continue # Shorthand: continue latest interrupted clos
548
548
  sce auto continue # Shortcut command: continue latest interrupted close-loop session
549
549
  sce auto close-loop "<goal>" --dry-run --json # Preview decomposition plan only
550
550
  sce auto close-loop-program "<goal>" --program-govern-until-stable --program-govern-use-action 1 --json # Program-level recovery + governance with remediation action execution
551
- sce auto close-loop-controller .kiro/auto/program-queue.lines --wait-on-empty --dequeue-limit 2 --json # Queue-driven autonomous controller for broad-goal backlogs
551
+ sce auto close-loop-controller .sce/auto/program-queue.lines --wait-on-empty --dequeue-limit 2 --json # Queue-driven autonomous controller for broad-goal backlogs
552
552
  sce auto close-loop-controller --controller-resume latest --json # Resume autonomous controller from latest persisted checkpoint
553
553
  sce auto controller-session list --limit 50 --json # Inspect persisted close-loop-controller summary sessions
554
554
  sce auto controller-session prune --keep 20 --older-than-days 14 --dry-run --json # Prune old controller summaries by retention policy
package/README.zh.md CHANGED
@@ -92,7 +92,7 @@ sce value metrics snapshot --input ./kpi-input.json --json
92
92
  **你的 AI 会:**
93
93
  1. 全局安装 sce(`npm install -g scene-capability-engine`)
94
94
  2. 在项目中采用它(`sce adopt`)
95
- 3. 阅读方法论指南(`.kiro/README.md`)
95
+ 3. 阅读方法论指南(`.sce/README.md`)
96
96
  4. 按照 Spec 驱动方式开始工作
97
97
 
98
98
  **就这样!** 你的 AI 处理一切。不需要手动步骤。
@@ -124,7 +124,7 @@ cd your-project
124
124
  sce adopt
125
125
  ```
126
126
 
127
- 这会创建一个 `.kiro/` 目录,包含:
127
+ 这会创建一个 `.sce/` 目录,包含:
128
128
  - `README.md` - 给 AI 的项目开发指南
129
129
  - `specs/` - Spec 存放位置
130
130
  - `steering/` - 开发规则(可选)
@@ -134,7 +134,7 @@ sce adopt
134
134
  **在你的 AI 工具中(Cursor、Claude、Windsurf 等),说:**
135
135
 
136
136
  ```
137
- 请阅读 .kiro/README.md 了解项目的开发方法。
137
+ 请阅读 .sce/README.md 了解项目的开发方法。
138
138
  ```
139
139
 
140
140
  **你的 AI 会学到:**
@@ -348,7 +348,7 @@ sequenceDiagram
348
348
  - **重试机制**: 可配置的失败自动重试
349
349
  - **实时监控**: 跟踪每个 Spec 状态和整体编排进度
350
350
  - **优雅终止**: 干净停止所有子 Agent(SIGTERM → SIGKILL)
351
- - **可配置**: 通过 `.kiro/config/orchestrator.json` 配置 Codex 命令、参数、并行度、超时、重试次数
351
+ - **可配置**: 通过 `.sce/config/orchestrator.json` 配置 Codex 命令、参数、并行度、超时、重试次数
352
352
 
353
353
  **快速开始**:
354
354
  ```bash
@@ -362,7 +362,7 @@ sce orchestrate status
362
362
  sce orchestrate stop
363
363
  ```
364
364
 
365
- **推荐 Codex 编排配置(`.kiro/config/orchestrator.json`)**:
365
+ **推荐 Codex 编排配置(`.sce/config/orchestrator.json`)**:
366
366
  ```json
367
367
  {
368
368
  "agentBackend": "codex",
@@ -462,7 +462,7 @@ sce auto close-loop 继续 # 简写:续跑最近一个未完成 clos
462
462
  sce auto continue # 快捷命令:续跑最近一个未完成 close-loop 会话
463
463
  sce auto close-loop "<目标>" --dry-run --json # 仅预览拆分与依赖计划
464
464
  sce auto close-loop-program "<目标>" --program-govern-until-stable --program-govern-use-action 1 --json # 程序级自动恢复 + 治理循环(含 remediation action 执行)直到稳定
465
- sce auto close-loop-controller .kiro/auto/program-queue.lines --wait-on-empty --dequeue-limit 2 --json # 队列驱动自治控制器,持续处理广义目标积压
465
+ sce auto close-loop-controller .sce/auto/program-queue.lines --wait-on-empty --dequeue-limit 2 --json # 队列驱动自治控制器,持续处理广义目标积压
466
466
  sce auto close-loop-controller --controller-resume latest --json # 从最近一次 controller 检查点恢复自治推进
467
467
  sce auto controller-session list --limit 50 --json # 查看持久化 close-loop-controller 摘要会话
468
468
  sce auto controller-session prune --keep 20 --older-than-days 14 --dry-run --json # 按保留策略清理旧 controller 摘要
@@ -14,11 +14,17 @@ const rollbackCommand = require('../lib/commands/rollback');
14
14
  const watchCommands = require('../lib/commands/watch');
15
15
  const workflowsCommand = require('../lib/commands/workflows');
16
16
  const registerCollabCommands = require('../lib/commands/collab');
17
+ const { registerSessionCommands } = require('../lib/commands/session');
18
+ const { registerSteeringCommands } = require('../lib/commands/steering');
17
19
  const { registerSpecBootstrapCommand } = require('../lib/commands/spec-bootstrap');
18
20
  const { registerSpecPipelineCommand } = require('../lib/commands/spec-pipeline');
19
21
  const { registerSpecGateCommand } = require('../lib/commands/spec-gate');
20
22
  const { registerValueCommands } = require('../lib/commands/value');
21
23
  const VersionChecker = require('../lib/version/version-checker');
24
+ const {
25
+ findLegacyKiroDirectories,
26
+ migrateLegacyKiroDirectories,
27
+ } = require('../lib/workspace/legacy-kiro-migrator');
22
28
 
23
29
  const i18n = getI18n();
24
30
  const t = (key, params) => i18n.t(key, params);
@@ -111,6 +117,40 @@ function findCommandIndex(args) {
111
117
  return -1;
112
118
  }
113
119
 
120
+ /**
121
+ * Allowlist commands that can run before legacy workspace migration.
122
+ * These commands help users discover and execute the migration itself.
123
+ *
124
+ * @param {string[]} args
125
+ * @returns {boolean}
126
+ */
127
+ function isLegacyMigrationAllowlistedCommand(args) {
128
+ if (!Array.isArray(args) || args.length === 0) {
129
+ return false;
130
+ }
131
+
132
+ if (args.includes('-h') || args.includes('--help') || args.includes('-v') || args.includes('--version')) {
133
+ return true;
134
+ }
135
+
136
+ const commandIndex = findCommandIndex(args);
137
+ if (commandIndex < 0) {
138
+ return false;
139
+ }
140
+
141
+ const command = args[commandIndex];
142
+ if (command === 'help') {
143
+ return true;
144
+ }
145
+
146
+ if (command === 'workspace') {
147
+ const subcommand = args[commandIndex + 1];
148
+ return subcommand === 'legacy-scan' || subcommand === 'legacy-migrate';
149
+ }
150
+
151
+ return false;
152
+ }
153
+
114
154
  // 版本和基本信息
115
155
  program
116
156
  .name(t('cli.name'))
@@ -145,8 +185,8 @@ program
145
185
  projectName = answers.projectName;
146
186
  }
147
187
 
148
- // 检查是否已存在 .kiro 目录
149
- const kiroDir = path.join(process.cwd(), '.kiro');
188
+ // 检查是否已存在 .sce 目录
189
+ const kiroDir = path.join(process.cwd(), '.sce');
150
190
  if (fs.existsSync(kiroDir) && !options.force) {
151
191
  console.log(chalk.yellow(t('cli.commands.init.alreadyExists')));
152
192
  const { overwrite } = await inquirer.prompt([
@@ -195,7 +235,7 @@ program
195
235
  console.log(chalk.red('🔥') + ` Starting ${stage} stage Ultrawork enhancement...`);
196
236
 
197
237
  // 检查 Python 和工具是否可用
198
- const toolPath = path.join(process.cwd(), '.kiro/tools/ultrawork_enhancer.py');
238
+ const toolPath = path.join(process.cwd(), '.sce/tools/ultrawork_enhancer.py');
199
239
  if (!fs.existsSync(toolPath)) {
200
240
  console.error(chalk.red('❌ Ultrawork tool not found. Please run: sce init'));
201
241
  process.exit(1);
@@ -234,7 +274,7 @@ program
234
274
  .option('-t, --template <template-id>', 'Use a template from the library')
235
275
  .option('-f, --force', 'Overwrite existing spec directory')
236
276
  .action(async (specName, options) => {
237
- const specPath = path.join(process.cwd(), '.kiro/specs', specName);
277
+ const specPath = path.join(process.cwd(), '.sce/specs', specName);
238
278
 
239
279
  try {
240
280
  // Check if using template
@@ -582,6 +622,70 @@ workspaceCmd
582
622
  await workspaceCommand.infoWorkspace(name);
583
623
  });
584
624
 
625
+ workspaceCmd
626
+ .command('legacy-scan')
627
+ .description('Scan workspace tree for legacy .kiro directories')
628
+ .option('--max-depth <n>', 'Maximum recursive scan depth', parseInt)
629
+ .option('--json', 'Output in JSON format')
630
+ .action(async (options) => {
631
+ const workspaceRoot = process.cwd();
632
+ const candidates = await findLegacyKiroDirectories(workspaceRoot, {
633
+ maxDepth: Number.isInteger(options.maxDepth) ? options.maxDepth : undefined,
634
+ });
635
+
636
+ if (options.json) {
637
+ console.log(JSON.stringify({
638
+ root: workspaceRoot,
639
+ legacy_directories: candidates,
640
+ count: candidates.length,
641
+ }, null, 2));
642
+ return;
643
+ }
644
+
645
+ if (candidates.length === 0) {
646
+ console.log(chalk.green('✓ No legacy .kiro directories found.'));
647
+ return;
648
+ }
649
+ console.log(chalk.yellow(`Found ${candidates.length} legacy .kiro director${candidates.length > 1 ? 'ies' : 'y'}:`));
650
+ for (const dir of candidates) {
651
+ console.log(chalk.gray(` - ${dir}`));
652
+ }
653
+ });
654
+
655
+ workspaceCmd
656
+ .command('legacy-migrate')
657
+ .description('Migrate legacy .kiro directories to .sce')
658
+ .option('--dry-run', 'Preview migration actions without writing changes')
659
+ .option('--max-depth <n>', 'Maximum recursive scan depth', parseInt)
660
+ .option('--json', 'Output in JSON format')
661
+ .action(async (options) => {
662
+ const workspaceRoot = process.cwd();
663
+ const report = await migrateLegacyKiroDirectories(workspaceRoot, {
664
+ dryRun: options.dryRun === true,
665
+ maxDepth: Number.isInteger(options.maxDepth) ? options.maxDepth : undefined,
666
+ });
667
+
668
+ if (options.json) {
669
+ console.log(JSON.stringify(report, null, 2));
670
+ return;
671
+ }
672
+
673
+ if (report.scanned === 0) {
674
+ console.log(chalk.green('✓ No legacy .kiro directories found.'));
675
+ return;
676
+ }
677
+
678
+ const modeLabel = report.dryRun ? ' (dry-run)' : '';
679
+ console.log(chalk.green(`Legacy migration completed${modeLabel}.`));
680
+ console.log(chalk.gray(`Scanned: ${report.scanned}`));
681
+ console.log(chalk.gray(`Migrated: ${report.migrated}`));
682
+ console.log(chalk.gray(`Renamed: ${report.renamed}`));
683
+ console.log(chalk.gray(`Merged: ${report.merged}`));
684
+ console.log(chalk.gray(`Moved files: ${report.moved_files}`));
685
+ console.log(chalk.gray(`Deduped files: ${report.deduped_files}`));
686
+ console.log(chalk.gray(`Conflict files: ${report.conflict_files}`));
687
+ });
688
+
585
689
  // Environment configuration management commands
586
690
  const envCommand = require('../lib/commands/env');
587
691
 
@@ -639,6 +743,10 @@ repoCmd
639
743
  // Spec-level collaboration commands
640
744
  registerCollabCommands(program);
641
745
 
746
+ // Universal steering and runtime session commands
747
+ registerSteeringCommands(program);
748
+ registerSessionCommands(program);
749
+
642
750
  // Autonomous control commands
643
751
  const { registerAutoCommands } = require('../lib/commands/auto');
644
752
  registerAutoCommands(program);
@@ -753,8 +861,8 @@ templatesCmd
753
861
 
754
862
  // 更新项目配置的辅助函数
755
863
  async function updateProjectConfig(projectName) {
756
- const envPath = path.join(process.cwd(), '.kiro/steering/ENVIRONMENT.md');
757
- const contextPath = path.join(process.cwd(), '.kiro/steering/CURRENT_CONTEXT.md');
864
+ const envPath = path.join(process.cwd(), '.sce/steering/ENVIRONMENT.md');
865
+ const contextPath = path.join(process.cwd(), '.sce/steering/CURRENT_CONTEXT.md');
758
866
 
759
867
  // 更新 ENVIRONMENT.md
760
868
  if (fs.existsSync(envPath)) {
@@ -777,11 +885,25 @@ async function updateProjectConfig(projectName) {
777
885
  const normalizedArgs = normalizeSpecCommandArgs(process.argv.slice(2));
778
886
  process.argv = [process.argv[0], process.argv[1], ...normalizedArgs];
779
887
 
780
- // Check for bypass flags
888
+ // Parse startup flags and guardrails
781
889
  const args = process.argv.slice(2);
890
+ const isLegacyAllowlistedCommand = isLegacyMigrationAllowlistedCommand(args);
782
891
  const skipCheck = args.includes('--skip-steering-check') ||
783
892
  process.env.KSE_SKIP_STEERING_CHECK === '1';
784
893
  const forceCheck = args.includes('--force-steering-check');
894
+
895
+ if (!isLegacyAllowlistedCommand) {
896
+ const legacyDirs = await findLegacyKiroDirectories(process.cwd(), { maxDepth: 6 });
897
+ if (legacyDirs.length > 0) {
898
+ console.error(chalk.red(
899
+ `Legacy workspace migration required: found ${legacyDirs.length} .kiro director${legacyDirs.length > 1 ? 'ies' : 'y'}.`
900
+ ));
901
+ console.error(chalk.yellow('SCE blocks all non-migration commands until migration is completed.'));
902
+ console.error(chalk.gray('Review first: sce workspace legacy-migrate --dry-run'));
903
+ console.error(chalk.gray('Apply manually: sce workspace legacy-migrate'));
904
+ process.exit(2);
905
+ }
906
+ }
785
907
 
786
908
  // Run compliance check
787
909
  await runSteeringComplianceCheck({
@@ -15,7 +15,7 @@
15
15
  - 一条命令串行执行 `plan -> queue -> close-loop-batch -> observability`。
16
16
  - 支持 `--dry-run` 与失败自动中断。
17
17
  7. 新增 handoff 结果归档:
18
- - 默认输出 `.kiro/reports/handoff-runs/<session>.json`。
18
+ - 默认输出 `.sce/reports/handoff-runs/<session>.json`。
19
19
  - 汇总每个 spec 的执行状态与阻塞项。
20
20
  8. 新增 handoff 门禁策略:
21
21
  - `--min-spec-success-rate`
@@ -33,7 +33,7 @@
33
33
  - `sce auto handoff run --continue-from <session|latest|file>`。
34
34
  - 支持 `--continue-strategy auto|pending|failed-only`。
35
35
  13. 新增 release evidence 自动归并:
36
- - `handoff run` 结束后自动将批次结果合并到 `.kiro/reports/release-evidence/handoff-runs.json`。
36
+ - `handoff run` 结束后自动将批次结果合并到 `.sce/reports/release-evidence/handoff-runs.json`。
37
37
  - 按 `session_id` 去重更新,失败时写 warning 不阻塞主流程。
38
38
  14. 新增回归可视化报表增强:
39
39
  - `handoff regression` 输出增加 `risk_layers` 风险分层视图(low/medium/high/unknown)。
@@ -142,7 +142,7 @@
142
142
  - `release.yml` 的 Evaluate drift 步骤改为直接调用脚本,消除大段内联 heredoc,降低语法错误与维护成本。
143
143
  - 新增 `tests/unit/scripts/release-drift-evaluate.test.js` 覆盖 advisory/enforce/missing history/gate report 写回四类场景。
144
144
  2. handoff 质量指标接入 governance 默认评估闭环:
145
- - `sce auto governance stats` 默认聚合 `.kiro/reports/release-evidence/handoff-runs.json`,输出 `health.handoff_quality` 快照。
145
+ - `sce auto governance stats` 默认聚合 `.sce/reports/release-evidence/handoff-runs.json`,输出 `health.handoff_quality` 快照。
146
146
  - `risk/concerns/recommendations` 自动纳入 handoff 最新状态、gate、ontology、capability、preflight 阻断等信号。
147
147
  - `sce auto governance close-loop` 的阻断判断纳入 handoff 严重质量信号,统一通过 `stop_reason=release-gate-blocked` 回传处置语义。
148
148
  - `sce auto governance maintain` 在 handoff 质量阻断时新增 `release-gate-handoff-remediate` 建议动作。
@@ -7,7 +7,7 @@
7
7
  每一轮从 `E:\workspace\331-poc` 接收以下产物:
8
8
 
9
9
  1. 完成态 Spec(requirements/design/tasks + `custom/scene.yaml` + `custom/scene-package.json`)。
10
- 2. 模板导出目录:`.kiro/templates/exports/<template-name>/`。
10
+ 2. 模板导出目录:`.sce/templates/exports/<template-name>/`。
11
11
  3. 交接包:`docs/handoffs/handoff-manifest.json` + 证据文档。
12
12
 
13
13
  若输入不满足以上三类,sce 侧不进入接入批次。
@@ -56,9 +56,9 @@ npx sce doctor --docs
56
56
 
57
57
  ```bash
58
58
  npx sce scene package-validate --spec <spec-name> --spec-package custom/scene-package.json --strict --json
59
- npx sce scene ontology validate --package .kiro/specs/<spec-name>/custom --json
60
- npx sce scene ontology impact --package .kiro/specs/<spec-name>/custom --ref <ref> --max-depth 2 --json
61
- npx sce scene ontology path --package .kiro/specs/<spec-name>/custom --from <from-ref> --to <to-ref> --json
59
+ npx sce scene ontology validate --package .sce/specs/<spec-name>/custom --json
60
+ npx sce scene ontology impact --package .sce/specs/<spec-name>/custom --ref <ref> --max-depth 2 --json
61
+ npx sce scene ontology path --package .sce/specs/<spec-name>/custom --from <from-ref> --to <to-ref> --json
62
62
  ```
63
63
 
64
64
  ## 2.3 批次 3:模板层接入
@@ -66,10 +66,10 @@ npx sce scene ontology path --package .kiro/specs/<spec-name>/custom --from <fro
66
66
  对于 scene package 模板链路(如果本轮包含 scene-package 模板):
67
67
 
68
68
  ```bash
69
- npx sce scene package-publish --spec <spec-name> --out-dir .kiro/templates/scene-packages --json --force
70
- npx sce scene package-registry --template-dir .kiro/templates/scene-packages --strict --json
71
- npx sce scene package-gate-template --out .kiro/templates/scene-package-gate-policy.json --profile three-layer --force --json
72
- npx sce scene package-gate --registry .kiro/templates/scene-packages/registry.json --policy .kiro/templates/scene-package-gate-policy.json --strict --json
69
+ npx sce scene package-publish --spec <spec-name> --out-dir .sce/templates/scene-packages --json --force
70
+ npx sce scene package-registry --template-dir .sce/templates/scene-packages --strict --json
71
+ npx sce scene package-gate-template --out .sce/templates/scene-package-gate-policy.json --profile three-layer --force --json
72
+ npx sce scene package-gate --registry .sce/templates/scene-packages/registry.json --policy .sce/templates/scene-package-gate-policy.json --strict --json
73
73
  ```
74
74
 
75
75
  说明:Spec 模板(`templates create-from-spec` 导出)与 scene package 模板是两条链路,可并行维护,但推荐在同一交接批次一并校验。
@@ -11,7 +11,7 @@ Use this checklist before each integration batch.
11
11
  - `custom/scene.yaml`
12
12
  - `custom/scene-package.json`
13
13
  - Exported template folder:
14
- - `.kiro/templates/exports/<template-name>/`
14
+ - `.sce/templates/exports/<template-name>/`
15
15
  - Handoff package:
16
16
  - `docs/handoffs/handoff-manifest.json`
17
17
  - ontology validation evidence in the same batch window
@@ -42,21 +42,21 @@ npx sce auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.js
42
42
  npx sce auto handoff template-diff --manifest ../331-poc/docs/handoffs/handoff-manifest.json --json
43
43
  npx sce auto handoff regression --session-id latest --json
44
44
  npx sce auto handoff capability-matrix --manifest ../331-poc/docs/handoffs/handoff-manifest.json --fail-on-gap --json
45
- npx sce scene moqui-baseline --compare-with .kiro/reports/release-evidence/moqui-template-baseline-prev.json --fail-on-portfolio-fail --json
45
+ npx sce scene moqui-baseline --compare-with .sce/reports/release-evidence/moqui-template-baseline-prev.json --fail-on-portfolio-fail --json
46
46
  node scripts/moqui-lexicon-audit.js --manifest ../331-poc/docs/handoffs/handoff-manifest.json --fail-on-gap --json
47
47
  node scripts/moqui-release-summary.js --fail-on-gate-fail --json
48
48
  node scripts/release-ops-weekly-summary.js --json
49
49
  node scripts/release-weekly-ops-gate.js
50
- node scripts/release-risk-remediation-bundle.js --gate-report .kiro/reports/release-evidence/release-gate.json --json
50
+ node scripts/release-risk-remediation-bundle.js --gate-report .sce/reports/release-evidence/release-gate.json --json
51
51
  node scripts/release-asset-integrity-check.js
52
52
  ```
53
53
 
54
54
  ## Scene Package Gate Commands
55
55
 
56
56
  ```bash
57
- npx sce scene package-registry --template-dir .kiro/templates/scene-packages --strict --json
58
- npx sce scene package-gate-template --out .kiro/templates/scene-package-gate-policy.json --profile three-layer --force --json
59
- npx sce scene package-gate --registry .kiro/templates/scene-packages/registry.json --policy .kiro/templates/scene-package-gate-policy.json --strict --json
57
+ npx sce scene package-registry --template-dir .sce/templates/scene-packages --strict --json
58
+ npx sce scene package-gate-template --out .sce/templates/scene-package-gate-policy.json --profile three-layer --force --json
59
+ npx sce scene package-gate --registry .sce/templates/scene-packages/registry.json --policy .sce/templates/scene-package-gate-policy.json --strict --json
60
60
  ```
61
61
 
62
62
  ## Batch Exit Criteria
package/docs/README.md CHANGED
@@ -94,7 +94,10 @@ Detailed technical documentation:
94
94
  - **[Moqui Template Core Library Playbook](moqui-template-core-library-playbook.md)** - Default-gated intake flow for absorbing Moqui capabilities into sce templates
95
95
  - **[331-poc Dual-Track Integration Guide](331-poc-dual-track-integration-guide.md)** - Handoff contract and integration playbook between 331-poc and sce
96
96
  - **[331-poc Adaptation Roadmap](331-poc-adaptation-roadmap.md)** - Ongoing sce-side adaptation backlog and rollout phases
97
+ - **[SCE Capability Matrix Roadmap](sce-capability-matrix-roadmap.md)** - Strategy routing, symbol evidence, self-repair, ontology mapping, and multi-agent merge policy roadmap
98
+ - **[SCE Capability Matrix E2E Example](sce-capability-matrix-e2e-example.md)** - End-to-end example from strategy decision to summary-driven merge block/allow
97
99
  - **[Handoff Profile Integration Guide](handoff-profile-integration-guide.md)** - External project intake contract for `default|moqui|enterprise` handoff profiles
100
+ - **[SCE Business Mode Map](sce-business-mode-map.md)** - Default takeover model and `user/ops/dev` mode execution governance
98
101
  - **[Multi-Agent Coordination Guide](multi-agent-coordination-guide.md)** - Multi-agent parallel coordination for concurrent development
99
102
  - **[Troubleshooting](troubleshooting.md)** - Solutions to common problems
100
103
  - **[FAQ](faq.md)** - Answers to frequently asked questions
@@ -107,6 +110,8 @@ Detailed technical documentation:
107
110
  - **[Upgrade Guide](upgrade-guide.md)** - Upgrading sce to newer versions
108
111
  - **[Release Checklist](release-checklist.md)** - Repeatable pre-release verification flow
109
112
  - **[Security Governance Default Baseline](security-governance-default-baseline.md)** - Default safety, approval, and audit controls for SCE delivery
113
+ - **[SCE Business Mode Map](sce-business-mode-map.md)** - User-mode, ops-mode, and dev-mode capability map with default gate policy
114
+ - **[Business Mode Policy Baseline](interactive-customization/business-mode-policy-baseline.json)** - Executable mode preset contract for `user/ops/dev` routing
110
115
  - **[Release-Ready Starter Kit](starter-kit/README.md)** - Starter manifest + workflow sample for external project onboarding
111
116
  - **[Release Archive](releases/README.md)** - Index of release notes and validation reports
112
117
  - **[Release Notes v1.46.2](releases/v1.46.2.md)** - Summary of value observability and onboarding improvements
@@ -195,6 +200,7 @@ Detailed technical documentation:
195
200
  - [331-poc Dual-Track Integration Guide](331-poc-dual-track-integration-guide.md)
196
201
  - [331-poc Adaptation Roadmap](331-poc-adaptation-roadmap.md)
197
202
  - [Handoff Profile Integration Guide](handoff-profile-integration-guide.md)
203
+ - [SCE Business Mode Map](sce-business-mode-map.md)
198
204
  - [Release-Ready Starter Kit](starter-kit/README.md)
199
205
  - [Security Governance Default Baseline](security-governance-default-baseline.md)
200
206
  - [Scene Template Engine](command-reference.md#scene-template-engine)
@@ -29,16 +29,16 @@ $ sce adopt
29
29
  📦 Analyzing project structure...
30
30
 
31
31
  ⚠️ Conflicts detected:
32
- - .kiro/steering/CORE_PRINCIPLES.md
33
- - .kiro/steering/ENVIRONMENT.md
32
+ - .sce/steering/CORE_PRINCIPLES.md
33
+ - .sce/steering/ENVIRONMENT.md
34
34
 
35
35
  ? How to handle conflicts?
36
36
  > Skip all
37
37
  Overwrite all
38
38
  Review each
39
39
 
40
- ? Overwrite .kiro/steering/CORE_PRINCIPLES.md? (y/N)
41
- ? Overwrite .kiro/steering/ENVIRONMENT.md? (y/N)
40
+ ? Overwrite .sce/steering/CORE_PRINCIPLES.md? (y/N)
41
+ ? Overwrite .sce/steering/ENVIRONMENT.md? (y/N)
42
42
  ...
43
43
  ```
44
44
 
@@ -71,9 +71,9 @@ Adoption Plan:
71
71
  📦 Creating backup... ✅ backup-20260128-143022
72
72
  ✓ Validating backup... ✅ 5 files verified
73
73
  📝 Updating files...
74
- ✅ .kiro/steering/CORE_PRINCIPLES.md
75
- ✅ .kiro/steering/ENVIRONMENT.md
76
- ⏭️ .kiro/specs/ (preserved)
74
+ ✅ .sce/steering/CORE_PRINCIPLES.md
75
+ ✅ .sce/steering/ENVIRONMENT.md
76
+ ⏭️ .sce/specs/ (preserved)
77
77
  ✅ Adoption completed successfully!
78
78
 
79
79
  📊 Summary:
@@ -277,7 +277,7 @@ $ sce adopt --interactive
277
277
  📦 Analyzing project structure...
278
278
 
279
279
  ⚠️ Conflicts detected:
280
- - .kiro/steering/CORE_PRINCIPLES.md
280
+ - .sce/steering/CORE_PRINCIPLES.md
281
281
 
282
282
  ? How to handle conflicts?
283
283
  > Skip all
@@ -293,7 +293,7 @@ $ sce adopt --interactive
293
293
 
294
294
  ### Q: Will my existing projects still work?
295
295
 
296
- **A**: Yes! The new system is fully backward compatible. Your existing `.kiro/` directories will be detected and handled correctly.
296
+ **A**: Yes! The new system is fully backward compatible. Your existing `.sce/` directories will be detected and handled correctly.
297
297
 
298
298
  ---
299
299
 
@@ -357,8 +357,8 @@ This will:
357
357
  ### Q: What happens to my specs and custom files?
358
358
 
359
359
  **A**: They are **always preserved**. The smart system never overwrites:
360
- - `.kiro/specs/` directory
361
- - `.kiro/steering/CURRENT_CONTEXT.md`
360
+ - `.sce/specs/` directory
361
+ - `.sce/steering/CURRENT_CONTEXT.md`
362
362
  - Any custom files you created
363
363
 
364
364
  ---
@@ -528,7 +528,7 @@ sce adopt
528
528
  Don't delete automatic backups immediately:
529
529
  ```bash
530
530
  # Keep for at least a week
531
- ls .kiro/backups/
531
+ ls .sce/backups/
532
532
  ```
533
533
 
534
534
  ### 4. Verify Results
@@ -544,7 +544,7 @@ npm test # If you have tests
544
544
 
545
545
  If you customize files, document it:
546
546
  ```markdown
547
- # In .kiro/steering/CUSTOM_RULES.md
547
+ # In .sce/steering/CUSTOM_RULES.md
548
548
  ## Customizations
549
549
  - Modified CORE_PRINCIPLES.md on 2026-01-28
550
550
  - Reason: Project-specific requirements