@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,11 +0,0 @@
|
|
|
1
|
-
import type { CmdContext, Styler } from '../context.js';
|
|
2
|
-
export type { CmdContext };
|
|
3
|
-
export declare function makeStyler(): Styler;
|
|
4
|
-
export declare function resolveContext(opts: {
|
|
5
|
-
dir?: string;
|
|
6
|
-
color?: boolean;
|
|
7
|
-
}): CmdContext;
|
|
8
|
-
export declare function resolveCheckContext(opts: {
|
|
9
|
-
dir?: string;
|
|
10
|
-
color?: boolean;
|
|
11
|
-
}, target?: string): CmdContext;
|
package/dist/src/cli/context.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { statSync } from 'node:fs';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
import { styleText } from 'node:util';
|
|
4
|
-
import { findLatticeDir } from '../project-discovery.js';
|
|
5
|
-
export function makeStyler() {
|
|
6
|
-
return {
|
|
7
|
-
bold: (s) => styleText('bold', s),
|
|
8
|
-
dim: (s) => styleText('dim', s),
|
|
9
|
-
red: (s) => styleText('red', s),
|
|
10
|
-
cyan: (s) => styleText('cyan', s),
|
|
11
|
-
white: (s) => styleText('white', s),
|
|
12
|
-
green: (s) => styleText('green', s),
|
|
13
|
-
yellow: (s) => styleText('yellow', s),
|
|
14
|
-
boldWhite: (s) => styleText(['bold', 'white'], s),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export function resolveContext(opts) {
|
|
18
|
-
const color = opts.color !== false;
|
|
19
|
-
if (!color) {
|
|
20
|
-
process.env.NO_COLOR = '1';
|
|
21
|
-
}
|
|
22
|
-
const latDir = findLatticeDir(opts.dir) ?? '';
|
|
23
|
-
if (!latDir) {
|
|
24
|
-
console.error(styleText('red', 'No lat.md directory found'));
|
|
25
|
-
console.error(styleText('dim', 'Run `lat init` to create one.'));
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
const projectRoot = dirname(latDir);
|
|
29
|
-
return { latDir, projectRoot, styler: makeStyler(), mode: 'cli' };
|
|
30
|
-
}
|
|
31
|
-
export function resolveCheckContext(opts, target) {
|
|
32
|
-
if (target === undefined)
|
|
33
|
-
return resolveContext(opts);
|
|
34
|
-
if (opts.color === false) {
|
|
35
|
-
process.env.NO_COLOR = '1';
|
|
36
|
-
}
|
|
37
|
-
const projectRoot = resolve(opts.dir ?? process.cwd());
|
|
38
|
-
const latDir = resolve(projectRoot, target);
|
|
39
|
-
try {
|
|
40
|
-
if (!statSync(latDir).isDirectory()) {
|
|
41
|
-
console.error(styleText('red', `Check target is not a directory: ${target}`));
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
if (error.code !== 'ENOENT')
|
|
47
|
-
throw error;
|
|
48
|
-
console.error(styleText('red', `Check directory not found: ${target}`));
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
latDir,
|
|
53
|
-
projectRoot,
|
|
54
|
-
styler: makeStyler(),
|
|
55
|
-
mode: 'cli',
|
|
56
|
-
headless: true,
|
|
57
|
-
};
|
|
58
|
-
}
|
package/dist/src/cli/expand.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CmdContext, CmdResult } from '../context.js';
|
|
2
|
-
/**
|
|
3
|
-
* Resolve [[refs]] in text and return the expanded output.
|
|
4
|
-
* Returns null if there are no wiki links, or if resolution fails.
|
|
5
|
-
*/
|
|
6
|
-
export declare function expandPrompt(ctx: CmdContext, text: string): Promise<string | null>;
|
|
7
|
-
export declare function expandCommand(ctx: CmdContext, text: string): Promise<CmdResult>;
|
package/dist/src/cli/expand.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { join, relative } from 'node:path';
|
|
2
|
-
import { findSections, } from '../lattice-model.js';
|
|
3
|
-
import { UNTRUSTED_NOTICE, quoteUntrusted, cleanUntrustedId, } from '../untrusted.js';
|
|
4
|
-
import { commandProjectAnalysis, commandProjectSession, } from '../project-analysis.js';
|
|
5
|
-
const WIKI_LINK_RE = /\[\[([^\]]+)\]\]/g;
|
|
6
|
-
function formatLocation(section, projectRoot) {
|
|
7
|
-
const relPath = relative(process.cwd(), join(projectRoot, section.filePath));
|
|
8
|
-
return `${cleanUntrustedId(relPath)}:${section.startLine}-${section.endLine}`;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Resolve [[refs]] in text and return the expanded output.
|
|
12
|
-
* Returns null if there are no wiki links, or if resolution fails.
|
|
13
|
-
*/
|
|
14
|
-
export async function expandPrompt(ctx, text) {
|
|
15
|
-
const refs = [...text.matchAll(WIKI_LINK_RE)];
|
|
16
|
-
if (refs.length === 0)
|
|
17
|
-
return null;
|
|
18
|
-
const { allSections } = await commandProjectAnalysis(ctx);
|
|
19
|
-
const resolved = new Map();
|
|
20
|
-
const externalResolved = new Map();
|
|
21
|
-
const external = await commandProjectSession(ctx).external();
|
|
22
|
-
const errors = [];
|
|
23
|
-
for (const match of refs) {
|
|
24
|
-
const target = match[1];
|
|
25
|
-
if (resolved.has(target) || externalResolved.has(target))
|
|
26
|
-
continue;
|
|
27
|
-
try {
|
|
28
|
-
if (external.parse(target)) {
|
|
29
|
-
externalResolved.set(target, await external.resolve(target));
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
errors.push(error.message);
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
const unknownExternal = external.unknownTargetMessage(target);
|
|
38
|
-
if (unknownExternal) {
|
|
39
|
-
errors.push(unknownExternal);
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
const matches = findSections(allSections, target);
|
|
43
|
-
if (matches.length >= 1) {
|
|
44
|
-
resolved.set(target, {
|
|
45
|
-
target,
|
|
46
|
-
best: matches[0],
|
|
47
|
-
alternatives: matches.slice(1),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
errors.push(`No section found for [[${target}]]`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
if (errors.length > 0)
|
|
55
|
-
return null;
|
|
56
|
-
// Replace [[refs]] inline
|
|
57
|
-
let output = text.replace(WIKI_LINK_RE, (_match, target) => {
|
|
58
|
-
if (externalResolved.has(target))
|
|
59
|
-
return `[[${target}]]`;
|
|
60
|
-
const ref = resolved.get(target);
|
|
61
|
-
return `[[${cleanUntrustedId(ref.best.section.id)}]]`;
|
|
62
|
-
});
|
|
63
|
-
// Append context block as nested outliner
|
|
64
|
-
output += '\n\n<lat-context>\n';
|
|
65
|
-
output += UNTRUSTED_NOTICE + '\n';
|
|
66
|
-
for (const [target, value] of externalResolved) {
|
|
67
|
-
output += `* \`[[${target}]]\` is referring to:\n`;
|
|
68
|
-
output += ` * ${value.source.repo} @ ${value.source.commit} via ${value.provider}\n`;
|
|
69
|
-
output += ` * ${value.target.repositoryPath}:${value.startLine}-${value.endLine}\n`;
|
|
70
|
-
for (const line of value.content.split('\n'))
|
|
71
|
-
output += ` | ${line}\n`;
|
|
72
|
-
}
|
|
73
|
-
for (const ref of resolved.values()) {
|
|
74
|
-
const isExact = ref.best.reason === 'exact match' ||
|
|
75
|
-
ref.best.reason.startsWith('file stem expanded');
|
|
76
|
-
const all = isExact ? [ref.best] : [ref.best, ...ref.alternatives];
|
|
77
|
-
if (isExact) {
|
|
78
|
-
output += `* \`[[${ref.target}]]\` is referring to:\n`;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
output += `* \`[[${ref.target}]]\` might be referring to either of the following:\n`;
|
|
82
|
-
}
|
|
83
|
-
for (const m of all) {
|
|
84
|
-
const reason = isExact ? '' : ` (${cleanUntrustedId(m.reason)})`;
|
|
85
|
-
output += ` * [[${cleanUntrustedId(m.section.id)}]]${reason}\n`;
|
|
86
|
-
output += ` * ${formatLocation(m.section, ctx.projectRoot)}\n`;
|
|
87
|
-
if (m.section.firstParagraph) {
|
|
88
|
-
output += ` * ${quoteUntrusted(m.section.firstParagraph)}\n`;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
output += '</lat-context>\n';
|
|
93
|
-
return output;
|
|
94
|
-
}
|
|
95
|
-
export async function expandCommand(ctx, text) {
|
|
96
|
-
const result = await expandPrompt(ctx, text);
|
|
97
|
-
if (result === null) {
|
|
98
|
-
const refs = [...text.matchAll(WIKI_LINK_RE)];
|
|
99
|
-
if (refs.length === 0) {
|
|
100
|
-
return { output: text };
|
|
101
|
-
}
|
|
102
|
-
// Resolution failed — find which ref is broken
|
|
103
|
-
const { allSections } = await commandProjectAnalysis(ctx);
|
|
104
|
-
const external = await commandProjectSession(ctx).external();
|
|
105
|
-
for (const match of refs) {
|
|
106
|
-
const target = match[1];
|
|
107
|
-
try {
|
|
108
|
-
if (external.parse(target)) {
|
|
109
|
-
await external.resolve(target);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
return {
|
|
115
|
-
output: ctx.styler.red(error.message),
|
|
116
|
-
isError: true,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
const unknownExternal = external.unknownTargetMessage(target);
|
|
120
|
-
if (unknownExternal) {
|
|
121
|
-
return {
|
|
122
|
-
output: ctx.styler.red(unknownExternal),
|
|
123
|
-
isError: true,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
const matches = findSections(allSections, target);
|
|
127
|
-
if (matches.length === 0) {
|
|
128
|
-
const s = ctx.styler;
|
|
129
|
-
return {
|
|
130
|
-
output: s.red(`No section found for [[${target}]]`) +
|
|
131
|
-
' (no exact, substring, or fuzzy matches).\n' +
|
|
132
|
-
s.dim('Ask the user to correct the reference.'),
|
|
133
|
-
isError: true,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// All refs matched individually but expansion still failed — shouldn't happen
|
|
138
|
-
return { output: text };
|
|
139
|
-
}
|
|
140
|
-
return { output: result };
|
|
141
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CmdContext, CmdResult } from '../context.js';
|
|
2
|
-
export type ExternalAddOptions = {
|
|
3
|
-
commit?: string;
|
|
4
|
-
prefix?: string;
|
|
5
|
-
defaultFileExtension?: string;
|
|
6
|
-
strategy?: string;
|
|
7
|
-
fetchUrl?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function externalListCommand(ctx: CmdContext, json?: boolean): Promise<CmdResult>;
|
|
10
|
-
export declare function externalShowCommand(ctx: CmdContext, query: string, json?: boolean): Promise<CmdResult>;
|
|
11
|
-
export declare function externalAddCommand(ctx: CmdContext, handleValue: string | undefined, repoValue: string | undefined, options: ExternalAddOptions): Promise<CmdResult>;
|
package/dist/src/cli/external.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { createInterface } from 'node:readline/promises';
|
|
2
|
-
import { addCanonicalExternalSource, describeExternalSources, inferExternalFetchUrl, loadExternalSources, normalizeExternalDefaultFileExtension, normalizeExternalRepoUrl, parseExternalTarget, resolveExternalCommit, } from '../external-sources.js';
|
|
3
|
-
import { selectMenu } from './select-menu.js';
|
|
4
|
-
function shellArg(value) {
|
|
5
|
-
return /^[a-zA-Z0-9_./:@=-]+$/.test(value)
|
|
6
|
-
? value
|
|
7
|
-
: `'${value.replaceAll("'", "'\\''")}'`;
|
|
8
|
-
}
|
|
9
|
-
function formatDescription(value) {
|
|
10
|
-
const lines = [
|
|
11
|
-
`${value.handle}`,
|
|
12
|
-
` Repository: ${value.repo}`,
|
|
13
|
-
` Commit: ${value.effectiveCommit}${value.effectiveCommit !== value.canonicalCommit ? ` (canonical: ${value.canonicalCommit})` : ''}`,
|
|
14
|
-
` Strategy: ${value.effectiveStrategy}${value.effectiveStrategy !== value.strategy ? ` (canonical: ${value.strategy})` : ''}`,
|
|
15
|
-
` Prefix: ${value.prefix || '(none)'}`,
|
|
16
|
-
` Default file extension: ${value.defaultFileExtension || '(none)'}`,
|
|
17
|
-
` Cache: ${value.cache ? `${value.cache.strategy} @ ${value.cache.commit}` : '(empty)'}`,
|
|
18
|
-
];
|
|
19
|
-
if (value.fetchUrl)
|
|
20
|
-
lines.push(` Fetch URL: ${value.fetchUrl}`);
|
|
21
|
-
if (value.localPath)
|
|
22
|
-
lines.push(` Local path: ${value.localPath}`);
|
|
23
|
-
if (value.localError)
|
|
24
|
-
lines.push(` Local error: ${value.localError}`);
|
|
25
|
-
lines.push(' Suggested checkout:');
|
|
26
|
-
for (const command of value.checkout) {
|
|
27
|
-
lines.push(` ${[command.command, ...command.args].map(shellArg).join(' ')}`);
|
|
28
|
-
}
|
|
29
|
-
return lines.join('\n');
|
|
30
|
-
}
|
|
31
|
-
export async function externalListCommand(ctx, json = false) {
|
|
32
|
-
const snapshot = await loadExternalSources(ctx.latDir, ctx.projectRoot);
|
|
33
|
-
if (!snapshot.validCanonical) {
|
|
34
|
-
return {
|
|
35
|
-
output: snapshot.errors
|
|
36
|
-
.map((error) => `${error.file}: ${error.message}`)
|
|
37
|
-
.join('\n'),
|
|
38
|
-
isError: true,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const descriptions = describeExternalSources(ctx.latDir, snapshot);
|
|
42
|
-
return {
|
|
43
|
-
output: json
|
|
44
|
-
? JSON.stringify(descriptions, null, 2)
|
|
45
|
-
: descriptions.length
|
|
46
|
-
? descriptions.map(formatDescription).join('\n\n')
|
|
47
|
-
: 'No external sources configured',
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export async function externalShowCommand(ctx, query, json = false) {
|
|
51
|
-
const snapshot = await loadExternalSources(ctx.latDir, ctx.projectRoot);
|
|
52
|
-
const colon = query.indexOf(':');
|
|
53
|
-
const handle = colon === -1 ? query : query.slice(0, colon);
|
|
54
|
-
const source = describeExternalSources(ctx.latDir, snapshot).find((item) => item.handle === handle);
|
|
55
|
-
if (!source) {
|
|
56
|
-
return {
|
|
57
|
-
output: `External source "${handle}" is not configured`,
|
|
58
|
-
isError: true,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
let target = null;
|
|
62
|
-
if (colon !== -1) {
|
|
63
|
-
try {
|
|
64
|
-
target = parseExternalTarget(query, snapshot);
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
return { output: error.message, isError: true };
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const value = target
|
|
71
|
-
? {
|
|
72
|
-
...source,
|
|
73
|
-
target: target.identity,
|
|
74
|
-
repositoryPath: target.repositoryPath,
|
|
75
|
-
}
|
|
76
|
-
: source;
|
|
77
|
-
return {
|
|
78
|
-
output: json
|
|
79
|
-
? JSON.stringify(value, null, 2)
|
|
80
|
-
: formatDescription(source) +
|
|
81
|
-
(target
|
|
82
|
-
? `\n Target: ${target.identity}\n Repository path: ${target.repositoryPath}`
|
|
83
|
-
: ''),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
async function question(rl, label, current) {
|
|
87
|
-
if (current)
|
|
88
|
-
return current;
|
|
89
|
-
const answer = (await rl.question(`${label}: `)).trim();
|
|
90
|
-
if (!answer)
|
|
91
|
-
throw new Error(`${label} is required`);
|
|
92
|
-
return answer;
|
|
93
|
-
}
|
|
94
|
-
export async function externalAddCommand(ctx, handleValue, repoValue, options) {
|
|
95
|
-
const interactive = !!process.stdin.isTTY;
|
|
96
|
-
if (!interactive &&
|
|
97
|
-
(!handleValue || !repoValue || !options.commit || !options.strategy)) {
|
|
98
|
-
return {
|
|
99
|
-
output: 'Non-interactive use requires handle, repo, --commit, and --strategy',
|
|
100
|
-
isError: true,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
let rl = null;
|
|
104
|
-
const getReadline = () => {
|
|
105
|
-
rl ??= createInterface({ input: process.stdin, output: process.stdout });
|
|
106
|
-
return rl;
|
|
107
|
-
};
|
|
108
|
-
const closeReadline = () => {
|
|
109
|
-
rl?.close();
|
|
110
|
-
rl = null;
|
|
111
|
-
};
|
|
112
|
-
try {
|
|
113
|
-
const handle = await question(getReadline(), 'Handle', handleValue);
|
|
114
|
-
const repo = normalizeExternalRepoUrl(await question(getReadline(), 'Repository', repoValue));
|
|
115
|
-
const ref = await question(getReadline(), 'Commit or ref', options.commit);
|
|
116
|
-
const prefix = options.prefix ??
|
|
117
|
-
(interactive
|
|
118
|
-
? (await getReadline().question('Prefix (optional): ')).trim()
|
|
119
|
-
: '');
|
|
120
|
-
const defaultFileExtensionValue = options.defaultFileExtension ??
|
|
121
|
-
(interactive
|
|
122
|
-
? (await getReadline().question('Default file extension (optional): ')).trim()
|
|
123
|
-
: '');
|
|
124
|
-
const defaultFileExtension = defaultFileExtensionValue
|
|
125
|
-
? normalizeExternalDefaultFileExtension(defaultFileExtensionValue)
|
|
126
|
-
: '';
|
|
127
|
-
let strategy = options.strategy;
|
|
128
|
-
if (!strategy && interactive) {
|
|
129
|
-
const inferred = inferExternalFetchUrl(repo);
|
|
130
|
-
// selectMenu reads raw keypresses directly. Detach readline first so it
|
|
131
|
-
// cannot consume the selection's Enter key or remain paused afterward.
|
|
132
|
-
closeReadline();
|
|
133
|
-
strategy =
|
|
134
|
-
(await selectMenu(inferred
|
|
135
|
-
? [
|
|
136
|
-
{
|
|
137
|
-
label: 'Fetch individual files (recommended)',
|
|
138
|
-
value: 'fetch',
|
|
139
|
-
},
|
|
140
|
-
{ label: 'Use a Lat-managed checkout', value: 'checkout' },
|
|
141
|
-
]
|
|
142
|
-
: [
|
|
143
|
-
{
|
|
144
|
-
label: 'Use a Lat-managed checkout (recommended)',
|
|
145
|
-
value: 'checkout',
|
|
146
|
-
},
|
|
147
|
-
{ label: 'Fetch individual files', value: 'fetch' },
|
|
148
|
-
], 'How should Lat read this source?')) ?? undefined;
|
|
149
|
-
}
|
|
150
|
-
if (strategy !== 'fetch' && strategy !== 'checkout') {
|
|
151
|
-
return { output: 'strategy must be fetch or checkout', isError: true };
|
|
152
|
-
}
|
|
153
|
-
let fetchUrl = options.fetchUrl;
|
|
154
|
-
if (strategy === 'fetch' &&
|
|
155
|
-
!fetchUrl &&
|
|
156
|
-
!inferExternalFetchUrl(repo) &&
|
|
157
|
-
interactive) {
|
|
158
|
-
fetchUrl = await question(getReadline(), 'Fetch URL template');
|
|
159
|
-
}
|
|
160
|
-
const commit = await resolveExternalCommit(repo, ref);
|
|
161
|
-
if (interactive) {
|
|
162
|
-
const confirmation = (await getReadline().question(`Add external source "${handle}" at commit "${commit}" using "${strategy}"? [Y/n] `))
|
|
163
|
-
.trim()
|
|
164
|
-
.toLowerCase();
|
|
165
|
-
if (confirmation === 'n' || confirmation === 'no')
|
|
166
|
-
return { output: 'Aborted' };
|
|
167
|
-
}
|
|
168
|
-
await addCanonicalExternalSource(ctx.latDir, {
|
|
169
|
-
handle,
|
|
170
|
-
repo,
|
|
171
|
-
commit,
|
|
172
|
-
...(prefix ? { prefix } : {}),
|
|
173
|
-
...(defaultFileExtension ? { defaultFileExtension } : {}),
|
|
174
|
-
strategy: strategy,
|
|
175
|
-
...(fetchUrl ? { fetchUrl } : {}),
|
|
176
|
-
});
|
|
177
|
-
return { output: `Added external source ${handle} at ${commit}` };
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
return { output: error.message, isError: true };
|
|
181
|
-
}
|
|
182
|
-
finally {
|
|
183
|
-
closeReadline();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export declare function mdEscapeLabel(value: string): string;
|
|
2
|
-
export declare function mdEscapeDest(value: string): string;
|
|
3
|
-
export type IndexEntrySource = {
|
|
4
|
-
/** Filesystem entry name: "notes.md" for a file, "guides" for a directory. */
|
|
5
|
-
name: string;
|
|
6
|
-
/**
|
|
7
|
-
* Link destination relative to the index file being written: the child's
|
|
8
|
-
* own filename ("notes.md"), or its own index file for a directory
|
|
9
|
-
* ("guides/guides.md"). This is what actually resolves on disk — unlike
|
|
10
|
-
* the wiki-link stem, it keeps the .md extension.
|
|
11
|
-
*/
|
|
12
|
-
dest: string;
|
|
13
|
-
/** Absolute path to read the title/summary from (the file itself, or a directory's own index file). */
|
|
14
|
-
readFrom: string;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Render the generated bullet list for a directory index, one entry per
|
|
18
|
-
* child, sorted by title. Each entry links through the wiki-link stem
|
|
19
|
-
* (`entryToStem`-compatible) using a real Markdown link so the title can
|
|
20
|
-
* carry a human-written summary — which is exactly why it must be escaped:
|
|
21
|
-
* the title is repository text landing inside `[...]`.
|
|
22
|
-
*/
|
|
23
|
-
export declare function renderIndexEntries(entries: IndexEntrySource[]): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Compute, for each line, whether it lies inside a fenced code block.
|
|
26
|
-
* Marker and bullet-run detection must skip fenced lines — otherwise a
|
|
27
|
-
* documentation example that shows the marker syntax (or a sample bullet
|
|
28
|
-
* list) inside a ``` block gets mistaken for the real thing and rewritten.
|
|
29
|
-
*/
|
|
30
|
-
export declare function fencedLineMask(lines: string[]): boolean[];
|
|
31
|
-
export type SpliceResult = {
|
|
32
|
-
ok: true;
|
|
33
|
-
content: string;
|
|
34
|
-
} | {
|
|
35
|
-
ok: false;
|
|
36
|
-
message: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Splice a freshly rendered entry list into an index file's content inside
|
|
40
|
-
* `<!-- lat:index:begin -->` / `<!-- lat:index:end -->` markers, preserving
|
|
41
|
-
* everything outside that region byte for byte. An unmarked file is
|
|
42
|
-
* migrated by wrapping the first contiguous run of local index entry
|
|
43
|
-
* bullets; a malformed marker pair is refused rather than guessed at.
|
|
44
|
-
*/
|
|
45
|
-
export declare function spliceIndexContent(existingContent: string | null, dirLabel: string, renderedList: string): SpliceResult;
|