@synap-core/workspace-templates 0.67.0 → 0.69.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/README.md +135 -68
- package/capabilities/design.capability.json +126 -643
- package/capabilities/storybook.capability.json +84 -0
- package/capabilities/vast-ai-compute-worker.capability.json +178 -76
- package/dist/index.js +1588 -104
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/designing-with-real-components/SKILL.md +7 -1
- package/src/agency-os.yaml +22 -4
- package/src/builder.yaml +1480 -773
- package/src/campaign-channel-platforms.template.test.ts +13 -2
- package/src/catalog-safety.test.ts +14 -3
- package/src/content-os.campaigns.template.test.ts +63 -20
- package/src/content-os.piece-model.template.test.ts +185 -41
- package/src/content-os.template.test.ts +174 -58
- package/src/content-os.yaml +170 -28
- package/src/crm.yaml +289 -46
- package/src/decisions-wave.template.test.ts +171 -47
- package/src/design-system.template.test.ts +87 -0
- package/src/design-system.yaml +173 -0
- package/src/ecosystem.yaml +7 -1
- package/src/finance.yaml +27 -5
- package/src/lifecycle-declarations.test.ts +8 -0
- package/src/marketing.yaml +6 -3
- package/src/process-contract.validate.test.ts +217 -71
- package/src/templates.ts +2522 -1310
- package/src/types.ts +35 -6
- package/src/ui-inventory.template.test.ts +256 -0
- package/src/validate.ts +541 -130
|
@@ -30,10 +30,12 @@ const tpl = (slug: string, c: WorkspaceYaml[] = corpus) => {
|
|
|
30
30
|
if (!t) throw new Error(`template ${slug} not in the corpus`);
|
|
31
31
|
return t;
|
|
32
32
|
};
|
|
33
|
-
const profileOf = (t: WorkspaceYaml, slug: string) =>
|
|
33
|
+
const profileOf = (t: WorkspaceYaml, slug: string) =>
|
|
34
|
+
t.profiles.find((p) => p.slug === slug);
|
|
34
35
|
const propOf = (t: WorkspaceYaml, profile: string, prop: string) =>
|
|
35
36
|
profileOf(t, profile)?.properties.find((p) => p.slug === prop);
|
|
36
|
-
const playbookOf = (t: WorkspaceYaml, name: string) =>
|
|
37
|
+
const playbookOf = (t: WorkspaceYaml, name: string) =>
|
|
38
|
+
t.playbooks?.find((p) => p.name === name);
|
|
37
39
|
const errorsOf = (t: WorkspaceYaml, c: WorkspaceYaml[] = corpus) =>
|
|
38
40
|
validateTemplate(t, { corpus: c }).errors.map((e) => `${e.rule} ${e.path}`);
|
|
39
41
|
|
|
@@ -44,10 +46,17 @@ describe("decision 1 — Business Developer folds into CRM", () => {
|
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
it("business-developer is a tombstone replaced by crm, and no live template depends on it", async () => {
|
|
47
|
-
expect(corpus.some((t) => t.meta.slug === "business-developer")).toBe(
|
|
49
|
+
expect(corpus.some((t) => t.meta.slug === "business-developer")).toBe(
|
|
50
|
+
false
|
|
51
|
+
);
|
|
48
52
|
const { retired } = await loadRetired();
|
|
49
|
-
expect(retired.find((r) => r.slug === "business-developer")).toMatchObject({
|
|
50
|
-
|
|
53
|
+
expect(retired.find((r) => r.slug === "business-developer")).toMatchObject({
|
|
54
|
+
kind: "workspace",
|
|
55
|
+
replacedBy: "crm",
|
|
56
|
+
});
|
|
57
|
+
const dependents = corpus.filter((t) =>
|
|
58
|
+
(t.dependencies ?? []).some((d) => d.slug === "business-developer")
|
|
59
|
+
);
|
|
51
60
|
expect(dependents.map((t) => t.meta.slug)).toEqual([]);
|
|
52
61
|
});
|
|
53
62
|
|
|
@@ -59,22 +68,35 @@ describe("decision 1 — Business Developer folds into CRM", () => {
|
|
|
59
68
|
// lead and burned the budget; "Score a list" scores a whole list in one run.
|
|
60
69
|
expect(pb?.activators).toEqual([{ on: "manual", mode: "propose" }]);
|
|
61
70
|
// The subject is a ROLE, declared pod-wide by foundation.
|
|
62
|
-
expect(profileOf(tpl("foundation"), "lead")).toMatchObject({
|
|
71
|
+
expect(profileOf(tpl("foundation"), "lead")).toMatchObject({
|
|
72
|
+
profileKind: "role",
|
|
73
|
+
scope: "shared",
|
|
74
|
+
});
|
|
63
75
|
// It owns researching and qualified; the other leadStage values belong to a
|
|
64
76
|
// person or another flow — derived by the pod, never listed (One model
|
|
65
77
|
// decision 4, 7 Nov 2026; conflict C2 on `outreach` closed).
|
|
66
|
-
const owned = (pb?.stages ?? [])
|
|
78
|
+
const owned = (pb?.stages ?? [])
|
|
79
|
+
.flatMap((s) => [s.subjectStatus, s.onApproved])
|
|
80
|
+
.filter(Boolean);
|
|
67
81
|
expect(owned).toEqual(["researching", "qualified"]);
|
|
68
|
-
for (const s of owned)
|
|
82
|
+
for (const s of owned)
|
|
83
|
+
expect(
|
|
84
|
+
propOf(tpl("foundation"), "lead", "leadStage")?.enumValues
|
|
85
|
+
).toContain(s);
|
|
69
86
|
// The last stage, reached when the person chose pursue, DECLARES
|
|
70
87
|
// qualified (the follow and flow.of read it) but nothing approves it
|
|
71
88
|
// (ungated, no output), so the pod never writes it: its goal tells the
|
|
72
89
|
// run to move the lead through the role's status door (decision D2). It
|
|
73
90
|
// opens no deal (CRM build plan A4, 2026-10-22): a deal is opened when a
|
|
74
91
|
// person records a booked meeting.
|
|
75
|
-
expect(pb?.stages?.at(-1)).toMatchObject({
|
|
92
|
+
expect(pb?.stages?.at(-1)).toMatchObject({
|
|
93
|
+
key: "pursue",
|
|
94
|
+
onApproved: "qualified",
|
|
95
|
+
});
|
|
76
96
|
expect(pb?.stages?.at(-1)?.subjectStatus).toBeUndefined();
|
|
77
|
-
expect(pb?.stages?.at(-1)?.goal).toMatch(
|
|
97
|
+
expect(pb?.stages?.at(-1)?.goal).toMatch(
|
|
98
|
+
/set the lead qualified yourself \(update_facet on the lead role, leadStage qualified/
|
|
99
|
+
);
|
|
78
100
|
expect(pb?.stages?.flatMap((s) => s.expectedOutputs ?? [])).toEqual([]);
|
|
79
101
|
expect(pb?.expectedOutputs).toBeUndefined();
|
|
80
102
|
});
|
|
@@ -84,42 +106,61 @@ describe("decision 1 — Business Developer folds into CRM", () => {
|
|
|
84
106
|
const c = structuredClone(corpus);
|
|
85
107
|
const pb = playbookOf(tpl("crm", c), "Qualify a lead")!;
|
|
86
108
|
pb.stages![0]!.subjectStatus = "won"; // a deal status, not a leadStage one
|
|
87
|
-
expect(errorsOf(tpl("crm", c), c)).toContain(
|
|
109
|
+
expect(errorsOf(tpl("crm", c), c)).toContain(
|
|
110
|
+
'stage-subject-status-unknown playbooks."Qualify a lead".stages.research.subjectStatus'
|
|
111
|
+
);
|
|
88
112
|
});
|
|
89
113
|
|
|
90
114
|
it("an onApproved outside the lifecycle is refused (D2)", () => {
|
|
91
115
|
const c = structuredClone(corpus);
|
|
92
116
|
const pb = playbookOf(tpl("crm", c), "Qualify a lead")!;
|
|
93
117
|
pb.stages![0]!.onApproved = "won";
|
|
94
|
-
expect(errorsOf(tpl("crm", c), c)).toContain(
|
|
118
|
+
expect(errorsOf(tpl("crm", c), c)).toContain(
|
|
119
|
+
'stage-on-approved-unknown playbooks."Qualify a lead".stages.research.onApproved'
|
|
120
|
+
);
|
|
95
121
|
});
|
|
96
122
|
|
|
97
123
|
it("an onApproved nothing approves is KEPT when the stage's goal names the move, refused when it does not (D2)", () => {
|
|
98
124
|
// The shipped catalog: every no-signal onApproved names its move.
|
|
99
|
-
const noSignal = corpus.flatMap((t) =>
|
|
125
|
+
const noSignal = corpus.flatMap((t) =>
|
|
126
|
+
errorsOf(t).filter((e) => e.startsWith("stage-on-approved-no-signal "))
|
|
127
|
+
);
|
|
100
128
|
expect(noSignal).toEqual([]);
|
|
101
129
|
// NEGATIVE: the same last stage, its goal silent on the move.
|
|
102
130
|
const c = structuredClone(corpus);
|
|
103
131
|
const pursue = playbookOf(tpl("crm", c), "Qualify a lead")!.stages!.at(-1)!;
|
|
104
132
|
expect(pursue.onApproved).toBe("qualified");
|
|
105
|
-
pursue.goal =
|
|
106
|
-
|
|
133
|
+
pursue.goal =
|
|
134
|
+
"Only after the person chose pursue, set the next action to book a meeting.";
|
|
135
|
+
expect(errorsOf(tpl("crm", c), c)).toContain(
|
|
136
|
+
'stage-on-approved-no-signal playbooks."Qualify a lead".stages.pursue.onApproved'
|
|
137
|
+
);
|
|
107
138
|
});
|
|
108
139
|
|
|
109
140
|
it("no-signal is the pod's: a required output or the NEXT stage's gate approves; the stage's own gate and an optional output do not (D2)", () => {
|
|
110
141
|
const rule = (c: WorkspaceYaml[]) =>
|
|
111
|
-
errorsOf(tpl("crm", c), c).filter(
|
|
112
|
-
|
|
142
|
+
errorsOf(tpl("crm", c), c).filter(
|
|
143
|
+
(e) =>
|
|
144
|
+
e.startsWith("stage-on-approved-no-signal ") &&
|
|
145
|
+
e.includes('"Win a deal"')
|
|
146
|
+
);
|
|
147
|
+
const send =
|
|
148
|
+
'stage-on-approved-no-signal playbooks."Win a deal".stages.send.onApproved';
|
|
113
149
|
const silent = () => {
|
|
114
150
|
const c = structuredClone(corpus);
|
|
115
|
-
const s = playbookOf(tpl("crm", c), "Win a deal")!.stages!.find(
|
|
151
|
+
const s = playbookOf(tpl("crm", c), "Win a deal")!.stages!.find(
|
|
152
|
+
(x) => x.key === "send"
|
|
153
|
+
)!;
|
|
116
154
|
// send carries its own human gate; the next stage (await-answer) has none.
|
|
117
155
|
expect(s.gate).toEqual({ kind: "human" });
|
|
118
156
|
// The shipped stage owes its Sent proposal (signal 1): strip it to judge
|
|
119
157
|
// the gates alone.
|
|
120
|
-
expect(s.expectedOutputs).toEqual([
|
|
158
|
+
expect(s.expectedOutputs).toEqual([
|
|
159
|
+
{ kind: "document", label: "Sent proposal", relationToSubject: "none" },
|
|
160
|
+
]);
|
|
121
161
|
s.expectedOutputs = undefined;
|
|
122
|
-
s.goal =
|
|
162
|
+
s.goal =
|
|
163
|
+
"A person approves the proposal; then send it to the decision maker.";
|
|
123
164
|
return { c, s, pb: playbookOf(tpl("crm", c), "Win a deal")! };
|
|
124
165
|
};
|
|
125
166
|
// Its own gate does not approve it: the goal must name the move.
|
|
@@ -127,7 +168,9 @@ describe("decision 1 — Business Developer folds into CRM", () => {
|
|
|
127
168
|
// An optional output does not either.
|
|
128
169
|
{
|
|
129
170
|
const { c, s } = silent();
|
|
130
|
-
s.expectedOutputs = [
|
|
171
|
+
s.expectedOutputs = [
|
|
172
|
+
{ kind: "document", label: "Sent proposal", optional: true },
|
|
173
|
+
];
|
|
131
174
|
expect(rule(c)).toEqual([send]);
|
|
132
175
|
}
|
|
133
176
|
// A required output does.
|
|
@@ -139,13 +182,16 @@ describe("decision 1 — Business Developer folds into CRM", () => {
|
|
|
139
182
|
// So does a gate on the NEXT stage.
|
|
140
183
|
{
|
|
141
184
|
const { c, pb } = silent();
|
|
142
|
-
pb.stages!.find((x) => x.key === "await-answer")!.gate = {
|
|
185
|
+
pb.stages!.find((x) => x.key === "await-answer")!.gate = {
|
|
186
|
+
kind: "human",
|
|
187
|
+
};
|
|
143
188
|
expect(rule(c)).toEqual([]);
|
|
144
189
|
}
|
|
145
190
|
// The option's LABEL names the move as well as its key ("Proposal sent").
|
|
146
191
|
{
|
|
147
192
|
const { c, s } = silent();
|
|
148
|
-
s.goal =
|
|
193
|
+
s.goal =
|
|
194
|
+
"A person approves the proposal; send it, then move the deal to Proposal sent.";
|
|
149
195
|
expect(rule(c)).toEqual([]);
|
|
150
196
|
}
|
|
151
197
|
});
|
|
@@ -159,34 +205,78 @@ describe("decision 1 — Business Developer folds into CRM", () => {
|
|
|
159
205
|
|
|
160
206
|
it("CRM carries the moved lead/client fields, the campaign kind and member_of", () => {
|
|
161
207
|
const crm = tpl("crm");
|
|
162
|
-
for (const p of [
|
|
208
|
+
for (const p of [
|
|
209
|
+
"icpScore",
|
|
210
|
+
"qualificationNotes",
|
|
211
|
+
"nextAction",
|
|
212
|
+
"outreachChannels",
|
|
213
|
+
"convertedAt",
|
|
214
|
+
"disqualificationReason",
|
|
215
|
+
])
|
|
163
216
|
expect(propOf(crm, "lead", p), `lead.${p}`).toBeDefined();
|
|
164
|
-
for (const p of [
|
|
217
|
+
for (const p of [
|
|
218
|
+
"becameClientAt",
|
|
219
|
+
"handoffStatus",
|
|
220
|
+
"handoffDestination",
|
|
221
|
+
"handoffNotes",
|
|
222
|
+
])
|
|
165
223
|
expect(propOf(crm, "client", p), `client.${p}`).toBeDefined();
|
|
166
224
|
expect(profileOf(crm, "campaign")?.semanticSlug).toBe("marketing.campaign");
|
|
167
|
-
expect(
|
|
225
|
+
expect(
|
|
226
|
+
crm.entityLinks
|
|
227
|
+
?.filter((l) => l.type === "member_of")
|
|
228
|
+
.map((l) => l.sourceProfileSlug)
|
|
229
|
+
).toEqual(["person", "company"]);
|
|
168
230
|
});
|
|
169
231
|
|
|
170
232
|
it("the Synap-fee and commission model left the catalog with arch-sales and the-arch, both tombstones", async () => {
|
|
171
|
-
const FEE = [
|
|
233
|
+
const FEE = [
|
|
234
|
+
"synapFeeModel",
|
|
235
|
+
"synapFixedFee",
|
|
236
|
+
"synapSuccessFeeRate",
|
|
237
|
+
"synapFeeAmount",
|
|
238
|
+
"sourcedByUserId",
|
|
239
|
+
"commissionEntitlementId",
|
|
240
|
+
"commissionStatus",
|
|
241
|
+
];
|
|
172
242
|
const { retired } = await loadRetired();
|
|
173
243
|
for (const slug of ["arch-sales", "the-arch"]) {
|
|
174
|
-
expect(
|
|
244
|
+
expect(
|
|
245
|
+
corpus.some((t) => t.meta.slug === slug),
|
|
246
|
+
`${slug} is live`
|
|
247
|
+
).toBe(false);
|
|
175
248
|
const stone = retired.find((r) => r.slug === slug);
|
|
176
|
-
expect(stone, `${slug} tombstone`).toMatchObject({
|
|
249
|
+
expect(stone, `${slug} tombstone`).toMatchObject({
|
|
250
|
+
kind: "workspace",
|
|
251
|
+
since: "2026-10-12",
|
|
252
|
+
});
|
|
177
253
|
expect(stone?.replacedBy, `${slug} has no replacement`).toBeUndefined();
|
|
178
|
-
const dependents = corpus.filter((t) =>
|
|
179
|
-
|
|
254
|
+
const dependents = corpus.filter((t) =>
|
|
255
|
+
(t.dependencies ?? []).some((d) => d.slug === slug)
|
|
256
|
+
);
|
|
257
|
+
expect(
|
|
258
|
+
dependents.map((t) => t.meta.slug),
|
|
259
|
+
`dependents of ${slug}`
|
|
260
|
+
).toEqual([]);
|
|
180
261
|
}
|
|
181
262
|
// No live template's deal carries the fee model any more (networking's
|
|
182
263
|
// `intro` keeps its own copy of the fee vocabulary: a separate decision).
|
|
183
264
|
for (const p of FEE) {
|
|
184
|
-
const holders = corpus
|
|
265
|
+
const holders = corpus
|
|
266
|
+
.filter((t) => !!propOf(t, "deal", p))
|
|
267
|
+
.map((t) => t.meta.slug);
|
|
185
268
|
expect(holders, `deal.${p}`).toEqual([]);
|
|
186
269
|
}
|
|
187
|
-
const holders = (pred: (t: WorkspaceYaml) => boolean) =>
|
|
188
|
-
|
|
189
|
-
expect(
|
|
270
|
+
const holders = (pred: (t: WorkspaceYaml) => boolean) =>
|
|
271
|
+
corpus.filter(pred).map((t) => t.meta.slug);
|
|
272
|
+
expect(
|
|
273
|
+
holders((t) => !!profileOf(t, "crm-commission-entitlement"))
|
|
274
|
+
).toEqual([]);
|
|
275
|
+
expect(
|
|
276
|
+
holders((t) =>
|
|
277
|
+
(t.automations ?? []).some((a) => a.name === "Win and hand off")
|
|
278
|
+
)
|
|
279
|
+
).toEqual([]);
|
|
190
280
|
});
|
|
191
281
|
});
|
|
192
282
|
|
|
@@ -194,7 +284,9 @@ describe("decision 4 — 'Deliver a deliverable' starts when the deliverable ent
|
|
|
194
284
|
const pb = playbookOf(tpl("operations"), "Deliver a deliverable")!;
|
|
195
285
|
|
|
196
286
|
it("its one activator is entering in-progress", () => {
|
|
197
|
-
expect(pb.activators).toEqual([
|
|
287
|
+
expect(pb.activators).toEqual([
|
|
288
|
+
{ on: "enters_status", status: "in-progress", mode: "propose" },
|
|
289
|
+
]);
|
|
198
290
|
});
|
|
199
291
|
|
|
200
292
|
it("no stage writes not-started (a run started at in-progress never moves the deliverable back)", () => {
|
|
@@ -208,7 +300,9 @@ describe("decision 4 — 'Deliver a deliverable' starts when the deliverable ent
|
|
|
208
300
|
|
|
209
301
|
describe("decision 5 — billing", () => {
|
|
210
302
|
it("an engagement chooses at-close (default) or per-deliverable billing", () => {
|
|
211
|
-
expect(
|
|
303
|
+
expect(
|
|
304
|
+
propOf(tpl("operations"), "engagement", "engagement-billing-mode")
|
|
305
|
+
).toMatchObject({
|
|
212
306
|
inputType: "select",
|
|
213
307
|
enumValues: ["at-close", "per-deliverable"],
|
|
214
308
|
constraints: { defaultValue: "at-close" },
|
|
@@ -216,7 +310,10 @@ describe("decision 5 — billing", () => {
|
|
|
216
310
|
});
|
|
217
311
|
|
|
218
312
|
it("an accepted deliverable may produce its milestone invoice (an optional slot)", () => {
|
|
219
|
-
const accepted = playbookOf(
|
|
313
|
+
const accepted = playbookOf(
|
|
314
|
+
tpl("operations"),
|
|
315
|
+
"Deliver a deliverable"
|
|
316
|
+
)!.stages!.find((s) => s.key === "accepted");
|
|
220
317
|
expect(accepted?.expectedOutputs?.map((o) => o.kind)).toEqual(["invoice"]);
|
|
221
318
|
// Owed by nobody (synap-backend 30a9ab85): an at-close run never shows it pending.
|
|
222
319
|
expect(accepted?.expectedOutputs?.[0]?.optional).toBe(true);
|
|
@@ -228,9 +325,13 @@ describe("decision 5 — billing", () => {
|
|
|
228
325
|
const pb = playbookOf(finance, "Bill a recurring fee")!;
|
|
229
326
|
expect(pb.subjectProfile?.profileSlug).toBe("revenue-stream");
|
|
230
327
|
// One run per stream, every month, running (not asking first).
|
|
231
|
-
expect(pb.activators).toEqual([
|
|
328
|
+
expect(pb.activators).toEqual([
|
|
329
|
+
{ on: "schedule", cron: "0 8 1 * *", size: "per_thing", mode: "run" },
|
|
330
|
+
]);
|
|
232
331
|
expect(pb).not.toHaveProperty("schedule");
|
|
233
|
-
expect(pb.metadata).toMatchObject({
|
|
332
|
+
expect(pb.metadata).toMatchObject({
|
|
333
|
+
governance: { forceProposeWrites: true },
|
|
334
|
+
});
|
|
234
335
|
// The pod's query filter grammar is a JSON string; it selects the streams the tick runs over.
|
|
235
336
|
const filter = pb.subjectProfile?.filter;
|
|
236
337
|
expect(typeof filter).toBe("string");
|
|
@@ -238,7 +339,11 @@ describe("decision 5 — billing", () => {
|
|
|
238
339
|
expect(Object.keys(parsed).length).toBeGreaterThan(0);
|
|
239
340
|
// Reachability: every filtered key is a property of revenue-stream and every value one of its options.
|
|
240
341
|
for (const [key, value] of Object.entries(parsed)) {
|
|
241
|
-
const prop = propOf(
|
|
342
|
+
const prop = propOf(
|
|
343
|
+
finance,
|
|
344
|
+
"revenue-stream",
|
|
345
|
+
key.replace(/^properties\./, "")
|
|
346
|
+
);
|
|
242
347
|
expect(prop?.enumValues, key).toContain(value);
|
|
243
348
|
}
|
|
244
349
|
expect(pb.expectedOutputs?.map((o) => o.kind)).toEqual(["invoice"]);
|
|
@@ -246,13 +351,18 @@ describe("decision 5 — billing", () => {
|
|
|
246
351
|
});
|
|
247
352
|
|
|
248
353
|
it("the drafted invoice is taken over by 'Bill a client' (its created activator)", () => {
|
|
249
|
-
expect(
|
|
354
|
+
expect(
|
|
355
|
+
playbookOf(tpl("finance"), "Bill a client")?.activators
|
|
356
|
+
).toContainEqual({ on: "created", mode: "propose" });
|
|
250
357
|
});
|
|
251
358
|
});
|
|
252
359
|
|
|
253
360
|
describe("settled item — a new brand voice guide is a draft", () => {
|
|
254
361
|
it("voice-status defaults to draft", () => {
|
|
255
|
-
expect(
|
|
362
|
+
expect(
|
|
363
|
+
propOf(tpl("brand-library"), "brand-voice-guide", "voice-status")
|
|
364
|
+
?.constraints
|
|
365
|
+
).toEqual({ defaultValue: "draft" });
|
|
256
366
|
});
|
|
257
367
|
});
|
|
258
368
|
|
|
@@ -262,7 +372,9 @@ describe("decision D2 — where a real artifact exists, the work itself reaches
|
|
|
262
372
|
it("Fix a finding's merged stage owes the merged pull request; the merge moves the finding to fixed", () => {
|
|
263
373
|
const merged = stageOf("builder-workspace", "Fix a finding", "merged");
|
|
264
374
|
expect(merged.onApproved).toBe("fixed");
|
|
265
|
-
expect(merged.expectedOutputs).toEqual([
|
|
375
|
+
expect(merged.expectedOutputs).toEqual([
|
|
376
|
+
{ kind: "pull_request", label: "Merged fix", relationToSubject: "none" },
|
|
377
|
+
]);
|
|
266
378
|
expect(merged.goal).toMatch(/with its url as the ref, and leave it open/);
|
|
267
379
|
expect(merged.goal).toMatch(/Never move the finding yourself/);
|
|
268
380
|
// Never the child's "Fix PR" label: the hand-off's draft PR must not close it.
|
|
@@ -270,12 +382,24 @@ describe("decision D2 — where a real artifact exists, the work itself reaches
|
|
|
270
382
|
});
|
|
271
383
|
it("Win a deal's send and Bill a client's send owe what was sent, and never move the subject themselves", () => {
|
|
272
384
|
for (const [slug, pb, label, output] of [
|
|
273
|
-
[
|
|
274
|
-
|
|
385
|
+
[
|
|
386
|
+
"crm",
|
|
387
|
+
"Win a deal",
|
|
388
|
+
"Sent proposal",
|
|
389
|
+
{ kind: "document", label: "Sent proposal", relationToSubject: "none" },
|
|
390
|
+
],
|
|
391
|
+
[
|
|
392
|
+
"finance",
|
|
393
|
+
"Bill a client",
|
|
394
|
+
"Invoice sent to the client",
|
|
395
|
+
{ kind: "document", label: "Invoice sent to the client" },
|
|
396
|
+
],
|
|
275
397
|
] as const) {
|
|
276
398
|
const send = stageOf(slug, pb, "send");
|
|
277
399
|
expect(send.expectedOutputs, pb).toEqual([output]);
|
|
278
|
-
expect(send.goal, pb).toContain(
|
|
400
|
+
expect(send.goal, pb).toContain(
|
|
401
|
+
`${label} output done with the sent message as its ref (update_run)`
|
|
402
|
+
);
|
|
279
403
|
expect(send.goal, pb).toMatch(/Never move the (deal|invoice) yourself/);
|
|
280
404
|
expect(send.goal, pb).not.toMatch(/update_entity/);
|
|
281
405
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "Design system on Synap" pack (plan 48854969 W5, "one click for
|
|
3
|
+
* anyone"): one install brings what an app's Storybook needs on a pod, and its
|
|
4
|
+
* setup asks three things, one at a time.
|
|
5
|
+
*
|
|
6
|
+
* What this guards:
|
|
7
|
+
* 1. the pack is a suite that owns no data, and REQUIRES what already exists
|
|
8
|
+
* instead of copying it: Dev first (the setup lands there), then the
|
|
9
|
+
* Brand library, then the storybook capability;
|
|
10
|
+
* 2. what it promises arrives through those dependencies: Dev carries the
|
|
11
|
+
* three UI kinds, the review and design playbooks and the two design
|
|
12
|
+
* skills; Brand carries the brand identity;
|
|
13
|
+
* 3. the setup asks ONE question per stage, in order (where the Storybook
|
|
14
|
+
* is, which app, which brand identity), each a stage-end ask of one field,
|
|
15
|
+
* and no other stage asks;
|
|
16
|
+
* 4. the storybook.sync parameters the setup names are the verb's own
|
|
17
|
+
* (`STORYBOOK_VERB_PARAMETERS`), so the text cannot drift from the door.
|
|
18
|
+
*
|
|
19
|
+
* Not covered: the install on a pod (CP + backend), whether the pod raises
|
|
20
|
+
* each endAsk at the end of its stage, and the run's resolution of the names.
|
|
21
|
+
*/
|
|
22
|
+
import { describe, expect, it } from "vitest";
|
|
23
|
+
import {
|
|
24
|
+
STORYBOOK_CAPABILITY_KEY,
|
|
25
|
+
STORYBOOK_SYNC_VERB,
|
|
26
|
+
STORYBOOK_VERB_PARAMETERS,
|
|
27
|
+
} from "@synap-core/types/storybook";
|
|
28
|
+
import { getWorkspaceTemplate } from "./templates.js";
|
|
29
|
+
|
|
30
|
+
const pack = getWorkspaceTemplate("design-system")!;
|
|
31
|
+
|
|
32
|
+
type EndAsk = { label: string; ask: { mode: string; form?: { fields: { key: string }[] } } };
|
|
33
|
+
type Stage = { key: string; goal: string; endAsk?: EndAsk };
|
|
34
|
+
type Pb = { name: string; goalTemplate: string; stages: Stage[] };
|
|
35
|
+
type Dep = { slug: string; kind: string; relation: string };
|
|
36
|
+
|
|
37
|
+
const deps = (pack as unknown as { dependencies: Dep[] }).dependencies;
|
|
38
|
+
const setup = (pack.playbooks as unknown as Pb[]).find((p) => p.name === "Set up a design system")!;
|
|
39
|
+
|
|
40
|
+
describe("Design system pack", () => {
|
|
41
|
+
it("is a suite that owns no data and requires Dev first, then Brand and the storybook capability", () => {
|
|
42
|
+
expect(pack.meta.tags).toContain("suite");
|
|
43
|
+
expect(pack.profiles).toEqual([]);
|
|
44
|
+
expect(deps.map((d) => [d.slug, d.kind, d.relation])).toEqual([
|
|
45
|
+
["builder-workspace", "workspace", "require"],
|
|
46
|
+
["brand-library", "workspace", "require"],
|
|
47
|
+
[STORYBOOK_CAPABILITY_KEY, "capability", "require"],
|
|
48
|
+
]);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("brings the UI kinds, the review and design playbooks and the design skills through Dev", () => {
|
|
52
|
+
const dev = getWorkspaceTemplate("builder-workspace")!;
|
|
53
|
+
const kinds = new Set(dev.profiles.map((p) => p.slug));
|
|
54
|
+
for (const k of ["ui-component", "ui-page", "user-flow", "devplane_app"]) expect(kinds.has(k), k).toBe(true);
|
|
55
|
+
const playbooks = new Set((dev.playbooks ?? []).map((p) => p.name));
|
|
56
|
+
for (const name of ["Review a UI component", "Design to implementation"])
|
|
57
|
+
expect(playbooks.has(name), name).toBe(true);
|
|
58
|
+
const devDeps = (dev as unknown as { dependencies: Dep[] }).dependencies.map((d) => `${d.kind}:${d.slug}`);
|
|
59
|
+
expect(devDeps).toEqual(expect.arrayContaining(["skill:design-critique", "skill:designing-with-real-components"]));
|
|
60
|
+
const brand = getWorkspaceTemplate("brand-library")!;
|
|
61
|
+
expect(brand.profiles.some((p) => p.slug === "brand-identity")).toBe(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("asks three things, one per stage, in order, and nothing else", () => {
|
|
65
|
+
expect(setup).toBeDefined();
|
|
66
|
+
const asks = setup.stages
|
|
67
|
+
.filter((s) => s.endAsk)
|
|
68
|
+
.map((s) => [s.key, s.endAsk!.ask.mode, (s.endAsk!.ask.form?.fields ?? []).map((f) => f.key)]);
|
|
69
|
+
expect(asks).toEqual([
|
|
70
|
+
["where", "form", ["storybookUrl"]],
|
|
71
|
+
["app", "form", ["app"]],
|
|
72
|
+
["brand", "form", ["brand"]],
|
|
73
|
+
]);
|
|
74
|
+
// The three asking stages come first, before the run connects anything.
|
|
75
|
+
expect(setup.stages.slice(0, 3).map((s) => s.key)).toEqual(["where", "app", "brand"]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("names only storybook.sync's own parameters, and the brand only there", () => {
|
|
79
|
+
const params = Object.keys(STORYBOOK_VERB_PARAMETERS[STORYBOOK_SYNC_VERB].properties);
|
|
80
|
+
const connect = setup.stages.find((s) => s.key === "connect")!;
|
|
81
|
+
for (const p of ["url", "bundleFileId", "appId", "brandIdentityId"]) {
|
|
82
|
+
expect(params, p).toContain(p);
|
|
83
|
+
expect(connect.goal, p).toContain(p);
|
|
84
|
+
}
|
|
85
|
+
expect(setup.goalTemplate).toMatch(/brand identity goes only to storybook\.sync/);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Design system on Synap — a pack (a `suite` workspace template)
|
|
2
|
+
# ==============================================================
|
|
3
|
+
# Plan 48854969 W5 "one click for anyone": install it and an app's Storybook
|
|
4
|
+
# becomes records on the pod (ui-component, ui-page, user-flow), reviewed by
|
|
5
|
+
# a playbook and tied to a brand identity in the Brand space.
|
|
6
|
+
#
|
|
7
|
+
# It installs, in order, what already exists (one space per domain) and owns
|
|
8
|
+
# no data of its own (`profiles: []`):
|
|
9
|
+
# • builder-workspace — the kinds ui-component, ui-page, user-flow and
|
|
10
|
+
# devplane_app, the playbooks "Review a UI component" (its weekly sweep is
|
|
11
|
+
# installed paused) and "Design to implementation", and the skills
|
|
12
|
+
# design-critique and designing-with-real-components;
|
|
13
|
+
# • brand-library — the brand identity a Storybook expresses;
|
|
14
|
+
# • storybook — the capability (storybook.sync, storybook.changed).
|
|
15
|
+
# It carries only the setup process, which lands in its primary domain (Dev).
|
|
16
|
+
#
|
|
17
|
+
# SETUP ASKS THREE THINGS, ONE AT A TIME. A package install takes no answers
|
|
18
|
+
# (a workspace package is applied with no params, backend marketplace-install
|
|
19
|
+
# `case "template"`), and a pack owns no space, so it carries no onboarding
|
|
20
|
+
# interview. What exists to ask a person one question at a time is a
|
|
21
|
+
# playbook stage's `endAsk`: the pod raises it when the turn ends the stage and
|
|
22
|
+
# the answer wakes the run at the next one. So the setup is the playbook below.
|
|
23
|
+
# An endAsk's choices are static, or the run subject's relations
|
|
24
|
+
# (`optionsFrom`); there is no subject before the app is named, so "which app"
|
|
25
|
+
# and "which brand identity" are answered by name and the run resolves them.
|
|
26
|
+
#
|
|
27
|
+
# THE SYNC SCHEDULE. The storybook sync kind is not ticked by the pod
|
|
28
|
+
# (`scheduled: false`, backend storybook-sync.ts) and a package cannot carry an
|
|
29
|
+
# automation holding one person's url and ids (`apply-time-placeholder`). So
|
|
30
|
+
# the setup run files the person's own daily sync automation (a public URL),
|
|
31
|
+
# or hands the build-and-upload step to their computer after each push (a
|
|
32
|
+
# computer). The brand identity lives only on the sync SOURCE's config (the
|
|
33
|
+
# contract): storybook.sync stores it there, never on the mirrored records.
|
|
34
|
+
|
|
35
|
+
meta:
|
|
36
|
+
slug: design-system
|
|
37
|
+
domain: build
|
|
38
|
+
name: Design system on Synap
|
|
39
|
+
description: Mirror an app's Storybook into your pod — every component, page and user flow as a record with its screenshot, status and what it is made of — review the ones that change with the design-critique rubric, and tie it to your brand identity. Setup asks three things, one at a time.
|
|
40
|
+
icon: layout-template
|
|
41
|
+
color: "#7C3AED"
|
|
42
|
+
tags: [suite, design, storybook, ui, builder, brand]
|
|
43
|
+
isPublic: true
|
|
44
|
+
|
|
45
|
+
dependencies:
|
|
46
|
+
- slug: builder-workspace
|
|
47
|
+
kind: workspace
|
|
48
|
+
relation: require
|
|
49
|
+
reason: "The kinds the Storybook becomes (ui-component, ui-page, user-flow, the app), the review and design playbooks, and the design-critique rubric. Must resolve first: the setup process lands here."
|
|
50
|
+
- slug: brand-library
|
|
51
|
+
kind: workspace
|
|
52
|
+
relation: require
|
|
53
|
+
reason: "The brand identity the Storybook expresses; the sync source names it."
|
|
54
|
+
- slug: storybook
|
|
55
|
+
kind: capability
|
|
56
|
+
relation: require
|
|
57
|
+
reason: "storybook.sync mirrors the Storybook into the records; storybook.changed lists the components changed since their last review."
|
|
58
|
+
|
|
59
|
+
workspace:
|
|
60
|
+
name: Design system on Synap
|
|
61
|
+
description: Setting up an app's Storybook as pod records, layered onto the Dev space.
|
|
62
|
+
|
|
63
|
+
profiles: []
|
|
64
|
+
|
|
65
|
+
playbooks:
|
|
66
|
+
- name: Set up a design system
|
|
67
|
+
description: "Connect one app's Storybook to the pod in three questions asked one at a time: where the Storybook is (a public URL, or a computer that builds and uploads it), which app or project it belongs to, and which brand identity it expresses. Ends with the first sync's import proposal filed for the person and the sync kept current."
|
|
68
|
+
goalTemplate: >-
|
|
69
|
+
Set up the design system of one app on this pod. Load the
|
|
70
|
+
designing-with-real-components skill first. The pod asks the person three
|
|
71
|
+
things, one per stage, when your turn ends that stage: never ask them
|
|
72
|
+
yourself and never ask two at once. WHERE: read what the pod already has
|
|
73
|
+
(the apps, the brand identities, any ui-component records and the app
|
|
74
|
+
they belong to) and list the apps and brand identities by name, so the
|
|
75
|
+
next answers can name one. APP: resolve the app the person named (an
|
|
76
|
+
existing devplane_app first; never a second record for one that exists;
|
|
77
|
+
a new one is created through a proposal, filed into the person's
|
|
78
|
+
project). BRAND: resolve the brand identity they named (brand-identity,
|
|
79
|
+
Brand space); none named: the source carries none. CONNECT: a public
|
|
80
|
+
https URL → run storybook.sync with url, appId and brandIdentityId; a
|
|
81
|
+
computer → hand the build-and-upload step to the person's computer
|
|
82
|
+
(hand-off skill): it builds Storybook, writes a synap.storybook-bundle/v1
|
|
83
|
+
file, uploads it to the pod and runs storybook.sync with bundleFileId,
|
|
84
|
+
appId and brandIdentityId. The first run of a source is ONE import
|
|
85
|
+
proposal the person approves; never write the records yourself. KEEP
|
|
86
|
+
CURRENT: the pod does not re-sync a Storybook on its own; for a URL, file
|
|
87
|
+
a daily automation that runs storybook.sync with the same three values;
|
|
88
|
+
for a computer, the same build, upload and sync runs after each push to
|
|
89
|
+
the app's main. The brand identity goes only to storybook.sync (the
|
|
90
|
+
source's config), never onto the records.
|
|
91
|
+
# No activator: a manual activator fires on a subject, and this setup has
|
|
92
|
+
# none (the app is its second answer). It is started by name
|
|
93
|
+
# (run_playbook), by the person or an agent they ask.
|
|
94
|
+
executor: is-agent
|
|
95
|
+
status: active
|
|
96
|
+
stages:
|
|
97
|
+
- key: where
|
|
98
|
+
name: Where the Storybook is
|
|
99
|
+
category: planned
|
|
100
|
+
goal: Read the pod's apps (devplane_app), brand identities (brand-identity) and any ui-component records with the app they belong to, and list the apps and brand identities by name in your message. Ask nothing yourself; when your turn ends the pod asks where the Storybook is.
|
|
101
|
+
endAsk:
|
|
102
|
+
label: Where the Storybook is
|
|
103
|
+
why: The pod reads a public Storybook over https, or a bundle a computer of yours builds and uploads after each push.
|
|
104
|
+
unblocks: The run asks which app the Storybook belongs to
|
|
105
|
+
ask:
|
|
106
|
+
mode: form
|
|
107
|
+
form:
|
|
108
|
+
title: Where is the Storybook?
|
|
109
|
+
fields:
|
|
110
|
+
- key: storybookUrl
|
|
111
|
+
label: Public Storybook URL (https)
|
|
112
|
+
type: url
|
|
113
|
+
required: false
|
|
114
|
+
help: Leave it empty when the Storybook is private; a computer of yours then builds it and uploads it to the pod after each push.
|
|
115
|
+
- key: app
|
|
116
|
+
name: Which app
|
|
117
|
+
category: started
|
|
118
|
+
goal: Read the Storybook answer (a URL must be https; an empty answer means a computer uploads). Ask nothing yourself; when your turn ends the pod asks which app or project the Storybook belongs to.
|
|
119
|
+
endAsk:
|
|
120
|
+
label: Which app the Storybook belongs to
|
|
121
|
+
why: Every component, page and flow is recorded as part of one app.
|
|
122
|
+
unblocks: The run asks which brand identity the Storybook expresses
|
|
123
|
+
ask:
|
|
124
|
+
mode: form
|
|
125
|
+
form:
|
|
126
|
+
title: Which app or project is it?
|
|
127
|
+
fields:
|
|
128
|
+
- key: app
|
|
129
|
+
label: The app (or project) this Storybook belongs to, by name
|
|
130
|
+
type: text
|
|
131
|
+
required: true
|
|
132
|
+
help: One of the apps listed above. A new name becomes a new app once you approve it.
|
|
133
|
+
- key: brand
|
|
134
|
+
name: Which brand identity
|
|
135
|
+
category: started
|
|
136
|
+
goal: Resolve the app the person named (an existing devplane_app first, never a twin; a new one through a proposal filed into their project). Ask nothing yourself; when your turn ends the pod asks which brand identity the Storybook expresses.
|
|
137
|
+
criteria:
|
|
138
|
+
- key: app-resolved-once
|
|
139
|
+
statement: The named app resolves to exactly one devplane_app, an existing one or one proposed in this run; no second record of an existing app was created.
|
|
140
|
+
check: { kind: judge }
|
|
141
|
+
endAsk:
|
|
142
|
+
label: Which brand identity it expresses
|
|
143
|
+
why: The sync source names the brand identity, so reviews and designs read the right brand.
|
|
144
|
+
unblocks: The run connects the Storybook and starts its first sync
|
|
145
|
+
ask:
|
|
146
|
+
mode: form
|
|
147
|
+
form:
|
|
148
|
+
title: Which brand identity?
|
|
149
|
+
fields:
|
|
150
|
+
- key: brand
|
|
151
|
+
label: The brand identity this Storybook expresses, by name
|
|
152
|
+
type: text
|
|
153
|
+
required: false
|
|
154
|
+
help: From the Brand space. Leave it empty to connect the Storybook without a brand.
|
|
155
|
+
- key: connect
|
|
156
|
+
name: Connect and first sync
|
|
157
|
+
category: started
|
|
158
|
+
goal: "Resolve the brand identity the person named (brand-identity in the Brand space; empty: none). A URL: run storybook.sync with url, appId and brandIdentityId. A computer: hand the step to the person's computer (hand-off skill): build Storybook, write a synap.storybook-bundle/v1 file, upload it to the pod, run storybook.sync with bundleFileId, appId and brandIdentityId. The first run is one import proposal for the person; a refused or failed sync is reported with its reason, never retried blindly."
|
|
159
|
+
criteria:
|
|
160
|
+
- key: sync-ran-with-answers
|
|
161
|
+
statement: storybook.sync ran once with the person's source (url, or a bundle file a computer uploaded), the resolved appId and, when one was named, the brandIdentityId, and its import proposal is filed or its refusal is reported with the reason.
|
|
162
|
+
check: { kind: judge }
|
|
163
|
+
- key: brand-only-on-source
|
|
164
|
+
statement: The brand identity was passed to storybook.sync only; no mirrored record was written by hand.
|
|
165
|
+
check: { kind: judge }
|
|
166
|
+
- key: keep-current
|
|
167
|
+
name: Keep it current
|
|
168
|
+
category: completed
|
|
169
|
+
goal: "A URL: file a daily automation (create_automation, cron) whose one capability step runs storybook.sync with the same url, appId and brandIdentityId. A computer: record on the session that the build, upload and sync run after each push to the app's main, and on which computer. Then say how the weekly review of changed components is turned on (the schedule of Review a UI component is installed paused)."
|
|
170
|
+
criteria:
|
|
171
|
+
- key: sync-kept-current
|
|
172
|
+
statement: For a URL a daily storybook.sync automation is filed with the same three values; for a computer the session names the computer and the push that triggers the upload.
|
|
173
|
+
check: { kind: judge }
|