@a-company/paradigm 3.44.0 → 5.3.3

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 (168) hide show
  1. package/dist/{accept-orchestration-ZUWQUHSK.js → accept-orchestration-GX2YRWM4.js} +5 -5
  2. package/dist/{add-VSPZ6FM4.js → add-FZRKEGH4.js} +1 -1
  3. package/dist/agent-HYKC2LAK.js +387 -0
  4. package/dist/agent-loader-SJPJJS33.js +36 -0
  5. package/dist/{agents-suggest-65SER5IS.js → agents-suggest-DNSYJ6IA.js} +1 -1
  6. package/dist/{aggregate-SV3VGEIL.js → aggregate-H57K7PNV.js} +1 -1
  7. package/dist/{assess-UHBDYIK7.js → assess-4WVXZLZQ.js} +2 -2
  8. package/dist/{auto-24ICVUH4.js → auto-QFS5NHQU.js} +1 -1
  9. package/dist/{beacon-3SJV4DAP.js → beacon-KXZXYQHX.js} +1 -1
  10. package/dist/{calibration-WWHK73WU.js → calibration-V46G7JTY.js} +2 -2
  11. package/dist/{check-OLI6AUS6.js → check-OWAIWV23.js} +1 -1
  12. package/dist/{chunk-RP6TZYGE.js → chunk-2IO7JAG2.js} +1 -1
  13. package/dist/chunk-2T6BTYBN.js +712 -0
  14. package/dist/{chunk-CDMAMDSG.js → chunk-5VKJBNJL.js} +13 -5
  15. package/dist/{chunk-KB4XJWE3.js → chunk-6N3JTACN.js} +98 -437
  16. package/dist/chunk-7N7GSU6K.js +34 -0
  17. package/dist/chunk-A2L4TSLZ.js +526 -0
  18. package/dist/{chunk-P7XSBJE3.js → chunk-ABVQGRF7.js} +1 -1
  19. package/dist/{chunk-HIKKOCXY.js → chunk-EI32ZBE6.js} +1 -1
  20. package/dist/{chunk-QIOCFXDQ.js → chunk-EKGMAM62.js} +1 -1
  21. package/dist/chunk-EZ3GOCYC.js +132 -0
  22. package/dist/chunk-GGMI6C2L.js +1075 -0
  23. package/dist/{chunk-DS5QY37M.js → chunk-GTR2TBIJ.js} +247 -15
  24. package/dist/{chunk-QDXI2DHR.js → chunk-J2JEQRT3.js} +1 -1
  25. package/dist/{chunk-AKIMFN6I.js → chunk-JASGXLK3.js} +2 -2
  26. package/dist/chunk-KVDYJLTC.js +121 -0
  27. package/dist/{chunk-J4E6K5MG.js → chunk-LSRABQIY.js} +25 -1
  28. package/dist/chunk-MCMOGQMU.js +145 -0
  29. package/dist/{chunk-ZXMDA7VB.js → chunk-PDX44BCA.js} +1 -6
  30. package/dist/{chunk-SOBTKFSP.js → chunk-S2HO5MLR.js} +5 -0
  31. package/dist/{chunk-2SKXFXIT.js → chunk-S3ORKP3V.js} +10 -15
  32. package/dist/{chunk-ZMQA6SCO.js → chunk-S6MZ2IEX.js} +628 -228
  33. package/dist/chunk-TAIJOFOE.js +124 -0
  34. package/dist/{chunk-FS3WTUHY.js → chunk-TXESEO7Y.js} +6 -6
  35. package/dist/{chunk-7COU5S2Z.js → chunk-VL67H5IC.js} +1 -1
  36. package/dist/{chunk-QWA26UNO.js → chunk-WQITYKHM.js} +7 -7
  37. package/dist/{chunk-MW5DMGBB.js → chunk-YMDLDELF.js} +114 -55
  38. package/dist/{claude-63ISJAZK.js → claude-FRRWJSTJ.js} +1 -1
  39. package/dist/{claude-cli-ABML5RHX.js → claude-cli-XJLK2X4L.js} +1 -1
  40. package/dist/{claude-code-JRLMRPTO.js → claude-code-HTBA4XRB.js} +1 -1
  41. package/dist/{claude-code-teams-CAJBEFIZ.js → claude-code-teams-T4SP24MD.js} +1 -1
  42. package/dist/{conductor-HLWYWUVH.js → conductor-PGPDVIVE.js} +1 -1
  43. package/dist/{config-schema-3YNIFJCJ.js → config-schema-EA4XALGG.js} +4 -2
  44. package/dist/{constellation-FAGT45TU.js → constellation-A26CCGQS.js} +1 -1
  45. package/dist/{context-audit-557EO6PK.js → context-audit-RLO3ETRP.js} +8 -5
  46. package/dist/{cost-XEBADYFT.js → cost-BGM32XJU.js} +1 -1
  47. package/dist/{cost-UD3WPEKZ.js → cost-VI46A4XL.js} +1 -1
  48. package/dist/{cursor-cli-QUOOF2N4.js → cursor-cli-JVEZGHWQ.js} +1 -1
  49. package/dist/{cursorrules-3TKZ4E4R.js → cursorrules-HLIKJJZT.js} +1 -1
  50. package/dist/decision-loader-WWCLIQPJ.js +20 -0
  51. package/dist/{delete-RRK4RL6Y.js → delete-KBRPQLPC.js} +2 -2
  52. package/dist/{diff-IP5CIARP.js → diff-RQLLNAFI.js} +5 -5
  53. package/dist/{discipline-5F5OVTXB.js → discipline-FA4OZXIS.js} +1 -1
  54. package/dist/{dist-UXWV4OKX.js → dist-34NA5RS5.js} +1 -1
  55. package/dist/{dist-5QE2BB2B-X6DYVSUL.js → dist-5QE2BB2B-5S3T6Y3T.js} +1 -1
  56. package/dist/{dist-CM3MVWWW.js → dist-77JDTVAY.js} +1 -0
  57. package/dist/{dist-POMVY6WP.js → dist-QK4SQAK7.js} +1 -1
  58. package/dist/{dist-3RVKEJRT.js → dist-TA6LSC2Q.js} +1 -1
  59. package/dist/docs-LVLRPBAW.js +155 -0
  60. package/dist/docs-PBZB7LYP.js +89 -0
  61. package/dist/{doctor-GKZJU7QG.js → doctor-ULBOHEIC.js} +3 -3
  62. package/dist/{drift-YGT4LJ7Q.js → drift-R5NRKFHI.js} +1 -1
  63. package/dist/{echo-A6HD5UP7.js → echo-O2LY7CC2.js} +1 -1
  64. package/dist/{edit-4CLNN5JG.js → edit-R2HNLMOG.js} +2 -2
  65. package/dist/event-25OJKDCE.js +31 -0
  66. package/dist/{export-T7CMMJIB.js → export-IWVL7XLF.js} +1 -1
  67. package/dist/{flow-UFMPVOEM.js → flow-CRRVV3O3.js} +2 -2
  68. package/dist/{global-HHUJSBG5.js → global-3NG5JXUB.js} +1 -1
  69. package/dist/graduate-USAWGBJM.js +160 -0
  70. package/dist/{graph-YYUXI3F7.js → graph-VHUMAAS6.js} +2 -2
  71. package/dist/{graph-server-ZPXRSGCW.js → graph-server-YL22VBBN.js} +1 -1
  72. package/dist/{habits-RG5SVKXP.js → habits-OL5NGPXO.js} +3 -3
  73. package/dist/{history-CETCSUCP.js → history-WOWC573W.js} +1 -1
  74. package/dist/{hooks-TCUHQMPF.js → hooks-HFWSCGPV.js} +2 -2
  75. package/dist/index.js +307 -184
  76. package/dist/{integrity-MK2OP5TA.js → integrity-IHO4FZTS.js} +1 -1
  77. package/dist/{integrity-checker-J7YXRTBT.js → integrity-checker-PSKJA5SB.js} +1 -0
  78. package/dist/journal-loader-5EYSBFFY.js +18 -0
  79. package/dist/{lint-HYWGS3JJ.js → lint-K6CJGGPH.js} +1 -1
  80. package/dist/{list-IUCYPGMK.js → list-4YK7QKFF.js} +1 -1
  81. package/dist/{list-BTLFHSRC.js → list-ENR7Q4CR.js} +2 -2
  82. package/dist/{lore-loader-VTEEZDX3.js → lore-loader-7NO6N6FT.js} +4 -1
  83. package/dist/{lore-server-NOOAHKJX.js → lore-server-UNJY5KC3.js} +1 -1
  84. package/dist/{manual-AFJ2J2V3.js → manual-G6FISID5.js} +1 -1
  85. package/dist/mcp.js +3954 -479
  86. package/dist/{migrate-FQVGQNXZ.js → migrate-LS45DNEV.js} +2 -2
  87. package/dist/{migrate-assessments-JP6Q5KME.js → migrate-assessments-RGH4O6IX.js} +2 -2
  88. package/dist/nomination-engine-Q4XSXFKT.js +40 -0
  89. package/dist/notebook-YWIYGEHV.js +155 -0
  90. package/dist/{orchestrate-A226N6FC.js → orchestrate-XZA33TJC.js} +5 -5
  91. package/dist/peers-DEOUIZM6.js +82 -0
  92. package/dist/persona-UHAHIVST.js +390 -0
  93. package/dist/{pipeline-3G2FRAKM.js → pipeline-L4HCSBGN.js} +1 -1
  94. package/dist/{platform-server-KHL6ZPPN.js → platform-server-PMD57BEG.js} +264 -18
  95. package/dist/{plugin-update-checker-HMRPGY5Z.js → plugin-update-checker-ELOEEQYS.js} +1 -0
  96. package/dist/{portal-check-FF5EKZE5.js → portal-check-NPYGII2D.js} +2 -2
  97. package/dist/{portal-compliance-VU4NIFEN.js → portal-compliance-J7DGAPFX.js} +2 -2
  98. package/dist/{probe-7JK7IDNI.js → probe-MHL5HQZ2.js} +3 -3
  99. package/dist/{promote-XO63XMAN.js → promote-F6ZYZZAL.js} +2 -2
  100. package/dist/{providers-YNFSL6HK.js → providers-GK7PB2OL.js} +2 -2
  101. package/dist/{quiz-I75NU2QQ.js → quiz-M66SC7F7.js} +1 -1
  102. package/dist/{record-46CLR4OG.js → record-RA4WR2BO.js} +2 -2
  103. package/dist/{reindex-WIJMCJ4A.js → reindex-HRA2AUS6.js} +3 -2
  104. package/dist/{remember-4EUZKIIB.js → remember-HBWJ655S.js} +1 -1
  105. package/dist/{retag-KC4JVRLE.js → retag-3OLCVDEQ.js} +2 -2
  106. package/dist/{review-Q7M4CRB5.js → review-27ATYTD2.js} +2 -2
  107. package/dist/review-57QMURZV.js +334 -0
  108. package/dist/{ripple-RI3LOT6R.js → ripple-JPBXP5I3.js} +1 -1
  109. package/dist/{sentinel-UOIGJWHH.js → sentinel-4XIG4STA.js} +2 -2
  110. package/dist/{sentinel-bridge-APDXYAZS.js → sentinel-bridge-MDUXTQRL.js} +2 -2
  111. package/dist/{serve-JVXSRSUB.js → serve-FLTFTM3P.js} +2 -2
  112. package/dist/{serve-22A4XOIG.js → serve-INL7SNBK.js} +2 -2
  113. package/dist/{serve-2YJ6D2Y6.js → serve-KBSE36PL.js} +4 -4
  114. package/dist/{server-JV6UFGWZ.js → server-54SKYFFY.js} +2 -2
  115. package/dist/{server-RDLQ3DK7.js → server-XUOIO7E6.js} +1 -1
  116. package/dist/{setup-YNZJQLW7.js → setup-EDS27WUR.js} +1 -1
  117. package/dist/{setup-M2ZKLKNN.js → setup-KO5AFC4K.js} +2 -2
  118. package/dist/{shift-LNMKFYLR.js → shift-VFG23DLA.js} +16 -16
  119. package/dist/{show-P7GYO43X.js → show-5PV5KFJE.js} +2 -2
  120. package/dist/{show-PKZMYKRN.js → show-NQKYX6WQ.js} +1 -1
  121. package/dist/{snapshot-Y3COXK4T.js → snapshot-BK4RBPCG.js} +1 -1
  122. package/dist/{spawn-SSXZX45U.js → spawn-AW6GDECS.js} +3 -3
  123. package/dist/{status-KLHALGW4.js → status-WGIAQODY.js} +1 -1
  124. package/dist/{summary-5NQNOD3F.js → summary-NIRABMF5.js} +2 -2
  125. package/dist/{sweep-EZU3GU6S.js → sweep-QMHNSIY5.js} +2 -2
  126. package/dist/{switch-WYUMVNA5.js → switch-6EJPZDIA.js} +1 -1
  127. package/dist/{symphony-EYRGGVNE.js → symphony-4OCY36AI.js} +350 -29
  128. package/dist/{symphony-QWOEKZMC.js → symphony-B75X2MME.js} +20 -2
  129. package/dist/symphony-peers-2ZQYLRNI.js +34 -0
  130. package/dist/symphony-peers-OL7F6M5S.js +121 -0
  131. package/dist/symphony-relay-UJYUXN65.js +710 -0
  132. package/dist/{sync-ZM4Q3R4U.js → sync-VEHUH4OA.js} +3 -3
  133. package/dist/{sync-llms-JIPP3XX4.js → sync-llms-YHCFIE6X.js} +2 -2
  134. package/dist/{task-loader-7M2FCBX6.js → task-loader-LDYWQSLM.js} +1 -0
  135. package/dist/{team-HGLJXWQG.js → team-7HG7XK5C.js} +6 -6
  136. package/dist/{test-WTR5Q33E.js → test-566CP5KC.js} +1 -1
  137. package/dist/{thread-3WM7KKID.js → thread-N754I4D5.js} +1 -1
  138. package/dist/{timeline-ANC7LVDL.js → timeline-M3CICQFE.js} +2 -2
  139. package/dist/{triage-IZ4MDYNB.js → triage-HHYGT3HY.js} +1 -1
  140. package/dist/{tutorial-GC6QL4US.js → tutorial-KD22SUNO.js} +1 -1
  141. package/dist/university-content/courses/.purpose +66 -0
  142. package/dist/university-content/courses/para-401.json +146 -0
  143. package/dist/university-content/courses/para-501.json +151 -0
  144. package/dist/university-content/courses/para-601.json +608 -0
  145. package/dist/university-content/plsat/.purpose +6 -0
  146. package/dist/university-content/plsat/v2.0.json +2 -2
  147. package/dist/university-content/plsat/v3.0.json +563 -3
  148. package/dist/university-content/reference.json +91 -0
  149. package/dist/{upgrade-ANX3LVSA.js → upgrade-H5PF32BW.js} +2 -2
  150. package/dist/{validate-GD5XWILV.js → validate-CNKEKO6A.js} +1 -1
  151. package/dist/{validate-ITC5D6QG.js → validate-MB5ULIHS.js} +1 -1
  152. package/dist/{validate-ZVPNN4FL.js → validate-QH3LADM6.js} +1 -1
  153. package/dist/{watch-X64UK7K4.js → watch-2TKP5PVL.js} +3 -3
  154. package/dist/{watch-ERBEJUJW.js → watch-ZF4ML6CD.js} +2 -2
  155. package/dist/{wisdom-L2WC7J62.js → wisdom-AATMGNFA.js} +1 -1
  156. package/dist/work-log-loader-5L45XNYZ.js +14 -0
  157. package/dist/{workspace-UIUTHZTD.js → workspace-6E6OSRNU.js} +4 -4
  158. package/package.json +1 -1
  159. package/platform-ui/dist/assets/DocsSection-ByAgPzWV.js +1 -0
  160. package/platform-ui/dist/assets/DocsSection-CjdO6R-u.css +1 -0
  161. package/platform-ui/dist/assets/{GitSection-BD3Ze06e.js → GitSection-BLovj9yT.js} +1 -1
  162. package/platform-ui/dist/assets/{GraphSection-SglITfSs.js → GraphSection-C5PCPUFl.js} +1 -1
  163. package/platform-ui/dist/assets/{LoreSection-bR5Km4Fd.js → LoreSection-BftejTla.js} +1 -1
  164. package/platform-ui/dist/assets/{SentinelSection-QSpAZArG.js → SentinelSection-CnYcasN7.js} +1 -1
  165. package/platform-ui/dist/assets/{SymphonySection-CobYJgvg.js → SymphonySection-BpmqCHeK.js} +1 -1
  166. package/platform-ui/dist/assets/{index-DbxeSMkV.js → index-G9JnWEs_.js} +10 -10
  167. package/platform-ui/dist/index.html +1 -1
  168. package/dist/dist-PSF5CP4I.js +0 -7294
@@ -0,0 +1,390 @@
1
+ #!/usr/bin/env node
2
+ import "./chunk-PDX44BCA.js";
3
+
4
+ // src/commands/persona/index.ts
5
+ import * as fs from "fs";
6
+ import * as path from "path";
7
+ import chalk from "chalk";
8
+ import * as yaml from "js-yaml";
9
+ function personasDir(rootDir) {
10
+ return path.join(rootDir, ".paradigm", "personas");
11
+ }
12
+ function loadAllPersonas(rootDir) {
13
+ const dir = personasDir(rootDir);
14
+ if (!fs.existsSync(dir)) return [];
15
+ return fs.readdirSync(dir).filter((f) => f.endsWith(".persona")).sort().map((f) => {
16
+ try {
17
+ const content = fs.readFileSync(path.join(dir, f), "utf8");
18
+ return yaml.load(content);
19
+ } catch {
20
+ return null;
21
+ }
22
+ }).filter((p) => p !== null && !!p.id);
23
+ }
24
+ function loadPersona(rootDir, id) {
25
+ const filePath = path.join(personasDir(rootDir), `${id}.persona`);
26
+ if (!fs.existsSync(filePath)) return null;
27
+ try {
28
+ return yaml.load(fs.readFileSync(filePath, "utf8"));
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+ function loadIndex(rootDir) {
34
+ const indexPath = path.join(personasDir(rootDir), "index.yaml");
35
+ if (!fs.existsSync(indexPath)) return null;
36
+ try {
37
+ return yaml.load(fs.readFileSync(indexPath, "utf8"));
38
+ } catch {
39
+ return null;
40
+ }
41
+ }
42
+ async function personaListCommand(options) {
43
+ const cwd = process.cwd();
44
+ let personas = loadAllPersonas(cwd);
45
+ if (personas.length === 0) {
46
+ console.log(chalk.yellow("\n No personas found. Create one with paradigm_persona_create.\n"));
47
+ return;
48
+ }
49
+ if (options.tag) {
50
+ personas = personas.filter((p) => p.tags?.includes(options.tag));
51
+ }
52
+ if (options.trigger) {
53
+ personas = personas.filter((p) => p.trigger.type === options.trigger);
54
+ }
55
+ if (options.gate) {
56
+ personas = personas.filter((p) => p.journey.some((s) => s.gates.includes(options.gate)));
57
+ }
58
+ if (options.json) {
59
+ console.log(JSON.stringify(personas.map((p) => ({
60
+ id: p.id,
61
+ name: p.name,
62
+ trigger: p.trigger.type,
63
+ steps: p.journey.length,
64
+ tags: p.tags || [],
65
+ gates: [...new Set(p.journey.flatMap((s) => s.gates))]
66
+ })), null, 2));
67
+ return;
68
+ }
69
+ console.log(chalk.blue(`
70
+ Personas (${personas.length})
71
+ `));
72
+ for (const p of personas) {
73
+ const gates = [...new Set(p.journey.flatMap((s) => s.gates))];
74
+ const triggerColor = p.trigger.type === "root" ? chalk.green : chalk.cyan;
75
+ console.log(` ${chalk.white.bold(p.id)} \u2014 ${p.name}`);
76
+ console.log(` ${triggerColor(p.trigger.type)} trigger, ${p.journey.length} steps, ${gates.length} gates`);
77
+ if (p.tags?.length) {
78
+ console.log(` ${chalk.gray(p.tags.map((t) => `[${t}]`).join(" "))}`);
79
+ }
80
+ if (p.description) {
81
+ console.log(` ${chalk.gray(p.description)}`);
82
+ }
83
+ console.log();
84
+ }
85
+ }
86
+ async function personaShowCommand(id, options) {
87
+ const cwd = process.cwd();
88
+ const persona = loadPersona(cwd, id);
89
+ if (!persona) {
90
+ console.log(chalk.red(`Persona "${id}" not found.`));
91
+ return;
92
+ }
93
+ if (options.json) {
94
+ console.log(JSON.stringify(persona, null, 2));
95
+ return;
96
+ }
97
+ console.log(chalk.blue(`
98
+ Persona: ${chalk.white.bold(persona.name)}
99
+ `));
100
+ console.log(` ID: ${persona.id}`);
101
+ console.log(` Trigger: ${persona.trigger.type}`);
102
+ if (persona.trigger.spawned_by) console.log(` Spawned: by ${persona.trigger.spawned_by}`);
103
+ if (persona.description) console.log(` Desc: ${persona.description}`);
104
+ if (persona.tags?.length) console.log(` Tags: ${persona.tags.join(", ")}`);
105
+ if (persona.traits && Object.keys(persona.traits).length) {
106
+ console.log(chalk.cyan("\n Traits:"));
107
+ for (const [k, v] of Object.entries(persona.traits)) {
108
+ console.log(` ${k}: ${chalk.white(String(v))}`);
109
+ }
110
+ }
111
+ if (persona.fixtures && Object.keys(persona.fixtures).length) {
112
+ console.log(chalk.cyan("\n Fixtures:"));
113
+ for (const [k, v] of Object.entries(persona.fixtures)) {
114
+ console.log(` ${k}: ${chalk.gray(v)}`);
115
+ }
116
+ }
117
+ console.log(chalk.cyan(`
118
+ Journey (${persona.journey.length} steps):`));
119
+ for (let i = 0; i < persona.journey.length; i++) {
120
+ const step = persona.journey[i];
121
+ const gateStr = step.gates.map((g) => chalk.yellow(g)).join(", ");
122
+ console.log(` ${chalk.gray(`${i + 1}.`)} ${chalk.white(step.id)} \u2014 ${step.route}`);
123
+ console.log(` Gates: ${gateStr} Expect: ${step.expect.status}`);
124
+ if (step.flow) console.log(` Flow: ${chalk.magenta(step.flow)}`);
125
+ if (step.produces) console.log(` Produces: ${Object.keys(step.produces).join(", ")}`);
126
+ if (step.spawns?.length) console.log(` Spawns: ${step.spawns.map((s) => s.persona).join(", ")}`);
127
+ if (step.signals?.length) console.log(` Signals: ${step.signals.join(", ")}`);
128
+ }
129
+ console.log();
130
+ }
131
+ async function personaValidateCommand(id, options) {
132
+ const cwd = process.cwd();
133
+ const personas = id ? [loadPersona(cwd, id)].filter(Boolean) : loadAllPersonas(cwd);
134
+ if (personas.length === 0) {
135
+ console.log(chalk.yellow(id ? `Persona "${id}" not found.` : "No personas found."));
136
+ return;
137
+ }
138
+ let portalGates = [];
139
+ const portalPath = path.join(cwd, "portal.yaml");
140
+ if (fs.existsSync(portalPath)) {
141
+ try {
142
+ const portal = yaml.load(fs.readFileSync(portalPath, "utf8"));
143
+ portalGates = Object.keys(portal?.gates || {}).map((g) => g.startsWith("^") ? g : `^${g}`);
144
+ } catch {
145
+ }
146
+ }
147
+ let totalErrors = 0;
148
+ let totalWarnings = 0;
149
+ const results = [];
150
+ for (const persona of personas) {
151
+ const errors = [];
152
+ const warnings = [];
153
+ if (!persona.id) errors.push("Missing required field: id");
154
+ if (!persona.name) errors.push("Missing required field: name");
155
+ if (!persona.journey || persona.journey.length === 0) errors.push("Journey must have at least 1 step");
156
+ const stepIds = /* @__PURE__ */ new Set();
157
+ for (const step of persona.journey || []) {
158
+ if (!step.id) errors.push("Step missing id");
159
+ if (stepIds.has(step.id)) errors.push(`Duplicate step id: ${step.id}`);
160
+ stepIds.add(step.id);
161
+ if (!step.route) errors.push(`Step ${step.id}: missing route`);
162
+ if (!step.gates || step.gates.length === 0) errors.push(`Step ${step.id}: gates[] required`);
163
+ if (!step.expect?.status) errors.push(`Step ${step.id}: expect.status required`);
164
+ if (portalGates.length > 0) {
165
+ for (const gate of step.gates || []) {
166
+ if (!portalGates.includes(gate)) {
167
+ warnings.push(`Step ${step.id}: gate ${gate} not in portal.yaml`);
168
+ }
169
+ }
170
+ }
171
+ for (const spawn of step.spawns || []) {
172
+ const target = loadPersona(cwd, spawn.persona);
173
+ if (!target) warnings.push(`Step ${step.id}: spawns ${spawn.persona} but that persona doesn't exist`);
174
+ }
175
+ }
176
+ totalErrors += errors.length;
177
+ totalWarnings += warnings.length;
178
+ results.push({ id: persona.id, errors, warnings });
179
+ }
180
+ if (options?.json) {
181
+ console.log(JSON.stringify({ results, totalErrors, totalWarnings }, null, 2));
182
+ return;
183
+ }
184
+ console.log(chalk.blue(`
185
+ Persona Validation (${personas.length} persona(s))
186
+ `));
187
+ for (const r of results) {
188
+ if (r.errors.length === 0 && r.warnings.length === 0) {
189
+ console.log(` ${chalk.green("\u2713")} ${r.id}`);
190
+ } else {
191
+ if (r.errors.length > 0) {
192
+ console.log(` ${chalk.red("\u2717")} ${r.id} \u2014 ${r.errors.length} error(s)`);
193
+ for (const e of r.errors) console.log(` ${chalk.red("\u2022")} ${e}`);
194
+ }
195
+ if (r.warnings.length > 0) {
196
+ console.log(` ${chalk.yellow("\u26A0")} ${r.id} \u2014 ${r.warnings.length} warning(s)`);
197
+ for (const w of r.warnings) console.log(` ${chalk.yellow("\u2022")} ${w}`);
198
+ }
199
+ }
200
+ }
201
+ console.log();
202
+ if (totalErrors === 0 && totalWarnings === 0) {
203
+ console.log(chalk.green(" All personas valid."));
204
+ } else {
205
+ console.log(` ${chalk.red(`${totalErrors} error(s)`)}, ${chalk.yellow(`${totalWarnings} warning(s)`)}`);
206
+ }
207
+ console.log();
208
+ }
209
+ async function personaCoverageCommand(options) {
210
+ const cwd = process.cwd();
211
+ const index = loadIndex(cwd);
212
+ if (!index) {
213
+ console.log(chalk.yellow("\n No persona index found. Run paradigm_reindex first.\n"));
214
+ return;
215
+ }
216
+ if (options.json) {
217
+ console.log(JSON.stringify({
218
+ gate_coverage: index.gate_coverage || {},
219
+ route_coverage: index.route_coverage || {},
220
+ uncovered_routes: index.uncovered_routes || []
221
+ }, null, 2));
222
+ return;
223
+ }
224
+ console.log(chalk.blue("\n Persona Coverage Report\n"));
225
+ const gateCov = index.gate_coverage || {};
226
+ if (Object.keys(gateCov).length > 0) {
227
+ console.log(chalk.cyan(" Gate Coverage:"));
228
+ for (const [gate, personas] of Object.entries(gateCov)) {
229
+ console.log(` ${chalk.yellow(gate)} \u2014 ${personas.join(", ")}`);
230
+ }
231
+ console.log();
232
+ }
233
+ const routeCov = index.route_coverage || {};
234
+ if (Object.keys(routeCov).length > 0) {
235
+ console.log(chalk.cyan(" Route Coverage:"));
236
+ for (const [route, personas] of Object.entries(routeCov)) {
237
+ console.log(` ${chalk.white(route)} \u2014 ${personas.join(", ")}`);
238
+ }
239
+ console.log();
240
+ }
241
+ const uncovered = index.uncovered_routes || [];
242
+ if (uncovered.length > 0) {
243
+ console.log(chalk.red(` Uncovered Routes (${uncovered.length}):`));
244
+ for (const route of uncovered) {
245
+ console.log(` ${chalk.red("\u2022")} ${route}`);
246
+ }
247
+ console.log();
248
+ } else {
249
+ console.log(chalk.green(" All portal.yaml routes have persona coverage."));
250
+ console.log();
251
+ }
252
+ }
253
+ async function personaRunCommand(id, options) {
254
+ const cwd = process.cwd();
255
+ const persona = loadPersona(cwd, id);
256
+ if (!persona) {
257
+ console.log(chalk.red(`Persona "${id}" not found.`));
258
+ return;
259
+ }
260
+ if (options.dryRun) {
261
+ console.log(chalk.blue(`
262
+ Dry Run: ${persona.name}
263
+ `));
264
+ for (let i = 0; i < persona.journey.length; i++) {
265
+ const step = persona.journey[i];
266
+ console.log(` ${chalk.gray(`${i + 1}.`)} ${step.route}`);
267
+ console.log(` Gates: ${step.gates.join(", ")}`);
268
+ console.log(` Expect: ${step.expect.status}`);
269
+ if (step.produces) console.log(` Produces: ${Object.keys(step.produces).join(", ")}`);
270
+ }
271
+ console.log(chalk.gray("\n (dry run \u2014 no HTTP requests made)\n"));
272
+ return;
273
+ }
274
+ console.log(chalk.blue(`
275
+ Running: ${persona.name} \u2192 ${options.baseUrl}
276
+ `));
277
+ const scope = {
278
+ fixtures: persona.fixtures || {},
279
+ produces: {},
280
+ context: persona.trigger.context || {},
281
+ env: process.env
282
+ };
283
+ let passed = 0;
284
+ let failed = 0;
285
+ for (const step of persona.journey) {
286
+ const url = `${options.baseUrl}${step.route.split(" ").pop()}`;
287
+ const method = step.route.split(" ")[0];
288
+ let payload;
289
+ if (step.payload) {
290
+ payload = JSON.stringify(step.payload).replace(/\{\{(\w+)\.(\w+)\}\}/g, (_, ns, key) => {
291
+ const nsObj = scope[ns];
292
+ return nsObj?.[key] !== void 0 ? String(nsObj[key]) : `{{${ns}.${key}}}`;
293
+ });
294
+ }
295
+ process.stdout.write(` ${chalk.gray(`${step.id}:`)} ${method} ${url} ... `);
296
+ try {
297
+ const headers = {
298
+ "Content-Type": "application/json",
299
+ ...step.headers || {}
300
+ };
301
+ const res = await fetch(url, {
302
+ method,
303
+ headers,
304
+ body: payload
305
+ });
306
+ if (res.status === step.expect.status) {
307
+ console.log(chalk.green(`${res.status} \u2713`));
308
+ passed++;
309
+ if (step.produces) {
310
+ try {
311
+ const body = await res.json();
312
+ for (const [key, jsonPath] of Object.entries(step.produces)) {
313
+ const value = jsonPath.split(".").reduce((obj, k) => obj?.[k], body);
314
+ scope.produces[key] = value;
315
+ }
316
+ } catch {
317
+ }
318
+ }
319
+ } else {
320
+ console.log(chalk.red(`${res.status} \u2717 (expected ${step.expect.status})`));
321
+ failed++;
322
+ }
323
+ } catch (err) {
324
+ console.log(chalk.red(`ERROR: ${err.message}`));
325
+ failed++;
326
+ }
327
+ }
328
+ console.log();
329
+ console.log(` ${chalk.green(`${passed} passed`)}, ${failed > 0 ? chalk.red(`${failed} failed`) : chalk.green("0 failed")}`);
330
+ console.log();
331
+ }
332
+ async function personaAffectedCommand(symbol, options) {
333
+ const cwd = process.cwd();
334
+ const personas = loadAllPersonas(cwd);
335
+ const affected = [];
336
+ for (const p of personas) {
337
+ const matchingSteps = p.journey.filter(
338
+ (s) => s.gates.includes(symbol) || s.flow === symbol || s.signals?.includes(symbol)
339
+ );
340
+ if (matchingSteps.length > 0) {
341
+ affected.push({ id: p.id, name: p.name, steps: matchingSteps.map((s) => s.id) });
342
+ }
343
+ }
344
+ if (options.json) {
345
+ console.log(JSON.stringify({ symbol, affected }, null, 2));
346
+ return;
347
+ }
348
+ if (affected.length === 0) {
349
+ console.log(chalk.gray(`
350
+ No personas reference ${symbol}.
351
+ `));
352
+ return;
353
+ }
354
+ console.log(chalk.blue(`
355
+ Personas affected by ${chalk.yellow(symbol)}:
356
+ `));
357
+ for (const a of affected) {
358
+ console.log(` ${chalk.white.bold(a.id)} \u2014 ${a.name}`);
359
+ console.log(` Steps: ${a.steps.join(", ")}`);
360
+ }
361
+ console.log();
362
+ }
363
+ async function personaDeleteCommand(id) {
364
+ const cwd = process.cwd();
365
+ const filePath = path.join(personasDir(cwd), `${id}.persona`);
366
+ if (!fs.existsSync(filePath)) {
367
+ console.log(chalk.red(`Persona "${id}" not found.`));
368
+ return;
369
+ }
370
+ const allPersonas = loadAllPersonas(cwd);
371
+ const referencedBy = allPersonas.filter(
372
+ (p) => p.id !== id && p.journey.some((s) => s.spawns?.some((sp) => sp.persona === id))
373
+ );
374
+ if (referencedBy.length > 0) {
375
+ console.log(chalk.yellow(`
376
+ Warning: ${id} is spawned by: ${referencedBy.map((p) => p.id).join(", ")}`));
377
+ console.log(chalk.yellow(" Deleting it will break their spawn chains.\n"));
378
+ }
379
+ fs.unlinkSync(filePath);
380
+ console.log(chalk.green(` Deleted persona "${id}".`));
381
+ }
382
+ export {
383
+ personaAffectedCommand,
384
+ personaCoverageCommand,
385
+ personaDeleteCommand,
386
+ personaListCommand,
387
+ personaRunCommand,
388
+ personaShowCommand,
389
+ personaValidateCommand
390
+ };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-ZXMDA7VB.js";
2
+ import "./chunk-PDX44BCA.js";
3
3
 
4
4
  // src/commands/pipeline/index.ts
5
5
  import chalk from "chalk";