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
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Init Component
|
|
4
|
-
*
|
|
5
|
-
* Reusable component for running the /init command with streaming output
|
|
6
|
-
* and inline prompts. Used by InitView and OnboardingFlow.
|
|
7
|
-
*/
|
|
8
|
-
import { Box, Text } from 'ink';
|
|
9
|
-
import Spinner from 'ink-spinner';
|
|
10
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
|
-
import { useCommands, useTheme } from '../hooks/index.js';
|
|
12
|
-
import { EnterPrompt } from './enter-prompt.js';
|
|
13
|
-
import { InlineConfirm, InlineInput, InlineSearch, InlineSelect } from './inline-prompts/index.js';
|
|
14
|
-
/**
|
|
15
|
-
* Count the total number of lines in streaming messages (simple newline count)
|
|
16
|
-
*
|
|
17
|
-
* @param messages - Array of streaming messages
|
|
18
|
-
* @returns Total number of lines across all messages
|
|
19
|
-
*/
|
|
20
|
-
function countOutputLines(messages) {
|
|
21
|
-
let total = 0;
|
|
22
|
-
for (const msg of messages) {
|
|
23
|
-
total += msg.content.split('\n').length;
|
|
24
|
-
}
|
|
25
|
-
return total;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get messages from the end that fit within maxLines, truncating from the beginning
|
|
29
|
-
*
|
|
30
|
-
* @param messages - Array of streaming messages
|
|
31
|
-
* @param maxLines - Maximum number of lines to display
|
|
32
|
-
* @returns Object containing display messages, skipped lines count, and total lines
|
|
33
|
-
*/
|
|
34
|
-
function getMessagesFromEnd(messages, maxLines) {
|
|
35
|
-
const totalLines = countOutputLines(messages);
|
|
36
|
-
if (totalLines <= maxLines) {
|
|
37
|
-
return { displayMessages: messages, skippedLines: 0, totalLines };
|
|
38
|
-
}
|
|
39
|
-
const displayMessages = [];
|
|
40
|
-
let lineCount = 0;
|
|
41
|
-
// Iterate from the end (newest messages first)
|
|
42
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
43
|
-
const msg = messages[i];
|
|
44
|
-
const msgLineArray = msg.content.split('\n');
|
|
45
|
-
const msgLineCount = msgLineArray.length;
|
|
46
|
-
if (lineCount + msgLineCount <= maxLines) {
|
|
47
|
-
displayMessages.unshift(msg);
|
|
48
|
-
lineCount += msgLineCount;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
const remainingSpace = maxLines - lineCount;
|
|
52
|
-
if (remainingSpace > 0) {
|
|
53
|
-
const truncatedContent = msgLineArray.slice(-remainingSpace).join('\n');
|
|
54
|
-
displayMessages.unshift({
|
|
55
|
-
...msg,
|
|
56
|
-
content: truncatedContent,
|
|
57
|
-
});
|
|
58
|
-
lineCount += remainingSpace;
|
|
59
|
-
}
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
displayMessages,
|
|
65
|
-
skippedLines: totalLines - lineCount,
|
|
66
|
-
totalLines,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Process streaming messages to handle action_start/action_stop pairs
|
|
71
|
-
* Matches action_start messages with their corresponding action_stop messages
|
|
72
|
-
*
|
|
73
|
-
* @param messages - Array of streaming messages
|
|
74
|
-
* @returns Processed messages with action state included
|
|
75
|
-
*/
|
|
76
|
-
function processMessagesForActions(messages) {
|
|
77
|
-
const stopMessages = new Map();
|
|
78
|
-
for (const msg of messages) {
|
|
79
|
-
if (msg.type === 'action_stop' && msg.actionId) {
|
|
80
|
-
stopMessages.set(msg.actionId, msg.content);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const result = [];
|
|
84
|
-
for (const msg of messages) {
|
|
85
|
-
if (msg.type === 'action_stop') {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (msg.type === 'action_start' && msg.actionId) {
|
|
89
|
-
const stopMessage = stopMessages.get(msg.actionId);
|
|
90
|
-
result.push({
|
|
91
|
-
...msg,
|
|
92
|
-
isActionRunning: stopMessage === undefined,
|
|
93
|
-
stopMessage,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
result.push(msg);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
/** Minimum visible items for inline search */
|
|
103
|
-
const MIN_SEARCH_ITEMS = 3;
|
|
104
|
-
/** Reserved lines for inline search (message + input + margins) */
|
|
105
|
-
const INLINE_SEARCH_OVERHEAD = 3;
|
|
106
|
-
export const Init = ({ active = true, autoStart = false, idleMessage = 'Your project needs initializing.', maxOutputLines, onInitComplete, showIdleMessage = true, }) => {
|
|
107
|
-
const { theme: { colors }, } = useTheme();
|
|
108
|
-
const { commands, handleSlashCommand } = useCommands();
|
|
109
|
-
const maxSearchItems = Math.max(MIN_SEARCH_ITEMS, maxOutputLines - INLINE_SEARCH_OVERHEAD);
|
|
110
|
-
// Streaming state for init command
|
|
111
|
-
const [isRunningInit, setIsRunningInit] = useState(false);
|
|
112
|
-
const [streamingMessages, setStreamingMessages] = useState([]);
|
|
113
|
-
const [activePrompt, setActivePrompt] = useState(null);
|
|
114
|
-
const [activeDialog, setActiveDialog] = useState(null);
|
|
115
|
-
const [initError, setInitError] = useState(null);
|
|
116
|
-
// Handle init command execution
|
|
117
|
-
const runInit = useCallback(async () => {
|
|
118
|
-
if (isRunningInit)
|
|
119
|
-
return;
|
|
120
|
-
setIsRunningInit(true);
|
|
121
|
-
setStreamingMessages([]);
|
|
122
|
-
setInitError(null);
|
|
123
|
-
const result = await handleSlashCommand('/init');
|
|
124
|
-
if (result && 'render' in result) {
|
|
125
|
-
// The InitFlow component handles everything, we just need to track when it completes
|
|
126
|
-
setActiveDialog(result.render({
|
|
127
|
-
onCancel() {
|
|
128
|
-
setActiveDialog(null);
|
|
129
|
-
setIsRunningInit(false);
|
|
130
|
-
},
|
|
131
|
-
onComplete(message) {
|
|
132
|
-
setActiveDialog(null);
|
|
133
|
-
setIsRunningInit(false);
|
|
134
|
-
if (message) {
|
|
135
|
-
setStreamingMessages((prev) => [...prev, { content: message, id: `result-${Date.now()}`, type: 'output' }]);
|
|
136
|
-
}
|
|
137
|
-
// Call completion callback if provided
|
|
138
|
-
if (onInitComplete) {
|
|
139
|
-
onInitComplete();
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
else if (result && 'type' in result && result.type === 'message') {
|
|
145
|
-
setInitError(result.content);
|
|
146
|
-
setIsRunningInit(false);
|
|
147
|
-
}
|
|
148
|
-
}, [handleSlashCommand, isRunningInit, onInitComplete]);
|
|
149
|
-
// Auto-start init if autoStart is true and component is in idle state
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
if (autoStart && commands.length > 0 && !isRunningInit && !initError) {
|
|
152
|
-
runInit();
|
|
153
|
-
}
|
|
154
|
-
}, [autoStart, commands, isRunningInit, initError, runInit]);
|
|
155
|
-
// Process streaming messages to handle action_start/action_stop pairs
|
|
156
|
-
const processedStreamingMessages = useMemo(() => processMessagesForActions(streamingMessages), [streamingMessages]);
|
|
157
|
-
// Render streaming message with proper styling
|
|
158
|
-
const renderStreamingMessage = useCallback((msg) => {
|
|
159
|
-
// Handle action messages with spinner
|
|
160
|
-
if (msg.type === 'action_start') {
|
|
161
|
-
if (msg.isActionRunning) {
|
|
162
|
-
return (_jsxs(Text, { color: colors.text, children: [_jsx(Spinner, { type: "dots" }), " ", msg.content] }, msg.id));
|
|
163
|
-
}
|
|
164
|
-
return (_jsx(Text, { color: colors.text, children: msg.stopMessage ? `... ${msg.stopMessage}` : '' }, msg.id));
|
|
165
|
-
}
|
|
166
|
-
// Regular messages
|
|
167
|
-
let color = colors.text;
|
|
168
|
-
if (msg.type === 'error')
|
|
169
|
-
color = colors.errorText;
|
|
170
|
-
if (msg.type === 'warning')
|
|
171
|
-
color = colors.warning;
|
|
172
|
-
return (_jsx(Text, { color: color, children: msg.content }, msg.id));
|
|
173
|
-
}, [colors]);
|
|
174
|
-
// Prompt response handlers
|
|
175
|
-
const handleSearchResponse = useCallback((value) => {
|
|
176
|
-
if (activePrompt?.type === 'search') {
|
|
177
|
-
activePrompt.onResponse(value);
|
|
178
|
-
setActivePrompt(null);
|
|
179
|
-
}
|
|
180
|
-
}, [activePrompt]);
|
|
181
|
-
const handleConfirmResponse = useCallback((value) => {
|
|
182
|
-
if (activePrompt?.type === 'confirm') {
|
|
183
|
-
activePrompt.onResponse(value);
|
|
184
|
-
setActivePrompt(null);
|
|
185
|
-
}
|
|
186
|
-
}, [activePrompt]);
|
|
187
|
-
const handleSelectResponse = useCallback((value) => {
|
|
188
|
-
if (activePrompt?.type === 'select') {
|
|
189
|
-
activePrompt.onResponse(value);
|
|
190
|
-
setActivePrompt(null);
|
|
191
|
-
}
|
|
192
|
-
}, [activePrompt]);
|
|
193
|
-
const handleInputResponse = useCallback((value) => {
|
|
194
|
-
if (activePrompt?.type === 'input') {
|
|
195
|
-
activePrompt.onResponse(value);
|
|
196
|
-
setActivePrompt(null);
|
|
197
|
-
}
|
|
198
|
-
}, [activePrompt]);
|
|
199
|
-
// Render active prompt
|
|
200
|
-
const renderActivePrompt = useCallback(() => {
|
|
201
|
-
if (!activePrompt)
|
|
202
|
-
return null;
|
|
203
|
-
switch (activePrompt.type) {
|
|
204
|
-
case 'confirm': {
|
|
205
|
-
return (_jsx(InlineConfirm, { default: activePrompt.default, message: activePrompt.message, onConfirm: handleConfirmResponse }));
|
|
206
|
-
}
|
|
207
|
-
case 'input': {
|
|
208
|
-
return (_jsx(InlineInput, { message: activePrompt.message, onSubmit: handleInputResponse, placeholder: activePrompt.placeholder, validate: activePrompt.validate }));
|
|
209
|
-
}
|
|
210
|
-
case 'search': {
|
|
211
|
-
return (_jsx(InlineSearch, { maxVisibleItems: maxSearchItems, message: activePrompt.message, onSelect: handleSearchResponse, source: activePrompt.source }));
|
|
212
|
-
}
|
|
213
|
-
case 'select': {
|
|
214
|
-
return (_jsx(InlineSelect, { choices: activePrompt.choices, message: activePrompt.message, onSelect: handleSelectResponse }));
|
|
215
|
-
}
|
|
216
|
-
default: {
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}, [
|
|
221
|
-
activePrompt,
|
|
222
|
-
handleConfirmResponse,
|
|
223
|
-
handleInputResponse,
|
|
224
|
-
handleSearchResponse,
|
|
225
|
-
handleSelectResponse,
|
|
226
|
-
maxSearchItems,
|
|
227
|
-
]);
|
|
228
|
-
// Error state - show error with retry
|
|
229
|
-
if (initError) {
|
|
230
|
-
return (_jsxs(Box, { flexDirection: "column", rowGap: 1, children: [_jsxs(Text, { color: colors.errorText, children: ["Error: ", initError] }), _jsx(EnterPrompt, { action: "try again", active: active && !isRunningInit && !activePrompt, onEnter: runInit })] }));
|
|
231
|
-
}
|
|
232
|
-
const { displayMessages } = getMessagesFromEnd(processedStreamingMessages, maxOutputLines);
|
|
233
|
-
return (_jsxs(Box, { flexDirection: "column", rowGap: 1, children: [showIdleMessage && !activeDialog && _jsx(Text, { color: colors.text, children: idleMessage }), activeDialog, !activeDialog && displayMessages.length > 0 && (_jsxs(Box, { borderColor: colors.border, borderStyle: "single", flexDirection: "column", paddingX: 1, paddingY: 0, width: "100%", children: [displayMessages.map((streamMsg) => renderStreamingMessage(streamMsg)), renderActivePrompt()] })), !isRunningInit && !activeDialog && displayMessages.length === 0 && (_jsx(EnterPrompt, { action: "initialize your project", active: active && !isRunningInit && !activePrompt, onEnter: runInit }))] }));
|
|
234
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { QueryConfig } from '../../../lib/react-query.js';
|
|
2
|
-
import { type SpaceListResponse } from '../../../../shared/transport/events/index.js';
|
|
3
|
-
export declare const getSpaces: () => Promise<SpaceListResponse>;
|
|
4
|
-
export declare const getSpacesQueryOptions: () => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<SpaceListResponse, Error, SpaceListResponse, string[]>, "queryFn"> & {
|
|
5
|
-
queryFn?: import("@tanstack/react-query").QueryFunction<SpaceListResponse, string[], never> | undefined;
|
|
6
|
-
} & {
|
|
7
|
-
queryKey: string[] & {
|
|
8
|
-
[dataTagSymbol]: SpaceListResponse;
|
|
9
|
-
[dataTagErrorSymbol]: Error;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
type UseGetSpacesOptions = {
|
|
13
|
-
queryConfig?: QueryConfig<typeof getSpacesQueryOptions>;
|
|
14
|
-
};
|
|
15
|
-
export declare const useGetSpaces: ({ queryConfig }?: UseGetSpacesOptions) => import("@tanstack/react-query").UseQueryResult<SpaceListResponse, Error>;
|
|
16
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { queryOptions, useQuery } from '@tanstack/react-query';
|
|
2
|
-
import { SpaceEvents } from '../../../../shared/transport/events/index.js';
|
|
3
|
-
import { useTransportStore } from '../../../stores/transport-store.js';
|
|
4
|
-
export const getSpaces = () => {
|
|
5
|
-
const { apiClient } = useTransportStore.getState();
|
|
6
|
-
if (!apiClient)
|
|
7
|
-
return Promise.reject(new Error('Not connected'));
|
|
8
|
-
return apiClient.request(SpaceEvents.LIST);
|
|
9
|
-
};
|
|
10
|
-
export const getSpacesQueryOptions = () => queryOptions({
|
|
11
|
-
queryFn: getSpaces,
|
|
12
|
-
queryKey: ['space', 'list'],
|
|
13
|
-
});
|
|
14
|
-
export const useGetSpaces = ({ queryConfig } = {}) => useQuery({
|
|
15
|
-
...getSpacesQueryOptions(),
|
|
16
|
-
...queryConfig,
|
|
17
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { MutationConfig } from '../../../lib/react-query.js';
|
|
2
|
-
import { type SpaceSwitchResponse } from '../../../../shared/transport/events/index.js';
|
|
3
|
-
export type SwitchSpaceDTO = {
|
|
4
|
-
spaceId: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const switchSpace: ({ spaceId }: SwitchSpaceDTO) => Promise<SpaceSwitchResponse>;
|
|
7
|
-
type UseSwitchSpaceOptions = {
|
|
8
|
-
mutationConfig?: MutationConfig<typeof switchSpace>;
|
|
9
|
-
};
|
|
10
|
-
export declare const useSwitchSpace: ({ mutationConfig }?: UseSwitchSpaceOptions) => import("@tanstack/react-query").UseMutationResult<SpaceSwitchResponse, Error, SwitchSpaceDTO, unknown>;
|
|
11
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { SpaceEvents } from '../../../../shared/transport/events/index.js';
|
|
3
|
-
import { useTransportStore } from '../../../stores/transport-store.js';
|
|
4
|
-
import { getSpacesQueryOptions } from './get-spaces.js';
|
|
5
|
-
export const switchSpace = ({ spaceId }) => {
|
|
6
|
-
const { apiClient } = useTransportStore.getState();
|
|
7
|
-
if (!apiClient)
|
|
8
|
-
return Promise.reject(new Error('Not connected'));
|
|
9
|
-
return apiClient.request(SpaceEvents.SWITCH, { spaceId });
|
|
10
|
-
};
|
|
11
|
-
export const useSwitchSpace = ({ mutationConfig } = {}) => {
|
|
12
|
-
const queryClient = useQueryClient();
|
|
13
|
-
const { onSuccess, ...restConfig } = mutationConfig ?? {};
|
|
14
|
-
return useMutation({
|
|
15
|
-
onSuccess(...args) {
|
|
16
|
-
queryClient.invalidateQueries({
|
|
17
|
-
queryKey: getSpacesQueryOptions().queryKey,
|
|
18
|
-
});
|
|
19
|
-
onSuccess?.(...args);
|
|
20
|
-
},
|
|
21
|
-
...restConfig,
|
|
22
|
-
mutationFn: switchSpace,
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SpaceListView Component
|
|
3
|
-
*
|
|
4
|
-
* Fetches and displays all spaces for the current team.
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import type { CustomDialogCallbacks } from '../../../types/commands.js';
|
|
8
|
-
interface SpaceListViewProps extends CustomDialogCallbacks {
|
|
9
|
-
json?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export declare function SpaceListView({ json, onComplete }: SpaceListViewProps): React.ReactNode;
|
|
12
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* SpaceListView Component
|
|
4
|
-
*
|
|
5
|
-
* Fetches and displays all spaces for the current team.
|
|
6
|
-
*/
|
|
7
|
-
import { Text } from 'ink';
|
|
8
|
-
import Spinner from 'ink-spinner';
|
|
9
|
-
import { useEffect, useMemo } from 'react';
|
|
10
|
-
import { useGetSpaces } from '../api/get-spaces.js';
|
|
11
|
-
export function SpaceListView({ json, onComplete }) {
|
|
12
|
-
const { data, error, isLoading } = useGetSpaces();
|
|
13
|
-
const result = useMemo(() => {
|
|
14
|
-
if (!data)
|
|
15
|
-
return null;
|
|
16
|
-
const { teams } = data;
|
|
17
|
-
if (teams.length === 0)
|
|
18
|
-
return 'No teams found.';
|
|
19
|
-
if (json) {
|
|
20
|
-
return JSON.stringify(teams.map((t) => ({
|
|
21
|
-
teamId: t.teamId,
|
|
22
|
-
teamName: t.teamName,
|
|
23
|
-
// eslint-disable-next-line perfectionist/sort-objects
|
|
24
|
-
spaces: t.spaces.map((s) => ({
|
|
25
|
-
isDefault: s.isDefault,
|
|
26
|
-
spaceId: s.id,
|
|
27
|
-
spaceName: s.name,
|
|
28
|
-
})),
|
|
29
|
-
})), undefined, 2);
|
|
30
|
-
}
|
|
31
|
-
const lines = [];
|
|
32
|
-
for (const [index, team] of teams.entries()) {
|
|
33
|
-
lines.push(`${index + 1}. ${team.teamName} (team)`);
|
|
34
|
-
if (team.spaces.length === 0) {
|
|
35
|
-
lines.push(' No spaces');
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
for (const space of team.spaces) {
|
|
39
|
-
const defaultMarker = space.isDefault ? ' (default)' : '';
|
|
40
|
-
lines.push(` - ${space.name}${defaultMarker} (space)`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return lines.join('\n');
|
|
45
|
-
}, [data, json]);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (result)
|
|
48
|
-
onComplete(result);
|
|
49
|
-
if (error)
|
|
50
|
-
onComplete(`Failed to list spaces: ${error.message}`);
|
|
51
|
-
}, [error, onComplete, result]);
|
|
52
|
-
if (isLoading) {
|
|
53
|
-
return (_jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Fetching spaces..."] }));
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SpaceSwitchFlow Component
|
|
3
|
-
*
|
|
4
|
-
* React flow for the /space switch command.
|
|
5
|
-
* Fetches spaces → renders selection → switches config → pulls context from new space.
|
|
6
|
-
*/
|
|
7
|
-
import React from 'react';
|
|
8
|
-
export interface SpaceSwitchFlowProps {
|
|
9
|
-
isActive?: boolean;
|
|
10
|
-
onCancel: () => void;
|
|
11
|
-
onComplete: (message: string) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare const SpaceSwitchFlow: React.FC<SpaceSwitchFlowProps>;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* SpaceSwitchFlow Component
|
|
4
|
-
*
|
|
5
|
-
* React flow for the /space switch command.
|
|
6
|
-
* Fetches spaces → renders selection → switches config → pulls context from new space.
|
|
7
|
-
*/
|
|
8
|
-
import { Box, Text } from 'ink';
|
|
9
|
-
import Spinner from 'ink-spinner';
|
|
10
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
|
-
import { PullEvents } from '../../../../shared/transport/events/index.js';
|
|
12
|
-
import { SelectableList } from '../../../components/selectable-list.js';
|
|
13
|
-
import { useTheme } from '../../../hooks/index.js';
|
|
14
|
-
import { BRV_DIR, CONTEXT_TREE_CONFLICT_DIR } from '../../../lib/environment.js';
|
|
15
|
-
import { useTransportStore } from '../../../stores/transport-store.js';
|
|
16
|
-
import { formatTransportError } from '../../../utils/error-messages.js';
|
|
17
|
-
import { useGetSpaces } from '../api/get-spaces.js';
|
|
18
|
-
import { useSwitchSpace } from '../api/switch-space.js';
|
|
19
|
-
export const SpaceSwitchFlow = ({ isActive = true, onCancel, onComplete }) => {
|
|
20
|
-
const { theme: { colors }, } = useTheme();
|
|
21
|
-
const [error, setError] = useState(null);
|
|
22
|
-
const [step, setStep] = useState('selecting');
|
|
23
|
-
const [selectedSpaceId, setSelectedSpaceId] = useState(null);
|
|
24
|
-
const [progressMessages, setProgressMessages] = useState([]);
|
|
25
|
-
const { data, error: fetchError, isLoading } = useGetSpaces();
|
|
26
|
-
const switchMutation = useSwitchSpace();
|
|
27
|
-
const allSpaces = useMemo(() => (data?.teams ?? []).flatMap((t) => t.spaces), [data]);
|
|
28
|
-
// Handle fetch error (e.g., not authenticated, not initialized)
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (fetchError) {
|
|
31
|
-
onComplete(formatTransportError(fetchError));
|
|
32
|
-
}
|
|
33
|
-
}, [fetchError, onComplete]);
|
|
34
|
-
// Auto-complete if no spaces
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (!isLoading && allSpaces.length === 0 && data) {
|
|
37
|
-
onComplete('No spaces found. Please create a space in the ByteRover dashboard first.');
|
|
38
|
-
}
|
|
39
|
-
}, [allSpaces.length, data, isLoading, onComplete]);
|
|
40
|
-
const spaceItems = useMemo(() => allSpaces.map((s) => ({ description: s.isDefault ? '(default)' : '', id: s.id, name: `${s.teamName}/${s.name}` })), [allSpaces]);
|
|
41
|
-
// Subscribe to pull progress and execute switch
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (step !== 'executing' || !selectedSpaceId)
|
|
44
|
-
return;
|
|
45
|
-
const { apiClient } = useTransportStore.getState();
|
|
46
|
-
let unsubProgress;
|
|
47
|
-
if (apiClient) {
|
|
48
|
-
unsubProgress = apiClient.on(PullEvents.PROGRESS, (progressData) => {
|
|
49
|
-
setProgressMessages((prev) => [...prev, progressData.message]);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
switchMutation.mutate({ spaceId: selectedSpaceId }, {
|
|
53
|
-
onError(error_) {
|
|
54
|
-
unsubProgress?.();
|
|
55
|
-
setStep('selecting');
|
|
56
|
-
setError(formatTransportError(error_));
|
|
57
|
-
},
|
|
58
|
-
onSuccess(result) {
|
|
59
|
-
unsubProgress?.();
|
|
60
|
-
if (!result.success) {
|
|
61
|
-
onComplete(`Failed to switch space: ${result.pullError ?? 'Unknown error'}`);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const spaceLine = `Successfully switched to space: ${result.config.spaceName}`;
|
|
65
|
-
let pullLine;
|
|
66
|
-
if (result.pullResult) {
|
|
67
|
-
pullLine = `Pulled: +${result.pullResult.added} ~${result.pullResult.edited} -${result.pullResult.deleted}`;
|
|
68
|
-
if (result.pullResult.conflicted) {
|
|
69
|
-
pullLine += `\n ${result.pullResult.conflicted} conflict(s) auto-merged — review ${BRV_DIR}/${CONTEXT_TREE_CONFLICT_DIR}/ for original files`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
pullLine = 'No remote context found.';
|
|
74
|
-
}
|
|
75
|
-
onComplete(`${spaceLine}\n${pullLine}\nConfiguration updated in: .brv/config.json`);
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
return () => {
|
|
79
|
-
unsubProgress?.();
|
|
80
|
-
};
|
|
81
|
-
}, [step, selectedSpaceId]);
|
|
82
|
-
const handleSelect = useCallback((item) => {
|
|
83
|
-
setError(null);
|
|
84
|
-
setSelectedSpaceId(item.id);
|
|
85
|
-
setStep('executing');
|
|
86
|
-
}, []);
|
|
87
|
-
if (isLoading) {
|
|
88
|
-
return (_jsx(Box, { children: _jsx(Text, { color: colors.dimText, children: "Fetching spaces..." }) }));
|
|
89
|
-
}
|
|
90
|
-
if (allSpaces.length === 0) {
|
|
91
|
-
return (_jsx(Box, { children: _jsx(Text, { color: colors.dimText, children: "Loading..." }) }));
|
|
92
|
-
}
|
|
93
|
-
if (step === 'executing') {
|
|
94
|
-
return (_jsxs(_Fragment, { children: [progressMessages.map((msg, i) => (_jsx(Text, { children: msg }, i))), _jsxs(Text, { children: [_jsx(Spinner, { type: "dots" }), " Switching space..."] })] }));
|
|
95
|
-
}
|
|
96
|
-
return (_jsxs(Box, { flexDirection: "column", children: [error && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: colors.errorText, children: error }) })), _jsx(SelectableList, { filterKeys: (item) => [item.id, item.name], getCurrentKey: (item) => item.id, isActive: isActive, items: spaceItems, keyExtractor: (item) => item.id, onCancel: onCancel, onSelect: handleSelect, renderItem: (item, isHighlighted) => (_jsxs(Box, { gap: 2, children: [_jsx(Text, { backgroundColor: isHighlighted ? colors.dimText : undefined, color: colors.text, children: item.name }), item.description && _jsx(Text, { color: colors.dimText, children: item.description })] })), title: "Select a space" })] }));
|
|
97
|
-
};
|
/package/dist/server/core/interfaces/services/{i-legacy-rule-detector.js → i-git-service.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|