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,218 @@
1
+ # MagicBall Integration Issue Tracker
2
+
3
+ > This file is the narrow coordination document between MagicBall and SCE.
4
+ > It is used to record only the minimum integration facts that require cross-project synchronization: active issues, contract gaps, decisions, and verification results.
5
+ > When SCE completes a relevant change that MagicBall needs to know about, the update should be synced here.
6
+ > Once an item is verified and no longer needs cross-project coordination, it should be removed or compacted to avoid the file becoming too large, too noisy, or too hard to maintain.
7
+
8
+ ## Usage Rule
9
+
10
+ - Keep this file narrow.
11
+ - Add only cross-project integration facts.
12
+ - Prefer short status-oriented records over long design discussion.
13
+ - Move completed items to `Resolved` or remove them once both sides no longer need them.
14
+
15
+ ## Current Contract
16
+
17
+ ### Current SCE capabilities ready for MagicBall integration
18
+
19
+ SCE changes completed and now available for MagicBall:
20
+ - `app bundle` registry local state and CLI
21
+ - `mode application home --app ... --json`
22
+ - `mode ontology home --app ... --json`
23
+ - `mode engineering home --app ... --json`
24
+ - `app registry status/configure/sync*`
25
+ - `app runtime show/releases/install/activate`
26
+ - `app engineering show/attach/hydrate/activate`
27
+ - `pm requirement/tracking/planning/change/issue` data plane
28
+ - `ontology er/br/dl` + `ontology triad summary`
29
+ - `ontology seed list/show/apply`
30
+ - `assurance resource/logs/backup/config`
31
+ - MagicBall-facing docs updated under `docs/`
32
+
33
+ ### Current recommended MagicBall consumption order
34
+ 1. consume `mode * home` as the top-level source for the three modes
35
+ 2. consume `pm`, `ontology`, and `assurance` table payloads
36
+ 3. wire runtime install/activate and engineering attach/hydrate/activate actions
37
+ 4. use demo app: `customer-order-demo`
38
+
39
+ ### Related SCE docs
40
+ - `docs/magicball-sce-adaptation-guide.md`
41
+ - `docs/magicball-write-auth-adaptation-guide.md`
42
+ - `docs/magicball-adaptation-task-checklist-v1.md`
43
+ - `docs/magicball-mode-home-and-ontology-empty-state-playbook.md`
44
+ - `docs/magicball-frontend-state-and-command-mapping.md`
45
+ - `docs/magicball-ui-surface-checklist.md`
46
+ - `docs/magicball-integration-doc-index.md`
47
+ - `docs/magicball-cli-invocation-examples.md`
48
+ - these docs now explicitly capture:
49
+ - current entry docs vs secondary references vs historical drafts are now separated in `docs/magicball-integration-doc-index.md`
50
+ - serialized `mode * home` loading as the safe default during `Issue 001` verification
51
+ - `fallback + optional seed apply` as the recommended default for fresh-project ontology UX under `Issue 003`
52
+
53
+ ### Next Needed From MagicBall
54
+ 1. treat the current doc set as stable and move into feedback-driven integration using the current entry docs
55
+ 2. continue real integration against `customer-order-demo` for all three `mode * home` pages
56
+ 3. keep `mode home` requests serialized during current verification window
57
+ 4. keep fresh-ontology UX on `fallback + optional seed apply`:
58
+ - MagicBall local UI now renders starter seed guidance + preview + explicit apply
59
+ - `ontology seed apply` is wired through shared write auth using scope `ontology:seed:apply`
60
+ - keep this item open only for wider field verification, not for strategy selection
61
+ 5. if any new integration mismatch appears, record it in `Open Items` with:
62
+ - exact command
63
+ - workspace path
64
+ - current payload
65
+ - expected payload
66
+ - UI impact
67
+
68
+ ## Open Items
69
+
70
+ ### Issue 001: SQLite lock when frontend triggers multiple SCE projection commands concurrently
71
+
72
+ Context:
73
+ - Project: `E:\workspace\331-poc`
74
+ - Upstream docs referenced from: `E:\workspace\kiro-spec-engine\docs`
75
+ - SCE local source version observed: `3.6.34`
76
+
77
+ Observed behavior:
78
+ - When multiple `sce mode ... home --json` commands are triggered concurrently, frontend occasionally receives:
79
+ - `database is locked`
80
+
81
+ Concrete command involved:
82
+ - `sce mode application home --app customer-order-demo --json`
83
+
84
+ Related commands that were being loaded together:
85
+ - `sce mode application home --app customer-order-demo --json`
86
+ - `sce mode ontology home --app customer-order-demo --json`
87
+ - `sce mode engineering home --app customer-order-demo --json`
88
+ - `sce app engineering show --app customer-order-demo --json`
89
+
90
+ MagicBall action taken:
91
+ - Changed mode-home loading from parallel to sequential in local store.
92
+ - MagicBall now serializes:
93
+ 1. application home
94
+ 2. ontology home
95
+ 3. engineering home
96
+ 4. engineering show
97
+
98
+ SCE action taken:
99
+ - Added short read retry handling for retryable sqlite lock errors on app/mode/pm/ontology/assurance read paths.
100
+ - Added short-lived `mode home` projection cache to reduce repeated reads for the same app/projection in a short window.
101
+ - Goal: reduce transient `database is locked` failures for read-heavy MagicBall integration flows.
102
+
103
+ Current cross-project decision:
104
+ - Keep sequential frontend loading as the current safe default.
105
+ - Treat SCE read retry + projection cache as mitigation, not as permission to switch back to parallel loading immediately.
106
+
107
+ Status:
108
+ - MagicBall workaround applied
109
+ - SCE mitigation applied
110
+ - still needs wider real-world verification before considering this fully closed
111
+
112
+ ### Issue 003: ontology ER/BR/DL data planes are command-ready but currently empty by default
113
+
114
+ Context:
115
+ - Project: `E:\workspace\331-poc`
116
+ - SCE source: `E:\workspace\kiro-spec-engine`
117
+ - Commands verified:
118
+ - `npx sce ontology er list --json`
119
+ - `npx sce ontology br list --json`
120
+ - `npx sce ontology dl list --json`
121
+ - `npx sce ontology triad summary --json`
122
+
123
+ Observed behavior:
124
+ - ER/BR/DL list commands are stable and return table payloads with `view_model.columns`
125
+ - but all three currently return empty item arrays in the default local state
126
+ - triad summary returns valid shape but zero coverage / all triads missing unless MagicBall applies fallback or the project creates real ontology assets
127
+
128
+ Impact on MagicBall:
129
+ - frontend can safely wire read flows now
130
+ - but user-visible ontology pages need either sample fallback, a create flow, or starter seed data to avoid blank pages in fresh projects
131
+ - triad completeness currently depends on newly created assets or fallback data
132
+
133
+ Current cross-project decision:
134
+ - treat empty ontology state as expected for fresh/local projects
135
+ - SCE now provides built-in starter seed support for `customer-order-demo`
136
+ - `ontology triad summary` and `mode ontology home` now also return `starter_seed` guidance when ontology is empty
137
+ - MagicBall local UI now uses `fallback + optional seed apply` as the default policy
138
+ - starter seed preview is driven by `sce ontology seed list/show --json`
139
+ - explicit initialization is driven by `sce ontology seed apply --profile <profile> --auth-lease <lease-id> --json`
140
+
141
+ Relevant commands:
142
+ - `sce ontology seed list --json`
143
+ - `sce ontology seed show --profile customer-order-demo --json`
144
+ - `sce ontology seed apply --profile customer-order-demo --json`
145
+
146
+ Status:
147
+ - frontend read path ready
148
+ - ontology write/read loop already verified working
149
+ - starter seed support implemented in SCE
150
+ - payload-level `starter_seed` guidance implemented in SCE
151
+ - MagicBall starter seed preview/apply UI implemented locally in `E:\workspace\331-poc\frontend\src\renderer\components\ontology\OntologyStarterSeedPanel.vue`
152
+ - empty-ontology flow reverified locally on 2026-03-08 in `E:\workspace\331-poc\tmp\sce-empty-ontology-repro`
153
+ - local verification covered: `triad summary` empty -> `seed list/show` preview -> `seed apply` -> `triad summary` ready
154
+ - keep open until broader field verification confirms the UX is stable
155
+
156
+ ## Resolved
157
+
158
+ ### Issue 002: pm requirement upsert succeeds but requirement list still returns empty
159
+
160
+ Resolution:
161
+ - Reproduced against current source and CLI smoke path.
162
+ - Current behavior is now correct.
163
+ - `pm requirement upsert` followed by `pm requirement list` returns the newly written item in the same workspace context.
164
+
165
+ Status:
166
+ - resolved on current SCE source
167
+ - keep closed unless MagicBall can reproduce with exact workspace path and command path
168
+
169
+ ### Issue 004: pm tracking/issue upsert succeeds but board queries still return empty
170
+
171
+ Resolution:
172
+ - Reproduced against current source and CLI smoke path.
173
+ - Current behavior is now correct.
174
+ - `pm tracking upsert` followed by `pm tracking board` returns the newly written item in the same workspace context.
175
+ - `pm issue upsert` followed by `pm issue board` returns the newly written item in the same workspace context.
176
+
177
+ Status:
178
+ - resolved on current SCE source
179
+ - keep closed unless MagicBall can reproduce with exact workspace path and command path
180
+
181
+ ### Issue 005: pm planning/change list results lag after upsert and can hide the newest local row
182
+
183
+ Resolution:
184
+ - Reproduced against current source and CLI smoke path.
185
+ - Current behavior is now correct.
186
+ - `pm planning upsert` followed by `pm planning board` returns the newest row first.
187
+ - `pm change upsert` followed by `pm change list` returns the newest row first.
188
+
189
+ Status:
190
+ - resolved on current SCE source
191
+ - keep closed unless MagicBall can reproduce with exact workspace path, input payloads, and command path
192
+
193
+ ### Verification 001: ontology ER/BR/DL upsert + list round-trip works in current SCE
194
+
195
+ Observed result:
196
+ - all three upsert commands return `success: true`
197
+ - all three corresponding list commands immediately show the inserted item
198
+
199
+ Implication for MagicBall:
200
+ - ontology ER/BR/DL minimal write forms can rely on post-save refresh
201
+ - optimistic fallback is optional for ontology write/read loops
202
+
203
+ Status:
204
+ - verified working
205
+ ### Verification 002: pm requirement/tracking/planning/change/issue round-trip works in current `331-poc`
206
+
207
+ Observed result:
208
+ - local repro on 2026-03-08 shows `requirement`, `tracking`, `planning`, `change`, and `issue` writes all appear on immediate follow-up list/board reads
209
+ - this revalidation was executed in `E:\workspace\331-poc`
210
+ - write payloads used current SCE-required minimal fields rather than older placeholder payloads
211
+
212
+ Implication for MagicBall:
213
+ - keep optimistic local UI fallback as a defensive strategy
214
+ - but current local evidence no longer shows stale read-after-write behavior for these PM objects
215
+
216
+ Status:
217
+ - verified working in current local context
218
+
@@ -0,0 +1,249 @@
1
+ # MagicBall Mode Home And Ontology Empty-State Playbook
2
+
3
+ ## Goal
4
+
5
+ Provide a small, implementation-ready playbook for MagicBall frontend integration around the two remaining active cross-project items:
6
+ 1. serialized mode-home loading during `Issue 001` verification
7
+ 2. fresh-project ontology empty-state handling for `Issue 003`
8
+
9
+ This document is intentionally narrower than the main adaptation guide.
10
+ It should be used by frontend engineers who are wiring the actual page behavior.
11
+
12
+ ## When To Use This Playbook
13
+
14
+ Use this playbook when MagicBall is:
15
+ - opening an app workspace
16
+ - switching between `application`, `ontology`, and `engineering` mode
17
+ - rendering a fresh project that has no ontology assets yet
18
+ - deciding whether and when to show starter seed initialization
19
+
20
+ ## Default Product Decisions
21
+
22
+ Current recommended defaults are:
23
+ - `mode * home` reads stay serialized
24
+ - fresh ontology pages use `fallback + optional seed apply`
25
+ - seed is never auto-applied silently on first load
26
+
27
+ These defaults should remain in place until `docs/magicball-integration-issue-tracker.md` explicitly closes the relevant open item.
28
+
29
+ ## Part 1: Serialized Mode-Home Loading
30
+
31
+ ### Why
32
+
33
+ SCE already includes sqlite read-retry and a short-lived projection cache.
34
+ That reduces transient lock failures, but it is not yet a signal that MagicBall should fan out home projections in parallel.
35
+
36
+ During current verification:
37
+ - frontend stability is more valuable than a small reduction in page bootstrap latency
38
+ - the safest contract is one request at a time
39
+
40
+ ### Required Load Order
41
+
42
+ When opening an app page, MagicBall should call these commands in order:
43
+
44
+ 1. `sce mode application home --app <app-key> --json`
45
+ 2. `sce mode ontology home --app <app-key> --json`
46
+ 3. `sce mode engineering home --app <app-key> --json`
47
+ 4. `sce app engineering show --app <app-key> --json`
48
+
49
+ ### Frontend State Rule
50
+
51
+ Treat each call as one step in a small boot pipeline.
52
+ Do not issue step 2 before step 1 resolves.
53
+ Do not issue step 3 before step 2 resolves.
54
+ Do not issue step 4 before step 3 resolves.
55
+
56
+ Recommended local state shape:
57
+
58
+ ```ts
59
+ interface ModeBootState {
60
+ appKey: string
61
+ bootStatus: 'idle' | 'loading' | 'partial' | 'ready' | 'failed'
62
+ activeStep: 'application-home' | 'ontology-home' | 'engineering-home' | 'engineering-show' | null
63
+ completedSteps: string[]
64
+ lastError: string | null
65
+ }
66
+ ```
67
+
68
+ ### Recommended UX
69
+
70
+ During boot:
71
+ - show top-level shell immediately
72
+ - reveal each mode card/section as its payload arrives
73
+ - if step 3 or step 4 fails, keep already-loaded earlier sections visible
74
+ - avoid a full-screen hard failure unless step 1 fails
75
+
76
+ Recommended status copy:
77
+ - step 1 loading: `Loading application view...`
78
+ - step 2 loading: `Loading ontology view...`
79
+ - step 3 loading: `Loading engineering view...`
80
+ - step 4 loading: `Loading engineering workspace details...`
81
+
82
+ ### Failure Handling
83
+
84
+ If a step fails:
85
+ - preserve all previously loaded payloads
86
+ - store the exact failing command and stderr text
87
+ - show a retry action for the failed step only
88
+ - do not automatically restart the full four-step sequence unless the app context changed
89
+
90
+ Recommended retry behavior:
91
+ - retry the failed step once on explicit user action
92
+ - if the step still fails, keep the shell usable and surface the exact command failure
93
+
94
+ ### What Not To Do
95
+
96
+ Do not:
97
+ - switch back to `Promise.all(...)` style mode-home loading
98
+ - merge multiple raw payloads and pretend they are one synthetic source
99
+ - hide the exact failed step from the user
100
+
101
+ ## Part 2: Fresh Ontology Empty-State Policy
102
+
103
+ ### Why
104
+
105
+ A fresh/local project can legitimately have:
106
+ - zero ER assets
107
+ - zero BR rules
108
+ - zero DL chains
109
+ - zero triad coverage
110
+
111
+ That is not a backend failure.
112
+ It is an expected empty workspace state.
113
+
114
+ ### Product Rule
115
+
116
+ MagicBall should use:
117
+ - explanatory empty state first
118
+ - optional starter seed second
119
+
120
+ That means:
121
+ - the first ontology page render explains why the page is empty
122
+ - the page reads `starter_seed` guidance from SCE payloads
123
+ - the user can explicitly choose to initialize starter data
124
+ - the page never seeds ontology data automatically without user intent
125
+
126
+ ### Inputs MagicBall Should Read
127
+
128
+ Primary inputs:
129
+ - `sce mode ontology home --app <app-key> --json`
130
+ - `sce ontology triad summary --json`
131
+ - `sce ontology er list --json`
132
+ - `sce ontology br list --json`
133
+ - `sce ontology dl list --json`
134
+
135
+ Optional seed inputs:
136
+ - `sce ontology seed list --json`
137
+ - `sce ontology seed show --profile customer-order-demo --json`
138
+
139
+ Mutation:
140
+ - `sce ontology seed apply --profile customer-order-demo --json`
141
+
142
+ ### Empty-State Trigger
143
+
144
+ Treat ontology as empty when both conditions hold:
145
+ - ER/BR/DL lists have no items
146
+ - ontology summary or triad summary indicates missing / zero coverage state
147
+
148
+ The frontend should not require a single exact boolean from one endpoint if the table/list payloads already prove the workspace is empty.
149
+
150
+ ### Recommended UI Layout
151
+
152
+ Top section:
153
+ - keep ontology summary / triad summary visible
154
+ - if available, surface `starter_seed` guidance text from SCE
155
+
156
+ Main empty-state card:
157
+ - title: `Ontology is not initialized yet`
158
+ - description: `This is expected for a fresh or local project. You can start from an empty model or initialize starter ontology data.`
159
+ - primary action: `Initialize starter ontology`
160
+ - secondary action: `Continue with empty ontology`
161
+
162
+ Below the card:
163
+ - ER table shell
164
+ - BR table shell
165
+ - DL table shell
166
+ - each table may remain empty but should not look broken
167
+
168
+ ### Seed Confirmation Flow
169
+
170
+ When the user clicks `Initialize starter ontology`:
171
+
172
+ 1. optionally call `sce ontology seed show --profile customer-order-demo --json`
173
+ 2. show what will be initialized
174
+ 3. require explicit confirmation
175
+ 4. call `sce ontology seed apply --profile customer-order-demo --json`
176
+ 5. show progress state until command completes
177
+
178
+ Recommended confirmation copy:
179
+ - `Initialize starter ontology data for this app?`
180
+ - `This will create starter ER, BR, and DL assets for the current project.`
181
+
182
+ ### Refresh Chain After Seed Apply
183
+
184
+ After a successful seed apply, refresh in this order:
185
+
186
+ 1. `sce mode ontology home --app <app-key> --json`
187
+ 2. `sce ontology triad summary --json`
188
+ 3. `sce ontology er list --json`
189
+ 4. `sce ontology br list --json`
190
+ 5. `sce ontology dl list --json`
191
+
192
+ Rationale:
193
+ - summary first so the page-level status updates immediately
194
+ - tables second so the user can see concrete assets appear
195
+
196
+ ### Seed Failure Handling
197
+
198
+ If seed apply fails:
199
+ - keep the empty-state card visible
200
+ - preserve the exact command error for copy/retry
201
+ - do not hide the ontology page or replace it with a generic crash screen
202
+ - let the user retry the seed action or continue with empty ontology
203
+
204
+ Recommended failure copy:
205
+ - `Starter ontology initialization failed.`
206
+ - `You can retry, inspect the command error, or continue with an empty ontology.`
207
+
208
+ ## Part 3: Suggested Frontend Call Graph
209
+
210
+ ```text
211
+ App Selected
212
+ -> app bundle show
213
+ -> application home
214
+ -> ontology home
215
+ -> engineering home
216
+ -> engineering show
217
+
218
+ Ontology Tab Opened
219
+ -> ontology home
220
+ -> triad summary
221
+ -> er list
222
+ -> br list
223
+ -> dl list
224
+ -> if empty: show starter seed guidance
225
+
226
+ User Clicks Initialize Starter Ontology
227
+ -> seed show (optional)
228
+ -> seed apply
229
+ -> ontology home
230
+ -> triad summary
231
+ -> er list
232
+ -> br list
233
+ -> dl list
234
+ ```
235
+
236
+ ## Part 4: Minimal Acceptance Checks
237
+
238
+ MagicBall can consider this playbook implemented when:
239
+ - mode-home calls are serialized by default
240
+ - each boot step has visible progress and isolated retry
241
+ - ontology empty pages no longer look like backend failure states
242
+ - starter seed is explicit and user-triggered
243
+ - post-seed refresh updates both summary cards and ER/BR/DL tables
244
+
245
+ ## Related Docs
246
+
247
+ - `docs/magicball-sce-adaptation-guide.md`
248
+ - `docs/magicball-adaptation-task-checklist-v1.md`
249
+ - `docs/magicball-integration-issue-tracker.md`
@@ -0,0 +1,203 @@
1
+ # MagicBall SCE Adaptation Guide
2
+
3
+ ## Goal
4
+
5
+ Provide the primary overview for MagicBall to integrate the current SCE capability set.
6
+
7
+ This document is intentionally concise.
8
+ It defines the stable integration shape, command families, and response contracts.
9
+ Implementation detail should live in the specialized documents listed below.
10
+
11
+ ## Primary Companion Docs
12
+
13
+ Use these documents together:
14
+ - `docs/magicball-integration-doc-index.md`
15
+ - `docs/magicball-ui-surface-checklist.md`
16
+ - `docs/magicball-mode-home-and-ontology-empty-state-playbook.md`
17
+ - `docs/magicball-frontend-state-and-command-mapping.md`
18
+ - `docs/magicball-cli-invocation-examples.md`
19
+ - `docs/magicball-write-auth-adaptation-guide.md`
20
+ - `docs/magicball-task-feedback-timeline-guide.md`
21
+ - `docs/magicball-integration-issue-tracker.md`
22
+
23
+ ## Current Scope
24
+
25
+ SCE currently provides MagicBall-facing support for:
26
+ 1. `app bundle registry`
27
+ 2. `application / ontology / engineering home projections`
28
+ 3. `app runtime install / activate`
29
+ 4. `app engineering attach / hydrate / activate`
30
+ 5. `pm` delivery data plane
31
+ 6. `ontology` triad data plane
32
+ 7. `assurance` data plane
33
+ 8. `write authorization`
34
+ 9. `task feedback + timeline`
35
+
36
+ ## Core Integration Positioning
37
+
38
+ ### 1. App identity
39
+
40
+ MagicBall should keep both:
41
+ - `app_id`
42
+ - `app_key`
43
+
44
+ Recommended rule:
45
+ - use `app_key` as the stable frontend route token
46
+ - keep `app_id` as the bound SCE identity once resolved
47
+ - prefer `app_name` for user-facing display
48
+
49
+ ### 2. Three-mode entry
50
+
51
+ MagicBall should enter every app through SCE projections, not through frontend-reconstructed relationships.
52
+
53
+ Top-level entry commands:
54
+ - `sce mode application home --app <app-id|app-key> --json`
55
+ - `sce mode ontology home --app <app-id|app-key> --json`
56
+ - `sce mode engineering home --app <app-id|app-key> --json`
57
+
58
+ Current default during `Issue 001` verification:
59
+ - load `mode * home` sequentially, not in parallel
60
+ - recommended order:
61
+ 1. `mode application home`
62
+ 2. `mode ontology home`
63
+ 3. `mode engineering home`
64
+ 4. `app engineering show`
65
+
66
+ ### 3. Fresh ontology behavior
67
+
68
+ Current default during `Issue 003` verification:
69
+ - treat empty ontology as a valid fresh/local project state
70
+ - use `fallback + optional seed apply`
71
+ - do not auto-apply starter seed silently
72
+ - keep seed apply explicit and user-triggered
73
+
74
+ ## Remote Registry Sources
75
+
76
+ ### Bundle Registry
77
+ - repository: `https://github.com/heguangyong/magicball-app-bundle-registry`
78
+ - example app key: `customer-order-demo`
79
+
80
+ ### Service Catalog
81
+ - repository: `https://github.com/heguangyong/magicball-app-service-catalog`
82
+ - example app key: `customer-order-demo`
83
+
84
+ ## Demo Application
85
+
86
+ Current first integration target:
87
+ - `app_id`: `app.customer-order-demo`
88
+ - `app_key`: `customer-order-demo`
89
+
90
+ ## Command Families
91
+
92
+ This guide does not repeat full invocation examples.
93
+ Use `docs/magicball-cli-invocation-examples.md` for copy-ready commands.
94
+
95
+ ### Mode entry
96
+ - `sce app bundle show`
97
+ - `sce mode application home`
98
+ - `sce mode ontology home`
99
+ - `sce mode engineering home`
100
+ - `sce app engineering show`
101
+
102
+ ### Runtime and engineering control
103
+ - `sce app runtime show/releases/install/activate`
104
+ - `sce app engineering show/attach/hydrate/activate`
105
+ - `sce app registry status/configure/sync*`
106
+
107
+ ### Engineering data plane
108
+ - `sce pm requirement list/show/upsert`
109
+ - `sce pm tracking board/show/upsert`
110
+ - `sce pm planning board/show/upsert`
111
+ - `sce pm change list/show/upsert`
112
+ - `sce pm issue board/show/upsert`
113
+
114
+ ### Ontology data plane
115
+ - `sce ontology triad summary`
116
+ - `sce ontology er list/show/upsert`
117
+ - `sce ontology br list/show/upsert`
118
+ - `sce ontology dl list/show/upsert`
119
+ - `sce ontology seed list/show/apply`
120
+
121
+ ### Assurance and governance
122
+ - `sce assurance resource status`
123
+ - `sce assurance logs views`
124
+ - `sce assurance backup list`
125
+ - `sce assurance config switches`
126
+ - `sce auth status/grant/revoke`
127
+
128
+ ### Task and timeline
129
+ - `sce studio events`
130
+ - `sce timeline list/show`
131
+
132
+ ## Stable Response Contracts
133
+
134
+ ### 1. Mode-home payloads
135
+
136
+ MagicBall should treat the three `mode * home` commands as stable page-shell sources.
137
+
138
+ Common top-level fields:
139
+ - `mode`
140
+ - `query`
141
+ - `summary`
142
+ - `view_model`
143
+ - `mb_status`
144
+
145
+ Important additional fields vary by mode:
146
+ - `application home`: release/runtime state
147
+ - `ontology home`: `ontology_core_ui`, triad readiness, `starter_seed`
148
+ - `engineering home`: delivery summary, assurance summary, project metadata
149
+
150
+ ### 2. Table payloads
151
+
152
+ The following command groups follow a stable table-style output:
153
+ - `sce pm * list/board`
154
+ - `sce ontology * list`
155
+ - `sce assurance *`
156
+
157
+ Expected fields:
158
+ - `mode`
159
+ - `query`
160
+ - `summary`
161
+ - `items`
162
+ - `filters`
163
+ - `sort`
164
+ - `view_model`
165
+ - `mb_status`
166
+
167
+ Current stable `view_model` shape:
168
+
169
+ ```json
170
+ {
171
+ "type": "table",
172
+ "columns": []
173
+ }
174
+ ```
175
+
176
+ MagicBall should use `view_model.columns` as the preferred visible-column contract.
177
+
178
+ ## Recommended Division Of Responsibility
179
+
180
+ ### This guide owns
181
+ - overall integration shape
182
+ - command family boundaries
183
+ - top-level response contracts
184
+ - current default product decisions
185
+
186
+ ### Specialized docs own
187
+ - page-level done criteria: `docs/magicball-ui-surface-checklist.md`
188
+ - frontend state + command mapping: `docs/magicball-frontend-state-and-command-mapping.md`
189
+ - mode-home + ontology empty-state behavior: `docs/magicball-mode-home-and-ontology-empty-state-playbook.md`
190
+ - copy-ready commands: `docs/magicball-cli-invocation-examples.md`
191
+ - write auth behavior: `docs/magicball-write-auth-adaptation-guide.md`
192
+ - task/timeline behavior: `docs/magicball-task-feedback-timeline-guide.md`
193
+ - live cross-project truth: `docs/magicball-integration-issue-tracker.md`
194
+
195
+ ## Practical Conclusion
196
+
197
+ MagicBall should now integrate SCE in this order:
198
+ 1. use `app_key` as the frontend app token
199
+ 2. bootstrap the workspace through serialized `mode * home`
200
+ 3. render page surfaces from SCE payloads directly
201
+ 4. keep ontology empty-state explicit and seed apply optional
202
+ 5. keep write flows lease-aware
203
+ 6. use task/timeline view contracts instead of raw event-first rendering