@flyingrobots/graft 0.6.1 → 0.7.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 +148 -0
- package/README.md +1 -2
- package/bin/graft.js +26 -26
- 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 +145 -47
- 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 +54 -6
- 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 +6 -0
- package/dist/cli/json-document.d.ts.map +1 -1
- package/dist/cli/json-document.js +12 -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/hooks/posttooluse-read.js +1 -1
- package/dist/hooks/posttooluse-read.js.map +1 -1
- package/dist/hooks/pretooluse-read.js +1 -1
- package/dist/hooks/pretooluse-read.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/daemon-worker-child-pool.d.ts +2 -0
- package/dist/mcp/daemon-worker-child-pool.d.ts.map +1 -1
- package/dist/mcp/daemon-worker-child-pool.js +10 -3
- package/dist/mcp/daemon-worker-child-pool.js.map +1 -1
- package/dist/mcp/daemon-worker-pool.d.ts +1 -1
- package/dist/mcp/daemon-worker-pool.d.ts.map +1 -1
- package/dist/mcp/daemon-worker-pool.js +1 -1
- package/dist/mcp/daemon-worker-pool.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/version.d.ts.map +1 -1
- package/dist/version.js +3 -1
- package/dist/version.js.map +1 -1
- 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 +112 -27
- package/package.json +13 -6
- 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/adapters/canonical-json.ts +0 -56
- package/src/adapters/node-fs.ts +0 -43
- package/src/adapters/node-git.ts +0 -47
- package/src/adapters/node-process-runner.ts +0 -27
- package/src/adapters/repo-paths.ts +0 -22
- package/src/adapters/rotating-ndjson-log.ts +0 -66
- package/src/api/index.ts +0 -107
- package/src/api/repo-local-graft.ts +0 -21
- package/src/api/repo-workspace.ts +0 -34
- package/src/api/tool-bridge.ts +0 -21
- package/src/cli/activity-render.ts +0 -112
- package/src/cli/cli-error.ts +0 -153
- package/src/cli/command-parser.ts +0 -302
- package/src/cli/entrypoint.ts +0 -18
- package/src/cli/index-cmd.ts +0 -94
- package/src/cli/index-model.ts +0 -76
- package/src/cli/init-bootstrap.ts +0 -47
- package/src/cli/init-client-config.ts +0 -299
- package/src/cli/init-model.ts +0 -229
- package/src/cli/init-render.ts +0 -54
- package/src/cli/init-target-hooks.ts +0 -93
- package/src/cli/init.ts +0 -122
- package/src/cli/json-document.ts +0 -144
- package/src/cli/local-history-dag-model.ts +0 -437
- package/src/cli/local-history-dag-render.ts +0 -133
- package/src/cli/local-history-dag.ts +0 -103
- package/src/cli/main.ts +0 -150
- package/src/cli/migrate-local-history.ts +0 -118
- package/src/cli/peer-command.ts +0 -59
- package/src/contracts/capabilities.ts +0 -450
- package/src/contracts/causal-ontology.ts +0 -627
- package/src/contracts/causal-surface-next-action.ts +0 -18
- package/src/contracts/json-object.ts +0 -28
- package/src/contracts/mcp-runtime.ts +0 -16
- package/src/contracts/output-schema-cli.ts +0 -70
- package/src/contracts/output-schema-fragments.ts +0 -831
- package/src/contracts/output-schema-mcp.ts +0 -282
- package/src/contracts/output-schema-meta.ts +0 -119
- package/src/contracts/output-schemas.ts +0 -1230
- package/src/git/diff.ts +0 -100
- package/src/git/target-git-hook-bootstrap.ts +0 -56
- package/src/guards/stream-boundary.ts +0 -110
- package/src/hooks/posttooluse-read.ts +0 -54
- package/src/hooks/pretooluse-read.ts +0 -52
- package/src/hooks/read-governor.ts +0 -95
- package/src/hooks/read-messages.ts +0 -53
- package/src/hooks/shared.ts +0 -168
- package/src/index.ts +0 -1
- package/src/mcp/burden.ts +0 -123
- package/src/mcp/cache.ts +0 -7
- package/src/mcp/cached-file.ts +0 -1
- package/src/mcp/context.ts +0 -187
- package/src/mcp/control-plane/authz-storage.ts +0 -129
- package/src/mcp/control-plane/session-registry.ts +0 -115
- package/src/mcp/control-plane/status-projection.ts +0 -76
- package/src/mcp/control-plane/types.ts +0 -144
- package/src/mcp/daemon-bootstrap.ts +0 -100
- package/src/mcp/daemon-control-plane.ts +0 -310
- package/src/mcp/daemon-job-scheduler.ts +0 -279
- package/src/mcp/daemon-repos.ts +0 -99
- package/src/mcp/daemon-server.ts +0 -165
- package/src/mcp/daemon-session-host.ts +0 -230
- package/src/mcp/daemon-stdio-bridge.ts +0 -260
- package/src/mcp/daemon-worker-child-pool.ts +0 -213
- package/src/mcp/daemon-worker-inline-pool.ts +0 -46
- package/src/mcp/daemon-worker-pool.ts +0 -7
- package/src/mcp/daemon-worker-process.ts +0 -52
- package/src/mcp/daemon-worker-types.ts +0 -66
- package/src/mcp/metrics.ts +0 -176
- package/src/mcp/monitor-health.ts +0 -83
- package/src/mcp/monitor-persistence.ts +0 -54
- package/src/mcp/monitor-tick-job.ts +0 -102
- package/src/mcp/monitor-types.ts +0 -103
- package/src/mcp/persisted-local-history-graph.ts +0 -591
- package/src/mcp/persisted-local-history-policy.ts +0 -501
- package/src/mcp/persisted-local-history-views.ts +0 -250
- package/src/mcp/persisted-local-history.ts +0 -1621
- package/src/mcp/persistent-monitor-runtime.ts +0 -445
- package/src/mcp/policy.ts +0 -75
- package/src/mcp/receipt.ts +0 -201
- package/src/mcp/repo-concurrency.ts +0 -392
- package/src/mcp/repo-overview/filter.ts +0 -44
- package/src/mcp/repo-overview/types.ts +0 -63
- package/src/mcp/repo-overview/view-projection.ts +0 -90
- package/src/mcp/repo-state-git.ts +0 -247
- package/src/mcp/repo-state-observation.ts +0 -203
- package/src/mcp/repo-state-transition.ts +0 -151
- package/src/mcp/repo-state-types.ts +0 -107
- package/src/mcp/repo-state.ts +0 -146
- package/src/mcp/repo-tool-job.ts +0 -102
- package/src/mcp/repo-tool-worker-context.ts +0 -212
- package/src/mcp/repo-workspace.ts +0 -21
- package/src/mcp/run-capture-config.ts +0 -33
- package/src/mcp/runtime-causal-context.ts +0 -72
- package/src/mcp/runtime-observability.ts +0 -217
- package/src/mcp/runtime-staged-target.ts +0 -161
- package/src/mcp/runtime-workspace-overlay.ts +0 -255
- package/src/mcp/secret-scrub.ts +0 -89
- package/src/mcp/semantic-transition-guidance.ts +0 -60
- package/src/mcp/semantic-transition-summary.ts +0 -130
- package/src/mcp/server-context.ts +0 -223
- package/src/mcp/server-invocation.ts +0 -388
- package/src/mcp/server-tool-access.ts +0 -145
- package/src/mcp/server.ts +0 -265
- package/src/mcp/stdio-server.ts +0 -26
- package/src/mcp/stdio.ts +0 -3
- package/src/mcp/tool-registry.ts +0 -80
- package/src/mcp/tools/activity-view.ts +0 -325
- package/src/mcp/tools/budget.ts +0 -23
- package/src/mcp/tools/causal-attach.ts +0 -67
- package/src/mcp/tools/causal-status.ts +0 -58
- package/src/mcp/tools/changed-since.ts +0 -71
- package/src/mcp/tools/code-find.ts +0 -169
- package/src/mcp/tools/code-refs.ts +0 -470
- package/src/mcp/tools/code-show.ts +0 -262
- package/src/mcp/tools/daemon-monitors.ts +0 -14
- package/src/mcp/tools/daemon-repos.ts +0 -22
- package/src/mcp/tools/daemon-sessions.ts +0 -14
- package/src/mcp/tools/daemon-status.ts +0 -12
- package/src/mcp/tools/diagnostic-models.ts +0 -95
- package/src/mcp/tools/doctor.ts +0 -66
- package/src/mcp/tools/explain.ts +0 -84
- package/src/mcp/tools/file-outline.ts +0 -67
- package/src/mcp/tools/git-files.ts +0 -73
- package/src/mcp/tools/graft-diff.ts +0 -35
- package/src/mcp/tools/map-collector.ts +0 -338
- package/src/mcp/tools/map.ts +0 -185
- package/src/mcp/tools/monitor-pause.ts +0 -18
- package/src/mcp/tools/monitor-resume.ts +0 -18
- package/src/mcp/tools/monitor-start.ts +0 -20
- package/src/mcp/tools/monitor-stop.ts +0 -18
- package/src/mcp/tools/precision-live.ts +0 -158
- package/src/mcp/tools/precision-match.ts +0 -54
- package/src/mcp/tools/precision-paths.ts +0 -59
- package/src/mcp/tools/precision-query.ts +0 -127
- package/src/mcp/tools/precision-show.ts +0 -86
- package/src/mcp/tools/precision-visibility.ts +0 -44
- package/src/mcp/tools/precision-warp.ts +0 -90
- package/src/mcp/tools/precision.ts +0 -21
- package/src/mcp/tools/read-range.ts +0 -28
- package/src/mcp/tools/run-capture.ts +0 -149
- package/src/mcp/tools/safe-read.ts +0 -148
- package/src/mcp/tools/since.ts +0 -53
- package/src/mcp/tools/state.ts +0 -39
- package/src/mcp/tools/stats.ts +0 -24
- package/src/mcp/tools/workspace-authorizations.ts +0 -14
- package/src/mcp/tools/workspace-authorize.ts +0 -20
- package/src/mcp/tools/workspace-bind.ts +0 -25
- package/src/mcp/tools/workspace-rebind.ts +0 -25
- package/src/mcp/tools/workspace-revoke.ts +0 -18
- package/src/mcp/tools/workspace-status.ts +0 -12
- package/src/mcp/warp-pool.ts +0 -36
- package/src/mcp/workspace-read-observation-model.ts +0 -48
- package/src/mcp/workspace-read-observation.ts +0 -103
- package/src/mcp/workspace-router-capability.ts +0 -32
- package/src/mcp/workspace-router-history.ts +0 -233
- package/src/mcp/workspace-router-model.ts +0 -131
- package/src/mcp/workspace-router-resolution.ts +0 -71
- package/src/mcp/workspace-router-runtime.ts +0 -243
- package/src/mcp/workspace-router.ts +0 -681
- package/src/metrics/logger.ts +0 -40
- package/src/metrics/types.ts +0 -40
- package/src/operations/cached-file.ts +0 -40
- package/src/operations/diff-identity.ts +0 -127
- package/src/operations/file-outline.ts +0 -48
- package/src/operations/graft-diff.ts +0 -162
- package/src/operations/observation-cache.ts +0 -149
- package/src/operations/read-range.ts +0 -64
- package/src/operations/repo-workspace.ts +0 -339
- package/src/operations/result-dto.ts +0 -23
- package/src/operations/safe-read.ts +0 -118
- package/src/operations/state.ts +0 -66
- package/src/operations/structured-buffer-compare.ts +0 -429
- package/src/operations/structured-buffer-model.ts +0 -456
- package/src/operations/structured-buffer-query.ts +0 -794
- package/src/operations/structured-buffer.ts +0 -181
- package/src/parser/diff.ts +0 -313
- package/src/parser/lang.ts +0 -71
- package/src/parser/markdown.ts +0 -197
- package/src/parser/outline.ts +0 -316
- package/src/parser/runtime.ts +0 -71
- package/src/parser/types.ts +0 -75
- package/src/policy/evaluate.ts +0 -178
- package/src/policy/graftignore.ts +0 -6
- package/src/policy/types.ts +0 -87
- package/src/ports/codec.ts +0 -13
- package/src/ports/filesystem.ts +0 -18
- package/src/ports/git.ts +0 -16
- package/src/ports/guards.ts +0 -68
- package/src/ports/process-runner.ts +0 -22
- package/src/ports/warp.ts +0 -55
- package/src/release/security-gate.ts +0 -102
- package/src/session/tracker.ts +0 -145
- package/src/session/types.ts +0 -23
- package/src/version.ts +0 -3
- 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/observers.ts +0 -100
- package/src/warp/open.ts +0 -93
- package/src/warp/plumbing.d.ts +0 -15
- package/src/warp/symbol-identity.ts +0 -100
- package/src/warp/writer-id.ts +0 -30
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { AuthorizedWorkspaceRecord, DaemonSessionView } from "../daemon-control-plane.js";
|
|
2
|
-
import type { MonitorStatusView } from "../persistent-monitor-runtime.js";
|
|
3
|
-
import type { DaemonRepoMonitorView, DaemonRepoView, DaemonRepoWorktreeView } from "./types.js";
|
|
4
|
-
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// Timestamp helpers
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
export function maxIsoTimestamp(values: readonly (string | null | undefined)[]): string | null {
|
|
10
|
-
let latest: string | null = null;
|
|
11
|
-
for (const value of values) {
|
|
12
|
-
if (value === undefined || value === null || value.length === 0) continue;
|
|
13
|
-
if (latest === null || value.localeCompare(latest) > 0) {
|
|
14
|
-
latest = value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return latest;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// ---------------------------------------------------------------------------
|
|
21
|
-
// Worktree view projection
|
|
22
|
-
// ---------------------------------------------------------------------------
|
|
23
|
-
|
|
24
|
-
export function toWorktreeView(
|
|
25
|
-
workspace: AuthorizedWorkspaceRecord,
|
|
26
|
-
repoSessions: readonly DaemonSessionView[],
|
|
27
|
-
): DaemonRepoWorktreeView {
|
|
28
|
-
return {
|
|
29
|
-
worktreeId: workspace.worktreeId,
|
|
30
|
-
worktreeRoot: workspace.worktreeRoot,
|
|
31
|
-
activeSessions: repoSessions.filter((session) => {
|
|
32
|
-
return session.bindState === "bound" && session.worktreeId === workspace.worktreeId;
|
|
33
|
-
}).length,
|
|
34
|
-
lastBoundAt: workspace.lastBoundAt,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// Monitor view projection
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
|
|
42
|
-
export function toMonitorView(monitor: MonitorStatusView): DaemonRepoMonitorView {
|
|
43
|
-
return {
|
|
44
|
-
workerKind: monitor.workerKind,
|
|
45
|
-
lifecycleState: monitor.lifecycleState,
|
|
46
|
-
health: monitor.health,
|
|
47
|
-
lastTickAt: monitor.lastTickAt,
|
|
48
|
-
lastSuccessAt: monitor.lastSuccessAt,
|
|
49
|
-
lastError: monitor.lastError,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// ---------------------------------------------------------------------------
|
|
54
|
-
// Repo view assembly
|
|
55
|
-
// ---------------------------------------------------------------------------
|
|
56
|
-
|
|
57
|
-
export function toRepoView(
|
|
58
|
-
repoId: string,
|
|
59
|
-
sortedWorkspaces: readonly AuthorizedWorkspaceRecord[],
|
|
60
|
-
repoSessions: readonly DaemonSessionView[],
|
|
61
|
-
monitor: MonitorStatusView | null,
|
|
62
|
-
): DaemonRepoView {
|
|
63
|
-
const firstWorkspace = sortedWorkspaces[0];
|
|
64
|
-
if (firstWorkspace === undefined) {
|
|
65
|
-
throw new Error(`DaemonRepoOverview: missing workspace for repo ${repoId}`);
|
|
66
|
-
}
|
|
67
|
-
const worktrees = sortedWorkspaces.map((workspace) => toWorktreeView(workspace, repoSessions));
|
|
68
|
-
const boundSessions = repoSessions.filter((session) => session.bindState === "bound").length;
|
|
69
|
-
const lastBoundAt = maxIsoTimestamp(sortedWorkspaces.map((workspace) => workspace.lastBoundAt));
|
|
70
|
-
const lastActivityAt = maxIsoTimestamp([
|
|
71
|
-
...sortedWorkspaces.map((workspace) => workspace.authorizedAt),
|
|
72
|
-
...sortedWorkspaces.map((workspace) => workspace.lastBoundAt),
|
|
73
|
-
...repoSessions.map((session) => session.lastActivityAt),
|
|
74
|
-
...(monitor === null
|
|
75
|
-
? []
|
|
76
|
-
: [monitor.lastStartedAt, monitor.lastTickAt, monitor.lastSuccessAt]),
|
|
77
|
-
]);
|
|
78
|
-
return {
|
|
79
|
-
repoId,
|
|
80
|
-
gitCommonDir: firstWorkspace.gitCommonDir,
|
|
81
|
-
authorizedWorkspaces: sortedWorkspaces.length,
|
|
82
|
-
boundSessions,
|
|
83
|
-
activeWorktrees: worktrees.filter((worktree) => worktree.activeSessions > 0).length,
|
|
84
|
-
backlogCommits: monitor?.backlogCommits ?? 0,
|
|
85
|
-
lastBoundAt,
|
|
86
|
-
lastActivityAt,
|
|
87
|
-
monitor: monitor === null ? null : toMonitorView(monitor),
|
|
88
|
-
worktrees,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import type { GitClient } from "../ports/git.js";
|
|
2
|
-
import type { FileSystem } from "../ports/filesystem.js";
|
|
3
|
-
import type { HeadReflogEntry, RebaseProgressState, RepoSnapshot } from "./repo-state-types.js";
|
|
4
|
-
|
|
5
|
-
export async function git(gitClient: GitClient, args: readonly string[], cwd: string): Promise<string> {
|
|
6
|
-
const result = await gitClient.run({ args, cwd });
|
|
7
|
-
if (result.error !== undefined || result.status !== 0) {
|
|
8
|
-
throw result.error ?? new Error(result.stderr.trim() || `git exited with status ${String(result.status)}`);
|
|
9
|
-
}
|
|
10
|
-
return result.stdout;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export async function readGit(gitClient: GitClient, args: readonly string[], cwd: string): Promise<string | null> {
|
|
14
|
-
try {
|
|
15
|
-
const value = (await git(gitClient, args, cwd)).trim();
|
|
16
|
-
return value.length > 0 ? value : null;
|
|
17
|
-
} catch {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
async function readGitPorcelain(gitClient: GitClient, args: readonly string[], cwd: string): Promise<string | null> {
|
|
23
|
-
try {
|
|
24
|
-
const value = (await git(gitClient, args, cwd)).replace(/\r?\n$/, "");
|
|
25
|
-
return value.length > 0 ? value : null;
|
|
26
|
-
} catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function readGitLines(gitClient: GitClient, args: readonly string[], cwd: string): Promise<string[]> {
|
|
32
|
-
const value = await readGitPorcelain(gitClient, args, cwd);
|
|
33
|
-
return value === null ? [] : value.split("\n");
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async function readGitPathText(
|
|
37
|
-
fs: FileSystem,
|
|
38
|
-
gitClient: GitClient,
|
|
39
|
-
cwd: string,
|
|
40
|
-
gitPath: string,
|
|
41
|
-
): Promise<string | null> {
|
|
42
|
-
const resolvedPath = await readGit(gitClient, ["rev-parse", "--path-format=absolute", "--git-path", gitPath], cwd);
|
|
43
|
-
if (resolvedPath === null) return null;
|
|
44
|
-
|
|
45
|
-
try {
|
|
46
|
-
const content = await fs.readFile(resolvedPath, "utf-8");
|
|
47
|
-
const value = content.trim();
|
|
48
|
-
return value.length > 0 ? value : null;
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function parseOptionalInt(value: string | null): number | null {
|
|
55
|
-
if (value === null) return null;
|
|
56
|
-
const parsed = Number.parseInt(value, 10);
|
|
57
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function countStatusLines(statusLines: readonly string[]): {
|
|
61
|
-
stagedPaths: number;
|
|
62
|
-
changedPaths: number;
|
|
63
|
-
untrackedPaths: number;
|
|
64
|
-
} {
|
|
65
|
-
let stagedPaths = 0;
|
|
66
|
-
let changedPaths = 0;
|
|
67
|
-
let untrackedPaths = 0;
|
|
68
|
-
|
|
69
|
-
for (const statusLine of statusLines) {
|
|
70
|
-
const x = statusLine[0] ?? " ";
|
|
71
|
-
const y = statusLine[1] ?? " ";
|
|
72
|
-
if (x === "?" && y === "?") {
|
|
73
|
-
untrackedPaths++;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (x !== " ") stagedPaths++;
|
|
77
|
-
if (y !== " ") changedPaths++;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return { stagedPaths, changedPaths, untrackedPaths };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async function countUnmergedPaths(gitClient: GitClient, cwd: string): Promise<number> {
|
|
84
|
-
const paths = await readGitLines(gitClient, ["diff", "--name-only", "--diff-filter=U", "--"], cwd);
|
|
85
|
-
return new Set(paths.filter((value) => value.length > 0)).size;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function mergeStatusLines(
|
|
89
|
-
stagedLines: readonly string[],
|
|
90
|
-
changedLines: readonly string[],
|
|
91
|
-
untrackedLines: readonly string[],
|
|
92
|
-
): readonly string[] {
|
|
93
|
-
const merged = new Map<string, { x: string; y: string }>();
|
|
94
|
-
|
|
95
|
-
for (const line of stagedLines) {
|
|
96
|
-
const parts = line.split("\t");
|
|
97
|
-
const rawStatus = parts[0] ?? "";
|
|
98
|
-
const filePath = parts.at(-1) ?? "";
|
|
99
|
-
if (filePath.length === 0) continue;
|
|
100
|
-
const existing = merged.get(filePath) ?? { x: " ", y: " " };
|
|
101
|
-
existing.x = rawStatus[0] ?? "M";
|
|
102
|
-
merged.set(filePath, existing);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
for (const line of changedLines) {
|
|
106
|
-
const parts = line.split("\t");
|
|
107
|
-
const rawStatus = parts[0] ?? "";
|
|
108
|
-
const filePath = parts.at(-1) ?? "";
|
|
109
|
-
if (filePath.length === 0) continue;
|
|
110
|
-
const existing = merged.get(filePath) ?? { x: " ", y: " " };
|
|
111
|
-
existing.y = rawStatus[0] ?? "M";
|
|
112
|
-
merged.set(filePath, existing);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
for (const filePath of untrackedLines) {
|
|
116
|
-
if (filePath.length === 0) continue;
|
|
117
|
-
merged.set(filePath, { x: "?", y: "?" });
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return [...merged.entries()]
|
|
121
|
-
.sort(([left], [right]) => left.localeCompare(right))
|
|
122
|
-
.map(([filePath, status]) => `${status.x}${status.y} ${filePath}`);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
async function readParentShas(gitClient: GitClient, cwd: string, headSha: string | null): Promise<readonly string[]> {
|
|
126
|
-
if (headSha === null) return [];
|
|
127
|
-
const raw = await readGit(gitClient, ["show", "-s", "--format=%P", headSha], cwd);
|
|
128
|
-
if (raw === null || raw.trim().length === 0) return [];
|
|
129
|
-
return raw.trim().split(/\s+/).filter((sha) => sha.length > 0);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async function readMergeInProgress(
|
|
133
|
-
fs: FileSystem,
|
|
134
|
-
gitClient: GitClient,
|
|
135
|
-
cwd: string,
|
|
136
|
-
): Promise<boolean> {
|
|
137
|
-
return (await readGitPathText(fs, gitClient, cwd, "MERGE_HEAD")) !== null;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async function readRebaseProgressState(
|
|
141
|
-
fs: FileSystem,
|
|
142
|
-
gitClient: GitClient,
|
|
143
|
-
cwd: string,
|
|
144
|
-
): Promise<RebaseProgressState> {
|
|
145
|
-
const mergeHead = await readGitPathText(fs, gitClient, cwd, "rebase-merge/head-name");
|
|
146
|
-
if (mergeHead !== null) {
|
|
147
|
-
return {
|
|
148
|
-
inProgress: true,
|
|
149
|
-
step: parseOptionalInt(await readGitPathText(fs, gitClient, cwd, "rebase-merge/msgnum")),
|
|
150
|
-
total: parseOptionalInt(await readGitPathText(fs, gitClient, cwd, "rebase-merge/end")),
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const applyHead = await readGitPathText(fs, gitClient, cwd, "rebase-apply/head-name");
|
|
155
|
-
if (applyHead !== null) {
|
|
156
|
-
return {
|
|
157
|
-
inProgress: true,
|
|
158
|
-
step: parseOptionalInt(await readGitPathText(fs, gitClient, cwd, "rebase-apply/next")),
|
|
159
|
-
total: parseOptionalInt(await readGitPathText(fs, gitClient, cwd, "rebase-apply/last")),
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const rebaseHead = await readGitPathText(fs, gitClient, cwd, "REBASE_HEAD");
|
|
164
|
-
return {
|
|
165
|
-
inProgress: rebaseHead !== null,
|
|
166
|
-
step: null,
|
|
167
|
-
total: null,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async function readHeadReflog(fs: FileSystem, gitClient: GitClient, cwd: string): Promise<HeadReflogEntry | null> {
|
|
172
|
-
const reflogPath = await readGit(gitClient, ["rev-parse", "--path-format=absolute", "--git-path", "logs/HEAD"], cwd);
|
|
173
|
-
if (reflogPath === null) return null;
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
const content = await fs.readFile(reflogPath, "utf-8");
|
|
177
|
-
const lines = content.split(/\r?\n/).map((line) => line.trimEnd());
|
|
178
|
-
let raw: string | null = null;
|
|
179
|
-
for (let index = lines.length - 1; index >= 0; index--) {
|
|
180
|
-
const line = lines[index];
|
|
181
|
-
if (line !== undefined && line.length > 0) {
|
|
182
|
-
raw = line;
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (raw === null) return null;
|
|
187
|
-
const [meta = "", subject = ""] = raw.split("\t");
|
|
188
|
-
const tokens = meta.split(" ");
|
|
189
|
-
const previousSha = tokens[0] ?? null;
|
|
190
|
-
const nextSha = tokens[1] ?? null;
|
|
191
|
-
const timestampToken = tokens.length >= 2 ? tokens[tokens.length - 2] : undefined;
|
|
192
|
-
const timestampSec = timestampToken !== undefined ? Number.parseInt(timestampToken, 10) : Number.NaN;
|
|
193
|
-
|
|
194
|
-
return {
|
|
195
|
-
raw,
|
|
196
|
-
previousSha: previousSha !== null && /^[0-9a-f]{40}$/i.test(previousSha) ? previousSha : null,
|
|
197
|
-
nextSha: nextSha !== null && /^[0-9a-f]{40}$/i.test(nextSha) ? nextSha : null,
|
|
198
|
-
timestampSec: Number.isFinite(timestampSec) ? timestampSec : null,
|
|
199
|
-
subject,
|
|
200
|
-
};
|
|
201
|
-
} catch {
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
export async function isAncestor(
|
|
207
|
-
gitClient: GitClient,
|
|
208
|
-
cwd: string,
|
|
209
|
-
possibleAncestor: string | null,
|
|
210
|
-
possibleDescendant: string | null,
|
|
211
|
-
): Promise<boolean> {
|
|
212
|
-
if (possibleAncestor === null || possibleDescendant === null) {
|
|
213
|
-
return false;
|
|
214
|
-
}
|
|
215
|
-
const result = await gitClient.run({
|
|
216
|
-
args: ["merge-base", "--is-ancestor", possibleAncestor, possibleDescendant],
|
|
217
|
-
cwd,
|
|
218
|
-
});
|
|
219
|
-
return result.status === 0;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export async function captureSnapshot(cwd: string, fs: FileSystem, gitClient: GitClient): Promise<RepoSnapshot> {
|
|
223
|
-
const headSha = await readGit(gitClient, ["rev-parse", "HEAD"], cwd);
|
|
224
|
-
const statusLines = mergeStatusLines(
|
|
225
|
-
headSha === null ? [] : await readGitLines(gitClient, ["diff-index", "--cached", "--find-renames", "--name-status", headSha, "--"], cwd),
|
|
226
|
-
await readGitLines(gitClient, ["diff-files", "--find-renames", "--name-status", "--"], cwd),
|
|
227
|
-
await readGitLines(gitClient, ["ls-files", "--others", "--exclude-standard"], cwd),
|
|
228
|
-
);
|
|
229
|
-
const counts = countStatusLines(statusLines);
|
|
230
|
-
const unmergedPaths = await countUnmergedPaths(gitClient, cwd);
|
|
231
|
-
const mergeInProgress = await readMergeInProgress(fs, gitClient, cwd);
|
|
232
|
-
const rebase = await readRebaseProgressState(fs, gitClient, cwd);
|
|
233
|
-
|
|
234
|
-
return {
|
|
235
|
-
headRef: await readGit(gitClient, ["symbolic-ref", "--quiet", "--short", "HEAD"], cwd),
|
|
236
|
-
headSha,
|
|
237
|
-
parentShas: await readParentShas(gitClient, cwd, headSha),
|
|
238
|
-
observedAt: new Date().toISOString(),
|
|
239
|
-
statusLines,
|
|
240
|
-
dirty: statusLines.length > 0,
|
|
241
|
-
...counts,
|
|
242
|
-
unmergedPaths,
|
|
243
|
-
mergeInProgress,
|
|
244
|
-
rebase,
|
|
245
|
-
headReflog: await readHeadReflog(fs, gitClient, cwd),
|
|
246
|
-
};
|
|
247
|
-
}
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import * as crypto from "node:crypto";
|
|
2
|
-
import { buildSemanticTransitionSummary } from "./semantic-transition-summary.js";
|
|
3
|
-
import type {
|
|
4
|
-
RepoObservation,
|
|
5
|
-
RepoSemanticTransition,
|
|
6
|
-
RepoSemanticTransitionPhase,
|
|
7
|
-
RepoSnapshot,
|
|
8
|
-
RepoTransition,
|
|
9
|
-
WorkspaceOverlaySummary,
|
|
10
|
-
} from "./repo-state-types.js";
|
|
11
|
-
|
|
12
|
-
function stableId(prefix: string, input: string): string {
|
|
13
|
-
return `${prefix}:${crypto.createHash("sha256").update(input).digest("hex").slice(0, 16)}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function buildWorkspaceOverlayId(snapshot: RepoSnapshot, checkoutEpoch: number): string | null {
|
|
17
|
-
if (!snapshot.dirty) return null;
|
|
18
|
-
return stableId("overlay", `${String(checkoutEpoch)}\n${snapshot.statusLines.join("\n")}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function buildWorkspaceOverlay(snapshot: RepoSnapshot): WorkspaceOverlaySummary | null {
|
|
22
|
-
if (!snapshot.dirty) return null;
|
|
23
|
-
return {
|
|
24
|
-
dirty: true,
|
|
25
|
-
totalPaths: snapshot.statusLines.length,
|
|
26
|
-
stagedPaths: snapshot.stagedPaths,
|
|
27
|
-
changedPaths: snapshot.changedPaths,
|
|
28
|
-
untrackedPaths: snapshot.untrackedPaths,
|
|
29
|
-
actorGuess: "unknown",
|
|
30
|
-
confidence: "low",
|
|
31
|
-
evidence: {
|
|
32
|
-
source: "git status --porcelain",
|
|
33
|
-
reflogSubject: null,
|
|
34
|
-
sample: snapshot.statusLines.slice(0, 10),
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function buildSemanticTransitionEvidence(
|
|
40
|
-
snapshot: RepoSnapshot,
|
|
41
|
-
lastTransition: RepoTransition | null,
|
|
42
|
-
): RepoSemanticTransition["evidence"] {
|
|
43
|
-
return {
|
|
44
|
-
totalPaths: snapshot.statusLines.length,
|
|
45
|
-
stagedPaths: snapshot.stagedPaths,
|
|
46
|
-
changedPaths: snapshot.changedPaths,
|
|
47
|
-
untrackedPaths: snapshot.untrackedPaths,
|
|
48
|
-
unmergedPaths: snapshot.unmergedPaths,
|
|
49
|
-
mergeInProgress: snapshot.mergeInProgress,
|
|
50
|
-
rebaseInProgress: snapshot.rebase.inProgress,
|
|
51
|
-
rebaseStep: snapshot.rebase.step,
|
|
52
|
-
rebaseTotalSteps: snapshot.rebase.total,
|
|
53
|
-
lastTransitionKind: lastTransition?.kind ?? null,
|
|
54
|
-
reflogSubject: lastTransition?.evidence.reflogSubject ?? snapshot.headReflog?.subject ?? null,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function buildSemanticTransition(
|
|
59
|
-
previous: RepoSnapshot | null,
|
|
60
|
-
current: RepoSnapshot,
|
|
61
|
-
lastTransition: RepoTransition | null,
|
|
62
|
-
): RepoSemanticTransition | null {
|
|
63
|
-
const evidence = buildSemanticTransitionEvidence(current, lastTransition);
|
|
64
|
-
|
|
65
|
-
if (current.mergeInProgress) {
|
|
66
|
-
return {
|
|
67
|
-
kind: "merge_phase",
|
|
68
|
-
authority: "authoritative_git_state",
|
|
69
|
-
phase: current.unmergedPaths > 0 ? "conflicted" : "resolved_waiting_commit",
|
|
70
|
-
summary: buildSemanticTransitionSummary({
|
|
71
|
-
kind: "merge_phase",
|
|
72
|
-
evidence,
|
|
73
|
-
phase: current.unmergedPaths > 0 ? "conflicted" : "resolved_waiting_commit",
|
|
74
|
-
}),
|
|
75
|
-
evidence,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (current.rebase.inProgress) {
|
|
80
|
-
const phase: RepoSemanticTransitionPhase = current.unmergedPaths > 0
|
|
81
|
-
? "conflicted"
|
|
82
|
-
: ((current.rebase.step ?? 1) > 1 ? "continued" : "started");
|
|
83
|
-
return {
|
|
84
|
-
kind: "rebase_phase",
|
|
85
|
-
authority: "authoritative_git_state",
|
|
86
|
-
phase,
|
|
87
|
-
summary: buildSemanticTransitionSummary({
|
|
88
|
-
kind: "rebase_phase",
|
|
89
|
-
evidence,
|
|
90
|
-
phase,
|
|
91
|
-
}),
|
|
92
|
-
evidence,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const unmergedChanged = previous !== null && previous.unmergedPaths !== current.unmergedPaths;
|
|
97
|
-
if (current.unmergedPaths > 0 || unmergedChanged) {
|
|
98
|
-
return {
|
|
99
|
-
kind: "conflict_resolution",
|
|
100
|
-
authority: "authoritative_git_state",
|
|
101
|
-
phase: null,
|
|
102
|
-
summary: buildSemanticTransitionSummary({
|
|
103
|
-
kind: "conflict_resolution",
|
|
104
|
-
evidence,
|
|
105
|
-
phase: null,
|
|
106
|
-
previousUnmergedPaths: previous?.unmergedPaths ?? null,
|
|
107
|
-
}),
|
|
108
|
-
evidence,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (lastTransition?.kind === "merge") {
|
|
113
|
-
return {
|
|
114
|
-
kind: "merge_phase",
|
|
115
|
-
authority: "repo_snapshot",
|
|
116
|
-
phase: "completed_or_cleared",
|
|
117
|
-
summary: buildSemanticTransitionSummary({
|
|
118
|
-
kind: "merge_phase",
|
|
119
|
-
evidence,
|
|
120
|
-
phase: "completed_or_cleared",
|
|
121
|
-
}),
|
|
122
|
-
evidence,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (lastTransition?.kind === "rebase") {
|
|
127
|
-
return {
|
|
128
|
-
kind: "rebase_phase",
|
|
129
|
-
authority: "repo_snapshot",
|
|
130
|
-
phase: "completed_or_cleared",
|
|
131
|
-
summary: buildSemanticTransitionSummary({
|
|
132
|
-
kind: "rebase_phase",
|
|
133
|
-
evidence,
|
|
134
|
-
phase: "completed_or_cleared",
|
|
135
|
-
}),
|
|
136
|
-
evidence,
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (current.statusLines.length >= 8) {
|
|
141
|
-
return {
|
|
142
|
-
kind: "bulk_transition",
|
|
143
|
-
authority: "repo_snapshot",
|
|
144
|
-
phase: null,
|
|
145
|
-
summary: buildSemanticTransitionSummary({
|
|
146
|
-
kind: "bulk_transition",
|
|
147
|
-
evidence,
|
|
148
|
-
phase: null,
|
|
149
|
-
}),
|
|
150
|
-
evidence,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (current.stagedPaths > 0) {
|
|
155
|
-
return {
|
|
156
|
-
kind: "index_update",
|
|
157
|
-
authority: "repo_snapshot",
|
|
158
|
-
phase: null,
|
|
159
|
-
summary: buildSemanticTransitionSummary({
|
|
160
|
-
kind: "index_update",
|
|
161
|
-
evidence,
|
|
162
|
-
phase: null,
|
|
163
|
-
}),
|
|
164
|
-
evidence,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (current.statusLines.length > 0) {
|
|
169
|
-
return {
|
|
170
|
-
kind: "unknown",
|
|
171
|
-
authority: "repo_snapshot",
|
|
172
|
-
phase: null,
|
|
173
|
-
summary: buildSemanticTransitionSummary({
|
|
174
|
-
kind: "unknown",
|
|
175
|
-
evidence,
|
|
176
|
-
phase: null,
|
|
177
|
-
}),
|
|
178
|
-
evidence,
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
return null;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export function buildObservation(
|
|
186
|
-
snapshot: RepoSnapshot,
|
|
187
|
-
checkoutEpoch: number,
|
|
188
|
-
lastTransition: RepoTransition | null,
|
|
189
|
-
semanticTransition: RepoSemanticTransition | null,
|
|
190
|
-
): RepoObservation {
|
|
191
|
-
return {
|
|
192
|
-
checkoutEpoch,
|
|
193
|
-
headRef: snapshot.headRef,
|
|
194
|
-
headSha: snapshot.headSha,
|
|
195
|
-
dirty: snapshot.dirty,
|
|
196
|
-
observedAt: snapshot.observedAt,
|
|
197
|
-
lastTransition,
|
|
198
|
-
semanticTransition,
|
|
199
|
-
workspaceOverlayId: buildWorkspaceOverlayId(snapshot, checkoutEpoch),
|
|
200
|
-
workspaceOverlay: buildWorkspaceOverlay(snapshot),
|
|
201
|
-
statusLines: snapshot.statusLines,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type { GitClient } from "../ports/git.js";
|
|
2
|
-
import type { RepoSnapshot, RepoTransition } from "./repo-state-types.js";
|
|
3
|
-
import { isAncestor } from "./repo-state-git.js";
|
|
4
|
-
|
|
5
|
-
function samePosition(a: RepoSnapshot, b: RepoSnapshot): boolean {
|
|
6
|
-
return a.headRef === b.headRef && a.headSha === b.headSha;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function parseCheckoutTarget(value: string): string | null {
|
|
10
|
-
if (/^[0-9a-f]{7,40}$/i.test(value)) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function parseTransitionFromReflog(
|
|
17
|
-
previous: RepoSnapshot,
|
|
18
|
-
current: RepoSnapshot,
|
|
19
|
-
bootstrapTimestampSec: number,
|
|
20
|
-
allowBootstrap: boolean,
|
|
21
|
-
): RepoTransition | null {
|
|
22
|
-
const entry = current.headReflog;
|
|
23
|
-
if (entry === null) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const hasFreshReflog = previous.headReflog?.raw !== entry.raw;
|
|
27
|
-
const bootstrapEligible = allowBootstrap && entry.timestampSec !== null && entry.timestampSec >= bootstrapTimestampSec;
|
|
28
|
-
if (!hasFreshReflog && !bootstrapEligible) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const checkout = /^checkout: moving from (.+) to (.+)$/.exec(entry.subject);
|
|
33
|
-
if (checkout !== null) {
|
|
34
|
-
const fromRef = checkout[1];
|
|
35
|
-
const toTarget = checkout[2];
|
|
36
|
-
if (fromRef === undefined || toTarget === undefined) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
const toRef = parseCheckoutTarget(toTarget);
|
|
40
|
-
return {
|
|
41
|
-
kind: "checkout",
|
|
42
|
-
fromRef,
|
|
43
|
-
toRef,
|
|
44
|
-
fromCommit: entry.previousSha,
|
|
45
|
-
toCommit: entry.nextSha ?? current.headSha,
|
|
46
|
-
evidence: { reflogSubject: entry.subject },
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const merge = /^merge ([^:]+):/.exec(entry.subject);
|
|
51
|
-
if (merge !== null) {
|
|
52
|
-
const fromRef = merge[1];
|
|
53
|
-
if (fromRef === undefined) {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
kind: "merge",
|
|
58
|
-
fromRef,
|
|
59
|
-
toRef: current.headRef,
|
|
60
|
-
fromCommit: entry.previousSha,
|
|
61
|
-
toCommit: entry.nextSha ?? current.headSha,
|
|
62
|
-
evidence: { reflogSubject: entry.subject },
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (entry.subject.startsWith("reset: ")) {
|
|
67
|
-
return {
|
|
68
|
-
kind: "reset",
|
|
69
|
-
fromRef: previous.headRef,
|
|
70
|
-
toRef: current.headRef,
|
|
71
|
-
fromCommit: entry.previousSha,
|
|
72
|
-
toCommit: entry.nextSha ?? current.headSha,
|
|
73
|
-
evidence: { reflogSubject: entry.subject },
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (entry.subject.startsWith("rebase (")) {
|
|
78
|
-
return {
|
|
79
|
-
kind: "rebase",
|
|
80
|
-
fromRef: previous.headRef,
|
|
81
|
-
toRef: current.headRef,
|
|
82
|
-
fromCommit: entry.previousSha,
|
|
83
|
-
toCommit: entry.nextSha ?? current.headSha,
|
|
84
|
-
evidence: { reflogSubject: entry.subject },
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export async function detectTransition(
|
|
92
|
-
gitClient: GitClient,
|
|
93
|
-
cwd: string,
|
|
94
|
-
previous: RepoSnapshot,
|
|
95
|
-
current: RepoSnapshot,
|
|
96
|
-
bootstrapTimestampSec: number,
|
|
97
|
-
allowBootstrap: boolean,
|
|
98
|
-
): Promise<RepoTransition | null> {
|
|
99
|
-
const reflogTransition = parseTransitionFromReflog(previous, current, bootstrapTimestampSec, allowBootstrap);
|
|
100
|
-
if (reflogTransition !== null) {
|
|
101
|
-
return reflogTransition;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (samePosition(previous, current)) return null;
|
|
105
|
-
|
|
106
|
-
if (previous.headRef !== current.headRef) {
|
|
107
|
-
return {
|
|
108
|
-
kind: "checkout",
|
|
109
|
-
fromRef: previous.headRef,
|
|
110
|
-
toRef: current.headRef,
|
|
111
|
-
fromCommit: previous.headSha,
|
|
112
|
-
toCommit: current.headSha,
|
|
113
|
-
evidence: { reflogSubject: null },
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (current.parentShas.length > 1 && previous.headSha !== null && current.parentShas.includes(previous.headSha)) {
|
|
118
|
-
return {
|
|
119
|
-
kind: "merge",
|
|
120
|
-
fromRef: previous.headRef,
|
|
121
|
-
toRef: current.headRef,
|
|
122
|
-
fromCommit: previous.headSha,
|
|
123
|
-
toCommit: current.headSha,
|
|
124
|
-
evidence: { reflogSubject: null },
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (await isAncestor(gitClient, cwd, current.headSha, previous.headSha)) {
|
|
129
|
-
return {
|
|
130
|
-
kind: "reset",
|
|
131
|
-
fromRef: previous.headRef,
|
|
132
|
-
toRef: current.headRef,
|
|
133
|
-
fromCommit: previous.headSha,
|
|
134
|
-
toCommit: current.headSha,
|
|
135
|
-
evidence: { reflogSubject: null },
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (!(await isAncestor(gitClient, cwd, previous.headSha, current.headSha))) {
|
|
140
|
-
return {
|
|
141
|
-
kind: "rebase",
|
|
142
|
-
fromRef: previous.headRef,
|
|
143
|
-
toRef: current.headRef,
|
|
144
|
-
fromCommit: previous.headSha,
|
|
145
|
-
toCommit: current.headSha,
|
|
146
|
-
evidence: { reflogSubject: null },
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return null;
|
|
151
|
-
}
|