scene-capability-engine 3.6.65 → 3.6.67
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 +16 -0
- package/README.md +17 -6
- package/README.zh.md +18 -6
- package/bin/scene-capability-engine.js +4 -0
- package/docs/README.md +2 -2
- package/docs/command-reference.md +382 -6
- package/docs/document-governance.md +3 -2
- package/docs/integration-modes.md +62 -478
- package/docs/integration-philosophy.md +56 -263
- package/docs/magicball-project-portfolio-contract.md +114 -2
- package/docs/project-management/README.md +14 -0
- package/docs/project-management/assurance/backup.md +3 -0
- package/docs/project-management/assurance/config.md +3 -0
- package/docs/project-management/assurance/evidence/README.md +3 -0
- package/docs/project-management/assurance/incidents/README.md +3 -0
- package/docs/project-management/assurance/logs.md +3 -0
- package/docs/project-management/assurance/overview.md +3 -0
- package/docs/project-management/assurance/recovery/README.md +3 -0
- package/docs/project-management/assurance/resource.md +3 -0
- package/docs/project-management/assurance/runbooks/README.md +3 -0
- package/docs/project-management/delivery/acceptance/README.md +3 -0
- package/docs/project-management/delivery/acceptance/evidence/README.md +3 -0
- package/docs/project-management/delivery/acceptance/exceptions/README.md +3 -0
- package/docs/project-management/delivery/acceptance/reports/README.md +3 -0
- package/docs/project-management/delivery/documents/changes.md +3 -0
- package/docs/project-management/delivery/documents/issues.md +3 -0
- package/docs/project-management/delivery/documents/overview.md +3 -0
- package/docs/project-management/delivery/documents/planning.md +3 -0
- package/docs/project-management/delivery/documents/requirements.md +3 -0
- package/docs/project-management/delivery/documents/tracking.md +3 -0
- package/docs/project-management/delivery/handoffs/README.md +3 -0
- package/docs/project-management/delivery/handoffs/evidence/README.md +3 -0
- package/docs/project-management/delivery/handoffs/records/README.md +3 -0
- package/docs/project-management/delivery/overview.md +10 -0
- package/docs/project-management/delivery/releases/README.md +3 -0
- package/docs/project-management/delivery/releases/baselines/README.md +3 -0
- package/docs/project-management/delivery/releases/evidence/README.md +3 -0
- package/docs/project-management/delivery/tables/changes.md +3 -0
- package/docs/project-management/delivery/tables/issues.md +3 -0
- package/docs/project-management/delivery/tables/planning.md +3 -0
- package/docs/project-management/delivery/tables/requirements.md +3 -0
- package/docs/project-management/delivery/tables/tracking.md +3 -0
- package/docs/project-management/environment/agent-discovery.md +3 -0
- package/docs/project-management/environment/development.md +3 -0
- package/docs/project-management/environment/overview.md +10 -0
- package/docs/project-management/environment/testing.md +3 -0
- package/docs/project-management/environment/version-alignment.md +3 -0
- package/docs/quick-start-with-ai-tools.md +68 -308
- package/docs/releases/README.md +2 -0
- package/docs/releases/v3.6.66.md +23 -0
- package/docs/releases/v3.6.67.md +23 -0
- package/docs/steering-governance.md +64 -2
- package/docs/zh/README.md +2 -2
- package/docs/zh/releases/README.md +2 -0
- package/docs/zh/releases/v3.6.66.md +23 -0
- package/docs/zh/releases/v3.6.67.md +23 -0
- package/lib/commands/adopt.js +24 -0
- package/lib/commands/native.js +158 -0
- package/lib/commands/project.js +95 -0
- package/lib/commands/semantic.js +1459 -0
- package/lib/commands/session.js +74 -3
- package/lib/commands/spec-bootstrap.js +10 -1
- package/lib/commands/spec-gate.js +10 -1
- package/lib/commands/spec-pipeline.js +10 -1
- package/lib/commands/studio.js +405 -30
- package/lib/commands/task.js +141 -7
- package/lib/governance/supreme-principles.js +530 -0
- package/lib/problem/problem-evaluator.js +4 -0
- package/lib/project/candidate-inspection-service.js +24 -1
- package/lib/project/portfolio-projection-service.js +315 -5
- package/lib/project/project-channel-output.js +94 -0
- package/lib/project/project-channel-projection.js +181 -0
- package/lib/project/root-onboarding-service.js +60 -8
- package/lib/project/semantic-shared-source-projection.js +150 -0
- package/lib/project/supervision-action-model.js +277 -0
- package/lib/project/supervision-projection-service.js +305 -5
- package/lib/project/target-resolution-service.js +70 -5
- package/lib/project/visibility-policy.js +93 -0
- package/lib/runtime/multi-spec-scene-session.js +8 -1
- package/lib/runtime/project-channel-context-store.js +387 -0
- package/lib/runtime/project-channel-context.js +406 -0
- package/lib/runtime/scene-session-binding.js +46 -0
- package/lib/runtime/session-store.js +186 -0
- package/lib/runtime/steering-contract.js +7 -1
- package/lib/semantic/archive-report.js +283 -0
- package/lib/semantic/archive-routing.js +67 -0
- package/lib/semantic/backflow-report.js +245 -0
- package/lib/semantic/capability-contract.js +30 -0
- package/lib/semantic/delta-export.js +145 -0
- package/lib/semantic/interaction-observer.js +254 -0
- package/lib/semantic/kernel-loader.js +881 -0
- package/lib/semantic/native-runtime.js +359 -0
- package/lib/semantic/progress-ledger.js +433 -0
- package/lib/semantic/replay-evaluator.js +382 -0
- package/lib/semantic/shared-publication.js +592 -0
- package/lib/semantic/shared-source-config.js +183 -0
- package/lib/semantic/shared-source-connect.js +139 -0
- package/lib/semantic/shared-source-discovery.js +98 -0
- package/lib/semantic/shared-sync-export.js +413 -0
- package/lib/semantic/shared-sync-intake.js +592 -0
- package/lib/semantic/shared-sync-merge.js +547 -0
- package/lib/semantic/shared-sync-release.js +463 -0
- package/lib/semantic/supreme-intent-report.js +300 -0
- package/lib/state/sce-state-store.js +1360 -0
- package/lib/steering/context-sync-manager.js +276 -25
- package/lib/studio/spec-intake-governor.js +39 -3
- package/lib/studio/task-envelope.js +35 -2
- package/lib/workspace/takeover-baseline.js +342 -83
- package/package.json +7 -2
- package/scripts/agent-governance-baseline-audit.js +395 -0
- package/scripts/clarification-first-audit.js +9 -9
- package/scripts/deprecated-entry-audit.js +240 -0
- package/scripts/release-posture-report.js +262 -0
- package/template/.sce/README.md +62 -228
- package/template/.sce/config/semantic-shared-sources.json +5 -0
- package/template/.sce/config/supreme-principles-policy.json +105 -0
- package/template/.sce/config/takeover-baseline.json +7 -0
- package/template/.sce/steering/CORE_PRINCIPLES.md +23 -63
- package/template/.sce/steering/CURRENT_CONTEXT.md +4 -0
- package/template/.sce/steering/RULES_GUIDE.md +17 -9
- package/template/README.md +32 -96
|
@@ -13,89 +13,131 @@ const {
|
|
|
13
13
|
const {
|
|
14
14
|
DEFAULT_CONFIG: MULTI_AGENT_CONFIG_DEFAULTS
|
|
15
15
|
} = require('../collab/multi-agent-config');
|
|
16
|
+
const { discoverSemanticSharedSourceDescriptors } = require('../semantic/shared-source-discovery');
|
|
16
17
|
|
|
17
18
|
const TAKEOVER_BASELINE_SCHEMA_VERSION = '1.0';
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
'',
|
|
22
|
-
'-
|
|
23
|
-
'-
|
|
24
|
-
'-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const NO_BLIND_FIX_CORE_PRINCIPLE_SECTION = [
|
|
29
|
-
NO_BLIND_FIX_CORE_PRINCIPLE_HEADING,
|
|
30
|
-
'',
|
|
31
|
-
'- 修改问题前,必须先明确现象、复现条件、影响范围、预期行为和验证方式。',
|
|
32
|
-
'- 缺少日志、数据、接口样本、最小复现或问题契约时,应先补证据,不得靠猜测连续改代码碰运气。',
|
|
33
|
-
'- 若两轮修改仍未收敛,必须回到调试、定位和根因分析,禁止在未理解问题前盲目扩大改动面。'
|
|
34
|
-
].join('\n');
|
|
35
|
-
const STEERING_CHANGE_EVALUATION_CORE_PRINCIPLE_HEADING = '## 13. Steering 条目变更必须先评估,禁止随意增删';
|
|
36
|
-
const STEERING_CHANGE_EVALUATION_CORE_PRINCIPLE_SECTION = [
|
|
37
|
-
STEERING_CHANGE_EVALUATION_CORE_PRINCIPLE_HEADING,
|
|
38
|
-
'',
|
|
39
|
-
'- 新增、删除或重写 steering 条目前,必须先评估它是否真属于长期原则,是否与现有条目重复,是否应迁移到 `CURRENT_CONTEXT.md`、Spec 或项目文档。',
|
|
40
|
-
'- steering 变更必须说明触发原因、适用范围以及与现有规则的关系;未经评估,不得把临时偏好、短期任务或偶发结论直接固化进去。',
|
|
41
|
-
'- 接管、升级和治理脚本只能补齐基线、修复漂移,不能把未经评估的项目习惯直接塞进 steering。'
|
|
42
|
-
].join('\n');
|
|
43
|
-
const BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_HEADING = '## 14. 问题修复时前后端接口不一致默认以后端契约为准';
|
|
44
|
-
const BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_SECTION = [
|
|
45
|
-
BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_HEADING,
|
|
19
|
+
const FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_HEADING = '## 1. 四句教:先判断该不该做';
|
|
20
|
+
const FOUR_SENTENCE_TEACHING_REQUIRED_LINES = Object.freeze([
|
|
21
|
+
'- 世界观:无善无恶心之始。先回到事情本身,识别真实意图、对象和边界,不用情绪、惯性或旧立场替代事实。',
|
|
22
|
+
'- 人生观:有善有恶意之动。一旦进入行动意图,就要判断该意图是否会伤害人、破坏秩序、规避责任或制造不当利益。',
|
|
23
|
+
'- 价值观:知善知恶是良知。必须主动辨别请求是否符合基本伦理、法律、合规和长期正当性,而不是只看能不能做。',
|
|
24
|
+
'- 方法论:为善去恶是格物。只有符合最高道德规范和治理边界的事情,才允许进入执行;不正当、有害或失范目标必须拒绝、收缩或改写为正当目标。',
|
|
25
|
+
'- 四句教用于判断用户让 SCE 做的事是否符合最高道德规范;只有通过这道门槛的事项,才允许调用“小九条”进入执行。'
|
|
26
|
+
]);
|
|
27
|
+
const FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_SECTION = [
|
|
28
|
+
FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_HEADING,
|
|
46
29
|
'',
|
|
47
|
-
|
|
48
|
-
'- 除非明确要求新建接口或修改后端接口,否则禁止为了迁就前端错误调用去随意改后端实现或契约。',
|
|
49
|
-
'- 默认优先修正前端请求、映射、类型和兼容处理,使其与后端接口保持一致;若怀疑后端契约错误,应先确认再改。'
|
|
30
|
+
...FOUR_SENTENCE_TEACHING_REQUIRED_LINES
|
|
50
31
|
].join('\n');
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
'-
|
|
54
|
-
'-
|
|
55
|
-
'-
|
|
56
|
-
'-
|
|
32
|
+
const SUPREME_ONLY_CORE_PRINCIPLE_HEADING = '## 2. 最高原则只保留四句教 + 小九条';
|
|
33
|
+
const SUPREME_ONLY_CORE_PRINCIPLE_REQUIRED_LINES = Object.freeze([
|
|
34
|
+
'- `CORE_PRINCIPLES.md` 只保留能直接决定该不该做、做事方向、判断质量和收敛效率的最高原则,不再堆放执行细则、门禁清单、策略阈值或场景化约束。',
|
|
35
|
+
'- 长期治理基线写入 `RULES_GUIDE.md`;项目经验、案例、阈值和方法论写入 `docs/steering-governance.md` 或 `.sce/knowledge/lessons/`;当前状态写入 `CURRENT_CONTEXT.md`。',
|
|
36
|
+
'- 四句教负责先判断“这件事该不该做、是否正当”;小九条负责在目标正当后,判断“这件事如何高质量地做成”。',
|
|
37
|
+
'- 若某条内容不能直接提升道德判断、目标理解、调查质量、判断质量或闭环效率,就不应继续占用最高原则层。'
|
|
57
38
|
]);
|
|
58
|
-
const
|
|
59
|
-
|
|
39
|
+
const SUPREME_ONLY_CORE_PRINCIPLE_SECTION = [
|
|
40
|
+
SUPREME_ONLY_CORE_PRINCIPLE_HEADING,
|
|
60
41
|
'',
|
|
61
|
-
...
|
|
42
|
+
...SUPREME_ONLY_CORE_PRINCIPLE_REQUIRED_LINES
|
|
62
43
|
].join('\n');
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
44
|
+
const LITTLE_NINE_CORE_PRINCIPLE_HEADING = '## 3. 小九条:把正确的事正确地做成';
|
|
45
|
+
const LITTLE_NINE_REQUIRED_LINES = Object.freeze([
|
|
46
|
+
'- 勤奋推进,不偷懒,不跳步;在无需用户额外干预时,按第一性原理先做计划并自主持续推进,始终沿关键路径连续推进分析、实现、验证、修复和交付,不靠省略环节伪装完成。',
|
|
47
|
+
'- 先准确领会你的真实意图,不拿旧判断、旧上下文或上一轮结论硬套现状;先校正目标,再展开动作。',
|
|
48
|
+
'- 主动调查研究,先看代码、数据、日志、配置和现场事实,再下结论;没有证据时先补证据。',
|
|
49
|
+
'- 保持项目活地图,持续知道当前结构、边界、依赖、关键约束和主要风险点;每次落刀前都要知道改动会影响哪里。',
|
|
50
|
+
'- 对问题想够想透,优先处理根因、连带影响和系统收敛路径,不做表面修补,也不把复杂问题压扁成局部补丁。',
|
|
51
|
+
'- 在证据足够时敢于下判断并推进下一步;结论可以修正,但不能在没有新证据时反复摇摆空转。',
|
|
52
|
+
'- 推进时必须统筹已有 Spec、`errorbook`(错题本)、测试、现状代码和你的关注点,保证目标、实现、验证和经验沉淀同向收敛。',
|
|
53
|
+
'- 遇到问题先主动拆解、定位和缩小范围;只有真正外部阻塞、权限缺口或目标冲突时才升级,不得轻易把阻塞甩回来。',
|
|
54
|
+
'- 保持连续作战能力,按断点记录和恢复,持续收敛直到形成可验证闭环;除非触发高风险、权限边界或目标冲突,否则不中途停在“等你指示”,任何中断都不能让上下文重新归零。'
|
|
55
|
+
]);
|
|
56
|
+
const LITTLE_NINE_CORE_PRINCIPLE_SECTION = [
|
|
57
|
+
LITTLE_NINE_CORE_PRINCIPLE_HEADING,
|
|
66
58
|
'',
|
|
67
|
-
|
|
68
|
-
'- 若项目尚未建立自己的阈值,默认参考源文件 `2000 / 4000 / 10000` 行三档触发:分别对应“必须评估”“必须发起重构收敛”“进入红线区”。',
|
|
69
|
-
'- 达到项目级或默认阈值后,后续改动必须优先评估拆分模块、服务、命令面或数据职责;超过重构/红线阈值时,不得继续无计划堆积复杂度。',
|
|
70
|
-
'- 项目开始较小时,阈值应更早触发;项目进入长期演进后,也必须按周或发布前重新评估,而不是让早期设定永久失效。',
|
|
71
|
-
'- 行数阈值只是强触发信号,不代表低于阈值就可以忽略耦合、职责混杂、测试失控和理解成本问题;若复杂度已明显失控,应提前启动重构。'
|
|
59
|
+
...LITTLE_NINE_REQUIRED_LINES
|
|
72
60
|
].join('\n');
|
|
73
61
|
const REQUIRED_CORE_PRINCIPLE_SECTIONS = Object.freeze([
|
|
74
62
|
{
|
|
75
|
-
heading:
|
|
76
|
-
section:
|
|
63
|
+
heading: FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_HEADING,
|
|
64
|
+
section: FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_SECTION
|
|
77
65
|
},
|
|
78
66
|
{
|
|
79
|
-
heading:
|
|
80
|
-
section:
|
|
67
|
+
heading: SUPREME_ONLY_CORE_PRINCIPLE_HEADING,
|
|
68
|
+
section: SUPREME_ONLY_CORE_PRINCIPLE_SECTION
|
|
81
69
|
},
|
|
82
70
|
{
|
|
83
|
-
heading:
|
|
84
|
-
section:
|
|
85
|
-
}
|
|
71
|
+
heading: LITTLE_NINE_CORE_PRINCIPLE_HEADING,
|
|
72
|
+
section: LITTLE_NINE_CORE_PRINCIPLE_SECTION
|
|
73
|
+
}
|
|
74
|
+
]);
|
|
75
|
+
const REQUIRED_CORE_PRINCIPLE_SECTION_LINES = Object.freeze([
|
|
86
76
|
{
|
|
87
|
-
heading:
|
|
88
|
-
|
|
77
|
+
heading: FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_HEADING,
|
|
78
|
+
lines: FOUR_SENTENCE_TEACHING_REQUIRED_LINES
|
|
89
79
|
},
|
|
90
80
|
{
|
|
91
|
-
heading:
|
|
92
|
-
|
|
81
|
+
heading: SUPREME_ONLY_CORE_PRINCIPLE_HEADING,
|
|
82
|
+
lines: SUPREME_ONLY_CORE_PRINCIPLE_REQUIRED_LINES
|
|
93
83
|
},
|
|
94
84
|
{
|
|
95
|
-
heading:
|
|
96
|
-
|
|
85
|
+
heading: LITTLE_NINE_CORE_PRINCIPLE_HEADING,
|
|
86
|
+
lines: LITTLE_NINE_REQUIRED_LINES
|
|
97
87
|
}
|
|
98
88
|
]);
|
|
89
|
+
const RULES_GUIDE_BASELINE_HEADING = '## 治理基线(非最高原则)';
|
|
90
|
+
const SPEC_ARTIFACT_RULE_GUIDE_LINE = '- 所有需求先落 Spec;所有由 Agent 生成的脚本、报告、诊断、调试日志、测试脚本、临时分析和验证产物默认归档到当前 `.sce/specs/<spec>/` 的对应子目录;没有明确 Spec 时先使用通用 Spec 承接。';
|
|
91
|
+
const ERRORBOOK_CONVERGENCE_RULE_GUIDE_LINE = '- 连续两轮以上仍未成功定位或验证问题时,先在 `errorbook` 记录或更新 incident,再用二分法配合 debug 日志/埋点快速收敛范围,不继续盲改。';
|
|
92
|
+
const CLARIFICATION_FIRST_RULE_GUIDE_LINE = '- 业务场景未知时先澄清,不得把未知范围直接变成一刀切禁用;修改问题前先建立问题契约和证据,不得靠猜测碰运气。';
|
|
93
|
+
const DELIVERY_SYNC_RULE_GUIDE_LINE = '- 代码、测试、文档必须同步闭环;重要功能、命令、配置变化必须同步更新说明,发布前不得带着失败验证前进。';
|
|
94
|
+
const MECHANISM_REUSE_RULE_GUIDE_LINE = '- Steering 变更先评估;已有机制优先复用,不得在 steering 中平行造轮子,尤其不得再造一套独立于 `errorbook` 的问题沉淀机制。';
|
|
95
|
+
const KNOWLEDGE_SINK_RULE_GUIDE_LINE = '- 可复用执行经验、阈值、案例和策略,优先写入 `docs/steering-governance.md` 或 `.sce/knowledge/lessons/`,不要回灌到最高原则层。';
|
|
96
|
+
const RULES_GUIDE_REQUIRED_LINES = Object.freeze([
|
|
97
|
+
SPEC_ARTIFACT_RULE_GUIDE_LINE,
|
|
98
|
+
ERRORBOOK_CONVERGENCE_RULE_GUIDE_LINE,
|
|
99
|
+
CLARIFICATION_FIRST_RULE_GUIDE_LINE,
|
|
100
|
+
DELIVERY_SYNC_RULE_GUIDE_LINE,
|
|
101
|
+
MECHANISM_REUSE_RULE_GUIDE_LINE,
|
|
102
|
+
KNOWLEDGE_SINK_RULE_GUIDE_LINE
|
|
103
|
+
]);
|
|
104
|
+
const RULES_GUIDE_BASELINE_SECTION = [
|
|
105
|
+
RULES_GUIDE_BASELINE_HEADING,
|
|
106
|
+
'',
|
|
107
|
+
...RULES_GUIDE_REQUIRED_LINES
|
|
108
|
+
].join('\n');
|
|
109
|
+
const REQUIRED_RULES_GUIDE_SECTIONS = Object.freeze([
|
|
110
|
+
{
|
|
111
|
+
heading: RULES_GUIDE_BASELINE_HEADING,
|
|
112
|
+
section: RULES_GUIDE_BASELINE_SECTION
|
|
113
|
+
}
|
|
114
|
+
]);
|
|
115
|
+
const REQUIRED_RULES_GUIDE_SECTION_LINES = Object.freeze([
|
|
116
|
+
{
|
|
117
|
+
heading: RULES_GUIDE_BASELINE_HEADING,
|
|
118
|
+
lines: RULES_GUIDE_REQUIRED_LINES
|
|
119
|
+
}
|
|
120
|
+
]);
|
|
121
|
+
const LEGACY_CORE_PRINCIPLE_HEADINGS = Object.freeze([
|
|
122
|
+
'## 1. Steering 分层必须稳定',
|
|
123
|
+
'## 2. 所有需求先落 Spec',
|
|
124
|
+
'## 3. 默认自主闭环推进',
|
|
125
|
+
'## 4. 复用已有 SCE 能力,不得平行造轮子',
|
|
126
|
+
'## 5. 质量问题必须追根,不允许伪修复',
|
|
127
|
+
'## 6. 测试、文档、代码必须同步闭环',
|
|
128
|
+
'## 7. 单一事实源优先',
|
|
129
|
+
'## 8. Git 托管与发版门禁默认启用',
|
|
130
|
+
'## 9. 开发测试环境默认授权',
|
|
131
|
+
'## 10. Steering 自身必须定期净化',
|
|
132
|
+
'## 11. 业务场景未知时必须先澄清,禁止直接彻底禁用',
|
|
133
|
+
'## 12. 禁止盲改问题,必须先建立问题契约和证据',
|
|
134
|
+
'## 13. Steering 条目变更必须先评估,禁止随意增删',
|
|
135
|
+
'## 14. 问题修复时前后端接口不一致默认以后端契约为准',
|
|
136
|
+
'## 15. 单文件规模过大必须触发重构评估,禁止无限堆积',
|
|
137
|
+
'## 1. 最高原则只保留小九条',
|
|
138
|
+
'## 2. 小九条:最高原则与默认执行姿态',
|
|
139
|
+
'## 16. 小九条:默认执行姿态必须成立'
|
|
140
|
+
]);
|
|
99
141
|
|
|
100
142
|
const ERRORBOOK_REGISTRY_DEFAULTS = Object.freeze({
|
|
101
143
|
enabled: true,
|
|
@@ -122,6 +164,12 @@ const ERRORBOOK_REGISTRY_DEFAULTS = Object.freeze({
|
|
|
122
164
|
]
|
|
123
165
|
});
|
|
124
166
|
|
|
167
|
+
const SEMANTIC_SHARED_SOURCE_DEFAULTS = Object.freeze({
|
|
168
|
+
enabled: true,
|
|
169
|
+
mirror_root: '.sce/knowledge/semantic-shared',
|
|
170
|
+
sources: []
|
|
171
|
+
});
|
|
172
|
+
|
|
125
173
|
const ERRORBOOK_CONVERGENCE_DEFAULTS = Object.freeze({
|
|
126
174
|
enabled: true,
|
|
127
175
|
canonical_mechanism: 'errorbook',
|
|
@@ -294,6 +342,11 @@ const STUDIO_INTAKE_POLICY_DEFAULTS = Object.freeze({
|
|
|
294
342
|
override_file: '.sce/spec-governance/spec-scene-overrides.json',
|
|
295
343
|
rules: [
|
|
296
344
|
{ id: 'moqui-core', scene_id: 'scene.moqui-core', keywords: ['moqui'] },
|
|
345
|
+
{
|
|
346
|
+
id: 'semantic-kernel',
|
|
347
|
+
scene_id: 'scene.sce-semantic-kernel',
|
|
348
|
+
keywords: ['semantic', 'dialogue', 'conversation', 'reply', 'prompt', 'self-eval', 'simulation', 'codex cli', 'claude code', 'kiro', 'standalone sce']
|
|
349
|
+
},
|
|
297
350
|
{ id: 'orchestration', scene_id: 'scene.sce-orchestration', keywords: ['orchestrate', 'runtime', 'controller', 'batch', 'parallel'] },
|
|
298
351
|
{ id: 'template-registry', scene_id: 'scene.sce-template-registry', keywords: ['template', 'scene-package', 'registry', 'catalog', 'scene-template'] },
|
|
299
352
|
{ id: 'spec-governance', scene_id: 'scene.sce-spec-governance', keywords: ['spec', 'gate', 'ontology', 'governance', 'policy'] },
|
|
@@ -304,6 +357,56 @@ const STUDIO_INTAKE_POLICY_DEFAULTS = Object.freeze({
|
|
|
304
357
|
}
|
|
305
358
|
});
|
|
306
359
|
|
|
360
|
+
const SUPREME_PRINCIPLES_POLICY_DEFAULTS = Object.freeze({
|
|
361
|
+
schema_version: '1.0',
|
|
362
|
+
enabled: true,
|
|
363
|
+
allow_planning_actions: ['allow', 'clarify', 'rewrite', 'narrow'],
|
|
364
|
+
allow_execution_actions: ['allow', 'rewrite', 'narrow'],
|
|
365
|
+
clarify_question: '请先明确你真正要达成的业务目标、作用对象和约束边界。',
|
|
366
|
+
refuse_message: '该请求不符合 SCE 的最高道德规范,不能直接执行。',
|
|
367
|
+
rewrite_message: '原始请求存在失范或越界风险,已收敛为可正当执行的目标。',
|
|
368
|
+
narrow_message: '原始请求风险过高,已收缩为审查、备份、验证优先的安全目标。',
|
|
369
|
+
refuse_rules: [
|
|
370
|
+
{
|
|
371
|
+
id: 'credential-theft',
|
|
372
|
+
keywords: ['steal password', 'dump token', 'exfiltrate', 'keylogger', 'phish', '窃取密码', '盗取令牌', '导出凭证'],
|
|
373
|
+
reason: '请求明显指向凭证盗取、数据外流或钓鱼等恶意行为。'
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
id: 'malware-abuse',
|
|
377
|
+
keywords: ['malware', 'ransomware', 'backdoor', 'payload', '木马', '勒索软件', '后门'],
|
|
378
|
+
reason: '请求明显指向恶意控制、破坏或持久化投毒。'
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
id: 'audit-evasion',
|
|
382
|
+
keywords: ['delete logs to hide', 'evade audit', 'disable audit trail', '清除日志掩盖', '绕过审计', '删除审计日志'],
|
|
383
|
+
reason: '请求明显指向规避责任、破坏审计或掩盖痕迹。'
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
rewrite_rules: [
|
|
387
|
+
{
|
|
388
|
+
id: 'auth-bypass-to-safe-test-fixture',
|
|
389
|
+
keywords: ['disable auth', 'bypass auth', 'skip login', 'skip approval', '关闭认证', '绕过认证', '跳过登录', '跳过审批'],
|
|
390
|
+
replacement: 'Design a dev/test-only mechanism with explicit scope guard, audit trail, rollback plan, and no production bypass of authentication or approval controls.',
|
|
391
|
+
reason: '将越界的“绕过保护”目标改写为受边界约束的测试/诊断机制。'
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: 'remove-audit-to-safe-observability',
|
|
395
|
+
keywords: ['remove audit', 'turn off audit', 'delete logs', '关闭审计', '删除日志', '去掉审计'],
|
|
396
|
+
replacement: 'Design a safe observability adjustment that preserves required auditability, keeps retention boundaries, and reduces noise without deleting accountability evidence.',
|
|
397
|
+
reason: '将“去掉审计/日志”改写为保留责任边界的可观测性优化目标。'
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
narrow_rules: [
|
|
401
|
+
{
|
|
402
|
+
id: 'destructive-production-change',
|
|
403
|
+
keywords: ['drop database', 'delete production data', 'truncate table', '删除生产数据', '清空数据表', '删库'],
|
|
404
|
+
replacement: 'Review the destructive change request, produce backup and rollback steps, verify scope, and require explicit confirmation before any irreversible data operation.',
|
|
405
|
+
reason: '高风险破坏性操作必须先收缩为审查、备份和回滚准备。'
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
});
|
|
409
|
+
|
|
307
410
|
const TAKEOVER_DEFAULTS = Object.freeze({
|
|
308
411
|
autonomous: {
|
|
309
412
|
enabled: true,
|
|
@@ -381,7 +484,21 @@ const TAKEOVER_DEFAULTS = Object.freeze({
|
|
|
381
484
|
enabled: true,
|
|
382
485
|
active_only_default: true,
|
|
383
486
|
default_scene_id: 'scene.sce-core',
|
|
384
|
-
override_file: '.sce/spec-governance/spec-scene-overrides.json'
|
|
487
|
+
override_file: '.sce/spec-governance/spec-scene-overrides.json',
|
|
488
|
+
rules: [
|
|
489
|
+
{ id: 'moqui-core', scene_id: 'scene.moqui-core', keywords: ['moqui'] },
|
|
490
|
+
{
|
|
491
|
+
id: 'semantic-kernel',
|
|
492
|
+
scene_id: 'scene.sce-semantic-kernel',
|
|
493
|
+
keywords: ['semantic', 'dialogue', 'conversation', 'reply', 'prompt', 'self-eval', 'simulation', 'codex cli', 'claude code', 'kiro', 'standalone sce']
|
|
494
|
+
},
|
|
495
|
+
{ id: 'orchestration', scene_id: 'scene.sce-orchestration', keywords: ['orchestrate', 'runtime', 'controller', 'batch', 'parallel'] },
|
|
496
|
+
{ id: 'template-registry', scene_id: 'scene.sce-template-registry', keywords: ['template', 'scene-package', 'registry', 'catalog', 'scene-template'] },
|
|
497
|
+
{ id: 'spec-governance', scene_id: 'scene.sce-spec-governance', keywords: ['spec', 'gate', 'ontology', 'governance', 'policy'] },
|
|
498
|
+
{ id: 'quality', scene_id: 'scene.sce-quality', keywords: ['test', 'quality', 'stability', 'jest', 'coverage'] },
|
|
499
|
+
{ id: 'docs', scene_id: 'scene.sce-docs', keywords: ['document', 'documentation', 'onboarding', 'guide'] },
|
|
500
|
+
{ id: 'platform', scene_id: 'scene.sce-platform', keywords: ['adopt', 'upgrade', 'workspace', 'repo', 'environment', 'devops', 'release', 'github', 'npm'] }
|
|
501
|
+
]
|
|
385
502
|
}
|
|
386
503
|
},
|
|
387
504
|
debug_policy: {
|
|
@@ -389,6 +506,18 @@ const TAKEOVER_DEFAULTS = Object.freeze({
|
|
|
389
506
|
max_direct_fix_rounds_before_debug: 2,
|
|
390
507
|
forbid_bypass_workarounds: true
|
|
391
508
|
},
|
|
509
|
+
supreme_principles: {
|
|
510
|
+
enabled: true,
|
|
511
|
+
allow_planning_actions: ['allow', 'clarify', 'rewrite', 'narrow'],
|
|
512
|
+
allow_execution_actions: ['allow', 'rewrite', 'narrow']
|
|
513
|
+
},
|
|
514
|
+
semantic_learning: {
|
|
515
|
+
enabled: true,
|
|
516
|
+
consent_model: 'adopt-implied',
|
|
517
|
+
auto_publish_qualified_delta: true,
|
|
518
|
+
publish_on_promotion: true,
|
|
519
|
+
shared_library_mirror_root: '.sce/knowledge/semantic-shared'
|
|
520
|
+
},
|
|
392
521
|
collaboration: {
|
|
393
522
|
multi_user_mode: true,
|
|
394
523
|
multi_agent: _clone(MULTI_AGENT_CONFIG_DEFAULTS)
|
|
@@ -555,6 +684,14 @@ function _buildErrorbookRegistryConfig(existing) {
|
|
|
555
684
|
};
|
|
556
685
|
}
|
|
557
686
|
|
|
687
|
+
function _buildSemanticSharedSourceConfig(existing) {
|
|
688
|
+
return _deepMerge(_isObject(existing) ? existing : {}, SEMANTIC_SHARED_SOURCE_DEFAULTS);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
function _buildSupremePrinciplesPolicyConfig(existing) {
|
|
692
|
+
return _deepMerge(_isObject(existing) ? existing : {}, SUPREME_PRINCIPLES_POLICY_DEFAULTS);
|
|
693
|
+
}
|
|
694
|
+
|
|
558
695
|
function _buildProjectSharedErrorbookRegistry(existing, projectPath, nowIso, config = {}) {
|
|
559
696
|
const projection = _isObject(config.project_shared_projection)
|
|
560
697
|
? config.project_shared_projection
|
|
@@ -822,27 +959,65 @@ function _appendLinesToSection(content, heading, lines) {
|
|
|
822
959
|
return `${content.slice(0, startIndex)}${updatedSection}${content.slice(sectionEnd)}`;
|
|
823
960
|
}
|
|
824
961
|
|
|
962
|
+
function _removeSection(content, heading) {
|
|
963
|
+
if (!content || !heading) {
|
|
964
|
+
return content;
|
|
965
|
+
}
|
|
966
|
+
const startIndex = content.indexOf(heading);
|
|
967
|
+
if (startIndex === -1) {
|
|
968
|
+
return content;
|
|
969
|
+
}
|
|
970
|
+
const nextHeadingIndex = content.indexOf('\n## ', startIndex + heading.length);
|
|
971
|
+
const sectionEnd = nextHeadingIndex === -1 ? content.length : nextHeadingIndex + 1;
|
|
972
|
+
let nextContent = `${content.slice(0, startIndex)}${content.slice(sectionEnd)}`;
|
|
973
|
+
nextContent = nextContent.replace(/\n{3,}/g, '\n\n').trim();
|
|
974
|
+
return nextContent ? `${nextContent}\n` : '';
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function _stripLegacyCorePrincipleSections(content) {
|
|
978
|
+
let nextContent = `${content || ''}`;
|
|
979
|
+
const removedHeadings = [];
|
|
980
|
+
for (const heading of LEGACY_CORE_PRINCIPLE_HEADINGS) {
|
|
981
|
+
if (!nextContent.includes(heading)) {
|
|
982
|
+
continue;
|
|
983
|
+
}
|
|
984
|
+
removedHeadings.push(heading);
|
|
985
|
+
nextContent = _removeSection(nextContent, heading);
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
content: nextContent.trimEnd(),
|
|
989
|
+
removedHeadings
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
|
|
825
993
|
async function _reconcileCorePrinciplesBaseline(projectPath, options = {}) {
|
|
826
994
|
const { apply, fileSystem } = options;
|
|
827
995
|
const corePrinciplesPath = path.join(projectPath, SCE_STEERING_DIR, DEFAULT_LAYER_FILES.core_principles);
|
|
828
996
|
const exists = await fileSystem.pathExists(corePrinciplesPath);
|
|
829
997
|
const existingContent = exists ? await fileSystem.readFile(corePrinciplesPath, 'utf8') : '';
|
|
830
|
-
const
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
998
|
+
const normalized = _stripLegacyCorePrincipleSections(existingContent);
|
|
999
|
+
const workingContent = normalized.content;
|
|
1000
|
+
const missingSections = REQUIRED_CORE_PRINCIPLE_SECTIONS.filter(({ heading }) => !workingContent.includes(heading));
|
|
1001
|
+
const missingSectionLines = REQUIRED_CORE_PRINCIPLE_SECTION_LINES
|
|
1002
|
+
.map(({ heading, lines }) => ({
|
|
1003
|
+
heading,
|
|
1004
|
+
lines: workingContent.includes(heading)
|
|
1005
|
+
? lines.filter((line) => !workingContent.includes(line))
|
|
1006
|
+
: []
|
|
1007
|
+
}))
|
|
1008
|
+
.filter((item) => item.lines.length > 0);
|
|
1009
|
+
const changed = normalized.removedHeadings.length > 0 || missingSections.length > 0 || missingSectionLines.length > 0;
|
|
835
1010
|
|
|
836
1011
|
if (apply && changed) {
|
|
837
|
-
let nextContent = `${
|
|
1012
|
+
let nextContent = `${workingContent || ''}`.trimEnd();
|
|
838
1013
|
const appendedSections = missingSections.map((item) => item.section).join('\n\n');
|
|
839
1014
|
if (appendedSections) {
|
|
840
1015
|
nextContent = nextContent
|
|
841
1016
|
? `${nextContent}\n\n${appendedSections}`
|
|
842
1017
|
: appendedSections;
|
|
843
1018
|
}
|
|
844
|
-
|
|
845
|
-
nextContent = _appendLinesToSection(nextContent,
|
|
1019
|
+
for (const item of missingSectionLines) {
|
|
1020
|
+
nextContent = _appendLinesToSection(nextContent, item.heading, item.lines);
|
|
846
1021
|
}
|
|
847
1022
|
await fileSystem.ensureDir(path.dirname(corePrinciplesPath));
|
|
848
1023
|
await fileSystem.writeFile(corePrinciplesPath, `${nextContent}\n`, 'utf8');
|
|
@@ -855,13 +1030,59 @@ async function _reconcileCorePrinciplesBaseline(projectPath, options = {}) {
|
|
|
855
1030
|
status: !exists ? (changed ? 'created' : 'unchanged') : (changed ? 'updated' : 'unchanged'),
|
|
856
1031
|
managed_by: 'takeover-baseline',
|
|
857
1032
|
details: {
|
|
1033
|
+
removed_legacy_headings_before: normalized.removedHeadings,
|
|
858
1034
|
missing_required_headings_before: missingSections.map((item) => item.heading),
|
|
859
|
-
|
|
1035
|
+
missing_required_lines_before: missingSectionLines,
|
|
860
1036
|
required_headings: REQUIRED_CORE_PRINCIPLE_SECTIONS.map((item) => item.heading)
|
|
861
1037
|
}
|
|
862
1038
|
};
|
|
863
1039
|
}
|
|
864
1040
|
|
|
1041
|
+
async function _reconcileRulesGuideBaseline(projectPath, options = {}) {
|
|
1042
|
+
const { apply, fileSystem } = options;
|
|
1043
|
+
const rulesGuidePath = path.join(projectPath, SCE_STEERING_DIR, DEFAULT_LAYER_FILES.rules_guide);
|
|
1044
|
+
const exists = await fileSystem.pathExists(rulesGuidePath);
|
|
1045
|
+
const existingContent = exists ? await fileSystem.readFile(rulesGuidePath, 'utf8') : '';
|
|
1046
|
+
const missingSections = REQUIRED_RULES_GUIDE_SECTIONS.filter(({ heading }) => !existingContent.includes(heading));
|
|
1047
|
+
const missingSectionLines = REQUIRED_RULES_GUIDE_SECTION_LINES
|
|
1048
|
+
.map(({ heading, lines }) => ({
|
|
1049
|
+
heading,
|
|
1050
|
+
lines: existingContent.includes(heading)
|
|
1051
|
+
? lines.filter((line) => !existingContent.includes(line))
|
|
1052
|
+
: []
|
|
1053
|
+
}))
|
|
1054
|
+
.filter((item) => item.lines.length > 0);
|
|
1055
|
+
const changed = missingSections.length > 0 || missingSectionLines.length > 0;
|
|
1056
|
+
|
|
1057
|
+
if (apply && changed) {
|
|
1058
|
+
let nextContent = `${existingContent || ''}`.trimEnd();
|
|
1059
|
+
const appendedSections = missingSections.map((item) => item.section).join('\n\n');
|
|
1060
|
+
if (appendedSections) {
|
|
1061
|
+
nextContent = nextContent
|
|
1062
|
+
? `${nextContent}\n\n${appendedSections}`
|
|
1063
|
+
: appendedSections;
|
|
1064
|
+
}
|
|
1065
|
+
for (const item of missingSectionLines) {
|
|
1066
|
+
nextContent = _appendLinesToSection(nextContent, item.heading, item.lines);
|
|
1067
|
+
}
|
|
1068
|
+
await fileSystem.ensureDir(path.dirname(rulesGuidePath));
|
|
1069
|
+
await fileSystem.writeFile(rulesGuidePath, `${nextContent}\n`, 'utf8');
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
return {
|
|
1073
|
+
path: _toRelativePosix(projectPath, rulesGuidePath),
|
|
1074
|
+
existed: exists,
|
|
1075
|
+
changed,
|
|
1076
|
+
status: !exists ? (changed ? 'created' : 'unchanged') : (changed ? 'updated' : 'unchanged'),
|
|
1077
|
+
managed_by: 'takeover-baseline',
|
|
1078
|
+
details: {
|
|
1079
|
+
missing_required_headings_before: missingSections.map((item) => item.heading),
|
|
1080
|
+
missing_required_lines_before: missingSectionLines,
|
|
1081
|
+
required_headings: REQUIRED_RULES_GUIDE_SECTIONS.map((item) => item.heading)
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
|
|
865
1086
|
function _summarize(items) {
|
|
866
1087
|
const summary = {
|
|
867
1088
|
created: 0,
|
|
@@ -937,12 +1158,14 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
937
1158
|
const autoConfigPath = path.join(sceRoot, 'auto', 'config.json');
|
|
938
1159
|
const takeoverConfigPath = path.join(sceRoot, 'config', 'takeover-baseline.json');
|
|
939
1160
|
const errorbookRegistryPath = path.join(sceRoot, 'config', 'errorbook-registry.json');
|
|
1161
|
+
const semanticSharedSourceConfigPath = path.join(sceRoot, 'config', 'semantic-shared-sources.json');
|
|
940
1162
|
const multiAgentConfigPath = path.join(sceRoot, 'config', 'multi-agent.json');
|
|
941
1163
|
const sessionGovernancePath = path.join(sceRoot, 'config', 'session-governance.json');
|
|
942
1164
|
const specDomainPolicyPath = path.join(sceRoot, 'config', 'spec-domain-policy.json');
|
|
943
1165
|
const problemEvalPolicyPath = path.join(sceRoot, 'config', 'problem-eval-policy.json');
|
|
944
1166
|
const problemClosurePolicyPath = path.join(sceRoot, 'config', 'problem-closure-policy.json');
|
|
945
1167
|
const studioIntakePolicyPath = path.join(sceRoot, 'config', 'studio-intake-policy.json');
|
|
1168
|
+
const supremePrinciplesPolicyPath = path.join(sceRoot, 'config', 'supreme-principles-policy.json');
|
|
946
1169
|
const stateStoragePolicyPath = path.join(sceRoot, 'config', 'state-storage-policy.json');
|
|
947
1170
|
const errorbookInventoryPath = path.join(sceRoot, 'errorbook', 'project-intake', 'custom-mechanism-inventory.json');
|
|
948
1171
|
const reportPath = path.join(sceRoot, 'reports', 'takeover-baseline-latest.json');
|
|
@@ -951,17 +1174,20 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
951
1174
|
const existingAuto = await _readJsonSafe(autoConfigPath, fileSystem);
|
|
952
1175
|
const existingTakeover = await _readJsonSafe(takeoverConfigPath, fileSystem);
|
|
953
1176
|
const existingErrorbookRegistry = await _readJsonSafe(errorbookRegistryPath, fileSystem);
|
|
1177
|
+
const existingSemanticSharedSourceConfig = await _readJsonSafe(semanticSharedSourceConfigPath, fileSystem);
|
|
954
1178
|
const existingMultiAgentConfig = await _readJsonSafe(multiAgentConfigPath, fileSystem);
|
|
955
1179
|
const existingSessionGovernance = await _readJsonSafe(sessionGovernancePath, fileSystem);
|
|
956
1180
|
const existingSpecDomainPolicy = await _readJsonSafe(specDomainPolicyPath, fileSystem);
|
|
957
1181
|
const existingProblemEvalPolicy = await _readJsonSafe(problemEvalPolicyPath, fileSystem);
|
|
958
1182
|
const existingProblemClosurePolicy = await _readJsonSafe(problemClosurePolicyPath, fileSystem);
|
|
959
1183
|
const existingStudioIntakePolicy = await _readJsonSafe(studioIntakePolicyPath, fileSystem);
|
|
1184
|
+
const existingSupremePrinciplesPolicy = await _readJsonSafe(supremePrinciplesPolicyPath, fileSystem);
|
|
960
1185
|
const existingStateStoragePolicy = await _readJsonSafe(stateStoragePolicyPath, fileSystem);
|
|
961
1186
|
const desiredAdoption = _buildAdoptionConfig(existingAdoption, nowIso, sceVersion);
|
|
962
1187
|
const desiredAutoConfig = _buildAutoConfig(existingAuto);
|
|
963
1188
|
const desiredTakeover = _buildTakeoverBaselineConfig(existingTakeover, sceVersion);
|
|
964
1189
|
const desiredErrorbookRegistry = _buildErrorbookRegistryConfig(existingErrorbookRegistry);
|
|
1190
|
+
const desiredSemanticSharedSourceConfig = _buildSemanticSharedSourceConfig(existingSemanticSharedSourceConfig);
|
|
965
1191
|
const projectSharedRegistryRelativePath = _isObject(desiredErrorbookRegistry.project_shared_projection)
|
|
966
1192
|
&& typeof desiredErrorbookRegistry.project_shared_projection.file === 'string'
|
|
967
1193
|
&& desiredErrorbookRegistry.project_shared_projection.file.trim()
|
|
@@ -997,9 +1223,13 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
997
1223
|
desiredProblemClosurePolicy
|
|
998
1224
|
);
|
|
999
1225
|
const desiredStudioIntakePolicy = _deepMerge(existingStudioIntakePolicy || {}, STUDIO_INTAKE_POLICY_DEFAULTS);
|
|
1226
|
+
const desiredSupremePrinciplesPolicy = _buildSupremePrinciplesPolicyConfig(existingSupremePrinciplesPolicy);
|
|
1000
1227
|
const desiredStateStoragePolicy = _deepMerge(existingStateStoragePolicy || {}, cloneStateStoragePolicyDefaults());
|
|
1001
1228
|
const customErrorbookFindings = await _scanProjectDefinedErrorbookMechanisms(projectPath, fileSystem);
|
|
1002
1229
|
const desiredErrorbookInventory = _buildErrorbookConvergenceInventory(sceVersion, customErrorbookFindings);
|
|
1230
|
+
const semanticSharedSourceDiscovery = await discoverSemanticSharedSourceDescriptors(projectPath, {
|
|
1231
|
+
fileSystem
|
|
1232
|
+
});
|
|
1003
1233
|
|
|
1004
1234
|
const fileResults = [];
|
|
1005
1235
|
fileResults.push(await _reconcileJsonFile(adoptionPath, desiredAdoption, {
|
|
@@ -1022,6 +1252,11 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
1022
1252
|
apply,
|
|
1023
1253
|
fileSystem
|
|
1024
1254
|
}));
|
|
1255
|
+
fileResults.push(await _reconcileJsonFile(semanticSharedSourceConfigPath, desiredSemanticSharedSourceConfig, {
|
|
1256
|
+
projectPath,
|
|
1257
|
+
apply,
|
|
1258
|
+
fileSystem
|
|
1259
|
+
}));
|
|
1025
1260
|
fileResults.push(await _reconcileJsonFile(projectSharedErrorbookRegistryPath, desiredProjectSharedErrorbookRegistry, {
|
|
1026
1261
|
projectPath,
|
|
1027
1262
|
apply,
|
|
@@ -1062,6 +1297,11 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
1062
1297
|
apply,
|
|
1063
1298
|
fileSystem
|
|
1064
1299
|
}));
|
|
1300
|
+
fileResults.push(await _reconcileJsonFile(supremePrinciplesPolicyPath, desiredSupremePrinciplesPolicy, {
|
|
1301
|
+
projectPath,
|
|
1302
|
+
apply,
|
|
1303
|
+
fileSystem
|
|
1304
|
+
}));
|
|
1065
1305
|
fileResults.push(await _reconcileJsonFile(stateStoragePolicyPath, desiredStateStoragePolicy, {
|
|
1066
1306
|
projectPath,
|
|
1067
1307
|
apply,
|
|
@@ -1081,6 +1321,10 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
1081
1321
|
apply,
|
|
1082
1322
|
fileSystem
|
|
1083
1323
|
}));
|
|
1324
|
+
fileResults.push(await _reconcileRulesGuideBaseline(projectPath, {
|
|
1325
|
+
apply,
|
|
1326
|
+
fileSystem
|
|
1327
|
+
}));
|
|
1084
1328
|
|
|
1085
1329
|
const auditFiles = _toAuditStatus(fileResults, apply);
|
|
1086
1330
|
const summary = _summarize(auditFiles);
|
|
@@ -1103,6 +1347,13 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
1103
1347
|
detected_custom_mechanism_count: desiredErrorbookInventory.summary.detected_custom_mechanisms,
|
|
1104
1348
|
inventory_file: _toRelativePosix(projectPath, errorbookInventoryPath)
|
|
1105
1349
|
},
|
|
1350
|
+
semantic_shared_source_discovery: {
|
|
1351
|
+
total_descriptors: semanticSharedSourceDiscovery.summary.total,
|
|
1352
|
+
approved_descriptors: semanticSharedSourceDiscovery.summary.approved,
|
|
1353
|
+
blocked_descriptors: semanticSharedSourceDiscovery.summary.blocked,
|
|
1354
|
+
items: semanticSharedSourceDiscovery.items,
|
|
1355
|
+
blocked: semanticSharedSourceDiscovery.blocked
|
|
1356
|
+
},
|
|
1106
1357
|
files: auditFiles,
|
|
1107
1358
|
summary
|
|
1108
1359
|
};
|
|
@@ -1127,20 +1378,28 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
1127
1378
|
}
|
|
1128
1379
|
|
|
1129
1380
|
module.exports = {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_HEADING,
|
|
1137
|
-
BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_SECTION,
|
|
1138
|
-
DELIVERY_SYNC_CORE_PRINCIPLE_HEADING,
|
|
1139
|
-
DELIVERY_SYNC_REQUIRED_LINES,
|
|
1140
|
-
LARGE_FILE_REFACTOR_CORE_PRINCIPLE_HEADING,
|
|
1141
|
-
LARGE_FILE_REFACTOR_CORE_PRINCIPLE_SECTION,
|
|
1381
|
+
FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_HEADING,
|
|
1382
|
+
FOUR_SENTENCE_TEACHING_CORE_PRINCIPLE_SECTION,
|
|
1383
|
+
SUPREME_ONLY_CORE_PRINCIPLE_HEADING,
|
|
1384
|
+
SUPREME_ONLY_CORE_PRINCIPLE_SECTION,
|
|
1385
|
+
LITTLE_NINE_CORE_PRINCIPLE_HEADING,
|
|
1386
|
+
LITTLE_NINE_CORE_PRINCIPLE_SECTION,
|
|
1142
1387
|
REQUIRED_CORE_PRINCIPLE_SECTIONS,
|
|
1388
|
+
REQUIRED_CORE_PRINCIPLE_SECTION_LINES,
|
|
1389
|
+
RULES_GUIDE_BASELINE_HEADING,
|
|
1390
|
+
RULES_GUIDE_BASELINE_SECTION,
|
|
1391
|
+
RULES_GUIDE_REQUIRED_LINES,
|
|
1392
|
+
REQUIRED_RULES_GUIDE_SECTIONS,
|
|
1393
|
+
REQUIRED_RULES_GUIDE_SECTION_LINES,
|
|
1394
|
+
SPEC_ARTIFACT_RULE_GUIDE_LINE,
|
|
1395
|
+
ERRORBOOK_CONVERGENCE_RULE_GUIDE_LINE,
|
|
1396
|
+
CLARIFICATION_FIRST_RULE_GUIDE_LINE,
|
|
1397
|
+
DELIVERY_SYNC_RULE_GUIDE_LINE,
|
|
1398
|
+
MECHANISM_REUSE_RULE_GUIDE_LINE,
|
|
1399
|
+
KNOWLEDGE_SINK_RULE_GUIDE_LINE,
|
|
1143
1400
|
ERRORBOOK_REGISTRY_DEFAULTS,
|
|
1401
|
+
SEMANTIC_SHARED_SOURCE_DEFAULTS,
|
|
1402
|
+
SUPREME_PRINCIPLES_POLICY_DEFAULTS,
|
|
1144
1403
|
ERRORBOOK_CONVERGENCE_DEFAULTS,
|
|
1145
1404
|
TAKEOVER_BASELINE_SCHEMA_VERSION,
|
|
1146
1405
|
TAKEOVER_DEFAULTS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scene-capability-engine",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.67",
|
|
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": {
|
|
@@ -39,21 +39,26 @@
|
|
|
39
39
|
"test:skip-audit": "node scripts/check-skip-allowlist.js",
|
|
40
40
|
"test:sce-tracking": "node scripts/check-sce-tracking.js",
|
|
41
41
|
"gate:npm-runtime-assets": "node scripts/npm-package-runtime-asset-check.js --fail-on-violation",
|
|
42
|
+
"gate:release-posture": "node scripts/release-posture-report.js --require-stable --fail-on-blocking --json",
|
|
42
43
|
"test:brand-consistency": "node scripts/check-branding-consistency.js",
|
|
43
44
|
"audit:release-docs": "node scripts/release-doc-version-audit.js --fail-on-error",
|
|
44
45
|
"audit:refactor-trigger": "node scripts/refactor-trigger-audit.js",
|
|
45
46
|
"audit:steering": "node scripts/steering-content-audit.js --fail-on-error",
|
|
46
47
|
"audit:clarification-first": "node scripts/clarification-first-audit.js --fail-on-violation",
|
|
48
|
+
"audit:agent-governance": "node scripts/agent-governance-baseline-audit.js --fail-on-violation",
|
|
47
49
|
"audit:magicball-engineering-contract": "node scripts/magicball-engineering-contract-audit.js --fail-on-violation",
|
|
48
50
|
"audit:magicball-project-contract": "node scripts/magicball-project-contract-audit.js --fail-on-violation",
|
|
51
|
+
"audit:deprecated-entry": "node scripts/deprecated-entry-audit.js --fail-on-violation",
|
|
49
52
|
"gate:collab-governance": "node scripts/collab-governance-gate.js --fail-on-violation",
|
|
50
53
|
"audit:state-storage": "node scripts/state-storage-tiering-audit.js",
|
|
51
54
|
"report:release-docs": "node scripts/release-doc-version-audit.js --json",
|
|
52
55
|
"report:refactor-trigger": "node scripts/refactor-trigger-audit.js --json",
|
|
53
56
|
"report:steering-audit": "node scripts/steering-content-audit.js --json",
|
|
54
57
|
"report:clarification-first-audit": "node scripts/clarification-first-audit.js --json",
|
|
58
|
+
"report:agent-governance-audit": "node scripts/agent-governance-baseline-audit.js --json",
|
|
55
59
|
"report:magicball-engineering-contract": "node scripts/magicball-engineering-contract-audit.js --json",
|
|
56
60
|
"report:magicball-project-contract": "node scripts/magicball-project-contract-audit.js --json",
|
|
61
|
+
"report:release-posture": "node scripts/release-posture-report.js --json",
|
|
57
62
|
"report:collab-governance": "node scripts/collab-governance-gate.js --json",
|
|
58
63
|
"report:state-storage": "node scripts/state-storage-tiering-audit.js --json",
|
|
59
64
|
"report:interactive-approval-projection": "node scripts/interactive-approval-event-projection.js --action doctor --json",
|
|
@@ -96,7 +101,7 @@
|
|
|
96
101
|
"gate:release-asset-integrity": "node scripts/release-asset-integrity-check.js",
|
|
97
102
|
"report:release-risk-remediation": "node scripts/release-risk-remediation-bundle.js --json",
|
|
98
103
|
"report:moqui-core-regression": "node scripts/moqui-core-regression-suite.js --json",
|
|
99
|
-
"prepublishOnly": "npm run test:release && npm run test:skip-audit && npm run test:sce-tracking && npm run gate:npm-runtime-assets && npm run test:brand-consistency && npm run audit:release-docs && npm run audit:steering && npm run audit:clarification-first && npm run audit:magicball-engineering-contract && npm run audit:magicball-project-contract && npm run gate:collab-governance && npm run gate:git-managed && npm run gate:errorbook-registry-health && npm run gate:errorbook-release && npm run
|
|
104
|
+
"prepublishOnly": "npm run test:release && npm run test:skip-audit && npm run test:sce-tracking && npm run gate:npm-runtime-assets && npm run test:brand-consistency && npm run audit:release-docs && npm run audit:steering && npm run audit:clarification-first && npm run audit:agent-governance && npm run audit:magicball-engineering-contract && npm run audit:magicball-project-contract && npm run audit:deprecated-entry && npm run gate:collab-governance && npm run gate:git-managed && npm run gate:errorbook-registry-health && npm run gate:errorbook-release && npm run gate:release-posture",
|
|
100
105
|
"publish:manual": "npm publish --access public",
|
|
101
106
|
"install-global": "npm install -g .",
|
|
102
107
|
"uninstall-global": "npm uninstall -g scene-capability-engine"
|