@a-company/paradigm 3.34.0 → 3.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/{accept-orchestration-XXANWJVZ.js → accept-orchestration-ZUWQUHSK.js} +6 -6
  2. package/dist/add-VSPZ6FM4.js +81 -0
  3. package/dist/{aggregate-XHQ6GI3Z.js → aggregate-SV3VGEIL.js} +2 -2
  4. package/dist/assess-UHBDYIK7.js +68 -0
  5. package/dist/{beacon-BTLQMYQL.js → beacon-3SJV4DAP.js} +2 -2
  6. package/dist/calibration-WWHK73WU.js +135 -0
  7. package/dist/{chunk-C5ZE6WEX.js → chunk-2SKXFXIT.js} +91 -1
  8. package/dist/{chunk-S5TDFT5Q.js → chunk-7COU5S2Z.js} +2 -2
  9. package/dist/{chunk-3BAMPB6I.js → chunk-7WEKMZ46.js} +2 -147
  10. package/dist/{chunk-H4TVBJD4.js → chunk-AKIMFN6I.js} +3 -3
  11. package/dist/{chunk-3DYYXGDC.js → chunk-CDMAMDSG.js} +33 -0
  12. package/dist/{chunk-PFLWLC6J.js → chunk-CZEIK3Y2.js} +855 -34
  13. package/dist/chunk-F3BCHPYT.js +143 -0
  14. package/dist/chunk-GT5QGC2H.js +253 -0
  15. package/dist/{chunk-UQNTJ5VB.js → chunk-HIKKOCXY.js} +1 -1
  16. package/dist/{chunk-J26YQVAK.js → chunk-J4E6K5MG.js} +1 -1
  17. package/dist/chunk-L27I3CPZ.js +357 -0
  18. package/dist/{chunk-WOONGZ3C.js → chunk-P7XSBJE3.js} +1 -1
  19. package/dist/{chunk-Z7W7HNRG.js → chunk-QDXI2DHR.js} +1 -1
  20. package/dist/{chunk-BRILIG7Z.js → chunk-QIOCFXDQ.js} +42 -0
  21. package/dist/{chunk-3BGSDKWD.js → chunk-QWA26UNO.js} +7 -7
  22. package/dist/{lore-server-ILPHKWLK.js → chunk-RAB5IKPR.js} +77 -112
  23. package/dist/{chunk-BKMNLROM.js → chunk-RGFANZ4Q.js} +448 -147
  24. package/dist/{chunk-R2SGQ22F.js → chunk-YW5OCVKB.js} +448 -2
  25. package/dist/{chunk-CTF6RHKG.js → chunk-ZGUAAVMA.js} +17 -2
  26. package/dist/{commands-KPT2T2OZ.js → commands-LEPFD7S5.js} +452 -1
  27. package/dist/config-schema-3YNIFJCJ.js +152 -0
  28. package/dist/{constellation-LZ6XIKDT.js → constellation-FAGT45TU.js} +2 -2
  29. package/dist/{context-audit-RI4R2WRH.js → context-audit-557EO6PK.js} +138 -8
  30. package/dist/{cost-4SZM7OUS.js → cost-UD3WPEKZ.js} +1 -1
  31. package/dist/{delete-YTASL4SM.js → delete-RRK4RL6Y.js} +1 -1
  32. package/dist/{diff-T6YJSAAC.js → diff-IP5CIARP.js} +6 -6
  33. package/dist/{dist-AG5JNIZU-HW2FWNTZ.js → dist-5QE2BB2B-X6DYVSUL.js} +59 -5
  34. package/dist/{dist-OH4DBV2O.js → dist-OGTSAZ55.js} +16 -1
  35. package/dist/{dist-IKBGY7FQ.js → dist-RVKYUCRU.js} +3 -1
  36. package/dist/{dist-QSBAGCZT.js → dist-UXWV4OKX.js} +2 -2
  37. package/dist/{dist-RMAIFRTW.js → dist-Y7I3CFY5.js} +5 -3
  38. package/dist/{doctor-INBOLZC7.js → doctor-GKZJU7QG.js} +1 -1
  39. package/dist/{edit-S7NZD7H7.js → edit-4CLNN5JG.js} +1 -1
  40. package/dist/{graph-ERNQQQ7C.js → graph-YYUXI3F7.js} +1 -1
  41. package/dist/graph-server-ZPXRSGCW.js +116 -0
  42. package/dist/{habits-7BORPC2F.js → habits-O37HTUKE.js} +2 -2
  43. package/dist/index.js +200 -86
  44. package/dist/integrity-MK2OP5TA.js +194 -0
  45. package/dist/integrity-checker-J7YXRTBT.js +11 -0
  46. package/dist/{lint-MTRZB5EC.js → lint-HYWGS3JJ.js} +1 -1
  47. package/dist/{list-QTFWN35D.js → list-BTLFHSRC.js} +1 -1
  48. package/dist/list-IUCYPGMK.js +57 -0
  49. package/dist/{lore-loader-S5BXMH27.js → lore-loader-VTEEZDX3.js} +3 -1
  50. package/dist/lore-server-NOOAHKJX.js +118 -0
  51. package/dist/mcp.js +2581 -112
  52. package/dist/{migrate-HRN5TUBQ.js → migrate-FQVGQNXZ.js} +21 -3
  53. package/dist/{migrate-assessments-FPR6C35Z.js → migrate-assessments-JP6Q5KME.js} +1 -1
  54. package/dist/{orchestrate-3SI6ON33.js → orchestrate-A226N6FC.js} +6 -6
  55. package/dist/platform-server-KK4OCRTV.js +891 -0
  56. package/dist/{probe-ABMGCXQG.js → probe-7JK7IDNI.js} +4 -4
  57. package/dist/{providers-YW3FG6DA.js → providers-YNFSL6HK.js} +1 -1
  58. package/dist/quiz-I75NU2QQ.js +99 -0
  59. package/dist/{record-UGN75GTB.js → record-46CLR4OG.js} +11 -2
  60. package/dist/{reindex-YC7LD4MN.js → reindex-NZQRGKPN.js} +3 -2
  61. package/dist/{remember-WR6ZVXLT.js → remember-4EUZKIIB.js} +1 -1
  62. package/dist/{retag-URLJLMSK.js → retag-KC4JVRLE.js} +1 -1
  63. package/dist/{review-725ZKA7U.js → review-Q7M4CRB5.js} +1 -1
  64. package/dist/{ripple-QTXKJCEI.js → ripple-RI3LOT6R.js} +2 -2
  65. package/dist/{sentinel-FUR3QKCJ.js → sentinel-BKYTBT7M.js} +1 -1
  66. package/dist/sentinel-bridge-IZTXYS5M.js +109 -0
  67. package/dist/sentinel-ui/assets/{index-Zh1YM0C9.css → index-CJ1Wx083.css} +1 -1
  68. package/dist/sentinel-ui/assets/index-S1VJ67dT.js +62 -0
  69. package/dist/sentinel-ui/assets/index-S1VJ67dT.js.map +1 -0
  70. package/dist/sentinel-ui/index.html +2 -2
  71. package/dist/sentinel.js +6 -6
  72. package/dist/{serve-DIALBCTU.js → serve-22A4XOIG.js} +1 -1
  73. package/dist/{university-A66BMZ4Z.js → serve-2YJ6D2Y6.js} +9 -8
  74. package/dist/serve-3V2WXLGM.js +33 -0
  75. package/dist/{server-2VICPDUR.js → server-OFEJ2HJP.js} +25 -2
  76. package/dist/{server-OWBK2WFS.js → server-RDLQ3DK7.js} +49 -4
  77. package/dist/{setup-ASR6OMKV.js → setup-M2ZKLKNN.js} +2 -2
  78. package/dist/{shift-7XLSBLDW.js → shift-LNMKFYLR.js} +63 -14
  79. package/dist/{show-GEVVQWWG.js → show-P7GYO43X.js} +1 -1
  80. package/dist/show-PKZMYKRN.js +82 -0
  81. package/dist/{snapshot-QZFD7YBI.js → snapshot-Y3COXK4T.js} +2 -2
  82. package/dist/{spawn-DIY7T4QW.js → spawn-SSXZX45U.js} +2 -2
  83. package/dist/status-KLHALGW4.js +71 -0
  84. package/dist/{summary-R4CSYNNP.js → summary-5NQNOD3F.js} +2 -2
  85. package/dist/{sweep-5POCF2E4.js → sweep-EZU3GU6S.js} +1 -1
  86. package/dist/symphony-ROEKK7VD.js +999 -0
  87. package/dist/{team-VH3HYABB.js → team-HGLJXWQG.js} +7 -7
  88. package/dist/{timeline-RKXNRMKF.js → timeline-ANC7LVDL.js} +1 -1
  89. package/dist/{triage-GJ6GK647.js → triage-POXJ2TIX.js} +2 -2
  90. package/dist/university-content/courses/.purpose +7 -1
  91. package/dist/university-content/courses/para-501.json +166 -0
  92. package/dist/university-content/plsat/.purpose +6 -0
  93. package/dist/university-content/plsat/v3.0.json +323 -1
  94. package/dist/university-content/reference.json +48 -0
  95. package/dist/university-ui/assets/{index-TcsCEBMo.js → index-tfi5xN4Q.js} +2 -2
  96. package/dist/university-ui/assets/{index-TcsCEBMo.js.map → index-tfi5xN4Q.js.map} +1 -1
  97. package/dist/university-ui/index.html +1 -1
  98. package/dist/validate-GD5XWILV.js +134 -0
  99. package/dist/{validate-OUHUBZPO.js → validate-ZVPNN4FL.js} +1 -1
  100. package/dist/{workspace-5RBSALXC.js → workspace-UIUTHZTD.js} +5 -5
  101. package/package.json +4 -2
  102. package/platform-ui/dist/assets/GitSection-C-GQWHcu.css +1 -0
  103. package/platform-ui/dist/assets/GitSection-DvyJBF_-.js +4 -0
  104. package/platform-ui/dist/assets/GraphSection-BiQrXqfs.js +8 -0
  105. package/platform-ui/dist/assets/GraphSection-BlgXTl53.css +1 -0
  106. package/platform-ui/dist/assets/LoreSection-BaH1FaRb.js +1 -0
  107. package/platform-ui/dist/assets/LoreSection-C3EixkjW.css +1 -0
  108. package/platform-ui/dist/assets/SentinelSection-BI-aIYKL.css +1 -0
  109. package/platform-ui/dist/assets/SentinelSection-DemAznjI.js +1 -0
  110. package/platform-ui/dist/assets/index-CfpZFjea.css +1 -0
  111. package/platform-ui/dist/assets/index-DDKhCt-w.js +57 -0
  112. package/platform-ui/dist/index.html +14 -0
  113. package/dist/graph-server-BZ73HTAT.js +0 -251
  114. package/dist/sentinel-ui/assets/index-C_Wstm64.js +0 -62
  115. package/dist/sentinel-ui/assets/index-C_Wstm64.js.map +0 -1
  116. /package/dist/{chunk-VUSCJJ4A.js → chunk-EDOAWN7J.js} +0 -0
  117. /package/dist/{chunk-5SXMV4SP.js → chunk-FS3WTUHY.js} +0 -0
@@ -0,0 +1,194 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ aggregateFromDirectory
4
+ } from "./chunk-ZGUAAVMA.js";
5
+ import "./chunk-EDOAWN7J.js";
6
+ import "./chunk-IRKUEJVW.js";
7
+ import "./chunk-ZXMDA7VB.js";
8
+
9
+ // src/commands/integrity.ts
10
+ import * as fs from "fs";
11
+ import * as path from "path";
12
+ import chalk from "chalk";
13
+ async function integrityCommand(options = {}) {
14
+ const cwd = process.cwd();
15
+ const aggregation = await aggregateFromDirectory(cwd);
16
+ const symbols = aggregation.symbols;
17
+ const brokenRefs = findBrokenReferences(symbols);
18
+ const duplicates = findDuplicateSymbols(symbols);
19
+ const orphaned = findOrphanedSymbols(symbols);
20
+ const missingAnchors = findMissingAnchors(symbols, cwd);
21
+ const outOfBounds = findAnchorOutOfBounds(symbols, cwd);
22
+ const brokenCount = brokenRefs.length;
23
+ const duplicateCount = duplicates.length;
24
+ const orphanedCount = orphaned.length;
25
+ const missingAnchorCount = missingAnchors.length;
26
+ const outOfBoundsCount = outOfBounds.length;
27
+ if (options.json) {
28
+ const result = {
29
+ brokenCount,
30
+ duplicateCount,
31
+ orphanedCount,
32
+ missingAnchors: missingAnchorCount,
33
+ outOfBoundsAnchors: outOfBoundsCount,
34
+ details: {
35
+ brokenReferences: brokenRefs,
36
+ duplicateSymbols: duplicates,
37
+ orphanedSymbols: orphaned.slice(0, 20),
38
+ missingAnchorFiles: missingAnchors,
39
+ anchorOutOfBounds: outOfBounds
40
+ }
41
+ };
42
+ console.log(JSON.stringify(result));
43
+ return;
44
+ }
45
+ console.log(chalk.blue("\n\u{1F50D} Paradigm Integrity Check\n"));
46
+ if (brokenCount > 0) {
47
+ console.log(chalk.red(` \u2717 ${brokenCount} broken reference${brokenCount > 1 ? "s" : ""}`));
48
+ for (const ref of brokenRefs.slice(0, 10)) {
49
+ console.log(chalk.gray(` \u2502 ${ref.from} \u2192 ${ref.to} (${ref.refType}) in ${ref.file}`));
50
+ }
51
+ if (brokenCount > 10) {
52
+ console.log(chalk.gray(` \u2502 ... and ${brokenCount - 10} more`));
53
+ }
54
+ } else {
55
+ console.log(chalk.green(" \u2713 No broken references"));
56
+ }
57
+ if (duplicateCount > 0) {
58
+ console.log(chalk.red(` \u2717 ${duplicateCount} duplicate symbol${duplicateCount > 1 ? "s" : ""}`));
59
+ for (const dup of duplicates.slice(0, 10)) {
60
+ console.log(chalk.gray(` \u2502 ${dup.symbol} defined in: ${dup.files.join(", ")}`));
61
+ }
62
+ } else {
63
+ console.log(chalk.green(" \u2713 No duplicate symbols"));
64
+ }
65
+ if (orphanedCount > 0) {
66
+ console.log(chalk.yellow(` \u26A0 ${orphanedCount} isolated symbol${orphanedCount > 1 ? "s" : ""} (no connections to other symbols)`));
67
+ for (const orph of orphaned.slice(0, 5)) {
68
+ console.log(chalk.gray(` \u2502 ${orph.symbol} in ${orph.file}`));
69
+ }
70
+ if (orphanedCount > 5) {
71
+ console.log(chalk.gray(` \u2502 ... and ${orphanedCount - 5} more`));
72
+ }
73
+ } else {
74
+ console.log(chalk.green(" \u2713 All symbols are connected"));
75
+ }
76
+ if (missingAnchorCount > 0) {
77
+ console.log(chalk.red(` \u2717 ${missingAnchorCount} anchor${missingAnchorCount > 1 ? "s" : ""} pointing to missing files`));
78
+ for (const a of missingAnchors.slice(0, 5)) {
79
+ console.log(chalk.gray(` \u2502 ${a.symbol}: ${a.anchor}`));
80
+ }
81
+ } else {
82
+ console.log(chalk.green(" \u2713 All anchor files exist"));
83
+ }
84
+ if (outOfBoundsCount > 0) {
85
+ console.log(chalk.yellow(` \u26A0 ${outOfBoundsCount} anchor${outOfBoundsCount > 1 ? "s" : ""} with line ranges exceeding file length`));
86
+ for (const a of outOfBounds.slice(0, 5)) {
87
+ console.log(chalk.gray(` \u2502 ${a.symbol}: ${a.anchor} (file has ${a.fileLines} lines)`));
88
+ }
89
+ } else {
90
+ console.log(chalk.green(" \u2713 All anchor line ranges valid"));
91
+ }
92
+ const totalIssues = brokenCount + duplicateCount + missingAnchorCount + outOfBoundsCount;
93
+ console.log("");
94
+ if (totalIssues === 0) {
95
+ console.log(chalk.green("\u2728 All integrity checks passed!\n"));
96
+ } else {
97
+ console.log(`${totalIssues} issue${totalIssues > 1 ? "s" : ""} found. Run 'paradigm doctor' for full diagnostics.
98
+ `);
99
+ }
100
+ }
101
+ function findBrokenReferences(symbols) {
102
+ const broken = [];
103
+ const definedIds = new Set(symbols.map((s) => s.symbol));
104
+ for (const sym of symbols) {
105
+ if (sym.parentSymbol) {
106
+ const parentRef = sym.parentSymbol.trim();
107
+ const normalized = /^[#$^!~]/.test(parentRef) ? parentRef : `#${parentRef}`;
108
+ if (!definedIds.has(normalized)) {
109
+ broken.push({ from: sym.symbol, to: normalized, file: sym.filePath, refType: "parent" });
110
+ }
111
+ }
112
+ }
113
+ const seen = /* @__PURE__ */ new Set();
114
+ return broken.filter((b) => {
115
+ const key = `${b.from}->${b.to}`;
116
+ if (seen.has(key)) return false;
117
+ seen.add(key);
118
+ return true;
119
+ });
120
+ }
121
+ function findDuplicateSymbols(symbols) {
122
+ const bySymbol = /* @__PURE__ */ new Map();
123
+ for (const sym of symbols) {
124
+ const entries = bySymbol.get(sym.symbol) || [];
125
+ if (!entries.find((e) => e.file === sym.filePath)) {
126
+ entries.push({ file: sym.filePath, source: sym.source });
127
+ }
128
+ bySymbol.set(sym.symbol, entries);
129
+ }
130
+ const dupes = [];
131
+ for (const [symbol, entries] of bySymbol) {
132
+ if (entries.length <= 1) continue;
133
+ if (entries.length === 2) {
134
+ const sources = entries.map((e) => e.source).sort();
135
+ if (sources[0] === "portal" && sources[1] === "purpose") continue;
136
+ }
137
+ dupes.push({ symbol, files: entries.map((e) => e.file) });
138
+ }
139
+ return dupes;
140
+ }
141
+ function findOrphanedSymbols(symbols) {
142
+ return symbols.filter((s) => s.referencedBy.length === 0 && s.references.length === 0).map((s) => ({ symbol: s.symbol, file: s.filePath }));
143
+ }
144
+ function resolveAnchorPath(anchorPath, rootDir, purposeFilePath) {
145
+ if (path.isAbsolute(anchorPath)) return anchorPath;
146
+ if (purposeFilePath) {
147
+ const purposeDir = path.dirname(purposeFilePath);
148
+ const relativePath = path.join(purposeDir, anchorPath);
149
+ if (fs.existsSync(relativePath)) return relativePath;
150
+ }
151
+ return path.join(rootDir, anchorPath);
152
+ }
153
+ function findMissingAnchors(symbols, rootDir) {
154
+ const missing = [];
155
+ for (const sym of symbols) {
156
+ if (!sym.anchors || sym.anchors.length === 0) continue;
157
+ for (const anchor of sym.anchors) {
158
+ const filePath = resolveAnchorPath(anchor.path, rootDir, sym.filePath);
159
+ if (!fs.existsSync(filePath)) {
160
+ missing.push({ symbol: sym.symbol, anchor: anchor.raw });
161
+ }
162
+ }
163
+ }
164
+ return missing;
165
+ }
166
+ function findAnchorOutOfBounds(symbols, rootDir) {
167
+ const oob = [];
168
+ for (const sym of symbols) {
169
+ if (!sym.anchors || sym.anchors.length === 0) continue;
170
+ for (const anchor of sym.anchors) {
171
+ const filePath = resolveAnchorPath(anchor.path, rootDir, sym.filePath);
172
+ if (!fs.existsSync(filePath)) continue;
173
+ const maxLine = getMaxLine(anchor);
174
+ if (maxLine <= 0) continue;
175
+ try {
176
+ const content = fs.readFileSync(filePath, "utf8");
177
+ const lineCount = content.split("\n").length;
178
+ if (maxLine > lineCount) {
179
+ oob.push({ symbol: sym.symbol, anchor: anchor.raw, fileLines: lineCount });
180
+ }
181
+ } catch {
182
+ }
183
+ }
184
+ }
185
+ return oob;
186
+ }
187
+ function getMaxLine(anchor) {
188
+ if (typeof anchor.lines === "number") return anchor.lines;
189
+ if (Array.isArray(anchor.lines)) return Math.max(...anchor.lines);
190
+ return 0;
191
+ }
192
+ export {
193
+ integrityCommand
194
+ };
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ checkComponentAnchors,
4
+ checkIntegrity,
5
+ checkPurposeHealth
6
+ } from "./chunk-L27I3CPZ.js";
7
+ export {
8
+ checkComponentAnchors,
9
+ checkIntegrity,
10
+ checkPurposeHealth
11
+ };
@@ -4,7 +4,7 @@ import {
4
4
  parsePurposeFileDetailed,
5
5
  serializePurposeFile,
6
6
  validatePurposeFile
7
- } from "./chunk-VUSCJJ4A.js";
7
+ } from "./chunk-EDOAWN7J.js";
8
8
  import {
9
9
  log
10
10
  } from "./chunk-4NCFWYGG.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  loadLoreEntries
4
- } from "./chunk-BRILIG7Z.js";
4
+ } from "./chunk-QIOCFXDQ.js";
5
5
  import "./chunk-ZXMDA7VB.js";
6
6
 
7
7
  // src/commands/lore/list.ts
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ loadUniversityIndex,
4
+ searchContent
5
+ } from "./chunk-GT5QGC2H.js";
6
+ import "./chunk-ZXMDA7VB.js";
7
+
8
+ // src/commands/university/list.ts
9
+ import chalk from "chalk";
10
+ async function universityListCommand(options) {
11
+ const rootDir = process.cwd();
12
+ const index = loadUniversityIndex(rootDir);
13
+ if (!index || index.totalContent === 0) {
14
+ console.log(chalk.yellow("\n No university content found."));
15
+ console.log(chalk.gray(' Create content with: paradigm university add note --title "My Note"\n'));
16
+ return;
17
+ }
18
+ const results = searchContent(rootDir, {
19
+ type: options.type,
20
+ tag: options.tag,
21
+ difficulty: options.difficulty,
22
+ symbol: options.symbol,
23
+ limit: options.limit ? parseInt(options.limit, 10) : 20
24
+ });
25
+ if (options.json) {
26
+ console.log(JSON.stringify(results, null, 2));
27
+ return;
28
+ }
29
+ console.log(chalk.blue(`
30
+ University Content (${results.length} of ${index.totalContent})
31
+ `));
32
+ const typeIcons = {
33
+ note: "N",
34
+ policy: "P",
35
+ guide: "N",
36
+ runbook: "N",
37
+ quiz: "Q",
38
+ path: "LP"
39
+ };
40
+ for (const entry of results) {
41
+ const icon = typeIcons[entry.type] || "?";
42
+ const diffColor = entry.difficulty === "advanced" ? chalk.red : entry.difficulty === "intermediate" ? chalk.yellow : chalk.green;
43
+ const tags = entry.tags.length > 0 ? chalk.gray(` [${entry.tags.join(", ")}]`) : "";
44
+ console.log(` ${chalk.cyan(icon)} ${chalk.white(entry.id)} \u2014 ${entry.title}${tags}`);
45
+ if (entry.difficulty) {
46
+ console.log(` ${diffColor(entry.difficulty)} \xB7 ${entry.author} \xB7 ${entry.updated || entry.created}`);
47
+ }
48
+ }
49
+ if (index.diplomaCount > 0) {
50
+ console.log(chalk.gray(`
51
+ ${index.diplomaCount} diploma${index.diplomaCount > 1 ? "s" : ""} earned`));
52
+ }
53
+ console.log();
54
+ }
55
+ export {
56
+ universityListCommand
57
+ };
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ addLoreAssessment,
3
4
  addLoreReview,
4
5
  deleteLoreEntry,
5
6
  loadLoreEntries,
@@ -8,8 +9,9 @@ import {
8
9
  rebuildTimeline,
9
10
  recordLoreEntry,
10
11
  updateLoreEntry
11
- } from "./chunk-3DYYXGDC.js";
12
+ } from "./chunk-CDMAMDSG.js";
12
13
  export {
14
+ addLoreAssessment,
13
15
  addLoreReview,
14
16
  deleteLoreEntry,
15
17
  loadLoreEntries,
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ createInfoRouter,
4
+ createLoreRouter,
5
+ createSessionsRouter
6
+ } from "./chunk-RAB5IKPR.js";
7
+ import "./chunk-ZXMDA7VB.js";
8
+
9
+ // src/lore-server/index.ts
10
+ import express from "express";
11
+ import * as path from "path";
12
+ import * as fs from "fs";
13
+ import { fileURLToPath } from "url";
14
+ import chalk from "chalk";
15
+ var __filename = fileURLToPath(import.meta.url);
16
+ var __dirname = path.dirname(__filename);
17
+ var log = {
18
+ component(name) {
19
+ const symbol = chalk.magenta(`#${name}`);
20
+ return {
21
+ info: (msg, data) => {
22
+ const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
23
+ console.log(`${chalk.blue("i")} ${symbol} ${msg}${dataStr}`);
24
+ },
25
+ success: (msg, data) => {
26
+ const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
27
+ console.log(`${chalk.green("+")} ${symbol} ${msg}${dataStr}`);
28
+ },
29
+ warn: (msg, data) => {
30
+ const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
31
+ console.log(`${chalk.yellow("!")} ${symbol} ${msg}${dataStr}`);
32
+ },
33
+ error: (msg, data) => {
34
+ const dataStr = data ? chalk.gray(` ${Object.entries(data).map(([k, v]) => `${k}=${v}`).join(" ")}`) : "";
35
+ console.error(`${chalk.red("x")} ${symbol} ${msg}${dataStr}`);
36
+ }
37
+ };
38
+ }
39
+ };
40
+ function createLoreApp(options) {
41
+ const app = express();
42
+ app.use(express.json());
43
+ app.use((_req, res, next) => {
44
+ res.header("Access-Control-Allow-Origin", "*");
45
+ res.header("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
46
+ res.header("Access-Control-Allow-Headers", "Content-Type");
47
+ if (_req.method === "OPTIONS") {
48
+ res.sendStatus(204);
49
+ return;
50
+ }
51
+ next();
52
+ });
53
+ app.use("/api/lore", createLoreRouter(options.projectDir));
54
+ app.use("/api/info", createInfoRouter(options.projectDir));
55
+ app.use("/api/sessions", createSessionsRouter(options.projectDir));
56
+ app.get("/api/health", (_req, res) => {
57
+ res.json({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
58
+ });
59
+ let uiDistPath = path.join(__dirname, "..", "lore-ui", "dist");
60
+ if (!fs.existsSync(uiDistPath)) {
61
+ uiDistPath = path.join(__dirname, "..", "..", "lore-ui", "dist");
62
+ }
63
+ if (fs.existsSync(uiDistPath)) {
64
+ app.use(express.static(uiDistPath));
65
+ app.get("{*path}", (req, res) => {
66
+ if (!req.path.startsWith("/api")) {
67
+ res.sendFile(path.join(uiDistPath, "index.html"));
68
+ }
69
+ });
70
+ } else {
71
+ app.get("/", (_req, res) => {
72
+ res.send(`
73
+ <html>
74
+ <head><title>Paradigm Lore</title></head>
75
+ <body style="background:#0a0a0f;color:#e2e8f0;font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0">
76
+ <div style="text-align:center">
77
+ <h1>Paradigm Lore</h1>
78
+ <p style="color:#94a3b8">UI not built yet. Run <code style="background:#1e293b;padding:4px 8px;border-radius:4px">cd lore-ui && npx vite build</code></p>
79
+ <p style="color:#94a3b8">API available at <a href="/api/lore" style="color:#7dd3fc">/api/lore</a></p>
80
+ </div>
81
+ </body>
82
+ </html>
83
+ `);
84
+ });
85
+ }
86
+ return app;
87
+ }
88
+ async function startLoreServer(options) {
89
+ const app = createLoreApp(options);
90
+ log.component("lore-server").info("Starting server", { port: options.port });
91
+ log.component("lore-server").info("Project directory", { path: options.projectDir });
92
+ return new Promise((resolve, reject) => {
93
+ const server = app.listen(options.port, () => {
94
+ log.component("lore-server").success("Server running", { url: `http://localhost:${options.port}` });
95
+ if (options.open) {
96
+ import("open").then((openModule) => {
97
+ openModule.default(`http://localhost:${options.port}`);
98
+ log.component("lore-server").info("Opened browser");
99
+ }).catch(() => {
100
+ log.component("lore-server").warn("Could not open browser automatically");
101
+ });
102
+ }
103
+ resolve();
104
+ });
105
+ server.on("error", (err) => {
106
+ if (err.code === "EADDRINUSE") {
107
+ log.component("lore-server").error("Port already in use", { port: options.port });
108
+ } else {
109
+ log.component("lore-server").error("Server error", { error: err.message });
110
+ }
111
+ reject(err);
112
+ });
113
+ });
114
+ }
115
+ export {
116
+ createLoreApp,
117
+ startLoreServer
118
+ };