@ruverd/julius 0.0.0-stage → 0.24.1
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 +47 -0
- package/CREDITS.md +25 -0
- package/LICENSE +21 -0
- package/PROVENANCE.md +9 -0
- package/README.md +229 -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 +68 -0
- package/dist/economy/index.d.ts.map +1 -0
- package/dist/economy/index.js +524 -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 +346 -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 +37 -0
- package/dist/search/grep-cli.d.ts.map +1 -0
- package/dist/search/grep-cli.js +119 -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,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a PR touched, read from git: changed files plus the *line ranges* inside
|
|
3
|
+
* them, which is what turns a diff into graph seeds (an enclosing-symbol lookup
|
|
4
|
+
* per changed line, see `blast.ts`).
|
|
5
|
+
*
|
|
6
|
+
* Git is shelled out to rather than parsed from a library because the CI job
|
|
7
|
+
* this feeds already has git — and `--unified=0` gives exactly the post-image
|
|
8
|
+
* line ranges we need, with no context lines to subtract back out.
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from "node:child_process";
|
|
11
|
+
import { resolve } from "node:path";
|
|
12
|
+
const HUNK_RE = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/;
|
|
13
|
+
/** Text kept per hunk, and per file. A regenerated lockfile is one hunk of 40,000
|
|
14
|
+
* lines: the ranges still matter (they seed the graph), the text does not, and it
|
|
15
|
+
* would otherwise ride along in `--format json` and in every exported page. */
|
|
16
|
+
const MAX_HUNK_LINES = 24;
|
|
17
|
+
const MAX_FILE_LINES = 200;
|
|
18
|
+
/** Run git in `root`, or return null when git fails (not a repo, unknown ref). */
|
|
19
|
+
function git(root, args) {
|
|
20
|
+
const res = spawnSync("git", ["-c", "core.quotePath=false", ...args], {
|
|
21
|
+
cwd: root,
|
|
22
|
+
encoding: "utf8",
|
|
23
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
24
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
25
|
+
});
|
|
26
|
+
if (res.error || res.status !== 0 || typeof res.stdout !== "string")
|
|
27
|
+
return null;
|
|
28
|
+
return res.stdout;
|
|
29
|
+
}
|
|
30
|
+
/** True when `ref` names something git can resolve — checked before diffing so
|
|
31
|
+
* an unknown `--base` fails with a caller-facing message, not a git stack. */
|
|
32
|
+
export function refExists(root, ref) {
|
|
33
|
+
return git(resolve(root), ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]) !== null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The diff arguments for a base ref, and the label to show for it.
|
|
37
|
+
*
|
|
38
|
+
* `<base>...HEAD` (three dots) diffs against the MERGE BASE, not the tip of the
|
|
39
|
+
* base branch — the difference matters on every PR whose base branch moved after
|
|
40
|
+
* it was cut: two-dot would attribute other people's merges to this PR and
|
|
41
|
+
* inflate the blast radius with files the author never touched.
|
|
42
|
+
*/
|
|
43
|
+
function rangeArgs(base) {
|
|
44
|
+
return { args: [`${base}...HEAD`], basis: `${base}...HEAD` };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Changed files + post-image line ranges.
|
|
48
|
+
*
|
|
49
|
+
* With no `base` this reports the working tree against HEAD (the local
|
|
50
|
+
* "what am I about to push" case), falling back to the last commit when the
|
|
51
|
+
* tree is clean — so the command answers something useful when run by hand,
|
|
52
|
+
* and CI passes `--base` for the real PR range.
|
|
53
|
+
*/
|
|
54
|
+
export function changedFiles(root, base) {
|
|
55
|
+
const dir = resolve(root);
|
|
56
|
+
if (base !== undefined) {
|
|
57
|
+
const { args, basis } = rangeArgs(base);
|
|
58
|
+
const files = diffFiles(dir, args);
|
|
59
|
+
return files === null ? null : { basis, files };
|
|
60
|
+
}
|
|
61
|
+
const working = diffFiles(dir, ["HEAD"]);
|
|
62
|
+
if (working === null)
|
|
63
|
+
return null;
|
|
64
|
+
if (working.length > 0)
|
|
65
|
+
return { basis: "working tree vs HEAD", files: working };
|
|
66
|
+
const last = diffFiles(dir, ["HEAD~1...HEAD"]);
|
|
67
|
+
if (last === null)
|
|
68
|
+
return { basis: "working tree vs HEAD", files: [] };
|
|
69
|
+
return { basis: "HEAD~1...HEAD", files: last };
|
|
70
|
+
}
|
|
71
|
+
/** Both git passes for one range: name-status (statuses, renames) then hunks. */
|
|
72
|
+
function diffFiles(dir, range) {
|
|
73
|
+
const status = git(dir, ["diff", "--name-status", "--find-renames", "-z", ...range, "--"]);
|
|
74
|
+
if (status === null)
|
|
75
|
+
return null;
|
|
76
|
+
const files = parseNameStatus(status);
|
|
77
|
+
if (files.length === 0)
|
|
78
|
+
return files;
|
|
79
|
+
const patch = git(dir, [
|
|
80
|
+
"diff",
|
|
81
|
+
"--unified=0",
|
|
82
|
+
"--no-color",
|
|
83
|
+
"--no-ext-diff",
|
|
84
|
+
"--find-renames",
|
|
85
|
+
...range,
|
|
86
|
+
"--",
|
|
87
|
+
]);
|
|
88
|
+
if (patch !== null)
|
|
89
|
+
applyHunks(files, patch);
|
|
90
|
+
return files;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* `--name-status -z` output: NUL-separated fields, where a rename spends THREE
|
|
94
|
+
* fields (`R096`, old, new) and everything else spends two. Splitting on NUL and
|
|
95
|
+
* walking with a cursor is the only way to read it — a line-oriented parse
|
|
96
|
+
* silently pairs a rename's old path with the next file's status.
|
|
97
|
+
*/
|
|
98
|
+
function parseNameStatus(out) {
|
|
99
|
+
const fields = out.split("\0").filter((f) => f !== "");
|
|
100
|
+
const files = [];
|
|
101
|
+
for (let i = 0; i < fields.length;) {
|
|
102
|
+
const code = fields[i++];
|
|
103
|
+
if (code.startsWith("R") || code.startsWith("C")) {
|
|
104
|
+
const oldPath = fields[i++];
|
|
105
|
+
const path = fields[i++];
|
|
106
|
+
if (path === undefined)
|
|
107
|
+
break;
|
|
108
|
+
files.push({ path, status: "renamed", oldPath, ranges: [], hunks: [] });
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const path = fields[i++];
|
|
112
|
+
if (path === undefined)
|
|
113
|
+
break;
|
|
114
|
+
if (code.startsWith("A"))
|
|
115
|
+
files.push({ path, status: "added", ranges: [], hunks: [] });
|
|
116
|
+
else if (code.startsWith("D"))
|
|
117
|
+
files.push({ path, status: "deleted", ranges: [], hunks: [] });
|
|
118
|
+
else
|
|
119
|
+
files.push({ path, status: "modified", ranges: [], hunks: [] });
|
|
120
|
+
}
|
|
121
|
+
return files;
|
|
122
|
+
}
|
|
123
|
+
/** Attach each hunk's post-image range — and its text — to its file. */
|
|
124
|
+
function applyHunks(files, patch) {
|
|
125
|
+
const byPath = new Map(files.map((f) => [f.path, f]));
|
|
126
|
+
let current;
|
|
127
|
+
let hunk;
|
|
128
|
+
/** Post-image number for the next `+` line of the open hunk. */
|
|
129
|
+
let next = 0;
|
|
130
|
+
let kept = 0;
|
|
131
|
+
for (const line of patch.split("\n")) {
|
|
132
|
+
// Every file starts with this, and a content line cannot: a deleted one begins
|
|
133
|
+
// with `-`. Closing the open hunk here is what stops the NEXT file's `--- a/x`
|
|
134
|
+
// header being absorbed as a deleted line of the previous hunk.
|
|
135
|
+
if (line.startsWith("diff --git ")) {
|
|
136
|
+
current = undefined;
|
|
137
|
+
hunk = undefined;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (line.startsWith("+++ ")) {
|
|
141
|
+
const raw = line.slice(4);
|
|
142
|
+
current = raw === "/dev/null" ? undefined : byPath.get(stripPrefix(raw));
|
|
143
|
+
hunk = undefined;
|
|
144
|
+
kept = 0;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (line.startsWith("@@")) {
|
|
148
|
+
hunk = undefined;
|
|
149
|
+
if (!current)
|
|
150
|
+
continue;
|
|
151
|
+
const m = HUNK_RE.exec(line);
|
|
152
|
+
if (!m)
|
|
153
|
+
continue;
|
|
154
|
+
const start = Number(m[1]);
|
|
155
|
+
// `+N,0` is a pure deletion: nothing survives in the post-image, and git
|
|
156
|
+
// reports the line BEFORE the gap. Recording that single line is what keeps
|
|
157
|
+
// "the body of foo() lost 10 lines" attributable to foo() at all.
|
|
158
|
+
const count = m[2] === undefined ? 1 : Number(m[2]);
|
|
159
|
+
const range = count === 0 ? { start, end: start } : { start, end: start + count - 1 };
|
|
160
|
+
hunk = { ...range, lines: [], dropped: 0 };
|
|
161
|
+
current.ranges.push(range);
|
|
162
|
+
current.hunks.push(hunk);
|
|
163
|
+
next = start;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (!hunk)
|
|
167
|
+
continue;
|
|
168
|
+
// With `--unified=0` every line inside a hunk is an edit, so there is no
|
|
169
|
+
// context to skip. `+++`/`---` headers are already consumed above; a bare
|
|
170
|
+
// `--- a/x` for the next file arrives before its `+++`, and the `!hunk`
|
|
171
|
+
// guard on a fresh file keeps it out.
|
|
172
|
+
if (line.startsWith("+")) {
|
|
173
|
+
pushLine(hunk, { n: next, sign: "+", text: line.slice(1) }, kept++ < MAX_FILE_LINES);
|
|
174
|
+
next += 1;
|
|
175
|
+
}
|
|
176
|
+
else if (line.startsWith("-")) {
|
|
177
|
+
pushLine(hunk, { n: null, sign: "-", text: line.slice(1) }, kept++ < MAX_FILE_LINES);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function pushLine(hunk, line, withinFile) {
|
|
182
|
+
if (!withinFile || hunk.lines.length >= MAX_HUNK_LINES) {
|
|
183
|
+
hunk.dropped += 1;
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
hunk.lines.push(line);
|
|
187
|
+
}
|
|
188
|
+
/** `b/src/x.ts` → `src/x.ts`, minus any trailing tab-separated timestamp. */
|
|
189
|
+
function stripPrefix(raw) {
|
|
190
|
+
const untabbed = raw.split("\t")[0];
|
|
191
|
+
return untabbed.startsWith("b/") ? untabbed.slice(2) : untabbed;
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/blast/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgDpC,MAAM,OAAO,GAAG,yCAAyC,CAAC;AAE1D;;+EAE+E;AAC/E,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,kFAAkF;AAClF,SAAS,GAAG,CAAC,IAAY,EAAE,IAAc;IACvC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC,EAAE;QACpE,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;KAC5B,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACjF,OAAO,GAAG,CAAC,MAAM,CAAC;AACpB,CAAC;AAED;8EAC8E;AAC9E,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,GAAW;IACjD,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,GAAG,WAAW,C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QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,OAAO,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Evidence } from "../viz/assemble.js";
|
|
2
|
+
import type { Impacted, Seed } from "./blast.js";
|
|
3
|
+
import type { ChangedFile } from "./diff.js";
|
|
4
|
+
/** Symbols given their own snippet per node. Past this the panel is a file listing
|
|
5
|
+
* rather than a summary — the rest are still counted in the headline. */
|
|
6
|
+
export declare const MAX_EVIDENCE = 4;
|
|
7
|
+
/** `L12-L34` → the numbers, so a label is something a reader can type. */
|
|
8
|
+
export declare function spanRange(span: string): {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
} | null;
|
|
12
|
+
/** Evidence for one changed symbol: what this PR did to it. */
|
|
13
|
+
export declare function seedEvidence(seed: Seed, file: ChangedFile | undefined): Evidence | null;
|
|
14
|
+
/**
|
|
15
|
+
* The first line inside a span that mentions one of `needles`, with its number.
|
|
16
|
+
*
|
|
17
|
+
* This is the whole trick behind "why is this symbol here": the edge says A calls
|
|
18
|
+
* B, and this finds the line where it does it. Shared so `blast`'s panel, its
|
|
19
|
+
* comment and `julius callers` all quote the same line for the same edge.
|
|
20
|
+
*/
|
|
21
|
+
export declare function referenceLine(path: string, span: string, needles: RegExp[], read: (path: string) => string[] | null): {
|
|
22
|
+
n: number;
|
|
23
|
+
text: string;
|
|
24
|
+
} | null;
|
|
25
|
+
/** A symbol name, matched as a whole word — `export` must not hit `exportViz`. */
|
|
26
|
+
export declare const wordRe: (name: string) => RegExp;
|
|
27
|
+
/**
|
|
28
|
+
* Evidence for one dependent symbol: the line that reaches the diff.
|
|
29
|
+
*
|
|
30
|
+
* Nothing changed here, so there is no hunk to show — the useful line is the one
|
|
31
|
+
* naming a changed symbol or module, which answers "why am I in this blast radius
|
|
32
|
+
* at all". Found by reading the symbol's span off disk.
|
|
33
|
+
*
|
|
34
|
+
* When no line names the diff, this returns nothing rather than quoting the span's
|
|
35
|
+
* first line: for a file-level dependent that first line is `/**`, and a panel that
|
|
36
|
+
* shows it has spent a code block to say nothing.
|
|
37
|
+
*/
|
|
38
|
+
export declare function impactedEvidence(sym: Impacted, reach: ReachTerms, read: (path: string) => string[] | null): Evidence | null;
|
|
39
|
+
/** What a line has to mention to be the line that reaches the diff. */
|
|
40
|
+
export interface ReachTerms {
|
|
41
|
+
/** Changed symbol names, longest first. */
|
|
42
|
+
names: string[];
|
|
43
|
+
/** `from "./data.js"` for each changed file, matched on the module specifier so
|
|
44
|
+
* a common stem like `data` cannot match a variable of the same name. */
|
|
45
|
+
modules: RegExp[];
|
|
46
|
+
}
|
|
47
|
+
export declare function reachTerms(seeds: Seed[], changed: ChangedFile[]): ReachTerms;
|
|
48
|
+
/** Read each file once, and never fail: a snippet is a nicety, and a symbol whose
|
|
49
|
+
* file moved under us must not take the whole page down. */
|
|
50
|
+
export declare function fileReader(root: string | undefined): (path: string) => string[] | null;
|
|
51
|
+
//# sourceMappingURL=evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../src/blast/evidence.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,WAAW,CAAC;AAIvD;yEACyE;AACzE,eAAO,MAAM,YAAY,IAAI,CAAC;AAK9B,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,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ols reach them
|
|
5
|
+
* (the walk), and both the hosted panel and the PR comment want to SHOW that
|
|
6
|
+
* rather than cite a line number the reader has to go and look up. The shaping
|
|
7
|
+
* lives here so the two surfaces quote the same lines: a comment that disagreed
|
|
8
|
+
* with the page it links to would be worse than one that said less.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
13
|
+
/** Symbols given their own snippet per node. Past this the panel is a file listing
|
|
14
|
+
* rather than a summary — the rest are still counted in the headline. */
|
|
15
|
+
export const MAX_EVIDENCE = 4;
|
|
16
|
+
/** Lines shown per snippet before it folds. A handful is a hunk you can read at a
|
|
17
|
+
* glance; a 30-line refactor is a diff view's job, not a panel's. */
|
|
18
|
+
const MAX_LINES = 6;
|
|
19
|
+
/** `L12-L34` → the numbers, so a label is something a reader can type. */
|
|
20
|
+
export function spanRange(span) {
|
|
21
|
+
const m = /^L(\d+)(?:-L(\d+))?$/.exec(span);
|
|
22
|
+
if (!m)
|
|
23
|
+
return null;
|
|
24
|
+
const start = Number(m[1]);
|
|
25
|
+
return { start, end: m[2] === undefined ? start : Number(m[2]) };
|
|
26
|
+
}
|
|
27
|
+
function labelFor(name, path, span) {
|
|
28
|
+
const r = spanRange(span);
|
|
29
|
+
return r ? `${name} · ${path}:${r.start}-${r.end}` : `${name} · ${path}`;
|
|
30
|
+
}
|
|
31
|
+
/** Keep the first {@link MAX_LINES}, and say how many were left. */
|
|
32
|
+
function fold(lines) {
|
|
33
|
+
if (lines.length <= MAX_LINES)
|
|
34
|
+
return { lines };
|
|
35
|
+
return { lines: lines.slice(0, MAX_LINES), more: lines.length - MAX_LINES };
|
|
36
|
+
}
|
|
37
|
+
const asEvidenceLines = (lines) => lines.map((l) => ({ n: l.n, sign: l.sign, text: l.text }));
|
|
38
|
+
/**
|
|
39
|
+
* The hunks of `file` that fall inside `span`.
|
|
40
|
+
*
|
|
41
|
+
* A file's diff is split by symbol rather than shown whole, because two unrelated
|
|
42
|
+
* edits in one file are two answers — a panel that merges them makes the reader do
|
|
43
|
+
* the separating.
|
|
44
|
+
*/
|
|
45
|
+
function hunksIn(file, span) {
|
|
46
|
+
const out = [];
|
|
47
|
+
let dropped = 0;
|
|
48
|
+
for (const h of file.hunks) {
|
|
49
|
+
if (span && (h.end < span.start || h.start > span.end))
|
|
50
|
+
continue;
|
|
51
|
+
out.push(...asEvidenceLines(h.lines));
|
|
52
|
+
dropped += h.dropped;
|
|
53
|
+
}
|
|
54
|
+
return { lines: out, dropped };
|
|
55
|
+
}
|
|
56
|
+
/** Evidence for one changed symbol: what this PR did to it. */
|
|
57
|
+
export function seedEvidence(seed, file) {
|
|
58
|
+
if (!file)
|
|
59
|
+
return null;
|
|
60
|
+
const span = seed.wholeFile ? null : spanRange(seed.span);
|
|
61
|
+
const { lines, dropped } = hunksIn(file, span);
|
|
62
|
+
if (lines.length === 0 && dropped === 0)
|
|
63
|
+
return null;
|
|
64
|
+
const folded = fold(lines);
|
|
65
|
+
const more = (folded.more ?? 0) + dropped;
|
|
66
|
+
return {
|
|
67
|
+
label: seed.wholeFile ? seed.path : labelFor(seed.name, seed.path, seed.span),
|
|
68
|
+
note: file.status === "added" ? "new file" : seed.wholeFile ? "outside any symbol" : undefined,
|
|
69
|
+
lines: folded.lines,
|
|
70
|
+
more: more > 0 ? more : undefined,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
74
|
+
/**
|
|
75
|
+
* The first line inside a span that mentions one of `needles`, with its number.
|
|
76
|
+
*
|
|
77
|
+
* This is the whole trick behind "why is this symbol here": the edge says A calls
|
|
78
|
+
* B, and this finds the line where it does it. Shared so `blast`'s panel, its
|
|
79
|
+
* comment and `julius callers` all quote the same line for the same edge.
|
|
80
|
+
*/
|
|
81
|
+
export function referenceLine(path, span, needles, read) {
|
|
82
|
+
const range = spanRange(span);
|
|
83
|
+
const lines = read(path);
|
|
84
|
+
if (!range || !lines)
|
|
85
|
+
return null;
|
|
86
|
+
for (const [i, text] of lines.slice(range.start - 1, range.end).entries()) {
|
|
87
|
+
if (needles.some((re) => re.test(text)))
|
|
88
|
+
return { n: range.start + i, text };
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
/** A symbol name, matched as a whole word — `export` must not hit `exportViz`. */
|
|
93
|
+
export const wordRe = (name) => new RegExp(`\\b${escapeRe(name)}\\b`);
|
|
94
|
+
/**
|
|
95
|
+
* Evidence for one dependent symbol: the line that reaches the diff.
|
|
96
|
+
*
|
|
97
|
+
* Nothing changed here, so there is no hunk to show — the useful line is the one
|
|
98
|
+
* naming a changed symbol or module, which answers "why am I in this blast radius
|
|
99
|
+
* at all". Found by reading the symbol's span off disk.
|
|
100
|
+
*
|
|
101
|
+
* When no line names the diff, this returns nothing rather than quoting the span's
|
|
102
|
+
* first line: for a file-level dependent that first line is `/**`, and a panel that
|
|
103
|
+
* shows it has spent a code block to say nothing.
|
|
104
|
+
*/
|
|
105
|
+
export function impactedEvidence(sym, reach, read) {
|
|
106
|
+
// A changed symbol's own name is the strongest signal; a file-level dependent
|
|
107
|
+
// usually reaches the diff through its import line, which names a MODULE
|
|
108
|
+
// instead, so both are tried in that order.
|
|
109
|
+
const byName = referenceLine(sym.path, sym.span, reach.names.map(wordRe), read);
|
|
110
|
+
if (byName) {
|
|
111
|
+
const hit = reach.names.find((n) => wordRe(n).test(byName.text));
|
|
112
|
+
return {
|
|
113
|
+
label: labelFor(sym.name, sym.path, sym.span),
|
|
114
|
+
note: `${sym.relation} ${hit}`,
|
|
115
|
+
lines: [{ n: byName.n, sign: " ", text: byName.text }],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
const byModule = referenceLine(sym.path, sym.span, reach.modules, read);
|
|
119
|
+
if (byModule) {
|
|
120
|
+
return {
|
|
121
|
+
label: labelFor(sym.name, sym.path, sym.span),
|
|
122
|
+
note: sym.relation,
|
|
123
|
+
lines: [{ n: byModule.n, sign: " ", text: byModule.text }],
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
// No line names the diff — an indirect reach (a dynamic import, a re-export),
|
|
127
|
+
// or a symbol whose whole file is the span. Quoting its first line means
|
|
128
|
+
// quoting `/**`, so the block is dropped instead: the path stays in `sources`
|
|
129
|
+
// and the panel simply says less.
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
export function reachTerms(seeds, changed) {
|
|
133
|
+
const names = [...new Set(seeds.filter((s) => !s.wholeFile).map((s) => s.name))].sort((a, b) => b.length - a.length);
|
|
134
|
+
const stems = [...new Set(changed.map((f) => f.path.replace(/\.[^./]+$/, "").split("/").pop() ?? ""))].filter(Boolean);
|
|
135
|
+
return {
|
|
136
|
+
names,
|
|
137
|
+
modules: stems.map((stem) => new RegExp(`["'\`][^"'\`]*\\b${escapeRe(stem)}(\\.[a-z]+)?["'\`]`)),
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** Read each file once, and never fail: a snippet is a nicety, and a symbol whose
|
|
141
|
+
* file moved under us must not take the whole page down. */
|
|
142
|
+
export function fileReader(root) {
|
|
143
|
+
const cache = new Map();
|
|
144
|
+
return (path) => {
|
|
145
|
+
if (root === undefined)
|
|
146
|
+
return null;
|
|
147
|
+
const hit = cache.get(path);
|
|
148
|
+
if (hit !== undefined)
|
|
149
|
+
return hit;
|
|
150
|
+
let lines = null;
|
|
151
|
+
try {
|
|
152
|
+
lines = readFileSync(join(root, path), "utf8").split("\n");
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// Deleted, renamed under us, or unreadable: no snippet, no failure.
|
|
156
|
+
lines = null;
|
|
157
|
+
}
|
|
158
|
+
cache.set(path, lines);
|
|
159
|
+
return lines;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0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AC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvH,OAAO;QACL,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,oBAAoB,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;KACjG,CAAC;AACJ,CAAC;AAED;4DAC4D;AAC5D,MAAM,UAAU,UAAU,CAAC,IAAwB;IACjD,MAAM,KAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;IACjD,OAAO,CAAC,IAAY,EAAE,EAAE;QACtB,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACpC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,GAAG,CAAC;QAClC,IAAI,KAAK,GAAoB,IAAI,CAAC;QAClC,IAAI,CAAC;YACH,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7D,CAAC;QAAC,MAAM,CAAC;YACP,oEAAoE;YACpE,KAAK,GAAG,IAAI,CAAC;QACf,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACvB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ModuleIndex {
|
|
2
|
+
/** Label for a repo-relative path — a concept name when one claims the file. */
|
|
3
|
+
labelOf(path: string): string;
|
|
4
|
+
/** The claiming concept's name, or null when only the directory fallback applies.
|
|
5
|
+
* Callers that group files need to tell the two apart: a shared concept is a real
|
|
6
|
+
* grouping signal, a shared directory is only a shared directory. */
|
|
7
|
+
conceptOf(path: string): string | null;
|
|
8
|
+
/** True when at least one concept node was read (i.e. a --deep graph). */
|
|
9
|
+
hasConcepts: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Build the path → module-label lookup for a context dir.
|
|
13
|
+
*
|
|
14
|
+
* A file can be cited by several concepts; the SMALLEST claiming concept wins.
|
|
15
|
+
* A concept grounded in three files says something specific about those three,
|
|
16
|
+
* while a forty-file concept is closer to "the codebase" — picking the tighter
|
|
17
|
+
* one keeps the diagram's boxes meaningful.
|
|
18
|
+
*/
|
|
19
|
+
export declare function moduleIndex(contextDir: string): ModuleIndex;
|
|
20
|
+
/**
|
|
21
|
+
* A concept name trimmed to fit a node.
|
|
22
|
+
*
|
|
23
|
+
* Concept names are written for a reader with the whole file in front of them, so
|
|
24
|
+
* they run long and some carry a `Concept: ` prefix from the synthesis prompt.
|
|
25
|
+
* "Reciprocal-Rank Fusion for Workspace Federation" is a fine node title in `julius
|
|
26
|
+
* viz` and unreadable inside a circle.
|
|
27
|
+
*/
|
|
28
|
+
export declare function shortLabel(label: string): string;
|
|
29
|
+
/** The parent directory of a directory label, or "" at the top level. */
|
|
30
|
+
export declare function parentDir(dir: string): string;
|
|
31
|
+
/** Fallback label: the file's directory, or `(root)` for a top-level file. */
|
|
32
|
+
export declare function dirLabel(path: string): string;
|
|
33
|
+
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../src/blast/modules.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,WAAW;IAC1B,gFAAgF;IAChF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B;;yEAEqE;IACrE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,0EAA0E;IAC1E,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAiB3D;AAeD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAWhD;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG7C"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module labels for the blast diagram — the "what part of the system is this?"
|
|
3
|
+
* layer, so a reviewer reads `Graph Extraction and Loading` instead of eleven
|
|
4
|
+
* file paths.
|
|
5
|
+
*
|
|
6
|
+
* Two sources, best first:
|
|
7
|
+
* 1. the deep tier's concept nodes (`julius/*.md`), whose frontmatter lists the
|
|
8
|
+
* source files each concept was synthesized from. This is why `blast` is
|
|
9
|
+
* worth running on a `build --deep` graph: the grouping is the product.
|
|
10
|
+
* 2. the file's directory, when no concept claims it (a breadth-tier graph, or
|
|
11
|
+
* a file added by this very PR and therefore absent from the concept layer).
|
|
12
|
+
*/
|
|
13
|
+
import { readNodes } from "../context/node-file.js";
|
|
14
|
+
/**
|
|
15
|
+
* Build the path → module-label lookup for a context dir.
|
|
16
|
+
*
|
|
17
|
+
* A file can be cited by several concepts; the SMALLEST claiming concept wins.
|
|
18
|
+
* A concept grounded in three files says something specific about those three,
|
|
19
|
+
* while a forty-file concept is closer to "the codebase" — picking the tighter
|
|
20
|
+
* one keeps the diagram's boxes meaningful.
|
|
21
|
+
*/
|
|
22
|
+
export function moduleIndex(contextDir) {
|
|
23
|
+
const claims = new Map();
|
|
24
|
+
const nodes = readNodes(contextDir);
|
|
25
|
+
for (const node of nodes) {
|
|
26
|
+
if (!node.name)
|
|
27
|
+
continue;
|
|
28
|
+
for (const src of node.sources) {
|
|
29
|
+
const prev = claims.get(src.path);
|
|
30
|
+
if (!prev || node.sources.length < prev.size) {
|
|
31
|
+
claims.set(src.path, { label: node.name, size: node.sources.length });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
hasConcepts: nodes.length > 0,
|
|
37
|
+
labelOf: (path) => shortLabel(claims.get(path)?.label ?? dirLabel(path)),
|
|
38
|
+
conceptOf: (path) => claims.get(path)?.label ?? null,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** Longest label a circle can hold before the text overruns it. */
|
|
42
|
+
const MAX_LABEL = 30;
|
|
43
|
+
/**
|
|
44
|
+
* Clause breaks a long concept name can be cut at.
|
|
45
|
+
*
|
|
46
|
+
* A concept name is a sentence fragment, so it has real joints: everything after
|
|
47
|
+
* "via", "and", a colon or an opening parenthesis is elaboration. Cutting there
|
|
48
|
+
* leaves a phrase that still reads as a name — "Incremental Build" rather than
|
|
49
|
+
* "Incremental Build via…" — which is why these cuts take no ellipsis.
|
|
50
|
+
*/
|
|
51
|
+
const CLAUSE_BREAK = /\s(?:\(|—|-\s)|:\s|\s(?:via|and|for|with|using|in|across|over|from|of|by|to)\s/i;
|
|
52
|
+
/**
|
|
53
|
+
* A concept name trimmed to fit a node.
|
|
54
|
+
*
|
|
55
|
+
* Concept names are written for a reader with the whole file in front of them, so
|
|
56
|
+
* they run long and some carry a `Concept: ` prefix from the synthesis prompt.
|
|
57
|
+
* "Reciprocal-Rank Fusion for Workspace Federation" is a fine node title in `julius
|
|
58
|
+
* viz` and unreadable inside a circle.
|
|
59
|
+
*/
|
|
60
|
+
export function shortLabel(label) {
|
|
61
|
+
const bare = label.replace(/^concepts?:\s*/i, "").trim();
|
|
62
|
+
if (bare.length <= MAX_LABEL)
|
|
63
|
+
return bare;
|
|
64
|
+
const at = CLAUSE_BREAK.exec(bare);
|
|
65
|
+
if (at && at.index >= 8 && at.index <= MAX_LABEL)
|
|
66
|
+
return bare.slice(0, at.index).trimEnd();
|
|
67
|
+
// No usable joint: a word-boundary cut, marked, because this one really does stop
|
|
68
|
+
// mid-phrase and a reader must not take the fragment for the whole name.
|
|
69
|
+
const cut = bare.lastIndexOf(" ", MAX_LABEL);
|
|
70
|
+
return `${bare.slice(0, cut > MAX_LABEL / 2 ? cut : MAX_LABEL).trimEnd()}…`;
|
|
71
|
+
}
|
|
72
|
+
/** The parent directory of a directory label, or "" at the top level. */
|
|
73
|
+
export function parentDir(dir) {
|
|
74
|
+
const trimmed = dir.replace(/\/$/, "");
|
|
75
|
+
const cut = trimmed.lastIndexOf("/");
|
|
76
|
+
return cut === -1 ? "" : `${trimmed.slice(0, cut)}/`;
|
|
77
|
+
}
|
|
78
|
+
/** Fallback label: the file's directory, or `(root)` for a top-level file. */
|
|
79
|
+
export function dirLabel(path) {
|
|
80
|
+
const cut = path.lastIndexOf("/");
|
|
81
|
+
return cut === -1 ? "(root)" : path.slice(0, cut) + "/";
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../src/blast/modules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAapD;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,UAAkB;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2C,CAAC;IAClE,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,SAAS;QACzB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IA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AAkF;IAClF,yEAAyE;IACzE,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC7C,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC;AAC9E,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC;AACvD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ChatModel } from "../ai/llm/types.js";
|
|
2
|
+
import type { GraphV1 } from "../graph/types.js";
|
|
3
|
+
import type { BlastReport } from "./blast.js";
|
|
4
|
+
/** One cluster to name: its identity, its files and the symbols inside it. */
|
|
5
|
+
export interface Cluster {
|
|
6
|
+
key: string;
|
|
7
|
+
files: string[];
|
|
8
|
+
symbols: string[];
|
|
9
|
+
}
|
|
10
|
+
/** Anything that can turn clusters into names. A model in production, a stub in tests. */
|
|
11
|
+
export interface Namer {
|
|
12
|
+
/** Names by cluster key. A key the namer chose not to name is simply absent. */
|
|
13
|
+
name(clusters: Cluster[]): Promise<Map<string, string>>;
|
|
14
|
+
}
|
|
15
|
+
export interface NameStats {
|
|
16
|
+
/** Labels taken from the cache, and labels that cost a call. */
|
|
17
|
+
cached: number;
|
|
18
|
+
named: number;
|
|
19
|
+
/** Clusters the namer declined ("mixed") or could not answer for. */
|
|
20
|
+
declined: number;
|
|
21
|
+
/** Set when naming was attempted and failed outright; the reason, for one line
|
|
22
|
+
* in the report. Never thrown: a comment without names still beats no comment. */
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
/** The production namer: one forced-tool call for every cluster at once. */
|
|
26
|
+
export declare class ChatNamer implements Namer {
|
|
27
|
+
private readonly model;
|
|
28
|
+
constructor(model: ChatModel);
|
|
29
|
+
name(clusters: Cluster[]): Promise<Map<string, string>>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A model-written string on its way into a Mermaid label and a markdown table.
|
|
33
|
+
*
|
|
34
|
+
* Symbol names from a fork's diff reach the prompt, so the answer is untrusted
|
|
35
|
+
* input: anything that could close a label, open a tag or start a table cell is
|
|
36
|
+
* stripped here rather than at each render site.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sanitize(raw: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* The cache key for a cluster: what it contains, not what it is called.
|
|
41
|
+
*
|
|
42
|
+
* Member paths pin the shape and each member's `body_hash` pins the content, so a
|
|
43
|
+
* cluster is renamed only when the code in it actually changes. Without this the
|
|
44
|
+
* same area gets a slightly different name on every PR and two comments stop being
|
|
45
|
+
* comparable — the failure the cache exists to prevent.
|
|
46
|
+
*/
|
|
47
|
+
export declare function clusterHash(files: string[], hashes: Map<string, string>): string;
|
|
48
|
+
export declare function loadNameCache(contextDir: string): Record<string, string>;
|
|
49
|
+
export declare function saveNameCache(contextDir: string, names: Record<string, string>): void;
|
|
50
|
+
/**
|
|
51
|
+
* Fill in labels for every cluster still sitting on its symbol backstop.
|
|
52
|
+
*
|
|
53
|
+
* Clusters already named by a concept node are left alone: a concept was written
|
|
54
|
+
* from whole file bodies, which is strictly more than the paths and symbol names
|
|
55
|
+
* this pass can see.
|
|
56
|
+
*/
|
|
57
|
+
export declare function applyNames(graph: GraphV1, report: BlastReport, opts: {
|
|
58
|
+
namer?: Namer;
|
|
59
|
+
contextDir: string;
|
|
60
|
+
}): Promise<NameStats>;
|
|
61
|
+
/**
|
|
62
|
+
* Name the clusters left on their symbol backstop, and say what it cost.
|
|
63
|
+
*
|
|
64
|
+
* Everything here is best-effort by construction: no key, a spent quota or a
|
|
65
|
+
* refused call leaves the backstop labels in place, because neither a PR check
|
|
66
|
+
* nor a review comment should fail over a cosmetic layer. The note comes back
|
|
67
|
+
* rather than going to a stream, so `julius blast --name` can prefix it and the
|
|
68
|
+
* App can log it against the pull request it belongs to.
|
|
69
|
+
*/
|
|
70
|
+
export declare function nameReport(graph: GraphV1, report: BlastReport, contextDir: string): Promise<{
|
|
71
|
+
stats: NameStats;
|
|
72
|
+
note: string | null;
|
|
73
|
+
}>;
|
|
74
|
+
//# sourceMappingURL=name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../src/blast/name.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAA+B,MAAM,YAAY,CAAC;AAG3E,8EAA8E;AAC9E,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,0FAA0F;AAC1F,MAAM,WAAW,KAAK;IACpB,gFAAgF;IAChF,IAAI,CAA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