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,180 @@
|
|
|
1
|
+
import { isoDay } from "./owners.js";
|
|
2
|
+
import { MAX_EVIDENCE, fileReader, impactedEvidence, reachTerms, seedEvidence, } from "./evidence.js";
|
|
3
|
+
const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
4
|
+
/** Owners as the page carries them: no scores, since a weight nobody can check is
|
|
5
|
+
* not evidence — the commit count and the date are what a reader can verify. */
|
|
6
|
+
function nodeOwners(owners) {
|
|
7
|
+
if (owners === undefined || owners.length === 0)
|
|
8
|
+
return undefined;
|
|
9
|
+
return owners.map((o) => ({ name: o.name, handle: o.handle, commits: o.commits, last: isoDay(o.last) }));
|
|
10
|
+
}
|
|
11
|
+
/** Kinds that carry behaviour — what "did a test reach it" is asked of. */
|
|
12
|
+
const BEHAVIOURAL = new Set(["function", "method", "class", "constructor"]);
|
|
13
|
+
/** Node-type names, which double as the viewer's legend labels. */
|
|
14
|
+
const CHANGED = "changed";
|
|
15
|
+
const AFFECTED = "affected";
|
|
16
|
+
/** One sentence about the tests, rather than the two that used to say it twice. */
|
|
17
|
+
function testNote(a) {
|
|
18
|
+
const signals = {
|
|
19
|
+
changed: `A test that reaches it changed too — ${a.reached} of ${plural(a.behavioural, "function")} covered.`,
|
|
20
|
+
stale: `Tests reach it, and this diff left all ${plural(a.testFiles.length, "of them", "of them")} alone.`,
|
|
21
|
+
none: "No test reaches this code.",
|
|
22
|
+
na: "No function or class changed here — types, config or comments only.",
|
|
23
|
+
};
|
|
24
|
+
return signals[a.tests];
|
|
25
|
+
}
|
|
26
|
+
/** `a`, `a and b`, `a, b and c`, `a, b and 3 more` — never a bare `+N`, which
|
|
27
|
+
* reads as a version number when it sits next to a symbol name. */
|
|
28
|
+
function list(names) {
|
|
29
|
+
const shown = names.slice(0, 3);
|
|
30
|
+
const rest = names.length - shown.length;
|
|
31
|
+
const tail = rest > 0 ? `${rest} more` : shown.pop();
|
|
32
|
+
return shown.length === 0 ? String(tail) : `${shown.join(", ")} and ${tail}`;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* What this PR did to an area, in the reviewer's words.
|
|
36
|
+
*
|
|
37
|
+
* The old copy counted ("2 files, 3 symbols") and then said the same thing about
|
|
38
|
+
* tests twice ("no test reaches it. 0 of 2 changed functions have a test that
|
|
39
|
+
* reaches them"), where `0 of 2` reads like a coverage score. Naming the symbols
|
|
40
|
+
* is shorter AND the thing a reviewer wanted to know.
|
|
41
|
+
*/
|
|
42
|
+
function changedSummary(a, seeds) {
|
|
43
|
+
const named = seeds.filter((s) => !s.wholeFile);
|
|
44
|
+
const behaviour = named.filter((s) => BEHAVIOURAL.has(s.kind)).map((s) => s.name);
|
|
45
|
+
const rest = named.filter((s) => !BEHAVIOURAL.has(s.kind)).map((s) => s.name);
|
|
46
|
+
const where = ` in ${plural(a.files.length, "file")}.`;
|
|
47
|
+
let what;
|
|
48
|
+
if (behaviour.length > 0) {
|
|
49
|
+
what = `Edits ${list(behaviour)}`;
|
|
50
|
+
if (rest.length > 0)
|
|
51
|
+
what += `, plus ${list(rest)}`;
|
|
52
|
+
}
|
|
53
|
+
else if (rest.length > 0) {
|
|
54
|
+
what = `Edits ${list(rest)}`;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Whole-file seeds only: an added file, or edits outside every symbol.
|
|
58
|
+
what = `Changes ${plural(a.seeds, "region")} outside any symbol`;
|
|
59
|
+
}
|
|
60
|
+
return `${what}${where} ${testNote(a)}`;
|
|
61
|
+
}
|
|
62
|
+
function changedNode(a, seeds, byPath) {
|
|
63
|
+
const files = new Set(a.files);
|
|
64
|
+
const mine = seeds.filter((s) => files.has(s.path));
|
|
65
|
+
const evidence = mine
|
|
66
|
+
.slice(0, MAX_EVIDENCE)
|
|
67
|
+
.map((s) => seedEvidence(s, byPath.get(s.path)))
|
|
68
|
+
.filter((e) => e !== null);
|
|
69
|
+
return {
|
|
70
|
+
id: `changed:${a.key}`,
|
|
71
|
+
name: a.label,
|
|
72
|
+
type: CHANGED,
|
|
73
|
+
summary: changedSummary(a, mine),
|
|
74
|
+
sources: a.files,
|
|
75
|
+
evidence: evidence.length > 0 ? evidence : undefined,
|
|
76
|
+
owners: nodeOwners(a.owners),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function affectedNode(m, reach, read) {
|
|
80
|
+
const nearest = m.symbols[0];
|
|
81
|
+
const how = nearest ? ` — nearest is ${nearest.name}, ${plural(nearest.depth, "hop")} away.` : ".";
|
|
82
|
+
const evidence = m.symbols
|
|
83
|
+
.slice(0, MAX_EVIDENCE)
|
|
84
|
+
.map((s) => impactedEvidence(s, reach, read))
|
|
85
|
+
.filter((e) => e !== null);
|
|
86
|
+
return {
|
|
87
|
+
id: `affected:${m.key}`,
|
|
88
|
+
name: m.label,
|
|
89
|
+
type: AFFECTED,
|
|
90
|
+
// Leading with "not edited" is the fact a reviewer needs first: this area is
|
|
91
|
+
// collateral, not part of their diff.
|
|
92
|
+
summary: `Not edited by this PR. ${plural(m.symbols.length, "symbol")} here ${m.symbols.length === 1 ? "reaches" : "reach"} code it changed${how}`,
|
|
93
|
+
sources: m.symbols.map((s) => `${s.path} · ${s.span}`),
|
|
94
|
+
evidence: evidence.length > 0 ? evidence : undefined,
|
|
95
|
+
owners: nodeOwners(m.owners),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* What an empty canvas means.
|
|
100
|
+
*
|
|
101
|
+
* A PR that only touches lockfiles, workflows or docs has no radius, and the page
|
|
102
|
+
* published for it used to be a blank canvas behind a link promising a graph — a
|
|
103
|
+
* reader cannot tell that from a broken export. Naming the reason (usually: no
|
|
104
|
+
* parser claims these files) turns it into an answer.
|
|
105
|
+
*/
|
|
106
|
+
function emptyNote(r) {
|
|
107
|
+
if (r.changed.length === 0)
|
|
108
|
+
return "This pull request changes no files.";
|
|
109
|
+
if (r.unindexed.length === r.changed.length) {
|
|
110
|
+
const shown = r.unindexed.slice(0, 3).join(", ");
|
|
111
|
+
const rest = r.unindexed.length > 3 ? `, +${r.unindexed.length - 3} more` : "";
|
|
112
|
+
return `Nothing to draw: no parser claims ${plural(r.unindexed.length, "changed file")} (${shown}${rest}), so this change has no symbols to trace.`;
|
|
113
|
+
}
|
|
114
|
+
return "Nothing to draw: the changed symbols have no resolved dependents at this depth.";
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Build the viewer graph for a report.
|
|
118
|
+
*
|
|
119
|
+
* `root` is the repository the report was taken in; without it the affected side
|
|
120
|
+
* loses its snippets — there is nothing to read — but keeps everything else, which
|
|
121
|
+
* is what a unit test wants.
|
|
122
|
+
*
|
|
123
|
+
* Nothing is capped at the graph level. The caps in the markdown renderer exist
|
|
124
|
+
* because a Mermaid diagram inside a comment cannot lay out more than a handful of
|
|
125
|
+
* circles; this page is force-directed and pannable, which is why it exists.
|
|
126
|
+
*/
|
|
127
|
+
export function blastVizGraph(r, opts = {}) {
|
|
128
|
+
const byPath = new Map(r.changed.map((f) => [f.path, f]));
|
|
129
|
+
// Longest name first, so `export` cannot match ahead of `exportViz` on a line
|
|
130
|
+
// that contains both.
|
|
131
|
+
const reach = reachTerms(r.seeds, r.changed);
|
|
132
|
+
const read = fileReader(opts.root);
|
|
133
|
+
const nodes = [
|
|
134
|
+
...r.areas.map((a) => changedNode(a, r.seeds, byPath)),
|
|
135
|
+
...r.modules.map((m) => affectedNode(m, reach, read)),
|
|
136
|
+
];
|
|
137
|
+
/** Changed path → the id of the area node standing for it. */
|
|
138
|
+
const areaOf = new Map();
|
|
139
|
+
for (const a of r.areas)
|
|
140
|
+
for (const f of a.files)
|
|
141
|
+
areaOf.set(f, `changed:${a.key}`);
|
|
142
|
+
const edges = [];
|
|
143
|
+
const seen = new Set();
|
|
144
|
+
for (const m of r.modules) {
|
|
145
|
+
for (const from of m.from) {
|
|
146
|
+
const source = areaOf.get(from);
|
|
147
|
+
if (!source)
|
|
148
|
+
continue; // a changed test file: the signal, not an area
|
|
149
|
+
const affected = `affected:${m.key}`;
|
|
150
|
+
const key = `${affected}→${source}`;
|
|
151
|
+
if (seen.has(key))
|
|
152
|
+
continue;
|
|
153
|
+
seen.add(key);
|
|
154
|
+
// Edge direction is the DEPENDENCY, affected → changed, not the impact. The
|
|
155
|
+
// viewer words its panels "depends on" / "depended on by" from the edge, so
|
|
156
|
+
// pointing it the other way made an affected area read as the thing being
|
|
157
|
+
// depended upon — backwards, on the one screen a reviewer is reading closely.
|
|
158
|
+
edges.push({
|
|
159
|
+
source: affected,
|
|
160
|
+
target: source,
|
|
161
|
+
relation: "depends_on",
|
|
162
|
+
description: "this area calls or imports code the PR changed",
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
meta: {
|
|
168
|
+
nodeCount: nodes.length,
|
|
169
|
+
edgeCount: edges.length,
|
|
170
|
+
emptyNote: nodes.length === 0 ? emptyNote(r) : undefined,
|
|
171
|
+
// Changed files no parser claims: named here so a thin graph is explained
|
|
172
|
+
// rather than read as "this PR is safe".
|
|
173
|
+
skippedFiles: r.unindexed.length,
|
|
174
|
+
droppedEdges: 0,
|
|
175
|
+
},
|
|
176
|
+
nodes,
|
|
177
|
+
edges,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=viz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viz.js","sourceRoot":"","sources":["../../src/blast/viz.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,MAAM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,GAAG,EAAE,CAAC;YACrC,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,MAAM,EAAE,CAAC;YACpC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,4EAA4E;YAC5E,4EAA4E;YAC5E,0EAA0E;YAC1E,8EAA8E;YAC9E,KAAK,CAAC,IAAI,CAAC;gBACT,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,YAAY;gBACtB,WAAW,EAAE,gDAAgD;aAC9D,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE;YACJ,SAAS,EAAE,KAAK,CAAC,MAAM;YACvB,SAAS,EAAE,KAAK,CAAC,MAAM;YACvB,SAAS,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;YACxD,0EAA0E;YAC1E,yCAAyC;YACzC,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM;YAChC,YAAY,EAAE,CAAC;SAChB;QACD,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/brand.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export type Brand = "trail" | "graft";
|
|
2
|
+
/** Set by `dist/bin/trail.js` and `dist/bin/graft.js` before the CLI loads. */
|
|
3
|
+
export declare const BRAND_ENV = "TRAIL_INVOKED_AS";
|
|
4
|
+
/** The npm package each name is published as. Same code, two names. */
|
|
5
|
+
export declare const PACKAGE_FOR: Record<Brand, string>;
|
|
6
|
+
export declare function brand(env?: NodeJS.ProcessEnv): Brand;
|
|
7
|
+
export declare function setBrand(b: Brand, env?: NodeJS.ProcessEnv): void;
|
|
8
|
+
/**
|
|
9
|
+
* `init --pair CODE` is Trail's setup prompt: only Trail's page hands out a pair
|
|
10
|
+
* code, so the person asked for Trail, whatever name ran it. An agent whose
|
|
11
|
+
* install of `trail-code` failed swaps in the `graft` already on the
|
|
12
|
+
* machine, and an old shim loads dist/cli.js with no name; under graft either
|
|
13
|
+
* would skip the look-back and `.trail/` while the page waits for them.
|
|
14
|
+
*/
|
|
15
|
+
export declare function asksForTrail(argv: readonly string[]): boolean;
|
|
16
|
+
/** `[trail]` or `[graft]`: the prefix agents and the statusline look for. */
|
|
17
|
+
export declare function tag(env?: NodeJS.ProcessEnv): string;
|
|
18
|
+
/**
|
|
19
|
+
* A command as the running name spells it. Takes the graft spelling, so call
|
|
20
|
+
* sites read the way they always have and graft's output does not change:
|
|
21
|
+
* `cmd("graft ask")` is `graft ask` under graft and `trail ask` under trail.
|
|
22
|
+
*/
|
|
23
|
+
export declare function cmd(graftSpelling: string, b?: Brand): string;
|
|
24
|
+
/**
|
|
25
|
+
* Agent-facing prose and tool names in trail's spelling: `graft_find_code` →
|
|
26
|
+
* `trail_find_code`, and the word graft → trail. A `graft` followed by `/` is
|
|
27
|
+
* the code map's folder and stays, as do `graft-…` names. Under graft, the
|
|
28
|
+
* text comes back unchanged.
|
|
29
|
+
*/
|
|
30
|
+
export declare function inBrand(text: string, b?: Brand): string;
|
|
31
|
+
/**
|
|
32
|
+
* `trail init` wired this repo: its `.trail/` gitignore is the marker it writes
|
|
33
|
+
* before anything else, and older wirings left a shim, a skill or a settings
|
|
34
|
+
* block that names trail. Read from the repo, not the machine, so every
|
|
35
|
+
* teammate's agent speaks the same name whichever command they installed.
|
|
36
|
+
*
|
|
37
|
+
* `.trail/.gitignore` is what current `trail init` actually leaves behind (the
|
|
38
|
+
* hook shim and the Claude settings it used to write are gone), and the map's
|
|
39
|
+
* location depends on this answer: a repo it does not recognise builds into
|
|
40
|
+
* `graft/` while its own AGENTS.md says `.trail/cache/`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function repoWiredForTrail(dir: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The name hooks and the statusline speak in `repo`. They run under whatever
|
|
45
|
+
* shim set the repo up, often one an older graft committed, so no `dist/bin`
|
|
46
|
+
* entry has set a name. They say trail in a repo wired for it, but only when
|
|
47
|
+
* the `trail` command is installed on this machine: a hook that tells the
|
|
48
|
+
* agent to run a command the machine doesn't have costs a failed tool call.
|
|
49
|
+
* A name already set (by the CLI that spawned this) is kept. `wiredElsewhere`
|
|
50
|
+
* also counts a repo whose other agents' files are on trail (hosts/registry.ts's
|
|
51
|
+
* `hostsWiredForTrail`, passed in so this file stays light): Cursor's and
|
|
52
|
+
* Codex's hooks run this same entry in repos with no `.claude` at all.
|
|
53
|
+
*/
|
|
54
|
+
export declare function adoptRepoBrand(repo: string, env?: NodeJS.ProcessEnv, wiredElsewhere?: (repo: string) => boolean): Brand;
|
|
55
|
+
export declare function noticeStampPath(home?: string): string;
|
|
56
|
+
/** Whether a `trail` executable is on PATH. Only checked when the notice is due. */
|
|
57
|
+
export declare function trailOnPath(env?: NodeJS.ProcessEnv): boolean;
|
|
58
|
+
/** Whether an executable called `name` is on PATH: a few stats, no process spawned. */
|
|
59
|
+
export declare function commandOnPath(name: string, env?: NodeJS.ProcessEnv): boolean;
|
|
60
|
+
export interface NoticeInput {
|
|
61
|
+
/** The graft spelling of what just ran, e.g. `graft ask` or `graft build`. */
|
|
62
|
+
ran: string;
|
|
63
|
+
/** stderr is a terminal: a person is watching. */
|
|
64
|
+
tty: boolean;
|
|
65
|
+
env?: NodeJS.ProcessEnv;
|
|
66
|
+
home?: string;
|
|
67
|
+
now?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The line a person typing `graft` sees, at most once a day, or null.
|
|
71
|
+
*
|
|
72
|
+
* Never shown to an agent (no terminal, or Claude Code's `CLAUDECODE` is set),
|
|
73
|
+
* in CI, or under trail itself: agents and scripts get graft's output exactly
|
|
74
|
+
* as it was. Writing the stamp is best-effort; a home we cannot write to just
|
|
75
|
+
* means the line may show again tomorrow.
|
|
76
|
+
*/
|
|
77
|
+
export declare function graftNotice(input: NoticeInput): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* The line a person typing `trail` sees in a repo an older graft wired, while
|
|
80
|
+
* nothing on this machine can reach that wiring; or null.
|
|
81
|
+
*
|
|
82
|
+
* A graft 0.21 or older committed hook shims that look for `@nanonets/graft`
|
|
83
|
+
* alone, and registered a bare `graft mcp` server. On a machine with trail and
|
|
84
|
+
* no graft, the hooks run and do nothing and the server never starts, so the
|
|
85
|
+
* session start that would move the repo to trail never happens. `trail init`
|
|
86
|
+
* in the repo moves it, and so does a session opened under the hooks
|
|
87
|
+
* `trail init` writes to `~/.claude`; this says so to someone who has done
|
|
88
|
+
* neither. Silent once graft is on PATH, since its hooks then move the repo.
|
|
89
|
+
* Never shown to an agent, a pipe or CI, like {@link graftNotice}.
|
|
90
|
+
*/
|
|
91
|
+
export declare function strandedRepoNotice(input: {
|
|
92
|
+
cwd: string;
|
|
93
|
+
tty: boolean;
|
|
94
|
+
env?: NodeJS.ProcessEnv;
|
|
95
|
+
}): string | null;
|
|
96
|
+
export declare function handoverStampPath(home?: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* The line a Claude Code session start hands the agent on a machine that has
|
|
99
|
+
* graft but not the trail command, at most once a week; or null.
|
|
100
|
+
*
|
|
101
|
+
* {@link graftNotice} reaches a person typing graft. Most people only meet
|
|
102
|
+
* graft through their agent, so the agent is the one who can tell them that
|
|
103
|
+
* `graft upgrade` adds trail. Once trail is installed, the next session moves
|
|
104
|
+
* the repo over by itself (see upkeep-run.ts), so this stops.
|
|
105
|
+
*/
|
|
106
|
+
export declare function trailHandoverLine(input?: {
|
|
107
|
+
env?: NodeJS.ProcessEnv;
|
|
108
|
+
home?: string;
|
|
109
|
+
now?: number;
|
|
110
|
+
}): string | null;
|
|
111
|
+
//# sourceMappingURL=brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../src/brand.ts"],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aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAazF;AAED,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAqB7D;AAUD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAY/G;AAID,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAElE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,GAAG,IAAI,CAqBrH"}
|
package/dist/brand.js
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which name this process was started under: `trail`, or `graft`, the name it
|
|
3
|
+
* had before.
|
|
4
|
+
*
|
|
5
|
+
* Both names run the same code. `trail` gets the new command layout and says
|
|
6
|
+
* `[trail]`; `graft` keeps every old command, meaning and output byte for byte,
|
|
7
|
+
* because agents, hooks, CI scripts and statusline parsers already read it.
|
|
8
|
+
* Nothing about graft is ever removed — see `graftNotice` for the one line a
|
|
9
|
+
* person typing it sees.
|
|
10
|
+
*
|
|
11
|
+
* The name travels in an environment variable rather than a module variable so
|
|
12
|
+
* that every child this process spawns (the detached update check, a hook's
|
|
13
|
+
* background build) speaks the same name as its parent. Unset means graft: the
|
|
14
|
+
* only things that load `dist/cli.js` without going through `dist/bin/*` are
|
|
15
|
+
* shims and configs an older graft wrote.
|
|
16
|
+
*
|
|
17
|
+
* This file imports nothing heavier than node:fs, because the hooks load it.
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
20
|
+
import { homedir } from "node:os";
|
|
21
|
+
import { delimiter, dirname, join } from "node:path";
|
|
22
|
+
/** Set by `dist/bin/trail.js` and `dist/bin/graft.js` before the CLI loads. */
|
|
23
|
+
export const BRAND_ENV = "TRAIL_INVOKED_AS";
|
|
24
|
+
/** The npm package each name is published as. Same code, two names. */
|
|
25
|
+
export const PACKAGE_FOR = {
|
|
26
|
+
trail: "trail-code",
|
|
27
|
+
graft: "@nanonets/graft",
|
|
28
|
+
};
|
|
29
|
+
export function brand(env = process.env) {
|
|
30
|
+
return env[BRAND_ENV] === "trail" ? "trail" : "graft";
|
|
31
|
+
}
|
|
32
|
+
export function setBrand(b, env = process.env) {
|
|
33
|
+
env[BRAND_ENV] = b;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `init --pair CODE` is Trail's setup prompt: only Trail's page hands out a pair
|
|
37
|
+
* code, so the person asked for Trail, whatever name ran it. An agent whose
|
|
38
|
+
* install of `trail-code` failed swaps in the `graft` already on the
|
|
39
|
+
* machine, and an old shim loads dist/cli.js with no name; under graft either
|
|
40
|
+
* would skip the look-back and `.trail/` while the page waits for them.
|
|
41
|
+
*/
|
|
42
|
+
export function asksForTrail(argv) {
|
|
43
|
+
return argv.includes("init") && argv.some((a) => a === "--pair" || a.startsWith("--pair="));
|
|
44
|
+
}
|
|
45
|
+
/** `[trail]` or `[graft]`: the prefix agents and the statusline look for. */
|
|
46
|
+
export function tag(env = process.env) {
|
|
47
|
+
return `[${brand(env)}]`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The commands whose trail spelling is not just `graft` → `trail`, longest
|
|
51
|
+
* prefix first. `graft check` gave its name to the team check, and `graft
|
|
52
|
+
* stats` became `trail status`.
|
|
53
|
+
*/
|
|
54
|
+
const RENAMED = [
|
|
55
|
+
["graft check", "trail build --check"],
|
|
56
|
+
["graft stats", "trail status"],
|
|
57
|
+
["graft", "trail"],
|
|
58
|
+
];
|
|
59
|
+
/**
|
|
60
|
+
* A command as the running name spells it. Takes the graft spelling, so call
|
|
61
|
+
* sites read the way they always have and graft's output does not change:
|
|
62
|
+
* `cmd("graft ask")` is `graft ask` under graft and `trail ask` under trail.
|
|
63
|
+
*/
|
|
64
|
+
export function cmd(graftSpelling, b = brand()) {
|
|
65
|
+
if (b === "graft")
|
|
66
|
+
return graftSpelling;
|
|
67
|
+
for (const [from, to] of RENAMED) {
|
|
68
|
+
if (graftSpelling === from)
|
|
69
|
+
return to;
|
|
70
|
+
if (graftSpelling.startsWith(`${from} `))
|
|
71
|
+
return `${to}${graftSpelling.slice(from.length)}`;
|
|
72
|
+
}
|
|
73
|
+
return graftSpelling;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Agent-facing prose and tool names in trail's spelling: `graft_find_code` →
|
|
77
|
+
* `trail_find_code`, and the word graft → trail. A `graft` followed by `/` is
|
|
78
|
+
* the code map's folder and stays, as do `graft-…` names. Under graft, the
|
|
79
|
+
* text comes back unchanged.
|
|
80
|
+
*/
|
|
81
|
+
export function inBrand(text, b = brand()) {
|
|
82
|
+
if (b === "graft")
|
|
83
|
+
return text;
|
|
84
|
+
return text.replace(/\bgraft_(?=[a-z])/g, "trail_").replace(/\bgraft\b(?![/\w-])/g, "trail");
|
|
85
|
+
}
|
|
86
|
+
/* -------------------------------------------------------------------------- */
|
|
87
|
+
/* hooks and the statusline */
|
|
88
|
+
/* -------------------------------------------------------------------------- */
|
|
89
|
+
/**
|
|
90
|
+
* `trail init` wired this repo: its `.trail/` gitignore is the marker it writes
|
|
91
|
+
* before anything else, and older wirings left a shim, a skill or a settings
|
|
92
|
+
* block that names trail. Read from the repo, not the machine, so every
|
|
93
|
+
* teammate's agent speaks the same name whichever command they installed.
|
|
94
|
+
*
|
|
95
|
+
* `.trail/.gitignore` is what current `trail init` actually leaves behind (the
|
|
96
|
+
* hook shim and the Claude settings it used to write are gone), and the map's
|
|
97
|
+
* location depends on this answer: a repo it does not recognise builds into
|
|
98
|
+
* `graft/` while its own AGENTS.md says `.trail/cache/`.
|
|
99
|
+
*/
|
|
100
|
+
export function repoWiredForTrail(dir) {
|
|
101
|
+
if (existsSync(join(dir, ".trail", ".gitignore")))
|
|
102
|
+
return true;
|
|
103
|
+
if (existsSync(join(dir, ".trail", "hook.cjs")))
|
|
104
|
+
return true;
|
|
105
|
+
if (existsSync(join(dir, ".claude", "helpers", "trail-hooks.cjs")) || existsSync(join(dir, ".claude", "skills", "trail", "SKILL.md")))
|
|
106
|
+
return true;
|
|
107
|
+
try {
|
|
108
|
+
const settings = readFileSync(join(dir, ".claude", "settings.json"), "utf8");
|
|
109
|
+
return settings.includes("trail-hooks.cjs") || settings.includes("/.trail/hook.cjs");
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The name hooks and the statusline speak in `repo`. They run under whatever
|
|
117
|
+
* shim set the repo up, often one an older graft committed, so no `dist/bin`
|
|
118
|
+
* entry has set a name. They say trail in a repo wired for it, but only when
|
|
119
|
+
* the `trail` command is installed on this machine: a hook that tells the
|
|
120
|
+
* agent to run a command the machine doesn't have costs a failed tool call.
|
|
121
|
+
* A name already set (by the CLI that spawned this) is kept. `wiredElsewhere`
|
|
122
|
+
* also counts a repo whose other agents' files are on trail (hosts/registry.ts's
|
|
123
|
+
* `hostsWiredForTrail`, passed in so this file stays light): Cursor's and
|
|
124
|
+
* Codex's hooks run this same entry in repos with no `.claude` at all.
|
|
125
|
+
*/
|
|
126
|
+
export function adoptRepoBrand(repo, env = process.env, wiredElsewhere) {
|
|
127
|
+
if (env[BRAND_ENV] !== "trail" && env[BRAND_ENV] !== "graft") {
|
|
128
|
+
const wired = repoWiredForTrail(repo) || Boolean(wiredElsewhere?.(repo));
|
|
129
|
+
setBrand(wired && trailOnPath(env) ? "trail" : "graft", env);
|
|
130
|
+
}
|
|
131
|
+
return brand(env);
|
|
132
|
+
}
|
|
133
|
+
/* -------------------------------------------------------------------------- */
|
|
134
|
+
/* the once-a-day line for people still typing graft */
|
|
135
|
+
/* -------------------------------------------------------------------------- */
|
|
136
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
137
|
+
export function noticeStampPath(home = homedir()) {
|
|
138
|
+
return join(home, ".graft", "rename-notice.json");
|
|
139
|
+
}
|
|
140
|
+
/** Whether a `trail` executable is on PATH. Only checked when the notice is due. */
|
|
141
|
+
export function trailOnPath(env = process.env) {
|
|
142
|
+
return commandOnPath("trail", env);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* A package's own bin folder, which npm puts on PATH only for the command it
|
|
146
|
+
* runs: npx's temporary copy (`~/.npm/_npx/<hash>/node_modules/.bin`) or a
|
|
147
|
+
* project's dependencies. Agents start with the person's own PATH, so a
|
|
148
|
+
* command found only there isn't installed for them.
|
|
149
|
+
*/
|
|
150
|
+
const PACKAGE_BIN = /[\\/]node_modules[\\/]\.bin[\\/]?$/;
|
|
151
|
+
/** Whether an executable called `name` is on PATH: a few stats, no process spawned. */
|
|
152
|
+
export function commandOnPath(name, env = process.env) {
|
|
153
|
+
const names = process.platform === "win32" ? [`${name}.cmd`, `${name}.exe`, name] : [name];
|
|
154
|
+
for (const dir of (env.PATH ?? "").split(delimiter)) {
|
|
155
|
+
if (!dir || PACKAGE_BIN.test(dir))
|
|
156
|
+
continue;
|
|
157
|
+
for (const n of names) {
|
|
158
|
+
try {
|
|
159
|
+
if (statSync(join(dir, n)).isFile())
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
/* not here */
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* The line a person typing `graft` sees, at most once a day, or null.
|
|
171
|
+
*
|
|
172
|
+
* Never shown to an agent (no terminal, or Claude Code's `CLAUDECODE` is set),
|
|
173
|
+
* in CI, or under trail itself: agents and scripts get graft's output exactly
|
|
174
|
+
* as it was. Writing the stamp is best-effort; a home we cannot write to just
|
|
175
|
+
* means the line may show again tomorrow.
|
|
176
|
+
*/
|
|
177
|
+
export function graftNotice(input) {
|
|
178
|
+
const env = input.env ?? process.env;
|
|
179
|
+
if (brand(env) !== "graft" || !input.tty)
|
|
180
|
+
return null;
|
|
181
|
+
if (env.CLAUDECODE !== undefined || env.CI || env.GRAFT_NO_RENAME_NOTICE)
|
|
182
|
+
return null;
|
|
183
|
+
const now = input.now ?? Date.now();
|
|
184
|
+
const path = noticeStampPath(input.home);
|
|
185
|
+
try {
|
|
186
|
+
const last = JSON.parse(readFileSync(path, "utf8")).shownAt ?? 0;
|
|
187
|
+
if (now - last < DAY_MS)
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
/* never shown */
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
195
|
+
writeFileSync(path, JSON.stringify({ shownAt: now }) + "\n");
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
/* shown again next time */
|
|
199
|
+
}
|
|
200
|
+
const lines = [`· graft is now trail. this ran ${cmd(input.ran, "trail")}, and graft keeps working (shown once a day)`];
|
|
201
|
+
if (!trailOnPath(env))
|
|
202
|
+
lines.push("· run graft upgrade to get the trail command too");
|
|
203
|
+
return lines.join("\n");
|
|
204
|
+
}
|
|
205
|
+
/** The nearest directory at or above `dir` holding a `.git`, or null. */
|
|
206
|
+
function gitRootOf(dir) {
|
|
207
|
+
for (let at = dir;; at = dirname(at)) {
|
|
208
|
+
if (existsSync(join(at, ".git")))
|
|
209
|
+
return at;
|
|
210
|
+
if (dirname(at) === at)
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The line a person typing `trail` sees in a repo an older graft wired, while
|
|
216
|
+
* nothing on this machine can reach that wiring; or null.
|
|
217
|
+
*
|
|
218
|
+
* A graft 0.21 or older committed hook shims that look for `@nanonets/graft`
|
|
219
|
+
* alone, and registered a bare `graft mcp` server. On a machine with trail and
|
|
220
|
+
* no graft, the hooks run and do nothing and the server never starts, so the
|
|
221
|
+
* session start that would move the repo to trail never happens. `trail init`
|
|
222
|
+
* in the repo moves it, and so does a session opened under the hooks
|
|
223
|
+
* `trail init` writes to `~/.claude`; this says so to someone who has done
|
|
224
|
+
* neither. Silent once graft is on PATH, since its hooks then move the repo.
|
|
225
|
+
* Never shown to an agent, a pipe or CI, like {@link graftNotice}.
|
|
226
|
+
*/
|
|
227
|
+
export function strandedRepoNotice(input) {
|
|
228
|
+
const env = input.env ?? process.env;
|
|
229
|
+
if (brand(env) !== "trail" || !input.tty)
|
|
230
|
+
return null;
|
|
231
|
+
if (env.CLAUDECODE !== undefined || env.CI)
|
|
232
|
+
return null;
|
|
233
|
+
const repo = gitRootOf(input.cwd);
|
|
234
|
+
if (!repo || repoWiredForTrail(repo) || commandOnPath("graft", env))
|
|
235
|
+
return null;
|
|
236
|
+
try {
|
|
237
|
+
if (readFileSync(join(repo, ".claude", "helpers", "graft-hooks.cjs"), "utf8").includes(PACKAGE_FOR.trail))
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
return null; // no graft wiring here
|
|
242
|
+
}
|
|
243
|
+
return "· this repo's agent hooks were set up by an older graft and can't find trail. run trail init here once to move the repo over";
|
|
244
|
+
}
|
|
245
|
+
const WEEK_MS = 7 * DAY_MS;
|
|
246
|
+
export function handoverStampPath(home = homedir()) {
|
|
247
|
+
return join(home, ".graft", "trail-handover.json");
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* The line a Claude Code session start hands the agent on a machine that has
|
|
251
|
+
* graft but not the trail command, at most once a week; or null.
|
|
252
|
+
*
|
|
253
|
+
* {@link graftNotice} reaches a person typing graft. Most people only meet
|
|
254
|
+
* graft through their agent, so the agent is the one who can tell them that
|
|
255
|
+
* `graft upgrade` adds trail. Once trail is installed, the next session moves
|
|
256
|
+
* the repo over by itself (see upkeep-run.ts), so this stops.
|
|
257
|
+
*/
|
|
258
|
+
export function trailHandoverLine(input = {}) {
|
|
259
|
+
const env = input.env ?? process.env;
|
|
260
|
+
if (brand(env) !== "graft" || env.CI || env.GRAFT_NO_RENAME_NOTICE || trailOnPath(env))
|
|
261
|
+
return null;
|
|
262
|
+
const now = input.now ?? Date.now();
|
|
263
|
+
const path = handoverStampPath(input.home);
|
|
264
|
+
try {
|
|
265
|
+
const last = JSON.parse(readFileSync(path, "utf8")).shownAt ?? 0;
|
|
266
|
+
if (now - last < WEEK_MS)
|
|
267
|
+
return null;
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
/* never shown */
|
|
271
|
+
}
|
|
272
|
+
try {
|
|
273
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
274
|
+
writeFileSync(path, JSON.stringify({ shownAt: now }) + "\n");
|
|
275
|
+
}
|
|
276
|
+
catch {
|
|
277
|
+
/* shown again next time */
|
|
278
|
+
}
|
|
279
|
+
return ("· graft is now Trail-code: the same code map under the `trail` command. " +
|
|
280
|
+
"Tell the user once, in a line at the end of your first reply, that `graft upgrade` switches the name and graft keeps working.");
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.js","sourceRoot":"","sources":["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CAAC,sBAAsB,IAAI,WAAW,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACpG,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,IAAI,GAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAA0B,CAAC,OAAO,IAAI,CAAC,CAAC;QAC3F,IAAI,GAAG,GAAG,IAAI,GAAG,OAAO;YAAE,OAAO,IAAI,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,iBAAiB;IACnB,CAAC;IACD,IAAI,CAAC;QACH,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,2BAA2B;IAC7B,CAAC;IACD,OAAO,CACL,0EAA0E;QAC1E,+HAA+H,CAChI,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface BuiltGraph {
|
|
2
|
+
nodes: number;
|
|
3
|
+
edges: number;
|
|
4
|
+
files: number;
|
|
5
|
+
}
|
|
6
|
+
/** The totals out of `graft build`'s stdout, or null when it printed none. */
|
|
7
|
+
export declare function parseBuildSummary(stdout: string): BuiltGraph | null;
|
|
8
|
+
/** The last `parsing N/M` in a chunk of the child's stderr. */
|
|
9
|
+
export declare function parseProgress(chunk: string): {
|
|
10
|
+
index: number;
|
|
11
|
+
total: number;
|
|
12
|
+
} | null;
|
|
13
|
+
/**
|
|
14
|
+
* Build the graph for `dir` unless it has one, showing progress on a spinner.
|
|
15
|
+
*
|
|
16
|
+
* `built: false` with no `failed` means there was nothing to do (`--no-build`,
|
|
17
|
+
* or a graph already there). Warning and error lines the build printed come
|
|
18
|
+
* back in `messages`, for the caller to print in full.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildGraphWithProgress(dir: string, opts: {
|
|
21
|
+
build?: boolean;
|
|
22
|
+
cliPath?: string;
|
|
23
|
+
childCount?: number;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
built: boolean;
|
|
26
|
+
graph?: BuiltGraph;
|
|
27
|
+
failed?: boolean;
|
|
28
|
+
messages: string[];
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=build-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-progress.d.ts","sourceRoot":"","sources":["../../src/claude/build-progress.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAID,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAKnE;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAIpF;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/D,OAAO,CAAC;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAwCvF"}
|