gsd-pi 2.10.12 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundled-extension-paths.d.ts +2 -0
- package/dist/bundled-extension-paths.js +10 -0
- package/dist/loader.js +45 -28
- package/dist/onboarding.js +100 -0
- package/dist/resource-loader.js +12 -3
- package/dist/resources/GSD-WORKFLOW.md +661 -0
- package/dist/resources/agents/researcher.md +29 -0
- package/dist/resources/agents/scout.md +56 -0
- package/dist/resources/agents/worker.md +31 -0
- package/dist/resources/extensions/ask-user-questions.ts +289 -0
- package/dist/resources/extensions/async-jobs/async-bash-tool.ts +211 -0
- package/dist/resources/extensions/async-jobs/await-tool.ts +101 -0
- package/dist/resources/extensions/async-jobs/cancel-job-tool.ts +34 -0
- package/dist/resources/extensions/async-jobs/index.ts +133 -0
- package/dist/resources/extensions/async-jobs/job-manager.ts +211 -0
- package/dist/resources/extensions/bg-shell/index.ts +3179 -0
- package/dist/resources/extensions/browser-tools/BROWSER-TOOLS-V2-PROPOSAL.md +1277 -0
- package/dist/resources/extensions/browser-tools/capture.ts +165 -0
- package/dist/resources/extensions/browser-tools/core.d.ts +205 -0
- package/dist/resources/extensions/browser-tools/core.js +1057 -0
- package/dist/resources/extensions/browser-tools/evaluate-helpers.ts +184 -0
- package/dist/resources/extensions/browser-tools/index.ts +51 -0
- package/dist/resources/extensions/browser-tools/lifecycle.ts +270 -0
- package/dist/resources/extensions/browser-tools/package.json +24 -0
- package/dist/resources/extensions/browser-tools/refs.ts +264 -0
- package/dist/resources/extensions/browser-tools/settle.ts +197 -0
- package/dist/resources/extensions/browser-tools/state.ts +408 -0
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +652 -0
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +614 -0
- package/dist/resources/extensions/browser-tools/tools/assertions.ts +342 -0
- package/dist/resources/extensions/browser-tools/tools/forms.ts +801 -0
- package/dist/resources/extensions/browser-tools/tools/inspection.ts +492 -0
- package/dist/resources/extensions/browser-tools/tools/intent.ts +614 -0
- package/dist/resources/extensions/browser-tools/tools/interaction.ts +865 -0
- package/dist/resources/extensions/browser-tools/tools/navigation.ts +232 -0
- package/dist/resources/extensions/browser-tools/tools/pages.ts +303 -0
- package/dist/resources/extensions/browser-tools/tools/refs.ts +541 -0
- package/dist/resources/extensions/browser-tools/tools/screenshot.ts +83 -0
- package/dist/resources/extensions/browser-tools/tools/session.ts +400 -0
- package/dist/resources/extensions/browser-tools/tools/wait.ts +247 -0
- package/dist/resources/extensions/browser-tools/utils.ts +660 -0
- package/dist/resources/extensions/context7/index.ts +428 -0
- package/dist/resources/extensions/context7/package.json +11 -0
- package/dist/resources/extensions/get-secrets-from-user.ts +625 -0
- package/dist/resources/extensions/google-search/index.ts +336 -0
- package/dist/resources/extensions/google-search/package.json +9 -0
- package/dist/resources/extensions/gsd/activity-log.ts +116 -0
- package/dist/resources/extensions/gsd/auto.ts +3732 -0
- package/dist/resources/extensions/gsd/commands.ts +544 -0
- package/dist/resources/extensions/gsd/crash-recovery.ts +105 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +564 -0
- package/dist/resources/extensions/gsd/dispatch-guard.ts +78 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +278 -0
- package/dist/resources/extensions/gsd/doctor.ts +766 -0
- package/dist/resources/extensions/gsd/exit-command.ts +18 -0
- package/dist/resources/extensions/gsd/files.ts +857 -0
- package/dist/resources/extensions/gsd/git-service.ts +904 -0
- package/dist/resources/extensions/gsd/gitignore.ts +200 -0
- package/dist/resources/extensions/gsd/guided-flow.ts +1054 -0
- package/dist/resources/extensions/gsd/index.ts +735 -0
- package/dist/resources/extensions/gsd/metrics.ts +374 -0
- package/dist/resources/extensions/gsd/migrate/command.ts +218 -0
- package/dist/resources/extensions/gsd/migrate/index.ts +42 -0
- package/dist/resources/extensions/gsd/migrate/parser.ts +323 -0
- package/dist/resources/extensions/gsd/migrate/parsers.ts +624 -0
- package/dist/resources/extensions/gsd/migrate/preview.ts +48 -0
- package/dist/resources/extensions/gsd/migrate/transformer.ts +346 -0
- package/dist/resources/extensions/gsd/migrate/types.ts +370 -0
- package/dist/resources/extensions/gsd/migrate/validator.ts +55 -0
- package/dist/resources/extensions/gsd/migrate/writer.ts +539 -0
- package/dist/resources/extensions/gsd/native-git-bridge.ts +181 -0
- package/dist/resources/extensions/gsd/native-parser-bridge.ts +135 -0
- package/dist/resources/extensions/gsd/observability-validator.ts +408 -0
- package/dist/resources/extensions/gsd/package.json +11 -0
- package/dist/resources/extensions/gsd/paths.ts +339 -0
- package/dist/resources/extensions/gsd/post-unit-hooks.ts +449 -0
- package/dist/resources/extensions/gsd/preferences.ts +988 -0
- package/dist/resources/extensions/gsd/prompt-loader.ts +92 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +25 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +27 -0
- package/dist/resources/extensions/gsd/prompts/discuss.md +237 -0
- package/dist/resources/extensions/gsd/prompts/doctor-heal.md +29 -0
- package/dist/resources/extensions/gsd/prompts/execute-task.md +63 -0
- package/dist/resources/extensions/gsd/prompts/guided-complete-slice.md +3 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-milestone.md +5 -0
- package/dist/resources/extensions/gsd/prompts/guided-discuss-slice.md +61 -0
- package/dist/resources/extensions/gsd/prompts/guided-execute-task.md +3 -0
- package/dist/resources/extensions/gsd/prompts/guided-plan-milestone.md +29 -0
- package/dist/resources/extensions/gsd/prompts/guided-plan-slice.md +3 -0
- package/dist/resources/extensions/gsd/prompts/guided-research-slice.md +13 -0
- package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -0
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +78 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +55 -0
- package/dist/resources/extensions/gsd/prompts/queue.md +100 -0
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +48 -0
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +39 -0
- package/dist/resources/extensions/gsd/prompts/research-milestone.md +37 -0
- package/dist/resources/extensions/gsd/prompts/research-slice.md +28 -0
- package/dist/resources/extensions/gsd/prompts/review-migration.md +66 -0
- package/dist/resources/extensions/gsd/prompts/run-uat.md +109 -0
- package/dist/resources/extensions/gsd/prompts/system.md +190 -0
- package/dist/resources/extensions/gsd/prompts/worktree-merge.md +123 -0
- package/dist/resources/extensions/gsd/roadmap-slices.ts +50 -0
- package/dist/resources/extensions/gsd/session-forensics.ts +500 -0
- package/dist/resources/extensions/gsd/skill-discovery.ts +137 -0
- package/dist/resources/extensions/gsd/state.ts +569 -0
- package/dist/resources/extensions/gsd/templates/context.md +76 -0
- package/dist/resources/extensions/gsd/templates/decisions.md +8 -0
- package/dist/resources/extensions/gsd/templates/milestone-summary.md +73 -0
- package/dist/resources/extensions/gsd/templates/plan.md +131 -0
- package/dist/resources/extensions/gsd/templates/preferences.md +23 -0
- package/dist/resources/extensions/gsd/templates/project.md +31 -0
- package/dist/resources/extensions/gsd/templates/reassessment.md +28 -0
- package/dist/resources/extensions/gsd/templates/requirements.md +81 -0
- package/dist/resources/extensions/gsd/templates/research.md +46 -0
- package/dist/resources/extensions/gsd/templates/roadmap.md +118 -0
- package/dist/resources/extensions/gsd/templates/secrets-manifest.md +22 -0
- package/dist/resources/extensions/gsd/templates/slice-context.md +58 -0
- package/dist/resources/extensions/gsd/templates/slice-summary.md +99 -0
- package/dist/resources/extensions/gsd/templates/state.md +19 -0
- package/dist/resources/extensions/gsd/templates/task-plan.md +52 -0
- package/dist/resources/extensions/gsd/templates/task-summary.md +57 -0
- package/dist/resources/extensions/gsd/templates/uat.md +54 -0
- package/dist/resources/extensions/gsd/tests/activity-log-prune.test.ts +297 -0
- package/dist/resources/extensions/gsd/tests/activity-log-save.test.ts +127 -0
- package/dist/resources/extensions/gsd/tests/auto-draft-pause.test.ts +109 -0
- package/dist/resources/extensions/gsd/tests/auto-preflight.test.ts +45 -0
- package/dist/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +196 -0
- package/dist/resources/extensions/gsd/tests/auto-supervisor.test.mjs +53 -0
- package/dist/resources/extensions/gsd/tests/collect-from-manifest.test.ts +469 -0
- package/dist/resources/extensions/gsd/tests/complete-milestone.test.ts +200 -0
- package/dist/resources/extensions/gsd/tests/cost-projection.test.ts +134 -0
- package/dist/resources/extensions/gsd/tests/derive-state-deps.test.ts +312 -0
- package/dist/resources/extensions/gsd/tests/derive-state-draft.test.ts +299 -0
- package/dist/resources/extensions/gsd/tests/derive-state.test.ts +660 -0
- package/dist/resources/extensions/gsd/tests/discuss-prompt.test.ts +27 -0
- package/dist/resources/extensions/gsd/tests/dispatch-guard.test.ts +91 -0
- package/dist/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +170 -0
- package/dist/resources/extensions/gsd/tests/doctor.test.ts +594 -0
- package/dist/resources/extensions/gsd/tests/draft-promotion.test.ts +169 -0
- package/dist/resources/extensions/gsd/tests/exit-command.test.ts +50 -0
- package/dist/resources/extensions/gsd/tests/git-service.test.ts +1788 -0
- package/dist/resources/extensions/gsd/tests/idle-recovery.test.ts +577 -0
- package/dist/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +580 -0
- package/dist/resources/extensions/gsd/tests/manifest-status.test.ts +283 -0
- package/dist/resources/extensions/gsd/tests/metrics-io.test.ts +176 -0
- package/dist/resources/extensions/gsd/tests/metrics.test.ts +188 -0
- package/dist/resources/extensions/gsd/tests/migrate-command.test.ts +369 -0
- package/dist/resources/extensions/gsd/tests/migrate-parser.test.ts +757 -0
- package/dist/resources/extensions/gsd/tests/migrate-transformer.test.ts +635 -0
- package/dist/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +414 -0
- package/dist/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +297 -0
- package/dist/resources/extensions/gsd/tests/migrate-writer.test.ts +398 -0
- package/dist/resources/extensions/gsd/tests/must-have-parser.test.ts +291 -0
- package/dist/resources/extensions/gsd/tests/network-error-fallback.test.ts +54 -0
- package/dist/resources/extensions/gsd/tests/next-milestone-id.test.ts +66 -0
- package/dist/resources/extensions/gsd/tests/orphaned-branch.test.ts +353 -0
- package/dist/resources/extensions/gsd/tests/parsers.test.ts +1664 -0
- package/dist/resources/extensions/gsd/tests/plan-milestone.test.ts +133 -0
- package/dist/resources/extensions/gsd/tests/plan-quality-validator.test.ts +363 -0
- package/dist/resources/extensions/gsd/tests/post-unit-hooks.test.ts +297 -0
- package/dist/resources/extensions/gsd/tests/preferences-hooks.test.ts +226 -0
- package/dist/resources/extensions/gsd/tests/queue-draft-detection.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/reassess-prompt.test.ts +142 -0
- package/dist/resources/extensions/gsd/tests/regex-hardening.test.ts +281 -0
- package/dist/resources/extensions/gsd/tests/remote-questions.test.ts +155 -0
- package/dist/resources/extensions/gsd/tests/remote-status.test.ts +99 -0
- package/dist/resources/extensions/gsd/tests/replan-slice.test.ts +493 -0
- package/dist/resources/extensions/gsd/tests/requirements.test.ts +106 -0
- package/dist/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +35 -0
- package/dist/resources/extensions/gsd/tests/resolve-ts.mjs +11 -0
- package/dist/resources/extensions/gsd/tests/roadmap-slices.test.ts +41 -0
- package/dist/resources/extensions/gsd/tests/run-uat.test.ts +316 -0
- package/dist/resources/extensions/gsd/tests/secure-env-collect.test.ts +185 -0
- package/dist/resources/extensions/gsd/tests/smart-entry-draft.test.ts +123 -0
- package/dist/resources/extensions/gsd/tests/test-helpers.ts +61 -0
- package/dist/resources/extensions/gsd/tests/unique-milestone-ids.test.ts +219 -0
- package/dist/resources/extensions/gsd/tests/unit-runtime.test.ts +234 -0
- package/dist/resources/extensions/gsd/tests/workspace-index.test.ts +75 -0
- package/dist/resources/extensions/gsd/tests/worktree-integration.test.ts +234 -0
- package/dist/resources/extensions/gsd/tests/worktree-manager.test.ts +141 -0
- package/dist/resources/extensions/gsd/tests/worktree.test.ts +597 -0
- package/dist/resources/extensions/gsd/tests/write-gate.test.ts +122 -0
- package/dist/resources/extensions/gsd/types.ts +296 -0
- package/dist/resources/extensions/gsd/unit-runtime.ts +184 -0
- package/dist/resources/extensions/gsd/workspace-index.ts +189 -0
- package/dist/resources/extensions/gsd/worktree-command.ts +845 -0
- package/dist/resources/extensions/gsd/worktree-manager.ts +459 -0
- package/dist/resources/extensions/gsd/{worktree.js → worktree.ts} +92 -61
- package/dist/resources/extensions/mac-tools/index.ts +852 -0
- package/dist/resources/extensions/mac-tools/swift-cli/Package.swift +22 -0
- package/dist/resources/extensions/mac-tools/swift-cli/Sources/main.swift +1318 -0
- package/dist/resources/extensions/mcporter/index.ts +429 -0
- package/dist/resources/extensions/remote-questions/config.ts +81 -0
- package/dist/resources/extensions/remote-questions/discord-adapter.ts +128 -0
- package/dist/resources/extensions/remote-questions/format.ts +163 -0
- package/dist/resources/extensions/remote-questions/manager.ts +192 -0
- package/dist/resources/extensions/remote-questions/remote-command.ts +361 -0
- package/dist/resources/extensions/remote-questions/slack-adapter.ts +92 -0
- package/dist/resources/extensions/remote-questions/status.ts +31 -0
- package/dist/resources/extensions/remote-questions/store.ts +77 -0
- package/dist/resources/extensions/remote-questions/types.ts +75 -0
- package/dist/resources/extensions/search-the-web/cache.ts +78 -0
- package/dist/resources/extensions/search-the-web/command-search-provider.ts +99 -0
- package/dist/resources/extensions/search-the-web/format.ts +258 -0
- package/dist/resources/extensions/search-the-web/http.ts +238 -0
- package/dist/resources/extensions/search-the-web/index.ts +65 -0
- package/dist/resources/extensions/search-the-web/native-search.ts +165 -0
- package/dist/resources/extensions/search-the-web/provider.ts +136 -0
- package/dist/resources/extensions/search-the-web/tavily.ts +116 -0
- package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +581 -0
- package/dist/resources/extensions/search-the-web/tool-llm-context.ts +620 -0
- package/dist/resources/extensions/search-the-web/tool-search.ts +635 -0
- package/dist/resources/extensions/search-the-web/url-utils.ts +91 -0
- package/dist/resources/extensions/shared/bundled-extension-paths.ts +11 -0
- package/dist/resources/extensions/shared/confirm-ui.ts +126 -0
- package/dist/resources/extensions/shared/interview-ui.ts +613 -0
- package/dist/resources/extensions/shared/next-action-ui.ts +197 -0
- package/dist/resources/extensions/shared/progress-widget.ts +282 -0
- package/dist/resources/extensions/shared/terminal.ts +23 -0
- package/dist/resources/extensions/shared/thinking-widget.ts +107 -0
- package/dist/resources/extensions/shared/ui.ts +400 -0
- package/dist/resources/extensions/shared/wizard-ui.ts +551 -0
- package/dist/resources/extensions/slash-commands/audit.ts +88 -0
- package/dist/resources/extensions/slash-commands/clear.ts +10 -0
- package/dist/resources/extensions/slash-commands/create-extension.ts +297 -0
- package/dist/resources/extensions/slash-commands/create-slash-command.ts +234 -0
- package/dist/resources/extensions/slash-commands/index.ts +12 -0
- package/dist/resources/extensions/subagent/agents.ts +126 -0
- package/dist/resources/extensions/subagent/index.ts +1072 -0
- package/dist/resources/extensions/subagent/isolation.ts +498 -0
- package/dist/resources/extensions/ttsr/index.ts +163 -0
- package/dist/resources/extensions/ttsr/rule-loader.ts +121 -0
- package/dist/resources/extensions/ttsr/ttsr-interrupt.md +6 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.ts +430 -0
- package/dist/resources/extensions/universal-config/discovery.ts +78 -0
- package/dist/resources/extensions/universal-config/format.ts +160 -0
- package/dist/resources/extensions/universal-config/index.ts +118 -0
- package/dist/resources/extensions/universal-config/package.json +11 -0
- package/dist/resources/extensions/universal-config/scanners.ts +579 -0
- package/dist/resources/extensions/universal-config/tests/discovery.test.ts +111 -0
- package/dist/resources/extensions/universal-config/tests/format.test.ts +111 -0
- package/dist/resources/extensions/universal-config/tests/scanners.test.ts +438 -0
- package/dist/resources/extensions/universal-config/tools.ts +60 -0
- package/dist/resources/extensions/universal-config/types.ts +116 -0
- package/dist/resources/extensions/voice/index.ts +271 -0
- package/dist/resources/extensions/voice/speech-recognizer.py +504 -0
- package/dist/resources/extensions/voice/speech-recognizer.swift +154 -0
- package/dist/resources/skills/debug-like-expert/SKILL.md +231 -0
- package/dist/resources/skills/debug-like-expert/references/debugging-mindset.md +253 -0
- package/dist/resources/skills/debug-like-expert/references/hypothesis-testing.md +373 -0
- package/dist/resources/skills/debug-like-expert/references/investigation-techniques.md +337 -0
- package/dist/resources/skills/debug-like-expert/references/verification-patterns.md +425 -0
- package/dist/resources/skills/debug-like-expert/references/when-to-research.md +361 -0
- package/dist/resources/skills/frontend-design/SKILL.md +45 -0
- package/dist/resources/skills/github-workflows/SKILL.md +92 -0
- package/dist/resources/skills/github-workflows/references/gh/SKILL.md +255 -0
- package/dist/resources/skills/github-workflows/references/gh/references/issue-stories.md +204 -0
- package/dist/resources/skills/github-workflows/references/gh/references/labels.md +170 -0
- package/dist/resources/skills/github-workflows/references/gh/references/milestones.md +158 -0
- package/dist/resources/skills/github-workflows/references/gh/references/projects-v2.md +177 -0
- package/dist/resources/skills/github-workflows/references/gh/scripts/experiment_cleanup.py +191 -0
- package/dist/resources/skills/github-workflows/references/gh/scripts/github_project_setup.py +799 -0
- package/dist/resources/skills/github-workflows/references/gh/tests/__init__.py +0 -0
- package/dist/resources/skills/github-workflows/references/gh/tests/test_github_project_setup.py +608 -0
- package/dist/resources/skills/swiftui/SKILL.md +208 -0
- package/dist/resources/skills/swiftui/references/animations.md +921 -0
- package/dist/resources/skills/swiftui/references/architecture.md +1561 -0
- package/dist/resources/skills/swiftui/references/layout-system.md +1186 -0
- package/dist/resources/skills/swiftui/references/navigation.md +1492 -0
- package/dist/resources/skills/swiftui/references/networking-async.md +214 -0
- package/dist/resources/skills/swiftui/references/performance.md +1706 -0
- package/dist/resources/skills/swiftui/references/platform-integration.md +204 -0
- package/dist/resources/skills/swiftui/references/state-management.md +1443 -0
- package/dist/resources/skills/swiftui/references/swiftdata.md +297 -0
- package/dist/resources/skills/swiftui/references/testing-debugging.md +247 -0
- package/dist/resources/skills/swiftui/references/uikit-appkit-interop.md +218 -0
- package/dist/resources/skills/swiftui/workflows/add-feature.md +191 -0
- package/dist/resources/skills/swiftui/workflows/build-new-app.md +311 -0
- package/dist/resources/skills/swiftui/workflows/debug-swiftui.md +192 -0
- package/dist/resources/skills/swiftui/workflows/optimize-performance.md +197 -0
- package/dist/resources/skills/swiftui/workflows/ship-app.md +203 -0
- package/dist/resources/skills/swiftui/workflows/write-tests.md +235 -0
- package/dist/wizard.js +1 -0
- package/package.json +8 -6
- package/packages/native/dist/fd/index.d.ts +1 -0
- package/packages/native/dist/fd/index.js +1 -0
- package/packages/native/dist/grep/index.d.ts +2 -1
- package/packages/native/dist/grep/index.js +1 -0
- package/packages/native/src/__tests__/fd.test.mjs +35 -0
- package/packages/native/src/__tests__/grep.test.mjs +26 -9
- package/packages/native/src/fd/index.ts +1 -0
- package/packages/native/src/grep/index.ts +3 -2
- package/packages/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +169 -55
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +13 -1
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +16 -0
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/types.d.ts +91 -1
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/src/agent-loop.ts +273 -63
- package/packages/pi-agent-core/src/agent.ts +24 -0
- package/packages/pi-agent-core/src/types.ts +98 -0
- package/packages/pi-ai/dist/env-api-keys.js +2 -0
- package/packages/pi-ai/dist/env-api-keys.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +314 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +236 -0
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-gemini-cli.js +6 -0
- package/packages/pi-ai/dist/providers/google-gemini-cli.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +2 -0
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +1 -1
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/src/env-api-keys.ts +2 -0
- package/packages/pi-ai/src/models.generated.ts +236 -0
- package/packages/pi-ai/src/providers/google-gemini-cli.ts +8 -0
- package/packages/pi-ai/src/providers/openai-completions.ts +3 -0
- package/packages/pi-ai/src/types.ts +2 -1
- package/packages/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/cli/args.js +1 -0
- package/packages/pi-coding-agent/dist/cli/args.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +26 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +137 -22
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +20 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +43 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/fallback-resolver.d.ts +51 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.js +119 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.test.js +183 -0
- package/packages/pi-coding-agent/dist/core/fallback-resolver.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/index.js +1 -0
- package/packages/pi-coding-agent/dist/core/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +1 -0
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts +12 -1
- package/packages/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +37 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/session-manager.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/session-manager.test.js +61 -0
- package/packages/pi-coding-agent/dist/core/session-manager.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +20 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +47 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/find.js +1 -0
- package/packages/pi-coding-agent/dist/core/tools/find.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 +6 -15
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +18 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +46 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/login-dialog.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 +25 -2
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/src/cli/args.ts +1 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +167 -22
- package/packages/pi-coding-agent/src/core/auth-storage.ts +45 -0
- package/packages/pi-coding-agent/src/core/fallback-resolver.test.ts +229 -0
- package/packages/pi-coding-agent/src/core/fallback-resolver.ts +165 -0
- package/packages/pi-coding-agent/src/core/index.ts +1 -0
- package/packages/pi-coding-agent/src/core/model-resolver.ts +1 -0
- package/packages/pi-coding-agent/src/core/session-manager.test.ts +65 -0
- package/packages/pi-coding-agent/src/core/session-manager.ts +51 -1
- package/packages/pi-coding-agent/src/core/settings-manager.ts +66 -0
- package/packages/pi-coding-agent/src/core/tools/find.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +6 -16
- package/packages/pi-coding-agent/src/modes/interactive/components/login-dialog.ts +49 -4
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +28 -2
- package/packages/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/packages/pi-tui/dist/autocomplete.js +3 -4
- package/packages/pi-tui/dist/autocomplete.js.map +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +7 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +57 -50
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/src/autocomplete.ts +3 -5
- package/packages/pi-tui/src/components/editor.ts +70 -49
- package/pkg/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/pkg/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/pkg/dist/core/export-html/ansi-to-html.js +249 -0
- package/pkg/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/pkg/dist/core/export-html/index.d.ts +37 -0
- package/pkg/dist/core/export-html/index.d.ts.map +1 -0
- package/pkg/dist/core/export-html/index.js +223 -0
- package/pkg/dist/core/export-html/index.js.map +1 -0
- package/pkg/dist/core/export-html/template.css +971 -0
- package/pkg/dist/core/export-html/template.html +54 -0
- package/pkg/dist/core/export-html/template.js +1583 -0
- package/pkg/dist/core/export-html/tool-renderer.d.ts +38 -0
- package/pkg/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/pkg/dist/core/export-html/tool-renderer.js +70 -0
- package/pkg/dist/core/export-html/tool-renderer.js.map +1 -0
- package/pkg/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/pkg/dist/core/export-html/vendor/marked.min.js +6 -0
- package/scripts/postinstall.js +30 -17
- package/src/resources/extensions/bg-shell/index.ts +51 -7
- package/src/resources/extensions/gsd/activity-log.ts +61 -14
- package/src/resources/extensions/gsd/auto.ts +288 -19
- package/src/resources/extensions/gsd/commands.ts +9 -3
- package/src/resources/extensions/gsd/dashboard-overlay.ts +55 -12
- package/src/resources/extensions/gsd/docs/preferences-reference.md +25 -0
- package/src/resources/extensions/gsd/doctor.ts +60 -3
- package/src/resources/extensions/gsd/files.ts +45 -1
- package/src/resources/extensions/gsd/git-service.ts +46 -41
- package/src/resources/extensions/gsd/guided-flow.ts +81 -9
- package/src/resources/extensions/gsd/index.ts +62 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +181 -0
- package/src/resources/extensions/gsd/paths.ts +35 -4
- package/src/resources/extensions/gsd/post-unit-hooks.ts +449 -0
- package/src/resources/extensions/gsd/preferences.ts +232 -1
- package/src/resources/extensions/gsd/prompt-loader.ts +45 -3
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -3
- package/src/resources/extensions/gsd/prompts/discuss.md +10 -8
- package/src/resources/extensions/gsd/prompts/execute-task.md +4 -2
- package/src/resources/extensions/gsd/prompts/guided-complete-slice.md +3 -1
- package/src/resources/extensions/gsd/prompts/guided-discuss-milestone.md +3 -1
- package/src/resources/extensions/gsd/prompts/guided-discuss-slice.md +3 -1
- package/src/resources/extensions/gsd/prompts/guided-execute-task.md +3 -1
- package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +4 -2
- package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +3 -1
- package/src/resources/extensions/gsd/prompts/guided-research-slice.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +9 -12
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -3
- package/src/resources/extensions/gsd/prompts/queue.md +3 -1
- package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/state.ts +130 -18
- package/src/resources/extensions/gsd/templates/context.md +1 -1
- package/src/resources/extensions/gsd/templates/state.md +3 -3
- package/src/resources/extensions/gsd/tests/activity-log-save.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/doctor.test.ts +115 -1
- package/src/resources/extensions/gsd/tests/draft-promotion.test.ts +6 -2
- package/src/resources/extensions/gsd/tests/git-service.test.ts +35 -35
- package/src/resources/extensions/gsd/tests/idle-recovery.test.ts +8 -8
- package/src/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/network-error-fallback.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/orphaned-branch.test.ts +5 -5
- package/src/resources/extensions/gsd/tests/post-unit-hooks.test.ts +297 -0
- package/src/resources/extensions/gsd/tests/preferences-hooks.test.ts +226 -0
- package/src/resources/extensions/gsd/tests/regex-hardening.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/unit-runtime.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/worktree-integration.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/worktree.test.ts +19 -19
- package/src/resources/extensions/gsd/types.ts +109 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +72 -13
- package/src/resources/extensions/gsd/worktree.ts +5 -4
- package/src/resources/extensions/search-the-web/command-search-provider.ts +8 -4
- package/src/resources/extensions/search-the-web/native-search.ts +32 -23
- package/src/resources/extensions/search-the-web/provider.ts +19 -2
- package/src/resources/extensions/search-the-web/tool-fetch-page.ts +62 -0
- package/src/resources/extensions/search-the-web/tool-llm-context.ts +62 -3
- package/src/resources/extensions/search-the-web/tool-search.ts +62 -3
- package/src/resources/extensions/shared/bundled-extension-paths.ts +11 -0
- package/src/resources/extensions/subagent/index.ts +2 -1
- package/src/resources/skills/github-workflows/SKILL.md +5 -0
- package/dist/resources/extensions/gsd/git-service.d.ts +0 -225
- package/dist/resources/extensions/gsd/git-service.js +0 -756
- package/dist/resources/extensions/gsd/preferences.d.ts +0 -122
- package/dist/resources/extensions/gsd/preferences.js +0 -616
- package/dist/resources/extensions/gsd/worktree.d.ts +0 -106
- package/dist/resources/extensions/remote-questions/config.d.ts +0 -14
- package/dist/resources/extensions/remote-questions/config.js +0 -68
- package/dist/resources/extensions/remote-questions/discord-adapter.d.ts +0 -17
- package/dist/resources/extensions/remote-questions/discord-adapter.js +0 -118
- package/dist/resources/extensions/remote-questions/format.d.ts +0 -38
- package/dist/resources/extensions/remote-questions/format.js +0 -119
- package/dist/resources/extensions/remote-questions/manager.d.ts +0 -23
- package/dist/resources/extensions/remote-questions/manager.js +0 -161
- package/dist/resources/extensions/remote-questions/remote-command.d.ts +0 -6
- package/dist/resources/extensions/remote-questions/remote-command.js +0 -358
- package/dist/resources/extensions/remote-questions/slack-adapter.d.ts +0 -15
- package/dist/resources/extensions/remote-questions/slack-adapter.js +0 -82
- package/dist/resources/extensions/remote-questions/status.d.ts +0 -9
- package/dist/resources/extensions/remote-questions/status.js +0 -25
- package/dist/resources/extensions/remote-questions/store.d.ts +0 -11
- package/dist/resources/extensions/remote-questions/store.js +0 -66
- package/dist/resources/extensions/remote-questions/types.d.ts +0 -68
- package/dist/resources/extensions/remote-questions/types.js +0 -4
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GSD Dashboard Overlay
|
|
3
|
+
*
|
|
4
|
+
* Full-screen overlay showing auto-mode progress: milestone/slice/task
|
|
5
|
+
* breakdown, current unit, completed units, timing, and activity log.
|
|
6
|
+
* Toggled with Ctrl+Alt+G (⌃⌥G on macOS) or opened from /gsd status.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { Theme } from "@gsd/pi-coding-agent";
|
|
10
|
+
import { truncateToWidth, visibleWidth, matchesKey, Key } from "@gsd/pi-tui";
|
|
11
|
+
import { deriveState } from "./state.js";
|
|
12
|
+
import { loadFile, parseRoadmap, parsePlan } from "./files.js";
|
|
13
|
+
import { resolveMilestoneFile, resolveSliceFile } from "./paths.js";
|
|
14
|
+
import { getAutoDashboardData, type AutoDashboardData } from "./auto.js";
|
|
15
|
+
import {
|
|
16
|
+
getLedger, getProjectTotals, aggregateByPhase, aggregateBySlice,
|
|
17
|
+
aggregateByModel, formatCost, formatTokenCount, formatCostProjection,
|
|
18
|
+
} from "./metrics.js";
|
|
19
|
+
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
20
|
+
import { getActiveWorktreeName } from "./worktree-command.js";
|
|
21
|
+
|
|
22
|
+
function formatDuration(ms: number): string {
|
|
23
|
+
const s = Math.floor(ms / 1000);
|
|
24
|
+
if (s < 60) return `${s}s`;
|
|
25
|
+
const m = Math.floor(s / 60);
|
|
26
|
+
const rs = s % 60;
|
|
27
|
+
if (m < 60) return `${m}m ${rs}s`;
|
|
28
|
+
const h = Math.floor(m / 60);
|
|
29
|
+
const rm = m % 60;
|
|
30
|
+
return `${h}h ${rm}m`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function unitLabel(type: string): string {
|
|
34
|
+
switch (type) {
|
|
35
|
+
case "research-milestone": return "Research";
|
|
36
|
+
case "plan-milestone": return "Plan";
|
|
37
|
+
case "research-slice": return "Research";
|
|
38
|
+
case "plan-slice": return "Plan";
|
|
39
|
+
case "execute-task": return "Execute";
|
|
40
|
+
case "complete-slice": return "Complete";
|
|
41
|
+
case "reassess-roadmap": return "Reassess";
|
|
42
|
+
default: return type;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function centerLine(content: string, width: number): string {
|
|
47
|
+
const vis = visibleWidth(content);
|
|
48
|
+
if (vis >= width) return truncateToWidth(content, width);
|
|
49
|
+
const leftPad = Math.floor((width - vis) / 2);
|
|
50
|
+
return " ".repeat(leftPad) + content;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function padRight(content: string, width: number): string {
|
|
54
|
+
const vis = visibleWidth(content);
|
|
55
|
+
return content + " ".repeat(Math.max(0, width - vis));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function joinColumns(left: string, right: string, width: number): string {
|
|
59
|
+
const leftW = visibleWidth(left);
|
|
60
|
+
const rightW = visibleWidth(right);
|
|
61
|
+
if (leftW + rightW + 2 > width) {
|
|
62
|
+
return truncateToWidth(`${left} ${right}`, width);
|
|
63
|
+
}
|
|
64
|
+
return left + " ".repeat(width - leftW - rightW) + right;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function fitColumns(parts: string[], width: number, separator = " "): string {
|
|
68
|
+
const filtered = parts.filter(Boolean);
|
|
69
|
+
if (filtered.length === 0) return "";
|
|
70
|
+
let result = filtered[0];
|
|
71
|
+
for (let i = 1; i < filtered.length; i++) {
|
|
72
|
+
const candidate = `${result}${separator}${filtered[i]}`;
|
|
73
|
+
if (visibleWidth(candidate) > width) break;
|
|
74
|
+
result = candidate;
|
|
75
|
+
}
|
|
76
|
+
return truncateToWidth(result, width);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export class GSDDashboardOverlay {
|
|
80
|
+
private tui: { requestRender: () => void };
|
|
81
|
+
private theme: Theme;
|
|
82
|
+
private onClose: () => void;
|
|
83
|
+
private cachedWidth?: number;
|
|
84
|
+
private cachedLines?: string[];
|
|
85
|
+
private refreshTimer: ReturnType<typeof setInterval>;
|
|
86
|
+
private scrollOffset = 0;
|
|
87
|
+
private dashData: AutoDashboardData;
|
|
88
|
+
private milestoneData: MilestoneView | null = null;
|
|
89
|
+
private loading = true;
|
|
90
|
+
private loadedDashboardIdentity?: string;
|
|
91
|
+
private refreshInFlight: Promise<void> | null = null;
|
|
92
|
+
|
|
93
|
+
constructor(
|
|
94
|
+
tui: { requestRender: () => void },
|
|
95
|
+
theme: Theme,
|
|
96
|
+
onClose: () => void,
|
|
97
|
+
) {
|
|
98
|
+
this.tui = tui;
|
|
99
|
+
this.theme = theme;
|
|
100
|
+
this.onClose = onClose;
|
|
101
|
+
this.dashData = getAutoDashboardData();
|
|
102
|
+
|
|
103
|
+
this.scheduleRefresh(true);
|
|
104
|
+
|
|
105
|
+
this.refreshTimer = setInterval(() => {
|
|
106
|
+
this.scheduleRefresh();
|
|
107
|
+
}, 2000);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private scheduleRefresh(initial = false): void {
|
|
111
|
+
if (this.refreshInFlight) return;
|
|
112
|
+
this.refreshInFlight = this.refreshDashboard(initial)
|
|
113
|
+
.finally(() => {
|
|
114
|
+
this.refreshInFlight = null;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private computeDashboardIdentity(dashData: AutoDashboardData): string {
|
|
119
|
+
const base = dashData.basePath || process.cwd();
|
|
120
|
+
const currentUnit = dashData.currentUnit
|
|
121
|
+
? `${dashData.currentUnit.type}:${dashData.currentUnit.id}:${dashData.currentUnit.startedAt}`
|
|
122
|
+
: "-";
|
|
123
|
+
const lastCompleted = dashData.completedUnits.length > 0
|
|
124
|
+
? dashData.completedUnits[dashData.completedUnits.length - 1]
|
|
125
|
+
: null;
|
|
126
|
+
const completedKey = lastCompleted
|
|
127
|
+
? `${dashData.completedUnits.length}:${lastCompleted.type}:${lastCompleted.id}:${lastCompleted.finishedAt}`
|
|
128
|
+
: "0";
|
|
129
|
+
return [
|
|
130
|
+
base,
|
|
131
|
+
dashData.active ? "1" : "0",
|
|
132
|
+
dashData.paused ? "1" : "0",
|
|
133
|
+
currentUnit,
|
|
134
|
+
completedKey,
|
|
135
|
+
].join("|");
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private async refreshDashboard(initial = false): Promise<void> {
|
|
139
|
+
this.dashData = getAutoDashboardData();
|
|
140
|
+
const nextIdentity = this.computeDashboardIdentity(this.dashData);
|
|
141
|
+
|
|
142
|
+
if (initial || nextIdentity !== this.loadedDashboardIdentity) {
|
|
143
|
+
const loaded = await this.loadData();
|
|
144
|
+
if (loaded) {
|
|
145
|
+
this.loadedDashboardIdentity = nextIdentity;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (initial) {
|
|
150
|
+
this.loading = false;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.invalidate();
|
|
154
|
+
this.tui.requestRender();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
private async loadData(): Promise<boolean> {
|
|
158
|
+
const base = this.dashData.basePath || process.cwd();
|
|
159
|
+
try {
|
|
160
|
+
const state = await deriveState(base);
|
|
161
|
+
if (!state.activeMilestone) {
|
|
162
|
+
this.milestoneData = null;
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const mid = state.activeMilestone.id;
|
|
167
|
+
const view: MilestoneView = {
|
|
168
|
+
id: mid,
|
|
169
|
+
title: state.activeMilestone.title,
|
|
170
|
+
slices: [],
|
|
171
|
+
phase: state.phase,
|
|
172
|
+
progress: {
|
|
173
|
+
milestones: {
|
|
174
|
+
total: state.progress?.milestones.total ?? state.registry.length,
|
|
175
|
+
done: state.progress?.milestones.done ?? state.registry.filter(entry => entry.status === "complete").length,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const roadmapFile = resolveMilestoneFile(base, mid, "ROADMAP");
|
|
181
|
+
const roadmapContent = roadmapFile ? await loadFile(roadmapFile) : null;
|
|
182
|
+
if (roadmapContent) {
|
|
183
|
+
const roadmap = parseRoadmap(roadmapContent);
|
|
184
|
+
for (const s of roadmap.slices) {
|
|
185
|
+
const sliceView: SliceView = {
|
|
186
|
+
id: s.id,
|
|
187
|
+
title: s.title,
|
|
188
|
+
done: s.done,
|
|
189
|
+
risk: s.risk,
|
|
190
|
+
active: state.activeSlice?.id === s.id,
|
|
191
|
+
tasks: [],
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
if (sliceView.active) {
|
|
195
|
+
const planFile = resolveSliceFile(base, mid, s.id, "PLAN");
|
|
196
|
+
const planContent = planFile ? await loadFile(planFile) : null;
|
|
197
|
+
if (planContent) {
|
|
198
|
+
const plan = parsePlan(planContent);
|
|
199
|
+
sliceView.taskProgress = {
|
|
200
|
+
done: plan.tasks.filter(t => t.done).length,
|
|
201
|
+
total: plan.tasks.length,
|
|
202
|
+
};
|
|
203
|
+
for (const t of plan.tasks) {
|
|
204
|
+
sliceView.tasks.push({
|
|
205
|
+
id: t.id,
|
|
206
|
+
title: t.title,
|
|
207
|
+
done: t.done,
|
|
208
|
+
active: state.activeTask?.id === t.id,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
view.slices.push(sliceView);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
this.milestoneData = view;
|
|
219
|
+
return true;
|
|
220
|
+
} catch {
|
|
221
|
+
// Don't crash the overlay
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
handleInput(data: string): void {
|
|
227
|
+
if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c")) || matchesKey(data, Key.ctrlAlt("g"))) {
|
|
228
|
+
clearInterval(this.refreshTimer);
|
|
229
|
+
this.onClose();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (matchesKey(data, Key.down) || matchesKey(data, "j")) {
|
|
234
|
+
this.scrollOffset++;
|
|
235
|
+
this.invalidate();
|
|
236
|
+
this.tui.requestRender();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (matchesKey(data, Key.up) || matchesKey(data, "k")) {
|
|
241
|
+
this.scrollOffset = Math.max(0, this.scrollOffset - 1);
|
|
242
|
+
this.invalidate();
|
|
243
|
+
this.tui.requestRender();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (data === "g") {
|
|
248
|
+
this.scrollOffset = 0;
|
|
249
|
+
this.invalidate();
|
|
250
|
+
this.tui.requestRender();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (data === "G") {
|
|
255
|
+
this.scrollOffset = 999;
|
|
256
|
+
this.invalidate();
|
|
257
|
+
this.tui.requestRender();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
render(width: number): string[] {
|
|
263
|
+
if (this.cachedLines && this.cachedWidth === width) {
|
|
264
|
+
return this.cachedLines;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const content = this.buildContentLines(width);
|
|
268
|
+
const viewportHeight = Math.max(5, process.stdout.rows ? process.stdout.rows - 8 : 24);
|
|
269
|
+
const chromeHeight = 2;
|
|
270
|
+
const visibleContentRows = Math.max(1, viewportHeight - chromeHeight);
|
|
271
|
+
const maxScroll = Math.max(0, content.length - visibleContentRows);
|
|
272
|
+
this.scrollOffset = Math.min(this.scrollOffset, maxScroll);
|
|
273
|
+
const visibleContent = content.slice(this.scrollOffset, this.scrollOffset + visibleContentRows);
|
|
274
|
+
|
|
275
|
+
const lines = this.wrapInBox(visibleContent, width);
|
|
276
|
+
|
|
277
|
+
this.cachedWidth = width;
|
|
278
|
+
this.cachedLines = lines;
|
|
279
|
+
return lines;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
private wrapInBox(inner: string[], width: number): string[] {
|
|
283
|
+
const th = this.theme;
|
|
284
|
+
const border = (s: string) => th.fg("borderAccent", s);
|
|
285
|
+
const innerWidth = width - 4;
|
|
286
|
+
const lines: string[] = [];
|
|
287
|
+
|
|
288
|
+
lines.push(border("╭" + "─".repeat(width - 2) + "╮"));
|
|
289
|
+
for (const line of inner) {
|
|
290
|
+
const truncated = truncateToWidth(line, innerWidth);
|
|
291
|
+
const padWidth = Math.max(0, innerWidth - visibleWidth(truncated));
|
|
292
|
+
lines.push(border("│") + " " + truncated + " ".repeat(padWidth) + " " + border("│"));
|
|
293
|
+
}
|
|
294
|
+
lines.push(border("╰" + "─".repeat(width - 2) + "╯"));
|
|
295
|
+
return lines;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
private buildContentLines(width: number): string[] {
|
|
299
|
+
const th = this.theme;
|
|
300
|
+
const shellWidth = width - 4;
|
|
301
|
+
const contentWidth = Math.min(shellWidth, 128);
|
|
302
|
+
const sidePad = Math.max(0, Math.floor((shellWidth - contentWidth) / 2));
|
|
303
|
+
const leftMargin = " ".repeat(sidePad);
|
|
304
|
+
const lines: string[] = [];
|
|
305
|
+
|
|
306
|
+
const row = (content = ""): string => {
|
|
307
|
+
const truncated = truncateToWidth(content, contentWidth);
|
|
308
|
+
return leftMargin + padRight(truncated, contentWidth);
|
|
309
|
+
};
|
|
310
|
+
const blank = () => row("");
|
|
311
|
+
const hr = () => row(th.fg("dim", "─".repeat(contentWidth)));
|
|
312
|
+
const centered = (content: string) => row(centerLine(content, contentWidth));
|
|
313
|
+
|
|
314
|
+
const title = th.fg("accent", th.bold("GSD Dashboard"));
|
|
315
|
+
const status = this.dashData.active
|
|
316
|
+
? `${Date.now() % 2000 < 1000 ? th.fg("success", "●") : th.fg("dim", "○")} ${th.fg("success", "AUTO")}`
|
|
317
|
+
: this.dashData.paused
|
|
318
|
+
? th.fg("warning", "⏸ PAUSED")
|
|
319
|
+
: th.fg("dim", "idle");
|
|
320
|
+
const worktreeName = getActiveWorktreeName();
|
|
321
|
+
const worktreeTag = worktreeName
|
|
322
|
+
? ` ${th.fg("warning", `⎇ ${worktreeName}`)}`
|
|
323
|
+
: "";
|
|
324
|
+
const elapsed = th.fg("dim", formatDuration(this.dashData.elapsed));
|
|
325
|
+
lines.push(row(joinColumns(`${title} ${status}${worktreeTag}`, elapsed, contentWidth)));
|
|
326
|
+
lines.push(blank());
|
|
327
|
+
|
|
328
|
+
if (this.dashData.currentUnit) {
|
|
329
|
+
const cu = this.dashData.currentUnit;
|
|
330
|
+
const currentElapsed = th.fg("dim", formatDuration(Date.now() - cu.startedAt));
|
|
331
|
+
lines.push(row(joinColumns(
|
|
332
|
+
`${th.fg("text", "Now")}: ${th.fg("accent", unitLabel(cu.type))} ${th.fg("text", cu.id)}`,
|
|
333
|
+
currentElapsed,
|
|
334
|
+
contentWidth,
|
|
335
|
+
)));
|
|
336
|
+
lines.push(blank());
|
|
337
|
+
} else if (this.dashData.paused) {
|
|
338
|
+
lines.push(row(th.fg("dim", "/gsd auto to resume")));
|
|
339
|
+
lines.push(blank());
|
|
340
|
+
} else {
|
|
341
|
+
lines.push(row(th.fg("dim", "No unit running · /gsd auto to start")));
|
|
342
|
+
lines.push(blank());
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (this.loading) {
|
|
346
|
+
lines.push(centered(th.fg("dim", "Loading dashboard…")));
|
|
347
|
+
return lines;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (this.milestoneData) {
|
|
351
|
+
const mv = this.milestoneData;
|
|
352
|
+
lines.push(row(th.fg("text", th.bold(`${mv.id}: ${mv.title}`))));
|
|
353
|
+
lines.push(blank());
|
|
354
|
+
|
|
355
|
+
const totalSlices = mv.slices.length;
|
|
356
|
+
const doneSlices = mv.slices.filter(s => s.done).length;
|
|
357
|
+
const totalMilestones = mv.progress.milestones.total;
|
|
358
|
+
const doneMilestones = mv.progress.milestones.done;
|
|
359
|
+
const activeSlice = mv.slices.find(s => s.active);
|
|
360
|
+
|
|
361
|
+
lines.push(blank());
|
|
362
|
+
|
|
363
|
+
if (activeSlice?.taskProgress) {
|
|
364
|
+
lines.push(row(this.renderProgressRow("Tasks", activeSlice.taskProgress.done, activeSlice.taskProgress.total, "accent", contentWidth)));
|
|
365
|
+
}
|
|
366
|
+
lines.push(row(this.renderProgressRow("Slices", doneSlices, totalSlices, "success", contentWidth)));
|
|
367
|
+
lines.push(row(this.renderProgressRow("Milestones", doneMilestones, totalMilestones, "warning", contentWidth)));
|
|
368
|
+
|
|
369
|
+
lines.push(blank());
|
|
370
|
+
|
|
371
|
+
for (const s of mv.slices) {
|
|
372
|
+
const icon = s.done ? th.fg("success", "✓")
|
|
373
|
+
: s.active ? th.fg("accent", "▸")
|
|
374
|
+
: th.fg("dim", "○");
|
|
375
|
+
const titleText = s.active ? th.fg("accent", `${s.id}: ${s.title}`)
|
|
376
|
+
: s.done ? th.fg("muted", `${s.id}: ${s.title}`)
|
|
377
|
+
: th.fg("dim", `${s.id}: ${s.title}`);
|
|
378
|
+
const risk = th.fg("dim", s.risk);
|
|
379
|
+
lines.push(row(joinColumns(` ${icon} ${titleText}`, risk, contentWidth)));
|
|
380
|
+
|
|
381
|
+
if (s.active && s.tasks.length > 0) {
|
|
382
|
+
for (const t of s.tasks) {
|
|
383
|
+
const tIcon = t.done ? th.fg("success", "✓")
|
|
384
|
+
: t.active ? th.fg("warning", "▸")
|
|
385
|
+
: th.fg("dim", "·");
|
|
386
|
+
const tTitle = t.active ? th.fg("warning", `${t.id}: ${t.title}`)
|
|
387
|
+
: t.done ? th.fg("muted", `${t.id}: ${t.title}`)
|
|
388
|
+
: th.fg("dim", `${t.id}: ${t.title}`);
|
|
389
|
+
lines.push(row(` ${tIcon} ${truncateToWidth(tTitle, contentWidth - 6)}`));
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
} else {
|
|
394
|
+
lines.push(centered(th.fg("dim", "No active milestone.")));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (this.dashData.completedUnits.length > 0) {
|
|
398
|
+
lines.push(blank());
|
|
399
|
+
lines.push(hr());
|
|
400
|
+
lines.push(row(th.fg("text", th.bold("Completed"))));
|
|
401
|
+
lines.push(blank());
|
|
402
|
+
|
|
403
|
+
const recent = [...this.dashData.completedUnits].reverse().slice(0, 10);
|
|
404
|
+
for (const u of recent) {
|
|
405
|
+
const left = ` ${th.fg("success", "✓")} ${th.fg("muted", unitLabel(u.type))} ${th.fg("muted", u.id)}`;
|
|
406
|
+
const right = th.fg("dim", formatDuration(u.finishedAt - u.startedAt));
|
|
407
|
+
lines.push(row(joinColumns(left, right, contentWidth)));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
if (this.dashData.completedUnits.length > 10) {
|
|
411
|
+
lines.push(row(th.fg("dim", ` ...and ${this.dashData.completedUnits.length - 10} more`)));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
const ledger = getLedger();
|
|
416
|
+
if (ledger && ledger.units.length > 0) {
|
|
417
|
+
const totals = getProjectTotals(ledger.units);
|
|
418
|
+
|
|
419
|
+
lines.push(blank());
|
|
420
|
+
lines.push(hr());
|
|
421
|
+
lines.push(row(th.fg("text", th.bold("Cost & Usage"))));
|
|
422
|
+
lines.push(blank());
|
|
423
|
+
|
|
424
|
+
lines.push(row(fitColumns([
|
|
425
|
+
`${th.fg("warning", formatCost(totals.cost))} total`,
|
|
426
|
+
`${th.fg("text", formatTokenCount(totals.tokens.total))} tokens`,
|
|
427
|
+
`${th.fg("text", String(totals.toolCalls))} tools`,
|
|
428
|
+
`${th.fg("text", String(totals.units))} units`,
|
|
429
|
+
], contentWidth, ` ${th.fg("dim", "·")} `)));
|
|
430
|
+
|
|
431
|
+
lines.push(row(fitColumns([
|
|
432
|
+
`${th.fg("dim", "in:")} ${th.fg("text", formatTokenCount(totals.tokens.input))}`,
|
|
433
|
+
`${th.fg("dim", "out:")} ${th.fg("text", formatTokenCount(totals.tokens.output))}`,
|
|
434
|
+
`${th.fg("dim", "cache-r:")} ${th.fg("text", formatTokenCount(totals.tokens.cacheRead))}`,
|
|
435
|
+
`${th.fg("dim", "cache-w:")} ${th.fg("text", formatTokenCount(totals.tokens.cacheWrite))}`,
|
|
436
|
+
], contentWidth, " ")));
|
|
437
|
+
|
|
438
|
+
const phases = aggregateByPhase(ledger.units);
|
|
439
|
+
if (phases.length > 0) {
|
|
440
|
+
lines.push(blank());
|
|
441
|
+
lines.push(row(th.fg("dim", "By Phase")));
|
|
442
|
+
for (const p of phases) {
|
|
443
|
+
const pct = totals.cost > 0 ? Math.round((p.cost / totals.cost) * 100) : 0;
|
|
444
|
+
const left = ` ${th.fg("text", p.phase.padEnd(14))}${th.fg("warning", formatCost(p.cost).padStart(8))}`;
|
|
445
|
+
const right = th.fg("dim", `${String(pct).padStart(3)}% ${formatTokenCount(p.tokens.total)} tok ${p.units} units`);
|
|
446
|
+
lines.push(row(joinColumns(left, right, contentWidth)));
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const slices = aggregateBySlice(ledger.units);
|
|
451
|
+
if (slices.length > 0) {
|
|
452
|
+
lines.push(blank());
|
|
453
|
+
lines.push(row(th.fg("dim", "By Slice")));
|
|
454
|
+
for (const s of slices) {
|
|
455
|
+
const pct = totals.cost > 0 ? Math.round((s.cost / totals.cost) * 100) : 0;
|
|
456
|
+
const left = ` ${th.fg("text", s.sliceId.padEnd(14))}${th.fg("warning", formatCost(s.cost).padStart(8))}`;
|
|
457
|
+
const right = th.fg("dim", `${String(pct).padStart(3)}% ${formatTokenCount(s.tokens.total)} tok ${formatDuration(s.duration)}`);
|
|
458
|
+
lines.push(row(joinColumns(left, right, contentWidth)));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Cost projection — only when active milestone data is available
|
|
463
|
+
if (this.milestoneData) {
|
|
464
|
+
const mv = this.milestoneData;
|
|
465
|
+
const msTotalSlices = mv.slices.length;
|
|
466
|
+
const msDoneSlices = mv.slices.filter(s => s.done).length;
|
|
467
|
+
const remainingCount = msTotalSlices - msDoneSlices;
|
|
468
|
+
const overlayPrefs = loadEffectiveGSDPreferences()?.preferences;
|
|
469
|
+
const projLines = formatCostProjection(slices, remainingCount, overlayPrefs?.budget_ceiling);
|
|
470
|
+
if (projLines.length > 0) {
|
|
471
|
+
lines.push(blank());
|
|
472
|
+
for (const line of projLines) {
|
|
473
|
+
const colored = line.toLowerCase().includes('ceiling')
|
|
474
|
+
? th.fg("warning", line)
|
|
475
|
+
: th.fg("dim", line);
|
|
476
|
+
lines.push(row(colored));
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const models = aggregateByModel(ledger.units);
|
|
482
|
+
if (models.length > 1) {
|
|
483
|
+
lines.push(blank());
|
|
484
|
+
lines.push(row(th.fg("dim", "By Model")));
|
|
485
|
+
for (const m of models) {
|
|
486
|
+
const pct = totals.cost > 0 ? Math.round((m.cost / totals.cost) * 100) : 0;
|
|
487
|
+
const modelName = truncateToWidth(m.model, 38);
|
|
488
|
+
const left = ` ${th.fg("text", modelName.padEnd(38))}${th.fg("warning", formatCost(m.cost).padStart(8))}`;
|
|
489
|
+
const right = th.fg("dim", `${String(pct).padStart(3)}% ${m.units} units`);
|
|
490
|
+
lines.push(row(joinColumns(left, right, contentWidth)));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
lines.push(blank());
|
|
495
|
+
lines.push(row(`${th.fg("dim", "avg/unit:")} ${th.fg("text", formatCost(totals.cost / totals.units))} ${th.fg("dim", "·")} ${th.fg("text", formatTokenCount(Math.round(totals.tokens.total / totals.units)))} tokens`));
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
lines.push(blank());
|
|
499
|
+
lines.push(hr());
|
|
500
|
+
lines.push(centered(th.fg("dim", "↑↓ scroll · g/G top/end · esc close")));
|
|
501
|
+
|
|
502
|
+
return lines;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
private renderProgressRow(
|
|
506
|
+
label: string,
|
|
507
|
+
done: number,
|
|
508
|
+
total: number,
|
|
509
|
+
color: "success" | "accent" | "warning",
|
|
510
|
+
width: number,
|
|
511
|
+
): string {
|
|
512
|
+
const th = this.theme;
|
|
513
|
+
const pct = total > 0 ? Math.round((done / total) * 100) : 0;
|
|
514
|
+
const labelWidth = 12;
|
|
515
|
+
const rightWidth = 14;
|
|
516
|
+
const gap = 2;
|
|
517
|
+
const labelText = truncateToWidth(label, labelWidth, "").padEnd(labelWidth);
|
|
518
|
+
const ratioText = `${done}/${total}`;
|
|
519
|
+
const rightText = `${String(pct).padStart(3)}% ${ratioText.padStart(rightWidth - 5)}`;
|
|
520
|
+
const barWidth = Math.max(12, width - labelWidth - rightWidth - gap * 2);
|
|
521
|
+
const filled = total > 0 ? Math.round((done / total) * barWidth) : 0;
|
|
522
|
+
const bar = th.fg(color, "█".repeat(filled)) + th.fg("dim", "░".repeat(Math.max(0, barWidth - filled)));
|
|
523
|
+
return `${th.fg("dim", labelText)}${" ".repeat(gap)}${bar}${" ".repeat(gap)}${th.fg("dim", rightText)}`;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
invalidate(): void {
|
|
527
|
+
this.cachedWidth = undefined;
|
|
528
|
+
this.cachedLines = undefined;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
dispose(): void {
|
|
532
|
+
clearInterval(this.refreshTimer);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
interface MilestoneView {
|
|
537
|
+
id: string;
|
|
538
|
+
title: string;
|
|
539
|
+
slices: SliceView[];
|
|
540
|
+
phase: string;
|
|
541
|
+
progress: {
|
|
542
|
+
milestones: {
|
|
543
|
+
total: number;
|
|
544
|
+
done: number;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
interface SliceView {
|
|
550
|
+
id: string;
|
|
551
|
+
title: string;
|
|
552
|
+
done: boolean;
|
|
553
|
+
risk: string;
|
|
554
|
+
active: boolean;
|
|
555
|
+
tasks: TaskView[];
|
|
556
|
+
taskProgress?: { done: number; total: number };
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
interface TaskView {
|
|
560
|
+
id: string;
|
|
561
|
+
title: string;
|
|
562
|
+
done: boolean;
|
|
563
|
+
active: boolean;
|
|
564
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
import { readdirSync } from "node:fs";
|
|
3
|
+
import { relMilestoneFile, milestonesDir } from "./paths.js";
|
|
4
|
+
import { parseRoadmapSlices } from "./roadmap-slices.js";
|
|
5
|
+
import { extractMilestoneSeq, milestoneIdSort } from "./guided-flow.js";
|
|
6
|
+
|
|
7
|
+
const SLICE_DISPATCH_TYPES = new Set([
|
|
8
|
+
"research-slice",
|
|
9
|
+
"plan-slice",
|
|
10
|
+
"replan-slice",
|
|
11
|
+
"execute-task",
|
|
12
|
+
"complete-slice",
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
function readTrackedFileFromBranch(base: string, branch: string, relPath: string): string | null {
|
|
16
|
+
try {
|
|
17
|
+
return execSync(`git show ${branch}:${relPath}`, {
|
|
18
|
+
cwd: base,
|
|
19
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
20
|
+
encoding: "utf-8",
|
|
21
|
+
}).trim();
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getPriorSliceCompletionBlocker(base: string, mainBranch: string, unitType: string, unitId: string): string | null {
|
|
28
|
+
if (!SLICE_DISPATCH_TYPES.has(unitType)) return null;
|
|
29
|
+
|
|
30
|
+
const [targetMid, targetSid] = unitId.split("/");
|
|
31
|
+
if (!targetMid || !targetSid) return null;
|
|
32
|
+
|
|
33
|
+
const targetSeq = extractMilestoneSeq(targetMid);
|
|
34
|
+
if (targetSeq === 0) return null;
|
|
35
|
+
|
|
36
|
+
// Scan actual milestone directories instead of iterating by number
|
|
37
|
+
let milestoneIds: string[];
|
|
38
|
+
try {
|
|
39
|
+
milestoneIds = readdirSync(milestonesDir(base), { withFileTypes: true })
|
|
40
|
+
.filter(d => d.isDirectory())
|
|
41
|
+
.map(d => {
|
|
42
|
+
const match = d.name.match(/^(M\d+(?:-[a-z0-9]{6})?)/);
|
|
43
|
+
return match ? match[1] : null;
|
|
44
|
+
})
|
|
45
|
+
.filter((id): id is string => id !== null)
|
|
46
|
+
.sort(milestoneIdSort)
|
|
47
|
+
.filter(id => extractMilestoneSeq(id) <= targetSeq);
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
for (const mid of milestoneIds) {
|
|
53
|
+
const roadmapRel = relMilestoneFile(base, mid, "ROADMAP");
|
|
54
|
+
if (!roadmapRel) continue;
|
|
55
|
+
|
|
56
|
+
const roadmapContent = readTrackedFileFromBranch(base, mainBranch, roadmapRel);
|
|
57
|
+
if (!roadmapContent) continue;
|
|
58
|
+
|
|
59
|
+
const slices = parseRoadmapSlices(roadmapContent);
|
|
60
|
+
if (mid !== targetMid) {
|
|
61
|
+
const incomplete = slices.find(slice => !slice.done);
|
|
62
|
+
if (incomplete) {
|
|
63
|
+
return `Cannot dispatch ${unitType} ${unitId}: earlier slice ${mid}/${incomplete.id} is not complete on ${mainBranch}.`;
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const targetIndex = slices.findIndex(slice => slice.id === targetSid);
|
|
69
|
+
if (targetIndex === -1) return null;
|
|
70
|
+
|
|
71
|
+
const incomplete = slices.slice(0, targetIndex).find(slice => !slice.done);
|
|
72
|
+
if (incomplete) {
|
|
73
|
+
return `Cannot dispatch ${unitType} ${unitId}: earlier slice ${targetMid}/${incomplete.id} is not complete on ${mainBranch}.`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return null;
|
|
78
|
+
}
|