@rubytech/create-maxy-code 0.1.118 → 0.1.119
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/package.json +1 -1
- package/payload/platform/neo4j/schema.cypher +2 -3
- package/payload/platform/package-lock.json +141 -125
- package/payload/platform/plugins/aeo/PLUGIN.md +1 -1
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/audit-heuristics.test.d.ts +2 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/audit-heuristics.test.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/audit-heuristics.test.js +121 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/audit-heuristics.test.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/schema-mapping.test.d.ts +2 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/schema-mapping.test.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/schema-mapping.test.js +129 -0
- package/payload/platform/plugins/aeo/mcp/dist/__tests__/schema-mapping.test.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/index.d.ts +2 -0
- package/payload/platform/plugins/aeo/mcp/dist/index.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/index.js +171 -0
- package/payload/platform/plugins/aeo/mcp/dist/index.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/audit-heuristics.d.ts +27 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/audit-heuristics.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/audit-heuristics.js +274 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/audit-heuristics.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/neo4j.d.ts +5 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/neo4j.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/neo4j.js +38 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/neo4j.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/schema-mapping.d.ts +48 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/schema-mapping.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/schema-mapping.js +254 -0
- package/payload/platform/plugins/aeo/mcp/dist/lib/schema-mapping.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-audit-page.d.ts +25 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-audit-page.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-audit-page.js +78 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-audit-page.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-emit-jsonld.d.ts +18 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-emit-jsonld.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-emit-jsonld.js +56 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-emit-jsonld.js.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.d.ts +37 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.d.ts.map +1 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.js +94 -0
- package/payload/platform/plugins/aeo/mcp/dist/tools/aeo-write-llms-txt.js.map +1 -0
- package/payload/platform/plugins/docs/references/aeo.md +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AuditResult } from "../lib/audit-heuristics.js";
|
|
2
|
+
export interface AuditPageInput {
|
|
3
|
+
accountId: string;
|
|
4
|
+
/** Provide one of `url` or `html`. */
|
|
5
|
+
url?: string;
|
|
6
|
+
html?: string;
|
|
7
|
+
/**
|
|
8
|
+
* When true, the audit result is persisted as an `:AEOAudit` node
|
|
9
|
+
* with `HAS_AEO_AUDIT` edge from `targetKnowledgeDocumentId` (if
|
|
10
|
+
* given) or the synthetic `targetUrl` audit history.
|
|
11
|
+
*/
|
|
12
|
+
persist?: boolean;
|
|
13
|
+
targetKnowledgeDocumentId?: string;
|
|
14
|
+
agentSlug?: string;
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface AuditPageResult extends AuditResult {
|
|
18
|
+
target: string;
|
|
19
|
+
audit: {
|
|
20
|
+
elementId?: string;
|
|
21
|
+
runAt: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare function auditPage(input: AuditPageInput): Promise<AuditPageResult>;
|
|
25
|
+
//# sourceMappingURL=aeo-audit-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeo-audit-page.d.ts","sourceRoot":"","sources":["../../src/tools/aeo-audit-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAeD,wBAAsB,SAAS,CAC7B,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC,CA2E1B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { auditHtml } from "../lib/audit-heuristics.js";
|
|
3
|
+
import { getSession } from "../lib/neo4j.js";
|
|
4
|
+
async function fetchHtml(url) {
|
|
5
|
+
const res = await fetch(url, {
|
|
6
|
+
redirect: "follow",
|
|
7
|
+
headers: { "User-Agent": "maxy-aeo-audit/0.1" },
|
|
8
|
+
});
|
|
9
|
+
if (!res.ok) {
|
|
10
|
+
throw new Error(`aeo-audit-page: GET ${url} returned HTTP ${res.status}`);
|
|
11
|
+
}
|
|
12
|
+
return await res.text();
|
|
13
|
+
}
|
|
14
|
+
export async function auditPage(input) {
|
|
15
|
+
if (!input.url && !input.html) {
|
|
16
|
+
throw new Error("aeo-audit-page requires one of url or html");
|
|
17
|
+
}
|
|
18
|
+
if (input.url && input.html) {
|
|
19
|
+
throw new Error("aeo-audit-page: pass exactly one of url or html, not both");
|
|
20
|
+
}
|
|
21
|
+
const html = input.html ?? (await fetchHtml(input.url));
|
|
22
|
+
const target = input.url ?? "(inline html)";
|
|
23
|
+
const result = auditHtml(html);
|
|
24
|
+
const runAt = new Date().toISOString();
|
|
25
|
+
const fails = result.heuristics
|
|
26
|
+
.filter((h) => h.status === "fail")
|
|
27
|
+
.map((h) => h.name);
|
|
28
|
+
const warns = result.heuristics
|
|
29
|
+
.filter((h) => h.status === "warn")
|
|
30
|
+
.map((h) => h.name);
|
|
31
|
+
process.stderr.write(`[aeo-audit] target=${target} score=${result.score} fails=${fails.join(",") || "-"} warns=${warns.join(",") || "-"}\n`);
|
|
32
|
+
let elementId;
|
|
33
|
+
if (input.persist) {
|
|
34
|
+
const auditId = randomUUID();
|
|
35
|
+
const session = getSession();
|
|
36
|
+
try {
|
|
37
|
+
const r = await session.run(`CREATE (a:AEOAudit {
|
|
38
|
+
accountId: $accountId,
|
|
39
|
+
auditId: $auditId,
|
|
40
|
+
target: $target,
|
|
41
|
+
score: $score,
|
|
42
|
+
heuristicsJson: $heuristicsJson,
|
|
43
|
+
runAt: $runAt,
|
|
44
|
+
createdByAgent: $agent,
|
|
45
|
+
createdBySession: $session,
|
|
46
|
+
createdAt: $runAt
|
|
47
|
+
})
|
|
48
|
+
WITH a
|
|
49
|
+
OPTIONAL MATCH (d:KnowledgeDocument)
|
|
50
|
+
WHERE elementId(d) = $kdocId AND d.accountId = $accountId
|
|
51
|
+
FOREACH (_ IN CASE WHEN d IS NULL THEN [] ELSE [1] END |
|
|
52
|
+
MERGE (d)-[:HAS_AEO_AUDIT]->(a)
|
|
53
|
+
)
|
|
54
|
+
RETURN elementId(a) AS id`, {
|
|
55
|
+
accountId: input.accountId,
|
|
56
|
+
auditId,
|
|
57
|
+
target,
|
|
58
|
+
score: result.score,
|
|
59
|
+
heuristicsJson: JSON.stringify(result.heuristics),
|
|
60
|
+
runAt,
|
|
61
|
+
agent: input.agentSlug ?? "system",
|
|
62
|
+
session: input.sessionId ?? null,
|
|
63
|
+
kdocId: input.targetKnowledgeDocumentId ?? null,
|
|
64
|
+
});
|
|
65
|
+
elementId = r.records[0]?.get("id");
|
|
66
|
+
process.stderr.write(`[aeo-audit] persisted auditId=${auditId} elementId=${elementId ?? "-"}\n`);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
await session.close();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
...result,
|
|
74
|
+
target,
|
|
75
|
+
audit: { elementId, runAt },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=aeo-audit-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeo-audit-page.js","sourceRoot":"","sources":["../../src/tools/aeo-audit-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAoB,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0B7C,KAAK,UAAU,SAAS,CAAC,GAAW;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IACH,CAAC;IAED,OAAO;QACL,GAAG,MAAM;QACT,MAAM;QACN,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MissingPropertyError, type JsonLdObject } from "../lib/schema-mapping.js";
|
|
2
|
+
export interface EmitJsonLdInput {
|
|
3
|
+
accountId: string;
|
|
4
|
+
/** Pull entity from the graph by Neo4j elementId. */
|
|
5
|
+
entityId?: string;
|
|
6
|
+
/** Or render a JSON-LD block from an inline label + property bag. */
|
|
7
|
+
label?: string;
|
|
8
|
+
properties?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface EmitJsonLdResult {
|
|
11
|
+
jsonLd: JsonLdObject;
|
|
12
|
+
scriptBlock: string;
|
|
13
|
+
schemaType: string;
|
|
14
|
+
source: "graph" | "inline";
|
|
15
|
+
}
|
|
16
|
+
export declare function emitJsonLd(input: EmitJsonLdInput): Promise<EmitJsonLdResult>;
|
|
17
|
+
export { MissingPropertyError };
|
|
18
|
+
//# sourceMappingURL=aeo-emit-jsonld.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeo-emit-jsonld.d.ts","sourceRoot":"","sources":["../../src/tools/aeo-emit-jsonld.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EACpB,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC5B;AAMD,wBAAsB,UAAU,CAC9B,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,gBAAgB,CAAC,CA8D3B;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getSession } from "../lib/neo4j.js";
|
|
2
|
+
import { buildJsonLd, renderJsonLdScript, MissingPropertyError, } from "../lib/schema-mapping.js";
|
|
3
|
+
function isPropertyBag(v) {
|
|
4
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
5
|
+
}
|
|
6
|
+
export async function emitJsonLd(input) {
|
|
7
|
+
if (!input.entityId && !input.label) {
|
|
8
|
+
throw new Error("aeo-emit-jsonld requires either entityId or label+properties");
|
|
9
|
+
}
|
|
10
|
+
if (input.entityId) {
|
|
11
|
+
const session = getSession();
|
|
12
|
+
try {
|
|
13
|
+
const r = await session.run(`MATCH (n) WHERE elementId(n) = $id AND n.accountId = $accountId
|
|
14
|
+
RETURN labels(n) AS labels, properties(n) AS props, elementId(n) AS id LIMIT 1`, { id: input.entityId, accountId: input.accountId });
|
|
15
|
+
if (r.records.length === 0) {
|
|
16
|
+
throw new Error(`aeo-emit-jsonld: no node with elementId=${input.entityId} in account=${input.accountId}`);
|
|
17
|
+
}
|
|
18
|
+
const rec = r.records[0];
|
|
19
|
+
const labels = rec.get("labels");
|
|
20
|
+
const props = rec.get("props");
|
|
21
|
+
const id = rec.get("id");
|
|
22
|
+
const primaryLabel = labels.find((l) => l !== "Resource") ?? labels[0];
|
|
23
|
+
const obj = buildJsonLd({
|
|
24
|
+
label: primaryLabel,
|
|
25
|
+
elementId: id,
|
|
26
|
+
properties: props,
|
|
27
|
+
});
|
|
28
|
+
process.stderr.write(`[aeo-emit-jsonld] entityId=${id} schemaType=${obj["@type"]} source=graph\n`);
|
|
29
|
+
return {
|
|
30
|
+
jsonLd: obj,
|
|
31
|
+
scriptBlock: renderJsonLdScript(obj),
|
|
32
|
+
schemaType: obj["@type"],
|
|
33
|
+
source: "graph",
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
await session.close();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!input.label || !isPropertyBag(input.properties)) {
|
|
41
|
+
throw new Error("aeo-emit-jsonld: label requires a properties object");
|
|
42
|
+
}
|
|
43
|
+
const obj = buildJsonLd({
|
|
44
|
+
label: input.label,
|
|
45
|
+
properties: input.properties,
|
|
46
|
+
});
|
|
47
|
+
process.stderr.write(`[aeo-emit-jsonld] label=${input.label} schemaType=${obj["@type"]} source=inline\n`);
|
|
48
|
+
return {
|
|
49
|
+
jsonLd: obj,
|
|
50
|
+
scriptBlock: renderJsonLdScript(obj),
|
|
51
|
+
schemaType: obj["@type"],
|
|
52
|
+
source: "inline",
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export { MissingPropertyError };
|
|
56
|
+
//# sourceMappingURL=aeo-emit-jsonld.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeo-emit-jsonld.js","sourceRoot":"","sources":["../../src/tools/aeo-emit-jsonld.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,0BAA0B,CAAC;AAkBlC,SAAS,aAAa,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,KAAsB;IAEtB,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,8DA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AC;gBACxB,MAAM,EAAE,OAAO;aAChB,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,qDAAqD,CACtD,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAAG,WAAW,CAAC;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC,CAAC;IACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,2BAA2B,KAAK,CAAC,KAAK,eAAe,GAAG,CAAC,OAAO,CAAC,kBAAkB,CACpF,CAAC;IACF,OAAO;QACL,MAAM,EAAE,GAAG;QACX,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC;QACpC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC;QACxB,MAAM,EAAE,QAAQ;KACjB,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates the `llms.txt` and `llms-full.txt` pair for an account's
|
|
3
|
+
* published content. Format follows the current llmstxt.org draft:
|
|
4
|
+
*
|
|
5
|
+
* # <Site name>
|
|
6
|
+
* > <Short description>
|
|
7
|
+
*
|
|
8
|
+
* ## <Section name>
|
|
9
|
+
* - [<Title>](<URL>): <Summary>
|
|
10
|
+
*
|
|
11
|
+
* `llms-full.txt` concatenates the full text of every listed page in
|
|
12
|
+
* the same order, separated by a blank line and the page's title as an
|
|
13
|
+
* H1.
|
|
14
|
+
*
|
|
15
|
+
* Source: `KnowledgeDocument` nodes for the account that have a `url`
|
|
16
|
+
* property. `summary` and `body` properties feed the index and the
|
|
17
|
+
* concatenated dump respectively. Pages without a `url` are skipped
|
|
18
|
+
* (they aren't reachable from a public site), and the count of skipped
|
|
19
|
+
* pages is returned so the operator can audit completeness.
|
|
20
|
+
*/
|
|
21
|
+
export interface WriteLlmsTxtInput {
|
|
22
|
+
accountId: string;
|
|
23
|
+
siteName: string;
|
|
24
|
+
siteDescription?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface WriteLlmsTxtResult {
|
|
27
|
+
llmsTxt: string;
|
|
28
|
+
llmsFullTxt: string;
|
|
29
|
+
pageCount: number;
|
|
30
|
+
skippedNoUrl: number;
|
|
31
|
+
sizeBytes: {
|
|
32
|
+
index: number;
|
|
33
|
+
full: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export declare function writeLlmsTxt(input: WriteLlmsTxtInput): Promise<WriteLlmsTxtResult>;
|
|
37
|
+
//# sourceMappingURL=aeo-write-llms-txt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeo-write-llms-txt.d.ts","sourceRoot":"","sources":["../../src/tools/aeo-write-llms-txt.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;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;CAC5C;AAqBD,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,kBAAkB,CAAC,CA4F7B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { getSession } from "../lib/neo4j.js";
|
|
2
|
+
const HEADER_RX = /^#\s/m;
|
|
3
|
+
function escapeMarkdown(text) {
|
|
4
|
+
return text.replace(/[\[\]\(\)\n\r]/g, " ").trim();
|
|
5
|
+
}
|
|
6
|
+
function summariseBody(body) {
|
|
7
|
+
const flat = body.replace(/\s+/g, " ").trim();
|
|
8
|
+
if (flat.length <= 200)
|
|
9
|
+
return flat;
|
|
10
|
+
return flat.slice(0, 197).trimEnd() + "…";
|
|
11
|
+
}
|
|
12
|
+
export async function writeLlmsTxt(input) {
|
|
13
|
+
const session = getSession();
|
|
14
|
+
let rows = [];
|
|
15
|
+
let skippedNoUrl = 0;
|
|
16
|
+
try {
|
|
17
|
+
const r = await session.run(`MATCH (d:KnowledgeDocument {accountId: $accountId})
|
|
18
|
+
RETURN d.title AS title, d.url AS url, d.summary AS summary,
|
|
19
|
+
coalesce(d.body, d.abstract, '') AS body
|
|
20
|
+
ORDER BY d.title ASC`, { accountId: input.accountId });
|
|
21
|
+
for (const rec of r.records) {
|
|
22
|
+
const title = rec.get("title") ?? "";
|
|
23
|
+
const url = rec.get("url") ?? "";
|
|
24
|
+
const summary = rec.get("summary") ?? "";
|
|
25
|
+
const body = rec.get("body") ?? "";
|
|
26
|
+
if (!url || !title) {
|
|
27
|
+
skippedNoUrl += 1;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
rows.push({
|
|
31
|
+
title: escapeMarkdown(title),
|
|
32
|
+
url: url.trim(),
|
|
33
|
+
summary: escapeMarkdown(summary) || summariseBody(body) || "(no summary)",
|
|
34
|
+
body: body.trim(),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
await session.close();
|
|
40
|
+
}
|
|
41
|
+
const indexLines = [];
|
|
42
|
+
indexLines.push(`# ${escapeMarkdown(input.siteName)}`);
|
|
43
|
+
indexLines.push("");
|
|
44
|
+
if (input.siteDescription) {
|
|
45
|
+
indexLines.push(`> ${escapeMarkdown(input.siteDescription)}`);
|
|
46
|
+
indexLines.push("");
|
|
47
|
+
}
|
|
48
|
+
indexLines.push("## Pages");
|
|
49
|
+
indexLines.push("");
|
|
50
|
+
for (const row of rows) {
|
|
51
|
+
indexLines.push(`- [${row.title}](${row.url}): ${row.summary}`);
|
|
52
|
+
}
|
|
53
|
+
indexLines.push("");
|
|
54
|
+
indexLines.push("<!-- generated by @maxy/aeo aeo-write-llms-txt; spec: https://llmstxt.org/ -->");
|
|
55
|
+
const llmsTxt = indexLines.join("\n");
|
|
56
|
+
const fullLines = [];
|
|
57
|
+
fullLines.push(`# ${escapeMarkdown(input.siteName)}`);
|
|
58
|
+
fullLines.push("");
|
|
59
|
+
if (input.siteDescription) {
|
|
60
|
+
fullLines.push(`> ${escapeMarkdown(input.siteDescription)}`);
|
|
61
|
+
fullLines.push("");
|
|
62
|
+
}
|
|
63
|
+
for (const row of rows) {
|
|
64
|
+
fullLines.push(`# ${row.title}`);
|
|
65
|
+
fullLines.push("");
|
|
66
|
+
fullLines.push(`Source: ${row.url}`);
|
|
67
|
+
fullLines.push("");
|
|
68
|
+
if (row.body) {
|
|
69
|
+
// Demote any in-body H1s to H2 so a single H1 hierarchy holds.
|
|
70
|
+
const safeBody = row.body.replace(HEADER_RX, "## ");
|
|
71
|
+
fullLines.push(safeBody);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
fullLines.push(row.summary);
|
|
75
|
+
}
|
|
76
|
+
fullLines.push("");
|
|
77
|
+
fullLines.push("---");
|
|
78
|
+
fullLines.push("");
|
|
79
|
+
}
|
|
80
|
+
const llmsFullTxt = fullLines.join("\n");
|
|
81
|
+
const sizeBytes = {
|
|
82
|
+
index: Buffer.byteLength(llmsTxt, "utf-8"),
|
|
83
|
+
full: Buffer.byteLength(llmsFullTxt, "utf-8"),
|
|
84
|
+
};
|
|
85
|
+
process.stderr.write(`[aeo-llms-txt] site=${input.siteName} pages=${rows.length} skippedNoUrl=${skippedNoUrl} indexBytes=${sizeBytes.index} fullBytes=${sizeBytes.full}\n`);
|
|
86
|
+
return {
|
|
87
|
+
llmsTxt,
|
|
88
|
+
llmsFullTxt,
|
|
89
|
+
pageCount: rows.length,
|
|
90
|
+
skippedNoUrl,
|
|
91
|
+
sizeBytes,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=aeo-write-llms-txt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeo-write-llms-txt.js","sourceRoot":"","sources":["../../src/tools/aeo-write-llms-txt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA4C7C,MAAM,SAAS,GAAG,OAAO,CAAC;AAE1B,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACrD,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAwB;IAExB,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,IAAI,IAAI,GAAc,EAAE,CAAC;IACzB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACzB;;;4BAGsB,EACtB,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAC/B,CAAC;QACF,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,EAAE,C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,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9B,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;IACD,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEzC,MAAM,SAAS,GAAG;QAChB,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC;QAC1C,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC;KAC9C,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uBAAuB,KAAK,CAAC,QAAQ,UAAU,IAAI,CAAC,MAAM,iBAAiB,YAAY,eAAe,SAAS,CAAC,KAAK,cAAc,SAAS,CAAC,IAAI,IAAI,CACtJ,CAAC;IAEF,OAAO;QACL,OAAO;QACP,WAAW;QACX,SAAS,EAAE,IAAI,CAAC,MAAM;QACtB,YAAY;QACZ,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -73,9 +73,9 @@ Every tool emits a single log line per invocation:
|
|
|
73
73
|
|
|
74
74
|
Diagnostic path: `grep -E '^\[aeo-' platform-logs/*.log | grep <urlOrEntityId>`.
|
|
75
75
|
|
|
76
|
-
## What this plugin does not do
|
|
76
|
+
## What this plugin does not do
|
|
77
77
|
|
|
78
|
-
- **No monitor.** Tracking whether your brand is cited by Claude / ChatGPT / Perplexity / Gemini
|
|
78
|
+
- **No citation monitor — out of scope.** Tracking whether your brand is cited by Claude / ChatGPT / Perplexity / Gemini would require multi-engine answer harvesting that doesn't fit maxy-code's no-API-key architecture. Archived without sprinting (Task 363). Check citation manually when needed.
|
|
79
79
|
- **No auto-emission on page render.** `aeo-emit-jsonld` is callable on demand. Wiring it into the platform's page-generator render path is per-renderer work, filed as a follow-up.
|
|
80
80
|
- **No publish-hook regeneration of `llms.txt`.** The tool runs on demand. Hooking it into the publish event is a follow-up.
|
|
81
81
|
|