@rubytech/create-maxy-code 0.1.125 → 0.1.127

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 (78) hide show
  1. package/dist/index.js +23 -1
  2. package/package.json +2 -2
  3. package/payload/platform/config/brand.json +20 -1
  4. package/payload/platform/lib/aeo-llms-txt-writer/dist/index.d.ts +33 -0
  5. package/payload/platform/lib/aeo-llms-txt-writer/dist/index.d.ts.map +1 -0
  6. package/payload/platform/lib/aeo-llms-txt-writer/dist/index.js +119 -0
  7. package/payload/platform/lib/aeo-llms-txt-writer/dist/index.js.map +1 -0
  8. package/payload/platform/lib/aeo-llms-txt-writer/src/index.ts +172 -0
  9. package/payload/platform/lib/aeo-llms-txt-writer/tsconfig.json +8 -0
  10. package/payload/platform/lib/graph-style/dist/index.d.ts +78 -0
  11. package/payload/platform/lib/graph-style/dist/index.d.ts.map +1 -0
  12. package/payload/platform/lib/graph-style/dist/index.js +296 -0
  13. package/payload/platform/lib/graph-style/dist/index.js.map +1 -0
  14. package/payload/platform/lib/graph-style/src/__tests__/parity.test.ts +114 -0
  15. package/payload/platform/lib/graph-style/src/index.ts +307 -0
  16. package/payload/platform/lib/graph-style/tsconfig.json +9 -0
  17. package/payload/platform/lib/graph-style/vitest.config.ts +9 -0
  18. package/payload/platform/package-lock.json +318 -0
  19. package/payload/platform/package.json +3 -2
  20. package/payload/platform/plugins/.claude-plugin/marketplace.json +5 -0
  21. package/payload/platform/plugins/admin/.claude-plugin/plugin.json +1 -1
  22. package/payload/platform/plugins/admin/PLUGIN.md +4 -1
  23. package/payload/platform/plugins/admin/mcp/dist/index.js +73 -0
  24. package/payload/platform/plugins/admin/mcp/dist/index.js.map +1 -1
  25. package/payload/platform/plugins/admin/mcp/dist/tools/publish-site.d.ts +34 -0
  26. package/payload/platform/plugins/admin/mcp/dist/tools/publish-site.d.ts.map +1 -0
  27. package/payload/platform/plugins/admin/mcp/dist/tools/publish-site.js +176 -0
  28. package/payload/platform/plugins/admin/mcp/dist/tools/publish-site.js.map +1 -0
  29. package/payload/platform/plugins/admin/skills/publish-site/SKILL.md +19 -57
  30. package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.d.ts +5 -38
  31. package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.d.ts.map +1 -1
  32. package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.js +7 -114
  33. package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.js.map +1 -1
  34. package/payload/platform/plugins/docs/references/visitor-graph.md +4 -3
  35. package/payload/platform/plugins/graph-viewer/.claude-plugin/plugin.json +8 -0
  36. package/payload/platform/plugins/graph-viewer/PLUGIN.md +56 -0
  37. package/payload/platform/plugins/graph-viewer/mcp/dist/index.d.ts +7 -0
  38. package/payload/platform/plugins/graph-viewer/mcp/dist/index.d.ts.map +1 -0
  39. package/payload/platform/plugins/graph-viewer/mcp/dist/index.js +74 -0
  40. package/payload/platform/plugins/graph-viewer/mcp/dist/index.js.map +1 -0
  41. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.d.ts +5 -0
  42. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.d.ts.map +1 -0
  43. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.js +43 -0
  44. package/payload/platform/plugins/graph-viewer/mcp/dist/lib/neo4j.js.map +1 -0
  45. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.d.ts +28 -0
  46. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.d.ts.map +1 -0
  47. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.js +73 -0
  48. package/payload/platform/plugins/graph-viewer/mcp/dist/render/draw.js.map +1 -0
  49. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.d.ts +40 -0
  50. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.d.ts.map +1 -0
  51. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.js +77 -0
  52. package/payload/platform/plugins/graph-viewer/mcp/dist/render/layout.js.map +1 -0
  53. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.d.ts +45 -0
  54. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.d.ts.map +1 -0
  55. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.js +170 -0
  56. package/payload/platform/plugins/graph-viewer/mcp/dist/tools/graph-render.js.map +1 -0
  57. package/payload/platform/plugins/graph-viewer/mcp/package.json +25 -0
  58. package/payload/platform/plugins/graph-viewer/mcp/vitest.config.ts +8 -0
  59. package/payload/platform/plugins/graph-viewer/skills/render-graph/SKILL.md +35 -0
  60. package/payload/platform/scripts/check-plugin-tools-mcp-consistency.mjs +136 -0
  61. package/payload/platform/templates/specialists/agents/content-producer.md +3 -3
  62. package/payload/server/public/assets/{admin-D6IfAzYY.js → admin-FcRHAL-3.js} +7 -7
  63. package/payload/server/public/assets/{data-BGbQyufe.js → data-Ds37mflX.js} +1 -1
  64. package/payload/server/public/assets/{graph-D-1lRTeL.js → graph-CmWRhaiS.js} +1 -1
  65. package/payload/server/public/assets/graph-labels-Ch2r00Gt.js +1 -0
  66. package/payload/server/public/assets/page-BOtNny_4.js +51 -0
  67. package/payload/server/public/assets/page-BcHhJXUt.js +1 -0
  68. package/payload/server/public/consent.css +97 -0
  69. package/payload/server/public/consent.js +259 -0
  70. package/payload/server/public/data.html +3 -3
  71. package/payload/server/public/graph.html +3 -3
  72. package/payload/server/public/index.html +4 -4
  73. package/payload/server/public/privacy.html +68 -5
  74. package/payload/server/public/v.js +53 -0
  75. package/payload/server/server.js +465 -176
  76. package/payload/server/public/assets/graph-labels-BRXJHNYE.js +0 -1
  77. package/payload/server/public/assets/page-B4oirCvn.js +0 -1
  78. package/payload/server/public/assets/page-FmJ7PIYx.js +0 -51
package/dist/index.js CHANGED
@@ -1171,7 +1171,17 @@ function installNeo4j() {
1171
1171
  const neo4jDataDir = resolve(process.env.HOME ?? "/root", BRAND.configDir, "neo4j-data");
1172
1172
  mkdirSync(neo4jDataDir, { recursive: true });
1173
1173
  shell("neo4j-admin", ["dbms", "set-initial-password", "--", password], { redact: true });
1174
- console.log(" Neo4j installed via Homebrew. Password stored securely.");
1174
+ // Start Neo4j under brew's launchd supervision. Linux path starts the
1175
+ // service via systemd a few lines below; without this start the darwin
1176
+ // brand server binds successfully but every Cypher write fails with
1177
+ // "Failed to connect to server" because nothing is listening on 7687.
1178
+ // `brew services start` is idempotent — if already running it no-ops,
1179
+ // and the LaunchAgent persists across reboots.
1180
+ const brewStart = spawnSync("brew", ["services", "start", "neo4j"], { stdio: "inherit" });
1181
+ if (brewStart.status !== 0) {
1182
+ throw new Error(`brew services start neo4j failed (exit ${brewStart.status}) — Neo4j must be running before the brand server starts or all graph writes will fail`);
1183
+ }
1184
+ console.log(" Neo4j installed and started via Homebrew launchd. Password stored securely.");
1175
1185
  return;
1176
1186
  }
1177
1187
  // Neo4j 5.x supports Java 17 and 21. Debian Bookworm ships 17, Trixie ships 21.
@@ -3500,6 +3510,7 @@ else {
3500
3510
  // Upgrade detection: preserve existing DISPLAY_MODE from .env
3501
3511
  const persistDir = resolve(process.env.HOME ?? "/root", BRAND.configDir);
3502
3512
  const envPath = join(persistDir, ".env");
3513
+ let preservedFromEnv = false;
3503
3514
  try {
3504
3515
  if (existsSync(envPath)) {
3505
3516
  const envContent = readFileSync(envPath, "utf-8");
@@ -3507,10 +3518,21 @@ else {
3507
3518
  if (envMatch) {
3508
3519
  DISPLAY_MODE = envMatch[1];
3509
3520
  DISPLAY_MODE_SOURCE = ".env (preserved)";
3521
+ preservedFromEnv = true;
3510
3522
  }
3511
3523
  }
3512
3524
  }
3513
3525
  catch { /* non-critical */ }
3526
+ // Darwin has no VNC/X11 stack — `virtual` mode is Pi-only (tigervnc +
3527
+ // websockify + novnc, none of which exist on macOS). Without this guard
3528
+ // a fresh Mac install defaults to virtual, the OAuth step calls the
3529
+ // "Open browser" path that requires a virtual display, and the user
3530
+ // sees "VNC display failed to start" before they ever get to sign in.
3531
+ // Auto-flip to native on darwin when the operator didn't pick a mode.
3532
+ if (!preservedFromEnv && process.platform === "darwin") {
3533
+ DISPLAY_MODE = "native";
3534
+ DISPLAY_MODE_SOURCE = "darwin-auto (no VNC stack)";
3535
+ }
3514
3536
  }
3515
3537
  // ---------------------------------------------------------------------------
3516
3538
  // Embedding model — install-time flag, not a brand attribute.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubytech/create-maxy-code",
3
- "version": "0.1.125",
3
+ "version": "0.1.127",
4
4
  "description": "Install Maxy — AI for Productive People",
5
5
  "bin": {
6
6
  "create-maxy-code": "./dist/index.js"
@@ -13,7 +13,7 @@
13
13
  "build": "tsc",
14
14
  "bundle": "node scripts/bundle.js",
15
15
  "test": "npm run build && node --test 'dist/__tests__/*.test.js'",
16
- "prepublishOnly": "bash ../../platform/scripts/verify-skill-tool-surface.sh && node ../../platform/scripts/check-no-task-id-leaks.mjs && node ../../platform/scripts/check-no-esm-require.mjs && node ../../platform/scripts/check-skill-load-coverage.mjs && node ../../platform/ui/scripts/check-route-wiring.mjs && node ../../platform/ui/scripts/check-edge-admin-routes.mjs && npm run build && node --test 'dist/__tests__/*.test.js' && chmod +x dist/index.js && npm run bundle && bash ../../platform/scripts/smoke-boot-services.sh && node ../../platform/ui/scripts/check-bundle-node-imports.mjs --dir=./payload/server/public/assets"
16
+ "prepublishOnly": "bash ../../platform/scripts/verify-skill-tool-surface.sh && node ../../platform/scripts/check-plugin-tools-mcp-consistency.mjs && node ../../platform/scripts/check-no-task-id-leaks.mjs && node ../../platform/scripts/check-no-esm-require.mjs && node ../../platform/scripts/check-skill-load-coverage.mjs && node ../../platform/ui/scripts/check-route-wiring.mjs && node ../../platform/ui/scripts/check-edge-admin-routes.mjs && npm run build && node --test 'dist/__tests__/*.test.js' && chmod +x dist/index.js && npm run bundle && bash ../../platform/scripts/smoke-boot-services.sh && node ../../platform/ui/scripts/check-bundle-node-imports.mjs --dir=./payload/server/public/assets"
17
17
  },
18
18
  "files": [
19
19
  "dist",
@@ -58,5 +58,24 @@
58
58
  { "name": "telegram", "marketplace": "claude-plugins-official", "configureSecret": "TELEGRAM_BOT_TOKEN", "channelPlugin": true },
59
59
  { "name": "discord", "marketplace": "claude-plugins-official", "configureSecret": "DISCORD_BOT_TOKEN", "channelPlugin": true },
60
60
  { "name": "imessage", "marketplace": "claude-plugins-official", "channelPlugin": true }
61
- ]
61
+ ],
62
+
63
+ "consent": {
64
+ "copy": {
65
+ "title": "Before you browse this listing",
66
+ "body": "Maxy uses a first-party script to count page views, scrolls and clicks. Nothing is shared with third parties. You can change your mind any time via Manage cookies in the footer.",
67
+ "accept": "Accept",
68
+ "reject": "Reject",
69
+ "manage": "Manage cookies",
70
+ "policyLinkText": "Read the cookie policy",
71
+ "policyHref": "/privacy.html#cookies"
72
+ },
73
+ "palette": {
74
+ "bg": "#FAFAF8",
75
+ "fg": "#1F1F1F",
76
+ "accent": "#7C8C72",
77
+ "accentFg": "#FFFFFF",
78
+ "border": "#E8ECF0"
79
+ }
80
+ }
62
81
  }
@@ -0,0 +1,33 @@
1
+ import type { Session } from "neo4j-driver";
2
+ /**
3
+ * Pure llms.txt + llms-full.txt generator for an account's published
4
+ * KnowledgeDocument set. llmstxt.org draft format. Plugin-agnostic:
5
+ * the caller injects its own neo4j session factory so the lib can
6
+ * be consumed from any plugin that already has a configured driver
7
+ * (aeo, admin's publish-site tool, future hook callers).
8
+ */
9
+ export interface WriteLlmsTxtInput {
10
+ accountId: string;
11
+ siteName: string;
12
+ siteDescription?: string;
13
+ siteDir?: string;
14
+ }
15
+ export interface WriteLlmsTxtDeps {
16
+ getSession: () => Session;
17
+ }
18
+ export interface WriteLlmsTxtResult {
19
+ llmsTxt: string;
20
+ llmsFullTxt: string;
21
+ pageCount: number;
22
+ skippedNoUrl: number;
23
+ sizeBytes: {
24
+ index: number;
25
+ full: number;
26
+ };
27
+ writtenPaths?: {
28
+ index: string;
29
+ full: string;
30
+ };
31
+ }
32
+ export declare function writeLlmsTxt(input: WriteLlmsTxtInput, deps: WriteLlmsTxtDeps): Promise<WriteLlmsTxtResult>;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;GAMG;AAEH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAChD;AAqBD,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAqH7B"}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writeLlmsTxt = writeLlmsTxt;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_path_1 = require("node:path");
6
+ const HEADER_RX = /^#\s/m;
7
+ function escapeMarkdown(text) {
8
+ return text.replace(/[\[\]\(\)\n\r]/g, " ").trim();
9
+ }
10
+ function summariseBody(body) {
11
+ const flat = body.replace(/\s+/g, " ").trim();
12
+ if (flat.length <= 200)
13
+ return flat;
14
+ return flat.slice(0, 197).trimEnd() + "…";
15
+ }
16
+ async function writeLlmsTxt(input, deps) {
17
+ const session = deps.getSession();
18
+ let rows = [];
19
+ let skippedNoUrl = 0;
20
+ try {
21
+ const r = await session.run(`MATCH (d:KnowledgeDocument {accountId: $accountId})
22
+ RETURN d.title AS title, d.url AS url, d.summary AS summary,
23
+ coalesce(d.body, d.abstract, '') AS body
24
+ ORDER BY d.title ASC`, { accountId: input.accountId });
25
+ for (const rec of r.records) {
26
+ const title = rec.get("title") ?? "";
27
+ const url = rec.get("url") ?? "";
28
+ const summary = rec.get("summary") ?? "";
29
+ const body = rec.get("body") ?? "";
30
+ if (!url || !title) {
31
+ skippedNoUrl += 1;
32
+ continue;
33
+ }
34
+ rows.push({
35
+ title: escapeMarkdown(title),
36
+ url: url.trim(),
37
+ summary: escapeMarkdown(summary) || summariseBody(body) || "(no summary)",
38
+ body: body.trim(),
39
+ });
40
+ }
41
+ }
42
+ finally {
43
+ await session.close();
44
+ }
45
+ const indexLines = [];
46
+ indexLines.push(`# ${escapeMarkdown(input.siteName)}`);
47
+ indexLines.push("");
48
+ if (input.siteDescription) {
49
+ indexLines.push(`> ${escapeMarkdown(input.siteDescription)}`);
50
+ indexLines.push("");
51
+ }
52
+ indexLines.push("## Pages");
53
+ indexLines.push("");
54
+ for (const row of rows) {
55
+ indexLines.push(`- [${row.title}](${row.url}): ${row.summary}`);
56
+ }
57
+ indexLines.push("");
58
+ indexLines.push("<!-- generated by @maxy/aeo-llms-txt-writer; spec: https://llmstxt.org/ -->");
59
+ const llmsTxt = indexLines.join("\n");
60
+ const fullLines = [];
61
+ fullLines.push(`# ${escapeMarkdown(input.siteName)}`);
62
+ fullLines.push("");
63
+ if (input.siteDescription) {
64
+ fullLines.push(`> ${escapeMarkdown(input.siteDescription)}`);
65
+ fullLines.push("");
66
+ }
67
+ for (const row of rows) {
68
+ fullLines.push(`# ${row.title}`);
69
+ fullLines.push("");
70
+ fullLines.push(`Source: ${row.url}`);
71
+ fullLines.push("");
72
+ if (row.body) {
73
+ const safeBody = row.body.replace(HEADER_RX, "## ");
74
+ fullLines.push(safeBody);
75
+ }
76
+ else {
77
+ fullLines.push(row.summary);
78
+ }
79
+ fullLines.push("");
80
+ fullLines.push("---");
81
+ fullLines.push("");
82
+ }
83
+ const llmsFullTxt = fullLines.join("\n");
84
+ const sizeBytes = {
85
+ index: Buffer.byteLength(llmsTxt, "utf-8"),
86
+ full: Buffer.byteLength(llmsFullTxt, "utf-8"),
87
+ };
88
+ process.stderr.write(`[aeo-llms-txt] site=${input.siteName} pages=${rows.length} skippedNoUrl=${skippedNoUrl} indexBytes=${sizeBytes.index} fullBytes=${sizeBytes.full}\n`);
89
+ let writtenPaths;
90
+ if (input.siteDir) {
91
+ const dir = (0, node_path_1.resolve)(input.siteDir);
92
+ let dirStat;
93
+ try {
94
+ dirStat = await (0, promises_1.stat)(dir);
95
+ }
96
+ catch (err) {
97
+ const code = err?.code;
98
+ throw new Error(`siteDir does not exist (${code ?? "unknown"}): ${dir}`);
99
+ }
100
+ if (!dirStat.isDirectory()) {
101
+ throw new Error(`siteDir is not a directory: ${dir}`);
102
+ }
103
+ const indexPath = (0, node_path_1.resolve)(dir, "llms.txt");
104
+ const fullPath = (0, node_path_1.resolve)(dir, "llms-full.txt");
105
+ await (0, promises_1.writeFile)(indexPath, llmsTxt, "utf-8");
106
+ await (0, promises_1.writeFile)(fullPath, llmsFullTxt, "utf-8");
107
+ writtenPaths = { index: indexPath, full: fullPath };
108
+ process.stderr.write(`[aeo-llms-txt] wrote site=${dir} indexBytes=${sizeBytes.index} fullBytes=${sizeBytes.full}\n`);
109
+ }
110
+ return {
111
+ llmsTxt,
112
+ llmsFullTxt,
113
+ pageCount: rows.length,
114
+ skippedNoUrl,
115
+ sizeBytes,
116
+ writtenPaths,
117
+ };
118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AAW,EAAE,OAAO,CAAC,CAAC;QAChD,YAAY,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACpD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,6BAA6B,GAAG,eAAe,SAAS,CAAC,KAAK,cAAc,SAAS,CAAC,IAAI,IAAI,CAC/F,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO;QACP,WAAW;QACX,SAAS,EAAE,IAAI,CAAC,MAAM;QACtB,YAAY;QACZ,SAAS;QACT,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,172 @@
1
+ import { stat, writeFile } from "node:fs/promises";
2
+ import { resolve as resolvePath } from "node:path";
3
+ import type { Session } from "neo4j-driver";
4
+
5
+ /**
6
+ * Pure llms.txt + llms-full.txt generator for an account's published
7
+ * KnowledgeDocument set. llmstxt.org draft format. Plugin-agnostic:
8
+ * the caller injects its own neo4j session factory so the lib can
9
+ * be consumed from any plugin that already has a configured driver
10
+ * (aeo, admin's publish-site tool, future hook callers).
11
+ */
12
+
13
+ export interface WriteLlmsTxtInput {
14
+ accountId: string;
15
+ siteName: string;
16
+ siteDescription?: string;
17
+ siteDir?: string;
18
+ }
19
+
20
+ export interface WriteLlmsTxtDeps {
21
+ getSession: () => Session;
22
+ }
23
+
24
+ export interface WriteLlmsTxtResult {
25
+ llmsTxt: string;
26
+ llmsFullTxt: string;
27
+ pageCount: number;
28
+ skippedNoUrl: number;
29
+ sizeBytes: { index: number; full: number };
30
+ writtenPaths?: { index: string; full: string };
31
+ }
32
+
33
+ interface PageRow {
34
+ title: string;
35
+ url: string;
36
+ summary: string;
37
+ body: string;
38
+ }
39
+
40
+ const HEADER_RX = /^#\s/m;
41
+
42
+ function escapeMarkdown(text: string): string {
43
+ return text.replace(/[\[\]\(\)\n\r]/g, " ").trim();
44
+ }
45
+
46
+ function summariseBody(body: string): string {
47
+ const flat = body.replace(/\s+/g, " ").trim();
48
+ if (flat.length <= 200) return flat;
49
+ return flat.slice(0, 197).trimEnd() + "…";
50
+ }
51
+
52
+ export async function writeLlmsTxt(
53
+ input: WriteLlmsTxtInput,
54
+ deps: WriteLlmsTxtDeps,
55
+ ): Promise<WriteLlmsTxtResult> {
56
+ const session = deps.getSession();
57
+ let rows: PageRow[] = [];
58
+ let skippedNoUrl = 0;
59
+ try {
60
+ const r = await session.run(
61
+ `MATCH (d:KnowledgeDocument {accountId: $accountId})
62
+ RETURN d.title AS title, d.url AS url, d.summary AS summary,
63
+ coalesce(d.body, d.abstract, '') AS body
64
+ ORDER BY d.title ASC`,
65
+ { accountId: input.accountId },
66
+ );
67
+ for (const rec of r.records) {
68
+ const title = (rec.get("title") as string | null) ?? "";
69
+ const url = (rec.get("url") as string | null) ?? "";
70
+ const summary = (rec.get("summary") as string | null) ?? "";
71
+ const body = (rec.get("body") as string | null) ?? "";
72
+ if (!url || !title) {
73
+ skippedNoUrl += 1;
74
+ continue;
75
+ }
76
+ rows.push({
77
+ title: escapeMarkdown(title),
78
+ url: url.trim(),
79
+ summary:
80
+ escapeMarkdown(summary) || summariseBody(body) || "(no summary)",
81
+ body: body.trim(),
82
+ });
83
+ }
84
+ } finally {
85
+ await session.close();
86
+ }
87
+
88
+ const indexLines: string[] = [];
89
+ indexLines.push(`# ${escapeMarkdown(input.siteName)}`);
90
+ indexLines.push("");
91
+ if (input.siteDescription) {
92
+ indexLines.push(`> ${escapeMarkdown(input.siteDescription)}`);
93
+ indexLines.push("");
94
+ }
95
+ indexLines.push("## Pages");
96
+ indexLines.push("");
97
+ for (const row of rows) {
98
+ indexLines.push(`- [${row.title}](${row.url}): ${row.summary}`);
99
+ }
100
+ indexLines.push("");
101
+ indexLines.push(
102
+ "<!-- generated by @maxy/aeo-llms-txt-writer; spec: https://llmstxt.org/ -->",
103
+ );
104
+ const llmsTxt = indexLines.join("\n");
105
+
106
+ const fullLines: string[] = [];
107
+ fullLines.push(`# ${escapeMarkdown(input.siteName)}`);
108
+ fullLines.push("");
109
+ if (input.siteDescription) {
110
+ fullLines.push(`> ${escapeMarkdown(input.siteDescription)}`);
111
+ fullLines.push("");
112
+ }
113
+ for (const row of rows) {
114
+ fullLines.push(`# ${row.title}`);
115
+ fullLines.push("");
116
+ fullLines.push(`Source: ${row.url}`);
117
+ fullLines.push("");
118
+ if (row.body) {
119
+ const safeBody = row.body.replace(HEADER_RX, "## ");
120
+ fullLines.push(safeBody);
121
+ } else {
122
+ fullLines.push(row.summary);
123
+ }
124
+ fullLines.push("");
125
+ fullLines.push("---");
126
+ fullLines.push("");
127
+ }
128
+ const llmsFullTxt = fullLines.join("\n");
129
+
130
+ const sizeBytes = {
131
+ index: Buffer.byteLength(llmsTxt, "utf-8"),
132
+ full: Buffer.byteLength(llmsFullTxt, "utf-8"),
133
+ };
134
+
135
+ process.stderr.write(
136
+ `[aeo-llms-txt] site=${input.siteName} pages=${rows.length} skippedNoUrl=${skippedNoUrl} indexBytes=${sizeBytes.index} fullBytes=${sizeBytes.full}\n`,
137
+ );
138
+
139
+ let writtenPaths: { index: string; full: string } | undefined;
140
+ if (input.siteDir) {
141
+ const dir = resolvePath(input.siteDir);
142
+ let dirStat;
143
+ try {
144
+ dirStat = await stat(dir);
145
+ } catch (err) {
146
+ const code = (err as NodeJS.ErrnoException)?.code;
147
+ throw new Error(
148
+ `siteDir does not exist (${code ?? "unknown"}): ${dir}`,
149
+ );
150
+ }
151
+ if (!dirStat.isDirectory()) {
152
+ throw new Error(`siteDir is not a directory: ${dir}`);
153
+ }
154
+ const indexPath = resolvePath(dir, "llms.txt");
155
+ const fullPath = resolvePath(dir, "llms-full.txt");
156
+ await writeFile(indexPath, llmsTxt, "utf-8");
157
+ await writeFile(fullPath, llmsFullTxt, "utf-8");
158
+ writtenPaths = { index: indexPath, full: fullPath };
159
+ process.stderr.write(
160
+ `[aeo-llms-txt] wrote site=${dir} indexBytes=${sizeBytes.index} fullBytes=${sizeBytes.full}\n`,
161
+ );
162
+ }
163
+
164
+ return {
165
+ llmsTxt,
166
+ llmsFullTxt,
167
+ pageCount: rows.length,
168
+ skippedNoUrl,
169
+ sizeBytes,
170
+ writtenPaths,
171
+ };
172
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src"
6
+ },
7
+ "include": ["src"]
8
+ }
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Shared palette + display-string primitives for any surface that renders
3
+ * the Neo4j graph. Both the live `/graph` page in platform/ui and the
4
+ * graph-viewer MCP plugin's PNG renderer import from here so a node looks
5
+ * the same wherever it appears: same colour family per label, same short
6
+ * canvas label per node.
7
+ *
8
+ * UI-only constants (filter-popover sets, zoom-tier wrap helpers,
9
+ * agent-action label sets) stay in platform/ui/app/lib/graph-labels.ts and
10
+ * platform/ui/app/graph/display-helpers.ts — they re-export the symbols
11
+ * defined here. The two parity tests (this lib's __tests__ and the UI's
12
+ * unchanged colour-stability tests) keep the surfaces in lockstep.
13
+ *
14
+ * Sources of truth:
15
+ * - Label list: .docs/neo4j.md "Schema (Phase 0)" + "Standards Compliance"
16
+ * - Brand colour for LocalBusiness: brand.json defaultColors.primary
17
+ * (resolved at runtime; this module supplies the schema-default fallback)
18
+ */
19
+ /**
20
+ * Label → display colour mapping. Closed list of node labels written by
21
+ * the Maxy MCP write paths. A new label without an entry here renders in
22
+ * FALLBACK_LABEL_COLOUR and is omitted from the legend.
23
+ */
24
+ export declare const GRAPH_LABEL_COLOURS: Record<string, string>;
25
+ export declare const FALLBACK_LABEL_COLOUR = "#94A3B8";
26
+ export declare const ALL_GRAPH_LABELS: readonly string[];
27
+ /**
28
+ * Select the sublabel whose colour should drive the node hue. Walks the
29
+ * label array from index 1 (skipping the base label at index 0) and
30
+ * returns the first sublabel that has a registered colour; falls back to
31
+ * labels[0]. Pure — drift-counting lives in resolveNodeColour.
32
+ */
33
+ export declare function pickDisplayLabel(labels: readonly string[]): string | null;
34
+ export declare function colourForLabel(label: string): string;
35
+ export interface ResolvedNodeColour {
36
+ displayLabel: string | null;
37
+ colour: string;
38
+ driftCandidates: number;
39
+ }
40
+ /**
41
+ * Single-source colour resolver. driftCandidates counts registered
42
+ * sublabels in labels[1..]; a node with two registered sublabels has
43
+ * driftCandidates = 2 and its rendered hue is order-dependent.
44
+ */
45
+ export declare function resolveNodeColour(labels: readonly string[]): ResolvedNodeColour;
46
+ /**
47
+ * Structural type used by display-string helpers. Mirrors the shape of
48
+ * GraphNode without coupling to it.
49
+ */
50
+ export interface GraphNodeLike {
51
+ id: string;
52
+ labels: string[];
53
+ properties: Record<string, unknown>;
54
+ }
55
+ /**
56
+ * YYYY-MM-DD HH:mm from an ISO 8601 prefix. Reads the prefix directly so
57
+ * timezone-stored UTC timestamps render identically across operator
58
+ * timezones; parsing to Date + reformatting would flip the day.
59
+ */
60
+ export declare function formatRunTimestamp(iso: string): string | null;
61
+ /** HH:mm:ss from an ISO 8601 prefix. Same tz-stable contract. */
62
+ export declare function formatMessageTimestamp(iso: string): string | null;
63
+ /**
64
+ * 24-char canvas label for a node. Label precedence per label family
65
+ * (ToolCall.toolName, WorkflowRun startedAt formatted, WorkflowStep.label,
66
+ * Person givenName+familyName compose, Agent displayName/slug, Message
67
+ * role+timestamp, ConversationArchive.title), then a generic fallthrough
68
+ * across curated keys (name, title, summary, givenName, subject, text),
69
+ * then a Conversation-specific `Conv <id8>` fallback so unpopulated
70
+ * conversations don't render as the literal label.
71
+ */
72
+ export declare function pickShortLabel(node: GraphNodeLike): string;
73
+ /**
74
+ * Untruncated sibling of pickShortLabel. Used by side-panel headings and
75
+ * tooltips where the 24-char canvas-overlap cap does not apply.
76
+ */
77
+ export declare function pickDisplayName(node: GraphNodeLike): string;
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;A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