gsd-pi 2.73.1 → 2.74.0-dev.b741afb
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/dist/cli-web-branch.d.ts +4 -3
- package/dist/cli-web-branch.js +10 -7
- package/dist/cli.js +184 -206
- package/dist/headless-query.js +4 -1
- package/dist/help-text.js +23 -0
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +1 -1
- package/dist/onboarding.js +59 -53
- package/dist/resource-loader.js +2 -2
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +68 -4
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +11 -4
- package/dist/resources/extensions/gsd/auto/phases.js +60 -10
- package/dist/resources/extensions/gsd/auto-dispatch.js +11 -3
- package/dist/resources/extensions/gsd/auto-model-selection.js +54 -11
- package/dist/resources/extensions/gsd/auto-post-unit.js +93 -57
- package/dist/resources/extensions/gsd/auto-prompts.js +12 -0
- package/dist/resources/extensions/gsd/auto-start.js +23 -6
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +13 -0
- package/dist/resources/extensions/gsd/auto-verification.js +88 -3
- package/dist/resources/extensions/gsd/auto.js +37 -10
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +21 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +26 -1
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +20 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +68 -9
- package/dist/resources/extensions/gsd/commands-add-tests.js +111 -0
- package/dist/resources/extensions/gsd/commands-backlog.js +140 -0
- package/dist/resources/extensions/gsd/commands-do.js +79 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +8 -2
- package/dist/resources/extensions/gsd/commands-maintenance.js +6 -6
- package/dist/resources/extensions/gsd/commands-pr-branch.js +180 -0
- package/dist/resources/extensions/gsd/commands-session-report.js +82 -0
- package/dist/resources/extensions/gsd/commands-ship.js +187 -0
- package/dist/resources/extensions/gsd/db-writer.js +3 -5
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/graph-context.js +66 -0
- package/dist/resources/extensions/gsd/gsd-db.js +321 -0
- package/dist/resources/extensions/gsd/index.js +15 -2
- package/dist/resources/extensions/gsd/md-importer.js +3 -4
- package/dist/resources/extensions/gsd/memory-store.js +19 -51
- package/dist/resources/extensions/gsd/milestone-validation-gates.js +13 -12
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -4
- package/dist/resources/extensions/gsd/notification-widget.js +2 -2
- package/dist/resources/extensions/gsd/preferences-models.js +43 -0
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +22 -0
- package/dist/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/dist/resources/extensions/gsd/state.js +66 -15
- package/dist/resources/extensions/gsd/tools/complete-slice.js +15 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +3 -14
- package/dist/resources/extensions/gsd/triage-resolution.js +2 -5
- package/dist/resources/extensions/gsd/workflow-manifest.js +8 -69
- package/dist/resources/extensions/gsd/workflow-migration.js +21 -22
- package/dist/resources/extensions/gsd/workflow-projections.js +4 -1
- package/dist/resources/extensions/gsd/workflow-reconcile.js +14 -11
- package/dist/tsconfig.extensions.tsbuildinfo +1 -0
- package/dist/update-check.d.ts +1 -0
- package/dist/update-check.js +13 -5
- package/dist/update-cmd.js +4 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +9 -9
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page.js +2 -2
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +9 -9
- package/dist/web/standalone/.next/server/chunks/63.js +3 -3
- package/dist/web/standalone/.next/server/chunks/6897.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-f1e30ab6bb269149.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/server.js +1 -1
- package/package.json +3 -3
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/index.d.ts +3 -0
- package/packages/mcp-server/dist/index.d.ts.map +1 -1
- package/packages/mcp-server/dist/index.js +3 -0
- package/packages/mcp-server/dist/index.js.map +1 -1
- package/packages/mcp-server/dist/readers/graph.d.ts +87 -0
- package/packages/mcp-server/dist/readers/graph.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/graph.js +548 -0
- package/packages/mcp-server/dist/readers/graph.js.map +1 -0
- package/packages/mcp-server/dist/readers/index.d.ts +2 -0
- package/packages/mcp-server/dist/readers/index.d.ts.map +1 -1
- package/packages/mcp-server/dist/readers/index.js +1 -0
- package/packages/mcp-server/dist/readers/index.js.map +1 -1
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +65 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/index.ts +15 -0
- package/packages/mcp-server/src/readers/graph.test.ts +426 -0
- package/packages/mcp-server/src/readers/graph.ts +708 -0
- package/packages/mcp-server/src/readers/index.ts +12 -0
- package/packages/mcp-server/src/server.ts +83 -0
- package/packages/mcp-server/tsconfig.json +1 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -0
- package/packages/native/package.json +2 -2
- package/packages/native/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.json +1 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-ai/dist/index.d.ts +1 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +12 -0
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/tests/overflow.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/tests/overflow.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/tests/overflow.test.js +50 -0
- package/packages/pi-ai/dist/utils/tests/overflow.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/index.ts +4 -0
- package/packages/pi-ai/src/utils/overflow.ts +14 -1
- package/packages/pi-ai/src/utils/tests/overflow.test.ts +58 -0
- package/packages/pi-ai/tsconfig.json +1 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +313 -8
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +5 -5
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.js +45 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +12 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +61 -28
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +9 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js +52 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +94 -16
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +11 -3
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +355 -8
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +5 -5
- package/packages/pi-coding-agent/src/core/compaction-utils.test.ts +50 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +74 -32
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +73 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +9 -3
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +113 -21
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +11 -3
- package/packages/pi-coding-agent/tsconfig.json +1 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +60 -1
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts +8 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +32 -3
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/tui.test.ts +76 -1
- package/packages/pi-tui/src/tui.ts +31 -3
- package/packages/pi-tui/tsconfig.json +1 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -0
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.json +1 -0
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +107 -5
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +111 -2
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +12 -4
- package/src/resources/extensions/gsd/auto/loop-deps.ts +6 -0
- package/src/resources/extensions/gsd/auto/phases.ts +90 -10
- package/src/resources/extensions/gsd/auto-dispatch.ts +10 -4
- package/src/resources/extensions/gsd/auto-model-selection.ts +85 -11
- package/src/resources/extensions/gsd/auto-post-unit.ts +107 -58
- package/src/resources/extensions/gsd/auto-prompts.ts +13 -0
- package/src/resources/extensions/gsd/auto-start.ts +30 -6
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +17 -0
- package/src/resources/extensions/gsd/auto-verification.ts +98 -3
- package/src/resources/extensions/gsd/auto.ts +38 -14
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +26 -1
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +20 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +74 -9
- package/src/resources/extensions/gsd/commands-add-tests.ts +137 -0
- package/src/resources/extensions/gsd/commands-backlog.ts +182 -0
- package/src/resources/extensions/gsd/commands-do.ts +109 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +8 -2
- package/src/resources/extensions/gsd/commands-maintenance.ts +6 -6
- package/src/resources/extensions/gsd/commands-pr-branch.ts +234 -0
- package/src/resources/extensions/gsd/commands-session-report.ts +101 -0
- package/src/resources/extensions/gsd/commands-ship.ts +219 -0
- package/src/resources/extensions/gsd/db-writer.ts +3 -5
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/graph-context.ts +85 -0
- package/src/resources/extensions/gsd/gsd-db.ts +467 -0
- package/src/resources/extensions/gsd/index.ts +18 -2
- package/src/resources/extensions/gsd/md-importer.ts +3 -5
- package/src/resources/extensions/gsd/memory-store.ts +31 -62
- package/src/resources/extensions/gsd/milestone-validation-gates.ts +13 -14
- package/src/resources/extensions/gsd/native-git-bridge.ts +11 -12
- package/src/resources/extensions/gsd/notification-widget.ts +2 -2
- package/src/resources/extensions/gsd/preferences-models.ts +41 -0
- package/src/resources/extensions/gsd/preferences-types.ts +12 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +23 -0
- package/src/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/src/resources/extensions/gsd/state.ts +80 -17
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +51 -2
- package/src/resources/extensions/gsd/tests/commands-backlog.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/commands-pr-branch.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/commands-session-report.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/commands-ship.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +68 -8
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +137 -1
- package/src/resources/extensions/gsd/tests/graph-context.test.ts +337 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/model-isolation.test.ts +91 -2
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +223 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +19 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +3 -11
- package/src/resources/extensions/gsd/triage-resolution.ts +2 -7
- package/src/resources/extensions/gsd/workflow-manifest.ts +9 -104
- package/src/resources/extensions/gsd/workflow-migration.ts +21 -29
- package/src/resources/extensions/gsd/workflow-projections.ts +8 -1
- package/src/resources/extensions/gsd/workflow-reconcile.ts +15 -15
- package/dist/web/standalone/.next/static/chunks/app/page-7115e62689b5fd84.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- /package/dist/web/standalone/.next/static/{Qr27MOHx0lxRGnJvlhxxu → XnHY5eXUsTCFmNodWHetD}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Qr27MOHx0lxRGnJvlhxxu → XnHY5eXUsTCFmNodWHetD}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Command — /gsd pr-branch
|
|
3
|
+
*
|
|
4
|
+
* Creates a clean PR branch by cherry-picking commits while stripping
|
|
5
|
+
* any changes to .gsd/, .planning/, and PLAN.md paths. Useful for
|
|
6
|
+
* upstream PRs where planning artifacts should not be included.
|
|
7
|
+
*/
|
|
8
|
+
import { execFileSync } from "node:child_process";
|
|
9
|
+
import { nativeGetCurrentBranch, nativeDetectMainBranch, nativeBranchExists, } from "./native-git-bridge.js";
|
|
10
|
+
const EXCLUDED_PATHS = [".gsd", ".planning", "PLAN.md"];
|
|
11
|
+
function git(basePath, args) {
|
|
12
|
+
return execFileSync("git", args, { cwd: basePath, encoding: "utf-8" }).trim();
|
|
13
|
+
}
|
|
14
|
+
function gitAllowFail(basePath, args) {
|
|
15
|
+
try {
|
|
16
|
+
execFileSync("git", args, { cwd: basePath, encoding: "utf-8", stdio: "pipe" });
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// ignored — caller opts into non-fatal behavior
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function hasStagedChanges(basePath) {
|
|
23
|
+
try {
|
|
24
|
+
execFileSync("git", ["diff", "--cached", "--quiet"], {
|
|
25
|
+
cwd: basePath,
|
|
26
|
+
stdio: "pipe",
|
|
27
|
+
});
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function isValidBranchName(name) {
|
|
35
|
+
try {
|
|
36
|
+
execFileSync("git", ["check-ref-format", "--branch", name], { stdio: "pipe" });
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function getCodeOnlyCommits(basePath, base, head) {
|
|
44
|
+
try {
|
|
45
|
+
const allCommits = git(basePath, ["log", "--format=%H", `${base}..${head}`])
|
|
46
|
+
.split("\n")
|
|
47
|
+
.filter(Boolean);
|
|
48
|
+
const codeCommits = [];
|
|
49
|
+
for (const sha of allCommits) {
|
|
50
|
+
const files = git(basePath, ["diff-tree", "--no-commit-id", "--name-only", "-r", sha])
|
|
51
|
+
.split("\n")
|
|
52
|
+
.filter(Boolean);
|
|
53
|
+
const hasCodeChanges = files.some((f) => !f.startsWith(".gsd/") && !f.startsWith(".planning/") && f !== "PLAN.md");
|
|
54
|
+
if (hasCodeChanges) {
|
|
55
|
+
codeCommits.push(sha);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return codeCommits.reverse(); // chronological for cherry-picking
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Cherry-pick a commit while stripping excluded paths from the resulting
|
|
66
|
+
* commit. Returns true if a commit was produced, false if nothing remained
|
|
67
|
+
* after filtering.
|
|
68
|
+
*/
|
|
69
|
+
function cherryPickFiltered(basePath, sha) {
|
|
70
|
+
git(basePath, ["cherry-pick", "--no-commit", "--allow-empty", sha]);
|
|
71
|
+
// Unstage any excluded paths introduced by the cherry-pick.
|
|
72
|
+
gitAllowFail(basePath, ["reset", "HEAD", "--", ...EXCLUDED_PATHS]);
|
|
73
|
+
// Restore worktree state for excluded paths from HEAD (if tracked),
|
|
74
|
+
// then remove any newly introduced untracked files under those paths.
|
|
75
|
+
gitAllowFail(basePath, ["checkout", "HEAD", "--", ...EXCLUDED_PATHS]);
|
|
76
|
+
gitAllowFail(basePath, ["clean", "-fdq", "--", ...EXCLUDED_PATHS]);
|
|
77
|
+
if (!hasStagedChanges(basePath)) {
|
|
78
|
+
// Nothing remained after filtering — discard worktree residue and skip.
|
|
79
|
+
git(basePath, ["reset", "--hard", "HEAD"]);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
git(basePath, ["commit", "-C", sha]);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
function assertNoExcludedPaths(basePath, base) {
|
|
86
|
+
const files = git(basePath, [
|
|
87
|
+
"diff",
|
|
88
|
+
"--name-only",
|
|
89
|
+
`${base}..HEAD`,
|
|
90
|
+
])
|
|
91
|
+
.split("\n")
|
|
92
|
+
.filter(Boolean);
|
|
93
|
+
const leaked = files.filter((f) => f.startsWith(".gsd/") || f.startsWith(".planning/") || f === "PLAN.md");
|
|
94
|
+
if (leaked.length > 0) {
|
|
95
|
+
throw new Error(`PR branch still contains excluded paths: ${leaked.slice(0, 5).join(", ")}${leaked.length > 5 ? ` (+${leaked.length - 5} more)` : ""}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export async function handlePrBranch(args, ctx) {
|
|
99
|
+
const basePath = process.cwd();
|
|
100
|
+
const dryRun = args.includes("--dry-run");
|
|
101
|
+
const nameMatch = args.match(/--name\s+(\S+)/);
|
|
102
|
+
const currentBranch = nativeGetCurrentBranch(basePath);
|
|
103
|
+
const mainBranch = nativeDetectMainBranch(basePath);
|
|
104
|
+
// Determine base ref (prefer upstream/main if available)
|
|
105
|
+
let baseRef;
|
|
106
|
+
try {
|
|
107
|
+
git(basePath, ["rev-parse", "--verify", "upstream/main"]);
|
|
108
|
+
baseRef = "upstream/main";
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
baseRef = mainBranch;
|
|
112
|
+
}
|
|
113
|
+
// Find commits with code changes
|
|
114
|
+
const commits = getCodeOnlyCommits(basePath, baseRef, "HEAD");
|
|
115
|
+
if (commits.length === 0) {
|
|
116
|
+
ctx.ui.notify("No code-only commits found (all commits only touch .gsd/ files).", "info");
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (dryRun) {
|
|
120
|
+
const lines = [`Would create PR branch with ${commits.length} commits (filtering .gsd/ paths):\n`];
|
|
121
|
+
for (const sha of commits) {
|
|
122
|
+
const msg = git(basePath, ["log", "--format=%s", "-1", sha]);
|
|
123
|
+
lines.push(` ${sha.slice(0, 8)} ${msg}`);
|
|
124
|
+
}
|
|
125
|
+
ctx.ui.notify(lines.join("\n"), "info");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const requestedName = nameMatch?.[1];
|
|
129
|
+
if (requestedName && !isValidBranchName(requestedName)) {
|
|
130
|
+
ctx.ui.notify(`Invalid branch name: ${requestedName}. Must satisfy git check-ref-format.`, "error");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const defaultName = `pr/${currentBranch}`;
|
|
134
|
+
const prBranch = requestedName ?? defaultName;
|
|
135
|
+
if (!isValidBranchName(prBranch)) {
|
|
136
|
+
ctx.ui.notify(`Derived branch name is invalid: ${prBranch}. Use --name to override.`, "error");
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (nativeBranchExists(basePath, prBranch)) {
|
|
140
|
+
ctx.ui.notify(`Branch ${prBranch} already exists. Use --name to specify a different name, or delete it first.`, "warning");
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
// Create clean branch from base
|
|
145
|
+
git(basePath, ["checkout", "-b", prBranch, baseRef]);
|
|
146
|
+
// Cherry-pick with path filter
|
|
147
|
+
let picked = 0;
|
|
148
|
+
let skipped = 0;
|
|
149
|
+
for (const sha of commits) {
|
|
150
|
+
try {
|
|
151
|
+
if (cherryPickFiltered(basePath, sha)) {
|
|
152
|
+
picked++;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
skipped++;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (pickErr) {
|
|
159
|
+
gitAllowFail(basePath, ["cherry-pick", "--abort"]);
|
|
160
|
+
gitAllowFail(basePath, ["reset", "--hard", "HEAD"]);
|
|
161
|
+
const detail = pickErr instanceof Error ? pickErr.message : String(pickErr);
|
|
162
|
+
ctx.ui.notify(`Cherry-pick conflict at ${sha.slice(0, 8)}. Picked ${picked}/${commits.length} commits. Resolve manually.\n${detail}`, "warning");
|
|
163
|
+
git(basePath, ["checkout", currentBranch]);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Post-condition: no excluded paths should appear in the PR branch diff.
|
|
168
|
+
assertNoExcludedPaths(basePath, baseRef);
|
|
169
|
+
const skippedMsg = skipped > 0 ? ` (${skipped} skipped — contained only planning artifacts)` : "";
|
|
170
|
+
ctx.ui.notify(`Created ${prBranch} with ${picked} commits${skippedMsg} (no .gsd/ artifacts).\nSwitch back: git checkout ${currentBranch}`, "success");
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
// Restore original branch on failure
|
|
174
|
+
gitAllowFail(basePath, ["cherry-pick", "--abort"]);
|
|
175
|
+
gitAllowFail(basePath, ["reset", "--hard", "HEAD"]);
|
|
176
|
+
gitAllowFail(basePath, ["checkout", currentBranch]);
|
|
177
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
178
|
+
ctx.ui.notify(`Failed to create PR branch: ${msg}`, "error");
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Command — /gsd session-report
|
|
3
|
+
*
|
|
4
|
+
* Summarizes the current session: tasks completed, cost, tokens,
|
|
5
|
+
* duration, model usage breakdown.
|
|
6
|
+
*/
|
|
7
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { getLedger, getProjectTotals, aggregateByModel, formatCost, formatTokenCount, loadLedgerFromDisk } from "./metrics.js";
|
|
10
|
+
import { gsdRoot } from "./paths.js";
|
|
11
|
+
import { formatDuration } from "../shared/format-utils.js";
|
|
12
|
+
function formatSessionReport(units) {
|
|
13
|
+
const totals = getProjectTotals(units);
|
|
14
|
+
const byModel = aggregateByModel(units);
|
|
15
|
+
const lines = [];
|
|
16
|
+
lines.push("╭─ Session Report ──────────────────────────────────────╮");
|
|
17
|
+
if (totals.duration > 0) {
|
|
18
|
+
lines.push(`│ Duration: ${formatDuration(totals.duration).padEnd(40)}│`);
|
|
19
|
+
}
|
|
20
|
+
lines.push(`│ Units: ${String(units.length).padEnd(40)}│`);
|
|
21
|
+
lines.push(`│ Cost: ${formatCost(totals.cost).padEnd(40)}│`);
|
|
22
|
+
lines.push(`│ Tokens: ${`${formatTokenCount(totals.tokens.input)} in / ${formatTokenCount(totals.tokens.output)} out`.padEnd(40)}│`);
|
|
23
|
+
lines.push("│ │");
|
|
24
|
+
// Work completed
|
|
25
|
+
if (units.length > 0) {
|
|
26
|
+
lines.push("│ Work Completed: │");
|
|
27
|
+
for (const unit of units) {
|
|
28
|
+
const finished = unit.finishedAt > 0;
|
|
29
|
+
const status = finished ? "✓" : "•";
|
|
30
|
+
const label = ` ${status} ${unit.id ?? "unknown"}`;
|
|
31
|
+
lines.push(`│ ${label.padEnd(53)}│`);
|
|
32
|
+
}
|
|
33
|
+
lines.push("│ │");
|
|
34
|
+
}
|
|
35
|
+
// Model usage
|
|
36
|
+
if (byModel.length > 0) {
|
|
37
|
+
lines.push("│ Model Usage: │");
|
|
38
|
+
for (const m of byModel) {
|
|
39
|
+
const label = ` ${m.model}: ${m.units} units (${formatCost(m.cost)})`;
|
|
40
|
+
lines.push(`│ ${label.padEnd(53)}│`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
lines.push("╰───────────────────────────────────────────────────────╯");
|
|
44
|
+
return lines.join("\n");
|
|
45
|
+
}
|
|
46
|
+
export async function handleSessionReport(args, ctx) {
|
|
47
|
+
const basePath = process.cwd();
|
|
48
|
+
// Get units from in-memory ledger or disk
|
|
49
|
+
const ledger = getLedger();
|
|
50
|
+
let units;
|
|
51
|
+
if (ledger && ledger.units.length > 0) {
|
|
52
|
+
units = ledger.units;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const diskLedger = loadLedgerFromDisk(basePath);
|
|
56
|
+
if (!diskLedger || diskLedger.units.length === 0) {
|
|
57
|
+
ctx.ui.notify("No session data — no units have been executed yet.", "info");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
units = diskLedger.units;
|
|
61
|
+
}
|
|
62
|
+
// JSON output
|
|
63
|
+
if (args.includes("--json")) {
|
|
64
|
+
const totals = getProjectTotals(units);
|
|
65
|
+
const byModel = aggregateByModel(units);
|
|
66
|
+
ctx.ui.notify(JSON.stringify({ units: units.length, totals, byModel }, null, 2), "info");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Save to file
|
|
70
|
+
if (args.includes("--save")) {
|
|
71
|
+
const report = formatSessionReport(units);
|
|
72
|
+
const reportsDir = join(gsdRoot(basePath), "reports");
|
|
73
|
+
mkdirSync(reportsDir, { recursive: true });
|
|
74
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
75
|
+
const outPath = join(reportsDir, `session-${timestamp}.md`);
|
|
76
|
+
writeFileSync(outPath, `\`\`\`\n${report}\n\`\`\`\n`, "utf-8");
|
|
77
|
+
ctx.ui.notify(`Report saved: ${outPath}`, "success");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Display
|
|
81
|
+
ctx.ui.notify(formatSessionReport(units), "info");
|
|
82
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Command — /gsd ship
|
|
3
|
+
*
|
|
4
|
+
* Creates a PR from milestone artifacts: generates title + body from
|
|
5
|
+
* roadmap, slice summaries, and metrics, then opens via `gh pr create`.
|
|
6
|
+
*/
|
|
7
|
+
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
9
|
+
import { deriveState } from "./state.js";
|
|
10
|
+
import { resolveMilestoneFile, resolveSlicePath, resolveSliceFile } from "./paths.js";
|
|
11
|
+
import { getLedger, getProjectTotals, aggregateByModel, formatCost, formatTokenCount, loadLedgerFromDisk } from "./metrics.js";
|
|
12
|
+
import { nativeGetCurrentBranch, nativeDetectMainBranch } from "./native-git-bridge.js";
|
|
13
|
+
import { formatDuration } from "../shared/format-utils.js";
|
|
14
|
+
function git(basePath, args) {
|
|
15
|
+
return execFileSync("git", args, { cwd: basePath, encoding: "utf-8" }).trim();
|
|
16
|
+
}
|
|
17
|
+
function isValidRefName(name) {
|
|
18
|
+
try {
|
|
19
|
+
execFileSync("git", ["check-ref-format", "--branch", name], { stdio: "pipe" });
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function listSliceIds(basePath, milestoneId) {
|
|
27
|
+
// Slices live at <milestoneDir>/slices/<sliceId>/ with canonical S\d+ IDs.
|
|
28
|
+
// Use resolveSlicePath with a probe to find the real slices directory root.
|
|
29
|
+
const probe = resolveSlicePath(basePath, milestoneId, "S01");
|
|
30
|
+
let slicesDir = null;
|
|
31
|
+
if (probe) {
|
|
32
|
+
// probe looks like <milestoneDir>/slices/S01 — parent is slices dir.
|
|
33
|
+
slicesDir = probe.replace(/[\\/][^\\/]+$/, "");
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// Fall back to scanning the milestones roadmap file's sibling slices dir.
|
|
37
|
+
const roadmap = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
38
|
+
if (roadmap) {
|
|
39
|
+
slicesDir = roadmap.replace(/[\\/][^\\/]+$/, "") + "/slices";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (!slicesDir || !existsSync(slicesDir))
|
|
43
|
+
return [];
|
|
44
|
+
try {
|
|
45
|
+
return readdirSync(slicesDir, { withFileTypes: true })
|
|
46
|
+
.filter((e) => e.isDirectory() && /^S\d+$/.test(e.name))
|
|
47
|
+
.map((e) => e.name)
|
|
48
|
+
.sort();
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function collectSliceSummaries(basePath, milestoneId) {
|
|
55
|
+
const summaries = [];
|
|
56
|
+
for (const sliceId of listSliceIds(basePath, milestoneId)) {
|
|
57
|
+
const summaryPath = resolveSliceFile(basePath, milestoneId, sliceId, "SUMMARY");
|
|
58
|
+
if (!summaryPath || !existsSync(summaryPath))
|
|
59
|
+
continue;
|
|
60
|
+
try {
|
|
61
|
+
const content = readFileSync(summaryPath, "utf-8").trim();
|
|
62
|
+
if (content)
|
|
63
|
+
summaries.push(`### ${sliceId}\n${content}`);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// non-fatal
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return summaries;
|
|
70
|
+
}
|
|
71
|
+
function generatePRContent(basePath, milestoneId, milestoneTitle) {
|
|
72
|
+
const title = `feat: ${milestoneTitle || milestoneId}`;
|
|
73
|
+
const sections = [];
|
|
74
|
+
// TL;DR
|
|
75
|
+
sections.push("## TL;DR\n");
|
|
76
|
+
sections.push(`**What:** Ship milestone ${milestoneId} — ${milestoneTitle || "(untitled)"}`);
|
|
77
|
+
sections.push(`**Why:** Milestone work complete, ready for review.`);
|
|
78
|
+
sections.push(`**How:** See slice summaries below.\n`);
|
|
79
|
+
// What — slice summaries
|
|
80
|
+
const summaries = collectSliceSummaries(basePath, milestoneId);
|
|
81
|
+
if (summaries.length > 0) {
|
|
82
|
+
sections.push("## What\n");
|
|
83
|
+
sections.push(summaries.join("\n\n"));
|
|
84
|
+
sections.push("");
|
|
85
|
+
}
|
|
86
|
+
// Roadmap status
|
|
87
|
+
const roadmapPath = resolveMilestoneFile(basePath, milestoneId, "ROADMAP");
|
|
88
|
+
if (roadmapPath && existsSync(roadmapPath)) {
|
|
89
|
+
try {
|
|
90
|
+
const roadmap = readFileSync(roadmapPath, "utf-8");
|
|
91
|
+
const checkboxLines = roadmap.split("\n").filter((l) => /^\s*-\s*\[[ x]\]/.test(l));
|
|
92
|
+
if (checkboxLines.length > 0) {
|
|
93
|
+
sections.push("## Roadmap\n");
|
|
94
|
+
sections.push(checkboxLines.join("\n"));
|
|
95
|
+
sections.push("");
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// non-fatal
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Metrics
|
|
103
|
+
const ledger = getLedger();
|
|
104
|
+
const units = ledger?.units ?? loadLedgerFromDisk(basePath)?.units ?? [];
|
|
105
|
+
if (units.length > 0) {
|
|
106
|
+
const totals = getProjectTotals(units);
|
|
107
|
+
const byModel = aggregateByModel(units);
|
|
108
|
+
sections.push("## Metrics\n");
|
|
109
|
+
sections.push(`- **Units executed:** ${units.length}`);
|
|
110
|
+
sections.push(`- **Total cost:** ${formatCost(totals.cost)}`);
|
|
111
|
+
sections.push(`- **Tokens:** ${formatTokenCount(totals.tokens.input)} input / ${formatTokenCount(totals.tokens.output)} output`);
|
|
112
|
+
if (totals.duration > 0) {
|
|
113
|
+
sections.push(`- **Duration:** ${formatDuration(totals.duration)}`);
|
|
114
|
+
}
|
|
115
|
+
if (byModel.length > 0) {
|
|
116
|
+
sections.push(`- **Models:** ${byModel.map((m) => `${m.model} (${m.units} units)`).join(", ")}`);
|
|
117
|
+
}
|
|
118
|
+
sections.push("");
|
|
119
|
+
}
|
|
120
|
+
// Change type checklist
|
|
121
|
+
sections.push("## Change type\n");
|
|
122
|
+
sections.push("- [x] `feat` — New feature or capability");
|
|
123
|
+
sections.push("- [ ] `fix` — Bug fix");
|
|
124
|
+
sections.push("- [ ] `refactor` — Code restructuring");
|
|
125
|
+
sections.push("- [ ] `test` — Adding or updating tests");
|
|
126
|
+
sections.push("- [ ] `docs` — Documentation only");
|
|
127
|
+
sections.push("- [ ] `chore` — Build, CI, or tooling changes\n");
|
|
128
|
+
// AI disclosure
|
|
129
|
+
sections.push("---\n");
|
|
130
|
+
sections.push("*This PR was prepared with AI assistance (GSD auto-mode).*");
|
|
131
|
+
return { title, body: sections.join("\n") };
|
|
132
|
+
}
|
|
133
|
+
export async function handleShip(args, ctx, _pi) {
|
|
134
|
+
const basePath = process.cwd();
|
|
135
|
+
const dryRun = args.includes("--dry-run");
|
|
136
|
+
const draft = args.includes("--draft");
|
|
137
|
+
const force = args.includes("--force");
|
|
138
|
+
const baseMatch = args.match(/--base\s+(\S+)/);
|
|
139
|
+
const base = baseMatch?.[1] ?? nativeDetectMainBranch(basePath);
|
|
140
|
+
if (!isValidRefName(base)) {
|
|
141
|
+
ctx.ui.notify(`Invalid base branch name: ${base}`, "error");
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// 1. Validate milestone state
|
|
145
|
+
const state = await deriveState(basePath);
|
|
146
|
+
if (!state.activeMilestone) {
|
|
147
|
+
ctx.ui.notify("No active milestone to ship. Complete milestone work first.", "warning");
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const milestoneId = state.activeMilestone.id;
|
|
151
|
+
const milestoneTitle = state.activeMilestone.title ?? "";
|
|
152
|
+
// 2. Check for incomplete work (use GSD phase as proxy — no phase field on ActiveRef)
|
|
153
|
+
if (state.phase !== "complete" && !force) {
|
|
154
|
+
ctx.ui.notify(`Milestone ${milestoneId} may not be complete (phase: ${state.phase}). Use --force to ship anyway.`, "warning");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
// 3. Generate PR content
|
|
158
|
+
const { title, body } = generatePRContent(basePath, milestoneId, milestoneTitle);
|
|
159
|
+
// 4. Dry-run — just show the PR content
|
|
160
|
+
if (dryRun) {
|
|
161
|
+
ctx.ui.notify(`--- PR Preview ---\n\nTitle: ${title}\n\n${body}`, "info");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
// 5. Check git state
|
|
165
|
+
const currentBranch = nativeGetCurrentBranch(basePath);
|
|
166
|
+
if (!isValidRefName(currentBranch)) {
|
|
167
|
+
ctx.ui.notify(`Current branch name is invalid for git: ${currentBranch}`, "error");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (currentBranch === base) {
|
|
171
|
+
ctx.ui.notify(`You're on ${base} — create a feature branch first.`, "warning");
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// 6. Push and create PR (all argv-safe, no shell interpolation)
|
|
175
|
+
try {
|
|
176
|
+
git(basePath, ["push", "-u", "origin", currentBranch]);
|
|
177
|
+
const ghArgs = ["pr", "create", "--base", base, "--title", title, "--body", body];
|
|
178
|
+
if (draft)
|
|
179
|
+
ghArgs.push("--draft");
|
|
180
|
+
const prUrl = execFileSync("gh", ghArgs, { cwd: basePath, encoding: "utf-8" }).trim();
|
|
181
|
+
ctx.ui.notify(`PR created: ${prUrl}`, "success");
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
185
|
+
ctx.ui.notify(`Failed to create PR: ${msg}`, "error");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -301,8 +301,7 @@ export async function saveRequirementToDb(fields, basePath) {
|
|
|
301
301
|
catch (diskErr) {
|
|
302
302
|
logError('manifest', 'disk write failed, rolling back DB row', { fn: 'saveRequirementToDb', error: String(diskErr.message) });
|
|
303
303
|
try {
|
|
304
|
-
|
|
305
|
-
rollbackAdapter?.prepare('DELETE FROM requirements WHERE id = :id').run({ ':id': id });
|
|
304
|
+
db.deleteRequirementById(id);
|
|
306
305
|
}
|
|
307
306
|
catch (rollbackErr) {
|
|
308
307
|
logError('manifest', 'SPLIT BRAIN: disk write failed AND DB rollback failed — DB has orphaned row', { fn: 'saveRequirementToDb', id, error: String(rollbackErr.message) });
|
|
@@ -405,7 +404,7 @@ export async function saveDecisionToDb(fields, basePath) {
|
|
|
405
404
|
catch (diskErr) {
|
|
406
405
|
logError('manifest', 'disk write failed, rolling back DB row', { fn: 'saveDecisionToDb', error: String(diskErr.message) });
|
|
407
406
|
try {
|
|
408
|
-
|
|
407
|
+
db.deleteDecisionById(id);
|
|
409
408
|
}
|
|
410
409
|
catch (rollbackErr) {
|
|
411
410
|
logError('manifest', 'SPLIT BRAIN: disk write failed AND DB rollback failed — DB has orphaned row', { fn: 'saveDecisionToDb', id, error: String(rollbackErr.message) });
|
|
@@ -614,8 +613,7 @@ export async function saveArtifactToDb(opts, basePath) {
|
|
|
614
613
|
}
|
|
615
614
|
catch (diskErr) {
|
|
616
615
|
logError('manifest', 'disk write failed, rolling back DB row', { fn: 'saveArtifactToDb', error: String(diskErr.message) });
|
|
617
|
-
|
|
618
|
-
rollbackAdapter?.prepare('DELETE FROM artifacts WHERE path = :path').run({ ':path': opts.path });
|
|
616
|
+
db.deleteArtifactByPath(opts.path);
|
|
619
617
|
throw diskErr;
|
|
620
618
|
}
|
|
621
619
|
}
|
|
@@ -157,7 +157,7 @@ Setting `prefer_skills: []` does **not** disable skill discovery — it just mea
|
|
|
157
157
|
|
|
158
158
|
- `phases`: fine-grained control over which phases run. Usually set by `token_profile`, but can be overridden. Keys:
|
|
159
159
|
- `skip_research`: boolean — skip milestone-level research. Default: `false`.
|
|
160
|
-
- `reassess_after_slice`: boolean — run roadmap reassessment after each completed slice. Default: `
|
|
160
|
+
- `reassess_after_slice`: boolean — run roadmap reassessment after each completed slice. Default: `true`.
|
|
161
161
|
- `skip_reassess`: boolean — force-disable roadmap reassessment even if `reassess_after_slice` is enabled. Default: `false`.
|
|
162
162
|
- `skip_slice_research`: boolean — skip per-slice research. Default: `false`.
|
|
163
163
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph-aware context injection for dispatch prompt builders.
|
|
3
|
+
*
|
|
4
|
+
* Reads the pre-built graph.json and returns a formatted context block
|
|
5
|
+
* for injection into prompts. Gracefully returns null when no graph exists
|
|
6
|
+
* or the query yields no results — callers must handle null.
|
|
7
|
+
*/
|
|
8
|
+
import { logWarning } from "./workflow-logger.js";
|
|
9
|
+
/**
|
|
10
|
+
* Query the knowledge graph for nodes related to the given term and format
|
|
11
|
+
* the result as an inlined context block.
|
|
12
|
+
*
|
|
13
|
+
* Returns null when:
|
|
14
|
+
* - @gsd-build/mcp-server fails to import
|
|
15
|
+
* - graph.json does not exist (graphQuery already handles this gracefully)
|
|
16
|
+
* - query returns zero nodes
|
|
17
|
+
*
|
|
18
|
+
* Annotates the block header when the graph is stale (> 24 hours old).
|
|
19
|
+
*/
|
|
20
|
+
export async function inlineGraphSubgraph(projectDir, term, opts) {
|
|
21
|
+
if (!term || !term.trim())
|
|
22
|
+
return null;
|
|
23
|
+
try {
|
|
24
|
+
const { graphQuery, graphStatus } = await import("@gsd-build/mcp-server");
|
|
25
|
+
const result = await graphQuery(projectDir, term, opts.budget);
|
|
26
|
+
if (result.nodes.length === 0)
|
|
27
|
+
return null;
|
|
28
|
+
// Check staleness for annotation
|
|
29
|
+
let staleAnnotation = "";
|
|
30
|
+
try {
|
|
31
|
+
const status = await graphStatus(projectDir);
|
|
32
|
+
if (status.exists && status.stale && status.ageHours !== undefined) {
|
|
33
|
+
const hours = Math.round(status.ageHours);
|
|
34
|
+
staleAnnotation = `\n> ⚠ Graph last built ${hours}h ago — context may be outdated`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Non-fatal — skip annotation on error
|
|
39
|
+
}
|
|
40
|
+
// Format nodes as a compact list
|
|
41
|
+
const nodeLines = result.nodes.map((n) => {
|
|
42
|
+
const desc = n.description ? ` — ${n.description}` : "";
|
|
43
|
+
return `- **${n.label}** (\`${n.type}\`, ${n.confidence})${desc}`;
|
|
44
|
+
});
|
|
45
|
+
// Format edges as relations (only if present)
|
|
46
|
+
const edgeLines = result.edges.length > 0
|
|
47
|
+
? result.edges.map((e) => `- \`${e.from}\` →[${e.type}]→ \`${e.to}\``)
|
|
48
|
+
: [];
|
|
49
|
+
const sections = [
|
|
50
|
+
`### Knowledge Graph Context (term: "${term}")`,
|
|
51
|
+
`Source: \`.gsd/graphs/graph.json\``,
|
|
52
|
+
staleAnnotation,
|
|
53
|
+
"",
|
|
54
|
+
`**Nodes (${result.nodes.length}):**`,
|
|
55
|
+
...nodeLines,
|
|
56
|
+
];
|
|
57
|
+
if (edgeLines.length > 0) {
|
|
58
|
+
sections.push("", `**Relations (${result.edges.length}):**`, ...edgeLines);
|
|
59
|
+
}
|
|
60
|
+
return sections.filter((l) => l !== undefined).join("\n");
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
logWarning("prompt", `inlineGraphSubgraph failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|