scene-capability-engine 3.3.10 → 3.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.3.12] - 2026-02-25
11
+
12
+ ### Changed
13
+ - Strengthened steering baseline for root-cause defect handling:
14
+ - Added explicit rule: bug fixing must prioritize root-cause remediation, not workaround-style bypass.
15
+ - Added explicit complex-issue debugging method: prefer debug logs and observability signals (inputs/outputs/branches/stack/context) to reconstruct execution path before conclusion.
16
+ - Standardized ontology analysis baseline in steering as a unified "four layers + one chain" model:
17
+ - Entity model
18
+ - Relation graph
19
+ - Business rule
20
+ - Decision logic
21
+ - Action/lineage execution chain
22
+ - Synced the same steering enhancements to both runtime project steering and template steering:
23
+ - `.sce/steering/CORE_PRINCIPLES.md`
24
+ - `template/.sce/steering/CORE_PRINCIPLES.md`
25
+
26
+ ## [3.3.11] - 2026-02-24
27
+
28
+ ### Added
29
+ - Workspace tracking audit for deterministic `.sce` fixture governance:
30
+ - New command: `sce workspace tracking-audit` (`--json`, `--no-strict`)
31
+ - New CI script: `node scripts/check-sce-tracking.js`
32
+ - New npm alias: `npm run test:sce-tracking`
33
+ - New audit helper: `lib/workspace/sce-tracking-audit.js`
34
+ - New unit coverage: `tests/unit/workspace/sce-tracking-audit.test.js`
35
+
36
+ ### Changed
37
+ - `sce workspace legacy-migrate` now requires explicit `--confirm` for non-dry-run execution.
38
+ - `prepublishOnly` now includes `test:sce-tracking` to prevent missing tracked `.sce` fixture assets before publish.
39
+
40
+ ### Fixed
41
+ - Added integration coverage to ensure legacy migration remains a strictly manual two-step flow (`--dry-run` then `--confirm`).
42
+
10
43
  ## [3.3.10] - 2026-02-24
11
44
 
12
45
  ### Fixed
@@ -25,6 +25,7 @@ const {
25
25
  findLegacyKiroDirectories,
26
26
  migrateLegacyKiroDirectories,
27
27
  } = require('../lib/workspace/legacy-kiro-migrator');
28
+ const { auditSceTracking } = require('../lib/workspace/sce-tracking-audit');
28
29
 
29
30
  const i18n = getI18n();
30
31
  const t = (key, params) => i18n.t(key, params);
@@ -656,9 +657,28 @@ workspaceCmd
656
657
  .command('legacy-migrate')
657
658
  .description('Migrate legacy .kiro directories to .sce')
658
659
  .option('--dry-run', 'Preview migration actions without writing changes')
660
+ .option('--confirm', 'Confirm manual migration execution (required for non-dry-run migration)')
659
661
  .option('--max-depth <n>', 'Maximum recursive scan depth', parseInt)
660
662
  .option('--json', 'Output in JSON format')
661
663
  .action(async (options) => {
664
+ if (!options.dryRun && options.confirm !== true) {
665
+ const message = 'Manual confirmation required: rerun with --confirm (or use --dry-run first).';
666
+ if (options.json) {
667
+ console.log(JSON.stringify({
668
+ success: false,
669
+ mode: 'workspace-legacy-migrate',
670
+ error: message,
671
+ hint: 'sce workspace legacy-migrate --dry-run --json'
672
+ }, null, 2));
673
+ } else {
674
+ console.error(chalk.red(message));
675
+ console.error(chalk.gray('Preview first: sce workspace legacy-migrate --dry-run'));
676
+ console.error(chalk.gray('Apply manually: sce workspace legacy-migrate --confirm'));
677
+ }
678
+ process.exitCode = 2;
679
+ return;
680
+ }
681
+
662
682
  const workspaceRoot = process.cwd();
663
683
  const report = await migrateLegacyKiroDirectories(workspaceRoot, {
664
684
  dryRun: options.dryRun === true,
@@ -686,6 +706,41 @@ workspaceCmd
686
706
  console.log(chalk.gray(`Conflict files: ${report.conflict_files}`));
687
707
  });
688
708
 
709
+ workspaceCmd
710
+ .command('tracking-audit')
711
+ .description('Audit tracked .sce assets required for deterministic CI/release behavior')
712
+ .option('--json', 'Output in JSON format')
713
+ .option('--no-strict', 'Do not fail process when audit reports violations')
714
+ .action(async (options) => {
715
+ const report = auditSceTracking(process.cwd());
716
+
717
+ if (options.json) {
718
+ console.log(JSON.stringify(report, null, 2));
719
+ } else if (report.passed) {
720
+ console.log(chalk.green('✓ SCE tracking audit passed.'));
721
+ console.log(chalk.gray(`Fixture tracked specs: ${report.summary.fixture_spec_files}`));
722
+ console.log(chalk.gray(`Fixture tracked templates: ${report.summary.fixture_template_files}`));
723
+ } else {
724
+ console.log(chalk.red('✖ SCE tracking audit failed.'));
725
+ if (report.missing_required_files.length > 0) {
726
+ console.log(chalk.yellow('Missing required tracked files:'));
727
+ for (const filePath of report.missing_required_files) {
728
+ console.log(chalk.gray(` - ${filePath}`));
729
+ }
730
+ }
731
+ if (report.fixture.disallowed_tracked_files.length > 0) {
732
+ console.log(chalk.yellow('Disallowed tracked fixture runtime files:'));
733
+ for (const filePath of report.fixture.disallowed_tracked_files) {
734
+ console.log(chalk.gray(` - ${filePath}`));
735
+ }
736
+ }
737
+ }
738
+
739
+ if (!report.passed && options.strict !== false) {
740
+ process.exitCode = 1;
741
+ }
742
+ });
743
+
689
744
  // Environment configuration management commands
690
745
  const envCommand = require('../lib/commands/env');
691
746
 
@@ -900,7 +955,7 @@ async function updateProjectConfig(projectName) {
900
955
  ));
901
956
  console.error(chalk.yellow('SCE blocks all non-migration commands until migration is completed.'));
902
957
  console.error(chalk.gray('Review first: sce workspace legacy-migrate --dry-run'));
903
- console.error(chalk.gray('Apply manually: sce workspace legacy-migrate'));
958
+ console.error(chalk.gray('Apply manually: sce workspace legacy-migrate --confirm'));
904
959
  process.exit(2);
905
960
  }
906
961
  }
@@ -225,11 +225,16 @@ sce workspace legacy-scan
225
225
  sce workspace legacy-scan --max-depth 8 --json
226
226
 
227
227
  # Migrate legacy .kiro directories to .sce (safe merge when .sce already exists)
228
- sce workspace legacy-migrate
228
+ # Non-dry-run migration now requires explicit manual confirmation.
229
+ sce workspace legacy-migrate --confirm
229
230
  sce workspace legacy-migrate --dry-run --json
230
231
  # Recommended: always run dry-run first, then execute manual migration
231
232
  # sce workspace legacy-migrate --dry-run
232
- # sce workspace legacy-migrate
233
+ # sce workspace legacy-migrate --confirm
234
+
235
+ # Audit tracked .sce assets required for deterministic CI/release behavior
236
+ sce workspace tracking-audit
237
+ sce workspace tracking-audit --json
233
238
 
234
239
  # Safety guardrail (default):
235
240
  # If legacy .kiro directories exist, sce blocks non-migration commands
@@ -0,0 +1,74 @@
1
+ const { execSync } = require('child_process');
2
+
3
+ const FIXTURE_ROOT = 'tests/fixtures/moqui-core-regression/workspace/.sce';
4
+ const REQUIRED_TRACKED_FILES = [
5
+ `${FIXTURE_ROOT}/specs/60-10-moqui-core-order-query/custom/scene-package.json`,
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`,
8
+ ];
9
+ const DISALLOWED_TRACKED_PREFIXES = [
10
+ `${FIXTURE_ROOT}/reports/`,
11
+ `${FIXTURE_ROOT}/auto/`,
12
+ ];
13
+
14
+ function defaultGetTrackedFiles(repoRoot) {
15
+ const output = execSync('git ls-files', {
16
+ cwd: repoRoot,
17
+ encoding: 'utf8'
18
+ });
19
+ return output
20
+ .split(/\r?\n/)
21
+ .map((line) => line.trim())
22
+ .filter(Boolean);
23
+ }
24
+
25
+ function auditSceTracking(repoRoot = process.cwd(), dependencies = {}) {
26
+ const getTrackedFiles = dependencies.getTrackedFiles || defaultGetTrackedFiles;
27
+ const trackedFiles = getTrackedFiles(repoRoot)
28
+ .map((filePath) => `${filePath}`.replace(/\\/g, '/'));
29
+ const trackedSet = new Set(trackedFiles);
30
+
31
+ const missingRequiredFiles = REQUIRED_TRACKED_FILES.filter((filePath) => !trackedSet.has(filePath));
32
+ const fixtureTrackedFiles = trackedFiles.filter((filePath) => filePath.startsWith(`${FIXTURE_ROOT}/`));
33
+ const fixtureSpecTrackedFiles = fixtureTrackedFiles.filter((filePath) => filePath.startsWith(`${FIXTURE_ROOT}/specs/`));
34
+ const fixtureTemplateTrackedFiles = fixtureTrackedFiles.filter((filePath) => filePath.startsWith(`${FIXTURE_ROOT}/templates/`));
35
+ const disallowedTrackedFiles = fixtureTrackedFiles.filter((filePath) =>
36
+ DISALLOWED_TRACKED_PREFIXES.some((prefix) => filePath.startsWith(prefix))
37
+ );
38
+
39
+ const summary = {
40
+ missing_required_files: missingRequiredFiles.length,
41
+ fixture_spec_files: fixtureSpecTrackedFiles.length,
42
+ fixture_template_files: fixtureTemplateTrackedFiles.length,
43
+ disallowed_fixture_files: disallowedTrackedFiles.length
44
+ };
45
+
46
+ const passed =
47
+ missingRequiredFiles.length === 0 &&
48
+ fixtureSpecTrackedFiles.length > 0 &&
49
+ fixtureTemplateTrackedFiles.length > 0 &&
50
+ disallowedTrackedFiles.length === 0;
51
+
52
+ return {
53
+ mode: 'sce-tracking-audit',
54
+ passed,
55
+ root: repoRoot,
56
+ required_files: REQUIRED_TRACKED_FILES,
57
+ missing_required_files: missingRequiredFiles,
58
+ fixture: {
59
+ root: FIXTURE_ROOT,
60
+ tracked_total: fixtureTrackedFiles.length,
61
+ tracked_specs: fixtureSpecTrackedFiles,
62
+ tracked_templates: fixtureTemplateTrackedFiles,
63
+ disallowed_tracked_files: disallowedTrackedFiles
64
+ },
65
+ summary
66
+ };
67
+ }
68
+
69
+ module.exports = {
70
+ FIXTURE_ROOT,
71
+ REQUIRED_TRACKED_FILES,
72
+ DISALLOWED_TRACKED_PREFIXES,
73
+ auditSceTracking
74
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scene-capability-engine",
3
- "version": "3.3.10",
3
+ "version": "3.3.12",
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": {
@@ -34,6 +34,7 @@
34
34
  "test:interactive-loop-smoke": "node scripts/interactive-loop-smoke.js --json",
35
35
  "test:interactive-flow-smoke": "node scripts/interactive-flow-smoke.js --json",
36
36
  "test:skip-audit": "node scripts/check-skip-allowlist.js",
37
+ "test:sce-tracking": "node scripts/check-sce-tracking.js",
37
38
  "test:brand-consistency": "node scripts/check-branding-consistency.js",
38
39
  "test:watch": "npx jest --watch",
39
40
  "coverage": "npx jest --coverage",
@@ -69,7 +70,7 @@
69
70
  "gate:release-asset-integrity": "node scripts/release-asset-integrity-check.js",
70
71
  "report:release-risk-remediation": "node scripts/release-risk-remediation-bundle.js --json",
71
72
  "report:moqui-core-regression": "node scripts/moqui-core-regression-suite.js --json",
72
- "prepublishOnly": "npm run test:full && npm run test:skip-audit && npm run test:brand-consistency && npm run report:interactive-governance -- --fail-on-alert",
73
+ "prepublishOnly": "npm run test:full && npm run test:skip-audit && npm run test:sce-tracking && npm run test:brand-consistency && npm run report:interactive-governance -- --fail-on-alert",
73
74
  "publish:manual": "npm publish --access public",
74
75
  "install-global": "npm install -g .",
75
76
  "uninstall-global": "npm uninstall -g scene-capability-engine"
@@ -128,6 +128,31 @@
128
128
 
129
129
  **目标**: AI 像人类开发者自由使用开发环境资源,专注解决问题而非权限申请
130
130
 
131
+ ### 11. 缺陷修复优先根因原则 🛠️
132
+
133
+ **核心**: 定位问题时,第一要务是修复根因,不是绕过问题
134
+
135
+ **硬规则**: ❌ 禁止通过关闭校验、跳过测试、降级关键路径、屏蔽异常等方式“假修复”
136
+
137
+ **复杂问题定位方法**: 优先使用 debug 日志与可观测信号定位(输入、输出、关键分支、异常栈、上下文参数),先还原执行路径再下结论
138
+
139
+ **允许的临时措施**: 仅在生产止血场景可临时绕行,但必须同时给出根因修复任务、回滚条件和截止时间
140
+
141
+ **验收标准**: 必须有可复现用例、修复后回归通过、明确根因记录(不是仅现象描述)
142
+
143
+ ### 12. Ontology 四层一链分析原则 🧭
144
+
145
+ **核心**: 梳理项目必须按统一语义框架推进,避免只看页面或只看接口
146
+
147
+ **标准口径(修正)**:
148
+ 1) 实体模型(Entity)
149
+ 2) 关系图谱(Relation)
150
+ 3) 业务规则(Business Rule)
151
+ 4) 决策逻辑(Decision)
152
+ 5) 执行链路(Action/Lineage,体现“决策如何被执行与影响到哪里”)
153
+
154
+ **要求**: 需求分析、问题定位、模板沉淀、发布门禁均按该口径检查完整性与一致性
155
+
131
156
  ---
132
157
 
133
- v14.0 | 2026-02-02 | 无损重构,精简 40% token
158
+ v15.0 | 2026-02-25 | 新增根因修复原则与 Ontology 四层一链分析原则