@contractspec/example.learning-journey-studio-onboarding 1.56.1 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +47 -46
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +32 -0
- package/dist/browser/docs/index.js +35 -0
- package/dist/browser/docs/studio-onboarding.docblock.js +35 -0
- package/dist/browser/example.js +32 -0
- package/dist/browser/handlers/demo.handlers.js +107 -0
- package/dist/browser/index.js +393 -0
- package/dist/browser/learning-journey-studio-onboarding.feature.js +50 -0
- package/dist/browser/operations/index.js +201 -0
- package/dist/browser/presentations/index.js +250 -0
- package/dist/browser/tests/operations.test-spec.js +34 -0
- package/dist/browser/track.js +87 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +36 -1
- package/dist/docs/studio-onboarding.docblock.d.ts +2 -1
- package/dist/docs/studio-onboarding.docblock.d.ts.map +1 -0
- package/dist/docs/studio-onboarding.docblock.js +21 -25
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +30 -39
- package/dist/handlers/demo.handlers.d.ts +12 -17
- package/dist/handlers/demo.handlers.d.ts.map +1 -1
- package/dist/handlers/demo.handlers.js +105 -21
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +394 -9
- package/dist/learning-journey-studio-onboarding.feature.d.ts +1 -7
- package/dist/learning-journey-studio-onboarding.feature.d.ts.map +1 -1
- package/dist/learning-journey-studio-onboarding.feature.js +49 -73
- package/dist/node/docs/index.js +35 -0
- package/dist/node/docs/studio-onboarding.docblock.js +35 -0
- package/dist/node/example.js +32 -0
- package/dist/node/handlers/demo.handlers.js +107 -0
- package/dist/node/index.js +393 -0
- package/dist/node/learning-journey-studio-onboarding.feature.js +50 -0
- package/dist/node/operations/index.js +201 -0
- package/dist/node/presentations/index.js +250 -0
- package/dist/node/tests/operations.test-spec.js +34 -0
- package/dist/node/track.js +87 -0
- package/dist/operations/index.d.ts +229 -236
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +193 -167
- package/dist/operations/index.test.d.ts +2 -0
- package/dist/operations/index.test.d.ts.map +1 -0
- package/dist/presentations/index.d.ts +3 -8
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +248 -54
- package/dist/tests/operations.test-spec.d.ts +1 -6
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +33 -34
- package/dist/track.d.ts +3 -7
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +87 -90
- package/package.json +118 -34
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -45
- package/dist/docs/studio-onboarding.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/demo.handlers.js.map +0 -1
- package/dist/learning-journey-studio-onboarding.feature.js.map +0 -1
- package/dist/operations/index.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/track.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// src/docs/studio-onboarding.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts";
|
|
3
|
+
var studioOnboardingDocBlocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.learning-journey.studio-onboarding",
|
|
6
|
+
title: "Learning Journey — Studio Getting Started",
|
|
7
|
+
summary: "Track that guides a new Studio user through template spawn, spec edit, regeneration, playground, and evolution.",
|
|
8
|
+
kind: "reference",
|
|
9
|
+
visibility: "public",
|
|
10
|
+
route: "/docs/learning-journey/studio-onboarding",
|
|
11
|
+
tags: ["learning", "onboarding", "studio"],
|
|
12
|
+
body: `## Track
|
|
13
|
+
- **Key**: \`studio_getting_started\`
|
|
14
|
+
- **Persona**: new Studio developer, first 30 minutes
|
|
15
|
+
- **Goal**: instantiate template → edit spec → regenerate → play → run evolution
|
|
16
|
+
|
|
17
|
+
## Steps & Events
|
|
18
|
+
1) \`choose_template\` → event \`studio.template.instantiated\`
|
|
19
|
+
2) \`edit_spec\` → event \`spec.changed\` (scope: sandbox)
|
|
20
|
+
3) \`regenerate_app\` → event \`regeneration.completed\`
|
|
21
|
+
4) \`play_in_playground\` → event \`playground.session.started\`
|
|
22
|
+
5) \`try_evolution_mode\` → event \`studio.evolution.applied\`
|
|
23
|
+
|
|
24
|
+
XP: 20/20/20/20/30 with bonus 25 XP if completed within 48h (streak rule). Badge: \`studio_first_30m\`.
|
|
25
|
+
|
|
26
|
+
## Wiring
|
|
27
|
+
- Tracks export from \`@contractspec/example.learning-journey-studio-onboarding/track\`.
|
|
28
|
+
- Use onboarding API:
|
|
29
|
+
- \`learning.onboarding.listTracks\` to surface catalog
|
|
30
|
+
- \`learning.onboarding.getProgress\` to render progress
|
|
31
|
+
- \`learning.onboarding.recordEvent\` to advance from bus events
|
|
32
|
+
- Events should be emitted by Studio surfaces (template creation, spec save, regeneration, playground session start, evolution apply).`
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
registerDocBlocks(studioOnboardingDocBlocks);
|
|
36
|
+
// src/example.ts
|
|
37
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
38
|
+
var example = defineExample({
|
|
39
|
+
meta: {
|
|
40
|
+
key: "learning-journey-studio-onboarding",
|
|
41
|
+
version: "1.0.0",
|
|
42
|
+
title: "Learning Journey — Studio Getting Started",
|
|
43
|
+
description: "Onboarding track guiding a new Studio user through template spawn, spec edit, regeneration, playground, and evolution.",
|
|
44
|
+
kind: "template",
|
|
45
|
+
visibility: "public",
|
|
46
|
+
stability: "experimental",
|
|
47
|
+
owners: ["@platform.core"],
|
|
48
|
+
tags: ["learning", "onboarding", "studio"]
|
|
49
|
+
},
|
|
50
|
+
docs: {
|
|
51
|
+
rootDocId: "docs.learning-journey.studio-onboarding"
|
|
52
|
+
},
|
|
53
|
+
entrypoints: {
|
|
54
|
+
packageName: "@contractspec/example.learning-journey-studio-onboarding",
|
|
55
|
+
docs: "./docs"
|
|
56
|
+
},
|
|
57
|
+
surfaces: {
|
|
58
|
+
templates: true,
|
|
59
|
+
sandbox: { enabled: true, modes: ["playground", "markdown"] },
|
|
60
|
+
studio: { enabled: true, installable: true },
|
|
61
|
+
mcp: { enabled: true }
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
var example_default = example;
|
|
65
|
+
|
|
66
|
+
// src/track.ts
|
|
67
|
+
var studioGettingStartedTrack = {
|
|
68
|
+
id: "studio_getting_started",
|
|
69
|
+
productId: "contractspec-studio",
|
|
70
|
+
name: "Studio Getting Started",
|
|
71
|
+
description: "First 30 minutes in Studio: create a project, edit the spec, deploy/regenerate, and try key modules.",
|
|
72
|
+
targetUserSegment: "new_studio_user",
|
|
73
|
+
targetRole: "developer",
|
|
74
|
+
totalXp: 110,
|
|
75
|
+
streakRule: { hoursWindow: 48, bonusXp: 25 },
|
|
76
|
+
completionRewards: { xpBonus: 25, badgeKey: "studio_first_30m" },
|
|
77
|
+
steps: [
|
|
78
|
+
{
|
|
79
|
+
id: "choose_template",
|
|
80
|
+
title: "Choose a template",
|
|
81
|
+
description: "Create your first Studio project (starter template).",
|
|
82
|
+
order: 1,
|
|
83
|
+
completion: {
|
|
84
|
+
eventName: "studio.template.instantiated",
|
|
85
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
86
|
+
},
|
|
87
|
+
xpReward: 20,
|
|
88
|
+
metadata: { surface: "projects" }
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: "edit_spec",
|
|
92
|
+
title: "Edit the spec",
|
|
93
|
+
description: "Change the spec (not generated code) and save.",
|
|
94
|
+
instructions: "Open spec editor, tweak a contract or presentation, save.",
|
|
95
|
+
order: 2,
|
|
96
|
+
completion: {
|
|
97
|
+
eventName: "spec.changed",
|
|
98
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
99
|
+
},
|
|
100
|
+
xpReward: 20,
|
|
101
|
+
metadata: { surface: "spec-editor" }
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "regenerate_app",
|
|
105
|
+
title: "Regenerate the app",
|
|
106
|
+
description: "Regenerate artifacts from the updated spec.",
|
|
107
|
+
order: 3,
|
|
108
|
+
completion: {
|
|
109
|
+
eventName: "regeneration.completed",
|
|
110
|
+
sourceModule: "@contractspec/lib.contracts/regenerator"
|
|
111
|
+
},
|
|
112
|
+
xpReward: 20,
|
|
113
|
+
metadata: { surface: "regenerator" }
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "open_canvas",
|
|
117
|
+
title: "Open the canvas",
|
|
118
|
+
description: "Visit the canvas module for your project.",
|
|
119
|
+
order: 4,
|
|
120
|
+
completion: {
|
|
121
|
+
eventName: "module.navigated",
|
|
122
|
+
sourceModule: "@contractspec/bundle.studio",
|
|
123
|
+
payloadFilter: { moduleId: "canvas" }
|
|
124
|
+
},
|
|
125
|
+
xpReward: 20,
|
|
126
|
+
metadata: { surface: "canvas" }
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "try_evolution_mode",
|
|
130
|
+
title: "Try evolution mode",
|
|
131
|
+
description: "Request a change via Evolution, then regenerate.",
|
|
132
|
+
order: 5,
|
|
133
|
+
completion: {
|
|
134
|
+
eventName: "studio.evolution.applied",
|
|
135
|
+
sourceModule: "@contractspec/lib.evolution"
|
|
136
|
+
},
|
|
137
|
+
xpReward: 30,
|
|
138
|
+
metadata: { surface: "evolution" }
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
metadata: {
|
|
142
|
+
persona: "first_run",
|
|
143
|
+
surfacedIn: ["studio/home", "studio/sidebar/learning"]
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var studioLearningTracks = [
|
|
147
|
+
studioGettingStartedTrack
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
// src/handlers/demo.handlers.ts
|
|
151
|
+
var studioOnboardingEvents = [
|
|
152
|
+
"studio.template.instantiated",
|
|
153
|
+
"spec.changed",
|
|
154
|
+
"regeneration.completed",
|
|
155
|
+
"playground.session.started",
|
|
156
|
+
"studio.evolution.applied"
|
|
157
|
+
];
|
|
158
|
+
var emitStudioOnboardingEvent = (eventName, { learnerId, occurredAt = new Date }, record) => {
|
|
159
|
+
const event = {
|
|
160
|
+
learnerId,
|
|
161
|
+
name: eventName,
|
|
162
|
+
occurredAt,
|
|
163
|
+
trackId: studioGettingStartedTrack.id
|
|
164
|
+
};
|
|
165
|
+
return record ? record(event) : event;
|
|
166
|
+
};
|
|
167
|
+
var emitAllStudioOnboardingEvents = (params, record) => studioOnboardingEvents.map((name) => emitStudioOnboardingEvent(name, params, record));
|
|
168
|
+
|
|
169
|
+
// src/operations/index.ts
|
|
170
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
171
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
|
|
172
|
+
var OWNERS = ["examples.learning-journey.studio-onboarding"];
|
|
173
|
+
var StepModel = defineSchemaModel({
|
|
174
|
+
name: "StudioOnboardingStep",
|
|
175
|
+
description: "Step metadata for Studio onboarding journey",
|
|
176
|
+
fields: {
|
|
177
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
178
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
179
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
180
|
+
completionEvent: {
|
|
181
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
182
|
+
isOptional: false
|
|
183
|
+
},
|
|
184
|
+
sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
185
|
+
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
186
|
+
order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
var StudioOnboardingTrackModel = defineSchemaModel({
|
|
190
|
+
name: "StudioOnboardingTrack",
|
|
191
|
+
description: "Studio onboarding track definition",
|
|
192
|
+
fields: {
|
|
193
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
194
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
195
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
196
|
+
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
197
|
+
completionXpBonus: {
|
|
198
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
199
|
+
isOptional: true
|
|
200
|
+
},
|
|
201
|
+
completionBadgeKey: {
|
|
202
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
203
|
+
isOptional: true
|
|
204
|
+
},
|
|
205
|
+
streakHoursWindow: {
|
|
206
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
207
|
+
isOptional: true
|
|
208
|
+
},
|
|
209
|
+
streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
210
|
+
steps: { type: StepModel, isArray: true, isOptional: false }
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
var TrackResponseModel = defineSchemaModel({
|
|
214
|
+
name: "StudioOnboardingTrackResponse",
|
|
215
|
+
description: "Response wrapper for studio onboarding track",
|
|
216
|
+
fields: {
|
|
217
|
+
track: { type: StudioOnboardingTrackModel, isOptional: false }
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
var RecordDemoEventInput = defineSchemaModel({
|
|
221
|
+
name: "StudioOnboardingRecordEventInput",
|
|
222
|
+
description: "Emit a demo event to advance Studio onboarding steps",
|
|
223
|
+
fields: {
|
|
224
|
+
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
225
|
+
eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
226
|
+
payload: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
227
|
+
occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
var SuccessModel = defineSchemaModel({
|
|
231
|
+
name: "StudioOnboardingSuccess",
|
|
232
|
+
description: "Generic success response",
|
|
233
|
+
fields: {
|
|
234
|
+
success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
var GetStudioOnboardingTrack = defineQuery({
|
|
238
|
+
meta: {
|
|
239
|
+
key: "learningJourney.studioOnboarding.getTrack",
|
|
240
|
+
version: "1.0.0",
|
|
241
|
+
stability: "experimental",
|
|
242
|
+
owners: [...OWNERS],
|
|
243
|
+
tags: ["learning", "onboarding", "studio"],
|
|
244
|
+
description: "Fetch the Studio onboarding track definition.",
|
|
245
|
+
goal: "Expose track metadata to UIs and templates.",
|
|
246
|
+
context: "Called by Studio/Playground to render journey steps."
|
|
247
|
+
},
|
|
248
|
+
io: {
|
|
249
|
+
input: defineSchemaModel({
|
|
250
|
+
name: "StudioOnboardingTrackInput",
|
|
251
|
+
description: "Track input",
|
|
252
|
+
fields: {}
|
|
253
|
+
}),
|
|
254
|
+
output: TrackResponseModel
|
|
255
|
+
},
|
|
256
|
+
policy: { auth: "user" }
|
|
257
|
+
});
|
|
258
|
+
var RecordStudioOnboardingEvent = defineCommand({
|
|
259
|
+
meta: {
|
|
260
|
+
key: "learningJourney.studioOnboarding.recordEvent",
|
|
261
|
+
version: "1.0.0",
|
|
262
|
+
stability: "experimental",
|
|
263
|
+
owners: [...OWNERS],
|
|
264
|
+
tags: ["learning", "onboarding", "studio"],
|
|
265
|
+
description: "Record an event to advance Studio onboarding progress.",
|
|
266
|
+
goal: "Advance steps via domain events in demo/sandbox contexts.",
|
|
267
|
+
context: "Called by handlers or demo scripts to emit step completion events."
|
|
268
|
+
},
|
|
269
|
+
io: {
|
|
270
|
+
input: RecordDemoEventInput,
|
|
271
|
+
output: SuccessModel
|
|
272
|
+
},
|
|
273
|
+
policy: { auth: "user" }
|
|
274
|
+
});
|
|
275
|
+
var studioOnboardingContracts = {
|
|
276
|
+
GetStudioOnboardingTrack,
|
|
277
|
+
RecordStudioOnboardingEvent,
|
|
278
|
+
track: studioGettingStartedTrack
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
// src/presentations/index.ts
|
|
282
|
+
import {
|
|
283
|
+
definePresentation,
|
|
284
|
+
StabilityEnum
|
|
285
|
+
} from "@contractspec/lib.contracts";
|
|
286
|
+
var baseMeta = {
|
|
287
|
+
domain: "learning-journey",
|
|
288
|
+
title: "Studio Onboarding",
|
|
289
|
+
owners: ["@examples.learning-journey.studio-onboarding"],
|
|
290
|
+
tags: ["learning", "onboarding", "studio"],
|
|
291
|
+
stability: StabilityEnum.Experimental
|
|
292
|
+
};
|
|
293
|
+
var StudioOnboardingTrackPresentation = definePresentation({
|
|
294
|
+
meta: {
|
|
295
|
+
key: "learning.journey.studio.track",
|
|
296
|
+
version: "1.0.0",
|
|
297
|
+
description: "Studio onboarding track detail",
|
|
298
|
+
goal: "Visualize the onboarding track for the user.",
|
|
299
|
+
context: "Displayed in the Studio dashboard.",
|
|
300
|
+
...baseMeta
|
|
301
|
+
},
|
|
302
|
+
source: {
|
|
303
|
+
type: "component",
|
|
304
|
+
framework: "react",
|
|
305
|
+
componentKey: "LearningTrackDetail",
|
|
306
|
+
props: StudioOnboardingTrackModel
|
|
307
|
+
},
|
|
308
|
+
targets: ["react", "markdown", "application/json"]
|
|
309
|
+
});
|
|
310
|
+
var StudioOnboardingWidgetPresentation = definePresentation({
|
|
311
|
+
meta: {
|
|
312
|
+
key: "learning.journey.studio.widget",
|
|
313
|
+
version: "1.0.0",
|
|
314
|
+
description: "Compact widget for Studio onboarding progress",
|
|
315
|
+
goal: "Show quick progress summary.",
|
|
316
|
+
context: "Displayed in the Studio sidebar or header.",
|
|
317
|
+
...baseMeta
|
|
318
|
+
},
|
|
319
|
+
source: {
|
|
320
|
+
type: "component",
|
|
321
|
+
framework: "react",
|
|
322
|
+
componentKey: "LearningTrackProgressWidget"
|
|
323
|
+
},
|
|
324
|
+
targets: ["react"]
|
|
325
|
+
});
|
|
326
|
+
var studioOnboardingPresentations = [
|
|
327
|
+
StudioOnboardingTrackPresentation,
|
|
328
|
+
StudioOnboardingWidgetPresentation
|
|
329
|
+
];
|
|
330
|
+
|
|
331
|
+
// src/learning-journey-studio-onboarding.feature.ts
|
|
332
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
333
|
+
var LearningJourneyStudioOnboardingFeature = defineFeature({
|
|
334
|
+
meta: {
|
|
335
|
+
key: "learning-journey-studio-onboarding",
|
|
336
|
+
title: "Learning Journey: Studio Onboarding",
|
|
337
|
+
description: "Studio onboarding journey for getting started with ContractSpec Studio",
|
|
338
|
+
domain: "learning-journey",
|
|
339
|
+
owners: ["@examples.learning-journey.studio-onboarding"],
|
|
340
|
+
tags: ["learning", "onboarding", "studio", "journey"],
|
|
341
|
+
stability: "experimental",
|
|
342
|
+
version: "1.0.0"
|
|
343
|
+
},
|
|
344
|
+
operations: [
|
|
345
|
+
{ key: "learningJourney.studioOnboarding.recordEvent", version: "1.0.0" },
|
|
346
|
+
{ key: "learningJourney.studioOnboarding.getTrack", version: "1.0.0" }
|
|
347
|
+
],
|
|
348
|
+
events: [],
|
|
349
|
+
presentations: [
|
|
350
|
+
{ key: "learning.journey.studio.track", version: "1.0.0" },
|
|
351
|
+
{ key: "learning.journey.studio.widget", version: "1.0.0" }
|
|
352
|
+
],
|
|
353
|
+
opToPresentation: [
|
|
354
|
+
{
|
|
355
|
+
op: {
|
|
356
|
+
key: "learningJourney.studioOnboarding.getTrack",
|
|
357
|
+
version: "1.0.0"
|
|
358
|
+
},
|
|
359
|
+
pres: { key: "learning.journey.studio.track", version: "1.0.0" }
|
|
360
|
+
}
|
|
361
|
+
],
|
|
362
|
+
presentationsTargets: [
|
|
363
|
+
{
|
|
364
|
+
key: "learning.journey.studio.track",
|
|
365
|
+
version: "1.0.0",
|
|
366
|
+
targets: ["react", "markdown", "application/json"]
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
key: "learning.journey.studio.widget",
|
|
370
|
+
version: "1.0.0",
|
|
371
|
+
targets: ["react"]
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
capabilities: {
|
|
375
|
+
requires: [{ key: "identity", version: "1.0.0" }]
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
export {
|
|
379
|
+
studioOnboardingPresentations,
|
|
380
|
+
studioOnboardingEvents,
|
|
381
|
+
studioOnboardingContracts,
|
|
382
|
+
studioLearningTracks,
|
|
383
|
+
studioGettingStartedTrack,
|
|
384
|
+
example_default as example,
|
|
385
|
+
emitStudioOnboardingEvent,
|
|
386
|
+
emitAllStudioOnboardingEvents,
|
|
387
|
+
StudioOnboardingWidgetPresentation,
|
|
388
|
+
StudioOnboardingTrackPresentation,
|
|
389
|
+
StudioOnboardingTrackModel,
|
|
390
|
+
RecordStudioOnboardingEvent,
|
|
391
|
+
LearningJourneyStudioOnboardingFeature,
|
|
392
|
+
GetStudioOnboardingTrack
|
|
393
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// src/learning-journey-studio-onboarding.feature.ts
|
|
2
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
3
|
+
var LearningJourneyStudioOnboardingFeature = defineFeature({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "learning-journey-studio-onboarding",
|
|
6
|
+
title: "Learning Journey: Studio Onboarding",
|
|
7
|
+
description: "Studio onboarding journey for getting started with ContractSpec Studio",
|
|
8
|
+
domain: "learning-journey",
|
|
9
|
+
owners: ["@examples.learning-journey.studio-onboarding"],
|
|
10
|
+
tags: ["learning", "onboarding", "studio", "journey"],
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
},
|
|
14
|
+
operations: [
|
|
15
|
+
{ key: "learningJourney.studioOnboarding.recordEvent", version: "1.0.0" },
|
|
16
|
+
{ key: "learningJourney.studioOnboarding.getTrack", version: "1.0.0" }
|
|
17
|
+
],
|
|
18
|
+
events: [],
|
|
19
|
+
presentations: [
|
|
20
|
+
{ key: "learning.journey.studio.track", version: "1.0.0" },
|
|
21
|
+
{ key: "learning.journey.studio.widget", version: "1.0.0" }
|
|
22
|
+
],
|
|
23
|
+
opToPresentation: [
|
|
24
|
+
{
|
|
25
|
+
op: {
|
|
26
|
+
key: "learningJourney.studioOnboarding.getTrack",
|
|
27
|
+
version: "1.0.0"
|
|
28
|
+
},
|
|
29
|
+
pres: { key: "learning.journey.studio.track", version: "1.0.0" }
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
presentationsTargets: [
|
|
33
|
+
{
|
|
34
|
+
key: "learning.journey.studio.track",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
targets: ["react", "markdown", "application/json"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "learning.journey.studio.widget",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
targets: ["react"]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
capabilities: {
|
|
45
|
+
requires: [{ key: "identity", version: "1.0.0" }]
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
LearningJourneyStudioOnboardingFeature
|
|
50
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// src/track.ts
|
|
2
|
+
var studioGettingStartedTrack = {
|
|
3
|
+
id: "studio_getting_started",
|
|
4
|
+
productId: "contractspec-studio",
|
|
5
|
+
name: "Studio Getting Started",
|
|
6
|
+
description: "First 30 minutes in Studio: create a project, edit the spec, deploy/regenerate, and try key modules.",
|
|
7
|
+
targetUserSegment: "new_studio_user",
|
|
8
|
+
targetRole: "developer",
|
|
9
|
+
totalXp: 110,
|
|
10
|
+
streakRule: { hoursWindow: 48, bonusXp: 25 },
|
|
11
|
+
completionRewards: { xpBonus: 25, badgeKey: "studio_first_30m" },
|
|
12
|
+
steps: [
|
|
13
|
+
{
|
|
14
|
+
id: "choose_template",
|
|
15
|
+
title: "Choose a template",
|
|
16
|
+
description: "Create your first Studio project (starter template).",
|
|
17
|
+
order: 1,
|
|
18
|
+
completion: {
|
|
19
|
+
eventName: "studio.template.instantiated",
|
|
20
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
21
|
+
},
|
|
22
|
+
xpReward: 20,
|
|
23
|
+
metadata: { surface: "projects" }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "edit_spec",
|
|
27
|
+
title: "Edit the spec",
|
|
28
|
+
description: "Change the spec (not generated code) and save.",
|
|
29
|
+
instructions: "Open spec editor, tweak a contract or presentation, save.",
|
|
30
|
+
order: 2,
|
|
31
|
+
completion: {
|
|
32
|
+
eventName: "spec.changed",
|
|
33
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
34
|
+
},
|
|
35
|
+
xpReward: 20,
|
|
36
|
+
metadata: { surface: "spec-editor" }
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "regenerate_app",
|
|
40
|
+
title: "Regenerate the app",
|
|
41
|
+
description: "Regenerate artifacts from the updated spec.",
|
|
42
|
+
order: 3,
|
|
43
|
+
completion: {
|
|
44
|
+
eventName: "regeneration.completed",
|
|
45
|
+
sourceModule: "@contractspec/lib.contracts/regenerator"
|
|
46
|
+
},
|
|
47
|
+
xpReward: 20,
|
|
48
|
+
metadata: { surface: "regenerator" }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "open_canvas",
|
|
52
|
+
title: "Open the canvas",
|
|
53
|
+
description: "Visit the canvas module for your project.",
|
|
54
|
+
order: 4,
|
|
55
|
+
completion: {
|
|
56
|
+
eventName: "module.navigated",
|
|
57
|
+
sourceModule: "@contractspec/bundle.studio",
|
|
58
|
+
payloadFilter: { moduleId: "canvas" }
|
|
59
|
+
},
|
|
60
|
+
xpReward: 20,
|
|
61
|
+
metadata: { surface: "canvas" }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "try_evolution_mode",
|
|
65
|
+
title: "Try evolution mode",
|
|
66
|
+
description: "Request a change via Evolution, then regenerate.",
|
|
67
|
+
order: 5,
|
|
68
|
+
completion: {
|
|
69
|
+
eventName: "studio.evolution.applied",
|
|
70
|
+
sourceModule: "@contractspec/lib.evolution"
|
|
71
|
+
},
|
|
72
|
+
xpReward: 30,
|
|
73
|
+
metadata: { surface: "evolution" }
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
metadata: {
|
|
77
|
+
persona: "first_run",
|
|
78
|
+
surfacedIn: ["studio/home", "studio/sidebar/learning"]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var studioLearningTracks = [
|
|
82
|
+
studioGettingStartedTrack
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
// src/operations/index.ts
|
|
86
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
87
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
|
|
88
|
+
var OWNERS = ["examples.learning-journey.studio-onboarding"];
|
|
89
|
+
var StepModel = defineSchemaModel({
|
|
90
|
+
name: "StudioOnboardingStep",
|
|
91
|
+
description: "Step metadata for Studio onboarding journey",
|
|
92
|
+
fields: {
|
|
93
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
96
|
+
completionEvent: {
|
|
97
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
98
|
+
isOptional: false
|
|
99
|
+
},
|
|
100
|
+
sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
101
|
+
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
102
|
+
order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var StudioOnboardingTrackModel = defineSchemaModel({
|
|
106
|
+
name: "StudioOnboardingTrack",
|
|
107
|
+
description: "Studio onboarding track definition",
|
|
108
|
+
fields: {
|
|
109
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
110
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
111
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
112
|
+
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
113
|
+
completionXpBonus: {
|
|
114
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
115
|
+
isOptional: true
|
|
116
|
+
},
|
|
117
|
+
completionBadgeKey: {
|
|
118
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
119
|
+
isOptional: true
|
|
120
|
+
},
|
|
121
|
+
streakHoursWindow: {
|
|
122
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
123
|
+
isOptional: true
|
|
124
|
+
},
|
|
125
|
+
streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
126
|
+
steps: { type: StepModel, isArray: true, isOptional: false }
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
var TrackResponseModel = defineSchemaModel({
|
|
130
|
+
name: "StudioOnboardingTrackResponse",
|
|
131
|
+
description: "Response wrapper for studio onboarding track",
|
|
132
|
+
fields: {
|
|
133
|
+
track: { type: StudioOnboardingTrackModel, isOptional: false }
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
var RecordDemoEventInput = defineSchemaModel({
|
|
137
|
+
name: "StudioOnboardingRecordEventInput",
|
|
138
|
+
description: "Emit a demo event to advance Studio onboarding steps",
|
|
139
|
+
fields: {
|
|
140
|
+
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
141
|
+
eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
142
|
+
payload: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
143
|
+
occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
var SuccessModel = defineSchemaModel({
|
|
147
|
+
name: "StudioOnboardingSuccess",
|
|
148
|
+
description: "Generic success response",
|
|
149
|
+
fields: {
|
|
150
|
+
success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
var GetStudioOnboardingTrack = defineQuery({
|
|
154
|
+
meta: {
|
|
155
|
+
key: "learningJourney.studioOnboarding.getTrack",
|
|
156
|
+
version: "1.0.0",
|
|
157
|
+
stability: "experimental",
|
|
158
|
+
owners: [...OWNERS],
|
|
159
|
+
tags: ["learning", "onboarding", "studio"],
|
|
160
|
+
description: "Fetch the Studio onboarding track definition.",
|
|
161
|
+
goal: "Expose track metadata to UIs and templates.",
|
|
162
|
+
context: "Called by Studio/Playground to render journey steps."
|
|
163
|
+
},
|
|
164
|
+
io: {
|
|
165
|
+
input: defineSchemaModel({
|
|
166
|
+
name: "StudioOnboardingTrackInput",
|
|
167
|
+
description: "Track input",
|
|
168
|
+
fields: {}
|
|
169
|
+
}),
|
|
170
|
+
output: TrackResponseModel
|
|
171
|
+
},
|
|
172
|
+
policy: { auth: "user" }
|
|
173
|
+
});
|
|
174
|
+
var RecordStudioOnboardingEvent = defineCommand({
|
|
175
|
+
meta: {
|
|
176
|
+
key: "learningJourney.studioOnboarding.recordEvent",
|
|
177
|
+
version: "1.0.0",
|
|
178
|
+
stability: "experimental",
|
|
179
|
+
owners: [...OWNERS],
|
|
180
|
+
tags: ["learning", "onboarding", "studio"],
|
|
181
|
+
description: "Record an event to advance Studio onboarding progress.",
|
|
182
|
+
goal: "Advance steps via domain events in demo/sandbox contexts.",
|
|
183
|
+
context: "Called by handlers or demo scripts to emit step completion events."
|
|
184
|
+
},
|
|
185
|
+
io: {
|
|
186
|
+
input: RecordDemoEventInput,
|
|
187
|
+
output: SuccessModel
|
|
188
|
+
},
|
|
189
|
+
policy: { auth: "user" }
|
|
190
|
+
});
|
|
191
|
+
var studioOnboardingContracts = {
|
|
192
|
+
GetStudioOnboardingTrack,
|
|
193
|
+
RecordStudioOnboardingEvent,
|
|
194
|
+
track: studioGettingStartedTrack
|
|
195
|
+
};
|
|
196
|
+
export {
|
|
197
|
+
studioOnboardingContracts,
|
|
198
|
+
StudioOnboardingTrackModel,
|
|
199
|
+
RecordStudioOnboardingEvent,
|
|
200
|
+
GetStudioOnboardingTrack
|
|
201
|
+
};
|