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,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* LogFlow Component
|
|
4
|
+
*
|
|
5
|
+
* Fetches and displays git commit history for the context-tree via VcHandler.
|
|
6
|
+
*/
|
|
7
|
+
import { Text } from 'ink';
|
|
8
|
+
import Spinner from 'ink-spinner';
|
|
9
|
+
import { useEffect } from 'react';
|
|
10
|
+
import { useExecuteLog } from '../api/execute-log.js';
|
|
11
|
+
import { formatCommitLog } from '../utils/format-log.js';
|
|
12
|
+
export function LogFlow({ all, branch, limit, onComplete }) {
|
|
13
|
+
const logMutation = useExecuteLog();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
logMutation.mutate({ all, limit, ref: branch }, {
|
|
16
|
+
onError(error) {
|
|
17
|
+
onComplete(`Failed to get log: ${error.message.replace(/ for event '[^']+'$/, '')}`);
|
|
18
|
+
},
|
|
19
|
+
onSuccess(result) {
|
|
20
|
+
if (result.commits.length === 0) {
|
|
21
|
+
onComplete('No commits found.');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
onComplete(formatCommitLog(result.commits, result.currentBranch));
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Loading commit history..."] }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export function formatRelativeDate(date) {
|
|
3
|
+
const now = Date.now();
|
|
4
|
+
const diffMs = now - date.getTime();
|
|
5
|
+
const diffSec = Math.floor(diffMs / 1000);
|
|
6
|
+
if (diffSec < 60)
|
|
7
|
+
return `${diffSec} second${diffSec === 1 ? '' : 's'} ago`;
|
|
8
|
+
const diffMin = Math.floor(diffSec / 60);
|
|
9
|
+
if (diffMin < 60)
|
|
10
|
+
return `${diffMin} minute${diffMin === 1 ? '' : 's'} ago`;
|
|
11
|
+
const diffHour = Math.floor(diffMin / 60);
|
|
12
|
+
if (diffHour < 24)
|
|
13
|
+
return `${diffHour} hour${diffHour === 1 ? '' : 's'} ago`;
|
|
14
|
+
const diffDay = Math.floor(diffHour / 24);
|
|
15
|
+
if (diffDay < 30)
|
|
16
|
+
return `${diffDay} day${diffDay === 1 ? '' : 's'} ago`;
|
|
17
|
+
const diffMonth = Math.floor(diffDay / 30);
|
|
18
|
+
if (diffMonth < 12)
|
|
19
|
+
return `${diffMonth} month${diffMonth === 1 ? '' : 's'} ago`;
|
|
20
|
+
const diffYear = Math.floor(diffMonth / 12);
|
|
21
|
+
return `${diffYear} year${diffYear === 1 ? '' : 's'} ago`;
|
|
22
|
+
}
|
|
23
|
+
export function formatCommitLog(commits, currentBranch) {
|
|
24
|
+
if (commits.length === 0)
|
|
25
|
+
return '';
|
|
26
|
+
return commits
|
|
27
|
+
.map((commit, index) => {
|
|
28
|
+
const shortSha = chalk.yellow(commit.sha.slice(0, 7));
|
|
29
|
+
const headMarker = index === 0
|
|
30
|
+
? currentBranch
|
|
31
|
+
? ` ${chalk.yellow.bold(`(HEAD -> ${currentBranch})`)}`
|
|
32
|
+
: ` ${chalk.yellow.bold('(HEAD)')}`
|
|
33
|
+
: '';
|
|
34
|
+
const relativeDate = formatRelativeDate(new Date(commit.timestamp));
|
|
35
|
+
return [
|
|
36
|
+
`* ${shortSha}${headMarker} ${commit.message}`,
|
|
37
|
+
` Author: ${commit.author.name} <${commit.author.email}>`,
|
|
38
|
+
` ${relativeDate}`,
|
|
39
|
+
].join('\n');
|
|
40
|
+
})
|
|
41
|
+
.join('\n\n');
|
|
42
|
+
}
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
* This is the single source of truth for determining what UI to show.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Application view modes as a discriminated union.
|
|
9
9
|
*/
|
|
10
10
|
export type AppViewMode = {
|
|
11
11
|
type: 'config-provider';
|
|
12
|
+
} | {
|
|
13
|
+
type: 'init-project';
|
|
12
14
|
} | {
|
|
13
15
|
type: 'loading';
|
|
14
16
|
} | {
|
|
@@ -20,6 +22,7 @@ export type AppViewMode = {
|
|
|
20
22
|
export type DeriveAppViewModeParams = {
|
|
21
23
|
activeModel?: string;
|
|
22
24
|
activeProviderId?: string;
|
|
25
|
+
contextTreeStatus?: string;
|
|
23
26
|
isAuthorized: boolean;
|
|
24
27
|
isLoading: boolean;
|
|
25
28
|
};
|
|
@@ -29,10 +32,11 @@ export type DeriveAppViewModeParams = {
|
|
|
29
32
|
*
|
|
30
33
|
* Decision tree:
|
|
31
34
|
* 1. Loading → 'loading'
|
|
32
|
-
* 2.
|
|
33
|
-
* 3. ByteRover +
|
|
34
|
-
* 4.
|
|
35
|
-
* 5.
|
|
35
|
+
* 2. Project not initialized → 'init-project'
|
|
36
|
+
* 3. ByteRover + unauthenticated → 'config-provider'
|
|
37
|
+
* 4. ByteRover + authenticated → 'ready'
|
|
38
|
+
* 5. Non-byterover + no active model → 'config-provider'
|
|
39
|
+
* 6. Otherwise → 'ready'
|
|
36
40
|
*/
|
|
37
41
|
export declare function deriveAppViewMode(params: DeriveAppViewModeParams): AppViewMode;
|
|
38
42
|
/**
|
|
@@ -6,21 +6,26 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { useAuthStore } from '../../auth/stores/auth-store.js';
|
|
8
8
|
import { useGetActiveProviderConfig } from '../../provider/api/get-active-provider-config.js';
|
|
9
|
+
import { useGetStatus } from '../../status/api/get-status.js';
|
|
9
10
|
/**
|
|
10
11
|
* Pure decision logic for determining the app view mode.
|
|
11
12
|
* Extracted from useAppViewMode for testability.
|
|
12
13
|
*
|
|
13
14
|
* Decision tree:
|
|
14
15
|
* 1. Loading → 'loading'
|
|
15
|
-
* 2.
|
|
16
|
-
* 3. ByteRover +
|
|
17
|
-
* 4.
|
|
18
|
-
* 5.
|
|
16
|
+
* 2. Project not initialized → 'init-project'
|
|
17
|
+
* 3. ByteRover + unauthenticated → 'config-provider'
|
|
18
|
+
* 4. ByteRover + authenticated → 'ready'
|
|
19
|
+
* 5. Non-byterover + no active model → 'config-provider'
|
|
20
|
+
* 6. Otherwise → 'ready'
|
|
19
21
|
*/
|
|
20
22
|
export function deriveAppViewMode(params) {
|
|
21
23
|
if (params.isLoading) {
|
|
22
24
|
return { type: 'loading' };
|
|
23
25
|
}
|
|
26
|
+
// if (['not_initialized', 'unknown'].includes(params.contextTreeStatus || '')) {
|
|
27
|
+
// return {type: 'init-project'}
|
|
28
|
+
// }
|
|
24
29
|
if (params.activeProviderId === 'byterover' && !params.isAuthorized) {
|
|
25
30
|
return { type: 'config-provider' };
|
|
26
31
|
}
|
|
@@ -38,11 +43,13 @@ export function deriveAppViewMode(params) {
|
|
|
38
43
|
*/
|
|
39
44
|
export function useAppViewMode() {
|
|
40
45
|
const { isAuthorized, isLoadingInitial: isLoadingAuth } = useAuthStore();
|
|
46
|
+
const { data: statusData, isLoading: isLoadingStatus } = useGetStatus();
|
|
41
47
|
const { data: activeData, isLoading: isLoadingActive } = useGetActiveProviderConfig();
|
|
42
48
|
return deriveAppViewMode({
|
|
43
49
|
activeModel: activeData?.activeModel,
|
|
44
50
|
activeProviderId: activeData?.activeProviderId,
|
|
51
|
+
contextTreeStatus: statusData?.status.contextTreeStatus,
|
|
45
52
|
isAuthorized,
|
|
46
|
-
isLoading: isLoadingAuth || isLoadingActive,
|
|
53
|
+
isLoading: isLoadingAuth || isLoadingStatus || isLoadingActive,
|
|
47
54
|
});
|
|
48
55
|
}
|
|
@@ -27,7 +27,14 @@ export function PushFlow({ branch, onComplete, skipConfirm }) {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
if (prepareData && !prepareData.hasChanges) {
|
|
30
|
-
|
|
30
|
+
if (prepareData.excludedReviewCount > 0) {
|
|
31
|
+
const fileLabel = prepareData.excludedReviewCount === 1 ? 'file is' : 'files are';
|
|
32
|
+
onComplete(`No pushable changes. ${prepareData.excludedReviewCount} ${fileLabel} pending review.` +
|
|
33
|
+
(prepareData.reviewUrl ? `\n Review: ${prepareData.reviewUrl}` : ''));
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
onComplete('No context changes to push.');
|
|
37
|
+
}
|
|
31
38
|
return;
|
|
32
39
|
}
|
|
33
40
|
if (prepareData) {
|
|
@@ -70,7 +77,7 @@ export function PushFlow({ branch, onComplete, skipConfirm }) {
|
|
|
70
77
|
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Checking for Context Tree changes..."] }));
|
|
71
78
|
}
|
|
72
79
|
if (step === 'confirm' && prepareData) {
|
|
73
|
-
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: `Changes found: ${prepareData.summary} (${prepareData.fileCount} files)` }), _jsx(Text, { children: `\nYou are about to push to ByteRover memory storage:` }), _jsx(Text, { children: ` Branch: ${branch}` }), _jsx(InlineConfirm, { default: false, message: "Push to ByteRover", onConfirm: (confirmed) => {
|
|
80
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: `Changes found: ${prepareData.summary} (${prepareData.fileCount} files)` }), prepareData.excludedReviewCount > 0 && (_jsxs(Text, { color: "yellow", children: [`⚠ ${prepareData.excludedReviewCount} file(s) excluded from push (pending/rejected review).`, prepareData.reviewUrl ? `\n Review: ${prepareData.reviewUrl}` : ''] })), _jsx(Text, { children: `\nYou are about to push to ByteRover memory storage:` }), _jsx(Text, { children: ` Branch: ${branch}` }), _jsx(InlineConfirm, { default: false, message: "Push to ByteRover", onConfirm: (confirmed) => {
|
|
74
81
|
if (confirmed) {
|
|
75
82
|
setStep('executing');
|
|
76
83
|
}
|
|
@@ -8,6 +8,7 @@ import { Text } from 'ink';
|
|
|
8
8
|
import Spinner from 'ink-spinner';
|
|
9
9
|
import { useEffect, useState } from 'react';
|
|
10
10
|
import { InlineConfirm } from '../../../components/inline-prompts/inline-confirm.js';
|
|
11
|
+
import { formatTransportError } from '../../../utils/error-messages.js';
|
|
11
12
|
import { useExecuteReset } from '../api/execute-reset.js';
|
|
12
13
|
export function ResetFlow({ onComplete, skipConfirm }) {
|
|
13
14
|
const [step, setStep] = useState(skipConfirm ? 'executing' : 'confirm');
|
|
@@ -18,7 +19,7 @@ export function ResetFlow({ onComplete, skipConfirm }) {
|
|
|
18
19
|
return;
|
|
19
20
|
resetMutation.mutate(undefined, {
|
|
20
21
|
onError(error) {
|
|
21
|
-
onComplete(`Failed to reset context tree: ${error
|
|
22
|
+
onComplete(`Failed to reset context tree: ${formatTransportError(error)}`);
|
|
22
23
|
},
|
|
23
24
|
onSuccess(result) {
|
|
24
25
|
if (result.success) {
|
|
@@ -7,6 +7,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { Text } from 'ink';
|
|
8
8
|
import Spinner from 'ink-spinner';
|
|
9
9
|
import { useEffect } from 'react';
|
|
10
|
+
import { formatTransportError } from '../../../utils/error-messages.js';
|
|
10
11
|
import { useGetStatus } from '../api/get-status.js';
|
|
11
12
|
import { formatStatus } from '../utils/format-status.js';
|
|
12
13
|
export function StatusView({ onComplete, version }) {
|
|
@@ -16,7 +17,7 @@ export function StatusView({ onComplete, version }) {
|
|
|
16
17
|
onComplete(formatStatus(data.status, version));
|
|
17
18
|
}
|
|
18
19
|
if (error) {
|
|
19
|
-
onComplete(`Failed to get status: ${error
|
|
20
|
+
onComplete(`Failed to get status: ${formatTransportError(error)}`);
|
|
20
21
|
}
|
|
21
22
|
}, [data, error, onComplete, version]);
|
|
22
23
|
if (isLoading) {
|
|
@@ -30,6 +30,10 @@ export function formatStatus(status, version) {
|
|
|
30
30
|
lines.push('Space: Not connected');
|
|
31
31
|
}
|
|
32
32
|
switch (status.contextTreeStatus) {
|
|
33
|
+
case 'git_vc': {
|
|
34
|
+
lines.push('Context Tree: Byterover version control (use /vc commands)');
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
33
37
|
case 'has_changes': {
|
|
34
38
|
if (status.contextTreeChanges && status.contextTreeRelativeDir) {
|
|
35
39
|
const { added, deleted, modified } = status.contextTreeChanges;
|
|
@@ -58,5 +62,10 @@ export function formatStatus(status, version) {
|
|
|
58
62
|
lines.push('Context Tree: Unable to check status');
|
|
59
63
|
}
|
|
60
64
|
}
|
|
65
|
+
if (status.pendingReviewCount && status.pendingReviewCount > 0) {
|
|
66
|
+
const fileLabel = status.pendingReviewCount === 1 ? 'file' : 'files';
|
|
67
|
+
lines.push(chalk.yellow(`Pending Reviews: ${status.pendingReviewCount} ${fileLabel} need review`) +
|
|
68
|
+
(status.reviewUrl ? `\n Review: ${chalk.blue(status.reviewUrl)}` : ''));
|
|
69
|
+
}
|
|
61
70
|
return lines.join('\n');
|
|
62
71
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Call this once from a top-level component to wire up task lifecycle events.
|
|
4
4
|
*/
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
|
+
import { ReviewEvents } from '../../../../shared/transport/events/review-events.js';
|
|
6
7
|
import { useTransportStore } from '../../../stores/transport-store.js';
|
|
7
8
|
import { useTasksStore } from '../stores/tasks-store.js';
|
|
8
9
|
export function useTaskSubscriptions() {
|
|
@@ -65,6 +66,16 @@ export function useTaskSubscriptions() {
|
|
|
65
66
|
taskId: data.taskId,
|
|
66
67
|
type: data.type === 'reasoning' ? 'reasoning' : 'text',
|
|
67
68
|
});
|
|
69
|
+
}), client.on(ReviewEvents.NOTIFY, (data) => {
|
|
70
|
+
if (data.pendingCount === 0) {
|
|
71
|
+
store.clearReviewNotification(data.taskId);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
store.setReviewNotification(data.taskId, {
|
|
75
|
+
pendingCount: data.pendingCount,
|
|
76
|
+
reviewUrl: data.reviewUrl,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
68
79
|
}));
|
|
69
80
|
return () => {
|
|
70
81
|
for (const unsub of unsubscribers)
|
|
@@ -26,6 +26,10 @@ export interface TaskErrorData {
|
|
|
26
26
|
code?: string;
|
|
27
27
|
message: string;
|
|
28
28
|
}
|
|
29
|
+
export interface ReviewNotification {
|
|
30
|
+
pendingCount: number;
|
|
31
|
+
reviewUrl: string;
|
|
32
|
+
}
|
|
29
33
|
export interface Task {
|
|
30
34
|
completedAt?: number;
|
|
31
35
|
content: string;
|
|
@@ -37,6 +41,8 @@ export interface Task {
|
|
|
37
41
|
isStreaming?: boolean;
|
|
38
42
|
reasoningContents?: ReasoningContentItem[];
|
|
39
43
|
result?: string;
|
|
44
|
+
/** Set when curate completes with pending HITL review operations. */
|
|
45
|
+
reviewNotification?: ReviewNotification;
|
|
40
46
|
sessionId?: string;
|
|
41
47
|
startedAt?: number;
|
|
42
48
|
status: TaskStatus;
|
|
@@ -62,6 +68,8 @@ export interface TasksActions {
|
|
|
62
68
|
taskId: string;
|
|
63
69
|
type: 'reasoning' | 'text';
|
|
64
70
|
}) => void;
|
|
71
|
+
/** Clear the review notification on a task (called after approve/reject) */
|
|
72
|
+
clearReviewNotification: (taskId: string) => void;
|
|
65
73
|
/** Clear all tasks */
|
|
66
74
|
clearTasks: () => void;
|
|
67
75
|
/** Create a new task */
|
|
@@ -76,6 +84,8 @@ export interface TasksActions {
|
|
|
76
84
|
setError: (taskId: string, error: TaskErrorData) => void;
|
|
77
85
|
/** Set task LLM response (final) */
|
|
78
86
|
setResponse: (taskId: string, content: string, sessionId?: string) => void;
|
|
87
|
+
/** Set review notification on a completed curate task */
|
|
88
|
+
setReviewNotification: (taskId: string, notification: ReviewNotification) => void;
|
|
79
89
|
/** Set task to started */
|
|
80
90
|
setStarted: (taskId: string) => void;
|
|
81
91
|
/** Update a tool call result */
|
|
@@ -103,6 +103,14 @@ export const useTasksStore = create()((set, get) => ({
|
|
|
103
103
|
}
|
|
104
104
|
return { stats: computeStats(tasks), tasks };
|
|
105
105
|
}),
|
|
106
|
+
clearReviewNotification: (taskId) => set((state) => {
|
|
107
|
+
const task = state.tasks.get(taskId);
|
|
108
|
+
if (!task?.reviewNotification)
|
|
109
|
+
return state;
|
|
110
|
+
const tasks = new Map(state.tasks);
|
|
111
|
+
tasks.set(taskId, { ...task, reviewNotification: undefined });
|
|
112
|
+
return { stats: computeStats(tasks), tasks };
|
|
113
|
+
}),
|
|
106
114
|
clearTasks: () => set({ stats: { created: 0, started: 0 }, tasks: new Map() }),
|
|
107
115
|
createTask: (taskId, type, content, files) => set((state) => {
|
|
108
116
|
const tasks = new Map(state.tasks);
|
|
@@ -218,6 +226,14 @@ export const useTasksStore = create()((set, get) => ({
|
|
|
218
226
|
});
|
|
219
227
|
return { stats: computeStats(tasks), tasks };
|
|
220
228
|
}),
|
|
229
|
+
setReviewNotification: (taskId, notification) => set((state) => {
|
|
230
|
+
const task = state.tasks.get(taskId);
|
|
231
|
+
if (!task)
|
|
232
|
+
return state;
|
|
233
|
+
const tasks = new Map(state.tasks);
|
|
234
|
+
tasks.set(taskId, { ...task, reviewNotification: notification });
|
|
235
|
+
return { stats: computeStats(tasks), tasks };
|
|
236
|
+
}),
|
|
221
237
|
setStarted: (taskId) => set((state) => {
|
|
222
238
|
const task = state.tasks.get(taskId);
|
|
223
239
|
if (!task)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcAddRequest, type IVcAddResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcAdd: (request: IVcAddRequest) => Promise<IVcAddResponse>;
|
|
4
|
+
type UseExecuteVcAddOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcAdd>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcAdd: ({ mutationConfig }?: UseExecuteVcAddOptions) => import("@tanstack/react-query").UseMutationResult<IVcAddResponse, Error, IVcAddRequest, 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 executeVcAdd = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.ADD, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcAdd = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcAdd,
|
|
13
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
3
|
+
type VcAddFlowProps = CustomDialogCallbacks & {
|
|
4
|
+
filePaths: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare function VcAddFlow({ filePaths, onCancel, onComplete }: VcAddFlowProps): React.ReactNode;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { useExecuteVcAdd } from '../api/execute-vc-add.js';
|
|
7
|
+
export function VcAddFlow({ filePaths, onCancel, onComplete }) {
|
|
8
|
+
const addMutation = useExecuteVcAdd();
|
|
9
|
+
useInput((_, key) => {
|
|
10
|
+
if (key.escape && !addMutation.isPending) {
|
|
11
|
+
onCancel();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const fired = React.useRef(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (fired.current)
|
|
17
|
+
return;
|
|
18
|
+
fired.current = true;
|
|
19
|
+
addMutation.mutate({ filePaths }, {
|
|
20
|
+
onError(error) {
|
|
21
|
+
onComplete(`Failed to stage: ${formatTransportError(error)}`);
|
|
22
|
+
},
|
|
23
|
+
onSuccess(result) {
|
|
24
|
+
if (result.count === 0) {
|
|
25
|
+
onComplete('Nothing to stage.');
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
onComplete(`Staged ${result.count} file(s).`);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}, []);
|
|
33
|
+
const label = filePaths.length === 1 && filePaths[0] === '.' ? '.' : filePaths.join(' ');
|
|
34
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Staging ", label, "..."] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcBranchRequest, type IVcBranchResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcBranch: (request: IVcBranchRequest) => Promise<IVcBranchResponse>;
|
|
4
|
+
type UseExecuteVcBranchOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcBranch>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcBranch: ({ mutationConfig }?: UseExecuteVcBranchOptions) => import("@tanstack/react-query").UseMutationResult<IVcBranchResponse, Error, IVcBranchRequest, 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 executeVcBranch = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.BRANCH, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcBranch = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcBranch,
|
|
13
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IVcBranchRequest } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
4
|
+
type VcBranchFlowProps = CustomDialogCallbacks & {
|
|
5
|
+
request: IVcBranchRequest;
|
|
6
|
+
};
|
|
7
|
+
export declare function VcBranchFlow({ onCancel, onComplete, request }: VcBranchFlowProps): React.ReactNode;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { useExecuteVcBranch } from '../api/execute-vc-branch.js';
|
|
7
|
+
import { formatBranchList } from '../utils/format-branch.js';
|
|
8
|
+
const LABELS = {
|
|
9
|
+
create: 'Creating branch...',
|
|
10
|
+
delete: 'Deleting branch...',
|
|
11
|
+
list: 'Listing branches...',
|
|
12
|
+
'set-upstream': 'Setting upstream...',
|
|
13
|
+
};
|
|
14
|
+
export function VcBranchFlow({ onCancel, onComplete, request }) {
|
|
15
|
+
const branchMutation = useExecuteVcBranch();
|
|
16
|
+
useInput((_, key) => {
|
|
17
|
+
if (key.escape && !branchMutation.isPending)
|
|
18
|
+
onCancel();
|
|
19
|
+
});
|
|
20
|
+
const fired = React.useRef(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (fired.current)
|
|
23
|
+
return;
|
|
24
|
+
fired.current = true;
|
|
25
|
+
branchMutation.mutate(request, {
|
|
26
|
+
onError(error) {
|
|
27
|
+
onComplete(`Failed: ${formatTransportError(error)}`);
|
|
28
|
+
},
|
|
29
|
+
onSuccess(result) {
|
|
30
|
+
switch (result.action) {
|
|
31
|
+
case 'create': {
|
|
32
|
+
onComplete(`Created branch '${result.created}'.`);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case 'delete': {
|
|
36
|
+
onComplete(`Deleted branch '${result.deleted}'.`);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'list': {
|
|
40
|
+
onComplete(formatBranchList(result.branches));
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'set-upstream': {
|
|
44
|
+
onComplete(`Branch '${result.branch}' set up to track '${result.upstream}'.`);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
// No default
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
}, []);
|
|
52
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " ", LABELS[request.action]] }));
|
|
53
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export function formatBranchList(branches) {
|
|
3
|
+
if (branches.length === 0)
|
|
4
|
+
return 'No branches found.';
|
|
5
|
+
return branches
|
|
6
|
+
.map((b) => {
|
|
7
|
+
const prefix = b.isCurrent ? '* ' : ' ';
|
|
8
|
+
const name = b.isRemote ? `remotes/${b.name}` : b.name;
|
|
9
|
+
return b.isCurrent ? `${prefix}${chalk.green(name)}` : `${prefix}${name}`;
|
|
10
|
+
})
|
|
11
|
+
.join('\n');
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcCheckoutRequest, type IVcCheckoutResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcCheckout: (request: IVcCheckoutRequest) => Promise<IVcCheckoutResponse>;
|
|
4
|
+
type UseExecuteVcCheckoutOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcCheckout>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcCheckout: ({ mutationConfig }?: UseExecuteVcCheckoutOptions) => import("@tanstack/react-query").UseMutationResult<IVcCheckoutResponse, Error, IVcCheckoutRequest, 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 executeVcCheckout = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.CHECKOUT, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcCheckout = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcCheckout,
|
|
13
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { IVcCheckoutRequest } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
4
|
+
type VcCheckoutFlowProps = CustomDialogCallbacks & {
|
|
5
|
+
request: IVcCheckoutRequest;
|
|
6
|
+
};
|
|
7
|
+
export declare function VcCheckoutFlow({ onCancel, onComplete, request }: VcCheckoutFlowProps): React.ReactNode;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { useExecuteVcCheckout } from '../api/execute-vc-checkout.js';
|
|
7
|
+
export function VcCheckoutFlow({ onCancel, onComplete, request }) {
|
|
8
|
+
const checkoutMutation = useExecuteVcCheckout();
|
|
9
|
+
useInput((_, key) => {
|
|
10
|
+
if (key.escape && !checkoutMutation.isPending)
|
|
11
|
+
onCancel();
|
|
12
|
+
});
|
|
13
|
+
const fired = React.useRef(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (fired.current)
|
|
16
|
+
return;
|
|
17
|
+
fired.current = true;
|
|
18
|
+
checkoutMutation.mutate(request, {
|
|
19
|
+
onError(error) {
|
|
20
|
+
onComplete(`Failed: ${formatTransportError(error)}`);
|
|
21
|
+
},
|
|
22
|
+
onSuccess(result) {
|
|
23
|
+
if (result.created) {
|
|
24
|
+
onComplete(`Switched to a new branch '${result.branch}'`);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
onComplete(`Switched to branch '${result.branch}'`);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Switching to branch '", request.branch, "'..."] }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MutationConfig } from '../../../../lib/react-query.js';
|
|
2
|
+
import { type IVcCloneRequest, type IVcCloneResponse } from '../../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
export declare const executeVcClone: (request: IVcCloneRequest) => Promise<IVcCloneResponse>;
|
|
4
|
+
type UseExecuteVcCloneOptions = {
|
|
5
|
+
mutationConfig?: MutationConfig<typeof executeVcClone>;
|
|
6
|
+
};
|
|
7
|
+
export declare const useExecuteVcClone: ({ mutationConfig }?: UseExecuteVcCloneOptions) => import("@tanstack/react-query").UseMutationResult<IVcCloneResponse, Error, IVcCloneRequest, 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 executeVcClone = (request) => {
|
|
5
|
+
const { apiClient } = useTransportStore.getState();
|
|
6
|
+
if (!apiClient)
|
|
7
|
+
return Promise.reject(new Error('Not connected'));
|
|
8
|
+
return apiClient.request(VcEvents.CLONE, request);
|
|
9
|
+
};
|
|
10
|
+
export const useExecuteVcClone = ({ mutationConfig } = {}) => useMutation({
|
|
11
|
+
...mutationConfig,
|
|
12
|
+
mutationFn: executeVcClone,
|
|
13
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CustomDialogCallbacks } from '../../../../types/commands.js';
|
|
3
|
+
interface VcCloneFlowProps extends CustomDialogCallbacks {
|
|
4
|
+
url?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function VcCloneFlow({ onCancel, onComplete, url }: VcCloneFlowProps): React.ReactNode;
|
|
7
|
+
export {};
|