@flyingrobots/graft 0.6.0 → 0.7.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/ADVANCED_GUIDE.md +52 -0
- package/CHANGELOG.md +142 -0
- package/GUIDE.md +53 -0
- package/README.md +1 -1
- package/dist/adapters/json-text-decoder.d.ts +3 -0
- package/dist/adapters/json-text-decoder.d.ts.map +1 -0
- package/dist/adapters/json-text-decoder.js +12 -0
- package/dist/adapters/json-text-decoder.js.map +1 -0
- package/dist/adapters/node-paths.d.ts +3 -0
- package/dist/adapters/node-paths.d.ts.map +1 -0
- package/dist/adapters/node-paths.js +29 -0
- package/dist/adapters/node-paths.js.map +1 -0
- package/dist/adapters/repo-paths.d.ts.map +1 -1
- package/dist/adapters/repo-paths.js +40 -5
- package/dist/adapters/repo-paths.js.map +1 -1
- package/dist/api/tool-bridge.d.ts +1 -1
- package/dist/api/tool-bridge.d.ts.map +1 -1
- package/dist/api/tool-bridge.js +1 -1
- package/dist/api/tool-bridge.js.map +1 -1
- package/dist/cli/cli-error.d.ts.map +1 -1
- package/dist/cli/cli-error.js +47 -10
- package/dist/cli/cli-error.js.map +1 -1
- package/dist/cli/command-parser.d.ts +12 -3
- package/dist/cli/command-parser.d.ts.map +1 -1
- package/dist/cli/command-parser.js +161 -2
- package/dist/cli/command-parser.js.map +1 -1
- package/dist/cli/daemon-status-model.d.ts +87 -0
- package/dist/cli/daemon-status-model.d.ts.map +1 -0
- package/dist/cli/daemon-status-model.js +142 -0
- package/dist/cli/daemon-status-model.js.map +1 -0
- package/dist/cli/daemon-status-render.d.ts +3 -0
- package/dist/cli/daemon-status-render.d.ts.map +1 -0
- package/dist/cli/daemon-status-render.js +100 -0
- package/dist/cli/daemon-status-render.js.map +1 -0
- package/dist/cli/daemon-status.d.ts +7 -0
- package/dist/cli/daemon-status.d.ts.map +1 -0
- package/dist/cli/daemon-status.js +79 -0
- package/dist/cli/daemon-status.js.map +1 -0
- package/dist/cli/git-graft-enhance-model.d.ts +67 -0
- package/dist/cli/git-graft-enhance-model.d.ts.map +1 -0
- package/dist/cli/git-graft-enhance-model.js +55 -0
- package/dist/cli/git-graft-enhance-model.js.map +1 -0
- package/dist/cli/git-graft-enhance-render.d.ts +3 -0
- package/dist/cli/git-graft-enhance-render.d.ts.map +1 -0
- package/dist/cli/git-graft-enhance-render.js +29 -0
- package/dist/cli/git-graft-enhance-render.js.map +1 -0
- package/dist/cli/git-graft-enhance.d.ts +14 -0
- package/dist/cli/git-graft-enhance.d.ts.map +1 -0
- package/dist/cli/git-graft-enhance.js +29 -0
- package/dist/cli/git-graft-enhance.js.map +1 -0
- package/dist/cli/index-cmd.d.ts.map +1 -1
- package/dist/cli/index-cmd.js +18 -21
- package/dist/cli/index-cmd.js.map +1 -1
- package/dist/cli/index-model.d.ts +5 -9
- package/dist/cli/index-model.d.ts.map +1 -1
- package/dist/cli/index-model.js +20 -18
- package/dist/cli/index-model.js.map +1 -1
- package/dist/cli/init-client-config.d.ts +12 -7
- package/dist/cli/init-client-config.d.ts.map +1 -1
- package/dist/cli/init-client-config.js +105 -43
- package/dist/cli/init-client-config.js.map +1 -1
- package/dist/cli/init-model.d.ts +9 -2
- package/dist/cli/init-model.d.ts.map +1 -1
- package/dist/cli/init-model.js +52 -4
- package/dist/cli/init-model.js.map +1 -1
- package/dist/cli/init-render.d.ts.map +1 -1
- package/dist/cli/init-render.js +2 -2
- package/dist/cli/init-render.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +11 -9
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/json-document.d.ts +5 -0
- package/dist/cli/json-document.d.ts.map +1 -1
- package/dist/cli/json-document.js +9 -0
- package/dist/cli/json-document.js.map +1 -1
- package/dist/cli/main.d.ts +7 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +49 -7
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/migrate-local-history.d.ts.map +1 -1
- package/dist/cli/migrate-local-history.js +3 -2
- package/dist/cli/migrate-local-history.js.map +1 -1
- package/dist/cli/peer-command.d.ts +1 -1
- package/dist/cli/peer-command.d.ts.map +1 -1
- package/dist/cli/peer-command.js +1 -1
- package/dist/cli/peer-command.js.map +1 -1
- package/dist/contracts/capabilities.d.ts +5 -5
- package/dist/contracts/capabilities.d.ts.map +1 -1
- package/dist/contracts/capabilities.js +89 -0
- package/dist/contracts/capabilities.js.map +1 -1
- package/dist/contracts/causal-ontology.d.ts +17 -17
- package/dist/contracts/json-object.d.ts +0 -1
- package/dist/contracts/json-object.d.ts.map +1 -1
- package/dist/contracts/json-object.js +0 -10
- package/dist/contracts/json-object.js.map +1 -1
- package/dist/contracts/output-schema-cli.d.ts +277 -25
- package/dist/contracts/output-schema-cli.d.ts.map +1 -1
- package/dist/contracts/output-schema-cli.js +35 -3
- package/dist/contracts/output-schema-cli.js.map +1 -1
- package/dist/contracts/output-schema-fragments.d.ts +212 -87
- package/dist/contracts/output-schema-fragments.d.ts.map +1 -1
- package/dist/contracts/output-schema-fragments.js +49 -2
- package/dist/contracts/output-schema-fragments.js.map +1 -1
- package/dist/contracts/output-schema-mcp.d.ts +372 -47
- package/dist/contracts/output-schema-mcp.d.ts.map +1 -1
- package/dist/contracts/output-schema-mcp.js +217 -1
- package/dist/contracts/output-schema-mcp.js.map +1 -1
- package/dist/contracts/output-schema-meta.d.ts +2 -2
- package/dist/contracts/output-schema-meta.d.ts.map +1 -1
- package/dist/contracts/output-schemas.d.ts +7 -7
- package/dist/contracts/output-schemas.d.ts.map +1 -1
- package/dist/contracts/output-schemas.js +294 -6
- package/dist/contracts/output-schemas.js.map +1 -1
- package/dist/git/diff.d.ts +11 -0
- package/dist/git/diff.d.ts.map +1 -1
- package/dist/git/diff.js +50 -6
- package/dist/git/diff.js.map +1 -1
- package/dist/mcp/burden.d.ts.map +1 -1
- package/dist/mcp/burden.js +9 -0
- package/dist/mcp/burden.js.map +1 -1
- package/dist/mcp/context.d.ts +3 -2
- package/dist/mcp/context.d.ts.map +1 -1
- package/dist/mcp/context.js +2 -37
- package/dist/mcp/context.js.map +1 -1
- package/dist/mcp/daemon-server.d.ts +2 -0
- package/dist/mcp/daemon-server.d.ts.map +1 -1
- package/dist/mcp/daemon-server.js +6 -1
- package/dist/mcp/daemon-server.js.map +1 -1
- package/dist/mcp/daemon-session-host.d.ts +1 -0
- package/dist/mcp/daemon-session-host.d.ts.map +1 -1
- package/dist/mcp/daemon-session-host.js +3 -0
- package/dist/mcp/daemon-session-host.js.map +1 -1
- package/dist/mcp/daemon-stdio-bridge.d.ts +1 -0
- package/dist/mcp/daemon-stdio-bridge.d.ts.map +1 -1
- package/dist/mcp/daemon-stdio-bridge.js +1 -0
- package/dist/mcp/daemon-stdio-bridge.js.map +1 -1
- package/dist/mcp/monitor-tick-job.d.ts +1 -0
- package/dist/mcp/monitor-tick-job.d.ts.map +1 -1
- package/dist/mcp/monitor-tick-job.js +84 -29
- package/dist/mcp/monitor-tick-job.js.map +1 -1
- package/dist/mcp/monitor-types.d.ts +1 -1
- package/dist/mcp/monitor-types.d.ts.map +1 -1
- package/dist/mcp/persisted-local-history-graph.d.ts +2 -2
- package/dist/mcp/persisted-local-history-graph.d.ts.map +1 -1
- package/dist/mcp/persisted-local-history-graph.js +3 -2
- package/dist/mcp/persisted-local-history-graph.js.map +1 -1
- package/dist/mcp/persisted-local-history.d.ts +5 -5
- package/dist/mcp/persisted-local-history.js +2 -2
- package/dist/mcp/persisted-local-history.js.map +1 -1
- package/dist/mcp/persistent-monitor-runtime.d.ts +1 -0
- package/dist/mcp/persistent-monitor-runtime.d.ts.map +1 -1
- package/dist/mcp/persistent-monitor-runtime.js +35 -0
- package/dist/mcp/persistent-monitor-runtime.js.map +1 -1
- package/dist/mcp/repo-tool-worker-context.d.ts.map +1 -1
- package/dist/mcp/repo-tool-worker-context.js +5 -2
- package/dist/mcp/repo-tool-worker-context.js.map +1 -1
- package/dist/mcp/server-context.d.ts.map +1 -1
- package/dist/mcp/server-context.js +13 -0
- package/dist/mcp/server-context.js.map +1 -1
- package/dist/mcp/server-tool-access.d.ts +1 -1
- package/dist/mcp/server-tool-access.d.ts.map +1 -1
- package/dist/mcp/server-tool-access.js +3 -1
- package/dist/mcp/server-tool-access.js.map +1 -1
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +5 -3
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +18 -0
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/code-find.d.ts.map +1 -1
- package/dist/mcp/tools/code-find.js +20 -0
- package/dist/mcp/tools/code-find.js.map +1 -1
- package/dist/mcp/tools/code-show.d.ts.map +1 -1
- package/dist/mcp/tools/code-show.js +24 -0
- package/dist/mcp/tools/code-show.js.map +1 -1
- package/dist/mcp/tools/diagnostic-models.d.ts +2 -0
- package/dist/mcp/tools/diagnostic-models.d.ts.map +1 -1
- package/dist/mcp/tools/doctor.d.ts.map +1 -1
- package/dist/mcp/tools/doctor.js +18 -1
- package/dist/mcp/tools/doctor.js.map +1 -1
- package/dist/mcp/tools/export-surface-diff.d.ts +3 -0
- package/dist/mcp/tools/export-surface-diff.d.ts.map +1 -0
- package/dist/mcp/tools/export-surface-diff.js +24 -0
- package/dist/mcp/tools/export-surface-diff.js.map +1 -0
- package/dist/mcp/tools/file-outline.js +1 -1
- package/dist/mcp/tools/file-outline.js.map +1 -1
- package/dist/mcp/tools/graft-edit.d.ts +3 -0
- package/dist/mcp/tools/graft-edit.d.ts.map +1 -0
- package/dist/mcp/tools/graft-edit.js +192 -0
- package/dist/mcp/tools/graft-edit.js.map +1 -0
- package/dist/mcp/tools/knowledge-map.d.ts +3 -0
- package/dist/mcp/tools/knowledge-map.d.ts.map +1 -0
- package/dist/mcp/tools/knowledge-map.js +31 -0
- package/dist/mcp/tools/knowledge-map.js.map +1 -0
- package/dist/mcp/tools/monitor-nudge.d.ts +3 -0
- package/dist/mcp/tools/monitor-nudge.d.ts.map +1 -0
- package/dist/mcp/tools/monitor-nudge.js +17 -0
- package/dist/mcp/tools/monitor-nudge.js.map +1 -0
- package/dist/mcp/tools/precision-warp.d.ts +3 -3
- package/dist/mcp/tools/precision-warp.d.ts.map +1 -1
- package/dist/mcp/tools/precision-warp.js +24 -15
- package/dist/mcp/tools/precision-warp.js.map +1 -1
- package/dist/mcp/tools/refactor-difficulty.d.ts +3 -0
- package/dist/mcp/tools/refactor-difficulty.d.ts.map +1 -0
- package/dist/mcp/tools/refactor-difficulty.js +36 -0
- package/dist/mcp/tools/refactor-difficulty.js.map +1 -0
- package/dist/mcp/tools/safe-read.js +2 -2
- package/dist/mcp/tools/safe-read.js.map +1 -1
- package/dist/mcp/tools/structural-blame.d.ts +3 -0
- package/dist/mcp/tools/structural-blame.d.ts.map +1 -0
- package/dist/mcp/tools/structural-blame.js +44 -0
- package/dist/mcp/tools/structural-blame.js.map +1 -0
- package/dist/mcp/tools/structural-churn.d.ts +3 -0
- package/dist/mcp/tools/structural-churn.d.ts.map +1 -0
- package/dist/mcp/tools/structural-churn.js +28 -0
- package/dist/mcp/tools/structural-churn.js.map +1 -0
- package/dist/mcp/tools/structural-log.d.ts +3 -0
- package/dist/mcp/tools/structural-log.d.ts.map +1 -0
- package/dist/mcp/tools/structural-log.js +38 -0
- package/dist/mcp/tools/structural-log.js.map +1 -0
- package/dist/mcp/tools/structural-review.d.ts +3 -0
- package/dist/mcp/tools/structural-review.d.ts.map +1 -0
- package/dist/mcp/tools/structural-review.js +55 -0
- package/dist/mcp/tools/structural-review.js.map +1 -0
- package/dist/mcp/warp-pool.d.ts +4 -4
- package/dist/mcp/warp-pool.d.ts.map +1 -1
- package/dist/mcp/warp-pool.js.map +1 -1
- package/dist/mcp/workspace-router-model.d.ts +2 -2
- package/dist/mcp/workspace-router-model.d.ts.map +1 -1
- package/dist/mcp/workspace-router-runtime.d.ts +3 -3
- package/dist/mcp/workspace-router-runtime.d.ts.map +1 -1
- package/dist/mcp/workspace-router-runtime.js +4 -1
- package/dist/mcp/workspace-router-runtime.js.map +1 -1
- package/dist/mcp/workspace-router.d.ts +3 -2
- package/dist/mcp/workspace-router.d.ts.map +1 -1
- package/dist/mcp/workspace-router.js +6 -0
- package/dist/mcp/workspace-router.js.map +1 -1
- package/dist/operations/adaptive-projection.d.ts +22 -0
- package/dist/operations/adaptive-projection.d.ts.map +1 -0
- package/dist/operations/adaptive-projection.js +36 -0
- package/dist/operations/adaptive-projection.js.map +1 -0
- package/dist/operations/agent-handoff.d.ts +25 -0
- package/dist/operations/agent-handoff.d.ts.map +1 -0
- package/dist/operations/agent-handoff.js +36 -0
- package/dist/operations/agent-handoff.js.map +1 -0
- package/dist/operations/capture-range.d.ts +33 -0
- package/dist/operations/capture-range.d.ts.map +1 -0
- package/dist/operations/capture-range.js +45 -0
- package/dist/operations/capture-range.js.map +1 -0
- package/dist/operations/conversation-primer.d.ts +27 -0
- package/dist/operations/conversation-primer.d.ts.map +1 -0
- package/dist/operations/conversation-primer.js +52 -0
- package/dist/operations/conversation-primer.js.map +1 -0
- package/dist/operations/cross-session-resume.d.ts +28 -0
- package/dist/operations/cross-session-resume.d.ts.map +1 -0
- package/dist/operations/cross-session-resume.js +79 -0
- package/dist/operations/cross-session-resume.js.map +1 -0
- package/dist/operations/deterministic-replay.d.ts +39 -0
- package/dist/operations/deterministic-replay.d.ts.map +1 -0
- package/dist/operations/deterministic-replay.js +90 -0
- package/dist/operations/deterministic-replay.js.map +1 -0
- package/dist/operations/export-surface-diff.d.ts +36 -0
- package/dist/operations/export-surface-diff.d.ts.map +1 -0
- package/dist/operations/export-surface-diff.js +298 -0
- package/dist/operations/export-surface-diff.js.map +1 -0
- package/dist/operations/footprint-parallelism.d.ts +25 -0
- package/dist/operations/footprint-parallelism.d.ts.map +1 -0
- package/dist/operations/footprint-parallelism.js +79 -0
- package/dist/operations/footprint-parallelism.js.map +1 -0
- package/dist/operations/graft-diff.d.ts.map +1 -1
- package/dist/operations/graft-diff.js +14 -7
- package/dist/operations/graft-diff.js.map +1 -1
- package/dist/operations/horizon-of-readability.d.ts +23 -0
- package/dist/operations/horizon-of-readability.d.ts.map +1 -0
- package/dist/operations/horizon-of-readability.js +39 -0
- package/dist/operations/horizon-of-readability.js.map +1 -0
- package/dist/operations/import-reference-impact.d.ts +13 -0
- package/dist/operations/import-reference-impact.d.ts.map +1 -0
- package/dist/operations/import-reference-impact.js +101 -0
- package/dist/operations/import-reference-impact.js.map +1 -0
- package/dist/operations/knowledge-map.d.ts +30 -0
- package/dist/operations/knowledge-map.d.ts.map +1 -0
- package/dist/operations/knowledge-map.js +64 -0
- package/dist/operations/knowledge-map.js.map +1 -0
- package/dist/operations/observation-cache.d.ts +8 -2
- package/dist/operations/observation-cache.d.ts.map +1 -1
- package/dist/operations/observation-cache.js +17 -5
- package/dist/operations/observation-cache.js.map +1 -1
- package/dist/operations/projection-safety.d.ts +31 -0
- package/dist/operations/projection-safety.d.ts.map +1 -0
- package/dist/operations/projection-safety.js +77 -0
- package/dist/operations/projection-safety.js.map +1 -0
- package/dist/operations/repo-workspace.js +3 -3
- package/dist/operations/repo-workspace.js.map +1 -1
- package/dist/operations/semantic-drift.d.ts +27 -0
- package/dist/operations/semantic-drift.d.ts.map +1 -0
- package/dist/operations/semantic-drift.js +46 -0
- package/dist/operations/semantic-drift.js.map +1 -0
- package/dist/operations/session-filtration.d.ts +36 -0
- package/dist/operations/session-filtration.d.ts.map +1 -0
- package/dist/operations/session-filtration.js +48 -0
- package/dist/operations/session-filtration.js.map +1 -0
- package/dist/operations/session-replay.d.ts +17 -0
- package/dist/operations/session-replay.d.ts.map +1 -0
- package/dist/operations/session-replay.js +59 -0
- package/dist/operations/session-replay.js.map +1 -0
- package/dist/operations/sludge-detector.d.ts +45 -0
- package/dist/operations/sludge-detector.d.ts.map +1 -0
- package/dist/operations/sludge-detector.js +278 -0
- package/dist/operations/sludge-detector.js.map +1 -0
- package/dist/operations/structural-blame.d.ts +67 -0
- package/dist/operations/structural-blame.d.ts.map +1 -0
- package/dist/operations/structural-blame.js +111 -0
- package/dist/operations/structural-blame.js.map +1 -0
- package/dist/operations/structural-review.d.ts +47 -0
- package/dist/operations/structural-review.d.ts.map +1 -0
- package/dist/operations/structural-review.js +225 -0
- package/dist/operations/structural-review.js.map +1 -0
- package/dist/operations/teaching-hints.d.ts +18 -0
- package/dist/operations/teaching-hints.d.ts.map +1 -0
- package/dist/operations/teaching-hints.js +35 -0
- package/dist/operations/teaching-hints.js.map +1 -0
- package/dist/parser/diff.d.ts +2 -0
- package/dist/parser/diff.d.ts.map +1 -1
- package/dist/parser/diff.js +7 -0
- package/dist/parser/diff.js.map +1 -1
- package/dist/ports/paths.d.ts +17 -0
- package/dist/ports/paths.d.ts.map +1 -0
- package/dist/ports/{warp.js → paths.js} +2 -2
- package/dist/ports/paths.js.map +1 -0
- package/dist/warp/ast-emitter.d.ts +28 -0
- package/dist/warp/ast-emitter.d.ts.map +1 -0
- package/dist/warp/ast-emitter.js +90 -0
- package/dist/warp/ast-emitter.js.map +1 -0
- package/dist/warp/ast-import-resolver.d.ts +13 -0
- package/dist/warp/ast-import-resolver.d.ts.map +1 -0
- package/dist/warp/ast-import-resolver.js +259 -0
- package/dist/warp/ast-import-resolver.js.map +1 -0
- package/dist/warp/commit-meta.d.ts +8 -0
- package/dist/warp/commit-meta.d.ts.map +1 -0
- package/dist/warp/commit-meta.js +13 -0
- package/dist/warp/commit-meta.js.map +1 -0
- package/dist/warp/context.d.ts +10 -0
- package/dist/warp/context.d.ts.map +1 -0
- package/dist/warp/context.js +26 -0
- package/dist/warp/context.js.map +1 -0
- package/dist/warp/dead-symbols.d.ts +40 -0
- package/dist/warp/dead-symbols.d.ts.map +1 -0
- package/dist/warp/dead-symbols.js +127 -0
- package/dist/warp/dead-symbols.js.map +1 -0
- package/dist/warp/drift-sentinel.d.ts +30 -0
- package/dist/warp/drift-sentinel.d.ts.map +1 -0
- package/dist/warp/drift-sentinel.js +65 -0
- package/dist/warp/drift-sentinel.js.map +1 -0
- package/dist/warp/index-head.d.ts +32 -0
- package/dist/warp/index-head.d.ts.map +1 -0
- package/dist/warp/index-head.js +245 -0
- package/dist/warp/index-head.js.map +1 -0
- package/dist/warp/observers.d.ts +6 -6
- package/dist/warp/observers.d.ts.map +1 -1
- package/dist/warp/observers.js +5 -4
- package/dist/warp/observers.js.map +1 -1
- package/dist/warp/open.d.ts +5 -4
- package/dist/warp/open.d.ts.map +1 -1
- package/dist/warp/open.js +24 -49
- package/dist/warp/open.js.map +1 -1
- package/dist/warp/outline-diff-trailer.d.ts +26 -0
- package/dist/warp/outline-diff-trailer.d.ts.map +1 -0
- package/dist/warp/outline-diff-trailer.js +68 -0
- package/dist/warp/outline-diff-trailer.js.map +1 -0
- package/dist/warp/refactor-difficulty.d.ts +38 -0
- package/dist/warp/refactor-difficulty.d.ts.map +1 -0
- package/dist/warp/refactor-difficulty.js +169 -0
- package/dist/warp/refactor-difficulty.js.map +1 -0
- package/dist/warp/references.d.ts +22 -0
- package/dist/warp/references.d.ts.map +1 -0
- package/dist/warp/references.js +57 -0
- package/dist/warp/references.js.map +1 -0
- package/dist/warp/stale-docs.d.ts +56 -0
- package/dist/warp/stale-docs.d.ts.map +1 -0
- package/dist/warp/stale-docs.js +149 -0
- package/dist/warp/stale-docs.js.map +1 -0
- package/dist/warp/structural-drift-detection.d.ts +49 -0
- package/dist/warp/structural-drift-detection.d.ts.map +1 -0
- package/dist/warp/structural-drift-detection.js +51 -0
- package/dist/warp/structural-drift-detection.js.map +1 -0
- package/dist/warp/structural-queries.d.ts +49 -0
- package/dist/warp/structural-queries.d.ts.map +1 -0
- package/dist/warp/structural-queries.js +175 -0
- package/dist/warp/structural-queries.js.map +1 -0
- package/dist/warp/symbol-timeline.d.ts +34 -0
- package/dist/warp/symbol-timeline.d.ts.map +1 -0
- package/dist/warp/symbol-timeline.js +127 -0
- package/dist/warp/symbol-timeline.js.map +1 -0
- package/dist/warp/traverse-hydrate.d.ts +23 -0
- package/dist/warp/traverse-hydrate.d.ts.map +1 -0
- package/dist/warp/traverse-hydrate.js +39 -0
- package/dist/warp/traverse-hydrate.js.map +1 -0
- package/dist/warp/warp-reference-count.d.ts +19 -0
- package/dist/warp/warp-reference-count.d.ts.map +1 -0
- package/dist/warp/warp-reference-count.js +32 -0
- package/dist/warp/warp-reference-count.js.map +1 -0
- package/dist/warp/warp-structural-blame.d.ts +20 -0
- package/dist/warp/warp-structural-blame.d.ts.map +1 -0
- package/dist/warp/warp-structural-blame.js +43 -0
- package/dist/warp/warp-structural-blame.js.map +1 -0
- package/dist/warp/warp-structural-churn.d.ts +30 -0
- package/dist/warp/warp-structural-churn.d.ts.map +1 -0
- package/dist/warp/warp-structural-churn.js +213 -0
- package/dist/warp/warp-structural-churn.js.map +1 -0
- package/dist/warp/warp-structural-log.d.ts +35 -0
- package/dist/warp/warp-structural-log.d.ts.map +1 -0
- package/dist/warp/warp-structural-log.js +104 -0
- package/dist/warp/warp-structural-log.js.map +1 -0
- package/docs/CLI.md +68 -4
- package/docs/MCP.md +23 -0
- package/docs/SETUP.md +779 -0
- package/package.json +10 -7
- package/src/adapters/json-text-decoder.ts +11 -0
- package/src/adapters/node-paths.ts +35 -0
- package/src/adapters/repo-paths.ts +45 -4
- package/src/api/tool-bridge.ts +2 -1
- package/src/cli/cli-error.ts +49 -10
- package/src/cli/command-parser.ts +185 -3
- package/src/cli/daemon-status-model.ts +238 -0
- package/src/cli/daemon-status-render.ts +102 -0
- package/src/cli/daemon-status.ts +100 -0
- package/src/cli/git-graft-enhance-model.ts +131 -0
- package/src/cli/git-graft-enhance-render.ts +33 -0
- package/src/cli/git-graft-enhance.ts +54 -0
- package/src/cli/index-cmd.ts +18 -22
- package/src/cli/index-model.ts +21 -22
- package/src/cli/init-client-config.ts +167 -38
- package/src/cli/init-model.ts +57 -2
- package/src/cli/init-render.ts +2 -2
- package/src/cli/init.ts +11 -9
- package/src/cli/json-document.ts +11 -0
- package/src/cli/main.ts +53 -6
- package/src/cli/migrate-local-history.ts +3 -2
- package/src/cli/peer-command.ts +2 -1
- package/src/contracts/capabilities.ts +90 -0
- package/src/contracts/json-object.ts +1 -11
- package/src/contracts/output-schema-cli.ts +36 -3
- package/src/contracts/output-schema-fragments.ts +52 -2
- package/src/contracts/output-schema-mcp.ts +219 -0
- package/src/contracts/output-schemas.ts +300 -6
- package/src/git/diff.ts +61 -0
- package/src/mcp/burden.ts +9 -0
- package/src/mcp/context.ts +5 -42
- package/src/mcp/daemon-server.ts +8 -1
- package/src/mcp/daemon-session-host.ts +4 -0
- package/src/mcp/daemon-stdio-bridge.ts +2 -0
- package/src/mcp/monitor-tick-job.ts +90 -39
- package/src/mcp/monitor-types.ts +1 -1
- package/src/mcp/persisted-local-history-graph.ts +5 -4
- package/src/mcp/persisted-local-history.ts +2 -2
- package/src/mcp/persistent-monitor-runtime.ts +37 -0
- package/src/mcp/repo-tool-worker-context.ts +5 -2
- package/src/mcp/server-context.ts +15 -2
- package/src/mcp/server-tool-access.ts +4 -1
- package/src/mcp/server.ts +8 -3
- package/src/mcp/tool-registry.ts +18 -0
- package/src/mcp/tools/code-find.ts +23 -0
- package/src/mcp/tools/code-show.ts +27 -0
- package/src/mcp/tools/diagnostic-models.ts +2 -0
- package/src/mcp/tools/doctor.ts +18 -1
- package/src/mcp/tools/export-surface-diff.ts +26 -0
- package/src/mcp/tools/file-outline.ts +1 -1
- package/src/mcp/tools/graft-edit.ts +276 -0
- package/src/mcp/tools/knowledge-map.ts +34 -0
- package/src/mcp/tools/monitor-nudge.ts +19 -0
- package/src/mcp/tools/precision-warp.ts +27 -16
- package/src/mcp/tools/refactor-difficulty.ts +42 -0
- package/src/mcp/tools/safe-read.ts +2 -2
- package/src/mcp/tools/structural-blame.ts +55 -0
- package/src/mcp/tools/structural-churn.ts +28 -0
- package/src/mcp/tools/structural-log.ts +41 -0
- package/src/mcp/tools/structural-review.ts +63 -0
- package/src/mcp/warp-pool.ts +6 -6
- package/src/mcp/workspace-router-model.ts +2 -2
- package/src/mcp/workspace-router-runtime.ts +11 -8
- package/src/mcp/workspace-router.ts +9 -2
- package/src/operations/adaptive-projection.ts +54 -0
- package/src/operations/agent-handoff.ts +59 -0
- package/src/operations/capture-range.ts +64 -0
- package/src/operations/conversation-primer.ts +82 -0
- package/src/operations/cross-session-resume.ts +104 -0
- package/src/operations/deterministic-replay.ts +143 -0
- package/src/operations/export-surface-diff.ts +355 -0
- package/src/operations/footprint-parallelism.ts +98 -0
- package/src/operations/graft-diff.ts +14 -7
- package/src/operations/horizon-of-readability.ts +60 -0
- package/src/operations/import-reference-impact.ts +143 -0
- package/src/operations/knowledge-map.ts +96 -0
- package/src/operations/observation-cache.ts +20 -4
- package/src/operations/projection-safety.ts +111 -0
- package/src/operations/repo-workspace.ts +3 -3
- package/src/operations/semantic-drift.ts +70 -0
- package/src/operations/session-filtration.ts +76 -0
- package/src/operations/session-replay.ts +73 -0
- package/src/operations/sludge-detector.ts +356 -0
- package/src/operations/structural-blame.ts +197 -0
- package/src/operations/structural-review.ts +317 -0
- package/src/operations/teaching-hints.ts +52 -0
- package/src/parser/diff.ts +7 -0
- package/src/ports/paths.ts +22 -0
- package/src/warp/ast-emitter.ts +133 -0
- package/src/warp/ast-import-resolver.ts +333 -0
- package/src/warp/commit-meta.ts +19 -0
- package/src/warp/context.ts +48 -0
- package/src/warp/dead-symbols.ts +174 -0
- package/src/warp/drift-sentinel.ts +101 -0
- package/src/warp/index-head.ts +348 -0
- package/src/warp/observers.ts +8 -7
- package/src/warp/open.ts +40 -66
- package/src/warp/outline-diff-trailer.ts +100 -0
- package/src/warp/plumbing.d.ts +11 -2
- package/src/warp/refactor-difficulty.ts +257 -0
- package/src/warp/references.ts +77 -0
- package/src/warp/stale-docs.ts +210 -0
- package/src/warp/structural-drift-detection.ts +97 -0
- package/src/warp/structural-queries.ts +258 -0
- package/src/warp/symbol-timeline.ts +209 -0
- package/src/warp/traverse-hydrate.ts +61 -0
- package/src/warp/warp-reference-count.ts +47 -0
- package/src/warp/warp-structural-blame.ts +65 -0
- package/src/warp/warp-structural-churn.ts +309 -0
- package/src/warp/warp-structural-log.ts +149 -0
- package/dist/ports/warp.d.ts +0 -45
- package/dist/ports/warp.d.ts.map +0 -1
- package/dist/ports/warp.js.map +0 -1
- package/dist/warp/identity-resolver.d.ts +0 -14
- package/dist/warp/identity-resolver.d.ts.map +0 -1
- package/dist/warp/identity-resolver.js +0 -31
- package/dist/warp/identity-resolver.js.map +0 -1
- package/dist/warp/indexer-git.d.ts +0 -22
- package/dist/warp/indexer-git.d.ts.map +0 -1
- package/dist/warp/indexer-git.js +0 -148
- package/dist/warp/indexer-git.js.map +0 -1
- package/dist/warp/indexer-graph.d.ts +0 -17
- package/dist/warp/indexer-graph.d.ts.map +0 -1
- package/dist/warp/indexer-graph.js +0 -179
- package/dist/warp/indexer-graph.js.map +0 -1
- package/dist/warp/indexer-model.d.ts +0 -51
- package/dist/warp/indexer-model.d.ts.map +0 -1
- package/dist/warp/indexer-model.js +0 -21
- package/dist/warp/indexer-model.js.map +0 -1
- package/dist/warp/indexer.d.ts +0 -9
- package/dist/warp/indexer.d.ts.map +0 -1
- package/dist/warp/indexer.js +0 -112
- package/dist/warp/indexer.js.map +0 -1
- package/dist/warp/symbol-identity.d.ts +0 -11
- package/dist/warp/symbol-identity.d.ts.map +0 -1
- package/dist/warp/symbol-identity.js +0 -67
- package/dist/warp/symbol-identity.js.map +0 -1
- package/src/ports/warp.ts +0 -55
- package/src/warp/identity-resolver.ts +0 -35
- package/src/warp/indexer-git.ts +0 -182
- package/src/warp/indexer-graph.ts +0 -276
- package/src/warp/indexer-model.ts +0 -69
- package/src/warp/indexer.ts +0 -186
- package/src/warp/symbol-identity.ts +0 -100
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import crypto from "node:crypto";
|
|
2
|
-
import { diffOutlines } from "../parser/diff.js";
|
|
3
|
-
export function buildSymbolPath(parentPath, name) {
|
|
4
|
-
return parentPath.length > 0 ? `${parentPath}.${name}` : name;
|
|
5
|
-
}
|
|
6
|
-
function mintCanonicalSymbolIdentity(commitSha, filePath, symbolPath, entry) {
|
|
7
|
-
const seed = [
|
|
8
|
-
commitSha,
|
|
9
|
-
filePath,
|
|
10
|
-
symbolPath,
|
|
11
|
-
entry.kind,
|
|
12
|
-
entry.signature ?? "",
|
|
13
|
-
String(entry.exported),
|
|
14
|
-
].join("\n");
|
|
15
|
-
return `sid:${crypto.createHash("sha256").update(seed).digest("hex").slice(0, 16)}`;
|
|
16
|
-
}
|
|
17
|
-
export function assignCanonicalSymbolIdentities(input) {
|
|
18
|
-
const assigned = new Map();
|
|
19
|
-
assignLevel({
|
|
20
|
-
oldEntries: input.oldEntries,
|
|
21
|
-
newEntries: input.newEntries,
|
|
22
|
-
oldIdentityByPath: input.oldIdentityByPath,
|
|
23
|
-
commitSha: input.commitSha,
|
|
24
|
-
filePath: input.filePath,
|
|
25
|
-
oldParentPath: "",
|
|
26
|
-
newParentPath: "",
|
|
27
|
-
assigned,
|
|
28
|
-
});
|
|
29
|
-
return assigned;
|
|
30
|
-
}
|
|
31
|
-
function assignLevel(input) {
|
|
32
|
-
const oldByName = new Map();
|
|
33
|
-
for (const entry of input.oldEntries) {
|
|
34
|
-
oldByName.set(entry.name, entry);
|
|
35
|
-
}
|
|
36
|
-
const continuityByNewName = new Map();
|
|
37
|
-
const diff = diffOutlines(input.oldEntries, input.newEntries);
|
|
38
|
-
for (const continuity of diff.continuity) {
|
|
39
|
-
continuityByNewName.set(continuity.newName, continuity.oldName);
|
|
40
|
-
}
|
|
41
|
-
for (const newEntry of input.newEntries) {
|
|
42
|
-
const newSymbolPath = buildSymbolPath(input.newParentPath, newEntry.name);
|
|
43
|
-
const oldName = oldByName.has(newEntry.name)
|
|
44
|
-
? newEntry.name
|
|
45
|
-
: continuityByNewName.get(newEntry.name);
|
|
46
|
-
const oldEntry = oldName !== undefined ? oldByName.get(oldName) : undefined;
|
|
47
|
-
const oldSymbolPath = oldName !== undefined
|
|
48
|
-
? buildSymbolPath(input.oldParentPath, oldName)
|
|
49
|
-
: null;
|
|
50
|
-
const identityId = oldSymbolPath !== null
|
|
51
|
-
? input.oldIdentityByPath.get(oldSymbolPath) ??
|
|
52
|
-
mintCanonicalSymbolIdentity(input.commitSha, input.filePath, newSymbolPath, newEntry)
|
|
53
|
-
: mintCanonicalSymbolIdentity(input.commitSha, input.filePath, newSymbolPath, newEntry);
|
|
54
|
-
input.assigned.set(newSymbolPath, identityId);
|
|
55
|
-
assignLevel({
|
|
56
|
-
oldEntries: oldEntry?.children ?? [],
|
|
57
|
-
newEntries: newEntry.children ?? [],
|
|
58
|
-
oldIdentityByPath: input.oldIdentityByPath,
|
|
59
|
-
commitSha: input.commitSha,
|
|
60
|
-
filePath: input.filePath,
|
|
61
|
-
oldParentPath: oldSymbolPath ?? "",
|
|
62
|
-
newParentPath: newSymbolPath,
|
|
63
|
-
assigned: input.assigned,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=symbol-identity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbol-identity.js","sourceRoot":"","sources":["../../src/warp/symbol-identity.ts"],"names":[],"mappings":"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"}
|
package/src/ports/warp.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// WARP port — hexagonal boundary for graph reads and writes
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
|
|
5
|
-
export interface WarpObserverLens {
|
|
6
|
-
readonly match: string | readonly string[];
|
|
7
|
-
readonly expose?: readonly string[] | undefined;
|
|
8
|
-
readonly redact?: readonly string[] | undefined;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface WarpObserverOptions {
|
|
12
|
-
readonly source?: {
|
|
13
|
-
readonly kind: "live";
|
|
14
|
-
readonly ceiling: number | null;
|
|
15
|
-
} | undefined;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface WarpEdge {
|
|
19
|
-
readonly from: string;
|
|
20
|
-
readonly to: string;
|
|
21
|
-
readonly label: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface WarpObserver {
|
|
25
|
-
getNodes(): Promise<string[]>;
|
|
26
|
-
getNodeProps(nodeId: string): Promise<Record<string, unknown> | null>;
|
|
27
|
-
getEdges(): Promise<readonly WarpEdge[]>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface WarpPatchBuilder {
|
|
31
|
-
addNode(id: string): unknown;
|
|
32
|
-
setProperty(id: string, key: string, value: unknown): unknown;
|
|
33
|
-
addEdge(from: string, to: string, label: string): unknown;
|
|
34
|
-
removeNode(id: string): unknown;
|
|
35
|
-
removeEdge(from: string, to: string, label: string): unknown;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface WarpMaterializeReceiptOp {
|
|
39
|
-
readonly op: string;
|
|
40
|
-
readonly result: string;
|
|
41
|
-
readonly target: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface WarpMaterializeReceipt {
|
|
45
|
-
readonly lamport: number;
|
|
46
|
-
readonly ops: readonly WarpMaterializeReceiptOp[];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface WarpHandle {
|
|
50
|
-
hasNode(nodeId: string): Promise<boolean>;
|
|
51
|
-
observer(lens: WarpObserverLens, options?: WarpObserverOptions): Promise<WarpObserver>;
|
|
52
|
-
patch(build: (patch: WarpPatchBuilder) => void | Promise<void>): Promise<string>;
|
|
53
|
-
materialize(): Promise<void>;
|
|
54
|
-
materializeReceipts(): Promise<readonly WarpMaterializeReceipt[]>;
|
|
55
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARP Identity Resolver — creates an IdentityResolver backed by
|
|
3
|
-
* the WARP graph. Reads symbol identityId properties through the
|
|
4
|
-
* observer lens system.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { WarpHandle } from "../ports/warp.js";
|
|
8
|
-
import type { IdentityResolver } from "../operations/diff-identity.js";
|
|
9
|
-
import { fileSymbolsLens, observe } from "./observers.js";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Create an IdentityResolver that queries WARP for canonical symbol
|
|
13
|
-
* identities. Each call reads the current frontier snapshot — the
|
|
14
|
-
* resolver is stateless between calls.
|
|
15
|
-
*/
|
|
16
|
-
export function createWarpIdentityResolver(warp: WarpHandle): IdentityResolver {
|
|
17
|
-
return async (filePath: string) => {
|
|
18
|
-
const lens = fileSymbolsLens(filePath);
|
|
19
|
-
const obs = await observe(warp, lens);
|
|
20
|
-
const nodes = await obs.getNodes();
|
|
21
|
-
const identities = new Map<string, string>();
|
|
22
|
-
|
|
23
|
-
for (const nodeId of nodes) {
|
|
24
|
-
const props = await obs.getNodeProps(nodeId);
|
|
25
|
-
if (props === null) continue;
|
|
26
|
-
const name = props["name"];
|
|
27
|
-
const identityId = props["identityId"];
|
|
28
|
-
if (typeof name === "string" && typeof identityId === "string") {
|
|
29
|
-
identities.set(name, identityId);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return identities;
|
|
34
|
-
};
|
|
35
|
-
}
|
package/src/warp/indexer-git.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { diffOutlines } from "../parser/diff.js";
|
|
2
|
-
import { detectLang } from "../parser/lang.js";
|
|
3
|
-
import { extractOutline } from "../parser/outline.js";
|
|
4
|
-
import { getFileAtRef } from "../git/diff.js";
|
|
5
|
-
import type { OutlineEntry } from "../parser/types.js";
|
|
6
|
-
import type { GitClient } from "../ports/git.js";
|
|
7
|
-
import { buildJumpLookup, fileNodeId, type PreparedChange } from "./indexer-model.js";
|
|
8
|
-
|
|
9
|
-
async function git(gitClient: GitClient, cwd: string, args: readonly string[]): Promise<string> {
|
|
10
|
-
const result = await gitClient.run({ cwd, args });
|
|
11
|
-
if (result.error !== undefined || result.status !== 0) {
|
|
12
|
-
throw result.error ?? new Error(result.stderr.trim() || `git exited with status ${String(result.status)}`);
|
|
13
|
-
}
|
|
14
|
-
return result.stdout;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function listCommits(
|
|
18
|
-
gitClient: GitClient,
|
|
19
|
-
cwd: string,
|
|
20
|
-
from?: string,
|
|
21
|
-
to?: string,
|
|
22
|
-
): Promise<string[]> {
|
|
23
|
-
const range = from !== undefined ? `${from}..${to ?? "HEAD"}` : to ?? "HEAD";
|
|
24
|
-
const args = ["log", "--reverse", "--format=%H", range];
|
|
25
|
-
return (await git(gitClient, cwd, args))
|
|
26
|
-
.trim().split("\n").filter((line) => line.length > 0);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function getCommitChanges(
|
|
30
|
-
gitClient: GitClient,
|
|
31
|
-
sha: string,
|
|
32
|
-
cwd: string,
|
|
33
|
-
): Promise<{ status: string; path: string; previousPath?: string }[]> {
|
|
34
|
-
const args = ["diff-tree", "--root", "--no-commit-id", "-r", "-M", "--name-status", sha];
|
|
35
|
-
return (await git(gitClient, cwd, args))
|
|
36
|
-
.trim().split("\n").filter((line) => line.length > 0).map((line) => {
|
|
37
|
-
const parts = line.split("\t");
|
|
38
|
-
const rawStatus = parts[0] ?? "";
|
|
39
|
-
if (rawStatus.startsWith("R")) {
|
|
40
|
-
return {
|
|
41
|
-
status: "R",
|
|
42
|
-
previousPath: parts[1] ?? "",
|
|
43
|
-
path: parts[2] ?? "",
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
if (rawStatus.startsWith("C")) {
|
|
47
|
-
return {
|
|
48
|
-
status: "A",
|
|
49
|
-
path: parts[2] ?? "",
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return { status: rawStatus[0] ?? rawStatus, path: parts[1] ?? "" };
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export async function getCommitMeta(
|
|
57
|
-
gitClient: GitClient,
|
|
58
|
-
sha: string,
|
|
59
|
-
cwd: string,
|
|
60
|
-
): Promise<{ message: string; author: string; email: string; timestamp: string }> {
|
|
61
|
-
const output = await git(gitClient, cwd, ["log", "-1", "--format=%s%n%aN%n%aE%n%aI", sha]);
|
|
62
|
-
const lines = output.trim().split("\n");
|
|
63
|
-
return { message: lines[0] ?? "", author: lines[1] ?? "", email: lines[2] ?? "", timestamp: lines[3] ?? "" };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function hasParent(gitClient: GitClient, sha: string, cwd: string): Promise<boolean> {
|
|
67
|
-
try {
|
|
68
|
-
await git(gitClient, cwd, ["rev-parse", "--verify", `${sha}~1`]);
|
|
69
|
-
return true;
|
|
70
|
-
} catch {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export async function getParentSha(gitClient: GitClient, sha: string, cwd: string): Promise<string> {
|
|
76
|
-
return (await git(gitClient, cwd, ["rev-parse", "--verify", `${sha}~1`])).trim();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export async function prepareChange(
|
|
80
|
-
gitClient: GitClient,
|
|
81
|
-
cwd: string,
|
|
82
|
-
sha: string,
|
|
83
|
-
parentRef: string,
|
|
84
|
-
parentExists: boolean,
|
|
85
|
-
change: { status: string; path: string; previousPath?: string },
|
|
86
|
-
): Promise<PreparedChange> {
|
|
87
|
-
const filePath = change.path;
|
|
88
|
-
const fileId = fileNodeId(filePath);
|
|
89
|
-
const lang = detectLang(filePath);
|
|
90
|
-
const previousPath = change.previousPath;
|
|
91
|
-
|
|
92
|
-
if (change.status === "D") {
|
|
93
|
-
let oldOutline: readonly OutlineEntry[] = [];
|
|
94
|
-
if (lang !== null && parentExists) {
|
|
95
|
-
const oldContent = await getFileAtRef(parentRef, filePath, { cwd, git: gitClient });
|
|
96
|
-
if (oldContent !== null) {
|
|
97
|
-
oldOutline = extractOutline(oldContent, lang).entries;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
status: change.status,
|
|
102
|
-
filePath,
|
|
103
|
-
...(previousPath !== undefined ? { previousPath } : {}),
|
|
104
|
-
fileId,
|
|
105
|
-
lang,
|
|
106
|
-
parentExists,
|
|
107
|
-
oldOutline,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (lang === null) {
|
|
112
|
-
return {
|
|
113
|
-
status: change.status,
|
|
114
|
-
filePath,
|
|
115
|
-
...(previousPath !== undefined ? { previousPath } : {}),
|
|
116
|
-
fileId,
|
|
117
|
-
lang,
|
|
118
|
-
parentExists,
|
|
119
|
-
oldOutline: [],
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const newContent = await getFileAtRef(sha, filePath, { cwd, git: gitClient });
|
|
124
|
-
if (newContent === null) {
|
|
125
|
-
return {
|
|
126
|
-
status: change.status,
|
|
127
|
-
filePath,
|
|
128
|
-
...(previousPath !== undefined ? { previousPath } : {}),
|
|
129
|
-
fileId,
|
|
130
|
-
lang,
|
|
131
|
-
parentExists,
|
|
132
|
-
oldOutline: [],
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const newResult = extractOutline(newContent, lang);
|
|
137
|
-
const newOutline = newResult.entries;
|
|
138
|
-
const jumpLookup = buildJumpLookup(newResult.jumpTable ?? []);
|
|
139
|
-
|
|
140
|
-
if (change.status === "A" || !parentExists) {
|
|
141
|
-
return {
|
|
142
|
-
status: change.status,
|
|
143
|
-
filePath,
|
|
144
|
-
...(previousPath !== undefined ? { previousPath } : {}),
|
|
145
|
-
fileId,
|
|
146
|
-
lang,
|
|
147
|
-
parentExists,
|
|
148
|
-
oldOutline: [],
|
|
149
|
-
newOutline,
|
|
150
|
-
jumpLookup,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const oldContent = await getFileAtRef(parentRef, previousPath ?? filePath, { cwd, git: gitClient });
|
|
155
|
-
if (oldContent === null) {
|
|
156
|
-
return {
|
|
157
|
-
status: change.status,
|
|
158
|
-
filePath,
|
|
159
|
-
...(previousPath !== undefined ? { previousPath } : {}),
|
|
160
|
-
fileId,
|
|
161
|
-
lang,
|
|
162
|
-
parentExists,
|
|
163
|
-
oldOutline: [],
|
|
164
|
-
newOutline,
|
|
165
|
-
jumpLookup,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
const oldOutline = extractOutline(oldContent, lang).entries;
|
|
170
|
-
return {
|
|
171
|
-
status: change.status,
|
|
172
|
-
filePath,
|
|
173
|
-
...(previousPath !== undefined ? { previousPath } : {}),
|
|
174
|
-
fileId,
|
|
175
|
-
lang,
|
|
176
|
-
parentExists,
|
|
177
|
-
oldOutline,
|
|
178
|
-
newOutline,
|
|
179
|
-
jumpLookup,
|
|
180
|
-
diff: diffOutlines(oldOutline, newOutline),
|
|
181
|
-
};
|
|
182
|
-
}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { diffOutlines } from "../parser/diff.js";
|
|
2
|
-
import type { OutlineEntry } from "../parser/types.js";
|
|
3
|
-
import type { WarpHandle } from "../ports/warp.js";
|
|
4
|
-
import { buildSymbolPath, type SymbolIdentityMap } from "./symbol-identity.js";
|
|
5
|
-
import { fileSymbolsLens } from "./observers.js";
|
|
6
|
-
import {
|
|
7
|
-
dirNodeId,
|
|
8
|
-
fileNodeId,
|
|
9
|
-
identityNodeId,
|
|
10
|
-
symNodeId,
|
|
11
|
-
type PatchOps,
|
|
12
|
-
} from "./indexer-model.js";
|
|
13
|
-
|
|
14
|
-
function cloneIdentityMap(input: SymbolIdentityMap | undefined): Map<string, string> {
|
|
15
|
-
return new Map(input ?? []);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function readCommitTick(warp: WarpHandle, sha: string): Promise<number | null> {
|
|
19
|
-
const observer = await warp.observer({ match: `commit:${sha}`, expose: ["tick"] });
|
|
20
|
-
const nodes = await observer.getNodes();
|
|
21
|
-
const nodeId = nodes[0];
|
|
22
|
-
if (nodeId === undefined) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const props = await observer.getNodeProps(nodeId);
|
|
26
|
-
return typeof props?.["tick"] === "number" ? props["tick"] : null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function readIdentitySeedForFile(
|
|
30
|
-
warp: WarpHandle,
|
|
31
|
-
filePath: string,
|
|
32
|
-
ceiling: number | null,
|
|
33
|
-
): Promise<Map<string, string>> {
|
|
34
|
-
if (ceiling === null) {
|
|
35
|
-
return new Map();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const observer = await warp.observer(fileSymbolsLens(filePath), {
|
|
39
|
-
source: { kind: "live", ceiling },
|
|
40
|
-
});
|
|
41
|
-
const nodes = await observer.getNodes();
|
|
42
|
-
const seeded = new Map<string, string>();
|
|
43
|
-
|
|
44
|
-
for (const nodeId of nodes) {
|
|
45
|
-
const props = await observer.getNodeProps(nodeId);
|
|
46
|
-
const symbolPath = typeof props?.["symbolPath"] === "string"
|
|
47
|
-
? props["symbolPath"]
|
|
48
|
-
: typeof props?.["name"] === "string"
|
|
49
|
-
? props["name"]
|
|
50
|
-
: null;
|
|
51
|
-
const identityId = typeof props?.["identityId"] === "string"
|
|
52
|
-
? props["identityId"]
|
|
53
|
-
: null;
|
|
54
|
-
if (symbolPath !== null && identityId !== null) {
|
|
55
|
-
seeded.set(symbolPath, identityId);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return seeded;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function resolveParentTick(
|
|
63
|
-
warp: WarpHandle,
|
|
64
|
-
commitTicks: ReadonlyMap<string, number>,
|
|
65
|
-
parentSha: string | null,
|
|
66
|
-
): Promise<number | null> {
|
|
67
|
-
if (parentSha === null) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return commitTicks.get(parentSha) ?? await readCommitTick(warp, parentSha);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export async function loadPriorIdentityMap(
|
|
74
|
-
warp: WarpHandle,
|
|
75
|
-
liveIdentityByFile: ReadonlyMap<string, Map<string, string>>,
|
|
76
|
-
filePath: string,
|
|
77
|
-
parentTick: number | null,
|
|
78
|
-
): Promise<Map<string, string>> {
|
|
79
|
-
return liveIdentityByFile.has(filePath)
|
|
80
|
-
? cloneIdentityMap(liveIdentityByFile.get(filePath))
|
|
81
|
-
: await readIdentitySeedForFile(warp, filePath, parentTick);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function emitDirectoryChain(patch: PatchOps, filePath: string): void {
|
|
85
|
-
const parts = filePath.split("/");
|
|
86
|
-
if (parts.length <= 1) return;
|
|
87
|
-
|
|
88
|
-
let current = "";
|
|
89
|
-
for (let index = 0; index < parts.length - 1; index++) {
|
|
90
|
-
const parent = current;
|
|
91
|
-
const part = parts[index] ?? "";
|
|
92
|
-
current = current.length > 0 ? `${current}/${part}` : part;
|
|
93
|
-
const dirId = dirNodeId(current);
|
|
94
|
-
patch.addNode(dirId);
|
|
95
|
-
patch.setProperty(dirId, "path", current);
|
|
96
|
-
|
|
97
|
-
if (parent.length > 0) {
|
|
98
|
-
patch.addEdge(dirNodeId(parent), dirId, "contains");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
patch.addEdge(dirNodeId(current), fileNodeId(filePath), "contains");
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function annotateSymbol(
|
|
106
|
-
patch: PatchOps,
|
|
107
|
-
input: {
|
|
108
|
-
filePath: string;
|
|
109
|
-
entry: OutlineEntry;
|
|
110
|
-
jumpLookup: Map<string, { start: number; end: number }>;
|
|
111
|
-
symbolPath: string;
|
|
112
|
-
identityByPath: SymbolIdentityMap;
|
|
113
|
-
parentSymId?: string | undefined;
|
|
114
|
-
commitId?: string | undefined;
|
|
115
|
-
},
|
|
116
|
-
): void {
|
|
117
|
-
const symId = symNodeId(input.filePath, input.symbolPath);
|
|
118
|
-
patch.addNode(symId);
|
|
119
|
-
patch.setProperty(symId, "name", input.entry.name);
|
|
120
|
-
patch.setProperty(symId, "kind", input.entry.kind);
|
|
121
|
-
patch.setProperty(symId, "exported", input.entry.exported);
|
|
122
|
-
patch.setProperty(symId, "symbolPath", input.symbolPath);
|
|
123
|
-
if (input.entry.signature !== undefined) {
|
|
124
|
-
patch.setProperty(symId, "signature", input.entry.signature);
|
|
125
|
-
}
|
|
126
|
-
const identityId = input.identityByPath.get(input.symbolPath);
|
|
127
|
-
if (identityId !== undefined) {
|
|
128
|
-
patch.setProperty(symId, "identityId", identityId);
|
|
129
|
-
patch.addNode(identityNodeId(identityId));
|
|
130
|
-
patch.setProperty(identityNodeId(identityId), "identityId", identityId);
|
|
131
|
-
patch.setProperty(identityNodeId(identityId), "entityKind", "symbol_identity");
|
|
132
|
-
patch.addEdge(symId, identityNodeId(identityId), "has_identity");
|
|
133
|
-
}
|
|
134
|
-
const jump = input.jumpLookup.get(input.entry.name);
|
|
135
|
-
if (jump !== undefined) {
|
|
136
|
-
patch.setProperty(symId, "startLine", jump.start);
|
|
137
|
-
patch.setProperty(symId, "endLine", jump.end);
|
|
138
|
-
}
|
|
139
|
-
patch.addEdge(fileNodeId(input.filePath), symId, "contains");
|
|
140
|
-
if (input.parentSymId !== undefined) {
|
|
141
|
-
patch.addEdge(input.parentSymId, symId, "child_of");
|
|
142
|
-
}
|
|
143
|
-
if (input.commitId !== undefined) {
|
|
144
|
-
patch.addEdge(input.commitId, symId, "adds");
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function emitSymbols(
|
|
149
|
-
patch: PatchOps,
|
|
150
|
-
filePath: string,
|
|
151
|
-
entries: readonly OutlineEntry[],
|
|
152
|
-
jumpLookup: Map<string, { start: number; end: number }>,
|
|
153
|
-
identityByPath: SymbolIdentityMap,
|
|
154
|
-
parentSymId?: string,
|
|
155
|
-
parentSymbolPath = "",
|
|
156
|
-
commitId?: string,
|
|
157
|
-
): void {
|
|
158
|
-
for (const entry of entries) {
|
|
159
|
-
const symbolPath = buildSymbolPath(parentSymbolPath, entry.name);
|
|
160
|
-
const symId = symNodeId(filePath, symbolPath);
|
|
161
|
-
annotateSymbol(patch, {
|
|
162
|
-
filePath,
|
|
163
|
-
entry,
|
|
164
|
-
jumpLookup,
|
|
165
|
-
symbolPath,
|
|
166
|
-
identityByPath,
|
|
167
|
-
parentSymId,
|
|
168
|
-
commitId,
|
|
169
|
-
});
|
|
170
|
-
if (entry.children !== undefined && entry.children.length > 0) {
|
|
171
|
-
emitSymbols(patch, filePath, entry.children, jumpLookup, identityByPath, symId, symbolPath, commitId);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export function removeSymbols(
|
|
177
|
-
patch: PatchOps,
|
|
178
|
-
filePath: string,
|
|
179
|
-
entries: readonly OutlineEntry[],
|
|
180
|
-
parentSymbolPath = "",
|
|
181
|
-
commitId?: string,
|
|
182
|
-
): void {
|
|
183
|
-
for (const entry of entries) {
|
|
184
|
-
const symbolPath = buildSymbolPath(parentSymbolPath, entry.name);
|
|
185
|
-
if (entry.children !== undefined && entry.children.length > 0) {
|
|
186
|
-
removeSymbols(patch, filePath, entry.children, symbolPath, commitId);
|
|
187
|
-
}
|
|
188
|
-
const symId = symNodeId(filePath, symbolPath);
|
|
189
|
-
if (commitId !== undefined) {
|
|
190
|
-
patch.addEdge(commitId, symId, "removes");
|
|
191
|
-
}
|
|
192
|
-
patch.removeEdge(fileNodeId(filePath), symId, "contains");
|
|
193
|
-
patch.removeNode(symId);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export function applyModifiedSymbols(
|
|
198
|
-
patch: PatchOps,
|
|
199
|
-
filePath: string,
|
|
200
|
-
fileId: string,
|
|
201
|
-
commitId: string,
|
|
202
|
-
oldEntries: readonly OutlineEntry[],
|
|
203
|
-
newEntries: readonly OutlineEntry[],
|
|
204
|
-
jumpLookup: Map<string, { start: number; end: number }>,
|
|
205
|
-
identityByPath: SymbolIdentityMap,
|
|
206
|
-
oldParentPath = "",
|
|
207
|
-
newParentPath = "",
|
|
208
|
-
): void {
|
|
209
|
-
const oldByName = new Map<string, OutlineEntry>();
|
|
210
|
-
for (const entry of oldEntries) {
|
|
211
|
-
oldByName.set(entry.name, entry);
|
|
212
|
-
}
|
|
213
|
-
const newByName = new Map<string, OutlineEntry>();
|
|
214
|
-
for (const entry of newEntries) {
|
|
215
|
-
newByName.set(entry.name, entry);
|
|
216
|
-
}
|
|
217
|
-
const diff = diffOutlines(oldEntries, newEntries);
|
|
218
|
-
const changedNames = new Set(diff.changed.map((entry) => entry.name));
|
|
219
|
-
|
|
220
|
-
for (const removed of diff.removed) {
|
|
221
|
-
const oldEntry = oldByName.get(removed.name);
|
|
222
|
-
if (oldEntry !== undefined) {
|
|
223
|
-
removeSymbols(patch, filePath, [oldEntry], oldParentPath, commitId);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
for (const added of diff.added) {
|
|
228
|
-
const newEntry = newByName.get(added.name);
|
|
229
|
-
if (newEntry !== undefined) {
|
|
230
|
-
emitSymbols(
|
|
231
|
-
patch,
|
|
232
|
-
filePath,
|
|
233
|
-
[newEntry],
|
|
234
|
-
jumpLookup,
|
|
235
|
-
identityByPath,
|
|
236
|
-
undefined,
|
|
237
|
-
newParentPath,
|
|
238
|
-
commitId,
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
for (const [name, newEntry] of newByName) {
|
|
244
|
-
const oldEntry = oldByName.get(name);
|
|
245
|
-
if (oldEntry === undefined) {
|
|
246
|
-
continue;
|
|
247
|
-
}
|
|
248
|
-
const symbolPath = buildSymbolPath(newParentPath, newEntry.name);
|
|
249
|
-
const symId = symNodeId(filePath, symbolPath);
|
|
250
|
-
|
|
251
|
-
applyModifiedSymbols(
|
|
252
|
-
patch,
|
|
253
|
-
filePath,
|
|
254
|
-
fileId,
|
|
255
|
-
commitId,
|
|
256
|
-
oldEntry.children ?? [],
|
|
257
|
-
newEntry.children ?? [],
|
|
258
|
-
jumpLookup,
|
|
259
|
-
identityByPath,
|
|
260
|
-
buildSymbolPath(oldParentPath, oldEntry.name),
|
|
261
|
-
symbolPath,
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
annotateSymbol(patch, {
|
|
265
|
-
filePath,
|
|
266
|
-
entry: newEntry,
|
|
267
|
-
jumpLookup,
|
|
268
|
-
symbolPath,
|
|
269
|
-
identityByPath,
|
|
270
|
-
});
|
|
271
|
-
patch.addEdge(fileId, symId, "contains");
|
|
272
|
-
if (changedNames.has(name)) {
|
|
273
|
-
patch.addEdge(commitId, symId, "changes");
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { diffOutlines } from "../parser/diff.js";
|
|
2
|
-
import type { JumpEntry, OutlineEntry } from "../parser/types.js";
|
|
3
|
-
import type { GitClient } from "../ports/git.js";
|
|
4
|
-
|
|
5
|
-
export interface IndexOptions {
|
|
6
|
-
readonly cwd: string;
|
|
7
|
-
readonly git: GitClient;
|
|
8
|
-
readonly from?: string;
|
|
9
|
-
readonly to?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IndexResultOk {
|
|
13
|
-
readonly ok: true;
|
|
14
|
-
readonly commitsIndexed: number;
|
|
15
|
-
readonly patchesWritten: number;
|
|
16
|
-
readonly commitTicks: ReadonlyMap<string, number>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IndexResultError {
|
|
20
|
-
readonly ok: false;
|
|
21
|
-
readonly error: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export type IndexResult = IndexResultOk | IndexResultError;
|
|
25
|
-
|
|
26
|
-
export interface PatchOps {
|
|
27
|
-
addNode(id: string): PatchOps;
|
|
28
|
-
removeNode(id: string): PatchOps;
|
|
29
|
-
setProperty(id: string, key: string, value: unknown): PatchOps;
|
|
30
|
-
addEdge(from: string, to: string, label: string): PatchOps;
|
|
31
|
-
removeEdge(from: string, to: string, label: string): PatchOps;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface PreparedChange {
|
|
35
|
-
readonly status: string;
|
|
36
|
-
readonly filePath: string;
|
|
37
|
-
readonly previousPath?: string | undefined;
|
|
38
|
-
readonly fileId: string;
|
|
39
|
-
readonly lang: string | null;
|
|
40
|
-
readonly parentExists: boolean;
|
|
41
|
-
readonly oldOutline: readonly OutlineEntry[];
|
|
42
|
-
readonly newOutline?: readonly OutlineEntry[] | undefined;
|
|
43
|
-
readonly jumpLookup?: Map<string, { start: number; end: number }> | undefined;
|
|
44
|
-
readonly diff?: ReturnType<typeof diffOutlines> | undefined;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function fileNodeId(filePath: string): string {
|
|
48
|
-
return `file:${filePath}`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function dirNodeId(dirPath: string): string {
|
|
52
|
-
return `dir:${dirPath}`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function symNodeId(filePath: string, name: string): string {
|
|
56
|
-
return `sym:${filePath}:${name}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function identityNodeId(identityId: string): string {
|
|
60
|
-
return identityId;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function buildJumpLookup(jumpTable: readonly JumpEntry[]): Map<string, { start: number; end: number }> {
|
|
64
|
-
const lookup = new Map<string, { start: number; end: number }>();
|
|
65
|
-
for (const entry of jumpTable) {
|
|
66
|
-
lookup.set(entry.symbol, { start: entry.start, end: entry.end });
|
|
67
|
-
}
|
|
68
|
-
return lookup;
|
|
69
|
-
}
|