byterover-cli 2.5.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.production +8 -0
- package/LICENSE +44 -0
- package/README.md +240 -14
- package/bin/dev.js +8 -1
- package/bin/run.js +8 -1
- 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 -19
- package/dist/server/config/environment.js +31 -38
- package/dist/server/constants.d.ts +3 -9
- package/dist/server/constants.js +9 -12
- 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/auth-error.d.ts +0 -6
- package/dist/server/core/domain/errors/auth-error.js +0 -12
- 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 -3
- package/dist/server/core/domain/errors/task-error.js +8 -8
- package/dist/server/core/domain/errors/transport-error.d.ts +0 -31
- package/dist/server/core/domain/errors/transport-error.js +0 -50
- 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/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/vc/i-vc-git-config-store.d.ts +8 -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/connectors/rules/rules-connector-config.d.ts +0 -4
- 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/models-dev-client.d.ts +0 -4
- package/dist/server/infra/http/models-dev-client.js +0 -6
- package/dist/server/infra/http/openrouter-api-client.d.ts +0 -8
- package/dist/server/infra/http/openrouter-api-client.js +0 -13
- package/dist/server/infra/http/provider-model-fetcher-registry.d.ts +0 -5
- package/dist/server/infra/http/provider-model-fetcher-registry.js +0 -7
- 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/provider/env-provider-detector.d.ts +0 -20
- package/dist/server/infra/provider/env-provider-detector.js +0 -27
- 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-provider-config-store.d.ts +0 -4
- package/dist/server/infra/storage/file-provider-config-store.js +0 -6
- 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/file-content-reader.d.ts +2 -1
- package/dist/server/utils/file-helpers.d.ts +0 -24
- package/dist/server/utils/file-helpers.js +0 -81
- package/dist/server/utils/gitignore.d.ts +9 -0
- package/dist/server/utils/gitignore.js +47 -0
- package/dist/server/utils/process-logger.d.ts +0 -13
- package/dist/server/utils/process-logger.js +1 -78
- 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/node_modules/@campfirein/brv-transport-client/LICENSE +95 -0
- package/node_modules/@campfirein/brv-transport-client/README.md +3 -4
- package/node_modules/@campfirein/brv-transport-client/package.json +2 -2
- package/oclif.manifest.json +985 -65
- package/package.json +13 -5
- 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/server/core/domain/entities/bullet.d.ts +0 -51
- package/dist/server/core/domain/entities/bullet.js +0 -94
- package/dist/server/core/domain/entities/memory.d.ts +0 -55
- package/dist/server/core/domain/entities/memory.js +0 -90
- package/dist/server/core/domain/entities/playbook.d.ts +0 -80
- package/dist/server/core/domain/entities/playbook.js +0 -214
- package/dist/server/core/domain/entities/presigned-url.d.ts +0 -9
- package/dist/server/core/domain/entities/presigned-url.js +0 -18
- package/dist/server/core/domain/entities/presigned-urls-response.d.ts +0 -10
- package/dist/server/core/domain/entities/presigned-urls-response.js +0 -18
- package/dist/server/core/domain/entities/retrieve-result.d.ts +0 -35
- package/dist/server/core/domain/entities/retrieve-result.js +0 -35
- package/dist/server/core/domain/errors/headless-prompt-error.d.ts +0 -11
- package/dist/server/core/domain/errors/headless-prompt-error.js +0 -18
- package/dist/server/core/interfaces/services/i-legacy-rule-detector.d.ts +0 -56
- package/dist/server/core/interfaces/services/i-memory-retrieval-service.d.ts +0 -39
- package/dist/server/core/interfaces/services/i-memory-storage-service.d.ts +0 -53
- package/dist/server/core/interfaces/services/i-terminal.d.ts +0 -146
- package/dist/server/core/interfaces/services/i-terminal.js +0 -1
- package/dist/server/core/interfaces/services/i-workspace-detector-service.d.ts +0 -8
- package/dist/server/core/interfaces/services/i-workspace-detector-service.js +0 -1
- package/dist/server/core/interfaces/storage/i-onboarding-preference-store.d.ts +0 -20
- package/dist/server/core/interfaces/storage/i-onboarding-preference-store.js +0 -1
- package/dist/server/infra/connectors/rules/legacy-rule-detector.d.ts +0 -21
- package/dist/server/infra/connectors/rules/legacy-rule-detector.js +0 -106
- package/dist/server/infra/memory/http-memory-retrieval-service.d.ts +0 -18
- package/dist/server/infra/memory/http-memory-retrieval-service.js +0 -64
- package/dist/server/infra/memory/http-memory-storage-service.d.ts +0 -18
- package/dist/server/infra/memory/http-memory-storage-service.js +0 -72
- package/dist/server/infra/memory/memory-to-playbook-mapper.d.ts +0 -33
- package/dist/server/infra/memory/memory-to-playbook-mapper.js +0 -51
- package/dist/server/infra/storage/file-onboarding-preference-store.d.ts +0 -10
- package/dist/server/infra/storage/file-onboarding-preference-store.js +0 -45
- package/dist/server/infra/terminal/headless-terminal.d.ts +0 -91
- package/dist/server/infra/terminal/headless-terminal.js +0 -211
- package/dist/server/infra/workspace/workspace-detector-service.d.ts +0 -57
- package/dist/server/infra/workspace/workspace-detector-service.js +0 -165
- package/dist/server/utils/crash-log.d.ts +0 -14
- package/dist/server/utils/crash-log.js +0 -19
- package/dist/server/utils/emoji-helpers.d.ts +0 -38
- package/dist/server/utils/emoji-helpers.js +0 -42
- package/dist/server/utils/error-handler.d.ts +0 -51
- package/dist/server/utils/error-handler.js +0 -169
- package/dist/server/utils/oclif-error-helpers.d.ts +0 -40
- package/dist/server/utils/oclif-error-helpers.js +0 -46
- package/dist/server/utils/tool-display-formatter.d.ts +0 -53
- package/dist/server/utils/tool-display-formatter.js +0 -257
- 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
- /package/dist/server/core/interfaces/services/{i-legacy-rule-detector.js → i-git-service.js} +0 -0
- /package/dist/server/core/interfaces/{services/i-memory-retrieval-service.js → storage/i-review-backup-store.js} +0 -0
- /package/dist/server/core/interfaces/{services/i-memory-storage-service.js → vc/i-vc-git-config-store.js} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { VcEvents } from '../../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import { formatConnectionError, withDaemonRetry } from '../../../lib/daemon-client.js';
|
|
4
|
+
export default class VcRemote extends Command {
|
|
5
|
+
static description = 'Show current remote origin';
|
|
6
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
7
|
+
async run() {
|
|
8
|
+
try {
|
|
9
|
+
const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.REMOTE, { subcommand: 'show' }));
|
|
10
|
+
this.log(result.url ? `origin: ${result.url}` : 'No remote configured.');
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
this.error(formatConnectionError(error));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class VcRemoteSetUrl extends Command {
|
|
3
|
+
static args: {
|
|
4
|
+
name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
url: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Args, Command } from '@oclif/core';
|
|
2
|
+
import { getGitRemoteBaseUrl } from '../../../../server/config/environment.js';
|
|
3
|
+
import { VcEvents } from '../../../../shared/transport/events/vc-events.js';
|
|
4
|
+
import { formatConnectionError, withDaemonRetry } from '../../../lib/daemon-client.js';
|
|
5
|
+
export default class VcRemoteSetUrl extends Command {
|
|
6
|
+
static args = {
|
|
7
|
+
name: Args.string({ description: 'Remote name', required: true }),
|
|
8
|
+
url: Args.string({
|
|
9
|
+
description: `Remote URL (e.g. ${getGitRemoteBaseUrl()}/<team>/<space>.git)`,
|
|
10
|
+
required: true,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
static description = 'Update a remote URL';
|
|
14
|
+
static examples = [
|
|
15
|
+
`<%= config.bin %> <%= command.id %> origin ${getGitRemoteBaseUrl()}/acme/project.git`,
|
|
16
|
+
];
|
|
17
|
+
async run() {
|
|
18
|
+
const { args } = await this.parse(VcRemoteSetUrl);
|
|
19
|
+
if (args.name !== 'origin') {
|
|
20
|
+
this.error(`Only 'origin' remote is currently supported.`);
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.REMOTE, { subcommand: 'set-url', url: args.url }));
|
|
24
|
+
this.log(`Remote 'origin' updated to ${result.url}.`);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
this.error(formatConnectionError(error));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class VcReset extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
hard: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
soft: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
};
|
|
9
|
+
static strict: boolean;
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
private formatRefResult;
|
|
12
|
+
private formatUnstageResult;
|
|
13
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { VcEvents } from '../../../shared/transport/events/vc-events.js';
|
|
3
|
+
import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
|
|
4
|
+
export default class VcReset extends Command {
|
|
5
|
+
static description = 'Unstage files or undo commits';
|
|
6
|
+
static examples = [
|
|
7
|
+
'<%= config.bin %> <%= command.id %>',
|
|
8
|
+
'<%= config.bin %> <%= command.id %> notes.md',
|
|
9
|
+
'<%= config.bin %> <%= command.id %> --soft HEAD~1',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> --hard HEAD~1',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --hard',
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
hard: Flags.boolean({
|
|
15
|
+
description: 'Reset HEAD, index, and working tree',
|
|
16
|
+
exclusive: ['soft'],
|
|
17
|
+
}),
|
|
18
|
+
soft: Flags.boolean({
|
|
19
|
+
description: 'Reset HEAD only, keep changes staged',
|
|
20
|
+
exclusive: ['hard'],
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
static strict = false;
|
|
24
|
+
async run() {
|
|
25
|
+
const { argv, flags } = await this.parse(VcReset);
|
|
26
|
+
const args = argv.filter((a) => typeof a === 'string');
|
|
27
|
+
// When --soft or --hard is set, first arg is the optional ref (default HEAD)
|
|
28
|
+
const mode = flags.soft ? 'soft' : flags.hard ? 'hard' : undefined;
|
|
29
|
+
const ref = mode ? args[0] : undefined;
|
|
30
|
+
const filePaths = mode ? undefined : args.length > 0 ? args : undefined;
|
|
31
|
+
try {
|
|
32
|
+
if (filePaths) {
|
|
33
|
+
const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.RESET, { filePaths }));
|
|
34
|
+
this.formatUnstageResult(result);
|
|
35
|
+
}
|
|
36
|
+
else if (mode) {
|
|
37
|
+
const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.RESET, { mode, ref }));
|
|
38
|
+
this.formatRefResult(result);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.RESET, {}));
|
|
42
|
+
this.formatUnstageResult(result);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
this.error(formatConnectionError(error));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
formatRefResult(result) {
|
|
50
|
+
if (!result.headSha)
|
|
51
|
+
return; // Empty repo — silent no-op, matches git
|
|
52
|
+
this.log(`HEAD is now at ${result.headSha.slice(0, 7)}`);
|
|
53
|
+
}
|
|
54
|
+
formatUnstageResult(result) {
|
|
55
|
+
if (result.filesUnstaged === 0) {
|
|
56
|
+
this.log('Nothing to unstage.');
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.log(`Unstaged ${result.filesUnstaged} file(s).`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { VcEvents } from '../../../shared/transport/events/vc-events.js';
|
|
4
|
+
import { formatConnectionError, withDaemonRetry } from '../../lib/daemon-client.js';
|
|
5
|
+
export default class VcStatus extends Command {
|
|
6
|
+
static description = 'Show ByteRover version control status';
|
|
7
|
+
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
8
|
+
async run() {
|
|
9
|
+
try {
|
|
10
|
+
const result = await withDaemonRetry(async (client) => client.requestWithAck(VcEvents.STATUS, {}));
|
|
11
|
+
this.formatOutput(result);
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
this.error(formatConnectionError(error));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
formatOutput(result) {
|
|
18
|
+
if (!result.initialized) {
|
|
19
|
+
this.log(chalk.yellow('ByteRover version control not initialized — run `brv vc init` to initialize'));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
this.log(chalk.bold(`On branch ${result.branch ?? '(detached HEAD)'}`));
|
|
23
|
+
if (result.hasCommits === false) {
|
|
24
|
+
this.log(chalk.yellow('No commits yet'));
|
|
25
|
+
}
|
|
26
|
+
if (result.trackingBranch) {
|
|
27
|
+
const ahead = result.ahead ?? 0;
|
|
28
|
+
const behind = result.behind ?? 0;
|
|
29
|
+
if (ahead > 0 && behind > 0) {
|
|
30
|
+
this.log(`Your branch and '${result.trackingBranch}' have diverged,\n` +
|
|
31
|
+
`and have ${ahead} and ${behind} different commits each, respectively.`);
|
|
32
|
+
}
|
|
33
|
+
else if (ahead > 0) {
|
|
34
|
+
this.log(`Your branch is ahead of '${result.trackingBranch}' by ${ahead} commit${ahead === 1 ? '' : 's'}.`);
|
|
35
|
+
}
|
|
36
|
+
else if (behind > 0) {
|
|
37
|
+
this.log(`Your branch is behind '${result.trackingBranch}' by ${behind} commit${behind === 1 ? '' : 's'}.`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const { staged, unstaged, untracked } = result;
|
|
41
|
+
const hasChanges = staged.added.length > 0 ||
|
|
42
|
+
staged.modified.length > 0 ||
|
|
43
|
+
staged.deleted.length > 0 ||
|
|
44
|
+
unstaged.modified.length > 0 ||
|
|
45
|
+
unstaged.deleted.length > 0 ||
|
|
46
|
+
untracked.length > 0;
|
|
47
|
+
if (result.mergeInProgress) {
|
|
48
|
+
const hasUnmerged = result.unmerged && result.unmerged.length > 0;
|
|
49
|
+
if (hasUnmerged) {
|
|
50
|
+
this.log(chalk.yellow('You have unmerged paths.'));
|
|
51
|
+
this.log(chalk.yellow(' (fix conflicts and run "brv vc add", then "brv vc merge --continue")'));
|
|
52
|
+
this.log('');
|
|
53
|
+
this.log(chalk.bold('Unmerged paths:'));
|
|
54
|
+
for (const f of result.unmerged) {
|
|
55
|
+
const label = f.type === 'deleted_modified' ? 'deleted by them' : f.type === 'both_added' ? 'both added' : 'both modified';
|
|
56
|
+
this.log(chalk.red(` ${label}: ${f.path}`));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.log(chalk.yellow('All conflicts fixed but you are still merging.'));
|
|
61
|
+
this.log(chalk.yellow(' (use "brv vc merge --continue" to conclude merge)'));
|
|
62
|
+
if (!hasChanges)
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
else if (!hasChanges && !(result.conflictMarkerFiles && result.conflictMarkerFiles.length > 0)) {
|
|
67
|
+
this.log('Nothing to commit, working directory clean');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (result.conflictMarkerFiles && result.conflictMarkerFiles.length > 0) {
|
|
71
|
+
this.log(chalk.yellow('Files with conflict markers:'));
|
|
72
|
+
this.log(chalk.yellow(' (resolve conflicts and run "brv vc add" before pushing)'));
|
|
73
|
+
this.log('');
|
|
74
|
+
for (const f of result.conflictMarkerFiles) {
|
|
75
|
+
this.log(chalk.red(` ${f} (conflict)`));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
this.printChangeSections(result);
|
|
79
|
+
}
|
|
80
|
+
printChangeSections(result) {
|
|
81
|
+
const { staged, unstaged, untracked } = result;
|
|
82
|
+
if (staged.added.length > 0 || staged.modified.length > 0 || staged.deleted.length > 0) {
|
|
83
|
+
this.log(chalk.bold('Changes to be committed:'));
|
|
84
|
+
for (const f of staged.added)
|
|
85
|
+
this.log(chalk.green(` new file: ${f}`));
|
|
86
|
+
for (const f of staged.modified)
|
|
87
|
+
this.log(chalk.green(` modified: ${f}`));
|
|
88
|
+
for (const f of staged.deleted)
|
|
89
|
+
this.log(chalk.green(` deleted: ${f}`));
|
|
90
|
+
}
|
|
91
|
+
if (unstaged.modified.length > 0 || unstaged.deleted.length > 0) {
|
|
92
|
+
this.log(chalk.bold('Changes not staged for commit:'));
|
|
93
|
+
this.log(chalk.bold('(use "brv vc add ‹file>..." to include in what will be committed)'));
|
|
94
|
+
for (const f of unstaged.modified)
|
|
95
|
+
this.log(chalk.red(` modified: ${f}`));
|
|
96
|
+
for (const f of unstaged.deleted)
|
|
97
|
+
this.log(chalk.red(` deleted: ${f}`));
|
|
98
|
+
}
|
|
99
|
+
if (untracked.length > 0) {
|
|
100
|
+
this.log(chalk.bold('Untracked files:'));
|
|
101
|
+
this.log(chalk.bold('(use "brv vc add ‹file>..." to include in what will be committed)'));
|
|
102
|
+
for (const f of untracked)
|
|
103
|
+
this.log(chalk.red(` ${f}`));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Hook } from '@oclif/core';
|
|
2
|
+
import type { IProjectConfigStore } from '../../../server/core/interfaces/storage/i-project-config-store.js';
|
|
3
|
+
import { type AutoInitDeps } from '../../../server/infra/config/auto-init.js';
|
|
4
|
+
/**
|
|
5
|
+
* Commands that should skip auto-init and config version validation.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COMMANDS_NEED_AUTO_INIT: Set<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Core validation logic extracted for testability.
|
|
10
|
+
* Auto-initializes .brv/ if it doesn't exist (for non-vc commands), then migrates config version if needed.
|
|
11
|
+
* VC commands still require explicit `brv vc init`.
|
|
12
|
+
* Also ensures connector files are patched with `brv curate view` docs (once per project).
|
|
13
|
+
*
|
|
14
|
+
* @param commandId - The command being executed
|
|
15
|
+
* @param configStore - The config store to use for reading config
|
|
16
|
+
* @param argv - Command arguments (used to detect help flags)
|
|
17
|
+
* @param autoInitDeps - Dependencies for auto-init (optional, for testing)
|
|
18
|
+
*/
|
|
19
|
+
export declare const validateBrvConfigVersion: (commandId: string, configStore: IProjectConfigStore, argv?: string[], autoInitDeps?: AutoInitDeps) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Init hook that ensures .brv/ exists and validates config version.
|
|
22
|
+
* Runs once during CLI bootstrap — does NOT re-fire for runCommand() calls,
|
|
23
|
+
* so commands like `init` can safely delegate to sub-commands.
|
|
24
|
+
*/
|
|
25
|
+
declare const hook: Hook<'init'>;
|
|
26
|
+
export default hook;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { BRV_CONFIG_VERSION } from '../../../server/constants.js';
|
|
2
|
+
import { ensureProjectInitialized } from '../../../server/infra/config/auto-init.js';
|
|
3
|
+
import { ProjectConfigStore } from '../../../server/infra/config/file-config-store.js';
|
|
4
|
+
import { FileContextTreeService } from '../../../server/infra/context-tree/file-context-tree-service.js';
|
|
5
|
+
import { syncConfigToXdg } from '../../../server/utils/config-xdg-sync.js';
|
|
6
|
+
/**
|
|
7
|
+
* Commands that should skip auto-init and config version validation.
|
|
8
|
+
*/
|
|
9
|
+
export const COMMANDS_NEED_AUTO_INIT = new Set(['connectors:install', 'curate', 'hub:install', 'main', 'query']);
|
|
10
|
+
const HELP_FLAGS = new Set(['--h', '--help', '-h', '-help']);
|
|
11
|
+
/**
|
|
12
|
+
* Core validation logic extracted for testability.
|
|
13
|
+
* Auto-initializes .brv/ if it doesn't exist (for non-vc commands), then migrates config version if needed.
|
|
14
|
+
* VC commands still require explicit `brv vc init`.
|
|
15
|
+
* Also ensures connector files are patched with `brv curate view` docs (once per project).
|
|
16
|
+
*
|
|
17
|
+
* @param commandId - The command being executed
|
|
18
|
+
* @param configStore - The config store to use for reading config
|
|
19
|
+
* @param argv - Command arguments (used to detect help flags)
|
|
20
|
+
* @param autoInitDeps - Dependencies for auto-init (optional, for testing)
|
|
21
|
+
*/
|
|
22
|
+
export const validateBrvConfigVersion = async (commandId, configStore, argv = [], autoInitDeps) => {
|
|
23
|
+
if (argv.some((arg) => HELP_FLAGS.has(arg)))
|
|
24
|
+
return;
|
|
25
|
+
const exists = await configStore.exists();
|
|
26
|
+
if (!exists && COMMANDS_NEED_AUTO_INIT.has(commandId)) {
|
|
27
|
+
const deps = autoInitDeps ?? {
|
|
28
|
+
contextTreeService: new FileContextTreeService(),
|
|
29
|
+
projectConfigStore: configStore,
|
|
30
|
+
};
|
|
31
|
+
await ensureProjectInitialized(deps);
|
|
32
|
+
const config = await configStore.read();
|
|
33
|
+
if (!config) {
|
|
34
|
+
throw new Error('fatal: corrupt or unreadable config: .brv/config.json');
|
|
35
|
+
}
|
|
36
|
+
// ProjectConfigStore checks .brv/ at process.cwd() directly (no walk-up),
|
|
37
|
+
// so configStore.exists() returning true means process.cwd() IS the project root.
|
|
38
|
+
const cwd = process.cwd();
|
|
39
|
+
if (config.version !== BRV_CONFIG_VERSION) {
|
|
40
|
+
const updated = config.withVersion(BRV_CONFIG_VERSION);
|
|
41
|
+
await configStore.write(updated);
|
|
42
|
+
await syncConfigToXdg(updated, cwd);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Init hook that ensures .brv/ exists and validates config version.
|
|
48
|
+
* Runs once during CLI bootstrap — does NOT re-fire for runCommand() calls,
|
|
49
|
+
* so commands like `init` can safely delegate to sub-commands.
|
|
50
|
+
*/
|
|
51
|
+
const hook = async function (options) {
|
|
52
|
+
try {
|
|
53
|
+
await validateBrvConfigVersion(options.id ?? '', new ProjectConfigStore(), options.argv ?? []);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
+
process.stderr.write(`${message}\n`);
|
|
58
|
+
// eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export default hook;
|
|
@@ -3,6 +3,8 @@ import { type TransportConnector } from '../../server/infra/transport/transport-
|
|
|
3
3
|
export interface DaemonClientOptions {
|
|
4
4
|
/** Max retry attempts. Default: 3 */
|
|
5
5
|
maxRetries?: number;
|
|
6
|
+
/** Explicit project path — bypasses walk-up discovery. Use for `init` where .brv/ doesn't exist yet. */
|
|
7
|
+
projectPath?: string;
|
|
6
8
|
/** Delay between retries in ms. Default: 2000. Set to 0 in tests. */
|
|
7
9
|
retryDelayMs?: number;
|
|
8
10
|
/** Optional transport connector for DI/testing */
|
|
@@ -2,6 +2,7 @@ import { ConnectionError, ConnectionFailedError, DaemonSpawnError, InstanceCrash
|
|
|
2
2
|
import { TaskErrorCode } from '../../server/core/domain/errors/task-error.js';
|
|
3
3
|
import { createDaemonAwareConnector } from '../../server/infra/transport/transport-connector.js';
|
|
4
4
|
import { getSandboxEnvironmentName, isSandboxEnvironment, isSandboxNetworkError, } from '../../server/utils/sandbox-detector.js';
|
|
5
|
+
import { VcErrorCode } from '../../shared/transport/events/vc-events.js';
|
|
5
6
|
/** Max retry attempts when daemon disconnects mid-task */
|
|
6
7
|
const MAX_RETRIES = 3;
|
|
7
8
|
/** Delay between retry attempts (ms) */
|
|
@@ -18,6 +19,20 @@ const USER_FRIENDLY_MESSAGES = {
|
|
|
18
19
|
[TaskErrorCode.PROVIDER_NOT_CONFIGURED]: 'No provider connected. Run "brv providers connect byterover" to use the free built-in provider, or connect another provider.',
|
|
19
20
|
[TaskErrorCode.SPACE_NOT_CONFIGURED]: 'No space configured. Run "brv space list" to see available spaces, then "brv space switch --team <team> --name <space>" to select one.',
|
|
20
21
|
[TaskErrorCode.SPACE_NOT_FOUND]: 'Space not found. Check your configuration.',
|
|
22
|
+
[TaskErrorCode.VC_GIT_INITIALIZED]: 'ByteRover version control is active. Use brv vc commands instead of legacy sync commands.',
|
|
23
|
+
[VcErrorCode.AUTH_FAILED]: 'Authentication failed. Run brv login.',
|
|
24
|
+
[VcErrorCode.CONFIG_KEY_NOT_SET]: 'Config key is not set.',
|
|
25
|
+
[VcErrorCode.CONFLICT_MARKERS_PRESENT]: 'Conflict markers detected. Resolve conflicts and run brv vc add before pushing.',
|
|
26
|
+
[VcErrorCode.GIT_NOT_INITIALIZED]: 'ByteRover version control not initialized. Run brv vc init first.',
|
|
27
|
+
// INVALID_BRANCH_NAME intentionally omitted: fall through to server's message with actual branch name
|
|
28
|
+
[VcErrorCode.INVALID_CONFIG_KEY]: 'Invalid config key. Allowed: user.name, user.email.',
|
|
29
|
+
[VcErrorCode.NETWORK_ERROR]: 'Network error. Check your connection and try again.',
|
|
30
|
+
[VcErrorCode.NON_FAST_FORWARD]: 'Remote has changes. Run brv vc pull first.',
|
|
31
|
+
[VcErrorCode.NOTHING_STAGED]: 'Nothing staged. Run brv vc add first.',
|
|
32
|
+
[VcErrorCode.NOTHING_TO_PUSH]: 'No commits to push. Run brv vc add and brv vc commit first.',
|
|
33
|
+
[VcErrorCode.REMOTE_ALREADY_EXISTS]: "Remote 'origin' already exists. Use brv vc remote set-url <url> to update.",
|
|
34
|
+
// UNCOMMITTED_CHANGES intentionally omitted: fall through to server's detailed message with file paths
|
|
35
|
+
// USER_NOT_CONFIGURED intentionally omitted: fall through to server's specific hint with actual values
|
|
21
36
|
};
|
|
22
37
|
/**
|
|
23
38
|
* Connects to the daemon, auto-starting it if needed.
|
|
@@ -35,7 +50,7 @@ export async function connectToDaemonClient(options) {
|
|
|
35
50
|
export async function withDaemonRetry(fn, options) {
|
|
36
51
|
const maxRetries = options?.maxRetries ?? MAX_RETRIES;
|
|
37
52
|
const retryDelayMs = options?.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
|
|
38
|
-
const connector = options?.transportConnector ?? createDaemonAwareConnector();
|
|
53
|
+
const connector = options?.transportConnector ?? createDaemonAwareConnector(options?.projectPath);
|
|
39
54
|
let lastError;
|
|
40
55
|
/* eslint-disable no-await-in-loop -- intentional sequential retry loop */
|
|
41
56
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
@@ -132,21 +147,32 @@ export function formatConnectionError(error, providerContext) {
|
|
|
132
147
|
}
|
|
133
148
|
return baseMessage;
|
|
134
149
|
}
|
|
150
|
+
// Task errors (from task-client.ts waitForTaskCompletion) arrive as plain Error with .code property.
|
|
151
|
+
// Check code-based lookup before text-matching — mirrors TUI's formatTaskError behavior.
|
|
152
|
+
if (error instanceof Error && 'code' in error) {
|
|
153
|
+
const { code } = error;
|
|
154
|
+
if (typeof code === 'string') {
|
|
155
|
+
return USER_FRIENDLY_MESSAGES[code] ?? error.message;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
135
158
|
const message = error instanceof Error ? error.message : String(error);
|
|
136
159
|
const lowerMessage = message.toLowerCase();
|
|
137
160
|
if (lowerMessage.includes('401') || lowerMessage.includes('unauthorized')) {
|
|
138
161
|
return "Authentication required for cloud sync. Run 'brv login' to connect your account.";
|
|
139
162
|
}
|
|
140
163
|
if (lowerMessage.includes('api key') || lowerMessage.includes('invalid key')) {
|
|
141
|
-
|
|
142
|
-
const model = providerContext?.activeModel;
|
|
143
|
-
const currentInfo = model ? `Provider: ${provider} Model: ${model}\n\n` : `Provider: ${provider}\n\n`;
|
|
144
|
-
return (`LLM provider credentials are missing or invalid.\n${currentInfo}` +
|
|
145
|
-
' Reconnect your provider:\n' +
|
|
146
|
-
` brv providers connect ${provider}\n\n` +
|
|
147
|
-
' Switch to a different provider:\n' +
|
|
148
|
-
' brv providers switch <provider>\n\n' +
|
|
149
|
-
' See all options: brv providers --help');
|
|
164
|
+
return formatApiKeyError(providerContext);
|
|
150
165
|
}
|
|
151
166
|
return `Unexpected error: ${message}`;
|
|
152
167
|
}
|
|
168
|
+
function formatApiKeyError(providerContext) {
|
|
169
|
+
const provider = providerContext?.activeProvider ?? '<provider>';
|
|
170
|
+
const model = providerContext?.activeModel;
|
|
171
|
+
const currentInfo = model ? `Provider: ${provider} Model: ${model}\n\n` : `Provider: ${provider}\n\n`;
|
|
172
|
+
return (`LLM provider API key is missing or invalid.\n${currentInfo}` +
|
|
173
|
+
' Reconnect with your API key:\n' +
|
|
174
|
+
` brv providers connect ${provider} --api-key <key>\n\n` +
|
|
175
|
+
' Switch to a different provider:\n' +
|
|
176
|
+
' brv providers switch <provider>\n\n' +
|
|
177
|
+
' See all options: brv providers --help');
|
|
178
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared theme for select prompts in interactive wizards.
|
|
3
|
+
* Appends "esc back" to the built-in key help tip (↑↓ navigate • ⏎ select).
|
|
4
|
+
*/
|
|
5
|
+
export declare const wizardSelectTheme: {
|
|
6
|
+
style: {
|
|
7
|
+
keysHelpTip: (keys: [string, string][]) => string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Shared theme for input/password prompts in interactive wizards.
|
|
12
|
+
* Appends "esc back" hint to the message line.
|
|
13
|
+
*/
|
|
14
|
+
export declare const wizardInputTheme: {
|
|
15
|
+
style: {
|
|
16
|
+
message(text: string, status: string): string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/** Esc key — go back to previous step */
|
|
20
|
+
export declare function isEscBack(error: unknown): boolean;
|
|
21
|
+
/** Ctrl+C — exit the wizard entirely */
|
|
22
|
+
export declare function isForceExit(error: unknown): boolean;
|
|
23
|
+
/** Any prompt cancellation (Esc or Ctrl+C) */
|
|
24
|
+
export declare function isPromptCancelled(error: unknown): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Validates a URL string.
|
|
27
|
+
* @param value The URL string to validate.
|
|
28
|
+
* @returns True if the URL is valid, otherwise an error message.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateUrl(value: string): boolean | string;
|
|
31
|
+
/**
|
|
32
|
+
* Creates an AbortSignal that aborts when Escape is pressed.
|
|
33
|
+
* Use with @inquirer/prompts to enable Esc-to-go-back in interactive wizards.
|
|
34
|
+
*
|
|
35
|
+
* - `signal` — pass to prompt's context `{signal}` to make it cancellable
|
|
36
|
+
* - `reset()` — create a fresh AbortController after a cancel (signal is single-use)
|
|
37
|
+
* - `cleanup()` — remove the keypress listener when the wizard is done
|
|
38
|
+
*/
|
|
39
|
+
export declare function createEscapeSignal(): {
|
|
40
|
+
cleanup: () => void;
|
|
41
|
+
reset: () => void;
|
|
42
|
+
signal: AbortSignal;
|
|
43
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Shared theme for select prompts in interactive wizards.
|
|
4
|
+
* Appends "esc back" to the built-in key help tip (↑↓ navigate • ⏎ select).
|
|
5
|
+
*/
|
|
6
|
+
export const wizardSelectTheme = {
|
|
7
|
+
style: {
|
|
8
|
+
keysHelpTip: (keys) => [...keys, ['esc', 'cancel']].map(([key, action]) => `${key} ${chalk.dim(action)}`).join(chalk.dim(' • ')),
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Shared theme for input/password prompts in interactive wizards.
|
|
13
|
+
* Appends "esc back" hint to the message line.
|
|
14
|
+
*/
|
|
15
|
+
export const wizardInputTheme = {
|
|
16
|
+
style: {
|
|
17
|
+
message(text, status) {
|
|
18
|
+
const base = chalk.bold(text);
|
|
19
|
+
return status === 'done' ? base : `${chalk.bold(text)} ${chalk.dim('(esc back)')}`;
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
/** Esc key — go back to previous step */
|
|
24
|
+
export function isEscBack(error) {
|
|
25
|
+
// @inquirer/prompts error class names as of v7
|
|
26
|
+
return error instanceof Error && error.name === 'AbortPromptError';
|
|
27
|
+
}
|
|
28
|
+
/** Ctrl+C — exit the wizard entirely */
|
|
29
|
+
export function isForceExit(error) {
|
|
30
|
+
// @inquirer/prompts error class names as of v7
|
|
31
|
+
return error instanceof Error && (error.name === 'ExitPromptError' || error.name === 'CancelPromptError');
|
|
32
|
+
}
|
|
33
|
+
/** Any prompt cancellation (Esc or Ctrl+C) */
|
|
34
|
+
export function isPromptCancelled(error) {
|
|
35
|
+
return isEscBack(error) || isForceExit(error);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validates a URL string.
|
|
39
|
+
* @param value The URL string to validate.
|
|
40
|
+
* @returns True if the URL is valid, otherwise an error message.
|
|
41
|
+
*/
|
|
42
|
+
export function validateUrl(value) {
|
|
43
|
+
let parsed;
|
|
44
|
+
try {
|
|
45
|
+
parsed = new URL(value);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return `Invalid base URL format: "${value}". Must be a valid http:// or https:// URL.`;
|
|
49
|
+
}
|
|
50
|
+
if (!['http:', 'https:'].includes(parsed.protocol)) {
|
|
51
|
+
return 'URL must start with http:// or https://';
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates an AbortSignal that aborts when Escape is pressed.
|
|
57
|
+
* Use with @inquirer/prompts to enable Esc-to-go-back in interactive wizards.
|
|
58
|
+
*
|
|
59
|
+
* - `signal` — pass to prompt's context `{signal}` to make it cancellable
|
|
60
|
+
* - `reset()` — create a fresh AbortController after a cancel (signal is single-use)
|
|
61
|
+
* - `cleanup()` — remove the keypress listener when the wizard is done
|
|
62
|
+
*/
|
|
63
|
+
export function createEscapeSignal() {
|
|
64
|
+
let controller = new AbortController();
|
|
65
|
+
const onKeypress = (_ch, key) => {
|
|
66
|
+
if (key?.name === 'escape') {
|
|
67
|
+
controller.abort();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (process.stdin.isTTY) {
|
|
71
|
+
process.stdin.on('keypress', onKeypress);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
cleanup() {
|
|
75
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
76
|
+
},
|
|
77
|
+
reset() {
|
|
78
|
+
controller = new AbortController();
|
|
79
|
+
},
|
|
80
|
+
get signal() {
|
|
81
|
+
return controller.signal;
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal stderr spinner that erases itself when cleared.
|
|
3
|
+
* Shows a spinning animation with a message, disappears completely on clear().
|
|
4
|
+
* No-op in non-TTY environments (CI, pipes).
|
|
5
|
+
*/
|
|
6
|
+
export declare function createSpinner(message: string): {
|
|
7
|
+
clear: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
2
|
+
/**
|
|
3
|
+
* Minimal stderr spinner that erases itself when cleared.
|
|
4
|
+
* Shows a spinning animation with a message, disappears completely on clear().
|
|
5
|
+
* No-op in non-TTY environments (CI, pipes).
|
|
6
|
+
*/
|
|
7
|
+
export function createSpinner(message) {
|
|
8
|
+
if (!process.stderr.isTTY) {
|
|
9
|
+
return { clear() { } };
|
|
10
|
+
}
|
|
11
|
+
let frameIndex = 0;
|
|
12
|
+
const interval = setInterval(() => {
|
|
13
|
+
const frame = SPINNER_FRAMES[frameIndex % SPINNER_FRAMES.length];
|
|
14
|
+
process.stderr.write(`\r${frame} ${message}`);
|
|
15
|
+
frameIndex++;
|
|
16
|
+
}, 80);
|
|
17
|
+
return {
|
|
18
|
+
clear() {
|
|
19
|
+
clearInterval(interval);
|
|
20
|
+
process.stderr.write('\r\u001B[2K');
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -20,6 +20,11 @@ export interface ToolCallRecord {
|
|
|
20
20
|
/** Completion result passed to onCompleted callback */
|
|
21
21
|
export interface TaskCompletionResult {
|
|
22
22
|
logId?: string;
|
|
23
|
+
/** Pending review notification from the server, present when review is required after task completion. */
|
|
24
|
+
pendingReview?: {
|
|
25
|
+
pendingCount: number;
|
|
26
|
+
reviewUrl: string;
|
|
27
|
+
};
|
|
23
28
|
result?: string;
|
|
24
29
|
taskId: string;
|
|
25
30
|
toolCalls: ToolCallRecord[];
|