scene-capability-engine 3.6.57 → 3.6.58

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 (34) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +5 -3
  3. package/README.zh.md +5 -3
  4. package/bin/scene-capability-engine.js +2 -0
  5. package/docs/command-reference.md +72 -0
  6. package/docs/magicball-adaptation-task-checklist-v1.md +65 -10
  7. package/docs/magicball-cli-invocation-examples.md +53 -8
  8. package/docs/magicball-engineering-projection-contract.md +175 -0
  9. package/docs/magicball-frontend-state-and-command-mapping.md +42 -5
  10. package/docs/magicball-integration-doc-index.md +19 -5
  11. package/docs/magicball-integration-issue-tracker.md +15 -5
  12. package/docs/magicball-mode-home-and-ontology-empty-state-playbook.md +13 -5
  13. package/docs/magicball-project-portfolio-contract.md +216 -0
  14. package/docs/magicball-sce-adaptation-guide.md +18 -4
  15. package/docs/magicball-ui-surface-checklist.md +25 -0
  16. package/docs/magicball-write-auth-adaptation-guide.md +3 -1
  17. package/docs/release-checklist.md +8 -0
  18. package/docs/releases/README.md +1 -0
  19. package/docs/releases/v3.6.58.md +27 -0
  20. package/docs/zh/release-checklist.md +8 -0
  21. package/docs/zh/releases/README.md +1 -0
  22. package/docs/zh/releases/v3.6.58.md +27 -0
  23. package/lib/app/engineering-scaffold-service.js +154 -0
  24. package/lib/commands/app.js +442 -13
  25. package/lib/commands/project.js +105 -0
  26. package/lib/commands/scene.js +16 -0
  27. package/lib/project/portfolio-projection-service.js +389 -0
  28. package/lib/project/supervision-projection-service.js +329 -0
  29. package/lib/project/target-resolution-service.js +180 -0
  30. package/lib/scene/delivery-projection-service.js +650 -0
  31. package/package.json +6 -2
  32. package/scripts/magicball-engineering-contract-audit.js +347 -0
  33. package/scripts/magicball-project-contract-audit.js +254 -0
  34. package/template/.sce/README.md +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.6.58] - 2026-03-19
11
+
12
+ ### Added
13
+ - Added `sce scene delivery show --scene <scene-id> --json` as the canonical delivery projection envelope for MagicBall/IDE engineering surfaces.
14
+ - Added canonical `sce app engineering preview|ownership|open|import|scaffold` read/result contracts, plus corresponding MagicBall-facing contract docs and audits.
15
+ - Added `sce project portfolio show --json`, `sce project target resolve --json`, and `sce project supervision show --project <project-id> --json` for phase-1 multi-project roster, routing preflight, and project-scoped supervision.
16
+ - Added MagicBall multi-project contract documentation and `audit:magicball-project-contract` so release/publish flow now checks project portfolio/target/supervision doc drift.
17
+
18
+ ### Changed
19
+ - MagicBall entry docs, CLI examples, frontend mapping, checklist, issue tracker, README, and release checklist now explicitly include multi-project shell integration through `project portfolio / target resolve / supervision`.
20
+ - Prepublish release gating now also enforces MagicBall multi-project contract consistency alongside the existing engineering contract audit.
21
+
10
22
  ## [3.6.57] - 2026-03-17
11
23
 
12
24
  ### Added
package/README.md CHANGED
@@ -169,10 +169,12 @@ MagicBall-specific integration surfaces now also include:
169
169
  - `sce app bundle list|show|register`
170
170
  - `sce app collection list|show|apply`
171
171
  - `sce app install-state list`
172
+ - `sce scene delivery show`
172
173
  - `sce scene workspace list|show|apply`
173
174
  - `sce app registry status|configure|sync*`
174
175
  - `sce app runtime show|releases|install|activate|uninstall`
175
- - `sce app engineering show|attach|hydrate|activate`
176
+ - `sce app engineering preview|ownership|open|import|show|attach|hydrate|scaffold|activate`
177
+ - `sce project portfolio show|target resolve|supervision show`
176
178
  - `sce mode application|ontology|engineering home`
177
179
  - `sce pm requirement|tracking|planning|change|issue ... --json`
178
180
  - `sce ontology er|br|dl ... --json`
@@ -228,5 +230,5 @@ MIT. See [LICENSE](LICENSE).
228
230
 
229
231
  ---
230
232
 
231
- **Version**: 3.6.57
232
- **Last Updated**: 2026-03-17
233
+ **Version**: 3.6.58
234
+ **Last Updated**: 2026-03-19
package/README.zh.md CHANGED
@@ -174,10 +174,12 @@ SCE 默认是强治理的。
174
174
  - `sce app bundle list|show|register`
175
175
  - `sce app collection list|show|apply`
176
176
  - `sce app install-state list`
177
+ - `sce scene delivery show`
177
178
  - `sce scene workspace list|show|apply`
178
179
  - `sce app registry status|configure|sync*`
179
180
  - `sce app runtime show|releases|install|activate|uninstall`
180
- - `sce app engineering show|attach|hydrate|activate`
181
+ - `sce app engineering preview|ownership|open|import|show|attach|hydrate|scaffold|activate`
182
+ - `sce project portfolio show|target resolve|supervision show`
181
183
  - `sce mode application|ontology|engineering home`
182
184
  - `sce pm requirement|tracking|planning|change|issue ... --json`
183
185
  - `sce ontology er|br|dl ... --json`
@@ -233,5 +235,5 @@ MIT,见 [LICENSE](LICENSE)。
233
235
 
234
236
  ---
235
237
 
236
- **版本**:3.6.57
237
- **最后更新**:2026-03-17
238
+ **版本**:3.6.58
239
+ **最后更新**:2026-03-19
@@ -1066,9 +1066,11 @@ registerCapabilityCommands(program);
1066
1066
  const { registerAppCommands } = require('../lib/commands/app');
1067
1067
  const { registerDeviceCommands } = require('../lib/commands/device');
1068
1068
  const { registerModeCommands } = require('../lib/commands/mode');
1069
+ const { registerProjectCommands } = require('../lib/commands/project');
1069
1070
  registerDeviceCommands(program);
1070
1071
  registerAppCommands(program);
1071
1072
  registerModeCommands(program);
1073
+ registerProjectCommands(program);
1072
1074
  const { registerPmCommands } = require('../lib/commands/pm');
1073
1075
  registerPmCommands(program);
1074
1076
  const { registerOntologyCommands } = require('../lib/commands/ontology');
@@ -411,6 +411,10 @@ sce scene workspace list --json
411
411
  sce scene workspace show --workspace sales --json
412
412
  sce scene workspace apply --workspace sales --json
413
413
 
414
+ # Scene delivery projection
415
+ sce scene delivery show --scene scene.demo --json
416
+ sce scene delivery show --scene scene.demo --spec 01-00-demo --json
417
+
414
418
  # Configure and sync remote registries
415
419
  sce app registry status --json
416
420
  sce app registry configure --bundle-index-url <path-or-url> --service-index-url <path-or-url> --json
@@ -428,9 +432,14 @@ sce app install-state list --json
428
432
  sce app install-state list --install-status installed --json
429
433
 
430
434
  # Engineering projection
435
+ sce app engineering preview --app customer-order-demo --json
436
+ sce app engineering ownership --app customer-order-demo --json
437
+ sce app engineering open --app customer-order-demo --json
438
+ sce app engineering import --app customer-order-demo --json
431
439
  sce app engineering show --app customer-order-demo --json
432
440
  sce app engineering attach --app customer-order-demo --repo <repo-url> --branch main --json
433
441
  sce app engineering hydrate --app customer-order-demo --json
442
+ sce app engineering scaffold --app customer-order-demo --overwrite-policy missing-only --json
434
443
  sce app engineering activate --app customer-order-demo --json
435
444
 
436
445
  # Three-mode home projections
@@ -2651,6 +2660,69 @@ Overall Health: 2 healthy, 1 unhealthy
2651
2660
 
2652
2661
  ---
2653
2662
 
2663
+ ## Project Portfolio And Supervision
2664
+
2665
+ #### `sce project portfolio show`
2666
+
2667
+ Inspect the canonical caller-visible project roster across registered workspaces and the current unregistered `.sce` project when applicable.
2668
+
2669
+ **Usage:**
2670
+ ```bash
2671
+ sce project portfolio show [options]
2672
+ ```
2673
+
2674
+ **Options:**
2675
+ - `--workspace <name>` - Resolve caller context against one registered workspace without switching the global active workspace
2676
+ - `--json` - Output the canonical `ProjectPortfolioProjection`
2677
+
2678
+ **Behavior:**
2679
+ - Reuses registered workspace visibility from multi-workspace state
2680
+ - Marks inaccessible or partial projects explicitly instead of dropping them
2681
+ - Reuses project-local session governance signals to summarize active sessions and last activity
2682
+
2683
+ #### `sce project target resolve`
2684
+
2685
+ Resolve one target project for cross-project flows without mutating active workspace selection.
2686
+
2687
+ **Usage:**
2688
+ ```bash
2689
+ sce project target resolve [options]
2690
+ ```
2691
+
2692
+ **Options:**
2693
+ - `--request <text>` - Routing request text
2694
+ - `--current-project <id>` - Caller asserted current project id
2695
+ - `--workspace <name>` - Resolve caller context against one registered workspace
2696
+ - `--device <id>` - Opaque caller device id
2697
+ - `--tool-instance-id <id>` - Opaque caller tool instance id
2698
+ - `--json` - Output the canonical `ProjectTargetResolution`
2699
+
2700
+ **Behavior:**
2701
+ - Returns `current-project`, `resolved-other-project`, `ambiguous`, or `unresolved`
2702
+ - Echoes caller context used during resolution
2703
+ - Returns alternative candidates for ambiguous matches
2704
+
2705
+ #### `sce project supervision show`
2706
+
2707
+ Inspect one project-scoped supervision snapshot with blocked, handoff, risk, and active items.
2708
+
2709
+ **Usage:**
2710
+ ```bash
2711
+ sce project supervision show --project <id> [options]
2712
+ ```
2713
+
2714
+ **Options:**
2715
+ - `--project <id>` - Visible project id from the portfolio projection
2716
+ - `--cursor <cursor>` - Best-effort checkpoint input; phase-1 still returns a full snapshot
2717
+ - `--json` - Output the canonical `ProjectSupervisionProjection`
2718
+
2719
+ **Behavior:**
2720
+ - Reuses project-local session governance, spec governance, and report artifacts
2721
+ - Preserves scene/spec/event drillback fields when evidence is available
2722
+ - Returns an opaque snapshot cursor for polling without pretending to expose a raw event stream
2723
+
2724
+ ---
2725
+
2654
2726
  ## See Also
2655
2727
 
2656
2728
  - [Multi-Repository Management Guide](./multi-repo-management-guide.md)
@@ -12,12 +12,61 @@ This checklist is meant for:
12
12
  ## Scope
13
13
 
14
14
  Current checklist covers:
15
- 1. app selection and mode switching
16
- 2. application mode adaptation
17
- 3. ontology mode adaptation
18
- 4. engineering mode adaptation
19
- 5. write authorization handling
20
- 6. demo app verification
15
+ 1. multi-project workspace shell
16
+ 2. app selection and mode switching
17
+ 3. application mode adaptation
18
+ 4. ontology mode adaptation
19
+ 5. engineering mode adaptation
20
+ 6. write authorization handling
21
+ 7. demo app verification
22
+
23
+ ## Phase 0: Multi-project Workspace Shell
24
+
25
+ ### Task 0.1
26
+ Load the engine-owned project roster before building a multi-project shell.
27
+
28
+ Command:
29
+ ```bash
30
+ sce project portfolio show --json
31
+ ```
32
+
33
+ Done when:
34
+ - project switcher is driven by `projects[]`
35
+ - current project marker comes from `activeProjectId`
36
+ - degraded or inaccessible projects are rendered explicitly
37
+
38
+ ### Task 0.2
39
+ Use `projectId` as the frontend multi-project route token.
40
+
41
+ Done when:
42
+ - registered projects do not depend on path heuristics in the UI
43
+ - frontend no longer rebuilds project identity from local workspace cache alone
44
+
45
+ ### Task 0.3
46
+ Preflight free-text cross-project requests before opening a project-bound assistant or orchestration flow.
47
+
48
+ Command:
49
+ ```bash
50
+ sce project target resolve --request "<text>" --current-project <project-id> --json
51
+ ```
52
+
53
+ Done when:
54
+ - `current-project` and `resolved-other-project` are handled separately
55
+ - `ambiguous` shows a candidate chooser instead of silent auto-selection
56
+ - unresolved routing preserves request text and reason code for clarification
57
+
58
+ ### Task 0.4
59
+ Render project health from the project-scoped supervision snapshot.
60
+
61
+ Command:
62
+ ```bash
63
+ sce project supervision show --project <project-id> --json
64
+ ```
65
+
66
+ Done when:
67
+ - blocked / handoff / risk / active counters come from backend summary directly
68
+ - drillback panels use `items[]` directly
69
+ - frontend does not present `cursor` as a raw event-stream offset
21
70
 
22
71
  ## Phase 1: App Entry And Mode Switching
23
72
 
@@ -55,7 +104,7 @@ sce mode engineering home --app customer-order-demo --json
55
104
  Done when:
56
105
  - all three mode entry pages are driven by these commands
57
106
  - frontend no longer reconstructs runtime/ontology/engineering binding itself
58
- - frontend loads them sequentially in this order: application -> ontology -> engineering -> engineering show
107
+ - frontend loads them sequentially in this order: application -> ontology -> engineering -> scene delivery -> engineering preview -> engineering ownership
59
108
  - frontend does not switch these four reads back to parallel loading until `Issue 001` is explicitly closed in `docs/magicball-integration-issue-tracker.md`
60
109
 
61
110
  ## Phase 2: Application Mode
@@ -263,15 +312,20 @@ Wire engineering workspace flow.
263
312
 
264
313
  Commands:
265
314
  ```bash
266
- sce app engineering show --app customer-order-demo --json
315
+ sce app engineering preview --app customer-order-demo --json
316
+ sce app engineering ownership --app customer-order-demo --json
317
+ sce app engineering open --app customer-order-demo --json
318
+ sce app engineering import --app customer-order-demo --json
267
319
  sce app engineering attach --app customer-order-demo --repo <repo-url> --branch main --json
268
320
  sce app engineering hydrate --app customer-order-demo --json
321
+ sce app engineering scaffold --app customer-order-demo --overwrite-policy missing-only --json
269
322
  sce app engineering activate --app customer-order-demo --json
270
323
  ```
271
324
 
272
325
  Done when:
273
- - MagicBall can detect attached/not-attached state
274
- - MagicBall can trigger attach/hydrate/activate
326
+ - MagicBall can detect readiness via preview without client-side field synthesis
327
+ - MagicBall can render conservative ownership relation without guessing missing links
328
+ - MagicBall can trigger attach/hydrate/scaffold/activate
275
329
  - active engineering workspace path is shown in UI
276
330
 
277
331
  ## Phase 5: Write Authorization
@@ -301,6 +355,7 @@ Commands that matter now:
301
355
  - `sce app registry configure`
302
356
  - `sce app engineering attach`
303
357
  - `sce app engineering hydrate`
358
+ - `sce app engineering scaffold`
304
359
  - `sce app engineering activate`
305
360
  - `sce app runtime install`
306
361
  - `sce app runtime activate`
@@ -21,7 +21,19 @@ Assume:
21
21
 
22
22
  ## 1. Workspace Bootstrap
23
23
 
24
- ### 1.0 Read current device baseline
24
+ ### 1.0 Read multi-project portfolio baseline
25
+ ```bash
26
+ sce project portfolio show --json
27
+ sce project target resolve --request "continue customer-order-demo" --json
28
+ sce project supervision show --project workspace:customer-order-demo --json
29
+ ```
30
+
31
+ Expected use:
32
+ - build project switcher from engine-owned roster
33
+ - preflight cross-project free-text routing before assistant/orchestration actions
34
+ - render one project-scoped health summary without replaying raw event streams
35
+
36
+ ### 1.1 Read current device baseline
25
37
  ```bash
26
38
  sce device current --json
27
39
  sce device override show --json
@@ -62,7 +74,7 @@ Example local override patch:
62
74
  }
63
75
  ```
64
76
 
65
- ### 1.1 App bundle identity
77
+ ### 1.2 App bundle identity
66
78
  ```bash
67
79
  sce app bundle show --app customer-order-demo --json
68
80
  ```
@@ -72,18 +84,20 @@ Expected use:
72
84
  - cache `app_key`
73
85
  - cache app-level bundle bindings
74
86
 
75
- ### 1.2 Serialized mode-home bootstrap
87
+ ### 1.3 Serialized mode-home bootstrap
76
88
  Run in this order only:
77
89
 
78
90
  ```bash
79
91
  sce mode application home --app customer-order-demo --json
80
92
  sce mode ontology home --app customer-order-demo --json
81
93
  sce mode engineering home --app customer-order-demo --json
82
- sce app engineering show --app customer-order-demo --json
94
+ sce scene delivery show --scene scene.customer-order-demo --json
95
+ sce app engineering preview --app customer-order-demo --json
96
+ sce app engineering ownership --app customer-order-demo --json
83
97
  ```
84
98
 
85
99
  Recommended frontend rule:
86
- - do not parallelize these four calls during current verification window
100
+ - do not parallelize these six calls during current verification window
87
101
 
88
102
  ## 2. Application Mode Examples
89
103
 
@@ -185,9 +199,33 @@ sce assurance backup list --json
185
199
  sce assurance config switches --json
186
200
  ```
187
201
 
188
- ### 4.4 Read engineering project detail
202
+ ### 4.4 Read engineering delivery projection
203
+ ```bash
204
+ sce scene delivery show --scene scene.customer-order-demo --json
205
+ ```
206
+
207
+ ### 4.5 Read engineering project readiness preview
208
+ ```bash
209
+ sce app engineering preview --app customer-order-demo --json
210
+ ```
211
+
212
+ ### 4.6 Read engineering ownership relation
213
+ ```bash
214
+ sce app engineering ownership --app customer-order-demo --json
215
+ ```
216
+
217
+ ### 4.7 Read canonical open/import envelopes
218
+ ```bash
219
+ sce app engineering open --app customer-order-demo --json
220
+ sce app engineering import --app customer-order-demo --json
221
+ ```
222
+
223
+ ### 4.8 Mutate engineering workspace bindings
189
224
  ```bash
190
- sce app engineering show --app customer-order-demo --json
225
+ sce app engineering attach --app customer-order-demo --repo <repo-url> --branch main --json
226
+ sce app engineering hydrate --app customer-order-demo --json
227
+ sce app engineering scaffold --app customer-order-demo --overwrite-policy missing-only --json
228
+ sce app engineering activate --app customer-order-demo --json
191
229
  ```
192
230
 
193
231
  ## 5. Write Authorization Examples
@@ -316,6 +354,7 @@ async function runSceJson(args: string[]) {
316
354
  ### 8.2 Serialized workspace bootstrap wrapper
317
355
  ```ts
318
356
  async function loadWorkspace(appKey: string) {
357
+ const projectPortfolio = await runSceJson(['project', 'portfolio', 'show', '--json']);
319
358
  const appBundle = await runSceJson(['app', 'bundle', 'show', '--app', appKey, '--json']);
320
359
  const applicationHome = await runSceJson(['mode', 'application', 'home', '--app', appKey, '--json']);
321
360
  const ontologyHome = await runSceJson(['mode', 'ontology', 'home', '--app', appKey, '--json']);
@@ -323,6 +362,7 @@ async function loadWorkspace(appKey: string) {
323
362
  const engineeringDetail = await runSceJson(['app', 'engineering', 'show', '--app', appKey, '--json']);
324
363
 
325
364
  return {
365
+ projectPortfolio,
326
366
  appBundle,
327
367
  applicationHome,
328
368
  ontologyHome,
@@ -360,11 +400,16 @@ Suggested error bundle:
360
400
  Run this full sequence when verifying MagicBall local integration:
361
401
 
362
402
  ```bash
403
+ sce project portfolio show --json
404
+ sce project target resolve --request "continue customer-order-demo" --json
405
+ sce project supervision show --project workspace:customer-order-demo --json
363
406
  sce app bundle show --app customer-order-demo --json
364
407
  sce mode application home --app customer-order-demo --json
365
408
  sce mode ontology home --app customer-order-demo --json
366
409
  sce mode engineering home --app customer-order-demo --json
367
- sce app engineering show --app customer-order-demo --json
410
+ sce scene delivery show --scene scene.customer-order-demo --json
411
+ sce app engineering preview --app customer-order-demo --json
412
+ sce app engineering ownership --app customer-order-demo --json
368
413
  sce ontology triad summary --json
369
414
  sce pm requirement list --json
370
415
  sce assurance resource status --json
@@ -0,0 +1,175 @@
1
+ # MagicBall Engineering Projection Contract
2
+
3
+ ## Goal
4
+
5
+ Provide one narrow contract document for the current engineering-facing SCE payloads that MagicBall should consume directly.
6
+
7
+ This document is intentionally limited to:
8
+ - delivery projection
9
+ - engineering readiness preview
10
+ - engineering ownership relation
11
+ - canonical open/import result envelopes
12
+ - scaffold result contract
13
+
14
+ It does not redefine:
15
+ - mode-home payloads
16
+ - PM / ontology / assurance tables
17
+ - write authorization flow
18
+
19
+ ## Current Read Models
20
+
21
+ ### 1. Delivery projection
22
+
23
+ Command:
24
+
25
+ ```bash
26
+ sce scene delivery show --scene <scene-id> --json
27
+ ```
28
+
29
+ Frontend should rely on:
30
+ - `summary`
31
+ - `delivery`
32
+ - `records`
33
+ - `scene`
34
+ - `spec`
35
+
36
+ Use it for:
37
+ - engineering delivery column
38
+ - phase / status / evidence rendering
39
+ - showing spec-bound delivery progress without frontend-side synthesis
40
+
41
+ ### 2. Engineering readiness preview
42
+
43
+ Command:
44
+
45
+ ```bash
46
+ sce app engineering preview --app <app-key> --json
47
+ ```
48
+
49
+ Stable fields:
50
+ - `summary.attached`
51
+ - `summary.hydrated`
52
+ - `summary.active`
53
+ - `summary.sourceKnown`
54
+ - `summary.projectionReady`
55
+ - `summary.readinessReasonCodes[]`
56
+ - `summary.nextActions[]`
57
+ - `summary.workspacePath`
58
+ - `summary.repoUrl`
59
+ - `summary.branch`
60
+ - `summary.codeVersion`
61
+
62
+ Rule:
63
+ - frontend should use `readinessReasonCodes` and `nextActions` directly
64
+ - frontend should not infer readiness by reverse-engineering `repoUrl/workspacePath/metadata`
65
+
66
+ ### 3. Engineering ownership relation
67
+
68
+ Command:
69
+
70
+ ```bash
71
+ sce app engineering ownership --app <app-key> --json
72
+ ```
73
+
74
+ Stable fields:
75
+ - `summary.appKey`
76
+ - `summary.workspaceId`
77
+ - `summary.userId`
78
+ - `summary.deviceId`
79
+ - `summary.ownershipType`
80
+ - `summary.sharedPolicy`
81
+
82
+ Ownership type meanings:
83
+ - `local`: SCE has evidence this engineering workspace is local to the current device context
84
+ - `shared`: SCE has explicit shared ownership evidence or policy
85
+ - `unresolved`: SCE does not have enough evidence and will not guess
86
+
87
+ Rule:
88
+ - treat `null` link fields as intentionally unknown
89
+ - do not create a frontend-owned fallback ownership registry
90
+
91
+ ## Current Action Envelopes
92
+
93
+ ### 4. Canonical open/import result
94
+
95
+ Commands:
96
+
97
+ ```bash
98
+ sce app engineering open --app <app-key> --json
99
+ sce app engineering import --app <app-key> --json
100
+ ```
101
+
102
+ Stable fields:
103
+ - `mode`
104
+ - `success`
105
+ - `summary`
106
+ - `preview`
107
+ - `steps[]`
108
+
109
+ Stable step keys:
110
+ - `register`
111
+ - `attach`
112
+ - `hydrate`
113
+ - `activate`
114
+
115
+ Stable step status values:
116
+ - `done`
117
+ - `pending`
118
+ - `skipped`
119
+ - `failed`
120
+
121
+ Rule:
122
+ - all four step keys remain ordered
123
+ - non-applicable work reports `skipped`
124
+ - frontend should render the step list directly instead of inferring flow order from command history
125
+
126
+ ### 5. Scaffold result
127
+
128
+ Command:
129
+
130
+ ```bash
131
+ sce app engineering scaffold --app <app-key> --overwrite-policy missing-only --json
132
+ ```
133
+
134
+ Stable fields:
135
+ - `summary.workspacePath`
136
+ - `summary.createdDirectoryCount`
137
+ - `summary.skippedDirectoryCount`
138
+ - `summary.failedDirectoryCount`
139
+ - `summary.createdFileCount`
140
+ - `summary.skippedFileCount`
141
+ - `summary.failedFileCount`
142
+ - `summary.overwritePolicy`
143
+
144
+ Overwrite policy values:
145
+ - `never`
146
+ - `missing-only`
147
+ - `explicit`
148
+
149
+ Rule:
150
+ - scaffold only initializes the SCE baseline under the engineering workspace
151
+ - scaffold does not authorize frontend to invent or rewrite business code layout
152
+ - repeated runs should be rendered as explicit skipped work, not as silent success
153
+
154
+ ## Recommended Frontend Consumption Order
155
+
156
+ For engineering-mode shell bootstrap, prefer:
157
+
158
+ 1. `sce mode engineering home --app <app-key> --json`
159
+ 2. `sce scene delivery show --scene <scene-id> --json`
160
+ 3. `sce app engineering preview --app <app-key> --json`
161
+ 4. `sce app engineering ownership --app <app-key> --json`
162
+
163
+ For user-triggered engineering actions, prefer:
164
+
165
+ 1. preview first
166
+ 2. then `open` or `import` if the UI wants one canonical action-progress envelope
167
+ 3. then explicit write actions: `attach`, `hydrate`, `scaffold`, `activate`
168
+ 4. refresh `preview` and `ownership` after successful mutation
169
+
170
+ ## Guardrails
171
+
172
+ - Do not treat `show` as the primary contract surface; it remains a compatibility alias.
173
+ - Do not derive ownership from missing fields by guesswork.
174
+ - Do not treat scaffold as permission to generate arbitrary business code.
175
+ - Do not replace backend readiness/step semantics with frontend-invented labels.
@@ -22,6 +22,7 @@ The current frontend-sensitive surfaces are:
22
22
  2. ontology empty-state and starter-seed initialization
23
23
  3. write-error presentation and retry boundaries
24
24
  4. timeline / task feedback handoff points
25
+ 5. multi-project portfolio / routing / supervision
25
26
 
26
27
  ## 2. Page State Ownership
27
28
 
@@ -38,7 +39,9 @@ interface AppWorkspaceState {
38
39
  applicationHome: Record<string, unknown> | null
39
40
  ontologyHome: Record<string, unknown> | null
40
41
  engineeringHome: Record<string, unknown> | null
41
- engineeringDetail: Record<string, unknown> | null
42
+ sceneDelivery: Record<string, unknown> | null
43
+ engineeringPreview: Record<string, unknown> | null
44
+ engineeringOwnership: Record<string, unknown> | null
42
45
  boot: ModeBootState
43
46
  }
44
47
  ```
@@ -48,11 +51,35 @@ Owned commands:
48
51
  - `sce mode application home --app <app-key> --json`
49
52
  - `sce mode ontology home --app <app-key> --json`
50
53
  - `sce mode engineering home --app <app-key> --json`
51
- - `sce app engineering show --app <app-key> --json`
54
+ - `sce scene delivery show --scene <scene-id> --json`
55
+ - `sce app engineering preview --app <app-key> --json`
56
+ - `sce app engineering ownership --app <app-key> --json`
52
57
 
53
58
  Rule:
54
59
  - this shell owns mode bootstrap and should not delegate command ordering to nested tabs
55
60
 
61
+ ### 2.1.1 Multi-project shell state
62
+
63
+ Recommended shape:
64
+
65
+ ```ts
66
+ interface ProjectWorkspaceShellState {
67
+ projectPortfolio: Record<string, unknown> | null
68
+ currentProjectId: string | null
69
+ projectTarget: Record<string, unknown> | null
70
+ projectSupervision: Record<string, unknown> | null
71
+ }
72
+ ```
73
+
74
+ Owned commands:
75
+ - `sce project portfolio show --json`
76
+ - `sce project target resolve --request <text> --current-project <project-id> --json`
77
+ - `sce project supervision show --project <project-id> --json`
78
+
79
+ Rule:
80
+ - multi-project shell must consume engine-owned project truth directly
81
+ - target resolution must be treated as preflight and must not mutate active workspace selection implicitly
82
+
56
83
  ### 2.2 Ontology Page State
57
84
 
58
85
  Recommended shape:
@@ -122,10 +149,12 @@ Rule:
122
149
  | Bootstrap step 1 | `sce mode application home --app <app-key> --json` | `applicationHome` | render app hero / release status | stop boot, allow step retry |
123
150
  | Bootstrap step 2 | `sce mode ontology home --app <app-key> --json` | `ontologyHome` | render ontology summary shell | keep app section visible, allow step retry |
124
151
  | Bootstrap step 3 | `sce mode engineering home --app <app-key> --json` | `engineeringHome` | render engineering summary shell | keep prior sections visible, allow step retry |
125
- | Bootstrap step 4 | `sce app engineering show --app <app-key> --json` | `engineeringDetail` | render repo/workspace detail | keep engineering summary visible, allow step retry |
152
+ | Bootstrap step 4 | `sce scene delivery show --scene <scene-id> --json` | `sceneDelivery` | render delivery column with phase/status evidence | keep engineering summary visible, allow step retry |
153
+ | Bootstrap step 5 | `sce app engineering preview --app <app-key> --json` | `engineeringPreview` | render readiness flags and next actions without client synthesis | keep engineering summary visible, allow step retry |
154
+ | Bootstrap step 6 | `sce app engineering ownership --app <app-key> --json` | `engineeringOwnership` | render local/shared/unresolved ownership relation conservatively | keep engineering summary visible, allow step retry |
126
155
 
127
156
  Implementation rule:
128
- - all four steps execute sequentially
157
+ - all six steps execute sequentially
129
158
  - each step updates `boot.activeStep`
130
159
  - each success appends to `boot.completedSteps`
131
160
  - each failure writes a `CommandFailureState`
@@ -168,7 +197,7 @@ Read errors should be rendered inline at the section that failed.
168
197
  Examples:
169
198
  - ontology summary failed -> show summary card error, not full page crash
170
199
  - ER list failed -> show ER table error, keep BR/DL areas usable
171
- - engineering detail failed -> keep engineering summary visible
200
+ - engineering preview/ownership failed -> keep engineering summary visible
172
201
 
173
202
  ### 6.2 Write Errors
174
203
 
@@ -225,6 +254,14 @@ Use existing SCE view contracts for those surfaces:
225
254
  Recommended connection point:
226
255
  - when a write or seed command fails, store the exact command failure bundle so MagicBall can pass it into its AI assistant or timeline/task views later
227
256
 
257
+ ## 8.1 Multi-project supervision and routing
258
+
259
+ | UI event | SCE command | State target | Success behavior | Failure behavior |
260
+ | --- | --- | --- | --- | --- |
261
+ | Open multi-project shell | `sce project portfolio show --json` | `projectPortfolio` | render project switcher and current active project marker | show shell-level error and preserve stale local shell state if available |
262
+ | Enter cross-project request | `sce project target resolve --request <text> --current-project <project-id> --json` | `projectTarget` | route to current project, resolved project, or candidate chooser | preserve request text and show clarification UI |
263
+ | Open project health panel | `sce project supervision show --project <project-id> --json` | `projectSupervision` | render blocked / handoff / risk / active summary and drillback items | keep project shell visible and show panel-level error |
264
+
228
265
  ## 9. Minimal Acceptance Checklist
229
266
 
230
267
  MagicBall can consider this mapping implemented when: