@synap-core/workspace-templates 0.66.0 → 0.68.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.
@@ -33,8 +33,12 @@ describe("Content OS pin strategy", () => {
33
33
  });
34
34
 
35
35
  it("pins Produce Content; Plan Next Content runs weekly and by hand, once per tick, proposing", () => {
36
- const produce = template.playbooks?.find((p) => p.name === "Produce Content");
37
- const plan = template.playbooks?.find((p) => p.name === "Plan Next Content");
36
+ const produce = template.playbooks?.find(
37
+ (p) => p.name === "Produce Content"
38
+ );
39
+ const plan = template.playbooks?.find(
40
+ (p) => p.name === "Plan Next Content"
41
+ );
38
42
 
39
43
  expect(produce?.inputStrategy).toEqual({
40
44
  kind: "pinned",
@@ -63,8 +67,13 @@ describe("Content OS pin strategy", () => {
63
67
 
64
68
  it("ships one paused playbook_run of Produce Content, with no subject binding", () => {
65
69
  // Two automations: this weekly run, and Publish due posts (content-os.publish-due-posts.template.test.ts).
66
- expect(template.automations?.map((a) => a.key)).toEqual(["content-os-weekly-produce", "content-os-publish-due-posts"]);
67
- const automation = template.automations?.find((a) => a.key === "content-os-weekly-produce");
70
+ expect(template.automations?.map((a) => a.key)).toEqual([
71
+ "content-os-weekly-produce",
72
+ "content-os-publish-due-posts",
73
+ ]);
74
+ const automation = template.automations?.find(
75
+ (a) => a.key === "content-os-weekly-produce"
76
+ );
68
77
  expect(automation).toMatchObject({
69
78
  key: "content-os-weekly-produce",
70
79
  triggerType: "cron",
@@ -97,7 +106,8 @@ describe("Content OS pin strategy", () => {
97
106
  * with only Content OS: `Profile not found: content-composition`.
98
107
  */
99
108
  describe("Content OS owns the video / visual pipeline", () => {
100
- const profile = (slug: string) => template.profiles.find((p) => p.slug === slug);
109
+ const profile = (slug: string) =>
110
+ template.profiles.find((p) => p.slug === slug);
101
111
 
102
112
  it("declares content-composition, content-asset and render-job (workspace scope)", () => {
103
113
  for (const slug of ["content-composition", "content-asset", "render-job"]) {
@@ -107,16 +117,23 @@ describe("Content OS owns the video / visual pipeline", () => {
107
117
  }
108
118
  // The fields the Content app and the composition detail read.
109
119
  expect(profile("render-job")?.properties.map((d) => d.slug)).toEqual(
110
- expect.arrayContaining(["job-status", "render-progress", "composition-ref"])
120
+ expect.arrayContaining([
121
+ "job-status",
122
+ "render-progress",
123
+ "composition-ref",
124
+ ])
125
+ );
126
+ expect(profile("content-asset")?.properties.map((d) => d.slug)).toContain(
127
+ "asset-kind"
111
128
  );
112
- expect(profile("content-asset")?.properties.map((d) => d.slug)).toContain("asset-kind");
113
129
  });
114
130
 
115
131
  it("re-declares brand-template as shared (the grant) and requires brand-library (the SSOT)", () => {
116
132
  expect(profile("brand-template")?.scope).toBe("shared");
117
133
  expect(
118
134
  (template.dependencies ?? []).some(
119
- (d) => d.slug === "brand-library" && (d.relation ?? "require") === "require"
135
+ (d) =>
136
+ d.slug === "brand-library" && (d.relation ?? "require") === "require"
120
137
  )
121
138
  ).toBe(true);
122
139
  });
@@ -124,7 +141,11 @@ describe("Content OS owns the video / visual pipeline", () => {
124
141
  it("ships the pipeline views and links", () => {
125
142
  const viewScopes = (template.views ?? []).map((v) => v.scopeProfileSlug);
126
143
  expect(viewScopes).toEqual(
127
- expect.arrayContaining(["content-composition", "content-asset", "render-job"])
144
+ expect.arrayContaining([
145
+ "content-composition",
146
+ "content-asset",
147
+ "render-job",
148
+ ])
128
149
  );
129
150
  const links = (template.entityLinks ?? []).map(
130
151
  (l) => `${l.sourceProfileSlug}-${l.type}->${l.targetProfileSlug}`
@@ -140,7 +161,10 @@ describe("Content OS owns the video / visual pipeline", () => {
140
161
  });
141
162
 
142
163
  it("keeps its own home: the content-home cell", () => {
143
- expect(template.app).toMatchObject({ kind: "stored", cellKey: "content-home" });
164
+ expect(template.app).toMatchObject({
165
+ kind: "stored",
166
+ cellKey: "content-home",
167
+ });
144
168
  });
145
169
  });
146
170
 
@@ -156,61 +180,106 @@ describe("Content OS owns the video / visual pipeline", () => {
156
180
  describe("Content OS never writes an outside act before a person confirms it", () => {
157
181
  const playbooks = (template.playbooks ?? []) as TemplatePlaybook[];
158
182
  type Stage = NonNullable<TemplatePlaybook["stages"]>[number];
159
- const bound: Array<{ playbook: string; stage: Stage; value: string; via: "enter" | "reach"; next?: Stage }> =
160
- playbooks.flatMap((pb) =>
161
- (pb.stages ?? []).flatMap((stage, i, all) => [
162
- ...(typeof stage.subjectStatus === "string"
163
- ? [{ playbook: pb.name, stage, value: stage.subjectStatus, via: "enter" as const }]
164
- : []),
165
- ...(typeof stage.onApproved === "string"
166
- ? [{ playbook: pb.name, stage, value: stage.onApproved, via: "reach" as const, next: all[i + 1] }]
167
- : []),
168
- ]),
169
- );
183
+ const bound: Array<{
184
+ playbook: string;
185
+ stage: Stage;
186
+ value: string;
187
+ via: "enter" | "reach";
188
+ next?: Stage;
189
+ }> = playbooks.flatMap((pb) =>
190
+ (pb.stages ?? []).flatMap((stage, i, all) => [
191
+ ...(typeof stage.subjectStatus === "string"
192
+ ? [
193
+ {
194
+ playbook: pb.name,
195
+ stage,
196
+ value: stage.subjectStatus,
197
+ via: "enter" as const,
198
+ },
199
+ ]
200
+ : []),
201
+ ...(typeof stage.onApproved === "string"
202
+ ? [
203
+ {
204
+ playbook: pb.name,
205
+ stage,
206
+ value: stage.onApproved,
207
+ via: "reach" as const,
208
+ next: all[i + 1],
209
+ },
210
+ ]
211
+ : []),
212
+ ])
213
+ );
170
214
  // Values another playbook's activator listens for, per subject kind.
171
- const activatedElsewhere = (owner: string, kind: string | undefined, status: string) =>
215
+ const activatedElsewhere = (
216
+ owner: string,
217
+ kind: string | undefined,
218
+ status: string
219
+ ) =>
172
220
  playbooks.some(
173
221
  (pb) =>
174
222
  pb.name !== owner &&
175
223
  pb.subjectProfile?.profileSlug === kind &&
176
- (pb.activators ?? []).some((a) => a.on === "enters_status" && a.status === status),
224
+ (pb.activators ?? []).some(
225
+ (a) => a.on === "enters_status" && a.status === status
226
+ )
177
227
  );
178
- const kindOf = (name: string) => playbooks.find((p) => p.name === name)?.subjectProfile?.profileSlug;
228
+ const kindOf = (name: string) =>
229
+ playbooks.find((p) => p.name === name)?.subjectProfile?.profileSlug;
179
230
 
180
231
  const mustBeHuman = bound.filter(
181
232
  ({ playbook, stage, value }) =>
182
- stage.category === "completed" || activatedElsewhere(playbook, kindOf(playbook), value),
233
+ stage.category === "completed" ||
234
+ activatedElsewhere(playbook, kindOf(playbook), value)
183
235
  );
184
236
 
185
237
  it("finds the stages it guards (non-vacuity)", () => {
186
- expect(mustBeHuman.map(({ playbook, stage, via }) => `${playbook}/${stage.key}/${via}`).sort()).toEqual([
187
- "Newsletter issue/sent/enter",
188
- "Produce Content/publish/reach",
189
- ]);
238
+ expect(
239
+ mustBeHuman
240
+ .map(({ playbook, stage, via }) => `${playbook}/${stage.key}/${via}`)
241
+ .sort()
242
+ ).toEqual(["Newsletter issue/sent/enter", "Produce Content/publish/reach"]);
190
243
  });
191
244
 
192
245
  it("gates each of them on a person, or leaves them to the act itself", () => {
193
246
  for (const { playbook, stage, via, next } of mustBeHuman) {
194
247
  const at = `${playbook}/${stage.key}`;
195
248
  if (via === "enter") {
196
- expect({ at, gate: stage.gate }).toEqual({ at, gate: { kind: "human" } });
249
+ expect({ at, gate: stage.gate }).toEqual({
250
+ at,
251
+ gate: { kind: "human" },
252
+ });
197
253
  continue;
198
254
  }
199
255
  // Reached: approved by the next stage's PERSON gate, or by nothing (no
200
256
  // outputs, no next stage) — the sender or a person writes it.
201
257
  const approvedBy =
202
- (stage.expectedOutputs ?? []).length > 0 ? "its outputs" : next ? `next gate: ${next.gate?.kind ?? "none"}` : "nothing";
203
- expect({ at, ok: approvedBy === "nothing" || approvedBy === "next gate: human" }).toEqual({ at, ok: true });
258
+ (stage.expectedOutputs ?? []).length > 0
259
+ ? "its outputs"
260
+ : next
261
+ ? `next gate: ${next.gate?.kind ?? "none"}`
262
+ : "nothing";
263
+ expect({
264
+ at,
265
+ ok: approvedBy === "nothing" || approvedBy === "next gate: human",
266
+ }).toEqual({ at, ok: true });
204
267
  }
205
268
  });
206
269
 
207
270
  it("keeps a recorded-evidence criterion on each (URL / date)", () => {
208
271
  for (const { playbook, stage } of mustBeHuman) {
209
272
  const evidence = (stage.criteria ?? [])
210
- .map((c) => (c as { check?: { kind?: string; evidenceKey?: string } }).check)
273
+ .map(
274
+ (c) =>
275
+ (c as { check?: { kind?: string; evidenceKey?: string } }).check
276
+ )
211
277
  .filter((c) => c?.kind === "evidence")
212
278
  .map((c) => c!.evidenceKey);
213
- expect({ at: `${playbook}/${stage.key}`, has: evidence.length > 0 }).toEqual({
279
+ expect({
280
+ at: `${playbook}/${stage.key}`,
281
+ has: evidence.length > 0,
282
+ }).toEqual({
214
283
  at: `${playbook}/${stage.key}`,
215
284
  has: true,
216
285
  });
@@ -224,20 +293,34 @@ describe("Content OS never writes an outside act before a person confirms it", (
224
293
  // without a rebuild.
225
294
  describe("Content OS scripts a post before generating it", () => {
226
295
  const source = load(
227
- readFileSync(join(dirname(fileURLToPath(import.meta.url)), "content-os.yaml"), "utf8"),
296
+ readFileSync(
297
+ join(dirname(fileURLToPath(import.meta.url)), "content-os.yaml"),
298
+ "utf8"
299
+ )
228
300
  ) as WorkspaceYaml;
229
301
  const post = source.profiles.find((p) => p.slug === "post");
230
302
  const prop = (slug: string) => post?.properties.find((d) => d.slug === slug);
231
- const produce = (source.playbooks ?? []).find((p) => p.name === "Produce Content") as
232
- | TemplatePlaybook
233
- | undefined;
303
+ const produce = (source.playbooks ?? []).find(
304
+ (p) => p.name === "Produce Content"
305
+ ) as TemplatePlaybook | undefined;
234
306
  const stage = (key: string) => produce?.stages?.find((s) => s.key === key);
235
307
 
236
308
  it("puts Scripted between Briefed and In Draft, in the enum and the lifecycle", () => {
237
- const order = ["Idea", "Briefed", "Scripted", "In Draft", "Review", "Scheduled", "Published", "Archived"];
309
+ const order = [
310
+ "Idea",
311
+ "Briefed",
312
+ "Scripted",
313
+ "In Draft",
314
+ "Review",
315
+ "Scheduled",
316
+ "Published",
317
+ "Archived",
318
+ ];
238
319
  expect(prop("post-status")?.enumValues).toEqual(order);
239
320
  expect(post?.lifecycle?.options.map((o) => o.key)).toEqual(order);
240
- expect(post?.lifecycle?.options.find((o) => o.key === "Scripted")?.category).toBe("active");
321
+ expect(
322
+ post?.lifecycle?.options.find((o) => o.key === "Scripted")?.category
323
+ ).toBe("active");
241
324
  });
242
325
 
243
326
  it("declares post-goal with the shared goal enum", () => {
@@ -285,27 +368,43 @@ describe("Content OS ideas: their own kind, feeding posts", () => {
285
368
 
286
369
  it("declares the idea kind with one lifecycle and no post fields", () => {
287
370
  expect(idea?.lifecycle?.property).toBe("idea-status");
288
- expect(idea?.lifecycle?.options.map((o) => `${o.key}:${o.category}`)).toEqual([
289
- "New:open",
290
- "Shaped:active",
291
- "Used:done",
292
- "Dropped:lost",
293
- ]);
371
+ expect(
372
+ idea?.lifecycle?.options.map((o) => `${o.key}:${o.category}`)
373
+ ).toEqual(["New:open", "Shaped:active", "Used:done", "Dropped:lost"]);
294
374
  const fields = (idea?.properties ?? []).map((p) => p.slug);
295
- expect(fields).toEqual(expect.arrayContaining(["idea-status", "content", "idea-pillar", "idea-stage", "idea-tags"]));
375
+ expect(fields).toEqual(
376
+ expect.arrayContaining([
377
+ "idea-status",
378
+ "content",
379
+ "idea-pillar",
380
+ "idea-stage",
381
+ "idea-tags",
382
+ ])
383
+ );
296
384
  // An idea has no format and no date (that is what makes it not a post).
297
- expect(fields.some((f) => f.startsWith("post-") || f === "publish-date")).toBe(false);
385
+ expect(
386
+ fields.some((f) => f.startsWith("post-") || f === "publish-date")
387
+ ).toBe(false);
298
388
  });
299
389
 
300
390
  it("links an idea to the posts it feeds, many-to-many", () => {
301
- const links = (template.entityLinks ?? []).map((l) => `${l.sourceProfileSlug}-${l.type}->${l.targetProfileSlug}`);
302
- expect(links).toEqual(expect.arrayContaining(["idea-feeds->post", "idea-belongs_to_pillar->pillar"]));
391
+ const links = (template.entityLinks ?? []).map(
392
+ (l) => `${l.sourceProfileSlug}-${l.type}->${l.targetProfileSlug}`
393
+ );
394
+ expect(links).toEqual(
395
+ expect.arrayContaining([
396
+ "idea-feeds->post",
397
+ "idea-belongs_to_pillar->pillar",
398
+ ])
399
+ );
303
400
  });
304
401
 
305
402
  it("packages ideas through a bank-wide playbook that proposes posts, never writes them", () => {
306
403
  const pkg = template.playbooks?.find((p) => p.name === "Package ideas");
307
404
  expect(pkg?.subjectProfile).toBeUndefined();
308
- expect(pkg?.expectedOutputs).toEqual([expect.objectContaining({ kind: "post", relationToSubject: "none" })]);
405
+ expect(pkg?.expectedOutputs).toEqual([
406
+ expect.objectContaining({ kind: "post", relationToSubject: "none" }),
407
+ ]);
309
408
  expect(pkg?.goalTemplate).toMatch(/idea feeds post/);
310
409
  expect(pkg?.goalTemplate).toMatch(/ONE synap_capture graph/);
311
410
  expect(pkg?.goalTemplate).toMatch(/Never a script/);
@@ -322,12 +421,21 @@ describe("Content OS Repurpose proposes once per original, never for a copy", ()
322
421
 
323
422
  it("finds Repurpose and its Published activator (non-vacuity)", () => {
324
423
  expect(repurpose?.subjectProfile?.profileSlug).toBe("post");
325
- expect(repurpose?.activators?.filter((a) => a.on === "enters_status" && a.status === "Published")).toHaveLength(1);
424
+ expect(
425
+ repurpose?.activators?.filter(
426
+ (a) => a.on === "enters_status" && a.status === "Published"
427
+ )
428
+ ).toHaveLength(1);
326
429
  });
327
430
 
328
431
  it("leaves out a post that carries post-copy-of", () => {
329
- const published = repurpose?.activators?.find((a) => a.on === "enters_status" && a.status === "Published");
330
- expect(published?.unless).toEqual({ property: "post-copy-of", present: true });
432
+ const published = repurpose?.activators?.find(
433
+ (a) => a.on === "enters_status" && a.status === "Published"
434
+ );
435
+ expect(published?.unless).toEqual({
436
+ property: "post-copy-of",
437
+ present: true,
438
+ });
331
439
  });
332
440
 
333
441
  it("names a property the post kind declares", () => {
@@ -346,7 +454,9 @@ describe("Content OS Write the caption drafts one post's caption, never the pers
346
454
 
347
455
  it("is a post's process, run by hand on one post (non-vacuity)", () => {
348
456
  expect(caption?.subjectProfile?.profileSlug).toBe("post");
349
- expect(caption?.params).toEqual([expect.objectContaining({ name: "post", type: "entity", required: true })]);
457
+ expect(caption?.params).toEqual([
458
+ expect.objectContaining({ name: "post", type: "entity", required: true }),
459
+ ]);
350
460
  expect(caption?.goalTemplate).toContain("{post}");
351
461
  expect(caption?.status).toBe("active");
352
462
  });
@@ -373,9 +483,15 @@ describe("Content OS Write the caption drafts one post's caption, never the pers
373
483
  }),
374
484
  ]);
375
485
  // A writing instruction only: no tool, no write, no ask, no close, no status move.
376
- expect(caption?.goalTemplate).not.toMatch(/synap_|update_document|revision|\bask\b|\bclose\b|\bstatus\b/i);
377
- expect(caption?.goalTemplate).toMatch(/Write ONE caption in the brand voice/);
486
+ expect(caption?.goalTemplate).not.toMatch(
487
+ /synap_|update_document|revision|\bask\b|\bclose\b|\bstatus\b/i
488
+ );
489
+ expect(caption?.goalTemplate).toMatch(
490
+ /Write ONE caption in the brand voice/
491
+ );
378
492
  // The voice reaches the one call as guidance (the call cannot look it up).
379
- expect(caption?.guidance).toEqual([expect.objectContaining({ ref: "kind:brand-voice-guide" })]);
493
+ expect(caption?.guidance).toEqual([
494
+ expect.objectContaining({ ref: "kind:brand-voice-guide" }),
495
+ ]);
380
496
  });
381
497
  });