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,162 @@
|
|
|
1
|
+
import { mkdir, unlink, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join, relative } from 'node:path';
|
|
3
|
+
import { ReviewEvents, } from '../../../../shared/transport/events/review-events.js';
|
|
4
|
+
import { BRV_DIR, CONTEXT_TREE_DIR } from '../../../constants.js';
|
|
5
|
+
import { resolveRequiredProjectPath } from './handler-types.js';
|
|
6
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
7
|
+
async function writeFileWithDirs(absolutePath, content) {
|
|
8
|
+
await mkdir(dirname(absolutePath), { recursive: true });
|
|
9
|
+
await writeFile(absolutePath, content, 'utf8');
|
|
10
|
+
}
|
|
11
|
+
// ── Handler ──────────────────────────────────────────────────────────────────
|
|
12
|
+
/**
|
|
13
|
+
* Handles review:decideTask — approves or rejects all pending review operations
|
|
14
|
+
* for a given task ID in a single transport request.
|
|
15
|
+
*
|
|
16
|
+
* Mirrors the per-file logic in review-api-handler.ts but operates at task scope.
|
|
17
|
+
*/
|
|
18
|
+
export class ReviewHandler {
|
|
19
|
+
curateLogStoreFactory;
|
|
20
|
+
onResolved;
|
|
21
|
+
resolveProjectPath;
|
|
22
|
+
reviewBackupStoreFactory;
|
|
23
|
+
transport;
|
|
24
|
+
constructor(deps) {
|
|
25
|
+
this.curateLogStoreFactory = deps.curateLogStoreFactory;
|
|
26
|
+
this.onResolved = deps.onResolved;
|
|
27
|
+
this.resolveProjectPath = deps.resolveProjectPath;
|
|
28
|
+
this.reviewBackupStoreFactory = deps.reviewBackupStoreFactory;
|
|
29
|
+
this.transport = deps.transport;
|
|
30
|
+
}
|
|
31
|
+
setup() {
|
|
32
|
+
this.transport.onRequest(ReviewEvents.DECIDE_TASK, (data, clientId) => this.handleDecideTask(data, clientId));
|
|
33
|
+
this.transport.onRequest(ReviewEvents.PENDING, (_data, clientId) => this.handlePending(clientId));
|
|
34
|
+
}
|
|
35
|
+
async handleDecideTask({ decision, filePaths: filterPaths, taskId }, clientId) {
|
|
36
|
+
const projectPath = resolveRequiredProjectPath(this.resolveProjectPath, clientId);
|
|
37
|
+
const contextTreeDir = join(projectPath, BRV_DIR, CONTEXT_TREE_DIR);
|
|
38
|
+
const store = this.curateLogStoreFactory(projectPath);
|
|
39
|
+
const backupStore = this.reviewBackupStoreFactory(projectPath);
|
|
40
|
+
const entries = await store.list();
|
|
41
|
+
// Collect pending ops grouped by relative file path for this taskId
|
|
42
|
+
const pendingByPath = new Map();
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
if (entry.taskId !== taskId)
|
|
45
|
+
continue;
|
|
46
|
+
for (let i = 0; i < entry.operations.length; i++) {
|
|
47
|
+
const op = entry.operations[i];
|
|
48
|
+
if (op.reviewStatus !== 'pending' || !op.filePath)
|
|
49
|
+
continue;
|
|
50
|
+
const rel = relative(contextTreeDir, op.filePath);
|
|
51
|
+
if (rel.startsWith('..'))
|
|
52
|
+
continue;
|
|
53
|
+
let ops = pendingByPath.get(rel);
|
|
54
|
+
if (!ops) {
|
|
55
|
+
ops = [];
|
|
56
|
+
pendingByPath.set(rel, ops);
|
|
57
|
+
}
|
|
58
|
+
ops.push({ additionalFilePaths: op.additionalFilePaths, logId: entry.id, operationIndex: i });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// If filePaths filter is provided, only process those files
|
|
62
|
+
if (filterPaths?.length) {
|
|
63
|
+
const filterSet = new Set(filterPaths);
|
|
64
|
+
const keysToDelete = [...pendingByPath.keys()].filter((key) => !filterSet.has(key));
|
|
65
|
+
for (const key of keysToDelete)
|
|
66
|
+
pendingByPath.delete(key);
|
|
67
|
+
}
|
|
68
|
+
// Apply decision for each affected file in parallel.
|
|
69
|
+
// allSettled so a single file failure does not block log updates for files that succeeded.
|
|
70
|
+
const settled = await Promise.allSettled([...pendingByPath.entries()].map(async ([relPath, ops]) => {
|
|
71
|
+
let reverted = false;
|
|
72
|
+
const allAdditionalPaths = [...new Set(ops.flatMap((o) => o.additionalFilePaths ?? []))];
|
|
73
|
+
if (decision === 'rejected') {
|
|
74
|
+
const absolutePath = join(contextTreeDir, relPath);
|
|
75
|
+
const backupContent = await backupStore.read(relPath);
|
|
76
|
+
// null backup = ADD operation (new file) → remove it; existing backup → restore
|
|
77
|
+
await (backupContent === null
|
|
78
|
+
? unlink(absolutePath).catch(() => { })
|
|
79
|
+
: writeFileWithDirs(absolutePath, backupContent));
|
|
80
|
+
// Restore additional paths (MERGE source, folder DELETE contents).
|
|
81
|
+
// Best-effort: partial failures must not block the log update below.
|
|
82
|
+
await Promise.allSettled(allAdditionalPaths.map(async (absPath) => {
|
|
83
|
+
const rel = relative(contextTreeDir, absPath);
|
|
84
|
+
const content = await backupStore.read(rel);
|
|
85
|
+
if (content !== null)
|
|
86
|
+
await writeFileWithDirs(absPath, content);
|
|
87
|
+
}));
|
|
88
|
+
reverted = true;
|
|
89
|
+
}
|
|
90
|
+
// Clear backups for both approve and reject (current state becomes new baseline)
|
|
91
|
+
await backupStore.delete(relPath);
|
|
92
|
+
await Promise.allSettled(allAdditionalPaths.map((absPath) => backupStore.delete(relative(contextTreeDir, absPath))));
|
|
93
|
+
return { ops, path: relPath, reverted };
|
|
94
|
+
}));
|
|
95
|
+
// Only update log entries for files that were successfully processed.
|
|
96
|
+
// Files that failed remain pending and can be retried.
|
|
97
|
+
const fileResults = settled
|
|
98
|
+
.filter((r) => r.status === 'fulfilled')
|
|
99
|
+
.map((r) => r.value);
|
|
100
|
+
// Batch-update review status grouped by logId (one read+write per entry file)
|
|
101
|
+
const byLogId = new Map();
|
|
102
|
+
for (const { ops } of fileResults) {
|
|
103
|
+
for (const { logId, operationIndex } of ops) {
|
|
104
|
+
let batch = byLogId.get(logId);
|
|
105
|
+
if (!batch) {
|
|
106
|
+
batch = [];
|
|
107
|
+
byLogId.set(logId, batch);
|
|
108
|
+
}
|
|
109
|
+
batch.push({ operationIndex, reviewStatus: decision });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
await Promise.all([...byLogId.entries()].map(([logId, updates]) => store.batchUpdateOperationReviewStatus(logId, updates)));
|
|
113
|
+
try {
|
|
114
|
+
this.onResolved?.({ projectPath, taskId });
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Best-effort notification — never block the response
|
|
118
|
+
}
|
|
119
|
+
const totalCount = fileResults.reduce((sum, { ops }) => sum + ops.length, 0);
|
|
120
|
+
return { files: fileResults.map(({ path, reverted }) => ({ path, reverted })), totalCount };
|
|
121
|
+
}
|
|
122
|
+
async handlePending(clientId) {
|
|
123
|
+
const projectPath = resolveRequiredProjectPath(this.resolveProjectPath, clientId);
|
|
124
|
+
const contextTreeDir = join(projectPath, BRV_DIR, CONTEXT_TREE_DIR);
|
|
125
|
+
const store = this.curateLogStoreFactory(projectPath);
|
|
126
|
+
const entries = await store.list({ status: ['completed'] });
|
|
127
|
+
const taskMap = new Map();
|
|
128
|
+
for (const entry of entries) {
|
|
129
|
+
for (const op of entry.operations) {
|
|
130
|
+
// Skip failed ops (e.g. validation errors) — they were never applied to disk
|
|
131
|
+
if (op.reviewStatus !== 'pending' || op.status === 'failed')
|
|
132
|
+
continue;
|
|
133
|
+
let ops = taskMap.get(entry.taskId);
|
|
134
|
+
if (!ops) {
|
|
135
|
+
ops = [];
|
|
136
|
+
taskMap.set(entry.taskId, ops);
|
|
137
|
+
}
|
|
138
|
+
const pendingOp = { path: op.path, type: op.type };
|
|
139
|
+
if (op.filePath) {
|
|
140
|
+
const rel = relative(contextTreeDir, op.filePath);
|
|
141
|
+
if (!rel.startsWith('..'))
|
|
142
|
+
pendingOp.filePath = rel;
|
|
143
|
+
}
|
|
144
|
+
if (op.impact)
|
|
145
|
+
pendingOp.impact = op.impact;
|
|
146
|
+
if (op.reason)
|
|
147
|
+
pendingOp.reason = op.reason;
|
|
148
|
+
if (op.previousSummary)
|
|
149
|
+
pendingOp.previousSummary = op.previousSummary;
|
|
150
|
+
if (op.summary)
|
|
151
|
+
pendingOp.summary = op.summary;
|
|
152
|
+
ops.push(pendingOp);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const tasks = [...taskMap.entries()].map(([taskId, operations]) => ({
|
|
156
|
+
operations,
|
|
157
|
+
taskId,
|
|
158
|
+
}));
|
|
159
|
+
const pendingCount = tasks.reduce((sum, t) => sum + t.operations.length, 0);
|
|
160
|
+
return { pendingCount, tasks };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ITokenStore } from '../../../core/interfaces/auth/i-token-store.js';
|
|
2
2
|
import type { IContextTreeMerger } from '../../../core/interfaces/context-tree/i-context-tree-merger.js';
|
|
3
|
+
import type { IContextTreeService } from '../../../core/interfaces/context-tree/i-context-tree-service.js';
|
|
3
4
|
import type { IContextTreeSnapshotService } from '../../../core/interfaces/context-tree/i-context-tree-snapshot-service.js';
|
|
4
5
|
import type { IContextTreeWriterService } from '../../../core/interfaces/context-tree/i-context-tree-writer-service.js';
|
|
5
6
|
import type { ICogitPullService } from '../../../core/interfaces/services/i-cogit-pull-service.js';
|
|
@@ -12,6 +13,7 @@ export interface SpaceHandlerDeps {
|
|
|
12
13
|
broadcastToProject: ProjectBroadcaster;
|
|
13
14
|
cogitPullService: ICogitPullService;
|
|
14
15
|
contextTreeMerger: IContextTreeMerger;
|
|
16
|
+
contextTreeService: IContextTreeService;
|
|
15
17
|
contextTreeSnapshotService: IContextTreeSnapshotService;
|
|
16
18
|
contextTreeWriterService: IContextTreeWriterService;
|
|
17
19
|
projectConfigStore: IProjectConfigStore;
|
|
@@ -29,6 +31,7 @@ export declare class SpaceHandler {
|
|
|
29
31
|
private readonly broadcastToProject;
|
|
30
32
|
private readonly cogitPullService;
|
|
31
33
|
private readonly contextTreeMerger;
|
|
34
|
+
private readonly contextTreeService;
|
|
32
35
|
private readonly contextTreeSnapshotService;
|
|
33
36
|
private readonly contextTreeWriterService;
|
|
34
37
|
private readonly projectConfigStore;
|
|
@@ -3,7 +3,7 @@ import { SpaceEvents, } from '../../../../shared/transport/events/space-events.j
|
|
|
3
3
|
import { BRV_DIR, CONTEXT_TREE_CONFLICT_DIR, DEFAULT_BRANCH } from '../../../constants.js';
|
|
4
4
|
import { LocalChangesExistError, NotAuthenticatedError, ProjectNotInitError, SpaceNotFoundError, } from '../../../core/domain/errors/task-error.js';
|
|
5
5
|
import { syncConfigToXdg } from '../../../utils/config-xdg-sync.js';
|
|
6
|
-
import { hasAnyChanges, resolveRequiredProjectPath, } from './handler-types.js';
|
|
6
|
+
import { guardAgainstGitVc, hasAnyChanges, resolveRequiredProjectPath, } from './handler-types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Handles space:* events.
|
|
9
9
|
* Business logic for space listing and switching — no terminal/UI calls.
|
|
@@ -12,6 +12,7 @@ export class SpaceHandler {
|
|
|
12
12
|
broadcastToProject;
|
|
13
13
|
cogitPullService;
|
|
14
14
|
contextTreeMerger;
|
|
15
|
+
contextTreeService;
|
|
15
16
|
contextTreeSnapshotService;
|
|
16
17
|
contextTreeWriterService;
|
|
17
18
|
projectConfigStore;
|
|
@@ -24,6 +25,7 @@ export class SpaceHandler {
|
|
|
24
25
|
this.broadcastToProject = deps.broadcastToProject;
|
|
25
26
|
this.cogitPullService = deps.cogitPullService;
|
|
26
27
|
this.contextTreeMerger = deps.contextTreeMerger;
|
|
28
|
+
this.contextTreeService = deps.contextTreeService;
|
|
27
29
|
this.contextTreeSnapshotService = deps.contextTreeSnapshotService;
|
|
28
30
|
this.contextTreeWriterService = deps.contextTreeWriterService;
|
|
29
31
|
this.projectConfigStore = deps.projectConfigStore;
|
|
@@ -66,6 +68,7 @@ export class SpaceHandler {
|
|
|
66
68
|
}
|
|
67
69
|
async handleSwitch(data, clientId) {
|
|
68
70
|
const projectPath = resolveRequiredProjectPath(this.resolveProjectPath, clientId);
|
|
71
|
+
await guardAgainstGitVc({ contextTreeService: this.contextTreeService, projectPath });
|
|
69
72
|
const token = await this.tokenStore.load();
|
|
70
73
|
if (!token || !token.isValid()) {
|
|
71
74
|
throw new NotAuthenticatedError();
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { ITokenStore } from '../../../core/interfaces/auth/i-token-store.js';
|
|
2
2
|
import type { IContextTreeService } from '../../../core/interfaces/context-tree/i-context-tree-service.js';
|
|
3
3
|
import type { IContextTreeSnapshotService } from '../../../core/interfaces/context-tree/i-context-tree-snapshot-service.js';
|
|
4
|
+
import type { ICurateLogStore } from '../../../core/interfaces/storage/i-curate-log-store.js';
|
|
4
5
|
import type { IProjectConfigStore } from '../../../core/interfaces/storage/i-project-config-store.js';
|
|
5
6
|
import type { ITransportServer } from '../../../core/interfaces/transport/i-transport-server.js';
|
|
6
7
|
import { type ProjectPathResolver } from './handler-types.js';
|
|
8
|
+
/** Factory that creates a curate log store scoped to a project directory. */
|
|
9
|
+
export type CurateLogStoreFactory = (projectPath: string) => ICurateLogStore;
|
|
7
10
|
export interface StatusHandlerDeps {
|
|
8
11
|
contextTreeService: IContextTreeService;
|
|
9
12
|
contextTreeSnapshotService: IContextTreeSnapshotService;
|
|
13
|
+
curateLogStoreFactory: CurateLogStoreFactory;
|
|
10
14
|
projectConfigStore: IProjectConfigStore;
|
|
11
15
|
resolveProjectPath: ProjectPathResolver;
|
|
12
16
|
tokenStore: ITokenStore;
|
|
@@ -19,6 +23,7 @@ export interface StatusHandlerDeps {
|
|
|
19
23
|
export declare class StatusHandler {
|
|
20
24
|
private readonly contextTreeService;
|
|
21
25
|
private readonly contextTreeSnapshotService;
|
|
26
|
+
private readonly curateLogStoreFactory;
|
|
22
27
|
private readonly projectConfigStore;
|
|
23
28
|
private readonly resolveProjectPath;
|
|
24
29
|
private readonly tokenStore;
|
|
@@ -9,6 +9,7 @@ import { resolveRequiredProjectPath } from './handler-types.js';
|
|
|
9
9
|
export class StatusHandler {
|
|
10
10
|
contextTreeService;
|
|
11
11
|
contextTreeSnapshotService;
|
|
12
|
+
curateLogStoreFactory;
|
|
12
13
|
projectConfigStore;
|
|
13
14
|
resolveProjectPath;
|
|
14
15
|
tokenStore;
|
|
@@ -16,6 +17,7 @@ export class StatusHandler {
|
|
|
16
17
|
constructor(deps) {
|
|
17
18
|
this.contextTreeService = deps.contextTreeService;
|
|
18
19
|
this.contextTreeSnapshotService = deps.contextTreeSnapshotService;
|
|
20
|
+
this.curateLogStoreFactory = deps.curateLogStoreFactory;
|
|
19
21
|
this.projectConfigStore = deps.projectConfigStore;
|
|
20
22
|
this.resolveProjectPath = deps.resolveProjectPath;
|
|
21
23
|
this.tokenStore = deps.tokenStore;
|
|
@@ -67,24 +69,30 @@ export class StatusHandler {
|
|
|
67
69
|
try {
|
|
68
70
|
const contextTreeExists = await this.contextTreeService.exists(projectPath);
|
|
69
71
|
if (contextTreeExists) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (!hasSnapshot) {
|
|
74
|
-
await this.contextTreeSnapshotService.initEmptySnapshot(projectPath);
|
|
75
|
-
}
|
|
76
|
-
const changes = await this.contextTreeSnapshotService.getChanges(projectPath);
|
|
77
|
-
const hasChanges = changes.added.length > 0 || changes.modified.length > 0 || changes.deleted.length > 0;
|
|
78
|
-
if (hasChanges) {
|
|
79
|
-
result.contextTreeStatus = 'has_changes';
|
|
80
|
-
result.contextTreeChanges = {
|
|
81
|
-
added: changes.added,
|
|
82
|
-
deleted: changes.deleted,
|
|
83
|
-
modified: changes.modified,
|
|
84
|
-
};
|
|
72
|
+
const hasGitVc = await this.contextTreeService.hasGitRepo(projectPath);
|
|
73
|
+
if (hasGitVc) {
|
|
74
|
+
result.contextTreeStatus = 'git_vc';
|
|
85
75
|
}
|
|
86
76
|
else {
|
|
87
|
-
result.
|
|
77
|
+
result.contextTreeDir = join(projectPath, BRV_DIR, CONTEXT_TREE_DIR);
|
|
78
|
+
result.contextTreeRelativeDir = join(BRV_DIR, CONTEXT_TREE_DIR);
|
|
79
|
+
const hasSnapshot = await this.contextTreeSnapshotService.hasSnapshot(projectPath);
|
|
80
|
+
if (!hasSnapshot) {
|
|
81
|
+
await this.contextTreeSnapshotService.initEmptySnapshot(projectPath);
|
|
82
|
+
}
|
|
83
|
+
const changes = await this.contextTreeSnapshotService.getChanges(projectPath);
|
|
84
|
+
const hasChanges = changes.added.length > 0 || changes.modified.length > 0 || changes.deleted.length > 0;
|
|
85
|
+
if (hasChanges) {
|
|
86
|
+
result.contextTreeStatus = 'has_changes';
|
|
87
|
+
result.contextTreeChanges = {
|
|
88
|
+
added: changes.added,
|
|
89
|
+
deleted: changes.deleted,
|
|
90
|
+
modified: changes.modified,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
result.contextTreeStatus = 'no_changes';
|
|
95
|
+
}
|
|
88
96
|
}
|
|
89
97
|
}
|
|
90
98
|
else {
|
|
@@ -94,6 +102,33 @@ export class StatusHandler {
|
|
|
94
102
|
catch {
|
|
95
103
|
result.contextTreeStatus = 'unknown';
|
|
96
104
|
}
|
|
105
|
+
// Pending review count (best-effort)
|
|
106
|
+
try {
|
|
107
|
+
const store = this.curateLogStoreFactory(projectPath);
|
|
108
|
+
const entries = await store.list({ limit: 100, status: ['completed'] });
|
|
109
|
+
const pendingFiles = new Set();
|
|
110
|
+
const contextTreeRoot = join(projectPath, BRV_DIR, CONTEXT_TREE_DIR);
|
|
111
|
+
for (const entry of entries) {
|
|
112
|
+
for (const op of entry.operations) {
|
|
113
|
+
if (op.reviewStatus === 'pending' && op.filePath) {
|
|
114
|
+
const prefix = contextTreeRoot + '/';
|
|
115
|
+
const relativePath = op.filePath.startsWith(prefix) ? op.filePath.slice(prefix.length) : op.filePath;
|
|
116
|
+
pendingFiles.add(relativePath);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (pendingFiles.size > 0) {
|
|
121
|
+
result.pendingReviewCount = pendingFiles.size;
|
|
122
|
+
const port = this.transport.getPort();
|
|
123
|
+
if (port) {
|
|
124
|
+
const encoded = Buffer.from(projectPath).toString('base64url');
|
|
125
|
+
result.reviewUrl = `http://127.0.0.1:${port}/review?project=${encoded}`;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
// Best-effort — if the log is unavailable, skip review info
|
|
131
|
+
}
|
|
97
132
|
return result;
|
|
98
133
|
}
|
|
99
134
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { ITokenStore } from '../../../core/interfaces/auth/i-token-store.js';
|
|
2
|
+
import type { IContextTreeService } from '../../../core/interfaces/context-tree/i-context-tree-service.js';
|
|
3
|
+
import type { IGitService } from '../../../core/interfaces/services/i-git-service.js';
|
|
4
|
+
import type { ISpaceService } from '../../../core/interfaces/services/i-space-service.js';
|
|
5
|
+
import type { ITeamService } from '../../../core/interfaces/services/i-team-service.js';
|
|
6
|
+
import type { IProjectConfigStore } from '../../../core/interfaces/storage/i-project-config-store.js';
|
|
7
|
+
import type { ITransportServer } from '../../../core/interfaces/transport/i-transport-server.js';
|
|
8
|
+
import type { IVcGitConfigStore } from '../../../core/interfaces/vc/i-vc-git-config-store.js';
|
|
9
|
+
import { type ProjectBroadcaster, type ProjectPathResolver } from './handler-types.js';
|
|
10
|
+
export interface IVcHandlerDeps {
|
|
11
|
+
broadcastToProject: ProjectBroadcaster;
|
|
12
|
+
contextTreeService: IContextTreeService;
|
|
13
|
+
gitRemoteBaseUrl: string;
|
|
14
|
+
gitService: IGitService;
|
|
15
|
+
projectConfigStore: IProjectConfigStore;
|
|
16
|
+
resolveProjectPath: ProjectPathResolver;
|
|
17
|
+
spaceService: ISpaceService;
|
|
18
|
+
teamService: ITeamService;
|
|
19
|
+
tokenStore: ITokenStore;
|
|
20
|
+
transport: ITransportServer;
|
|
21
|
+
vcGitConfigStore: IVcGitConfigStore;
|
|
22
|
+
webAppUrl: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Handles vc:* events (Version Control commands).
|
|
26
|
+
*/
|
|
27
|
+
export declare class VcHandler {
|
|
28
|
+
private readonly broadcastToProject;
|
|
29
|
+
private readonly contextTreeService;
|
|
30
|
+
private readonly gitRemoteBaseUrl;
|
|
31
|
+
private readonly gitService;
|
|
32
|
+
private readonly projectConfigStore;
|
|
33
|
+
private readonly resolveProjectPath;
|
|
34
|
+
private readonly spaceService;
|
|
35
|
+
private readonly teamService;
|
|
36
|
+
private readonly tokenStore;
|
|
37
|
+
private readonly transport;
|
|
38
|
+
private readonly vcGitConfigStore;
|
|
39
|
+
private readonly webAppUrl;
|
|
40
|
+
constructor(deps: IVcHandlerDeps);
|
|
41
|
+
setup(): void;
|
|
42
|
+
private buildAuthorHint;
|
|
43
|
+
private buildNoRemoteMessage;
|
|
44
|
+
/**
|
|
45
|
+
* Writes a .gitignore to the context-tree directory only if one does not already exist.
|
|
46
|
+
*/
|
|
47
|
+
private ensureGitignore;
|
|
48
|
+
/**
|
|
49
|
+
* When force is NOT set, checks for uncommitted changes and throws
|
|
50
|
+
* VcError(UNCOMMITTED_CHANGES) if the working tree is dirty.
|
|
51
|
+
* When force IS set, skips the check entirely (changes will be discarded).
|
|
52
|
+
*/
|
|
53
|
+
private guardUncommittedChanges;
|
|
54
|
+
private handleAdd;
|
|
55
|
+
private handleBranch;
|
|
56
|
+
private handleBranchCreate;
|
|
57
|
+
private handleBranchDelete;
|
|
58
|
+
private handleBranchList;
|
|
59
|
+
private handleBranchSetUpstream;
|
|
60
|
+
private handleCheckout;
|
|
61
|
+
private handleClone;
|
|
62
|
+
private handleCommit;
|
|
63
|
+
private handleConfig;
|
|
64
|
+
private handleFetch;
|
|
65
|
+
private handleInit;
|
|
66
|
+
private handleLog;
|
|
67
|
+
private handleMerge;
|
|
68
|
+
private handlePull;
|
|
69
|
+
private handlePush;
|
|
70
|
+
private handleRemote;
|
|
71
|
+
private handleReset;
|
|
72
|
+
private handleStatus;
|
|
73
|
+
/**
|
|
74
|
+
* Resolve clone request data into a clean cogit URL + team/space info.
|
|
75
|
+
* Accepts either a URL or explicit teamName/spaceName.
|
|
76
|
+
* Auth is handled by IsomorphicGitService via headers, not URL credentials.
|
|
77
|
+
*/
|
|
78
|
+
private resolveCloneInput;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve a remote URL to a clean cogit URL + team/space info.
|
|
81
|
+
* Expected format: {domain}/{teamName}/{spaceName}.git
|
|
82
|
+
* Resolves names to IDs via API; rejects unknown formats.
|
|
83
|
+
*
|
|
84
|
+
* Auth is handled by IsomorphicGitService via headers, not URL credentials.
|
|
85
|
+
*/
|
|
86
|
+
private resolveFullCogitUrl;
|
|
87
|
+
private resolveLogResult;
|
|
88
|
+
/**
|
|
89
|
+
* Resolves pull target branch: explicit → tracking config → error.
|
|
90
|
+
* Mirrors native git: `git pull` without tracking config errors.
|
|
91
|
+
*/
|
|
92
|
+
private resolvePullBranch;
|
|
93
|
+
private resolveTargetBranch;
|
|
94
|
+
/**
|
|
95
|
+
* Resolve team/space names to IDs via API, build clean cogit URL.
|
|
96
|
+
*/
|
|
97
|
+
private resolveTeamSpaceNames;
|
|
98
|
+
private validateBranchName;
|
|
99
|
+
private validateRemoteUrlDomain;
|
|
100
|
+
}
|