gsd-pi 2.33.1-dev.235d83a → 2.33.1-dev.29a8268
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +0 -16
- package/dist/resource-loader.d.ts +0 -2
- package/dist/resource-loader.js +3 -36
- package/dist/resources/extensions/ask-user-questions.ts +290 -0
- package/dist/resources/extensions/async-jobs/async-bash-tool.ts +212 -0
- package/dist/resources/extensions/async-jobs/await-tool.ts +103 -0
- package/dist/resources/extensions/async-jobs/cancel-job-tool.ts +35 -0
- package/dist/resources/extensions/async-jobs/index.ts +141 -0
- package/dist/resources/extensions/async-jobs/job-manager.ts +211 -0
- package/dist/resources/extensions/aws-auth/index.ts +144 -0
- package/dist/resources/extensions/bg-shell/bg-shell-command.ts +219 -0
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.ts +400 -0
- package/dist/resources/extensions/bg-shell/bg-shell-tool.ts +985 -0
- package/dist/resources/extensions/bg-shell/index.ts +59 -0
- package/dist/resources/extensions/bg-shell/interaction.ts +198 -0
- package/dist/resources/extensions/bg-shell/output-formatter.ts +279 -0
- package/dist/resources/extensions/bg-shell/overlay.ts +437 -0
- package/dist/resources/extensions/bg-shell/process-manager.ts +464 -0
- package/dist/resources/extensions/bg-shell/readiness-detector.ts +126 -0
- package/dist/resources/extensions/bg-shell/types.ts +303 -0
- package/dist/resources/extensions/bg-shell/utilities.ts +57 -0
- package/dist/resources/extensions/browser-tools/capture.ts +199 -0
- package/dist/resources/extensions/browser-tools/core.ts +1196 -0
- package/dist/resources/extensions/browser-tools/{evaluate-helpers.js → evaluate-helpers.ts} +1 -0
- package/dist/resources/extensions/browser-tools/index.ts +71 -0
- package/dist/resources/extensions/browser-tools/lifecycle.ts +270 -0
- package/dist/resources/extensions/browser-tools/refs.ts +264 -0
- package/dist/resources/extensions/browser-tools/settle.ts +197 -0
- package/dist/resources/extensions/browser-tools/state.ts +408 -0
- package/dist/resources/extensions/browser-tools/tools/action-cache.ts +216 -0
- package/dist/resources/extensions/browser-tools/tools/assertions.ts +342 -0
- package/dist/resources/extensions/browser-tools/tools/codegen.ts +274 -0
- package/dist/resources/extensions/browser-tools/tools/device.ts +183 -0
- package/dist/resources/extensions/browser-tools/tools/extract.ts +229 -0
- package/dist/resources/extensions/browser-tools/tools/forms.ts +801 -0
- package/dist/resources/extensions/browser-tools/tools/injection-detect.ts +221 -0
- package/dist/resources/extensions/browser-tools/tools/inspection.ts +492 -0
- package/dist/resources/extensions/browser-tools/tools/intent.ts +614 -0
- package/dist/resources/extensions/browser-tools/tools/interaction.ts +865 -0
- package/dist/resources/extensions/browser-tools/tools/navigation.ts +232 -0
- package/dist/resources/extensions/browser-tools/tools/network-mock.ts +244 -0
- package/dist/resources/extensions/browser-tools/tools/pages.ts +303 -0
- package/dist/resources/extensions/browser-tools/tools/pdf.ts +92 -0
- package/dist/resources/extensions/browser-tools/tools/refs.ts +541 -0
- package/dist/resources/extensions/browser-tools/tools/screenshot.ts +101 -0
- package/dist/resources/extensions/browser-tools/tools/session.ts +400 -0
- package/dist/resources/extensions/browser-tools/tools/state-persistence.ts +202 -0
- package/dist/resources/extensions/browser-tools/tools/visual-diff.ts +209 -0
- package/dist/resources/extensions/browser-tools/tools/wait.ts +247 -0
- package/dist/resources/extensions/browser-tools/tools/zoom.ts +104 -0
- package/dist/resources/extensions/browser-tools/utils.ts +660 -0
- package/dist/resources/extensions/context7/index.ts +428 -0
- package/dist/resources/extensions/get-secrets-from-user.ts +607 -0
- package/dist/resources/extensions/google-search/index.ts +466 -0
- package/dist/resources/extensions/gsd/activity-log.ts +162 -0
- package/dist/resources/extensions/gsd/atomic-write.ts +35 -0
- package/dist/resources/extensions/gsd/auto/session.ts +236 -0
- package/dist/resources/extensions/gsd/auto-budget.ts +32 -0
- package/dist/resources/extensions/gsd/{auto-constants.js → auto-constants.ts} +1 -0
- package/dist/resources/extensions/gsd/auto-dashboard.ts +626 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.ts +224 -0
- package/dist/resources/extensions/gsd/auto-dispatch.ts +409 -0
- package/dist/resources/extensions/gsd/auto-idempotency.ts +151 -0
- package/dist/resources/extensions/gsd/auto-model-selection.ts +179 -0
- package/dist/resources/extensions/gsd/auto-observability.ts +72 -0
- package/dist/resources/extensions/gsd/auto-post-unit.ts +618 -0
- package/dist/resources/extensions/gsd/auto-prompts.ts +1273 -0
- package/dist/resources/extensions/gsd/auto-recovery.ts +578 -0
- package/dist/resources/extensions/gsd/auto-start.ts +483 -0
- package/dist/resources/extensions/gsd/auto-stuck-detection.ts +221 -0
- package/dist/resources/extensions/gsd/{auto-supervisor.js → auto-supervisor.ts} +33 -25
- package/dist/resources/extensions/gsd/auto-timeout-recovery.ts +263 -0
- package/dist/resources/extensions/gsd/auto-timers.ts +224 -0
- package/dist/resources/extensions/gsd/auto-tool-tracking.ts +54 -0
- package/dist/resources/extensions/gsd/auto-unit-closeout.ts +48 -0
- package/dist/resources/extensions/gsd/auto-verification.ts +229 -0
- package/dist/resources/extensions/gsd/auto-worktree.ts +658 -0
- package/dist/resources/extensions/gsd/auto.ts +1834 -0
- package/dist/resources/extensions/gsd/{cache.js → cache.ts} +7 -5
- package/dist/resources/extensions/gsd/captures.ts +427 -0
- package/dist/resources/extensions/gsd/claude-import.ts +656 -0
- package/dist/resources/extensions/gsd/collision-diagnostics.ts +332 -0
- package/dist/resources/extensions/gsd/commands-config.ts +102 -0
- package/dist/resources/extensions/gsd/commands-extensions.ts +328 -0
- package/dist/resources/extensions/gsd/commands-handlers.ts +395 -0
- package/dist/resources/extensions/gsd/commands-inspect.ts +91 -0
- package/dist/resources/extensions/gsd/commands-logs.ts +536 -0
- package/dist/resources/extensions/gsd/commands-maintenance.ts +206 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.ts +780 -0
- package/dist/resources/extensions/gsd/commands-workflow-templates.ts +543 -0
- package/dist/resources/extensions/gsd/commands.ts +1149 -0
- package/dist/resources/extensions/gsd/complexity-classifier.ts +320 -0
- package/dist/resources/extensions/gsd/{constants.js → constants.ts} +6 -0
- package/dist/resources/extensions/gsd/context-budget.ts +266 -0
- package/dist/resources/extensions/gsd/context-store.ts +195 -0
- package/dist/resources/extensions/gsd/crash-recovery.ts +121 -0
- package/dist/resources/extensions/gsd/dashboard-overlay.ts +681 -0
- package/dist/resources/extensions/gsd/db-writer.ts +360 -0
- package/dist/resources/extensions/gsd/debug-logger.ts +178 -0
- package/dist/resources/extensions/gsd/detection.ts +470 -0
- package/dist/resources/extensions/gsd/diff-context.ts +214 -0
- package/dist/resources/extensions/gsd/dispatch-guard.ts +81 -0
- package/dist/resources/extensions/gsd/doctor-checks.ts +612 -0
- package/dist/resources/extensions/gsd/doctor-environment.ts +497 -0
- package/dist/resources/extensions/gsd/doctor-format.ts +78 -0
- package/dist/resources/extensions/gsd/doctor-proactive.ts +292 -0
- package/dist/resources/extensions/gsd/doctor-providers.ts +343 -0
- package/dist/resources/extensions/gsd/doctor-types.ts +87 -0
- package/dist/resources/extensions/gsd/doctor.ts +722 -0
- package/dist/resources/extensions/gsd/error-utils.ts +6 -0
- package/dist/resources/extensions/gsd/{errors.js → errors.ts} +11 -6
- package/dist/resources/extensions/gsd/exit-command.ts +18 -0
- package/dist/resources/extensions/gsd/{export-html.js → export-html.ts} +614 -482
- package/dist/resources/extensions/gsd/export.ts +317 -0
- package/dist/resources/extensions/gsd/file-watcher.ts +97 -0
- package/dist/resources/extensions/gsd/files.ts +1058 -0
- package/dist/resources/extensions/gsd/forensics.ts +629 -0
- package/dist/resources/extensions/gsd/{git-constants.js → git-constants.ts} +5 -4
- package/dist/resources/extensions/gsd/git-self-heal.ts +127 -0
- package/dist/resources/extensions/gsd/git-service.ts +586 -0
- package/dist/resources/extensions/gsd/{gitignore.js → gitignore.ts} +125 -98
- package/dist/resources/extensions/gsd/gsd-db.ts +685 -0
- package/dist/resources/extensions/gsd/guided-flow-queue.ts +440 -0
- package/dist/resources/extensions/gsd/guided-flow.ts +1303 -0
- package/dist/resources/extensions/gsd/health-widget.ts +167 -0
- package/dist/resources/extensions/gsd/history.ts +143 -0
- package/dist/resources/extensions/gsd/index.ts +1401 -0
- package/dist/resources/extensions/gsd/init-wizard.ts +587 -0
- package/dist/resources/extensions/gsd/json-persistence.ts +67 -0
- package/dist/resources/extensions/gsd/{jsonl-utils.js → jsonl-utils.ts} +7 -10
- package/dist/resources/extensions/gsd/key-manager.ts +996 -0
- package/dist/resources/extensions/gsd/marketplace-discovery.ts +508 -0
- package/dist/resources/extensions/gsd/md-importer.ts +527 -0
- package/dist/resources/extensions/gsd/mechanical-completion.ts +430 -0
- package/dist/resources/extensions/gsd/memory-extractor.ts +352 -0
- package/dist/resources/extensions/gsd/memory-store.ts +441 -0
- package/dist/resources/extensions/gsd/metrics.ts +532 -0
- package/dist/resources/extensions/gsd/migrate/command.ts +219 -0
- package/dist/resources/extensions/gsd/migrate/index.ts +42 -0
- package/dist/resources/extensions/gsd/migrate/parser.ts +323 -0
- package/dist/resources/extensions/gsd/migrate/parsers.ts +539 -0
- package/dist/resources/extensions/gsd/migrate/preview.ts +48 -0
- package/dist/resources/extensions/gsd/migrate/transformer.ts +346 -0
- package/dist/resources/extensions/gsd/migrate/types.ts +370 -0
- package/dist/resources/extensions/gsd/migrate/validator.ts +55 -0
- package/dist/resources/extensions/gsd/migrate/writer.ts +579 -0
- package/dist/resources/extensions/gsd/migrate-external.ts +140 -0
- package/dist/resources/extensions/gsd/milestone-actions.ts +126 -0
- package/dist/resources/extensions/gsd/{milestone-ids.js → milestone-ids.ts} +63 -50
- package/dist/resources/extensions/gsd/model-cost-table.ts +65 -0
- package/dist/resources/extensions/gsd/model-router.ts +256 -0
- package/dist/resources/extensions/gsd/namespaced-registry.ts +467 -0
- package/dist/resources/extensions/gsd/namespaced-resolver.ts +307 -0
- package/dist/resources/extensions/gsd/native-git-bridge.ts +1041 -0
- package/dist/resources/extensions/gsd/native-parser-bridge.ts +267 -0
- package/dist/resources/extensions/gsd/notifications.ts +87 -0
- package/dist/resources/extensions/gsd/observability-validator.ts +429 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.ts +233 -0
- package/dist/resources/extensions/gsd/parallel-merge.ts +157 -0
- package/dist/resources/extensions/gsd/parallel-orchestrator.ts +826 -0
- package/dist/resources/extensions/gsd/paths.ts +449 -0
- package/dist/resources/extensions/gsd/plugin-importer.ts +411 -0
- package/dist/resources/extensions/gsd/post-unit-hooks.ts +520 -0
- package/dist/resources/extensions/gsd/preferences-models.ts +329 -0
- package/dist/resources/extensions/gsd/preferences-skills.ts +169 -0
- package/dist/resources/extensions/gsd/preferences-types.ts +229 -0
- package/dist/resources/extensions/gsd/preferences-validation.ts +590 -0
- package/dist/resources/extensions/gsd/preferences.ts +416 -0
- package/dist/resources/extensions/gsd/progress-score.ts +273 -0
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.ts +213 -0
- package/dist/resources/extensions/gsd/prompt-compressor.ts +508 -0
- package/dist/resources/extensions/gsd/prompt-loader.ts +130 -0
- package/dist/resources/extensions/gsd/prompt-ordering.ts +200 -0
- package/dist/resources/extensions/gsd/provider-error-pause.ts +88 -0
- package/dist/resources/extensions/gsd/queue-order.ts +230 -0
- package/dist/resources/extensions/gsd/queue-reorder-ui.ts +276 -0
- package/dist/resources/extensions/gsd/quick.ts +212 -0
- package/dist/resources/extensions/gsd/repo-identity.ts +169 -0
- package/dist/resources/extensions/gsd/{reports.js → reports.ts} +241 -146
- package/dist/resources/extensions/gsd/{resource-version.js → resource-version.ts} +53 -50
- package/dist/resources/extensions/gsd/roadmap-slices.ts +149 -0
- package/dist/resources/extensions/gsd/routing-history.ts +286 -0
- package/dist/resources/extensions/gsd/safe-fs.ts +47 -0
- package/dist/resources/extensions/gsd/semantic-chunker.ts +336 -0
- package/dist/resources/extensions/gsd/session-forensics.ts +537 -0
- package/dist/resources/extensions/gsd/session-lock.ts +426 -0
- package/dist/resources/extensions/gsd/session-status-io.ts +179 -0
- package/dist/resources/extensions/gsd/skill-discovery.ts +139 -0
- package/dist/resources/extensions/gsd/skill-health.ts +417 -0
- package/dist/resources/extensions/gsd/{skill-telemetry.js → skill-telemetry.ts} +74 -58
- package/dist/resources/extensions/gsd/state.ts +727 -0
- package/dist/resources/extensions/gsd/structured-data-formatter.ts +144 -0
- package/dist/resources/extensions/gsd/summary-distiller.ts +258 -0
- package/dist/resources/extensions/gsd/tests/activity-log.test.ts +213 -0
- package/dist/resources/extensions/gsd/tests/agent-end-retry.test.ts +107 -0
- package/dist/resources/extensions/gsd/tests/all-milestones-complete-merge.test.ts +200 -0
- package/dist/resources/extensions/gsd/tests/auto-budget-alerts.test.ts +50 -0
- package/dist/resources/extensions/gsd/tests/auto-dashboard.test.ts +166 -0
- package/dist/resources/extensions/gsd/tests/auto-dispatch-loop.test.ts +691 -0
- package/dist/resources/extensions/gsd/tests/auto-lock-creation.test.ts +186 -0
- package/dist/resources/extensions/gsd/tests/auto-preflight.test.ts +40 -0
- package/dist/resources/extensions/gsd/tests/auto-recovery.test.ts +640 -0
- package/dist/resources/extensions/gsd/tests/auto-reentrancy-guard.test.ts +127 -0
- package/dist/resources/extensions/gsd/tests/auto-secrets-gate.test.ts +302 -0
- package/dist/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +257 -0
- package/dist/resources/extensions/gsd/tests/auto-skip-loop.test.ts +123 -0
- package/dist/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +340 -0
- package/dist/resources/extensions/gsd/tests/auto-worktree.test.ts +167 -0
- package/dist/resources/extensions/gsd/tests/budget-prediction.test.ts +220 -0
- package/dist/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +317 -0
- package/dist/resources/extensions/gsd/tests/captures.test.ts +438 -0
- package/dist/resources/extensions/gsd/tests/claude-import-tui.test.ts +351 -0
- package/dist/resources/extensions/gsd/tests/collect-from-manifest.test.ts +469 -0
- package/dist/resources/extensions/gsd/tests/collision-diagnostics.test.ts +705 -0
- package/dist/resources/extensions/gsd/tests/commands-logs.test.ts +241 -0
- package/dist/resources/extensions/gsd/tests/complete-milestone.test.ts +209 -0
- package/dist/resources/extensions/gsd/tests/complexity-classifier.test.ts +181 -0
- package/dist/resources/extensions/gsd/tests/context-budget.test.ts +352 -0
- package/dist/resources/extensions/gsd/tests/context-compression.test.ts +193 -0
- package/dist/resources/extensions/gsd/tests/context-store.test.ts +462 -0
- package/dist/resources/extensions/gsd/tests/continue-here.test.ts +285 -0
- package/dist/resources/extensions/gsd/tests/cost-projection.test.ts +134 -0
- package/dist/resources/extensions/gsd/tests/crash-recovery.test.ts +134 -0
- package/dist/resources/extensions/gsd/tests/dashboard-budget.test.ts +346 -0
- package/dist/resources/extensions/gsd/tests/db-writer.test.ts +602 -0
- package/dist/resources/extensions/gsd/tests/debug-logger.test.ts +185 -0
- package/dist/resources/extensions/gsd/tests/derive-state-db.test.ts +405 -0
- package/dist/resources/extensions/gsd/tests/derive-state-deps.test.ts +421 -0
- package/dist/resources/extensions/gsd/tests/derive-state-draft.test.ts +308 -0
- package/dist/resources/extensions/gsd/tests/derive-state.test.ts +788 -0
- package/dist/resources/extensions/gsd/tests/detection.test.ts +398 -0
- package/dist/resources/extensions/gsd/tests/diff-context.test.ts +136 -0
- package/dist/resources/extensions/gsd/tests/discuss-prompt.test.ts +15 -0
- package/dist/resources/extensions/gsd/tests/dispatch-guard.test.ts +128 -0
- package/dist/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +132 -0
- package/dist/resources/extensions/gsd/tests/dispatch-stall-guard.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/doctor-environment.test.ts +314 -0
- package/dist/resources/extensions/gsd/tests/doctor-fixlevel.test.ts +245 -0
- package/dist/resources/extensions/gsd/tests/doctor-git.test.ts +344 -0
- package/dist/resources/extensions/gsd/tests/doctor-proactive.test.ts +278 -0
- package/dist/resources/extensions/gsd/tests/doctor-providers.test.ts +298 -0
- package/dist/resources/extensions/gsd/tests/doctor-runtime.test.ts +302 -0
- package/dist/resources/extensions/gsd/tests/doctor.test.ts +652 -0
- package/dist/resources/extensions/gsd/tests/draft-promotion.test.ts +169 -0
- package/dist/resources/extensions/gsd/tests/exit-command.test.ts +50 -0
- package/dist/resources/extensions/gsd/tests/export-html-all.test.ts +105 -0
- package/dist/resources/extensions/gsd/tests/export-html-enhancements.test.ts +378 -0
- package/dist/resources/extensions/gsd/tests/extension-selector-separator.test.ts +144 -0
- package/dist/resources/extensions/gsd/tests/feature-branch-lifecycle-integration.test.ts +424 -0
- package/dist/resources/extensions/gsd/tests/git-self-heal.test.ts +131 -0
- package/dist/resources/extensions/gsd/tests/git-service.test.ts +1181 -0
- package/dist/resources/extensions/gsd/tests/gsd-db.test.ts +353 -0
- package/dist/resources/extensions/gsd/tests/gsd-inspect.test.ts +125 -0
- package/dist/resources/extensions/gsd/tests/gsd-tools.test.ts +326 -0
- package/dist/resources/extensions/gsd/tests/headless-answers.test.ts +340 -0
- package/dist/resources/extensions/gsd/tests/headless-query.test.ts +162 -0
- package/dist/resources/extensions/gsd/tests/idle-recovery.test.ts +485 -0
- package/dist/resources/extensions/gsd/tests/in-flight-tool-tracking.test.ts +32 -0
- package/dist/resources/extensions/gsd/tests/init-wizard.test.ts +197 -0
- package/dist/resources/extensions/gsd/tests/integration/headless-command.ts +534 -0
- package/dist/resources/extensions/gsd/tests/integration-edge.test.ts +228 -0
- package/dist/resources/extensions/gsd/tests/integration-lifecycle.test.ts +277 -0
- package/dist/resources/extensions/gsd/tests/integration-mixed-milestones.test.ts +523 -0
- package/dist/resources/extensions/gsd/tests/key-manager.test.ts +414 -0
- package/dist/resources/extensions/gsd/tests/knowledge.test.ts +161 -0
- package/dist/resources/extensions/gsd/tests/loop-regression.test.ts +877 -0
- package/dist/resources/extensions/gsd/tests/manifest-status.test.ts +283 -0
- package/dist/resources/extensions/gsd/tests/marketplace-test-fixtures.ts +91 -0
- package/dist/resources/extensions/gsd/tests/md-importer.test.ts +410 -0
- package/dist/resources/extensions/gsd/tests/mechanical-completion.test.ts +356 -0
- package/dist/resources/extensions/gsd/tests/memory-extractor.test.ts +180 -0
- package/dist/resources/extensions/gsd/tests/memory-leak-guards.test.ts +91 -0
- package/dist/resources/extensions/gsd/tests/memory-store.test.ts +345 -0
- package/dist/resources/extensions/gsd/tests/metrics.test.ts +253 -0
- package/dist/resources/extensions/gsd/tests/migrate-command.test.ts +369 -0
- package/dist/resources/extensions/gsd/tests/migrate-parser.test.ts +757 -0
- package/dist/resources/extensions/gsd/tests/migrate-transformer.test.ts +635 -0
- package/dist/resources/extensions/gsd/tests/migrate-validator-parsers.test.ts +414 -0
- package/dist/resources/extensions/gsd/tests/migrate-writer-integration.test.ts +303 -0
- package/dist/resources/extensions/gsd/tests/migrate-writer.test.ts +398 -0
- package/dist/resources/extensions/gsd/tests/milestone-transition-worktree.test.ts +147 -0
- package/dist/resources/extensions/gsd/tests/model-cost-table.test.ts +69 -0
- package/dist/resources/extensions/gsd/tests/model-isolation.test.ts +157 -0
- package/dist/resources/extensions/gsd/tests/model-router.test.ts +167 -0
- package/dist/resources/extensions/gsd/tests/must-have-parser.test.ts +291 -0
- package/dist/resources/extensions/gsd/tests/namespaced-registry.test.ts +1027 -0
- package/dist/resources/extensions/gsd/tests/namespaced-resolver.test.ts +671 -0
- package/dist/resources/extensions/gsd/tests/native-has-changes-cache.test.ts +61 -0
- package/dist/resources/extensions/gsd/tests/next-milestone-id.test.ts +23 -0
- package/dist/resources/extensions/gsd/tests/none-mode-gates.test.ts +114 -0
- package/dist/resources/extensions/gsd/tests/notifications.test.ts +67 -0
- package/dist/resources/extensions/gsd/tests/overrides.test.ts +131 -0
- package/dist/resources/extensions/gsd/tests/parallel-budget-atomicity.test.ts +331 -0
- package/dist/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +298 -0
- package/dist/resources/extensions/gsd/tests/parallel-merge.test.ts +468 -0
- package/dist/resources/extensions/gsd/tests/parallel-orchestration.test.ts +685 -0
- package/dist/resources/extensions/gsd/tests/parallel-worker-monitoring.test.ts +171 -0
- package/dist/resources/extensions/gsd/tests/parallel-workers-multi-milestone-e2e.test.ts +354 -0
- package/dist/resources/extensions/gsd/tests/park-edge-cases.test.ts +276 -0
- package/dist/resources/extensions/gsd/tests/park-milestone.test.ts +401 -0
- package/dist/resources/extensions/gsd/tests/parsers.test.ts +1704 -0
- package/dist/resources/extensions/gsd/tests/plan-milestone.test.ts +133 -0
- package/dist/resources/extensions/gsd/tests/plan-quality-validator.test.ts +363 -0
- package/dist/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +42 -0
- package/dist/resources/extensions/gsd/tests/plugin-importer-live.test.ts +481 -0
- package/dist/resources/extensions/gsd/tests/plugin-importer.test.ts +1383 -0
- package/dist/resources/extensions/gsd/tests/post-unit-hooks.test.ts +337 -0
- package/dist/resources/extensions/gsd/tests/preferences.test.ts +276 -0
- package/dist/resources/extensions/gsd/tests/progress-score.test.ts +206 -0
- package/dist/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +464 -0
- package/dist/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +314 -0
- package/dist/resources/extensions/gsd/tests/prompt-compressor.test.ts +529 -0
- package/dist/resources/extensions/gsd/tests/prompt-db.test.ts +385 -0
- package/dist/resources/extensions/gsd/tests/prompt-ordering.test.ts +296 -0
- package/dist/resources/extensions/gsd/tests/provider-errors.test.ts +338 -0
- package/dist/resources/extensions/gsd/tests/queue-draft-detection.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/queue-order.test.ts +204 -0
- package/dist/resources/extensions/gsd/tests/queue-reorder-e2e.test.ts +282 -0
- package/dist/resources/extensions/gsd/tests/reassess-detection.test.ts +154 -0
- package/dist/resources/extensions/gsd/tests/reassess-prompt.test.ts +145 -0
- package/dist/resources/extensions/gsd/tests/regex-hardening.test.ts +281 -0
- package/dist/resources/extensions/gsd/tests/remote-questions.test.ts +642 -0
- package/dist/resources/extensions/gsd/tests/remote-status.test.ts +99 -0
- package/dist/resources/extensions/gsd/tests/replan-slice.test.ts +538 -0
- package/dist/resources/extensions/gsd/tests/requirements.test.ts +106 -0
- package/dist/resources/extensions/gsd/tests/roadmap-parse-regression.test.ts +358 -0
- package/dist/resources/extensions/gsd/tests/roadmap-slices.test.ts +66 -0
- package/dist/resources/extensions/gsd/tests/routing-history.test.ts +240 -0
- package/dist/resources/extensions/gsd/tests/run-uat.test.ts +416 -0
- package/dist/resources/extensions/gsd/tests/secure-env-collect.test.ts +185 -0
- package/dist/resources/extensions/gsd/tests/semantic-chunker.test.ts +426 -0
- package/dist/resources/extensions/gsd/tests/session-lock-regression.test.ts +216 -0
- package/dist/resources/extensions/gsd/tests/session-lock.test.ts +434 -0
- package/dist/resources/extensions/gsd/tests/skill-lifecycle.test.ts +126 -0
- package/dist/resources/extensions/gsd/tests/smart-entry-draft.test.ts +123 -0
- package/dist/resources/extensions/gsd/tests/stale-worktree-cwd.test.ts +142 -0
- package/dist/resources/extensions/gsd/tests/stop-auto-remote.test.ts +156 -0
- package/dist/resources/extensions/gsd/tests/structured-data-formatter.test.ts +365 -0
- package/dist/resources/extensions/gsd/tests/summary-distiller.test.ts +323 -0
- package/dist/resources/extensions/gsd/tests/test-helpers.ts +61 -0
- package/dist/resources/extensions/gsd/tests/token-counter.test.ts +129 -0
- package/dist/resources/extensions/gsd/tests/token-optimization-benchmark.test.ts +1272 -0
- package/dist/resources/extensions/gsd/tests/token-optimization-prefs.test.ts +164 -0
- package/dist/resources/extensions/gsd/tests/token-profile.test.ts +268 -0
- package/dist/resources/extensions/gsd/tests/token-savings.test.ts +366 -0
- package/dist/resources/extensions/gsd/tests/triage-dispatch.test.ts +340 -0
- package/dist/resources/extensions/gsd/tests/triage-resolution.test.ts +416 -0
- package/dist/resources/extensions/gsd/tests/undo.test.ts +136 -0
- package/dist/resources/extensions/gsd/tests/unique-milestone-ids.test.ts +219 -0
- package/dist/resources/extensions/gsd/tests/unit-runtime.test.ts +258 -0
- package/dist/resources/extensions/gsd/tests/update-command.test.ts +67 -0
- package/dist/resources/extensions/gsd/tests/validate-directory.test.ts +222 -0
- package/dist/resources/extensions/gsd/tests/validate-milestone.test.ts +375 -0
- package/dist/resources/extensions/gsd/tests/verification-evidence.test.ts +745 -0
- package/dist/resources/extensions/gsd/tests/verification-gate.test.ts +1208 -0
- package/dist/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +145 -0
- package/dist/resources/extensions/gsd/tests/visualizer-data.test.ts +446 -0
- package/dist/resources/extensions/gsd/tests/visualizer-overlay.test.ts +237 -0
- package/dist/resources/extensions/gsd/tests/visualizer-views.test.ts +718 -0
- package/dist/resources/extensions/gsd/tests/worker-registry.test.ts +148 -0
- package/dist/resources/extensions/gsd/tests/workflow-templates.test.ts +173 -0
- package/dist/resources/extensions/gsd/tests/workspace-index.test.ts +38 -0
- package/dist/resources/extensions/gsd/tests/worktree-bugfix.test.ts +120 -0
- package/dist/resources/extensions/gsd/tests/worktree-e2e.test.ts +244 -0
- package/dist/resources/extensions/gsd/tests/worktree-integration.test.ts +207 -0
- package/dist/resources/extensions/gsd/tests/worktree-manager.test.ts +141 -0
- package/dist/resources/extensions/gsd/tests/worktree-post-create-hook.test.ts +165 -0
- package/dist/resources/extensions/gsd/tests/worktree-sync-milestones.test.ts +206 -0
- package/dist/resources/extensions/gsd/tests/worktree.test.ts +171 -0
- package/dist/resources/extensions/gsd/tests/write-gate.test.ts +211 -0
- package/dist/resources/extensions/gsd/token-counter.ts +65 -0
- package/dist/resources/extensions/gsd/triage-resolution.ts +284 -0
- package/dist/resources/extensions/gsd/triage-ui.ts +175 -0
- package/dist/resources/extensions/gsd/types.ts +425 -0
- package/dist/resources/extensions/gsd/undo.ts +223 -0
- package/dist/resources/extensions/gsd/unit-id.ts +14 -0
- package/dist/resources/extensions/gsd/unit-runtime.ts +192 -0
- package/dist/resources/extensions/gsd/validate-directory.ts +164 -0
- package/dist/resources/extensions/gsd/verification-evidence.ts +188 -0
- package/dist/resources/extensions/gsd/verification-gate.ts +643 -0
- package/dist/resources/extensions/gsd/visualizer-data.ts +866 -0
- package/dist/resources/extensions/gsd/visualizer-overlay.ts +566 -0
- package/dist/resources/extensions/gsd/visualizer-views.ts +1171 -0
- package/dist/resources/extensions/gsd/workflow-templates.ts +241 -0
- package/dist/resources/extensions/gsd/workspace-index.ts +217 -0
- package/dist/resources/extensions/gsd/worktree-command.ts +807 -0
- package/dist/resources/extensions/gsd/worktree-manager.ts +449 -0
- package/dist/resources/extensions/gsd/worktree.ts +257 -0
- package/dist/resources/extensions/mac-tools/index.ts +852 -0
- package/dist/resources/extensions/mcp-client/index.ts +459 -0
- package/dist/resources/extensions/remote-questions/config.ts +83 -0
- package/dist/resources/extensions/remote-questions/discord-adapter.ts +148 -0
- package/dist/resources/extensions/remote-questions/format.ts +315 -0
- package/dist/resources/extensions/remote-questions/http-client.ts +76 -0
- package/dist/resources/extensions/remote-questions/manager.ts +184 -0
- package/dist/resources/extensions/remote-questions/{mod.js → mod.ts} +10 -1
- package/dist/resources/extensions/remote-questions/notify.ts +90 -0
- package/dist/resources/extensions/remote-questions/remote-command.ts +457 -0
- package/dist/resources/extensions/remote-questions/slack-adapter.ts +141 -0
- package/dist/resources/extensions/remote-questions/status.ts +31 -0
- package/dist/resources/extensions/remote-questions/store.ts +81 -0
- package/dist/resources/extensions/remote-questions/telegram-adapter.ts +149 -0
- package/dist/resources/extensions/remote-questions/types.ts +102 -0
- package/dist/resources/extensions/search-the-web/cache.ts +78 -0
- package/dist/resources/extensions/search-the-web/command-search-provider.ts +101 -0
- package/dist/resources/extensions/search-the-web/format.ts +258 -0
- package/dist/resources/extensions/search-the-web/http.ts +238 -0
- package/dist/resources/extensions/search-the-web/index.ts +65 -0
- package/dist/resources/extensions/search-the-web/native-search.ts +193 -0
- package/dist/resources/extensions/search-the-web/provider.ts +148 -0
- package/dist/resources/extensions/search-the-web/tavily.ts +116 -0
- package/dist/resources/extensions/search-the-web/tool-fetch-page.ts +589 -0
- package/dist/resources/extensions/search-the-web/tool-llm-context.ts +608 -0
- package/dist/resources/extensions/search-the-web/tool-search.ts +649 -0
- package/dist/resources/extensions/search-the-web/url-utils.ts +125 -0
- package/dist/resources/extensions/shared/confirm-ui.ts +126 -0
- package/dist/resources/extensions/shared/{format-utils.js → format-utils.ts} +91 -85
- package/dist/resources/extensions/shared/frontmatter.ts +117 -0
- package/dist/resources/extensions/shared/interview-ui.ts +613 -0
- package/dist/resources/extensions/shared/{mod.js → mod.ts} +24 -2
- package/dist/resources/extensions/shared/next-action-ui.ts +212 -0
- package/dist/resources/extensions/shared/{path-display.js → path-display.ts} +3 -2
- package/dist/resources/extensions/shared/sanitize.ts +19 -0
- package/dist/resources/extensions/shared/terminal.ts +23 -0
- package/dist/resources/extensions/shared/tests/format-utils.test.ts +153 -0
- package/dist/resources/extensions/shared/ui.ts +400 -0
- package/dist/resources/extensions/shared/wizard-ui.ts +551 -0
- package/dist/resources/extensions/slash-commands/audit.ts +88 -0
- package/dist/resources/extensions/slash-commands/clear.ts +10 -0
- package/dist/resources/extensions/slash-commands/create-extension.ts +297 -0
- package/dist/resources/extensions/slash-commands/create-slash-command.ts +234 -0
- package/dist/resources/extensions/slash-commands/index.ts +12 -0
- package/dist/resources/extensions/subagent/agents.ts +126 -0
- package/dist/resources/extensions/subagent/index.ts +1121 -0
- package/dist/resources/extensions/subagent/isolation.ts +501 -0
- package/dist/resources/extensions/subagent/worker-registry.ts +99 -0
- package/dist/resources/extensions/ttsr/index.ts +168 -0
- package/dist/resources/extensions/ttsr/rule-loader.ts +74 -0
- package/dist/resources/extensions/ttsr/ttsr-manager.ts +456 -0
- package/dist/resources/extensions/universal-config/discovery.ts +104 -0
- package/dist/resources/extensions/universal-config/format.ts +191 -0
- package/dist/resources/extensions/universal-config/index.ts +120 -0
- package/dist/resources/extensions/universal-config/scanners.ts +642 -0
- package/dist/resources/extensions/universal-config/tests/discovery.test.ts +119 -0
- package/dist/resources/extensions/universal-config/tests/format.test.ts +127 -0
- package/dist/resources/extensions/universal-config/tests/scanners.test.ts +456 -0
- package/dist/resources/extensions/universal-config/tools.ts +60 -0
- package/dist/resources/extensions/universal-config/types.ts +135 -0
- package/dist/resources/extensions/voice/index.ts +272 -0
- package/dist/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +51 -0
- package/dist/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +143 -0
- package/package.json +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 +0 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +4 -31
- 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/src/core/extensions/index.ts +0 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +4 -35
- package/packages/pi-coding-agent/src/index.ts +0 -1
- package/src/resources/extensions/bg-shell/index.ts +46 -41
- package/src/resources/extensions/browser-tools/index.ts +67 -156
- package/src/resources/extensions/gsd/auto-verification.ts +2 -20
- package/src/resources/extensions/gsd/auto-worktree.ts +2 -3
- package/src/resources/extensions/gsd/commands.ts +31 -39
- package/src/resources/extensions/gsd/git-service.ts +0 -7
- package/src/resources/extensions/gsd/index.ts +32 -93
- package/src/resources/extensions/gsd/quick.ts +3 -52
- package/src/resources/extensions/gsd/repo-identity.ts +22 -56
- package/src/resources/extensions/gsd/tests/loop-regression.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +0 -65
- package/src/resources/extensions/gsd/types.ts +0 -4
- package/src/resources/extensions/gsd/verification-evidence.ts +1 -1
- package/src/resources/extensions/gsd/verification-gate.ts +2 -23
- package/src/resources/extensions/gsd/worktree-command.ts +11 -17
- package/src/resources/extensions/search-the-web/command-search-provider.ts +1 -1
- package/src/resources/extensions/search-the-web/index.ts +52 -35
- package/src/resources/extensions/search-the-web/tavily.ts +1 -1
- package/dist/resources/extensions/ask-user-questions.js +0 -217
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +0 -180
- package/dist/resources/extensions/async-jobs/await-tool.js +0 -90
- package/dist/resources/extensions/async-jobs/cancel-job-tool.js +0 -28
- package/dist/resources/extensions/async-jobs/index.js +0 -119
- package/dist/resources/extensions/async-jobs/job-manager.js +0 -159
- package/dist/resources/extensions/aws-auth/index.js +0 -138
- package/dist/resources/extensions/bg-shell/bg-shell-command.js +0 -182
- package/dist/resources/extensions/bg-shell/bg-shell-lifecycle.js +0 -343
- package/dist/resources/extensions/bg-shell/bg-shell-tool.js +0 -831
- package/dist/resources/extensions/bg-shell/index.js +0 -41
- package/dist/resources/extensions/bg-shell/interaction.js +0 -160
- package/dist/resources/extensions/bg-shell/output-formatter.js +0 -245
- package/dist/resources/extensions/bg-shell/overlay.js +0 -378
- package/dist/resources/extensions/bg-shell/process-manager.js +0 -413
- package/dist/resources/extensions/bg-shell/readiness-detector.js +0 -109
- package/dist/resources/extensions/bg-shell/types.js +0 -96
- package/dist/resources/extensions/bg-shell/utilities.js +0 -50
- package/dist/resources/extensions/browser-tools/capture.js +0 -179
- package/dist/resources/extensions/browser-tools/core.js +0 -899
- package/dist/resources/extensions/browser-tools/index.js +0 -123
- package/dist/resources/extensions/browser-tools/lifecycle.js +0 -222
- package/dist/resources/extensions/browser-tools/refs.js +0 -254
- package/dist/resources/extensions/browser-tools/settle.js +0 -173
- package/dist/resources/extensions/browser-tools/state.js +0 -126
- package/dist/resources/extensions/browser-tools/tools/action-cache.js +0 -179
- package/dist/resources/extensions/browser-tools/tools/assertions.js +0 -320
- package/dist/resources/extensions/browser-tools/tools/codegen.js +0 -242
- package/dist/resources/extensions/browser-tools/tools/device.js +0 -162
- package/dist/resources/extensions/browser-tools/tools/extract.js +0 -191
- package/dist/resources/extensions/browser-tools/tools/forms.js +0 -710
- package/dist/resources/extensions/browser-tools/tools/injection-detect.js +0 -178
- package/dist/resources/extensions/browser-tools/tools/inspection.js +0 -426
- package/dist/resources/extensions/browser-tools/tools/intent.js +0 -556
- package/dist/resources/extensions/browser-tools/tools/interaction.js +0 -776
- package/dist/resources/extensions/browser-tools/tools/navigation.js +0 -208
- package/dist/resources/extensions/browser-tools/tools/network-mock.js +0 -194
- package/dist/resources/extensions/browser-tools/tools/pages.js +0 -280
- package/dist/resources/extensions/browser-tools/tools/pdf.js +0 -74
- package/dist/resources/extensions/browser-tools/tools/refs.js +0 -485
- package/dist/resources/extensions/browser-tools/tools/screenshot.js +0 -87
- package/dist/resources/extensions/browser-tools/tools/session.js +0 -375
- package/dist/resources/extensions/browser-tools/tools/state-persistence.js +0 -180
- package/dist/resources/extensions/browser-tools/tools/visual-diff.js +0 -174
- package/dist/resources/extensions/browser-tools/tools/wait.js +0 -201
- package/dist/resources/extensions/browser-tools/tools/zoom.js +0 -90
- package/dist/resources/extensions/browser-tools/utils.js +0 -490
- package/dist/resources/extensions/context7/index.js +0 -337
- package/dist/resources/extensions/get-secrets-from-user.js +0 -492
- package/dist/resources/extensions/google-search/index.js +0 -373
- package/dist/resources/extensions/gsd/activity-log.js +0 -146
- package/dist/resources/extensions/gsd/atomic-write.js +0 -38
- package/dist/resources/extensions/gsd/auto/session.js +0 -187
- package/dist/resources/extensions/gsd/auto-budget.js +0 -30
- package/dist/resources/extensions/gsd/auto-dashboard.js +0 -509
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +0 -180
- package/dist/resources/extensions/gsd/auto-dispatch.js +0 -382
- package/dist/resources/extensions/gsd/auto-idempotency.js +0 -106
- package/dist/resources/extensions/gsd/auto-model-selection.js +0 -133
- package/dist/resources/extensions/gsd/auto-observability.js +0 -54
- package/dist/resources/extensions/gsd/auto-post-unit.js +0 -495
- package/dist/resources/extensions/gsd/auto-prompts.js +0 -1121
- package/dist/resources/extensions/gsd/auto-recovery.js +0 -550
- package/dist/resources/extensions/gsd/auto-start.js +0 -393
- package/dist/resources/extensions/gsd/auto-stuck-detection.js +0 -165
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +0 -183
- package/dist/resources/extensions/gsd/auto-timers.js +0 -181
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +0 -50
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +0 -30
- package/dist/resources/extensions/gsd/auto-verification.js +0 -209
- package/dist/resources/extensions/gsd/auto-worktree.js +0 -594
- package/dist/resources/extensions/gsd/auto.js +0 -1485
- package/dist/resources/extensions/gsd/captures.js +0 -348
- package/dist/resources/extensions/gsd/claude-import.js +0 -540
- package/dist/resources/extensions/gsd/collision-diagnostics.js +0 -226
- package/dist/resources/extensions/gsd/commands-bootstrap.js +0 -223
- package/dist/resources/extensions/gsd/commands-config.js +0 -89
- package/dist/resources/extensions/gsd/commands-extensions.js +0 -259
- package/dist/resources/extensions/gsd/commands-handlers.js +0 -310
- package/dist/resources/extensions/gsd/commands-inspect.js +0 -70
- package/dist/resources/extensions/gsd/commands-logs.js +0 -468
- package/dist/resources/extensions/gsd/commands-maintenance.js +0 -185
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +0 -660
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +0 -408
- package/dist/resources/extensions/gsd/commands.js +0 -1024
- package/dist/resources/extensions/gsd/complexity-classifier.js +0 -257
- package/dist/resources/extensions/gsd/context-budget.js +0 -187
- package/dist/resources/extensions/gsd/context-store.js +0 -165
- package/dist/resources/extensions/gsd/crash-recovery.js +0 -110
- package/dist/resources/extensions/gsd/dashboard-overlay.js +0 -562
- package/dist/resources/extensions/gsd/db-writer.js +0 -298
- package/dist/resources/extensions/gsd/debug-logger.js +0 -161
- package/dist/resources/extensions/gsd/detection.js +0 -373
- package/dist/resources/extensions/gsd/diff-context.js +0 -168
- package/dist/resources/extensions/gsd/dispatch-guard.js +0 -76
- package/dist/resources/extensions/gsd/doctor-checks.js +0 -563
- package/dist/resources/extensions/gsd/doctor-environment.js +0 -429
- package/dist/resources/extensions/gsd/doctor-format.js +0 -71
- package/dist/resources/extensions/gsd/doctor-proactive.js +0 -239
- package/dist/resources/extensions/gsd/doctor-providers.js +0 -292
- package/dist/resources/extensions/gsd/doctor-types.js +0 -12
- package/dist/resources/extensions/gsd/doctor.js +0 -672
- package/dist/resources/extensions/gsd/error-utils.js +0 -6
- package/dist/resources/extensions/gsd/exit-command.js +0 -11
- package/dist/resources/extensions/gsd/export.js +0 -268
- package/dist/resources/extensions/gsd/file-watcher.js +0 -76
- package/dist/resources/extensions/gsd/files.js +0 -937
- package/dist/resources/extensions/gsd/forensics.js +0 -511
- package/dist/resources/extensions/gsd/git-self-heal.js +0 -113
- package/dist/resources/extensions/gsd/git-service.js +0 -460
- package/dist/resources/extensions/gsd/gsd-db.js +0 -590
- package/dist/resources/extensions/gsd/guided-flow-queue.js +0 -366
- package/dist/resources/extensions/gsd/guided-flow.js +0 -1149
- package/dist/resources/extensions/gsd/health-widget.js +0 -141
- package/dist/resources/extensions/gsd/history.js +0 -118
- package/dist/resources/extensions/gsd/index.js +0 -1250
- package/dist/resources/extensions/gsd/init-wizard.js +0 -479
- package/dist/resources/extensions/gsd/json-persistence.js +0 -62
- package/dist/resources/extensions/gsd/key-manager.js +0 -829
- package/dist/resources/extensions/gsd/marketplace-discovery.js +0 -356
- package/dist/resources/extensions/gsd/md-importer.js +0 -440
- package/dist/resources/extensions/gsd/mechanical-completion.js +0 -351
- package/dist/resources/extensions/gsd/memory-extractor.js +0 -295
- package/dist/resources/extensions/gsd/memory-store.js +0 -351
- package/dist/resources/extensions/gsd/metrics.js +0 -377
- package/dist/resources/extensions/gsd/migrate/command.js +0 -157
- package/dist/resources/extensions/gsd/migrate/index.js +0 -7
- package/dist/resources/extensions/gsd/migrate/parser.js +0 -268
- package/dist/resources/extensions/gsd/migrate/parsers.js +0 -477
- package/dist/resources/extensions/gsd/migrate/preview.js +0 -47
- package/dist/resources/extensions/gsd/migrate/transformer.js +0 -278
- package/dist/resources/extensions/gsd/migrate/types.js +0 -4
- package/dist/resources/extensions/gsd/migrate/validator.js +0 -41
- package/dist/resources/extensions/gsd/migrate/writer.js +0 -477
- package/dist/resources/extensions/gsd/migrate-external.js +0 -130
- package/dist/resources/extensions/gsd/milestone-actions.js +0 -111
- package/dist/resources/extensions/gsd/model-cost-table.js +0 -48
- package/dist/resources/extensions/gsd/model-router.js +0 -187
- package/dist/resources/extensions/gsd/namespaced-registry.js +0 -322
- package/dist/resources/extensions/gsd/namespaced-resolver.js +0 -176
- package/dist/resources/extensions/gsd/native-git-bridge.js +0 -842
- package/dist/resources/extensions/gsd/native-parser-bridge.js +0 -156
- package/dist/resources/extensions/gsd/notifications.js +0 -58
- package/dist/resources/extensions/gsd/observability-validator.js +0 -398
- package/dist/resources/extensions/gsd/parallel-eligibility.js +0 -182
- package/dist/resources/extensions/gsd/parallel-merge.js +0 -121
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +0 -687
- package/dist/resources/extensions/gsd/paths.js +0 -414
- package/dist/resources/extensions/gsd/plugin-importer.js +0 -254
- package/dist/resources/extensions/gsd/post-unit-hooks.js +0 -433
- package/dist/resources/extensions/gsd/preferences-models.js +0 -294
- package/dist/resources/extensions/gsd/preferences-skills.js +0 -154
- package/dist/resources/extensions/gsd/preferences-types.js +0 -73
- package/dist/resources/extensions/gsd/preferences-validation.js +0 -607
- package/dist/resources/extensions/gsd/preferences.js +0 -325
- package/dist/resources/extensions/gsd/progress-score.js +0 -197
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.js +0 -150
- package/dist/resources/extensions/gsd/prompt-compressor.js +0 -393
- package/dist/resources/extensions/gsd/prompt-loader.js +0 -119
- package/dist/resources/extensions/gsd/prompt-ordering.js +0 -170
- package/dist/resources/extensions/gsd/provider-error-pause.js +0 -60
- package/dist/resources/extensions/gsd/queue-order.js +0 -178
- package/dist/resources/extensions/gsd/queue-reorder-ui.js +0 -234
- package/dist/resources/extensions/gsd/quick.js +0 -230
- package/dist/resources/extensions/gsd/repo-identity.js +0 -187
- package/dist/resources/extensions/gsd/roadmap-slices.js +0 -130
- package/dist/resources/extensions/gsd/routing-history.js +0 -210
- package/dist/resources/extensions/gsd/safe-fs.js +0 -52
- package/dist/resources/extensions/gsd/semantic-chunker.js +0 -254
- package/dist/resources/extensions/gsd/session-forensics.js +0 -427
- package/dist/resources/extensions/gsd/session-lock.js +0 -376
- package/dist/resources/extensions/gsd/session-status-io.js +0 -134
- package/dist/resources/extensions/gsd/skill-discovery.js +0 -121
- package/dist/resources/extensions/gsd/skill-health.js +0 -324
- package/dist/resources/extensions/gsd/state.js +0 -653
- package/dist/resources/extensions/gsd/structured-data-formatter.js +0 -97
- package/dist/resources/extensions/gsd/summary-distiller.js +0 -212
- package/dist/resources/extensions/gsd/token-counter.js +0 -54
- package/dist/resources/extensions/gsd/triage-resolution.js +0 -217
- package/dist/resources/extensions/gsd/triage-ui.js +0 -125
- package/dist/resources/extensions/gsd/types.js +0 -4
- package/dist/resources/extensions/gsd/undo.js +0 -210
- package/dist/resources/extensions/gsd/unit-id.js +0 -7
- package/dist/resources/extensions/gsd/unit-runtime.js +0 -130
- package/dist/resources/extensions/gsd/validate-directory.js +0 -143
- package/dist/resources/extensions/gsd/verification-evidence.js +0 -123
- package/dist/resources/extensions/gsd/verification-gate.js +0 -543
- package/dist/resources/extensions/gsd/visualizer-data.js +0 -612
- package/dist/resources/extensions/gsd/visualizer-overlay.js +0 -501
- package/dist/resources/extensions/gsd/visualizer-views.js +0 -893
- package/dist/resources/extensions/gsd/workflow-templates.js +0 -188
- package/dist/resources/extensions/gsd/workspace-index.js +0 -139
- package/dist/resources/extensions/gsd/worktree-command-bootstrap.js +0 -40
- package/dist/resources/extensions/gsd/worktree-command.js +0 -676
- package/dist/resources/extensions/gsd/worktree-manager.js +0 -359
- package/dist/resources/extensions/gsd/worktree.js +0 -236
- package/dist/resources/extensions/mac-tools/index.js +0 -768
- package/dist/resources/extensions/mcp-client/index.js +0 -363
- package/dist/resources/extensions/package.json +0 -3
- package/dist/resources/extensions/remote-questions/config.js +0 -70
- package/dist/resources/extensions/remote-questions/discord-adapter.js +0 -134
- package/dist/resources/extensions/remote-questions/format.js +0 -234
- package/dist/resources/extensions/remote-questions/http-client.js +0 -43
- package/dist/resources/extensions/remote-questions/manager.js +0 -156
- package/dist/resources/extensions/remote-questions/notify.js +0 -89
- package/dist/resources/extensions/remote-questions/remote-command.js +0 -453
- package/dist/resources/extensions/remote-questions/slack-adapter.js +0 -123
- package/dist/resources/extensions/remote-questions/status.js +0 -25
- package/dist/resources/extensions/remote-questions/store.js +0 -70
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +0 -123
- package/dist/resources/extensions/remote-questions/types.js +0 -5
- package/dist/resources/extensions/search-the-web/cache.js +0 -74
- package/dist/resources/extensions/search-the-web/command-search-provider.js +0 -79
- package/dist/resources/extensions/search-the-web/format.js +0 -161
- package/dist/resources/extensions/search-the-web/http.js +0 -178
- package/dist/resources/extensions/search-the-web/index.js +0 -41
- package/dist/resources/extensions/search-the-web/native-search.js +0 -166
- package/dist/resources/extensions/search-the-web/provider.js +0 -143
- package/dist/resources/extensions/search-the-web/tavily.js +0 -82
- package/dist/resources/extensions/search-the-web/tool-fetch-page.js +0 -452
- package/dist/resources/extensions/search-the-web/tool-llm-context.js +0 -455
- package/dist/resources/extensions/search-the-web/tool-search.js +0 -482
- package/dist/resources/extensions/search-the-web/url-utils.js +0 -121
- package/dist/resources/extensions/shared/confirm-ui.js +0 -96
- package/dist/resources/extensions/shared/frontmatter.js +0 -109
- package/dist/resources/extensions/shared/interview-ui.js +0 -569
- package/dist/resources/extensions/shared/next-action-ui.js +0 -168
- package/dist/resources/extensions/shared/sanitize.js +0 -17
- package/dist/resources/extensions/shared/terminal.js +0 -21
- package/dist/resources/extensions/shared/ui.js +0 -245
- package/dist/resources/extensions/shared/wizard-ui.js +0 -478
- package/dist/resources/extensions/slash-commands/audit.js +0 -72
- package/dist/resources/extensions/slash-commands/clear.js +0 -8
- package/dist/resources/extensions/slash-commands/create-extension.js +0 -264
- package/dist/resources/extensions/slash-commands/create-slash-command.js +0 -208
- package/dist/resources/extensions/slash-commands/index.js +0 -10
- package/dist/resources/extensions/subagent/agents.js +0 -103
- package/dist/resources/extensions/subagent/index.js +0 -905
- package/dist/resources/extensions/subagent/isolation.js +0 -384
- package/dist/resources/extensions/subagent/worker-registry.js +0 -73
- package/dist/resources/extensions/ttsr/index.js +0 -144
- package/dist/resources/extensions/ttsr/rule-loader.js +0 -70
- package/dist/resources/extensions/ttsr/ttsr-manager.js +0 -380
- package/dist/resources/extensions/universal-config/discovery.js +0 -94
- package/dist/resources/extensions/universal-config/format.js +0 -178
- package/dist/resources/extensions/universal-config/index.js +0 -99
- package/dist/resources/extensions/universal-config/scanners.js +0 -574
- package/dist/resources/extensions/universal-config/tools.js +0 -57
- package/dist/resources/extensions/universal-config/types.js +0 -8
- package/dist/resources/extensions/voice/index.js +0 -247
- package/dist/startup-timings.d.ts +0 -2
- package/dist/startup-timings.js +0 -22
- package/src/resources/extensions/gsd/commands-bootstrap.ts +0 -252
- package/src/resources/extensions/gsd/tests/quick-branch-lifecycle.test.ts +0 -281
- package/src/resources/extensions/gsd/tests/repo-identity-worktree.test.ts +0 -71
- package/src/resources/extensions/gsd/worktree-command-bootstrap.ts +0 -46
- package/src/resources/extensions/package.json +0 -3
|
@@ -0,0 +1,1041 @@
|
|
|
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
|
+
};
|