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,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seedGraph` — give a linked git worktree the graph its parent checkout already has.
|
|
3
|
+
*
|
|
4
|
+
* `graft/` is a local cache, so it is gitignored, so `git worktree add` never checks
|
|
5
|
+
* it out: a worktree starts with `src/` and `.claude/` and no graph at all. Every
|
|
6
|
+
* MCP tool then answers "no graph found — run graft build first" for the whole
|
|
7
|
+
* session, and the passive surface (`INDEX.md`, the cards) is missing too. The agent
|
|
8
|
+
* that was supposed to be cheapest in a fresh worktree is instead blind in one.
|
|
9
|
+
*
|
|
10
|
+
* What travels is the graph and the sidecars a query reads — never the markdown; see
|
|
11
|
+
* `seedable` for why the cards are the parent's branch and not this one's.
|
|
12
|
+
*
|
|
13
|
+
* The parent checkout has not gone anywhere, though — a worktree's `.git` is a *file*
|
|
14
|
+
* naming it, and the harness that creates these worktrees already reaches back the
|
|
15
|
+
* same way (Claude Code symlinks `node_modules` to the parent's). So: copy the
|
|
16
|
+
* parent's `graft/` in, then let the ordinary refresh gate repair the difference.
|
|
17
|
+
*
|
|
18
|
+
* Copy, not symlink. `node_modules` is the same for every branch; a graph is a set of
|
|
19
|
+
* `file:line` spans for one specific tree, so a shared one would have the worktree
|
|
20
|
+
* rewriting the parent's graph with its own branch's line numbers. What makes the
|
|
21
|
+
* copy worth doing rather than just rebuilding cold:
|
|
22
|
+
*
|
|
23
|
+
* - **The Tier-2 meaning layer survives.** Summaries and cruxes cost real money;
|
|
24
|
+
* `buildGraph` folds a prior `wiring.json` in by `body_hash`, so an unchanged
|
|
25
|
+
* function keeps the summary someone already paid for. A cold build throws them all
|
|
26
|
+
* away and the worktree silently drops to structural-only answers.
|
|
27
|
+
* - **The repair is small.** `probeDrift` confirms a suspect file by content hash, so
|
|
28
|
+
* a fresh checkout's brand-new mtimes cost one hashing pass and nothing more; the
|
|
29
|
+
* drift that survives is exactly the diff between the two checkouts' commits.
|
|
30
|
+
* - **$0 and offline**, like everything else on the query path.
|
|
31
|
+
*
|
|
32
|
+
* Never writes to the parent, never throws, and no-ops unless there is genuinely a
|
|
33
|
+
* built parent checkout on disk — so a fresh clone, CI, or a cloud session whose repo
|
|
34
|
+
* was *cloned* rather than worktree'd behaves exactly as it did before: "run graft
|
|
35
|
+
* build first".
|
|
36
|
+
*/
|
|
37
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, } from "node:fs";
|
|
38
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
39
|
+
import { ASK_INDEX_FILE } from "../ask/index-file.js";
|
|
40
|
+
import { CACHE_DIR, contextDirFor } from "../context/node-file.js";
|
|
41
|
+
import { EXTRACT_CACHE_PREFIX } from "./extract-cache.js";
|
|
42
|
+
import { FINGERPRINT_PREFIX } from "./fingerprint.js";
|
|
43
|
+
import { GRAPH_DIR, wiringPath } from "./write.js";
|
|
44
|
+
/** The one line a linked worktree's `.git` file carries. */
|
|
45
|
+
const GITDIR_KEY = "gitdir:";
|
|
46
|
+
/** Env kill switch, mirroring `GRAFT_NO_REFRESH` in ./refresh.ts. */
|
|
47
|
+
export function seedDisabled() {
|
|
48
|
+
const v = process.env.GRAFT_NO_SEED;
|
|
49
|
+
return v !== undefined && v !== "" && v !== "0" && v !== "false";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The main checkout of the repo `root` is a linked worktree of, or null when `root`
|
|
53
|
+
* isn't one (which is the common case, and not an error).
|
|
54
|
+
*
|
|
55
|
+
* Filesystem-only on purpose: no `git` subprocess on a path that runs before every
|
|
56
|
+
* query. The shapes it has to tell apart:
|
|
57
|
+
*
|
|
58
|
+
* - `<root>/.git` is a **directory** → this *is* the main checkout. Nothing to seed.
|
|
59
|
+
* - `gitdir: <main>/.git/worktrees/<name>` → a linked worktree. `commondir` inside
|
|
60
|
+
* that dir points back at the shared `.git` (`../..`), whose parent is the main
|
|
61
|
+
* checkout.
|
|
62
|
+
* - `gitdir: <super>/.git/modules/<name>` → a **submodule**. Identical file shape,
|
|
63
|
+
* completely different thing: a submodule is its own repo and its parent's `graft/`
|
|
64
|
+
* describes different code entirely. The `worktrees` path segment is what rejects it.
|
|
65
|
+
* - A bare repo or `--separate-git-dir` layout, where the resolved common dir isn't
|
|
66
|
+
* named `.git` and there may be no working tree at all → null.
|
|
67
|
+
*/
|
|
68
|
+
export function mainWorktreeRoot(root) {
|
|
69
|
+
try {
|
|
70
|
+
const dot = join(root, ".git");
|
|
71
|
+
if (statSync(dot).isDirectory())
|
|
72
|
+
return null;
|
|
73
|
+
// Read the pointer without a regex. `/^gitdir:[ \t]*(.+?)[ \t]*$/m` is the
|
|
74
|
+
// polynomial-ReDoS shape CodeQL flagged on `ensureSearchable` (`js/polynomial-redos`,
|
|
75
|
+
// fixed in 44a191e): `.` also matches space and tab, so the lazy group and the
|
|
76
|
+
// trailing `[ \t]*` overlap and a line of blanks costs O(n²). Same conclusion as
|
|
77
|
+
// that fix — the ambiguity buys nothing, and split/startsWith/trim is linear and
|
|
78
|
+
// plainer. `trim` also absorbs the `\r` of a CRLF checkout.
|
|
79
|
+
const line = readFileSync(dot, "utf8").split("\n").find((l) => l.startsWith(GITDIR_KEY));
|
|
80
|
+
if (line === undefined)
|
|
81
|
+
return null;
|
|
82
|
+
const target = line.slice(GITDIR_KEY.length).trim();
|
|
83
|
+
if (!target)
|
|
84
|
+
return null;
|
|
85
|
+
const gitdir = isAbsolute(target) ? target : resolve(root, target);
|
|
86
|
+
if (basename(dirname(gitdir)) !== "worktrees")
|
|
87
|
+
return null;
|
|
88
|
+
const rel = readFileSync(join(gitdir, "commondir"), "utf8").trim();
|
|
89
|
+
if (!rel)
|
|
90
|
+
return null;
|
|
91
|
+
const common = isAbsolute(rel) ? rel : resolve(gitdir, rel);
|
|
92
|
+
if (basename(common) !== ".git" || !statSync(common).isDirectory())
|
|
93
|
+
return null;
|
|
94
|
+
const main = dirname(common);
|
|
95
|
+
if (resolve(main) === resolve(root))
|
|
96
|
+
return null;
|
|
97
|
+
return main;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// No `.git` at all, an unreadable one, a `commondir` that doesn't exist: all of
|
|
101
|
+
// them mean "can't seed from here", which is the same answer as "not a worktree".
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const NOT_SEEDED = { seeded: false };
|
|
106
|
+
/** Filename of the semantic embeddings database, relative to the cache dir. */
|
|
107
|
+
const EMBEDDINGS_FILE = "embeddings.db";
|
|
108
|
+
/**
|
|
109
|
+
* An allowlist, not a skip list: is this repo-relative path (posix) one of the few
|
|
110
|
+
* files a seed may bring across?
|
|
111
|
+
*
|
|
112
|
+
* The gate that calls this promises "writes only what a query reads — the graph, the
|
|
113
|
+
* `ask` sidecar, the freshness record" (see the header of ./refresh.ts). A copy that
|
|
114
|
+
* wrote anything else would turn a read into a write of the repo, so the copy honours
|
|
115
|
+
* the same list. The extraction memo is on it because the refresh immediately after
|
|
116
|
+
* rewrites that file anyway, and replaying it is what keeps the repair cheap.
|
|
117
|
+
*
|
|
118
|
+
* **Deliberately absent: the cards and `INDEX.md`.** They would land as this
|
|
119
|
+
* checkout's documentation while describing the *parent's* branch, and nothing on the
|
|
120
|
+
* query path rewrites them (`writeCards`/`writeIndex` sit behind `!graphOnly`), so they
|
|
121
|
+
* would stay wrong indefinitely. An explicit `graft build` regenerates them from this
|
|
122
|
+
* checkout's own graph — and prunes the ones that no longer apply — which is both
|
|
123
|
+
* correct and nearly free once the graph is here.
|
|
124
|
+
*
|
|
125
|
+
* Also absent, because it belongs to the checkout that produced it: `.cache/session/`
|
|
126
|
+
* (another session's transcripts), `.sync.lock` (another process's lock), and
|
|
127
|
+
* `stats.json` (this checkout earns its own savings and dirty flag).
|
|
128
|
+
*/
|
|
129
|
+
function seedable(rel) {
|
|
130
|
+
// The dirs themselves, or cpSync would never look inside them.
|
|
131
|
+
if (rel === "" || rel === GRAPH_DIR || rel === CACHE_DIR)
|
|
132
|
+
return true;
|
|
133
|
+
if (!rel.startsWith(`${CACHE_DIR}/`))
|
|
134
|
+
return false; // incl. the graph: `installGraph` places it
|
|
135
|
+
const name = rel.slice(CACHE_DIR.length + 1);
|
|
136
|
+
return (name === ASK_INDEX_FILE ||
|
|
137
|
+
name === EMBEDDINGS_FILE ||
|
|
138
|
+
name.startsWith(`${EXTRACT_CACHE_PREFIX}.`) ||
|
|
139
|
+
name.startsWith(`${FINGERPRINT_PREFIX}.`));
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Copy `srcDir` into `outDir`, keeping only what {@link seedable} allows.
|
|
143
|
+
*
|
|
144
|
+
* Walked by hand rather than through `cpSync`'s `filter`, which did not hold on
|
|
145
|
+
* Windows: the graph arrived — it is placed directly, by {@link installGraph} — while
|
|
146
|
+
* every allowlisted sidecar next to it was dropped. A seeded worktree therefore had no
|
|
147
|
+
* fingerprint, `probeDrift` read that as "never built", and the query right behind the
|
|
148
|
+
* seed rebuilt the whole repo instead of the diff against the parent: precisely the
|
|
149
|
+
* cost seeding exists to avoid, and silent, because a full rebuild still answers
|
|
150
|
+
* correctly. It only surfaced as a `(? files changed)` note on the CI leg.
|
|
151
|
+
*
|
|
152
|
+
* Composing `rel` from the segments this walk joined itself is what fixes it — the
|
|
153
|
+
* allowlist no longer depends on the form `cpSync` chooses to hand its callback, and
|
|
154
|
+
* `rel` is posix by construction rather than by conversion. Also narrower than the old
|
|
155
|
+
* copy in one way worth keeping: only real files and directories travel, never a
|
|
156
|
+
* symlink, and nothing in the allowlist is one.
|
|
157
|
+
*/
|
|
158
|
+
function copyTree(srcDir, outDir) {
|
|
159
|
+
const walk = (rel) => {
|
|
160
|
+
const from = rel ? join(srcDir, rel) : srcDir;
|
|
161
|
+
mkdirSync(rel ? join(outDir, rel) : outDir, { recursive: true });
|
|
162
|
+
for (const entry of readdirSync(from, { withFileTypes: true })) {
|
|
163
|
+
const childRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
164
|
+
if (!seedable(childRel))
|
|
165
|
+
continue;
|
|
166
|
+
if (entry.isDirectory())
|
|
167
|
+
walk(childRel);
|
|
168
|
+
else if (entry.isFile())
|
|
169
|
+
copyFileSync(join(from, entry.name), join(outDir, childRel));
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
walk("");
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Put `wiring.json` in place last, via a temp file and a rename.
|
|
176
|
+
*
|
|
177
|
+
* Its presence is the flag every caller reads to mean "this repo has a graph"
|
|
178
|
+
* (`refresh.ts`, `workspace.ts`, every MCP tool). So it must appear only once the
|
|
179
|
+
* rest of the copy has landed and must never appear half-written: a seed killed
|
|
180
|
+
* midway then leaves no graph, and the next call simply seeds again.
|
|
181
|
+
*/
|
|
182
|
+
function installGraph(srcGraph, destGraph) {
|
|
183
|
+
mkdirSync(dirname(destGraph), { recursive: true });
|
|
184
|
+
const tmp = `${destGraph}.seed.${process.pid}`;
|
|
185
|
+
try {
|
|
186
|
+
copyFileSync(srcGraph, tmp);
|
|
187
|
+
renameSync(tmp, destGraph);
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
try {
|
|
191
|
+
rmSync(tmp, { force: true });
|
|
192
|
+
}
|
|
193
|
+
catch { /* nothing to clean up */ }
|
|
194
|
+
throw err;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Copy the parent checkout's graph into `root`'s own `graft/`, if all of this holds:
|
|
199
|
+
* `root` is a linked worktree, it has no graph yet, the parent has one, and no `--dir`
|
|
200
|
+
* override is in play (a custom output dir can't be mapped to a sibling checkout —
|
|
201
|
+
* the same conservatism `ensureGitignored` applies).
|
|
202
|
+
*
|
|
203
|
+
* Best-effort by contract: the caller's fallback is the behaviour that existed before
|
|
204
|
+
* this function did, so every failure returns `{ seeded: false }` rather than raising.
|
|
205
|
+
*/
|
|
206
|
+
export function seedGraph(root, opts = {}) {
|
|
207
|
+
if (opts.contextDir || seedDisabled())
|
|
208
|
+
return NOT_SEEDED;
|
|
209
|
+
try {
|
|
210
|
+
const dir = resolve(root);
|
|
211
|
+
const outDir = contextDirFor(dir);
|
|
212
|
+
if (existsSync(wiringPath(outDir)))
|
|
213
|
+
return NOT_SEEDED; // already has its own
|
|
214
|
+
const main = mainWorktreeRoot(dir);
|
|
215
|
+
if (!main)
|
|
216
|
+
return NOT_SEEDED;
|
|
217
|
+
const srcDir = contextDirFor(main);
|
|
218
|
+
const srcGraph = wiringPath(srcDir);
|
|
219
|
+
if (!existsSync(srcGraph))
|
|
220
|
+
return NOT_SEEDED; // parent never built either
|
|
221
|
+
copyTree(srcDir, outDir);
|
|
222
|
+
installGraph(srcGraph, wiringPath(outDir));
|
|
223
|
+
return { seeded: true, from: main };
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
return NOT_SEEDED;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=seed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../src/graph/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,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U,CAAC;QAC7B,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,UAAU,CAAC,CAAC,4BAA4B;QAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzB,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Every extension graft has a parser for (depth + breadth + container), sorted
|
|
2
|
+
* and de-duped — the authoritative answer to "what does `-e` actually support". */
|
|
3
|
+
export declare function supportedExtensions(): string[];
|
|
4
|
+
/**
|
|
5
|
+
* The subset of user-supplied `-e` extensions that no parser claims (depth or breadth).
|
|
6
|
+
* `graft build -e ".vue"` used to accept these silently and index nothing; the CLI warns
|
|
7
|
+
* on whatever this returns so an unsupported extension is never a quiet no-op.
|
|
8
|
+
*/
|
|
9
|
+
export declare function unsupportedExtensions(exts: string[]): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The source files a graph build parses: supported languages, minus the
|
|
12
|
+
* output dir. When no pre-enumerated `repoFiles` is passed, the walk reads
|
|
13
|
+
* `root`'s persisted file-walk choices directly from state, so every caller
|
|
14
|
+
* that enumerates through here (the fingerprint probe and hooks/refresh path,
|
|
15
|
+
* none of which ever see a CLI flag) behaves identically to the build that
|
|
16
|
+
* saved those choices.
|
|
17
|
+
*/
|
|
18
|
+
/** Keep only files whose repo-relative path is at or under one of `onlyDirs`.
|
|
19
|
+
* No-op when `onlyDirs` is empty/absent. The whitelist is carried in the graph
|
|
20
|
+
* itself (the fingerprint records it at build time), never in the source repo,
|
|
21
|
+
* so a build and the query-path freshness probe read the identical set. */
|
|
22
|
+
export declare function filterByOnlyDirs(files: string[], root: string, onlyDirs?: ReadonlySet<string>): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Returns true for OpenSpec `.md` files that should be auto-indexed regardless
|
|
25
|
+
* of `--include-md`. Covers `openspec/specs/**` and active `openspec/changes/**`,
|
|
26
|
+
* excluding `openspec/changes/archive/**` unless `includeArchive` is true.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isOpenSpecMd(rel: string, includeArchive: boolean): boolean;
|
|
29
|
+
export declare function listSourceFiles(root: string, outDir: string, repoFiles?: string[], onlyDirs?: ReadonlySet<string>): string[];
|
|
30
|
+
export interface SourceStat {
|
|
31
|
+
/** Absolute path. */
|
|
32
|
+
abs: string;
|
|
33
|
+
/** Repo-relative, posix (`relPosix`) — exactly the form `buildGraph` uses for
|
|
34
|
+
* node ids and `checkGraph` diffs against, so cache keys and ids can never
|
|
35
|
+
* disagree. Posix on every platform: see `../util/paths.ts`. */
|
|
36
|
+
rel: string;
|
|
37
|
+
size: number;
|
|
38
|
+
mtimeMs: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* {@link listSourceFiles} plus each file's `(size, mtimeMs)` — the currency of
|
|
42
|
+
* both the freshness probe and the extraction cache. Files that vanish between
|
|
43
|
+
* the walk and the stat are dropped (same fail-soft posture as `walkDir`).
|
|
44
|
+
*/
|
|
45
|
+
export declare function listSourceStats(root: string, outDir: string, repoFiles?: string[], onlyDirs?: ReadonlySet<string>): SourceStat[];
|
|
46
|
+
//# sourceMappingURL=source-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-files.d.ts","sourceRoot":"","sources":["../../src/graph/source-files.ts"],"names":[],"mappings":"AAkBA;mFACmF;AACnF,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAQD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAG9D;AAED;;;;;;;GAOG;AACH;;;2EAG2E;AAC3E,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,MAAM,EAAE,CAMV;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,GAAG,OAAO,CAK1E;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAM,EAGf,EACF,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,MAAM,EAAE,CAwBV;AAED,MAAM,WAAW,UAAU;IACzB,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ;;oEAEgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAAE,EACpB,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,UAAU,EAAE,CAYd"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file set a graph build parses, and its stat metadata.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `build.ts` so the freshness probe (`fingerprint.ts`) can enumerate
|
|
5
|
+
* exactly the same files without importing the builder (which would be an import
|
|
6
|
+
* cycle: build → fingerprint → build). `build.ts` re-exports
|
|
7
|
+
* {@link listSourceFiles} so its existing importers are unaffected.
|
|
8
|
+
*/
|
|
9
|
+
import { statSync } from "node:fs";
|
|
10
|
+
import { resolve } from "node:path";
|
|
11
|
+
import { walkDir } from "../ingest/fs.js";
|
|
12
|
+
import { relPosix } from "../util/paths.js";
|
|
13
|
+
import { readFollowNestedRepos, readFollowSubmodules, readIncludeDirs, readIncludeMd, readIncludeOpenSpecArchive, readMdOnlyDirs } from "../util/state.js";
|
|
14
|
+
import { languageOf, depthExtensions } from "./extract.js";
|
|
15
|
+
import { genericLangOf, genericExtensions } from "./generic.js";
|
|
16
|
+
import { containerLangOf, containerExtensions } from "./container.js";
|
|
17
|
+
import { isMdFile, MD_EXT } from "./markdown.js";
|
|
18
|
+
/** Every extension graft has a parser for (depth + breadth + container), sorted
|
|
19
|
+
* and de-duped — the authoritative answer to "what does `-e` actually support". */
|
|
20
|
+
export function supportedExtensions() {
|
|
21
|
+
return [...new Set([...depthExtensions(), ...genericExtensions(), ...containerExtensions(), MD_EXT])].sort();
|
|
22
|
+
}
|
|
23
|
+
/** Normalize a user-supplied extension: ensure a leading dot, lower-case. */
|
|
24
|
+
function normExt(e) {
|
|
25
|
+
const t = e.trim().toLowerCase();
|
|
26
|
+
return t.startsWith(".") ? t : `.${t}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The subset of user-supplied `-e` extensions that no parser claims (depth or breadth).
|
|
30
|
+
* `graft build -e ".vue"` used to accept these silently and index nothing; the CLI warns
|
|
31
|
+
* on whatever this returns so an unsupported extension is never a quiet no-op.
|
|
32
|
+
*/
|
|
33
|
+
export function unsupportedExtensions(exts) {
|
|
34
|
+
const supported = new Set(supportedExtensions());
|
|
35
|
+
return exts.filter((e) => !supported.has(normExt(e)));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The source files a graph build parses: supported languages, minus the
|
|
39
|
+
* output dir. When no pre-enumerated `repoFiles` is passed, the walk reads
|
|
40
|
+
* `root`'s persisted file-walk choices directly from state, so every caller
|
|
41
|
+
* that enumerates through here (the fingerprint probe and hooks/refresh path,
|
|
42
|
+
* none of which ever see a CLI flag) behaves identically to the build that
|
|
43
|
+
* saved those choices.
|
|
44
|
+
*/
|
|
45
|
+
/** Keep only files whose repo-relative path is at or under one of `onlyDirs`.
|
|
46
|
+
* No-op when `onlyDirs` is empty/absent. The whitelist is carried in the graph
|
|
47
|
+
* itself (the fingerprint records it at build time), never in the source repo,
|
|
48
|
+
* so a build and the query-path freshness probe read the identical set. */
|
|
49
|
+
export function filterByOnlyDirs(files, root, onlyDirs) {
|
|
50
|
+
if (!onlyDirs || onlyDirs.size === 0)
|
|
51
|
+
return files;
|
|
52
|
+
return files.filter((abs) => {
|
|
53
|
+
const rel = relPosix(root, abs);
|
|
54
|
+
return [...onlyDirs].some((d) => rel === d || rel.startsWith(`${d}/`));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns true for OpenSpec `.md` files that should be auto-indexed regardless
|
|
59
|
+
* of `--include-md`. Covers `openspec/specs/**` and active `openspec/changes/**`,
|
|
60
|
+
* excluding `openspec/changes/archive/**` unless `includeArchive` is true.
|
|
61
|
+
*/
|
|
62
|
+
export function isOpenSpecMd(rel, includeArchive) {
|
|
63
|
+
if (rel.startsWith('openspec/specs/'))
|
|
64
|
+
return true;
|
|
65
|
+
if (!rel.startsWith('openspec/changes/'))
|
|
66
|
+
return false;
|
|
67
|
+
if (rel.startsWith('openspec/changes/archive/'))
|
|
68
|
+
return includeArchive;
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
export function listSourceFiles(root, outDir, repoFiles = walkDir(root, readIncludeDirs(resolve(root)), {
|
|
72
|
+
followSubmodules: readFollowSubmodules(resolve(root)),
|
|
73
|
+
followNestedRepos: readFollowNestedRepos(resolve(root)),
|
|
74
|
+
}), onlyDirs) {
|
|
75
|
+
// A file is a source file if a depth-tier grammar (languageOf), a breadth-tier
|
|
76
|
+
// grammar (genericLangOf) or a container (containerLangOf) claims its extension.
|
|
77
|
+
// All three must agree here or `build` and `check` would enumerate different sets.
|
|
78
|
+
const mdOnlyDirs = readMdOnlyDirs(root);
|
|
79
|
+
const includeArchive = readIncludeOpenSpecArchive(root);
|
|
80
|
+
return filterByOnlyDirs(repoFiles.filter((f) => {
|
|
81
|
+
if (f.startsWith(outDir))
|
|
82
|
+
return false;
|
|
83
|
+
if (languageOf(f) !== null || genericLangOf(f) !== null || containerLangOf(f) !== null)
|
|
84
|
+
return true;
|
|
85
|
+
if (!isMdFile(f))
|
|
86
|
+
return false;
|
|
87
|
+
// Auto-include OpenSpec .md files (specs + active changes, archive opt-in).
|
|
88
|
+
const rel = relPosix(root, f);
|
|
89
|
+
if (isOpenSpecMd(rel, includeArchive))
|
|
90
|
+
return true;
|
|
91
|
+
// Explicit --include-md behaviour (mdOnlyDirs filter applies).
|
|
92
|
+
if (!readIncludeMd(root))
|
|
93
|
+
return false;
|
|
94
|
+
if (mdOnlyDirs.length === 0)
|
|
95
|
+
return true;
|
|
96
|
+
return mdOnlyDirs.some((d) => rel === d || rel.startsWith(`${d}/`));
|
|
97
|
+
}), root, onlyDirs);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* {@link listSourceFiles} plus each file's `(size, mtimeMs)` — the currency of
|
|
101
|
+
* both the freshness probe and the extraction cache. Files that vanish between
|
|
102
|
+
* the walk and the stat are dropped (same fail-soft posture as `walkDir`).
|
|
103
|
+
*/
|
|
104
|
+
export function listSourceStats(root, outDir, repoFiles, onlyDirs) {
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const abs of listSourceFiles(root, outDir, repoFiles, onlyDirs)) {
|
|
107
|
+
let s;
|
|
108
|
+
try {
|
|
109
|
+
s = statSync(abs);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
out.push({ abs, rel: relPosix(root, abs), size: s.size, mtimeMs: s.mtimeMs });
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=source-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source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B,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC;QACrE,IAAI,CAAoC,CAAC;QACzC,IAAI,CAAC;YACH,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Savings } from "../context/savings.js";
|
|
2
|
+
import { type Direction, type EdgeHit } from "./traverse.js";
|
|
3
|
+
import type { GraphV1, NodeV1 } from "./types.js";
|
|
4
|
+
export interface CallersCliOptions {
|
|
5
|
+
in?: string;
|
|
6
|
+
json?: boolean;
|
|
7
|
+
/** walk direction; defaults to "in" (callers). "out" gives callees. */
|
|
8
|
+
direction?: string;
|
|
9
|
+
/** max BFS depth, as the raw --depth string (validated here); defaults to 1. */
|
|
10
|
+
depth?: string;
|
|
11
|
+
/** the top-level `--dir` override, so this command respects it like every other. */
|
|
12
|
+
globalDir?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Exported so the MCP `graft_trace_calls` tool (`src/mcp/tools.ts`) can render the
|
|
15
|
+
* same human report format as the CLI, rather than re-implementing it — both
|
|
16
|
+
* surfaces walk the same edges via the same `resolveSymbol` / `edgeWalk` core. */
|
|
17
|
+
export declare function headerOf(n: NodeV1): string;
|
|
18
|
+
/** `showDepth` is set for multi-hop walks (depth > 1), matching the old
|
|
19
|
+
* `graft impact` output which tagged every hit with its BFS depth.
|
|
20
|
+
*
|
|
21
|
+
* `quote`, when given, is the call site itself — the line inside the hit where it
|
|
22
|
+
* references the symbol. An edge that says "total calls add" is a claim; the line
|
|
23
|
+
* under it is the evidence, and it saves opening the file to check.
|
|
24
|
+
*/
|
|
25
|
+
export declare function hitLine(direction: Direction, hit: EdgeHit, showDepth: boolean, quote?: Quote): string;
|
|
26
|
+
/** A quoted source line: where the edge actually happens. */
|
|
27
|
+
interface Quote {
|
|
28
|
+
n: number;
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
/** Tokens-saved baseline for a callers/callees walk: the files of the matched
|
|
32
|
+
* symbols plus every resolved edge endpoint, read whole — the files you'd open
|
|
33
|
+
* to trace these edges by hand. Shared by the CLI and the MCP tool so both
|
|
34
|
+
* surfaces report the same number. */
|
|
35
|
+
export declare function callersSavings(graph: GraphV1, results: {
|
|
36
|
+
symbol: NodeV1;
|
|
37
|
+
hits: EdgeHit[];
|
|
38
|
+
}[]): Savings | undefined;
|
|
39
|
+
/** Loud, actionable empty-result note — never a bare empty list. `candidateCount`
|
|
40
|
+
* is how many nodes {@link resolveSymbol} matched for this query (both call
|
|
41
|
+
* sites already hold it as `matches.length`) — when it's >1, the query name is
|
|
42
|
+
* itself ambiguous (several definitions share it), which is exactly the case
|
|
43
|
+
* `resolve.ts` drops a cross-file call/reference for rather than guessing which
|
|
44
|
+
* one it means. Without saying so, a zero-hit result here reads as "nothing
|
|
45
|
+
* calls this" when it may really be "something does, but the edge was dropped". */
|
|
46
|
+
export declare function looseNoteFor(direction: Direction, name: string, candidateCount: number): string;
|
|
47
|
+
/**
|
|
48
|
+
* Resolve `query` in the graph at `dir` (respecting `--dir`/`--in`), walk edges
|
|
49
|
+
* per `--direction`/`--depth`, and print either the human report or `--json`.
|
|
50
|
+
* Exits the process (code 1) when there's no graph at all or the symbol is
|
|
51
|
+
* unknown — both are caller-facing mistakes, not recoverable states.
|
|
52
|
+
*/
|
|
53
|
+
export declare function runCallersCommand(query: string, dir: string, opts: CallersCliOptions): void;
|
|
54
|
+
export {};
|
|
55
|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