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 @@
|
|
|
1
|
+
{"version":3,"file":"map-dir.d.ts","sourceRoot":"","sources":["../../src/context/map-dir.ts"],"names":[],"mappings":"AAgCA,iEAAiE;AACjE,eAAO,MAAM,aAAa,QAA0B,CAAC;AACrD,wCAAwC;AACxC,eAAO,MAAM,aAAa,UAAU,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a repo's code map lives.
|
|
3
|
+
*
|
|
4
|
+
* In a repo on trail, `.trail/cache/`: inside the one folder a team commits,
|
|
5
|
+
* and kept out of git by `.trail/.gitignore`, so neither the repo's own
|
|
6
|
+
* `.gitignore` nor a root `.ignore` has to name it. Everywhere else `graft/`,
|
|
7
|
+
* as before. Being a hidden folder, `.trail/cache/` is skipped by a grep from
|
|
8
|
+
* the repo root; the agent reaches it through `trail ask` and the path the
|
|
9
|
+
* session-start hook names, and a grep given that path searches it.
|
|
10
|
+
*
|
|
11
|
+
* A map still in `graft/` from before the repo moved to trail is renamed into
|
|
12
|
+
* place the first time anyone asks where the map is, so a session never
|
|
13
|
+
* rebuilds what's already on disk.
|
|
14
|
+
*/
|
|
15
|
+
import { WINHIDE } from "../util/child-process.js";
|
|
16
|
+
import { execFileSync } from "node:child_process";
|
|
17
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
18
|
+
import { join } from "node:path";
|
|
19
|
+
import { repoWiredForTrail } from "../brand.js";
|
|
20
|
+
/** Write `entry` into `.trail/.gitignore` so the cache stays out of git. */
|
|
21
|
+
function ignoreInTrailDir(root, entry) {
|
|
22
|
+
const trailDir = join(root, '.trail');
|
|
23
|
+
mkdirSync(trailDir, { recursive: true });
|
|
24
|
+
const giPath = join(trailDir, '.gitignore');
|
|
25
|
+
let current = '';
|
|
26
|
+
try {
|
|
27
|
+
current = readFileSync(giPath, 'utf8');
|
|
28
|
+
}
|
|
29
|
+
catch { /* new file */ }
|
|
30
|
+
if (!current.split('\n').some(l => l.trim() === entry.trim())) {
|
|
31
|
+
writeFileSync(giPath, current ? `${current.trimEnd()}\n${entry}\n` : `${entry}\n`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** The map's folder in a repo on trail, relative to the repo. */
|
|
35
|
+
export const TRAIL_MAP_DIR = join(".trail", "cache");
|
|
36
|
+
/** The map's folder everywhere else. */
|
|
37
|
+
export const GRAFT_MAP_DIR = "graft";
|
|
38
|
+
/**
|
|
39
|
+
* Absolute path of `root`'s code map folder. A repo is on trail once its
|
|
40
|
+
* hooks say so or it has `.trail/learnings/`, which `trail init` makes before
|
|
41
|
+
* anything else, so nothing it writes lands in `graft/` first.
|
|
42
|
+
*/
|
|
43
|
+
export function mapDirFor(root) {
|
|
44
|
+
const trail = join(root, TRAIL_MAP_DIR);
|
|
45
|
+
if (existsSync(trail))
|
|
46
|
+
return trail;
|
|
47
|
+
if (!existsSync(join(root, ".trail", "learnings")) && !repoWiredForTrail(root))
|
|
48
|
+
return join(root, GRAFT_MAP_DIR);
|
|
49
|
+
moveOldMap(root, trail);
|
|
50
|
+
return trail;
|
|
51
|
+
}
|
|
52
|
+
/** Whether `dir` is a repo's trail map folder, which `.trail/.gitignore` keeps out of git. */
|
|
53
|
+
export function isTrailMapDir(root, dir) {
|
|
54
|
+
return join(root, TRAIL_MAP_DIR) === join(dir);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `graft/` holding a map from before the repo moved to trail: renamed to
|
|
58
|
+
* `.trail/cache/`. Left alone when git tracks it (a map committed back when
|
|
59
|
+
* it was shared), since moving it would delete committed files.
|
|
60
|
+
*/
|
|
61
|
+
function moveOldMap(root, to) {
|
|
62
|
+
const from = join(root, GRAFT_MAP_DIR);
|
|
63
|
+
if (!existsSync(join(from, "INDEX.md")) && !existsSync(join(from, ".graph")))
|
|
64
|
+
return;
|
|
65
|
+
try {
|
|
66
|
+
execFileSync("git", ["ls-files", "--error-unmatch", "--", "graft/INDEX.md"], { ...WINHIDE, cwd: root, stdio: "ignore", timeout: 3000 });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// untracked, or not a git checkout: ours to move
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
mkdirSync(join(root, ".trail"), { recursive: true });
|
|
74
|
+
ignoreInTrailDir(root, "cache/");
|
|
75
|
+
renameSync(from, to);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Another process moved it first, or it can't move: the next build makes a new one.
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=map-dir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-dir.js","sourceRoot":"","sources":["../../src/context/map-dir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,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
+
/** A source file a node was derived from, with its content hash at generation time. */
|
|
2
|
+
export interface SourceRef {
|
|
3
|
+
path: string;
|
|
4
|
+
hash: string;
|
|
5
|
+
}
|
|
6
|
+
/** A directed edge to another node (by slug). */
|
|
7
|
+
export interface NodeLink {
|
|
8
|
+
to: string;
|
|
9
|
+
relation: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A single node in the graph — one markdown file. */
|
|
13
|
+
export interface ContextNode {
|
|
14
|
+
name: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
/** Coarse category from extraction: system | service | api | concept | … */
|
|
17
|
+
type: string;
|
|
18
|
+
/** Prose description that becomes the node body. */
|
|
19
|
+
summary: string;
|
|
20
|
+
/** Source files that produced this node (empty only for hand-authored nodes). */
|
|
21
|
+
sources: SourceRef[];
|
|
22
|
+
/** sha256 over the sorted `path:hash` lines of {@link sources}. */
|
|
23
|
+
sourcesDigest: string;
|
|
24
|
+
/** Outbound edges. */
|
|
25
|
+
links: NodeLink[];
|
|
26
|
+
/** Free-form region below the generated block, preserved across re-runs. */
|
|
27
|
+
human: string;
|
|
28
|
+
}
|
|
29
|
+
/** The generated index written alongside the node files. */
|
|
30
|
+
export interface Manifest {
|
|
31
|
+
version: number;
|
|
32
|
+
/** Human label for the model that built the graph, e.g. "openrouter:openai/gpt-4o-mini". */
|
|
33
|
+
model: string;
|
|
34
|
+
/** sha256 over every source file's `path:hash` — the whole-graph fingerprint. */
|
|
35
|
+
repoDigest: string;
|
|
36
|
+
/** Every source file `init` processed, with its hash. The staleness ground-truth. */
|
|
37
|
+
files: SourceRef[];
|
|
38
|
+
/** Node roster (a subset of each node's frontmatter, for fast reads). */
|
|
39
|
+
nodes: Array<{
|
|
40
|
+
slug: string;
|
|
41
|
+
name: string;
|
|
42
|
+
type: string;
|
|
43
|
+
sources: string[];
|
|
44
|
+
sourcesDigest: string;
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
export declare const MANIFEST_VERSION = 1;
|
|
48
|
+
/** Gitignored cache dir (per-file summaries + extractions), never committed. */
|
|
49
|
+
export declare const CACHE_DIR = ".cache";
|
|
50
|
+
/** Turn a display name into a stable, filesystem- and link-safe slug. */
|
|
51
|
+
export declare function slugify(name: string): string;
|
|
52
|
+
/** sha256 over the sorted `path:hash` lines of a set of sources. */
|
|
53
|
+
export declare function digestSources(sources: SourceRef[]): string;
|
|
54
|
+
/** Absolute path of a repo's code map: `graft/`, or `.trail/cache/` in a repo
|
|
55
|
+
* on trail (see context/map-dir.ts). An explicit `--dir` wins. `graft/` is
|
|
56
|
+
* visible (not dot-prefixed) on purpose: default ripgrep skips hidden dirs, so
|
|
57
|
+
* a grep can land on its cards; under trail the hooks name the path instead. */
|
|
58
|
+
export declare function contextDirFor(root: string, override?: string): string;
|
|
59
|
+
/** Why `.graft/` is ignored, which is a different reason: not that it is cheap
|
|
60
|
+
* to regenerate, but that it holds a token. */
|
|
61
|
+
export declare const LINK_NOTE = "graft's brain link \u2014 holds a read token, never commit it.";
|
|
62
|
+
export declare function ensureGitignored(root: string, contextDir: string, note?: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Keep the card tree greppable even though it's gitignored, by writing a root
|
|
65
|
+
* `.ignore` that re-admits it.
|
|
66
|
+
*
|
|
67
|
+
* The cards exist so that a `grep <symbol>` lands on a ~150-token card instead of
|
|
68
|
+
* a whole source file. Making the graph a local cache (and so gitignored) silently
|
|
69
|
+
* broke that: **ripgrep honours `.gitignore`**, and every ripgrep-backed search
|
|
70
|
+
* tool inherits the blind spot — verified by a card that names a symbol which
|
|
71
|
+
* default `rg` will not return and `rg -uu` finds instantly. `.ignore` is read at
|
|
72
|
+
* higher precedence than `.gitignore`, so re-admitting the tree there restores
|
|
73
|
+
* search without git ever tracking a byte of it.
|
|
74
|
+
*
|
|
75
|
+
* The two negative entries matter as much as the positive one: `.cache/` holds a
|
|
76
|
+
* multi-MB parse memo and `.graph/` holds `wiring.json`, and dropping either into
|
|
77
|
+
* every repo-wide search would be worse than the problem being fixed.
|
|
78
|
+
*
|
|
79
|
+
* Same contract as {@link ensureGitignored}: idempotent, skips a context dir
|
|
80
|
+
* outside `root`, and swallows write failures — a build that already succeeded
|
|
81
|
+
* must not fail over a convenience file.
|
|
82
|
+
*/
|
|
83
|
+
export declare function ensureSearchable(root: string, contextDir: string): void;
|
|
84
|
+
/** Serialize a node to its full markdown file contents. */
|
|
85
|
+
export declare function renderNodeFile(node: ContextNode): string;
|
|
86
|
+
/**
|
|
87
|
+
* Write a node file, preserving any existing human region. Returns the file
|
|
88
|
+
* path written.
|
|
89
|
+
*/
|
|
90
|
+
export declare function writeNode(dir: string, node: ContextNode): string;
|
|
91
|
+
/** A node file parsed back off disk (frontmatter only; body is not needed for `check`). */
|
|
92
|
+
export interface ParsedNode {
|
|
93
|
+
slug: string;
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
sources: SourceRef[];
|
|
97
|
+
sourcesDigest: string;
|
|
98
|
+
links: NodeLink[];
|
|
99
|
+
}
|
|
100
|
+
/** Read and parse every concept-node `.md` in a context dir (skips INDEX.md
|
|
101
|
+
* and root-level per-file cards). */
|
|
102
|
+
export declare function readNodes(dir: string): ParsedNode[];
|
|
103
|
+
/** List the node files present (slug → filename), for pruning deleted nodes. */
|
|
104
|
+
export declare function existingNodeSlugs(dir: string): Set<string>;
|
|
105
|
+
/** Delete a node file by slug. */
|
|
106
|
+
export declare function deleteNode(dir: string, slug: string): void;
|
|
107
|
+
export declare function writeManifest(dir: string, manifest: Manifest): void;
|
|
108
|
+
export declare function readManifest(dir: string): Manifest | undefined;
|
|
109
|
+
//# sourceMappingURL=node-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-file.d.ts","sourceRoot":"","sources":["../../src/context/node-file.ts"],"names":[],"mappings":"AA6CA,uFAAuF;AACvF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,C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AG,SAAS,CAQ9D"}
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The on-disk format of the context graph: a folder of plain markdown files
|
|
3
|
+
* under `.context/`, one per node. The files ARE the graph — the frontmatter
|
|
4
|
+
* carries the machine-readable node (identity, source provenance, edges) and
|
|
5
|
+
* the body is human/agent-readable prose. There is no database.
|
|
6
|
+
*
|
|
7
|
+
* Layout of a node file:
|
|
8
|
+
*
|
|
9
|
+
* --- ← YAML frontmatter (canonical, machine-owned)
|
|
10
|
+
* name / slug / type
|
|
11
|
+
* sources: [{path, hash}] ← provenance + the staleness key
|
|
12
|
+
* sources_digest
|
|
13
|
+
* links: [{to, relation}] ← edges (canonical form)
|
|
14
|
+
* ---
|
|
15
|
+
* <!-- context:generated:start -->
|
|
16
|
+
* ## Summary … ## Related … ← regenerated on every `init`
|
|
17
|
+
* <!-- context:generated:end -->
|
|
18
|
+
* ## Notes … ← anything a human writes is preserved verbatim
|
|
19
|
+
*
|
|
20
|
+
* `.context/manifest.json` is a generated index over all nodes plus the full
|
|
21
|
+
* file→hash map `init` saw, so `check` can detect drift in O(files) without an
|
|
22
|
+
* LLM and without re-reading every node body.
|
|
23
|
+
*/
|
|
24
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, rmSync } from "node:fs";
|
|
25
|
+
import { join } from "node:path";
|
|
26
|
+
import { spawnSync } from "node:child_process";
|
|
27
|
+
import { matter } from "../util/front-matter.js";
|
|
28
|
+
import { contentHash, normalizeName } from "../util/id.js";
|
|
29
|
+
import { relPosix, stripTrailingSlashes } from "../util/paths.js";
|
|
30
|
+
// Value-only import of a constant; `write.ts` pulls in nothing from here, so no cycle.
|
|
31
|
+
import { GRAPH_DIR } from "../graph/write.js";
|
|
32
|
+
import { mapDirFor, isTrailMapDir } from "./map-dir.js";
|
|
33
|
+
/** Write `entry` into `.trail/.gitignore` so the cache stays out of git. */
|
|
34
|
+
function ignoreInTrailDir(root, entry) {
|
|
35
|
+
const trailDir = join(root, '.trail');
|
|
36
|
+
mkdirSync(trailDir, { recursive: true });
|
|
37
|
+
const giPath = join(trailDir, '.gitignore');
|
|
38
|
+
let current = '';
|
|
39
|
+
try {
|
|
40
|
+
current = readFileSync(giPath, 'utf8');
|
|
41
|
+
}
|
|
42
|
+
catch { /* new file */ }
|
|
43
|
+
if (!current.split('\n').some(l => l.trim() === entry.trim())) {
|
|
44
|
+
writeFileSync(giPath, current ? `${current.trimEnd()}\n${entry}\n` : `${entry}\n`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export const MANIFEST_VERSION = 1;
|
|
48
|
+
const GEN_START = "<!-- context:generated:start -->";
|
|
49
|
+
const GEN_END = "<!-- context:generated:end -->";
|
|
50
|
+
const MANIFEST_FILE = "manifest.json";
|
|
51
|
+
/** Gitignored cache dir (per-file summaries + extractions), never committed. */
|
|
52
|
+
export const CACHE_DIR = ".cache";
|
|
53
|
+
/** Env kill switch — same truthy parsing as `GRAFT_NO_REFRESH` in ../graph/refresh.ts. */
|
|
54
|
+
function envTruthy(name) {
|
|
55
|
+
const v = process.env[name];
|
|
56
|
+
return v !== undefined && v !== "" && v !== "0" && v !== "false";
|
|
57
|
+
}
|
|
58
|
+
/** Turn a display name into a stable, filesystem- and link-safe slug. */
|
|
59
|
+
export function slugify(name) {
|
|
60
|
+
const base = normalizeName(name)
|
|
61
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
62
|
+
.replace(/^-+|-+$/g, "");
|
|
63
|
+
return base || "node";
|
|
64
|
+
}
|
|
65
|
+
/** sha256 over the sorted `path:hash` lines of a set of sources. */
|
|
66
|
+
export function digestSources(sources) {
|
|
67
|
+
const lines = sources
|
|
68
|
+
.map((s) => `${s.path}:${s.hash}`)
|
|
69
|
+
.sort()
|
|
70
|
+
.join("\n");
|
|
71
|
+
return contentHash(lines);
|
|
72
|
+
}
|
|
73
|
+
/** Absolute path of a repo's code map: `graft/`, or `.trail/cache/` in a repo
|
|
74
|
+
* on trail (see context/map-dir.ts). An explicit `--dir` wins. `graft/` is
|
|
75
|
+
* visible (not dot-prefixed) on purpose: default ripgrep skips hidden dirs, so
|
|
76
|
+
* a grep can land on its cards; under trail the hooks name the path instead. */
|
|
77
|
+
export function contextDirFor(root, override) {
|
|
78
|
+
if (override)
|
|
79
|
+
return override;
|
|
80
|
+
return mapDirFor(root);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Make sure the repo's root `.gitignore` ignores the graft output dir. The
|
|
84
|
+
* graph is a local, regenerable cache (like `node_modules`), not a committed
|
|
85
|
+
* artifact, so every `graft build` adds the entry itself the first time — the
|
|
86
|
+
* user never has to think about it. No-ops when the entry is already present,
|
|
87
|
+
* when git already ignores the dir by other means (`.git/info/exclude`, a parent
|
|
88
|
+
* `.gitignore`, `core.excludesFile`), or when the dir lives outside `root` (a
|
|
89
|
+
* custom `--dir` elsewhere, which can't be expressed as a repo-relative ignore).
|
|
90
|
+
* Best-effort: an unwritable `.gitignore` must never abort a build, so write
|
|
91
|
+
* failures are swallowed.
|
|
92
|
+
*/
|
|
93
|
+
const GRAPH_CACHE_NOTE = "graft's local graph cache — regenerable, not committed (run `graft build`).";
|
|
94
|
+
/** Why `.graft/` is ignored, which is a different reason: not that it is cheap
|
|
95
|
+
* to regenerate, but that it holds a token. */
|
|
96
|
+
export const LINK_NOTE = "graft's brain link — holds a read token, never commit it.";
|
|
97
|
+
export function ensureGitignored(root, contextDir, note = GRAPH_CACHE_NOTE) {
|
|
98
|
+
if (envTruthy("GRAFT_NO_GITIGNORE"))
|
|
99
|
+
return;
|
|
100
|
+
// trail's map: `.trail/.gitignore` keeps it out, and the repo's own file is never touched.
|
|
101
|
+
if (isTrailMapDir(root, contextDir)) {
|
|
102
|
+
try {
|
|
103
|
+
ignoreInTrailDir(root, "cache/");
|
|
104
|
+
}
|
|
105
|
+
catch { /* best-effort */ }
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const rel = relPosix(root, contextDir);
|
|
109
|
+
if (rel === "" || rel.startsWith(".."))
|
|
110
|
+
return; // dir is at/above the repo root — nothing sane to ignore
|
|
111
|
+
const bare = stripTrailingSlashes(rel); // "graft" (or a `--dir` subpath like "tools/ctx")
|
|
112
|
+
// Root-ANCHORED, so it ignores exactly this repo's `graft/` and not a directory named
|
|
113
|
+
// `graft` at any depth. An unanchored `graft/` also matched `.claude/skills/graft/`, so
|
|
114
|
+
// committing the skill graft just wrote was silently dropped (#79). `rel` is always
|
|
115
|
+
// repo-relative here, so a leading `/` is always safe (incl. a `--dir` subpath).
|
|
116
|
+
const entry = `/${bare}/`;
|
|
117
|
+
const path = join(root, ".gitignore");
|
|
118
|
+
let current = "";
|
|
119
|
+
try {
|
|
120
|
+
current = readFileSync(path, "utf8");
|
|
121
|
+
}
|
|
122
|
+
catch { /* no .gitignore yet — we create one */ }
|
|
123
|
+
// Accept the anchored form AND the older unanchored `graft/` / `graft`, so existing
|
|
124
|
+
// repos aren't double-appended and a hand-anchored entry survives the next build.
|
|
125
|
+
const present = current.split("\n").some((l) => {
|
|
126
|
+
const t = l.trim();
|
|
127
|
+
return t === entry || t === `${bare}/` || t === bare;
|
|
128
|
+
});
|
|
129
|
+
if (present)
|
|
130
|
+
return;
|
|
131
|
+
// Not in `.gitignore` itself, but git may already ignore the dir through `.git/info/exclude`,
|
|
132
|
+
// a parent `.gitignore` or `core.excludesFile`. Then there is nothing to add, and appending
|
|
133
|
+
// would dirty the checkout again on every build for a user who keeps tooling noise out of
|
|
134
|
+
// the tracked `.gitignore` on purpose.
|
|
135
|
+
if (gitAlreadyIgnores(root, bare))
|
|
136
|
+
return;
|
|
137
|
+
const gap = current === "" ? "" : current.endsWith("\n") ? "\n" : "\n\n";
|
|
138
|
+
const block = `${gap}# ${note}\n${entry}\n`;
|
|
139
|
+
try {
|
|
140
|
+
writeFileSync(path, current + block);
|
|
141
|
+
}
|
|
142
|
+
catch { /* best-effort — build already succeeded */ }
|
|
143
|
+
}
|
|
144
|
+
/** Variables that point git at a different repo than the one in `cwd` (a git hook exports
|
|
145
|
+
* `GIT_DIR` and `GIT_INDEX_FILE`, a wrapper may export the rest). Left in the child's
|
|
146
|
+
* environment they make `check-ignore` answer for that other repo. */
|
|
147
|
+
const GIT_REPO_ENV = [
|
|
148
|
+
"GIT_DIR", "GIT_WORK_TREE", "GIT_INDEX_FILE", "GIT_COMMON_DIR", "GIT_OBJECT_DIRECTORY", "GIT_NAMESPACE",
|
|
149
|
+
];
|
|
150
|
+
/** True when `root` is a git work tree whose ignore rules (every source git reads: `.gitignore`
|
|
151
|
+
* files, `.git/info/exclude`, `core.excludesFile`) already cover the directory `rel/`. Any
|
|
152
|
+
* failure (git missing, not a repo, timeout) answers false, so the caller falls back to
|
|
153
|
+
* writing the entry. The trailing slash makes git treat the path as a directory, so dir-only
|
|
154
|
+
* patterns like `graft/` match. A negation rule (an allowlist `.gitignore` that re-includes
|
|
155
|
+
* directories) can judge a not-yet-created path differently from an existing one, so callers
|
|
156
|
+
* create the dir first. `core.fsmonitor` is off because it would run a command named by the
|
|
157
|
+
* repo's own config. */
|
|
158
|
+
function gitAlreadyIgnores(root, rel) {
|
|
159
|
+
try {
|
|
160
|
+
const env = { ...process.env };
|
|
161
|
+
for (const k of GIT_REPO_ENV)
|
|
162
|
+
delete env[k];
|
|
163
|
+
const r = spawnSync("git", ["-c", "core.fsmonitor=false", "check-ignore", "-q", "--", `${rel}/`], {
|
|
164
|
+
cwd: root, env, stdio: "ignore", timeout: 5000, windowsHide: true,
|
|
165
|
+
});
|
|
166
|
+
return r.status === 0;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Keep the card tree greppable even though it's gitignored, by writing a root
|
|
174
|
+
* `.ignore` that re-admits it.
|
|
175
|
+
*
|
|
176
|
+
* The cards exist so that a `grep <symbol>` lands on a ~150-token card instead of
|
|
177
|
+
* a whole source file. Making the graph a local cache (and so gitignored) silently
|
|
178
|
+
* broke that: **ripgrep honours `.gitignore`**, and every ripgrep-backed search
|
|
179
|
+
* tool inherits the blind spot — verified by a card that names a symbol which
|
|
180
|
+
* default `rg` will not return and `rg -uu` finds instantly. `.ignore` is read at
|
|
181
|
+
* higher precedence than `.gitignore`, so re-admitting the tree there restores
|
|
182
|
+
* search without git ever tracking a byte of it.
|
|
183
|
+
*
|
|
184
|
+
* The two negative entries matter as much as the positive one: `.cache/` holds a
|
|
185
|
+
* multi-MB parse memo and `.graph/` holds `wiring.json`, and dropping either into
|
|
186
|
+
* every repo-wide search would be worse than the problem being fixed.
|
|
187
|
+
*
|
|
188
|
+
* Same contract as {@link ensureGitignored}: idempotent, skips a context dir
|
|
189
|
+
* outside `root`, and swallows write failures — a build that already succeeded
|
|
190
|
+
* must not fail over a convenience file.
|
|
191
|
+
*/
|
|
192
|
+
export function ensureSearchable(root, contextDir) {
|
|
193
|
+
if (envTruthy("GRAFT_NO_IGNORE"))
|
|
194
|
+
return;
|
|
195
|
+
// trail's map is reached by the path the hooks name, not by a grep from the root: no `.ignore`.
|
|
196
|
+
if (isTrailMapDir(root, contextDir))
|
|
197
|
+
return;
|
|
198
|
+
const rel = relPosix(root, contextDir);
|
|
199
|
+
if (rel === "" || rel.startsWith(".."))
|
|
200
|
+
return; // outside the repo — nothing to re-admit
|
|
201
|
+
const dir = stripTrailingSlashes(rel);
|
|
202
|
+
const entry = `!${dir}/`;
|
|
203
|
+
const path = join(root, ".ignore");
|
|
204
|
+
let current = "";
|
|
205
|
+
try {
|
|
206
|
+
current = readFileSync(path, "utf8");
|
|
207
|
+
}
|
|
208
|
+
catch { /* no .ignore yet — we create one */ }
|
|
209
|
+
// Any mention of the negation means a human (or a previous build) has already
|
|
210
|
+
// had an opinion here; leave it alone rather than append a second copy.
|
|
211
|
+
if (current.split("\n").some((l) => l.trim() === entry))
|
|
212
|
+
return;
|
|
213
|
+
const gap = current === "" ? "" : current.endsWith("\n") ? "\n" : "\n\n";
|
|
214
|
+
const block = `${gap}# graft's cards are gitignored but should stay greppable: ripgrep reads\n` +
|
|
215
|
+
`# .ignore before .gitignore, so this re-admits the tree to search only.\n` +
|
|
216
|
+
`${entry}\n${dir}/${CACHE_DIR}/\n${dir}/${GRAPH_DIR}/\n`;
|
|
217
|
+
try {
|
|
218
|
+
writeFileSync(path, current + block);
|
|
219
|
+
}
|
|
220
|
+
catch { /* best-effort */ }
|
|
221
|
+
}
|
|
222
|
+
/** Render the generated body (Summary + Related) for a node. */
|
|
223
|
+
function renderGenerated(node) {
|
|
224
|
+
const lines = [`## Summary`, ``, node.summary.trim() || "_(no summary)_", ``];
|
|
225
|
+
if (node.links.length > 0) {
|
|
226
|
+
lines.push(`## Related`, ``);
|
|
227
|
+
for (const link of [...node.links].sort((a, b) => a.to.localeCompare(b.to))) {
|
|
228
|
+
const rel = link.relation.replace(/_/g, " ");
|
|
229
|
+
const tail = link.description ? ` — ${link.description}` : "";
|
|
230
|
+
lines.push(`- ${rel} [[${link.to}]]${tail}`);
|
|
231
|
+
}
|
|
232
|
+
lines.push(``);
|
|
233
|
+
}
|
|
234
|
+
return lines.join("\n");
|
|
235
|
+
}
|
|
236
|
+
/** Default human region for a brand-new node (preserved verbatim afterwards). */
|
|
237
|
+
function defaultHuman() {
|
|
238
|
+
return `\n## Notes\n\n_Anything written below the generated block is preserved when the graph is regenerated._\n`;
|
|
239
|
+
}
|
|
240
|
+
/** Serialize a node to its full markdown file contents. */
|
|
241
|
+
export function renderNodeFile(node) {
|
|
242
|
+
const data = {
|
|
243
|
+
name: node.name,
|
|
244
|
+
slug: node.slug,
|
|
245
|
+
type: node.type,
|
|
246
|
+
sources: node.sources.map((s) => ({ path: s.path, hash: s.hash })),
|
|
247
|
+
sources_digest: node.sourcesDigest,
|
|
248
|
+
links: node.links.map((l) => l.description ? { to: l.to, relation: l.relation, description: l.description } : { to: l.to, relation: l.relation }),
|
|
249
|
+
generator: { version: MANIFEST_VERSION },
|
|
250
|
+
};
|
|
251
|
+
const body = `${GEN_START}\n${renderGenerated(node)}${GEN_END}\n${node.human}`;
|
|
252
|
+
// gray-matter appends a trailing newline; keep output stable across runs.
|
|
253
|
+
return matter.stringify(body, data);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Extract the human region (everything after the generated-end marker) from an
|
|
257
|
+
* existing node file so it survives regeneration. If the markers are missing
|
|
258
|
+
* (a hand-deleted or foreign file), returns a fresh default region.
|
|
259
|
+
*/
|
|
260
|
+
function preserveHuman(existingContent) {
|
|
261
|
+
const idx = existingContent.indexOf(GEN_END);
|
|
262
|
+
if (idx === -1)
|
|
263
|
+
return defaultHuman();
|
|
264
|
+
return existingContent.slice(idx + GEN_END.length).replace(/^\n/, "");
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Write a node file, preserving any existing human region. Returns the file
|
|
268
|
+
* path written.
|
|
269
|
+
*/
|
|
270
|
+
export function writeNode(dir, node) {
|
|
271
|
+
mkdirSync(dir, { recursive: true });
|
|
272
|
+
const path = join(dir, `${node.slug}.md`);
|
|
273
|
+
if (existsSync(path)) {
|
|
274
|
+
const parsed = matter(readFileSync(path, "utf8"));
|
|
275
|
+
node = { ...node, human: preserveHuman(parsed.content) };
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
node = { ...node, human: node.human || defaultHuman() };
|
|
279
|
+
}
|
|
280
|
+
writeFileSync(path, renderNodeFile(node));
|
|
281
|
+
return path;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Stems of per-file wiring cards that sit at the graft/ top level — i.e. cards
|
|
285
|
+
* for source files in the repo root. Those cards share a directory with concept
|
|
286
|
+
* nodes (`graft/<stem>.md`) but are recorded in `manifest.files`, not
|
|
287
|
+
* `manifest.nodes`. Nested file cards live in subdirs and are never scanned here.
|
|
288
|
+
*
|
|
289
|
+
* Incomplete on its own (#261): the graph can write a root card for a source
|
|
290
|
+
* that the concept pipeline never recorded (different extension lists), so the
|
|
291
|
+
* stem is absent from `manifest.files`. Combined with isRootFileCard().
|
|
292
|
+
*/
|
|
293
|
+
function rootFileCardStems(dir) {
|
|
294
|
+
const manifest = readManifest(dir);
|
|
295
|
+
if (!manifest)
|
|
296
|
+
return new Set();
|
|
297
|
+
const stems = new Set();
|
|
298
|
+
for (const f of manifest.files) {
|
|
299
|
+
if (f.path.includes("/"))
|
|
300
|
+
continue;
|
|
301
|
+
stems.add(f.path.replace(/\.[^./]+$/, ""));
|
|
302
|
+
}
|
|
303
|
+
return stems;
|
|
304
|
+
}
|
|
305
|
+
function hasConceptSlug(fm) {
|
|
306
|
+
return fm.slug != null && String(fm.slug).length > 0;
|
|
307
|
+
}
|
|
308
|
+
/** `writeCovers` used to stamp `covers: []` onto slug-less root file cards. */
|
|
309
|
+
function isCoversOnlyFileCard(fm) {
|
|
310
|
+
if (hasConceptSlug(fm) || !("covers" in fm))
|
|
311
|
+
return false;
|
|
312
|
+
return fm.name == null && fm.type == null && fm.sources == null;
|
|
313
|
+
}
|
|
314
|
+
/** Wiring cards start with `# <source path with extension>`, optionally followed
|
|
315
|
+
* by ` · [[slug]]` up-links. A hand-dropped `notes.md` does not. */
|
|
316
|
+
function isWiringCardHeading(content) {
|
|
317
|
+
const line = content.trimStart().split(/\r?\n/, 1)[0] ?? "";
|
|
318
|
+
return /^# [^\s#]+\.[A-Za-z0-9]{1,12}(?:\s|$)/.test(line);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* A top-level `.md` that is a per-file wiring card, not a concept node.
|
|
322
|
+
* Real concepts always carry `slug` in frontmatter and are never skipped.
|
|
323
|
+
* A hand-dropped `notes.md` has no slug, no `covers`, and no file-path heading,
|
|
324
|
+
* so it still surfaces as indexDrift (#215 / #261).
|
|
325
|
+
*/
|
|
326
|
+
function isRootFileCard(stem, fm, content, fileCardStems) {
|
|
327
|
+
if (hasConceptSlug(fm))
|
|
328
|
+
return false;
|
|
329
|
+
if (fileCardStems.has(stem))
|
|
330
|
+
return true;
|
|
331
|
+
if (isCoversOnlyFileCard(fm))
|
|
332
|
+
return true;
|
|
333
|
+
return isWiringCardHeading(content);
|
|
334
|
+
}
|
|
335
|
+
/** Read and parse every concept-node `.md` in a context dir (skips INDEX.md
|
|
336
|
+
* and root-level per-file cards). */
|
|
337
|
+
export function readNodes(dir) {
|
|
338
|
+
if (!existsSync(dir))
|
|
339
|
+
return [];
|
|
340
|
+
const fileCardStems = rootFileCardStems(dir);
|
|
341
|
+
const out = [];
|
|
342
|
+
for (const entry of readdirSync(dir)) {
|
|
343
|
+
if (!entry.endsWith(".md") || entry === "INDEX.md")
|
|
344
|
+
continue;
|
|
345
|
+
const parsed = matter(readFileSync(join(dir, entry), "utf8"));
|
|
346
|
+
const fm = parsed.data;
|
|
347
|
+
const fallbackSlug = entry.replace(/\.md$/, "");
|
|
348
|
+
if (isRootFileCard(fallbackSlug, fm, parsed.content, fileCardStems))
|
|
349
|
+
continue;
|
|
350
|
+
out.push({
|
|
351
|
+
slug: String(fm.slug ?? fallbackSlug),
|
|
352
|
+
name: String(fm.name ?? ""),
|
|
353
|
+
type: String(fm.type ?? ""),
|
|
354
|
+
sources: Array.isArray(fm.sources) ? fm.sources : [],
|
|
355
|
+
sourcesDigest: String(fm.sources_digest ?? ""),
|
|
356
|
+
links: Array.isArray(fm.links) ? fm.links : [],
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
return out;
|
|
360
|
+
}
|
|
361
|
+
/** List the node files present (slug → filename), for pruning deleted nodes. */
|
|
362
|
+
export function existingNodeSlugs(dir) {
|
|
363
|
+
if (!existsSync(dir))
|
|
364
|
+
return new Set();
|
|
365
|
+
return new Set(readdirSync(dir)
|
|
366
|
+
.filter((e) => e.endsWith(".md") && e !== "INDEX.md")
|
|
367
|
+
.map((e) => e.replace(/\.md$/, "")));
|
|
368
|
+
}
|
|
369
|
+
/** Delete a node file by slug. */
|
|
370
|
+
export function deleteNode(dir, slug) {
|
|
371
|
+
const path = join(dir, `${slug}.md`);
|
|
372
|
+
if (existsSync(path))
|
|
373
|
+
rmSync(path);
|
|
374
|
+
}
|
|
375
|
+
export function writeManifest(dir, manifest) {
|
|
376
|
+
mkdirSync(dir, { recursive: true });
|
|
377
|
+
writeFileSync(join(dir, MANIFEST_FILE), JSON.stringify(manifest, null, 2) + "\n");
|
|
378
|
+
}
|
|
379
|
+
export function readManifest(dir) {
|
|
380
|
+
const path = join(dir, MANIFEST_FILE);
|
|
381
|
+
if (!existsSync(path))
|
|
382
|
+
return undefined;
|
|
383
|
+
try {
|
|
384
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
//# sourceMappingURL=node-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-file.js","sourceRoot":"","sources":["../../src/context/node-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAClE,uFAAuF;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAExD,4EAA4E;AAC5E,SAAS,gBAAgB,CAAC,IAAY,EAAE,KAAa;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAA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