scene-capability-engine 3.6.32 → 3.6.37

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 (111) hide show
  1. package/CHANGELOG.md +109 -11
  2. package/README.md +119 -122
  3. package/README.zh.md +123 -121
  4. package/bin/scene-capability-engine.js +12 -1
  5. package/docs/331-poc-adaptation-roadmap.md +3 -3
  6. package/docs/README.md +21 -32
  7. package/docs/auto-refactor-index.md +384 -0
  8. package/docs/command-reference.md +99 -7
  9. package/docs/faq.md +1 -1
  10. package/docs/interactive-customization/331-poc-sce-integration-checklist.md +3 -3
  11. package/docs/interactive-customization/moqui-interactive-template-playbook.md +4 -4
  12. package/docs/interactive-customization/phase-acceptance-evidence.md +2 -2
  13. package/docs/magicball-adaptation-task-checklist-v1.md +385 -0
  14. package/docs/magicball-app-bundle-sqlite-and-command-draft.md +539 -0
  15. package/docs/magicball-capability-iteration-api.md +2 -0
  16. package/docs/magicball-capability-iteration-ui.md +2 -0
  17. package/docs/magicball-capability-library.md +2 -0
  18. package/docs/magicball-cli-invocation-examples.md +336 -0
  19. package/docs/magicball-frontend-state-and-command-mapping.md +244 -0
  20. package/docs/magicball-integration-doc-index.md +137 -0
  21. package/docs/magicball-integration-issue-tracker.md +218 -0
  22. package/docs/magicball-mode-home-and-ontology-empty-state-playbook.md +249 -0
  23. package/docs/magicball-sce-adaptation-guide.md +203 -0
  24. package/docs/magicball-three-mode-alignment-plan.md +551 -0
  25. package/docs/magicball-ui-surface-checklist.md +126 -0
  26. package/docs/magicball-write-auth-adaptation-guide.md +328 -0
  27. package/docs/moqui-standard-rebuild-guide.md +6 -6
  28. package/docs/moqui-template-core-library-playbook.md +1 -1
  29. package/docs/refactor-completion-roadmap.md +116 -0
  30. package/docs/release-checklist.md +50 -27
  31. package/docs/releases/README.md +1 -0
  32. package/docs/releases/v3.6.37.md +22 -0
  33. package/docs/steering-strategy-guide.md +7 -7
  34. package/docs/troubleshooting.md +1 -1
  35. package/docs/zh/README.md +27 -30
  36. package/docs/zh/refactor-completion-roadmap.md +116 -0
  37. package/docs/zh/release-checklist.md +40 -17
  38. package/docs/zh/releases/README.md +1 -0
  39. package/docs/zh/releases/v3.6.37.md +22 -0
  40. package/lib/app/registry-config.js +73 -0
  41. package/lib/app/registry-sync-service.js +228 -0
  42. package/lib/auto/archive-schema-service.js +276 -0
  43. package/lib/auto/archive-summary.js +60 -0
  44. package/lib/auto/batch-goal-input-service.js +543 -0
  45. package/lib/auto/batch-output.js +201 -0
  46. package/lib/auto/batch-summary-storage-service.js +110 -0
  47. package/lib/auto/close-loop-batch-service.js +116 -0
  48. package/lib/auto/close-loop-controller-service.js +287 -0
  49. package/lib/auto/close-loop-program-service.js +283 -0
  50. package/lib/auto/close-loop-recovery-service.js +191 -0
  51. package/lib/auto/close-loop-session-storage-service.js +50 -0
  52. package/lib/auto/controller-lock-service.js +55 -0
  53. package/lib/auto/controller-output.js +32 -0
  54. package/lib/auto/controller-queue-service.js +127 -0
  55. package/lib/auto/controller-session-storage-service.js +105 -0
  56. package/lib/auto/governance-advisory-service.js +208 -0
  57. package/lib/auto/governance-close-loop-service.js +411 -0
  58. package/lib/auto/governance-maintenance-presenter.js +162 -0
  59. package/lib/auto/governance-maintenance-service.js +112 -0
  60. package/lib/auto/governance-session-presenter.js +70 -0
  61. package/lib/auto/governance-session-storage-service.js +198 -0
  62. package/lib/auto/governance-signals.js +139 -0
  63. package/lib/auto/governance-stats-presenter.js +337 -0
  64. package/lib/auto/governance-stats-service.js +115 -0
  65. package/lib/auto/governance-summary.js +703 -0
  66. package/lib/auto/handoff-capability-matrix-service.js +281 -0
  67. package/lib/auto/handoff-evidence-review-service.js +251 -0
  68. package/lib/auto/handoff-release-evidence-service.js +190 -0
  69. package/lib/auto/handoff-release-gate-history-loaders-service.js +502 -0
  70. package/lib/auto/handoff-release-gate-history-service.js +257 -0
  71. package/lib/auto/handoff-reporting-service.js +1407 -0
  72. package/lib/auto/handoff-run-service.js +486 -0
  73. package/lib/auto/handoff-snapshots-service.js +645 -0
  74. package/lib/auto/observability-service.js +132 -0
  75. package/lib/auto/output-writer.js +34 -0
  76. package/lib/auto/program-auto-remediation-service.js +130 -0
  77. package/lib/auto/program-diagnostics.js +138 -0
  78. package/lib/auto/program-governance-helpers.js +306 -0
  79. package/lib/auto/program-governance-loop-service.js +413 -0
  80. package/lib/auto/program-output.js +106 -0
  81. package/lib/auto/program-summary.js +183 -0
  82. package/lib/auto/recovery-memory-service.js +684 -0
  83. package/lib/auto/recovery-selection-service.js +52 -0
  84. package/lib/auto/retention-policy.js +98 -0
  85. package/lib/auto/session-persistence-service.js +106 -0
  86. package/lib/auto/session-presenter.js +105 -0
  87. package/lib/auto/session-prune-service.js +190 -0
  88. package/lib/auto/session-query-service.js +249 -0
  89. package/lib/auto/spec-protection.js +141 -0
  90. package/lib/commands/adopt.js +4 -4
  91. package/lib/commands/app.js +911 -0
  92. package/lib/commands/assurance.js +212 -0
  93. package/lib/commands/auto.js +1093 -11065
  94. package/lib/commands/mode.js +321 -0
  95. package/lib/commands/ontology.js +415 -0
  96. package/lib/commands/pm.js +422 -0
  97. package/lib/ontology/seed-profiles.js +160 -0
  98. package/lib/spec/bootstrap/context-collector.js +1 -1
  99. package/lib/state/sce-state-store.js +3369 -1200
  100. package/lib/steering/adoption-config.js +2 -2
  101. package/lib/steering/compliance-cache.js +2 -2
  102. package/lib/steering/steering-manager.js +4 -4
  103. package/lib/task/task-claimer.js +1 -2
  104. package/lib/workspace/multi/workspace-context-resolver.js +3 -3
  105. package/lib/workspace/multi/workspace-state-manager.js +0 -164
  106. package/lib/workspace/sce-tracking-audit.js +1 -1
  107. package/lib/workspace/takeover-baseline.js +1 -1
  108. package/package.json +1 -1
  109. package/template/.sce/README.md +1 -1
  110. package/template/.sce/steering/CORE_PRINCIPLES.md +1 -1
  111. package/bin/kse.js +0 -3
@@ -60,7 +60,7 @@ class AdoptionConfig {
60
60
  /**
61
61
  * 更新 steering 策略配置
62
62
  *
63
- * @param {string} strategy - 策略 ('use-kse' | 'use-project')
63
+ * @param {string} strategy - 策略 ('use-sce' | 'use-project')
64
64
  * @param {string|null} backupId - 备份 ID(如果有)
65
65
  * @returns {Promise<boolean>} 是否成功
66
66
  */
@@ -152,7 +152,7 @@ class AdoptionConfig {
152
152
  const config = {
153
153
  version: '1.0.0',
154
154
  adoptedAt: new Date().toISOString(),
155
- steeringStrategy: options.steeringStrategy || 'use-kse',
155
+ steeringStrategy: options.steeringStrategy || 'use-sce',
156
156
  multiUserMode: options.multiUserMode || false,
157
157
  ...options
158
158
  };
@@ -21,11 +21,11 @@ class ComplianceCache {
21
21
  /**
22
22
  * Get the default cache file path
23
23
  *
24
- * @returns {string} Path to ~/.kse/steering-check-cache.json
24
+ * @returns {string} Path to ~/.sce/steering-check-cache.json
25
25
  */
26
26
  getDefaultCachePath() {
27
27
  const homeDir = os.homedir();
28
- return path.join(homeDir, '.kse', 'steering-check-cache.json');
28
+ return path.join(homeDir, '.sce', 'steering-check-cache.json');
29
29
  }
30
30
 
31
31
  /**
@@ -65,12 +65,12 @@ class SteeringManager {
65
65
  * 提示用户选择 steering 策略
66
66
  *
67
67
  * @param {Object} detection - detectSteering 的返回结果
68
- * @returns {Promise<string>} 选择的策略 ('use-kse' | 'use-project')
68
+ * @returns {Promise<string>} 选择的策略 ('use-sce' | 'use-project')
69
69
  */
70
70
  async promptStrategy(detection) {
71
71
  if (!detection.hasExistingSteering) {
72
72
  // 没有现有 steering 文件,默认使用 sce
73
- return 'use-kse';
73
+ return 'use-sce';
74
74
  }
75
75
 
76
76
  console.log('\n⚠️ Steering Conflict Detected');
@@ -94,7 +94,7 @@ class SteeringManager {
94
94
  choices: [
95
95
  {
96
96
  name: 'Use sce steering (backup existing files) - Recommended for new sce users',
97
- value: 'use-kse'
97
+ value: 'use-sce'
98
98
  },
99
99
  {
100
100
  name: 'Keep existing steering (skip sce steering) - For projects with custom steering rules',
@@ -167,7 +167,7 @@ class SteeringManager {
167
167
  * @param {string} projectPath - 项目根目录路径
168
168
  * @returns {Promise<Object>} 安装结果
169
169
  */
170
- async installKseSteering(projectPath) {
170
+ async installSceSteering(projectPath) {
171
171
  const steeringPath = path.join(projectPath, this.steeringDir);
172
172
  const templatePath = path.join(__dirname, '../../template/.sce/steering');
173
173
 
@@ -97,8 +97,7 @@ class TaskClaimer {
97
97
  return [];
98
98
  }
99
99
 
100
- // Accept both legacy and current section headers to keep existing specs readable.
101
- const markerHeaderRegex = /^\s*##\s+(?:(?:sce|kse)\s+)?Status\s+Markers\s*$/i;
100
+ const markerHeaderRegex = /^\s*##\s+(?:sce\s+)?Status\s+Markers\s*$/i;
102
101
  const sectionHeaderRegex = /^\s*##\s+/;
103
102
 
104
103
  const markerLine = lines.findIndex((line) => markerHeaderRegex.test(String(line || '')));
@@ -92,7 +92,7 @@ class WorkspaceContextResolver {
92
92
  * @param {string} dirPath - Directory path to check
93
93
  * @returns {Promise<boolean>} True if directory contains .sce/ structure
94
94
  */
95
- async isValidKseDirectory(dirPath) {
95
+ async isValidSceDirectory(dirPath) {
96
96
  try {
97
97
  const kiroPath = path.join(dirPath, '.sce');
98
98
  const exists = await fs.pathExists(kiroPath);
@@ -184,7 +184,7 @@ class WorkspaceContextResolver {
184
184
  const targetDir = currentDir || process.cwd();
185
185
 
186
186
  // Check if it's a valid sce directory
187
- const isValid = await this.isValidKseDirectory(targetDir);
187
+ const isValid = await this.isValidSceDirectory(targetDir);
188
188
  if (!isValid) {
189
189
  return false;
190
190
  }
@@ -210,7 +210,7 @@ class WorkspaceContextResolver {
210
210
 
211
211
  if (!workspace) {
212
212
  const targetDir = currentDir || process.cwd();
213
- const isValid = await this.isValidKseDirectory(targetDir);
213
+ const isValid = await this.isValidSceDirectory(targetDir);
214
214
 
215
215
  if (isValid) {
216
216
  throw new Error(
@@ -48,62 +48,20 @@ class WorkspaceStateManager {
48
48
  return path.join(homeDir, '.sce', 'workspace-state.json');
49
49
  }
50
50
 
51
- /**
52
- * Get the legacy state file path used by prior versions
53
- *
54
- * @returns {string} Path to ~/.kse/workspace-state.json
55
- */
56
- getLegacyStatePath() {
57
- const homeDir = os.homedir();
58
- return path.join(homeDir, '.kse', 'workspace-state.json');
59
- }
60
-
61
- /**
62
- * Whether state manager is operating on the default state path.
63
- *
64
- * Automatic legacy migration should only run in this mode.
65
- *
66
- * @returns {boolean}
67
- */
68
- isDefaultStatePath() {
69
- return path.resolve(this.statePath) === path.resolve(this.getDefaultStatePath());
70
- }
71
-
72
51
  /**
73
52
  * Load workspace state from disk
74
53
  *
75
- * Supports automatic migration from legacy format (workspaces.json + config.json)
76
- *
77
54
  * @returns {Promise<boolean>} True if loaded successfully
78
55
  */
79
56
  async load() {
80
57
  try {
81
- // Try loading new format
82
58
  const exists = await fs.pathExists(this.statePath);
83
-
84
59
  if (exists) {
85
60
  await this.loadNewFormat();
86
61
  this.loaded = true;
87
62
  return true;
88
63
  }
89
64
 
90
- // Migrate legacy single-file state from ~/.kse/workspace-state.json
91
- if (await this.hasLegacyStateFile()) {
92
- console.log('Migrating workspace state to new .sce directory...');
93
- await this.migrateFromLegacyStateFile();
94
- await this.loadNewFormat();
95
- this.loaded = true;
96
- return true;
97
- }
98
-
99
- // Check for legacy format and migrate
100
- if (await this.hasLegacyFiles()) {
101
- console.log('Migrating workspace configuration to new format...');
102
- await this.migrateFromLegacy();
103
- this.loaded = true;
104
- return true;
105
- }
106
-
107
65
  // Initialize empty state
108
66
  this.state = {
109
67
  version: '1.0',
@@ -160,128 +118,6 @@ class WorkspaceStateManager {
160
118
  };
161
119
  }
162
120
 
163
- /**
164
- * Check if legacy configuration files exist
165
- *
166
- * @private
167
- * @returns {Promise<boolean>}
168
- */
169
- async hasLegacyFiles() {
170
- if (!this.isDefaultStatePath()) {
171
- return false;
172
- }
173
-
174
- const homeDir = os.homedir();
175
- const legacyWorkspacesPath = path.join(homeDir, '.kse', 'workspaces.json');
176
- const legacyConfigPath = path.join(homeDir, '.kse', 'config.json');
177
-
178
- const workspacesExists = await fs.pathExists(legacyWorkspacesPath);
179
- const configExists = await fs.pathExists(legacyConfigPath);
180
-
181
- return workspacesExists || configExists;
182
- }
183
-
184
- /**
185
- * Check whether legacy single-file state exists
186
- *
187
- * @private
188
- * @returns {Promise<boolean>}
189
- */
190
- async hasLegacyStateFile() {
191
- if (!this.isDefaultStatePath()) {
192
- return false;
193
- }
194
-
195
- const legacyStatePath = this.getLegacyStatePath();
196
- return fs.pathExists(legacyStatePath);
197
- }
198
-
199
- /**
200
- * Copy legacy single-file state into the new default location.
201
- *
202
- * @private
203
- * @returns {Promise<void>}
204
- */
205
- async migrateFromLegacyStateFile() {
206
- const legacyStatePath = this.getLegacyStatePath();
207
- const stateDir = path.dirname(this.statePath);
208
- await fs.ensureDir(stateDir);
209
- await fs.copy(legacyStatePath, this.statePath);
210
- }
211
-
212
- /**
213
- * Migrate from legacy format (workspaces.json + config.json)
214
- *
215
- * @private
216
- */
217
- async migrateFromLegacy() {
218
- const homeDir = os.homedir();
219
- const legacyWorkspacesPath = path.join(homeDir, '.kse', 'workspaces.json');
220
- const legacyConfigPath = path.join(homeDir, '.kse', 'config.json');
221
-
222
- // Load legacy workspaces
223
- let legacyWorkspaces = [];
224
- if (await fs.pathExists(legacyWorkspacesPath)) {
225
- const content = await fs.readFile(legacyWorkspacesPath, 'utf8');
226
- const data = JSON.parse(content);
227
- legacyWorkspaces = data.workspaces || [];
228
- }
229
-
230
- // Load legacy config
231
- let legacyActiveWorkspace = null;
232
- let legacyPreferences = {};
233
- if (await fs.pathExists(legacyConfigPath)) {
234
- const content = await fs.readFile(legacyConfigPath, 'utf8');
235
- const data = JSON.parse(content);
236
- legacyActiveWorkspace = data.active_workspace || null;
237
- legacyPreferences = data.preferences || {};
238
- }
239
-
240
- // Merge into new format
241
- this.state.activeWorkspace = legacyActiveWorkspace;
242
- this.state.workspaces = new Map();
243
-
244
- for (const workspaceData of legacyWorkspaces) {
245
- const workspace = Workspace.fromDict(workspaceData);
246
- this.state.workspaces.set(workspace.name, workspace);
247
- }
248
-
249
- this.state.preferences = {
250
- autoDetectWorkspace: legacyPreferences.auto_detect_workspace ?? true,
251
- confirmDestructiveOperations: legacyPreferences.confirm_destructive_operations ?? true
252
- };
253
-
254
- // Save to new format
255
- await this.save();
256
-
257
- // Backup legacy files
258
- await this.backupLegacyFiles();
259
- }
260
-
261
- /**
262
- * Backup legacy configuration files
263
- *
264
- * @private
265
- */
266
- async backupLegacyFiles() {
267
- const homeDir = os.homedir();
268
- const legacyWorkspacesPath = path.join(homeDir, '.kse', 'workspaces.json');
269
- const legacyConfigPath = path.join(homeDir, '.kse', 'config.json');
270
- const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
271
-
272
- if (await fs.pathExists(legacyWorkspacesPath)) {
273
- const backupPath = path.join(homeDir, '.kse', `workspaces.json.backup-${timestamp}`);
274
- await fs.copy(legacyWorkspacesPath, backupPath);
275
- await fs.remove(legacyWorkspacesPath);
276
- }
277
-
278
- if (await fs.pathExists(legacyConfigPath)) {
279
- const backupPath = path.join(homeDir, '.kse', `config.json.backup-${timestamp}`);
280
- await fs.copy(legacyConfigPath, backupPath);
281
- await fs.remove(legacyConfigPath);
282
- }
283
- }
284
-
285
121
  /**
286
122
  * Save workspace state to disk (atomic operation)
287
123
  *
@@ -4,7 +4,7 @@ const FIXTURE_ROOT = 'tests/fixtures/moqui-core-regression/workspace/.sce';
4
4
  const REQUIRED_TRACKED_FILES = [
5
5
  `${FIXTURE_ROOT}/specs/60-10-moqui-core-order-query/custom/scene-package.json`,
6
6
  `${FIXTURE_ROOT}/specs/60-10-moqui-core-order-query/custom/scene.yaml`,
7
- `${FIXTURE_ROOT}/templates/scene-packages/kse.scene--erp-order-query-read--0.1.0/scene-package.json`,
7
+ `${FIXTURE_ROOT}/templates/scene-packages/sce.scene--erp-order-query-read--0.1.0/scene-package.json`,
8
8
  ];
9
9
  const DISALLOWED_TRACKED_PREFIXES = [
10
10
  `${FIXTURE_ROOT}/reports/`,
@@ -303,7 +303,7 @@ function _buildAdoptionConfig(existing, nowIso, sceVersion) {
303
303
  adoptedAt,
304
304
  steeringStrategy: typeof base.steeringStrategy === 'string' && base.steeringStrategy.trim()
305
305
  ? base.steeringStrategy
306
- : 'use-kse',
306
+ : 'use-sce',
307
307
  multiUserMode: base.multiUserMode === true,
308
308
  runtimePolicy: {
309
309
  agent_parity_permissions: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scene-capability-engine",
3
- "version": "3.6.32",
3
+ "version": "3.6.37",
4
4
  "description": "SCE (Scene Capability Engine) - A CLI tool and npm package for spec-driven development with AI coding assistants.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -45,7 +45,7 @@ This project uses **Spec-driven development** - a structured approach where:
45
45
 
46
46
  ### Workspace Management
47
47
  - `sce workspace create/list/switch/info/remove` — Manage multiple sce projects
48
- - Global state: `~/.kse/workspace-state.json`
48
+ - Global state: `~/.sce/workspace-state.json`
49
49
 
50
50
  ### Environment Configuration
51
51
  - `sce env list/switch/info/register/unregister/rollback/verify/run` — Multi-environment management
@@ -16,7 +16,7 @@
16
16
 
17
17
  ## ⚠️ 核心原则
18
18
 
19
- ### 0. KSE 项目接管声明 🎯
19
+ ### 0. SCE 项目接管声明 🎯
20
20
 
21
21
  **核心**: 项目已由 sce 接管,AI 拥有完全开发和管理权限
22
22
 
package/bin/kse.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require('./scene-capability-engine');