byterover-cli 2.6.0 → 3.0.1
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/.env.production +1 -0
- package/README.md +240 -14
- package/dist/agent/core/domain/knowledge/conflict-detector.d.ts +38 -0
- package/dist/agent/core/domain/knowledge/conflict-detector.js +71 -0
- package/dist/agent/core/domain/knowledge/conflict-resolver.d.ts +17 -0
- package/dist/agent/core/domain/knowledge/conflict-resolver.js +118 -0
- package/dist/agent/core/domain/knowledge/utils.d.ts +4 -0
- package/dist/agent/core/domain/knowledge/utils.js +6 -0
- package/dist/agent/core/interfaces/i-curate-service.d.ts +6 -0
- package/dist/agent/infra/tools/implementations/curate-tool.d.ts +67 -34
- package/dist/agent/infra/tools/implementations/curate-tool.js +294 -47
- package/dist/agent/resources/prompts/system-prompt.yml +15 -8
- package/dist/agent/resources/tools/code_exec.txt +3 -0
- package/dist/agent/resources/tools/curate.txt +12 -3
- package/dist/oclif/commands/connectors/install.d.ts +2 -1
- package/dist/oclif/commands/connectors/install.js +38 -3
- package/dist/oclif/commands/curate/index.d.ts +18 -0
- package/dist/oclif/commands/curate/index.js +78 -1
- package/dist/oclif/commands/init.d.ts +12 -0
- package/dist/oclif/commands/init.js +75 -0
- package/dist/oclif/commands/locations.js +1 -1
- package/dist/oclif/commands/providers/connect.d.ts +31 -1
- package/dist/oclif/commands/providers/connect.js +307 -27
- package/dist/oclif/commands/pull.d.ts +1 -0
- package/dist/oclif/commands/pull.js +7 -0
- package/dist/oclif/commands/push.d.ts +1 -0
- package/dist/oclif/commands/push.js +8 -0
- package/dist/oclif/commands/review/approve.d.ts +17 -0
- package/dist/oclif/commands/review/approve.js +37 -0
- package/dist/oclif/commands/review/base-review-decision.d.ts +18 -0
- package/dist/oclif/commands/review/base-review-decision.js +71 -0
- package/dist/oclif/commands/review/pending.d.ts +13 -0
- package/dist/oclif/commands/review/pending.js +94 -0
- package/dist/oclif/commands/review/reject.d.ts +17 -0
- package/dist/oclif/commands/review/reject.js +38 -0
- package/dist/oclif/commands/space/list.d.ts +2 -2
- package/dist/oclif/commands/space/list.js +13 -35
- package/dist/oclif/commands/space/switch.d.ts +2 -7
- package/dist/oclif/commands/space/switch.js +13 -56
- package/dist/oclif/commands/status.d.ts +1 -0
- package/dist/oclif/commands/status.js +11 -1
- package/dist/oclif/commands/vc/add.d.ts +7 -0
- package/dist/oclif/commands/vc/add.js +29 -0
- package/dist/oclif/commands/vc/branch.d.ts +15 -0
- package/dist/oclif/commands/vc/branch.js +70 -0
- package/dist/oclif/commands/vc/checkout.d.ts +14 -0
- package/dist/oclif/commands/vc/checkout.js +47 -0
- package/dist/oclif/commands/vc/clone.d.ts +9 -0
- package/dist/oclif/commands/vc/clone.js +61 -0
- package/dist/oclif/commands/vc/commit.d.ts +10 -0
- package/dist/oclif/commands/vc/commit.js +32 -0
- package/dist/oclif/commands/vc/config.d.ts +10 -0
- package/dist/oclif/commands/vc/config.js +30 -0
- package/dist/oclif/commands/vc/fetch.d.ts +10 -0
- package/dist/oclif/commands/vc/fetch.js +42 -0
- package/dist/oclif/commands/vc/index.d.ts +6 -0
- package/dist/oclif/commands/vc/index.js +8 -0
- package/dist/oclif/commands/vc/init.d.ts +6 -0
- package/dist/oclif/commands/vc/init.js +25 -0
- package/dist/oclif/commands/vc/log.d.ts +13 -0
- package/dist/oclif/commands/vc/log.js +48 -0
- package/dist/oclif/commands/vc/merge.d.ts +19 -0
- package/dist/oclif/commands/vc/merge.js +130 -0
- package/dist/oclif/commands/vc/pull.d.ts +13 -0
- package/dist/oclif/commands/vc/pull.js +60 -0
- package/dist/oclif/commands/vc/push.d.ts +13 -0
- package/dist/oclif/commands/vc/push.js +60 -0
- package/dist/oclif/commands/vc/remote/add.d.ts +10 -0
- package/dist/oclif/commands/vc/remote/add.js +30 -0
- package/dist/oclif/commands/vc/remote/index.d.ts +6 -0
- package/dist/oclif/commands/vc/remote/index.js +16 -0
- package/dist/oclif/commands/vc/remote/set-url.d.ts +10 -0
- package/dist/oclif/commands/vc/remote/set-url.js +30 -0
- package/dist/oclif/commands/vc/reset.d.ts +13 -0
- package/dist/oclif/commands/vc/reset.js +62 -0
- package/dist/oclif/commands/vc/status.d.ts +8 -0
- package/dist/oclif/commands/vc/status.js +106 -0
- package/dist/oclif/hooks/init/validate-brv-config.d.ts +26 -0
- package/dist/oclif/hooks/init/validate-brv-config.js +62 -0
- package/dist/oclif/lib/daemon-client.d.ts +2 -0
- package/dist/oclif/lib/daemon-client.js +36 -10
- package/dist/oclif/lib/prompt-utils.d.ts +43 -0
- package/dist/oclif/lib/prompt-utils.js +84 -0
- package/dist/oclif/lib/spinner.d.ts +8 -0
- package/dist/oclif/lib/spinner.js +23 -0
- package/dist/oclif/lib/task-client.d.ts +5 -0
- package/dist/oclif/lib/task-client.js +15 -2
- package/dist/server/config/environment.d.ts +2 -0
- package/dist/server/config/environment.js +2 -0
- package/dist/server/constants.d.ts +3 -0
- package/dist/server/constants.js +9 -0
- package/dist/server/core/domain/entities/auth-token.d.ts +2 -0
- package/dist/server/core/domain/entities/auth-token.js +7 -1
- package/dist/server/core/domain/entities/curate-log-entry.d.ts +11 -0
- package/dist/server/core/domain/entities/space.d.ts +4 -0
- package/dist/server/core/domain/entities/space.js +8 -0
- package/dist/server/core/domain/entities/team.d.ts +2 -0
- package/dist/server/core/domain/entities/team.js +4 -0
- package/dist/server/core/domain/errors/git-error.d.ts +6 -0
- package/dist/server/core/domain/errors/git-error.js +12 -0
- package/dist/server/core/domain/errors/task-error.d.ts +4 -0
- package/dist/server/core/domain/errors/task-error.js +8 -0
- package/dist/server/core/domain/errors/vc-error.d.ts +5 -0
- package/dist/server/core/domain/errors/vc-error.js +8 -0
- package/dist/server/core/domain/knowledge/markdown-writer.d.ts +4 -1
- package/dist/server/core/domain/knowledge/markdown-writer.js +37 -7
- package/dist/server/core/domain/transport/schemas.d.ts +6 -6
- package/dist/server/core/interfaces/context-tree/i-context-tree-service.d.ts +11 -0
- package/dist/server/core/interfaces/process/i-task-lifecycle-hook.d.ts +6 -0
- package/dist/server/core/interfaces/services/i-git-service.d.ts +234 -0
- package/dist/server/core/interfaces/services/i-git-service.js +1 -0
- package/dist/server/core/interfaces/storage/i-curate-log-store.d.ts +5 -0
- package/dist/server/core/interfaces/storage/i-review-backup-store.d.ts +19 -0
- package/dist/server/core/interfaces/storage/i-review-backup-store.js +1 -0
- package/dist/server/core/interfaces/vc/i-vc-git-config-store.d.ts +8 -0
- package/dist/server/core/interfaces/vc/i-vc-git-config-store.js +1 -0
- package/dist/server/infra/config/auto-init.d.ts +0 -2
- package/dist/server/infra/config/auto-init.js +0 -1
- package/dist/server/infra/context-tree/file-context-tree-service.d.ts +2 -0
- package/dist/server/infra/context-tree/file-context-tree-service.js +13 -0
- package/dist/server/infra/daemon/brv-server.js +23 -3
- package/dist/server/infra/git/cogit-url.d.ts +17 -0
- package/dist/server/infra/git/cogit-url.js +39 -0
- package/dist/server/infra/git/git-http-wrapper.d.ts +20 -0
- package/dist/server/infra/git/git-http-wrapper.js +334 -0
- package/dist/server/infra/git/isomorphic-git-service.d.ts +78 -0
- package/dist/server/infra/git/isomorphic-git-service.js +983 -0
- package/dist/server/infra/http/review-api-handler.d.ts +13 -0
- package/dist/server/infra/http/review-api-handler.js +286 -0
- package/dist/server/infra/http/review-ui.d.ts +7 -0
- package/dist/server/infra/http/review-ui.js +606 -0
- package/dist/server/infra/mcp/tools/brv-curate-tool.d.ts +2 -2
- package/dist/server/infra/process/curate-log-handler.d.ts +18 -2
- package/dist/server/infra/process/curate-log-handler.js +50 -13
- package/dist/server/infra/process/feature-handlers.js +41 -1
- package/dist/server/infra/process/task-router.js +16 -0
- package/dist/server/infra/space/http-space-service.js +2 -0
- package/dist/server/infra/storage/file-curate-log-store.d.ts +10 -0
- package/dist/server/infra/storage/file-curate-log-store.js +35 -0
- package/dist/server/infra/storage/file-review-backup-store.d.ts +29 -0
- package/dist/server/infra/storage/file-review-backup-store.js +121 -0
- package/dist/server/infra/transport/handlers/auth-handler.js +9 -5
- package/dist/server/infra/transport/handlers/handler-types.d.ts +9 -0
- package/dist/server/infra/transport/handlers/handler-types.js +11 -0
- package/dist/server/infra/transport/handlers/index.d.ts +4 -0
- package/dist/server/infra/transport/handlers/index.js +2 -0
- package/dist/server/infra/transport/handlers/init-handler.d.ts +1 -0
- package/dist/server/infra/transport/handlers/init-handler.js +13 -1
- package/dist/server/infra/transport/handlers/pull-handler.d.ts +3 -0
- package/dist/server/infra/transport/handlers/pull-handler.js +5 -1
- package/dist/server/infra/transport/handlers/push-handler.d.ts +20 -0
- package/dist/server/infra/transport/handlers/push-handler.js +116 -14
- package/dist/server/infra/transport/handlers/reset-handler.d.ts +11 -0
- package/dist/server/infra/transport/handlers/reset-handler.js +37 -1
- package/dist/server/infra/transport/handlers/review-handler.d.ts +35 -0
- package/dist/server/infra/transport/handlers/review-handler.js +162 -0
- package/dist/server/infra/transport/handlers/space-handler.d.ts +3 -0
- package/dist/server/infra/transport/handlers/space-handler.js +4 -1
- package/dist/server/infra/transport/handlers/status-handler.d.ts +5 -0
- package/dist/server/infra/transport/handlers/status-handler.js +51 -16
- package/dist/server/infra/transport/handlers/vc-handler.d.ts +100 -0
- package/dist/server/infra/transport/handlers/vc-handler.js +1050 -0
- package/dist/server/infra/transport/socket-io-transport-server.d.ts +7 -0
- package/dist/server/infra/transport/socket-io-transport-server.js +12 -1
- package/dist/server/infra/transport/transport-connector.d.ts +1 -1
- package/dist/server/infra/transport/transport-connector.js +2 -1
- package/dist/server/infra/vc/file-vc-git-config-store.d.ts +11 -0
- package/dist/server/infra/vc/file-vc-git-config-store.js +43 -0
- package/dist/server/templates/skill/SKILL.md +167 -33
- package/dist/server/utils/curate-result-parser.d.ts +64 -0
- package/dist/server/utils/curate-result-parser.js +8 -0
- package/dist/server/utils/gitignore.d.ts +9 -0
- package/dist/server/utils/gitignore.js +47 -0
- package/dist/shared/transport/events/index.d.ts +6 -0
- package/dist/shared/transport/events/index.js +3 -0
- package/dist/shared/transport/events/init-events.d.ts +8 -0
- package/dist/shared/transport/events/init-events.js +1 -0
- package/dist/shared/transport/events/push-events.d.ts +6 -0
- package/dist/shared/transport/events/review-events.d.ts +41 -0
- package/dist/shared/transport/events/review-events.js +5 -0
- package/dist/shared/transport/events/vc-events.d.ts +257 -0
- package/dist/shared/transport/events/vc-events.js +67 -0
- package/dist/shared/transport/types/dto.d.ts +6 -1
- package/dist/tui/app/pages/init-project-page.d.ts +9 -0
- package/dist/tui/app/pages/init-project-page.js +54 -0
- package/dist/tui/app/pages/protected-routes.js +14 -6
- package/dist/tui/components/index.d.ts +0 -2
- package/dist/tui/components/index.js +0 -1
- package/dist/tui/features/activity/hooks/use-activity-logs.js +7 -1
- package/dist/tui/features/commands/definitions/index.js +3 -0
- package/dist/tui/features/commands/definitions/space-list.js +9 -18
- package/dist/tui/features/commands/definitions/space-switch.js +10 -6
- package/dist/tui/features/commands/definitions/vc-add.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-add.js +15 -0
- package/dist/tui/features/commands/definitions/vc-branch.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-branch.js +33 -0
- package/dist/tui/features/commands/definitions/vc-checkout.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-checkout.js +32 -0
- package/dist/tui/features/commands/definitions/vc-clone.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-clone.js +18 -0
- package/dist/tui/features/commands/definitions/vc-commit.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-commit.js +32 -0
- package/dist/tui/features/commands/definitions/vc-config.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-config.js +40 -0
- package/dist/tui/features/commands/definitions/vc-fetch.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-fetch.js +37 -0
- package/dist/tui/features/commands/definitions/vc-init.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-init.js +11 -0
- package/dist/tui/features/commands/definitions/vc-log.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-log.js +25 -0
- package/dist/tui/features/commands/definitions/vc-merge.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-merge.js +48 -0
- package/dist/tui/features/commands/definitions/vc-pull.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-pull.js +42 -0
- package/dist/tui/features/commands/definitions/vc-push.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-push.js +38 -0
- package/dist/tui/features/commands/definitions/vc-remote.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-remote.js +57 -0
- package/dist/tui/features/commands/definitions/vc-reset.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-reset.js +35 -0
- package/dist/tui/features/commands/definitions/vc-status.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-status.js +11 -0
- package/dist/tui/features/commands/definitions/vc.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc.js +36 -0
- package/dist/tui/features/commands/hooks/use-slash-command-processor.js +5 -5
- package/dist/tui/features/log/api/execute-log.d.ts +8 -0
- package/dist/tui/features/log/api/execute-log.js +13 -0
- package/dist/tui/features/log/components/log-flow.d.ts +14 -0
- package/dist/tui/features/log/components/log-flow.js +29 -0
- package/dist/tui/features/log/utils/format-log.d.ts +3 -0
- package/dist/tui/features/log/utils/format-log.js +42 -0
- package/dist/tui/features/onboarding/hooks/use-app-view-mode.d.ts +9 -5
- package/dist/tui/features/onboarding/hooks/use-app-view-mode.js +12 -5
- package/dist/tui/features/push/components/push-flow.js +9 -2
- package/dist/tui/features/reset/components/reset-flow.js +2 -1
- package/dist/tui/features/status/components/status-view.js +2 -1
- package/dist/tui/features/status/utils/format-status.js +9 -0
- package/dist/tui/features/tasks/hooks/use-task-subscriptions.js +11 -0
- package/dist/tui/features/tasks/stores/tasks-store.d.ts +10 -0
- package/dist/tui/features/tasks/stores/tasks-store.js +16 -0
- package/dist/tui/features/vc/add/api/execute-vc-add.d.ts +8 -0
- package/dist/tui/features/vc/add/api/execute-vc-add.js +13 -0
- package/dist/tui/features/vc/add/components/vc-add-flow.d.ts +7 -0
- package/dist/tui/features/vc/add/components/vc-add-flow.js +35 -0
- package/dist/tui/features/vc/branch/api/execute-vc-branch.d.ts +8 -0
- package/dist/tui/features/vc/branch/api/execute-vc-branch.js +13 -0
- package/dist/tui/features/vc/branch/components/vc-branch-flow.d.ts +8 -0
- package/dist/tui/features/vc/branch/components/vc-branch-flow.js +53 -0
- package/dist/tui/features/vc/branch/utils/format-branch.d.ts +4 -0
- package/dist/tui/features/vc/branch/utils/format-branch.js +12 -0
- package/dist/tui/features/vc/checkout/api/execute-vc-checkout.d.ts +8 -0
- package/dist/tui/features/vc/checkout/api/execute-vc-checkout.js +13 -0
- package/dist/tui/features/vc/checkout/components/vc-checkout-flow.d.ts +8 -0
- package/dist/tui/features/vc/checkout/components/vc-checkout-flow.js +33 -0
- package/dist/tui/features/vc/clone/api/execute-vc-clone.d.ts +8 -0
- package/dist/tui/features/vc/clone/api/execute-vc-clone.js +13 -0
- package/dist/tui/features/vc/clone/components/vc-clone-flow.d.ts +7 -0
- package/dist/tui/features/vc/clone/components/vc-clone-flow.js +79 -0
- package/dist/tui/features/vc/commit/api/execute-vc-commit.d.ts +8 -0
- package/dist/tui/features/vc/commit/api/execute-vc-commit.js +13 -0
- package/dist/tui/features/vc/commit/components/vc-commit-flow.d.ts +7 -0
- package/dist/tui/features/vc/commit/components/vc-commit-flow.js +29 -0
- package/dist/tui/features/vc/config/api/execute-vc-config.d.ts +8 -0
- package/dist/tui/features/vc/config/api/execute-vc-config.js +13 -0
- package/dist/tui/features/vc/config/components/vc-config-flow.d.ts +9 -0
- package/dist/tui/features/vc/config/components/vc-config-flow.js +30 -0
- package/dist/tui/features/vc/fetch/api/execute-vc-fetch.d.ts +8 -0
- package/dist/tui/features/vc/fetch/api/execute-vc-fetch.js +13 -0
- package/dist/tui/features/vc/fetch/components/vc-fetch-flow.d.ts +8 -0
- package/dist/tui/features/vc/fetch/components/vc-fetch-flow.js +75 -0
- package/dist/tui/features/vc/init/api/execute-vc-init.d.ts +8 -0
- package/dist/tui/features/vc/init/api/execute-vc-init.js +13 -0
- package/dist/tui/features/vc/init/components/vc-init-flow.d.ts +10 -0
- package/dist/tui/features/vc/init/components/vc-init-flow.js +37 -0
- package/dist/tui/features/vc/merge/api/execute-vc-merge.d.ts +8 -0
- package/dist/tui/features/vc/merge/api/execute-vc-merge.js +13 -0
- package/dist/tui/features/vc/merge/components/vc-merge-flow.d.ts +11 -0
- package/dist/tui/features/vc/merge/components/vc-merge-flow.js +72 -0
- package/dist/tui/features/vc/pull/api/execute-vc-pull.d.ts +8 -0
- package/dist/tui/features/vc/pull/api/execute-vc-pull.js +13 -0
- package/dist/tui/features/vc/pull/components/vc-pull-flow.d.ts +9 -0
- package/dist/tui/features/vc/pull/components/vc-pull-flow.js +83 -0
- package/dist/tui/features/vc/push/api/execute-vc-push.d.ts +8 -0
- package/dist/tui/features/vc/push/api/execute-vc-push.js +13 -0
- package/dist/tui/features/vc/push/components/vc-push-flow.d.ts +8 -0
- package/dist/tui/features/vc/push/components/vc-push-flow.js +83 -0
- package/dist/tui/features/vc/remote/api/execute-vc-remote.d.ts +8 -0
- package/dist/tui/features/vc/remote/api/execute-vc-remote.js +13 -0
- package/dist/tui/features/vc/remote/components/vc-remote-flow.d.ts +9 -0
- package/dist/tui/features/vc/remote/components/vc-remote-flow.js +42 -0
- package/dist/tui/features/vc/reset/api/execute-vc-reset.d.ts +8 -0
- package/dist/tui/features/vc/reset/api/execute-vc-reset.js +13 -0
- package/dist/tui/features/vc/reset/components/vc-reset-flow.d.ts +10 -0
- package/dist/tui/features/vc/reset/components/vc-reset-flow.js +63 -0
- package/dist/tui/features/vc/status/api/execute-vc-status.d.ts +8 -0
- package/dist/tui/features/vc/status/api/execute-vc-status.js +13 -0
- package/dist/tui/features/vc/status/components/vc-status-flow.d.ts +10 -0
- package/dist/tui/features/vc/status/components/vc-status-flow.js +133 -0
- package/dist/tui/lib/environment.d.ts +8 -0
- package/dist/tui/lib/environment.js +8 -0
- package/dist/tui/utils/error-messages.d.ts +5 -1
- package/dist/tui/utils/error-messages.js +32 -3
- package/oclif.manifest.json +1018 -98
- package/package.json +9 -3
- package/dist/oclif/hooks/prerun/validate-brv-config-version.d.ts +0 -33
- package/dist/oclif/hooks/prerun/validate-brv-config-version.js +0 -86
- package/dist/tui/components/init.d.ts +0 -33
- package/dist/tui/components/init.js +0 -234
- package/dist/tui/features/space/api/get-spaces.d.ts +0 -16
- package/dist/tui/features/space/api/get-spaces.js +0 -17
- package/dist/tui/features/space/api/switch-space.d.ts +0 -11
- package/dist/tui/features/space/api/switch-space.js +0 -24
- package/dist/tui/features/space/components/space-list-view.d.ts +0 -12
- package/dist/tui/features/space/components/space-list-view.js +0 -56
- package/dist/tui/features/space/components/space-switch-flow.d.ts +0 -13
- package/dist/tui/features/space/components/space-switch-flow.js +0 -97
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { VcEvents, } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import { useTransportStore } from '../../../../stores/transport-store.js';
|
|
4
|
+
export const executeVcPush = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.PUSH, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcPush = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcPush,
|
|
13
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
3
|
+
type VcPushFlowProps = CustomDialogCallbacks & {
|
|
4
|
+
branch?: string;
|
|
5
|
+
setUpstream?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function VcPushFlow({ branch, onCancel, onComplete, setUpstream }: VcPushFlowProps): React.ReactNode;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useInput } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { VcErrorCode } from '../../../../../shared/transport/events/vc-events.js';
|
|
6
|
+
import { InlineInput } from '../../../../components/inline-prompts/inline-input.js';
|
|
7
|
+
import { useTheme } from '../../../../hooks/index.js';
|
|
8
|
+
import { getWebAppUrl } from '../../../../lib/environment.js';
|
|
9
|
+
import { formatTransportError, getTransportErrorCode } from '../../../../utils/error-messages.js';
|
|
10
|
+
import { useExecuteVcRemote } from '../../remote/api/execute-vc-remote.js';
|
|
11
|
+
import { useExecuteVcPush } from '../api/execute-vc-push.js';
|
|
12
|
+
function validateRemoteUrl(value) {
|
|
13
|
+
if (!value)
|
|
14
|
+
return 'URL is required';
|
|
15
|
+
try {
|
|
16
|
+
const parsed = new URL(value);
|
|
17
|
+
if (parsed.protocol !== 'https:') {
|
|
18
|
+
return 'URL must start with https://';
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return 'Invalid URL';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function VcPushFlow({ branch, onCancel, onComplete, setUpstream }) {
|
|
27
|
+
const { theme: { colors }, } = useTheme();
|
|
28
|
+
const [step, setStep] = useState('pushing');
|
|
29
|
+
const pushMutation = useExecuteVcPush();
|
|
30
|
+
const remoteMutation = useExecuteVcRemote();
|
|
31
|
+
useInput((_, key) => {
|
|
32
|
+
if (key.escape && !pushMutation.isPending && !remoteMutation.isPending) {
|
|
33
|
+
onCancel();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const executePush = useCallback((overrideSetUpstream) => {
|
|
37
|
+
pushMutation.mutate({ branch, setUpstream: overrideSetUpstream ?? setUpstream }, {
|
|
38
|
+
onError(error) {
|
|
39
|
+
if (getTransportErrorCode(error) === VcErrorCode.NO_REMOTE) {
|
|
40
|
+
setStep('configuring_remote');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
onComplete(`Failed to push: ${formatTransportError(error)}`);
|
|
44
|
+
},
|
|
45
|
+
onSuccess(result) {
|
|
46
|
+
if (result.alreadyUpToDate) {
|
|
47
|
+
onComplete('Everything up-to-date.');
|
|
48
|
+
}
|
|
49
|
+
else if (result.upstreamSet) {
|
|
50
|
+
onComplete(`Pushed to origin/${result.branch} and set upstream.`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
onComplete(`Pushed to origin/${result.branch}.`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}, [branch, onComplete, pushMutation, setUpstream]);
|
|
58
|
+
const fired = useRef(false);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (fired.current)
|
|
61
|
+
return;
|
|
62
|
+
fired.current = true;
|
|
63
|
+
executePush();
|
|
64
|
+
}, []);
|
|
65
|
+
const handleUrlSubmit = useCallback((url) => {
|
|
66
|
+
remoteMutation.mutate({ subcommand: 'add', url }, {
|
|
67
|
+
onError(error) {
|
|
68
|
+
onComplete(`Failed to add remote: ${formatTransportError(error)}`);
|
|
69
|
+
},
|
|
70
|
+
onSuccess() {
|
|
71
|
+
setStep('pushing');
|
|
72
|
+
executePush(true);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}, [executePush, onComplete, remoteMutation]);
|
|
76
|
+
if (step === 'configuring_remote') {
|
|
77
|
+
if (remoteMutation.isPending) {
|
|
78
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Adding remote..."] }));
|
|
79
|
+
}
|
|
80
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: colors.warning, children: "No remote configured." }), _jsx(Text, {}), _jsx(Text, { children: "To connect to cloud:" }), _jsxs(Text, { children: [" Go to ", _jsx(Text, { bold: true, children: getWebAppUrl() }), " \u2192 create or open a Space"] }), _jsx(Text, { children: " and copy the remote URL." })] }), _jsx(InlineInput, { message: "Paste your remote URL:", onSubmit: handleUrlSubmit, validate: validateRemoteUrl })] }));
|
|
81
|
+
}
|
|
82
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " ", branch ? `Pushing to origin/${branch}...` : 'Pushing...'] }));
|
|
83
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcRemoteRequest, type IVcRemoteResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcRemote: (request: IVcRemoteRequest) => Promise<IVcRemoteResponse>;
|
|
4
|
+
type UseExecuteVcRemoteOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcRemote>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcRemote: ({ mutationConfig }?: UseExecuteVcRemoteOptions) => import("@tanstack/react-query").UseMutationResult<IVcRemoteResponse, Error, IVcRemoteRequest, unknown>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { VcEvents, } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import { useTransportStore } from '../../../../stores/transport-store.js';
|
|
4
|
+
export const executeVcRemote = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.REMOTE, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcRemote = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcRemote,
|
|
13
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { VcRemoteSubcommand } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
4
|
+
type VcRemoteFlowProps = CustomDialogCallbacks & {
|
|
5
|
+
subcommand: VcRemoteSubcommand;
|
|
6
|
+
url?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function VcRemoteFlow({ onCancel, onComplete, subcommand, url }: VcRemoteFlowProps): React.ReactNode;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text, useInput } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { formatTransportError } from '../../../../utils/error-messages.js';
|
|
6
|
+
import { useExecuteVcRemote } from '../api/execute-vc-remote.js';
|
|
7
|
+
const LABELS = {
|
|
8
|
+
add: 'Adding remote...',
|
|
9
|
+
'set-url': 'Updating remote...',
|
|
10
|
+
show: 'Fetching remote...',
|
|
11
|
+
};
|
|
12
|
+
export function VcRemoteFlow({ onCancel, onComplete, subcommand, url }) {
|
|
13
|
+
const remoteMutation = useExecuteVcRemote();
|
|
14
|
+
useInput((_, key) => {
|
|
15
|
+
if (key.escape && !remoteMutation.isPending) {
|
|
16
|
+
onCancel();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const fired = React.useRef(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (fired.current)
|
|
22
|
+
return;
|
|
23
|
+
fired.current = true;
|
|
24
|
+
remoteMutation.mutate({ subcommand, url }, {
|
|
25
|
+
onError(error) {
|
|
26
|
+
onComplete(`Failed: ${formatTransportError(error)}`);
|
|
27
|
+
},
|
|
28
|
+
onSuccess(result) {
|
|
29
|
+
if (result.action === 'show') {
|
|
30
|
+
onComplete(result.url ? `origin: ${result.url}` : 'No remote configured.');
|
|
31
|
+
}
|
|
32
|
+
else if (result.action === 'add') {
|
|
33
|
+
onComplete(`Remote 'origin' set to ${result.url}.`);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
onComplete(`Remote 'origin' updated to ${result.url}.`);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}, []);
|
|
41
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " ", LABELS[subcommand]] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcResetRequest, type IVcResetResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcReset: (request: IVcResetRequest) => Promise<IVcResetResponse>;
|
|
4
|
+
type UseExecuteVcResetOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcReset>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcReset: ({ mutationConfig }?: UseExecuteVcResetOptions) => import("@tanstack/react-query").UseMutationResult<IVcResetResponse, Error, IVcResetRequest, unknown>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { VcEvents } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import { useTransportStore } from '../../../../stores/transport-store.js';
|
|
4
|
+
export const executeVcReset = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.RESET, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcReset = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcReset,
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { VcResetMode } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
4
|
+
type VcResetFlowProps = CustomDialogCallbacks & {
|
|
5
|
+
filePaths?: string[];
|
|
6
|
+
mode?: VcResetMode;
|
|
7
|
+
ref?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function VcResetFlow({ filePaths, mode, onCancel, onComplete, ref }: VcResetFlowProps): React.ReactNode;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text, useInput } from 'ink';
|
|
3
|
+
import Spinner from 'ink-spinner';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
import { InlineConfirm } from '../../../../components/inline-prompts/inline-confirm.js';
|
|
6
|
+
import { formatTransportError } from '../../../../utils/error-messages.js';
|
|
7
|
+
import { useExecuteVcReset } from '../api/execute-vc-reset.js';
|
|
8
|
+
export function VcResetFlow({ filePaths, mode, onCancel, onComplete, ref }) {
|
|
9
|
+
const needsConfirm = mode === 'hard';
|
|
10
|
+
const [step, setStep] = useState(needsConfirm ? 'confirm' : 'executing');
|
|
11
|
+
const resetMutation = useExecuteVcReset();
|
|
12
|
+
useInput((_, key) => {
|
|
13
|
+
if (key.escape && !resetMutation.isPending) {
|
|
14
|
+
onCancel();
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (step !== 'executing')
|
|
19
|
+
return;
|
|
20
|
+
const request = filePaths
|
|
21
|
+
? { filePaths }
|
|
22
|
+
: { mode: mode ?? 'mixed', ref };
|
|
23
|
+
resetMutation.mutate(request, {
|
|
24
|
+
onError(error) {
|
|
25
|
+
onComplete(`Failed to reset: ${formatTransportError(error)}`);
|
|
26
|
+
},
|
|
27
|
+
onSuccess(result) {
|
|
28
|
+
if (result.filesUnstaged === undefined) {
|
|
29
|
+
if (result.headSha) {
|
|
30
|
+
onComplete(`HEAD is now at ${result.headSha.slice(0, 7)}`);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
onComplete(''); // Empty repo — silent no-op, matches git
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (result.filesUnstaged === 0) {
|
|
37
|
+
onComplete('Nothing to unstage.');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
onComplete(`Unstaged ${result.filesUnstaged} file(s).`);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}, [step]);
|
|
45
|
+
if (step === 'confirm') {
|
|
46
|
+
return (_jsx(InlineConfirm, { default: false, message: `This will discard all changes and reset to ${ref ?? 'HEAD'}. Continue`, onConfirm: (confirmed) => {
|
|
47
|
+
if (confirmed) {
|
|
48
|
+
setStep('executing');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
onComplete('Reset cancelled.');
|
|
52
|
+
}
|
|
53
|
+
} }));
|
|
54
|
+
}
|
|
55
|
+
const label = filePaths
|
|
56
|
+
? `Unstaging ${filePaths.join(' ')}...`
|
|
57
|
+
: mode === 'soft'
|
|
58
|
+
? `Soft resetting to ${ref ?? 'HEAD'}...`
|
|
59
|
+
: mode === 'hard'
|
|
60
|
+
? `Hard resetting to ${ref ?? 'HEAD'}...`
|
|
61
|
+
: 'Unstaging all files...';
|
|
62
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " ", label] }));
|
|
63
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcStatusResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcStatus: () => Promise<IVcStatusResponse>;
|
|
4
|
+
type UseExecuteVcStatusOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcStatus>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcStatus: ({ mutationConfig }?: UseExecuteVcStatusOptions) => import("@tanstack/react-query").UseMutationResult<IVcStatusResponse, Error, undefined, unknown>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMutation } from '@tanstack/react-query';
|
|
2
|
+
import { VcEvents } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import { useTransportStore } from '../../../../stores/transport-store.js';
|
|
4
|
+
export const executeVcStatus = () => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.STATUS, {});
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcStatus = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcStatus,
|
|
13
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VcStatusFlow Component
|
|
3
|
+
*
|
|
4
|
+
* Shows git status of the context tree via VcHandler.
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
8
|
+
type VcStatusFlowProps = CustomDialogCallbacks;
|
|
9
|
+
export declare function VcStatusFlow({ onCancel, onComplete }: VcStatusFlowProps): React.ReactNode;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* VcStatusFlow Component
|
|
4
|
+
*
|
|
5
|
+
* Shows git status of the context tree via VcHandler.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { Text, useInput } from 'ink';
|
|
9
|
+
import Spinner from 'ink-spinner';
|
|
10
|
+
import React, { useEffect } from 'react';
|
|
11
|
+
import { formatTransportError } from '../../../../utils/error-messages.js';
|
|
12
|
+
import { useExecuteVcStatus } from '../api/execute-vc-status.js';
|
|
13
|
+
// eslint-disable-next-line complexity
|
|
14
|
+
function formatVcStatus(result) {
|
|
15
|
+
if (!result.initialized) {
|
|
16
|
+
return chalk.yellow('Git repository not initialized — run `/vc init` to initialize');
|
|
17
|
+
}
|
|
18
|
+
const lines = [chalk.bold(`On branch ${result.branch ?? '(detached HEAD)'}`)];
|
|
19
|
+
if (result.hasCommits === false) {
|
|
20
|
+
lines.push(chalk.yellow('No commits yet'));
|
|
21
|
+
}
|
|
22
|
+
if (result.trackingBranch) {
|
|
23
|
+
const ahead = result.ahead ?? 0;
|
|
24
|
+
const behind = result.behind ?? 0;
|
|
25
|
+
if (ahead > 0 && behind > 0) {
|
|
26
|
+
lines.push(`Your branch and '${result.trackingBranch}' have diverged,\n` +
|
|
27
|
+
`and have ${ahead} and ${behind} different commits each, respectively.`);
|
|
28
|
+
}
|
|
29
|
+
else if (ahead > 0) {
|
|
30
|
+
lines.push(`Your branch is ahead of '${result.trackingBranch}' by ${ahead} commit${ahead === 1 ? '' : 's'}.`);
|
|
31
|
+
}
|
|
32
|
+
else if (behind > 0) {
|
|
33
|
+
lines.push(`Your branch is behind '${result.trackingBranch}' by ${behind} commit${behind === 1 ? '' : 's'}.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const { staged, unstaged, untracked } = result;
|
|
37
|
+
const hasChanges = staged.added.length > 0 ||
|
|
38
|
+
staged.modified.length > 0 ||
|
|
39
|
+
staged.deleted.length > 0 ||
|
|
40
|
+
unstaged.modified.length > 0 ||
|
|
41
|
+
unstaged.deleted.length > 0 ||
|
|
42
|
+
untracked.length > 0;
|
|
43
|
+
if (result.mergeInProgress) {
|
|
44
|
+
const hasUnmerged = result.unmerged && result.unmerged.length > 0;
|
|
45
|
+
if (hasUnmerged) {
|
|
46
|
+
lines.push(chalk.yellow('You have unmerged paths.'));
|
|
47
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
48
|
+
lines.push(chalk.yellow(' (fix conflicts and run "/vc add", then "/vc merge --continue")'));
|
|
49
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
50
|
+
lines.push('');
|
|
51
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
52
|
+
lines.push(chalk.bold('Unmerged paths:'));
|
|
53
|
+
for (const f of result.unmerged) {
|
|
54
|
+
const label = f.type === 'deleted_modified'
|
|
55
|
+
? 'deleted by them'
|
|
56
|
+
: f.type === 'both_added'
|
|
57
|
+
? 'both added'
|
|
58
|
+
: 'both modified';
|
|
59
|
+
lines.push(chalk.red(` ${label}: ${f.path}`));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
lines.push(chalk.yellow('All conflicts fixed but you are still merging.'));
|
|
64
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
65
|
+
lines.push(chalk.yellow(' (use "/vc merge --continue" to conclude merge)'));
|
|
66
|
+
if (!hasChanges)
|
|
67
|
+
return lines.join('\n');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (!hasChanges && !(result.conflictMarkerFiles && result.conflictMarkerFiles.length > 0)) {
|
|
71
|
+
lines.push('Nothing to commit, working tree clean');
|
|
72
|
+
return lines.join('\n');
|
|
73
|
+
}
|
|
74
|
+
if (result.conflictMarkerFiles && result.conflictMarkerFiles.length > 0) {
|
|
75
|
+
lines.push(chalk.yellow('Files with conflict markers:'));
|
|
76
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
77
|
+
lines.push(chalk.yellow(' (resolve conflicts and run "/vc add" before pushing)'));
|
|
78
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
79
|
+
lines.push('');
|
|
80
|
+
for (const f of result.conflictMarkerFiles) {
|
|
81
|
+
lines.push(chalk.red(` ${f} (conflict)`));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (staged.added.length > 0 || staged.modified.length > 0 || staged.deleted.length > 0) {
|
|
85
|
+
lines.push(chalk.bold('Changes to be committed:'));
|
|
86
|
+
for (const f of staged.added)
|
|
87
|
+
lines.push(chalk.green(` new file: ${f}`));
|
|
88
|
+
for (const f of staged.modified)
|
|
89
|
+
lines.push(chalk.green(` modified: ${f}`));
|
|
90
|
+
for (const f of staged.deleted)
|
|
91
|
+
lines.push(chalk.green(` deleted: ${f}`));
|
|
92
|
+
}
|
|
93
|
+
if (unstaged.modified.length > 0 || unstaged.deleted.length > 0) {
|
|
94
|
+
lines.push(chalk.bold('Changes not staged for commit:'));
|
|
95
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
96
|
+
lines.push(chalk.bold('(use "/vc add ‹file>..." to include in what will be committed)'));
|
|
97
|
+
for (const f of unstaged.modified)
|
|
98
|
+
lines.push(chalk.red(` modified: ${f}`));
|
|
99
|
+
for (const f of unstaged.deleted)
|
|
100
|
+
lines.push(chalk.red(` deleted: ${f}`));
|
|
101
|
+
}
|
|
102
|
+
if (untracked.length > 0) {
|
|
103
|
+
lines.push(chalk.bold('Untracked files:'));
|
|
104
|
+
// eslint-disable-next-line unicorn/no-array-push-push
|
|
105
|
+
lines.push(chalk.bold('(use "/vc add ‹file>..." to include in what will be committed)'));
|
|
106
|
+
for (const f of untracked)
|
|
107
|
+
lines.push(chalk.red(` ${f}`));
|
|
108
|
+
}
|
|
109
|
+
return lines.join('\n');
|
|
110
|
+
}
|
|
111
|
+
export function VcStatusFlow({ onCancel, onComplete }) {
|
|
112
|
+
const statusMutation = useExecuteVcStatus();
|
|
113
|
+
useInput((_, key) => {
|
|
114
|
+
if (key.escape && !statusMutation.isPending) {
|
|
115
|
+
onCancel();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
const fired = React.useRef(false);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (fired.current)
|
|
121
|
+
return;
|
|
122
|
+
fired.current = true;
|
|
123
|
+
statusMutation.mutate(undefined, {
|
|
124
|
+
onError(error) {
|
|
125
|
+
onComplete(`Failed to get vc status: ${formatTransportError(error)}`);
|
|
126
|
+
},
|
|
127
|
+
onSuccess(result) {
|
|
128
|
+
onComplete(formatVcStatus(result));
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}, []);
|
|
132
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Getting vc status..."] }));
|
|
133
|
+
}
|
|
@@ -16,3 +16,11 @@ export declare const BRV_DIR = ".brv";
|
|
|
16
16
|
* Directory for conflict review files created during space switch merge.
|
|
17
17
|
*/
|
|
18
18
|
export declare const CONTEXT_TREE_CONFLICT_DIR = "context-tree-conflicts";
|
|
19
|
+
/**
|
|
20
|
+
* Web app URL for the current environment.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getWebAppUrl: () => string;
|
|
23
|
+
/**
|
|
24
|
+
* Git remote base URL for the current environment.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getGitRemoteBaseUrl: () => string;
|
|
@@ -16,3 +16,11 @@ export const BRV_DIR = '.brv';
|
|
|
16
16
|
* Directory for conflict review files created during space switch merge.
|
|
17
17
|
*/
|
|
18
18
|
export const CONTEXT_TREE_CONFLICT_DIR = 'context-tree-conflicts';
|
|
19
|
+
/**
|
|
20
|
+
* Web app URL for the current environment.
|
|
21
|
+
*/
|
|
22
|
+
export const getWebAppUrl = () => isDevelopment() ? 'https://dev-beta-app.byterover.dev' : 'https://app.byterover.dev';
|
|
23
|
+
/**
|
|
24
|
+
* Git remote base URL for the current environment.
|
|
25
|
+
*/
|
|
26
|
+
export const getGitRemoteBaseUrl = () => process.env.BRV_GIT_REMOTE_BASE_URL ?? (isDevelopment() ? 'https://dev-beta.byterover.dev' : 'https://byterover.dev');
|
|
@@ -10,10 +10,14 @@
|
|
|
10
10
|
* Format a task error (from task:error events) into a user-friendly message.
|
|
11
11
|
* Falls back to the raw error message if no mapping exists.
|
|
12
12
|
*/
|
|
13
|
-
export declare function formatTaskError(error
|
|
13
|
+
export declare function formatTaskError(error?: {
|
|
14
14
|
code?: string;
|
|
15
15
|
message: string;
|
|
16
16
|
}): string;
|
|
17
|
+
/**
|
|
18
|
+
* Extract the error code from a transport error, if present.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getTransportErrorCode(error: unknown): string | undefined;
|
|
17
21
|
/**
|
|
18
22
|
* Format a transport error (from request/response calls) into a user-friendly message.
|
|
19
23
|
* Checks for a `code` property on the error and looks up a friendly message.
|
|
@@ -17,6 +17,26 @@ const USER_FRIENDLY_MESSAGES = {
|
|
|
17
17
|
ERR_PROVIDER_NOT_CONFIGURED: 'No provider connected. Run /providers connect byterover to use the free built-in provider, or connect another provider.',
|
|
18
18
|
ERR_SPACE_NOT_CONFIGURED: 'No space configured. Run /space switch to select a space first.',
|
|
19
19
|
ERR_SPACE_NOT_FOUND: 'Space not found. Check your configuration.',
|
|
20
|
+
ERR_VC_AUTH_FAILED: 'Authentication failed. Run /login.',
|
|
21
|
+
ERR_VC_BRANCH_ALREADY_EXISTS: 'Branch already exists.',
|
|
22
|
+
ERR_VC_CANNOT_DELETE_CURRENT_BRANCH: 'Cannot delete the currently checked-out branch.',
|
|
23
|
+
ERR_VC_CONFIG_KEY_NOT_SET: 'Config key is not set.',
|
|
24
|
+
ERR_VC_CONFLICT_MARKERS_PRESENT: 'Conflict markers detected. Run /vc conflicts to view them. Resolve conflicts and run /vc add before pushing.',
|
|
25
|
+
ERR_VC_GIT_INITIALIZED: 'ByteRover version control is active. Use /vc commands instead of legacy sync commands.',
|
|
26
|
+
ERR_VC_GIT_NOT_INITIALIZED: 'ByteRover version control not initialized. Run /vc init first.',
|
|
27
|
+
ERR_VC_INVALID_ACTION: 'Invalid action.',
|
|
28
|
+
// ERR_VC_INVALID_BRANCH_NAME intentionally omitted: fall through to server's message with actual branch name
|
|
29
|
+
ERR_VC_INVALID_CONFIG_KEY: 'Invalid config key. Allowed: user.name, user.email.',
|
|
30
|
+
ERR_VC_NETWORK_ERROR: 'Network error. Check your connection and try again.',
|
|
31
|
+
ERR_VC_NO_BRANCH_RESOLVED: 'Cannot determine branch. Check out a branch first.',
|
|
32
|
+
ERR_VC_NO_COMMITS: 'No commits yet. Run /vc add and /vc commit first.',
|
|
33
|
+
ERR_VC_NON_FAST_FORWARD: 'Remote has changes. Run /vc pull first.',
|
|
34
|
+
ERR_VC_NOTHING_STAGED: 'Nothing staged. Run /vc add first.',
|
|
35
|
+
ERR_VC_NOTHING_TO_PUSH: 'No commits to push. Run /vc add and /vc commit first.',
|
|
36
|
+
ERR_VC_REMOTE_ALREADY_EXISTS: "Remote 'origin' already exists. Use /vc remote set-url <url> to update.",
|
|
37
|
+
// ERR_VC_UNCOMMITTED_CHANGES intentionally omitted: fall through to server's detailed message with file paths
|
|
38
|
+
ERR_VC_UNRELATED_HISTORIES: 'Cannot merge unrelated histories. Use --allow-unrelated-histories to force.',
|
|
39
|
+
// ERR_VC_USER_NOT_CONFIGURED intentionally omitted: fall through to server's specific hint with actual values
|
|
20
40
|
};
|
|
21
41
|
/**
|
|
22
42
|
* Format a task error (from task:error events) into a user-friendly message.
|
|
@@ -30,6 +50,15 @@ export function formatTaskError(error) {
|
|
|
30
50
|
}
|
|
31
51
|
return error.message;
|
|
32
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Extract the error code from a transport error, if present.
|
|
55
|
+
*/
|
|
56
|
+
export function getTransportErrorCode(error) {
|
|
57
|
+
if (!(error instanceof Error))
|
|
58
|
+
return undefined;
|
|
59
|
+
const errorRecord = error;
|
|
60
|
+
return 'code' in error && typeof errorRecord.code === 'string' ? errorRecord.code : undefined;
|
|
61
|
+
}
|
|
33
62
|
/**
|
|
34
63
|
* Format a transport error (from request/response calls) into a user-friendly message.
|
|
35
64
|
* Checks for a `code` property on the error and looks up a friendly message.
|
|
@@ -38,13 +67,13 @@ export function formatTaskError(error) {
|
|
|
38
67
|
export function formatTransportError(error) {
|
|
39
68
|
if (!(error instanceof Error))
|
|
40
69
|
return String(error);
|
|
41
|
-
const
|
|
42
|
-
const code = 'code' in error && typeof errorRecord.code === 'string' ? errorRecord.code : undefined;
|
|
70
|
+
const code = getTransportErrorCode(error);
|
|
43
71
|
if (code && code in USER_FRIENDLY_MESSAGES) {
|
|
44
72
|
return USER_FRIENDLY_MESSAGES[code];
|
|
45
73
|
}
|
|
46
74
|
if (error.name === 'TransportRequestTimeoutError') {
|
|
47
75
|
return 'Request timed out. Please try again.';
|
|
48
76
|
}
|
|
49
|
-
|
|
77
|
+
// Strip transport suffix and rewrite CLI-style hints (brv vc ...) to TUI slash commands (/vc ...)
|
|
78
|
+
return error.message.replace(/ for event '[^']+'(?: after \d+ms)?$/, '').replaceAll(/\bbrv\s+/g, '/');
|
|
50
79
|
}
|