@productbrain/cli 0.1.0-beta.27 → 0.1.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +2 -0
  2. package/dist/__tests__/relate.test.js +15 -0
  3. package/dist/__tests__/relate.test.js.map +1 -1
  4. package/dist/commands/collections.d.ts +22 -0
  5. package/dist/commands/collections.d.ts.map +1 -0
  6. package/dist/commands/collections.js +73 -0
  7. package/dist/commands/collections.js.map +1 -0
  8. package/dist/commands/handshake.d.ts +2 -0
  9. package/dist/commands/handshake.d.ts.map +1 -1
  10. package/dist/commands/handshake.js +37 -1
  11. package/dist/commands/handshake.js.map +1 -1
  12. package/dist/commands/relate.d.ts.map +1 -1
  13. package/dist/commands/relate.js +10 -3
  14. package/dist/commands/relate.js.map +1 -1
  15. package/dist/formatters/collections.d.ts +40 -0
  16. package/dist/formatters/collections.d.ts.map +1 -0
  17. package/dist/formatters/collections.js +93 -0
  18. package/dist/formatters/collections.js.map +1 -0
  19. package/dist/formatters/handshake.d.ts +5 -0
  20. package/dist/formatters/handshake.d.ts.map +1 -1
  21. package/dist/formatters/handshake.js +9 -0
  22. package/dist/formatters/handshake.js.map +1 -1
  23. package/dist/formatters/relate.d.ts +2 -0
  24. package/dist/formatters/relate.d.ts.map +1 -1
  25. package/dist/formatters/relate.js +3 -0
  26. package/dist/formatters/relate.js.map +1 -1
  27. package/dist/generators/archetypes.d.ts +52 -0
  28. package/dist/generators/archetypes.d.ts.map +1 -0
  29. package/dist/generators/archetypes.js +153 -0
  30. package/dist/generators/archetypes.js.map +1 -0
  31. package/dist/generators/archetypes.test.d.ts +2 -0
  32. package/dist/generators/archetypes.test.d.ts.map +1 -0
  33. package/dist/generators/archetypes.test.js +237 -0
  34. package/dist/generators/archetypes.test.js.map +1 -0
  35. package/dist/generators/chain-classifier.d.ts +49 -0
  36. package/dist/generators/chain-classifier.d.ts.map +1 -0
  37. package/dist/generators/chain-classifier.js +180 -0
  38. package/dist/generators/chain-classifier.js.map +1 -0
  39. package/dist/generators/chain-classifier.test.d.ts +2 -0
  40. package/dist/generators/chain-classifier.test.d.ts.map +1 -0
  41. package/dist/generators/chain-classifier.test.js +257 -0
  42. package/dist/generators/chain-classifier.test.js.map +1 -0
  43. package/dist/generators/chain-rules.d.ts +42 -0
  44. package/dist/generators/chain-rules.d.ts.map +1 -0
  45. package/dist/generators/chain-rules.js +144 -0
  46. package/dist/generators/chain-rules.js.map +1 -0
  47. package/dist/generators/chain-rules.test.d.ts +2 -0
  48. package/dist/generators/chain-rules.test.d.ts.map +1 -0
  49. package/dist/generators/chain-rules.test.js +179 -0
  50. package/dist/generators/chain-rules.test.js.map +1 -0
  51. package/dist/generators/handshake-diff.d.ts +67 -0
  52. package/dist/generators/handshake-diff.d.ts.map +1 -0
  53. package/dist/generators/handshake-diff.js +183 -0
  54. package/dist/generators/handshake-diff.js.map +1 -0
  55. package/dist/generators/handshake-diff.test.d.ts +2 -0
  56. package/dist/generators/handshake-diff.test.d.ts.map +1 -0
  57. package/dist/generators/handshake-diff.test.js +264 -0
  58. package/dist/generators/handshake-diff.test.js.map +1 -0
  59. package/dist/index.js +59 -1
  60. package/dist/index.js.map +1 -1
  61. package/package.json +2 -2
  62. package/templates/archetypes/boundary.md +23 -0
  63. package/templates/archetypes/constraint.md +23 -0
  64. package/templates/archetypes/convention.md +23 -0
  65. package/templates/archetypes/policy.md +23 -0
  66. package/templates/archetypes/quality-gate.md +23 -0
  67. package/templates/archetypes/workflow.md +23 -0
@@ -6,6 +6,8 @@ export interface RelateReceiptData {
6
6
  type: string;
7
7
  toId: string;
8
8
  alreadyExists?: boolean;
9
+ action: 'related' | 'unrelated' | 'proposal_created';
10
+ proposalId?: string;
9
11
  }
10
12
  export declare function formatRelateReceipt(data: RelateReceiptData): string;
11
13
  export declare function formatUnrelateReceipt(data: RelateReceiptData): string;
@@ -1 +1 @@
1
- {"version":3,"file":"relate.d.ts","sourceRoot":"","sources":["../../src/formatters/relate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAKnE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAErE"}
1
+ {"version":3,"file":"relate.d.ts","sourceRoot":"","sources":["../../src/formatters/relate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,kBAAkB,CAAC;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAQnE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAErE"}
@@ -5,6 +5,9 @@ export function formatRelateReceipt(data) {
5
5
  if (data.alreadyExists) {
6
6
  return `Already exists: ${data.fromId} –[${data.type}]→ ${data.toId}`;
7
7
  }
8
+ if (data.action === 'proposal_created') {
9
+ return `Proposal created (requires approval): ${data.fromId} –[${data.type}]→ ${data.toId}`;
10
+ }
8
11
  return `→ ${data.fromId} –[${data.type}]→ ${data.toId}`;
9
12
  }
10
13
  export function formatUnrelateReceipt(data) {
@@ -1 +1 @@
1
- {"version":3,"file":"relate.js","sourceRoot":"","sources":["../../src/formatters/relate.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,OAAO,mBAAmB,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;IACD,OAAO,KAAK,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,aAAa,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC"}
1
+ {"version":3,"file":"relate.js","sourceRoot":"","sources":["../../src/formatters/relate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,UAAU,mBAAmB,CAAC,IAAuB;IACzD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,OAAO,mBAAmB,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,kBAAkB,EAAE,CAAC;QACvC,OAAO,yCAAyC,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAC9F,CAAC;IACD,OAAO,KAAK,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAuB;IAC3D,OAAO,aAAa,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;AAClE,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Archetype loader and resolver — BET-286 Slice 2
3
+ *
4
+ * Loads archetype templates from packages/cli/templates/archetypes/ and
5
+ * resolves their {{slot}} placeholders using ClassifiedGovernance entries.
6
+ * Each resolved archetype produces a CanonicalRule ready to merge into
7
+ * the canonical rules array.
8
+ *
9
+ * Chain: BET-286 (Chain-Derived Agent Configuration), FEAT-894 (chain:// convention)
10
+ */
11
+ import type { CanonicalRule } from './portable-knowledge.js';
12
+ import type { ClassifiedGovernance, GovernanceFunction } from './chain-classifier.js';
13
+ /** Parsed archetype template, ready for slot resolution. */
14
+ interface ArchetypeTemplate {
15
+ functionKey: GovernanceFunction;
16
+ /** Frontmatter fields */
17
+ name: string;
18
+ description: string;
19
+ autoApply: boolean;
20
+ level: string;
21
+ /** Template body with {{slot}} placeholders */
22
+ body: string;
23
+ }
24
+ /** Result of resolving an archetype against classified governance entries. */
25
+ export interface ResolvedArchetype {
26
+ /** Ready to merge into the canonical rules array */
27
+ rule: CanonicalRule;
28
+ functionKey: GovernanceFunction;
29
+ /** Which entry IDs contributed to this rule */
30
+ resolvedEntryIds: string[];
31
+ }
32
+ /** Discriminated reason when resolveArchetype returns null. */
33
+ export type ArchetypeSkipReason = 'no-template' | 'manual-suppression' | 'zero-entries';
34
+ /**
35
+ * Load the archetype template for a governance function.
36
+ * Returns null if the function is 'unclassified' or no template file exists.
37
+ */
38
+ export declare function loadArchetype(functionKey: GovernanceFunction): ArchetypeTemplate | null;
39
+ /**
40
+ * Resolve an archetype's slots using classified governance entries.
41
+ *
42
+ * Returns a discriminated result:
43
+ * - `{ resolved: ResolvedArchetype }` on success
44
+ * - `{ skipped: ArchetypeSkipReason }` when the archetype cannot be produced
45
+ */
46
+ export declare function resolveArchetype(functionKey: GovernanceFunction, classified: ClassifiedGovernance[], manualRuleNames: Set<string>): {
47
+ resolved: ResolvedArchetype;
48
+ } | {
49
+ skipped: ArchetypeSkipReason;
50
+ };
51
+ export {};
52
+ //# sourceMappingURL=archetypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archetypes.d.ts","sourceRoot":"","sources":["../../src/generators/archetypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAItF,4DAA4D;AAC5D,UAAU,iBAAiB;IACzB,WAAW,EAAE,kBAAkB,CAAC;IAChC,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,8EAA8E;AAC9E,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,IAAI,EAAE,aAAa,CAAC;IACpB,WAAW,EAAE,kBAAkB,CAAC;IAChC,+CAA+C;IAC/C,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,+DAA+D;AAC/D,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,oBAAoB,GAAG,cAAc,CAAC;AAwCxF;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,kBAAkB,GAAG,iBAAiB,GAAG,IAAI,CAkBvF;AA4CD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,EAC/B,UAAU,EAAE,oBAAoB,EAAE,EAClC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,GAC3B;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,mBAAmB,CAAA;CAAE,CAsDpE"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Archetype loader and resolver — BET-286 Slice 2
3
+ *
4
+ * Loads archetype templates from packages/cli/templates/archetypes/ and
5
+ * resolves their {{slot}} placeholders using ClassifiedGovernance entries.
6
+ * Each resolved archetype produces a CanonicalRule ready to merge into
7
+ * the canonical rules array.
8
+ *
9
+ * Chain: BET-286 (Chain-Derived Agent Configuration), FEAT-894 (chain:// convention)
10
+ */
11
+ import { existsSync, readFileSync } from 'fs';
12
+ import { join, dirname } from 'path';
13
+ import { fileURLToPath } from 'url';
14
+ // ── Path resolution ───────────────────────────────────────────────────
15
+ /** Resolved archetypes template directory (relative to this module).
16
+ * From dist/generators/archetypes.js → ../../templates/archetypes/
17
+ */
18
+ const TEMPLATES_DIR = (() => {
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+ return join(__dirname, '..', '..', 'templates', 'archetypes');
22
+ })();
23
+ function parseArchetypeFrontmatter(raw) {
24
+ const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
25
+ if (!match)
26
+ return { fields: {}, body: raw };
27
+ const yaml = match[1];
28
+ const body = match[2] ?? '';
29
+ const fields = {};
30
+ for (const line of yaml.split('\n')) {
31
+ const kv = line.match(/^([\w-]+):\s*(.*)/);
32
+ if (kv) {
33
+ fields[kv[1]] = kv[2].trim().replace(/^["']|["']$/g, '');
34
+ }
35
+ }
36
+ return { fields, body };
37
+ }
38
+ // ── Loader ────────────────────────────────────────────────────────────
39
+ /**
40
+ * Load the archetype template for a governance function.
41
+ * Returns null if the function is 'unclassified' or no template file exists.
42
+ */
43
+ export function loadArchetype(functionKey) {
44
+ if (functionKey === 'unclassified')
45
+ return null;
46
+ const filePath = join(TEMPLATES_DIR, `${functionKey}.md`);
47
+ if (!existsSync(filePath))
48
+ return null;
49
+ const raw = readFileSync(filePath, 'utf8');
50
+ const { fields, body } = parseArchetypeFrontmatter(raw);
51
+ return {
52
+ functionKey,
53
+ name: fields['name'] ?? functionKey,
54
+ description: fields['description'] ?? '',
55
+ autoApply: fields['autoApply'] === 'true',
56
+ level: fields['level'] ?? 'core',
57
+ body,
58
+ };
59
+ }
60
+ // ── Slot resolution ───────────────────────────────────────────────────
61
+ /** Replace all {{slot}} placeholders in a string. */
62
+ function resolveSlots(text, slots) {
63
+ return text.replace(/\{\{(\w+)\}\}/g, (_match, key) => slots[key] ?? _match);
64
+ }
65
+ /**
66
+ * Build the *_summary slot value for a given function key.
67
+ * Lists up to 5 entry names then "and N more".
68
+ */
69
+ function buildSummary(entries) {
70
+ if (entries.length === 0)
71
+ return '(none)';
72
+ const MAX_LISTED = 5;
73
+ const names = entries.map((e) => e.name);
74
+ const listed = names.slice(0, MAX_LISTED);
75
+ const remaining = names.length - MAX_LISTED;
76
+ const lines = listed.map((n) => `- ${n}`);
77
+ if (remaining > 0) {
78
+ lines.push(`- ...and ${remaining} more`);
79
+ }
80
+ return lines.join('\n');
81
+ }
82
+ /** Map function key to its summary slot name. */
83
+ function summarySlotName(functionKey) {
84
+ const map = {
85
+ constraint: 'constraint_summary',
86
+ boundary: 'boundary_summary',
87
+ convention: 'convention_summary',
88
+ policy: 'policy_summary',
89
+ workflow: 'workflow_summary',
90
+ 'quality-gate': 'quality_summary',
91
+ };
92
+ return map[functionKey] ?? `${functionKey}_summary`;
93
+ }
94
+ // ── Resolver ──────────────────────────────────────────────────────────
95
+ /**
96
+ * Resolve an archetype's slots using classified governance entries.
97
+ *
98
+ * Returns a discriminated result:
99
+ * - `{ resolved: ResolvedArchetype }` on success
100
+ * - `{ skipped: ArchetypeSkipReason }` when the archetype cannot be produced
101
+ */
102
+ export function resolveArchetype(functionKey, classified, manualRuleNames) {
103
+ const template = loadArchetype(functionKey);
104
+ if (!template)
105
+ return { skipped: 'no-template' };
106
+ // Manual rule suppression: if a manual rule with this name exists, skip
107
+ if (manualRuleNames.has(template.name))
108
+ return { skipped: 'manual-suppression' };
109
+ // Filter to entries matching this function
110
+ const matching = classified.filter((e) => e.governanceFunction === functionKey);
111
+ if (matching.length === 0)
112
+ return { skipped: 'zero-entries' };
113
+ // Build slot values
114
+ const entryIds = matching.map((e) => e.entryId).join(', ');
115
+ const entryNames = matching.map((e) => e.name).join(', ');
116
+ const entryCount = String(matching.length);
117
+ const summary = buildSummary(matching);
118
+ const summarySlot = summarySlotName(functionKey);
119
+ const slots = {
120
+ entry_ids: entryIds,
121
+ entry_names: entryNames,
122
+ entry_count: entryCount,
123
+ // Populate all summary slots — only the relevant one gets the real summary;
124
+ // others get empty string so stale placeholders resolve to blank, not wrong data.
125
+ constraint_summary: '',
126
+ boundary_summary: '',
127
+ convention_summary: '',
128
+ policy_summary: '',
129
+ workflow_summary: '',
130
+ quality_summary: '',
131
+ [summarySlot]: summary,
132
+ };
133
+ const resolvedDescription = resolveSlots(template.description, slots);
134
+ const resolvedBody = resolveSlots(template.body, slots);
135
+ const rule = {
136
+ name: template.name,
137
+ description: resolvedDescription,
138
+ autoApply: template.autoApply,
139
+ level: template.level,
140
+ body: resolvedBody,
141
+ sourcePath: `chain://${functionKey}`,
142
+ scope: undefined,
143
+ targets: undefined,
144
+ };
145
+ return {
146
+ resolved: {
147
+ rule,
148
+ functionKey,
149
+ resolvedEntryIds: matching.map((e) => e.entryId),
150
+ },
151
+ };
152
+ }
153
+ //# sourceMappingURL=archetypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archetypes.js","sourceRoot":"","sources":["../../src/generators/archetypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AA+BpC,yEAAyE;AAEzE;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;IAC1B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AAChE,CAAC,CAAC,EAAE,CAAC;AASL,SAAS,y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IACvC,MAAM,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAEjD,MAAM,KAAK,GAA2B;QACpC,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,UAAU;QACvB,4EAA4E;QAC5E,kFAAkF;QAClF,kBAAkB,EAAE,EAAE;QACtB,gBAAgB,EAAE,EAAE;QACpB,kBAAkB,EAAE,EAAE;QACtB,cAAc,EAAE,EAAE;QAClB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;QACnB,CAAC,WAAW,CAAC,EAAE,OAAO;KACvB,CAAC;IAEF,MAAM,mBAAmB,GAAG,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAExD,MAAM,IAAI,GAAkB;QAC1B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,WAAW,EAAE,mBAAmB;QAChC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,WAAW,WAAW,EAAE;QACpC,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,SAAS;KACnB,CAAC;IAEF,OAAO;QACL,QAAQ,EAAE;YACR,IAAI;YACJ,WAAW;YACX,gBAAgB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SACjD;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=archetypes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archetypes.test.d.ts","sourceRoot":"","sources":["../../src/generators/archetypes.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * archetypes — unit tests.
3
+ * BET-286 Slice 2: archetype template loader and slot resolver.
4
+ */
5
+ import { describe, expect, it } from 'vitest';
6
+ import { loadArchetype, resolveArchetype, } from './archetypes.js';
7
+ /** Helper to extract a resolved archetype, failing the test if skipped. */
8
+ function expectResolved(result) {
9
+ expect('resolved' in result).toBe(true);
10
+ return result.resolved;
11
+ }
12
+ /** Helper to extract a skip reason, failing the test if resolved. */
13
+ function expectSkipped(result) {
14
+ expect('skipped' in result).toBe(true);
15
+ return result.skipped;
16
+ }
17
+ // ── Helpers ────────────────────────────────────────────────────────────
18
+ function makeClassified(overrides) {
19
+ return {
20
+ collectionSlug: 'standards',
21
+ confidence: 0.65,
22
+ matchedSignals: ['collection standards → constraint'],
23
+ data: null,
24
+ relations: [],
25
+ ...overrides,
26
+ };
27
+ }
28
+ // ── loadArchetype ──────────────────────────────────────────────────────
29
+ describe('loadArchetype', () => {
30
+ it('loads the constraint template and returns an ArchetypeTemplate', () => {
31
+ const template = loadArchetype('constraint');
32
+ expect(template).not.toBeNull();
33
+ expect(template.functionKey).toBe('constraint');
34
+ expect(template.name).toBe('chain-constraints');
35
+ expect(template.autoApply).toBe(true);
36
+ expect(template.level).toBe('core');
37
+ expect(template.body.length).toBeGreaterThan(0);
38
+ });
39
+ it('loads the boundary template', () => {
40
+ const template = loadArchetype('boundary');
41
+ expect(template).not.toBeNull();
42
+ expect(template.name).toBe('chain-boundaries');
43
+ });
44
+ it('loads the convention template', () => {
45
+ const template = loadArchetype('convention');
46
+ expect(template).not.toBeNull();
47
+ expect(template.name).toBe('chain-conventions');
48
+ });
49
+ it('loads the policy template', () => {
50
+ const template = loadArchetype('policy');
51
+ expect(template).not.toBeNull();
52
+ expect(template.name).toBe('chain-policies');
53
+ });
54
+ it('loads the workflow template', () => {
55
+ const template = loadArchetype('workflow');
56
+ expect(template).not.toBeNull();
57
+ expect(template.name).toBe('chain-workflows');
58
+ });
59
+ it('loads the quality-gate template', () => {
60
+ const template = loadArchetype('quality-gate');
61
+ expect(template).not.toBeNull();
62
+ expect(template.name).toBe('chain-quality-gates');
63
+ });
64
+ it('returns null for unclassified', () => {
65
+ const template = loadArchetype('unclassified');
66
+ expect(template).toBeNull();
67
+ });
68
+ // GovernanceFunction is a union — cast to test unknown-like behavior
69
+ it('returns null for a function key with no template file', () => {
70
+ // Cast to bypass type check — simulates a future unknown function key
71
+ const template = loadArchetype('unknown-function');
72
+ expect(template).toBeNull();
73
+ });
74
+ });
75
+ // ── resolveArchetype ───────────────────────────────────────────────────
76
+ describe('resolveArchetype — returns valid CanonicalRule', () => {
77
+ it('returns a ResolvedArchetype when matching entries exist', () => {
78
+ const classified = [
79
+ makeClassified({ entryId: 'STD-7', name: 'Trunk-based development', governanceFunction: 'constraint' }),
80
+ makeClassified({ entryId: 'STD-22', name: 'Session equals slice', governanceFunction: 'constraint' }),
81
+ ];
82
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
83
+ expect(resolved.functionKey).toBe('constraint');
84
+ expect(resolved.resolvedEntryIds).toEqual(['STD-7', 'STD-22']);
85
+ expect(resolved.rule).toBeDefined();
86
+ });
87
+ it('the resolved rule has name, description, body, autoApply, level, sourcePath', () => {
88
+ const classified = [
89
+ makeClassified({ entryId: 'ARCH-26', name: 'Seven system domains', governanceFunction: 'boundary' }),
90
+ ];
91
+ const resolved = expectResolved(resolveArchetype('boundary', classified, new Set()));
92
+ const rule = resolved.rule;
93
+ expect(rule.name).toBe('chain-boundaries');
94
+ expect(rule.description).toBeTruthy();
95
+ expect(rule.body).toBeTruthy();
96
+ expect(rule.autoApply).toBe(true);
97
+ expect(rule.level).toBe('core');
98
+ expect(rule.sourcePath).toBe('chain://boundary');
99
+ });
100
+ it('scope is undefined (global rule)', () => {
101
+ const classified = [
102
+ makeClassified({ entryId: 'DEC-1', name: 'Deploy ordering', governanceFunction: 'convention' }),
103
+ ];
104
+ const resolved = expectResolved(resolveArchetype('convention', classified, new Set()));
105
+ expect(resolved.rule.scope).toBeUndefined();
106
+ });
107
+ it('targets is undefined (emit to all targets)', () => {
108
+ const classified = [
109
+ makeClassified({ entryId: 'POL-1', name: 'Access control', governanceFunction: 'policy' }),
110
+ ];
111
+ const resolved = expectResolved(resolveArchetype('policy', classified, new Set()));
112
+ expect(resolved.rule.targets).toBeUndefined();
113
+ });
114
+ });
115
+ describe('resolveArchetype — skip cases (suppression)', () => {
116
+ it('returns skipped:zero-entries when zero entries match the function key', () => {
117
+ const classified = [
118
+ makeClassified({ entryId: 'STD-7', name: 'Some standard', governanceFunction: 'constraint' }),
119
+ ];
120
+ // No 'boundary' entries
121
+ expect(expectSkipped(resolveArchetype('boundary', classified, new Set()))).toBe('zero-entries');
122
+ });
123
+ it('returns skipped:manual-suppression when manualRuleNames contains the archetype name', () => {
124
+ const classified = [
125
+ makeClassified({ entryId: 'STD-7', name: 'Some standard', governanceFunction: 'constraint' }),
126
+ ];
127
+ const manualRuleNames = new Set(['chain-constraints']);
128
+ expect(expectSkipped(resolveArchetype('constraint', classified, manualRuleNames))).toBe('manual-suppression');
129
+ });
130
+ it('returns skipped:no-template for unclassified function key', () => {
131
+ const classified = [
132
+ makeClassified({ entryId: 'GLO-1', name: 'Some glossary entry', governanceFunction: 'unclassified' }),
133
+ ];
134
+ expect(expectSkipped(resolveArchetype('unclassified', classified, new Set()))).toBe('no-template');
135
+ });
136
+ });
137
+ describe('resolveArchetype — slot resolution', () => {
138
+ it('replaces {{entry_ids}} with comma-separated human IDs', () => {
139
+ const classified = [
140
+ makeClassified({ entryId: 'STD-7', name: 'Standard A', governanceFunction: 'constraint' }),
141
+ makeClassified({ entryId: 'BR-64', name: 'Business Rule B', governanceFunction: 'constraint' }),
142
+ ];
143
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
144
+ expect(resolved.rule.body).toContain('STD-7, BR-64');
145
+ });
146
+ it('replaces {{entry_names}} with comma-separated names', () => {
147
+ const classified = [
148
+ makeClassified({ entryId: 'STD-7', name: 'Trunk-based dev', governanceFunction: 'constraint' }),
149
+ makeClassified({ entryId: 'STD-22', name: 'Session is a slice', governanceFunction: 'constraint' }),
150
+ ];
151
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
152
+ expect(resolved.rule.body).toContain('Trunk-based dev');
153
+ expect(resolved.rule.body).toContain('Session is a slice');
154
+ });
155
+ it('replaces {{entry_count}} with the number of matching entries', () => {
156
+ const classified = [
157
+ makeClassified({ entryId: 'STD-7', name: 'A', governanceFunction: 'constraint' }),
158
+ makeClassified({ entryId: 'STD-8', name: 'B', governanceFunction: 'constraint' }),
159
+ makeClassified({ entryId: 'STD-9', name: 'C', governanceFunction: 'constraint' }),
160
+ ];
161
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
162
+ expect(resolved.rule.body).toContain('3');
163
+ expect(resolved.rule.description).toContain('3');
164
+ });
165
+ it('no unresolved {{slot}} placeholders remain in body', () => {
166
+ const classified = [
167
+ makeClassified({ entryId: 'STD-7', name: 'Some constraint', governanceFunction: 'constraint' }),
168
+ ];
169
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
170
+ // No raw {{...}} placeholders should remain
171
+ expect(resolved.rule.body).not.toMatch(/\{\{\w+\}\}/);
172
+ });
173
+ it('no unresolved {{slot}} placeholders remain in description', () => {
174
+ const classified = [
175
+ makeClassified({ entryId: 'STD-7', name: 'Some constraint', governanceFunction: 'constraint' }),
176
+ ];
177
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
178
+ expect(resolved.rule.description).not.toMatch(/\{\{\w+\}\}/);
179
+ });
180
+ });
181
+ describe('resolveArchetype — sourcePath convention', () => {
182
+ it('sourcePath follows chain:// convention with function key', () => {
183
+ const classified = [
184
+ makeClassified({ entryId: 'FLOW-1', name: 'Feature flag lifecycle', governanceFunction: 'workflow' }),
185
+ ];
186
+ const resolved = expectResolved(resolveArchetype('workflow', classified, new Set()));
187
+ expect(resolved.rule.sourcePath).toBe('chain://workflow');
188
+ });
189
+ it('quality-gate sourcePath uses chain://quality-gate', () => {
190
+ const classified = [
191
+ makeClassified({ entryId: 'STD-2', name: 'Test coverage gate', governanceFunction: 'quality-gate', collectionSlug: 'standards' }),
192
+ ];
193
+ const resolved = expectResolved(resolveArchetype('quality-gate', classified, new Set()));
194
+ expect(resolved.rule.sourcePath).toBe('chain://quality-gate');
195
+ });
196
+ });
197
+ describe('resolveArchetype — CanonicalRule type compatibility', () => {
198
+ it('the resolved rule satisfies the CanonicalRule interface', () => {
199
+ const classified = [
200
+ makeClassified({ entryId: 'DEC-100', name: 'Some decision', governanceFunction: 'convention' }),
201
+ ];
202
+ const resolved = expectResolved(resolveArchetype('convention', classified, new Set()));
203
+ // TypeScript structural check: assign to CanonicalRule
204
+ const rule = resolved.rule;
205
+ expect(rule.name).toBeTruthy();
206
+ expect(typeof rule.autoApply).toBe('boolean');
207
+ expect(typeof rule.body).toBe('string');
208
+ expect(typeof rule.sourcePath).toBe('string');
209
+ });
210
+ });
211
+ describe('resolveArchetype — summary truncation', () => {
212
+ it('lists up to 5 entries then "and N more"', () => {
213
+ const classified = Array.from({ length: 8 }, (_, i) => makeClassified({ entryId: `STD-${i + 1}`, name: `Standard ${i + 1}`, governanceFunction: 'constraint' }));
214
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
215
+ expect(resolved.rule.body).toContain('and 3 more');
216
+ });
217
+ it('does not add "and N more" when 5 or fewer entries', () => {
218
+ const classified = Array.from({ length: 5 }, (_, i) => makeClassified({ entryId: `STD-${i + 1}`, name: `Standard ${i + 1}`, governanceFunction: 'constraint' }));
219
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
220
+ expect(resolved.rule.body).not.toMatch(/\.\.\.and \d+ more/);
221
+ });
222
+ });
223
+ describe('resolveArchetype — only matching entries contribute', () => {
224
+ it('entries of other function types are excluded from resolution', () => {
225
+ const classified = [
226
+ makeClassified({ entryId: 'STD-7', name: 'Constraint entry', governanceFunction: 'constraint' }),
227
+ makeClassified({ entryId: 'ARCH-1', name: 'Boundary entry', governanceFunction: 'boundary' }),
228
+ makeClassified({ entryId: 'FLOW-1', name: 'Workflow entry', governanceFunction: 'workflow' }),
229
+ ];
230
+ const resolved = expectResolved(resolveArchetype('constraint', classified, new Set()));
231
+ expect(resolved.resolvedEntryIds).toEqual(['STD-7']);
232
+ expect(resolved.rule.body).toContain('STD-7');
233
+ expect(resolved.rule.body).not.toContain('ARCH-1');
234
+ expect(resolved.rule.body).not.toContain('FLOW-1');
235
+ });
236
+ });
237
+ //# sourceMappingURL=archetypes.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archetypes.test.js","sourceRoot":"","sources":["../../src/generators/archetypes.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,gBAAgB,GAGjB,MAAM,iBAAiB,CAAC;AAIzB,2EAA2E;AAC3E,SAAS,cAAc,CAAC,MAA0E;IAChG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,OAAQ,MAA0C,CAAC,QAAQ,CAAC;AAC9D,CAAC;AAED,qEAAqE;AACrE,SAAS,aAAa,CAAC,MAA0E;IAC/F,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,OAAQ,MAA2C,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,0EAA0E;AAE1E,SAAS,cAAc,CAAC,SAA4I;IAClK,OAAO;QACL,cAAc,EAAE,WAAW;QAC3B,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE,CAAC,mCAAmC,CAAC;QACrD,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,EAAE;QACb,GAAG,SAAS;KACb,CAAC;AACJ,CAAC;AAED,0EAA0E;AAE1E,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,gEAAgE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AC,CAAC,CAAC;QACrD,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Chain Classifier — BET-286 Slice 1
3
+ *
4
+ * Pure function that maps governance entries (from getGovernanceWithRelations)
5
+ * to the governance function each entry serves. No LLM, no network calls.
6
+ * Deterministic: same input always produces same output.
7
+ *
8
+ * Chain: BET-286 (Chain-Derived Agent Configuration)
9
+ */
10
+ /** The governance functions that archetypes exist for. */
11
+ export type GovernanceFunction = 'constraint' | 'boundary' | 'convention' | 'policy' | 'workflow' | 'quality-gate' | 'unclassified';
12
+ /** Typed relation edge — mirrors GovernanceRelationEdge from convex/mcpKnowledge/governanceQuery.ts */
13
+ export interface GovernanceRelationEdge {
14
+ type: string;
15
+ direction: 'outgoing' | 'incoming';
16
+ otherEntryId: string | null;
17
+ otherName: string;
18
+ otherCollectionSlug: string | null;
19
+ }
20
+ /** Input shape — matches GovernanceEntry from the Convex query. */
21
+ export interface GovernanceEntryInput {
22
+ entryId: string | null;
23
+ name: string;
24
+ collectionSlug: string;
25
+ status: string;
26
+ verificationStatus: 'verified' | 'unverified' | null;
27
+ data: Record<string, unknown> | null;
28
+ relations: GovernanceRelationEdge[];
29
+ }
30
+ /** Result of classifying a single governance entry. */
31
+ export interface ClassifiedGovernance {
32
+ entryId: string;
33
+ name: string;
34
+ collectionSlug: string;
35
+ governanceFunction: GovernanceFunction;
36
+ confidence: number;
37
+ matchedSignals: string[];
38
+ /** Original entry data passed through for archetype slot resolution */
39
+ data: Record<string, unknown> | null;
40
+ /** Original relations passed through */
41
+ relations: GovernanceRelationEdge[];
42
+ }
43
+ /**
44
+ * Classify a batch of governance entries, returning one ClassifiedGovernance
45
+ * per entry that has a non-null entryId. Entries with null entryId are silently
46
+ * excluded (safety guard — entries without IDs cannot be referenced by archetypes).
47
+ */
48
+ export declare function classifyGovernance(entries: GovernanceEntryInput[]): ClassifiedGovernance[];
49
+ //# sourceMappingURL=chain-classifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain-classifier.d.ts","sourceRoot":"","sources":["../../src/generators/chain-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,0DAA0D;AAC1D,MAAM,MAAM,kBAAkB,GAC1B,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,UAAU,GACV,cAAc,GACd,cAAc,CAAC;AAEnB,uGAAuG;AACvG,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,UAAU,GAAG,UAAU,CAAC;IACnC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI,CAAC;IACrD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAED,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAA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