scene-capability-engine 3.6.24 → 3.6.26

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,10 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.6.26] - 2026-03-06
11
+
12
+ ### Added
13
+ - Capability inventory now exposes scene-level advice fields, homepage summary recommendations, and quick filters for Magicball dashboards.
14
+ - Capability iteration schema and Magicball docs now define the homepage recommendation contract.
15
+
16
+ ## [3.6.25] - 2026-03-06
17
+
18
+ ### Added
19
+ - Capability inventory now exposes homepage summary stats for publish readiness and triad gap cards.
20
+ - Capability iteration schema and Magicball docs now define the homepage summary card contract.
21
+
10
22
  ## [3.6.24] - 2026-03-06
11
23
 
12
24
  ### Added
13
- - Capability inventory payload now exposes fixed homepage query metadata (`query`) and sorting metadata (`sort`).
25
+ - Capability inventory payload now exposes fixed homepage query metadata (`query`), summary stats (`summary_stats`), summary recommendations, quick filters, and sorting metadata (`sort`).
14
26
  - Capability iteration schema and Magicball docs now define the fixed homepage inventory protocol.
15
27
 
16
28
  ## [3.6.23] - 2026-03-06
package/README.md CHANGED
@@ -218,5 +218,5 @@ MIT. See [LICENSE](LICENSE).
218
218
 
219
219
  ---
220
220
 
221
- **Version**: 3.6.24
221
+ **Version**: 3.6.26
222
222
  **Last Updated**: 2026-03-05
package/README.zh.md CHANGED
@@ -218,5 +218,5 @@ MIT,见 [LICENSE](LICENSE)。
218
218
 
219
219
  ---
220
220
 
221
- **版本**:3.6.24
221
+ **版本**:3.6.26
222
222
  **最后更新**:2026-03-05
@@ -667,7 +667,10 @@
667
667
  "scene_total",
668
668
  "scene_count",
669
669
  "sort",
670
- "scenes"
670
+ "scenes",
671
+ "summary_stats",
672
+ "summary_recommendations",
673
+ "quick_filters"
671
674
  ],
672
675
  "properties": {
673
676
  "mode": {
@@ -768,7 +771,12 @@
768
771
  "ontology_core_ui",
769
772
  "release_readiness",
770
773
  "release_readiness_ui",
771
- "score_preview"
774
+ "score_preview",
775
+ "attention_level",
776
+ "recommended_action",
777
+ "blocking_summary",
778
+ "next_action",
779
+ "next_command"
772
780
  ],
773
781
  "properties": {
774
782
  "scene_id": {
@@ -797,6 +805,111 @@
797
805
  },
798
806
  "score_preview": {
799
807
  "type": "object"
808
+ },
809
+ "attention_level": {
810
+ "type": "string"
811
+ },
812
+ "recommended_action": {
813
+ "type": "string"
814
+ },
815
+ "blocking_summary": {
816
+ "type": "string"
817
+ },
818
+ "next_action": {
819
+ "type": "string"
820
+ },
821
+ "next_command": {
822
+ "type": "string"
823
+ }
824
+ },
825
+ "additionalProperties": false
826
+ }
827
+ },
828
+ "summary_stats": {
829
+ "type": "object",
830
+ "required": [
831
+ "publish_ready_count",
832
+ "blocked_count",
833
+ "missing_triads"
834
+ ],
835
+ "properties": {
836
+ "publish_ready_count": {
837
+ "type": "integer",
838
+ "minimum": 0
839
+ },
840
+ "blocked_count": {
841
+ "type": "integer",
842
+ "minimum": 0
843
+ },
844
+ "missing_triads": {
845
+ "type": "object",
846
+ "required": [
847
+ "decision_strategy",
848
+ "business_rules",
849
+ "entity_relation"
850
+ ],
851
+ "properties": {
852
+ "decision_strategy": {
853
+ "type": "integer",
854
+ "minimum": 0
855
+ },
856
+ "business_rules": {
857
+ "type": "integer",
858
+ "minimum": 0
859
+ },
860
+ "entity_relation": {
861
+ "type": "integer",
862
+ "minimum": 0
863
+ }
864
+ },
865
+ "additionalProperties": false
866
+ }
867
+ },
868
+ "additionalProperties": false
869
+ },
870
+ "summary_recommendations": {
871
+ "type": "array",
872
+ "items": {
873
+ "type": "string"
874
+ }
875
+ },
876
+ "quick_filters": {
877
+ "type": "array",
878
+ "items": {
879
+ "type": "object",
880
+ "required": [
881
+ "id",
882
+ "label",
883
+ "query"
884
+ ],
885
+ "properties": {
886
+ "id": {
887
+ "type": "string"
888
+ },
889
+ "label": {
890
+ "type": "string"
891
+ },
892
+ "query": {
893
+ "type": "object",
894
+ "required": [
895
+ "release_ready",
896
+ "missing_triad"
897
+ ],
898
+ "properties": {
899
+ "release_ready": {
900
+ "type": [
901
+ "boolean",
902
+ "null"
903
+ ]
904
+ },
905
+ "missing_triad": {
906
+ "type": [
907
+ "string",
908
+ "null"
909
+ ]
910
+ }
911
+ },
912
+ "additionalProperties": false
800
913
  }
801
914
  },
802
915
  "additionalProperties": false
@@ -1875,7 +1875,7 @@ sce capability inventory --json
1875
1875
  sce capability inventory --release-ready false --missing-triad decision_strategy --json
1876
1876
  ```
1877
1877
 
1878
- `capability inventory` returns fixed homepage query metadata in `query` and sorting metadata in `sort`.
1878
+ `capability inventory` returns fixed homepage query metadata in `query`, summary cards in `summary_stats`, top recommendations in `summary_recommendations`, quick filters in `quick_filters`, and sorting metadata in `sort`.
1879
1879
 
1880
1880
 
1881
1881
  Capability candidates are now evaluated against the ontology core triad by default:
@@ -186,5 +186,9 @@ sce capability register --input <template_file> --risk-level <level> --difficult
186
186
  - `query.sample_limit`:每个 spec 抽样任务上限
187
187
  - `query.filters.release_ready`:发布可用性过滤
188
188
  - `query.filters.missing_triad`:triad 缺口过滤
189
+ - `summary_stats.publish_ready_count` / `summary_stats.blocked_count`:顶部统计卡
190
+ - `summary_stats.missing_triads.*`:triad 缺口计数卡
191
+ - `summary_recommendations[]`:首页总览建议
192
+ - `quick_filters[]`:首页快捷筛选配置
189
193
  - `sort.strategy`:默认排序策略说明
190
194
  - `sort.triad_priority`:triad 优先级数组
@@ -205,4 +205,25 @@ sce capability register --input <template.json> --json
205
205
  - 使用 `capability-inventory` 返回的 `query` 作为首页请求回显
206
206
  - 使用 `sort` 作为排序策略展示来源
207
207
  - 首页筛选器应直接映射:`query.filters.release_ready`、`query.filters.missing_triad`
208
- - 首页顶部可显示:`scene_total` / `scene_count`
208
+ - 首页顶部可显示:`scene_total` / `scene_count` / `summary_stats`
209
+
210
+ ## 12. 顶部统计卡
211
+
212
+ - `summary_stats.publish_ready_count`:可发布 scene 数
213
+ - `summary_stats.blocked_count`:被阻断 scene 数
214
+ - `summary_stats.missing_triads.decision_strategy`:缺决策策略数量
215
+ - `summary_stats.missing_triads.business_rules`:缺业务规则数量
216
+ - `summary_stats.missing_triads.entity_relation`:缺实体关系数量
217
+
218
+ ## 13. Scene 卡片建议字段
219
+
220
+ - `attention_level`:critical/high/medium/low
221
+ - `recommended_action`:卡片主建议
222
+ - `blocking_summary`:一行摘要
223
+ - `next_action`:前端动作 key
224
+ - `next_command`:默认 CLI 建议
225
+
226
+ ## 14. 首页总览建议字段
227
+
228
+ - `summary_recommendations[]`:顶部全局建议
229
+ - `quick_filters[]`:推荐快捷筛选
@@ -836,6 +836,134 @@ function resolveCapabilityTriadPriority(entry) {
836
836
  return 3;
837
837
  }
838
838
 
839
+ function buildCapabilityInventorySceneAdvice(entry) {
840
+ const sceneId = String(entry && entry.scene_id || 'scene.unknown');
841
+ const releaseUi = entry && entry.release_readiness_ui ? entry.release_readiness_ui : { publish_ready: true, blocking_missing: [] };
842
+ const missing = Array.isArray(releaseUi.blocking_missing) ? releaseUi.blocking_missing : [];
843
+ const valueScore = Number(entry && entry.score_preview && entry.score_preview.value_score || 0);
844
+
845
+ let attentionLevel = 'low';
846
+ let recommendedAction = '可直接发布';
847
+ let blockingSummary = '已满足发布前置条件';
848
+ let nextAction = 'publish';
849
+
850
+ if (!releaseUi.publish_ready) {
851
+ if (missing.includes('decision_strategy')) {
852
+ attentionLevel = 'critical';
853
+ recommendedAction = '补齐决策策略';
854
+ blockingSummary = '缺决策策略,暂不可发布';
855
+ nextAction = 'fill_decision_strategy';
856
+ } else if (missing.includes('business_rules')) {
857
+ attentionLevel = 'high';
858
+ recommendedAction = '补齐业务规则';
859
+ blockingSummary = '缺业务规则,暂不可发布';
860
+ nextAction = 'fill_business_rules';
861
+ } else if (missing.includes('entity_relation')) {
862
+ attentionLevel = 'medium';
863
+ recommendedAction = '补齐实体关系';
864
+ blockingSummary = '缺实体关系,暂不可发布';
865
+ nextAction = 'fill_entity_relation';
866
+ } else {
867
+ attentionLevel = 'medium';
868
+ recommendedAction = '补齐本体能力';
869
+ blockingSummary = '本体能力不完整,暂不可发布';
870
+ nextAction = 'repair_ontology_core';
871
+ }
872
+ } else if (valueScore >= 70) {
873
+ attentionLevel = 'low';
874
+ recommendedAction = '进入模板构建';
875
+ blockingSummary = '能力成熟度较高,可进入模板构建/发布';
876
+ nextAction = 'build_template';
877
+ } else {
878
+ attentionLevel = 'medium';
879
+ recommendedAction = '继续补充任务证据';
880
+ blockingSummary = '已可发布,但建议先补强任务与验证证据';
881
+ nextAction = 'strengthen_evidence';
882
+ }
883
+
884
+ return {
885
+ attention_level: attentionLevel,
886
+ recommended_action: recommendedAction,
887
+ blocking_summary: blockingSummary,
888
+ next_action: nextAction,
889
+ next_command: 'sce capability extract --scene ' + sceneId + ' --json'
890
+ };
891
+ }
892
+
893
+ function buildCapabilityInventorySummaryStats(entries) {
894
+ const items = Array.isArray(entries) ? entries : [];
895
+ const summary = {
896
+ publish_ready_count: 0,
897
+ blocked_count: 0,
898
+ missing_triads: {
899
+ decision_strategy: 0,
900
+ business_rules: 0,
901
+ entity_relation: 0
902
+ }
903
+ };
904
+
905
+ for (const entry of items) {
906
+ const ready = Boolean(entry && entry.release_readiness_ui && entry.release_readiness_ui.publish_ready);
907
+ if (ready) {
908
+ summary.publish_ready_count += 1;
909
+ } else {
910
+ summary.blocked_count += 1;
911
+ }
912
+
913
+ const missing = Array.isArray(entry && entry.release_readiness_ui && entry.release_readiness_ui.blocking_missing)
914
+ ? entry.release_readiness_ui.blocking_missing
915
+ : [];
916
+ for (const triad of Object.keys(summary.missing_triads)) {
917
+ if (missing.includes(triad)) {
918
+ summary.missing_triads[triad] += 1;
919
+ }
920
+ }
921
+ }
922
+
923
+ return summary;
924
+ }
925
+
926
+ function buildCapabilityInventorySummaryRecommendations(entries) {
927
+ const items = Array.isArray(entries) ? entries : [];
928
+ const recommendations = [];
929
+ const blocked = items.filter((item) => !(item && item.release_readiness_ui && item.release_readiness_ui.publish_ready));
930
+ const missingDecision = blocked.filter((item) => Array.isArray(item.release_readiness_ui && item.release_readiness_ui.blocking_missing) && item.release_readiness_ui.blocking_missing.includes('decision_strategy'));
931
+ const missingRules = blocked.filter((item) => Array.isArray(item.release_readiness_ui && item.release_readiness_ui.blocking_missing) && item.release_readiness_ui.blocking_missing.includes('business_rules'));
932
+ const readyScenes = items.filter((item) => item && item.release_readiness_ui && item.release_readiness_ui.publish_ready);
933
+
934
+ if (missingDecision.length > 0) {
935
+ recommendations.push('优先处理缺决策策略的 scene(' + missingDecision.length + ')');
936
+ }
937
+ if (missingRules.length > 0) {
938
+ recommendations.push('其次处理缺业务规则的 scene(' + missingRules.length + ')');
939
+ }
940
+ if (readyScenes.length > 0) {
941
+ recommendations.push('可优先推进可发布 scene 进入模板构建(' + readyScenes.length + ')');
942
+ }
943
+ if (blocked.length === 0 && readyScenes.length === 0 && items.length > 0) {
944
+ recommendations.push('当前 scene 已基本稳定,可继续补强验证证据');
945
+ }
946
+
947
+ return recommendations;
948
+ }
949
+
950
+ function buildCapabilityInventoryQuickFilters(summaryStats) {
951
+ const stats = summaryStats || { blocked_count: 0, missing_triads: {} };
952
+ const filters = [];
953
+ if (Number(stats.blocked_count || 0) > 0) {
954
+ filters.push({ id: 'blocked', label: '不可发布', query: { release_ready: false, missing_triad: null } });
955
+ }
956
+ for (const triad of ['decision_strategy', 'business_rules', 'entity_relation']) {
957
+ if (Number(stats.missing_triads && stats.missing_triads[triad] || 0) > 0) {
958
+ filters.push({ id: 'missing_' + triad, label: '缺' + triad, query: { release_ready: false, missing_triad: triad } });
959
+ }
960
+ }
961
+ if (Number(stats.publish_ready_count || 0) > 0) {
962
+ filters.push({ id: 'ready', label: '可发布', query: { release_ready: true, missing_triad: null } });
963
+ }
964
+ return filters;
965
+ }
966
+
839
967
  function sortCapabilityInventoryEntries(entries) {
840
968
  return [...(Array.isArray(entries) ? entries : [])].sort((left, right) => {
841
969
  const leftReady = Boolean(left && left.release_readiness_ui && left.release_readiness_ui.publish_ready);
@@ -900,7 +1028,7 @@ async function runCapabilityInventoryCommand(options = {}, dependencies = {}) {
900
1028
  ontology_scope: candidate.ontology_scope,
901
1029
  ontology_core: candidate.ontology_core
902
1030
  });
903
- scenes.push({
1031
+ const sceneEntry = {
904
1032
  scene_id: sceneId,
905
1033
  summary: candidate.summary,
906
1034
  source: candidate.source,
@@ -910,10 +1038,15 @@ async function runCapabilityInventoryCommand(options = {}, dependencies = {}) {
910
1038
  release_readiness: releaseReadiness,
911
1039
  release_readiness_ui: buildCapabilityReleaseReadinessUi(releaseReadiness),
912
1040
  score_preview: score
1041
+ };
1042
+ scenes.push({
1043
+ ...sceneEntry,
1044
+ ...buildCapabilityInventorySceneAdvice(sceneEntry)
913
1045
  });
914
1046
  }
915
1047
 
916
1048
  const filteredScenes = sortCapabilityInventoryEntries(filterCapabilityInventoryEntries(scenes, options));
1049
+ const summaryStats = buildCapabilityInventorySummaryStats(filteredScenes);
917
1050
  const releaseReadyFilterRaw = normalizeText(options.releaseReady || options.release_ready).toLowerCase();
918
1051
  const payload = {
919
1052
  mode: 'capability-inventory',
@@ -930,6 +1063,9 @@ async function runCapabilityInventoryCommand(options = {}, dependencies = {}) {
930
1063
  },
931
1064
  scene_total: scenes.length,
932
1065
  scene_count: filteredScenes.length,
1066
+ summary_stats: summaryStats,
1067
+ summary_recommendations: buildCapabilityInventorySummaryRecommendations(filteredScenes),
1068
+ quick_filters: buildCapabilityInventoryQuickFilters(summaryStats),
933
1069
  sort: {
934
1070
  strategy: 'publish_ready -> missing_triad_priority -> value_score_desc -> scene_id',
935
1071
  triad_priority: ['decision_strategy', 'business_rules', 'entity_relation']
@@ -1717,5 +1853,9 @@ module.exports = {
1717
1853
  buildCapabilityReleaseReadinessUi,
1718
1854
  filterCapabilityCatalogEntries,
1719
1855
  filterCapabilityInventoryEntries,
1720
- sortCapabilityInventoryEntries
1856
+ sortCapabilityInventoryEntries,
1857
+ buildCapabilityInventorySceneAdvice,
1858
+ buildCapabilityInventorySummaryStats,
1859
+ buildCapabilityInventorySummaryRecommendations,
1860
+ buildCapabilityInventoryQuickFilters
1721
1861
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scene-capability-engine",
3
- "version": "3.6.24",
3
+ "version": "3.6.26",
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": {