@a-company/paradigm 3.46.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.
- package/dist/{accept-orchestration-ZUWQUHSK.js → accept-orchestration-GX2YRWM4.js} +5 -5
- package/dist/{add-VSPZ6FM4.js → add-FZRKEGH4.js} +1 -1
- package/dist/agent-HYKC2LAK.js +387 -0
- package/dist/agent-loader-SJPJJS33.js +36 -0
- package/dist/{agents-suggest-65SER5IS.js → agents-suggest-DNSYJ6IA.js} +1 -1
- package/dist/{aggregate-SV3VGEIL.js → aggregate-H57K7PNV.js} +1 -1
- package/dist/{assess-UHBDYIK7.js → assess-4WVXZLZQ.js} +2 -2
- package/dist/{auto-24ICVUH4.js → auto-QFS5NHQU.js} +1 -1
- package/dist/{beacon-3SJV4DAP.js → beacon-KXZXYQHX.js} +1 -1
- package/dist/{calibration-WWHK73WU.js → calibration-V46G7JTY.js} +2 -2
- package/dist/{check-OLI6AUS6.js → check-OWAIWV23.js} +1 -1
- package/dist/{chunk-RP6TZYGE.js → chunk-2IO7JAG2.js} +1 -1
- package/dist/chunk-2T6BTYBN.js +712 -0
- package/dist/{chunk-CDMAMDSG.js → chunk-5VKJBNJL.js} +13 -5
- package/dist/{chunk-KB4XJWE3.js → chunk-6N3JTACN.js} +98 -437
- package/dist/chunk-7N7GSU6K.js +34 -0
- package/dist/chunk-A2L4TSLZ.js +526 -0
- package/dist/{chunk-P7XSBJE3.js → chunk-ABVQGRF7.js} +1 -1
- package/dist/{chunk-HIKKOCXY.js → chunk-EI32ZBE6.js} +1 -1
- package/dist/{chunk-QIOCFXDQ.js → chunk-EKGMAM62.js} +1 -1
- package/dist/chunk-EZ3GOCYC.js +132 -0
- package/dist/chunk-GGMI6C2L.js +1075 -0
- package/dist/{chunk-DS5QY37M.js → chunk-GTR2TBIJ.js} +247 -15
- package/dist/{chunk-QDXI2DHR.js → chunk-J2JEQRT3.js} +1 -1
- package/dist/{chunk-AKIMFN6I.js → chunk-JASGXLK3.js} +2 -2
- package/dist/{chunk-J4E6K5MG.js → chunk-LSRABQIY.js} +25 -1
- package/dist/chunk-MCMOGQMU.js +145 -0
- package/dist/{chunk-ZXMDA7VB.js → chunk-PDX44BCA.js} +1 -6
- package/dist/{chunk-2SKXFXIT.js → chunk-S3ORKP3V.js} +10 -15
- package/dist/{chunk-ZMQA6SCO.js → chunk-S6MZ2IEX.js} +628 -228
- package/dist/chunk-TAIJOFOE.js +124 -0
- package/dist/{chunk-FS3WTUHY.js → chunk-TXESEO7Y.js} +6 -6
- package/dist/{chunk-7COU5S2Z.js → chunk-VL67H5IC.js} +1 -1
- package/dist/{chunk-QWA26UNO.js → chunk-WQITYKHM.js} +7 -7
- package/dist/{chunk-MW5DMGBB.js → chunk-YMDLDELF.js} +114 -55
- package/dist/{claude-63ISJAZK.js → claude-FRRWJSTJ.js} +1 -1
- package/dist/{claude-cli-ABML5RHX.js → claude-cli-XJLK2X4L.js} +1 -1
- package/dist/{claude-code-JRLMRPTO.js → claude-code-HTBA4XRB.js} +1 -1
- package/dist/{claude-code-teams-CAJBEFIZ.js → claude-code-teams-T4SP24MD.js} +1 -1
- package/dist/{conductor-HLWYWUVH.js → conductor-PGPDVIVE.js} +1 -1
- package/dist/{config-schema-3YNIFJCJ.js → config-schema-EA4XALGG.js} +4 -2
- package/dist/{constellation-FAGT45TU.js → constellation-A26CCGQS.js} +1 -1
- package/dist/{context-audit-557EO6PK.js → context-audit-RLO3ETRP.js} +8 -5
- package/dist/{cost-XEBADYFT.js → cost-BGM32XJU.js} +1 -1
- package/dist/{cost-UD3WPEKZ.js → cost-VI46A4XL.js} +1 -1
- package/dist/{cursor-cli-QUOOF2N4.js → cursor-cli-JVEZGHWQ.js} +1 -1
- package/dist/{cursorrules-3TKZ4E4R.js → cursorrules-HLIKJJZT.js} +1 -1
- package/dist/decision-loader-WWCLIQPJ.js +20 -0
- package/dist/{delete-RRK4RL6Y.js → delete-KBRPQLPC.js} +2 -2
- package/dist/{diff-IP5CIARP.js → diff-RQLLNAFI.js} +5 -5
- package/dist/{discipline-5F5OVTXB.js → discipline-FA4OZXIS.js} +1 -1
- package/dist/{dist-UXWV4OKX.js → dist-34NA5RS5.js} +1 -1
- package/dist/{dist-5QE2BB2B-X6DYVSUL.js → dist-5QE2BB2B-5S3T6Y3T.js} +1 -1
- package/dist/{dist-CM3MVWWW.js → dist-77JDTVAY.js} +1 -0
- package/dist/{dist-POMVY6WP.js → dist-QK4SQAK7.js} +1 -1
- package/dist/{dist-3RVKEJRT.js → dist-TA6LSC2Q.js} +1 -1
- package/dist/docs-LVLRPBAW.js +155 -0
- package/dist/docs-PBZB7LYP.js +89 -0
- package/dist/{doctor-GKZJU7QG.js → doctor-ULBOHEIC.js} +3 -3
- package/dist/{drift-YGT4LJ7Q.js → drift-R5NRKFHI.js} +1 -1
- package/dist/{echo-A6HD5UP7.js → echo-O2LY7CC2.js} +1 -1
- package/dist/{edit-4CLNN5JG.js → edit-R2HNLMOG.js} +2 -2
- package/dist/event-25OJKDCE.js +31 -0
- package/dist/{export-T7CMMJIB.js → export-IWVL7XLF.js} +1 -1
- package/dist/{flow-UFMPVOEM.js → flow-CRRVV3O3.js} +2 -2
- package/dist/{global-HHUJSBG5.js → global-3NG5JXUB.js} +1 -1
- package/dist/graduate-USAWGBJM.js +160 -0
- package/dist/{graph-YYUXI3F7.js → graph-VHUMAAS6.js} +2 -2
- package/dist/{graph-server-ZPXRSGCW.js → graph-server-YL22VBBN.js} +1 -1
- package/dist/{habits-RG5SVKXP.js → habits-OL5NGPXO.js} +3 -3
- package/dist/{history-CETCSUCP.js → history-WOWC573W.js} +1 -1
- package/dist/{hooks-TCUHQMPF.js → hooks-HFWSCGPV.js} +2 -2
- package/dist/index.js +290 -188
- package/dist/{integrity-MK2OP5TA.js → integrity-IHO4FZTS.js} +1 -1
- package/dist/{integrity-checker-J7YXRTBT.js → integrity-checker-PSKJA5SB.js} +1 -0
- package/dist/journal-loader-5EYSBFFY.js +18 -0
- package/dist/{lint-HYWGS3JJ.js → lint-K6CJGGPH.js} +1 -1
- package/dist/{list-IUCYPGMK.js → list-4YK7QKFF.js} +1 -1
- package/dist/{list-BTLFHSRC.js → list-ENR7Q4CR.js} +2 -2
- package/dist/{lore-loader-VTEEZDX3.js → lore-loader-7NO6N6FT.js} +4 -1
- package/dist/{lore-server-NOOAHKJX.js → lore-server-UNJY5KC3.js} +1 -1
- package/dist/{manual-AFJ2J2V3.js → manual-G6FISID5.js} +1 -1
- package/dist/mcp.js +3764 -359
- package/dist/{migrate-FQVGQNXZ.js → migrate-LS45DNEV.js} +2 -2
- package/dist/{migrate-assessments-JP6Q5KME.js → migrate-assessments-RGH4O6IX.js} +2 -2
- package/dist/nomination-engine-Q4XSXFKT.js +40 -0
- package/dist/notebook-YWIYGEHV.js +155 -0
- package/dist/{orchestrate-A226N6FC.js → orchestrate-XZA33TJC.js} +5 -5
- package/dist/{peers-RFQCWVLV.js → peers-DEOUIZM6.js} +1 -1
- package/dist/persona-UHAHIVST.js +390 -0
- package/dist/{pipeline-3G2FRAKM.js → pipeline-L4HCSBGN.js} +1 -1
- package/dist/{platform-server-H7Y6Q7O4.js → platform-server-PMD57BEG.js} +264 -18
- package/dist/{plugin-update-checker-HMRPGY5Z.js → plugin-update-checker-ELOEEQYS.js} +1 -0
- package/dist/{portal-check-FF5EKZE5.js → portal-check-NPYGII2D.js} +2 -2
- package/dist/{portal-compliance-VU4NIFEN.js → portal-compliance-J7DGAPFX.js} +2 -2
- package/dist/{probe-7JK7IDNI.js → probe-MHL5HQZ2.js} +3 -3
- package/dist/{promote-XO63XMAN.js → promote-F6ZYZZAL.js} +2 -2
- package/dist/{providers-YNFSL6HK.js → providers-GK7PB2OL.js} +2 -2
- package/dist/{quiz-I75NU2QQ.js → quiz-M66SC7F7.js} +1 -1
- package/dist/{record-46CLR4OG.js → record-RA4WR2BO.js} +2 -2
- package/dist/{reindex-WIJMCJ4A.js → reindex-HRA2AUS6.js} +3 -2
- package/dist/{remember-4EUZKIIB.js → remember-HBWJ655S.js} +1 -1
- package/dist/{retag-KC4JVRLE.js → retag-3OLCVDEQ.js} +2 -2
- package/dist/{review-Q7M4CRB5.js → review-27ATYTD2.js} +2 -2
- package/dist/review-57QMURZV.js +334 -0
- package/dist/{ripple-RI3LOT6R.js → ripple-JPBXP5I3.js} +1 -1
- package/dist/{sentinel-UOIGJWHH.js → sentinel-4XIG4STA.js} +2 -2
- package/dist/{sentinel-bridge-APDXYAZS.js → sentinel-bridge-MDUXTQRL.js} +2 -2
- package/dist/{serve-KKEHE44G.js → serve-FLTFTM3P.js} +2 -2
- package/dist/{serve-22A4XOIG.js → serve-INL7SNBK.js} +2 -2
- package/dist/{serve-2YJ6D2Y6.js → serve-KBSE36PL.js} +4 -4
- package/dist/{server-JV6UFGWZ.js → server-54SKYFFY.js} +2 -2
- package/dist/{server-RDLQ3DK7.js → server-XUOIO7E6.js} +1 -1
- package/dist/{setup-YNZJQLW7.js → setup-EDS27WUR.js} +1 -1
- package/dist/{setup-M2ZKLKNN.js → setup-KO5AFC4K.js} +2 -2
- package/dist/{shift-LNMKFYLR.js → shift-VFG23DLA.js} +16 -16
- package/dist/{show-P7GYO43X.js → show-5PV5KFJE.js} +2 -2
- package/dist/{show-PKZMYKRN.js → show-NQKYX6WQ.js} +1 -1
- package/dist/{snapshot-Y3COXK4T.js → snapshot-BK4RBPCG.js} +1 -1
- package/dist/{spawn-SSXZX45U.js → spawn-AW6GDECS.js} +3 -3
- package/dist/{status-KLHALGW4.js → status-WGIAQODY.js} +1 -1
- package/dist/{summary-5NQNOD3F.js → summary-NIRABMF5.js} +2 -2
- package/dist/{sweep-EZU3GU6S.js → sweep-QMHNSIY5.js} +2 -2
- package/dist/{switch-WYUMVNA5.js → switch-6EJPZDIA.js} +1 -1
- package/dist/{symphony-6K3HD7AW.js → symphony-4OCY36AI.js} +5 -5
- package/dist/{symphony-YCHBYN3E.js → symphony-B75X2MME.js} +2 -2
- package/dist/{symphony-peers-HSY3RI3S.js → symphony-peers-2ZQYLRNI.js} +1 -1
- package/dist/{symphony-peers-APOGJPF4.js → symphony-peers-OL7F6M5S.js} +1 -0
- package/dist/{symphony-relay-GTAJRCVF.js → symphony-relay-UJYUXN65.js} +28 -1
- package/dist/{sync-ZM4Q3R4U.js → sync-VEHUH4OA.js} +3 -3
- package/dist/{sync-llms-JIPP3XX4.js → sync-llms-YHCFIE6X.js} +2 -2
- package/dist/{task-loader-7M2FCBX6.js → task-loader-LDYWQSLM.js} +1 -0
- package/dist/{team-HGLJXWQG.js → team-7HG7XK5C.js} +6 -6
- package/dist/{test-WTR5Q33E.js → test-566CP5KC.js} +1 -1
- package/dist/{thread-3WM7KKID.js → thread-N754I4D5.js} +1 -1
- package/dist/{timeline-ANC7LVDL.js → timeline-M3CICQFE.js} +2 -2
- package/dist/{triage-IZ4MDYNB.js → triage-HHYGT3HY.js} +1 -1
- package/dist/{tutorial-GC6QL4US.js → tutorial-KD22SUNO.js} +1 -1
- package/dist/university-content/courses/.purpose +66 -0
- package/dist/university-content/courses/para-401.json +146 -0
- package/dist/university-content/courses/para-501.json +67 -0
- package/dist/university-content/courses/para-601.json +608 -0
- package/dist/university-content/plsat/.purpose +6 -0
- package/dist/university-content/plsat/v2.0.json +2 -2
- package/dist/university-content/plsat/v3.0.json +563 -3
- package/dist/university-content/reference.json +91 -0
- package/dist/{upgrade-ANX3LVSA.js → upgrade-H5PF32BW.js} +2 -2
- package/dist/{validate-GD5XWILV.js → validate-CNKEKO6A.js} +1 -1
- package/dist/{validate-ITC5D6QG.js → validate-MB5ULIHS.js} +1 -1
- package/dist/{validate-ZVPNN4FL.js → validate-QH3LADM6.js} +1 -1
- package/dist/{watch-X64UK7K4.js → watch-2TKP5PVL.js} +3 -3
- package/dist/{watch-ERBEJUJW.js → watch-ZF4ML6CD.js} +2 -2
- package/dist/{wisdom-L2WC7J62.js → wisdom-AATMGNFA.js} +1 -1
- package/dist/work-log-loader-5L45XNYZ.js +14 -0
- package/dist/{workspace-UIUTHZTD.js → workspace-6E6OSRNU.js} +4 -4
- package/package.json +1 -1
- package/platform-ui/dist/assets/DocsSection-ByAgPzWV.js +1 -0
- package/platform-ui/dist/assets/DocsSection-CjdO6R-u.css +1 -0
- package/platform-ui/dist/assets/{GitSection-BD3Ze06e.js → GitSection-BLovj9yT.js} +1 -1
- package/platform-ui/dist/assets/{GraphSection-SglITfSs.js → GraphSection-C5PCPUFl.js} +1 -1
- package/platform-ui/dist/assets/{LoreSection-bR5Km4Fd.js → LoreSection-BftejTla.js} +1 -1
- package/platform-ui/dist/assets/{SentinelSection-QSpAZArG.js → SentinelSection-CnYcasN7.js} +1 -1
- package/platform-ui/dist/assets/{SymphonySection-CobYJgvg.js → SymphonySection-BpmqCHeK.js} +1 -1
- package/platform-ui/dist/assets/{index-DbxeSMkV.js → index-G9JnWEs_.js} +10 -10
- package/platform-ui/dist/index.html +1 -1
- package/dist/dist-PSF5CP4I.js +0 -7294
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-PDX44BCA.js";
|
|
3
3
|
|
|
4
4
|
// src/commands/migrate/index.ts
|
|
5
5
|
import * as fs4 from "fs";
|
|
@@ -486,7 +486,7 @@ var refreshHooks = {
|
|
|
486
486
|
async apply(rootDir, opts) {
|
|
487
487
|
if (opts.dryRun) return { status: "skipped", message: "Would reinstall hooks" };
|
|
488
488
|
try {
|
|
489
|
-
const { hooksInstallCommand } = await import("./hooks-
|
|
489
|
+
const { hooksInstallCommand } = await import("./hooks-HFWSCGPV.js");
|
|
490
490
|
await hooksInstallCommand({ force: true });
|
|
491
491
|
return { status: "applied", message: "Hooks reinstalled" };
|
|
492
492
|
} catch (err) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
adjustAttentionFromFeedback,
|
|
4
|
+
applySurfacingRules,
|
|
5
|
+
autoPromoteJournalEntries,
|
|
6
|
+
detectDebates,
|
|
7
|
+
emitAndProcess,
|
|
8
|
+
engageNomination,
|
|
9
|
+
forwardNominationsToRelay,
|
|
10
|
+
getNominationStats,
|
|
11
|
+
init_nomination_engine,
|
|
12
|
+
loadDebates,
|
|
13
|
+
loadNominations,
|
|
14
|
+
loadSurfacingConfig,
|
|
15
|
+
persistNominations,
|
|
16
|
+
processEvent,
|
|
17
|
+
processPendingEvents,
|
|
18
|
+
resolveDebate
|
|
19
|
+
} from "./chunk-GGMI6C2L.js";
|
|
20
|
+
import "./chunk-A2L4TSLZ.js";
|
|
21
|
+
import "./chunk-MCMOGQMU.js";
|
|
22
|
+
import "./chunk-7N7GSU6K.js";
|
|
23
|
+
init_nomination_engine();
|
|
24
|
+
export {
|
|
25
|
+
adjustAttentionFromFeedback,
|
|
26
|
+
applySurfacingRules,
|
|
27
|
+
autoPromoteJournalEntries,
|
|
28
|
+
detectDebates,
|
|
29
|
+
emitAndProcess,
|
|
30
|
+
engageNomination,
|
|
31
|
+
forwardNominationsToRelay,
|
|
32
|
+
getNominationStats,
|
|
33
|
+
loadDebates,
|
|
34
|
+
loadNominations,
|
|
35
|
+
loadSurfacingConfig,
|
|
36
|
+
persistNominations,
|
|
37
|
+
processEvent,
|
|
38
|
+
processPendingEvents,
|
|
39
|
+
resolveDebate
|
|
40
|
+
};
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
log
|
|
4
|
+
} from "./chunk-4NCFWYGG.js";
|
|
5
|
+
import "./chunk-PDX44BCA.js";
|
|
6
|
+
|
|
7
|
+
// src/commands/notebook/index.ts
|
|
8
|
+
import * as fs from "fs";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
import * as os from "os";
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import * as yaml from "js-yaml";
|
|
13
|
+
var GLOBAL_NOTEBOOKS_DIR = path.join(os.homedir(), ".paradigm", "notebooks");
|
|
14
|
+
var PROJECT_NOTEBOOKS_DIR = ".paradigm/notebooks";
|
|
15
|
+
var NOTEBOOK_PREFIX = "nb-";
|
|
16
|
+
var NOTEBOOK_EXT = ".yaml";
|
|
17
|
+
async function notebookListCommand(options = {}) {
|
|
18
|
+
const cwd = process.cwd();
|
|
19
|
+
const tracker = log.command("notebook-list").start("Listing notebook entries", { cwd });
|
|
20
|
+
const agentId = options.agent || "all";
|
|
21
|
+
const entries = loadEntries(cwd, agentId === "all" ? void 0 : agentId);
|
|
22
|
+
if (options.json) {
|
|
23
|
+
console.log(JSON.stringify({ count: entries.length, entries: entries.map(summarize) }, null, 2));
|
|
24
|
+
tracker.success(`Found ${entries.length} entries`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log(chalk.blue("\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
28
|
+
console.log(chalk.blue("\u2502") + chalk.white.bold(" paradigm notebook list ") + chalk.blue("\u2502"));
|
|
29
|
+
console.log(chalk.blue("\u2502") + chalk.gray(` Agent: ${agentId}`.padEnd(50)) + chalk.blue("\u2502"));
|
|
30
|
+
console.log(chalk.blue("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"));
|
|
31
|
+
if (entries.length === 0) {
|
|
32
|
+
console.log(chalk.yellow(" No notebook entries found."));
|
|
33
|
+
console.log(chalk.gray(" Add entries via paradigm_notebook_add or paradigm_notebook_promote.\n"));
|
|
34
|
+
tracker.success("No entries found");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
for (const e of entries) {
|
|
38
|
+
const concepts = e.concepts.join(", ") || chalk.gray("none");
|
|
39
|
+
const applied = e.appliedCount > 0 ? chalk.green(`${e.appliedCount}x applied`) : chalk.gray("unused");
|
|
40
|
+
console.log(` ${chalk.white.bold(e.id)}`);
|
|
41
|
+
console.log(` ${chalk.gray(e.context.slice(0, 80))}`);
|
|
42
|
+
console.log(` Concepts: ${concepts} | ${applied} | Confidence: ${(e.confidence * 100).toFixed(0)}%`);
|
|
43
|
+
console.log("");
|
|
44
|
+
}
|
|
45
|
+
tracker.success(`Listed ${entries.length} entries`);
|
|
46
|
+
}
|
|
47
|
+
async function notebookShowCommand(id, options = {}) {
|
|
48
|
+
const cwd = process.cwd();
|
|
49
|
+
const tracker = log.command("notebook-show").start(`Showing notebook ${id}`, { cwd });
|
|
50
|
+
const entries = loadEntries(cwd, options.agent);
|
|
51
|
+
const entry = entries.find((e) => e.id === id);
|
|
52
|
+
if (!entry) {
|
|
53
|
+
if (options.json) {
|
|
54
|
+
console.log(JSON.stringify({ error: `Entry "${id}" not found` }));
|
|
55
|
+
} else {
|
|
56
|
+
console.log(chalk.red(`
|
|
57
|
+
Entry "${id}" not found.
|
|
58
|
+
`));
|
|
59
|
+
}
|
|
60
|
+
tracker.error(`Entry ${id} not found`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (options.json) {
|
|
64
|
+
console.log(JSON.stringify(entry, null, 2));
|
|
65
|
+
tracker.success(`Showed entry ${id}`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
console.log(chalk.blue(`
|
|
69
|
+
Notebook Entry: ${id}
|
|
70
|
+
`));
|
|
71
|
+
console.log(` ${chalk.white.bold("Context:")} ${entry.context}`);
|
|
72
|
+
console.log(` ${chalk.white.bold("Concepts:")} ${entry.concepts.join(", ")}`);
|
|
73
|
+
console.log(` ${chalk.white.bold("Tags:")} ${entry.tags.join(", ") || "(none)"}`);
|
|
74
|
+
console.log(` ${chalk.white.bold("Confidence:")} ${(entry.confidence * 100).toFixed(0)}%`);
|
|
75
|
+
console.log(` ${chalk.white.bold("Applied:")} ${entry.appliedCount} times`);
|
|
76
|
+
console.log(` ${chalk.white.bold("Provenance:")} ${entry.provenance.source}${entry.provenance.loreEntryId ? ` (${entry.provenance.loreEntryId})` : ""}`);
|
|
77
|
+
console.log(` ${chalk.white.bold("Created:")} ${entry.created}`);
|
|
78
|
+
console.log(` ${chalk.white.bold("Updated:")} ${entry.updated}`);
|
|
79
|
+
console.log(`
|
|
80
|
+
${chalk.white.bold("Snippet:")}`);
|
|
81
|
+
console.log(chalk.gray(" \u2500".repeat(25)));
|
|
82
|
+
for (const line of entry.snippet.split("\n")) {
|
|
83
|
+
console.log(` ${line}`);
|
|
84
|
+
}
|
|
85
|
+
console.log(chalk.gray(" \u2500".repeat(25)));
|
|
86
|
+
console.log("");
|
|
87
|
+
tracker.success(`Showed entry ${id}`);
|
|
88
|
+
}
|
|
89
|
+
async function notebookExportCommand(options = {}) {
|
|
90
|
+
const cwd = process.cwd();
|
|
91
|
+
const tracker = log.command("notebook-export").start("Exporting notebook entries", { cwd });
|
|
92
|
+
const entries = loadEntries(cwd, options.agent);
|
|
93
|
+
const format = options.format || "yaml";
|
|
94
|
+
if (format === "json") {
|
|
95
|
+
console.log(JSON.stringify(entries, null, 2));
|
|
96
|
+
} else {
|
|
97
|
+
console.log(yaml.dump(entries, { lineWidth: 120, noRefs: true }));
|
|
98
|
+
}
|
|
99
|
+
tracker.success(`Exported ${entries.length} entries as ${format}`);
|
|
100
|
+
}
|
|
101
|
+
function loadEntries(rootDir, agentId) {
|
|
102
|
+
const entries = [];
|
|
103
|
+
const dirs = [];
|
|
104
|
+
if (agentId) {
|
|
105
|
+
dirs.push(path.join(GLOBAL_NOTEBOOKS_DIR, agentId));
|
|
106
|
+
dirs.push(path.join(rootDir, PROJECT_NOTEBOOKS_DIR, agentId));
|
|
107
|
+
} else {
|
|
108
|
+
for (const base of [GLOBAL_NOTEBOOKS_DIR, path.join(rootDir, PROJECT_NOTEBOOKS_DIR)]) {
|
|
109
|
+
if (fs.existsSync(base)) {
|
|
110
|
+
try {
|
|
111
|
+
const agentDirs = fs.readdirSync(base, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => path.join(base, d.name));
|
|
112
|
+
dirs.push(...agentDirs);
|
|
113
|
+
} catch {
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const seen = /* @__PURE__ */ new Set();
|
|
119
|
+
for (const dir of dirs) {
|
|
120
|
+
if (!fs.existsSync(dir)) continue;
|
|
121
|
+
try {
|
|
122
|
+
const files = fs.readdirSync(dir).filter(
|
|
123
|
+
(f) => f.startsWith(NOTEBOOK_PREFIX) && f.endsWith(NOTEBOOK_EXT)
|
|
124
|
+
);
|
|
125
|
+
for (const file of files) {
|
|
126
|
+
try {
|
|
127
|
+
const content = fs.readFileSync(path.join(dir, file), "utf-8");
|
|
128
|
+
const entry = yaml.load(content);
|
|
129
|
+
if (entry?.id && !seen.has(entry.id)) {
|
|
130
|
+
seen.add(entry.id);
|
|
131
|
+
entries.push(entry);
|
|
132
|
+
}
|
|
133
|
+
} catch {
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return entries.sort((a, b) => b.appliedCount - a.appliedCount);
|
|
140
|
+
}
|
|
141
|
+
function summarize(e) {
|
|
142
|
+
return {
|
|
143
|
+
id: e.id,
|
|
144
|
+
context: e.context.slice(0, 100),
|
|
145
|
+
concepts: e.concepts,
|
|
146
|
+
appliedCount: e.appliedCount,
|
|
147
|
+
confidence: e.confidence,
|
|
148
|
+
provenance: e.provenance.source
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
notebookExportCommand,
|
|
153
|
+
notebookListCommand,
|
|
154
|
+
notebookShowCommand
|
|
155
|
+
};
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
BackgroundOrchestrator,
|
|
4
4
|
Orchestrator
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-WQITYKHM.js";
|
|
6
|
+
import "./chunk-LSRABQIY.js";
|
|
7
7
|
import "./chunk-PBHIFAL4.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-TXESEO7Y.js";
|
|
9
9
|
import "./chunk-6QC3YGB6.js";
|
|
10
10
|
import {
|
|
11
11
|
loadAgentsManifest
|
|
12
12
|
} from "./chunk-PMXRGPRQ.js";
|
|
13
|
-
import "./chunk-MW5DMGBB.js";
|
|
14
13
|
import {
|
|
15
14
|
formatCost,
|
|
16
15
|
formatTokens
|
|
@@ -18,7 +17,8 @@ import {
|
|
|
18
17
|
import "./chunk-ZGUAAVMA.js";
|
|
19
18
|
import "./chunk-EDOAWN7J.js";
|
|
20
19
|
import "./chunk-IRKUEJVW.js";
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-YMDLDELF.js";
|
|
21
|
+
import "./chunk-PDX44BCA.js";
|
|
22
22
|
|
|
23
23
|
// src/commands/team/orchestrate.ts
|
|
24
24
|
import * as path from "path";
|
|
@@ -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
|
+
};
|