trail-code 0.0.0-stage → 0.28.0-semantic.3
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/LICENSE +21 -0
- package/README.md +567 -2
- package/dist/ai/crux.d.ts +88 -0
- package/dist/ai/crux.d.ts.map +1 -0
- package/dist/ai/crux.js +219 -0
- package/dist/ai/crux.js.map +1 -0
- package/dist/ai/failure.d.ts +60 -0
- package/dist/ai/failure.d.ts.map +1 -0
- package/dist/ai/failure.js +86 -0
- package/dist/ai/failure.js.map +1 -0
- package/dist/ai/llm/anthropic.d.ts +37 -0
- package/dist/ai/llm/anthropic.d.ts.map +1 -0
- package/dist/ai/llm/anthropic.js +144 -0
- package/dist/ai/llm/anthropic.js.map +1 -0
- package/dist/ai/llm/factory.d.ts +28 -0
- package/dist/ai/llm/factory.d.ts.map +1 -0
- package/dist/ai/llm/factory.js +36 -0
- package/dist/ai/llm/factory.js.map +1 -0
- package/dist/ai/llm/litellm.d.ts +34 -0
- package/dist/ai/llm/litellm.d.ts.map +1 -0
- package/dist/ai/llm/litellm.js +45 -0
- package/dist/ai/llm/litellm.js.map +1 -0
- package/dist/ai/llm/openai.d.ts +145 -0
- package/dist/ai/llm/openai.d.ts.map +1 -0
- package/dist/ai/llm/openai.js +629 -0
- package/dist/ai/llm/openai.js.map +1 -0
- package/dist/ai/llm/orcarouter.d.ts +34 -0
- package/dist/ai/llm/orcarouter.d.ts.map +1 -0
- package/dist/ai/llm/orcarouter.js +45 -0
- package/dist/ai/llm/orcarouter.js.map +1 -0
- package/dist/ai/llm/recover-tool.d.ts +21 -0
- package/dist/ai/llm/recover-tool.d.ts.map +1 -0
- package/dist/ai/llm/recover-tool.js +109 -0
- package/dist/ai/llm/recover-tool.js.map +1 -0
- package/dist/ai/llm/types.d.ts +122 -0
- package/dist/ai/llm/types.d.ts.map +1 -0
- package/dist/ai/llm/types.js +33 -0
- package/dist/ai/llm/types.js.map +1 -0
- package/dist/ai/providers.d.ts +59 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +54 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/ai/summarize.d.ts +25 -0
- package/dist/ai/summarize.d.ts.map +1 -0
- package/dist/ai/summarize.js +34 -0
- package/dist/ai/summarize.js.map +1 -0
- package/dist/ai/synthesize.d.ts +40 -0
- package/dist/ai/synthesize.d.ts.map +1 -0
- package/dist/ai/synthesize.js +230 -0
- package/dist/ai/synthesize.js.map +1 -0
- package/dist/ask/ask.d.ts +199 -0
- package/dist/ask/ask.d.ts.map +1 -0
- package/dist/ask/ask.js +1291 -0
- package/dist/ask/ask.js.map +1 -0
- package/dist/ask/file-rank.d.ts +72 -0
- package/dist/ask/file-rank.d.ts.map +1 -0
- package/dist/ask/file-rank.js +160 -0
- package/dist/ask/file-rank.js.map +1 -0
- package/dist/ask/file-selection.d.ts +22 -0
- package/dist/ask/file-selection.d.ts.map +1 -0
- package/dist/ask/file-selection.js +66 -0
- package/dist/ask/file-selection.js.map +1 -0
- package/dist/ask/fuse.d.ts +195 -0
- package/dist/ask/fuse.d.ts.map +1 -0
- package/dist/ask/fuse.js +344 -0
- package/dist/ask/fuse.js.map +1 -0
- package/dist/ask/graphrank.d.ts +61 -0
- package/dist/ask/graphrank.d.ts.map +1 -0
- package/dist/ask/graphrank.js +130 -0
- package/dist/ask/graphrank.js.map +1 -0
- package/dist/ask/index-file.d.ts +44 -0
- package/dist/ask/index-file.d.ts.map +1 -0
- package/dist/ask/index-file.js +128 -0
- package/dist/ask/index-file.js.map +1 -0
- package/dist/ask/semantic.d.ts +42 -0
- package/dist/ask/semantic.d.ts.map +1 -0
- package/dist/ask/semantic.js +293 -0
- package/dist/ask/semantic.js.map +1 -0
- package/dist/bin/graft.d.ts +3 -0
- package/dist/bin/graft.d.ts.map +1 -0
- package/dist/bin/graft.js +14 -0
- package/dist/bin/graft.js.map +1 -0
- package/dist/bin/trail.d.ts +3 -0
- package/dist/bin/trail.d.ts.map +1 -0
- package/dist/bin/trail.js +13 -0
- package/dist/bin/trail.js.map +1 -0
- package/dist/blast/blast-cli.d.ts +35 -0
- package/dist/blast/blast-cli.d.ts.map +1 -0
- package/dist/blast/blast-cli.js +155 -0
- package/dist/blast/blast-cli.js.map +1 -0
- package/dist/blast/blast.d.ts +128 -0
- package/dist/blast/blast.d.ts.map +1 -0
- package/dist/blast/blast.js +383 -0
- package/dist/blast/blast.js.map +1 -0
- package/dist/blast/diff.d.ts +53 -0
- package/dist/blast/diff.d.ts.map +1 -0
- package/dist/blast/diff.js +193 -0
- package/dist/blast/diff.js.map +1 -0
- package/dist/blast/evidence.d.ts +51 -0
- package/dist/blast/evidence.d.ts.map +1 -0
- package/dist/blast/evidence.js +162 -0
- package/dist/blast/evidence.js.map +1 -0
- package/dist/blast/modules.d.ts +33 -0
- package/dist/blast/modules.d.ts.map +1 -0
- package/dist/blast/modules.js +83 -0
- package/dist/blast/modules.js.map +1 -0
- package/dist/blast/name.d.ts +74 -0
- package/dist/blast/name.d.ts.map +1 -0
- package/dist/blast/name.js +269 -0
- package/dist/blast/name.js.map +1 -0
- package/dist/blast/owners.d.ts +85 -0
- package/dist/blast/owners.d.ts.map +1 -0
- package/dist/blast/owners.js +272 -0
- package/dist/blast/owners.js.map +1 -0
- package/dist/blast/render.d.ts +46 -0
- package/dist/blast/render.d.ts.map +1 -0
- package/dist/blast/render.js +422 -0
- package/dist/blast/render.js.map +1 -0
- package/dist/blast/viz.d.ts +37 -0
- package/dist/blast/viz.d.ts.map +1 -0
- package/dist/blast/viz.js +180 -0
- package/dist/blast/viz.js.map +1 -0
- package/dist/brand.d.ts +111 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +282 -0
- package/dist/brand.js.map +1 -0
- package/dist/claude/build-progress.d.ts +30 -0
- package/dist/claude/build-progress.d.ts.map +1 -0
- package/dist/claude/build-progress.js +81 -0
- package/dist/claude/build-progress.js.map +1 -0
- package/dist/claude/hermes-skill-template.d.ts +16 -0
- package/dist/claude/hermes-skill-template.d.ts.map +1 -0
- package/dist/claude/hermes-skill-template.js +154 -0
- package/dist/claude/hermes-skill-template.js.map +1 -0
- package/dist/claude/init.d.ts +65 -0
- package/dist/claude/init.d.ts.map +1 -0
- package/dist/claude/init.js +258 -0
- package/dist/claude/init.js.map +1 -0
- package/dist/claude/paths.d.ts +9 -0
- package/dist/claude/paths.d.ts.map +1 -0
- package/dist/claude/paths.js +22 -0
- package/dist/claude/paths.js.map +1 -0
- package/dist/claude/session-metrics.d.ts +73 -0
- package/dist/claude/session-metrics.d.ts.map +1 -0
- package/dist/claude/session-metrics.js +209 -0
- package/dist/claude/session-metrics.js.map +1 -0
- package/dist/claude/settings-merge.d.ts +76 -0
- package/dist/claude/settings-merge.d.ts.map +1 -0
- package/dist/claude/settings-merge.js +283 -0
- package/dist/claude/settings-merge.js.map +1 -0
- package/dist/claude/skill-template.d.ts +13 -0
- package/dist/claude/skill-template.d.ts.map +1 -0
- package/dist/claude/skill-template.js +290 -0
- package/dist/claude/skill-template.js.map +1 -0
- package/dist/claude/state.d.ts +85 -0
- package/dist/claude/state.d.ts.map +1 -0
- package/dist/claude/state.js +88 -0
- package/dist/claude/state.js.map +1 -0
- package/dist/claude/stats.d.ts +5 -0
- package/dist/claude/stats.d.ts.map +1 -0
- package/dist/claude/stats.js +24 -0
- package/dist/claude/stats.js.map +1 -0
- package/dist/cli-epilogue.d.ts +12 -0
- package/dist/cli-epilogue.d.ts.map +1 -0
- package/dist/cli-epilogue.js +72 -0
- package/dist/cli-epilogue.js.map +1 -0
- package/dist/cli-meta.d.ts +82 -0
- package/dist/cli-meta.d.ts.map +1 -0
- package/dist/cli-meta.js +238 -0
- package/dist/cli-meta.js.map +1 -0
- package/dist/cli-picker.d.ts +139 -0
- package/dist/cli-picker.d.ts.map +1 -0
- package/dist/cli-picker.js +439 -0
- package/dist/cli-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1638 -0
- package/dist/cli.js.map +1 -0
- package/dist/context/batches.d.ts +29 -0
- package/dist/context/batches.d.ts.map +1 -0
- package/dist/context/batches.js +130 -0
- package/dist/context/batches.js.map +1 -0
- package/dist/context/build.d.ts +57 -0
- package/dist/context/build.d.ts.map +1 -0
- package/dist/context/build.js +396 -0
- package/dist/context/build.js.map +1 -0
- package/dist/context/check.d.ts +42 -0
- package/dist/context/check.d.ts.map +1 -0
- package/dist/context/check.js +162 -0
- package/dist/context/check.js.map +1 -0
- package/dist/context/map-dir.d.ts +13 -0
- package/dist/context/map-dir.d.ts.map +1 -0
- package/dist/context/map-dir.js +81 -0
- package/dist/context/map-dir.js.map +1 -0
- package/dist/context/node-file.d.ts +109 -0
- package/dist/context/node-file.d.ts.map +1 -0
- package/dist/context/node-file.js +390 -0
- package/dist/context/node-file.js.map +1 -0
- package/dist/context/price.d.ts +49 -0
- package/dist/context/price.d.ts.map +1 -0
- package/dist/context/price.js +83 -0
- package/dist/context/price.js.map +1 -0
- package/dist/context/savings.d.ts +67 -0
- package/dist/context/savings.d.ts.map +1 -0
- package/dist/context/savings.js +125 -0
- package/dist/context/savings.js.map +1 -0
- package/dist/engine.d.ts +85 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +122 -0
- package/dist/engine.js.map +1 -0
- package/dist/graph/bindings.d.ts +64 -0
- package/dist/graph/bindings.d.ts.map +1 -0
- package/dist/graph/bindings.js +713 -0
- package/dist/graph/bindings.js.map +1 -0
- package/dist/graph/build-run.d.ts +25 -0
- package/dist/graph/build-run.d.ts.map +1 -0
- package/dist/graph/build-run.js +121 -0
- package/dist/graph/build-run.js.map +1 -0
- package/dist/graph/build.d.ts +88 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +386 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/cards.d.ts +46 -0
- package/dist/graph/cards.d.ts.map +1 -0
- package/dist/graph/cards.js +280 -0
- package/dist/graph/cards.js.map +1 -0
- package/dist/graph/check.d.ts +25 -0
- package/dist/graph/check.d.ts.map +1 -0
- package/dist/graph/check.js +192 -0
- package/dist/graph/check.js.map +1 -0
- package/dist/graph/container.d.ts +63 -0
- package/dist/graph/container.d.ts.map +1 -0
- package/dist/graph/container.js +191 -0
- package/dist/graph/container.js.map +1 -0
- package/dist/graph/depth-parser.d.ts +61 -0
- package/dist/graph/depth-parser.d.ts.map +1 -0
- package/dist/graph/depth-parser.js +153 -0
- package/dist/graph/depth-parser.js.map +1 -0
- package/dist/graph/enrich.d.ts +62 -0
- package/dist/graph/enrich.d.ts.map +1 -0
- package/dist/graph/enrich.js +258 -0
- package/dist/graph/enrich.js.map +1 -0
- package/dist/graph/extract-cache.d.ts +101 -0
- package/dist/graph/extract-cache.d.ts.map +1 -0
- package/dist/graph/extract-cache.js +199 -0
- package/dist/graph/extract-cache.js.map +1 -0
- package/dist/graph/extract.d.ts +85 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +2377 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/fingerprint.d.ts +76 -0
- package/dist/graph/fingerprint.d.ts.map +1 -0
- package/dist/graph/fingerprint.js +160 -0
- package/dist/graph/fingerprint.js.map +1 -0
- package/dist/graph/generic.d.ts +74 -0
- package/dist/graph/generic.d.ts.map +1 -0
- package/dist/graph/generic.js +773 -0
- package/dist/graph/generic.js.map +1 -0
- package/dist/graph/invariants.d.ts +33 -0
- package/dist/graph/invariants.d.ts.map +1 -0
- package/dist/graph/invariants.js +52 -0
- package/dist/graph/invariants.js.map +1 -0
- package/dist/graph/load.d.ts +29 -0
- package/dist/graph/load.d.ts.map +1 -0
- package/dist/graph/load.js +97 -0
- package/dist/graph/load.js.map +1 -0
- package/dist/graph/lsp/client.d.ts +61 -0
- package/dist/graph/lsp/client.d.ts.map +1 -0
- package/dist/graph/lsp/client.js +217 -0
- package/dist/graph/lsp/client.js.map +1 -0
- package/dist/graph/lsp/enrich.d.ts +11 -0
- package/dist/graph/lsp/enrich.d.ts.map +1 -0
- package/dist/graph/lsp/enrich.js +163 -0
- package/dist/graph/lsp/enrich.js.map +1 -0
- package/dist/graph/lsp/registry.d.ts +22 -0
- package/dist/graph/lsp/registry.d.ts.map +1 -0
- package/dist/graph/lsp/registry.js +71 -0
- package/dist/graph/lsp/registry.js.map +1 -0
- package/dist/graph/map.d.ts +107 -0
- package/dist/graph/map.d.ts.map +1 -0
- package/dist/graph/map.js +239 -0
- package/dist/graph/map.js.map +1 -0
- package/dist/graph/markdown.d.ts +22 -0
- package/dist/graph/markdown.d.ts.map +1 -0
- package/dist/graph/markdown.js +143 -0
- package/dist/graph/markdown.js.map +1 -0
- package/dist/graph/native.d.ts +46 -0
- package/dist/graph/native.d.ts.map +1 -0
- package/dist/graph/native.js +169 -0
- package/dist/graph/native.js.map +1 -0
- package/dist/graph/queries/c.scm +13 -0
- package/dist/graph/queries/c_sharp.scm +19 -0
- package/dist/graph/queries/clojure.scm +58 -0
- package/dist/graph/queries/cpp.scm +23 -0
- package/dist/graph/queries/dart.scm +42 -0
- package/dist/graph/queries/elixir.scm +54 -0
- package/dist/graph/queries/gleam.scm +51 -0
- package/dist/graph/queries/java.scm +20 -0
- package/dist/graph/queries/kotlin.scm +43 -0
- package/dist/graph/queries/lua.scm +36 -0
- package/dist/graph/queries/nix.scm +32 -0
- package/dist/graph/queries/php.scm +40 -0
- package/dist/graph/queries/ruby.scm +65 -0
- package/dist/graph/queries/rust.scm +41 -0
- package/dist/graph/queries/scala.scm +66 -0
- package/dist/graph/queries/solidity.scm +43 -0
- package/dist/graph/queries/swift.scm +51 -0
- package/dist/graph/refresh.d.ts +106 -0
- package/dist/graph/refresh.d.ts.map +1 -0
- package/dist/graph/refresh.js +430 -0
- package/dist/graph/refresh.js.map +1 -0
- package/dist/graph/relations.d.ts +14 -0
- package/dist/graph/relations.d.ts.map +1 -0
- package/dist/graph/relations.js +8 -0
- package/dist/graph/relations.js.map +1 -0
- package/dist/graph/resolve.d.ts +17 -0
- package/dist/graph/resolve.d.ts.map +1 -0
- package/dist/graph/resolve.js +716 -0
- package/dist/graph/resolve.js.map +1 -0
- package/dist/graph/root.d.ts +11 -0
- package/dist/graph/root.d.ts.map +1 -0
- package/dist/graph/root.js +40 -0
- package/dist/graph/root.js.map +1 -0
- package/dist/graph/scopes.d.ts +40 -0
- package/dist/graph/scopes.d.ts.map +1 -0
- package/dist/graph/scopes.js +383 -0
- package/dist/graph/scopes.js.map +1 -0
- package/dist/graph/seed.d.ts +38 -0
- package/dist/graph/seed.d.ts.map +1 -0
- package/dist/graph/seed.js +229 -0
- package/dist/graph/seed.js.map +1 -0
- package/dist/graph/source-files.d.ts +46 -0
- package/dist/graph/source-files.d.ts.map +1 -0
- package/dist/graph/source-files.js +118 -0
- package/dist/graph/source-files.js.map +1 -0
- package/dist/graph/traverse-cli.d.ts +55 -0
- package/dist/graph/traverse-cli.d.ts.map +1 -0
- package/dist/graph/traverse-cli.js +189 -0
- package/dist/graph/traverse-cli.js.map +1 -0
- package/dist/graph/traverse.d.ts +112 -0
- package/dist/graph/traverse.d.ts.map +1 -0
- package/dist/graph/traverse.js +192 -0
- package/dist/graph/traverse.js.map +1 -0
- package/dist/graph/types.d.ts +78 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +14 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/graph/wasm-runtime.d.ts +19 -0
- package/dist/graph/wasm-runtime.d.ts.map +1 -0
- package/dist/graph/wasm-runtime.js +38 -0
- package/dist/graph/wasm-runtime.js.map +1 -0
- package/dist/graph/workspace-cli.d.ts +56 -0
- package/dist/graph/workspace-cli.d.ts.map +1 -0
- package/dist/graph/workspace-cli.js +111 -0
- package/dist/graph/workspace-cli.js.map +1 -0
- package/dist/graph/workspace.d.ts +172 -0
- package/dist/graph/workspace.d.ts.map +1 -0
- package/dist/graph/workspace.js +714 -0
- package/dist/graph/workspace.js.map +1 -0
- package/dist/graph/write.d.ts +13 -0
- package/dist/graph/write.d.ts.map +1 -0
- package/dist/graph/write.js +86 -0
- package/dist/graph/write.js.map +1 -0
- package/dist/hosts/antigravity.d.ts +14 -0
- package/dist/hosts/antigravity.d.ts.map +1 -0
- package/dist/hosts/antigravity.js +59 -0
- package/dist/hosts/antigravity.js.map +1 -0
- package/dist/hosts/auto.d.ts +37 -0
- package/dist/hosts/auto.d.ts.map +1 -0
- package/dist/hosts/auto.js +141 -0
- package/dist/hosts/auto.js.map +1 -0
- package/dist/hosts/claude-global.d.ts +72 -0
- package/dist/hosts/claude-global.d.ts.map +1 -0
- package/dist/hosts/claude-global.js +230 -0
- package/dist/hosts/claude-global.js.map +1 -0
- package/dist/hosts/config-write.d.ts +36 -0
- package/dist/hosts/config-write.d.ts.map +1 -0
- package/dist/hosts/config-write.js +64 -0
- package/dist/hosts/config-write.js.map +1 -0
- package/dist/hosts/init.d.ts +28 -0
- package/dist/hosts/init.d.ts.map +1 -0
- package/dist/hosts/init.js +89 -0
- package/dist/hosts/init.js.map +1 -0
- package/dist/hosts/instructions.d.ts +14 -0
- package/dist/hosts/instructions.d.ts.map +1 -0
- package/dist/hosts/instructions.js +95 -0
- package/dist/hosts/instructions.js.map +1 -0
- package/dist/hosts/mcp-config.d.ts +78 -0
- package/dist/hosts/mcp-config.d.ts.map +1 -0
- package/dist/hosts/mcp-config.js +251 -0
- package/dist/hosts/mcp-config.js.map +1 -0
- package/dist/hosts/plan.d.ts +32 -0
- package/dist/hosts/plan.d.ts.map +1 -0
- package/dist/hosts/plan.js +73 -0
- package/dist/hosts/plan.js.map +1 -0
- package/dist/hosts/registry.d.ts +41 -0
- package/dist/hosts/registry.d.ts.map +1 -0
- package/dist/hosts/registry.js +164 -0
- package/dist/hosts/registry.js.map +1 -0
- package/dist/hosts/retract.d.ts +47 -0
- package/dist/hosts/retract.d.ts.map +1 -0
- package/dist/hosts/retract.js +520 -0
- package/dist/hosts/retract.js.map +1 -0
- package/dist/hosts/sections.d.ts +47 -0
- package/dist/hosts/sections.d.ts.map +1 -0
- package/dist/hosts/sections.js +127 -0
- package/dist/hosts/sections.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/fs.d.ts +79 -0
- package/dist/ingest/fs.d.ts.map +1 -0
- package/dist/ingest/fs.js +306 -0
- package/dist/ingest/fs.js.map +1 -0
- package/dist/init-guard.d.ts +16 -0
- package/dist/init-guard.d.ts.map +1 -0
- package/dist/init-guard.js +27 -0
- package/dist/init-guard.js.map +1 -0
- package/dist/mcp/instructions.d.ts +5 -0
- package/dist/mcp/instructions.d.ts.map +1 -0
- package/dist/mcp/instructions.js +64 -0
- package/dist/mcp/instructions.js.map +1 -0
- package/dist/mcp/kept-listing.d.ts +27 -0
- package/dist/mcp/kept-listing.d.ts.map +1 -0
- package/dist/mcp/kept-listing.js +63 -0
- package/dist/mcp/kept-listing.js.map +1 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +147 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-names.d.ts +27 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +47 -0
- package/dist/mcp/tool-names.js.map +1 -0
- package/dist/mcp/tools.d.ts +22 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +440 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/node-version.d.ts +15 -0
- package/dist/node-version.d.ts.map +1 -0
- package/dist/node-version.js +23 -0
- package/dist/node-version.js.map +1 -0
- package/dist/search/grep-cli.d.ts +35 -0
- package/dist/search/grep-cli.d.ts.map +1 -0
- package/dist/search/grep-cli.js +115 -0
- package/dist/search/grep-cli.js.map +1 -0
- package/dist/search/grep.d.ts +60 -0
- package/dist/search/grep.d.ts.map +1 -0
- package/dist/search/grep.js +143 -0
- package/dist/search/grep.js.map +1 -0
- package/dist/search/ignored-code.d.ts +9 -0
- package/dist/search/ignored-code.d.ts.map +1 -0
- package/dist/search/ignored-code.js +73 -0
- package/dist/search/ignored-code.js.map +1 -0
- package/dist/search/user-regexp.d.ts +26 -0
- package/dist/search/user-regexp.d.ts.map +1 -0
- package/dist/search/user-regexp.js +150 -0
- package/dist/search/user-regexp.js.map +1 -0
- package/dist/telemetry/contract.d.ts +117 -0
- package/dist/telemetry/contract.d.ts.map +1 -0
- package/dist/telemetry/contract.js +341 -0
- package/dist/telemetry/contract.js.map +1 -0
- package/dist/telemetry/flush.d.ts +21 -0
- package/dist/telemetry/flush.d.ts.map +1 -0
- package/dist/telemetry/flush.js +85 -0
- package/dist/telemetry/flush.js.map +1 -0
- package/dist/telemetry/gate.d.ts +30 -0
- package/dist/telemetry/gate.d.ts.map +1 -0
- package/dist/telemetry/gate.js +81 -0
- package/dist/telemetry/gate.js.map +1 -0
- package/dist/telemetry/identity.d.ts +40 -0
- package/dist/telemetry/identity.d.ts.map +1 -0
- package/dist/telemetry/identity.js +80 -0
- package/dist/telemetry/identity.js.map +1 -0
- package/dist/telemetry/index.d.ts +18 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +16 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/key.d.ts +21 -0
- package/dist/telemetry/key.d.ts.map +1 -0
- package/dist/telemetry/key.js +49 -0
- package/dist/telemetry/key.js.map +1 -0
- package/dist/telemetry/notice.d.ts +19 -0
- package/dist/telemetry/notice.d.ts.map +1 -0
- package/dist/telemetry/notice.js +93 -0
- package/dist/telemetry/notice.js.map +1 -0
- package/dist/telemetry/queue.d.ts +35 -0
- package/dist/telemetry/queue.d.ts.map +1 -0
- package/dist/telemetry/queue.js +162 -0
- package/dist/telemetry/queue.js.map +1 -0
- package/dist/telemetry/send.d.ts +19 -0
- package/dist/telemetry/send.d.ts.map +1 -0
- package/dist/telemetry/send.js +84 -0
- package/dist/telemetry/send.js.map +1 -0
- package/dist/telemetry/sessions.d.ts +25 -0
- package/dist/telemetry/sessions.d.ts.map +1 -0
- package/dist/telemetry/sessions.js +104 -0
- package/dist/telemetry/sessions.js.map +1 -0
- package/dist/telemetry/track.d.ts +62 -0
- package/dist/telemetry/track.d.ts.map +1 -0
- package/dist/telemetry/track.js +143 -0
- package/dist/telemetry/track.js.map +1 -0
- package/dist/upkeep-run.d.ts +22 -0
- package/dist/upkeep-run.d.ts.map +1 -0
- package/dist/upkeep-run.js +85 -0
- package/dist/upkeep-run.js.map +1 -0
- package/dist/upkeep.d.ts +127 -0
- package/dist/upkeep.d.ts.map +1 -0
- package/dist/upkeep.js +252 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/util/actions-folder.d.ts +2 -0
- package/dist/util/actions-folder.d.ts.map +1 -0
- package/dist/util/actions-folder.js +9 -0
- package/dist/util/actions-folder.js.map +1 -0
- package/dist/util/browser.d.ts +3 -0
- package/dist/util/browser.d.ts.map +1 -0
- package/dist/util/browser.js +14 -0
- package/dist/util/browser.js.map +1 -0
- package/dist/util/child-process.d.ts +15 -0
- package/dist/util/child-process.d.ts.map +1 -0
- package/dist/util/child-process.js +15 -0
- package/dist/util/child-process.js.map +1 -0
- package/dist/util/front-matter.d.ts +46 -0
- package/dist/util/front-matter.d.ts.map +1 -0
- package/dist/util/front-matter.js +113 -0
- package/dist/util/front-matter.js.map +1 -0
- package/dist/util/id.d.ts +7 -0
- package/dist/util/id.d.ts.map +1 -0
- package/dist/util/id.js +14 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/paths.d.ts +29 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +71 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/private-file.d.ts +14 -0
- package/dist/util/private-file.d.ts.map +1 -0
- package/dist/util/private-file.js +82 -0
- package/dist/util/private-file.js.map +1 -0
- package/dist/util/source.d.ts +4 -0
- package/dist/util/source.d.ts.map +1 -0
- package/dist/util/source.js +12 -0
- package/dist/util/source.js.map +1 -0
- package/dist/util/spinner.d.ts +15 -0
- package/dist/util/spinner.d.ts.map +1 -0
- package/dist/util/spinner.js +52 -0
- package/dist/util/spinner.js.map +1 -0
- package/dist/util/state.d.ts +120 -0
- package/dist/util/state.d.ts.map +1 -0
- package/dist/util/state.js +264 -0
- package/dist/util/state.js.map +1 -0
- package/dist/vendor/grammars/tree-sitter-go.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-go.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-java.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-java.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-kotlin.LICENSE +9 -0
- package/dist/vendor/grammars/tree-sitter-kotlin.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-php.LICENSE +22 -0
- package/dist/vendor/grammars/tree-sitter-php.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-python.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-python.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-r.LICENSE +9 -0
- package/dist/vendor/grammars/tree-sitter-r.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-swift.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-swift.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-tsx.wasm +0 -0
- package/dist/vendor/grammars/tree-sitter-typescript.LICENSE +21 -0
- package/dist/vendor/grammars/tree-sitter-typescript.wasm +0 -0
- package/dist/viewer/app.js +2 -0
- package/dist/viewer/index.html +49 -0
- package/dist/viewer/style.css +154 -0
- package/dist/viz/assemble.d.ts +83 -0
- package/dist/viz/assemble.d.ts.map +1 -0
- package/dist/viz/assemble.js +101 -0
- package/dist/viz/assemble.js.map +1 -0
- package/dist/viz/export.d.ts +39 -0
- package/dist/viz/export.d.ts.map +1 -0
- package/dist/viz/export.js +98 -0
- package/dist/viz/export.js.map +1 -0
- package/dist/viz/serve.d.ts +13 -0
- package/dist/viz/serve.d.ts.map +1 -0
- package/dist/viz/serve.js +130 -0
- package/dist/viz/serve.js.map +1 -0
- package/package.json +115 -4
- package/scripts/build-grammar-wasm.mjs +112 -0
- package/scripts/build-viewer.mjs +44 -0
- package/scripts/graph-quality.mjs +117 -0
- package/scripts/pack-trail.mjs +53 -0
- package/scripts/postinstall.mjs +65 -0
- package/scripts/run-tests.mjs +72 -0
- package/scripts/stamp-telemetry-key.mjs +56 -0
- package/scripts/tally-audit.mjs +140 -0
- package/scripts/vendor-grammars.mjs +53 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 "wiring cards" — the passive-channel surface of the wiring graph.
|
|
3
|
+
*
|
|
4
|
+
* The wiring graph itself lives as machine-only JSON in `graft/.graph/wiring.json`
|
|
5
|
+
* (nodes + edges), which an agent never greps or reads. This module projects its
|
|
6
|
+
* NODES up into markdown: one small card per source file, mirroring the source
|
|
7
|
+
* tree under `graft/` (e.g. `graft/src/ai/providers.md`). Each card lists the
|
|
8
|
+
* file's symbols with their `L<start>-L<end>` spans and a one-line description, so
|
|
9
|
+
* a `grep <symbol>` / `find <name>` / `cat` lands on the card and the agent reads
|
|
10
|
+
* ~150 tokens instead of the whole source file. Edges stay in the JSON — you can't
|
|
11
|
+
* grep a traversal — and are reached through `graft ask`.
|
|
12
|
+
*
|
|
13
|
+
* Cards are a pure projection: no LLM work here. The one-liner is the node's LLM
|
|
14
|
+
* `summary` when present (after `graft build --deep`), else its deterministic
|
|
15
|
+
* `signature`, so cards are useful even in a $0 structure-only build.
|
|
16
|
+
*/
|
|
17
|
+
import { mkdirSync, writeFileSync, readFileSync, existsSync, readdirSync, rmSync } from "node:fs";
|
|
18
|
+
import { dirname, join } from "node:path";
|
|
19
|
+
import { relPosix } from "../util/paths.js";
|
|
20
|
+
import { matter } from "../util/front-matter.js";
|
|
21
|
+
import { CACHE_DIR, readNodes } from "../context/node-file.js";
|
|
22
|
+
import { GRAPH_DIR } from "./write.js";
|
|
23
|
+
import { inBrand } from "../brand.js";
|
|
24
|
+
const INDEX_FILE = "INDEX.md";
|
|
25
|
+
/** Where a root-level file card goes when `graft/<stem>.md` is already a concept
|
|
26
|
+
* node (same stem as a slug — Laravel `server.php` vs a "Server" concept). */
|
|
27
|
+
const ROOT_CARD_DIR = "_root";
|
|
28
|
+
function writeIfChanged(path, content) {
|
|
29
|
+
if (existsSync(path) && readFileSync(path, "utf8") === content)
|
|
30
|
+
return;
|
|
31
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
32
|
+
writeFileSync(path, content);
|
|
33
|
+
}
|
|
34
|
+
/** True when `path` is an existing concept node (frontmatter carries `slug`). */
|
|
35
|
+
function isConceptNodeFile(path) {
|
|
36
|
+
if (!existsSync(path))
|
|
37
|
+
return false;
|
|
38
|
+
try {
|
|
39
|
+
const fm = matter(readFileSync(path, "utf8")).data;
|
|
40
|
+
return fm.slug != null && String(fm.slug).length > 0;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/** The card path for a source path: mirror the tree, swap the extension for .md.
|
|
47
|
+
* Root-level sources share `graft/` with concept nodes. If that filename is
|
|
48
|
+
* already a concept, park the file card under `_root/` instead of clobbering it. */
|
|
49
|
+
function cardPathFor(outDir, sourcePath) {
|
|
50
|
+
const md = sourcePath.replace(/\.[^./]+$/, "") + ".md";
|
|
51
|
+
const primary = join(outDir, md);
|
|
52
|
+
if (sourcePath.includes("/"))
|
|
53
|
+
return primary;
|
|
54
|
+
if (isConceptNodeFile(primary))
|
|
55
|
+
return join(outDir, ROOT_CARD_DIR, md);
|
|
56
|
+
return primary;
|
|
57
|
+
}
|
|
58
|
+
/** Starting line of an "L43-L55" span, for stable ordering (0 if unparseable). */
|
|
59
|
+
function spanStart(span) {
|
|
60
|
+
const m = /^L(\d+)/.exec(span);
|
|
61
|
+
return m ? Number(m[1]) : 0;
|
|
62
|
+
}
|
|
63
|
+
/** First line of a node's meaning: LLM summary if ready, else its signature. */
|
|
64
|
+
function oneLiner(node) {
|
|
65
|
+
const s = node.summary?.trim();
|
|
66
|
+
if (s)
|
|
67
|
+
return s.split("\n")[0].trim();
|
|
68
|
+
return node.signature?.trim() ?? "";
|
|
69
|
+
}
|
|
70
|
+
/** path → concept-node slugs that cite it as a source (for the up-links). */
|
|
71
|
+
function conceptsByPath(outDir) {
|
|
72
|
+
const map = new Map();
|
|
73
|
+
for (const node of readNodes(outDir)) {
|
|
74
|
+
for (const src of node.sources) {
|
|
75
|
+
const list = map.get(src.path) ?? [];
|
|
76
|
+
list.push(node.slug);
|
|
77
|
+
map.set(src.path, list);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return map;
|
|
81
|
+
}
|
|
82
|
+
/** Render one file's card. `fileNode` may be absent for parse-only fragments. */
|
|
83
|
+
function renderCard(sourcePath, fileNode, symbols, conceptSlugs) {
|
|
84
|
+
const uplinks = conceptSlugs
|
|
85
|
+
.sort()
|
|
86
|
+
.map((s) => `[[${s}]]`)
|
|
87
|
+
.join(" ");
|
|
88
|
+
const head = uplinks ? `# ${sourcePath} · ${uplinks}` : `# ${sourcePath}`;
|
|
89
|
+
const lines = [head, ""];
|
|
90
|
+
const fileSummary = fileNode ? oneLiner(fileNode) : "";
|
|
91
|
+
if (fileSummary)
|
|
92
|
+
lines.push(fileSummary, "");
|
|
93
|
+
const sorted = [...symbols].sort((a, b) => spanStart(a.span) - spanStart(b.span) || a.name.localeCompare(b.name));
|
|
94
|
+
for (const n of sorted) {
|
|
95
|
+
const desc = oneLiner(n);
|
|
96
|
+
const tail = desc ? ` — ${desc}` : "";
|
|
97
|
+
lines.push(`- ${n.name} · ${n.kind} · ${n.span}${tail}`);
|
|
98
|
+
}
|
|
99
|
+
if (sorted.length === 0)
|
|
100
|
+
lines.push("_No extracted symbols in this file._");
|
|
101
|
+
return lines.join("\n") + "\n";
|
|
102
|
+
}
|
|
103
|
+
/** Every existing card file (`.md` inside subdirs of outDir; not concept nodes). */
|
|
104
|
+
function listExistingCards(outDir) {
|
|
105
|
+
const out = [];
|
|
106
|
+
const walk = (dir) => {
|
|
107
|
+
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
108
|
+
if (e.isDirectory()) {
|
|
109
|
+
if (dir === outDir && (e.name === CACHE_DIR || e.name === GRAPH_DIR))
|
|
110
|
+
continue;
|
|
111
|
+
walk(join(dir, e.name));
|
|
112
|
+
}
|
|
113
|
+
else if (e.isFile() && e.name.endsWith(".md")) {
|
|
114
|
+
out.push(join(dir, e.name));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
for (const e of readdirSync(outDir, { withFileTypes: true })) {
|
|
119
|
+
// Concept nodes and INDEX.md are top-level files — skip. Cards live in
|
|
120
|
+
// subdirs (`src/…`, and `_root/` when a root card would collide with a concept).
|
|
121
|
+
if (e.isDirectory() && e.name !== CACHE_DIR && e.name !== GRAPH_DIR) {
|
|
122
|
+
walk(join(outDir, e.name));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
/** Remove now-empty directories under outDir (bottom-up), skipping .cache/.graph. */
|
|
128
|
+
function pruneEmptyDirs(outDir) {
|
|
129
|
+
const visit = (dir) => {
|
|
130
|
+
// returns true if dir is empty after visiting children
|
|
131
|
+
let empty = true;
|
|
132
|
+
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
133
|
+
if (dir === outDir && (e.name === CACHE_DIR || e.name === GRAPH_DIR)) {
|
|
134
|
+
empty = false;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const child = join(dir, e.name);
|
|
138
|
+
if (e.isDirectory()) {
|
|
139
|
+
if (visit(child))
|
|
140
|
+
rmSync(child, { recursive: true, force: true });
|
|
141
|
+
else
|
|
142
|
+
empty = false;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
empty = false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return empty;
|
|
149
|
+
};
|
|
150
|
+
if (existsSync(outDir))
|
|
151
|
+
visit(outDir);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Write one wiring card per source file into `outDir`, mirroring the source tree,
|
|
155
|
+
* and prune cards whose source no longer exists. Returns what changed.
|
|
156
|
+
*/
|
|
157
|
+
export function writeCards(graph, outDir) {
|
|
158
|
+
const byPath = new Map();
|
|
159
|
+
for (const n of graph.nodes) {
|
|
160
|
+
const list = byPath.get(n.path) ?? [];
|
|
161
|
+
list.push(n);
|
|
162
|
+
byPath.set(n.path, list);
|
|
163
|
+
}
|
|
164
|
+
const concepts = conceptsByPath(outDir);
|
|
165
|
+
const written = new Set();
|
|
166
|
+
const files = [];
|
|
167
|
+
for (const [sourcePath, group] of byPath) {
|
|
168
|
+
const fileNode = group.find((n) => n.kind === "file");
|
|
169
|
+
const symbols = group.filter((n) => n.kind !== "file");
|
|
170
|
+
const cardPath = cardPathFor(outDir, sourcePath);
|
|
171
|
+
writeIfChanged(cardPath, renderCard(sourcePath, fileNode, symbols, concepts.get(sourcePath) ?? []));
|
|
172
|
+
written.add(cardPath);
|
|
173
|
+
files.push({ card: relPosix(outDir, cardPath), path: sourcePath, symbols: symbols.length });
|
|
174
|
+
}
|
|
175
|
+
let pruned = 0;
|
|
176
|
+
for (const existing of listExistingCards(outDir)) {
|
|
177
|
+
if (!written.has(existing)) {
|
|
178
|
+
rmSync(existing);
|
|
179
|
+
pruned++;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
pruneEmptyDirs(outDir);
|
|
183
|
+
files.sort((a, b) => a.card.localeCompare(b.card));
|
|
184
|
+
return { written: written.size, pruned, files };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Write `graft/INDEX.md` — the roster an agent `cat`s to orient. Lists the concept
|
|
188
|
+
* nodes on disk and the per-file cards. Deterministic order; no timestamps.
|
|
189
|
+
*/
|
|
190
|
+
export function writeIndex(outDir, files) {
|
|
191
|
+
// Spelled by the name that built it: a trail-only machine has no `graft` to run.
|
|
192
|
+
const lines = [
|
|
193
|
+
"# graft — repo map",
|
|
194
|
+
"",
|
|
195
|
+
"Small markdown nodes summarising this repo. `grep` any term, symbol, or",
|
|
196
|
+
'filename here, or run `graft ask "<task>"`. Each node carries prose plus exact',
|
|
197
|
+
"`file:line`; open a source file only to edit the named span.",
|
|
198
|
+
"",
|
|
199
|
+
// Whoever reads this file has already decided to look at graft, so this is the
|
|
200
|
+
// one place a pointer to the richer surface is welcome rather than noise. Stated
|
|
201
|
+
// as what exists, not as an instruction — see `mcp/instructions.ts` for why.
|
|
202
|
+
"The same graph is queryable as MCP tools (`graft_find_code`, `graft_find_all`,",
|
|
203
|
+
"`graft_trace_calls`, `graft_file_api`, `graft_repo_map`) where a host exposes them, and",
|
|
204
|
+
"as the `graft` CLI everywhere else. Edges — who calls what — live only in the",
|
|
205
|
+
"graph, not in these files: `graft callers <symbol>` is the only way to read them.",
|
|
206
|
+
"",
|
|
207
|
+
].map((l) => inBrand(l));
|
|
208
|
+
const concepts = readNodes(outDir).sort((a, b) => a.slug.localeCompare(b.slug));
|
|
209
|
+
if (concepts.length) {
|
|
210
|
+
lines.push("## Concepts", "");
|
|
211
|
+
for (const c of concepts) {
|
|
212
|
+
const srcs = c.sources.map((s) => s.path).join(", ");
|
|
213
|
+
const tail = srcs ? ` · ${srcs}` : "";
|
|
214
|
+
lines.push(`- [${c.slug}](${c.slug}.md) — ${c.name || c.slug}${tail}`);
|
|
215
|
+
}
|
|
216
|
+
lines.push("");
|
|
217
|
+
}
|
|
218
|
+
if (files.length) {
|
|
219
|
+
const withSymbols = files.filter((f) => f.symbols > 0).length;
|
|
220
|
+
lines.push("## Files", "");
|
|
221
|
+
lines.push(`${files.length} per-file wiring cards mirror the source tree under \`graft/\` ` +
|
|
222
|
+
`(${withSymbols} carry extracted symbols). They are deliberately not enumerated here —`, "`grep` a symbol or `find`/`ls` a filename under `graft/` to land on the card for that file.", "");
|
|
223
|
+
}
|
|
224
|
+
writeIfChanged(join(outDir, INDEX_FILE), lines.join("\n"));
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Backfill each concept node's frontmatter with a `covers:` list — the symbols
|
|
228
|
+
* (and their exact `file:line`) it spans, read from the wiring graph. This is the
|
|
229
|
+
* explicit OKF↔Wiring link: it doubles as grep bait (a `grep <symbol>` lands on
|
|
230
|
+
* the prose node, not just its card) and lets an agent read the span straight
|
|
231
|
+
* from the node without ever opening `wiring.json`.
|
|
232
|
+
*
|
|
233
|
+
* A surgical frontmatter patch: the generated body and every other key are
|
|
234
|
+
* preserved verbatim; only `covers` is added/replaced. Concept nodes are the
|
|
235
|
+
* top-level `.md` files that carry a `slug` (cards live in subdirs, or at the
|
|
236
|
+
* top level without a slug when they mirror a root source; INDEX.md is skipped).
|
|
237
|
+
* On a $0 structure-only build there are no concept nodes, so this is a no-op.
|
|
238
|
+
* Returns the number of nodes enriched.
|
|
239
|
+
*/
|
|
240
|
+
export function writeCovers(graph, outDir) {
|
|
241
|
+
if (!existsSync(outDir))
|
|
242
|
+
return 0;
|
|
243
|
+
const symbolsByPath = new Map();
|
|
244
|
+
for (const n of graph.nodes) {
|
|
245
|
+
if (n.kind === "file")
|
|
246
|
+
continue;
|
|
247
|
+
const list = symbolsByPath.get(n.path) ?? [];
|
|
248
|
+
list.push(n);
|
|
249
|
+
symbolsByPath.set(n.path, list);
|
|
250
|
+
}
|
|
251
|
+
for (const list of symbolsByPath.values()) {
|
|
252
|
+
list.sort((a, b) => spanStart(a.span) - spanStart(b.span) || a.name.localeCompare(b.name));
|
|
253
|
+
}
|
|
254
|
+
let enriched = 0;
|
|
255
|
+
for (const entry of readdirSync(outDir)) {
|
|
256
|
+
if (!entry.endsWith(".md") || entry === INDEX_FILE)
|
|
257
|
+
continue;
|
|
258
|
+
const full = join(outDir, entry);
|
|
259
|
+
const parsed = matter(readFileSync(full, "utf8"));
|
|
260
|
+
// Root-level file cards have no concept slug; stamping `covers: []` onto
|
|
261
|
+
// them made readNodes treat them as concept nodes (#261).
|
|
262
|
+
if (parsed.data.slug == null || String(parsed.data.slug).length === 0)
|
|
263
|
+
continue;
|
|
264
|
+
const sources = Array.isArray(parsed.data.sources)
|
|
265
|
+
? parsed.data.sources
|
|
266
|
+
: [];
|
|
267
|
+
const covers = [];
|
|
268
|
+
for (const path of [...new Set(sources.map((s) => s.path ?? ""))].sort()) {
|
|
269
|
+
for (const n of symbolsByPath.get(path) ?? []) {
|
|
270
|
+
covers.push({ symbol: n.name, kind: n.kind, at: `${n.path}:${n.span}` });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// Re-stringify with covers appended last, so re-runs produce a stable diff.
|
|
274
|
+
const { covers: _prev, ...rest } = parsed.data;
|
|
275
|
+
writeIfChanged(full, matter.stringify(parsed.content, { ...rest, covers }));
|
|
276
|
+
enriched++;
|
|
277
|
+
}
|
|
278
|
+
return enriched;
|
|
279
|
+
}
|
|
280
|
+
//# sourceMappingURL=cards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.js","sourceRoot":"","sources":["../../src/graph/cards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,UAAU,GAAG,UAAU,CAAC;AAC9B;8EAC8E;AAC9E,MAAM,aAAa,G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AAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;QAED,4EAA4E;QAC5E,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,IAA+B,CAAC;QAC1E,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAC5E,QAAQ,EAAE,CAAC;IACb,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface GraphCheckResult {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
/** True when there is no graph.json (a graph has never been built). */
|
|
4
|
+
missing: boolean;
|
|
5
|
+
added: string[];
|
|
6
|
+
removed: string[];
|
|
7
|
+
changed: string[];
|
|
8
|
+
stale: string[];
|
|
9
|
+
/** Nodes never summarized (reported for context; not counted as drift). */
|
|
10
|
+
pending: number;
|
|
11
|
+
/** Ids of pending nodes (capped when formatting) — so a stuck meaning pass
|
|
12
|
+
* names the files instead of only saying "run --deep" (#172). */
|
|
13
|
+
pendingIds: string[];
|
|
14
|
+
/** Committed nodes in total — the denominator that turns `pending` into a
|
|
15
|
+
* coverage figure. A deep build that lost most of its LLM calls (#127) is only
|
|
16
|
+
* distinguishable from a deliberate Tier-1 build by the SHARE that is missing. */
|
|
17
|
+
nodes: number;
|
|
18
|
+
}
|
|
19
|
+
export interface GraphCheckOptions {
|
|
20
|
+
contextDir?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function checkGraph(dir: string, opts?: GraphCheckOptions): Promise<GraphCheckResult>;
|
|
23
|
+
/** Render a graph-check result as a human-readable report. */
|
|
24
|
+
export declare function formatGraphCheckReport(r: GraphCheckResult): string;
|
|
25
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/graph/check.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,uEAAuE;IACvE,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,2EAA2E;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB;qEACiE;IACjE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;sFAEkF;IAClF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CAiG3B;AAED,8DAA8D;AAC9D,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAkClE"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `checkGraph` — is the committed `graph.json` still in sync with the code?
|
|
3
|
+
*
|
|
4
|
+
* Deterministic and fast (tree-sitter only, no LLM, no network): it re-runs
|
|
5
|
+
* Tier-1 extraction and diffs the fresh node set against the committed graph by
|
|
6
|
+
* `id` and `body_hash`. Meant for CI — exit non-zero when a PR changed code but
|
|
7
|
+
* didn't rebuild the graph.
|
|
8
|
+
*
|
|
9
|
+
* Drift categories:
|
|
10
|
+
* added a definition exists in code but not in graph.json (run `graph`)
|
|
11
|
+
* removed a node in graph.json no longer exists in code (run `graph`)
|
|
12
|
+
* changed a node's body_hash differs from the committed one (run `graph`)
|
|
13
|
+
* stale a committed node's summary is flagged stale — its body changed
|
|
14
|
+
* since it was last summarized (run `graft build --deep`)
|
|
15
|
+
*
|
|
16
|
+
* `added`/`removed`/`changed` are structural: the graph no longer describes the
|
|
17
|
+
* code. `stale` is a meaning-layer signal the last build already recorded.
|
|
18
|
+
* `pending` (never summarized) is not drift — it's a deliberate Tier-1-only build.
|
|
19
|
+
*/
|
|
20
|
+
import { resolve } from "node:path";
|
|
21
|
+
import { relPosix } from "../util/paths.js";
|
|
22
|
+
import { contextDirFor } from "../context/node-file.js";
|
|
23
|
+
import { extractFile } from "./extract.js";
|
|
24
|
+
import { extractGeneric } from "./generic.js";
|
|
25
|
+
import { extractContainer } from "./container.js";
|
|
26
|
+
import { listSourceFiles, tierOf, warmGrammarsFor } from "./build.js";
|
|
27
|
+
import { readGraph, wiringPath } from "./write.js";
|
|
28
|
+
import { readFingerprint } from "./fingerprint.js";
|
|
29
|
+
import { readSourceFile } from "../util/source.js";
|
|
30
|
+
import { cmd } from "../brand.js";
|
|
31
|
+
// async: the breadth tier's WASM grammars load asynchronously and must be warmed
|
|
32
|
+
// before the (synchronous) re-extraction below, exactly as buildGraph does — else
|
|
33
|
+
// breadth-tier files (.rs, …) would re-extract as empty here and read as `removed`
|
|
34
|
+
// against a graph that built them, so `graft check` would never report OK.
|
|
35
|
+
export async function checkGraph(dir, opts = {}) {
|
|
36
|
+
const root = resolve(dir);
|
|
37
|
+
const outDir = contextDirFor(root, opts.contextDir);
|
|
38
|
+
const result = {
|
|
39
|
+
ok: false,
|
|
40
|
+
missing: false,
|
|
41
|
+
added: [],
|
|
42
|
+
removed: [],
|
|
43
|
+
changed: [],
|
|
44
|
+
stale: [],
|
|
45
|
+
pending: 0,
|
|
46
|
+
pendingIds: [],
|
|
47
|
+
nodes: 0,
|
|
48
|
+
};
|
|
49
|
+
const committed = readGraph(wiringPath(outDir));
|
|
50
|
+
if (!committed) {
|
|
51
|
+
result.missing = true;
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
// Freshly extract Tier-1 nodes from the code on disk (same file set as build).
|
|
55
|
+
// A `--only-dir` build records its whitelist in the fingerprint; read it back
|
|
56
|
+
// so `check` diffs the same limited set instead of flagging every excluded
|
|
57
|
+
// file as "added".
|
|
58
|
+
const fpOnlyDirs = readFingerprint(outDir)?.onlyDirs;
|
|
59
|
+
const onlyDirs = fpOnlyDirs && fpOnlyDirs.length > 0 ? new Set(fpOnlyDirs) : undefined;
|
|
60
|
+
const sourceFiles = listSourceFiles(root, outDir, undefined, onlyDirs);
|
|
61
|
+
// Container-tier grammars need the same warmup as the generic ones, for the same
|
|
62
|
+
// reason: extraction below is synchronous. Missing that is what made `graft
|
|
63
|
+
// check` report every `.vue` node as `removed` right after a clean build (#236)
|
|
64
|
+
// — the tier extracted fine, and then the check had no branch that could see it.
|
|
65
|
+
// The same call warms the WASM stand-in for a depth language whose native
|
|
66
|
+
// grammar didn't load, exactly as the build does.
|
|
67
|
+
await warmGrammarsFor(sourceFiles);
|
|
68
|
+
const current = new Map(); // id → body_hash
|
|
69
|
+
for (const file of sourceFiles) {
|
|
70
|
+
// The same dispatch `buildGraph` uses (`tierOf`). The two must stay in step: a
|
|
71
|
+
// tier the build extracts and the check cannot see reports as `removed`
|
|
72
|
+
// forever, and the `graft build` the check tells you to run can never repair it.
|
|
73
|
+
const { lang, container, generic } = tierOf(file);
|
|
74
|
+
let source;
|
|
75
|
+
try {
|
|
76
|
+
source = readSourceFile(file);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
continue; // unreadable now → its nodes show up as `removed` below
|
|
80
|
+
}
|
|
81
|
+
if (source === null)
|
|
82
|
+
continue; // unsupported encoding (e.g. UTF-16BE)
|
|
83
|
+
const rel = relPosix(root, file);
|
|
84
|
+
try {
|
|
85
|
+
const extracted = lang
|
|
86
|
+
? extractFile(rel, source, lang)
|
|
87
|
+
: container
|
|
88
|
+
? extractContainer(rel, source, container)
|
|
89
|
+
: generic
|
|
90
|
+
? extractGeneric(rel, source, generic.name)
|
|
91
|
+
: null;
|
|
92
|
+
// No tier claims this file. Spelled out rather than asserted away: the
|
|
93
|
+
// `generic!` that used to stand in this position threw a TypeError on a
|
|
94
|
+
// container-tier file, the catch below swallowed it as a parse failure, and
|
|
95
|
+
// a missing branch became a silent permanent `removed` (#236). Returning
|
|
96
|
+
// null here means the next tier graft gains fails loudly in the type
|
|
97
|
+
// checker instead.
|
|
98
|
+
if (extracted === null)
|
|
99
|
+
continue;
|
|
100
|
+
for (const n of extracted.nodes)
|
|
101
|
+
current.set(n.id, n.body_hash);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// parse failure → skip; the committed nodes for this file become `removed`.
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const committedById = new Map(committed.nodes.map((n) => [n.id, n]));
|
|
108
|
+
result.nodes = committedById.size;
|
|
109
|
+
for (const [id, node] of committedById) {
|
|
110
|
+
const now = current.get(id);
|
|
111
|
+
if (now === undefined)
|
|
112
|
+
result.removed.push(id);
|
|
113
|
+
else if (now !== node.body_hash)
|
|
114
|
+
result.changed.push(id);
|
|
115
|
+
if (node.summary_state === "stale")
|
|
116
|
+
result.stale.push(id);
|
|
117
|
+
if (node.summary_state === "pending") {
|
|
118
|
+
result.pending++;
|
|
119
|
+
result.pendingIds.push(id);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
for (const id of current.keys()) {
|
|
123
|
+
if (!committedById.has(id))
|
|
124
|
+
result.added.push(id);
|
|
125
|
+
}
|
|
126
|
+
for (const arr of [result.added, result.removed, result.changed, result.stale, result.pendingIds]) {
|
|
127
|
+
arr.sort();
|
|
128
|
+
}
|
|
129
|
+
result.ok =
|
|
130
|
+
result.added.length === 0 &&
|
|
131
|
+
result.removed.length === 0 &&
|
|
132
|
+
result.changed.length === 0 &&
|
|
133
|
+
result.stale.length === 0;
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
/** Render a graph-check result as a human-readable report. */
|
|
137
|
+
export function formatGraphCheckReport(r) {
|
|
138
|
+
if (r.missing) {
|
|
139
|
+
return `graph check: NO GRAPH\n\nNo graft/.graph/wiring.json found. Run \`${cmd("graft build")}\` first.`;
|
|
140
|
+
}
|
|
141
|
+
if (r.ok) {
|
|
142
|
+
// A share, not a bare count: "1203 not yet summarized" reads the same whether
|
|
143
|
+
// the repo was never deep-built or a deep build failed most of its calls.
|
|
144
|
+
const pct = r.nodes > 0 ? Math.round(((r.nodes - r.pending) / r.nodes) * 100) : 0;
|
|
145
|
+
const note = r.pending ? ` (${formatPendingNote(r, pct)})` : "";
|
|
146
|
+
return `graph check: OK — the wiring graph is in sync with the code.${note}`;
|
|
147
|
+
}
|
|
148
|
+
const lines = ["graph check: STALE", ""];
|
|
149
|
+
const structural = r.added.length + r.removed.length + r.changed.length;
|
|
150
|
+
if (r.changed.length) {
|
|
151
|
+
lines.push(`changed (${r.changed.length}):`);
|
|
152
|
+
for (const id of r.changed)
|
|
153
|
+
lines.push(` ~ ${id}`);
|
|
154
|
+
}
|
|
155
|
+
if (r.added.length) {
|
|
156
|
+
lines.push(`added (${r.added.length}):`);
|
|
157
|
+
for (const id of r.added)
|
|
158
|
+
lines.push(` + ${id}`);
|
|
159
|
+
}
|
|
160
|
+
if (r.removed.length) {
|
|
161
|
+
lines.push(`removed (${r.removed.length}):`);
|
|
162
|
+
for (const id of r.removed)
|
|
163
|
+
lines.push(` - ${id}`);
|
|
164
|
+
}
|
|
165
|
+
if (r.stale.length) {
|
|
166
|
+
lines.push(`stale summaries (${r.stale.length}):`);
|
|
167
|
+
for (const id of r.stale)
|
|
168
|
+
lines.push(` ! ${id}`);
|
|
169
|
+
}
|
|
170
|
+
lines.push("");
|
|
171
|
+
if (structural)
|
|
172
|
+
lines.push(`Run \`${cmd("graft build")}\` to rebuild the structure, then commit graft/.`);
|
|
173
|
+
if (r.stale.length)
|
|
174
|
+
lines.push(`Run \`${cmd("graft build --deep")}\` to refresh stale summaries.`);
|
|
175
|
+
return lines.join("\n");
|
|
176
|
+
}
|
|
177
|
+
/** Cap how many pending ids the OK-note lists so a large Tier-1 graph stays readable. */
|
|
178
|
+
const PENDING_SAMPLE = 8;
|
|
179
|
+
function formatPendingNote(r, pct) {
|
|
180
|
+
const ids = r.pendingIds ?? [];
|
|
181
|
+
const sample = ids.slice(0, PENDING_SAMPLE);
|
|
182
|
+
const more = ids.length > PENDING_SAMPLE ? `, … +${ids.length - PENDING_SAMPLE} more` : "";
|
|
183
|
+
const named = sample.length ? `: ${sample.join(", ")}${more}` : "";
|
|
184
|
+
// Tier-1-only builds are supposed to leave everything pending — "run --deep"
|
|
185
|
+
// is the right next step. A deep build that still left them pending used to
|
|
186
|
+
// dead-end here (#172): re-running the same command never cleared empty/failed
|
|
187
|
+
// meaning replies, so name the nodes and point at the last build's errors.
|
|
188
|
+
return (`meaning tier ${pct}% complete — ${r.pending} of ${r.nodes} node(s) pending${named}. ` +
|
|
189
|
+
`Run \`${cmd("graft build --deep")}\` to summarize them; if a deep build already left these pending, ` +
|
|
190
|
+
`that meaning pass failed — see that build's errors (re-running alone will not clear them)`);
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/graph/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;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CAAC,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,oBAAoB,CAAC,gCAAgC,CAAC,CAAC;IACnG,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,yFAAyF;AACzF,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,SAAS,iBAAiB,CAAC,CAAmB,EAAE,GAAW;IACzD,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC;IAC/B,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,MAAM,GAAG,cAAc,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,6EAA6E;IAC7E,4EAA4E;IAC5E,+EAA+E;IAC/E,2EAA2E;IAC3E,OAAO,CACL,gBAAgB,GAAG,gBAAgB,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,mBAAmB,KAAK,IAAI;QACtF,SAAS,GAAG,CAAC,oBAAoB,CAAC,oEAAoE;QACtG,2FAA2F,CAC5F,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container tier — files that are not a language but a wrapper around one.
|
|
3
|
+
*
|
|
4
|
+
* A Vue SFC is the motivating case: `.vue` is HTML-shaped, and everything worth
|
|
5
|
+
* indexing lives inside its `<script>` block. Registering `tree-sitter-vue` as a
|
|
6
|
+
* breadth-tier language (generic.ts) would not help — that grammar parses the
|
|
7
|
+
* shell (`<template>` / `<script>` / `<style>`) and hands back the script body as
|
|
8
|
+
* one opaque `raw_text` node, so the cards would come out empty.
|
|
9
|
+
*
|
|
10
|
+
* So the container grammar is used only to answer "where does the embedded
|
|
11
|
+
* language start and end", and the block itself goes to the DEPTH-tier extractor
|
|
12
|
+
* (extract.ts). A `.vue` file therefore gets the same quality of extraction as a
|
|
13
|
+
* `.ts` file — bindings, imports, resolved calls — not the signature-only output
|
|
14
|
+
* the breadth tier would give.
|
|
15
|
+
*
|
|
16
|
+
* **The span shift is the whole risk here.** `extractFile` numbers its spans from
|
|
17
|
+
* the start of the string it was handed, so every node comes back pointing at a
|
|
18
|
+
* line in the script, not in the `.vue`. A span that is off by even one line is
|
|
19
|
+
* worse than not indexing the file at all: graft's promise is that its
|
|
20
|
+
* `file:line` is exact, and a plausible-but-wrong line silently sends the reader
|
|
21
|
+
* to the wrong place. `test/container-extract.test.ts` pins this against
|
|
22
|
+
* fixtures whose true line numbers are known.
|
|
23
|
+
*/
|
|
24
|
+
import { type ExtractResult, type Language } from "./extract.js";
|
|
25
|
+
/** A container language: the wrapper grammar, the node that holds the embedded
|
|
26
|
+
* source, and which depth-tier extractor to hand that source to. */
|
|
27
|
+
export interface ContainerLang {
|
|
28
|
+
name: string;
|
|
29
|
+
exts: string[];
|
|
30
|
+
/** wasm basename in tree-sitter-wasms/out/tree-sitter-<wasm>.wasm */
|
|
31
|
+
wasm: string;
|
|
32
|
+
/** Wrapper node that represents one embedded block (e.g. Vue's script_element). */
|
|
33
|
+
block: string;
|
|
34
|
+
/** Child of `block` holding the raw embedded source (e.g. Vue's raw_text). */
|
|
35
|
+
body: string;
|
|
36
|
+
/** Depth-tier grammar for the embedded language. TypeScript is a superset of
|
|
37
|
+
* JavaScript, so it parses both `<script>` and `<script lang="ts">`. */
|
|
38
|
+
inner: Language;
|
|
39
|
+
}
|
|
40
|
+
/** The container registry. Svelte and Astro are the same shape and would be a
|
|
41
|
+
* row each, but they are left out until someone has a repo to verify them
|
|
42
|
+
* against — a wrong `body` node type would produce silently misplaced spans. */
|
|
43
|
+
export declare const CONTAINER_LANGS: readonly ContainerLang[];
|
|
44
|
+
/** The container language for a path, or null if none claims it. */
|
|
45
|
+
export declare function containerLangOf(path: string): ContainerLang | null;
|
|
46
|
+
/** Every file extension the container tier claims. */
|
|
47
|
+
export declare function containerExtensions(): string[];
|
|
48
|
+
/** Warm the container grammars this repo needs, and the depth grammar of each
|
|
49
|
+
* one's embedded language. Same contract as `warmGenericGrammars`: await once
|
|
50
|
+
* before the synchronous parse loop, and an unavailable grammar is skipped rather
|
|
51
|
+
* than fatal (its files then extract to a file node only, exactly as they do today). */
|
|
52
|
+
export declare function warmContainerGrammars(langNames: Iterable<string>): Promise<void>;
|
|
53
|
+
/** True if a container grammar has been warmed (else extraction is file-only). */
|
|
54
|
+
export declare function isContainerWarm(langName: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Extract one container file. Synchronous; needs the grammar pre-warmed.
|
|
57
|
+
*
|
|
58
|
+
* Never throws: a missing grammar, an unparseable SFC or a script block the
|
|
59
|
+
* inner extractor chokes on all degrade to "fewer nodes", because a build must
|
|
60
|
+
* not fail over one component.
|
|
61
|
+
*/
|
|
62
|
+
export declare function extractContainer(rel: string, source: string, lang: ContainerLang): ExtractResult;
|
|
63
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/graph/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAgB,MAAM,cAAc,CAAC;AAMpG;oEACoE;AACpE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb;4EACwE;IACxE,KAAK,EAAE,QAAQ,CAAC;CACjB;AAED;;gFAEgF;AAChF,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAEnD,CAAC;AAKF,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAIlE;AAED,sDAAsD;AACtD,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAID;;;wFAGwF;AACxF,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAStF;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AA0DD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,aAAa,CA6DhG"}
|