@plebeiantech/lat.md 0.12.3-fork.15 → 0.12.3-fork.17
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/README.md +1 -1
- package/dist/src/cli/checklist-menu.d.ts +2 -1
- package/dist/src/cli/checklist-menu.js +3 -2
- package/dist/src/cli/index.js +59 -16
- package/dist/src/cli/init-preferences.d.ts +4 -0
- package/dist/src/cli/init-preferences.js +35 -0
- package/dist/src/cli/init.js +10 -5
- package/dist/src/cli/reindex.js +4 -8
- package/dist/src/cli/search.d.ts +3 -2
- package/dist/src/cli/search.js +71 -66
- package/dist/src/cli/ui-build-server.d.ts +12 -0
- package/dist/src/cli/ui-build-server.js +26 -0
- package/dist/src/cli/ui-build.js +1 -1
- package/dist/src/cli/ui.js +1 -1
- package/dist/src/format.d.ts +5 -0
- package/dist/src/format.js +32 -4
- package/dist/src/lattice-model.d.ts +8 -1
- package/dist/src/lattice-model.js +4 -1
- package/dist/src/lattice.d.ts +2 -2
- package/dist/src/lattice.js +17 -34
- package/dist/src/markdown-analysis.d.ts +11 -0
- package/dist/src/markdown-analysis.js +31 -1
- package/dist/src/mcp/server.js +6 -6
- package/dist/src/parser-cache.d.ts +1 -1
- package/dist/src/parser-cache.js +1 -1
- package/dist/src/search/cache.d.ts +3 -0
- package/dist/src/search/cache.js +71 -0
- package/dist/src/search/chunks.d.ts +23 -0
- package/dist/src/search/chunks.js +197 -0
- package/dist/src/search/db.d.ts +27 -16
- package/dist/src/search/db.js +108 -38
- package/dist/src/search/index.d.ts +5 -2
- package/dist/src/search/index.js +173 -69
- package/dist/src/search/lexical.d.ts +6 -0
- package/dist/src/search/lexical.js +36 -0
- package/dist/src/search/lock.d.ts +2 -0
- package/dist/src/search/lock.js +23 -0
- package/dist/src/search/query.d.ts +6 -3
- package/dist/src/search/query.js +45 -26
- package/dist/src/search/search.d.ts +13 -8
- package/dist/src/search/search.js +155 -23
- package/dist/src/search/types.d.ts +31 -0
- package/dist/src/search/types.js +1 -0
- package/dist/src/source-formats.d.ts +1 -1
- package/dist/src/source-formats.js +4 -0
- package/dist/src/source-parser.js +397 -1
- package/dist/src/view/client/assets/GraphView-BWlRdQM4.js +456 -0
- package/dist/src/view/client/assets/{MarkdownEditor-B7quqPb8.js → MarkdownEditor-MW-Ck1O0.js} +8 -8
- package/dist/src/view/client/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-Bn3RshMV.js +1 -0
- package/dist/src/view/client/assets/{arc-BnwR8Bu7.js → arc-En9tdFQF.js} +1 -1
- package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-B-9J1VAM.js +36 -0
- package/dist/src/view/client/assets/{blockDiagram-I7D4REHJ-DETl8e_H.js → blockDiagram-I7D4REHJ-QlznwalP.js} +2 -2
- package/dist/src/view/client/assets/{c4Diagram-7LVT6UL2-DJRAT1Ve.js → c4Diagram-7LVT6UL2-Bp2y8B4_.js} +2 -2
- package/dist/src/view/client/assets/channel-uy0fFvcW.js +1 -0
- package/dist/src/view/client/assets/{chunk-2Q5K7J3B-C0TmOC1Q.js → chunk-2Q5K7J3B-CnBKL-lm.js} +1 -1
- package/dist/src/view/client/assets/{chunk-5VM5RSS4-dfBOrYE6.js → chunk-5VM5RSS4-LLYMi_n6.js} +1 -1
- package/dist/src/view/client/assets/{chunk-F27PBJKO-DAnks99K.js → chunk-F27PBJKO-VIeO7VF0.js} +1 -1
- package/dist/src/view/client/assets/{chunk-IMKFNOWR-CPjB07if.js → chunk-IMKFNOWR-D5i67DVD.js} +1 -1
- package/dist/src/view/client/assets/{chunk-JWPE2WC7-VvU_gZI6.js → chunk-JWPE2WC7-D4qAtoL3.js} +1 -1
- package/dist/src/view/client/assets/{chunk-POPQ4Y6H-DDUbVF55.js → chunk-POPQ4Y6H-BMzOyiW_.js} +1 -1
- package/dist/src/view/client/assets/{chunk-SVP7TREG-BHROkr6D.js → chunk-SVP7TREG-DWy5nbfp.js} +1 -1
- package/dist/src/view/client/assets/{chunk-TICWLB2K-95PzGIOg.js → chunk-TICWLB2K-CVqCANFB.js} +1 -1
- package/dist/src/view/client/assets/{chunk-XXDRQBXY-MdmuLhIs.js → chunk-XXDRQBXY-Bp23h6Tf.js} +1 -1
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-DbSEqjA5.js +1 -0
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-DbSEqjA5.js +1 -0
- package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-BCw7fCC2.js +1 -0
- package/dist/src/view/client/assets/{cynefin-OW5HDTMX-CeA8IKWo.js → cynefin-OW5HDTMX--lYN4N9m.js} +1 -1
- package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-9sK5EV7v.js +62 -0
- package/dist/src/view/client/assets/{dagre-GXQ25YYZ-DLQwTa3H.js → dagre-GXQ25YYZ-CoMdEFCq.js} +2 -2
- package/dist/src/view/client/assets/{diagram-S7CK7UJ4-kbKdIyXG.js → diagram-S7CK7UJ4-D13dyWdd.js} +2 -2
- package/dist/src/view/client/assets/diagram-UQ7AKVKN-PdwLPPPA.js +41 -0
- package/dist/src/view/client/assets/{diagram-VSXAHHWV-EXJTU8qq.js → diagram-VSXAHHWV-CtWWa_A7.js} +2 -2
- package/dist/src/view/client/assets/diagram-VX7I27RA-BeCYcSU-.js +24 -0
- package/dist/src/view/client/assets/diagram-Z3DM3KII-DiWabOBM.js +24 -0
- package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-CZQ3MD_K.js +1 -0
- package/dist/src/view/client/assets/{erDiagram-RLTQ6QDP-C925J5A3.js → erDiagram-RLTQ6QDP-B1AhXIrP.js} +2 -2
- package/dist/src/view/client/assets/{flowDiagram-HODETNUW-DzoCa-Nq.js → flowDiagram-HODETNUW-Bhr0JM6P.js} +1 -1
- package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-CbP8iAkg.js +292 -0
- package/dist/src/view/client/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/src/view/client/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/src/view/client/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/src/view/client/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/src/view/client/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/src/view/client/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-B9uuGdLF.js +106 -0
- package/dist/src/view/client/assets/index-DG0Ez15D.css +1 -0
- package/dist/src/view/client/assets/index-nBmbYfun.js +13 -0
- package/dist/src/view/client/assets/infoDiagram-27XIBGKW-BrfwQ_Cq.js +2 -0
- package/dist/src/view/client/assets/{ishikawaDiagram-5VMMS53U-CW4mto2d.js → ishikawaDiagram-5VMMS53U-CHtJ36re.js} +2 -2
- package/dist/src/view/client/assets/{journeyDiagram-3NMN7TZE-8R4eacFW.js → journeyDiagram-3NMN7TZE-BChcgX1s.js} +2 -2
- package/dist/src/view/client/assets/{kanban-definition-UXKFOSKX-Cy9ioXEJ.js → kanban-definition-UXKFOSKX-BnwFsKiB.js} +6 -6
- package/dist/src/view/client/assets/{layout-C0MFuhth.js → layout-Dnd0pLdb.js} +1 -1
- package/dist/src/view/client/assets/{linear-Dv3N4dQR.js → linear-CFhW2ozn.js} +1 -1
- package/dist/src/view/client/assets/{maplibre-gl-DnqZgfUS.js → maplibre-gl-CDX6Zuow.js} +1 -1
- package/dist/src/view/client/assets/{mermaid.core-bds9A7e2.js → mermaid.core--OP6lXtW.js} +11 -11
- package/dist/src/view/client/assets/{mindmap-definition-YA3MSWOX-DjmGW355.js → mindmap-definition-YA3MSWOX-D51y2zbm.js} +2 -2
- package/dist/src/view/client/assets/pegDiagram-XKGWAZYB--zyQJDvI.js +1 -0
- package/dist/src/view/client/assets/{pieDiagram-E7YTZNPT-CCH2gGR-.js → pieDiagram-E7YTZNPT-Cj8mvpJy.js} +2 -2
- package/dist/src/view/client/assets/{quadrantDiagram-AXDQQJYC-CjocPJFz.js → quadrantDiagram-AXDQQJYC-qvhJrnBf.js} +4 -4
- package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-CtWvxpSo.js +1 -0
- package/dist/src/view/client/assets/{requirementDiagram-BXWQKSXE-Ct6AoXRr.js → requirementDiagram-BXWQKSXE-CBxen_KG.js} +2 -2
- package/dist/src/view/client/assets/{sankeyDiagram-P5KCCOFB-CIpgGN_w.js → sankeyDiagram-P5KCCOFB-B_fUkmfc.js} +2 -2
- package/dist/src/view/client/assets/{sequenceDiagram-WJ2MYXX4-DrmLFj6w.js → sequenceDiagram-WJ2MYXX4-Dclv4p68.js} +2 -2
- package/dist/src/view/client/assets/sizeCapture-INFHLROL-GfG0sMTZ.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-D77RDMKH-YQWPnzxU.js +1 -0
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-gUj6Hzgl.js +1 -0
- package/dist/src/view/client/assets/swimlanes-42K2YHIH-5yiCveVS.js +1 -0
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-DR7JhrxL.js +8 -0
- package/dist/src/view/client/assets/{timeline-definition-24CTP7MA-BExPu6X5.js → timeline-definition-24CTP7MA-BvAbB5Zs.js} +2 -2
- package/dist/src/view/client/assets/{vennDiagram-4TSXK5OY-PC1MU3si.js → vennDiagram-4TSXK5OY-guC-r60n.js} +2 -2
- package/dist/src/view/client/assets/{wardleyDiagram-VM6X3IG4-DNWqU3fa.js → wardleyDiagram-VM6X3IG4-C0yXcU2x.js} +2 -2
- package/dist/src/view/client/assets/{xychartDiagram-S5SC5T6Z-E1uA28_D.js → xychartDiagram-S5SC5T6Z-RPmkPNfK.js} +2 -2
- package/dist/src/view/client/index.html +2 -2
- package/dist/src/view/document-route.d.ts +2 -0
- package/dist/src/view/document-route.js +40 -7
- package/dist/src/view/graph.d.ts +2 -2
- package/dist/src/view/graph.js +7 -3
- package/dist/src/view/highlight.js +207 -203
- package/dist/src/view/markdown.js +19 -0
- package/dist/src/view/preindexed-search.d.ts +15 -0
- package/dist/src/view/preindexed-search.js +25 -0
- package/dist/src/view/protocol.d.ts +10 -1
- package/dist/src/view/references.js +6 -7
- package/dist/src/view/repository.js +10 -2
- package/dist/src/view/search-result.d.ts +4 -0
- package/dist/src/view/search-result.js +25 -0
- package/dist/src/view/search.d.ts +7 -2
- package/dist/src/view/search.js +23 -30
- package/dist/src/view/server-build.d.ts +21 -0
- package/dist/src/view/server-build.js +145 -0
- package/dist/src/view/server-deployment.d.ts +32 -0
- package/dist/src/view/server-deployment.js +134 -0
- package/dist/src/view/server-index-worker.d.ts +6 -0
- package/dist/src/view/server-index-worker.js +14 -0
- package/dist/src/view/server.js +25 -7
- package/dist/src/view/source-target.d.ts +2 -0
- package/dist/src/view/source-target.js +24 -0
- package/dist/src/view/static-build.d.ts +16 -1
- package/dist/src/view/static-build.js +187 -89
- package/dist/src/view/static-protocol.d.ts +7 -0
- package/dist/src/view/static-protocol.js +5 -0
- package/dist/src/view/store.js +17 -7
- package/dist/src/view/vercel-build.d.ts +24 -0
- package/dist/src/view/vercel-build.js +140 -0
- package/dist/src/view/vercel-server-build.d.ts +10 -0
- package/dist/src/view/vercel-server-build.js +61 -0
- package/dist/vendor/lat.md-server/index.d.ts +1 -1
- package/dist/vendor/lat.md-server/index.js +1 -1
- package/package.json +20 -5
- package/templates/AGENTS.md +1 -1
- package/templates/cursor-rules.md +1 -1
- package/templates/skill/SKILL.md +1 -1
- package/dist/src/view/client/assets/abnfDiagram-VCTEODGH-V7-T6qsl.js +0 -1
- package/dist/src/view/client/assets/architectureDiagram-5GKGNRK7-u97vDna9.js +0 -36
- package/dist/src/view/client/assets/channel-BwQbnWCN.js +0 -1
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-HvQKkIS-.js +0 -1
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-HvQKkIS-.js +0 -1
- package/dist/src/view/client/assets/cose-bilkent-JH36ORCC-CauUf_rN.js +0 -1
- package/dist/src/view/client/assets/cynefinDiagram-5FMLGOSQ-L1rtcT8l.js +0 -62
- package/dist/src/view/client/assets/diagram-UQ7AKVKN-kmzp92RC.js +0 -41
- package/dist/src/view/client/assets/diagram-VX7I27RA-DAiIyMCG.js +0 -24
- package/dist/src/view/client/assets/diagram-Z3DM3KII-G9wz50ZV.js +0 -24
- package/dist/src/view/client/assets/ebnfDiagram-PWID7BFC-D2tVRCNA.js +0 -1
- package/dist/src/view/client/assets/ganttDiagram-EL5Y4UJY-D2ebbg4p.js +0 -292
- package/dist/src/view/client/assets/gitGraphDiagram-WWUBYQGX-B4QratYy.js +0 -106
- package/dist/src/view/client/assets/index-D0ajr_Ja.css +0 -1
- package/dist/src/view/client/assets/index-KZcnpXJH.js +0 -321
- package/dist/src/view/client/assets/infoDiagram-27XIBGKW-DL4mtHkt.js +0 -2
- package/dist/src/view/client/assets/pegDiagram-XKGWAZYB-BWsZp0ab.js +0 -1
- package/dist/src/view/client/assets/railroadDiagram-O6MQD6OU-BjLeb2KF.js +0 -1
- package/dist/src/view/client/assets/sizeCapture-INFHLROL-BdFMe2Lr.js +0 -1
- package/dist/src/view/client/assets/stateDiagram-D77RDMKH-Zd9F1goW.js +0 -1
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-ByIKCftl.js +0 -1
- package/dist/src/view/client/assets/swimlanes-42K2YHIH-a7VFwi00.js +0 -1
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-CzxaUHB-.js +0 -8
- /package/dist/src/view/client/assets/{logo-small-RR_KBOAT.svg → logo-RR_KBOAT.svg} +0 -0
|
@@ -36,5 +36,12 @@ export type ViewStaticManifest = {
|
|
|
36
36
|
sources: Record<string, ViewStaticSourceEntry>;
|
|
37
37
|
externals: Record<string, ViewStaticExternalEntry>;
|
|
38
38
|
};
|
|
39
|
+
export type ViewStaticBootstrap = {
|
|
40
|
+
manifest: ViewStaticManifest;
|
|
41
|
+
responses: Record<string, object>;
|
|
42
|
+
};
|
|
43
|
+
export declare const VIEW_STATIC_BOOTSTRAP_ID = "lat-static-bootstrap";
|
|
44
|
+
/** Match the live document endpoint key used by the static browser adapter. */
|
|
45
|
+
export declare function viewStaticDocumentRequest(path: string): string;
|
|
39
46
|
/** Stable lookup key shared by the static exporter and browser adapter. */
|
|
40
47
|
export declare function viewStaticSourceKey(request: ViewStaticSourceRequest): string;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export const VIEW_STATIC_BOOTSTRAP_ID = 'lat-static-bootstrap';
|
|
2
|
+
/** Match the live document endpoint key used by the static browser adapter. */
|
|
3
|
+
export function viewStaticDocumentRequest(path) {
|
|
4
|
+
return `/api/document?path=${encodeURIComponent(path)}`;
|
|
5
|
+
}
|
|
1
6
|
/** Stable lookup key shared by the static exporter and browser adapter. */
|
|
2
7
|
export function viewStaticSourceKey(request) {
|
|
3
8
|
return JSON.stringify([
|
package/dist/src/view/store.js
CHANGED
|
@@ -18,7 +18,7 @@ import { emptyViewGitSnapshot, findViewGitRepository, readViewGitSnapshot, sameV
|
|
|
18
18
|
import { DEFAULT_VIEW_LOGO_TEXT } from './protocol.js';
|
|
19
19
|
import { createMarkdownWikiLinkResolver, getViewExternal, getViewSource, ViewDocumentNotFoundError, } from './repository.js';
|
|
20
20
|
import { buildViewReferenceIndex, renderSectionBackReferences, } from './references.js';
|
|
21
|
-
import {
|
|
21
|
+
import { rewriteLocalFileLink } from './source-target.js';
|
|
22
22
|
const DEFAULT_DEBOUNCE_MS = 75;
|
|
23
23
|
const DEFAULT_GIT_POLL_MS = 2_000;
|
|
24
24
|
const EXTERNAL_REFRESH_PATH = '@lat-external-refresh';
|
|
@@ -99,8 +99,8 @@ async function scanCodeState(projectRoot, excludedPaths = []) {
|
|
|
99
99
|
scope,
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function viewIndex(latDir,
|
|
103
|
-
const files = [...
|
|
102
|
+
function viewIndex(latDir, markdownFiles, diagnostics, git, references, external) {
|
|
103
|
+
const files = [...markdownFiles.keys()].sort();
|
|
104
104
|
const externalFiles = new Map();
|
|
105
105
|
for (const target of references.externalByTarget.keys()) {
|
|
106
106
|
try {
|
|
@@ -123,8 +123,18 @@ function viewIndex(latDir, paths, diagnostics, git, references, external) {
|
|
|
123
123
|
const indexName = directoryName.endsWith('.md')
|
|
124
124
|
? directoryName
|
|
125
125
|
: `${directoryName}.md`;
|
|
126
|
+
const directoryOrder = Object.fromEntries([...markdownFiles].flatMap(([path, file]) => {
|
|
127
|
+
const separator = path.lastIndexOf('/');
|
|
128
|
+
const directory = separator === -1 ? '' : path.slice(0, separator);
|
|
129
|
+
const name = directory ? basename(directory) : directoryName;
|
|
130
|
+
const filename = name.endsWith('.md') ? name : `${name}.md`;
|
|
131
|
+
if (path.slice(separator + 1) !== filename)
|
|
132
|
+
return [];
|
|
133
|
+
return [[directory, file.indexEntries]];
|
|
134
|
+
}));
|
|
126
135
|
return {
|
|
127
136
|
files,
|
|
137
|
+
directoryOrder,
|
|
128
138
|
externalFiles: [...externalFiles.values()].sort((left, right) => left.handle.localeCompare(right.handle) ||
|
|
129
139
|
left.path.localeCompare(right.path)),
|
|
130
140
|
entry: files.includes(indexName) ? indexName : (files[0] ?? ''),
|
|
@@ -162,10 +172,10 @@ async function buildSnapshot(latDir, projectRoot, markdownFiles, codeFiles, git,
|
|
|
162
172
|
files,
|
|
163
173
|
allSections,
|
|
164
174
|
references,
|
|
165
|
-
graph: buildViewGraph(files.values(), codeFiles.values(), allSections, diagnostics, git, generation, external),
|
|
175
|
+
graph: buildViewGraph(files.values(), codeFiles.values(), allSections, diagnostics, git, generation, references, external),
|
|
166
176
|
diagnostics,
|
|
167
177
|
git,
|
|
168
|
-
index: viewIndex(latDir,
|
|
178
|
+
index: viewIndex(latDir, files, diagnostics, git, references, external),
|
|
169
179
|
external,
|
|
170
180
|
};
|
|
171
181
|
}
|
|
@@ -277,7 +287,7 @@ export class ViewStore {
|
|
|
277
287
|
const resolver = await createMarkdownWikiLinkResolver(this.latDir, requestedPath, snapshot.allSections, snapshot.references, snapshot.external);
|
|
278
288
|
const rendered = await renderMarkdown(file.content, requestedPath, resolver, {
|
|
279
289
|
errors: [...(snapshot.diagnostics.get(requestedPath) ?? [])],
|
|
280
|
-
rewriteMarkdownLink: (url) =>
|
|
290
|
+
rewriteMarkdownLink: (url) => rewriteLocalFileLink(url, requestedPath),
|
|
281
291
|
});
|
|
282
292
|
const errors = [...(snapshot.diagnostics.get(requestedPath) ?? [])];
|
|
283
293
|
const gitFile = snapshot.git.files.get(requestedPath);
|
|
@@ -287,7 +297,7 @@ export class ViewStore {
|
|
|
287
297
|
const gitRendered = gitTree
|
|
288
298
|
? await renderMarkdown(file.content, requestedPath, resolver, {
|
|
289
299
|
errors,
|
|
290
|
-
rewriteMarkdownLink: (url) =>
|
|
300
|
+
rewriteMarkdownLink: (url) => rewriteLocalFileLink(url, requestedPath),
|
|
291
301
|
}, gitTree)
|
|
292
302
|
: null;
|
|
293
303
|
return {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type FileTraceResult = {
|
|
2
|
+
fileList: Set<string>;
|
|
3
|
+
warnings: Set<Error>;
|
|
4
|
+
};
|
|
5
|
+
export type VercelBuildDependencies = {
|
|
6
|
+
traceFiles: (files: string[], options: {
|
|
7
|
+
base: string;
|
|
8
|
+
conditions: string[];
|
|
9
|
+
exportsOnly: boolean;
|
|
10
|
+
processCwd: string;
|
|
11
|
+
}) => Promise<FileTraceResult>;
|
|
12
|
+
};
|
|
13
|
+
export type VercelBuildOptions = {
|
|
14
|
+
force?: boolean;
|
|
15
|
+
warn?: (message: string) => void;
|
|
16
|
+
};
|
|
17
|
+
export type VercelBuildResult = {
|
|
18
|
+
files: number;
|
|
19
|
+
functionPath: string;
|
|
20
|
+
outputDir: string;
|
|
21
|
+
};
|
|
22
|
+
/** Convert an installed portable Lat UI server into Vercel Build Output API v3. */
|
|
23
|
+
export declare function buildVercelOutput(requestedArtifact: string, requestedOutput?: string, options?: VercelBuildOptions, dependencies?: VercelBuildDependencies): Promise<VercelBuildResult>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { cp, lstat, mkdir, mkdtemp, readFile, rename, rm, writeFile, } from 'node:fs/promises';
|
|
2
|
+
import { dirname, isAbsolute, join, resolve, sep } from 'node:path';
|
|
3
|
+
import { nodeFileTrace } from '@vercel/nft';
|
|
4
|
+
import { LAT_UI_CONTENT_SECURITY_POLICY } from '../../vendor/lat.md-server/index.js';
|
|
5
|
+
import { INDEX_FILE, hasIndex } from '../search/db.js';
|
|
6
|
+
const defaultDependencies = {
|
|
7
|
+
traceFiles: nodeFileTrace,
|
|
8
|
+
};
|
|
9
|
+
function json(value) {
|
|
10
|
+
return `${JSON.stringify(value, null, 2)}\n`;
|
|
11
|
+
}
|
|
12
|
+
function basePathSegments(basePath) {
|
|
13
|
+
const parsed = new URL(basePath, 'http://lat.local');
|
|
14
|
+
if (parsed.origin !== 'http://lat.local' ||
|
|
15
|
+
parsed.search ||
|
|
16
|
+
parsed.hash ||
|
|
17
|
+
!basePath.startsWith('/')) {
|
|
18
|
+
throw new Error(`Invalid Lat UI server base path: ${basePath}`);
|
|
19
|
+
}
|
|
20
|
+
return parsed.pathname
|
|
21
|
+
.split('/')
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.map((part) => {
|
|
24
|
+
const decoded = decodeURIComponent(part);
|
|
25
|
+
if (decoded === '.' ||
|
|
26
|
+
decoded === '..' ||
|
|
27
|
+
decoded.includes('/') ||
|
|
28
|
+
decoded.includes('\\')) {
|
|
29
|
+
throw new Error(`Invalid Lat UI server base path: ${basePath}`);
|
|
30
|
+
}
|
|
31
|
+
return decoded;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function safeTracePath(path) {
|
|
35
|
+
if (isAbsolute(path) ||
|
|
36
|
+
path === '..' ||
|
|
37
|
+
path.startsWith(`..${sep}`) ||
|
|
38
|
+
path.split(/[\\/]/).includes('..')) {
|
|
39
|
+
throw new Error(`Node file trace escaped the server artifact: ${path}`);
|
|
40
|
+
}
|
|
41
|
+
return path;
|
|
42
|
+
}
|
|
43
|
+
function outputConfig() {
|
|
44
|
+
const securityHeaders = {
|
|
45
|
+
'Content-Security-Policy': LAT_UI_CONTENT_SECURITY_POLICY,
|
|
46
|
+
'Referrer-Policy': 'no-referrer',
|
|
47
|
+
'X-Content-Type-Options': 'nosniff',
|
|
48
|
+
};
|
|
49
|
+
const immutableHeaders = {
|
|
50
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
version: 3,
|
|
54
|
+
routes: [
|
|
55
|
+
{ src: '/(.*)', headers: securityHeaders, continue: true },
|
|
56
|
+
{
|
|
57
|
+
src: '/(?:.*?/)?assets/.*',
|
|
58
|
+
headers: immutableHeaders,
|
|
59
|
+
continue: true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
src: '/(?:.*?/)?data/[^/]+/[a-f0-9]{20}\\.json',
|
|
63
|
+
headers: immutableHeaders,
|
|
64
|
+
continue: true,
|
|
65
|
+
},
|
|
66
|
+
{ handle: 'filesystem' },
|
|
67
|
+
{ src: '/', dest: '/index.html' },
|
|
68
|
+
{ src: '/(.*)/', dest: '/$1/index.html' },
|
|
69
|
+
{ src: '/(.*)', dest: '/$1/index.html' },
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Convert an installed portable Lat UI server into Vercel Build Output API v3. */
|
|
74
|
+
export async function buildVercelOutput(requestedArtifact, requestedOutput = '.vercel/output', options = {}, dependencies = defaultDependencies) {
|
|
75
|
+
const artifactDir = resolve(requestedArtifact);
|
|
76
|
+
const outputDir = resolve(requestedOutput);
|
|
77
|
+
if (!options.force) {
|
|
78
|
+
try {
|
|
79
|
+
await lstat(outputDir);
|
|
80
|
+
throw new Error(`Vercel build output already exists: ${outputDir}. Use force to replace it.`);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
if (error.code !== 'ENOENT')
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const manifestFile = join(artifactDir, 'server-data', 'server.json');
|
|
88
|
+
const manifest = JSON.parse(await readFile(manifestFile, 'utf8'));
|
|
89
|
+
if (typeof manifest.basePath !== 'string') {
|
|
90
|
+
throw new Error(`Invalid Lat UI server manifest: ${manifestFile}`);
|
|
91
|
+
}
|
|
92
|
+
const entrypoint = join(artifactDir, 'app.mjs');
|
|
93
|
+
const trace = await dependencies.traceFiles([entrypoint], {
|
|
94
|
+
base: artifactDir,
|
|
95
|
+
conditions: ['node', 'production'],
|
|
96
|
+
exportsOnly: true,
|
|
97
|
+
processCwd: artifactDir,
|
|
98
|
+
});
|
|
99
|
+
for (const warning of trace.warnings) {
|
|
100
|
+
options.warn?.(`Node file trace: ${warning.message}`);
|
|
101
|
+
}
|
|
102
|
+
// Keep the database in the function even if tracing cannot infer the asset.
|
|
103
|
+
if (!hasIndex(join(artifactDir, 'server-data'))) {
|
|
104
|
+
throw new Error('Missing hybrid search database; rebuild this deployment.');
|
|
105
|
+
}
|
|
106
|
+
trace.fileList.add('server-data/server.json');
|
|
107
|
+
trace.fileList.add(`server-data/${INDEX_FILE}`);
|
|
108
|
+
await mkdir(dirname(outputDir), { recursive: true });
|
|
109
|
+
const stagingDir = await mkdtemp(join(dirname(outputDir), '.lat-vercel-staging-'));
|
|
110
|
+
try {
|
|
111
|
+
const staticDir = join(stagingDir, 'static');
|
|
112
|
+
const functionPath = join('functions', ...basePathSegments(manifest.basePath), 'api', 'search.func');
|
|
113
|
+
const functionDir = join(stagingDir, functionPath);
|
|
114
|
+
await cp(join(artifactDir, 'public'), staticDir, { recursive: true });
|
|
115
|
+
for (const traced of trace.fileList) {
|
|
116
|
+
const path = safeTracePath(traced);
|
|
117
|
+
const destination = join(functionDir, path);
|
|
118
|
+
await mkdir(dirname(destination), { recursive: true });
|
|
119
|
+
await cp(join(artifactDir, path), destination, {
|
|
120
|
+
dereference: true,
|
|
121
|
+
recursive: true,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
await writeFile(join(functionDir, '.vc-config.json'), json({
|
|
125
|
+
runtime: 'nodejs22.x',
|
|
126
|
+
handler: 'app.mjs',
|
|
127
|
+
launcherType: 'Nodejs',
|
|
128
|
+
shouldAddHelpers: true,
|
|
129
|
+
}));
|
|
130
|
+
await writeFile(join(stagingDir, 'config.json'), json(outputConfig()));
|
|
131
|
+
if (options.force)
|
|
132
|
+
await rm(outputDir, { recursive: true, force: true });
|
|
133
|
+
await rename(stagingDir, outputDir);
|
|
134
|
+
return { files: trace.fileList.size, functionPath, outputDir };
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
await rm(stagingDir, { recursive: true, force: true });
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CmdContext } from '../context.js';
|
|
2
|
+
import { buildServerView, type ServerViewBuildOptions, type ServerViewBuildResult } from './server-build.js';
|
|
3
|
+
import { type VercelBuildOptions, type VercelBuildResult } from './vercel-build.js';
|
|
4
|
+
export type VercelServerBuildDependencies = {
|
|
5
|
+
buildNode: typeof buildServerView;
|
|
6
|
+
buildOutput: (artifact: string, output: string, options: VercelBuildOptions) => Promise<VercelBuildResult>;
|
|
7
|
+
installDependencies: (artifact: string) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
/** Build the portable server in staging, install it, then emit Vercel v3 output. */
|
|
10
|
+
export declare function buildVercelServerView(ctx: CmdContext, requestedOutput: string, options?: ServerViewBuildOptions, dependencies?: VercelServerBuildDependencies): Promise<ServerViewBuildResult>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { mkdir, mkdtemp, rm } from 'node:fs/promises';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
|
+
import { buildServerView, } from './server-build.js';
|
|
5
|
+
import { validateViewBuildOutput } from './static-build.js';
|
|
6
|
+
import { buildVercelOutput, } from './vercel-build.js';
|
|
7
|
+
function installServerDependencies(artifact) {
|
|
8
|
+
const executable = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
9
|
+
const args = [
|
|
10
|
+
'install',
|
|
11
|
+
'--ignore-scripts',
|
|
12
|
+
'--no-package-lock',
|
|
13
|
+
'--omit=dev',
|
|
14
|
+
'--no-audit',
|
|
15
|
+
'--no-fund',
|
|
16
|
+
];
|
|
17
|
+
return new Promise((resolveInstall, reject) => {
|
|
18
|
+
const child = spawn(executable, args, { cwd: artifact, stdio: 'inherit' });
|
|
19
|
+
child.once('error', reject);
|
|
20
|
+
child.once('exit', (code, signal) => {
|
|
21
|
+
if (code === 0) {
|
|
22
|
+
resolveInstall();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
reject(new Error(`npm install failed${signal ? ` with signal ${signal}` : ` with exit code ${code}`}`));
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const defaultDependencies = {
|
|
30
|
+
buildNode: buildServerView,
|
|
31
|
+
buildOutput: buildVercelOutput,
|
|
32
|
+
installDependencies: installServerDependencies,
|
|
33
|
+
};
|
|
34
|
+
/** Build the portable server in staging, install it, then emit Vercel v3 output. */
|
|
35
|
+
export async function buildVercelServerView(ctx, requestedOutput, options = {}, dependencies = defaultDependencies) {
|
|
36
|
+
const outputDir = resolve(ctx.projectRoot, requestedOutput);
|
|
37
|
+
await validateViewBuildOutput(outputDir, ctx.projectRoot, 'Vercel', options.force);
|
|
38
|
+
await mkdir(dirname(outputDir), { recursive: true });
|
|
39
|
+
const stagingDir = await mkdtemp(join(dirname(outputDir), '.lat-vercel-server-'));
|
|
40
|
+
const nodeArtifact = join(stagingDir, 'node');
|
|
41
|
+
try {
|
|
42
|
+
const result = await dependencies.buildNode(ctx, nodeArtifact, {
|
|
43
|
+
...options,
|
|
44
|
+
force: false,
|
|
45
|
+
});
|
|
46
|
+
await dependencies.installDependencies(nodeArtifact);
|
|
47
|
+
await dependencies.buildOutput(nodeArtifact, outputDir, {
|
|
48
|
+
force: options.force,
|
|
49
|
+
warn: (message) => console.warn(message),
|
|
50
|
+
});
|
|
51
|
+
return { ...result, outputDir };
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
await rm(stagingDir, {
|
|
55
|
+
recursive: true,
|
|
56
|
+
force: true,
|
|
57
|
+
maxRetries: 10,
|
|
58
|
+
retryDelay: 150,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IncomingMessage, type RequestListener, type Server, type ServerResponse } from 'node:http';
|
|
2
2
|
import { type Express } from 'express';
|
|
3
|
-
export declare const LAT_UI_CONTENT_SECURITY_POLICY = "default-src 'self'; connect-src 'self' https://tiles.openfreemap.org; font-src 'self' data:; img-src 'self' data: https://github.githubassets.com; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'";
|
|
3
|
+
export declare const LAT_UI_CONTENT_SECURITY_POLICY = "default-src 'self'; connect-src 'self' https://tiles.openfreemap.org; font-src 'self' data:; img-src 'self' data: https://github.com https://github.githubassets.com https://img.shields.io; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'";
|
|
4
4
|
export type LatServerAppOptions = {
|
|
5
5
|
/** Handle dynamic routes before immutable files and fallback handlers. */
|
|
6
6
|
handle?: LatServerRequestHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServer, } from 'node:http';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
3
|
import express from 'express';
|
|
4
|
-
export const LAT_UI_CONTENT_SECURITY_POLICY = "default-src 'self'; connect-src 'self' https://tiles.openfreemap.org; font-src 'self' data:; img-src 'self' data: https://github.githubassets.com; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'";
|
|
4
|
+
export const LAT_UI_CONTENT_SECURITY_POLICY = "default-src 'self'; connect-src 'self' https://tiles.openfreemap.org; font-src 'self' data:; img-src 'self' data: https://github.com https://github.githubassets.com https://img.shields.io; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; object-src 'none'; base-uri 'none'; frame-ancestors 'none'";
|
|
5
5
|
function setSecurityHeaders(res) {
|
|
6
6
|
res.setHeader('Content-Security-Policy', LAT_UI_CONTENT_SECURITY_POLICY);
|
|
7
7
|
res.setHeader('Referrer-Policy', 'no-referrer');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plebeiantech/lat.md",
|
|
3
|
-
"version": "0.12.3-fork.
|
|
3
|
+
"version": "0.12.3-fork.17",
|
|
4
4
|
"description": "A knowledge graph for your codebase, written in markdown",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,6 +22,12 @@
|
|
|
22
22
|
"bin": {
|
|
23
23
|
"lat": "./dist/src/cli/index.js"
|
|
24
24
|
},
|
|
25
|
+
"exports": {
|
|
26
|
+
"./server": {
|
|
27
|
+
"types": "./dist/src/view/server-deployment.d.ts",
|
|
28
|
+
"import": "./dist/src/view/server-deployment.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
25
31
|
"files": [
|
|
26
32
|
"dist/src",
|
|
27
33
|
"dist/vendor",
|
|
@@ -35,9 +41,11 @@
|
|
|
35
41
|
"@codemirror/merge": "^6.12.2",
|
|
36
42
|
"@codemirror/state": "^6.7.1",
|
|
37
43
|
"@codemirror/view": "^6.43.9",
|
|
44
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
45
|
+
"@fontsource-variable/geist-mono": "^5.3.0",
|
|
38
46
|
"@lezer/highlight": "^1.2.3",
|
|
39
|
-
"@types/geojson": "^7946.0.16",
|
|
40
47
|
"@types/express": "^5.0.6",
|
|
48
|
+
"@types/geojson": "^7946.0.16",
|
|
41
49
|
"@types/hast": "^3.0.5",
|
|
42
50
|
"@types/mdast": "^4.0.4",
|
|
43
51
|
"@types/node": "^25.3.0",
|
|
@@ -74,9 +82,12 @@
|
|
|
74
82
|
"@libsql/client": "^0.17.0",
|
|
75
83
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
76
84
|
"@repomix/tree-sitter-wasms": "^0.1.17",
|
|
85
|
+
"@tursodatabase/database": "0.7.2",
|
|
86
|
+
"@vercel/nft": "^1.10.0",
|
|
77
87
|
"commander": "^14.0.3",
|
|
78
88
|
"diff": "^8.0.4",
|
|
79
89
|
"express": "^5.2.1",
|
|
90
|
+
"fs-native-extensions": "1.5.1",
|
|
80
91
|
"github-slugger": "^2.0.0",
|
|
81
92
|
"ignore-walk": "^8.0.0",
|
|
82
93
|
"mdast-util-gfm-autolink-literal": "^2.0.1",
|
|
@@ -106,17 +117,21 @@
|
|
|
106
117
|
"web-tree-sitter": "^0.26.6",
|
|
107
118
|
"yaml": "^2.8.2",
|
|
108
119
|
"zod": "^4.3.6",
|
|
109
|
-
"@lat.md/embed
|
|
110
|
-
"@lat.md/
|
|
120
|
+
"@lat.md/embed": "0.2.1",
|
|
121
|
+
"@lat.md/stemmer": "0.1.0",
|
|
122
|
+
"@lat.md/embed-minilm-fp16": "0.1.0"
|
|
111
123
|
},
|
|
112
124
|
"scripts": {
|
|
113
125
|
"build": "tsc && tsx scripts/fork-vendor-ui-server.ts && pnpm build:view",
|
|
114
126
|
"build:view": "vite build --config view/vite.config.ts && vite build --config view/highlight.vite.config.ts",
|
|
127
|
+
"build:site": "pnpm --filter @lat.md/server build && node scripts/prepare-site-packages.mjs && pnpm build && node dist/src/cli/index.js ui build server --force",
|
|
128
|
+
"build:site:vercel": "pnpm build:site && node scripts/vendor-site-packages.mjs && npm install --prefix .lat-build/server --ignore-scripts --no-package-lock && node scripts/build-vercel-output.mjs",
|
|
129
|
+
"build:site:source": "pnpm buildall && node dist/src/cli/index.js ui build server --force",
|
|
115
130
|
"buildall": "pnpm build:packages && pnpm build",
|
|
116
131
|
"setup:rust": "pnpm --filter @lat.md/embed setup:rust",
|
|
117
132
|
"build:wasm": "pnpm --filter @lat.md/embed build:wasm",
|
|
118
133
|
"build:weights": "pnpm --filter @lat.md/embed-minilm-fp16 build:weights",
|
|
119
|
-
"build:packages": "pnpm --filter @lat.md/server build && pnpm --filter @lat.md/embed build && pnpm --filter @lat.md/embed-minilm-fp16 build",
|
|
134
|
+
"build:packages": "pnpm --filter @lat.md/server build && pnpm --filter @lat.md/stemmer build && pnpm --filter @lat.md/embed build && pnpm --filter @lat.md/embed-minilm-fp16 build",
|
|
120
135
|
"test": "vitest run",
|
|
121
136
|
"test:watch": "vitest",
|
|
122
137
|
"typecheck": "pnpm --filter @lat.md/server build && tsc --noEmit && tsc --noEmit -p view/tsconfig.json",
|
package/templates/AGENTS.md
CHANGED
|
@@ -48,7 +48,7 @@ Lat uses stable section ids, wiki links, source links, and code references to co
|
|
|
48
48
|
- **Wiki links**: `[[target]]` or `[[target|alias]]` — cross-references between sections. Can also reference repository paths or source code: `[[schema.sql]]`, `[[src/components]]`, `[[src/foo.ts#myFunction]]`.
|
|
49
49
|
- **Repository path links**: Wiki links without a `#` fragment may target any existing file or directory inside the project. Unsupported formats validate but cannot be opened by Lat; fragments require a `lat.md/` section or supported source file.
|
|
50
50
|
- **Source code links**: Wiki links in `lat.md/` files can reference functions, classes, constants, and methods in supported source files. Use the full path: `[[src/config.ts#getConfigDir]]`, `[[src/server.ts#App#listen]]` (class method), `[[lib/utils.py#parse_args]]`, `[[src/lib.rs#Greeter#greet]]` (Rust impl method), `[[src/app.go#Greeter#Greet]]` (Go method), `[[src/app.h#Greeter]]` (C struct). When prose names an implementation symbol or a behavior governed by one, link the symbol instead of using a bare code span or copying its literal value. Prefer `[[src/config.ts#DEFAULT_TIMEOUT]]` (or an aliased form) over a bare identifier or copied value. `lat check` validates these exist.
|
|
51
|
-
- **Code refs**: `// @lat: [[section-id]]` (JS/TS/Rust/Go/C) or `# @lat: [[section-id]]` (Python) — ties source code to concepts
|
|
51
|
+
- **Code refs**: `// @lat: [[section-id]]` (JS/TS/Rust/Go/C/PHP) or `# @lat: [[section-id]]` (Python/PHP) — ties source code to concepts
|
|
52
52
|
|
|
53
53
|
# Test specs
|
|
54
54
|
|
|
@@ -43,7 +43,7 @@ Lat uses stable section ids, wiki links, source links, and code references to co
|
|
|
43
43
|
- **Wiki links**: `[[target]]` or `[[target|alias]]` — cross-references between sections. Can also reference repository paths or source code: `[[schema.sql]]`, `[[src/components]]`, `[[src/foo.ts#myFunction]]`.
|
|
44
44
|
- **Repository path links**: Wiki links without a `#` fragment may target any existing file or directory inside the project. Unsupported formats validate but cannot be opened by Lat; fragments require a `lat.md/` section or supported source file.
|
|
45
45
|
- **Source code links**: Wiki links in `lat.md/` files can reference functions, classes, constants, and methods in supported source files. Use the full path: `[[src/config.ts#getConfigDir]]`, `[[src/server.ts#App#listen]]` (class method), `[[lib/utils.py#parse_args]]`, `[[src/lib.rs#Greeter#greet]]` (Rust impl method), `[[src/app.go#Greeter#Greet]]` (Go method), `[[src/app.h#Greeter]]` (C struct). When prose names an implementation symbol or a behavior governed by one, link the symbol instead of using a bare code span or copying its literal value. Prefer `[[src/config.ts#DEFAULT_TIMEOUT]]` (or an aliased form) over a bare identifier or copied value. `lat check` validates these exist.
|
|
46
|
-
- **Code refs**: `// @lat: [[section-id]]` (JS/TS/Rust/Go/C) or `# @lat: [[section-id]]` (Python) — ties source code to concepts
|
|
46
|
+
- **Code refs**: `// @lat: [[section-id]]` (JS/TS/Rust/Go/C/PHP) or `# @lat: [[section-id]]` (Python/PHP) — ties source code to concepts
|
|
47
47
|
|
|
48
48
|
# Test specs
|
|
49
49
|
|
package/templates/skill/SKILL.md
CHANGED
|
@@ -131,7 +131,7 @@ def init():
|
|
|
131
131
|
...
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
Supported comment styles: `//` (JS/TS/Rust/Go/C) and `#` (Python).
|
|
134
|
+
Supported comment styles: `//` (JS/TS/Rust/Go/C/PHP) and `#` (Python/PHP).
|
|
135
135
|
|
|
136
136
|
Place one `@lat:` comment per section, at the relevant code — not at the top of the file.
|
|
137
137
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-BHROkr6D.js";import{p as f}from"./chunk-JWPE2WC7-VvU_gZI6.js";import{_ as n,l as o}from"./mermaid.core-bds9A7e2.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-CeA8IKWo.js";import"./index-KZcnpXJH.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|