kiro-spec-engine 1.47.29 → 1.47.31

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.
@@ -22,11 +22,10 @@
22
22
  npx kse auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.json --json
23
23
  ```
24
24
 
25
- 需要更严格门禁时:
25
+ 需要提高成功率门槛时:
26
26
 
27
27
  ```bash
28
28
  npx kse auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.json \
29
- --require-ontology-validation \
30
29
  --min-spec-success-rate 95 \
31
30
  --max-risk-level medium \
32
31
  --json
@@ -28,7 +28,6 @@ Use this checklist before each integration batch.
28
28
 
29
29
  ```bash
30
30
  npx kse auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.json \\
31
- --require-ontology-validation \\
32
31
  --min-spec-success-rate 95 \\
33
32
  --max-risk-level medium \\
34
33
  --json
package/docs/README.md CHANGED
@@ -91,6 +91,7 @@ Detailed technical documentation:
91
91
  - **[Multi-Repository Management Guide](multi-repo-management-guide.md)** - Managing multiple Git repositories
92
92
  - **[Value Observability Guide](value-observability-guide.md)** - KPI snapshot, baseline, trend, and gate evidence workflow
93
93
  - **[Scene Runtime Guide](scene-runtime-guide.md)** - Scene template engine, quality pipeline, ontology, and Moqui ERP integration
94
+ - **[Moqui Template Core Library Playbook](moqui-template-core-library-playbook.md)** - Default-gated intake flow for absorbing Moqui capabilities into KSE templates
94
95
  - **[331-poc Dual-Track Integration Guide](331-poc-dual-track-integration-guide.md)** - Handoff contract and integration playbook between 331-poc and kse
95
96
  - **[331-poc Adaptation Roadmap](331-poc-adaptation-roadmap.md)** - Ongoing KSE-side adaptation backlog and rollout phases
96
97
  - **[Multi-Agent Coordination Guide](multi-agent-coordination-guide.md)** - Multi-agent parallel coordination for concurrent development
@@ -187,6 +188,7 @@ Detailed technical documentation:
187
188
 
188
189
  ### Scene Runtime
189
190
  - [Scene Runtime Guide](scene-runtime-guide.md)
191
+ - [Moqui Template Core Library Playbook](moqui-template-core-library-playbook.md)
190
192
  - [331-poc Dual-Track Integration Guide](331-poc-dual-track-integration-guide.md)
191
193
  - [331-poc Adaptation Roadmap](331-poc-adaptation-roadmap.md)
192
194
  - [Scene Template Engine](command-reference.md#scene-template-engine)
@@ -516,14 +516,14 @@ kse auto schema migrate --json # dry-run by default
516
516
  kse auto schema migrate --apply --json # apply schema_version migration
517
517
  kse auto schema migrate --only close-loop-session,batch-session --apply --json
518
518
 
519
- # Dual-track handoff integration (e.g., 331-poc -> kse)
520
- kse auto handoff plan --manifest ../331-poc/docs/handoffs/handoff-manifest.json --json
521
- kse auto handoff plan --manifest ../331-poc/docs/handoffs/handoff-manifest.json --strict --out .kiro/reports/handoff-plan.json --json
522
- kse auto handoff queue --manifest ../331-poc/docs/handoffs/handoff-manifest.json --out .kiro/auto/handoff-goals.lines --json
523
- kse auto handoff template-diff --manifest ../331-poc/docs/handoffs/handoff-manifest.json --json
524
- kse auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.json --json
525
- kse auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.json --min-spec-success-rate 95 --max-risk-level medium --json
526
- kse auto handoff run --manifest ../331-poc/docs/handoffs/handoff-manifest.json --continue-from latest --continue-strategy auto --json
519
+ # Dual-track handoff integration (generic external project -> kse)
520
+ kse auto handoff plan --manifest docs/handoffs/handoff-manifest.json --json
521
+ kse auto handoff plan --manifest docs/handoffs/handoff-manifest.json --strict --out .kiro/reports/handoff-plan.json --json
522
+ kse auto handoff queue --manifest docs/handoffs/handoff-manifest.json --out .kiro/auto/handoff-goals.lines --json
523
+ kse auto handoff template-diff --manifest docs/handoffs/handoff-manifest.json --json
524
+ kse auto handoff run --manifest docs/handoffs/handoff-manifest.json --json
525
+ kse auto handoff run --manifest docs/handoffs/handoff-manifest.json --min-spec-success-rate 95 --max-risk-level medium --json
526
+ kse auto handoff run --manifest docs/handoffs/handoff-manifest.json --continue-from latest --continue-strategy auto --json
527
527
  kse auto handoff regression --session-id latest --json
528
528
  kse auto handoff regression --session-id latest --window 5 --json
529
529
  kse auto handoff regression --session-id latest --format markdown --out .kiro/reports/handoff-regression.md --json
@@ -856,22 +856,22 @@ kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json -
856
856
  kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --manifest-spec-path handoff.spec_items --json
857
857
 
858
858
  # Tighten per-spec ontology semantic quality threshold before publish
859
- kse scene package-publish-batch --from-331 --require-ontology-validation --ontology-min-score 70 --json
859
+ kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --ontology-min-score 70 --json
860
860
 
861
861
  # Persist ontology/publish batch report for governance tracking
862
- kse scene package-publish-batch --from-331 --dry-run --ontology-report-out .kiro/reports/scene-package-ontology-batch.json --json
862
+ kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --dry-run --ontology-report-out .kiro/reports/scene-package-ontology-batch.json --json
863
863
 
864
864
  # Enforce batch-level ontology portfolio gate (average score + valid-rate)
865
- kse scene package-publish-batch --from-331 --dry-run --ontology-min-average-score 60 --ontology-min-valid-rate 90 --json
865
+ kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --dry-run --ontology-min-average-score 60 --ontology-min-valid-rate 90 --json
866
866
 
867
867
  # Emergency bypass (not recommended): disable ontology validation requirement
868
868
  kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --no-require-ontology-validation --json
869
869
 
870
870
  # Export ontology remediation task draft markdown
871
- kse scene package-publish-batch --from-331 --dry-run --ontology-task-out .kiro/reports/scene-package-ontology-task-draft.md --json
871
+ kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --dry-run --ontology-task-out .kiro/reports/scene-package-ontology-task-draft.md --json
872
872
 
873
873
  # Export ontology remediation queue lines (directly consumable by close-loop-batch)
874
- kse scene package-publish-batch --from-331 --dry-run --ontology-task-queue-out .kiro/auto/ontology-remediation.lines --json
874
+ kse scene package-publish-batch --manifest docs/handoffs/handoff-manifest.json --dry-run --ontology-task-queue-out .kiro/auto/ontology-remediation.lines --json
875
875
  ```
876
876
 
877
877
  ### Scene Package Ontology Backfill Batch
@@ -890,6 +890,37 @@ kse scene package-ontology-backfill-batch --from-331 --include 62-00-moqui-full-
890
890
  kse scene package-ontology-backfill-batch --from-331 --dry-run --out-report .kiro/reports/scene-package-ontology-backfill-report.json --json
891
891
  ```
892
892
 
893
+ ### Moqui Template Baseline Scorecard
894
+
895
+ ```bash
896
+ # Preferred CLI entry: score Moqui/ERP templates in the local template library (default filter: moqui|erp)
897
+ kse scene moqui-baseline --json
898
+
899
+ # Script alias (same behavior)
900
+ npm run report:moqui-baseline
901
+
902
+ # Score all scene templates instead of Moqui/ERP subset
903
+ kse scene moqui-baseline --include-all --json
904
+
905
+ # Customize score thresholds and output paths
906
+ kse scene moqui-baseline \
907
+ --min-score 75 \
908
+ --min-valid-rate 100 \
909
+ --out .kiro/reports/moqui-template-baseline.json \
910
+ --markdown-out .kiro/reports/moqui-template-baseline.md \
911
+ --json
912
+
913
+ # Compare with a previous baseline and fail CI on portfolio gate fail
914
+ kse scene moqui-baseline \
915
+ --compare-with .kiro/reports/release-evidence/moqui-template-baseline-prev.json \
916
+ --fail-on-portfolio-fail \
917
+ --json
918
+ ```
919
+
920
+ Release workflow default:
921
+ - Publishes `moqui-template-baseline.json` + `moqui-template-baseline.md` as release assets.
922
+ - Enforces baseline portfolio gate by default (`KSE_MOQUI_BASELINE_ENFORCE` defaults to `true` when unset).
923
+
893
924
  ### Moqui ERP Integration
894
925
 
895
926
  ```bash
@@ -0,0 +1,156 @@
1
+ {
2
+ "mode": "moqui-template-baseline",
3
+ "generated_at": "2026-02-17T15:29:22.909Z",
4
+ "template_root": ".kiro\\templates\\scene-packages",
5
+ "filter": {
6
+ "include_all": false,
7
+ "match": "(moqui|erp)"
8
+ },
9
+ "baseline": {
10
+ "min_score": 70,
11
+ "min_valid_rate_percent": 100
12
+ },
13
+ "summary": {
14
+ "total_templates": 4,
15
+ "scoped_templates": 3,
16
+ "avg_score": 100,
17
+ "valid_rate_percent": 100,
18
+ "baseline_passed": 3,
19
+ "baseline_failed": 0,
20
+ "portfolio_passed": true
21
+ },
22
+ "templates": [
23
+ {
24
+ "template_id": "kse.scene--erp-inventory-reserve-adjust--0.1.0",
25
+ "template_path": ".kiro\\templates\\scene-packages\\kse.scene--erp-inventory-reserve-adjust--0.1.0",
26
+ "contract_path": ".kiro\\templates\\scene-packages\\kse.scene--erp-inventory-reserve-adjust--0.1.0\\scene-package.json",
27
+ "ontology": {
28
+ "valid": true,
29
+ "error_count": 0
30
+ },
31
+ "semantic": {
32
+ "score": 100,
33
+ "level": "high",
34
+ "metrics": {
35
+ "entity_count": 4,
36
+ "relation_count": 4,
37
+ "business_rule_total": 2,
38
+ "business_rule_mapped": 2,
39
+ "business_rule_unmapped": 0,
40
+ "business_rule_passed": 2,
41
+ "business_rule_failed": 0,
42
+ "business_rule_mapping_rate_percent": 100,
43
+ "business_rule_pass_rate_percent": 100,
44
+ "decision_total": 2,
45
+ "decision_resolved": 2,
46
+ "decision_pending": 0,
47
+ "decision_undecided": 0,
48
+ "decision_automated": 2,
49
+ "decision_resolved_rate_percent": 100
50
+ }
51
+ },
52
+ "baseline": {
53
+ "flags": {
54
+ "graph_valid": true,
55
+ "score_passed": true,
56
+ "entity_coverage": true,
57
+ "relation_coverage": true,
58
+ "business_rule_coverage": true,
59
+ "business_rule_closed": true,
60
+ "decision_coverage": true,
61
+ "decision_closed": true,
62
+ "baseline_passed": true
63
+ },
64
+ "gaps": []
65
+ }
66
+ },
67
+ {
68
+ "template_id": "kse.scene--erp-order-fulfillment-workflow--0.1.0",
69
+ "template_path": ".kiro\\templates\\scene-packages\\kse.scene--erp-order-fulfillment-workflow--0.1.0",
70
+ "contract_path": ".kiro\\templates\\scene-packages\\kse.scene--erp-order-fulfillment-workflow--0.1.0\\scene-package.json",
71
+ "ontology": {
72
+ "valid": true,
73
+ "error_count": 0
74
+ },
75
+ "semantic": {
76
+ "score": 100,
77
+ "level": "high",
78
+ "metrics": {
79
+ "entity_count": 5,
80
+ "relation_count": 6,
81
+ "business_rule_total": 2,
82
+ "business_rule_mapped": 2,
83
+ "business_rule_unmapped": 0,
84
+ "business_rule_passed": 2,
85
+ "business_rule_failed": 0,
86
+ "business_rule_mapping_rate_percent": 100,
87
+ "business_rule_pass_rate_percent": 100,
88
+ "decision_total": 2,
89
+ "decision_resolved": 2,
90
+ "decision_pending": 0,
91
+ "decision_undecided": 0,
92
+ "decision_automated": 2,
93
+ "decision_resolved_rate_percent": 100
94
+ }
95
+ },
96
+ "baseline": {
97
+ "flags": {
98
+ "graph_valid": true,
99
+ "score_passed": true,
100
+ "entity_coverage": true,
101
+ "relation_coverage": true,
102
+ "business_rule_coverage": true,
103
+ "business_rule_closed": true,
104
+ "decision_coverage": true,
105
+ "decision_closed": true,
106
+ "baseline_passed": true
107
+ },
108
+ "gaps": []
109
+ }
110
+ },
111
+ {
112
+ "template_id": "kse.scene--erp-order-query-read--0.1.0",
113
+ "template_path": ".kiro\\templates\\scene-packages\\kse.scene--erp-order-query-read--0.1.0",
114
+ "contract_path": ".kiro\\templates\\scene-packages\\kse.scene--erp-order-query-read--0.1.0\\scene-package.json",
115
+ "ontology": {
116
+ "valid": true,
117
+ "error_count": 0
118
+ },
119
+ "semantic": {
120
+ "score": 100,
121
+ "level": "high",
122
+ "metrics": {
123
+ "entity_count": 4,
124
+ "relation_count": 4,
125
+ "business_rule_total": 2,
126
+ "business_rule_mapped": 2,
127
+ "business_rule_unmapped": 0,
128
+ "business_rule_passed": 2,
129
+ "business_rule_failed": 0,
130
+ "business_rule_mapping_rate_percent": 100,
131
+ "business_rule_pass_rate_percent": 100,
132
+ "decision_total": 2,
133
+ "decision_resolved": 2,
134
+ "decision_pending": 0,
135
+ "decision_undecided": 0,
136
+ "decision_automated": 2,
137
+ "decision_resolved_rate_percent": 100
138
+ }
139
+ },
140
+ "baseline": {
141
+ "flags": {
142
+ "graph_valid": true,
143
+ "score_passed": true,
144
+ "entity_coverage": true,
145
+ "relation_coverage": true,
146
+ "business_rule_coverage": true,
147
+ "business_rule_closed": true,
148
+ "decision_coverage": true,
149
+ "decision_closed": true,
150
+ "baseline_passed": true
151
+ },
152
+ "gaps": []
153
+ }
154
+ }
155
+ ]
156
+ }
@@ -0,0 +1,24 @@
1
+ # Moqui Template Baseline Report
2
+
3
+ - Generated at: 2026-02-17T15:29:22.909Z
4
+ - Template root: .kiro\templates\scene-packages
5
+ - Filter: (moqui|erp)
6
+ - Baseline thresholds: score>=70, valid-rate>=100%
7
+
8
+ ## Summary
9
+
10
+ - Total templates scanned: 4
11
+ - Templates in scope: 3
12
+ - Avg score: 100
13
+ - Ontology valid-rate: 100%
14
+ - Baseline passed: 3
15
+ - Baseline failed: 0
16
+ - Portfolio pass: yes
17
+
18
+ ## Templates
19
+
20
+ | Template | Score | Graph | Baseline | Gaps |
21
+ | --- | ---: | --- | --- | --- |
22
+ | kse.scene--erp-inventory-reserve-adjust--0.1.0 | 100 | valid | pass | none |
23
+ | kse.scene--erp-order-fulfillment-workflow--0.1.0 | 100 | valid | pass | none |
24
+ | kse.scene--erp-order-query-read--0.1.0 | 100 | valid | pass | none |
@@ -48,4 +48,4 @@ A capability is considered absorbed by KSE when all checks pass:
48
48
  - `kse scene lint --strict`
49
49
  - `kse scene score --threshold 85`
50
50
  - `kse scene ontology validate`
51
- - `kse auto handoff run --require-ontology-validation`
51
+ - `kse auto handoff run`
@@ -0,0 +1,89 @@
1
+ # Moqui Template Core Library Playbook
2
+
3
+ This playbook defines a generic (project-agnostic) path to absorb Moqui capabilities into the KSE core template library.
4
+
5
+ ## Objectives
6
+
7
+ - Turn Moqui business capabilities into reusable `scene-package` templates.
8
+ - Enforce ontology quality as a default gate (no project-specific flags required).
9
+ - Keep evidence output stable for release and regression review.
10
+
11
+ ## Default Gate Baseline
12
+
13
+ KSE defaults already enforce the baseline below:
14
+
15
+ - `kse auto handoff run`: ontology validation is required by default.
16
+ - `kse scene package-publish-batch`:
17
+ - ontology validation required by default
18
+ - batch ontology gate defaults:
19
+ - average ontology score `>= 70`
20
+ - ontology valid-rate `>= 100%`
21
+
22
+ Emergency bypass exists but is not recommended:
23
+
24
+ - `--no-require-ontology-validation`
25
+
26
+ ## One-Shot Intake Flow
27
+
28
+ ```bash
29
+ # 0) Generate template baseline scoreboard (Moqui/ERP templates by default)
30
+ kse scene moqui-baseline --json
31
+
32
+ # 0.1) CI/release mode: compare against previous baseline and enforce portfolio gate
33
+ kse scene moqui-baseline \
34
+ --compare-with .kiro/reports/release-evidence/moqui-template-baseline-prev.json \
35
+ --fail-on-portfolio-fail \
36
+ --json
37
+
38
+ # 1) Handoff close-loop
39
+ kse auto handoff run --manifest docs/handoffs/handoff-manifest.json --json
40
+
41
+ # 2) Publish templates from scene packages (with default ontology gates)
42
+ kse scene package-publish-batch \
43
+ --manifest docs/handoffs/handoff-manifest.json \
44
+ --json
45
+
46
+ # 3) Persist ontology publish evidence for governance/review
47
+ kse scene package-publish-batch \
48
+ --manifest docs/handoffs/handoff-manifest.json \
49
+ --dry-run \
50
+ --ontology-report-out .kiro/reports/scene-package-ontology-batch.json \
51
+ --json
52
+
53
+ # 4) Validate registry + package gate
54
+ kse scene package-registry --template-dir .kiro/templates/scene-packages --strict --json
55
+ kse scene package-gate-template --out .kiro/templates/scene-package-gate-policy.json --profile three-layer --force --json
56
+ kse scene package-gate --registry .kiro/templates/scene-packages/registry.json --policy .kiro/templates/scene-package-gate-policy.json --strict --json
57
+ ```
58
+
59
+ ## Evidence Contract
60
+
61
+ Required artifacts for each intake batch:
62
+
63
+ - `.kiro/reports/moqui-template-baseline.json`
64
+ - `.kiro/reports/moqui-template-baseline.md`
65
+ - `.kiro/reports/handoff-runs/<session>.json`
66
+ - `.kiro/reports/scene-package-ontology-batch.json`
67
+ - `.kiro/templates/scene-packages/registry.json`
68
+ - gate output/evidence linked from release notes or handoff summary
69
+
70
+ ## Minimum Semantic Coverage
71
+
72
+ Each accepted template should include ontology semantics for:
73
+
74
+ - entity model
75
+ - relation graph
76
+ - business rules
77
+ - decision logic
78
+
79
+ If any area is weak, export remediation queue lines and feed back to close-loop:
80
+
81
+ ```bash
82
+ kse scene package-publish-batch \
83
+ --manifest docs/handoffs/handoff-manifest.json \
84
+ --dry-run \
85
+ --ontology-task-queue-out .kiro/auto/ontology-remediation.lines \
86
+ --json
87
+
88
+ kse auto close-loop-batch .kiro/auto/ontology-remediation.lines --format lines --json
89
+ ```
package/docs/zh/README.md CHANGED
@@ -172,6 +172,12 @@
172
172
  - Ontology 图、Action Abstraction、Data Lineage、Agent Hints
173
173
  - Moqui ERP 连接、发现、模板提取
174
174
 
175
+ ### [Moqui Template Core Library Playbook](../moqui-template-core-library-playbook.md)
176
+ **Moqui 能力核心库化执行清单(英文)** - 默认门禁、批处理吸收链路、证据合同
177
+ - 不依赖 331 特参的通用 intake 流程
178
+ - Ontology 与 scene-package 默认门禁
179
+ - remediation 队列回灌闭环
180
+
175
181
  ### [331-poc 双轨协同对接手册](../331-poc-dual-track-integration-guide.md)
176
182
  **331-poc 与 kse 协同执行指南** - 交接契约、接入命令链、主从闭环验收
177
183
  - 331 深化成果输入约束
@@ -1,6 +1,7 @@
1
1
  const path = require('path');
2
2
  const zlib = require('zlib');
3
3
  const crypto = require('crypto');
4
+ const { spawnSync } = require('child_process');
4
5
  const fs = require('fs-extra');
5
6
  const chalk = require('chalk');
6
7
  const yaml = require('js-yaml');
@@ -60,6 +61,9 @@ const SCENE_PACKAGE_KINDS = new Set([
60
61
  const SCENE_PACKAGE_RISK_LEVELS = new Set(['low', 'medium', 'high', 'critical']);
61
62
  const SCENE_PACKAGE_TEMPLATE_API_VERSION = 'kse.scene.template/v0.1';
62
63
  const SCENE_PACKAGE_TEMPLATE_DEFAULT_DIR = '.kiro/templates/scene-packages';
64
+ const SCENE_MOQUI_BASELINE_DEFAULT_MATCH = '(moqui|erp)';
65
+ const SCENE_MOQUI_BASELINE_DEFAULT_MIN_SCORE = 70;
66
+ const SCENE_MOQUI_BASELINE_DEFAULT_MIN_VALID_RATE = 100;
63
67
  const SCENE_PACKAGE_BATCH_DEFAULT_ONTOLOGY_MIN_AVERAGE_SCORE = 70;
64
68
  const SCENE_PACKAGE_BATCH_DEFAULT_ONTOLOGY_MIN_VALID_RATE = 100;
65
69
  const SCENE_PACKAGE_GATE_API_VERSION = 'kse.scene.package-gate/v0.1';
@@ -536,6 +540,23 @@ function registerSceneCommands(program) {
536
540
  await runSceneTemplateRenderCommand(options);
537
541
  });
538
542
 
543
+ sceneCmd
544
+ .command('moqui-baseline')
545
+ .description('Generate Moqui template baseline scorecard from scene package library')
546
+ .option('--template-dir <path>', 'Template root directory', SCENE_PACKAGE_TEMPLATE_DEFAULT_DIR)
547
+ .option('--out <path>', 'JSON report output path', '.kiro/reports/moqui-template-baseline.json')
548
+ .option('--markdown-out <path>', 'Markdown report output path', '.kiro/reports/moqui-template-baseline.md')
549
+ .option('--match <regex>', 'Template selector regex', SCENE_MOQUI_BASELINE_DEFAULT_MATCH)
550
+ .option('--include-all', 'Disable selector filter and score all templates')
551
+ .option('--min-score <number>', 'Baseline minimum semantic score (0-100)', String(SCENE_MOQUI_BASELINE_DEFAULT_MIN_SCORE))
552
+ .option('--min-valid-rate <number>', 'Baseline minimum ontology valid-rate percent (0-100)', String(SCENE_MOQUI_BASELINE_DEFAULT_MIN_VALID_RATE))
553
+ .option('--compare-with <path>', 'Compare with previous baseline JSON report')
554
+ .option('--fail-on-portfolio-fail', 'Exit non-zero when portfolio baseline gate fails')
555
+ .option('--json', 'Print payload as JSON')
556
+ .action(async (options) => {
557
+ await runSceneMoquiBaselineCommand(options);
558
+ });
559
+
539
560
  sceneCmd
540
561
  .command('instantiate')
541
562
  .description('Instantiate scene template package with full pipeline (resolve, validate, render, manifest, log, hook)')
@@ -10960,6 +10981,48 @@ function validateSceneTemplateResolveOptions(options) {
10960
10981
  return null;
10961
10982
  }
10962
10983
 
10984
+ function normalizeSceneMoquiBaselineOptions(options = {}) {
10985
+ const minScore = Number(options.minScore);
10986
+ const minValidRate = Number(options.minValidRate);
10987
+ return {
10988
+ templateDir: options.templateDir ? String(options.templateDir).trim() : SCENE_PACKAGE_TEMPLATE_DEFAULT_DIR,
10989
+ out: options.out ? String(options.out).trim() : '.kiro/reports/moqui-template-baseline.json',
10990
+ markdownOut: options.markdownOut ? String(options.markdownOut).trim() : '.kiro/reports/moqui-template-baseline.md',
10991
+ match: options.match ? String(options.match).trim() : SCENE_MOQUI_BASELINE_DEFAULT_MATCH,
10992
+ includeAll: options.includeAll === true,
10993
+ minScore: Number.isFinite(minScore) ? minScore : SCENE_MOQUI_BASELINE_DEFAULT_MIN_SCORE,
10994
+ minValidRate: Number.isFinite(minValidRate) ? minValidRate : SCENE_MOQUI_BASELINE_DEFAULT_MIN_VALID_RATE,
10995
+ compareWith: options.compareWith ? String(options.compareWith).trim() : undefined,
10996
+ failOnPortfolioFail: options.failOnPortfolioFail === true,
10997
+ json: options.json === true
10998
+ };
10999
+ }
11000
+
11001
+ function validateSceneMoquiBaselineOptions(options) {
11002
+ if (!options.templateDir || typeof options.templateDir !== 'string' || options.templateDir.trim().length === 0) {
11003
+ return '--template-dir is required';
11004
+ }
11005
+ if (!options.out || typeof options.out !== 'string' || options.out.trim().length === 0) {
11006
+ return '--out is required';
11007
+ }
11008
+ if (!options.markdownOut || typeof options.markdownOut !== 'string' || options.markdownOut.trim().length === 0) {
11009
+ return '--markdown-out is required';
11010
+ }
11011
+ if (!options.match || typeof options.match !== 'string' || options.match.trim().length === 0) {
11012
+ return '--match is required';
11013
+ }
11014
+ if (!Number.isFinite(Number(options.minScore)) || Number(options.minScore) < 0 || Number(options.minScore) > 100) {
11015
+ return '--min-score must be a number between 0 and 100';
11016
+ }
11017
+ if (!Number.isFinite(Number(options.minValidRate)) || Number(options.minValidRate) < 0 || Number(options.minValidRate) > 100) {
11018
+ return '--min-valid-rate must be a number between 0 and 100';
11019
+ }
11020
+ if (options.compareWith !== undefined && (!options.compareWith || options.compareWith.length === 0)) {
11021
+ return '--compare-with cannot be empty';
11022
+ }
11023
+ return null;
11024
+ }
11025
+
10963
11026
  // --- Print functions for template commands ---
10964
11027
 
10965
11028
  function printSceneTemplateValidateSummary(options, payload, projectRoot = process.cwd()) {
@@ -11076,6 +11139,80 @@ function printSceneTemplateRenderSummary(options, payload, projectRoot = process
11076
11139
 
11077
11140
  // --- Command runners for template commands ---
11078
11141
 
11142
+ async function runSceneMoquiBaselineCommand(rawOptions = {}, dependencies = {}) {
11143
+ const projectRoot = dependencies.projectRoot || process.cwd();
11144
+ const fileSystem = dependencies.fileSystem || fs;
11145
+
11146
+ const options = normalizeSceneMoquiBaselineOptions(rawOptions);
11147
+ const validationError = validateSceneMoquiBaselineOptions(options);
11148
+ if (validationError) {
11149
+ console.error(chalk.red(`Scene moqui-baseline failed: ${validationError}`));
11150
+ process.exitCode = 1;
11151
+ return null;
11152
+ }
11153
+
11154
+ const scriptPath = path.join(projectRoot, 'scripts', 'moqui-template-baseline-report.js');
11155
+ const scriptExists = await fileSystem.pathExists(scriptPath);
11156
+ if (!scriptExists) {
11157
+ console.error(chalk.red(`Scene moqui-baseline failed: script not found at ${scriptPath}`));
11158
+ process.exitCode = 1;
11159
+ return null;
11160
+ }
11161
+
11162
+ const args = [scriptPath];
11163
+ args.push('--template-dir', options.templateDir);
11164
+ args.push('--out', options.out);
11165
+ args.push('--markdown-out', options.markdownOut);
11166
+ args.push('--match', options.match);
11167
+ args.push('--min-score', String(options.minScore));
11168
+ args.push('--min-valid-rate', String(options.minValidRate));
11169
+ if (options.includeAll) {
11170
+ args.push('--include-all');
11171
+ }
11172
+ if (options.compareWith) {
11173
+ args.push('--compare-with', options.compareWith);
11174
+ }
11175
+ if (options.failOnPortfolioFail) {
11176
+ args.push('--fail-on-portfolio-fail');
11177
+ }
11178
+ if (options.json) {
11179
+ args.push('--json');
11180
+ }
11181
+
11182
+ const result = spawnSync(process.execPath, args, {
11183
+ cwd: projectRoot,
11184
+ encoding: 'utf8'
11185
+ });
11186
+
11187
+ if (typeof result.stdout === 'string' && result.stdout.length > 0) {
11188
+ process.stdout.write(result.stdout);
11189
+ }
11190
+ if (typeof result.stderr === 'string' && result.stderr.length > 0) {
11191
+ process.stderr.write(result.stderr);
11192
+ }
11193
+
11194
+ if (result.error) {
11195
+ console.error(chalk.red(`Scene moqui-baseline failed: ${result.error.message}`));
11196
+ process.exitCode = 1;
11197
+ return null;
11198
+ }
11199
+
11200
+ const exitCode = Number.isInteger(result.status) ? result.status : 1;
11201
+ if (exitCode !== 0) {
11202
+ process.exitCode = exitCode;
11203
+ }
11204
+
11205
+ if (options.json && typeof result.stdout === 'string' && result.stdout.trim().length > 0) {
11206
+ try {
11207
+ return JSON.parse(result.stdout);
11208
+ } catch (_error) {
11209
+ return null;
11210
+ }
11211
+ }
11212
+
11213
+ return null;
11214
+ }
11215
+
11079
11216
  async function runSceneTemplateValidateCommand(rawOptions = {}, dependencies = {}) {
11080
11217
  const projectRoot = dependencies.projectRoot || process.cwd();
11081
11218
  const fileSystem = dependencies.fileSystem || fs;
@@ -15266,6 +15403,9 @@ module.exports = {
15266
15403
  validateSceneTemplateValidateOptions,
15267
15404
  normalizeSceneTemplateResolveOptions,
15268
15405
  validateSceneTemplateResolveOptions,
15406
+ normalizeSceneMoquiBaselineOptions,
15407
+ validateSceneMoquiBaselineOptions,
15408
+ runSceneMoquiBaselineCommand,
15269
15409
  runSceneTemplateValidateCommand,
15270
15410
  runSceneTemplateResolveCommand,
15271
15411
  runSceneTemplateRenderCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-spec-engine",
3
- "version": "1.47.29",
3
+ "version": "1.47.31",
4
4
  "description": "kiro-spec-engine (kse) - A CLI tool and npm package for spec-driven development with AI coding assistants. NOT the Kiro IDE desktop application.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -34,6 +34,7 @@
34
34
  "test:skip-audit": "node scripts/check-skip-allowlist.js",
35
35
  "test:watch": "npx jest --watch",
36
36
  "coverage": "npx jest --coverage",
37
+ "report:moqui-baseline": "node scripts/moqui-template-baseline-report.js --json",
37
38
  "prepublishOnly": "npm run test:full && npm run test:skip-audit",
38
39
  "publish:manual": "npm publish --access public",
39
40
  "install-global": "npm install -g .",