scene-capability-engine 3.6.16 → 3.6.17

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,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.6.17] - 2026-03-06
11
+
12
+ ### Added
13
+ - Capability catalog/list/search/show/match/use payloads now expose `ontology_core_ui` for direct UI badge rendering.
14
+ - Magicball capability library guide now documents direct triad badge fields for list and match views.
15
+
10
16
  ## [3.6.16] - 2026-03-06
11
17
 
12
18
  ### Added
package/README.md CHANGED
@@ -218,5 +218,5 @@ MIT. See [LICENSE](LICENSE).
218
218
 
219
219
  ---
220
220
 
221
- **Version**: 3.6.16
221
+ **Version**: 3.6.17
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.16
221
+ **版本**:3.6.17
222
222
  **最后更新**:2026-03-05
@@ -1896,7 +1896,7 @@ Schema references:
1896
1896
 
1897
1897
  ### Capability Library Reuse (query -> match -> use)
1898
1898
 
1899
- `catalog/show/match/use` responses now include `ontology_core` so UI can render triad readiness directly.
1899
+ `catalog/list/search/show/match/use` responses now include `ontology_core` and `ontology_core_ui` so UI can render triad readiness directly.
1900
1900
 
1901
1901
  ```bash
1902
1902
  # List capability templates
@@ -90,6 +90,14 @@ sce capability use --template <template-id> --spec <spec-id> --apply --json
90
90
 
91
91
  ## 5. 输出结构(关键字段)
92
92
 
93
+ 列表、详情、匹配、使用计划里的模板对象都应直接消费:
94
+ - `ontology_core`
95
+ - `ontology_core_ui.ready`
96
+ - `ontology_core_ui.coverage_percent`
97
+ - `ontology_core_ui.missing`
98
+ - `ontology_core_ui.triads.entity_relation|business_rules|decision_strategy`
99
+
100
+
93
101
  ### capability-match
94
102
  ```json
95
103
  {
@@ -100,6 +108,16 @@ sce capability use --template <template-id> --spec <spec-id> --apply --json
100
108
  "matches": [
101
109
  {
102
110
  "template_id": "customer-order-core",
111
+ "ontology_core_ui": {
112
+ "ready": true,
113
+ "coverage_percent": 100,
114
+ "missing": [],
115
+ "triads": {
116
+ "entity_relation": true,
117
+ "business_rules": true,
118
+ "decision_strategy": true
119
+ }
120
+ },
103
121
  "score": 82,
104
122
  "score_components": {
105
123
  "ontology": 0.72,
@@ -407,6 +407,38 @@ function assertCoreOntologySummary(summary, contextLabel = 'capability template'
407
407
  );
408
408
  }
409
409
 
410
+ function buildOntologyCoreUiState(summary) {
411
+ const details = summary || buildCoreOntologySummary(createEmptyOntologyScope());
412
+ const labels = {
413
+ entity_relation: 'entity_relation',
414
+ business_rules: 'business_rules',
415
+ decision_strategy: 'decision_strategy'
416
+ };
417
+ return {
418
+ ready: details.ready === true,
419
+ coverage_ratio: Number(details.coverage_ratio || 0),
420
+ coverage_percent: Math.round(Number(details.coverage_ratio || 0) * 100),
421
+ missing: Array.isArray(details.missing) ? details.missing : [],
422
+ missing_labels: (Array.isArray(details.missing) ? details.missing : []).map((key) => labels[key] || key),
423
+ triads: {
424
+ entity_relation: Boolean(details.triads && details.triads.entity_relation && details.triads.entity_relation.passed),
425
+ business_rules: Boolean(details.triads && details.triads.business_rules && details.triads.business_rules.passed),
426
+ decision_strategy: Boolean(details.triads && details.triads.decision_strategy && details.triads.decision_strategy.passed)
427
+ }
428
+ };
429
+ }
430
+
431
+ function enrichCapabilityTemplateForUi(template) {
432
+ const ontologyCore = template && template.ontology_core
433
+ ? template.ontology_core
434
+ : buildCoreOntologySummary(template && template.ontology_scope ? template.ontology_scope : createEmptyOntologyScope());
435
+ return {
436
+ ...template,
437
+ ontology_core: ontologyCore,
438
+ ontology_core_ui: buildOntologyCoreUiState(ontologyCore)
439
+ };
440
+ }
441
+
410
442
  async function loadSceneIndexFromFile(projectPath, fileSystem) {
411
443
  const indexPath = path.join(projectPath, '.sce', 'spec-governance', 'scene-index.json');
412
444
  if (!await fileSystem.pathExists(indexPath)) {
@@ -912,7 +944,8 @@ function displayCapabilityCatalog(templates, options = {}) {
912
944
  }
913
945
  return;
914
946
  }
915
- templates.forEach((template) => {
947
+ templates.forEach((rawTemplate) => {
948
+ const template = enrichCapabilityTemplateForUi(rawTemplate);
916
949
  const sourcePrefix = template.source && template.source !== 'official'
917
950
  ? chalk.gray(`[${template.source}] `)
918
951
  : '';
@@ -926,13 +959,13 @@ function displayCapabilityCatalog(templates, options = {}) {
926
959
 
927
960
  async function listCapabilityCatalog(options = {}) {
928
961
  const manager = new TemplateManager();
929
- const templates = await manager.listTemplates({
962
+ const templates = (await manager.listTemplates({
930
963
  category: options.category,
931
964
  source: options.source,
932
965
  templateType: 'capability-template',
933
966
  compatibleWith: options.compatibleWith,
934
967
  riskLevel: options.risk
935
- });
968
+ })).map((template) => enrichCapabilityTemplateForUi(template));
936
969
  if (normalizeBoolean(options.json, false)) {
937
970
  return {
938
971
  mode: 'capability-catalog-list',
@@ -945,13 +978,13 @@ async function listCapabilityCatalog(options = {}) {
945
978
 
946
979
  async function searchCapabilityCatalog(keyword, options = {}) {
947
980
  const manager = new TemplateManager();
948
- const templates = await manager.searchTemplates(keyword, {
981
+ const templates = (await manager.searchTemplates(keyword, {
949
982
  category: options.category,
950
983
  source: options.source,
951
984
  templateType: 'capability-template',
952
985
  compatibleWith: options.compatibleWith,
953
986
  riskLevel: options.risk
954
- });
987
+ })).map((template) => enrichCapabilityTemplateForUi(template));
955
988
  if (normalizeBoolean(options.json, false)) {
956
989
  return {
957
990
  mode: 'capability-catalog-search',
@@ -965,7 +998,7 @@ async function searchCapabilityCatalog(keyword, options = {}) {
965
998
 
966
999
  async function showCapabilityTemplate(templatePath, options = {}) {
967
1000
  const manager = new TemplateManager();
968
- const template = await manager.showTemplate(templatePath);
1001
+ const template = enrichCapabilityTemplateForUi(await manager.showTemplate(templatePath));
969
1002
  const { sourceName, templateId } = parseTemplatePath(templatePath);
970
1003
  await manager.ensureCached(sourceName);
971
1004
  const sourcePath = manager.cacheManager.getSourceCachePath(sourceName);
@@ -1038,6 +1071,7 @@ async function matchCapabilityTemplates(options = {}) {
1038
1071
  category: template.category,
1039
1072
  risk_level: template.risk_level,
1040
1073
  ontology_core: template.ontology_core || buildCoreOntologySummary(template.ontology_scope || {}),
1074
+ ontology_core_ui: buildOntologyCoreUiState(template.ontology_core || buildCoreOntologySummary(template.ontology_scope || {})),
1041
1075
  score: Math.round(totalScore * 100),
1042
1076
  score_components: {
1043
1077
  ontology: Number(overlap.score.toFixed(3)),
@@ -1123,7 +1157,8 @@ async function useCapabilityTemplate(options = {}) {
1123
1157
  source: template.source,
1124
1158
  description: template.description,
1125
1159
  ontology_scope: template.ontology_scope || {},
1126
- ontology_core: template.ontology_core || buildCoreOntologySummary(template.ontology_scope || {})
1160
+ ontology_core: template.ontology_core || buildCoreOntologySummary(template.ontology_scope || {}),
1161
+ ontology_core_ui: buildOntologyCoreUiState(template.ontology_core || buildCoreOntologySummary(template.ontology_scope || {}))
1127
1162
  },
1128
1163
  spec_id: specId,
1129
1164
  recommended_tasks: recommendedTasks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scene-capability-engine",
3
- "version": "3.6.16",
3
+ "version": "3.6.17",
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": {