@synap-core/workspace-templates 0.35.0 → 0.37.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 +1 -0
- package/dist/{define-DHDi8C33.d.ts → define-YL-hIPcn.d.ts} +10 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +319 -10
- package/dist/index.js.map +1 -1
- package/dist/wire.d.ts +1 -1
- package/package.json +1 -1
- package/src/brand-library.yaml +17 -1
- package/src/crm-health.template.test.ts +82 -0
- package/src/crm-messages-cadence.template.test.ts +39 -0
- package/src/crm-rules-guidance.template.test.ts +156 -0
- package/src/crm.yaml +324 -20
- package/src/lifecycle-declarations.test.ts +6 -1
- package/src/templates.ts +319 -10
- package/src/types.ts +5 -0
package/dist/wire.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as PackageDefinitionOutput, X as WorkspaceDefinitionInput } from './define-
|
|
1
|
+
import { g as PackageDefinitionOutput, X as WorkspaceDefinitionInput } from './define-YL-hIPcn.js';
|
|
2
2
|
import '@synap-core/types/presentation';
|
|
3
3
|
import '@synap-core/types/space-brief';
|
|
4
4
|
import '@synap-core/types/capability-intents';
|
package/package.json
CHANGED
package/src/brand-library.yaml
CHANGED
|
@@ -526,11 +526,16 @@ profiles:
|
|
|
526
526
|
description: "Generated or curated voice guidance by context: traits, tone, vocabulary, and copy examples."
|
|
527
527
|
semanticSlug: brand.voice
|
|
528
528
|
# The ONE lifecycle (work model L1): every option's category.
|
|
529
|
+
# `approved` is a person's call (design b199a3a4, trust (a), 8 Nov 2026):
|
|
530
|
+
# an approved guide is rendered into the instructions of every playbook
|
|
531
|
+
# that declares `guidance: kind:brand-voice-guide` (the CRM drafters), so
|
|
532
|
+
# an agent's text reaches a future prompt only once a person approved it.
|
|
533
|
+
# An agent writes a draft; a person approves it.
|
|
529
534
|
lifecycle:
|
|
530
535
|
property: voice-status
|
|
531
536
|
options:
|
|
532
537
|
- { key: draft, category: open }
|
|
533
|
-
- { key: approved, category: done }
|
|
538
|
+
- { key: approved, category: done, humanOnly: true }
|
|
534
539
|
- { key: deprecated, category: lost, humanOnly: true }
|
|
535
540
|
properties:
|
|
536
541
|
- slug: voice-context
|
|
@@ -547,7 +552,11 @@ profiles:
|
|
|
547
552
|
legal,
|
|
548
553
|
editorial,
|
|
549
554
|
investor,
|
|
555
|
+
outreach,
|
|
550
556
|
]
|
|
557
|
+
# `outreach`: how we write to a lead (design b199a3a4, founder 8 Nov
|
|
558
|
+
# 2026: ONE voice for content and sales). The CRM drafters read the
|
|
559
|
+
# `general` and `outreach` guides (`guidance` where voice-context).
|
|
551
560
|
constraints: { defaultValue: general }
|
|
552
561
|
- slug: voice-status
|
|
553
562
|
label: Status
|
|
@@ -877,6 +886,13 @@ views:
|
|
|
877
886
|
description: Base, format and goal-frame guidelines for making content.
|
|
878
887
|
|
|
879
888
|
entityLinks:
|
|
889
|
+
# A new version of a voice guide is a new guide, a draft that `revises` the
|
|
890
|
+
# approved one (design b199a3a4): approving it and deprecating the old one
|
|
891
|
+
# is a person's act, and the chain of revisions is the guide's history.
|
|
892
|
+
- sourceProfileSlug: brand-voice-guide
|
|
893
|
+
targetProfileSlug: brand-voice-guide
|
|
894
|
+
type: revises
|
|
895
|
+
label: Revises
|
|
880
896
|
- sourceProfileSlug: brand-token-set
|
|
881
897
|
targetProfileSlug: brand-color
|
|
882
898
|
type: derived_from
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CRM's Health dashboard (design b199a3a4 Question 2, slice 5), pinned
|
|
3
|
+
* against the REAL YAML corpus, the real validator and the published cell
|
|
4
|
+
* bridge. The CRM app (site-crm, slice 6) codes against these names:
|
|
5
|
+
*
|
|
6
|
+
* - the view is the bento "Health" (slug health) of the CRM space, with no
|
|
7
|
+
* profile and no tile shipped: every tile is a cell a person approved;
|
|
8
|
+
* - the playbook is "Propose a Health cell", one param `question` (text,
|
|
9
|
+
* required); its run files ONE cell/define proposal through
|
|
10
|
+
* synap_create_cell with contentKind widget and placeOn the Health view.
|
|
11
|
+
*
|
|
12
|
+
* The bridge ops the goal teaches are the ones `@synap-core/types/cell-bridge`
|
|
13
|
+
* answers, derived from its table: a op added or removed there turns this red
|
|
14
|
+
* until the goal says the same.
|
|
15
|
+
*
|
|
16
|
+
* Does NOT cover what an agent does at run time (the goal is prose), nor the
|
|
17
|
+
* install itself (the pod creates the view; a template update does not add a
|
|
18
|
+
* bento view to an existing space).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { CELL_BRIDGE_READ_OP_NAMES } from "@synap-core/types/cell-bridge";
|
|
22
|
+
import { describe, expect, it } from "vitest";
|
|
23
|
+
import { readYamlTemplates } from "./generate.mjs";
|
|
24
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
25
|
+
import { validateTemplate } from "./validate.js";
|
|
26
|
+
|
|
27
|
+
const NAME = "Propose a Health cell";
|
|
28
|
+
|
|
29
|
+
const corpus = readYamlTemplates().map((t) => t.data as WorkspaceYaml);
|
|
30
|
+
const crm = corpus.find((x) => x.meta.slug === "crm")!;
|
|
31
|
+
const pb = () => {
|
|
32
|
+
const found = crm.playbooks?.find((p) => p.name === NAME);
|
|
33
|
+
if (!found) throw new Error(`playbook "${NAME}" not in crm`);
|
|
34
|
+
return found;
|
|
35
|
+
};
|
|
36
|
+
const goal = () => String(pb().goalTemplate ?? "").replace(/\s+/g, " ");
|
|
37
|
+
|
|
38
|
+
describe("CRM — Health", () => {
|
|
39
|
+
it("crm validates against the corpus", () => {
|
|
40
|
+
expect(validateTemplate(crm, { corpus }).errors).toEqual([]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("ships one Health bento, scoped to no profile, with no tile", () => {
|
|
44
|
+
const health = (crm.views ?? []).filter((v) => v.name === "Health");
|
|
45
|
+
expect(health).toHaveLength(1);
|
|
46
|
+
const view = health[0] as unknown as Record<string, unknown>;
|
|
47
|
+
expect(view).toMatchObject({ slug: "health", type: "bento", config: { layout: "bento", blocks: [] } });
|
|
48
|
+
// A profile would make it a profile dashboard (metadata.isProfileBento).
|
|
49
|
+
expect(view.scopeProfileSlug).toBeUndefined();
|
|
50
|
+
expect(view.scopeProfileSlugs).toBeUndefined();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("the playbook asks one question and has no subject, activator or extra grant", () => {
|
|
54
|
+
const p = pb() as unknown as Record<string, unknown>;
|
|
55
|
+
expect(p.params).toEqual([{ name: "question", type: "text", label: "What should the tile answer?", required: true }]);
|
|
56
|
+
expect(goal()).toContain("{question}");
|
|
57
|
+
expect(p.subjectProfile).toBeUndefined();
|
|
58
|
+
expect(p.activators).toBeUndefined();
|
|
59
|
+
expect(p.grants).toBeUndefined();
|
|
60
|
+
// MCP synap_create_cell carries placeOn and contentKind; Synap AI's create_cell does not yet.
|
|
61
|
+
expect(p.executor).toBe("external-agent");
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("the run files one placed widget cell in the CRM space, and a person approves it", () => {
|
|
65
|
+
const g = goal();
|
|
66
|
+
expect(g).toContain("synap_create_cell");
|
|
67
|
+
expect(g).toContain("contentKind widget");
|
|
68
|
+
expect(g).toContain("placeOn = {viewId: the Health view's id}");
|
|
69
|
+
expect(g).toContain("workspaceId = the CRM space (never pod-wide");
|
|
70
|
+
const stages = (pb().stages ?? []) as Array<Record<string, unknown>>;
|
|
71
|
+
expect(stages.map((s) => s.key)).toEqual(["draft", "approve"]);
|
|
72
|
+
expect(stages[1]).toMatchObject({ gate: { kind: "human" }, onFail: { toStage: "draft" } });
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("teaches exactly the read ops the cell bridge answers", () => {
|
|
76
|
+
expect(CELL_BRIDGE_READ_OP_NAMES.length).toBeGreaterThan(5);
|
|
77
|
+
const listed = /op of the bridge table \(([^)]*)\)/.exec(goal());
|
|
78
|
+
expect(listed, "the goal lists the bridge ops in parentheses").not.toBeNull();
|
|
79
|
+
const ops = listed![1].split(",").map((s) => s.trim());
|
|
80
|
+
expect([...ops].sort()).toEqual([...CELL_BRIDGE_READ_OP_NAMES].sort());
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
* channel, filed through the pod's `messaging.send` with `to` = their
|
|
12
12
|
* entity id; never a tool's own send verb, never an outreach touch, never
|
|
13
13
|
* synap_capture; ONE paragraph, word for word, in every drafter;
|
|
14
|
+
* - RULES (design b199a3a4, 8 Nov 2026): the style a drafter writes in is
|
|
15
|
+
* the rules it follows (`guidance`: Voice, then By kind of lead), rendered
|
|
16
|
+
* by the pod from person-approved records; ONE paragraph, word for word,
|
|
17
|
+
* in every drafter, and the old style lines are gone from the goals;
|
|
14
18
|
* - the CADENCE counts the outbound messages in the lead's channels, and a
|
|
15
19
|
* reply (an inbound message after our last outbound one) is read by
|
|
16
20
|
* "Follow up on leads in outreach";
|
|
@@ -69,6 +73,23 @@ const DRAFT_RULES =
|
|
|
69
73
|
"DRAFT RULES: each draft is one proposed message in the channel of the person it is written to, filed through the pod's send door: run messaging.send with to = that person's entity id (for a company lead, its decider: when that person is not in the pod, create them through the entity door with only their own fields, such as name, role and LinkedIn URL, never the company's website, domain or email), text = the message, and provider linkedin or email. Read their channel first (synap_get_channel, mode person) for what was already said. The pod files it for a person to review in that channel; it goes out only once they approve it. Never call a tool's own send verb (Unipile, Gmail), never create an outreach touch, a note or a task holding the message, and never use synap_capture for it. Never send. " +
|
|
70
74
|
LINKEDIN_ORDER;
|
|
71
75
|
|
|
76
|
+
/**
|
|
77
|
+
* RULES (design b199a3a4, slice 2, 8 Nov 2026): the style a drafter writes in
|
|
78
|
+
* is no longer lines of its goal but the rules it follows (`guidance`), which
|
|
79
|
+
* every run renders from the current, person-approved records under "Rules
|
|
80
|
+
* this playbook follows". ONE paragraph, word for word, in every drafter.
|
|
81
|
+
*/
|
|
82
|
+
const RULES =
|
|
83
|
+
"RULES: follow the rules this process follows, in order: Voice, then By kind of lead (the first row that fits the lead; a given campaign's angle comes first). A rule shown as not available is left out: say so.";
|
|
84
|
+
/** The rules every drafter declares, in this order (Voice, By kind of lead). */
|
|
85
|
+
const GUIDANCE = [
|
|
86
|
+
{ ref: "kind:brand-voice-guide", label: "Voice", where: { "voice-context": ["general", "outreach"] } },
|
|
87
|
+
{ ref: "kind:outreach-angle", label: "By kind of lead" },
|
|
88
|
+
];
|
|
89
|
+
/** The style lines the drafters' goals held until 8 Nov 2026: they seed the Voice now. */
|
|
90
|
+
const STYLE_SEED =
|
|
91
|
+
'Its message is personal: it cites the buying signal and what it showed, or a past exchange, never a generic template; short; in the person\'s language, French by default, and in French it says vous. It offers one useful next step, never pressure.';
|
|
92
|
+
|
|
72
93
|
/** What a drafter yields: a `messaging.external.send` proposal (target type `messaging`). */
|
|
73
94
|
const PROPOSED_MESSAGE = "messaging";
|
|
74
95
|
const outputsOf = (p: NonNullable<WorkspaceYaml["playbooks"]>[number]) => [
|
|
@@ -114,6 +135,24 @@ describe("CRM messages and cadence — catalog contract", () => {
|
|
|
114
135
|
expect(DRAFT_RULES).toContain(part);
|
|
115
136
|
});
|
|
116
137
|
|
|
138
|
+
it("RULES: every drafter declares the same guidance and holds one RULES paragraph; the style lines left the goals", () => {
|
|
139
|
+
for (const name of DRAFTERS) {
|
|
140
|
+
expect(playbookOf(name).guidance, name).toEqual(GUIDANCE);
|
|
141
|
+
expect(goalOf(name), name).toContain(RULES);
|
|
142
|
+
// The style lines moved into guidance (their seed is "Propose my rules
|
|
143
|
+
// from my sent messages"): no drafter states them in its goal any more.
|
|
144
|
+
for (const gone of ["French by default", "says vous", "never pressure", "never a generic template", "short and in the lead's language", "specific to them"])
|
|
145
|
+
expect(goalOf(name), `${name}: ${gone}`).not.toContain(gone);
|
|
146
|
+
}
|
|
147
|
+
// Only the drafters hold it: a fourth copy would be a second wording.
|
|
148
|
+
const holders = (crm.playbooks ?? []).filter((p) => flat(p.goalTemplate).includes("RULES: follow the rules")).map((p) => p.name);
|
|
149
|
+
expect(holders.sort()).toEqual([...DRAFTERS].sort());
|
|
150
|
+
// The seed of the voice is the old style lines, word for word.
|
|
151
|
+
expect(goalOf("Propose my rules from my sent messages")).toContain(STYLE_SEED);
|
|
152
|
+
// The pod refuses a goal over 5,000 characters (playbookDefinitionSchema).
|
|
153
|
+
for (const name of DRAFTERS) expect(playbookOf(name).goalTemplate.length, name).toBeLessThanOrEqual(5000);
|
|
154
|
+
});
|
|
155
|
+
|
|
117
156
|
it("'Draft a first message': send it to <name> today, then follow up 3 days after the send", () => {
|
|
118
157
|
const name = "Draft a first message";
|
|
119
158
|
expect(goalOf(name)).toContain('"Send the first message to <name> on LinkedIn"');
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRM rules a playbook follows (design b199a3a4 Question 1, slice 2; founder
|
|
3
|
+
* approval 8 Nov 2026, Brand & communication board), pinned against the REAL
|
|
4
|
+
* YAML corpus. The pod (backend#924) renders a playbook's `guidance` from the
|
|
5
|
+
* CURRENT versions only: a kind's entities whose lifecycle category is `done`.
|
|
6
|
+
* Entity text becomes prompt text, so:
|
|
7
|
+
*
|
|
8
|
+
* - "By kind of lead" is the CRM kind `outreach-angle`: the match (a
|
|
9
|
+
* condition, an optional audience and offer), lead with, offer, proof,
|
|
10
|
+
* avoid, tone, channel and the `order` the pod sorts by; its `current`
|
|
11
|
+
* (done) and `retired` options are a person's (humanOnly);
|
|
12
|
+
* - Voice is Brand Library's `brand-voice-guide` with an `outreach` context;
|
|
13
|
+
* its `approved` (done) option is a person's (humanOnly);
|
|
14
|
+
* - a new version is a draft that `revises` the current one;
|
|
15
|
+
* - "Propose my rules from my sent messages" writes DRAFTS only, and no stage
|
|
16
|
+
* of it moves anything to a done option.
|
|
17
|
+
*
|
|
18
|
+
* The drafters' declarations and their RULES paragraph are pinned in
|
|
19
|
+
* crm-messages-cadence.template.test.ts. Does NOT cover what the pod renders
|
|
20
|
+
* or what an agent does at run time.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { describe, expect, it } from "vitest";
|
|
24
|
+
import { readYamlTemplates } from "./generate.mjs";
|
|
25
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
26
|
+
|
|
27
|
+
const corpus = readYamlTemplates().map((t) => t.data as WorkspaceYaml);
|
|
28
|
+
const tpl = (slug: string) => {
|
|
29
|
+
const t = corpus.find((x) => x.meta.slug === slug);
|
|
30
|
+
if (!t) throw new Error(`template ${slug} not in the corpus`);
|
|
31
|
+
return t;
|
|
32
|
+
};
|
|
33
|
+
const kindOf = (t: WorkspaceYaml, slug: string) => {
|
|
34
|
+
const p = t.profiles?.find((x) => x.slug === slug);
|
|
35
|
+
if (!p) throw new Error(`kind ${slug} not in ${t.meta.slug}`);
|
|
36
|
+
return p;
|
|
37
|
+
};
|
|
38
|
+
const flat = (s: string | undefined) => (s ?? "").replace(/\s+/g, " ");
|
|
39
|
+
const lifecycleShape = (p: ReturnType<typeof kindOf>) =>
|
|
40
|
+
(p.lifecycle?.options ?? []).map((o) => [o.key, o.category, o.humanOnly === true]);
|
|
41
|
+
|
|
42
|
+
const crm = tpl("crm");
|
|
43
|
+
const brand = tpl("brand-library");
|
|
44
|
+
|
|
45
|
+
describe("By kind of lead: the outreach-angle kind", () => {
|
|
46
|
+
const angle = kindOf(crm, "outreach-angle");
|
|
47
|
+
|
|
48
|
+
it("draft → current → retired; only a person makes a row current or retires it", () => {
|
|
49
|
+
expect(angle.lifecycle?.property).toBe("angle-status");
|
|
50
|
+
expect(lifecycleShape(angle)).toEqual([
|
|
51
|
+
["draft", "open", false],
|
|
52
|
+
["current", "done", true],
|
|
53
|
+
["retired", "lost", true],
|
|
54
|
+
]);
|
|
55
|
+
const status = angle.properties.find((p) => p.slug === "angle-status");
|
|
56
|
+
expect(status?.enumValues).toEqual(["draft", "current", "retired"]);
|
|
57
|
+
// A new row is a draft: an agent's write never lands current.
|
|
58
|
+
expect(status?.constraints).toEqual({ defaultValue: "draft" });
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("the match, then what to lead with, in the order the pod renders them; `order` sorts the rows", () => {
|
|
62
|
+
expect(angle.properties.map((p) => p.slug)).toEqual([
|
|
63
|
+
"angle-status",
|
|
64
|
+
"angle-if",
|
|
65
|
+
"angle-audience",
|
|
66
|
+
"angle-about-offer",
|
|
67
|
+
"angle-lead-with",
|
|
68
|
+
"angle-offer",
|
|
69
|
+
"angle-proof",
|
|
70
|
+
"angle-avoid",
|
|
71
|
+
"angle-tone",
|
|
72
|
+
"angle-channel",
|
|
73
|
+
// The pod's renderer sorts an ordered kind by the property named exactly
|
|
74
|
+
// `order` (backend playbook-guidance.ts ORDER_PROPERTY) and never renders it.
|
|
75
|
+
"order",
|
|
76
|
+
]);
|
|
77
|
+
const prop = (slug: string) => angle.properties.find((p) => p.slug === slug);
|
|
78
|
+
expect(prop("order")).toMatchObject({ valueType: "number" });
|
|
79
|
+
expect(prop("angle-audience")).toMatchObject({ valueType: "entity_id", targetProfileSlug: "audience" });
|
|
80
|
+
expect(prop("angle-about-offer")).toMatchObject({ valueType: "entity_id", targetProfileSlug: "offer" });
|
|
81
|
+
// The CRM's own reference to the pod-wide audience kind, and foundation
|
|
82
|
+
// (a dependency) owns offer: both targets resolve.
|
|
83
|
+
expect(crm.profiles?.some((p) => p.slug === "audience")).toBe(true);
|
|
84
|
+
expect(crm.dependencies?.some((d) => d.slug === "foundation")).toBe(true);
|
|
85
|
+
expect(kindOf(tpl("foundation"), "offer")).toBeTruthy();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("a new version revises the current one (the history is the retired chain)", () => {
|
|
89
|
+
expect(crm.entityLinks).toContainEqual(
|
|
90
|
+
expect.objectContaining({ sourceProfileSlug: "outreach-angle", targetProfileSlug: "outreach-angle", type: "revises" }),
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("Voice: Brand Library's voice guide", () => {
|
|
96
|
+
const voice = kindOf(brand, "brand-voice-guide");
|
|
97
|
+
|
|
98
|
+
it("approved is a person's call (trust (a)); a new guide is a draft", () => {
|
|
99
|
+
expect(lifecycleShape(voice)).toEqual([
|
|
100
|
+
["draft", "open", false],
|
|
101
|
+
["approved", "done", true],
|
|
102
|
+
["deprecated", "lost", true],
|
|
103
|
+
]);
|
|
104
|
+
expect(voice.properties.find((p) => p.slug === "voice-status")?.constraints).toEqual({ defaultValue: "draft" });
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it("one voice for content and sales: an outreach context, and the default stays general", () => {
|
|
108
|
+
const context = voice.properties.find((p) => p.slug === "voice-context");
|
|
109
|
+
expect(context?.enumValues).toContain("outreach");
|
|
110
|
+
expect(context?.enumValues).toContain("general");
|
|
111
|
+
expect(context?.constraints).toEqual({ defaultValue: "general" });
|
|
112
|
+
// Say / Don't say are the guide's Do / Don't.
|
|
113
|
+
expect(voice.properties.map((p) => p.slug)).toEqual(expect.arrayContaining(["voice-example-do", "voice-example-dont"]));
|
|
114
|
+
expect(brand.entityLinks).toContainEqual(
|
|
115
|
+
expect.objectContaining({ sourceProfileSlug: "brand-voice-guide", targetProfileSlug: "brand-voice-guide", type: "revises" }),
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe("'Propose my rules from my sent messages': drafts only", () => {
|
|
121
|
+
const name = "Propose my rules from my sent messages";
|
|
122
|
+
const pb = crm.playbooks?.find((p) => p.name === name);
|
|
123
|
+
|
|
124
|
+
it("exists, started by the person, and yields draft voice and By kind of lead rows", () => {
|
|
125
|
+
expect(pb).toBeTruthy();
|
|
126
|
+
expect(pb?.executor).toBe("is-agent");
|
|
127
|
+
expect(pb?.grants).toEqual(["entity.create"]);
|
|
128
|
+
expect((pb?.expectedOutputs ?? []).map((o) => o.kind).sort()).toEqual(["brand-voice-guide", "outreach-angle"]);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("never makes a version current: no stage moves a status, and its goal says drafts only", () => {
|
|
132
|
+
for (const st of pb?.stages ?? []) expect(st.subjectStatus, st.key).toBeUndefined();
|
|
133
|
+
// Only a person makes them current, at a human gate.
|
|
134
|
+
expect(pb?.stages?.at(-1)?.gate).toEqual({ kind: "human" });
|
|
135
|
+
const goal = flat(pb?.goalTemplate);
|
|
136
|
+
expect(goal).toContain("status draft");
|
|
137
|
+
expect(goal).toContain("never set a voice guide to approved or deprecated, nor a row to current or retired");
|
|
138
|
+
expect(goal).toContain("never edit or retire a current one");
|
|
139
|
+
expect(goal).toContain("a new record that revises it");
|
|
140
|
+
expect(goal).toContain("context outreach");
|
|
141
|
+
const criteria = Object.fromEntries((pb?.stages ?? []).flatMap((s) => s.criteria ?? []).map((c) => [c.key, flat(c.statement)]));
|
|
142
|
+
expect(criteria["rules-drafts-only"]).toMatch(/is a draft .* no approved voice guide or current row was edited, approved or retired/);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("every value it names exists: the voice context, and each status it writes or forbids", () => {
|
|
146
|
+
const goal = flat(pb?.goalTemplate);
|
|
147
|
+
const voice = kindOf(brand, "brand-voice-guide");
|
|
148
|
+
const angle = kindOf(crm, "outreach-angle");
|
|
149
|
+
const keys = (p: ReturnType<typeof kindOf>) => (p.lifecycle?.options ?? []).map((o) => o.key);
|
|
150
|
+
expect(voice.properties.find((p) => p.slug === "voice-context")?.enumValues).toContain("outreach");
|
|
151
|
+
for (const k of ["approved", "deprecated", "draft"]) expect(keys(voice)).toContain(k);
|
|
152
|
+
for (const k of ["current", "retired", "draft"]) expect(keys(angle)).toContain(k);
|
|
153
|
+
expect(goal).toContain("profileSlug brand-voice-guide");
|
|
154
|
+
expect(goal).toContain("profileSlug outreach-angle");
|
|
155
|
+
});
|
|
156
|
+
});
|