gsd-pi 2.81.0 → 2.82.0-dev.2841a1e44
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/README.md +63 -32
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +3 -1
- package/dist/resources/extensions/browser-tools/tools/screenshot.js +1 -0
- package/dist/resources/extensions/browser-tools/tools/zoom.js +1 -0
- package/dist/resources/extensions/cmux/index.js +5 -0
- package/dist/resources/extensions/gsd/auto/loop.js +111 -8
- package/dist/resources/extensions/gsd/auto/orchestrator.js +113 -6
- package/dist/resources/extensions/gsd/auto/phases.js +199 -97
- package/dist/resources/extensions/gsd/auto/run-unit.js +66 -3
- package/dist/resources/extensions/gsd/auto/session.js +9 -0
- package/dist/resources/extensions/gsd/auto/verification-retry-policy.js +43 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +182 -178
- package/dist/resources/extensions/gsd/auto-dispatch.js +14 -11
- package/dist/resources/extensions/gsd/auto-post-unit.js +176 -125
- package/dist/resources/extensions/gsd/auto-prompts.js +13 -5
- package/dist/resources/extensions/gsd/auto-recovery.js +6 -181
- package/dist/resources/extensions/gsd/auto-runtime-state.js +5 -0
- package/dist/resources/extensions/gsd/auto-start.js +20 -23
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +33 -5
- package/dist/resources/extensions/gsd/auto-verification.js +38 -26
- package/dist/resources/extensions/gsd/auto-worktree.js +8 -0
- package/dist/resources/extensions/gsd/auto.js +371 -106
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +13 -6
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +13 -2
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +4 -8
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +16 -7
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +55 -12
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +3 -1
- package/dist/resources/extensions/gsd/clean-root-preflight.js +170 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +4 -1
- package/dist/resources/extensions/gsd/commands/handlers/core.js +22 -1
- package/dist/resources/extensions/gsd/commands/handlers/notifications-handler.js +4 -10
- package/dist/resources/extensions/gsd/commands/handlers/parallel.js +9 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +5 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +15 -2
- package/dist/resources/extensions/gsd/context-store.js +112 -0
- package/dist/resources/extensions/gsd/db-writer.js +150 -84
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/doctor-git-checks.js +41 -6
- package/dist/resources/extensions/gsd/git-service.js +2 -1
- package/dist/resources/extensions/gsd/gsd-db.js +7 -23
- package/dist/resources/extensions/gsd/health-widget-core.js +1 -1
- package/dist/resources/extensions/gsd/health-widget.js +4 -10
- package/dist/resources/extensions/gsd/knowledge-backfill.js +144 -0
- package/dist/resources/extensions/gsd/knowledge-capture.js +136 -0
- package/dist/resources/extensions/gsd/knowledge-parser.js +154 -0
- package/dist/resources/extensions/gsd/knowledge-projection.js +210 -0
- package/dist/resources/extensions/gsd/markdown-renderer.js +6 -96
- package/dist/resources/extensions/gsd/md-importer.js +1 -1
- package/dist/resources/extensions/gsd/memory-backfill.js +73 -17
- package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +222 -0
- package/dist/resources/extensions/gsd/migrate/command.js +5 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +9 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +51 -4
- package/dist/resources/extensions/gsd/migrate/writer.js +11 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +14 -14
- package/dist/resources/extensions/gsd/notification-overlay.js +35 -40
- package/dist/resources/extensions/gsd/parallel-merge.js +53 -30
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +25 -33
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +14 -12
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +20 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +20 -2
- package/dist/resources/extensions/gsd/prompts/system.md +2 -2
- package/dist/resources/extensions/gsd/provider-switch-observer.js +146 -0
- package/dist/resources/extensions/gsd/recovery-classification.js +15 -1
- package/dist/resources/extensions/gsd/session-lock.js +40 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/completion.js +131 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/merge-state.js +247 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/project-md.js +50 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/roadmap.js +87 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.js +50 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/stale-render.js +124 -0
- package/dist/resources/extensions/gsd/state-reconciliation/drift/stale-worker.js +32 -0
- package/dist/resources/extensions/gsd/state-reconciliation/errors.js +41 -0
- package/dist/resources/extensions/gsd/state-reconciliation/index.js +99 -0
- package/dist/resources/extensions/gsd/state-reconciliation/registry.js +24 -0
- package/dist/resources/extensions/gsd/state-reconciliation/spawn-gate.js +43 -0
- package/dist/resources/extensions/gsd/state-reconciliation/types.js +3 -0
- package/dist/resources/extensions/gsd/state-reconciliation.js +5 -26
- package/dist/resources/extensions/gsd/templates/knowledge.md +2 -2
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +119 -0
- package/dist/resources/extensions/gsd/tui/render-kit.js +74 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +25 -2
- package/dist/resources/extensions/gsd/verification-verdict.js +26 -0
- package/dist/resources/extensions/gsd/watch/header-renderer.js +92 -69
- package/dist/resources/extensions/gsd/watch/splash-palette.js +10 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +2 -2
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +743 -318
- package/dist/resources/extensions/gsd/worktree-telemetry.js +3 -1
- package/dist/resources/extensions/subagent/index.js +448 -78
- package/dist/resources/extensions/subagent/launch.js +77 -0
- package/dist/resources/extensions/subagent/run-store.js +148 -0
- package/dist/resources/extensions/visual-brief/artifact-policy.js +29 -0
- package/dist/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/dist/resources/extensions/visual-brief/index.js +5 -0
- package/dist/resources/extensions/visual-brief/page-contract.js +122 -0
- package/dist/resources/extensions/visual-brief/prompts.js +111 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- package/dist/web/standalone/.next/build-manifest.json +4 -4
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-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 +4 -4
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- 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 +4 -4
- 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 +2 -2
- 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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +5 -5
- 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 +5 -5
- 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 +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- 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 +11 -11
- 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-react-loadable-manifest.js +1 -1
- 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/2973.33f26573894b6153.js +2 -0
- package/dist/web/standalone/.next/static/chunks/{8359.e059d86b255fce1c.js → 8359.7eb3bb8f8ecf4c01.js} +2 -2
- 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-752f1e2ebdaa3e45.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/.next/static/chunks/{webpack-de742b64187e13fe.js → webpack-6a95bc41e0f7ec89.js} +1 -1
- package/dist/web/standalone/.next/static/css/0262768ec1b89d34.css +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/dist/welcome-screen.d.ts +0 -7
- package/dist/welcome-screen.js +60 -69
- package/package.json +5 -4
- package/packages/contracts/dist/rpc.test.js +7 -0
- package/packages/contracts/dist/rpc.test.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +21 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +24 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/src/rpc.test.ts +8 -0
- package/packages/contracts/src/workflow.ts +24 -0
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/README.md +14 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts +0 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +80 -0
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/workflow-tools-parity.test.ts +244 -0
- package/packages/mcp-server/src/workflow-tools.test.ts +22 -0
- package/packages/mcp-server/src/workflow-tools.ts +168 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/index.d.ts +2 -2
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -1
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/providers/transform-messages.d.ts +11 -0
- package/packages/pi-ai/dist/providers/transform-messages.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/transform-messages.js +20 -0
- package/packages/pi-ai/dist/providers/transform-messages.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/index.ts +7 -2
- package/packages/pi-ai/src/providers/transform-messages.ts +24 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +4 -4
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/assistant-message-design.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/assistant-message-design.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/assistant-message-design.test.js +47 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/assistant-message-design.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +76 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/user-message-design.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/user-message-design.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/user-message-design.test.js +40 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/user-message-design.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts +0 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js +30 -29
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js +10 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/adaptive-layout.test.js.map +1 -1
- 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 +13 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +1 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +58 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.d.ts +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js +12 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/diff.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +14 -41
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +86 -82
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/transcript-design.d.ts +35 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/transcript-design.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/transcript-design.js +152 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/transcript-design.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tui-style-kit.d.ts +16 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tui-style-kit.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tui-style-kit.js +73 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tui-style-kit.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +12 -8
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-highlight.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-highlight.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-highlight.test.js +17 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-highlight.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +105 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +27 -26
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js +9 -6
- package/packages/pi-coding-agent/dist/modes/interactive/tui-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.js +17 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-file-safety.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/system-prompt.ts +4 -4
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/assistant-message-design.test.ts +56 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +113 -9
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/user-message-design.test.ts +48 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.test.ts +10 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/adaptive-layout.ts +43 -42
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +14 -14
- package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.ts +64 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/diff.ts +13 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +15 -42
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +84 -104
- package/packages/pi-coding-agent/src/modes/interactive/components/transcript-design.ts +196 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tui-style-kit.ts +94 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +14 -9
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-highlight.test.ts +23 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +106 -1
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +27 -26
- package/packages/pi-coding-agent/src/modes/interactive/tui-mode.test.ts +9 -6
- package/packages/pi-coding-agent/src/tests/system-prompt-file-safety.test.ts +22 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +14 -1
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.d.ts.map +1 -1
- package/packages/pi-tui/dist/overlay-layout.js +9 -6
- package/packages/pi-tui/dist/overlay-layout.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +5 -0
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +20 -1
- package/packages/pi-tui/src/overlay-layout.ts +10 -7
- package/packages/pi-tui/src/tui.ts +6 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/theme-highlight.test.d.ts +2 -0
- package/pkg/dist/modes/interactive/theme/theme-highlight.test.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme-highlight.test.js +17 -0
- package/pkg/dist/modes/interactive/theme/theme-highlight.test.js.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +105 -1
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.js +27 -26
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +3 -1
- package/src/resources/extensions/browser-tools/tools/screenshot.ts +1 -0
- package/src/resources/extensions/browser-tools/tools/zoom.ts +1 -0
- package/src/resources/extensions/cmux/index.ts +6 -0
- package/src/resources/extensions/gsd/auto/contracts.ts +46 -11
- package/src/resources/extensions/gsd/auto/loop-deps.ts +9 -5
- package/src/resources/extensions/gsd/auto/loop.ts +113 -9
- package/src/resources/extensions/gsd/auto/orchestrator.ts +118 -6
- package/src/resources/extensions/gsd/auto/phases.ts +158 -19
- package/src/resources/extensions/gsd/auto/run-unit.ts +69 -4
- package/src/resources/extensions/gsd/auto/session.ts +10 -0
- package/src/resources/extensions/gsd/auto/verification-retry-policy.ts +82 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +230 -183
- package/src/resources/extensions/gsd/auto-dispatch.ts +15 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +201 -138
- package/src/resources/extensions/gsd/auto-prompts.ts +13 -5
- package/src/resources/extensions/gsd/auto-recovery.ts +7 -209
- package/src/resources/extensions/gsd/auto-runtime-state.ts +5 -0
- package/src/resources/extensions/gsd/auto-start.ts +22 -22
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +51 -0
- package/src/resources/extensions/gsd/auto-verification.ts +46 -38
- package/src/resources/extensions/gsd/auto-worktree.ts +8 -0
- package/src/resources/extensions/gsd/auto.ts +411 -106
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +21 -6
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +12 -2
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +5 -8
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +16 -6
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +58 -15
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +3 -2
- package/src/resources/extensions/gsd/clean-root-preflight.ts +174 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +4 -1
- package/src/resources/extensions/gsd/commands/handlers/core.ts +25 -1
- package/src/resources/extensions/gsd/commands/handlers/notifications-handler.ts +4 -10
- package/src/resources/extensions/gsd/commands/handlers/parallel.ts +12 -0
- package/src/resources/extensions/gsd/commands-bootstrap.ts +10 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
- package/src/resources/extensions/gsd/context-store.ts +120 -1
- package/src/resources/extensions/gsd/db-writer.ts +167 -84
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/doctor-git-checks.ts +44 -6
- package/src/resources/extensions/gsd/doctor-types.ts +2 -0
- package/src/resources/extensions/gsd/git-service.ts +2 -0
- package/src/resources/extensions/gsd/gsd-db.ts +7 -23
- package/src/resources/extensions/gsd/health-widget-core.ts +1 -1
- package/src/resources/extensions/gsd/health-widget.ts +6 -10
- package/src/resources/extensions/gsd/journal.ts +2 -0
- package/src/resources/extensions/gsd/knowledge-backfill.ts +164 -0
- package/src/resources/extensions/gsd/knowledge-capture.ts +160 -0
- package/src/resources/extensions/gsd/knowledge-parser.ts +174 -0
- package/src/resources/extensions/gsd/knowledge-projection.ts +241 -0
- package/src/resources/extensions/gsd/markdown-renderer.ts +10 -96
- package/src/resources/extensions/gsd/md-importer.ts +1 -1
- package/src/resources/extensions/gsd/memory-backfill.ts +89 -17
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +277 -0
- package/src/resources/extensions/gsd/migrate/command.ts +5 -0
- package/src/resources/extensions/gsd/migrate/preview.ts +10 -0
- package/src/resources/extensions/gsd/migrate/transformer.ts +58 -4
- package/src/resources/extensions/gsd/migrate/writer.ts +14 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +14 -13
- package/src/resources/extensions/gsd/notification-overlay.ts +50 -46
- package/src/resources/extensions/gsd/parallel-merge.ts +61 -34
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +33 -35
- package/src/resources/extensions/gsd/prompts/complete-slice.md +14 -12
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +20 -2
- package/src/resources/extensions/gsd/prompts/discuss.md +20 -2
- package/src/resources/extensions/gsd/prompts/system.md +2 -2
- package/src/resources/extensions/gsd/provider-switch-observer.ts +185 -0
- package/src/resources/extensions/gsd/recovery-classification.ts +18 -1
- package/src/resources/extensions/gsd/session-lock.ts +41 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/completion.ts +172 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/merge-state.ts +337 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/project-md.ts +69 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/roadmap.ts +109 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.ts +68 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/stale-render.ts +185 -0
- package/src/resources/extensions/gsd/state-reconciliation/drift/stale-worker.ts +46 -0
- package/src/resources/extensions/gsd/state-reconciliation/errors.ts +67 -0
- package/src/resources/extensions/gsd/state-reconciliation/index.ts +142 -0
- package/src/resources/extensions/gsd/state-reconciliation/registry.ts +27 -0
- package/src/resources/extensions/gsd/state-reconciliation/spawn-gate.ts +60 -0
- package/src/resources/extensions/gsd/state-reconciliation/types.ts +83 -0
- package/src/resources/extensions/gsd/state-reconciliation.ts +21 -53
- package/src/resources/extensions/gsd/templates/knowledge.md +2 -2
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +99 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +729 -176
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +408 -4
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +292 -4
- package/src/resources/extensions/gsd/tests/auto-runtime-state.test.ts +20 -5
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/auto-unit-closeout.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/brief-command.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/browser-tools-compatibility-declarations.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +107 -2
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/context-store-decisions-from-memories.test.ts +312 -0
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +28 -1
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +13 -8
- package/src/resources/extensions/gsd/tests/decisions-projection-from-memories.test.ts +453 -0
- package/src/resources/extensions/gsd/tests/decisions-stop-table-writes.test.ts +348 -0
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +20 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/freeform-decisions.test.ts +8 -4
- package/src/resources/extensions/gsd/tests/gsd-tools.test.ts +11 -7
- package/src/resources/extensions/gsd/tests/header-renderer.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +10 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +14 -4
- package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +26 -0
- package/src/resources/extensions/gsd/tests/integration/integration-lifecycle.test.ts +13 -5
- package/src/resources/extensions/gsd/tests/integration/integration-proof.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/integration/migrate-command.test.ts +48 -3
- package/src/resources/extensions/gsd/tests/integration/parallel-merge.test.ts +116 -24
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +0 -1
- package/src/resources/extensions/gsd/tests/knowledge-backfill-projection.test.ts +323 -0
- package/src/resources/extensions/gsd/tests/knowledge-capture.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +47 -2
- package/src/resources/extensions/gsd/tests/load-knowledge-block-rules-only.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/markdown-renderer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-consolidation-scanner.test.ts +316 -0
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +46 -11
- package/src/resources/extensions/gsd/tests/migrate-transformer.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +78 -41
- package/src/resources/extensions/gsd/tests/notifications-handler.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/originalbase-path-comparison.test.ts +12 -217
- package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +38 -6
- package/src/resources/extensions/gsd/tests/plan-milestone-sketch-render.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +81 -3
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/provider-switch-observer.test.ts +252 -0
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +16 -4
- package/src/resources/extensions/gsd/tests/session-switch-abort-misclassification.test.ts +24 -0
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +71 -58
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +952 -0
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/tui-header-lifecycle.test.ts +121 -1
- package/src/resources/extensions/gsd/tests/tui-render-kit.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/verification-retry-policy.test.ts +83 -0
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +158 -58
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +597 -118
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +34 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +135 -0
- package/src/resources/extensions/gsd/tui/render-kit.ts +109 -0
- package/src/resources/extensions/gsd/unit-context-manifest.ts +35 -2
- package/src/resources/extensions/gsd/verification-verdict.ts +47 -0
- package/src/resources/extensions/gsd/watch/header-renderer.ts +121 -79
- package/src/resources/extensions/gsd/watch/splash-palette.ts +11 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +4 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +2 -2
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +1171 -526
- package/src/resources/extensions/gsd/worktree-telemetry.ts +7 -2
- package/src/resources/extensions/subagent/index.ts +567 -103
- package/src/resources/extensions/subagent/launch.ts +131 -0
- package/src/resources/extensions/subagent/run-store.ts +218 -0
- package/src/resources/extensions/subagent/tests/launch.test.ts +115 -0
- package/src/resources/extensions/subagent/tests/run-store.test.ts +111 -0
- package/src/resources/extensions/visual-brief/artifact-policy.ts +41 -0
- package/src/resources/extensions/visual-brief/extension-manifest.json +8 -0
- package/src/resources/extensions/visual-brief/index.ts +8 -0
- package/src/resources/extensions/visual-brief/page-contract.ts +134 -0
- package/src/resources/extensions/visual-brief/prompts.ts +147 -0
- package/src/resources/extensions/visual-brief/tests/visual-brief.test.ts +172 -0
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/page-200592a7f3baf579.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/css/54ec2745c1da488b.css +0 -1
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +0 -1544
- /package/dist/web/standalone/.next/static/{drLMkgfHQ8lzS229_HWYR → Qgr2B_MRhPxC0z8fwv4vT}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{drLMkgfHQ8lzS229_HWYR → Qgr2B_MRhPxC0z8fwv4vT}/_ssgManifest.js +0 -0
|
@@ -1136,33 +1136,17 @@ export function setSliceSketchFlag(milestoneId: string, sliceId: string, isSketc
|
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
1138
|
/**
|
|
1139
|
-
* ADR-
|
|
1140
|
-
*
|
|
1141
|
-
*
|
|
1142
|
-
*
|
|
1143
|
-
* to keep path logic in one place — do not hand-roll the path inside the callback.
|
|
1144
|
-
*
|
|
1145
|
-
* Recovers from two scenarios:
|
|
1146
|
-
* 1. Crash between `gsd_plan_slice` write and the sketch flag flip.
|
|
1147
|
-
* 2. Flag-OFF downgrade path: when `progressive_planning` is off, the dispatch
|
|
1148
|
-
* rule routes sketch slices to plan-slice, which writes PLAN.md but leaves
|
|
1149
|
-
* `is_sketch=1` — the next state derivation auto-heals it to 0 here.
|
|
1150
|
-
*
|
|
1151
|
-
* Not aggressive in practice: PLAN.md is only written via the DB-backed
|
|
1152
|
-
* `gsd_plan_slice` tool (which also inserts tasks), so a "stale PLAN.md with
|
|
1153
|
-
* is_sketch=1" is extremely unlikely to indicate anything other than the two
|
|
1154
|
-
* recovery scenarios above.
|
|
1139
|
+
* ADR-017 raw primitive: returns slice IDs in a milestone whose is_sketch flag
|
|
1140
|
+
* is still 1. The stale-sketch-flag drift handler at
|
|
1141
|
+
* `state-reconciliation/drift/sketch-flag.ts` composes this with PLAN.md
|
|
1142
|
+
* existence checks to detect drift, then writes via `setSliceSketchFlag`.
|
|
1155
1143
|
*/
|
|
1156
|
-
export function
|
|
1157
|
-
if (!currentDb) return;
|
|
1144
|
+
export function getSketchedSliceIds(milestoneId: string): string[] {
|
|
1145
|
+
if (!currentDb) return [];
|
|
1158
1146
|
const rows = currentDb.prepare(
|
|
1159
1147
|
`SELECT id FROM slices WHERE milestone_id = :mid AND is_sketch = 1`,
|
|
1160
1148
|
).all({ ":mid": milestoneId }) as Array<{ id: string }>;
|
|
1161
|
-
|
|
1162
|
-
if (hasPlanFile(row.id)) {
|
|
1163
|
-
setSliceSketchFlag(milestoneId, row.id, false);
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1149
|
+
return rows.map((r) => r.id);
|
|
1166
1150
|
}
|
|
1167
1151
|
|
|
1168
1152
|
export function upsertSlicePlanning(milestoneId: string, sliceId: string, planning: Partial<SlicePlanningRecord>): void {
|
|
@@ -70,7 +70,7 @@ export function buildHealthLines(data: HealthWidgetData, width?: number): string
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if (data.projectState === "initialized") {
|
|
73
|
-
return [" GSD Project
|
|
73
|
+
return [" GSD Project Initialized"];
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const leftParts: string[] = [];
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Shows a compact 1-2 line summary: progress score, budget, provider key
|
|
5
|
-
* status, and doctor/environment issue count. Refreshes every 60 seconds.
|
|
6
|
-
* Quiet when everything is healthy; turns amber/red when issues arise.
|
|
7
|
-
*
|
|
8
|
-
* Widget key: "gsd-health", placement: "belowEditor"
|
|
9
|
-
*/
|
|
1
|
+
// Project/App: GSD-2
|
|
2
|
+
// File Purpose: Always-on ambient health signal rendered below the editor.
|
|
10
3
|
|
|
11
4
|
import type { ExtensionContext } from "@gsd/pi-coding-agent";
|
|
12
5
|
import type { GSDState } from "./types.js";
|
|
@@ -24,6 +17,9 @@ import {
|
|
|
24
17
|
type HealthWidgetData,
|
|
25
18
|
} from "./health-widget-core.js";
|
|
26
19
|
|
|
20
|
+
export const HEALTH_WIDGET_ACTIVE_HINTS =
|
|
21
|
+
" /gsd auto to run · /gsd status for overview · /gsd visualize to inspect · /gsd notifications for history · /gsd help";
|
|
22
|
+
|
|
27
23
|
// ── Data loader ────────────────────────────────────────────────────────────────
|
|
28
24
|
|
|
29
25
|
function loadHealthWidgetData(basePath: string): HealthWidgetData {
|
|
@@ -136,7 +132,7 @@ export function initHealthWidget(ctx: ExtensionContext): void {
|
|
|
136
132
|
if (!cachedLines || cachedWidth !== width) {
|
|
137
133
|
cachedLines = buildHealthLines(data, width);
|
|
138
134
|
if (data.projectState === "active") {
|
|
139
|
-
cachedLines = [...cachedLines, _theme.fg("dim",
|
|
135
|
+
cachedLines = [...cachedLines, _theme.fg("dim", HEALTH_WIDGET_ACTIVE_HINTS)];
|
|
140
136
|
}
|
|
141
137
|
cachedWidth = width;
|
|
142
138
|
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// GSD2 — KNOWLEDGE.md -> memories backfill (ADR-013 Stage 2b).
|
|
2
|
+
//
|
|
3
|
+
// Idempotent migration of `.gsd/KNOWLEDGE.md` Patterns and Lessons rows into
|
|
4
|
+
// the `memories` table. Patterns become memories with `category: "pattern"`;
|
|
5
|
+
// Lessons become memories with `category: "gotcha"` (mirroring the ADR-013
|
|
6
|
+
// line 38 contract). Rules (K###) are NOT migrated — they remain manually
|
|
7
|
+
// maintained in `KNOWLEDGE.md` per ADR-013 line 39.
|
|
8
|
+
//
|
|
9
|
+
// Idempotency is enforced by tagging each backfilled memory with
|
|
10
|
+
// `structured_fields.sourceKnowledgeId = "<P|L>NNN"`. The
|
|
11
|
+
// memory-consolidation-scanner (PR #5765) checks for the same marker.
|
|
12
|
+
//
|
|
13
|
+
// Triggered opportunistically by `buildBeforeAgentStartResult` so the cost
|
|
14
|
+
// only ever fires once per project. Costs O(N) inserts on first run where N
|
|
15
|
+
// is the row count; subsequent runs are an O(N) lookup that finds existing
|
|
16
|
+
// markers and exits.
|
|
17
|
+
|
|
18
|
+
import { _getAdapter, isDbAvailable } from "./gsd-db.js";
|
|
19
|
+
import { createMemory } from "./memory-store.js";
|
|
20
|
+
import { parseKnowledgeRows, readKnowledgeMd, type KnowledgeRow } from "./knowledge-parser.js";
|
|
21
|
+
import { logWarning } from "./workflow-logger.js";
|
|
22
|
+
|
|
23
|
+
interface SynthesizedRow {
|
|
24
|
+
table: "patterns" | "lessons";
|
|
25
|
+
id: string;
|
|
26
|
+
category: "pattern" | "gotcha";
|
|
27
|
+
content: string;
|
|
28
|
+
scope: string;
|
|
29
|
+
structuredFields: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Backfill KNOWLEDGE.md Patterns + Lessons rows into the memories table.
|
|
34
|
+
*
|
|
35
|
+
* - Idempotent (per-row): each migrated memory carries
|
|
36
|
+
* `structured_fields.sourceKnowledgeId = "<P|L>NNN"`. Rows whose ID is
|
|
37
|
+
* already present in the memory store are skipped.
|
|
38
|
+
* - Best-effort: never throws. Logs and returns 0 on failure so a broken
|
|
39
|
+
* backfill cannot block agent startup.
|
|
40
|
+
* - Rules (K###) are intentionally skipped — they remain manually maintained
|
|
41
|
+
* in `KNOWLEDGE.md` per ADR-013.
|
|
42
|
+
*
|
|
43
|
+
* Returns the number of memories written (0 when there's nothing to migrate
|
|
44
|
+
* or when the file is absent).
|
|
45
|
+
*/
|
|
46
|
+
export function backfillKnowledgeToMemories(basePath: string): number {
|
|
47
|
+
if (!isDbAvailable()) return 0;
|
|
48
|
+
const adapter = _getAdapter();
|
|
49
|
+
if (!adapter) return 0;
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const content = readKnowledgeMd(basePath);
|
|
53
|
+
if (!content.trim()) return 0;
|
|
54
|
+
|
|
55
|
+
const rows = parseKnowledgeRows(content);
|
|
56
|
+
if (rows.length === 0) return 0;
|
|
57
|
+
|
|
58
|
+
const checkExisting = adapter.prepare(
|
|
59
|
+
"SELECT 1 FROM memories WHERE structured_fields LIKE :pattern LIMIT 1",
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
let written = 0;
|
|
63
|
+
for (const row of rows) {
|
|
64
|
+
const synth = synthesize(row);
|
|
65
|
+
if (!synth) continue;
|
|
66
|
+
|
|
67
|
+
// Pattern is anchored on both sides of the value to avoid prefix
|
|
68
|
+
// collisions (e.g. P1 vs P10).
|
|
69
|
+
const matchPattern = `%"sourceKnowledgeId":"${synth.id}"%`;
|
|
70
|
+
if (checkExisting.get({ ":pattern": matchPattern })) continue;
|
|
71
|
+
|
|
72
|
+
const id = createMemory({
|
|
73
|
+
category: synth.category,
|
|
74
|
+
content: synth.content,
|
|
75
|
+
scope: synth.scope,
|
|
76
|
+
confidence: 0.85,
|
|
77
|
+
structuredFields: synth.structuredFields,
|
|
78
|
+
});
|
|
79
|
+
if (id) written += 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return written;
|
|
83
|
+
} catch (e) {
|
|
84
|
+
logWarning(
|
|
85
|
+
"memory-backfill",
|
|
86
|
+
`KNOWLEDGE.md -> memories backfill failed: ${(e as Error).message}`,
|
|
87
|
+
);
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Convert a parsed KNOWLEDGE.md row into the memory payload we insert.
|
|
94
|
+
* Returns `null` for Rules (K###) which are not migrated, or for rows whose
|
|
95
|
+
* primary content cell is empty (defensive against malformed manual edits).
|
|
96
|
+
*/
|
|
97
|
+
function synthesize(row: KnowledgeRow): SynthesizedRow | null {
|
|
98
|
+
if (row.table === "rules") return null;
|
|
99
|
+
|
|
100
|
+
if (row.table === "patterns") {
|
|
101
|
+
// Cells: [P###, Pattern, Where, Notes]
|
|
102
|
+
const [, pattern, where, notes] = row.cells;
|
|
103
|
+
const cleaned = (pattern ?? "").trim();
|
|
104
|
+
if (!cleaned) return null;
|
|
105
|
+
|
|
106
|
+
const contentParts: string[] = [cleaned];
|
|
107
|
+
if (where && where.trim() && where.trim() !== "—") {
|
|
108
|
+
contentParts.push(`Where: ${where.trim()}.`);
|
|
109
|
+
}
|
|
110
|
+
if (notes && notes.trim() && notes.trim() !== "—") {
|
|
111
|
+
contentParts.push(`Notes: ${notes.trim()}.`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
table: "patterns",
|
|
116
|
+
id: row.id,
|
|
117
|
+
category: "pattern",
|
|
118
|
+
content: trim(contentParts.join(" "), 600),
|
|
119
|
+
scope: (where ?? "").trim() || "project",
|
|
120
|
+
structuredFields: {
|
|
121
|
+
sourceKnowledgeId: row.id,
|
|
122
|
+
sourceKnowledgeTable: "patterns",
|
|
123
|
+
pattern: cleaned,
|
|
124
|
+
where: (where ?? "").trim(),
|
|
125
|
+
notes: (notes ?? "").trim(),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// table === "lessons"
|
|
131
|
+
// Cells: [L###, What Happened, Root Cause, Fix, Scope]
|
|
132
|
+
const [, whatHappened, rootCause, fix, scope] = row.cells;
|
|
133
|
+
const cleanedWhat = (whatHappened ?? "").trim();
|
|
134
|
+
if (!cleanedWhat) return null;
|
|
135
|
+
|
|
136
|
+
const contentParts: string[] = [cleanedWhat];
|
|
137
|
+
if (rootCause && rootCause.trim() && rootCause.trim() !== "—") {
|
|
138
|
+
contentParts.push(`Root cause: ${rootCause.trim()}.`);
|
|
139
|
+
}
|
|
140
|
+
if (fix && fix.trim() && fix.trim() !== "—") {
|
|
141
|
+
contentParts.push(`Fix: ${fix.trim()}.`);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
table: "lessons",
|
|
146
|
+
id: row.id,
|
|
147
|
+
category: "gotcha",
|
|
148
|
+
content: trim(contentParts.join(" "), 600),
|
|
149
|
+
scope: (scope ?? "").trim() || "project",
|
|
150
|
+
structuredFields: {
|
|
151
|
+
sourceKnowledgeId: row.id,
|
|
152
|
+
sourceKnowledgeTable: "lessons",
|
|
153
|
+
whatHappened: cleanedWhat,
|
|
154
|
+
rootCause: (rootCause ?? "").trim(),
|
|
155
|
+
fix: (fix ?? "").trim(),
|
|
156
|
+
scopeText: (scope ?? "").trim(),
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function trim(value: string, max: number): string {
|
|
162
|
+
const cleaned = value.replace(/\s+/g, " ").trim();
|
|
163
|
+
return cleaned.length > max ? cleaned.slice(0, max - 1) + "…" : cleaned;
|
|
164
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// GSD2 — KNOWLEDGE.md write-side cutover (ADR-013 Stage 2c).
|
|
2
|
+
//
|
|
3
|
+
// Replaces the legacy `appendKnowledge` file-append path for Patterns and
|
|
4
|
+
// Lessons with `createMemory` calls. Rules (K###) continue to flow through
|
|
5
|
+
// the legacy file-append because they are intentionally not migrated to
|
|
6
|
+
// memories per ADR-013 line 39.
|
|
7
|
+
//
|
|
8
|
+
// Next-ID assignment is the cross-surface stable rule: read the existing
|
|
9
|
+
// `.gsd/KNOWLEDGE.md` for the highest <prefix>### in that section, AND read
|
|
10
|
+
// the memories table for the highest `sourceKnowledgeId` with the matching
|
|
11
|
+
// prefix, take the max, and increment. This stays stable across the
|
|
12
|
+
// knowledge backfill mid-run (when some rows exist only in the file and
|
|
13
|
+
// others only in memories) and on a fresh project where neither has any
|
|
14
|
+
// entries yet.
|
|
15
|
+
|
|
16
|
+
import { _getAdapter, isDbAvailable } from "./gsd-db.js";
|
|
17
|
+
import { createMemory } from "./memory-store.js";
|
|
18
|
+
import { parseKnowledgeRows, readKnowledgeMd } from "./knowledge-parser.js";
|
|
19
|
+
import { logWarning } from "./workflow-logger.js";
|
|
20
|
+
|
|
21
|
+
export type PatternLessonType = "pattern" | "lesson";
|
|
22
|
+
|
|
23
|
+
export interface CaptureKnowledgeResult {
|
|
24
|
+
/** The assigned <prefix>### identifier (e.g. "P004"). */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Whether the memory row was actually written. False only when the
|
|
27
|
+
* DB is unavailable or the createMemory call returned undefined. */
|
|
28
|
+
written: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Append a new Pattern or Lesson by writing it as a memory row carrying a
|
|
33
|
+
* `sourceKnowledgeId` marker. The next session's KNOWLEDGE.md projection
|
|
34
|
+
* render (`knowledge-projection.ts`) picks it up and emits the row into the
|
|
35
|
+
* appropriate section.
|
|
36
|
+
*
|
|
37
|
+
* `entryText` is treated as the row's primary description cell (Pattern for
|
|
38
|
+
* patterns, "What Happened" for lessons). Auxiliary cells (Where/Notes for
|
|
39
|
+
* patterns; Root Cause/Fix/Scope for lessons) are left empty — the projection
|
|
40
|
+
* renders `—` for empty cells. Users who need richer structure can call
|
|
41
|
+
* `capture_thought` directly with a fuller `structuredFields` payload.
|
|
42
|
+
*/
|
|
43
|
+
export function captureKnowledgeEntry(
|
|
44
|
+
basePath: string,
|
|
45
|
+
type: PatternLessonType,
|
|
46
|
+
entryText: string,
|
|
47
|
+
scope: string,
|
|
48
|
+
): CaptureKnowledgeResult {
|
|
49
|
+
const cleaned = entryText.trim();
|
|
50
|
+
const idPrefix = type === "pattern" ? "P" : "L";
|
|
51
|
+
const id = nextKnowledgeId(basePath, idPrefix);
|
|
52
|
+
|
|
53
|
+
if (!cleaned) {
|
|
54
|
+
return { id, written: false };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (!isDbAvailable()) {
|
|
58
|
+
logWarning("knowledge-capture", "DB unavailable; cannot persist knowledge entry");
|
|
59
|
+
return { id, written: false };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const category = type === "pattern" ? "pattern" : "gotcha";
|
|
64
|
+
const structuredFields: Record<string, unknown> =
|
|
65
|
+
type === "pattern"
|
|
66
|
+
? {
|
|
67
|
+
sourceKnowledgeId: id,
|
|
68
|
+
sourceKnowledgeTable: "patterns",
|
|
69
|
+
pattern: cleaned,
|
|
70
|
+
where: "",
|
|
71
|
+
notes: "",
|
|
72
|
+
}
|
|
73
|
+
: {
|
|
74
|
+
sourceKnowledgeId: id,
|
|
75
|
+
sourceKnowledgeTable: "lessons",
|
|
76
|
+
whatHappened: cleaned,
|
|
77
|
+
rootCause: "",
|
|
78
|
+
fix: "",
|
|
79
|
+
scopeText: scope,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const memoryId = createMemory({
|
|
83
|
+
category,
|
|
84
|
+
content: cleaned,
|
|
85
|
+
scope: scope || "project",
|
|
86
|
+
confidence: 0.85,
|
|
87
|
+
structuredFields,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return { id, written: !!memoryId };
|
|
91
|
+
} catch (e) {
|
|
92
|
+
logWarning(
|
|
93
|
+
"knowledge-capture",
|
|
94
|
+
`failed to persist ${type} entry as memory: ${(e as Error).message}`,
|
|
95
|
+
);
|
|
96
|
+
return { id, written: false };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Compute the next <prefix>### identifier across both the legacy
|
|
102
|
+
* `.gsd/KNOWLEDGE.md` and the `memories.structured_fields.sourceKnowledgeId`
|
|
103
|
+
* surface. Takes the max numeric suffix from either side and increments.
|
|
104
|
+
*
|
|
105
|
+
* Padded to three digits to match the existing `appendKnowledge` convention.
|
|
106
|
+
* Exported for tests; production callers go through `captureKnowledgeEntry`.
|
|
107
|
+
*/
|
|
108
|
+
export function nextKnowledgeId(basePath: string, prefix: "K" | "P" | "L"): string {
|
|
109
|
+
const fromFile = maxIdInFile(basePath, prefix);
|
|
110
|
+
const fromMemories = maxIdInMemories(prefix);
|
|
111
|
+
const next = Math.max(fromFile, fromMemories) + 1;
|
|
112
|
+
return `${prefix}${String(next).padStart(3, "0")}`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function maxIdInFile(basePath: string, prefix: "K" | "P" | "L"): number {
|
|
116
|
+
const content = readKnowledgeMd(basePath);
|
|
117
|
+
if (!content.trim()) return 0;
|
|
118
|
+
const expectedTable =
|
|
119
|
+
prefix === "K" ? "rules" : prefix === "P" ? "patterns" : "lessons";
|
|
120
|
+
|
|
121
|
+
let max = 0;
|
|
122
|
+
for (const row of parseKnowledgeRows(content)) {
|
|
123
|
+
if (row.table !== expectedTable) continue;
|
|
124
|
+
const num = parseInt(row.id.slice(1), 10);
|
|
125
|
+
if (Number.isFinite(num) && num > max) max = num;
|
|
126
|
+
}
|
|
127
|
+
return max;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function maxIdInMemories(prefix: "K" | "P" | "L"): number {
|
|
131
|
+
if (!isDbAvailable()) return 0;
|
|
132
|
+
const adapter = _getAdapter();
|
|
133
|
+
if (!adapter) return 0;
|
|
134
|
+
try {
|
|
135
|
+
const rows = adapter
|
|
136
|
+
.prepare(
|
|
137
|
+
"SELECT structured_fields FROM memories WHERE structured_fields LIKE :pattern",
|
|
138
|
+
)
|
|
139
|
+
.all({ ":pattern": `%"sourceKnowledgeId":"${prefix}%` }) as Array<{
|
|
140
|
+
structured_fields: string | null;
|
|
141
|
+
}>;
|
|
142
|
+
let max = 0;
|
|
143
|
+
for (const row of rows) {
|
|
144
|
+
if (!row.structured_fields) continue;
|
|
145
|
+
let sf: Record<string, unknown>;
|
|
146
|
+
try {
|
|
147
|
+
sf = JSON.parse(row.structured_fields) as Record<string, unknown>;
|
|
148
|
+
} catch {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
const sourceId = sf["sourceKnowledgeId"];
|
|
152
|
+
if (typeof sourceId !== "string" || !sourceId.startsWith(prefix)) continue;
|
|
153
|
+
const num = parseInt(sourceId.slice(1), 10);
|
|
154
|
+
if (Number.isFinite(num) && num > max) max = num;
|
|
155
|
+
}
|
|
156
|
+
return max;
|
|
157
|
+
} catch {
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// GSD-2 — KNOWLEDGE.md parsing helpers shared by the consolidation scanner,
|
|
2
|
+
// the Patterns/Lessons backfill, and the hybrid projection renderer
|
|
3
|
+
// (ADR-013 Stage 2a/2b).
|
|
4
|
+
//
|
|
5
|
+
// The KNOWLEDGE.md format is locked in `files.ts:appendKnowledge`:
|
|
6
|
+
//
|
|
7
|
+
// # Project Knowledge
|
|
8
|
+
//
|
|
9
|
+
// <optional intro prose>
|
|
10
|
+
//
|
|
11
|
+
// ## Rules
|
|
12
|
+
//
|
|
13
|
+
// | # | Scope | Rule | Why | Added |
|
|
14
|
+
// |---|-------|------|-----|-------|
|
|
15
|
+
// | K001 | project | <rule text> | <reason> | <date> |
|
|
16
|
+
//
|
|
17
|
+
// ## Patterns
|
|
18
|
+
//
|
|
19
|
+
// | # | Pattern | Where | Notes |
|
|
20
|
+
// |---|---------|-------|-------|
|
|
21
|
+
// | P001 | <pattern> | <location> | <notes> |
|
|
22
|
+
//
|
|
23
|
+
// ## Lessons Learned
|
|
24
|
+
//
|
|
25
|
+
// | # | What Happened | Root Cause | Fix | Scope |
|
|
26
|
+
// |---|--------------|------------|-----|-------|
|
|
27
|
+
// | L001 | <what> | <cause> | <fix> | <scope> |
|
|
28
|
+
//
|
|
29
|
+
// Row IDs use a strict <prefix><digits> format (K001, P001, L001 …). Parsers
|
|
30
|
+
// skip the column-title and separator rows; only rows whose first cell
|
|
31
|
+
// matches the expected prefix are emitted.
|
|
32
|
+
|
|
33
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
34
|
+
|
|
35
|
+
import { resolveGsdRootFile } from "./paths.js";
|
|
36
|
+
|
|
37
|
+
export type KnowledgeTable = "rules" | "patterns" | "lessons";
|
|
38
|
+
|
|
39
|
+
export interface KnowledgeRow {
|
|
40
|
+
table: KnowledgeTable;
|
|
41
|
+
id: string;
|
|
42
|
+
/** Full table row, trimmed. Useful as a sample for diagnostic surfaces. */
|
|
43
|
+
raw: string;
|
|
44
|
+
/** Pipe-split cell values (excluding the leading/trailing empty cells from `| ... |`). */
|
|
45
|
+
cells: string[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const KNOWLEDGE_SECTIONS: ReadonlyArray<{
|
|
49
|
+
table: KnowledgeTable;
|
|
50
|
+
heading: string;
|
|
51
|
+
idPrefix: string;
|
|
52
|
+
}> = [
|
|
53
|
+
{ table: "rules", heading: "## Rules", idPrefix: "K" },
|
|
54
|
+
{ table: "patterns", heading: "## Patterns", idPrefix: "P" },
|
|
55
|
+
{ table: "lessons", heading: "## Lessons Learned", idPrefix: "L" },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
/** Read `.gsd/KNOWLEDGE.md` content if present. Returns "" when absent or unreadable. */
|
|
59
|
+
export function readKnowledgeMd(basePath: string): string {
|
|
60
|
+
const path = resolveGsdRootFile(basePath, "KNOWLEDGE");
|
|
61
|
+
if (!existsSync(path)) return "";
|
|
62
|
+
try {
|
|
63
|
+
return readFileSync(path, "utf-8");
|
|
64
|
+
} catch {
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Resolve the canonical `.gsd/KNOWLEDGE.md` path. */
|
|
70
|
+
export function knowledgeMdPath(basePath: string): string {
|
|
71
|
+
return resolveGsdRootFile(basePath, "KNOWLEDGE");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Parse KNOWLEDGE.md into row records. Skips intro prose, table headers,
|
|
76
|
+
* separator lines, and rows from unrecognized sections. Each row's first
|
|
77
|
+
* cell must match the section's expected prefix (K/P/L + digits).
|
|
78
|
+
*/
|
|
79
|
+
export function parseKnowledgeRows(content: string): KnowledgeRow[] {
|
|
80
|
+
const rows: KnowledgeRow[] = [];
|
|
81
|
+
if (!content.trim()) return rows;
|
|
82
|
+
|
|
83
|
+
const lines = content.split("\n");
|
|
84
|
+
let activeSection: (typeof KNOWLEDGE_SECTIONS)[number] | undefined;
|
|
85
|
+
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
const trimmed = line.trim();
|
|
88
|
+
if (trimmed.startsWith("## ")) {
|
|
89
|
+
activeSection = KNOWLEDGE_SECTIONS.find((s) => s.heading === trimmed);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (!activeSection) continue;
|
|
93
|
+
if (!trimmed.startsWith("|")) continue;
|
|
94
|
+
|
|
95
|
+
const idMatch = new RegExp(`^\\|\\s*(${activeSection.idPrefix}\\d+)\\s*\\|`).exec(trimmed);
|
|
96
|
+
if (!idMatch) continue;
|
|
97
|
+
|
|
98
|
+
rows.push({
|
|
99
|
+
table: activeSection.table,
|
|
100
|
+
id: idMatch[1] ?? "",
|
|
101
|
+
raw: trimmed,
|
|
102
|
+
cells: splitPipeRow(trimmed),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return rows;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Slice the KNOWLEDGE.md content to just the intro prose plus the `## Rules`
|
|
111
|
+
* section, dropping `## Patterns` and `## Lessons Learned`. Used by
|
|
112
|
+
* `loadKnowledgeBlock` to avoid double-injecting Patterns and Lessons —
|
|
113
|
+
* those reach the LLM via `loadMemoryBlock` after the ADR-013 Stage 2b
|
|
114
|
+
* cutover, so re-emitting them through the KNOWLEDGE.md block is pure
|
|
115
|
+
* token-cost overhead.
|
|
116
|
+
*
|
|
117
|
+
* Returns the full content unchanged when no `## Rules` heading exists
|
|
118
|
+
* (legacy projects or unusual layouts — better to over-inject than drop
|
|
119
|
+
* unfamiliar content silently).
|
|
120
|
+
*/
|
|
121
|
+
export function extractIntroAndRules(content: string): string {
|
|
122
|
+
if (!content.trim()) return "";
|
|
123
|
+
const lines = content.split("\n");
|
|
124
|
+
const rulesIdx = lines.findIndex((l) => l.trim() === "## Rules");
|
|
125
|
+
if (rulesIdx === -1) return content;
|
|
126
|
+
|
|
127
|
+
// End of the Rules section is the next `## ` heading (Patterns or
|
|
128
|
+
// Lessons Learned) or end-of-file. Drop trailing blank lines so the
|
|
129
|
+
// caller can join the slice without producing a triple newline.
|
|
130
|
+
let endIdx = lines.length;
|
|
131
|
+
for (let i = rulesIdx + 1; i < lines.length; i++) {
|
|
132
|
+
if (lines[i]!.startsWith("## ")) {
|
|
133
|
+
endIdx = i;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const slice = lines.slice(0, endIdx);
|
|
138
|
+
while (slice.length > 0 && slice[slice.length - 1]!.trim() === "") {
|
|
139
|
+
slice.pop();
|
|
140
|
+
}
|
|
141
|
+
return slice.join("\n") + "\n";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Split a Markdown table row on un-escaped pipes. Returns the cell values
|
|
146
|
+
* (without the leading/trailing empty fragments from `| ... |`), each
|
|
147
|
+
* trimmed. Escaped pipes (`\|`) inside a cell are preserved as `|` in the
|
|
148
|
+
* output.
|
|
149
|
+
*/
|
|
150
|
+
export function splitPipeRow(row: string): string[] {
|
|
151
|
+
const cells: string[] = [];
|
|
152
|
+
let current = "";
|
|
153
|
+
for (let i = 0; i < row.length; i++) {
|
|
154
|
+
const ch = row[i];
|
|
155
|
+
if (ch === "\\" && row[i + 1] === "|") {
|
|
156
|
+
current += "|";
|
|
157
|
+
i += 1;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (ch === "|") {
|
|
161
|
+
cells.push(current.trim());
|
|
162
|
+
current = "";
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
current += ch;
|
|
166
|
+
}
|
|
167
|
+
if (current.trim().length > 0) {
|
|
168
|
+
cells.push(current.trim());
|
|
169
|
+
}
|
|
170
|
+
// Drop the leading empty fragment from `|<cell>|...|` — the first split
|
|
171
|
+
// produces an empty string before the first pipe.
|
|
172
|
+
if (cells.length > 0 && cells[0] === "") cells.shift();
|
|
173
|
+
return cells;
|
|
174
|
+
}
|