scene-capability-engine 3.6.48 → 3.6.50
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 +15 -0
- package/README.md +4 -2
- package/README.zh.md +4 -2
- package/docs/command-reference.md +4 -3
- package/docs/multi-agent-coordination-guide.md +15 -15
- package/docs/releases/v3.6.50.md +21 -0
- package/docs/steering-strategy-guide.md +1 -1
- package/docs/zh/releases/v3.6.50.md +21 -0
- package/lib/collab/multi-agent-config.js +4 -4
- package/lib/commands/timeline.js +20 -3
- package/lib/steering/adoption-config.js +3 -3
- package/lib/workspace/collab-governance-gate.js +65 -0
- package/lib/workspace/takeover-baseline.js +40 -1
- package/package.json +8 -2
- package/scripts/collab-governance-gate.js +76 -0
- package/scripts/refactor-trigger-audit.js +357 -0
- package/scripts/release-doc-version-audit.js +317 -0
- package/template/.sce/README.md +10 -10
- package/template/.sce/config/multi-agent.json +8 -0
- package/template/.sce/config/takeover-baseline.json +11 -0
- package/template/.sce/steering/CORE_PRINCIPLES.md +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.6.50] - 2026-03-14
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- Switched the SCE co-work baseline to default-on: multi-agent config defaults to `enabled=true`, `init/adopt/takeover` now provision `.sce/config/multi-agent.json`, and adoption metadata defaults `multiUserMode` to true while keeping the central coordinator opt-in.
|
|
14
|
+
- Added `scripts/collab-governance-gate.js` and a shared collaboration-governance gate helper so co-work governance can run as a reusable push/publish preflight instead of remaining a report-only audit.
|
|
15
|
+
- Updated `sce timeline push` to fail fast on collaboration governance drift before creating a push checkpoint or executing `git push`, ensuring managed push flow respects `.gitignore` collaboration boundaries, runtime-state tracking hygiene, multi-agent config validity, legacy naming cleanup, and steering boundary rules.
|
|
16
|
+
- Wired `gate:collab-governance` into `prepublishOnly` so npm publish now enforces the same co-work governance baseline as managed push.
|
|
17
|
+
|
|
18
|
+
## [3.6.49] - 2026-03-14
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Added `scripts/release-doc-version-audit.js` and wired it into package scripts, CI, release, and steering-hygiene workflows so README release metadata drift now blocks publish instead of relying on manual sync.
|
|
22
|
+
- Synced `README.md`, `README.zh.md`, `.sce/README.md`, and `template/.sce/README.md` release footers to the current package version/date and removed stale hardcoded capability-version headings from long-lived project guide READMEs.
|
|
23
|
+
- Added a new project-calibrated refactor trigger capability via `scripts/refactor-trigger-audit.js`, plus a matching steering baseline rule: each SCE project should periodically evaluate its own file-size distribution, while `2000 / 4000 / 10000` remains the default source-file fallback when no project-specific threshold is set.
|
|
24
|
+
|
|
10
25
|
## [3.6.48] - 2026-03-14
|
|
11
26
|
|
|
12
27
|
### Changed
|
package/README.md
CHANGED
|
@@ -142,7 +142,9 @@ SCE is opinionated by default.
|
|
|
142
142
|
- When business scene/module/page/entity context is missing, SCE must route to clarification first; unknown business scope must not be turned into blanket disable.
|
|
143
143
|
- `verify` and `release` enforce problem-closure and related gates when a spec is bound.
|
|
144
144
|
- Autonomous program execution applies gate evaluation, fallback-chain logic, governance replay, and auto-remediation.
|
|
145
|
+
- Co-work baseline is enabled by default: initialized/adopted SCE projects provision `.sce/config/multi-agent.json` with `enabled=true`, while the central coordinator stays opt-in.
|
|
145
146
|
- State persistence prefers SQLite, not ad hoc local caches.
|
|
147
|
+
- Oversized source files must trigger periodic refactor assessment; SCE recommends project-specific thresholds, with `2000 / 4000 / 10000` as the default source-file fallback.
|
|
146
148
|
- Release validation defaults to integration test coverage via `npm run test:release` for faster publish feedback.
|
|
147
149
|
|
|
148
150
|
---
|
|
@@ -216,5 +218,5 @@ MIT. See [LICENSE](LICENSE).
|
|
|
216
218
|
|
|
217
219
|
---
|
|
218
220
|
|
|
219
|
-
**Version**: 3.6.
|
|
220
|
-
**Last Updated**: 2026-03-
|
|
221
|
+
**Version**: 3.6.50
|
|
222
|
+
**Last Updated**: 2026-03-14
|
package/README.zh.md
CHANGED
|
@@ -147,7 +147,9 @@ SCE 默认是强治理的。
|
|
|
147
147
|
- 缺少业务场景/模块/页面/实体上下文时,SCE 必须先进入澄清,而不是把未知业务范围直接变成一刀切禁用
|
|
148
148
|
- 当 spec 绑定时,`verify` 和 `release` 默认执行 problem-closure 等相关门禁
|
|
149
149
|
- `close-loop-program` 默认带 gate 评估、fallback-chain、governance replay、auto-remediation
|
|
150
|
+
- co-work 基线默认开启:初始化或接管后的 SCE 项目会落地 `.sce/config/multi-agent.json` 且 `enabled=true`,但中央 coordinator 仍保持按需开启
|
|
150
151
|
- 状态持久化默认优先走 SQLite,而不是零散本地缓存
|
|
152
|
+
- 超大源文件必须定期触发重构评估;SCE 优先建议按项目给出阈值,若项目尚未设定,则默认参考 `2000 / 4000 / 10000`
|
|
151
153
|
- 发布默认验证走 integration gate:`npm run test:release`
|
|
152
154
|
|
|
153
155
|
---
|
|
@@ -221,5 +223,5 @@ MIT,见 [LICENSE](LICENSE)。
|
|
|
221
223
|
|
|
222
224
|
---
|
|
223
225
|
|
|
224
|
-
**版本**:3.6.
|
|
225
|
-
**最后更新**:2026-03-
|
|
226
|
+
**版本**:3.6.50
|
|
227
|
+
**最后更新**:2026-03-14
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
> Quick reference for all `sce` commands
|
|
4
4
|
|
|
5
|
-
**Version**: 3.6.
|
|
6
|
-
**Last Updated**: 2026-03-
|
|
5
|
+
**Version**: 3.6.50
|
|
6
|
+
**Last Updated**: 2026-03-14
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -127,7 +127,7 @@ sce timeline restore <snapshot-id> --prune --json
|
|
|
127
127
|
# Update timeline policy
|
|
128
128
|
sce timeline config --enabled true --interval 30 --max-entries 120 --json
|
|
129
129
|
|
|
130
|
-
# Push with pre-push snapshot
|
|
130
|
+
# Push with co-work governance gate + pre-push snapshot
|
|
131
131
|
sce timeline push origin main
|
|
132
132
|
```
|
|
133
133
|
|
|
@@ -135,6 +135,7 @@ Timeline policy:
|
|
|
135
135
|
- default enabled with local retention under `.sce/timeline/snapshots/`
|
|
136
136
|
- stage/key-event checkpoints are automatically captured for `studio` and `session` commands
|
|
137
137
|
- interval auto-checkpoints are integrated in the same flow via timeline checkpoint capture
|
|
138
|
+
- `timeline push` now blocks before snapshot/push when collaboration governance drifts, so tracked runtime state, missing co-work ignore rules, legacy `.kiro*` references, invalid multi-agent config, or steering boundary drift cannot pass through managed push flow
|
|
138
139
|
|
|
139
140
|
### Value Metrics
|
|
140
141
|
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
> Enable multiple AI agents to work on the same sce project simultaneously without conflicts.
|
|
4
4
|
|
|
5
|
-
**Version**:
|
|
6
|
-
**Last Updated**: 2026-
|
|
5
|
+
**Version**: 3.6.50
|
|
6
|
+
**Last Updated**: 2026-03-14
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -25,31 +25,31 @@ The Multi-Agent Parallel Coordination system solves this with six layers of prot
|
|
|
25
25
|
10. **Spec Lifecycle Manager** — Spec state machine and auto-completion (v1.44.0)
|
|
26
26
|
11. **Sync Barrier** — Agent Spec-switch synchronization (v1.44.0)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
SCE provisions the co-work baseline by default. If a project explicitly sets `enabled: false`, all components fall back to single-agent no-op behavior.
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
32
|
## Quick Start
|
|
33
33
|
|
|
34
|
-
### 1.
|
|
34
|
+
### 1. Review Multi-Agent Mode Baseline
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
SCE provisions `.sce/config/multi-agent.json` by default:
|
|
37
37
|
|
|
38
38
|
```json
|
|
39
39
|
{
|
|
40
40
|
"enabled": true,
|
|
41
|
-
"
|
|
42
|
-
"heartbeatIntervalMs":
|
|
43
|
-
"heartbeatTimeoutMs":
|
|
41
|
+
"coordinatorEnabled": false,
|
|
42
|
+
"heartbeatIntervalMs": 60000,
|
|
43
|
+
"heartbeatTimeoutMs": 180000
|
|
44
44
|
}
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
| Field | Description | Default |
|
|
48
48
|
|-------|-------------|---------|
|
|
49
|
-
| `enabled` | Enable multi-agent coordination | `
|
|
50
|
-
| `
|
|
51
|
-
| `heartbeatIntervalMs` | Heartbeat interval in ms | `
|
|
52
|
-
| `heartbeatTimeoutMs` | Agent considered inactive after this | `
|
|
49
|
+
| `enabled` | Enable multi-agent coordination | `true` |
|
|
50
|
+
| `coordinatorEnabled` | Enable central task assignment | `false` |
|
|
51
|
+
| `heartbeatIntervalMs` | Heartbeat interval in ms | `60000` |
|
|
52
|
+
| `heartbeatTimeoutMs` | Agent considered inactive after this | `180000` |
|
|
53
53
|
|
|
54
54
|
### 2. Each Agent Registers Itself
|
|
55
55
|
|
|
@@ -504,9 +504,9 @@ All components check `MultiAgentConfig.isEnabled()` before doing anything:
|
|
|
504
504
|
```json
|
|
505
505
|
{
|
|
506
506
|
"enabled": true,
|
|
507
|
-
"
|
|
508
|
-
"heartbeatIntervalMs":
|
|
509
|
-
"heartbeatTimeoutMs":
|
|
507
|
+
"coordinatorEnabled": false,
|
|
508
|
+
"heartbeatIntervalMs": 60000,
|
|
509
|
+
"heartbeatTimeoutMs": 180000
|
|
510
510
|
}
|
|
511
511
|
```
|
|
512
512
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# v3.6.50 Release Notes
|
|
2
|
+
|
|
3
|
+
Release date: 2026-03-14
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Switched the SCE co-work baseline to default-on: initialized/adopted/takeover-aligned projects now provision `.sce/config/multi-agent.json` with `enabled=true`, while the central coordinator remains opt-in.
|
|
8
|
+
- Added a reusable `collab-governance-gate` and wired it into both `sce timeline push` and `prepublishOnly`, so managed push/publish flow now blocks on co-work governance drift instead of relying on report-only auditing.
|
|
9
|
+
- Synced template/runtime release metadata and multi-agent guidance so shipped documentation reflects the new default co-work baseline and the current package version.
|
|
10
|
+
|
|
11
|
+
## Validation
|
|
12
|
+
|
|
13
|
+
- `npx jest tests/unit/scripts/collab-governance-gate.test.js tests/unit/commands/timeline.test.js --runInBand`
|
|
14
|
+
- `npx jest tests/unit/collab/multi-agent-config.test.js tests/unit/workspace/takeover-baseline.test.js tests/integration/takeover-baseline-cli.integration.test.js --runInBand`
|
|
15
|
+
- `node scripts/collab-governance-gate.js --json`
|
|
16
|
+
- `npm run prepublishOnly`
|
|
17
|
+
|
|
18
|
+
## Release Notes
|
|
19
|
+
|
|
20
|
+
- This patch closes the gap where SCE had co-work governance rules and auditing, but initialized/adopted projects still defaulted to a disabled multi-agent baseline.
|
|
21
|
+
- Managed push and publish now share the same co-work governance gate, which prevents collaboration boundary drift from slipping through one path while being caught by another.
|
|
@@ -102,7 +102,7 @@ Your steering strategy choice is saved in `.sce/adoption-config.json`:
|
|
|
102
102
|
"adoptedAt": "2026-01-23T10:00:00.000Z",
|
|
103
103
|
"steeringStrategy": "use-sce",
|
|
104
104
|
"steeringBackupId": "steering-2026-01-23T10-00-00-000Z",
|
|
105
|
-
"multiUserMode":
|
|
105
|
+
"multiUserMode": true,
|
|
106
106
|
"lastUpdated": "2026-01-23T10:00:00.000Z"
|
|
107
107
|
}
|
|
108
108
|
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# v3.6.50 发布说明
|
|
2
|
+
|
|
3
|
+
发布日期:2026-03-14
|
|
4
|
+
|
|
5
|
+
## 重点变化
|
|
6
|
+
|
|
7
|
+
- 将 SCE 的 co-work 基线切换为默认开启:`init` / `adopt` / `takeover` 对齐后的项目现在都会落地 `.sce/config/multi-agent.json` 且 `enabled=true`,中央 coordinator 仍保持按需开启。
|
|
8
|
+
- 新增可复用的 `collab-governance-gate`,并接入 `sce timeline push` 与 `prepublishOnly`,让托管 push / publish 在 co-work 治理漂移时直接阻断,而不是只做报告型审计。
|
|
9
|
+
- 同步更新模板、运行时说明和版本元数据,确保发出的文档与默认 co-work 基线、当前包版本保持一致。
|
|
10
|
+
|
|
11
|
+
## 验证
|
|
12
|
+
|
|
13
|
+
- `npx jest tests/unit/scripts/collab-governance-gate.test.js tests/unit/commands/timeline.test.js --runInBand`
|
|
14
|
+
- `npx jest tests/unit/collab/multi-agent-config.test.js tests/unit/workspace/takeover-baseline.test.js tests/integration/takeover-baseline-cli.integration.test.js --runInBand`
|
|
15
|
+
- `node scripts/collab-governance-gate.js --json`
|
|
16
|
+
- `npm run prepublishOnly`
|
|
17
|
+
|
|
18
|
+
## 发布说明
|
|
19
|
+
|
|
20
|
+
- 这个补丁版补齐了一个关键缺口:SCE 虽然已经具备 co-work 治理规则和审计能力,但此前新接入项目默认仍可能落在关闭态。
|
|
21
|
+
- 现在托管 push 与 publish 共用同一条 co-work governance gate,避免一条链路能放过的协作治理漂移,在另一条链路才被发现。
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Multi-Agent Configuration Manager
|
|
3
3
|
*
|
|
4
4
|
* Manages `.sce/config/multi-agent.json` for multi-Agent parallel coordination.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Co-work baseline is enabled by default for SCE-managed projects; a project
|
|
6
|
+
* can still opt out explicitly by setting `enabled: false`.
|
|
7
7
|
*
|
|
8
8
|
* Requirements: 7.1 (no extra files when disabled), 7.4 (auto-init on first enable)
|
|
9
9
|
*/
|
|
@@ -16,7 +16,7 @@ const CONFIG_DIR = '.sce/config';
|
|
|
16
16
|
|
|
17
17
|
/** @type {import('./multi-agent-config').MultiAgentConfigData} */
|
|
18
18
|
const DEFAULT_CONFIG = Object.freeze({
|
|
19
|
-
enabled:
|
|
19
|
+
enabled: true,
|
|
20
20
|
heartbeatIntervalMs: 60000,
|
|
21
21
|
heartbeatTimeoutMs: 180000,
|
|
22
22
|
coordinatorEnabled: false,
|
|
@@ -36,7 +36,7 @@ class MultiAgentConfig {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Read the current configuration.
|
|
39
|
-
* Returns the default
|
|
39
|
+
* Returns the default config when the file is missing or corrupted.
|
|
40
40
|
*
|
|
41
41
|
* @returns {Promise<object>} Resolved configuration
|
|
42
42
|
*/
|
package/lib/commands/timeline.js
CHANGED
|
@@ -5,6 +5,10 @@ const {
|
|
|
5
5
|
ProjectTimelineStore,
|
|
6
6
|
captureTimelineCheckpoint
|
|
7
7
|
} = require('../runtime/project-timeline');
|
|
8
|
+
const {
|
|
9
|
+
evaluateCollabGovernanceGate,
|
|
10
|
+
formatCollabGovernanceGateBlockMessage
|
|
11
|
+
} = require('../workspace/collab-governance-gate');
|
|
8
12
|
const {
|
|
9
13
|
summarizeTimelineAttention,
|
|
10
14
|
buildTimelineEntryViewModel,
|
|
@@ -172,8 +176,21 @@ async function runTimelineConfigCommand(options = {}, dependencies = {}) {
|
|
|
172
176
|
|
|
173
177
|
async function runTimelinePushCommand(gitArgs = [], options = {}, dependencies = {}) {
|
|
174
178
|
const projectPath = dependencies.projectPath || process.cwd();
|
|
179
|
+
const collabGovernanceGate = dependencies.evaluateCollabGovernanceGate || evaluateCollabGovernanceGate;
|
|
180
|
+
const checkpointRunner = dependencies.captureTimelineCheckpoint || captureTimelineCheckpoint;
|
|
181
|
+
const runGitPush = dependencies.spawnSync || spawnSync;
|
|
182
|
+
|
|
183
|
+
const gatePayload = await collabGovernanceGate({
|
|
184
|
+
projectPath
|
|
185
|
+
}, dependencies);
|
|
186
|
+
if (!gatePayload.passed) {
|
|
187
|
+
const error = new Error(formatCollabGovernanceGateBlockMessage(gatePayload));
|
|
188
|
+
error.exitCode = 2;
|
|
189
|
+
error.gate = gatePayload;
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
175
192
|
|
|
176
|
-
const checkpoint = await
|
|
193
|
+
const checkpoint = await checkpointRunner({
|
|
177
194
|
trigger: 'push',
|
|
178
195
|
event: 'git.push.preflight',
|
|
179
196
|
summary: normalizeText(options.summary) || 'pre-push timeline checkpoint',
|
|
@@ -183,7 +200,7 @@ async function runTimelinePushCommand(gitArgs = [], options = {}, dependencies =
|
|
|
183
200
|
fileSystem: dependencies.fileSystem
|
|
184
201
|
});
|
|
185
202
|
|
|
186
|
-
const result =
|
|
203
|
+
const result = runGitPush('git', ['push', ...(Array.isArray(gitArgs) ? gitArgs : [])], {
|
|
187
204
|
cwd: projectPath,
|
|
188
205
|
stdio: 'inherit',
|
|
189
206
|
windowsHide: true
|
|
@@ -277,7 +294,7 @@ function registerTimelineCommands(program) {
|
|
|
277
294
|
|
|
278
295
|
timeline
|
|
279
296
|
.command('push [gitArgs...]')
|
|
280
|
-
.description('
|
|
297
|
+
.description('Run collaboration governance gate, create a pre-push timeline snapshot, then run git push')
|
|
281
298
|
.option('--summary <text>', 'Summary for pre-push checkpoint')
|
|
282
299
|
.option('--json', 'Output as JSON')
|
|
283
300
|
.action(async (gitArgs, options) => safeRun(runTimelinePushCommand, options, gitArgs));
|
|
@@ -73,7 +73,7 @@ class AdoptionConfig {
|
|
|
73
73
|
config = {
|
|
74
74
|
version: '1.0.0',
|
|
75
75
|
adoptedAt: new Date().toISOString(),
|
|
76
|
-
multiUserMode:
|
|
76
|
+
multiUserMode: true
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -139,7 +139,7 @@ class AdoptionConfig {
|
|
|
139
139
|
*/
|
|
140
140
|
async isMultiUserMode() {
|
|
141
141
|
const config = await this.read();
|
|
142
|
-
return config ? (config.multiUserMode
|
|
142
|
+
return config ? (typeof config.multiUserMode === 'boolean' ? config.multiUserMode : true) : true;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
/**
|
|
@@ -153,7 +153,7 @@ class AdoptionConfig {
|
|
|
153
153
|
version: '1.0.0',
|
|
154
154
|
adoptedAt: new Date().toISOString(),
|
|
155
155
|
steeringStrategy: options.steeringStrategy || 'use-sce',
|
|
156
|
-
multiUserMode: options.multiUserMode
|
|
156
|
+
multiUserMode: typeof options.multiUserMode === 'boolean' ? options.multiUserMode : true,
|
|
157
157
|
...options
|
|
158
158
|
};
|
|
159
159
|
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { auditCollabGovernance } = require('./collab-governance-audit');
|
|
4
|
+
|
|
5
|
+
async function evaluateCollabGovernanceGate(options = {}, dependencies = {}) {
|
|
6
|
+
const projectPath = options.projectPath || dependencies.projectPath || process.cwd();
|
|
7
|
+
const audit = await (dependencies.auditCollabGovernance || auditCollabGovernance)(
|
|
8
|
+
projectPath,
|
|
9
|
+
options,
|
|
10
|
+
dependencies
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
mode: 'collab-governance-gate',
|
|
15
|
+
project_path: projectPath,
|
|
16
|
+
passed: audit.passed === true,
|
|
17
|
+
reason: audit.reason || (audit.passed === true ? 'passed' : 'violations'),
|
|
18
|
+
summary: audit.summary || {},
|
|
19
|
+
warnings: Array.isArray(audit.warnings) ? audit.warnings : [],
|
|
20
|
+
violations: Array.isArray(audit.violations) ? audit.violations : [],
|
|
21
|
+
audit
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function formatCollabGovernanceGateBlockMessage(payload = {}, maxViolations = 3) {
|
|
26
|
+
const violations = Array.isArray(payload.violations) ? payload.violations.filter(Boolean) : [];
|
|
27
|
+
if (violations.length === 0) {
|
|
28
|
+
return 'collaboration governance gate blocked push';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const visibleViolations = violations.slice(0, Math.max(1, maxViolations));
|
|
32
|
+
const suffix = violations.length > visibleViolations.length
|
|
33
|
+
? ` (+${violations.length - visibleViolations.length} more)`
|
|
34
|
+
: '';
|
|
35
|
+
return `collaboration governance gate blocked push: ${visibleViolations.join('; ')}${suffix}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function runCollabGovernanceGate(options = {}, dependencies = {}) {
|
|
39
|
+
const payload = await evaluateCollabGovernanceGate(options, dependencies);
|
|
40
|
+
|
|
41
|
+
if (options.json) {
|
|
42
|
+
process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
|
|
43
|
+
} else if (payload.passed) {
|
|
44
|
+
process.stdout.write('[collab-governance-gate] passed\n');
|
|
45
|
+
process.stdout.write(
|
|
46
|
+
`[collab-governance-gate] missing-ignore-rules=${payload.summary.missing_gitignore_rules || 0} legacy-references=${payload.summary.legacy_reference_count || 0}\n`
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
process.stdout.write('[collab-governance-gate] blocked\n');
|
|
50
|
+
payload.violations.forEach((item) => {
|
|
51
|
+
process.stdout.write(`[collab-governance-gate] violation=${item}\n`);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
...payload,
|
|
57
|
+
exit_code: options.failOnViolation && !payload.passed ? 2 : 0
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
evaluateCollabGovernanceGate,
|
|
63
|
+
formatCollabGovernanceGateBlockMessage,
|
|
64
|
+
runCollabGovernanceGate
|
|
65
|
+
};
|
|
@@ -10,6 +10,9 @@ const {
|
|
|
10
10
|
const {
|
|
11
11
|
cloneStateStoragePolicyDefaults
|
|
12
12
|
} = require('../state/state-storage-policy');
|
|
13
|
+
const {
|
|
14
|
+
DEFAULT_CONFIG: MULTI_AGENT_CONFIG_DEFAULTS
|
|
15
|
+
} = require('../collab/multi-agent-config');
|
|
13
16
|
|
|
14
17
|
const TAKEOVER_BASELINE_SCHEMA_VERSION = '1.0';
|
|
15
18
|
const CLARIFICATION_FIRST_CORE_PRINCIPLE_HEADING = '## 11. 业务场景未知时必须先澄清,禁止直接彻底禁用';
|
|
@@ -45,6 +48,16 @@ const BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_SECTION = [
|
|
|
45
48
|
'- 除非明确要求新建接口或修改后端接口,否则禁止为了迁就前端错误调用去随意改后端实现或契约。',
|
|
46
49
|
'- 默认优先修正前端请求、映射、类型和兼容处理,使其与后端接口保持一致;若怀疑后端契约错误,应先确认再改。'
|
|
47
50
|
].join('\n');
|
|
51
|
+
const LARGE_FILE_REFACTOR_CORE_PRINCIPLE_HEADING = '## 15. 单文件规模过大必须触发重构评估,禁止无限堆积';
|
|
52
|
+
const LARGE_FILE_REFACTOR_CORE_PRINCIPLE_SECTION = [
|
|
53
|
+
LARGE_FILE_REFACTOR_CORE_PRINCIPLE_HEADING,
|
|
54
|
+
'',
|
|
55
|
+
'- SCE 应为每个项目定期评估代码规模分布,并给出项目级的重构参考节点;禁止假设所有项目都适用同一个固定行数阈值。',
|
|
56
|
+
'- 若项目尚未建立自己的阈值,默认参考源文件 `2000 / 4000 / 10000` 行三档触发:分别对应“必须评估”“必须发起重构收敛”“进入红线区”。',
|
|
57
|
+
'- 达到项目级或默认阈值后,后续改动必须优先评估拆分模块、服务、命令面或数据职责;超过重构/红线阈值时,不得继续无计划堆积复杂度。',
|
|
58
|
+
'- 项目开始较小时,阈值应更早触发;项目进入长期演进后,也必须按周或发布前重新评估,而不是让早期设定永久失效。',
|
|
59
|
+
'- 行数阈值只是强触发信号,不代表低于阈值就可以忽略耦合、职责混杂、测试失控和理解成本问题;若复杂度已明显失控,应提前启动重构。'
|
|
60
|
+
].join('\n');
|
|
48
61
|
const REQUIRED_CORE_PRINCIPLE_SECTIONS = Object.freeze([
|
|
49
62
|
{
|
|
50
63
|
heading: CLARIFICATION_FIRST_CORE_PRINCIPLE_HEADING,
|
|
@@ -61,6 +74,10 @@ const REQUIRED_CORE_PRINCIPLE_SECTIONS = Object.freeze([
|
|
|
61
74
|
{
|
|
62
75
|
heading: BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_HEADING,
|
|
63
76
|
section: BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_SECTION
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
heading: LARGE_FILE_REFACTOR_CORE_PRINCIPLE_HEADING,
|
|
80
|
+
section: LARGE_FILE_REFACTOR_CORE_PRINCIPLE_SECTION
|
|
64
81
|
}
|
|
65
82
|
]);
|
|
66
83
|
|
|
@@ -335,6 +352,10 @@ const TAKEOVER_DEFAULTS = Object.freeze({
|
|
|
335
352
|
max_direct_fix_rounds_before_debug: 2,
|
|
336
353
|
forbid_bypass_workarounds: true
|
|
337
354
|
},
|
|
355
|
+
collaboration: {
|
|
356
|
+
multi_user_mode: true,
|
|
357
|
+
multi_agent: _clone(MULTI_AGENT_CONFIG_DEFAULTS)
|
|
358
|
+
},
|
|
338
359
|
errorbook_convergence: _clone(ERRORBOOK_CONVERGENCE_DEFAULTS),
|
|
339
360
|
migration_policy: {
|
|
340
361
|
legacy_kiro_supported: false,
|
|
@@ -426,7 +447,7 @@ function _buildAdoptionConfig(existing, nowIso, sceVersion) {
|
|
|
426
447
|
steeringStrategy: typeof base.steeringStrategy === 'string' && base.steeringStrategy.trim()
|
|
427
448
|
? base.steeringStrategy
|
|
428
449
|
: 'use-sce',
|
|
429
|
-
multiUserMode: base.multiUserMode === true,
|
|
450
|
+
multiUserMode: typeof base.multiUserMode === 'boolean' ? base.multiUserMode : true,
|
|
430
451
|
runtimePolicy: {
|
|
431
452
|
agent_parity_permissions: true,
|
|
432
453
|
autonomous_default: true
|
|
@@ -442,6 +463,14 @@ function _buildAdoptionConfig(existing, nowIso, sceVersion) {
|
|
|
442
463
|
};
|
|
443
464
|
}
|
|
444
465
|
|
|
466
|
+
function _buildMultiAgentConfig(existing) {
|
|
467
|
+
const base = _isObject(existing) ? _clone(existing) : {};
|
|
468
|
+
return {
|
|
469
|
+
..._clone(MULTI_AGENT_CONFIG_DEFAULTS),
|
|
470
|
+
...base
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
|
|
445
474
|
function _buildTakeoverBaselineConfig(existing, sceVersion) {
|
|
446
475
|
const base = _isObject(existing) ? _clone(existing) : {};
|
|
447
476
|
return {
|
|
@@ -735,6 +764,7 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
735
764
|
const autoConfigPath = path.join(sceRoot, 'auto', 'config.json');
|
|
736
765
|
const takeoverConfigPath = path.join(sceRoot, 'config', 'takeover-baseline.json');
|
|
737
766
|
const errorbookRegistryPath = path.join(sceRoot, 'config', 'errorbook-registry.json');
|
|
767
|
+
const multiAgentConfigPath = path.join(sceRoot, 'config', 'multi-agent.json');
|
|
738
768
|
const sessionGovernancePath = path.join(sceRoot, 'config', 'session-governance.json');
|
|
739
769
|
const specDomainPolicyPath = path.join(sceRoot, 'config', 'spec-domain-policy.json');
|
|
740
770
|
const problemEvalPolicyPath = path.join(sceRoot, 'config', 'problem-eval-policy.json');
|
|
@@ -748,6 +778,7 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
748
778
|
const existingAuto = await _readJsonSafe(autoConfigPath, fileSystem);
|
|
749
779
|
const existingTakeover = await _readJsonSafe(takeoverConfigPath, fileSystem);
|
|
750
780
|
const existingErrorbookRegistry = await _readJsonSafe(errorbookRegistryPath, fileSystem);
|
|
781
|
+
const existingMultiAgentConfig = await _readJsonSafe(multiAgentConfigPath, fileSystem);
|
|
751
782
|
const existingSessionGovernance = await _readJsonSafe(sessionGovernancePath, fileSystem);
|
|
752
783
|
const existingSpecDomainPolicy = await _readJsonSafe(specDomainPolicyPath, fileSystem);
|
|
753
784
|
const existingProblemEvalPolicy = await _readJsonSafe(problemEvalPolicyPath, fileSystem);
|
|
@@ -758,6 +789,7 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
758
789
|
const desiredAutoConfig = _buildAutoConfig(existingAuto);
|
|
759
790
|
const desiredTakeover = _buildTakeoverBaselineConfig(existingTakeover, sceVersion);
|
|
760
791
|
const desiredErrorbookRegistry = _buildErrorbookRegistryConfig(existingErrorbookRegistry);
|
|
792
|
+
const desiredMultiAgentConfig = _buildMultiAgentConfig(existingMultiAgentConfig);
|
|
761
793
|
const desiredSessionGovernance = _deepMerge(existingSessionGovernance || {}, SESSION_GOVERNANCE_DEFAULTS);
|
|
762
794
|
const desiredSpecDomainPolicy = _deepMerge(existingSpecDomainPolicy || {}, SPEC_DOMAIN_POLICY_DEFAULTS);
|
|
763
795
|
const desiredProblemEvalPolicy = _deepMerge(existingProblemEvalPolicy || {}, PROBLEM_EVAL_POLICY_DEFAULTS);
|
|
@@ -788,6 +820,11 @@ async function applyTakeoverBaseline(projectPath = process.cwd(), options = {})
|
|
|
788
820
|
apply,
|
|
789
821
|
fileSystem
|
|
790
822
|
}));
|
|
823
|
+
fileResults.push(await _reconcileJsonFile(multiAgentConfigPath, desiredMultiAgentConfig, {
|
|
824
|
+
projectPath,
|
|
825
|
+
apply,
|
|
826
|
+
fileSystem
|
|
827
|
+
}));
|
|
791
828
|
fileResults.push(await _reconcileJsonFile(sessionGovernancePath, desiredSessionGovernance, {
|
|
792
829
|
projectPath,
|
|
793
830
|
apply,
|
|
@@ -886,6 +923,8 @@ module.exports = {
|
|
|
886
923
|
STEERING_CHANGE_EVALUATION_CORE_PRINCIPLE_SECTION,
|
|
887
924
|
BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_HEADING,
|
|
888
925
|
BACKEND_API_PRECEDENCE_CORE_PRINCIPLE_SECTION,
|
|
926
|
+
LARGE_FILE_REFACTOR_CORE_PRINCIPLE_HEADING,
|
|
927
|
+
LARGE_FILE_REFACTOR_CORE_PRINCIPLE_SECTION,
|
|
889
928
|
REQUIRED_CORE_PRINCIPLE_SECTIONS,
|
|
890
929
|
ERRORBOOK_REGISTRY_DEFAULTS,
|
|
891
930
|
ERRORBOOK_CONVERGENCE_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.50",
|
|
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": {
|
|
@@ -40,11 +40,17 @@
|
|
|
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
42
|
"test:brand-consistency": "node scripts/check-branding-consistency.js",
|
|
43
|
+
"audit:release-docs": "node scripts/release-doc-version-audit.js --fail-on-error",
|
|
44
|
+
"audit:refactor-trigger": "node scripts/refactor-trigger-audit.js",
|
|
43
45
|
"audit:steering": "node scripts/steering-content-audit.js --fail-on-error",
|
|
44
46
|
"audit:clarification-first": "node scripts/clarification-first-audit.js --fail-on-violation",
|
|
47
|
+
"gate:collab-governance": "node scripts/collab-governance-gate.js --fail-on-violation",
|
|
45
48
|
"audit:state-storage": "node scripts/state-storage-tiering-audit.js",
|
|
49
|
+
"report:release-docs": "node scripts/release-doc-version-audit.js --json",
|
|
50
|
+
"report:refactor-trigger": "node scripts/refactor-trigger-audit.js --json",
|
|
46
51
|
"report:steering-audit": "node scripts/steering-content-audit.js --json",
|
|
47
52
|
"report:clarification-first-audit": "node scripts/clarification-first-audit.js --json",
|
|
53
|
+
"report:collab-governance": "node scripts/collab-governance-gate.js --json",
|
|
48
54
|
"report:state-storage": "node scripts/state-storage-tiering-audit.js --json",
|
|
49
55
|
"report:interactive-approval-projection": "node scripts/interactive-approval-event-projection.js --action doctor --json",
|
|
50
56
|
"audit:interactive-approval-projection": "node scripts/interactive-approval-event-projection.js --action doctor --fail-on-drift --fail-on-parse-error",
|
|
@@ -86,7 +92,7 @@
|
|
|
86
92
|
"gate:release-asset-integrity": "node scripts/release-asset-integrity-check.js",
|
|
87
93
|
"report:release-risk-remediation": "node scripts/release-risk-remediation-bundle.js --json",
|
|
88
94
|
"report:moqui-core-regression": "node scripts/moqui-core-regression-suite.js --json",
|
|
89
|
-
"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:steering && npm run audit:clarification-first && npm run gate:git-managed && npm run gate:errorbook-registry-health && npm run gate:errorbook-release && npm run report:interactive-governance -- --fail-on-alert",
|
|
95
|
+
"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 gate:collab-governance && npm run gate:git-managed && npm run gate:errorbook-registry-health && npm run gate:errorbook-release && npm run report:interactive-governance -- --fail-on-alert",
|
|
90
96
|
"publish:manual": "npm publish --access public",
|
|
91
97
|
"install-global": "npm install -g .",
|
|
92
98
|
"uninstall-global": "npm uninstall -g scene-capability-engine"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { runCollabGovernanceGate } = require('../lib/workspace/collab-governance-gate');
|
|
6
|
+
|
|
7
|
+
function parseArgs(argv = []) {
|
|
8
|
+
const options = {
|
|
9
|
+
projectPath: process.cwd(),
|
|
10
|
+
failOnViolation: false,
|
|
11
|
+
json: false,
|
|
12
|
+
help: false
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
16
|
+
const token = argv[index];
|
|
17
|
+
const next = argv[index + 1];
|
|
18
|
+
|
|
19
|
+
if (token === '--project-path' && next) {
|
|
20
|
+
options.projectPath = path.resolve(next);
|
|
21
|
+
index += 1;
|
|
22
|
+
} else if (token === '--fail-on-violation') {
|
|
23
|
+
options.failOnViolation = true;
|
|
24
|
+
} else if (token === '--json') {
|
|
25
|
+
options.json = true;
|
|
26
|
+
} else if (token === '--help' || token === '-h') {
|
|
27
|
+
options.help = true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return options;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function printHelp() {
|
|
35
|
+
const lines = [
|
|
36
|
+
'Usage: node scripts/collab-governance-gate.js [options]',
|
|
37
|
+
'',
|
|
38
|
+
'Options:',
|
|
39
|
+
' --project-path <path> Project path (default: cwd)',
|
|
40
|
+
' --fail-on-violation Exit with code 2 when violations exist',
|
|
41
|
+
' --json Print JSON payload',
|
|
42
|
+
' -h, --help Show help'
|
|
43
|
+
];
|
|
44
|
+
process.stdout.write(`${lines.join('\n')}\n`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (require.main === module) {
|
|
48
|
+
const options = parseArgs(process.argv.slice(2));
|
|
49
|
+
if (options.help) {
|
|
50
|
+
printHelp();
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
runCollabGovernanceGate(options)
|
|
55
|
+
.then((result) => {
|
|
56
|
+
process.exitCode = result.exit_code;
|
|
57
|
+
})
|
|
58
|
+
.catch((error) => {
|
|
59
|
+
const payload = {
|
|
60
|
+
mode: 'collab-governance-gate',
|
|
61
|
+
passed: false,
|
|
62
|
+
error: error.message
|
|
63
|
+
};
|
|
64
|
+
if (options.json) {
|
|
65
|
+
process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
|
|
66
|
+
} else {
|
|
67
|
+
process.stderr.write(`[collab-governance-gate] error=${error.message}\n`);
|
|
68
|
+
}
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = {
|
|
74
|
+
parseArgs,
|
|
75
|
+
runCollabGovernanceGate
|
|
76
|
+
};
|