@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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import { type z } from "zod";
|
|
3
|
+
import { mcpOutputBodySchemas } from "../contracts/output-schema-mcp.js";
|
|
4
|
+
|
|
5
|
+
export type DaemonStatusPayload = z.output<typeof mcpOutputBodySchemas.daemon_status>;
|
|
6
|
+
export type DaemonSessionsPayload = z.output<typeof mcpOutputBodySchemas.daemon_sessions>;
|
|
7
|
+
export type DaemonReposPayload = z.output<typeof mcpOutputBodySchemas.daemon_repos>;
|
|
8
|
+
export type DaemonMonitorsPayload = z.output<typeof mcpOutputBodySchemas.daemon_monitors>;
|
|
9
|
+
export type WorkspaceStatusPayload = z.output<typeof mcpOutputBodySchemas.workspace_status>;
|
|
10
|
+
export type WorkspaceAuthorizationsPayload = z.output<typeof mcpOutputBodySchemas.workspace_authorizations>;
|
|
11
|
+
|
|
12
|
+
export interface DaemonStatusReadSnapshot {
|
|
13
|
+
readonly status: DaemonStatusPayload;
|
|
14
|
+
readonly sessions?: DaemonSessionsPayload | undefined;
|
|
15
|
+
readonly currentRepo?: DaemonReposPayload | undefined;
|
|
16
|
+
readonly monitors?: DaemonMonitorsPayload | undefined;
|
|
17
|
+
readonly workspaceStatus?: WorkspaceStatusPayload | undefined;
|
|
18
|
+
readonly authorizations?: WorkspaceAuthorizationsPayload | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type UnknownCount = number | "unknown";
|
|
22
|
+
export type DaemonHealth = "ok" | "degraded";
|
|
23
|
+
export type DaemonCurrentAuthorization = "authorized" | "not_authorized" | "unknown";
|
|
24
|
+
export type DaemonCurrentBindState = "bound" | "unbound" | "unknown";
|
|
25
|
+
export type DaemonSchedulerPressure = "idle" | "running" | "queued" | "saturated";
|
|
26
|
+
export type DaemonWorkerPressure = "idle" | "busy" | "saturated" | "unknown";
|
|
27
|
+
|
|
28
|
+
export interface DaemonStatusModel {
|
|
29
|
+
readonly command: "daemon_status";
|
|
30
|
+
readonly cwd: string;
|
|
31
|
+
readonly daemon: {
|
|
32
|
+
readonly health: DaemonHealth;
|
|
33
|
+
readonly transport: DaemonStatusPayload["transport"];
|
|
34
|
+
readonly socketPath: string;
|
|
35
|
+
readonly mcpPath: string;
|
|
36
|
+
readonly healthPath: string;
|
|
37
|
+
readonly startedAt: string;
|
|
38
|
+
readonly sameUserOnly: true;
|
|
39
|
+
readonly activeWarpRepos: number;
|
|
40
|
+
};
|
|
41
|
+
readonly sessions: {
|
|
42
|
+
readonly total: number;
|
|
43
|
+
readonly bound: number;
|
|
44
|
+
readonly unbound: number;
|
|
45
|
+
readonly listed: UnknownCount;
|
|
46
|
+
};
|
|
47
|
+
readonly workspaces: {
|
|
48
|
+
readonly authorized: number;
|
|
49
|
+
readonly authorizedRepos: number;
|
|
50
|
+
readonly bound: UnknownCount;
|
|
51
|
+
readonly current: {
|
|
52
|
+
readonly cwd: string;
|
|
53
|
+
readonly authorization: DaemonCurrentAuthorization;
|
|
54
|
+
readonly bindState: DaemonCurrentBindState;
|
|
55
|
+
readonly repoId: string | null;
|
|
56
|
+
readonly worktreeRoot: string | null;
|
|
57
|
+
readonly activeSessions: number | null;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly monitors: {
|
|
61
|
+
readonly total: number;
|
|
62
|
+
readonly running: number;
|
|
63
|
+
readonly paused: number;
|
|
64
|
+
readonly stopped: number;
|
|
65
|
+
readonly failing: number;
|
|
66
|
+
readonly backlog: number;
|
|
67
|
+
readonly listed: UnknownCount;
|
|
68
|
+
};
|
|
69
|
+
readonly scheduler: {
|
|
70
|
+
readonly maxConcurrentJobs: number;
|
|
71
|
+
readonly activeJobs: number;
|
|
72
|
+
readonly queuedJobs: number;
|
|
73
|
+
readonly interactiveQueuedJobs: number;
|
|
74
|
+
readonly backgroundQueuedJobs: number;
|
|
75
|
+
readonly longestQueuedWaitMs: number;
|
|
76
|
+
readonly pressure: DaemonSchedulerPressure;
|
|
77
|
+
};
|
|
78
|
+
readonly workers: {
|
|
79
|
+
readonly mode: DaemonStatusPayload["workers"]["mode"];
|
|
80
|
+
readonly totalWorkers: number;
|
|
81
|
+
readonly busyWorkers: number;
|
|
82
|
+
readonly idleWorkers: number;
|
|
83
|
+
readonly queuedTasks: number;
|
|
84
|
+
readonly pressure: DaemonWorkerPressure;
|
|
85
|
+
};
|
|
86
|
+
readonly degraded: readonly string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface CurrentWorkspacePosture {
|
|
90
|
+
readonly authorization: DaemonCurrentAuthorization;
|
|
91
|
+
readonly repoId: string | null;
|
|
92
|
+
readonly worktreeRoot: string | null;
|
|
93
|
+
readonly activeSessions: number | null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function normalizePath(value: string): string {
|
|
97
|
+
return path.resolve(value);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function schedulerPressure(status: DaemonStatusPayload): DaemonSchedulerPressure {
|
|
101
|
+
if (status.scheduler.queuedJobs > 0) return "queued";
|
|
102
|
+
if (status.scheduler.activeJobs >= status.scheduler.maxConcurrentJobs) return "saturated";
|
|
103
|
+
if (status.scheduler.activeJobs > 0) return "running";
|
|
104
|
+
return "idle";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function workerPressure(status: DaemonStatusPayload): DaemonWorkerPressure {
|
|
108
|
+
if (status.workers.totalWorkers === 0) return "unknown";
|
|
109
|
+
if (status.workers.queuedTasks > 0 || status.workers.busyWorkers >= status.workers.totalWorkers) {
|
|
110
|
+
return "saturated";
|
|
111
|
+
}
|
|
112
|
+
if (status.workers.busyWorkers > 0) return "busy";
|
|
113
|
+
return "idle";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function buildDegradedReasons(status: DaemonStatusPayload): string[] {
|
|
117
|
+
const reasons: string[] = [];
|
|
118
|
+
if (status.failingMonitors > 0) reasons.push("failing_monitors");
|
|
119
|
+
if (status.backlogMonitors > 0) reasons.push("monitor_backlog");
|
|
120
|
+
if (status.scheduler.queuedJobs > 0) reasons.push("scheduler_queue");
|
|
121
|
+
if (status.scheduler.failedJobs > 0) reasons.push("scheduler_failures");
|
|
122
|
+
if (status.workers.queuedTasks > 0) reasons.push("worker_queue");
|
|
123
|
+
if (status.workers.failedTasks > 0) reasons.push("worker_failures");
|
|
124
|
+
return reasons;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function currentPosture(
|
|
128
|
+
cwd: string,
|
|
129
|
+
snapshot: DaemonStatusReadSnapshot,
|
|
130
|
+
): CurrentWorkspacePosture {
|
|
131
|
+
const normalizedCwd = normalizePath(cwd);
|
|
132
|
+
const currentRepo = snapshot.currentRepo?.repos[0];
|
|
133
|
+
const currentWorktree = currentRepo?.worktrees.find((worktree) => {
|
|
134
|
+
return normalizePath(worktree.worktreeRoot) === normalizedCwd;
|
|
135
|
+
}) ?? currentRepo?.worktrees[0];
|
|
136
|
+
|
|
137
|
+
const exactAuthorization = snapshot.authorizations?.workspaces.find((workspace) => {
|
|
138
|
+
return normalizePath(workspace.worktreeRoot) === normalizedCwd;
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
if (currentRepo !== undefined || exactAuthorization !== undefined) {
|
|
142
|
+
return {
|
|
143
|
+
authorization: "authorized",
|
|
144
|
+
repoId: currentRepo?.repoId ?? exactAuthorization?.repoId ?? null,
|
|
145
|
+
worktreeRoot: currentWorktree?.worktreeRoot ?? exactAuthorization?.worktreeRoot ?? null,
|
|
146
|
+
activeSessions: currentWorktree?.activeSessions ?? exactAuthorization?.activeSessions ?? null,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (snapshot.authorizations !== undefined || snapshot.currentRepo !== undefined) {
|
|
151
|
+
return {
|
|
152
|
+
authorization: "not_authorized",
|
|
153
|
+
repoId: null,
|
|
154
|
+
worktreeRoot: null,
|
|
155
|
+
activeSessions: null,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
authorization: "unknown",
|
|
161
|
+
repoId: null,
|
|
162
|
+
worktreeRoot: null,
|
|
163
|
+
activeSessions: null,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export function buildDaemonStatusModel(input: {
|
|
168
|
+
readonly cwd: string;
|
|
169
|
+
readonly snapshot: DaemonStatusReadSnapshot;
|
|
170
|
+
}): DaemonStatusModel {
|
|
171
|
+
const { cwd, snapshot } = input;
|
|
172
|
+
const { status } = snapshot;
|
|
173
|
+
const degraded = buildDegradedReasons(status);
|
|
174
|
+
const current = currentPosture(cwd, snapshot);
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
command: "daemon_status",
|
|
178
|
+
cwd,
|
|
179
|
+
daemon: {
|
|
180
|
+
health: degraded.length === 0 ? "ok" : "degraded",
|
|
181
|
+
transport: status.transport,
|
|
182
|
+
socketPath: status.socketPath,
|
|
183
|
+
mcpPath: status.mcpPath,
|
|
184
|
+
healthPath: status.healthPath,
|
|
185
|
+
startedAt: status.startedAt,
|
|
186
|
+
sameUserOnly: status.sameUserOnly,
|
|
187
|
+
activeWarpRepos: status.activeWarpRepos,
|
|
188
|
+
},
|
|
189
|
+
sessions: {
|
|
190
|
+
total: status.activeSessions,
|
|
191
|
+
bound: status.boundSessions,
|
|
192
|
+
unbound: status.unboundSessions,
|
|
193
|
+
listed: snapshot.sessions?.sessions.length ?? "unknown",
|
|
194
|
+
},
|
|
195
|
+
workspaces: {
|
|
196
|
+
authorized: status.authorizedWorkspaces,
|
|
197
|
+
authorizedRepos: status.authorizedRepos,
|
|
198
|
+
bound: snapshot.authorizations === undefined
|
|
199
|
+
? "unknown"
|
|
200
|
+
: snapshot.authorizations.workspaces.filter((workspace) => workspace.activeSessions > 0).length,
|
|
201
|
+
current: {
|
|
202
|
+
cwd,
|
|
203
|
+
authorization: current.authorization,
|
|
204
|
+
bindState: snapshot.workspaceStatus?.bindState ?? "unknown",
|
|
205
|
+
repoId: current.repoId,
|
|
206
|
+
worktreeRoot: current.worktreeRoot,
|
|
207
|
+
activeSessions: current.activeSessions,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
monitors: {
|
|
211
|
+
total: status.totalMonitors,
|
|
212
|
+
running: status.runningMonitors,
|
|
213
|
+
paused: status.pausedMonitors,
|
|
214
|
+
stopped: status.stoppedMonitors,
|
|
215
|
+
failing: status.failingMonitors,
|
|
216
|
+
backlog: status.backlogMonitors,
|
|
217
|
+
listed: snapshot.monitors?.monitors.length ?? "unknown",
|
|
218
|
+
},
|
|
219
|
+
scheduler: {
|
|
220
|
+
maxConcurrentJobs: status.scheduler.maxConcurrentJobs,
|
|
221
|
+
activeJobs: status.scheduler.activeJobs,
|
|
222
|
+
queuedJobs: status.scheduler.queuedJobs,
|
|
223
|
+
interactiveQueuedJobs: status.scheduler.interactiveQueuedJobs,
|
|
224
|
+
backgroundQueuedJobs: status.scheduler.backgroundQueuedJobs,
|
|
225
|
+
longestQueuedWaitMs: status.scheduler.longestQueuedWaitMs,
|
|
226
|
+
pressure: schedulerPressure(status),
|
|
227
|
+
},
|
|
228
|
+
workers: {
|
|
229
|
+
mode: status.workers.mode,
|
|
230
|
+
totalWorkers: status.workers.totalWorkers,
|
|
231
|
+
busyWorkers: status.workers.busyWorkers,
|
|
232
|
+
idleWorkers: status.workers.idleWorkers,
|
|
233
|
+
queuedTasks: status.workers.queuedTasks,
|
|
234
|
+
pressure: workerPressure(status),
|
|
235
|
+
},
|
|
236
|
+
degraded,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { headerBox, table } from "@flyingrobots/bijou";
|
|
2
|
+
import { initDefaultContext } from "@flyingrobots/bijou-node";
|
|
3
|
+
import type { DaemonStatusModel, UnknownCount } from "./daemon-status-model.js";
|
|
4
|
+
|
|
5
|
+
function count(value: UnknownCount): string {
|
|
6
|
+
return typeof value === "number" ? String(value) : value;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function currentAuthLabel(value: DaemonStatusModel["workspaces"]["current"]["authorization"]): string {
|
|
10
|
+
if (value === "authorized") return "ok";
|
|
11
|
+
if (value === "not_authorized") return "none";
|
|
12
|
+
return "unknown";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function renderDaemonStatus(model: DaemonStatusModel): string {
|
|
16
|
+
const ctx = initDefaultContext();
|
|
17
|
+
const rows = [
|
|
18
|
+
[
|
|
19
|
+
"runtime",
|
|
20
|
+
[
|
|
21
|
+
`transport ${model.daemon.transport}`,
|
|
22
|
+
`started ${model.daemon.startedAt}`,
|
|
23
|
+
`warp repos ${String(model.daemon.activeWarpRepos)}`,
|
|
24
|
+
].join("; "),
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"sessions",
|
|
28
|
+
[
|
|
29
|
+
`total ${String(model.sessions.total)}`,
|
|
30
|
+
`bound ${String(model.sessions.bound)}`,
|
|
31
|
+
`unbound ${String(model.sessions.unbound)}`,
|
|
32
|
+
`listed ${count(model.sessions.listed)}`,
|
|
33
|
+
].join("; "),
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
"workspaces",
|
|
37
|
+
[
|
|
38
|
+
`auth ${String(model.workspaces.authorized)}`,
|
|
39
|
+
`repos ${String(model.workspaces.authorizedRepos)}`,
|
|
40
|
+
`bound ${count(model.workspaces.bound)}`,
|
|
41
|
+
`current ${currentAuthLabel(model.workspaces.current.authorization)}`,
|
|
42
|
+
`status-session ${model.workspaces.current.bindState}`,
|
|
43
|
+
`active ${model.workspaces.current.activeSessions === null ? "unknown" : String(model.workspaces.current.activeSessions)}`,
|
|
44
|
+
].join("; "),
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
"monitors",
|
|
48
|
+
[
|
|
49
|
+
`total ${String(model.monitors.total)}`,
|
|
50
|
+
`running ${String(model.monitors.running)}`,
|
|
51
|
+
`paused ${String(model.monitors.paused)}`,
|
|
52
|
+
`stopped ${String(model.monitors.stopped)}`,
|
|
53
|
+
`failing ${String(model.monitors.failing)}`,
|
|
54
|
+
`backlog ${String(model.monitors.backlog)}`,
|
|
55
|
+
`listed ${count(model.monitors.listed)}`,
|
|
56
|
+
].join("; "),
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"scheduler",
|
|
60
|
+
[
|
|
61
|
+
model.scheduler.pressure,
|
|
62
|
+
`active ${String(model.scheduler.activeJobs)}/${String(model.scheduler.maxConcurrentJobs)}`,
|
|
63
|
+
`queued ${String(model.scheduler.queuedJobs)}`,
|
|
64
|
+
`interactive ${String(model.scheduler.interactiveQueuedJobs)}`,
|
|
65
|
+
`background ${String(model.scheduler.backgroundQueuedJobs)}`,
|
|
66
|
+
`longest wait ${String(model.scheduler.longestQueuedWaitMs)}ms`,
|
|
67
|
+
].join("; "),
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
"workers",
|
|
71
|
+
[
|
|
72
|
+
model.workers.pressure,
|
|
73
|
+
model.workers.mode,
|
|
74
|
+
`busy ${String(model.workers.busyWorkers)}/${String(model.workers.totalWorkers)}`,
|
|
75
|
+
`idle ${String(model.workers.idleWorkers)}`,
|
|
76
|
+
`queued ${String(model.workers.queuedTasks)}`,
|
|
77
|
+
].join("; "),
|
|
78
|
+
],
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
return [
|
|
82
|
+
headerBox("Daemon Status", {
|
|
83
|
+
detail: `health: ${model.daemon.health}`,
|
|
84
|
+
width: 80,
|
|
85
|
+
ctx,
|
|
86
|
+
}),
|
|
87
|
+
`cwd: ${model.cwd}`,
|
|
88
|
+
`socket: ${model.daemon.socketPath}`,
|
|
89
|
+
`mcp: ${model.daemon.mcpPath}`,
|
|
90
|
+
"",
|
|
91
|
+
table({
|
|
92
|
+
ctx,
|
|
93
|
+
columns: [
|
|
94
|
+
{ header: "Surface" },
|
|
95
|
+
{ header: "State" },
|
|
96
|
+
],
|
|
97
|
+
rows,
|
|
98
|
+
}),
|
|
99
|
+
"",
|
|
100
|
+
`degraded: ${model.degraded.length === 0 ? "none" : model.degraded.join(", ")}`,
|
|
101
|
+
].join("\n").trimEnd();
|
|
102
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
3
|
+
import { type z } from "zod";
|
|
4
|
+
import { mcpOutputBodySchemas } from "../contracts/output-schema-mcp.js";
|
|
5
|
+
import { createLocalSocketFetch, ensureDaemonReady } from "../mcp/daemon-stdio-bridge.js";
|
|
6
|
+
import { GRAFT_VERSION } from "../version.js";
|
|
7
|
+
import type { DaemonStatusReadSnapshot } from "./daemon-status-model.js";
|
|
8
|
+
|
|
9
|
+
const MCP_PATH = "/mcp";
|
|
10
|
+
|
|
11
|
+
export interface ReadDaemonStatusOptions {
|
|
12
|
+
readonly cwd: string;
|
|
13
|
+
readonly socketPath?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function readToolText(result: unknown): string {
|
|
17
|
+
const content = (result as { readonly content?: unknown }).content;
|
|
18
|
+
if (!Array.isArray(content)) {
|
|
19
|
+
throw new Error("Daemon tool returned no content");
|
|
20
|
+
}
|
|
21
|
+
const text = content.find((item): item is { readonly type: "text"; readonly text: string } => {
|
|
22
|
+
return typeof item === "object"
|
|
23
|
+
&& item !== null
|
|
24
|
+
&& (item as { readonly type?: unknown }).type === "text"
|
|
25
|
+
&& typeof (item as { readonly text?: unknown }).text === "string";
|
|
26
|
+
});
|
|
27
|
+
if (text === undefined) {
|
|
28
|
+
throw new Error("Daemon tool returned no text content");
|
|
29
|
+
}
|
|
30
|
+
return text.text;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function stripMcpCommon(value: unknown): unknown {
|
|
34
|
+
if (typeof value !== "object" || value === null) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
const body = { ...(value as Record<string, unknown>) };
|
|
38
|
+
delete body["_schema"];
|
|
39
|
+
delete body["_receipt"];
|
|
40
|
+
delete body["tripwire"];
|
|
41
|
+
return body;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function parseToolBody<T>(schema: z.ZodType<T>, result: unknown): T {
|
|
45
|
+
return schema.parse(stripMcpCommon(JSON.parse(readToolText(result)) as unknown));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function readDaemonStatusSnapshot(
|
|
49
|
+
options: ReadDaemonStatusOptions,
|
|
50
|
+
): Promise<DaemonStatusReadSnapshot> {
|
|
51
|
+
const socketPath = await ensureDaemonReady({
|
|
52
|
+
...(options.socketPath !== undefined ? { socketPath: options.socketPath } : {}),
|
|
53
|
+
spawnIfMissing: false,
|
|
54
|
+
});
|
|
55
|
+
const transport = new StreamableHTTPClientTransport(
|
|
56
|
+
new URL(`http://graft${MCP_PATH}`),
|
|
57
|
+
{ fetch: createLocalSocketFetch(socketPath) },
|
|
58
|
+
);
|
|
59
|
+
const client = new Client({
|
|
60
|
+
name: "graft-cli-daemon-status",
|
|
61
|
+
version: GRAFT_VERSION,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
await client.connect(transport as unknown as Parameters<Client["connect"]>[0]);
|
|
65
|
+
try {
|
|
66
|
+
const call = async <T>(
|
|
67
|
+
tool: string,
|
|
68
|
+
schema: z.ZodType<T>,
|
|
69
|
+
args: Record<string, unknown> = {},
|
|
70
|
+
): Promise<T> => {
|
|
71
|
+
const result = await client.callTool({
|
|
72
|
+
name: tool,
|
|
73
|
+
arguments: args,
|
|
74
|
+
});
|
|
75
|
+
return parseToolBody(schema, result);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const [status, sessions, currentRepo, monitors, workspaceStatus, authorizations] = await Promise.all([
|
|
79
|
+
call("daemon_status", mcpOutputBodySchemas.daemon_status),
|
|
80
|
+
call("daemon_sessions", mcpOutputBodySchemas.daemon_sessions),
|
|
81
|
+
call("daemon_repos", mcpOutputBodySchemas.daemon_repos, { cwd: options.cwd }),
|
|
82
|
+
call("daemon_monitors", mcpOutputBodySchemas.daemon_monitors),
|
|
83
|
+
call("workspace_status", mcpOutputBodySchemas.workspace_status),
|
|
84
|
+
call("workspace_authorizations", mcpOutputBodySchemas.workspace_authorizations),
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
status,
|
|
89
|
+
sessions,
|
|
90
|
+
currentRepo,
|
|
91
|
+
monitors,
|
|
92
|
+
workspaceStatus,
|
|
93
|
+
authorizations,
|
|
94
|
+
};
|
|
95
|
+
} finally {
|
|
96
|
+
await client.close().catch(() => {
|
|
97
|
+
return undefined;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type GitGraftEnhanceSemverImpact = "major" | "minor" | "patch" | "none";
|
|
2
|
+
|
|
3
|
+
export interface GitGraftEnhanceDiffBucket {
|
|
4
|
+
readonly length: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface GitGraftEnhanceFileDiff {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly status: string;
|
|
10
|
+
readonly summary: string;
|
|
11
|
+
readonly diff: {
|
|
12
|
+
readonly added: GitGraftEnhanceDiffBucket;
|
|
13
|
+
readonly removed: GitGraftEnhanceDiffBucket;
|
|
14
|
+
readonly changed: GitGraftEnhanceDiffBucket;
|
|
15
|
+
readonly unchangedCount?: number | undefined;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface GitGraftEnhanceStructuralInput {
|
|
20
|
+
readonly base: string;
|
|
21
|
+
readonly head: string;
|
|
22
|
+
readonly summary: string;
|
|
23
|
+
readonly layer: string;
|
|
24
|
+
readonly files: readonly GitGraftEnhanceFileDiff[];
|
|
25
|
+
readonly refused?: readonly unknown[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface GitGraftEnhanceExportsInput {
|
|
29
|
+
readonly base: string;
|
|
30
|
+
readonly head: string;
|
|
31
|
+
readonly added: readonly unknown[];
|
|
32
|
+
readonly removed: readonly unknown[];
|
|
33
|
+
readonly changed: readonly unknown[];
|
|
34
|
+
readonly semverImpact: GitGraftEnhanceSemverImpact;
|
|
35
|
+
readonly summary: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface BuildGitGraftEnhanceModelInput {
|
|
39
|
+
readonly since: string;
|
|
40
|
+
readonly head: string;
|
|
41
|
+
readonly structural: GitGraftEnhanceStructuralInput;
|
|
42
|
+
readonly exports: GitGraftEnhanceExportsInput;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface GitGraftEnhanceTopFile {
|
|
46
|
+
readonly path: string;
|
|
47
|
+
readonly status: string;
|
|
48
|
+
readonly changeCount: number;
|
|
49
|
+
readonly summary: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface GitGraftEnhanceModel {
|
|
53
|
+
readonly range: {
|
|
54
|
+
readonly since: string;
|
|
55
|
+
readonly head: string;
|
|
56
|
+
};
|
|
57
|
+
readonly structural: {
|
|
58
|
+
readonly changedFiles: number;
|
|
59
|
+
readonly addedSymbols: number;
|
|
60
|
+
readonly removedSymbols: number;
|
|
61
|
+
readonly changedSymbols: number;
|
|
62
|
+
readonly topFilesByChangeCount: readonly GitGraftEnhanceTopFile[];
|
|
63
|
+
};
|
|
64
|
+
readonly exports: {
|
|
65
|
+
readonly changed: boolean;
|
|
66
|
+
readonly semverImpact: GitGraftEnhanceSemverImpact;
|
|
67
|
+
readonly addedExports: number;
|
|
68
|
+
readonly removedExports: number;
|
|
69
|
+
readonly changedExports: number;
|
|
70
|
+
};
|
|
71
|
+
readonly warnings: readonly string[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function fileChangeCount(file: GitGraftEnhanceFileDiff): number {
|
|
75
|
+
return file.diff.added.length + file.diff.removed.length + file.diff.changed.length;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function topFiles(files: readonly GitGraftEnhanceFileDiff[]): readonly GitGraftEnhanceTopFile[] {
|
|
79
|
+
return [...files]
|
|
80
|
+
.map((file) => ({
|
|
81
|
+
path: file.path,
|
|
82
|
+
status: file.status,
|
|
83
|
+
changeCount: fileChangeCount(file),
|
|
84
|
+
summary: file.summary,
|
|
85
|
+
}))
|
|
86
|
+
.sort((a, b) => b.changeCount - a.changeCount || a.path.localeCompare(b.path))
|
|
87
|
+
.slice(0, 5);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function buildWarnings(input: BuildGitGraftEnhanceModelInput): readonly string[] {
|
|
91
|
+
const warnings: string[] = [];
|
|
92
|
+
if (input.structural.files.length === 0) {
|
|
93
|
+
warnings.push("No structural changes found for this range.");
|
|
94
|
+
}
|
|
95
|
+
const refusedCount = input.structural.refused?.length ?? 0;
|
|
96
|
+
if (refusedCount > 0) {
|
|
97
|
+
warnings.push(`${String(refusedCount)} structural files were refused by policy.`);
|
|
98
|
+
}
|
|
99
|
+
return warnings;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function buildGitGraftEnhanceModel(input: BuildGitGraftEnhanceModelInput): GitGraftEnhanceModel {
|
|
103
|
+
const addedSymbols = input.structural.files.reduce((total, file) => total + file.diff.added.length, 0);
|
|
104
|
+
const removedSymbols = input.structural.files.reduce((total, file) => total + file.diff.removed.length, 0);
|
|
105
|
+
const changedSymbols = input.structural.files.reduce((total, file) => total + file.diff.changed.length, 0);
|
|
106
|
+
const addedExports = input.exports.added.length;
|
|
107
|
+
const removedExports = input.exports.removed.length;
|
|
108
|
+
const changedExports = input.exports.changed.length;
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
range: {
|
|
112
|
+
since: input.since,
|
|
113
|
+
head: input.head,
|
|
114
|
+
},
|
|
115
|
+
structural: {
|
|
116
|
+
changedFiles: input.structural.files.length,
|
|
117
|
+
addedSymbols,
|
|
118
|
+
removedSymbols,
|
|
119
|
+
changedSymbols,
|
|
120
|
+
topFilesByChangeCount: topFiles(input.structural.files),
|
|
121
|
+
},
|
|
122
|
+
exports: {
|
|
123
|
+
changed: addedExports + removedExports + changedExports > 0,
|
|
124
|
+
semverImpact: input.exports.semverImpact,
|
|
125
|
+
addedExports,
|
|
126
|
+
removedExports,
|
|
127
|
+
changedExports,
|
|
128
|
+
},
|
|
129
|
+
warnings: buildWarnings(input),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GitGraftEnhanceModel } from "./git-graft-enhance-model.js";
|
|
2
|
+
|
|
3
|
+
export function renderGitGraftEnhance(model: GitGraftEnhanceModel): string {
|
|
4
|
+
const lines = [
|
|
5
|
+
"Git Graft Enhance",
|
|
6
|
+
`range: ${model.range.since}..${model.range.head}`,
|
|
7
|
+
"",
|
|
8
|
+
"Structural",
|
|
9
|
+
`files: ${String(model.structural.changedFiles)}`,
|
|
10
|
+
`symbols: +${String(model.structural.addedSymbols)} -${String(model.structural.removedSymbols)} ~${String(model.structural.changedSymbols)}`,
|
|
11
|
+
"",
|
|
12
|
+
"Exports",
|
|
13
|
+
`exports: ${model.exports.changed ? "changed" : "unchanged"}`,
|
|
14
|
+
`semver impact: ${model.exports.semverImpact}`,
|
|
15
|
+
`export symbols: +${String(model.exports.addedExports)} -${String(model.exports.removedExports)} ~${String(model.exports.changedExports)}`,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
if (model.structural.topFilesByChangeCount.length > 0) {
|
|
19
|
+
lines.push("", "Top files");
|
|
20
|
+
for (const file of model.structural.topFilesByChangeCount) {
|
|
21
|
+
lines.push(`- ${file.path} (${file.status}, ${String(file.changeCount)}): ${file.summary}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (model.warnings.length > 0) {
|
|
26
|
+
lines.push("", "warnings:");
|
|
27
|
+
for (const warning of model.warnings) {
|
|
28
|
+
lines.push(`- ${warning}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return lines.join("\n");
|
|
33
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CanonicalJsonCodec } from "../adapters/canonical-json.js";
|
|
2
|
+
import { attachCliSchemaMeta, validateCliOutput } from "../contracts/output-schemas.js";
|
|
3
|
+
import type { JsonObject } from "../contracts/json-object.js";
|
|
4
|
+
import type { McpToolName } from "../contracts/capabilities.js";
|
|
5
|
+
import {
|
|
6
|
+
buildGitGraftEnhanceModel,
|
|
7
|
+
type GitGraftEnhanceExportsInput,
|
|
8
|
+
type GitGraftEnhanceStructuralInput,
|
|
9
|
+
} from "./git-graft-enhance-model.js";
|
|
10
|
+
import { renderGitGraftEnhance } from "./git-graft-enhance-render.js";
|
|
11
|
+
import { invokePeerCommand, type Writer } from "./peer-command.js";
|
|
12
|
+
|
|
13
|
+
const codec = new CanonicalJsonCodec();
|
|
14
|
+
|
|
15
|
+
export type GitGraftEnhancePeerInvoker = (
|
|
16
|
+
cwd: string,
|
|
17
|
+
tool: McpToolName,
|
|
18
|
+
args: JsonObject,
|
|
19
|
+
) => Promise<JsonObject>;
|
|
20
|
+
|
|
21
|
+
export interface RunGitGraftEnhanceOptions {
|
|
22
|
+
readonly cwd: string;
|
|
23
|
+
readonly since: string;
|
|
24
|
+
readonly head?: string | undefined;
|
|
25
|
+
readonly json: boolean;
|
|
26
|
+
readonly stdout?: Writer | undefined;
|
|
27
|
+
readonly invokePeer?: GitGraftEnhancePeerInvoker | undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function emitJson(model: ReturnType<typeof buildGitGraftEnhanceModel>, writer: Writer): void {
|
|
31
|
+
writer.write(`${codec.encode(validateCliOutput("git_graft_enhance", attachCliSchemaMeta("git_graft_enhance", model)))}\n`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function runGitGraftEnhance(options: RunGitGraftEnhanceOptions): Promise<void> {
|
|
35
|
+
const stdout = options.stdout ?? process.stdout;
|
|
36
|
+
const head = options.head ?? "HEAD";
|
|
37
|
+
const invoke = options.invokePeer ?? invokePeerCommand;
|
|
38
|
+
const args = { base: options.since, head };
|
|
39
|
+
const structural = await invoke(options.cwd, "graft_since", args) as unknown as GitGraftEnhanceStructuralInput;
|
|
40
|
+
const exports = await invoke(options.cwd, "graft_exports", args) as unknown as GitGraftEnhanceExportsInput;
|
|
41
|
+
const model = buildGitGraftEnhanceModel({
|
|
42
|
+
since: options.since,
|
|
43
|
+
head,
|
|
44
|
+
structural,
|
|
45
|
+
exports,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (options.json) {
|
|
49
|
+
emitJson(model, stdout);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
stdout.write(`${renderGitGraftEnhance(model)}\n`);
|
|
54
|
+
}
|