scene-capability-engine 3.6.32 → 3.6.36

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.
Files changed (83) hide show
  1. package/CHANGELOG.md +86 -1
  2. package/README.md +119 -122
  3. package/README.zh.md +123 -121
  4. package/bin/scene-capability-engine.js +11 -0
  5. package/docs/README.md +21 -32
  6. package/docs/auto-refactor-index.md +384 -0
  7. package/docs/command-reference.md +94 -2
  8. package/docs/magicball-adaptation-task-checklist-v1.md +385 -0
  9. package/docs/magicball-app-bundle-sqlite-and-command-draft.md +539 -0
  10. package/docs/magicball-capability-iteration-api.md +2 -0
  11. package/docs/magicball-capability-iteration-ui.md +2 -0
  12. package/docs/magicball-capability-library.md +2 -0
  13. package/docs/magicball-cli-invocation-examples.md +336 -0
  14. package/docs/magicball-frontend-state-and-command-mapping.md +244 -0
  15. package/docs/magicball-integration-doc-index.md +137 -0
  16. package/docs/magicball-integration-issue-tracker.md +218 -0
  17. package/docs/magicball-mode-home-and-ontology-empty-state-playbook.md +249 -0
  18. package/docs/magicball-sce-adaptation-guide.md +203 -0
  19. package/docs/magicball-three-mode-alignment-plan.md +551 -0
  20. package/docs/magicball-ui-surface-checklist.md +126 -0
  21. package/docs/magicball-write-auth-adaptation-guide.md +328 -0
  22. package/docs/refactor-completion-roadmap.md +116 -0
  23. package/docs/zh/README.md +27 -30
  24. package/docs/zh/refactor-completion-roadmap.md +116 -0
  25. package/lib/app/registry-config.js +73 -0
  26. package/lib/app/registry-sync-service.js +228 -0
  27. package/lib/auto/archive-schema-service.js +276 -0
  28. package/lib/auto/archive-summary.js +60 -0
  29. package/lib/auto/batch-goal-input-service.js +543 -0
  30. package/lib/auto/batch-output.js +201 -0
  31. package/lib/auto/batch-summary-storage-service.js +110 -0
  32. package/lib/auto/close-loop-batch-service.js +116 -0
  33. package/lib/auto/close-loop-controller-service.js +287 -0
  34. package/lib/auto/close-loop-program-service.js +283 -0
  35. package/lib/auto/close-loop-recovery-service.js +191 -0
  36. package/lib/auto/close-loop-session-storage-service.js +50 -0
  37. package/lib/auto/controller-lock-service.js +55 -0
  38. package/lib/auto/controller-output.js +32 -0
  39. package/lib/auto/controller-queue-service.js +127 -0
  40. package/lib/auto/controller-session-storage-service.js +105 -0
  41. package/lib/auto/governance-advisory-service.js +208 -0
  42. package/lib/auto/governance-close-loop-service.js +411 -0
  43. package/lib/auto/governance-maintenance-presenter.js +162 -0
  44. package/lib/auto/governance-maintenance-service.js +112 -0
  45. package/lib/auto/governance-session-presenter.js +70 -0
  46. package/lib/auto/governance-session-storage-service.js +198 -0
  47. package/lib/auto/governance-signals.js +139 -0
  48. package/lib/auto/governance-stats-presenter.js +337 -0
  49. package/lib/auto/governance-stats-service.js +115 -0
  50. package/lib/auto/governance-summary.js +703 -0
  51. package/lib/auto/handoff-capability-matrix-service.js +281 -0
  52. package/lib/auto/handoff-evidence-review-service.js +251 -0
  53. package/lib/auto/handoff-release-evidence-service.js +190 -0
  54. package/lib/auto/handoff-release-gate-history-loaders-service.js +502 -0
  55. package/lib/auto/handoff-release-gate-history-service.js +257 -0
  56. package/lib/auto/handoff-reporting-service.js +1407 -0
  57. package/lib/auto/handoff-run-service.js +486 -0
  58. package/lib/auto/handoff-snapshots-service.js +645 -0
  59. package/lib/auto/observability-service.js +132 -0
  60. package/lib/auto/output-writer.js +34 -0
  61. package/lib/auto/program-auto-remediation-service.js +130 -0
  62. package/lib/auto/program-diagnostics.js +138 -0
  63. package/lib/auto/program-governance-helpers.js +306 -0
  64. package/lib/auto/program-governance-loop-service.js +413 -0
  65. package/lib/auto/program-output.js +106 -0
  66. package/lib/auto/program-summary.js +183 -0
  67. package/lib/auto/recovery-memory-service.js +684 -0
  68. package/lib/auto/recovery-selection-service.js +52 -0
  69. package/lib/auto/retention-policy.js +98 -0
  70. package/lib/auto/session-persistence-service.js +106 -0
  71. package/lib/auto/session-presenter.js +105 -0
  72. package/lib/auto/session-prune-service.js +190 -0
  73. package/lib/auto/session-query-service.js +249 -0
  74. package/lib/auto/spec-protection.js +141 -0
  75. package/lib/commands/app.js +911 -0
  76. package/lib/commands/assurance.js +212 -0
  77. package/lib/commands/auto.js +1091 -11063
  78. package/lib/commands/mode.js +321 -0
  79. package/lib/commands/ontology.js +415 -0
  80. package/lib/commands/pm.js +422 -0
  81. package/lib/ontology/seed-profiles.js +160 -0
  82. package/lib/state/sce-state-store.js +3369 -1200
  83. package/package.json +1 -1
@@ -0,0 +1,328 @@
1
+ # MagicBall Write Auth Adaptation Guide
2
+
3
+ ## Goal
4
+
5
+ Define how MagicBall should adapt to SCE write-authorization requirements.
6
+
7
+ This guide focuses on:
8
+ 1. which actions require authorization
9
+ 2. how MagicBall should request or reuse a lease
10
+ 3. how to pass lease information to SCE
11
+ 4. how to handle denied / expired / invalid lease errors
12
+
13
+ This guide is intentionally frontend-oriented.
14
+
15
+ ## Current SCE Authorization Model
16
+
17
+ SCE uses a write-authorization layer centered on:
18
+ - policy file: `.sce/config/authorization-policy.json`
19
+ - lease storage: `.sce/state/sce-state.sqlite`
20
+ - commands:
21
+ - `sce auth grant`
22
+ - `sce auth status`
23
+ - `sce auth revoke`
24
+
25
+ The runtime enforcement entry is:
26
+ - `ensureWriteAuthorization(...)`
27
+
28
+ ## What MagicBall Should Assume By Default
29
+
30
+ MagicBall should assume:
31
+ 1. read operations do not require lease
32
+ 2. write operations may require lease
33
+ 3. the exact enforcement depends on SCE policy
34
+ 4. frontend must not guess policy internals from static assumptions
35
+
36
+ Therefore, MagicBall should design write flows as:
37
+ - optimistic if lease exists
38
+ - blocked-with-guidance if lease is missing or invalid
39
+
40
+ ## SCE Commands Relevant To Auth
41
+
42
+ ### Grant lease
43
+ ```bash
44
+ sce auth grant --scope <scope> --reason "<reason>" --json
45
+ ```
46
+
47
+ ### Inspect lease status
48
+ ```bash
49
+ sce auth status --json
50
+ sce auth status --lease <lease-id> --json
51
+ ```
52
+
53
+ ### Revoke lease
54
+ ```bash
55
+ sce auth revoke --lease <lease-id> --json
56
+ ```
57
+
58
+ ## Scopes MagicBall Should Care About
59
+
60
+ Current implemented write flows in SCE imply these practical action families:
61
+
62
+ ### App / mode related
63
+ - `app:bundle:register`
64
+ - `app:registry:configure`
65
+ - `app:engineering:attach`
66
+ - `app:engineering:hydrate`
67
+ - `app:engineering:activate`
68
+ - `app:runtime:install`
69
+ - `app:runtime:activate`
70
+
71
+ ### Engineering mode PM data plane
72
+ - `pm:requirement:upsert`
73
+ - `pm:tracking:upsert`
74
+ - `pm:planning:upsert`
75
+ - `pm:change:upsert`
76
+ - `pm:issue:upsert`
77
+
78
+ ### Ontology mode data plane
79
+ - `ontology:er:upsert`
80
+ - `ontology:br:upsert`
81
+ - `ontology:dl:upsert`
82
+
83
+ ### Existing studio/task actions
84
+ - `studio:apply`
85
+ - `studio:release`
86
+ - `studio:rollback`
87
+ - `task:rerun`
88
+
89
+ ## Recommended MagicBall UI Rule
90
+
91
+ ### Rule 1
92
+ Treat all mutating actions as lease-aware actions.
93
+
94
+ ### Rule 2
95
+ Do not hide all write buttons permanently.
96
+ Instead:
97
+ - show action button
98
+ - if no valid lease is present, show locked state or auth prompt before execution
99
+
100
+ ### Rule 3
101
+ For dangerous write actions, require an explicit authorization step even if the button is visible.
102
+
103
+ ## Recommended Frontend State Model
104
+
105
+ MagicBall should keep a lightweight authorization state model:
106
+
107
+ ```ts
108
+ interface WriteLeaseState {
109
+ leaseId: string | null
110
+ subject: string | null
111
+ role: string | null
112
+ scope: string[]
113
+ expiresAt: string | null
114
+ revokedAt: string | null
115
+ active: boolean
116
+ stale: boolean
117
+ }
118
+ ```
119
+
120
+ Recommended derived flags:
121
+ - `hasLease`
122
+ - `leaseActive`
123
+ - `leaseExpired`
124
+ - `scopeSatisfied(action)`
125
+
126
+ ## Recommended Frontend Flow
127
+
128
+ ### 1. Startup / app switch
129
+ When MagicBall starts or switches app/project context:
130
+ 1. call `sce auth status --json`
131
+ 2. cache active leases
132
+ 3. derive whether current user/session can write
133
+
134
+ ### 2. Before a write action
135
+ When user clicks a write action:
136
+ 1. map UI action to SCE action scope
137
+ 2. check local cached lease state
138
+ 3. if lease exists and scope matches, execute command with `--auth-lease <lease-id>`
139
+ 4. if lease missing or insufficient, open auth prompt flow
140
+
141
+ ### 3. Auth prompt flow
142
+ Recommended UI steps:
143
+ 1. show why authorization is required
144
+ 2. show requested action scope
145
+ 3. ask user to authorize
146
+ 4. execute `sce auth grant ... --json`
147
+ 5. cache returned `lease_id`
148
+ 6. retry original write action with `--auth-lease`
149
+
150
+ ## Suggested UI Copy Pattern
151
+
152
+ ### Locked action hint
153
+ - `This action requires SCE write authorization.`
154
+ - `Requested scope: pm:requirement:upsert`
155
+
156
+ ### Grant dialog content
157
+ - `Action`: human-readable action name
158
+ - `Requested scope`: exact SCE scope string
159
+ - `Reason`: user-editable reason text
160
+ - `Password`: if needed by policy
161
+
162
+ ### Success hint
163
+ - `Write authorization granted for 15 minutes.`
164
+
165
+ ### Failure hint
166
+ - `Authorization failed. Check password, lease policy, or requested scope.`
167
+
168
+ ## Recommended Scope Mapping Table
169
+
170
+ | MagicBall UI action | SCE command | Required scope |
171
+ | --- | --- | --- |
172
+ | Save app bundle | `sce app bundle register` | `app:bundle:register` |
173
+ | Update registry config | `sce app registry configure` | `app:registry:configure` |
174
+ | Attach engineering project | `sce app engineering attach` | `app:engineering:attach` |
175
+ | Hydrate engineering workspace | `sce app engineering hydrate` | `app:engineering:hydrate` |
176
+ | Activate engineering workspace | `sce app engineering activate` | `app:engineering:activate` |
177
+ | Install runtime release | `sce app runtime install` | `app:runtime:install` |
178
+ | Activate runtime release | `sce app runtime activate` | `app:runtime:activate` |
179
+ | Save requirement | `sce pm requirement upsert` | `pm:requirement:upsert` |
180
+ | Save tracking item | `sce pm tracking upsert` | `pm:tracking:upsert` |
181
+ | Save plan | `sce pm planning upsert` | `pm:planning:upsert` |
182
+ | Save change request | `sce pm change upsert` | `pm:change:upsert` |
183
+ | Save issue item | `sce pm issue upsert` | `pm:issue:upsert` |
184
+ | Save ER asset | `sce ontology er upsert` | `ontology:er:upsert` |
185
+ | Save BR rule | `sce ontology br upsert` | `ontology:br:upsert` |
186
+ | Save DL chain | `sce ontology dl upsert` | `ontology:dl:upsert` |
187
+ | Apply studio change | `sce studio apply` | `studio:apply` |
188
+ | Release studio result | `sce studio release` | `studio:release` |
189
+ | Rollback studio result | `sce studio rollback` | `studio:rollback` |
190
+ | Rerun task | `sce task rerun` | `task:rerun` |
191
+
192
+ ## Recommended Grant Command Patterns
193
+
194
+ ### Generic lease
195
+ ```bash
196
+ sce auth grant --scope app:runtime:activate --reason "activate selected runtime release" --json
197
+ ```
198
+
199
+ ### Multiple scopes if one workflow batches mutations
200
+ ```bash
201
+ sce auth grant --scope app:engineering:attach,app:engineering:hydrate,app:engineering:activate --reason "initialize engineering workspace" --json
202
+ ```
203
+
204
+ ## How MagicBall Should Pass Lease To SCE
205
+
206
+ For every write command, pass:
207
+ - `--auth-lease <lease-id>`
208
+
209
+ Example:
210
+ ```bash
211
+ sce pm requirement upsert --input requirement.json --auth-lease <lease-id> --json
212
+ ```
213
+
214
+ ## Error Handling Rules
215
+
216
+ MagicBall should not treat all write failures the same.
217
+
218
+ ### Case A: lease required
219
+ Typical symptom:
220
+ - error mentions `Write authorization required`
221
+ - or says lease is required for action
222
+
223
+ Frontend action:
224
+ 1. keep form state intact
225
+ 2. open authorization prompt
226
+ 3. let user retry after grant
227
+
228
+ ### Case B: lease not found
229
+ Typical symptom:
230
+ - error mentions `lease not found`
231
+
232
+ Frontend action:
233
+ 1. clear cached lease id
234
+ 2. force refresh auth status
235
+ 3. reopen grant flow
236
+
237
+ ### Case C: lease expired / revoked
238
+ Typical symptom:
239
+ - error mentions expired / revoked / inactive lease
240
+
241
+ Frontend action:
242
+ 1. mark local lease stale
243
+ 2. force refresh auth status
244
+ 3. ask user to grant again
245
+
246
+ ### Case D: scope mismatch
247
+ Typical symptom:
248
+ - authorization denied for action despite active lease
249
+
250
+ Frontend action:
251
+ 1. show requested scope
252
+ 2. request a new lease with broader or correct scope
253
+
254
+ ### Case E: business validation error
255
+ Typical symptom:
256
+ - payload/field/schema validation failure
257
+ - no auth wording in error message
258
+
259
+ Frontend action:
260
+ 1. do not reopen auth flow
261
+ 2. keep current form state
262
+ 3. show validation feedback only
263
+
264
+ ## Recommended Frontend State Machine
265
+
266
+ ```text
267
+ idle
268
+ -> checking_lease
269
+ -> lease_ready
270
+ -> lease_missing
271
+ -> requesting_lease
272
+ -> lease_granted
273
+ -> executing_write
274
+ -> write_succeeded
275
+ -> write_failed_auth
276
+ -> write_failed_validation
277
+ ```
278
+
279
+ ## Minimal Frontend Implementation Checklist
280
+
281
+ ### Required now
282
+ 1. local lease cache
283
+ 2. `auth status` fetch on startup / app switch
284
+ 3. action-to-scope mapping table
285
+ 4. shared auth prompt dialog
286
+ 5. automatic retry of blocked action after successful grant
287
+
288
+ ### Can wait
289
+ 1. lease auto-refresh before expiry
290
+ 2. batch lease orchestration for multi-step workflows
291
+ 3. lease history panel
292
+ 4. revoke button in UI
293
+
294
+ ## Recommended MagicBall Button Policy
295
+
296
+ ### Safe read-only buttons
297
+ - always enabled
298
+
299
+ ### Write buttons with no lease
300
+ - visible
301
+ - disabled or soft-blocked
302
+ - click opens auth dialog
303
+
304
+ ### Write buttons with valid lease
305
+ - enabled
306
+ - execute command with `--auth-lease`
307
+
308
+ ### High-risk buttons
309
+ Examples:
310
+ - runtime activate
311
+ - engineering activate
312
+ - studio release
313
+ - backup restore
314
+
315
+ Recommended behavior:
316
+ - keep visible
317
+ - require explicit confirmation even with valid lease
318
+
319
+ ## Practical Conclusion
320
+
321
+ MagicBall should now implement write authorization as a shared UI capability, not as page-by-page special handling.
322
+
323
+ The most important thing is:
324
+ - centralize scope mapping
325
+ - centralize lease state
326
+ - centralize retry-after-grant flow
327
+
328
+ That will keep all app/runtime/pm/ontology/studio write flows consistent.
@@ -0,0 +1,116 @@
1
+ # Refactor Completion And Next Roadmap
2
+
3
+ ## Scope
4
+
5
+ This document records the completion state of the `3.6.33` refactor round and defines the next engineering direction.
6
+
7
+ Current stable commits:
8
+
9
+ - `0c9594d` `refactor(auto): finalize close-loop governance split and docs refresh`
10
+ - `0fb49b7` `refactor(handoff): extract capability matrix service`
11
+ - `8ebc5bc` `release: 3.6.33`
12
+
13
+ ## What Is Considered Done
14
+
15
+ This refactor round is considered complete because the main autonomous delivery chain is no longer centered in `lib/commands/auto.js`.
16
+
17
+ Completed extractions:
18
+
19
+ - `lib/auto/close-loop-controller-service.js`
20
+ - `lib/auto/close-loop-batch-service.js`
21
+ - `lib/auto/close-loop-program-service.js`
22
+ - `lib/auto/observability-service.js`
23
+ - `lib/auto/program-summary.js`
24
+ - `lib/auto/program-output.js`
25
+ - `lib/auto/batch-output.js`
26
+ - `lib/auto/program-governance-helpers.js`
27
+ - `lib/auto/program-governance-loop-service.js`
28
+ - `lib/auto/program-auto-remediation-service.js`
29
+ - `lib/auto/output-writer.js`
30
+ - `lib/auto/handoff-capability-matrix-service.js`
31
+
32
+ Supporting cleanup completed in the same round:
33
+
34
+ - README and docs hub restructuring
35
+ - governance summary regression fix
36
+ - governance weekly-ops session telemetry fix
37
+ - session stats `criteria.days` fix
38
+
39
+ ## Resulting Architecture Shift
40
+
41
+ Before this round:
42
+
43
+ - `lib/commands/auto.js` contained both command registration and most major orchestration logic.
44
+ - changes to program or governance behavior were high-risk because too many concerns were coupled.
45
+
46
+ After this round:
47
+
48
+ - `lib/commands/auto.js` is primarily a command-layer shell plus wrappers.
49
+ - major delivery orchestration now lives under `lib/auto/`.
50
+ - the first `auto-handoff` subdomain now has a dedicated service boundary.
51
+
52
+ This is the practical reason the round is treated as complete even though `auto.js` is still large.
53
+
54
+ ## Why Some Work Was Explicitly Deferred
55
+
56
+ Not every remaining function in `lib/commands/auto.js` should be extracted immediately.
57
+
58
+ Deferred on purpose:
59
+
60
+ - low-value helper moves with poor payoff
61
+ - unstable `auto-handoff` micro-extractions that increased regression risk
62
+ - cosmetic-only reductions that do not improve long-term maintainability
63
+
64
+ The rule used during this round was:
65
+
66
+ - keep extractions that create durable service boundaries
67
+ - stop when the next move becomes lower value than the regression risk it introduces
68
+
69
+ ## Remaining High-Value Areas
70
+
71
+ The next meaningful work is no longer the close-loop main path. It is concentrated in `auto-handoff` and a few release/governance support areas.
72
+
73
+ Highest-value remaining themes:
74
+
75
+ 1. `auto-handoff` release evidence and history services
76
+ 2. `auto-handoff` release note / evidence review renderers
77
+ 3. `auto-handoff` baseline and coverage snapshot services
78
+ 4. final documentation and release process hardening
79
+
80
+ ## Recommended Next Round
81
+
82
+ The next round should be treated as a focused `auto-handoff` refactor, not a continuation of generic `auto.js` cleanup.
83
+
84
+ Recommended order:
85
+
86
+ 1. `release evidence` subdomain
87
+ 2. `release gate history` subdomain
88
+ 3. `release note / evidence review` rendering subdomain
89
+ 4. `baseline / coverage snapshot` subdomain
90
+
91
+ Each subdomain should follow the same rule used in `3.6.33`:
92
+
93
+ - extract one coherent service boundary
94
+ - keep command behavior unchanged
95
+ - require unit coverage for the new module
96
+ - require guarded integration coverage before keeping the change
97
+
98
+ ## Validation Baseline
99
+
100
+ The following checks were used to accept the current refactor round:
101
+
102
+ - `npx jest tests/unit/auto --runInBand`
103
+ - `npx jest tests/unit/commands/auto.test.js --runInBand`
104
+ - `npx jest tests/integration/auto-close-loop-cli.integration.test.js tests/integration/version-cli.integration.test.js --runInBand`
105
+ - `npm run test:release`
106
+
107
+ Any next round should continue to use these as the minimum baseline.
108
+
109
+ ## Release Status
110
+
111
+ Current stable release:
112
+
113
+ - version: `3.6.33`
114
+ - tag: `v3.6.33`
115
+
116
+ This version is the baseline for future `auto-handoff` evolution.
package/docs/zh/README.md CHANGED
@@ -1,31 +1,42 @@
1
1
  # SCE 文档总览
2
2
 
3
- 本页仅保留高价值入口,帮助你快速完成从接入到规模化交付。
3
+ 本页只保留高价值入口,帮助你从接入、集成到规模化交付快速找到主路径。
4
4
 
5
5
  ---
6
6
 
7
7
  ## 优先入口
8
8
 
9
9
  - [快速开始](quick-start.md)
10
+ - [AI 工具快速开始](../quick-start-with-ai-tools.md)
10
11
  - [命令参考](../command-reference.md)
11
12
  - [常见问题](../faq.md)
12
13
  - [故障排除](../troubleshooting.md)
13
14
 
14
15
  ---
15
16
 
16
- ## 交付主路径
17
+ ## 核心交付路径
17
18
 
18
19
  - [Spec 工作流](../spec-workflow.md)
19
20
  - [自动闭环指南](../autonomous-control-guide.md)
20
21
  - [多 Agent 协同指南](../multi-agent-coordination-guide.md)
21
- - [Spec 协作指南](../spec-collaboration-guide.md)
22
- - [Spec 锁机制指南](../spec-locking-guide.md)
22
+ - [场景运行时指南](../scene-runtime-guide.md)
23
+ - [Value 可观测指南](../value-observability-guide.md)
24
+ - [本轮重构完成总结与下一轮路线图](refactor-completion-roadmap.md)
25
+
26
+ ---
27
+
28
+ ## 治理与发布
29
+
30
+ - [Errorbook 注册表指南](../errorbook-registry.md)
31
+ - [安全治理默认基线](../security-governance-default-baseline.md)
32
+ - [文档治理](../document-governance.md)
33
+ - [发布检查清单](../release-checklist.md)
34
+ - [发布归档](../releases/README.md)
23
35
 
24
36
  ---
25
37
 
26
38
  ## 场景化能力与 Moqui
27
39
 
28
- - [场景运行时指南](../scene-runtime-guide.md)
29
40
  - [Moqui 模板核心库 Playbook](../moqui-template-core-library-playbook.md)
30
41
  - [Moqui 能力矩阵](../moqui-capability-matrix.md)
31
42
  - [Moqui 标准重建指南](../moqui-standard-rebuild-guide.md)
@@ -33,27 +44,12 @@
33
44
 
34
45
  ---
35
46
 
36
- ## 治理、质量与发布
37
-
38
- - [文档治理](../document-governance.md)
39
- - [安全治理默认基线](../security-governance-default-baseline.md)
40
- - [Errorbook 注册表指南](../errorbook-registry.md)
41
- - [发布检查清单](release-checklist.md)
42
- - [发布归档](releases/README.md)
43
-
44
- ---
45
-
46
- ## 平台管理与运维
47
+ ## 平台与集成
47
48
 
48
49
  - [环境管理指南](../environment-management-guide.md)
49
50
  - [多仓库管理指南](../multi-repo-management-guide.md)
50
51
  - [团队协作指南](../team-collaboration-guide.md)
51
52
  - [手动工作流指南](../manual-workflows-guide.md)
52
-
53
- ---
54
-
55
- ## AI 工具集成
56
-
57
53
  - [Cursor 集成](tools/cursor-guide.md)
58
54
  - [Claude Code 集成](tools/claude-guide.md)
59
55
  - [Windsurf 集成](tools/windsurf-guide.md)
@@ -62,20 +58,21 @@
62
58
 
63
59
  ---
64
60
 
65
- ## 补充阅读
61
+ ## Language
66
62
 
67
- - [Value 可观测指南](value-observability-guide.md)
68
- - [架构说明](../architecture.md)
69
- - [开发者指南](../developer-guide.md)
70
- - [社区入口](../community.md)
63
+ - [English Docs Hub](../README.md)
71
64
 
72
65
  ---
73
66
 
74
- ## Language
67
+ ## 社区
75
68
 
76
- - [English Docs Hub](../README.md)
69
+ - [社区入口](../community.md)
70
+ - [GitHub Discussions](https://github.com/heguangyong/scene-capability-engine/discussions)
71
+ - [GitHub Issues](https://github.com/heguangyong/scene-capability-engine/issues)
77
72
 
78
73
  ---
79
74
 
80
- **版本**:3.3.26
81
- **最后更新**:2026-03-02
75
+ **版本**:3.6.34
76
+ **最后更新**:2026-03-08
77
+
78
+
@@ -0,0 +1,116 @@
1
+ # 本轮重构完成总结与下一轮路线图
2
+
3
+ ## 范围
4
+
5
+ 本文件用于记录 `3.6.33` 这一轮重构的完成状态,并明确下一阶段的工程方向。
6
+
7
+ 当前稳定提交:
8
+
9
+ - `0c9594d` `refactor(auto): finalize close-loop governance split and docs refresh`
10
+ - `0fb49b7` `refactor(handoff): extract capability matrix service`
11
+ - `8ebc5bc` `release: 3.6.33`
12
+
13
+ ## 什么算完成
14
+
15
+ 这一轮重构之所以可以判定为完成,不是因为 `lib/commands/auto.js` 里一个大函数都不剩,而是因为最核心的自动交付主链已经不再以它为中心。
16
+
17
+ 本轮已完成下沉:
18
+
19
+ - `lib/auto/close-loop-controller-service.js`
20
+ - `lib/auto/close-loop-batch-service.js`
21
+ - `lib/auto/close-loop-program-service.js`
22
+ - `lib/auto/observability-service.js`
23
+ - `lib/auto/program-summary.js`
24
+ - `lib/auto/program-output.js`
25
+ - `lib/auto/batch-output.js`
26
+ - `lib/auto/program-governance-helpers.js`
27
+ - `lib/auto/program-governance-loop-service.js`
28
+ - `lib/auto/program-auto-remediation-service.js`
29
+ - `lib/auto/output-writer.js`
30
+ - `lib/auto/handoff-capability-matrix-service.js`
31
+
32
+ 本轮同步完成的收口工作:
33
+
34
+ - README 与 docs hub 重组
35
+ - governance summary 真实回归修复
36
+ - governance weekly-ops session telemetry 修复
37
+ - session stats `criteria.days` 字段修复
38
+
39
+ ## 架构变化
40
+
41
+ 在本轮之前:
42
+
43
+ - `lib/commands/auto.js` 同时承担命令注册和大量主执行逻辑。
44
+ - program / governance 行为一旦调整,回归风险会很高,因为职责耦合过重。
45
+
46
+ 在本轮之后:
47
+
48
+ - `lib/commands/auto.js` 更接近命令层壳子与 wrapper。
49
+ - 主要交付链路已经迁移到 `lib/auto/`。
50
+ - `auto-handoff` 也已经拥有了第一个完整专题边界。
51
+
52
+ 这就是为什么即使 `auto.js` 仍然很大,这一轮也可以被定义为完成。
53
+
54
+ ## 为什么有些工作被明确延后
55
+
56
+ 不是 `auto.js` 里剩下的每个函数,都值得马上继续拆。
57
+
58
+ 本轮明确延后的内容:
59
+
60
+ - 收益很低的 helper 搬运
61
+ - 一旦切出去就容易引入回归的 `auto-handoff` 零碎微边界
62
+ - 对长期维护性帮助不大的纯 cosmetic 收缩
63
+
64
+ 本轮执行标准是:
65
+
66
+ - 保留能形成长期 service 边界的拆分
67
+ - 当下一刀的收益低于回归风险时,立即停止
68
+
69
+ ## 剩余高价值方向
70
+
71
+ 下一轮真正值得继续做的,不再是 close-loop 主链,而是 `auto-handoff` 及少量发布治理支持域。
72
+
73
+ 剩余高价值主题:
74
+
75
+ 1. `auto-handoff` release evidence 子域
76
+ 2. `auto-handoff` release gate history 子域
77
+ 3. `auto-handoff` release notes / evidence review 渲染子域
78
+ 4. `auto-handoff` baseline / coverage snapshot 子域
79
+
80
+ ## 建议的下一轮
81
+
82
+ 下一轮建议明确命名为 `auto-handoff` 专题重构,而不是继续做泛化的 `auto.js` 清理。
83
+
84
+ 建议顺序:
85
+
86
+ 1. `release evidence` 子域
87
+ 2. `release gate history` 子域
88
+ 3. `release notes / evidence review` 渲染子域
89
+ 4. `baseline / coverage snapshot` 子域
90
+
91
+ 每个子域都沿用本轮的标准:
92
+
93
+ - 一次只切一个完整边界
94
+ - 命令行为保持不变
95
+ - 新模块必须有单测
96
+ - 通过关键 integration 回归后才保留
97
+
98
+ ## 验证基线
99
+
100
+ 本轮用于验收的最低基线:
101
+
102
+ - `npx jest tests/unit/auto --runInBand`
103
+ - `npx jest tests/unit/commands/auto.test.js --runInBand`
104
+ - `npx jest tests/integration/auto-close-loop-cli.integration.test.js tests/integration/version-cli.integration.test.js --runInBand`
105
+ - `npm run test:release`
106
+
107
+ 下一轮建议继续沿用这套基线。
108
+
109
+ ## 发布状态
110
+
111
+ 当前稳定版本:
112
+
113
+ - version: `3.6.33`
114
+ - tag: `v3.6.33`
115
+
116
+ 后续 `auto-handoff` 的继续演进,应以这个版本作为新的稳定基线。