gsd-pi 2.33.1 → 2.34.0-dev.bbb5216
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-resource-path.d.ts +8 -0
- package/dist/bundled-resource-path.js +14 -0
- package/dist/cli.js +16 -0
- package/dist/headless-query.js +6 -6
- package/dist/resource-loader.d.ts +2 -0
- package/dist/resource-loader.js +39 -4
- package/dist/resources/extensions/ask-user-questions.js +217 -0
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +180 -0
- package/dist/resources/extensions/async-jobs/await-tool.js +90 -0
- package/dist/resources/extensions/async-jobs/cancel-job-tool.js +28 -0
- package/dist/resources/extensions/async-jobs/index.js +119 -0
- package/dist/resources/extensions/async-jobs/job-manager.js +159 -0
- package/dist/resources/extensions/aws-auth/index.js +138 -0
- package/dist/resources/extensions/bg-shell/bg-shell-command.js +182 -0
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +343 -0
- package/dist/resources/extensions/bg-shell/bg-shell-tool.js +831 -0
- package/dist/resources/extensions/bg-shell/index.js +41 -0
- package/dist/resources/extensions/bg-shell/interaction.js +160 -0
- package/dist/resources/extensions/bg-shell/output-formatter.js +245 -0
- package/dist/resources/extensions/bg-shell/overlay.js +378 -0
- package/dist/resources/extensions/bg-shell/process-manager.js +413 -0
- package/dist/resources/extensions/bg-shell/readiness-detector.js +109 -0
- package/dist/resources/extensions/bg-shell/types.js +96 -0
- package/dist/resources/extensions/bg-shell/utilities.js +50 -0
- package/dist/resources/extensions/browser-tools/capture.js +179 -0
- package/dist/resources/extensions/browser-tools/core.js +899 -0
- package/dist/resources/extensions/browser-tools/{evaluate-helpers.ts → evaluate-helpers.js} +0 -1
- package/dist/resources/extensions/browser-tools/index.js +123 -0
- package/dist/resources/extensions/browser-tools/lifecycle.js +222 -0
- package/dist/resources/extensions/browser-tools/refs.js +254 -0
- package/dist/resources/extensions/browser-tools/settle.js +173 -0
- package/dist/resources/extensions/browser-tools/state.js +126 -0
- package/dist/resources/extensions/browser-tools/tools/action-cache.js +179 -0
- package/dist/resources/extensions/browser-tools/tools/assertions.js +320 -0
- package/dist/resources/extensions/browser-tools/tools/codegen.js +242 -0
- package/dist/resources/extensions/browser-tools/tools/device.js +162 -0
- package/dist/resources/extensions/browser-tools/tools/extract.js +191 -0
- package/dist/resources/extensions/browser-tools/tools/forms.js +710 -0
- package/dist/resources/extensions/browser-tools/tools/injection-detect.js +178 -0
- package/dist/resources/extensions/browser-tools/tools/inspection.js +426 -0
- package/dist/resources/extensions/browser-tools/tools/intent.js +556 -0
- package/dist/resources/extensions/browser-tools/tools/interaction.js +776 -0
- package/dist/resources/extensions/browser-tools/tools/navigation.js +208 -0
- package/dist/resources/extensions/browser-tools/tools/network-mock.js +194 -0
- package/dist/resources/extensions/browser-tools/tools/pages.js +280 -0
- package/dist/resources/extensions/browser-tools/tools/pdf.js +74 -0
- package/dist/resources/extensions/browser-tools/tools/refs.js +485 -0
- package/dist/resources/extensions/browser-tools/tools/screenshot.js +87 -0
- package/dist/resources/extensions/browser-tools/tools/session.js +375 -0
- package/dist/resources/extensions/browser-tools/tools/state-persistence.js +180 -0
- package/dist/resources/extensions/browser-tools/tools/visual-diff.js +174 -0
- package/dist/resources/extensions/browser-tools/tools/wait.js +201 -0
- package/dist/resources/extensions/browser-tools/tools/zoom.js +90 -0
- package/dist/resources/extensions/browser-tools/utils.js +490 -0
- package/dist/resources/extensions/context7/index.js +337 -0
- package/dist/resources/extensions/get-secrets-from-user.js +492 -0
- package/dist/resources/extensions/google-search/index.js +373 -0
- package/dist/resources/extensions/gsd/activity-log.js +146 -0
- package/dist/resources/extensions/gsd/atomic-write.js +38 -0
- package/dist/resources/extensions/gsd/auto/session.js +182 -0
- package/dist/resources/extensions/gsd/auto-budget.js +30 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +429 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +185 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +353 -0
- package/dist/resources/extensions/gsd/auto-loop.js +956 -0
- package/dist/resources/extensions/gsd/auto-model-selection.js +133 -0
- package/dist/resources/extensions/gsd/auto-observability.js +56 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +385 -0
- package/dist/resources/extensions/gsd/auto-prompts.js +1153 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +512 -0
- package/dist/resources/extensions/gsd/auto-start.js +414 -0
- package/dist/resources/extensions/gsd/auto-supervisor.js +47 -0
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +183 -0
- package/dist/resources/extensions/gsd/auto-timers.js +180 -0
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +50 -0
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +30 -0
- package/dist/resources/extensions/gsd/auto-verification.js +171 -0
- package/dist/resources/extensions/gsd/auto-worktree-sync.js +167 -0
- package/dist/resources/extensions/gsd/auto-worktree.js +830 -0
- package/dist/resources/extensions/gsd/auto.js +765 -0
- package/dist/resources/extensions/gsd/{cache.ts → cache.js} +5 -7
- package/dist/resources/extensions/gsd/captures.js +354 -0
- package/dist/resources/extensions/gsd/claude-import.js +540 -0
- package/dist/resources/extensions/gsd/collision-diagnostics.js +226 -0
- package/dist/resources/extensions/gsd/commands-bootstrap.js +223 -0
- package/dist/resources/extensions/gsd/commands-config.js +89 -0
- package/dist/resources/extensions/gsd/commands-extensions.js +259 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +310 -0
- package/dist/resources/extensions/gsd/commands-inspect.js +70 -0
- package/dist/resources/extensions/gsd/commands-logs.js +468 -0
- package/dist/resources/extensions/gsd/commands-maintenance.js +185 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +660 -0
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +408 -0
- package/dist/resources/extensions/gsd/commands.js +1024 -0
- package/dist/resources/extensions/gsd/complexity-classifier.js +257 -0
- package/dist/resources/extensions/gsd/{constants.ts → constants.js} +0 -6
- package/dist/resources/extensions/gsd/context-budget.js +187 -0
- package/dist/resources/extensions/gsd/context-store.js +165 -0
- package/dist/resources/extensions/gsd/crash-recovery.js +110 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.js +562 -0
- package/dist/resources/extensions/gsd/db-writer.js +298 -0
- package/dist/resources/extensions/gsd/debug-logger.js +161 -0
- package/dist/resources/extensions/gsd/detection.js +373 -0
- package/dist/resources/extensions/gsd/diff-context.js +168 -0
- package/dist/resources/extensions/gsd/dispatch-guard.js +75 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +25 -18
- package/dist/resources/extensions/gsd/doctor-checks.js +562 -0
- package/dist/resources/extensions/gsd/doctor-environment.js +429 -0
- package/dist/resources/extensions/gsd/doctor-format.js +71 -0
- package/dist/resources/extensions/gsd/doctor-proactive.js +239 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +292 -0
- package/dist/resources/extensions/gsd/doctor-types.js +12 -0
- package/dist/resources/extensions/gsd/doctor.js +672 -0
- package/dist/resources/extensions/gsd/error-utils.js +6 -0
- package/dist/resources/extensions/gsd/{errors.ts → errors.js} +6 -11
- package/dist/resources/extensions/gsd/exit-command.js +11 -0
- package/dist/resources/extensions/gsd/{export-html.ts → export-html.js} +482 -614
- package/dist/resources/extensions/gsd/export.js +268 -0
- package/dist/resources/extensions/gsd/file-watcher.js +76 -0
- package/dist/resources/extensions/gsd/files.js +937 -0
- package/dist/resources/extensions/gsd/forensics.js +511 -0
- package/dist/resources/extensions/gsd/{git-constants.ts → git-constants.js} +4 -5
- package/dist/resources/extensions/gsd/git-self-heal.js +113 -0
- package/dist/resources/extensions/gsd/git-service.js +460 -0
- package/dist/resources/extensions/gsd/{gitignore.ts → gitignore.js} +98 -125
- package/dist/resources/extensions/gsd/gsd-db.js +735 -0
- package/dist/resources/extensions/gsd/guided-flow-queue.js +366 -0
- package/dist/resources/extensions/gsd/guided-flow.js +1158 -0
- package/dist/resources/extensions/gsd/health-widget.js +141 -0
- package/dist/resources/extensions/gsd/history.js +118 -0
- package/dist/resources/extensions/gsd/index.js +1114 -0
- package/dist/resources/extensions/gsd/init-wizard.js +479 -0
- package/dist/resources/extensions/gsd/json-persistence.js +62 -0
- package/dist/resources/extensions/gsd/{jsonl-utils.ts → jsonl-utils.js} +10 -7
- package/dist/resources/extensions/gsd/key-manager.js +829 -0
- package/dist/resources/extensions/gsd/marketplace-discovery.js +356 -0
- package/dist/resources/extensions/gsd/md-importer.js +440 -0
- package/dist/resources/extensions/gsd/memory-extractor.js +295 -0
- package/dist/resources/extensions/gsd/memory-store.js +351 -0
- package/dist/resources/extensions/gsd/metrics.js +377 -0
- package/dist/resources/extensions/gsd/migrate/command.js +157 -0
- package/dist/resources/extensions/gsd/migrate/index.js +7 -0
- package/dist/resources/extensions/gsd/migrate/parser.js +268 -0
- package/dist/resources/extensions/gsd/migrate/parsers.js +477 -0
- package/dist/resources/extensions/gsd/migrate/preview.js +47 -0
- package/dist/resources/extensions/gsd/migrate/transformer.js +278 -0
- package/dist/resources/extensions/gsd/migrate/types.js +4 -0
- package/dist/resources/extensions/gsd/migrate/validator.js +41 -0
- package/dist/resources/extensions/gsd/migrate/writer.js +477 -0
- package/dist/resources/extensions/gsd/migrate-external.js +130 -0
- package/dist/resources/extensions/gsd/milestone-actions.js +111 -0
- package/dist/resources/extensions/gsd/{milestone-ids.ts → milestone-ids.js} +50 -63
- package/dist/resources/extensions/gsd/model-cost-table.js +48 -0
- package/dist/resources/extensions/gsd/model-router.js +187 -0
- package/dist/resources/extensions/gsd/namespaced-registry.js +322 -0
- package/dist/resources/extensions/gsd/namespaced-resolver.js +176 -0
- package/dist/resources/extensions/gsd/native-git-bridge.js +842 -0
- package/dist/resources/extensions/gsd/native-parser-bridge.js +156 -0
- package/dist/resources/extensions/gsd/notifications.js +58 -0
- package/dist/resources/extensions/gsd/observability-validator.js +398 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.js +182 -0
- package/dist/resources/extensions/gsd/parallel-merge.js +121 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +687 -0
- package/dist/resources/extensions/gsd/paths.js +414 -0
- package/dist/resources/extensions/gsd/plugin-importer.js +254 -0
- package/dist/resources/extensions/gsd/post-unit-hooks.js +433 -0
- package/dist/resources/extensions/gsd/preferences-models.js +294 -0
- package/dist/resources/extensions/gsd/preferences-skills.js +154 -0
- package/dist/resources/extensions/gsd/preferences-types.js +73 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +607 -0
- package/dist/resources/extensions/gsd/preferences.js +325 -0
- package/dist/resources/extensions/gsd/progress-score.js +102 -0
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.js +150 -0
- package/dist/resources/extensions/gsd/prompt-compressor.js +393 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +119 -0
- package/dist/resources/extensions/gsd/prompt-ordering.js +170 -0
- package/dist/resources/extensions/gsd/provider-error-pause.js +60 -0
- package/dist/resources/extensions/gsd/queue-order.js +178 -0
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +234 -0
- package/dist/resources/extensions/gsd/quick.js +206 -0
- package/dist/resources/extensions/gsd/repo-identity.js +187 -0
- package/dist/resources/extensions/gsd/{reports.ts → reports.js} +146 -241
- package/dist/resources/extensions/gsd/{resource-version.ts → resource-version.js} +50 -53
- package/dist/resources/extensions/gsd/roadmap-slices.js +130 -0
- package/dist/resources/extensions/gsd/routing-history.js +210 -0
- package/dist/resources/extensions/gsd/safe-fs.js +52 -0
- package/dist/resources/extensions/gsd/semantic-chunker.js +254 -0
- package/dist/resources/extensions/gsd/session-forensics.js +427 -0
- package/dist/resources/extensions/gsd/session-lock.js +397 -0
- package/dist/resources/extensions/gsd/session-status-io.js +134 -0
- package/dist/resources/extensions/gsd/skill-discovery.js +121 -0
- package/dist/resources/extensions/gsd/skill-health.js +324 -0
- package/dist/resources/extensions/gsd/{skill-telemetry.ts → skill-telemetry.js} +58 -74
- package/dist/resources/extensions/gsd/state.js +653 -0
- package/dist/resources/extensions/gsd/structured-data-formatter.js +97 -0
- package/dist/resources/extensions/gsd/summary-distiller.js +212 -0
- package/dist/resources/extensions/gsd/templates/preferences.md +1 -0
- package/dist/resources/extensions/gsd/token-counter.js +54 -0
- package/dist/resources/extensions/gsd/triage-resolution.js +217 -0
- package/dist/resources/extensions/gsd/triage-ui.js +125 -0
- package/dist/resources/extensions/gsd/types.js +4 -0
- package/dist/resources/extensions/gsd/undo.js +205 -0
- package/dist/resources/extensions/gsd/unit-id.js +7 -0
- package/dist/resources/extensions/gsd/unit-runtime.js +131 -0
- package/dist/resources/extensions/gsd/validate-directory.js +143 -0
- package/dist/resources/extensions/gsd/verification-evidence.js +122 -0
- package/dist/resources/extensions/gsd/verification-gate.js +514 -0
- package/dist/resources/extensions/gsd/visualizer-data.js +612 -0
- package/dist/resources/extensions/gsd/visualizer-overlay.js +501 -0
- package/dist/resources/extensions/gsd/visualizer-views.js +893 -0
- package/dist/resources/extensions/gsd/workflow-templates.js +188 -0
- package/dist/resources/extensions/gsd/workspace-index.js +139 -0
- package/dist/resources/extensions/gsd/worktree-command-bootstrap.js +40 -0
- package/dist/resources/extensions/gsd/worktree-command.js +682 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +358 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +344 -0
- package/dist/resources/extensions/gsd/worktree.js +199 -0
- package/dist/resources/extensions/mac-tools/index.js +768 -0
- package/dist/resources/extensions/mcp-client/index.js +363 -0
- package/dist/resources/extensions/package.json +3 -0
- package/dist/resources/extensions/remote-questions/config.js +70 -0
- package/dist/resources/extensions/remote-questions/discord-adapter.js +134 -0
- package/dist/resources/extensions/remote-questions/format.js +234 -0
- package/dist/resources/extensions/remote-questions/http-client.js +43 -0
- package/dist/resources/extensions/remote-questions/manager.js +156 -0
- package/dist/resources/extensions/remote-questions/{mod.ts → mod.js} +1 -10
- package/dist/resources/extensions/remote-questions/notify.js +89 -0
- package/dist/resources/extensions/remote-questions/remote-command.js +453 -0
- package/dist/resources/extensions/remote-questions/slack-adapter.js +123 -0
- package/dist/resources/extensions/remote-questions/status.js +25 -0
- package/dist/resources/extensions/remote-questions/store.js +70 -0
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +123 -0
- package/dist/resources/extensions/remote-questions/types.js +5 -0
- package/dist/resources/extensions/search-the-web/cache.js +74 -0
- package/dist/resources/extensions/search-the-web/command-search-provider.js +79 -0
- package/dist/resources/extensions/search-the-web/format.js +161 -0
- package/dist/resources/extensions/search-the-web/http.js +178 -0
- package/dist/resources/extensions/search-the-web/index.js +41 -0
- package/dist/resources/extensions/search-the-web/native-search.js +166 -0
- package/dist/resources/extensions/search-the-web/provider.js +143 -0
- package/dist/resources/extensions/search-the-web/tavily.js +82 -0
- package/dist/resources/extensions/search-the-web/tool-fetch-page.js +452 -0
- package/dist/resources/extensions/search-the-web/tool-llm-context.js +455 -0
- package/dist/resources/extensions/search-the-web/tool-search.js +482 -0
- package/dist/resources/extensions/search-the-web/url-utils.js +121 -0
- package/dist/resources/extensions/shared/confirm-ui.js +96 -0
- package/dist/resources/extensions/shared/{format-utils.ts → format-utils.js} +85 -91
- package/dist/resources/extensions/shared/frontmatter.js +109 -0
- package/dist/resources/extensions/shared/interview-ui.js +569 -0
- package/dist/resources/extensions/shared/{mod.ts → mod.js} +2 -24
- package/dist/resources/extensions/shared/next-action-ui.js +168 -0
- package/dist/resources/extensions/shared/{path-display.ts → path-display.js} +2 -3
- package/dist/resources/extensions/shared/sanitize.js +17 -0
- package/dist/resources/extensions/shared/terminal.js +21 -0
- package/dist/resources/extensions/shared/ui.js +245 -0
- package/dist/resources/extensions/shared/wizard-ui.js +478 -0
- package/dist/resources/extensions/slash-commands/audit.js +72 -0
- package/dist/resources/extensions/slash-commands/clear.js +8 -0
- package/dist/resources/extensions/slash-commands/create-extension.js +264 -0
- package/dist/resources/extensions/slash-commands/create-slash-command.js +208 -0
- package/dist/resources/extensions/slash-commands/index.js +10 -0
- package/dist/resources/extensions/subagent/agents.js +103 -0
- package/dist/resources/extensions/subagent/index.js +905 -0
- package/dist/resources/extensions/subagent/isolation.js +384 -0
- package/dist/resources/extensions/subagent/worker-registry.js +73 -0
- package/dist/resources/extensions/ttsr/index.js +144 -0
- package/dist/resources/extensions/ttsr/rule-loader.js +70 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.js +380 -0
- package/dist/resources/extensions/universal-config/discovery.js +94 -0
- package/dist/resources/extensions/universal-config/format.js +178 -0
- package/dist/resources/extensions/universal-config/index.js +99 -0
- package/dist/resources/extensions/universal-config/scanners.js +574 -0
- package/dist/resources/extensions/universal-config/tools.js +57 -0
- package/dist/resources/extensions/universal-config/types.js +8 -0
- package/dist/resources/extensions/voice/index.js +247 -0
- package/dist/startup-timings.d.ts +2 -0
- package/dist/startup-timings.js +22 -0
- package/dist/tool-bootstrap.js +59 -11
- package/dist/worktree-cli.js +7 -7
- package/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +9 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +31 -4
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +9 -0
- package/packages/pi-coding-agent/src/core/extensions/index.ts +1 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +35 -4
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/bg-shell/index.ts +41 -46
- package/src/resources/extensions/browser-tools/index.ts +156 -67
- package/src/resources/extensions/gsd/auto/session.ts +47 -30
- package/src/resources/extensions/gsd/auto-dashboard.ts +28 -131
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +6 -1
- package/src/resources/extensions/gsd/auto-dispatch.ts +135 -91
- package/src/resources/extensions/gsd/auto-loop.ts +1665 -0
- package/src/resources/extensions/gsd/auto-observability.ts +4 -2
- package/src/resources/extensions/gsd/auto-post-unit.ts +85 -228
- package/src/resources/extensions/gsd/auto-prompts.ts +138 -109
- package/src/resources/extensions/gsd/auto-recovery.ts +124 -118
- package/src/resources/extensions/gsd/auto-start.ts +440 -354
- package/src/resources/extensions/gsd/auto-supervisor.ts +5 -12
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +8 -8
- package/src/resources/extensions/gsd/auto-timers.ts +3 -4
- package/src/resources/extensions/gsd/auto-verification.ts +76 -72
- package/src/resources/extensions/gsd/auto-worktree-sync.ts +204 -0
- package/src/resources/extensions/gsd/auto-worktree.ts +453 -133
- package/src/resources/extensions/gsd/auto.ts +516 -1189
- package/src/resources/extensions/gsd/captures.ts +10 -4
- package/src/resources/extensions/gsd/commands-bootstrap.ts +252 -0
- package/src/resources/extensions/gsd/commands.ts +39 -31
- package/src/resources/extensions/gsd/dispatch-guard.ts +13 -9
- package/src/resources/extensions/gsd/docs/preferences-reference.md +25 -18
- package/src/resources/extensions/gsd/doctor-checks.ts +3 -4
- package/src/resources/extensions/gsd/git-service.ts +32 -12
- package/src/resources/extensions/gsd/gitignore.ts +4 -2
- package/src/resources/extensions/gsd/gsd-db.ts +375 -180
- package/src/resources/extensions/gsd/guided-flow.ts +22 -11
- package/src/resources/extensions/gsd/index.ts +76 -163
- package/src/resources/extensions/gsd/post-unit-hooks.ts +13 -13
- package/src/resources/extensions/gsd/progress-score.ts +65 -200
- package/src/resources/extensions/gsd/quick.ts +121 -76
- package/src/resources/extensions/gsd/repo-identity.ts +56 -22
- package/src/resources/extensions/gsd/session-lock.ts +17 -0
- package/src/resources/extensions/gsd/templates/preferences.md +1 -0
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +32 -59
- package/src/resources/extensions/gsd/tests/all-milestones-complete-merge.test.ts +75 -27
- package/src/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-lock-creation.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +1458 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +8 -162
- package/src/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +2 -108
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +1 -3
- package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/auto-worktree.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +0 -55
- package/src/resources/extensions/gsd/tests/git-service.test.ts +16 -7
- package/src/resources/extensions/gsd/tests/headless-query.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-worktree.test.ts +8 -11
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +4 -6
- package/src/resources/extensions/gsd/tests/quick-branch-lifecycle.test.ts +281 -0
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/run-uat.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/sidecar-queue.test.ts +181 -0
- package/src/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/triage-dispatch.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/undo.test.ts +6 -0
- package/src/resources/extensions/gsd/tests/verification-evidence.test.ts +24 -26
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +7 -136
- package/src/resources/extensions/gsd/tests/worktree-db-integration.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +442 -0
- package/src/resources/extensions/gsd/tests/worktree-e2e.test.ts +0 -3
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +705 -0
- package/src/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +57 -106
- package/src/resources/extensions/gsd/tests/worktree.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +43 -132
- package/src/resources/extensions/gsd/types.ts +90 -77
- package/src/resources/extensions/gsd/undo.ts +42 -46
- package/src/resources/extensions/gsd/unit-runtime.ts +14 -18
- package/src/resources/extensions/gsd/verification-evidence.ts +0 -2
- package/src/resources/extensions/gsd/verification-gate.ts +4 -16
- package/src/resources/extensions/gsd/worktree-command-bootstrap.ts +46 -0
- package/src/resources/extensions/gsd/worktree-command.ts +29 -11
- package/src/resources/extensions/gsd/worktree-manager.ts +2 -3
- package/src/resources/extensions/gsd/worktree-resolver.ts +485 -0
- package/src/resources/extensions/gsd/worktree.ts +7 -44
- package/src/resources/extensions/package.json +3 -0
- package/src/resources/extensions/search-the-web/command-search-provider.ts +1 -1
- package/src/resources/extensions/search-the-web/index.ts +35 -52
- package/src/resources/extensions/search-the-web/tavily.ts +1 -1
- package/dist/resources/extensions/ask-user-questions.ts +0 -290
- package/dist/resources/extensions/async-jobs/async-bash-tool.ts +0 -212
- package/dist/resources/extensions/async-jobs/await-tool.ts +0 -103
- package/dist/resources/extensions/async-jobs/cancel-job-tool.ts +0 -35
- package/dist/resources/extensions/async-jobs/index.ts +0 -141
- package/dist/resources/extensions/async-jobs/job-manager.ts +0 -211
- package/dist/resources/extensions/aws-auth/index.ts +0 -144
- package/dist/resources/extensions/bg-shell/bg-shell-command.ts +0 -219
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.ts +0 -400
- package/dist/resources/extensions/bg-shell/bg-shell-tool.ts +0 -985
- package/dist/resources/extensions/bg-shell/index.ts +0 -59
- package/dist/resources/extensions/bg-shell/interaction.ts +0 -198
- package/dist/resources/extensions/bg-shell/output-formatter.ts +0 -279
- package/dist/resources/extensions/bg-shell/overlay.ts +0 -437
- package/dist/resources/extensions/bg-shell/process-manager.ts +0 -464
- package/dist/resources/extensions/bg-shell/readiness-detector.ts +0 -126
- package/dist/resources/extensions/bg-shell/types.ts +0 -303
- package/dist/resources/extensions/bg-shell/utilities.ts +0 -57
- package/dist/resources/extensions/browser-tools/capture.ts +0 -199
- package/dist/resources/extensions/browser-tools/core.ts +0 -1196
- package/dist/resources/extensions/browser-tools/index.ts +0 -71
- package/dist/resources/extensions/browser-tools/lifecycle.ts +0 -270
- package/dist/resources/extensions/browser-tools/refs.ts +0 -264
- package/dist/resources/extensions/browser-tools/settle.ts +0 -197
- package/dist/resources/extensions/browser-tools/state.ts +0 -408
- package/dist/resources/extensions/browser-tools/tools/action-cache.ts +0 -216
- package/dist/resources/extensions/browser-tools/tools/assertions.ts +0 -342
- package/dist/resources/extensions/browser-tools/tools/codegen.ts +0 -274
- package/dist/resources/extensions/browser-tools/tools/device.ts +0 -183
- package/dist/resources/extensions/browser-tools/tools/extract.ts +0 -229
- package/dist/resources/extensions/browser-tools/tools/forms.ts +0 -801
- package/dist/resources/extensions/browser-tools/tools/injection-detect.ts +0 -221
- package/dist/resources/extensions/browser-tools/tools/inspection.ts +0 -492
- package/dist/resources/extensions/browser-tools/tools/intent.ts +0 -614
- package/dist/resources/extensions/browser-tools/tools/interaction.ts +0 -865
- package/dist/resources/extensions/browser-tools/tools/navigation.ts +0 -232
- package/dist/resources/extensions/browser-tools/tools/network-mock.ts +0 -244
- package/dist/resources/extensions/browser-tools/tools/pages.ts +0 -303
- package/dist/resources/extensions/browser-tools/tools/pdf.ts +0 -92
- package/dist/resources/extensions/browser-tools/tools/refs.ts +0 -541
- package/dist/resources/extensions/browser-tools/tools/screenshot.ts +0 -101
- package/dist/resources/extensions/browser-tools/tools/session.ts +0 -400
- package/dist/resources/extensions/browser-tools/tools/state-persistence.ts +0 -202
- package/dist/resources/extensions/browser-tools/tools/visual-diff.ts +0 -209
- package/dist/resources/extensions/browser-tools/tools/wait.ts +0 -247
- package/dist/resources/extensions/browser-tools/tools/zoom.ts +0 -104
- package/dist/resources/extensions/browser-tools/utils.ts +0 -660
- package/dist/resources/extensions/context7/index.ts +0 -428
- package/dist/resources/extensions/get-secrets-from-user.ts +0 -607
- package/dist/resources/extensions/google-search/index.ts +0 -466
- package/dist/resources/extensions/gsd/activity-log.ts +0 -162
- package/dist/resources/extensions/gsd/atomic-write.ts +0 -35
- package/dist/resources/extensions/gsd/auto/session.ts +0 -236
- package/dist/resources/extensions/gsd/auto-budget.ts +0 -32
- package/dist/resources/extensions/gsd/auto-constants.ts +0 -6
- package/dist/resources/extensions/gsd/auto-dashboard.ts +0 -626
- package/dist/resources/extensions/gsd/auto-direct-dispatch.ts +0 -224
- package/dist/resources/extensions/gsd/auto-dispatch.ts +0 -409
- package/dist/resources/extensions/gsd/auto-idempotency.ts +0 -151
- package/dist/resources/extensions/gsd/auto-model-selection.ts +0 -179
- package/dist/resources/extensions/gsd/auto-observability.ts +0 -72
- package/dist/resources/extensions/gsd/auto-post-unit.ts +0 -618
- package/dist/resources/extensions/gsd/auto-prompts.ts +0 -1273
- package/dist/resources/extensions/gsd/auto-recovery.ts +0 -578
- package/dist/resources/extensions/gsd/auto-start.ts +0 -483
- package/dist/resources/extensions/gsd/auto-stuck-detection.ts +0 -221
- package/dist/resources/extensions/gsd/auto-supervisor.ts +0 -61
- package/dist/resources/extensions/gsd/auto-timeout-recovery.ts +0 -263
- package/dist/resources/extensions/gsd/auto-timers.ts +0 -224
- package/dist/resources/extensions/gsd/auto-tool-tracking.ts +0 -54
- package/dist/resources/extensions/gsd/auto-unit-closeout.ts +0 -48
- package/dist/resources/extensions/gsd/auto-verification.ts +0 -229
- package/dist/resources/extensions/gsd/auto-worktree.ts +0 -658
- package/dist/resources/extensions/gsd/auto.ts +0 -1834
- package/dist/resources/extensions/gsd/captures.ts +0 -427
- package/dist/resources/extensions/gsd/claude-import.ts +0 -656
- package/dist/resources/extensions/gsd/collision-diagnostics.ts +0 -332
- package/dist/resources/extensions/gsd/commands-config.ts +0 -102
- package/dist/resources/extensions/gsd/commands-extensions.ts +0 -328
- package/dist/resources/extensions/gsd/commands-handlers.ts +0 -395
- package/dist/resources/extensions/gsd/commands-inspect.ts +0 -91
- package/dist/resources/extensions/gsd/commands-logs.ts +0 -536
- package/dist/resources/extensions/gsd/commands-maintenance.ts +0 -206
- package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +0 -780
- package/dist/resources/extensions/gsd/commands-workflow-templates.ts +0 -543
- package/dist/resources/extensions/gsd/commands.ts +0 -1149
- package/dist/resources/extensions/gsd/complexity-classifier.ts +0 -320
- package/dist/resources/extensions/gsd/context-budget.ts +0 -266
- package/dist/resources/extensions/gsd/context-store.ts +0 -195
- package/dist/resources/extensions/gsd/crash-recovery.ts +0 -121
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +0 -681
- package/dist/resources/extensions/gsd/db-writer.ts +0 -360
- package/dist/resources/extensions/gsd/debug-logger.ts +0 -178
- package/dist/resources/extensions/gsd/detection.ts +0 -470
- package/dist/resources/extensions/gsd/diff-context.ts +0 -214
- package/dist/resources/extensions/gsd/dispatch-guard.ts +0 -81
- package/dist/resources/extensions/gsd/doctor-checks.ts +0 -612
- package/dist/resources/extensions/gsd/doctor-environment.ts +0 -497
- package/dist/resources/extensions/gsd/doctor-format.ts +0 -78
- package/dist/resources/extensions/gsd/doctor-proactive.ts +0 -292
- package/dist/resources/extensions/gsd/doctor-providers.ts +0 -343
- package/dist/resources/extensions/gsd/doctor-types.ts +0 -87
- package/dist/resources/extensions/gsd/doctor.ts +0 -722
- package/dist/resources/extensions/gsd/error-utils.ts +0 -6
- package/dist/resources/extensions/gsd/exit-command.ts +0 -18
- package/dist/resources/extensions/gsd/export.ts +0 -317
- package/dist/resources/extensions/gsd/file-watcher.ts +0 -97
- package/dist/resources/extensions/gsd/files.ts +0 -1058
- package/dist/resources/extensions/gsd/forensics.ts +0 -629
- package/dist/resources/extensions/gsd/git-self-heal.ts +0 -127
- package/dist/resources/extensions/gsd/git-service.ts +0 -580
- package/dist/resources/extensions/gsd/gsd-db.ts +0 -685
- package/dist/resources/extensions/gsd/guided-flow-queue.ts +0 -440
- package/dist/resources/extensions/gsd/guided-flow.ts +0 -1303
- package/dist/resources/extensions/gsd/health-widget.ts +0 -167
- package/dist/resources/extensions/gsd/history.ts +0 -143
- package/dist/resources/extensions/gsd/index.ts +0 -1390
- package/dist/resources/extensions/gsd/init-wizard.ts +0 -587
- package/dist/resources/extensions/gsd/json-persistence.ts +0 -67
- package/dist/resources/extensions/gsd/key-manager.ts +0 -996
- package/dist/resources/extensions/gsd/marketplace-discovery.ts +0 -508
- package/dist/resources/extensions/gsd/md-importer.ts +0 -527
- package/dist/resources/extensions/gsd/mechanical-completion.ts +0 -430
- package/dist/resources/extensions/gsd/memory-extractor.ts +0 -352
- package/dist/resources/extensions/gsd/memory-store.ts +0 -441
- package/dist/resources/extensions/gsd/metrics.ts +0 -532
- package/dist/resources/extensions/gsd/migrate/command.ts +0 -219
- package/dist/resources/extensions/gsd/migrate/index.ts +0 -42
- package/dist/resources/extensions/gsd/migrate/parser.ts +0 -323
- package/dist/resources/extensions/gsd/migrate/parsers.ts +0 -539
- package/dist/resources/extensions/gsd/migrate/preview.ts +0 -48
- package/dist/resources/extensions/gsd/migrate/transformer.ts +0 -346
- package/dist/resources/extensions/gsd/migrate/types.ts +0 -370
- package/dist/resources/extensions/gsd/migrate/validator.ts +0 -55
- package/dist/resources/extensions/gsd/migrate/writer.ts +0 -579
- package/dist/resources/extensions/gsd/migrate-external.ts +0 -140
- package/dist/resources/extensions/gsd/milestone-actions.ts +0 -126
- package/dist/resources/extensions/gsd/model-cost-table.ts +0 -65
- package/dist/resources/extensions/gsd/model-router.ts +0 -256
- package/dist/resources/extensions/gsd/namespaced-registry.ts +0 -467
- package/dist/resources/extensions/gsd/namespaced-resolver.ts +0 -307
- package/dist/resources/extensions/gsd/native-git-bridge.ts +0 -1041
- package/dist/resources/extensions/gsd/native-parser-bridge.ts +0 -267
- package/dist/resources/extensions/gsd/notifications.ts +0 -87
- package/dist/resources/extensions/gsd/observability-validator.ts +0 -429
- package/dist/resources/extensions/gsd/parallel-eligibility.ts +0 -233
- package/dist/resources/extensions/gsd/parallel-merge.ts +0 -157
- package/dist/resources/extensions/gsd/parallel-orchestrator.ts +0 -826
- package/dist/resources/extensions/gsd/paths.ts +0 -449
- package/dist/resources/extensions/gsd/plugin-importer.ts +0 -411
- package/dist/resources/extensions/gsd/post-unit-hooks.ts +0 -520
- package/dist/resources/extensions/gsd/preferences-models.ts +0 -329
- package/dist/resources/extensions/gsd/preferences-skills.ts +0 -169
- package/dist/resources/extensions/gsd/preferences-types.ts +0 -229
- package/dist/resources/extensions/gsd/preferences-validation.ts +0 -590
- package/dist/resources/extensions/gsd/preferences.ts +0 -416
- package/dist/resources/extensions/gsd/progress-score.ts +0 -273
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.ts +0 -213
- package/dist/resources/extensions/gsd/prompt-compressor.ts +0 -508
- package/dist/resources/extensions/gsd/prompt-loader.ts +0 -130
- package/dist/resources/extensions/gsd/prompt-ordering.ts +0 -200
- package/dist/resources/extensions/gsd/provider-error-pause.ts +0 -88
- package/dist/resources/extensions/gsd/queue-order.ts +0 -230
- package/dist/resources/extensions/gsd/queue-reorder-ui.ts +0 -276
- package/dist/resources/extensions/gsd/quick.ts +0 -212
- package/dist/resources/extensions/gsd/repo-identity.ts +0 -169
- package/dist/resources/extensions/gsd/roadmap-slices.ts +0 -149
- package/dist/resources/extensions/gsd/routing-history.ts +0 -286
- package/dist/resources/extensions/gsd/safe-fs.ts +0 -47
- package/dist/resources/extensions/gsd/semantic-chunker.ts +0 -336
- package/dist/resources/extensions/gsd/session-forensics.ts +0 -537
- package/dist/resources/extensions/gsd/session-lock.ts +0 -426
- package/dist/resources/extensions/gsd/session-status-io.ts +0 -179
- package/dist/resources/extensions/gsd/skill-discovery.ts +0 -139
- package/dist/resources/extensions/gsd/skill-health.ts +0 -417
- package/dist/resources/extensions/gsd/state.ts +0 -727
- package/dist/resources/extensions/gsd/structured-data-formatter.ts +0 -144
- package/dist/resources/extensions/gsd/summary-distiller.ts +0 -258
- package/dist/resources/extensions/gsd/tests/activity-log.test.ts +0 -213
- package/dist/resources/extensions/gsd/tests/agent-end-retry.test.ts +0 -107
- package/dist/resources/extensions/gsd/tests/all-milestones-complete-merge.test.ts +0 -200
- package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +0 -50
- package/dist/resources/extensions/gsd/tests/auto-dashboard.test.ts +0 -166
- package/dist/resources/extensions/gsd/tests/auto-dispatch-loop.test.ts +0 -691
- package/dist/resources/extensions/gsd/tests/auto-lock-creation.test.ts +0 -186
- package/dist/resources/extensions/gsd/tests/auto-preflight.test.ts +0 -40
- package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +0 -640
- package/dist/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +0 -127
- package/dist/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +0 -302
- package/dist/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +0 -257
- package/dist/resources/extensions/gsd/tests/auto-skip-loop.test.ts +0 -123
- package/dist/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +0 -340
- package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +0 -167
- package/dist/resources/extensions/gsd/tests/budget-prediction.test.ts +0 -220
- package/dist/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +0 -317
- package/dist/resources/extensions/gsd/tests/captures.test.ts +0 -438
- package/dist/resources/extensions/gsd/tests/claude-import-tui.test.ts +0 -351
- package/dist/resources/extensions/gsd/tests/collect-from-manifest.test.ts +0 -469
- package/dist/resources/extensions/gsd/tests/collision-diagnostics.test.ts +0 -705
- package/dist/resources/extensions/gsd/tests/commands-logs.test.ts +0 -241
- package/dist/resources/extensions/gsd/tests/complete-milestone.test.ts +0 -209
- package/dist/resources/extensions/gsd/tests/complexity-classifier.test.ts +0 -181
- package/dist/resources/extensions/gsd/tests/context-budget.test.ts +0 -352
- package/dist/resources/extensions/gsd/tests/context-compression.test.ts +0 -193
- package/dist/resources/extensions/gsd/tests/context-store.test.ts +0 -462
- package/dist/resources/extensions/gsd/tests/continue-here.test.ts +0 -285
- package/dist/resources/extensions/gsd/tests/cost-projection.test.ts +0 -134
- package/dist/resources/extensions/gsd/tests/crash-recovery.test.ts +0 -134
- package/dist/resources/extensions/gsd/tests/dashboard-budget.test.ts +0 -346
- package/dist/resources/extensions/gsd/tests/db-writer.test.ts +0 -602
- package/dist/resources/extensions/gsd/tests/debug-logger.test.ts +0 -185
- package/dist/resources/extensions/gsd/tests/derive-state-db.test.ts +0 -405
- package/dist/resources/extensions/gsd/tests/derive-state-deps.test.ts +0 -421
- package/dist/resources/extensions/gsd/tests/derive-state-draft.test.ts +0 -308
- package/dist/resources/extensions/gsd/tests/derive-state.test.ts +0 -788
- package/dist/resources/extensions/gsd/tests/detection.test.ts +0 -398
- package/dist/resources/extensions/gsd/tests/diff-context.test.ts +0 -136
- package/dist/resources/extensions/gsd/tests/discuss-prompt.test.ts +0 -15
- package/dist/resources/extensions/gsd/tests/dispatch-guard.test.ts +0 -128
- package/dist/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +0 -132
- package/dist/resources/extensions/gsd/tests/dispatch-stall-guard.test.ts +0 -126
- package/dist/resources/extensions/gsd/tests/doctor-environment.test.ts +0 -314
- package/dist/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +0 -245
- package/dist/resources/extensions/gsd/tests/doctor-git.test.ts +0 -344
- package/dist/resources/extensions/gsd/tests/doctor-proactive.test.ts +0 -278
- package/dist/resources/extensions/gsd/tests/doctor-providers.test.ts +0 -298
- package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +0 -302
- package/dist/resources/extensions/gsd/tests/doctor.test.ts +0 -652
- package/dist/resources/extensions/gsd/tests/draft-promotion.test.ts +0 -169
- package/dist/resources/extensions/gsd/tests/exit-command.test.ts +0 -50
- package/dist/resources/extensions/gsd/tests/export-html-all.test.ts +0 -105
- package/dist/resources/extensions/gsd/tests/export-html-enhancements.test.ts +0 -378
- package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +0 -144
- package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +0 -424
- package/dist/resources/extensions/gsd/tests/git-self-heal.test.ts +0 -131
- package/dist/resources/extensions/gsd/tests/git-service.test.ts +0 -1172
- package/dist/resources/extensions/gsd/tests/gsd-db.test.ts +0 -353
- package/dist/resources/extensions/gsd/tests/gsd-inspect.test.ts +0 -125
- package/dist/resources/extensions/gsd/tests/gsd-tools.test.ts +0 -326
- package/dist/resources/extensions/gsd/tests/headless-answers.test.ts +0 -340
- package/dist/resources/extensions/gsd/tests/headless-query.test.ts +0 -162
- package/dist/resources/extensions/gsd/tests/idle-recovery.test.ts +0 -485
- package/dist/resources/extensions/gsd/tests/in-flight-tool-tracking.test.ts +0 -32
- package/dist/resources/extensions/gsd/tests/init-wizard.test.ts +0 -197
- package/dist/resources/extensions/gsd/tests/integration/headless-command.ts +0 -534
- package/dist/resources/extensions/gsd/tests/integration-edge.test.ts +0 -228
- package/dist/resources/extensions/gsd/tests/integration-lifecycle.test.ts +0 -277
- package/dist/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +0 -523
- package/dist/resources/extensions/gsd/tests/key-manager.test.ts +0 -414
- package/dist/resources/extensions/gsd/tests/knowledge.test.ts +0 -161
- package/dist/resources/extensions/gsd/tests/loop-regression.test.ts +0 -877
- package/dist/resources/extensions/gsd/tests/manifest-status.test.ts +0 -283
- package/dist/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +0 -91
- package/dist/resources/extensions/gsd/tests/md-importer.test.ts +0 -410
- package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +0 -356
- package/dist/resources/extensions/gsd/tests/memory-extractor.test.ts +0 -180
- package/dist/resources/extensions/gsd/tests/memory-leak-guards.test.ts +0 -91
- package/dist/resources/extensions/gsd/tests/memory-store.test.ts +0 -345
- package/dist/resources/extensions/gsd/tests/metrics.test.ts +0 -253
- package/dist/resources/extensions/gsd/tests/migrate-command.test.ts +0 -369
- package/dist/resources/extensions/gsd/tests/migrate-parser.test.ts +0 -757
- package/dist/resources/extensions/gsd/tests/migrate-transformer.test.ts +0 -635
- package/dist/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +0 -414
- package/dist/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +0 -303
- package/dist/resources/extensions/gsd/tests/migrate-writer.test.ts +0 -398
- package/dist/resources/extensions/gsd/tests/milestone-transition-worktree.test.ts +0 -147
- package/dist/resources/extensions/gsd/tests/model-cost-table.test.ts +0 -69
- package/dist/resources/extensions/gsd/tests/model-isolation.test.ts +0 -157
- package/dist/resources/extensions/gsd/tests/model-router.test.ts +0 -167
- package/dist/resources/extensions/gsd/tests/must-have-parser.test.ts +0 -291
- package/dist/resources/extensions/gsd/tests/namespaced-registry.test.ts +0 -1027
- package/dist/resources/extensions/gsd/tests/namespaced-resolver.test.ts +0 -671
- package/dist/resources/extensions/gsd/tests/native-has-changes-cache.test.ts +0 -61
- package/dist/resources/extensions/gsd/tests/next-milestone-id.test.ts +0 -23
- package/dist/resources/extensions/gsd/tests/none-mode-gates.test.ts +0 -114
- package/dist/resources/extensions/gsd/tests/notifications.test.ts +0 -67
- package/dist/resources/extensions/gsd/tests/overrides.test.ts +0 -131
- package/dist/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +0 -331
- package/dist/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +0 -298
- package/dist/resources/extensions/gsd/tests/parallel-merge.test.ts +0 -468
- package/dist/resources/extensions/gsd/tests/parallel-orchestration.test.ts +0 -685
- package/dist/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +0 -171
- package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +0 -354
- package/dist/resources/extensions/gsd/tests/park-edge-cases.test.ts +0 -276
- package/dist/resources/extensions/gsd/tests/park-milestone.test.ts +0 -401
- package/dist/resources/extensions/gsd/tests/parsers.test.ts +0 -1704
- package/dist/resources/extensions/gsd/tests/plan-milestone.test.ts +0 -133
- package/dist/resources/extensions/gsd/tests/plan-quality-validator.test.ts +0 -363
- package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +0 -42
- package/dist/resources/extensions/gsd/tests/plugin-importer-live.test.ts +0 -481
- package/dist/resources/extensions/gsd/tests/plugin-importer.test.ts +0 -1383
- package/dist/resources/extensions/gsd/tests/post-unit-hooks.test.ts +0 -337
- package/dist/resources/extensions/gsd/tests/preferences.test.ts +0 -276
- package/dist/resources/extensions/gsd/tests/progress-score.test.ts +0 -206
- package/dist/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +0 -464
- package/dist/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +0 -314
- package/dist/resources/extensions/gsd/tests/prompt-compressor.test.ts +0 -529
- package/dist/resources/extensions/gsd/tests/prompt-db.test.ts +0 -385
- package/dist/resources/extensions/gsd/tests/prompt-ordering.test.ts +0 -296
- package/dist/resources/extensions/gsd/tests/provider-errors.test.ts +0 -338
- package/dist/resources/extensions/gsd/tests/queue-draft-detection.test.ts +0 -126
- package/dist/resources/extensions/gsd/tests/queue-order.test.ts +0 -204
- package/dist/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +0 -282
- package/dist/resources/extensions/gsd/tests/reassess-detection.test.ts +0 -154
- package/dist/resources/extensions/gsd/tests/reassess-prompt.test.ts +0 -145
- package/dist/resources/extensions/gsd/tests/regex-hardening.test.ts +0 -281
- package/dist/resources/extensions/gsd/tests/remote-questions.test.ts +0 -642
- package/dist/resources/extensions/gsd/tests/remote-status.test.ts +0 -99
- package/dist/resources/extensions/gsd/tests/replan-slice.test.ts +0 -538
- package/dist/resources/extensions/gsd/tests/requirements.test.ts +0 -106
- package/dist/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +0 -358
- package/dist/resources/extensions/gsd/tests/roadmap-slices.test.ts +0 -66
- package/dist/resources/extensions/gsd/tests/routing-history.test.ts +0 -240
- package/dist/resources/extensions/gsd/tests/run-uat.test.ts +0 -416
- package/dist/resources/extensions/gsd/tests/secure-env-collect.test.ts +0 -185
- package/dist/resources/extensions/gsd/tests/semantic-chunker.test.ts +0 -426
- package/dist/resources/extensions/gsd/tests/session-lock-regression.test.ts +0 -216
- package/dist/resources/extensions/gsd/tests/session-lock.test.ts +0 -434
- package/dist/resources/extensions/gsd/tests/skill-lifecycle.test.ts +0 -126
- package/dist/resources/extensions/gsd/tests/smart-entry-draft.test.ts +0 -123
- package/dist/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +0 -142
- package/dist/resources/extensions/gsd/tests/stop-auto-remote.test.ts +0 -156
- package/dist/resources/extensions/gsd/tests/structured-data-formatter.test.ts +0 -365
- package/dist/resources/extensions/gsd/tests/summary-distiller.test.ts +0 -323
- package/dist/resources/extensions/gsd/tests/test-helpers.ts +0 -61
- package/dist/resources/extensions/gsd/tests/token-counter.test.ts +0 -129
- package/dist/resources/extensions/gsd/tests/token-optimization-benchmark.test.ts +0 -1272
- package/dist/resources/extensions/gsd/tests/token-optimization-prefs.test.ts +0 -164
- package/dist/resources/extensions/gsd/tests/token-profile.test.ts +0 -268
- package/dist/resources/extensions/gsd/tests/token-savings.test.ts +0 -366
- package/dist/resources/extensions/gsd/tests/triage-dispatch.test.ts +0 -340
- package/dist/resources/extensions/gsd/tests/triage-resolution.test.ts +0 -416
- package/dist/resources/extensions/gsd/tests/undo.test.ts +0 -136
- package/dist/resources/extensions/gsd/tests/unique-milestone-ids.test.ts +0 -219
- package/dist/resources/extensions/gsd/tests/unit-runtime.test.ts +0 -258
- package/dist/resources/extensions/gsd/tests/update-command.test.ts +0 -67
- package/dist/resources/extensions/gsd/tests/validate-directory.test.ts +0 -222
- package/dist/resources/extensions/gsd/tests/validate-milestone.test.ts +0 -375
- package/dist/resources/extensions/gsd/tests/verification-evidence.test.ts +0 -745
- package/dist/resources/extensions/gsd/tests/verification-gate.test.ts +0 -1208
- package/dist/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +0 -145
- package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +0 -446
- package/dist/resources/extensions/gsd/tests/visualizer-overlay.test.ts +0 -237
- package/dist/resources/extensions/gsd/tests/visualizer-views.test.ts +0 -718
- package/dist/resources/extensions/gsd/tests/worker-registry.test.ts +0 -148
- package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +0 -173
- package/dist/resources/extensions/gsd/tests/workspace-index.test.ts +0 -38
- package/dist/resources/extensions/gsd/tests/worktree-bugfix.test.ts +0 -120
- package/dist/resources/extensions/gsd/tests/worktree-e2e.test.ts +0 -244
- package/dist/resources/extensions/gsd/tests/worktree-integration.test.ts +0 -207
- package/dist/resources/extensions/gsd/tests/worktree-manager.test.ts +0 -141
- package/dist/resources/extensions/gsd/tests/worktree-post-create-hook.test.ts +0 -165
- package/dist/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +0 -206
- package/dist/resources/extensions/gsd/tests/worktree.test.ts +0 -171
- package/dist/resources/extensions/gsd/tests/write-gate.test.ts +0 -211
- package/dist/resources/extensions/gsd/token-counter.ts +0 -65
- package/dist/resources/extensions/gsd/triage-resolution.ts +0 -284
- package/dist/resources/extensions/gsd/triage-ui.ts +0 -175
- package/dist/resources/extensions/gsd/types.ts +0 -425
- package/dist/resources/extensions/gsd/undo.ts +0 -223
- package/dist/resources/extensions/gsd/unit-id.ts +0 -14
- package/dist/resources/extensions/gsd/unit-runtime.ts +0 -192
- package/dist/resources/extensions/gsd/validate-directory.ts +0 -164
- package/dist/resources/extensions/gsd/verification-evidence.ts +0 -188
- package/dist/resources/extensions/gsd/verification-gate.ts +0 -643
- package/dist/resources/extensions/gsd/visualizer-data.ts +0 -866
- package/dist/resources/extensions/gsd/visualizer-overlay.ts +0 -566
- package/dist/resources/extensions/gsd/visualizer-views.ts +0 -1171
- package/dist/resources/extensions/gsd/workflow-templates.ts +0 -241
- package/dist/resources/extensions/gsd/workspace-index.ts +0 -217
- package/dist/resources/extensions/gsd/worktree-command.ts +0 -807
- package/dist/resources/extensions/gsd/worktree-manager.ts +0 -449
- package/dist/resources/extensions/gsd/worktree.ts +0 -257
- package/dist/resources/extensions/mac-tools/index.ts +0 -852
- package/dist/resources/extensions/mcp-client/index.ts +0 -459
- package/dist/resources/extensions/remote-questions/config.ts +0 -83
- package/dist/resources/extensions/remote-questions/discord-adapter.ts +0 -148
- package/dist/resources/extensions/remote-questions/format.ts +0 -315
- package/dist/resources/extensions/remote-questions/http-client.ts +0 -76
- package/dist/resources/extensions/remote-questions/manager.ts +0 -184
- package/dist/resources/extensions/remote-questions/notify.ts +0 -90
- package/dist/resources/extensions/remote-questions/remote-command.ts +0 -457
- package/dist/resources/extensions/remote-questions/slack-adapter.ts +0 -141
- package/dist/resources/extensions/remote-questions/status.ts +0 -31
- package/dist/resources/extensions/remote-questions/store.ts +0 -81
- package/dist/resources/extensions/remote-questions/telegram-adapter.ts +0 -149
- package/dist/resources/extensions/remote-questions/types.ts +0 -102
- package/dist/resources/extensions/search-the-web/cache.ts +0 -78
- package/dist/resources/extensions/search-the-web/command-search-provider.ts +0 -101
- package/dist/resources/extensions/search-the-web/format.ts +0 -258
- package/dist/resources/extensions/search-the-web/http.ts +0 -238
- package/dist/resources/extensions/search-the-web/index.ts +0 -65
- package/dist/resources/extensions/search-the-web/native-search.ts +0 -193
- package/dist/resources/extensions/search-the-web/provider.ts +0 -148
- package/dist/resources/extensions/search-the-web/tavily.ts +0 -116
- package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +0 -589
- package/dist/resources/extensions/search-the-web/tool-llm-context.ts +0 -608
- package/dist/resources/extensions/search-the-web/tool-search.ts +0 -649
- package/dist/resources/extensions/search-the-web/url-utils.ts +0 -125
- package/dist/resources/extensions/shared/confirm-ui.ts +0 -126
- package/dist/resources/extensions/shared/frontmatter.ts +0 -117
- package/dist/resources/extensions/shared/interview-ui.ts +0 -613
- package/dist/resources/extensions/shared/next-action-ui.ts +0 -212
- package/dist/resources/extensions/shared/sanitize.ts +0 -19
- package/dist/resources/extensions/shared/terminal.ts +0 -23
- package/dist/resources/extensions/shared/tests/format-utils.test.ts +0 -153
- package/dist/resources/extensions/shared/ui.ts +0 -400
- package/dist/resources/extensions/shared/wizard-ui.ts +0 -551
- package/dist/resources/extensions/slash-commands/audit.ts +0 -88
- package/dist/resources/extensions/slash-commands/clear.ts +0 -10
- package/dist/resources/extensions/slash-commands/create-extension.ts +0 -297
- package/dist/resources/extensions/slash-commands/create-slash-command.ts +0 -234
- package/dist/resources/extensions/slash-commands/index.ts +0 -12
- package/dist/resources/extensions/subagent/agents.ts +0 -126
- package/dist/resources/extensions/subagent/index.ts +0 -1121
- package/dist/resources/extensions/subagent/isolation.ts +0 -501
- package/dist/resources/extensions/subagent/worker-registry.ts +0 -99
- package/dist/resources/extensions/ttsr/index.ts +0 -168
- package/dist/resources/extensions/ttsr/rule-loader.ts +0 -74
- package/dist/resources/extensions/ttsr/ttsr-manager.ts +0 -456
- package/dist/resources/extensions/universal-config/discovery.ts +0 -104
- package/dist/resources/extensions/universal-config/format.ts +0 -191
- package/dist/resources/extensions/universal-config/index.ts +0 -120
- package/dist/resources/extensions/universal-config/scanners.ts +0 -642
- package/dist/resources/extensions/universal-config/tests/discovery.test.ts +0 -119
- package/dist/resources/extensions/universal-config/tests/format.test.ts +0 -127
- package/dist/resources/extensions/universal-config/tests/scanners.test.ts +0 -456
- package/dist/resources/extensions/universal-config/tools.ts +0 -60
- package/dist/resources/extensions/universal-config/types.ts +0 -135
- package/dist/resources/extensions/voice/index.ts +0 -272
- package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +0 -51
- package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +0 -143
- package/src/resources/extensions/gsd/auto-constants.ts +0 -6
- package/src/resources/extensions/gsd/auto-idempotency.ts +0 -151
- package/src/resources/extensions/gsd/auto-stuck-detection.ts +0 -221
- package/src/resources/extensions/gsd/mechanical-completion.ts +0 -430
- package/src/resources/extensions/gsd/tests/auto-dispatch-loop.test.ts +0 -691
- package/src/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +0 -127
- package/src/resources/extensions/gsd/tests/auto-skip-loop.test.ts +0 -123
- package/src/resources/extensions/gsd/tests/dispatch-stall-guard.test.ts +0 -126
- package/src/resources/extensions/gsd/tests/loop-regression.test.ts +0 -877
- package/src/resources/extensions/gsd/tests/mechanical-completion.test.ts +0 -356
- package/src/resources/extensions/gsd/tests/progress-score.test.ts +0 -206
- package/src/resources/extensions/gsd/tests/session-lock.test.ts +0 -434
|
@@ -1,1041 +0,0 @@
|
|
|
1
|
-
// Native Git Bridge
|
|
2
|
-
// Provides high-performance git operations backed by libgit2 via the Rust native module.
|
|
3
|
-
// Falls back to execSync/execFileSync git commands when the native module is unavailable.
|
|
4
|
-
//
|
|
5
|
-
// Both READ and WRITE operations are native — push operations remain as
|
|
6
|
-
// execSync calls because git2 credential handling is too complex.
|
|
7
|
-
|
|
8
|
-
import { execSync, execFileSync } from "node:child_process";
|
|
9
|
-
import { existsSync, readFileSync, unlinkSync, rmSync } from "node:fs";
|
|
10
|
-
import { join } from "node:path";
|
|
11
|
-
import { GSDError, GSD_GIT_ERROR } from "./errors.js";
|
|
12
|
-
import { GIT_NO_PROMPT_ENV } from "./git-constants.js";
|
|
13
|
-
import { getErrorMessage } from "./error-utils.js";
|
|
14
|
-
|
|
15
|
-
// Issue #453: keep auto-mode bookkeeping on the stable git CLI path unless a
|
|
16
|
-
// caller explicitly opts into the native helper.
|
|
17
|
-
const NATIVE_GSD_GIT_ENABLED = process.env.GSD_ENABLE_NATIVE_GSD_GIT === "1";
|
|
18
|
-
|
|
19
|
-
// ─── Native Module Types ──────────────────────────────────────────────────
|
|
20
|
-
|
|
21
|
-
interface GitDiffStat {
|
|
22
|
-
filesChanged: number;
|
|
23
|
-
insertions: number;
|
|
24
|
-
deletions: number;
|
|
25
|
-
summary: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface GitNameStatus {
|
|
29
|
-
status: string;
|
|
30
|
-
path: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface GitNumstat {
|
|
34
|
-
added: number;
|
|
35
|
-
removed: number;
|
|
36
|
-
path: string;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
interface GitLogEntry {
|
|
40
|
-
sha: string;
|
|
41
|
-
message: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
interface GitWorktreeEntry {
|
|
45
|
-
path: string;
|
|
46
|
-
branch: string;
|
|
47
|
-
isBare: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface GitBatchInfo {
|
|
51
|
-
branch: string;
|
|
52
|
-
hasChanges: boolean;
|
|
53
|
-
status: string;
|
|
54
|
-
stagedCount: number;
|
|
55
|
-
unstagedCount: number;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
interface GitMergeResult {
|
|
59
|
-
success: boolean;
|
|
60
|
-
conflicts: string[];
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ─── Native Module Loading ──────────────────────────────────────────────────
|
|
64
|
-
|
|
65
|
-
let nativeModule: {
|
|
66
|
-
// Existing read functions
|
|
67
|
-
gitCurrentBranch: (repoPath: string) => string | null;
|
|
68
|
-
gitMainBranch: (repoPath: string) => string;
|
|
69
|
-
gitBranchExists: (repoPath: string, branch: string) => boolean;
|
|
70
|
-
gitHasMergeConflicts: (repoPath: string) => boolean;
|
|
71
|
-
gitWorkingTreeStatus: (repoPath: string) => string;
|
|
72
|
-
gitHasChanges: (repoPath: string) => boolean;
|
|
73
|
-
gitCommitCountBetween: (repoPath: string, fromRef: string, toRef: string) => number;
|
|
74
|
-
// New read functions
|
|
75
|
-
gitIsRepo: (path: string) => boolean;
|
|
76
|
-
gitHasStagedChanges: (repoPath: string) => boolean;
|
|
77
|
-
gitDiffStat: (repoPath: string, fromRef: string, toRef: string) => GitDiffStat;
|
|
78
|
-
gitDiffNameStatus: (repoPath: string, fromRef: string, toRef: string, pathspec?: string, useMergeBase?: boolean) => GitNameStatus[];
|
|
79
|
-
gitDiffNumstat: (repoPath: string, fromRef: string, toRef: string) => GitNumstat[];
|
|
80
|
-
gitDiffContent: (repoPath: string, fromRef: string, toRef: string, pathspec?: string, exclude?: string, useMergeBase?: boolean) => string;
|
|
81
|
-
gitLogOneline: (repoPath: string, fromRef: string, toRef: string) => GitLogEntry[];
|
|
82
|
-
gitWorktreeList: (repoPath: string) => GitWorktreeEntry[];
|
|
83
|
-
gitBranchList: (repoPath: string, pattern?: string) => string[];
|
|
84
|
-
gitBranchListMerged: (repoPath: string, target: string, pattern?: string) => string[];
|
|
85
|
-
gitLsFiles: (repoPath: string, pathspec: string) => string[];
|
|
86
|
-
gitForEachRef: (repoPath: string, prefix: string) => string[];
|
|
87
|
-
gitConflictFiles: (repoPath: string) => string[];
|
|
88
|
-
gitBatchInfo: (repoPath: string) => GitBatchInfo;
|
|
89
|
-
// Write functions
|
|
90
|
-
gitInit: (path: string, initialBranch?: string) => void;
|
|
91
|
-
gitAddAll: (repoPath: string) => void;
|
|
92
|
-
gitAddPaths: (repoPath: string, paths: string[]) => void;
|
|
93
|
-
gitResetPaths: (repoPath: string, paths: string[]) => void;
|
|
94
|
-
gitCommit: (repoPath: string, message: string, allowEmpty?: boolean) => string;
|
|
95
|
-
gitCheckoutBranch: (repoPath: string, branch: string) => void;
|
|
96
|
-
gitCheckoutTheirs: (repoPath: string, paths: string[]) => void;
|
|
97
|
-
gitMergeSquash: (repoPath: string, branch: string) => GitMergeResult;
|
|
98
|
-
gitMergeAbort: (repoPath: string) => void;
|
|
99
|
-
gitRebaseAbort: (repoPath: string) => void;
|
|
100
|
-
gitResetHard: (repoPath: string) => void;
|
|
101
|
-
gitBranchDelete: (repoPath: string, branch: string, force?: boolean) => void;
|
|
102
|
-
gitBranchForceReset: (repoPath: string, branch: string, target: string) => void;
|
|
103
|
-
gitRmCached: (repoPath: string, paths: string[], recursive?: boolean) => string[];
|
|
104
|
-
gitRmForce: (repoPath: string, paths: string[]) => void;
|
|
105
|
-
gitWorktreeAdd: (repoPath: string, wtPath: string, branch: string, createBranch?: boolean, startPoint?: string) => void;
|
|
106
|
-
gitWorktreeRemove: (repoPath: string, wtPath: string, force?: boolean) => void;
|
|
107
|
-
gitWorktreePrune: (repoPath: string) => void;
|
|
108
|
-
gitRevertCommit: (repoPath: string, sha: string) => void;
|
|
109
|
-
gitRevertAbort: (repoPath: string) => void;
|
|
110
|
-
gitUpdateRef: (repoPath: string, refname: string, target?: string) => void;
|
|
111
|
-
} | null = null;
|
|
112
|
-
|
|
113
|
-
let loadAttempted = false;
|
|
114
|
-
|
|
115
|
-
function loadNative(): typeof nativeModule {
|
|
116
|
-
if (loadAttempted) return nativeModule;
|
|
117
|
-
loadAttempted = true;
|
|
118
|
-
if (!NATIVE_GSD_GIT_ENABLED) return nativeModule;
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
122
|
-
const mod = require("@gsd/native");
|
|
123
|
-
if (mod.gitCurrentBranch && mod.gitHasChanges) {
|
|
124
|
-
nativeModule = mod;
|
|
125
|
-
}
|
|
126
|
-
} catch {
|
|
127
|
-
// Native module not available — all functions fall back to git CLI
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return nativeModule;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// ─── Fallback Helpers ──────────────────────────────────────────────────────
|
|
134
|
-
|
|
135
|
-
/** Run a git command via execFileSync. Returns trimmed stdout. */
|
|
136
|
-
function gitExec(basePath: string, args: string[], allowFailure = false): string {
|
|
137
|
-
try {
|
|
138
|
-
return execFileSync("git", args, {
|
|
139
|
-
cwd: basePath,
|
|
140
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
141
|
-
encoding: "utf-8",
|
|
142
|
-
env: GIT_NO_PROMPT_ENV,
|
|
143
|
-
}).trim();
|
|
144
|
-
} catch {
|
|
145
|
-
if (allowFailure) return "";
|
|
146
|
-
throw new GSDError(GSD_GIT_ERROR, `git ${args.join(" ")} failed in ${basePath}`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/** Run a git command via execFileSync. Returns trimmed stdout. */
|
|
151
|
-
function gitFileExec(basePath: string, args: string[], allowFailure = false): string {
|
|
152
|
-
try {
|
|
153
|
-
return execFileSync("git", args, {
|
|
154
|
-
cwd: basePath,
|
|
155
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
156
|
-
encoding: "utf-8",
|
|
157
|
-
env: GIT_NO_PROMPT_ENV,
|
|
158
|
-
}).trim();
|
|
159
|
-
} catch {
|
|
160
|
-
if (allowFailure) return "";
|
|
161
|
-
throw new GSDError(GSD_GIT_ERROR, `git ${args.join(" ")} failed in ${basePath}`);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// ─── Existing Read Functions ──────────────────────────────────────────────
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Get the current branch name.
|
|
169
|
-
* Native: reads HEAD symbolic ref via libgit2.
|
|
170
|
-
* Fallback: `git branch --show-current`.
|
|
171
|
-
*/
|
|
172
|
-
export function nativeGetCurrentBranch(basePath: string): string {
|
|
173
|
-
const native = loadNative();
|
|
174
|
-
if (native) {
|
|
175
|
-
const branch = native.gitCurrentBranch(basePath);
|
|
176
|
-
return branch ?? "";
|
|
177
|
-
}
|
|
178
|
-
return gitExec(basePath, ["branch", "--show-current"]);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Detect the repo-level main branch (origin/HEAD → main → master → current).
|
|
183
|
-
* Native: checks refs via libgit2.
|
|
184
|
-
* Fallback: `git symbolic-ref` + `git show-ref` chain.
|
|
185
|
-
*/
|
|
186
|
-
export function nativeDetectMainBranch(basePath: string): string {
|
|
187
|
-
const native = loadNative();
|
|
188
|
-
if (native) {
|
|
189
|
-
return native.gitMainBranch(basePath);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const symbolic = gitExec(basePath, ["symbolic-ref", "refs/remotes/origin/HEAD"], true);
|
|
193
|
-
if (symbolic) {
|
|
194
|
-
const match = symbolic.match(/refs\/remotes\/origin\/(.+)$/);
|
|
195
|
-
if (match) return match[1]!;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const mainExists = gitExec(basePath, ["show-ref", "--verify", "refs/heads/main"], true);
|
|
199
|
-
if (mainExists) return "main";
|
|
200
|
-
|
|
201
|
-
const masterExists = gitExec(basePath, ["show-ref", "--verify", "refs/heads/master"], true);
|
|
202
|
-
if (masterExists) return "master";
|
|
203
|
-
|
|
204
|
-
return gitExec(basePath, ["branch", "--show-current"]);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Check if a local branch exists.
|
|
209
|
-
* Native: checks refs/heads/<name> via libgit2.
|
|
210
|
-
* Fallback: `git show-ref --verify`.
|
|
211
|
-
*/
|
|
212
|
-
export function nativeBranchExists(basePath: string, branch: string): boolean {
|
|
213
|
-
const native = loadNative();
|
|
214
|
-
if (native) {
|
|
215
|
-
return native.gitBranchExists(basePath, branch);
|
|
216
|
-
}
|
|
217
|
-
const result = gitExec(basePath, ["show-ref", "--verify", `refs/heads/${branch}`], true);
|
|
218
|
-
return result !== "";
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Check if the index has unmerged entries (merge conflicts).
|
|
223
|
-
* Native: reads index conflict state via libgit2.
|
|
224
|
-
* Fallback: `git diff --name-only --diff-filter=U`.
|
|
225
|
-
*/
|
|
226
|
-
export function nativeHasMergeConflicts(basePath: string): boolean {
|
|
227
|
-
const native = loadNative();
|
|
228
|
-
if (native) {
|
|
229
|
-
return native.gitHasMergeConflicts(basePath);
|
|
230
|
-
}
|
|
231
|
-
const result = gitExec(basePath, ["diff", "--name-only", "--diff-filter=U"], true);
|
|
232
|
-
return result !== "";
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Get working tree status (porcelain format).
|
|
237
|
-
* Native: reads status via libgit2.
|
|
238
|
-
* Fallback: `git status --porcelain`.
|
|
239
|
-
*/
|
|
240
|
-
export function nativeWorkingTreeStatus(basePath: string): string {
|
|
241
|
-
const native = loadNative();
|
|
242
|
-
if (native) {
|
|
243
|
-
return native.gitWorkingTreeStatus(basePath);
|
|
244
|
-
}
|
|
245
|
-
return gitExec(basePath, ["status", "--porcelain"], true);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// ─── nativeHasChanges fallback cache (10s TTL) ─────────────────────────
|
|
249
|
-
let _hasChangesCachedResult: boolean = false;
|
|
250
|
-
let _hasChangesCachedAt: number = 0;
|
|
251
|
-
let _hasChangesCachedPath: string = "";
|
|
252
|
-
const HAS_CHANGES_CACHE_TTL_MS = 10_000; // 10 seconds
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Quick check: any staged or unstaged changes?
|
|
256
|
-
* Native: libgit2 status check (single syscall).
|
|
257
|
-
* Fallback: `git status --short` (cached for 10s per basePath).
|
|
258
|
-
*/
|
|
259
|
-
export function nativeHasChanges(basePath: string): boolean {
|
|
260
|
-
const native = loadNative();
|
|
261
|
-
if (native) {
|
|
262
|
-
return native.gitHasChanges(basePath);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const now = Date.now();
|
|
266
|
-
if (
|
|
267
|
-
basePath === _hasChangesCachedPath &&
|
|
268
|
-
now - _hasChangesCachedAt < HAS_CHANGES_CACHE_TTL_MS
|
|
269
|
-
) {
|
|
270
|
-
return _hasChangesCachedResult;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
const result = gitExec(basePath, ["status", "--short"], true);
|
|
274
|
-
const hasChanges = result !== "";
|
|
275
|
-
|
|
276
|
-
_hasChangesCachedResult = hasChanges;
|
|
277
|
-
_hasChangesCachedAt = now;
|
|
278
|
-
_hasChangesCachedPath = basePath;
|
|
279
|
-
|
|
280
|
-
return hasChanges;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/** Reset the nativeHasChanges fallback cache (exported for testing). */
|
|
284
|
-
export function _resetHasChangesCache(): void {
|
|
285
|
-
_hasChangesCachedResult = false;
|
|
286
|
-
_hasChangesCachedAt = 0;
|
|
287
|
-
_hasChangesCachedPath = "";
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Count commits between two refs (from..to).
|
|
292
|
-
* Native: libgit2 revwalk.
|
|
293
|
-
* Fallback: `git rev-list --count from..to`.
|
|
294
|
-
*/
|
|
295
|
-
export function nativeCommitCountBetween(basePath: string, fromRef: string, toRef: string): number {
|
|
296
|
-
const native = loadNative();
|
|
297
|
-
if (native) {
|
|
298
|
-
return native.gitCommitCountBetween(basePath, fromRef, toRef);
|
|
299
|
-
}
|
|
300
|
-
const result = gitExec(basePath, ["rev-list", "--count", `${fromRef}..${toRef}`], true);
|
|
301
|
-
return parseInt(result, 10) || 0;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// ─── New Read Functions ──────────────────────────────────────────────────
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Check if a path is inside a git repository.
|
|
308
|
-
* Native: Repository::open() check.
|
|
309
|
-
* Fallback: `git rev-parse --git-dir`.
|
|
310
|
-
*/
|
|
311
|
-
export function nativeIsRepo(basePath: string): boolean {
|
|
312
|
-
const native = loadNative();
|
|
313
|
-
if (native) {
|
|
314
|
-
return native.gitIsRepo(basePath);
|
|
315
|
-
}
|
|
316
|
-
try {
|
|
317
|
-
execSync("git rev-parse --git-dir", { cwd: basePath, stdio: "pipe" });
|
|
318
|
-
return true;
|
|
319
|
-
} catch {
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Check if there are staged changes (index differs from HEAD).
|
|
326
|
-
* Native: libgit2 tree-to-index diff.
|
|
327
|
-
* Fallback: `git diff --cached --stat`.
|
|
328
|
-
*/
|
|
329
|
-
export function nativeHasStagedChanges(basePath: string): boolean {
|
|
330
|
-
const native = loadNative();
|
|
331
|
-
if (native) {
|
|
332
|
-
return native.gitHasStagedChanges(basePath);
|
|
333
|
-
}
|
|
334
|
-
const result = gitExec(basePath, ["diff", "--cached", "--stat"], true);
|
|
335
|
-
return result !== "";
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Get diff statistics.
|
|
340
|
-
* Use fromRef="HEAD", toRef="WORKDIR" for working tree diff.
|
|
341
|
-
* Use fromRef="HEAD", toRef="INDEX" for staged diff.
|
|
342
|
-
* Native: libgit2 diff stats.
|
|
343
|
-
* Fallback: `git diff --stat`.
|
|
344
|
-
*/
|
|
345
|
-
export function nativeDiffStat(basePath: string, fromRef: string, toRef: string): GitDiffStat {
|
|
346
|
-
const native = loadNative();
|
|
347
|
-
if (native) {
|
|
348
|
-
return native.gitDiffStat(basePath, fromRef, toRef);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Fallback
|
|
352
|
-
let args: string[];
|
|
353
|
-
if (fromRef === "HEAD" && toRef === "WORKDIR") {
|
|
354
|
-
args = ["diff", "--stat", "HEAD"];
|
|
355
|
-
} else if (fromRef === "HEAD" && toRef === "INDEX") {
|
|
356
|
-
args = ["diff", "--stat", "--cached", "HEAD"];
|
|
357
|
-
} else {
|
|
358
|
-
args = ["diff", "--stat", fromRef, toRef];
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
const result = gitExec(basePath, args, true);
|
|
362
|
-
// Parse numeric stats from the summary line (e.g. "3 files changed, 10 insertions(+), 2 deletions(-)")
|
|
363
|
-
let filesChanged = 0, insertions = 0, deletions = 0;
|
|
364
|
-
const statsMatch = result.match(/(\d+) files? changed(?:, (\d+) insertions?\(\+\))?(?:, (\d+) deletions?\(-\))?/);
|
|
365
|
-
if (statsMatch) {
|
|
366
|
-
filesChanged = parseInt(statsMatch[1] ?? "0", 10);
|
|
367
|
-
insertions = parseInt(statsMatch[2] ?? "0", 10);
|
|
368
|
-
deletions = parseInt(statsMatch[3] ?? "0", 10);
|
|
369
|
-
}
|
|
370
|
-
return { filesChanged, insertions, deletions, summary: result };
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Get name-status diff between two refs with optional pathspec filter.
|
|
375
|
-
* useMergeBase: if true, uses three-dot semantics (main...branch).
|
|
376
|
-
* Native: libgit2 tree-to-tree diff.
|
|
377
|
-
* Fallback: `git diff --name-status`.
|
|
378
|
-
*/
|
|
379
|
-
export function nativeDiffNameStatus(
|
|
380
|
-
basePath: string,
|
|
381
|
-
fromRef: string,
|
|
382
|
-
toRef: string,
|
|
383
|
-
pathspec?: string,
|
|
384
|
-
useMergeBase?: boolean,
|
|
385
|
-
): GitNameStatus[] {
|
|
386
|
-
const native = loadNative();
|
|
387
|
-
if (native) {
|
|
388
|
-
return native.gitDiffNameStatus(basePath, fromRef, toRef, pathspec, useMergeBase);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// Fallback
|
|
392
|
-
const separator = useMergeBase ? "..." : " ";
|
|
393
|
-
const args = ["diff", "--name-status", `${fromRef}${separator}${toRef}`];
|
|
394
|
-
if (pathspec) args.push("--", pathspec);
|
|
395
|
-
|
|
396
|
-
const result = gitExec(basePath, args, true);
|
|
397
|
-
if (!result) return [];
|
|
398
|
-
|
|
399
|
-
return result.split("\n").filter(Boolean).map(line => {
|
|
400
|
-
const [status, ...pathParts] = line.split("\t");
|
|
401
|
-
return { status: status ?? "", path: pathParts.join("\t") };
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* Get numstat diff between two refs.
|
|
407
|
-
* Native: libgit2 patch line stats.
|
|
408
|
-
* Fallback: `git diff --numstat`.
|
|
409
|
-
*/
|
|
410
|
-
export function nativeDiffNumstat(basePath: string, fromRef: string, toRef: string): GitNumstat[] {
|
|
411
|
-
const native = loadNative();
|
|
412
|
-
if (native) {
|
|
413
|
-
return native.gitDiffNumstat(basePath, fromRef, toRef);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
const result = gitExec(basePath, ["diff", "--numstat", fromRef, toRef], true);
|
|
417
|
-
if (!result) return [];
|
|
418
|
-
|
|
419
|
-
return result.split("\n").filter(Boolean).map(line => {
|
|
420
|
-
const [a, r, ...pathParts] = line.split("\t");
|
|
421
|
-
return {
|
|
422
|
-
added: a === "-" ? 0 : parseInt(a ?? "0", 10),
|
|
423
|
-
removed: r === "-" ? 0 : parseInt(r ?? "0", 10),
|
|
424
|
-
path: pathParts.join("\t"),
|
|
425
|
-
};
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* Get unified diff content between two refs.
|
|
431
|
-
* useMergeBase: if true, uses three-dot semantics.
|
|
432
|
-
* Native: libgit2 diff print.
|
|
433
|
-
* Fallback: `git diff`.
|
|
434
|
-
*/
|
|
435
|
-
export function nativeDiffContent(
|
|
436
|
-
basePath: string,
|
|
437
|
-
fromRef: string,
|
|
438
|
-
toRef: string,
|
|
439
|
-
pathspec?: string,
|
|
440
|
-
exclude?: string,
|
|
441
|
-
useMergeBase?: boolean,
|
|
442
|
-
): string {
|
|
443
|
-
const native = loadNative();
|
|
444
|
-
if (native) {
|
|
445
|
-
return native.gitDiffContent(basePath, fromRef, toRef, pathspec, exclude, useMergeBase);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const separator = useMergeBase ? "..." : " ";
|
|
449
|
-
const args = ["diff", `${fromRef}${separator}${toRef}`];
|
|
450
|
-
if (pathspec) {
|
|
451
|
-
args.push("--", pathspec);
|
|
452
|
-
} else if (exclude) {
|
|
453
|
-
args.push("--", ".", `:(exclude)${exclude}`);
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return gitExec(basePath, args, true);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
* Get commit log between two refs (from..to).
|
|
461
|
-
* Native: libgit2 revwalk.
|
|
462
|
-
* Fallback: `git log --oneline from..to`.
|
|
463
|
-
*/
|
|
464
|
-
export function nativeLogOneline(basePath: string, fromRef: string, toRef: string): GitLogEntry[] {
|
|
465
|
-
const native = loadNative();
|
|
466
|
-
if (native) {
|
|
467
|
-
return native.gitLogOneline(basePath, fromRef, toRef);
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
const result = gitExec(basePath, ["log", "--oneline", `${fromRef}..${toRef}`], true);
|
|
471
|
-
if (!result) return [];
|
|
472
|
-
|
|
473
|
-
return result.split("\n").filter(Boolean).map(line => {
|
|
474
|
-
const sha = line.substring(0, 7);
|
|
475
|
-
const message = line.substring(8);
|
|
476
|
-
return { sha, message };
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* List git worktrees.
|
|
482
|
-
* Native: libgit2 worktree API.
|
|
483
|
-
* Fallback: `git worktree list --porcelain`.
|
|
484
|
-
*/
|
|
485
|
-
export function nativeWorktreeList(basePath: string): GitWorktreeEntry[] {
|
|
486
|
-
const native = loadNative();
|
|
487
|
-
if (native) {
|
|
488
|
-
return native.gitWorktreeList(basePath);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
const result = gitExec(basePath, ["worktree", "list", "--porcelain"], true);
|
|
492
|
-
if (!result) return [];
|
|
493
|
-
|
|
494
|
-
const entries: GitWorktreeEntry[] = [];
|
|
495
|
-
const blocks = result.replaceAll("\r\n", "\n").split("\n\n").filter(Boolean);
|
|
496
|
-
|
|
497
|
-
for (const block of blocks) {
|
|
498
|
-
const lines = block.split("\n");
|
|
499
|
-
const wtLine = lines.find(l => l.startsWith("worktree "));
|
|
500
|
-
const branchLine = lines.find(l => l.startsWith("branch "));
|
|
501
|
-
const isBare = lines.some(l => l === "bare");
|
|
502
|
-
|
|
503
|
-
if (wtLine) {
|
|
504
|
-
entries.push({
|
|
505
|
-
path: wtLine.replace("worktree ", ""),
|
|
506
|
-
branch: branchLine ? branchLine.replace("branch refs/heads/", "") : "",
|
|
507
|
-
isBare,
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return entries;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* List branches matching an optional pattern.
|
|
517
|
-
* Native: libgit2 branch iterator.
|
|
518
|
-
* Fallback: `git branch --list <pattern>`.
|
|
519
|
-
*/
|
|
520
|
-
export function nativeBranchList(basePath: string, pattern?: string): string[] {
|
|
521
|
-
const native = loadNative();
|
|
522
|
-
if (native) {
|
|
523
|
-
return native.gitBranchList(basePath, pattern);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
const args = ["branch", "--list"];
|
|
527
|
-
if (pattern) args.push(pattern);
|
|
528
|
-
|
|
529
|
-
const result = gitFileExec(basePath, args, true);
|
|
530
|
-
if (!result) return [];
|
|
531
|
-
|
|
532
|
-
return result.split("\n").map(b => b.trim().replace(/^\* /, "")).filter(Boolean);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* List branches merged into target.
|
|
537
|
-
* Native: libgit2 merge-base check.
|
|
538
|
-
* Fallback: `git branch --merged <target> --list <pattern>`.
|
|
539
|
-
*/
|
|
540
|
-
export function nativeBranchListMerged(basePath: string, target: string, pattern?: string): string[] {
|
|
541
|
-
const native = loadNative();
|
|
542
|
-
if (native) {
|
|
543
|
-
return native.gitBranchListMerged(basePath, target, pattern);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
const args = ["branch", "--merged", target];
|
|
547
|
-
if (pattern) args.push("--list", pattern);
|
|
548
|
-
|
|
549
|
-
const result = gitFileExec(basePath, args, true);
|
|
550
|
-
if (!result) return [];
|
|
551
|
-
|
|
552
|
-
return result.split("\n").map(b => b.trim()).filter(Boolean);
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* List tracked files matching a pathspec.
|
|
557
|
-
* Native: libgit2 index iteration.
|
|
558
|
-
* Fallback: `git ls-files <pathspec>`.
|
|
559
|
-
*/
|
|
560
|
-
export function nativeLsFiles(basePath: string, pathspec: string): string[] {
|
|
561
|
-
const native = loadNative();
|
|
562
|
-
if (native) {
|
|
563
|
-
return native.gitLsFiles(basePath, pathspec);
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
const result = gitFileExec(basePath, ["ls-files", pathspec], true);
|
|
567
|
-
if (!result) return [];
|
|
568
|
-
return result.split("\n").filter(Boolean);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* List references matching a prefix.
|
|
573
|
-
* Native: libgit2 references_glob.
|
|
574
|
-
* Fallback: `git for-each-ref <prefix> --format=%(refname)`.
|
|
575
|
-
*/
|
|
576
|
-
export function nativeForEachRef(basePath: string, prefix: string): string[] {
|
|
577
|
-
const native = loadNative();
|
|
578
|
-
if (native) {
|
|
579
|
-
return native.gitForEachRef(basePath, prefix);
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
const result = gitFileExec(basePath, ["for-each-ref", prefix, "--format=%(refname)"], true);
|
|
583
|
-
if (!result) return [];
|
|
584
|
-
return result.split("\n").filter(Boolean);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Get list of files with unmerged (conflict) entries.
|
|
589
|
-
* Native: libgit2 index conflicts.
|
|
590
|
-
* Fallback: `git diff --name-only --diff-filter=U`.
|
|
591
|
-
*/
|
|
592
|
-
export function nativeConflictFiles(basePath: string): string[] {
|
|
593
|
-
const native = loadNative();
|
|
594
|
-
if (native) {
|
|
595
|
-
return native.gitConflictFiles(basePath);
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
const result = gitExec(basePath, ["diff", "--name-only", "--diff-filter=U"], true);
|
|
599
|
-
if (!result) return [];
|
|
600
|
-
return result.split("\n").filter(Boolean);
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
/**
|
|
604
|
-
* Get batch info: branch + status + change counts in ONE call.
|
|
605
|
-
* Native: single libgit2 call replaces 3-4 sequential execSync calls.
|
|
606
|
-
* Fallback: multiple git commands.
|
|
607
|
-
*/
|
|
608
|
-
export function nativeBatchInfo(basePath: string): GitBatchInfo {
|
|
609
|
-
const native = loadNative();
|
|
610
|
-
if (native) {
|
|
611
|
-
return native.gitBatchInfo(basePath);
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
const branch = gitExec(basePath, ["branch", "--show-current"], true);
|
|
615
|
-
const status = gitExec(basePath, ["status", "--porcelain"], true);
|
|
616
|
-
const hasChanges = status !== "";
|
|
617
|
-
|
|
618
|
-
// Parse porcelain status to count staged vs unstaged changes
|
|
619
|
-
let stagedCount = 0;
|
|
620
|
-
let unstagedCount = 0;
|
|
621
|
-
if (status) {
|
|
622
|
-
for (const line of status.split("\n")) {
|
|
623
|
-
if (!line || line.length < 2) continue;
|
|
624
|
-
const x = line[0]; // index (staged) status
|
|
625
|
-
const y = line[1]; // worktree (unstaged) status
|
|
626
|
-
if (x !== " " && x !== "?") stagedCount++;
|
|
627
|
-
if (y !== " " && y !== "?") unstagedCount++;
|
|
628
|
-
if (x === "?" && y === "?") unstagedCount++; // untracked files
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
return {
|
|
633
|
-
branch,
|
|
634
|
-
hasChanges,
|
|
635
|
-
status,
|
|
636
|
-
stagedCount,
|
|
637
|
-
unstagedCount,
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// ─── Write Functions ──────────────────────────────────────────────────────
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Initialize a new git repository.
|
|
645
|
-
* Native: libgit2 Repository::init.
|
|
646
|
-
* Fallback: `git init -b <branch>`.
|
|
647
|
-
*/
|
|
648
|
-
export function nativeInit(basePath: string, initialBranch?: string): void {
|
|
649
|
-
const native = loadNative();
|
|
650
|
-
if (native) {
|
|
651
|
-
native.gitInit(basePath, initialBranch);
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
const args = ["init"];
|
|
656
|
-
if (initialBranch) args.push("-b", initialBranch);
|
|
657
|
-
gitFileExec(basePath, args);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* Stage all files (git add -A).
|
|
662
|
-
* Native: libgit2 index add_all + update_all.
|
|
663
|
-
* Fallback: `git add -A`.
|
|
664
|
-
*/
|
|
665
|
-
export function nativeAddAll(basePath: string): void {
|
|
666
|
-
const native = loadNative();
|
|
667
|
-
if (native) {
|
|
668
|
-
native.gitAddAll(basePath);
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
gitFileExec(basePath, ["add", "-A"]);
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Stage specific files.
|
|
676
|
-
* Native: libgit2 index add.
|
|
677
|
-
* Fallback: `git add -- <paths>`.
|
|
678
|
-
*/
|
|
679
|
-
export function nativeAddPaths(basePath: string, paths: string[]): void {
|
|
680
|
-
const native = loadNative();
|
|
681
|
-
if (native) {
|
|
682
|
-
native.gitAddPaths(basePath, paths);
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
gitFileExec(basePath, ["add", "--", ...paths]);
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* Unstage files (reset index entries to HEAD).
|
|
690
|
-
* Native: libgit2 reset_default.
|
|
691
|
-
* Fallback: `git reset HEAD -- <paths>`.
|
|
692
|
-
*/
|
|
693
|
-
export function nativeResetPaths(basePath: string, paths: string[]): void {
|
|
694
|
-
const native = loadNative();
|
|
695
|
-
if (native) {
|
|
696
|
-
native.gitResetPaths(basePath, paths);
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
for (const p of paths) {
|
|
700
|
-
gitExec(basePath, ["reset", "HEAD", "--", p], true);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
/**
|
|
705
|
-
* Create a commit from the current index.
|
|
706
|
-
* Returns the commit SHA on success, or null if nothing to commit.
|
|
707
|
-
* Native: libgit2 commit create.
|
|
708
|
-
* Fallback: `git commit --no-verify -F -`.
|
|
709
|
-
*/
|
|
710
|
-
export function nativeCommit(
|
|
711
|
-
basePath: string,
|
|
712
|
-
message: string,
|
|
713
|
-
options?: { allowEmpty?: boolean; input?: string },
|
|
714
|
-
): string | null {
|
|
715
|
-
const native = loadNative();
|
|
716
|
-
if (native) {
|
|
717
|
-
try {
|
|
718
|
-
return native.gitCommit(basePath, message, options?.allowEmpty);
|
|
719
|
-
} catch (e) {
|
|
720
|
-
const msg = getErrorMessage(e);
|
|
721
|
-
if (msg.includes("nothing to commit")) return null;
|
|
722
|
-
throw e;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
// Fallback: use git commit with stdin pipe for safe multi-line messages
|
|
727
|
-
try {
|
|
728
|
-
const result = execSync(
|
|
729
|
-
`git commit --no-verify -F -${options?.allowEmpty ? " --allow-empty" : ""}`,
|
|
730
|
-
{
|
|
731
|
-
cwd: basePath,
|
|
732
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
733
|
-
encoding: "utf-8",
|
|
734
|
-
env: GIT_NO_PROMPT_ENV,
|
|
735
|
-
input: message,
|
|
736
|
-
},
|
|
737
|
-
).trim();
|
|
738
|
-
return result;
|
|
739
|
-
} catch (err: unknown) {
|
|
740
|
-
const errObj = err as { stdout?: string; stderr?: string; message?: string };
|
|
741
|
-
const combined = [errObj.stdout, errObj.stderr, errObj.message].filter(Boolean).join(" ");
|
|
742
|
-
if (combined.includes("nothing to commit") || combined.includes("nothing added to commit") || combined.includes("no changes added")) {
|
|
743
|
-
return null;
|
|
744
|
-
}
|
|
745
|
-
throw err;
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
/**
|
|
750
|
-
* Checkout a branch (switch HEAD and update working tree).
|
|
751
|
-
* Native: libgit2 checkout + set_head.
|
|
752
|
-
* Fallback: `git checkout <branch>`.
|
|
753
|
-
*/
|
|
754
|
-
export function nativeCheckoutBranch(basePath: string, branch: string): void {
|
|
755
|
-
const native = loadNative();
|
|
756
|
-
if (native) {
|
|
757
|
-
native.gitCheckoutBranch(basePath, branch);
|
|
758
|
-
return;
|
|
759
|
-
}
|
|
760
|
-
execSync(`git checkout ${branch}`, {
|
|
761
|
-
cwd: basePath,
|
|
762
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
763
|
-
encoding: "utf-8",
|
|
764
|
-
});
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
/**
|
|
768
|
-
* Resolve index conflicts by accepting "theirs" version.
|
|
769
|
-
* Native: libgit2 index conflict resolution.
|
|
770
|
-
* Fallback: `git checkout --theirs -- <file>`.
|
|
771
|
-
*/
|
|
772
|
-
export function nativeCheckoutTheirs(basePath: string, paths: string[]): void {
|
|
773
|
-
const native = loadNative();
|
|
774
|
-
if (native) {
|
|
775
|
-
native.gitCheckoutTheirs(basePath, paths);
|
|
776
|
-
return;
|
|
777
|
-
}
|
|
778
|
-
for (const path of paths) {
|
|
779
|
-
gitFileExec(basePath, ["checkout", "--theirs", "--", path]);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Squash-merge a branch (stages changes, does NOT commit).
|
|
785
|
-
* Native: libgit2 merge with squash semantics.
|
|
786
|
-
* Fallback: `git merge --squash <branch>`.
|
|
787
|
-
*/
|
|
788
|
-
export function nativeMergeSquash(basePath: string, branch: string): GitMergeResult {
|
|
789
|
-
const native = loadNative();
|
|
790
|
-
if (native) {
|
|
791
|
-
return native.gitMergeSquash(basePath, branch);
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
try {
|
|
795
|
-
execSync(`git merge --squash ${branch}`, {
|
|
796
|
-
cwd: basePath,
|
|
797
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
798
|
-
encoding: "utf-8",
|
|
799
|
-
});
|
|
800
|
-
return { success: true, conflicts: [] };
|
|
801
|
-
} catch {
|
|
802
|
-
// Check for conflicts
|
|
803
|
-
const conflictOutput = gitExec(basePath, ["diff", "--name-only", "--diff-filter=U"], true);
|
|
804
|
-
const conflicts = conflictOutput ? conflictOutput.split("\n").filter(Boolean) : [];
|
|
805
|
-
return { success: conflicts.length === 0, conflicts };
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
/**
|
|
810
|
-
* Abort an in-progress merge.
|
|
811
|
-
* Native: libgit2 reset + cleanup.
|
|
812
|
-
* Fallback: `git merge --abort`.
|
|
813
|
-
*/
|
|
814
|
-
export function nativeMergeAbort(basePath: string): void {
|
|
815
|
-
const native = loadNative();
|
|
816
|
-
if (native) {
|
|
817
|
-
native.gitMergeAbort(basePath);
|
|
818
|
-
return;
|
|
819
|
-
}
|
|
820
|
-
gitExec(basePath, ["merge", "--abort"], true);
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Abort an in-progress rebase.
|
|
825
|
-
* Native: libgit2 reset + cleanup.
|
|
826
|
-
* Fallback: `git rebase --abort`.
|
|
827
|
-
*/
|
|
828
|
-
export function nativeRebaseAbort(basePath: string): void {
|
|
829
|
-
const native = loadNative();
|
|
830
|
-
if (native) {
|
|
831
|
-
native.gitRebaseAbort(basePath);
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
gitExec(basePath, ["rebase", "--abort"], true);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* Hard reset to HEAD.
|
|
839
|
-
* Native: libgit2 reset(Hard).
|
|
840
|
-
* Fallback: `git reset --hard HEAD`.
|
|
841
|
-
*/
|
|
842
|
-
export function nativeResetHard(basePath: string): void {
|
|
843
|
-
const native = loadNative();
|
|
844
|
-
if (native) {
|
|
845
|
-
native.gitResetHard(basePath);
|
|
846
|
-
return;
|
|
847
|
-
}
|
|
848
|
-
execSync("git reset --hard HEAD", { cwd: basePath, stdio: "pipe" });
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* Delete a branch.
|
|
853
|
-
* Native: libgit2 branch delete.
|
|
854
|
-
* Fallback: `git branch -D/-d <branch>`.
|
|
855
|
-
*/
|
|
856
|
-
export function nativeBranchDelete(basePath: string, branch: string, force = true): void {
|
|
857
|
-
const native = loadNative();
|
|
858
|
-
if (native) {
|
|
859
|
-
native.gitBranchDelete(basePath, branch, force);
|
|
860
|
-
return;
|
|
861
|
-
}
|
|
862
|
-
gitFileExec(basePath, ["branch", force ? "-D" : "-d", branch], true);
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* Force-reset a branch to point at a target ref.
|
|
867
|
-
* Native: libgit2 branch create with force.
|
|
868
|
-
* Fallback: `git branch -f <branch> <target>`.
|
|
869
|
-
*/
|
|
870
|
-
export function nativeBranchForceReset(basePath: string, branch: string, target: string): void {
|
|
871
|
-
const native = loadNative();
|
|
872
|
-
if (native) {
|
|
873
|
-
native.gitBranchForceReset(basePath, branch, target);
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
gitExec(basePath, ["branch", "-f", branch, target]);
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* Remove files from the index (cache) without touching the working tree.
|
|
881
|
-
* Returns list of removed files.
|
|
882
|
-
* Native: libgit2 index remove.
|
|
883
|
-
* Fallback: `git rm --cached -r --ignore-unmatch <path>`.
|
|
884
|
-
*/
|
|
885
|
-
export function nativeRmCached(basePath: string, paths: string[], recursive = true): string[] {
|
|
886
|
-
const native = loadNative();
|
|
887
|
-
if (native) {
|
|
888
|
-
return native.gitRmCached(basePath, paths, recursive);
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
const removed: string[] = [];
|
|
892
|
-
for (const path of paths) {
|
|
893
|
-
const result = gitExec(
|
|
894
|
-
basePath,
|
|
895
|
-
["rm", "--cached", ...(recursive ? ["-r"] : []), "--ignore-unmatch", path],
|
|
896
|
-
true,
|
|
897
|
-
);
|
|
898
|
-
if (result) removed.push(result);
|
|
899
|
-
}
|
|
900
|
-
return removed;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Force-remove files from both index and working tree.
|
|
905
|
-
* Native: libgit2 index remove + fs delete.
|
|
906
|
-
* Fallback: `git rm --force -- <file>`.
|
|
907
|
-
*/
|
|
908
|
-
export function nativeRmForce(basePath: string, paths: string[]): void {
|
|
909
|
-
const native = loadNative();
|
|
910
|
-
if (native) {
|
|
911
|
-
native.gitRmForce(basePath, paths);
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
for (const path of paths) {
|
|
915
|
-
gitFileExec(basePath, ["rm", "--force", "--", path], true);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
/**
|
|
920
|
-
* Add a new git worktree.
|
|
921
|
-
* Native: libgit2 worktree API.
|
|
922
|
-
* Fallback: `git worktree add`.
|
|
923
|
-
*/
|
|
924
|
-
export function nativeWorktreeAdd(
|
|
925
|
-
basePath: string,
|
|
926
|
-
wtPath: string,
|
|
927
|
-
branch: string,
|
|
928
|
-
createBranch?: boolean,
|
|
929
|
-
startPoint?: string,
|
|
930
|
-
): void {
|
|
931
|
-
const native = loadNative();
|
|
932
|
-
if (native) {
|
|
933
|
-
native.gitWorktreeAdd(basePath, wtPath, branch, createBranch, startPoint);
|
|
934
|
-
return;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
if (createBranch) {
|
|
938
|
-
gitExec(basePath, ["worktree", "add", "-b", branch, wtPath, startPoint ?? "HEAD"]);
|
|
939
|
-
} else {
|
|
940
|
-
gitExec(basePath, ["worktree", "add", wtPath, branch]);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
/**
|
|
945
|
-
* Remove a git worktree.
|
|
946
|
-
* Native: libgit2 worktree prune + fs cleanup.
|
|
947
|
-
* Fallback: `git worktree remove [--force] <path>`.
|
|
948
|
-
*/
|
|
949
|
-
export function nativeWorktreeRemove(basePath: string, wtPath: string, force = false): void {
|
|
950
|
-
const native = loadNative();
|
|
951
|
-
if (native) {
|
|
952
|
-
native.gitWorktreeRemove(basePath, wtPath, force);
|
|
953
|
-
return;
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
const args = ["worktree", "remove"];
|
|
957
|
-
if (force) args.push("--force");
|
|
958
|
-
args.push(wtPath);
|
|
959
|
-
gitExec(basePath, args, true);
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* Prune stale worktree entries.
|
|
964
|
-
* Native: libgit2 worktree validation + prune.
|
|
965
|
-
* Fallback: `git worktree prune`.
|
|
966
|
-
*/
|
|
967
|
-
export function nativeWorktreePrune(basePath: string): void {
|
|
968
|
-
const native = loadNative();
|
|
969
|
-
if (native) {
|
|
970
|
-
native.gitWorktreePrune(basePath);
|
|
971
|
-
return;
|
|
972
|
-
}
|
|
973
|
-
gitExec(basePath, ["worktree", "prune"], true);
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
/**
|
|
977
|
-
* Revert a commit without auto-committing.
|
|
978
|
-
* Native: libgit2 revert.
|
|
979
|
-
* Fallback: `git revert --no-commit <sha>`.
|
|
980
|
-
*/
|
|
981
|
-
export function nativeRevertCommit(basePath: string, sha: string): void {
|
|
982
|
-
const native = loadNative();
|
|
983
|
-
if (native) {
|
|
984
|
-
native.gitRevertCommit(basePath, sha);
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
gitFileExec(basePath, ["revert", "--no-commit", sha]);
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Abort an in-progress revert.
|
|
992
|
-
* Native: libgit2 reset + cleanup.
|
|
993
|
-
* Fallback: `git revert --abort`.
|
|
994
|
-
*/
|
|
995
|
-
export function nativeRevertAbort(basePath: string): void {
|
|
996
|
-
const native = loadNative();
|
|
997
|
-
if (native) {
|
|
998
|
-
native.gitRevertAbort(basePath);
|
|
999
|
-
return;
|
|
1000
|
-
}
|
|
1001
|
-
gitFileExec(basePath, ["revert", "--abort"], true);
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* Create or delete a ref.
|
|
1006
|
-
* When target is provided, creates/updates the ref. When undefined, deletes it.
|
|
1007
|
-
* Native: libgit2 reference create/delete.
|
|
1008
|
-
* Fallback: `git update-ref`.
|
|
1009
|
-
*/
|
|
1010
|
-
export function nativeUpdateRef(basePath: string, refname: string, target?: string): void {
|
|
1011
|
-
const native = loadNative();
|
|
1012
|
-
if (native) {
|
|
1013
|
-
native.gitUpdateRef(basePath, refname, target);
|
|
1014
|
-
return;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
if (target !== undefined) {
|
|
1018
|
-
gitExec(basePath, ["update-ref", refname, target]);
|
|
1019
|
-
} else {
|
|
1020
|
-
gitExec(basePath, ["update-ref", "-d", refname], true);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
* Check if the native git module is available.
|
|
1026
|
-
*/
|
|
1027
|
-
export function isNativeGitAvailable(): boolean {
|
|
1028
|
-
return loadNative() !== null;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
// ─── Re-exports for type consumers ──────────────────────────────────────
|
|
1032
|
-
|
|
1033
|
-
export type {
|
|
1034
|
-
GitDiffStat,
|
|
1035
|
-
GitNameStatus,
|
|
1036
|
-
GitNumstat,
|
|
1037
|
-
GitLogEntry,
|
|
1038
|
-
GitWorktreeEntry,
|
|
1039
|
-
GitBatchInfo,
|
|
1040
|
-
GitMergeResult,
|
|
1041
|
-
};
|