scene-capability-engine 3.6.56 → 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 (41) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +6 -3
  3. package/README.zh.md +6 -3
  4. package/bin/scene-capability-engine.js +2 -0
  5. package/docs/autonomous-control-guide.md +2 -0
  6. package/docs/command-reference.md +76 -0
  7. package/docs/magicball-adaptation-task-checklist-v1.md +65 -10
  8. package/docs/magicball-cli-invocation-examples.md +53 -8
  9. package/docs/magicball-engineering-projection-contract.md +175 -0
  10. package/docs/magicball-frontend-state-and-command-mapping.md +42 -5
  11. package/docs/magicball-integration-doc-index.md +19 -5
  12. package/docs/magicball-integration-issue-tracker.md +15 -5
  13. package/docs/magicball-mode-home-and-ontology-empty-state-playbook.md +13 -5
  14. package/docs/magicball-project-portfolio-contract.md +216 -0
  15. package/docs/magicball-sce-adaptation-guide.md +18 -4
  16. package/docs/magicball-ui-surface-checklist.md +25 -0
  17. package/docs/magicball-write-auth-adaptation-guide.md +3 -1
  18. package/docs/release-checklist.md +8 -0
  19. package/docs/releases/README.md +2 -0
  20. package/docs/releases/v3.6.57.md +19 -0
  21. package/docs/releases/v3.6.58.md +27 -0
  22. package/docs/spec-workflow.md +2 -0
  23. package/docs/zh/release-checklist.md +8 -0
  24. package/docs/zh/releases/README.md +2 -0
  25. package/docs/zh/releases/v3.6.57.md +19 -0
  26. package/docs/zh/releases/v3.6.58.md +27 -0
  27. package/lib/app/engineering-scaffold-service.js +154 -0
  28. package/lib/commands/app.js +442 -13
  29. package/lib/commands/project.js +105 -0
  30. package/lib/commands/scene.js +16 -0
  31. package/lib/commands/spec-gate.js +57 -6
  32. package/lib/commands/spec-pipeline.js +13 -4
  33. package/lib/problem/project-problem-projection.js +43 -0
  34. package/lib/project/portfolio-projection-service.js +389 -0
  35. package/lib/project/supervision-projection-service.js +329 -0
  36. package/lib/project/target-resolution-service.js +180 -0
  37. package/lib/scene/delivery-projection-service.js +650 -0
  38. package/package.json +6 -2
  39. package/scripts/magicball-engineering-contract-audit.js +347 -0
  40. package/scripts/magicball-project-contract-audit.js +254 -0
  41. package/template/.sce/README.md +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ 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
+
22
+ ## [3.6.57] - 2026-03-17
23
+
24
+ ### Added
25
+ - Added a read-only `strategy_assessment` advisory to `sce spec gate run --spec <id>` and `sce spec pipeline run --spec <id>` single-Spec output so workflow consumers can see when the current Spec should escalate to `multi-spec-program` or `research-program`.
26
+
27
+ ### Changed
28
+ - Human-readable `spec gate` and `spec pipeline` output now print an explicit strategy advisory for broad or clarification-heavy Specs, without auto-rerouting execution or changing the underlying execution decision itself.
29
+ - Shared project problem projection sync is now idempotent when content does not change, so collaboration governance checks no longer dirty the worktree just by refreshing `generated_at`.
30
+
10
31
  ## [3.6.56] - 2026-03-17
11
32
 
12
33
  ### Added
package/README.md CHANGED
@@ -140,6 +140,7 @@ SCE is opinionated by default.
140
140
 
141
141
  - `studio plan` runs intake and scene/spec governance unless policy explicitly allows bypass.
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
+ - `spec pipeline` and `spec gate` now carry a read-only strategy advisory for single-Spec runs, so broad or clarification-heavy work is surfaced as `multi-spec-program` / `research-program` instead of being blindly forced deeper into one Spec.
143
144
  - `verify` and `release` enforce problem-closure and related gates when a spec is bound.
144
145
  - Autonomous program execution applies gate evaluation, fallback-chain logic, governance replay, and auto-remediation.
145
146
  - 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.
@@ -168,10 +169,12 @@ MagicBall-specific integration surfaces now also include:
168
169
  - `sce app bundle list|show|register`
169
170
  - `sce app collection list|show|apply`
170
171
  - `sce app install-state list`
172
+ - `sce scene delivery show`
171
173
  - `sce scene workspace list|show|apply`
172
174
  - `sce app registry status|configure|sync*`
173
175
  - `sce app runtime show|releases|install|activate|uninstall`
174
- - `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`
175
178
  - `sce mode application|ontology|engineering home`
176
179
  - `sce pm requirement|tracking|planning|change|issue ... --json`
177
180
  - `sce ontology er|br|dl ... --json`
@@ -227,5 +230,5 @@ MIT. See [LICENSE](LICENSE).
227
230
 
228
231
  ---
229
232
 
230
- **Version**: 3.6.56
231
- **Last Updated**: 2026-03-17
233
+ **Version**: 3.6.58
234
+ **Last Updated**: 2026-03-19
package/README.zh.md CHANGED
@@ -145,6 +145,7 @@ SCE 默认是强治理的。
145
145
 
146
146
  - `studio plan` 默认执行 intake 与 scene/spec 治理,除非策略显式允许绕过
147
147
  - 缺少业务场景/模块/页面/实体上下文时,SCE 必须先进入澄清,而不是把未知业务范围直接变成一刀切禁用
148
+ - 单 spec 的 `spec pipeline` 和 `spec gate` 现在都会附带只读策略建议;当问题已经更适合 `multi-spec-program` / `research-program` 时,SCE 会显式提示,而不是继续把复杂问题盲目压进同一个 spec
148
149
  - 当 spec 绑定时,`verify` 和 `release` 默认执行 problem-closure 等相关门禁
149
150
  - `close-loop-program` 默认带 gate 评估、fallback-chain、governance replay、auto-remediation
150
151
  - co-work 基线默认开启:初始化或接管后的 SCE 项目会落地 `.sce/config/multi-agent.json` 且 `enabled=true`,但中央 coordinator 仍保持按需开启
@@ -173,10 +174,12 @@ SCE 默认是强治理的。
173
174
  - `sce app bundle list|show|register`
174
175
  - `sce app collection list|show|apply`
175
176
  - `sce app install-state list`
177
+ - `sce scene delivery show`
176
178
  - `sce scene workspace list|show|apply`
177
179
  - `sce app registry status|configure|sync*`
178
180
  - `sce app runtime show|releases|install|activate|uninstall`
179
- - `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`
180
183
  - `sce mode application|ontology|engineering home`
181
184
  - `sce pm requirement|tracking|planning|change|issue ... --json`
182
185
  - `sce ontology er|br|dl ... --json`
@@ -232,5 +235,5 @@ MIT,见 [LICENSE](LICENSE)。
232
235
 
233
236
  ---
234
237
 
235
- **版本**:3.6.56
236
- **最后更新**: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');
@@ -97,6 +97,8 @@ Suggested preflight:
97
97
  sce spec strategy assess --goal "broad complex goal" --json
98
98
  ```
99
99
 
100
+ If you are already inside a single Spec flow, `sce spec gate run --spec <spec-id>` and `sce spec pipeline run --spec <spec-id>` now echo the same strategy concern as a non-blocking advisory when one Spec is no longer the right execution container.
101
+
100
102
  # Controller command: drain queue goals with autonomous close-loop-program runtime
101
103
  sce auto close-loop-controller .sce/auto/program-queue.lines \
102
104
  --dequeue-limit 2 \
@@ -101,6 +101,10 @@ Spec session governance:
101
101
  - When multiple active scenes exist, you must pass `--scene` explicitly.
102
102
  - Multi-Spec orchestrate fallback (`--specs ...`) follows the same scene binding and writes per-spec child-session archive records.
103
103
  - `sce spec strategy assess` is read-only and should be used when you are not sure whether the current problem still fits one Spec.
104
+ - `sce spec pipeline run --spec <id> --json` now includes the same read-only `strategy_assessment` block for single-Spec runs.
105
+ - `sce spec gate run --spec <id> --json` now includes a read-only `strategy_assessment` block for single-Spec runs.
106
+ - Human-readable `spec gate` output now prints a strategy advisory when the assessed decision is `multi-spec-program` or `research-program`, but it does not auto-reroute execution.
107
+ - Human-readable `spec pipeline` output now prints the same advisory after stage results for single-Spec runs.
104
108
  - `spec bootstrap` always generates problem-domain, scene-spec, and `problem-contract` artifacts to force domain-first exploration.
105
109
  - `spec gate` now hard-fails when either of the following is missing or structurally incomplete:
106
110
  - `.sce/specs/<spec>/custom/problem-domain-map.md`
@@ -407,6 +411,10 @@ sce scene workspace list --json
407
411
  sce scene workspace show --workspace sales --json
408
412
  sce scene workspace apply --workspace sales --json
409
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
+
410
418
  # Configure and sync remote registries
411
419
  sce app registry status --json
412
420
  sce app registry configure --bundle-index-url <path-or-url> --service-index-url <path-or-url> --json
@@ -424,9 +432,14 @@ sce app install-state list --json
424
432
  sce app install-state list --install-status installed --json
425
433
 
426
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
427
439
  sce app engineering show --app customer-order-demo --json
428
440
  sce app engineering attach --app customer-order-demo --repo <repo-url> --branch main --json
429
441
  sce app engineering hydrate --app customer-order-demo --json
442
+ sce app engineering scaffold --app customer-order-demo --overwrite-policy missing-only --json
430
443
  sce app engineering activate --app customer-order-demo --json
431
444
 
432
445
  # Three-mode home projections
@@ -2647,6 +2660,69 @@ Overall Health: 2 healthy, 1 unhealthy
2647
2660
 
2648
2661
  ---
2649
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
+
2650
2726
  ## See Also
2651
2727
 
2652
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.