@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,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container tier — files that are not a language but a wrapper around one.
|
|
3
|
+
*
|
|
4
|
+
* A Vue SFC is the motivating case: `.vue` is HTML-shaped, and everything worth
|
|
5
|
+
* indexing lives inside its `<script>` block. Registering `tree-sitter-vue` as a
|
|
6
|
+
* breadth-tier language (generic.ts) would not help — that grammar parses the
|
|
7
|
+
* shell (`<template>` / `<script>` / `<style>`) and hands back the script body as
|
|
8
|
+
* one opaque `raw_text` node, so the cards would come out empty.
|
|
9
|
+
*
|
|
10
|
+
* So the container grammar is used only to answer "where does the embedded
|
|
11
|
+
* language start and end", and the block itself goes to the DEPTH-tier extractor
|
|
12
|
+
* (extract.ts). A `.vue` file therefore gets the same quality of extraction as a
|
|
13
|
+
* `.ts` file — bindings, imports, resolved calls — not the signature-only output
|
|
14
|
+
* the breadth tier would give.
|
|
15
|
+
*
|
|
16
|
+
* **The span shift is the whole risk here.** `extractFile` numbers its spans from
|
|
17
|
+
* the start of the string it was handed, so every node comes back pointing at a
|
|
18
|
+
* line in the script, not in the `.vue`. A span that is off by even one line is
|
|
19
|
+
* worse than not indexing the file at all: julius's promise is that its
|
|
20
|
+
* `file:line` is exact, and a plausible-but-wrong line silently sends the reader
|
|
21
|
+
* to the wrong place. `test/container-extract.test.ts` pins this against
|
|
22
|
+
* fixtures whose true line numbers are known.
|
|
23
|
+
*/
|
|
24
|
+
import { extractFile, mintId } from "./extract.js";
|
|
25
|
+
import { extractGeneric, fallbackLangOf, loadWasmLanguage, parseWasm } from "./generic.js";
|
|
26
|
+
import { nativeReady } from "./native.js";
|
|
27
|
+
import { contentHash } from "../util/id.js";
|
|
28
|
+
/** The container registry. Svelte and Astro are the same shape and would be a
|
|
29
|
+
* row each, but they are left out until someone has a repo to verify them
|
|
30
|
+
* against — a wrong `body` node type would produce silently misplaced spans. */
|
|
31
|
+
export const CONTAINER_LANGS = [
|
|
32
|
+
{ name: "vue", exts: [".vue"], wasm: "vue", block: "script_element", body: "raw_text", inner: "typescript" },
|
|
33
|
+
];
|
|
34
|
+
const byExt = new Map();
|
|
35
|
+
for (const l of CONTAINER_LANGS)
|
|
36
|
+
for (const e of l.exts)
|
|
37
|
+
byExt.set(e, l);
|
|
38
|
+
/** The container language for a path, or null if none claims it. */
|
|
39
|
+
export function containerLangOf(path) {
|
|
40
|
+
const lower = path.toLowerCase();
|
|
41
|
+
for (const [ext, l] of byExt)
|
|
42
|
+
if (lower.endsWith(ext))
|
|
43
|
+
return l;
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
/** Every file extension the container tier claims. */
|
|
47
|
+
export function containerExtensions() {
|
|
48
|
+
return CONTAINER_LANGS.flatMap((l) => l.exts);
|
|
49
|
+
}
|
|
50
|
+
const loaded = new Map();
|
|
51
|
+
/** Warm the container grammars this repo needs. Same contract as
|
|
52
|
+
* `warmGenericGrammars`: await once before the synchronous parse loop, and an
|
|
53
|
+
* unavailable grammar is skipped rather than fatal (its files then extract to a
|
|
54
|
+
* file node only, exactly as they do today). */
|
|
55
|
+
export async function warmContainerGrammars(langNames) {
|
|
56
|
+
for (const name of new Set(langNames)) {
|
|
57
|
+
if (loaded.has(name))
|
|
58
|
+
continue;
|
|
59
|
+
const row = CONTAINER_LANGS.find((l) => l.name === name);
|
|
60
|
+
if (!row)
|
|
61
|
+
continue;
|
|
62
|
+
const language = await loadWasmLanguage(row.wasm);
|
|
63
|
+
if (language)
|
|
64
|
+
loaded.set(name, language);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** True if a container grammar has been warmed (else extraction is file-only). */
|
|
68
|
+
export function isContainerWarm(langName) {
|
|
69
|
+
return loaded.has(langName);
|
|
70
|
+
}
|
|
71
|
+
/** `L12-L20` shifted by n lines. The span format is produced in exactly two
|
|
72
|
+
* places (extract.ts and generic.ts) and is always this shape; anything else is
|
|
73
|
+
* returned untouched rather than guessed at. */
|
|
74
|
+
function shiftSpan(span, lines) {
|
|
75
|
+
const m = /^L(\d+)-L(\d+)$/.exec(span);
|
|
76
|
+
if (!m)
|
|
77
|
+
return span;
|
|
78
|
+
return `L${Number(m[1]) + lines}-L${Number(m[2]) + lines}`;
|
|
79
|
+
}
|
|
80
|
+
/** The `.vue` file's own node. Deliberately describes the whole file — line
|
|
81
|
+
* count, hash and size of the SFC, not of the script block — because that is
|
|
82
|
+
* what a reader opening this path will see. */
|
|
83
|
+
function containerFileNode(rel, source, residual) {
|
|
84
|
+
return {
|
|
85
|
+
id: rel,
|
|
86
|
+
name: rel.split("/").pop() ?? rel,
|
|
87
|
+
kind: "file",
|
|
88
|
+
path: rel,
|
|
89
|
+
span: `L1-L${Math.max(1, source.split("\n").length)}`,
|
|
90
|
+
signature: null,
|
|
91
|
+
exported: true,
|
|
92
|
+
// "ast", not "generic": the symbols under this file come from the depth-tier
|
|
93
|
+
// extractor with real bindings and specifiers. resolve.ts gates a
|
|
94
|
+
// guess-by-name fallback on `origin === "generic"`, and these nodes must not
|
|
95
|
+
// take it — they carry the information to resolve properly.
|
|
96
|
+
origin: "ast",
|
|
97
|
+
body_hash: contentHash(source),
|
|
98
|
+
chars: source.length,
|
|
99
|
+
body_text: residual,
|
|
100
|
+
summary_state: "pending",
|
|
101
|
+
summary: null,
|
|
102
|
+
crux: null,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** Every embedded block in document order, as [bodyNode] — an SFC may legally
|
|
106
|
+
* carry two (`<script>` for options/exports plus `<script setup>`), and each
|
|
107
|
+
* needs its own offset. */
|
|
108
|
+
function blocks(root, lang) {
|
|
109
|
+
const out = [];
|
|
110
|
+
const n = root.namedChildCount ?? 0;
|
|
111
|
+
for (let i = 0; i < n; i++) {
|
|
112
|
+
const child = root.namedChild?.(i);
|
|
113
|
+
if (!child || child.type !== lang.block)
|
|
114
|
+
continue;
|
|
115
|
+
const kids = child.namedChildCount ?? 0;
|
|
116
|
+
for (let j = 0; j < kids; j++) {
|
|
117
|
+
const body = child.namedChild?.(j);
|
|
118
|
+
// An empty `<script></script>` has no body child at all — skipped here, so
|
|
119
|
+
// the file still gets its file node and nothing else, which is the same
|
|
120
|
+
// shape as a file whose grammar is missing.
|
|
121
|
+
if (body && body.type === lang.body)
|
|
122
|
+
out.push(body);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Extract one container file. Synchronous; needs the grammar pre-warmed.
|
|
129
|
+
*
|
|
130
|
+
* Never throws: a missing grammar, an unparseable SFC or a script block the
|
|
131
|
+
* inner extractor chokes on all degrade to "fewer nodes", because a build must
|
|
132
|
+
* not fail over one component.
|
|
133
|
+
*/
|
|
134
|
+
export function extractContainer(rel, source, lang) {
|
|
135
|
+
const nodes = [];
|
|
136
|
+
const rawEdges = [];
|
|
137
|
+
const residuals = [];
|
|
138
|
+
const language = loaded.get(lang.name);
|
|
139
|
+
const root = language ? parseWasm(language, source) : null;
|
|
140
|
+
if (root) {
|
|
141
|
+
// Ids are minted per file by the inner extractor, so two script blocks that
|
|
142
|
+
// both define `setup` would collide. Threading one set across the blocks
|
|
143
|
+
// makes the second one `path#setup~2`, and the rename is applied to that
|
|
144
|
+
// block's edges too so nothing points at an id that no longer exists.
|
|
145
|
+
const minted = new Set([rel]);
|
|
146
|
+
for (const body of blocks(root, lang)) {
|
|
147
|
+
const script = source.slice(body.startIndex, body.endIndex);
|
|
148
|
+
let inner;
|
|
149
|
+
try {
|
|
150
|
+
// No native grammar for the embedded language (see native.ts): its WASM
|
|
151
|
+
// stand-in gives the block's symbols, warmed by the build like any other.
|
|
152
|
+
inner = nativeReady(lang.inner)
|
|
153
|
+
? extractFile(rel, script, lang.inner)
|
|
154
|
+
: extractGeneric(rel, script, fallbackLangOf(lang.inner).name);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
continue; // one bad block, not a bad build
|
|
158
|
+
}
|
|
159
|
+
// `raw_text` starts immediately after the `>` of the opening tag, so its
|
|
160
|
+
// row IS the tag's row and the slice begins with that line's newline.
|
|
161
|
+
// Script line 1 is therefore the tail of the tag line, and script line N
|
|
162
|
+
// lands on `.vue` line row + N — which is exactly "add the start row to a
|
|
163
|
+
// 1-based span". Taking the row from the tag node instead would look
|
|
164
|
+
// equivalent and be right only when the tag has no attributes.
|
|
165
|
+
const shift = body.startPosition.row;
|
|
166
|
+
// nodes[0] is the script's own file node: it describes the block, not the
|
|
167
|
+
// file, so it is dropped and its residual folded into the .vue file node.
|
|
168
|
+
const [scriptFile, ...symbols] = inner.nodes;
|
|
169
|
+
if (scriptFile?.body_text)
|
|
170
|
+
residuals.push(scriptFile.body_text);
|
|
171
|
+
const renamed = new Map();
|
|
172
|
+
for (const node of symbols) {
|
|
173
|
+
const id = mintId(node.id, minted);
|
|
174
|
+
if (id !== node.id)
|
|
175
|
+
renamed.set(node.id, id);
|
|
176
|
+
nodes.push({ ...node, id, span: shiftSpan(node.span, shift) });
|
|
177
|
+
}
|
|
178
|
+
for (const edge of inner.rawEdges) {
|
|
179
|
+
const source_ = renamed.get(edge.source) ?? edge.source;
|
|
180
|
+
const targetId = edge.targetId === undefined ? undefined : (renamed.get(edge.targetId) ?? edge.targetId);
|
|
181
|
+
rawEdges.push({ ...edge, source: source_, ...(targetId === undefined ? {} : { targetId }) });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Built last so it can carry the residual, but unshifted first so the file node
|
|
186
|
+
// stays at index 0 like every other tier's output.
|
|
187
|
+
nodes.unshift(containerFileNode(rel, source, residuals.join("\n")));
|
|
188
|
+
return { nodes, rawEdges };
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/graph/container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAmD,MAAM,cAAc,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAe,MAAM,cAAc,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmB5C;;gFAEgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE;CAC7G,CAAC;AAEF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;AAC/C,KAAK,MAAM,CAAC,IAAI,eAAe;IAAE,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI;QAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEzE,oEAAoE;AACpE,MAAM,UAAU,eAAe,CAAC,IAAY;IA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,EAAE,CAAC;gBAClC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC;gBACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACzG,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;YAC/F,CAAC;QACH,CAAC;IACH,CAAC;IAED,gFAAgF;IAChF,mDAAmD;IACnD,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 pass: attach the LLM meaning layer (`summary` + `crux`) to nodes.
|
|
3
|
+
*
|
|
4
|
+
* graph.json is its own cache — the committed file already holds every node's
|
|
5
|
+
* summary/crux from a prior run. So this pass is diff-driven:
|
|
6
|
+
*
|
|
7
|
+
* - cache hit — a prior node with the same id, same `body_hash`, and
|
|
8
|
+
* `summary_state:"ready"` → carry its summary/crux over, no LLM call.
|
|
9
|
+
* - stale — a prior ready summary whose body has since changed → keep the
|
|
10
|
+
* old text as a hint but mark it "stale". Recomputed only if an LLM is given.
|
|
11
|
+
* - pending — new or never-summarized node → one LLM call when an LLM is
|
|
12
|
+
* given, otherwise left "pending".
|
|
13
|
+
*
|
|
14
|
+
* Passing no summarizer runs the cache/stale bookkeeping alone (no calls, no
|
|
15
|
+
* cost) — which is what a plain `graph` build does, so it never wipes the
|
|
16
|
+
* meaning layer a previous `--llm` run produced.
|
|
17
|
+
*
|
|
18
|
+
* The LLM returns line numbers into the slice it was shown; we consume them here,
|
|
19
|
+
* once, to cut `crux.code` verbatim from the source. `crux.span` is a pointer
|
|
20
|
+
* only and is never used to re-slice.
|
|
21
|
+
*/
|
|
22
|
+
import { type CruxSummarizer } from "../ai/crux.js";
|
|
23
|
+
import type { NodeV1 } from "./types.js";
|
|
24
|
+
export interface EnrichOptions {
|
|
25
|
+
/** When present, (re)compute meaning for stale/pending nodes. Absent → cache only. */
|
|
26
|
+
summarizer?: CruxSummarizer;
|
|
27
|
+
/** Max files summarized in parallel (each is one LLM call). Default {@link DEFAULT_CONCURRENCY}. */
|
|
28
|
+
concurrency?: number;
|
|
29
|
+
/** Progress is reported per file (one LLM call each), as files finish — not per node. */
|
|
30
|
+
onProgress?: (info: {
|
|
31
|
+
index: number;
|
|
32
|
+
total: number;
|
|
33
|
+
node: string;
|
|
34
|
+
}) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Durability flush of the (partially) enriched graph, called from the per-file
|
|
37
|
+
* completion handler at most once every {@link CHECKPOINT_MS}. Without it, crux
|
|
38
|
+
* only reached wiring.json at build end, so an interrupted --deep run discarded
|
|
39
|
+
* every crux it had already computed and paid for (#128). Single-threaded, so it
|
|
40
|
+
* never interleaves with a node mutation.
|
|
41
|
+
*/
|
|
42
|
+
checkpoint?: () => void;
|
|
43
|
+
}
|
|
44
|
+
export interface EnrichStats {
|
|
45
|
+
cached: number;
|
|
46
|
+
computed: number;
|
|
47
|
+
stale: number;
|
|
48
|
+
pending: number;
|
|
49
|
+
errors: string[];
|
|
50
|
+
/** Files whose LLM call failed outright. The count `errors` used to only imply —
|
|
51
|
+
* a caller has to be able to decide "this build is degraded" without parsing
|
|
52
|
+
* message strings (#127). */
|
|
53
|
+
failedFiles: number;
|
|
54
|
+
/** Files never attempted, because {@link EnrichStats.fatal} stopped the pass. */
|
|
55
|
+
skippedFiles: number;
|
|
56
|
+
/** Set when the pass gave up early: quota/auth rejection, or a run of
|
|
57
|
+
* provider failures. Content-quality misses (#235) count in `failedFiles` but
|
|
58
|
+
* do not set this. The reason is what `julius build --deep` exits non-zero with. */
|
|
59
|
+
fatal?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function enrichGraph(nodes: NodeV1[], prior: Map<string, NodeV1>, sources: Map<string, string>, opts?: EnrichOptions): Promise<EnrichStats>;
|
|
62
|
+
//# sourceMappingURL=enrich.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrich.d.ts","sourceRoot":"","sources":["../../src/graph/enrich.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAqC,KAAK,cAAc,EAA+B,MAAM,eAAe,CAAC;AAEpH,OAAO,KAAK,EAAQ,MAAM,EAAE,MAAM,YAAY,CAAC;AAQ/C,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,oGAAoG;IACpG,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yFAAyF;IACzF,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB;AASD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;iCAE6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB;;wFAEoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,WAAW,CAC/B,KAAK,EAAE,MAAM,EAAE,EACf,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,GAAE,aAAkB,GACvB,OAAO,CAAC,WAAW,CAAC,CAgJtB"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 pass: attach the LLM meaning layer (`summary` + `crux`) to nodes.
|
|
3
|
+
*
|
|
4
|
+
* graph.json is its own cache — the committed file already holds every node's
|
|
5
|
+
* summary/crux from a prior run. So this pass is diff-driven:
|
|
6
|
+
*
|
|
7
|
+
* - cache hit — a prior node with the same id, same `body_hash`, and
|
|
8
|
+
* `summary_state:"ready"` → carry its summary/crux over, no LLM call.
|
|
9
|
+
* - stale — a prior ready summary whose body has since changed → keep the
|
|
10
|
+
* old text as a hint but mark it "stale". Recomputed only if an LLM is given.
|
|
11
|
+
* - pending — new or never-summarized node → one LLM call when an LLM is
|
|
12
|
+
* given, otherwise left "pending".
|
|
13
|
+
*
|
|
14
|
+
* Passing no summarizer runs the cache/stale bookkeeping alone (no calls, no
|
|
15
|
+
* cost) — which is what a plain `graph` build does, so it never wipes the
|
|
16
|
+
* meaning layer a previous `--llm` run produced.
|
|
17
|
+
*
|
|
18
|
+
* The LLM returns line numbers into the slice it was shown; we consume them here,
|
|
19
|
+
* once, to cut `crux.code` verbatim from the source. `crux.span` is a pointer
|
|
20
|
+
* only and is never used to re-slice.
|
|
21
|
+
*/
|
|
22
|
+
import { formatCruxMiss } from "../ai/crux.js";
|
|
23
|
+
import { LlmFailureGate } from "../ai/failure.js";
|
|
24
|
+
/** Cap on the stored crux: an over-long pick is trimmed to its leading slice. */
|
|
25
|
+
const MAX_CRUX_LINES = 12;
|
|
26
|
+
/** Files summarized at once. Each is an independent LLM call; order is preserved. */
|
|
27
|
+
const DEFAULT_CONCURRENCY = 5;
|
|
28
|
+
/** How often the crux pass flushes partial progress to disk. Read at call time (not
|
|
29
|
+
* module load) so a test seam `JULIUS_CRUX_CHECKPOINT_MS=0` (flush on every completed
|
|
30
|
+
* file) takes effect. */
|
|
31
|
+
function checkpointMs() {
|
|
32
|
+
return Number(process.env.JULIUS_CRUX_CHECKPOINT_MS ?? 15000);
|
|
33
|
+
}
|
|
34
|
+
export async function enrichGraph(nodes, prior, sources, opts = {}) {
|
|
35
|
+
const stats = {
|
|
36
|
+
cached: 0,
|
|
37
|
+
computed: 0,
|
|
38
|
+
stale: 0,
|
|
39
|
+
pending: 0,
|
|
40
|
+
errors: [],
|
|
41
|
+
failedFiles: 0,
|
|
42
|
+
skippedFiles: 0,
|
|
43
|
+
};
|
|
44
|
+
// Which nodes actually need an LLM call this run (after cache carry-over).
|
|
45
|
+
const dirty = [];
|
|
46
|
+
for (const node of nodes) {
|
|
47
|
+
const was = prior.get(node.id);
|
|
48
|
+
if (was?.summary_state === "ready" && was.body_hash === node.body_hash) {
|
|
49
|
+
node.summary = was.summary;
|
|
50
|
+
node.crux = was.crux;
|
|
51
|
+
node.summary_state = "ready";
|
|
52
|
+
stats.cached++;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
// needs computing; seed with the old summary as a stale hint when one exists.
|
|
56
|
+
if (was && was.summary) {
|
|
57
|
+
node.summary = was.summary;
|
|
58
|
+
node.crux = was.crux;
|
|
59
|
+
node.summary_state = "stale";
|
|
60
|
+
}
|
|
61
|
+
dirty.push(node);
|
|
62
|
+
}
|
|
63
|
+
if (!opts.summarizer) {
|
|
64
|
+
for (const node of dirty) {
|
|
65
|
+
if (node.summary_state === "stale")
|
|
66
|
+
stats.stale++;
|
|
67
|
+
else
|
|
68
|
+
stats.pending++;
|
|
69
|
+
}
|
|
70
|
+
return stats;
|
|
71
|
+
}
|
|
72
|
+
// One LLM call per file: group the dirty nodes by the file they live in.
|
|
73
|
+
const byFile = new Map();
|
|
74
|
+
for (const node of dirty) {
|
|
75
|
+
if (!sources.has(node.path))
|
|
76
|
+
continue;
|
|
77
|
+
const arr = byFile.get(node.path);
|
|
78
|
+
if (arr)
|
|
79
|
+
arr.push(node);
|
|
80
|
+
else
|
|
81
|
+
byFile.set(node.path, [node]);
|
|
82
|
+
}
|
|
83
|
+
// Each file is an independent LLM call, so run several in flight at once —
|
|
84
|
+
// the slow part is the round-trip, not local work. Files never share state:
|
|
85
|
+
// one file's nodes and source stand alone, so parallelism can't corrupt the
|
|
86
|
+
// per-file line numbers the crux slicing depends on. `stats` mutation is safe
|
|
87
|
+
// because JS is single-threaded — increments run between awaits, never during.
|
|
88
|
+
const summarizer = opts.summarizer;
|
|
89
|
+
const files = [...byFile.keys()];
|
|
90
|
+
const limit = Math.max(1, opts.concurrency ?? DEFAULT_CONCURRENCY);
|
|
91
|
+
let done = 0;
|
|
92
|
+
const flushEvery = checkpointMs();
|
|
93
|
+
let lastCheckpoint = Date.now();
|
|
94
|
+
// Shared with the concept pass (`context/build.ts`), so both agree on when a
|
|
95
|
+
// provider has stopped working. Counted across the whole pass, not per worker:
|
|
96
|
+
// with `-j 5` the interleaving is what a user sees as "everything is failing now".
|
|
97
|
+
const gate = new LlmFailureGate();
|
|
98
|
+
await mapWithConcurrency(files, limit, async (path) => {
|
|
99
|
+
const fileNodes = byFile.get(path);
|
|
100
|
+
const source = sources.get(path);
|
|
101
|
+
const lineCount = source.split("\n").length;
|
|
102
|
+
// Once the pass is fatal, the remaining files are not attempted: every call
|
|
103
|
+
// would fail the same way, and on a metered gateway each one still costs a
|
|
104
|
+
// request. They are counted so the caller can report what was left undone.
|
|
105
|
+
if (gate.stopped) {
|
|
106
|
+
gate.skip();
|
|
107
|
+
for (const node of fileNodes) {
|
|
108
|
+
if (node.summary_state === "stale")
|
|
109
|
+
stats.stale++;
|
|
110
|
+
else
|
|
111
|
+
stats.pending++;
|
|
112
|
+
}
|
|
113
|
+
// Still reported, so the caller's progress counter reaches `total` instead of
|
|
114
|
+
// freezing at the file that broke — the abort is announced by the build's
|
|
115
|
+
// summary, not by a stalled line.
|
|
116
|
+
opts.onProgress?.({ index: done++, total: files.length, node: path });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const refs = fileNodes.map((n) => {
|
|
120
|
+
const [startLine, endLine] = spanLines(n.span, lineCount);
|
|
121
|
+
return { id: n.id, kind: n.kind, signature: n.signature, startLine, endLine };
|
|
122
|
+
});
|
|
123
|
+
const { results, error, quality } = await collectFileCrux(summarizer, path, source, refs);
|
|
124
|
+
let fileError = error;
|
|
125
|
+
if (fileError) {
|
|
126
|
+
stats.errors.push(`${path}: ${fileError}`);
|
|
127
|
+
gate.record(fileError, { quality });
|
|
128
|
+
}
|
|
129
|
+
let applied = 0;
|
|
130
|
+
for (const node of fileNodes) {
|
|
131
|
+
const r = results.size > 0 ? results.get(node.id) : undefined;
|
|
132
|
+
// Empty / whitespace-only summaries are not success: caching them as
|
|
133
|
+
// `ready` made the next `--deep` a permanent cache hit (#172).
|
|
134
|
+
if (!r || !r.summary.trim()) {
|
|
135
|
+
// whole-file call failed, the model skipped this symbol, or it returned
|
|
136
|
+
// an empty summary: keep what it had and leave it retryable.
|
|
137
|
+
if (node.summary_state === "stale")
|
|
138
|
+
stats.stale++;
|
|
139
|
+
else
|
|
140
|
+
stats.pending++;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
node.summary = r.summary;
|
|
144
|
+
node.crux = buildCrux(r, node, source, lineCount);
|
|
145
|
+
node.summary_state = "ready";
|
|
146
|
+
stats.computed++;
|
|
147
|
+
applied++;
|
|
148
|
+
}
|
|
149
|
+
if (!fileError && refs.length > 0 && applied === 0) {
|
|
150
|
+
// collectFileCrux already labels a total miss; this catches "got entries
|
|
151
|
+
// but every summary was blank" so the CLI's #127 degraded-exit path fires.
|
|
152
|
+
fileError = cruxMissMessage(summarizer, "empty-parsed");
|
|
153
|
+
stats.errors.push(`${path}: ${fileError}`);
|
|
154
|
+
gate.record(fileError, { quality: true });
|
|
155
|
+
}
|
|
156
|
+
else if (!fileError) {
|
|
157
|
+
gate.succeeded();
|
|
158
|
+
}
|
|
159
|
+
// Report on completion so the counter climbs monotonically under concurrency.
|
|
160
|
+
opts.onProgress?.({ index: done++, total: files.length, node: path });
|
|
161
|
+
// Flush partial crux to disk periodically, so a killed --deep run keeps what it
|
|
162
|
+
// has already computed (#128). Throttled by wall-clock; the caller's checkpoint
|
|
163
|
+
// writes wiring.json atomically, and the next run folds it back in by body_hash.
|
|
164
|
+
if (opts.checkpoint && Date.now() - lastCheckpoint >= flushEvery) {
|
|
165
|
+
lastCheckpoint = Date.now();
|
|
166
|
+
opts.checkpoint();
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
stats.failedFiles = gate.failed;
|
|
170
|
+
stats.skippedFiles = gate.skipped;
|
|
171
|
+
stats.fatal = gate.fatal;
|
|
172
|
+
return stats;
|
|
173
|
+
}
|
|
174
|
+
/** Run `fn` over `items` with at most `limit` in flight, preserving result order. */
|
|
175
|
+
async function mapWithConcurrency(items, limit, fn) {
|
|
176
|
+
const results = new Array(items.length);
|
|
177
|
+
let next = 0;
|
|
178
|
+
const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
179
|
+
while (next < items.length) {
|
|
180
|
+
const i = next++;
|
|
181
|
+
results[i] = await fn(items[i], i);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
await Promise.all(workers);
|
|
185
|
+
return results;
|
|
186
|
+
}
|
|
187
|
+
function cruxMissMessage(summarizer, fallback) {
|
|
188
|
+
const miss = summarizer.lastMiss;
|
|
189
|
+
return formatCruxMiss(miss?.kind ?? fallback, miss?.finishReason ?? null);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Describe every requested definition in a file, re-asking for any the model
|
|
193
|
+
* omits (it sometimes drops entries from a batch). Returns whatever it collected
|
|
194
|
+
* plus the last error, if any — partial results are kept, not discarded.
|
|
195
|
+
*/
|
|
196
|
+
async function collectFileCrux(summarizer, path, source, refs) {
|
|
197
|
+
const results = new Map();
|
|
198
|
+
let missing = refs;
|
|
199
|
+
let error;
|
|
200
|
+
for (let attempt = 0; attempt < 2 && missing.length > 0; attempt++) {
|
|
201
|
+
try {
|
|
202
|
+
const list = await summarizer.describeFile({ path, source, nodes: missing });
|
|
203
|
+
for (const r of list)
|
|
204
|
+
if (!results.has(r.id))
|
|
205
|
+
results.set(r.id, r);
|
|
206
|
+
missing = refs.filter((r) => !results.has(r.id));
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
error = err instanceof Error ? err.message : String(err);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// A total miss used to return `{ results: ∅ }` with no error — enrich left
|
|
214
|
+
// every node `pending`, the CLI exited 0, and `julius check` told the user to
|
|
215
|
+
// re-run `--deep` forever (#172). Surface it as a failure like a thrown error.
|
|
216
|
+
// Content-quality, not quota: count the file, keep going (#235).
|
|
217
|
+
if (!error && refs.length > 0 && results.size === 0) {
|
|
218
|
+
return { results, error: cruxMissMessage(summarizer, "empty-toolCalls"), quality: true };
|
|
219
|
+
}
|
|
220
|
+
return { results, error };
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Cut the crux text verbatim from the file using the model's file-absolute line
|
|
224
|
+
* range, clamped to the node's own span. Returns null when the model reported no
|
|
225
|
+
* distinct crux (0/0) or gave an unusable range.
|
|
226
|
+
*/
|
|
227
|
+
function buildCrux(r, node, source, lineCount) {
|
|
228
|
+
// 0/0 (or an invalid range) is the model saying "nothing to highlight here".
|
|
229
|
+
if (r.crux_start < 1 || r.crux_end < r.crux_start)
|
|
230
|
+
return null;
|
|
231
|
+
const [nodeStart, nodeEnd] = spanLines(node.span, lineCount);
|
|
232
|
+
const start = Math.max(nodeStart, Math.min(r.crux_start, nodeEnd));
|
|
233
|
+
let end = Math.max(start, Math.min(r.crux_end, nodeEnd));
|
|
234
|
+
// Keep the crux readable: if the model pointed at a big region, store its
|
|
235
|
+
// leading slice (the anchor it chose) rather than the whole blob — still the
|
|
236
|
+
// most important part, and the full definition is reachable via node.span.
|
|
237
|
+
if (end - start + 1 > MAX_CRUX_LINES)
|
|
238
|
+
end = start + MAX_CRUX_LINES - 1;
|
|
239
|
+
const code = source.split("\n").slice(start - 1, end).join("\n");
|
|
240
|
+
if (!code.trim())
|
|
241
|
+
return null;
|
|
242
|
+
return { code, span: `L${start}-L${end}` };
|
|
243
|
+
}
|
|
244
|
+
/** Parse a `"L12-L30"` span into a clamped [start, end] line pair (1-based). */
|
|
245
|
+
function spanLines(span, fileLines) {
|
|
246
|
+
const m = /^L(\d+)-L(\d+)$/.exec(span);
|
|
247
|
+
if (!m)
|
|
248
|
+
return [1, fileLines];
|
|
249
|
+
const start = Math.max(1, Math.min(Number(m[1]), fileLines));
|
|
250
|
+
const end = Math.max(start, Math.min(Number(m[2]), fileLines));
|
|
251
|
+
return [start, end];
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=enrich.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enrich.js","sourceRoot":"","sources":["../../src/graph/enrich.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,cAAc,EAAuE,MAAM,eAAe,CAAC;AACpH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,iFAAiF;AACjF,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,qFAAqF;AACrF,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAmB9B;;yBAEyB;AACzB,SAAS,YAAY;IACnB,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,KAAK,CAAC,CAAC;AAChE,CAAC;AAoBD,MAAM,CAAC,KAAK,UAA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,CAAC;IAEvE,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,KAAK,KAAK,GAAG,EAAE,EAAE,CAAC;AAC7C,CAAC;AAED,gFAAgF;AAChF,SAAS,SAAS,CAAC,IAAY,EAAE,SAAiB;IAChD,MAAM,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { RawEdge } from "./extract.js";
|
|
2
|
+
import type { NodeV1 } from "./types.js";
|
|
3
|
+
export declare const EXTRACT_CACHE_PREFIX = "extract";
|
|
4
|
+
export interface ExtractEntry {
|
|
5
|
+
size: number;
|
|
6
|
+
mtimeMs: number;
|
|
7
|
+
/** sha256 of the file's bytes — the same value as its `kind:"file"` node's `body_hash`. */
|
|
8
|
+
hash: string;
|
|
9
|
+
nodes: NodeV1[];
|
|
10
|
+
rawEdges: RawEdge[];
|
|
11
|
+
/** Set when this file couldn't be read or parsed. The entry exists anyway so the
|
|
12
|
+
* freshness probe doesn't flag the file as new on every query; replaying it
|
|
13
|
+
* re-reports the same error and contributes no nodes, exactly as a cold build
|
|
14
|
+
* would. */
|
|
15
|
+
error?: string;
|
|
16
|
+
/** The breadth-tier grammar that parsed this file standing in for its depth-tier
|
|
17
|
+
* one, whose native grammar didn't load. Absent for every other file. The entry is
|
|
18
|
+
* replayed only while the same stand-in would parse it again. */
|
|
19
|
+
via?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ExtractCache {
|
|
22
|
+
version: number;
|
|
23
|
+
/** Identity of the extractor that produced these entries. */
|
|
24
|
+
extractor: string;
|
|
25
|
+
/** repo-relative source path → its last parse. */
|
|
26
|
+
files: Record<string, ExtractEntry>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Where this julius's memo lives: `<outDir>/.cache/extract.<stamp>.json`.
|
|
30
|
+
*
|
|
31
|
+
* The stamp is in the *filename*, not just inside the file, so two juliuss working
|
|
32
|
+
* on one repo keep separate memos instead of evicting each other. That is the
|
|
33
|
+
* default install, not an exotic case: `julius init` wires the MCP server as
|
|
34
|
+
* `npx -y @ruverd/julius` (which resolves the latest published version) while the
|
|
35
|
+
* Claude Code hooks run the locally installed one. The moment those two versions
|
|
36
|
+
* differ, a single shared file means the prompt hook and every MCP retrieval take
|
|
37
|
+
* turns rejecting each other's entries and cold-re-parsing the whole repo — the memo
|
|
38
|
+
* would never help anyone.
|
|
39
|
+
*
|
|
40
|
+
* Null stamp → null path → no memo at all. See {@link extractorStamp}.
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractCachePath(outDir: string): string | null;
|
|
43
|
+
/** Keep `.cache/` from growing a file per version forever: after writing, drop all
|
|
44
|
+
* but the newest `keep` files sharing a prefix. Best-effort and never fatal — this
|
|
45
|
+
* is a cache directory, and a failure here costs disk, not correctness. */
|
|
46
|
+
export declare function pruneSidecars(cacheDir: string, prefix: string, keep?: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* Identity of the code that produces the cached parses. Both sidecars key on it,
|
|
49
|
+
* so *anything* that can change extraction output has to change this string.
|
|
50
|
+
*
|
|
51
|
+
* Content-hashed over every sibling module in this directory, plus the package
|
|
52
|
+
* version. Two earlier instincts are deliberately rejected:
|
|
53
|
+
*
|
|
54
|
+
* - **Not a timestamp.** This was `mtime:size` of `extract.js` alone, which is
|
|
55
|
+
* wrong in both directions. Too loose: the parse of `db.count()` depends on
|
|
56
|
+
* `bindings.ts` deciding that `db` is a `UserRepo` (that answer is stored *in*
|
|
57
|
+
* the cached entry, as an edge's `recvType`), and fixing a binding bug leaves
|
|
58
|
+
* `extract.js`'s emitted bytes untouched — so any build that skips rewriting
|
|
59
|
+
* unchanged output keeps the old stamp and silently replays pre-fix edges. Too
|
|
60
|
+
* tight: a rebuild that rewrites identical content moves the mtime and throws
|
|
61
|
+
* away the whole memo for nothing.
|
|
62
|
+
* - **Not a hand-kept list of modules.** A list is correct exactly until someone
|
|
63
|
+
* moves parse logic into a module nobody added to it, and the failure is silent.
|
|
64
|
+
*
|
|
65
|
+
* Hashing the directory over-invalidates a little — editing any `graph/` module
|
|
66
|
+
* costs one cold rebuild — which is no more often than a version bump already
|
|
67
|
+
* costs, and always in the safe direction. The package version is folded in so a
|
|
68
|
+
* tree-sitter grammar upgrade (which changes parse output without changing any of
|
|
69
|
+
* julius's own files) invalidates too.
|
|
70
|
+
*
|
|
71
|
+
* Measured at ~0.5ms for 21 files / 556KB, paid once per process.
|
|
72
|
+
*
|
|
73
|
+
* **Null when no identity can be established at all**, and that is deliberately not
|
|
74
|
+
* a string. It used to return `"unknown"` on failure — but `"unknown"` was then
|
|
75
|
+
* *written into the sidecars as a real identity*, and every later run compared equal
|
|
76
|
+
* to it, so any environment where stamping fails (a `pkg`/`bun-compile` single-file
|
|
77
|
+
* build, an asar-style read, a directory that can't be listed) permanently lost the
|
|
78
|
+
* ability to notice an extractor change. A sentinel that doubles as a valid value
|
|
79
|
+
* silently disables the whole mechanism. Null forces callers to decide instead, and
|
|
80
|
+
* {@link extractCachePath} decides not to have a memo.
|
|
81
|
+
*/
|
|
82
|
+
export declare function extractorStamp(): string | null;
|
|
83
|
+
/**
|
|
84
|
+
* Hash every `ext` file in `dir`, plus `version`. Null when the directory holds no
|
|
85
|
+
* such file. Separated from {@link extractorStamp} so a test can prove the property
|
|
86
|
+
* that matters: a change to *any* module in the directory moves the stamp, not just
|
|
87
|
+
* the one the old implementation happened to watch.
|
|
88
|
+
*/
|
|
89
|
+
export declare function stampDir(dir: string, ext: string, version?: string): string | null;
|
|
90
|
+
export declare function emptyExtractCache(): ExtractCache;
|
|
91
|
+
/** The cache for `outDir`, or an empty one when it's absent, unparseable, written by
|
|
92
|
+
* a different cache version, or when this julius has no identity to key on (then
|
|
93
|
+
* every build is cold, which is slow but never wrong). The stamp is in the filename,
|
|
94
|
+
* so the `extractor` field is a second check rather than the only one. */
|
|
95
|
+
export declare function readExtractCache(outDir: string): ExtractCache;
|
|
96
|
+
/** Best-effort write — a full graph is already on disk by the time this runs, so an
|
|
97
|
+
* unwritable cache dir must never fail the build (it only costs the next build its
|
|
98
|
+
* reuse). Returns false when nothing was written, including the deliberate case of
|
|
99
|
+
* having no extractor identity: a parse we can't attribute must never be replayed. */
|
|
100
|
+
export declare function writeExtractCache(outDir: string, cache: ExtractCache): boolean;
|
|
101
|
+
//# sourceMappingURL=extract-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract-cache.d.ts","sourceRoot":"","sources":["../../src/graph/extract-cache.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIzC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EA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