@plebeiantech/lat.md 0.12.3-fork.17 → 0.12.3-fork.20
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/agent-invocation.d.ts +6 -0
- package/dist/src/cli/agent-invocation.js +23 -0
- package/dist/src/cli/fork-instructions.js +1 -1
- package/dist/src/cli/fork-scaffold.js +2 -2
- package/dist/src/cli/graph.d.ts +1 -1
- package/dist/src/cli/hook.js +11 -11
- package/dist/src/cli/index.js +41 -59
- package/dist/src/cli/init-preferences.js +5 -4
- package/dist/src/cli/init.d.ts +1 -1
- package/dist/src/cli/init.js +54 -45
- package/dist/src/cli/reindex.d.ts +1 -1
- package/dist/src/cli/reindex.js +2 -2
- package/dist/src/cli/search.d.ts +4 -4
- package/dist/src/cli/search.js +41 -28
- package/dist/src/cli/ui-build-server.d.ts +1 -1
- package/dist/src/cli/ui-build.d.ts +1 -1
- package/dist/src/cli/ui.d.ts +1 -1
- package/dist/src/fork/antigravity-hook.js +6 -6
- package/dist/src/fork/antigravity-init.d.ts +2 -2
- package/dist/src/fork/antigravity-init.js +2 -2
- package/dist/src/graph-export.js +7 -7
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/mcp/server.js +8 -8
- package/dist/src/search/cache.d.ts +1 -1
- package/dist/src/search/cache.js +40 -7
- package/dist/src/search/chunks.d.ts +2 -2
- package/dist/src/search/db.d.ts +5 -4
- package/dist/src/search/db.js +36 -40
- package/dist/src/search/embedder.js +1 -1
- package/dist/src/search/index.d.ts +1 -1
- package/dist/src/search/index.js +2 -2
- package/dist/src/search/lock.d.ts +4 -1
- package/dist/src/search/lock.js +30 -8
- package/dist/src/search/query.d.ts +5 -2
- package/dist/src/search/query.js +55 -38
- package/dist/src/search/search.d.ts +3 -1
- package/dist/src/search/search.js +21 -12
- package/dist/src/search/types.d.ts +2 -18
- package/dist/src/view/client/assets/{GraphView-BWlRdQM4.js → GraphView-Dij8mAA_.js} +1 -1
- package/dist/src/view/client/assets/{MarkdownEditor-MW-Ck1O0.js → MarkdownEditor-88Wbt0M1.js} +1 -1
- package/dist/src/view/client/assets/{abnfDiagram-VCTEODGH-Bn3RshMV.js → abnfDiagram-VCTEODGH-y0DlYa8E.js} +1 -1
- package/dist/src/view/client/assets/{arc-En9tdFQF.js → arc-FlMu8dnO.js} +1 -1
- package/dist/src/view/client/assets/{architectureDiagram-5GKGNRK7-B-9J1VAM.js → architectureDiagram-5GKGNRK7-DA_uWZW1.js} +1 -1
- package/dist/src/view/client/assets/{blockDiagram-I7D4REHJ-QlznwalP.js → blockDiagram-I7D4REHJ-BHQ5LU85.js} +1 -1
- package/dist/src/view/client/assets/{c4Diagram-7LVT6UL2-Bp2y8B4_.js → c4Diagram-7LVT6UL2-BRucKCt2.js} +1 -1
- package/dist/src/view/client/assets/channel-BgDNA_Ay.js +1 -0
- package/dist/src/view/client/assets/{chunk-2Q5K7J3B-CnBKL-lm.js → chunk-2Q5K7J3B-BJPcFivt.js} +1 -1
- package/dist/src/view/client/assets/{chunk-5VM5RSS4-LLYMi_n6.js → chunk-5VM5RSS4-v2q99bGz.js} +1 -1
- package/dist/src/view/client/assets/{chunk-F27PBJKO-VIeO7VF0.js → chunk-F27PBJKO-CcHOuJCs.js} +1 -1
- package/dist/src/view/client/assets/{chunk-IMKFNOWR-D5i67DVD.js → chunk-IMKFNOWR-DNxYuJNq.js} +1 -1
- package/dist/src/view/client/assets/{chunk-JWPE2WC7-D4qAtoL3.js → chunk-JWPE2WC7-C0eHKvLW.js} +1 -1
- package/dist/src/view/client/assets/{chunk-POPQ4Y6H-BMzOyiW_.js → chunk-POPQ4Y6H-57CWp2Ve.js} +1 -1
- package/dist/src/view/client/assets/{chunk-SVP7TREG-DWy5nbfp.js → chunk-SVP7TREG-BqcoxIJw.js} +1 -1
- package/dist/src/view/client/assets/{chunk-TICWLB2K-CVqCANFB.js → chunk-TICWLB2K-DRUJR5zH.js} +1 -1
- package/dist/src/view/client/assets/{chunk-XXDRQBXY-Bp23h6Tf.js → chunk-XXDRQBXY-Dez0oRoM.js} +1 -1
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-CFZ_Sgh5.js +1 -0
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-CFZ_Sgh5.js +1 -0
- package/dist/src/view/client/assets/{cose-bilkent-JH36ORCC-BCw7fCC2.js → cose-bilkent-JH36ORCC-BHtud6Hg.js} +1 -1
- package/dist/src/view/client/assets/{cynefin-OW5HDTMX--lYN4N9m.js → cynefin-OW5HDTMX-BjBW8VGk.js} +1 -1
- package/dist/src/view/client/assets/{cynefinDiagram-5FMLGOSQ-9sK5EV7v.js → cynefinDiagram-5FMLGOSQ-DwGuD7oF.js} +1 -1
- package/dist/src/view/client/assets/{dagre-GXQ25YYZ-CoMdEFCq.js → dagre-GXQ25YYZ-C5zSlGK9.js} +1 -1
- package/dist/src/view/client/assets/{diagram-S7CK7UJ4-D13dyWdd.js → diagram-S7CK7UJ4-C_NhA3bj.js} +1 -1
- package/dist/src/view/client/assets/{diagram-UQ7AKVKN-PdwLPPPA.js → diagram-UQ7AKVKN-az7QPYNb.js} +1 -1
- package/dist/src/view/client/assets/{diagram-VSXAHHWV-CtWWa_A7.js → diagram-VSXAHHWV-BRvDuM8_.js} +1 -1
- package/dist/src/view/client/assets/{diagram-VX7I27RA-BeCYcSU-.js → diagram-VX7I27RA-BWLgF6S-.js} +1 -1
- package/dist/src/view/client/assets/{diagram-Z3DM3KII-DiWabOBM.js → diagram-Z3DM3KII-DV3d6mL5.js} +1 -1
- package/dist/src/view/client/assets/{ebnfDiagram-PWID7BFC-CZQ3MD_K.js → ebnfDiagram-PWID7BFC-yUXrEAvK.js} +1 -1
- package/dist/src/view/client/assets/{erDiagram-RLTQ6QDP-B1AhXIrP.js → erDiagram-RLTQ6QDP-D35FN1Pt.js} +1 -1
- package/dist/src/view/client/assets/{flowDiagram-HODETNUW-Bhr0JM6P.js → flowDiagram-HODETNUW-BciZqsjT.js} +1 -1
- package/dist/src/view/client/assets/{ganttDiagram-EL5Y4UJY-CbP8iAkg.js → ganttDiagram-EL5Y4UJY-BysPGgXS.js} +1 -1
- package/dist/src/view/client/assets/{gitGraphDiagram-WWUBYQGX-B9uuGdLF.js → gitGraphDiagram-WWUBYQGX-C3DdJ5xG.js} +1 -1
- package/dist/src/view/client/assets/index-CJokoRSp.js +13 -0
- package/dist/src/view/client/assets/{infoDiagram-27XIBGKW-BrfwQ_Cq.js → infoDiagram-27XIBGKW-D3HZrDRb.js} +1 -1
- package/dist/src/view/client/assets/{ishikawaDiagram-5VMMS53U-CHtJ36re.js → ishikawaDiagram-5VMMS53U-BXyVIXTU.js} +1 -1
- package/dist/src/view/client/assets/{journeyDiagram-3NMN7TZE-BChcgX1s.js → journeyDiagram-3NMN7TZE-D4-1NxVU.js} +1 -1
- package/dist/src/view/client/assets/{kanban-definition-UXKFOSKX-BnwFsKiB.js → kanban-definition-UXKFOSKX-4Gu_5yBA.js} +1 -1
- package/dist/src/view/client/assets/{layout-Dnd0pLdb.js → layout-Jf1K3TMM.js} +1 -1
- package/dist/src/view/client/assets/{linear-CFhW2ozn.js → linear-DWfwzUT_.js} +1 -1
- package/dist/src/view/client/assets/{mermaid.core--OP6lXtW.js → mermaid.core-DMx_DAl8.js} +5 -5
- package/dist/src/view/client/assets/{mindmap-definition-YA3MSWOX-D51y2zbm.js → mindmap-definition-YA3MSWOX-8pxY_RWi.js} +1 -1
- package/dist/src/view/client/assets/{pegDiagram-XKGWAZYB--zyQJDvI.js → pegDiagram-XKGWAZYB-DNAw_O5t.js} +1 -1
- package/dist/src/view/client/assets/{pieDiagram-E7YTZNPT-Cj8mvpJy.js → pieDiagram-E7YTZNPT-uuvRCDkC.js} +1 -1
- package/dist/src/view/client/assets/{quadrantDiagram-AXDQQJYC-qvhJrnBf.js → quadrantDiagram-AXDQQJYC-BER2O4Aq.js} +1 -1
- package/dist/src/view/client/assets/{railroadDiagram-O6MQD6OU-CtWvxpSo.js → railroadDiagram-O6MQD6OU-CxEsJ_0n.js} +1 -1
- package/dist/src/view/client/assets/{requirementDiagram-BXWQKSXE-CBxen_KG.js → requirementDiagram-BXWQKSXE-yS9rspca.js} +1 -1
- package/dist/src/view/client/assets/{sankeyDiagram-P5KCCOFB-B_fUkmfc.js → sankeyDiagram-P5KCCOFB-Bqt70a2j.js} +1 -1
- package/dist/src/view/client/assets/{sequenceDiagram-WJ2MYXX4-Dclv4p68.js → sequenceDiagram-WJ2MYXX4-BvOOEJNr.js} +1 -1
- package/dist/src/view/client/assets/{sizeCapture-INFHLROL-GfG0sMTZ.js → sizeCapture-INFHLROL-CvO_Pjjo.js} +1 -1
- package/dist/src/view/client/assets/{stateDiagram-D77RDMKH-YQWPnzxU.js → stateDiagram-D77RDMKH-KLmVOZkq.js} +1 -1
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-KCS8Mdzu.js +1 -0
- package/dist/src/view/client/assets/{swimlanes-42K2YHIH-5yiCveVS.js → swimlanes-42K2YHIH-DC1r4_sq.js} +1 -1
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-B2TcAwis.js +8 -0
- package/dist/src/view/client/assets/{timeline-definition-24CTP7MA-BvAbB5Zs.js → timeline-definition-24CTP7MA-ChXLOuBL.js} +1 -1
- package/dist/src/view/client/assets/{vennDiagram-4TSXK5OY-guC-r60n.js → vennDiagram-4TSXK5OY-D9_h25-Y.js} +1 -1
- package/dist/src/view/client/assets/{wardleyDiagram-VM6X3IG4-C0yXcU2x.js → wardleyDiagram-VM6X3IG4-CsQJGGW0.js} +1 -1
- package/dist/src/view/client/assets/{xychartDiagram-S5SC5T6Z-RPmkPNfK.js → xychartDiagram-S5SC5T6Z-DGMuPMlm.js} +1 -1
- package/dist/src/view/client/index.html +1 -1
- package/dist/src/view/diagnostics.d.ts +2 -2
- package/dist/src/view/diagnostics.js +5 -5
- package/dist/src/view/external-document-tree.js +1 -1
- package/dist/src/view/git-diff.js +1 -1
- package/dist/src/view/git.js +1 -1
- package/dist/src/view/graph.d.ts +2 -2
- package/dist/src/view/graph.js +2 -2
- package/dist/src/view/markdown.js +1 -1
- package/dist/src/view/preindexed-search.d.ts +1 -1
- package/dist/src/view/protocol.d.ts +2 -18
- package/dist/src/view/publication.d.ts +2 -0
- package/dist/src/view/publication.js +78 -0
- package/dist/src/view/references.d.ts +3 -3
- package/dist/src/view/references.js +3 -3
- package/dist/src/view/repository.d.ts +6 -6
- package/dist/src/view/repository.js +28 -14
- package/dist/src/view/request-security.d.ts +5 -0
- package/dist/src/view/request-security.js +46 -0
- package/dist/src/view/search-result.d.ts +1 -1
- package/dist/src/view/search-result.js +1 -1
- package/dist/src/view/search.d.ts +1 -1
- package/dist/src/view/server-build.d.ts +2 -2
- package/dist/src/view/server-build.js +2 -2
- package/dist/src/view/server-deployment.d.ts +1 -2
- package/dist/src/view/server-deployment.js +6 -46
- package/dist/src/view/server-index-worker.d.ts +1 -1
- package/dist/src/view/server.d.ts +1 -1
- package/dist/src/view/server.js +13 -3
- package/dist/src/view/source-target.js +2 -2
- package/dist/src/view/static-build.d.ts +1 -1
- package/dist/src/view/static-build.js +49 -17
- package/dist/src/view/store.d.ts +4 -2
- package/dist/src/view/store.js +31 -19
- package/dist/src/view/table-of-contents.d.ts +1 -1
- package/dist/src/view/table-of-contents.js +1 -1
- package/dist/src/view/vercel-server-build.d.ts +1 -1
- package/package.json +19 -29
- package/templates/AGENTS.md +2 -2
- package/templates/cursor-rules.md +2 -2
- package/templates/opencode-plugin.ts +9 -9
- package/templates/pi-extension.ts +11 -11
- package/templates/skill/SKILL.md +2 -1
- package/dist/src/cli/check-context.d.ts +0 -56
- package/dist/src/cli/check-context.js +0 -215
- package/dist/src/cli/check-coverage.d.ts +0 -2
- package/dist/src/cli/check-coverage.js +0 -75
- package/dist/src/cli/check-frontmatter.d.ts +0 -12
- package/dist/src/cli/check-frontmatter.js +0 -44
- package/dist/src/cli/check-mode.d.ts +0 -21
- package/dist/src/cli/check-mode.js +0 -394
- package/dist/src/cli/check-status.d.ts +0 -74
- package/dist/src/cli/check-status.js +0 -217
- package/dist/src/cli/check.d.ts +0 -52
- package/dist/src/cli/check.js +0 -834
- package/dist/src/cli/context.d.ts +0 -11
- package/dist/src/cli/context.js +0 -58
- package/dist/src/cli/expand.d.ts +0 -7
- package/dist/src/cli/expand.js +0 -141
- package/dist/src/cli/external.d.ts +0 -11
- package/dist/src/cli/external.js +0 -185
- package/dist/src/cli/gen-index.d.ts +0 -45
- package/dist/src/cli/gen-index.js +0 -235
- package/dist/src/cli/link-scheme.d.ts +0 -54
- package/dist/src/cli/link-scheme.js +0 -101
- package/dist/src/cli/locate.d.ts +0 -2
- package/dist/src/cli/locate.js +0 -18
- package/dist/src/cli/refs.d.ts +0 -23
- package/dist/src/cli/refs.js +0 -274
- package/dist/src/cli/section.d.ts +0 -45
- package/dist/src/cli/section.js +0 -328
- package/dist/src/cli/select-menu.d.ts +0 -13
- package/dist/src/cli/select-menu.js +0 -100
- package/dist/src/code-refs.d.ts +0 -29
- package/dist/src/code-refs.js +0 -479
- package/dist/src/config.d.ts +0 -29
- package/dist/src/config.js +0 -83
- package/dist/src/context.d.ts +0 -26
- package/dist/src/context.js +0 -11
- package/dist/src/document-formats.d.ts +0 -7
- package/dist/src/document-formats.js +0 -39
- package/dist/src/extensions/alert-marker.d.ts +0 -25
- package/dist/src/extensions/alert-marker.js +0 -55
- package/dist/src/extensions/wiki-link/from-markdown.d.ts +0 -5
- package/dist/src/extensions/wiki-link/from-markdown.js +0 -34
- package/dist/src/extensions/wiki-link/index.d.ts +0 -4
- package/dist/src/extensions/wiki-link/index.js +0 -3
- package/dist/src/extensions/wiki-link/syntax.d.ts +0 -14
- package/dist/src/extensions/wiki-link/syntax.js +0 -121
- package/dist/src/extensions/wiki-link/to-markdown.d.ts +0 -5
- package/dist/src/extensions/wiki-link/to-markdown.js +0 -28
- package/dist/src/extensions/wiki-link/types.d.ts +0 -34
- package/dist/src/extensions/wiki-link/types.js +0 -1
- package/dist/src/external-documents.d.ts +0 -56
- package/dist/src/external-documents.js +0 -404
- package/dist/src/external-sources.d.ts +0 -136
- package/dist/src/external-sources.js +0 -1098
- package/dist/src/fork/frontmatter-fields.d.ts +0 -36
- package/dist/src/fork/frontmatter-fields.js +0 -23
- package/dist/src/format.d.ts +0 -16
- package/dist/src/format.js +0 -76
- package/dist/src/init-version.d.ts +0 -10
- package/dist/src/init-version.js +0 -49
- package/dist/src/lattice-model.d.ts +0 -84
- package/dist/src/lattice-model.js +0 -467
- package/dist/src/lattice.d.ts +0 -14
- package/dist/src/lattice.js +0 -353
- package/dist/src/markdown-analysis-cache.d.ts +0 -20
- package/dist/src/markdown-analysis-cache.js +0 -139
- package/dist/src/markdown-analysis-worker.d.ts +0 -16
- package/dist/src/markdown-analysis-worker.js +0 -33
- package/dist/src/markdown-analysis.d.ts +0 -61
- package/dist/src/markdown-analysis.js +0 -169
- package/dist/src/markdown-analyzer-loader.d.ts +0 -4
- package/dist/src/markdown-analyzer-loader.js +0 -13
- package/dist/src/markdown-validation.d.ts +0 -25
- package/dist/src/markdown-validation.js +0 -104
- package/dist/src/parser-cache.d.ts +0 -17
- package/dist/src/parser-cache.js +0 -65
- package/dist/src/parser-import.d.ts +0 -8
- package/dist/src/parser-import.js +0 -1
- package/dist/src/parser.d.ts +0 -3
- package/dist/src/parser.js +0 -93
- package/dist/src/path.d.ts +0 -2
- package/dist/src/path.js +0 -4
- package/dist/src/profiler.d.ts +0 -16
- package/dist/src/profiler.js +0 -81
- package/dist/src/project-analysis.d.ts +0 -59
- package/dist/src/project-analysis.js +0 -233
- package/dist/src/project-discovery.d.ts +0 -6
- package/dist/src/project-discovery.js +0 -30
- package/dist/src/repository-path.d.ts +0 -11
- package/dist/src/repository-path.js +0 -52
- package/dist/src/source-formats.d.ts +0 -7
- package/dist/src/source-formats.js +0 -30
- package/dist/src/source-parser.d.ts +0 -67
- package/dist/src/source-parser.js +0 -1749
- package/dist/src/untrusted.d.ts +0 -18
- package/dist/src/untrusted.js +0 -93
- package/dist/src/view/client/assets/channel-uy0fFvcW.js +0 -1
- package/dist/src/view/client/assets/classDiagram-ZZMXUADV-DbSEqjA5.js +0 -1
- package/dist/src/view/client/assets/classDiagram-v2-VYDZK3BY-DbSEqjA5.js +0 -1
- package/dist/src/view/client/assets/index-nBmbYfun.js +0 -13
- package/dist/src/view/client/assets/stateDiagram-v2-MP3YSRHH-gUj6Hzgl.js +0 -1
- package/dist/src/view/client/assets/swimlanesDiagram-VR7AAH4N-DR7JhrxL.js +0 -8
- package/dist/src/walk.d.ts +0 -20
- package/dist/src/walk.js +0 -121
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { flattenSections, } from '../lattice-model.js';
|
|
2
|
-
import { scanCodeRefs } from '../code-refs.js';
|
|
3
|
-
import { SourceParserRuntime, } from '../source-parser.js';
|
|
4
|
-
import { createExternalResolver, } from '../external-sources.js';
|
|
5
|
-
import { analyzeMarkdownProject, } from '../project-analysis.js';
|
|
6
|
-
import { analyzeMarkdownPath } from '../markdown-analysis-cache.js';
|
|
7
|
-
/** Lazy, command-scoped cache shared by every validator in one check run. */
|
|
8
|
-
export class CheckRunContext {
|
|
9
|
-
latticeDir;
|
|
10
|
-
projectRoot;
|
|
11
|
-
profile;
|
|
12
|
-
executor;
|
|
13
|
-
projectPromise;
|
|
14
|
-
codeRefsPromise;
|
|
15
|
-
externalResolverPromise;
|
|
16
|
-
reconciledExternalPromise;
|
|
17
|
-
sourceSymbolCacheCleared = false;
|
|
18
|
-
sourceParserRuntime = new SourceParserRuntime();
|
|
19
|
-
headingPromises = new Map();
|
|
20
|
-
externalContentPromises = new Map();
|
|
21
|
-
repositoryLinkErrorPromises = new Map();
|
|
22
|
-
auxiliaryFilePromises = new Map();
|
|
23
|
-
constructor(latticeDir, projectRoot, profile, executor = 'auto') {
|
|
24
|
-
this.latticeDir = latticeDir;
|
|
25
|
-
this.projectRoot = projectRoot;
|
|
26
|
-
this.profile = profile;
|
|
27
|
-
this.executor = executor;
|
|
28
|
-
}
|
|
29
|
-
time(label, work, detail) {
|
|
30
|
-
return this.profile ? this.profile.time(label, work, detail) : work();
|
|
31
|
-
}
|
|
32
|
-
timeSync(label, work, detail) {
|
|
33
|
-
return this.profile ? this.profile.timeSync(label, work, detail) : work();
|
|
34
|
-
}
|
|
35
|
-
recordAnalysis(analysis) {
|
|
36
|
-
if (!this.profile)
|
|
37
|
-
return;
|
|
38
|
-
const detail = analysis.path;
|
|
39
|
-
const timings = analysis.timings;
|
|
40
|
-
this.profile.record('read Markdown file', timings.readMs, detail);
|
|
41
|
-
this.profile.record('hash Markdown file', timings.hashMs, detail);
|
|
42
|
-
if (timings.cacheStatus !== 'disabled') {
|
|
43
|
-
this.profile.record('read parsed Markdown cache', timings.cacheReadMs, detail);
|
|
44
|
-
this.profile.record(`parsed Markdown cache ${timings.cacheStatus}`, 0);
|
|
45
|
-
}
|
|
46
|
-
if (timings.cacheStatus === 'hit')
|
|
47
|
-
return;
|
|
48
|
-
this.profile.record('parse Markdown AST', timings.parseMs, detail);
|
|
49
|
-
this.profile.record('extract Markdown sections', timings.sectionsMs, detail);
|
|
50
|
-
this.profile.record('extract wiki links', timings.refsMs, detail);
|
|
51
|
-
this.profile.record('extract relative links', timings.linksMs, detail);
|
|
52
|
-
this.profile.record('extract Markdown presentation facts', timings.paragraphsMs, detail);
|
|
53
|
-
this.profile.record('parse code-mention frontmatter', timings.frontmatterMs, detail);
|
|
54
|
-
this.profile.record('extract directory-index entries', timings.indexEntriesMs, detail);
|
|
55
|
-
this.profile.record('validate local Markdown facts', timings.diagnosticsMs, detail);
|
|
56
|
-
if (timings.cacheStatus === 'miss') {
|
|
57
|
-
this.profile.record('write parsed Markdown cache', timings.cacheWriteMs, detail);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
recordParserImport(event) {
|
|
61
|
-
if (!this.profile)
|
|
62
|
-
return;
|
|
63
|
-
this.profile.record(event.imported ? `import ${event.parser}` : `skip ${event.parser} import`, event.durationMs, event.detail);
|
|
64
|
-
}
|
|
65
|
-
recordSourceAnalysis(analysis) {
|
|
66
|
-
if (!this.profile)
|
|
67
|
-
return;
|
|
68
|
-
const detail = analysis.path;
|
|
69
|
-
const timings = analysis.timings;
|
|
70
|
-
this.profile.record('read source file', timings.readMs, detail);
|
|
71
|
-
this.profile.record('hash source file', timings.hashMs, detail);
|
|
72
|
-
if (timings.cacheStatus !== 'disabled') {
|
|
73
|
-
this.profile.record('read parsed source cache', timings.cacheReadMs, detail);
|
|
74
|
-
this.profile.record(`parsed source cache ${timings.cacheStatus}`, 0);
|
|
75
|
-
}
|
|
76
|
-
if (timings.cacheStatus === 'hit')
|
|
77
|
-
return;
|
|
78
|
-
this.profile.record('parse source symbols', timings.parseMs, detail);
|
|
79
|
-
if (timings.cacheStatus === 'miss') {
|
|
80
|
-
this.profile.record('write parsed source cache', timings.cacheWriteMs, detail);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
recordExternalDocumentAnalysis(analysis) {
|
|
84
|
-
if (!this.profile)
|
|
85
|
-
return;
|
|
86
|
-
const detail = analysis.path;
|
|
87
|
-
const timings = analysis.timings;
|
|
88
|
-
this.profile.record('hash external document', timings.hashMs, detail);
|
|
89
|
-
if (timings.cacheStatus !== 'disabled') {
|
|
90
|
-
this.profile.record('read parsed external document cache', timings.cacheReadMs, detail);
|
|
91
|
-
this.profile.record(`parsed external document cache ${timings.cacheStatus}`, 0);
|
|
92
|
-
}
|
|
93
|
-
if (timings.cacheStatus === 'hit')
|
|
94
|
-
return;
|
|
95
|
-
this.profile.record('parse external document', timings.parseMs, detail);
|
|
96
|
-
if (timings.cacheStatus === 'miss') {
|
|
97
|
-
this.profile.record('write parsed external document cache', timings.cacheWriteMs, detail);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
sourceSymbolOptions() {
|
|
101
|
-
return {
|
|
102
|
-
latDir: this.latticeDir,
|
|
103
|
-
runtime: this.sourceParserRuntime,
|
|
104
|
-
onFileAnalyzed: (analysis) => this.recordSourceAnalysis(analysis),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
clearSourceSymbolCache() {
|
|
108
|
-
if (this.sourceSymbolCacheCleared)
|
|
109
|
-
return;
|
|
110
|
-
this.sourceSymbolCacheCleared = true;
|
|
111
|
-
this.timeSync('clear source-symbol cache', () => this.sourceParserRuntime.clear());
|
|
112
|
-
}
|
|
113
|
-
project() {
|
|
114
|
-
this.projectPromise ??= this.time('analyze Markdown project', () => analyzeMarkdownProject(this.latticeDir, this.projectRoot, {
|
|
115
|
-
executor: this.executor,
|
|
116
|
-
onFileAnalyzed: (analysis) => this.recordAnalysis(analysis),
|
|
117
|
-
onParserImport: (event) => this.recordParserImport(event),
|
|
118
|
-
}));
|
|
119
|
-
return this.projectPromise;
|
|
120
|
-
}
|
|
121
|
-
async entries() {
|
|
122
|
-
return (await this.project()).entries;
|
|
123
|
-
}
|
|
124
|
-
async markdownFiles() {
|
|
125
|
-
return (await this.project()).markdownFiles;
|
|
126
|
-
}
|
|
127
|
-
async file(file) {
|
|
128
|
-
const analysis = (await this.project()).filesByAbsolutePath.get(file);
|
|
129
|
-
if (analysis)
|
|
130
|
-
return analysis;
|
|
131
|
-
let auxiliary = this.auxiliaryFilePromises.get(file);
|
|
132
|
-
if (!auxiliary) {
|
|
133
|
-
auxiliary = (async () => {
|
|
134
|
-
const result = await analyzeMarkdownPath(file, this.latticeDir, this.projectRoot, true, (event) => this.recordParserImport(event));
|
|
135
|
-
this.recordAnalysis(result);
|
|
136
|
-
return result;
|
|
137
|
-
})();
|
|
138
|
-
this.auxiliaryFilePromises.set(file, auxiliary);
|
|
139
|
-
}
|
|
140
|
-
return auxiliary;
|
|
141
|
-
}
|
|
142
|
-
async content(file) {
|
|
143
|
-
return (await this.file(file)).content;
|
|
144
|
-
}
|
|
145
|
-
async sections(file) {
|
|
146
|
-
return (await this.file(file)).sections;
|
|
147
|
-
}
|
|
148
|
-
async refs(file) {
|
|
149
|
-
return (await this.file(file)).wikiRefs;
|
|
150
|
-
}
|
|
151
|
-
async links(file) {
|
|
152
|
-
return (await this.file(file)).validationLinks;
|
|
153
|
-
}
|
|
154
|
-
async frontmatter(file) {
|
|
155
|
-
return (await this.file(file)).frontmatter;
|
|
156
|
-
}
|
|
157
|
-
async diagnostics(file) {
|
|
158
|
-
return (await this.file(file)).diagnostics;
|
|
159
|
-
}
|
|
160
|
-
async allSections() {
|
|
161
|
-
return (await this.project()).allSections;
|
|
162
|
-
}
|
|
163
|
-
async sectionIndex() {
|
|
164
|
-
const project = await this.project();
|
|
165
|
-
return {
|
|
166
|
-
sectionIds: new Set(project.sectionIds),
|
|
167
|
-
fileIndex: project.fileIndex,
|
|
168
|
-
slugIndex: project.slugIndex,
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
headings(file) {
|
|
172
|
-
let headings = this.headingPromises.get(file);
|
|
173
|
-
if (!headings) {
|
|
174
|
-
headings = (async () => {
|
|
175
|
-
const sections = await this.sections(file);
|
|
176
|
-
return this.timeSync('collect Markdown headings', () => new Set(flattenSections(sections).map((section) => section.githubSlug)), (await this.file(file)).path);
|
|
177
|
-
})();
|
|
178
|
-
this.headingPromises.set(file, headings);
|
|
179
|
-
}
|
|
180
|
-
return headings;
|
|
181
|
-
}
|
|
182
|
-
codeRefs() {
|
|
183
|
-
this.codeRefsPromise ??= this.time('scan project files for @lat references', () => scanCodeRefs(this.projectRoot, this.profile));
|
|
184
|
-
return this.codeRefsPromise;
|
|
185
|
-
}
|
|
186
|
-
loadExternalResolver() {
|
|
187
|
-
this.externalResolverPromise ??= this.time('load external-source configuration', () => createExternalResolver(this.latticeDir, this.projectRoot, {
|
|
188
|
-
onDocumentAnalyzed: (analysis) => this.recordExternalDocumentAnalysis(analysis),
|
|
189
|
-
onParserImport: (event) => this.recordParserImport(event),
|
|
190
|
-
}));
|
|
191
|
-
return this.externalResolverPromise;
|
|
192
|
-
}
|
|
193
|
-
async externalResolver() {
|
|
194
|
-
const resolver = await this.loadExternalResolver();
|
|
195
|
-
this.reconciledExternalPromise ??= this.time('reconcile external cache', () => resolver.reconcile());
|
|
196
|
-
await this.reconciledExternalPromise;
|
|
197
|
-
return resolver;
|
|
198
|
-
}
|
|
199
|
-
resolveExternal(target) {
|
|
200
|
-
let content = this.externalContentPromises.get(target);
|
|
201
|
-
if (!content) {
|
|
202
|
-
content = this.time('resolve external reference', async () => (await this.externalResolver()).resolve(target), target);
|
|
203
|
-
this.externalContentPromises.set(target, content);
|
|
204
|
-
}
|
|
205
|
-
return content;
|
|
206
|
-
}
|
|
207
|
-
resolveRepositoryLink(target, resolveLink) {
|
|
208
|
-
let error = this.repositoryLinkErrorPromises.get(target);
|
|
209
|
-
if (!error) {
|
|
210
|
-
error = this.time('resolve repository wiki link', resolveLink, target);
|
|
211
|
-
this.repositoryLinkErrorPromises.set(target, error);
|
|
212
|
-
}
|
|
213
|
-
return error;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { relative } from 'node:path';
|
|
3
|
-
import { createCodeReferenceDiscovery } from '../code-refs.js';
|
|
4
|
-
import { listLatticeFiles } from '../lattice.js';
|
|
5
|
-
import { indexNameFor } from './check-mode.js';
|
|
6
|
-
import { toPosix } from '../path.js';
|
|
7
|
-
import { basename, dirname } from 'node:path';
|
|
8
|
-
/**
|
|
9
|
-
* Fail a `lat.md/` tree that has documents and no `@lat:` ref pointing into it
|
|
10
|
-
* from anywhere in the codebase.
|
|
11
|
-
*
|
|
12
|
-
* `require-code-mention` was the only thing asking for refs, and it is opt-in
|
|
13
|
-
* frontmatter: an agent setting up a tree can simply not write it, and every
|
|
14
|
-
* check still passes. One did. Its reasons were both ordinary — it read a list
|
|
15
|
-
* of example comment markers as an exclusive language list and concluded its
|
|
16
|
-
* language was unsupported, and it was optimising for a green check rather
|
|
17
|
-
* than a correct one, so the option that could not fail was the one it took.
|
|
18
|
-
*
|
|
19
|
-
* A graph nothing points at cannot be reached from the code, which is the only
|
|
20
|
-
* reason it exists. So the floor is one ref, and the message says where to put
|
|
21
|
-
* the first one.
|
|
22
|
-
*
|
|
23
|
-
* Deliberately a floor and not a coverage ratio. Half this repository's own
|
|
24
|
-
* documents have no incoming ref and should not have one — a per-document rule
|
|
25
|
-
* would have to be either wrong here or watered down everywhere.
|
|
26
|
-
*/
|
|
27
|
-
/** Nothing to anchor: a tree of pure navigation, or a project with no code. */
|
|
28
|
-
function isIndex(latticeDir, file) {
|
|
29
|
-
const holder = basename(dirname(file));
|
|
30
|
-
return (basename(file) ===
|
|
31
|
-
indexNameFor(holder === '' ? basename(latticeDir) : holder));
|
|
32
|
-
}
|
|
33
|
-
export async function checkCoverage(latticeDir, projectRoot = dirname(latticeDir)) {
|
|
34
|
-
const files = await listLatticeFiles(latticeDir);
|
|
35
|
-
const documents = files.filter((f) => !isIndex(latticeDir, f));
|
|
36
|
-
if (documents.length === 0)
|
|
37
|
-
return [];
|
|
38
|
-
// One discovery for both questions: it coalesces the repeated call and
|
|
39
|
-
// shares the ripgrep exclusion scan between them. Upstream's ScanResult no
|
|
40
|
-
// longer carries the file list, so the scope has to be asked for separately.
|
|
41
|
-
const discovery = createCodeReferenceDiscovery(projectRoot);
|
|
42
|
-
const { refs } = await discovery.scan();
|
|
43
|
-
if (refs.length > 0)
|
|
44
|
-
return [];
|
|
45
|
-
if ((await discovery.listSourceFiles()).length === 0)
|
|
46
|
-
return [];
|
|
47
|
-
const rootIndexPath = `${latticeDir}/${indexNameFor(basename(latticeDir))}`;
|
|
48
|
-
const rootIndexRel = toPosix(relative(process.cwd(), rootIndexPath));
|
|
49
|
-
// Quote the ref the reader should actually paste. A generic placeholder gets
|
|
50
|
-
// pasted verbatim and then fails `lat check code-refs`, which turns one
|
|
51
|
-
// error into two.
|
|
52
|
-
const stem = basename(latticeDir).replace(/\.md$/, '');
|
|
53
|
-
let anchor = `${stem}#Your Project`;
|
|
54
|
-
try {
|
|
55
|
-
const heading = (await readFile(rootIndexPath, 'utf-8')).match(/^#\s+(.+)$/m);
|
|
56
|
-
if (heading)
|
|
57
|
-
anchor = `${stem}#${heading[1].trim()}`;
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
// No root index, or unreadable — the placeholder still names the shape.
|
|
61
|
-
}
|
|
62
|
-
return [
|
|
63
|
-
{
|
|
64
|
-
file: rootIndexRel,
|
|
65
|
-
line: 1,
|
|
66
|
-
target: toPosix(relative(projectRoot, latticeDir)),
|
|
67
|
-
message: `${documents.length} document(s) here and no \`@lat:\` code ref anywhere in the project — nothing in the codebase can reach this graph.\n` +
|
|
68
|
-
' Start at the application entrypoint (config/application.rb, src/index.ts, main.go, manage.py) and point it at the root index:\n' +
|
|
69
|
-
` # @lat: [[${anchor}]]\n` +
|
|
70
|
-
' Then add one ref per section that source code implements, at that code.\n' +
|
|
71
|
-
' The marker is a comment syntax, not a language allowlist: `//` for C-family, `#` for Ruby, Python, shell, Elixir and the rest. The scan is textual and reads every non-markdown file.\n' +
|
|
72
|
-
' An `@lat:` line is a machine directive, like a magic comment or a linter pragma. A project convention that minimises comments does not reach it.',
|
|
73
|
-
},
|
|
74
|
-
];
|
|
75
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { CheckError } from './check.js';
|
|
2
|
-
/**
|
|
3
|
-
* Report frontmatter that parses to nothing useful, or that puts a lat field
|
|
4
|
-
* somewhere the parser will not look.
|
|
5
|
-
*
|
|
6
|
-
* Both failures are quiet by nature, and both fail OPEN. A misplaced or
|
|
7
|
-
* unparseable `require-code-mention` turns a validation off, and `lat check`
|
|
8
|
-
* then reports success on a file whose leaf sections are no longer required to
|
|
9
|
-
* carry `@lat:` coverage. Nothing else in the output says the rule stopped
|
|
10
|
-
* applying, which is precisely why it has to be said here.
|
|
11
|
-
*/
|
|
12
|
-
export declare function checkFrontmatter(latticeDir: string, projectRoot?: string): Promise<CheckError[]>;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import { dirname, relative } from 'node:path';
|
|
3
|
-
import { listLatticeFiles, parseFrontmatter } from '../lattice.js';
|
|
4
|
-
import { toPosix } from '../path.js';
|
|
5
|
-
/**
|
|
6
|
-
* Report frontmatter that parses to nothing useful, or that puts a lat field
|
|
7
|
-
* somewhere the parser will not look.
|
|
8
|
-
*
|
|
9
|
-
* Both failures are quiet by nature, and both fail OPEN. A misplaced or
|
|
10
|
-
* unparseable `require-code-mention` turns a validation off, and `lat check`
|
|
11
|
-
* then reports success on a file whose leaf sections are no longer required to
|
|
12
|
-
* carry `@lat:` coverage. Nothing else in the output says the rule stopped
|
|
13
|
-
* applying, which is precisely why it has to be said here.
|
|
14
|
-
*/
|
|
15
|
-
export async function checkFrontmatter(latticeDir, projectRoot = dirname(latticeDir)) {
|
|
16
|
-
const files = await listLatticeFiles(latticeDir);
|
|
17
|
-
const errors = [];
|
|
18
|
-
for (const file of files) {
|
|
19
|
-
const content = await readFile(file, 'utf-8');
|
|
20
|
-
const problems = parseFrontmatter(content).problems;
|
|
21
|
-
if (!problems)
|
|
22
|
-
continue;
|
|
23
|
-
const relPath = relative(process.cwd(), file);
|
|
24
|
-
const target = toPosix(relative(projectRoot, file)).replace(/\.md$/, '');
|
|
25
|
-
for (const problem of problems) {
|
|
26
|
-
if (problem.kind === 'root-level-field') {
|
|
27
|
-
errors.push({
|
|
28
|
-
file: relPath,
|
|
29
|
-
line: 1,
|
|
30
|
-
target,
|
|
31
|
-
message: `frontmatter sets "${problem.field}" at the document root, where it is ignored — nest it under "lat:" instead:\n ---\n lat:\n ${problem.field}: ...\n ---`,
|
|
32
|
-
});
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
errors.push({
|
|
36
|
-
file: relPath,
|
|
37
|
-
line: 1,
|
|
38
|
-
target,
|
|
39
|
-
message: `frontmatter is not valid YAML (${problem.message}) — every lat field in this document is being ignored, including any that turn a check on`,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return errors;
|
|
44
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { CheckError } from './check.js';
|
|
2
|
-
export declare const DIATAXIS_MODES: readonly ["tutorial", "how-to", "reference", "explanation"];
|
|
3
|
-
export type DiataxisMode = (typeof DIATAXIS_MODES)[number];
|
|
4
|
-
/** Directory below lat.md/ that holds each mode. */
|
|
5
|
-
export declare const MODE_DIRS: Record<DiataxisMode, string>;
|
|
6
|
-
/**
|
|
7
|
-
* The index file a directory is required to carry, e.g. `lat.md` for the root
|
|
8
|
-
* and `reference.md` for `reference/`. An index is navigation rather than
|
|
9
|
-
* content, so the `require-mode` gate below never asks one to declare a mode.
|
|
10
|
-
*/
|
|
11
|
-
export declare function indexNameFor(dirName: string): string;
|
|
12
|
-
export type CheckModeOptions = {
|
|
13
|
-
/**
|
|
14
|
-
* Enforce as if the root index said this, whatever it actually says. Used to
|
|
15
|
-
* price adoption — running once each way and taking the difference is what
|
|
16
|
-
* the offer in `lat init` reports, and it keeps that number defined by this
|
|
17
|
-
* checker rather than by a second copy of its rules.
|
|
18
|
-
*/
|
|
19
|
-
requireMode?: boolean;
|
|
20
|
-
};
|
|
21
|
-
export declare function checkMode(latticeDir: string, projectRoot?: string, options?: CheckModeOptions): Promise<CheckError[]>;
|