@ruverd/julius 0.0.0-stage → 0.24.0
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/CHANGELOG.md +31 -0
- package/CREDITS.md +25 -0
- package/LICENSE +21 -0
- package/PROVENANCE.md +9 -0
- package/README.md +225 -2
- package/dist/ai/crux.d.ts +60 -0
- package/dist/ai/crux.d.ts.map +1 -0
- package/dist/ai/crux.js +141 -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 +44 -0
- package/dist/ai/llm/openai.d.ts.map +1 -0
- package/dist/ai/llm/openai.js +239 -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 +19 -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 +131 -0
- package/dist/ai/synthesize.js.map +1 -0
- package/dist/app/checkout.d.ts +46 -0
- package/dist/app/checkout.d.ts.map +1 -0
- package/dist/app/checkout.js +223 -0
- package/dist/app/checkout.js.map +1 -0
- package/dist/app/events.d.ts +44 -0
- package/dist/app/events.d.ts.map +1 -0
- package/dist/app/events.js +64 -0
- package/dist/app/events.js.map +1 -0
- package/dist/app/identity.d.ts +54 -0
- package/dist/app/identity.d.ts.map +1 -0
- package/dist/app/identity.js +96 -0
- package/dist/app/identity.js.map +1 -0
- package/dist/app/main.d.ts +2 -0
- package/dist/app/main.d.ts.map +1 -0
- package/dist/app/main.js +62 -0
- package/dist/app/main.js.map +1 -0
- package/dist/app/pages.d.ts +56 -0
- package/dist/app/pages.d.ts.map +1 -0
- package/dist/app/pages.js +193 -0
- package/dist/app/pages.js.map +1 -0
- package/dist/app/queue.d.ts +40 -0
- package/dist/app/queue.d.ts.map +1 -0
- package/dist/app/queue.js +68 -0
- package/dist/app/queue.js.map +1 -0
- package/dist/app/review-process.d.ts +66 -0
- package/dist/app/review-process.d.ts.map +1 -0
- package/dist/app/review-process.js +200 -0
- package/dist/app/review-process.js.map +1 -0
- package/dist/app/review-worker.d.ts +2 -0
- package/dist/app/review-worker.d.ts.map +1 -0
- package/dist/app/review-worker.js +108 -0
- package/dist/app/review-worker.js.map +1 -0
- package/dist/app/review.d.ts +23 -0
- package/dist/app/review.d.ts.map +1 -0
- package/dist/app/review.js +142 -0
- package/dist/app/review.js.map +1 -0
- package/dist/app/server.d.ts +49 -0
- package/dist/app/server.d.ts.map +1 -0
- package/dist/app/server.js +123 -0
- package/dist/app/server.js.map +1 -0
- package/dist/ask/ask.d.ts +195 -0
- package/dist/ask/ask.d.ts.map +1 -0
- package/dist/ask/ask.js +1252 -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/bin/julius.d.ts +3 -0
- package/dist/bin/julius.d.ts.map +1 -0
- package/dist/bin/julius.js +4 -0
- package/dist/bin/julius.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 +13 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +43 -0
- package/dist/brand.js.map +1 -0
- package/dist/check/learning-edits.d.ts +9 -0
- package/dist/check/learning-edits.d.ts.map +1 -0
- package/dist/check/learning-edits.js +62 -0
- package/dist/check/learning-edits.js.map +1 -0
- package/dist/check/local-check.d.ts +104 -0
- package/dist/check/local-check.d.ts.map +1 -0
- package/dist/check/local-check.js +830 -0
- package/dist/check/local-check.js.map +1 -0
- package/dist/check/types.d.ts +31 -0
- package/dist/check/types.d.ts.map +1 -0
- package/dist/check/types.js +2 -0
- package/dist/check/types.js.map +1 -0
- package/dist/claude/build-progress.d.ts +29 -0
- package/dist/claude/build-progress.d.ts.map +1 -0
- package/dist/claude/build-progress.js +76 -0
- package/dist/claude/build-progress.js.map +1 -0
- package/dist/claude/format.d.ts +131 -0
- package/dist/claude/format.d.ts.map +1 -0
- package/dist/claude/format.js +328 -0
- package/dist/claude/format.js.map +1 -0
- package/dist/claude/hook-layers.d.ts +8 -0
- package/dist/claude/hook-layers.d.ts.map +1 -0
- package/dist/claude/hook-layers.js +74 -0
- package/dist/claude/hook-layers.js.map +1 -0
- package/dist/claude/hooks.d.ts +101 -0
- package/dist/claude/hooks.d.ts.map +1 -0
- package/dist/claude/hooks.js +849 -0
- package/dist/claude/hooks.js.map +1 -0
- package/dist/claude/init.d.ts +70 -0
- package/dist/claude/init.d.ts.map +1 -0
- package/dist/claude/init.js +207 -0
- package/dist/claude/init.js.map +1 -0
- package/dist/claude/note-signals.d.ts +28 -0
- package/dist/claude/note-signals.d.ts.map +1 -0
- package/dist/claude/note-signals.js +325 -0
- package/dist/claude/note-signals.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 +66 -0
- package/dist/claude/settings-merge.d.ts.map +1 -0
- package/dist/claude/settings-merge.js +249 -0
- package/dist/claude/settings-merge.js.map +1 -0
- package/dist/claude/shim-template.d.ts +18 -0
- package/dist/claude/shim-template.d.ts.map +1 -0
- package/dist/claude/shim-template.js +226 -0
- package/dist/claude/shim-template.js.map +1 -0
- package/dist/claude/skill-template.d.ts +12 -0
- package/dist/claude/skill-template.d.ts.map +1 -0
- package/dist/claude/skill-template.js +294 -0
- package/dist/claude/skill-template.js.map +1 -0
- package/dist/claude/state.d.ts +73 -0
- package/dist/claude/state.d.ts.map +1 -0
- package/dist/claude/state.js +33 -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/claude/statusline.d.ts +14 -0
- package/dist/claude/statusline.d.ts.map +1 -0
- package/dist/claude/statusline.js +45 -0
- package/dist/claude/statusline.js.map +1 -0
- package/dist/claude/sync-run.d.ts +3 -0
- package/dist/claude/sync-run.d.ts.map +1 -0
- package/dist/claude/sync-run.js +46 -0
- package/dist/claude/sync-run.js.map +1 -0
- package/dist/claude/tally.d.ts +50 -0
- package/dist/claude/tally.d.ts.map +1 -0
- package/dist/claude/tally.js +211 -0
- package/dist/claude/tally.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 +55 -0
- package/dist/cli-epilogue.js.map +1 -0
- package/dist/cli-meta.d.ts +45 -0
- package/dist/cli-meta.d.ts.map +1 -0
- package/dist/cli-meta.js +145 -0
- package/dist/cli-meta.js.map +1 -0
- package/dist/cli-picker.d.ts +129 -0
- package/dist/cli-picker.d.ts.map +1 -0
- package/dist/cli-picker.js +432 -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 +2213 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/diff.d.ts +20 -0
- package/dist/cloud/diff.d.ts.map +1 -0
- package/dist/cloud/diff.js +59 -0
- package/dist/cloud/diff.js.map +1 -0
- package/dist/cloud/nudge.d.ts +66 -0
- package/dist/cloud/nudge.d.ts.map +1 -0
- package/dist/cloud/nudge.js +268 -0
- package/dist/cloud/nudge.js.map +1 -0
- package/dist/cloud/workspace-sync.d.ts +58 -0
- package/dist/cloud/workspace-sync.d.ts.map +1 -0
- package/dist/cloud/workspace-sync.js +268 -0
- package/dist/cloud/workspace-sync.js.map +1 -0
- package/dist/cloud/workspace.d.ts +159 -0
- package/dist/cloud/workspace.d.ts.map +1 -0
- package/dist/cloud/workspace.js +134 -0
- package/dist/cloud/workspace.js.map +1 -0
- package/dist/context/build.d.ts +52 -0
- package/dist/context/build.d.ts.map +1 -0
- package/dist/context/build.js +362 -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 +4 -0
- package/dist/context/map-dir.d.ts.map +1 -0
- package/dist/context/map-dir.js +6 -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 +362 -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 +26 -0
- package/dist/context/savings.d.ts.map +1 -0
- package/dist/context/savings.js +59 -0
- package/dist/context/savings.js.map +1 -0
- package/dist/economy/cli.d.ts +3 -0
- package/dist/economy/cli.d.ts.map +1 -0
- package/dist/economy/cli.js +52 -0
- package/dist/economy/cli.js.map +1 -0
- package/dist/economy/delivery.d.ts +49 -0
- package/dist/economy/delivery.d.ts.map +1 -0
- package/dist/economy/delivery.js +176 -0
- package/dist/economy/delivery.js.map +1 -0
- package/dist/economy/index.d.ts +67 -0
- package/dist/economy/index.d.ts.map +1 -0
- package/dist/economy/index.js +519 -0
- package/dist/economy/index.js.map +1 -0
- package/dist/engine.d.ts +83 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +122 -0
- package/dist/engine.js.map +1 -0
- package/dist/evaluation/index.d.ts +41 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/index.js +61 -0
- package/dist/evaluation/index.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.d.ts +88 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +375 -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 +190 -0
- package/dist/graph/container.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 +253 -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 +2376 -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 +580 -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 +43 -0
- package/dist/graph/lsp/client.d.ts.map +1 -0
- package/dist/graph/lsp/client.js +179 -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 +155 -0
- package/dist/graph/lsp/enrich.js.map +1 -0
- package/dist/graph/lsp/registry.d.ts +15 -0
- package/dist/graph/lsp/registry.d.ts.map +1 -0
- package/dist/graph/lsp/registry.js +46 -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/native.d.ts +38 -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/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 +49 -0
- package/dist/graph/refresh.d.ts.map +1 -0
- package/dist/graph/refresh.js +255 -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 +654 -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 +42 -0
- package/dist/graph/scopes.d.ts.map +1 -0
- package/dist/graph/scopes.js +342 -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 +226 -0
- package/dist/graph/seed.js.map +1 -0
- package/dist/graph/source-files.d.ts +40 -0
- package/dist/graph/source-files.d.ts.map +1 -0
- package/dist/graph/source-files.js +85 -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/workspace-cli.d.ts +48 -0
- package/dist/graph/workspace-cli.d.ts.map +1 -0
- package/dist/graph/workspace-cli.js +102 -0
- package/dist/graph/workspace-cli.js.map +1 -0
- package/dist/graph/workspace.d.ts +135 -0
- package/dist/graph/workspace.d.ts.map +1 -0
- package/dist/graph/workspace.js +598 -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 +8 -0
- package/dist/hosts/antigravity.d.ts.map +1 -0
- package/dist/hosts/antigravity.js +42 -0
- package/dist/hosts/antigravity.js.map +1 -0
- package/dist/hosts/claude-global.d.ts +36 -0
- package/dist/hosts/claude-global.d.ts.map +1 -0
- package/dist/hosts/claude-global.js +153 -0
- package/dist/hosts/claude-global.js.map +1 -0
- package/dist/hosts/codex-hooks.d.ts +11 -0
- package/dist/hosts/codex-hooks.d.ts.map +1 -0
- package/dist/hosts/codex-hooks.js +80 -0
- package/dist/hosts/codex-hooks.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/cursor-hooks.d.ts +21 -0
- package/dist/hosts/cursor-hooks.d.ts.map +1 -0
- package/dist/hosts/cursor-hooks.js +103 -0
- package/dist/hosts/cursor-hooks.js.map +1 -0
- package/dist/hosts/init.d.ts +26 -0
- package/dist/hosts/init.d.ts.map +1 -0
- package/dist/hosts/init.js +82 -0
- package/dist/hosts/init.js.map +1 -0
- package/dist/hosts/install.d.ts +12 -0
- package/dist/hosts/install.d.ts.map +1 -0
- package/dist/hosts/install.js +347 -0
- package/dist/hosts/install.js.map +1 -0
- package/dist/hosts/instructions.d.ts +7 -0
- package/dist/hosts/instructions.d.ts.map +1 -0
- package/dist/hosts/instructions.js +71 -0
- package/dist/hosts/instructions.js.map +1 -0
- package/dist/hosts/investigation-instructions.d.ts +2 -0
- package/dist/hosts/investigation-instructions.d.ts.map +1 -0
- package/dist/hosts/investigation-instructions.js +2 -0
- package/dist/hosts/investigation-instructions.js.map +1 -0
- package/dist/hosts/mcp-config.d.ts +59 -0
- package/dist/hosts/mcp-config.d.ts.map +1 -0
- package/dist/hosts/mcp-config.js +229 -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 +77 -0
- package/dist/hosts/plan.js.map +1 -0
- package/dist/hosts/registry.d.ts +35 -0
- package/dist/hosts/registry.d.ts.map +1 -0
- package/dist/hosts/registry.js +157 -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 +541 -0
- package/dist/hosts/retract.js.map +1 -0
- package/dist/hosts/sections.d.ts +46 -0
- package/dist/hosts/sections.d.ts.map +1 -0
- package/dist/hosts/sections.js +126 -0
- package/dist/hosts/sections.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -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 +307 -0
- package/dist/ingest/fs.js.map +1 -0
- package/dist/init-guard.d.ts +11 -0
- package/dist/init-guard.d.ts.map +1 -0
- package/dist/init-guard.js +21 -0
- package/dist/init-guard.js.map +1 -0
- package/dist/investigation/index.d.ts +57 -0
- package/dist/investigation/index.d.ts.map +1 -0
- package/dist/investigation/index.js +315 -0
- package/dist/investigation/index.js.map +1 -0
- package/dist/mcp/compact.d.ts +9 -0
- package/dist/mcp/compact.d.ts.map +1 -0
- package/dist/mcp/compact.js +133 -0
- package/dist/mcp/compact.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 +57 -0
- package/dist/mcp/instructions.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +128 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-names.d.ts +20 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +36 -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 +300 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/notes/ask-notes.d.ts +8 -0
- package/dist/notes/ask-notes.d.ts.map +1 -0
- package/dist/notes/ask-notes.js +19 -0
- package/dist/notes/ask-notes.js.map +1 -0
- package/dist/notes/branches.d.ts +102 -0
- package/dist/notes/branches.d.ts.map +1 -0
- package/dist/notes/branches.js +304 -0
- package/dist/notes/branches.js.map +1 -0
- package/dist/notes/cold-start.d.ts +177 -0
- package/dist/notes/cold-start.d.ts.map +1 -0
- package/dist/notes/cold-start.js +537 -0
- package/dist/notes/cold-start.js.map +1 -0
- package/dist/notes/edit-overlap.d.ts +62 -0
- package/dist/notes/edit-overlap.d.ts.map +1 -0
- package/dist/notes/edit-overlap.js +202 -0
- package/dist/notes/edit-overlap.js.map +1 -0
- package/dist/notes/git-facts.d.ts +21 -0
- package/dist/notes/git-facts.d.ts.map +1 -0
- package/dist/notes/git-facts.js +121 -0
- package/dist/notes/git-facts.js.map +1 -0
- package/dist/notes/home.d.ts +87 -0
- package/dist/notes/home.d.ts.map +1 -0
- package/dist/notes/home.js +430 -0
- package/dist/notes/home.js.map +1 -0
- package/dist/notes/learning-fields.d.ts +102 -0
- package/dist/notes/learning-fields.d.ts.map +1 -0
- package/dist/notes/learning-fields.js +217 -0
- package/dist/notes/learning-fields.js.map +1 -0
- package/dist/notes/note-gate.d.ts +42 -0
- package/dist/notes/note-gate.d.ts.map +1 -0
- package/dist/notes/note-gate.js +181 -0
- package/dist/notes/note-gate.js.map +1 -0
- package/dist/notes/notes.d.ts +214 -0
- package/dist/notes/notes.d.ts.map +1 -0
- package/dist/notes/notes.js +591 -0
- package/dist/notes/notes.js.map +1 -0
- package/dist/notes/pr-reviews.d.ts +108 -0
- package/dist/notes/pr-reviews.d.ts.map +1 -0
- package/dist/notes/pr-reviews.js +325 -0
- package/dist/notes/pr-reviews.js.map +1 -0
- package/dist/notes/repo-julius.d.ts +18 -0
- package/dist/notes/repo-julius.d.ts.map +1 -0
- package/dist/notes/repo-julius.js +111 -0
- package/dist/notes/repo-julius.js.map +1 -0
- package/dist/notes/session-cost.d.ts +35 -0
- package/dist/notes/session-cost.d.ts.map +1 -0
- package/dist/notes/session-cost.js +276 -0
- package/dist/notes/session-cost.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 +176 -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/skills/skills.d.ts +118 -0
- package/dist/skills/skills.d.ts.map +1 -0
- package/dist/skills/skills.js +370 -0
- package/dist/skills/skills.js.map +1 -0
- package/dist/telemetry/contract.d.ts +103 -0
- package/dist/telemetry/contract.d.ts.map +1 -0
- package/dist/telemetry/contract.js +270 -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 +4 -0
- package/dist/telemetry/key.d.ts.map +1 -0
- package/dist/telemetry/key.js +4 -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 +142 -0
- package/dist/telemetry/track.js.map +1 -0
- package/dist/upkeep-run.d.ts +15 -0
- package/dist/upkeep-run.d.ts.map +1 -0
- package/dist/upkeep-run.js +71 -0
- package/dist/upkeep-run.js.map +1 -0
- package/dist/upkeep.d.ts +125 -0
- package/dist/upkeep.d.ts.map +1 -0
- package/dist/upkeep.js +255 -0
- package/dist/upkeep.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/front-matter.d.ts +19 -0
- package/dist/util/front-matter.d.ts.map +1 -0
- package/dist/util/front-matter.js +21 -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/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 +100 -0
- package/dist/util/state.d.ts.map +1 -0
- package/dist/util/state.js +186 -0
- package/dist/util/state.js.map +1 -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 +12 -0
- package/dist/viz/serve.d.ts.map +1 -0
- package/dist/viz/serve.js +129 -0
- package/dist/viz/serve.js.map +1 -0
- package/docs/assets/context-benchmark.svg +31 -0
- package/docs/assets/julius-hero.png +0 -0
- package/docs/upstream-changelog.md +785 -0
- package/package.json +138 -4
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `seedGraph` — give a linked git worktree the graph its parent checkout already has.
|
|
3
|
+
*
|
|
4
|
+
* `julius/` is a local cache, so it is gitignored, so `git worktree add` never checks
|
|
5
|
+
* it out: a worktree starts with `src/` and `.claude/` and no graph at all. Every
|
|
6
|
+
* MCP tool then answers "no graph found — run julius build first" for the whole
|
|
7
|
+
* session, and the passive surface (`INDEX.md`, the cards) is missing too. The agent
|
|
8
|
+
* that was supposed to be cheapest in a fresh worktree is instead blind in one.
|
|
9
|
+
*
|
|
10
|
+
* What travels is the graph and the sidecars a query reads — never the markdown; see
|
|
11
|
+
* `seedable` for why the cards are the parent's branch and not this one's.
|
|
12
|
+
*
|
|
13
|
+
* The parent checkout has not gone anywhere, though — a worktree's `.git` is a *file*
|
|
14
|
+
* naming it, and the harness that creates these worktrees already reaches back the
|
|
15
|
+
* same way (Claude Code symlinks `node_modules` to the parent's). So: copy the
|
|
16
|
+
* parent's `julius/` in, then let the ordinary refresh gate repair the difference.
|
|
17
|
+
*
|
|
18
|
+
* Copy, not symlink. `node_modules` is the same for every branch; a graph is a set of
|
|
19
|
+
* `file:line` spans for one specific tree, so a shared one would have the worktree
|
|
20
|
+
* rewriting the parent's graph with its own branch's line numbers. What makes the
|
|
21
|
+
* copy worth doing rather than just rebuilding cold:
|
|
22
|
+
*
|
|
23
|
+
* - **The Tier-2 meaning layer survives.** Summaries and cruxes cost real money;
|
|
24
|
+
* `buildGraph` folds a prior `wiring.json` in by `body_hash`, so an unchanged
|
|
25
|
+
* function keeps the summary someone already paid for. A cold build throws them all
|
|
26
|
+
* away and the worktree silently drops to structural-only answers.
|
|
27
|
+
* - **The repair is small.** `probeDrift` confirms a suspect file by content hash, so
|
|
28
|
+
* a fresh checkout's brand-new mtimes cost one hashing pass and nothing more; the
|
|
29
|
+
* drift that survives is exactly the diff between the two checkouts' commits.
|
|
30
|
+
* - **$0 and offline**, like everything else on the query path.
|
|
31
|
+
*
|
|
32
|
+
* Never writes to the parent, never throws, and no-ops unless there is genuinely a
|
|
33
|
+
* built parent checkout on disk — so a fresh clone, CI, or a cloud session whose repo
|
|
34
|
+
* was *cloned* rather than worktree'd behaves exactly as it did before: "run julius
|
|
35
|
+
* build first".
|
|
36
|
+
*/
|
|
37
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, } from "node:fs";
|
|
38
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
39
|
+
import { ASK_INDEX_FILE } from "../ask/index-file.js";
|
|
40
|
+
import { CACHE_DIR, contextDirFor } from "../context/node-file.js";
|
|
41
|
+
import { EXTRACT_CACHE_PREFIX } from "./extract-cache.js";
|
|
42
|
+
import { FINGERPRINT_PREFIX } from "./fingerprint.js";
|
|
43
|
+
import { GRAPH_DIR, wiringPath } from "./write.js";
|
|
44
|
+
/** The one line a linked worktree's `.git` file carries. */
|
|
45
|
+
const GITDIR_KEY = "gitdir:";
|
|
46
|
+
/** Env kill switch, mirroring `JULIUS_NO_REFRESH` in ./refresh.ts. */
|
|
47
|
+
export function seedDisabled() {
|
|
48
|
+
const v = process.env.JULIUS_NO_SEED;
|
|
49
|
+
return v !== undefined && v !== "" && v !== "0" && v !== "false";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The main checkout of the repo `root` is a linked worktree of, or null when `root`
|
|
53
|
+
* isn't one (which is the common case, and not an error).
|
|
54
|
+
*
|
|
55
|
+
* Filesystem-only on purpose: no `git` subprocess on a path that runs before every
|
|
56
|
+
* query. The shapes it has to tell apart:
|
|
57
|
+
*
|
|
58
|
+
* - `<root>/.git` is a **directory** → this *is* the main checkout. Nothing to seed.
|
|
59
|
+
* - `gitdir: <main>/.git/worktrees/<name>` → a linked worktree. `commondir` inside
|
|
60
|
+
* that dir points back at the shared `.git` (`../..`), whose parent is the main
|
|
61
|
+
* checkout.
|
|
62
|
+
* - `gitdir: <super>/.git/modules/<name>` → a **submodule**. Identical file shape,
|
|
63
|
+
* completely different thing: a submodule is its own repo and its parent's `julius/`
|
|
64
|
+
* describes different code entirely. The `worktrees` path segment is what rejects it.
|
|
65
|
+
* - A bare repo or `--separate-git-dir` layout, where the resolved common dir isn't
|
|
66
|
+
* named `.git` and there may be no working tree at all → null.
|
|
67
|
+
*/
|
|
68
|
+
export function mainWorktreeRoot(root) {
|
|
69
|
+
try {
|
|
70
|
+
const dot = join(root, ".git");
|
|
71
|
+
if (statSync(dot).isDirectory())
|
|
72
|
+
return null;
|
|
73
|
+
// Read the pointer without a regex. `/^gitdir:[ \t]*(.+?)[ \t]*$/m` is the
|
|
74
|
+
// polynomial-ReDoS shape CodeQL flagged on `ensureSearchable` (`js/polynomial-redos`,
|
|
75
|
+
// fixed in 44a191e): `.` also matches space and tab, so the lazy group and the
|
|
76
|
+
// trailing `[ \t]*` overlap and a line of blanks costs O(n²). Same conclusion as
|
|
77
|
+
// that fix — the ambiguity buys nothing, and split/startsWith/trim is linear and
|
|
78
|
+
// plainer. `trim` also absorbs the `\r` of a CRLF checkout.
|
|
79
|
+
const line = readFileSync(dot, "utf8").split("\n").find((l) => l.startsWith(GITDIR_KEY));
|
|
80
|
+
if (line === undefined)
|
|
81
|
+
return null;
|
|
82
|
+
const target = line.slice(GITDIR_KEY.length).trim();
|
|
83
|
+
if (!target)
|
|
84
|
+
return null;
|
|
85
|
+
const gitdir = isAbsolute(target) ? target : resolve(root, target);
|
|
86
|
+
if (basename(dirname(gitdir)) !== "worktrees")
|
|
87
|
+
return null;
|
|
88
|
+
const rel = readFileSync(join(gitdir, "commondir"), "utf8").trim();
|
|
89
|
+
if (!rel)
|
|
90
|
+
return null;
|
|
91
|
+
const common = isAbsolute(rel) ? rel : resolve(gitdir, rel);
|
|
92
|
+
if (basename(common) !== ".git" || !statSync(common).isDirectory())
|
|
93
|
+
return null;
|
|
94
|
+
const main = dirname(common);
|
|
95
|
+
if (resolve(main) === resolve(root))
|
|
96
|
+
return null;
|
|
97
|
+
return main;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// No `.git` at all, an unreadable one, a `commondir` that doesn't exist: all of
|
|
101
|
+
// them mean "can't seed from here", which is the same answer as "not a worktree".
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const NOT_SEEDED = { seeded: false };
|
|
106
|
+
/**
|
|
107
|
+
* An allowlist, not a skip list: is this repo-relative path (posix) one of the few
|
|
108
|
+
* files a seed may bring across?
|
|
109
|
+
*
|
|
110
|
+
* The gate that calls this promises "writes only what a query reads — the graph, the
|
|
111
|
+
* `ask` sidecar, the freshness record" (see the header of ./refresh.ts). A copy that
|
|
112
|
+
* wrote anything else would turn a read into a write of the repo, so the copy honours
|
|
113
|
+
* the same list. The extraction memo is on it because the refresh immediately after
|
|
114
|
+
* rewrites that file anyway, and replaying it is what keeps the repair cheap.
|
|
115
|
+
*
|
|
116
|
+
* **Deliberately absent: the cards and `INDEX.md`.** They would land as this
|
|
117
|
+
* checkout's documentation while describing the *parent's* branch, and nothing on the
|
|
118
|
+
* query path rewrites them (`writeCards`/`writeIndex` sit behind `!graphOnly`), so they
|
|
119
|
+
* would stay wrong indefinitely. An explicit `julius build` regenerates them from this
|
|
120
|
+
* checkout's own graph — and prunes the ones that no longer apply — which is both
|
|
121
|
+
* correct and nearly free once the graph is here.
|
|
122
|
+
*
|
|
123
|
+
* Also absent, because it belongs to the checkout that produced it: `.cache/session/`
|
|
124
|
+
* (another session's transcripts), `.sync.lock` (another process's lock), and
|
|
125
|
+
* `stats.json` (this checkout earns its own savings and dirty flag).
|
|
126
|
+
*/
|
|
127
|
+
function seedable(rel) {
|
|
128
|
+
// The dirs themselves, or cpSync would never look inside them.
|
|
129
|
+
if (rel === "" || rel === GRAPH_DIR || rel === CACHE_DIR)
|
|
130
|
+
return true;
|
|
131
|
+
if (!rel.startsWith(`${CACHE_DIR}/`))
|
|
132
|
+
return false; // incl. the graph: `installGraph` places it
|
|
133
|
+
const name = rel.slice(CACHE_DIR.length + 1);
|
|
134
|
+
return (name === ASK_INDEX_FILE ||
|
|
135
|
+
name.startsWith(`${EXTRACT_CACHE_PREFIX}.`) ||
|
|
136
|
+
name.startsWith(`${FINGERPRINT_PREFIX}.`));
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Copy `srcDir` into `outDir`, keeping only what {@link seedable} allows.
|
|
140
|
+
*
|
|
141
|
+
* Walked by hand rather than through `cpSync`'s `filter`, which did not hold on
|
|
142
|
+
* Windows: the graph arrived — it is placed directly, by {@link installGraph} — while
|
|
143
|
+
* every allowlisted sidecar next to it was dropped. A seeded worktree therefore had no
|
|
144
|
+
* fingerprint, `probeDrift` read that as "never built", and the query right behind the
|
|
145
|
+
* seed rebuilt the whole repo instead of the diff against the parent: precisely the
|
|
146
|
+
* cost seeding exists to avoid, and silent, because a full rebuild still answers
|
|
147
|
+
* correctly. It only surfaced as a `(? files changed)` note on the CI leg.
|
|
148
|
+
*
|
|
149
|
+
* Composing `rel` from the segments this walk joined itself is what fixes it — the
|
|
150
|
+
* allowlist no longer depends on the form `cpSync` chooses to hand its callback, and
|
|
151
|
+
* `rel` is posix by construction rather than by conversion. Also narrower than the old
|
|
152
|
+
* copy in one way worth keeping: only real files and directories travel, never a
|
|
153
|
+
* symlink, and nothing in the allowlist is one.
|
|
154
|
+
*/
|
|
155
|
+
function copyTree(srcDir, outDir) {
|
|
156
|
+
const walk = (rel) => {
|
|
157
|
+
const from = rel ? join(srcDir, rel) : srcDir;
|
|
158
|
+
mkdirSync(rel ? join(outDir, rel) : outDir, { recursive: true });
|
|
159
|
+
for (const entry of readdirSync(from, { withFileTypes: true })) {
|
|
160
|
+
const childRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
161
|
+
if (!seedable(childRel))
|
|
162
|
+
continue;
|
|
163
|
+
if (entry.isDirectory())
|
|
164
|
+
walk(childRel);
|
|
165
|
+
else if (entry.isFile())
|
|
166
|
+
copyFileSync(join(from, entry.name), join(outDir, childRel));
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
walk("");
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Put `wiring.json` in place last, via a temp file and a rename.
|
|
173
|
+
*
|
|
174
|
+
* Its presence is the flag every caller reads to mean "this repo has a graph"
|
|
175
|
+
* (`refresh.ts`, `workspace.ts`, every MCP tool). So it must appear only once the
|
|
176
|
+
* rest of the copy has landed and must never appear half-written: a seed killed
|
|
177
|
+
* midway then leaves no graph, and the next call simply seeds again.
|
|
178
|
+
*/
|
|
179
|
+
function installGraph(srcGraph, destGraph) {
|
|
180
|
+
mkdirSync(dirname(destGraph), { recursive: true });
|
|
181
|
+
const tmp = `${destGraph}.seed.${process.pid}`;
|
|
182
|
+
try {
|
|
183
|
+
copyFileSync(srcGraph, tmp);
|
|
184
|
+
renameSync(tmp, destGraph);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
try {
|
|
188
|
+
rmSync(tmp, { force: true });
|
|
189
|
+
}
|
|
190
|
+
catch { /* nothing to clean up */ }
|
|
191
|
+
throw err;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Copy the parent checkout's graph into `root`'s own `julius/`, if all of this holds:
|
|
196
|
+
* `root` is a linked worktree, it has no graph yet, the parent has one, and no `--dir`
|
|
197
|
+
* override is in play (a custom output dir can't be mapped to a sibling checkout —
|
|
198
|
+
* the same conservatism `ensureGitignored` applies).
|
|
199
|
+
*
|
|
200
|
+
* Best-effort by contract: the caller's fallback is the behaviour that existed before
|
|
201
|
+
* this function did, so every failure returns `{ seeded: false }` rather than raising.
|
|
202
|
+
*/
|
|
203
|
+
export function seedGraph(root, opts = {}) {
|
|
204
|
+
if (opts.contextDir || seedDisabled())
|
|
205
|
+
return NOT_SEEDED;
|
|
206
|
+
try {
|
|
207
|
+
const dir = resolve(root);
|
|
208
|
+
const outDir = contextDirFor(dir);
|
|
209
|
+
if (existsSync(wiringPath(outDir)))
|
|
210
|
+
return NOT_SEEDED; // already has its own
|
|
211
|
+
const main = mainWorktreeRoot(dir);
|
|
212
|
+
if (!main)
|
|
213
|
+
return NOT_SEEDED;
|
|
214
|
+
const srcDir = contextDirFor(main);
|
|
215
|
+
const srcGraph = wiringPath(srcDir);
|
|
216
|
+
if (!existsSync(srcGraph))
|
|
217
|
+
return NOT_SEEDED; // parent never built either
|
|
218
|
+
copyTree(srcDir, outDir);
|
|
219
|
+
installGraph(srcGraph, wiringPath(outDir));
|
|
220
|
+
return { seeded: true, from: main };
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
return NOT_SEEDED;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=seed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed.js","sourceRoot":"","sources":["../../src/graph/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,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GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI;YAAE,OAAO,UAAU,CAAC;QAC7B,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,UAAU,CAAC,CAAC,4BAA4B;QAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzB,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Every extension julius has a parser for (depth + breadth + container), sorted
|
|
2
|
+
* and de-duped — the authoritative answer to "what does `-e` actually support". */
|
|
3
|
+
export declare function supportedExtensions(): string[];
|
|
4
|
+
/**
|
|
5
|
+
* The subset of user-supplied `-e` extensions that no parser claims (depth or breadth).
|
|
6
|
+
* `julius build -e ".vue"` used to accept these silently and index nothing; the CLI warns
|
|
7
|
+
* on whatever this returns so an unsupported extension is never a quiet no-op.
|
|
8
|
+
*/
|
|
9
|
+
export declare function unsupportedExtensions(exts: string[]): string[];
|
|
10
|
+
/**
|
|
11
|
+
* The source files a graph build parses: supported languages, minus the
|
|
12
|
+
* output dir. When no pre-enumerated `repoFiles` is passed, the walk reads
|
|
13
|
+
* `root`'s persisted file-walk choices directly from state, so every caller
|
|
14
|
+
* that enumerates through here (the fingerprint probe and hooks/refresh path,
|
|
15
|
+
* none of which ever see a CLI flag) behaves identically to the build that
|
|
16
|
+
* saved those choices.
|
|
17
|
+
*/
|
|
18
|
+
/** Keep only files whose repo-relative path is at or under one of `onlyDirs`.
|
|
19
|
+
* No-op when `onlyDirs` is empty/absent. The whitelist is carried in the graph
|
|
20
|
+
* itself (the fingerprint records it at build time), never in the source repo,
|
|
21
|
+
* so a build and the query-path freshness probe read the identical set. */
|
|
22
|
+
export declare function filterByOnlyDirs(files: string[], root: string, onlyDirs?: ReadonlySet<string>): string[];
|
|
23
|
+
export declare function listSourceFiles(root: string, outDir: string, repoFiles?: string[], onlyDirs?: ReadonlySet<string>): string[];
|
|
24
|
+
export interface SourceStat {
|
|
25
|
+
/** Absolute path. */
|
|
26
|
+
abs: string;
|
|
27
|
+
/** Repo-relative, posix (`relPosix`) — exactly the form `buildGraph` uses for
|
|
28
|
+
* node ids and `checkGraph` diffs against, so cache keys and ids can never
|
|
29
|
+
* disagree. Posix on every platform: see `../util/paths.ts`. */
|
|
30
|
+
rel: string;
|
|
31
|
+
size: number;
|
|
32
|
+
mtimeMs: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* {@link listSourceFiles} plus each file's `(size, mtimeMs)` — the currency of
|
|
36
|
+
* both the freshness probe and the extraction cache. Files that vanish between
|
|
37
|
+
* the walk and the stat are dropped (same fail-soft posture as `walkDir`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function listSourceStats(root: string, outDir: string, repoFiles?: string[], onlyDirs?: ReadonlySet<string>): SourceStat[];
|
|
40
|
+
//# sourceMappingURL=source-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-files.d.ts","sourceRoot":"","sources":["../../src/graph/source-files.ts"],"names":[],"mappings":"AAiBA;mFACmF;AACnF,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAQD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAG9D;AAED;;;;;;;GAOG;AACH;;;2EAG2E;AAC3E,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,MAAM,EAAE,CAMV;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAM,EAGf,EACF,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,MAAM,EAAE,CAaV;AAED,MAAM,WAAW,UAAU;IACzB,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ;;oEAEgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,MAAM,EAAE,EACpB,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC7B,UAAU,EAAE,CAYd"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file set a graph build parses, and its stat metadata.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `build.ts` so the freshness probe (`fingerprint.ts`) can enumerate
|
|
5
|
+
* exactly the same files without importing the builder (which would be an import
|
|
6
|
+
* cycle: build → fingerprint → build). `build.ts` re-exports
|
|
7
|
+
* {@link listSourceFiles} so its existing importers are unaffected.
|
|
8
|
+
*/
|
|
9
|
+
import { statSync } from "node:fs";
|
|
10
|
+
import { resolve } from "node:path";
|
|
11
|
+
import { walkDir } from "../ingest/fs.js";
|
|
12
|
+
import { relPosix } from "../util/paths.js";
|
|
13
|
+
import { readFollowNestedRepos, readFollowSubmodules, readIncludeDirs } from "../util/state.js";
|
|
14
|
+
import { languageOf, depthExtensions } from "./extract.js";
|
|
15
|
+
import { genericLangOf, genericExtensions } from "./generic.js";
|
|
16
|
+
import { containerLangOf, containerExtensions } from "./container.js";
|
|
17
|
+
/** Every extension julius has a parser for (depth + breadth + container), sorted
|
|
18
|
+
* and de-duped — the authoritative answer to "what does `-e` actually support". */
|
|
19
|
+
export function supportedExtensions() {
|
|
20
|
+
return [...new Set([...depthExtensions(), ...genericExtensions(), ...containerExtensions()])].sort();
|
|
21
|
+
}
|
|
22
|
+
/** Normalize a user-supplied extension: ensure a leading dot, lower-case. */
|
|
23
|
+
function normExt(e) {
|
|
24
|
+
const t = e.trim().toLowerCase();
|
|
25
|
+
return t.startsWith(".") ? t : `.${t}`;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The subset of user-supplied `-e` extensions that no parser claims (depth or breadth).
|
|
29
|
+
* `julius build -e ".vue"` used to accept these silently and index nothing; the CLI warns
|
|
30
|
+
* on whatever this returns so an unsupported extension is never a quiet no-op.
|
|
31
|
+
*/
|
|
32
|
+
export function unsupportedExtensions(exts) {
|
|
33
|
+
const supported = new Set(supportedExtensions());
|
|
34
|
+
return exts.filter((e) => !supported.has(normExt(e)));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The source files a graph build parses: supported languages, minus the
|
|
38
|
+
* output dir. When no pre-enumerated `repoFiles` is passed, the walk reads
|
|
39
|
+
* `root`'s persisted file-walk choices directly from state, so every caller
|
|
40
|
+
* that enumerates through here (the fingerprint probe and hooks/refresh path,
|
|
41
|
+
* none of which ever see a CLI flag) behaves identically to the build that
|
|
42
|
+
* saved those choices.
|
|
43
|
+
*/
|
|
44
|
+
/** Keep only files whose repo-relative path is at or under one of `onlyDirs`.
|
|
45
|
+
* No-op when `onlyDirs` is empty/absent. The whitelist is carried in the graph
|
|
46
|
+
* itself (the fingerprint records it at build time), never in the source repo,
|
|
47
|
+
* so a build and the query-path freshness probe read the identical set. */
|
|
48
|
+
export function filterByOnlyDirs(files, root, onlyDirs) {
|
|
49
|
+
if (!onlyDirs || onlyDirs.size === 0)
|
|
50
|
+
return files;
|
|
51
|
+
return files.filter((abs) => {
|
|
52
|
+
const rel = relPosix(root, abs);
|
|
53
|
+
return [...onlyDirs].some((d) => rel === d || rel.startsWith(`${d}/`));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
export function listSourceFiles(root, outDir, repoFiles = walkDir(root, readIncludeDirs(resolve(root)), {
|
|
57
|
+
followSubmodules: readFollowSubmodules(resolve(root)),
|
|
58
|
+
followNestedRepos: readFollowNestedRepos(resolve(root)),
|
|
59
|
+
}), onlyDirs) {
|
|
60
|
+
// A file is a source file if a depth-tier grammar (languageOf), a breadth-tier
|
|
61
|
+
// grammar (genericLangOf) or a container (containerLangOf) claims its extension.
|
|
62
|
+
// All three must agree here or `build` and `check` would enumerate different sets.
|
|
63
|
+
return filterByOnlyDirs(repoFiles.filter((f) => !f.startsWith(outDir) &&
|
|
64
|
+
(languageOf(f) !== null || genericLangOf(f) !== null || containerLangOf(f) !== null)), root, onlyDirs);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* {@link listSourceFiles} plus each file's `(size, mtimeMs)` — the currency of
|
|
68
|
+
* both the freshness probe and the extraction cache. Files that vanish between
|
|
69
|
+
* the walk and the stat are dropped (same fail-soft posture as `walkDir`).
|
|
70
|
+
*/
|
|
71
|
+
export function listSourceStats(root, outDir, repoFiles, onlyDirs) {
|
|
72
|
+
const out = [];
|
|
73
|
+
for (const abs of listSourceFiles(root, outDir, repoFiles, onlyDirs)) {
|
|
74
|
+
let s;
|
|
75
|
+
try {
|
|
76
|
+
s = statSync(abs);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
out.push({ abs, rel: relPosix(root, abs), size: s.size, mtimeMs: s.mtimeMs });
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=source-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-files.js","sourceRoot":"","sources":["../../src/graph/source-files.ts"],"names":[],"mappings":"AAAA;;;;;;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AE9B,MAAM,GAAG,GAAiB,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC;QACrE,IAAI,CAAoC,CAAC;QACzC,IAAI,CAAC;YACH,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Savings } from "../context/savings.js";
|
|
2
|
+
import { type Direction, type EdgeHit } from "./traverse.js";
|
|
3
|
+
import type { GraphV1, NodeV1 } from "./types.js";
|
|
4
|
+
export interface CallersCliOptions {
|
|
5
|
+
in?: string;
|
|
6
|
+
json?: boolean;
|
|
7
|
+
/** walk direction; defaults to "in" (callers). "out" gives callees. */
|
|
8
|
+
direction?: string;
|
|
9
|
+
/** max BFS depth, as the raw --depth string (validated here); defaults to 1. */
|
|
10
|
+
depth?: string;
|
|
11
|
+
/** the top-level `--dir` override, so this command respects it like every other. */
|
|
12
|
+
globalDir?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Exported so the MCP `julius_trace_calls` tool (`src/mcp/tools.ts`) can render the
|
|
15
|
+
* same human report format as the CLI, rather than re-implementing it — both
|
|
16
|
+
* surfaces walk the same edges via the same `resolveSymbol` / `edgeWalk` core. */
|
|
17
|
+
export declare function headerOf(n: NodeV1): string;
|
|
18
|
+
/** `showDepth` is set for multi-hop walks (depth > 1), matching the old
|
|
19
|
+
* `julius impact` output which tagged every hit with its BFS depth.
|
|
20
|
+
*
|
|
21
|
+
* `quote`, when given, is the call site itself — the line inside the hit where it
|
|
22
|
+
* references the symbol. An edge that says "total calls add" is a claim; the line
|
|
23
|
+
* under it is the evidence, and it saves opening the file to check.
|
|
24
|
+
*/
|
|
25
|
+
export declare function hitLine(direction: Direction, hit: EdgeHit, showDepth: boolean, quote?: Quote): string;
|
|
26
|
+
/** A quoted source line: where the edge actually happens. */
|
|
27
|
+
interface Quote {
|
|
28
|
+
n: number;
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
/** Tokens-saved baseline for a callers/callees walk: the files of the matched
|
|
32
|
+
* symbols plus every resolved edge endpoint, read whole — the files you'd open
|
|
33
|
+
* to trace these edges by hand. Shared by the CLI and the MCP tool so both
|
|
34
|
+
* surfaces report the same number. */
|
|
35
|
+
export declare function callersSavings(graph: GraphV1, results: {
|
|
36
|
+
symbol: NodeV1;
|
|
37
|
+
hits: EdgeHit[];
|
|
38
|
+
}[]): Savings | undefined;
|
|
39
|
+
/** Loud, actionable empty-result note — never a bare empty list. `candidateCount`
|
|
40
|
+
* is how many nodes {@link resolveSymbol} matched for this query (both call
|
|
41
|
+
* sites already hold it as `matches.length`) — when it's >1, the query name is
|
|
42
|
+
* itself ambiguous (several definitions share it), which is exactly the case
|
|
43
|
+
* `resolve.ts` drops a cross-file call/reference for rather than guessing which
|
|
44
|
+
* one it means. Without saying so, a zero-hit result here reads as "nothing
|
|
45
|
+
* calls this" when it may really be "something does, but the edge was dropped". */
|
|
46
|
+
export declare function looseNoteFor(direction: Direction, name: string, candidateCount: number): string;
|
|
47
|
+
/**
|
|
48
|
+
* Resolve `query` in the graph at `dir` (respecting `--dir`/`--in`), walk edges
|
|
49
|
+
* per `--direction`/`--depth`, and print either the human report or `--json`.
|
|
50
|
+
* Exits the process (code 1) when there's no graph at all or the symbol is
|
|
51
|
+
* unknown — both are caller-facing mistakes, not recoverable states.
|
|
52
|
+
*/
|
|
53
|
+
export declare function runCallersCommand(query: string, dir: string, opts: CallersCliOptions): void;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=traverse-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-cli.d.ts","sourceRoot":"","sources":["../../src/graph/traverse-cli.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAA2B,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGlD,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAKD;;kFAEkF;AAClF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAMrG;AAED,6DAA6D;AAC7D,UAAU,KAAK;IACb,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd;AAkBD;;;sCAGsC;AACtC,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,EAAE,GAC7C,OAAO,GAAG,SAAS,CAOrB;AAED;;;;;;mFAMmF;AACnF,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAQ/F;AAiDD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CA4E3F"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI wiring for `julius callers` and its `--direction` / `--depth` flags.
|
|
3
|
+
*
|
|
4
|
+
* One command, one implementation: resolve a symbol via `resolveSymbol`, walk
|
|
5
|
+
* edges via `edgeWalk` (incoming or outgoing, depth 1 or a BFS), and share the
|
|
6
|
+
* same resolve-or-die flow, human formatter, and --json shape. Kept out of
|
|
7
|
+
* cli.ts so that file stays thin (argument wiring only) and this logic stays
|
|
8
|
+
* unit-testable without shelling out to the CLI on every case.
|
|
9
|
+
*
|
|
10
|
+
* `--direction out` subsumes the old `julius callees`; `--depth N` subsumes the
|
|
11
|
+
* old `julius impact`. Exported formatters are reused by the MCP `julius_trace_calls`
|
|
12
|
+
* tool (`src/mcp/tools.ts`), so both surfaces render identical reports.
|
|
13
|
+
*/
|
|
14
|
+
import { resolve } from "node:path";
|
|
15
|
+
import { fileReader, referenceLine, wordRe } from "../blast/evidence.js";
|
|
16
|
+
import { contextDirFor } from "../context/node-file.js";
|
|
17
|
+
import { withSavings, savingsFor } from "../context/savings.js";
|
|
18
|
+
import { loadGraphCached } from "./load.js";
|
|
19
|
+
import { resolveSymbol, edgeWalk } from "./traverse.js";
|
|
20
|
+
import { cmd } from "../brand.js";
|
|
21
|
+
const ARROW = { in: "←", out: "→" };
|
|
22
|
+
const DEFAULT_DEPTH = 1;
|
|
23
|
+
/** Exported so the MCP `julius_trace_calls` tool (`src/mcp/tools.ts`) can render the
|
|
24
|
+
* same human report format as the CLI, rather than re-implementing it — both
|
|
25
|
+
* surfaces walk the same edges via the same `resolveSymbol` / `edgeWalk` core. */
|
|
26
|
+
export function headerOf(n) {
|
|
27
|
+
return `${n.name} · ${n.kind} · ${n.path}:${n.span}`;
|
|
28
|
+
}
|
|
29
|
+
/** `showDepth` is set for multi-hop walks (depth > 1), matching the old
|
|
30
|
+
* `julius impact` output which tagged every hit with its BFS depth.
|
|
31
|
+
*
|
|
32
|
+
* `quote`, when given, is the call site itself — the line inside the hit where it
|
|
33
|
+
* references the symbol. An edge that says "total calls add" is a claim; the line
|
|
34
|
+
* under it is the evidence, and it saves opening the file to check.
|
|
35
|
+
*/
|
|
36
|
+
export function hitLine(direction, hit, showDepth, quote) {
|
|
37
|
+
const arrow = ARROW[direction];
|
|
38
|
+
const depthTag = showDepth ? ` [depth ${hit.depth}]` : "";
|
|
39
|
+
const label = hit.node ? `${hit.node.name} (${hit.node.path}:${hit.node.span})` : `${hit.id} (unresolved import)`;
|
|
40
|
+
const line = ` ${hit.relation} ${arrow} ${label}${depthTag}`;
|
|
41
|
+
return quote ? `${line}\n ${quote.n}: ${quote.text.trim()}` : line;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The call site for one hit, or nothing.
|
|
45
|
+
*
|
|
46
|
+
* Only for a resolved hit whose span we can read: an unresolved import has no
|
|
47
|
+
* file, and a hit at depth 2+ references something in between rather than the
|
|
48
|
+
* symbol asked about, so quoting it would point at the wrong line.
|
|
49
|
+
*/
|
|
50
|
+
function quoteFor(hit, name, read) {
|
|
51
|
+
if (!hit.node || hit.depth > 1)
|
|
52
|
+
return undefined;
|
|
53
|
+
return referenceLine(hit.node.path, hit.node.span, [wordRe(name)], read) ?? undefined;
|
|
54
|
+
}
|
|
55
|
+
/** Tokens-saved baseline for a callers/callees walk: the files of the matched
|
|
56
|
+
* symbols plus every resolved edge endpoint, read whole — the files you'd open
|
|
57
|
+
* to trace these edges by hand. Shared by the CLI and the MCP tool so both
|
|
58
|
+
* surfaces report the same number. */
|
|
59
|
+
export function callersSavings(graph, results) {
|
|
60
|
+
const paths = [];
|
|
61
|
+
for (const { symbol, hits } of results) {
|
|
62
|
+
paths.push(symbol.path);
|
|
63
|
+
for (const h of hits)
|
|
64
|
+
if (h.node)
|
|
65
|
+
paths.push(h.node.path);
|
|
66
|
+
}
|
|
67
|
+
return savingsFor(graph, paths);
|
|
68
|
+
}
|
|
69
|
+
/** Loud, actionable empty-result note — never a bare empty list. `candidateCount`
|
|
70
|
+
* is how many nodes {@link resolveSymbol} matched for this query (both call
|
|
71
|
+
* sites already hold it as `matches.length`) — when it's >1, the query name is
|
|
72
|
+
* itself ambiguous (several definitions share it), which is exactly the case
|
|
73
|
+
* `resolve.ts` drops a cross-file call/reference for rather than guessing which
|
|
74
|
+
* one it means. Without saying so, a zero-hit result here reads as "nothing
|
|
75
|
+
* calls this" when it may really be "something does, but the edge was dropped". */
|
|
76
|
+
export function looseNoteFor(direction, name, candidateCount) {
|
|
77
|
+
const label = direction === "out" ? "callees" : "callers";
|
|
78
|
+
const dir = direction === "out" ? "outgoing" : "incoming";
|
|
79
|
+
const ambiguity = candidateCount > 1
|
|
80
|
+
? ` ${candidateCount} definitions share the name "${name}"; a cross-file caller of an ambiguous name is dropped rather than guessed, so this may undercount.`
|
|
81
|
+
: "";
|
|
82
|
+
return ` no indexed ${label} — the graph has no ${dir} call/reference edges for this symbol as written.${ambiguity} Check the name (try the bare symbol, or "Type.method"), or find its uses with ${cmd("julius grep")} "${name}". Fall back to raw grep -rn only for unindexed files`;
|
|
83
|
+
}
|
|
84
|
+
function symbolJson(n) {
|
|
85
|
+
return { id: n.id, name: n.name, kind: n.kind, path: n.path, span: n.span };
|
|
86
|
+
}
|
|
87
|
+
function hitJson(hit) {
|
|
88
|
+
const out = { id: hit.id, relation: hit.relation, depth: hit.depth };
|
|
89
|
+
if (hit.node) {
|
|
90
|
+
out.name = hit.node.name;
|
|
91
|
+
out.kind = hit.node.kind;
|
|
92
|
+
out.path = hit.node.path;
|
|
93
|
+
out.span = hit.node.span;
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
/** Parse and validate the raw `--direction` string; exits (code 1) on garbage. */
|
|
98
|
+
function resolveDirection(raw) {
|
|
99
|
+
if (raw === undefined)
|
|
100
|
+
return "in";
|
|
101
|
+
if (raw === "in" || raw === "out")
|
|
102
|
+
return raw;
|
|
103
|
+
console.error(`✗ --direction must be "in" or "out", got "${raw}"`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve `query` in the graph at `dir` (respecting `--dir`/`--in`), walk edges
|
|
108
|
+
* per `--direction`/`--depth`, and print either the human report or `--json`.
|
|
109
|
+
* Exits the process (code 1) when there's no graph at all or the symbol is
|
|
110
|
+
* unknown — both are caller-facing mistakes, not recoverable states.
|
|
111
|
+
*/
|
|
112
|
+
export function runCallersCommand(query, dir, opts) {
|
|
113
|
+
const root = resolve(dir);
|
|
114
|
+
const contextDir = contextDirFor(root, opts.globalDir);
|
|
115
|
+
const graph = loadGraphCached(contextDir);
|
|
116
|
+
if (!graph) {
|
|
117
|
+
console.error(`✗ no graph found at ${contextDir} — run \`${cmd("julius build")}\` first`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
// `resolveSymbol` throws on an `--in` prefix that matches nothing indexed —
|
|
121
|
+
// a caller mistake, reported in the same shape as the ones around it rather
|
|
122
|
+
// than as a bare stack-trace message from the top-level handler.
|
|
123
|
+
let matches;
|
|
124
|
+
try {
|
|
125
|
+
matches = resolveSymbol(graph, query, opts.in ? { in: opts.in } : {});
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
console.error(`✗ ${err instanceof Error ? err.message : String(err)}`);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (matches.length === 0) {
|
|
133
|
+
console.error(`✗ no symbol "${query}" in the graph — check spelling or run ${cmd("julius build")}`);
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
const direction = resolveDirection(opts.direction);
|
|
137
|
+
let depth = DEFAULT_DEPTH;
|
|
138
|
+
if (opts.depth !== undefined) {
|
|
139
|
+
// `all` (aka full/max) = the whole transitive closure: walk until no new
|
|
140
|
+
// node is reached. The BFS's visited-set makes this cycle-safe, and it
|
|
141
|
+
// terminates when the frontier empties. This is the "show me every
|
|
142
|
+
// connected source" mode — the right first move before a multi-file
|
|
143
|
+
// refactor, where stopping at direct edges misses sibling/downstream files.
|
|
144
|
+
if (/^(all|full|max)$/i.test(opts.depth)) {
|
|
145
|
+
depth = Number.POSITIVE_INFINITY;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const d = Number(opts.depth);
|
|
149
|
+
if (!Number.isFinite(d) || d < 1) {
|
|
150
|
+
console.error(`✗ --depth must be a positive number or "all", got "${opts.depth}"`);
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
depth = Math.floor(d);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const showDepth = depth > 1;
|
|
157
|
+
const results = matches.map((symbol) => ({ symbol, hits: edgeWalk(graph, symbol, direction, depth) }));
|
|
158
|
+
const saved = callersSavings(graph, results);
|
|
159
|
+
if (opts.json) {
|
|
160
|
+
const payload = {
|
|
161
|
+
query,
|
|
162
|
+
matches: results.map((r) => {
|
|
163
|
+
const m = { symbol: symbolJson(r.symbol), hits: r.hits.map(hitJson) };
|
|
164
|
+
if (r.hits.length === 0) {
|
|
165
|
+
m.note = looseNoteFor(direction, r.symbol.name, matches.length);
|
|
166
|
+
}
|
|
167
|
+
return m;
|
|
168
|
+
}),
|
|
169
|
+
saved,
|
|
170
|
+
};
|
|
171
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const lines = [];
|
|
175
|
+
// One reader for the whole walk: several hits usually live in the same file.
|
|
176
|
+
const read = fileReader(root);
|
|
177
|
+
for (const { symbol, hits } of results) {
|
|
178
|
+
lines.push(headerOf(symbol));
|
|
179
|
+
if (hits.length === 0)
|
|
180
|
+
lines.push(looseNoteFor(direction, symbol.name, matches.length));
|
|
181
|
+
else
|
|
182
|
+
for (const h of hits)
|
|
183
|
+
lines.push(hitLine(direction, h, showDepth, quoteFor(h, symbol.name, read)));
|
|
184
|
+
lines.push("");
|
|
185
|
+
}
|
|
186
|
+
const body = lines.join("\n").replace(/\n+$/, "\n");
|
|
187
|
+
process.stdout.write(withSavings(body, saved));
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=traverse-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traverse-cli.js","sourceRoot":"","sources":["../../src/graph/traverse-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAgC,MAAM,eAAe,CAAC;AAEtF,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAalC,MAAM,KAAK,GAAiC,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAClE,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;kFAEkF;AAClF,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,OAAO,GAAG,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,SAAoB,EAAE,GAAY,EAAE,SAA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