byterover-cli 2.6.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.production +1 -0
- package/README.md +240 -14
- package/dist/agent/core/domain/knowledge/conflict-detector.d.ts +38 -0
- package/dist/agent/core/domain/knowledge/conflict-detector.js +71 -0
- package/dist/agent/core/domain/knowledge/conflict-resolver.d.ts +17 -0
- package/dist/agent/core/domain/knowledge/conflict-resolver.js +118 -0
- package/dist/agent/core/domain/knowledge/utils.d.ts +4 -0
- package/dist/agent/core/domain/knowledge/utils.js +6 -0
- package/dist/agent/core/interfaces/i-curate-service.d.ts +6 -0
- package/dist/agent/infra/tools/implementations/curate-tool.d.ts +67 -34
- package/dist/agent/infra/tools/implementations/curate-tool.js +294 -47
- package/dist/agent/resources/prompts/system-prompt.yml +15 -8
- package/dist/agent/resources/tools/code_exec.txt +3 -0
- package/dist/agent/resources/tools/curate.txt +12 -3
- package/dist/oclif/commands/connectors/install.d.ts +2 -1
- package/dist/oclif/commands/connectors/install.js +38 -3
- package/dist/oclif/commands/curate/index.d.ts +18 -0
- package/dist/oclif/commands/curate/index.js +78 -1
- package/dist/oclif/commands/init.d.ts +12 -0
- package/dist/oclif/commands/init.js +75 -0
- package/dist/oclif/commands/locations.js +1 -1
- package/dist/oclif/commands/providers/connect.d.ts +31 -1
- package/dist/oclif/commands/providers/connect.js +307 -27
- package/dist/oclif/commands/pull.d.ts +1 -0
- package/dist/oclif/commands/pull.js +7 -0
- package/dist/oclif/commands/push.d.ts +1 -0
- package/dist/oclif/commands/push.js +8 -0
- package/dist/oclif/commands/review/approve.d.ts +17 -0
- package/dist/oclif/commands/review/approve.js +37 -0
- package/dist/oclif/commands/review/base-review-decision.d.ts +18 -0
- package/dist/oclif/commands/review/base-review-decision.js +71 -0
- package/dist/oclif/commands/review/pending.d.ts +13 -0
- package/dist/oclif/commands/review/pending.js +94 -0
- package/dist/oclif/commands/review/reject.d.ts +17 -0
- package/dist/oclif/commands/review/reject.js +38 -0
- package/dist/oclif/commands/space/list.d.ts +2 -2
- package/dist/oclif/commands/space/list.js +13 -35
- package/dist/oclif/commands/space/switch.d.ts +2 -7
- package/dist/oclif/commands/space/switch.js +13 -56
- package/dist/oclif/commands/status.d.ts +1 -0
- package/dist/oclif/commands/status.js +11 -1
- package/dist/oclif/commands/vc/add.d.ts +7 -0
- package/dist/oclif/commands/vc/add.js +29 -0
- package/dist/oclif/commands/vc/branch.d.ts +15 -0
- package/dist/oclif/commands/vc/branch.js +70 -0
- package/dist/oclif/commands/vc/checkout.d.ts +14 -0
- package/dist/oclif/commands/vc/checkout.js +47 -0
- package/dist/oclif/commands/vc/clone.d.ts +9 -0
- package/dist/oclif/commands/vc/clone.js +61 -0
- package/dist/oclif/commands/vc/commit.d.ts +10 -0
- package/dist/oclif/commands/vc/commit.js +32 -0
- package/dist/oclif/commands/vc/config.d.ts +10 -0
- package/dist/oclif/commands/vc/config.js +30 -0
- package/dist/oclif/commands/vc/fetch.d.ts +10 -0
- package/dist/oclif/commands/vc/fetch.js +42 -0
- package/dist/oclif/commands/vc/index.d.ts +6 -0
- package/dist/oclif/commands/vc/index.js +8 -0
- package/dist/oclif/commands/vc/init.d.ts +6 -0
- package/dist/oclif/commands/vc/init.js +25 -0
- package/dist/oclif/commands/vc/log.d.ts +13 -0
- package/dist/oclif/commands/vc/log.js +48 -0
- package/dist/oclif/commands/vc/merge.d.ts +19 -0
- package/dist/oclif/commands/vc/merge.js +130 -0
- package/dist/oclif/commands/vc/pull.d.ts +13 -0
- package/dist/oclif/commands/vc/pull.js +60 -0
- package/dist/oclif/commands/vc/push.d.ts +13 -0
- package/dist/oclif/commands/vc/push.js +60 -0
- package/dist/oclif/commands/vc/remote/add.d.ts +10 -0
- package/dist/oclif/commands/vc/remote/add.js +30 -0
- package/dist/oclif/commands/vc/remote/index.d.ts +6 -0
- package/dist/oclif/commands/vc/remote/index.js +16 -0
- package/dist/oclif/commands/vc/remote/set-url.d.ts +10 -0
- package/dist/oclif/commands/vc/remote/set-url.js +30 -0
- package/dist/oclif/commands/vc/reset.d.ts +13 -0
- package/dist/oclif/commands/vc/reset.js +62 -0
- package/dist/oclif/commands/vc/status.d.ts +8 -0
- package/dist/oclif/commands/vc/status.js +106 -0
- package/dist/oclif/hooks/init/validate-brv-config.d.ts +26 -0
- package/dist/oclif/hooks/init/validate-brv-config.js +62 -0
- package/dist/oclif/lib/daemon-client.d.ts +2 -0
- package/dist/oclif/lib/daemon-client.js +36 -10
- package/dist/oclif/lib/prompt-utils.d.ts +43 -0
- package/dist/oclif/lib/prompt-utils.js +84 -0
- package/dist/oclif/lib/spinner.d.ts +8 -0
- package/dist/oclif/lib/spinner.js +23 -0
- package/dist/oclif/lib/task-client.d.ts +5 -0
- package/dist/oclif/lib/task-client.js +15 -2
- package/dist/server/config/environment.d.ts +2 -0
- package/dist/server/config/environment.js +2 -0
- package/dist/server/constants.d.ts +3 -0
- package/dist/server/constants.js +9 -0
- package/dist/server/core/domain/entities/auth-token.d.ts +2 -0
- package/dist/server/core/domain/entities/auth-token.js +7 -1
- package/dist/server/core/domain/entities/curate-log-entry.d.ts +11 -0
- package/dist/server/core/domain/entities/space.d.ts +4 -0
- package/dist/server/core/domain/entities/space.js +8 -0
- package/dist/server/core/domain/entities/team.d.ts +2 -0
- package/dist/server/core/domain/entities/team.js +4 -0
- package/dist/server/core/domain/errors/git-error.d.ts +6 -0
- package/dist/server/core/domain/errors/git-error.js +12 -0
- package/dist/server/core/domain/errors/task-error.d.ts +4 -0
- package/dist/server/core/domain/errors/task-error.js +8 -0
- package/dist/server/core/domain/errors/vc-error.d.ts +5 -0
- package/dist/server/core/domain/errors/vc-error.js +8 -0
- package/dist/server/core/domain/knowledge/markdown-writer.d.ts +4 -1
- package/dist/server/core/domain/knowledge/markdown-writer.js +37 -7
- package/dist/server/core/domain/transport/schemas.d.ts +6 -6
- package/dist/server/core/interfaces/context-tree/i-context-tree-service.d.ts +11 -0
- package/dist/server/core/interfaces/process/i-task-lifecycle-hook.d.ts +6 -0
- package/dist/server/core/interfaces/services/i-git-service.d.ts +234 -0
- package/dist/server/core/interfaces/services/i-git-service.js +1 -0
- package/dist/server/core/interfaces/storage/i-curate-log-store.d.ts +5 -0
- package/dist/server/core/interfaces/storage/i-review-backup-store.d.ts +19 -0
- package/dist/server/core/interfaces/storage/i-review-backup-store.js +1 -0
- package/dist/server/core/interfaces/vc/i-vc-git-config-store.d.ts +8 -0
- package/dist/server/core/interfaces/vc/i-vc-git-config-store.js +1 -0
- package/dist/server/infra/config/auto-init.d.ts +0 -2
- package/dist/server/infra/config/auto-init.js +0 -1
- package/dist/server/infra/context-tree/file-context-tree-service.d.ts +2 -0
- package/dist/server/infra/context-tree/file-context-tree-service.js +13 -0
- package/dist/server/infra/daemon/brv-server.js +23 -3
- package/dist/server/infra/git/cogit-url.d.ts +17 -0
- package/dist/server/infra/git/cogit-url.js +39 -0
- package/dist/server/infra/git/git-http-wrapper.d.ts +20 -0
- package/dist/server/infra/git/git-http-wrapper.js +334 -0
- package/dist/server/infra/git/isomorphic-git-service.d.ts +78 -0
- package/dist/server/infra/git/isomorphic-git-service.js +983 -0
- package/dist/server/infra/http/review-api-handler.d.ts +13 -0
- package/dist/server/infra/http/review-api-handler.js +286 -0
- package/dist/server/infra/http/review-ui.d.ts +7 -0
- package/dist/server/infra/http/review-ui.js +606 -0
- package/dist/server/infra/mcp/tools/brv-curate-tool.d.ts +2 -2
- package/dist/server/infra/process/curate-log-handler.d.ts +18 -2
- package/dist/server/infra/process/curate-log-handler.js +50 -13
- package/dist/server/infra/process/feature-handlers.js +41 -1
- package/dist/server/infra/process/task-router.js +16 -0
- package/dist/server/infra/space/http-space-service.js +2 -0
- package/dist/server/infra/storage/file-curate-log-store.d.ts +10 -0
- package/dist/server/infra/storage/file-curate-log-store.js +35 -0
- package/dist/server/infra/storage/file-review-backup-store.d.ts +29 -0
- package/dist/server/infra/storage/file-review-backup-store.js +121 -0
- package/dist/server/infra/transport/handlers/auth-handler.js +9 -5
- package/dist/server/infra/transport/handlers/handler-types.d.ts +9 -0
- package/dist/server/infra/transport/handlers/handler-types.js +11 -0
- package/dist/server/infra/transport/handlers/index.d.ts +4 -0
- package/dist/server/infra/transport/handlers/index.js +2 -0
- package/dist/server/infra/transport/handlers/init-handler.d.ts +1 -0
- package/dist/server/infra/transport/handlers/init-handler.js +13 -1
- package/dist/server/infra/transport/handlers/pull-handler.d.ts +3 -0
- package/dist/server/infra/transport/handlers/pull-handler.js +5 -1
- package/dist/server/infra/transport/handlers/push-handler.d.ts +20 -0
- package/dist/server/infra/transport/handlers/push-handler.js +116 -14
- package/dist/server/infra/transport/handlers/reset-handler.d.ts +11 -0
- package/dist/server/infra/transport/handlers/reset-handler.js +37 -1
- package/dist/server/infra/transport/handlers/review-handler.d.ts +35 -0
- package/dist/server/infra/transport/handlers/review-handler.js +162 -0
- package/dist/server/infra/transport/handlers/space-handler.d.ts +3 -0
- package/dist/server/infra/transport/handlers/space-handler.js +4 -1
- package/dist/server/infra/transport/handlers/status-handler.d.ts +5 -0
- package/dist/server/infra/transport/handlers/status-handler.js +51 -16
- package/dist/server/infra/transport/handlers/vc-handler.d.ts +100 -0
- package/dist/server/infra/transport/handlers/vc-handler.js +1050 -0
- package/dist/server/infra/transport/socket-io-transport-server.d.ts +7 -0
- package/dist/server/infra/transport/socket-io-transport-server.js +12 -1
- package/dist/server/infra/transport/transport-connector.d.ts +1 -1
- package/dist/server/infra/transport/transport-connector.js +2 -1
- package/dist/server/infra/vc/file-vc-git-config-store.d.ts +11 -0
- package/dist/server/infra/vc/file-vc-git-config-store.js +43 -0
- package/dist/server/templates/skill/SKILL.md +167 -33
- package/dist/server/utils/curate-result-parser.d.ts +64 -0
- package/dist/server/utils/curate-result-parser.js +8 -0
- package/dist/server/utils/gitignore.d.ts +9 -0
- package/dist/server/utils/gitignore.js +47 -0
- package/dist/shared/transport/events/index.d.ts +6 -0
- package/dist/shared/transport/events/index.js +3 -0
- package/dist/shared/transport/events/init-events.d.ts +8 -0
- package/dist/shared/transport/events/init-events.js +1 -0
- package/dist/shared/transport/events/push-events.d.ts +6 -0
- package/dist/shared/transport/events/review-events.d.ts +41 -0
- package/dist/shared/transport/events/review-events.js +5 -0
- package/dist/shared/transport/events/vc-events.d.ts +257 -0
- package/dist/shared/transport/events/vc-events.js +67 -0
- package/dist/shared/transport/types/dto.d.ts +6 -1
- package/dist/tui/app/pages/init-project-page.d.ts +9 -0
- package/dist/tui/app/pages/init-project-page.js +54 -0
- package/dist/tui/app/pages/protected-routes.js +14 -6
- package/dist/tui/components/index.d.ts +0 -2
- package/dist/tui/components/index.js +0 -1
- package/dist/tui/features/activity/hooks/use-activity-logs.js +7 -1
- package/dist/tui/features/commands/definitions/index.js +3 -0
- package/dist/tui/features/commands/definitions/space-list.js +9 -18
- package/dist/tui/features/commands/definitions/space-switch.js +10 -6
- package/dist/tui/features/commands/definitions/vc-add.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-add.js +15 -0
- package/dist/tui/features/commands/definitions/vc-branch.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-branch.js +33 -0
- package/dist/tui/features/commands/definitions/vc-checkout.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-checkout.js +32 -0
- package/dist/tui/features/commands/definitions/vc-clone.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-clone.js +18 -0
- package/dist/tui/features/commands/definitions/vc-commit.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-commit.js +32 -0
- package/dist/tui/features/commands/definitions/vc-config.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-config.js +40 -0
- package/dist/tui/features/commands/definitions/vc-fetch.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-fetch.js +37 -0
- package/dist/tui/features/commands/definitions/vc-init.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-init.js +11 -0
- package/dist/tui/features/commands/definitions/vc-log.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-log.js +25 -0
- package/dist/tui/features/commands/definitions/vc-merge.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-merge.js +48 -0
- package/dist/tui/features/commands/definitions/vc-pull.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-pull.js +42 -0
- package/dist/tui/features/commands/definitions/vc-push.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-push.js +38 -0
- package/dist/tui/features/commands/definitions/vc-remote.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-remote.js +57 -0
- package/dist/tui/features/commands/definitions/vc-reset.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-reset.js +35 -0
- package/dist/tui/features/commands/definitions/vc-status.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-status.js +11 -0
- package/dist/tui/features/commands/definitions/vc.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc.js +36 -0
- package/dist/tui/features/commands/hooks/use-slash-command-processor.js +5 -5
- package/dist/tui/features/log/api/execute-log.d.ts +8 -0
- package/dist/tui/features/log/api/execute-log.js +13 -0
- package/dist/tui/features/log/components/log-flow.d.ts +14 -0
- package/dist/tui/features/log/components/log-flow.js +29 -0
- package/dist/tui/features/log/utils/format-log.d.ts +3 -0
- package/dist/tui/features/log/utils/format-log.js +42 -0
- package/dist/tui/features/onboarding/hooks/use-app-view-mode.d.ts +9 -5
- package/dist/tui/features/onboarding/hooks/use-app-view-mode.js +12 -5
- package/dist/tui/features/push/components/push-flow.js +9 -2
- package/dist/tui/features/reset/components/reset-flow.js +2 -1
- package/dist/tui/features/status/components/status-view.js +2 -1
- package/dist/tui/features/status/utils/format-status.js +9 -0
- package/dist/tui/features/tasks/hooks/use-task-subscriptions.js +11 -0
- package/dist/tui/features/tasks/stores/tasks-store.d.ts +10 -0
- package/dist/tui/features/tasks/stores/tasks-store.js +16 -0
- package/dist/tui/features/vc/add/api/execute-vc-add.d.ts +8 -0
- package/dist/tui/features/vc/add/api/execute-vc-add.js +13 -0
- package/dist/tui/features/vc/add/components/vc-add-flow.d.ts +7 -0
- package/dist/tui/features/vc/add/components/vc-add-flow.js +35 -0
- package/dist/tui/features/vc/branch/api/execute-vc-branch.d.ts +8 -0
- package/dist/tui/features/vc/branch/api/execute-vc-branch.js +13 -0
- package/dist/tui/features/vc/branch/components/vc-branch-flow.d.ts +8 -0
- package/dist/tui/features/vc/branch/components/vc-branch-flow.js +53 -0
- package/dist/tui/features/vc/branch/utils/format-branch.d.ts +4 -0
- package/dist/tui/features/vc/branch/utils/format-branch.js +12 -0
- package/dist/tui/features/vc/checkout/api/execute-vc-checkout.d.ts +8 -0
- package/dist/tui/features/vc/checkout/api/execute-vc-checkout.js +13 -0
- package/dist/tui/features/vc/checkout/components/vc-checkout-flow.d.ts +8 -0
- package/dist/tui/features/vc/checkout/components/vc-checkout-flow.js +33 -0
- package/dist/tui/features/vc/clone/api/execute-vc-clone.d.ts +8 -0
- package/dist/tui/features/vc/clone/api/execute-vc-clone.js +13 -0
- package/dist/tui/features/vc/clone/components/vc-clone-flow.d.ts +7 -0
- package/dist/tui/features/vc/clone/components/vc-clone-flow.js +79 -0
- package/dist/tui/features/vc/commit/api/execute-vc-commit.d.ts +8 -0
- package/dist/tui/features/vc/commit/api/execute-vc-commit.js +13 -0
- package/dist/tui/features/vc/commit/components/vc-commit-flow.d.ts +7 -0
- package/dist/tui/features/vc/commit/components/vc-commit-flow.js +29 -0
- package/dist/tui/features/vc/config/api/execute-vc-config.d.ts +8 -0
- package/dist/tui/features/vc/config/api/execute-vc-config.js +13 -0
- package/dist/tui/features/vc/config/components/vc-config-flow.d.ts +9 -0
- package/dist/tui/features/vc/config/components/vc-config-flow.js +30 -0
- package/dist/tui/features/vc/fetch/api/execute-vc-fetch.d.ts +8 -0
- package/dist/tui/features/vc/fetch/api/execute-vc-fetch.js +13 -0
- package/dist/tui/features/vc/fetch/components/vc-fetch-flow.d.ts +8 -0
- package/dist/tui/features/vc/fetch/components/vc-fetch-flow.js +75 -0
- package/dist/tui/features/vc/init/api/execute-vc-init.d.ts +8 -0
- package/dist/tui/features/vc/init/api/execute-vc-init.js +13 -0
- package/dist/tui/features/vc/init/components/vc-init-flow.d.ts +10 -0
- package/dist/tui/features/vc/init/components/vc-init-flow.js +37 -0
- package/dist/tui/features/vc/merge/api/execute-vc-merge.d.ts +8 -0
- package/dist/tui/features/vc/merge/api/execute-vc-merge.js +13 -0
- package/dist/tui/features/vc/merge/components/vc-merge-flow.d.ts +11 -0
- package/dist/tui/features/vc/merge/components/vc-merge-flow.js +72 -0
- package/dist/tui/features/vc/pull/api/execute-vc-pull.d.ts +8 -0
- package/dist/tui/features/vc/pull/api/execute-vc-pull.js +13 -0
- package/dist/tui/features/vc/pull/components/vc-pull-flow.d.ts +9 -0
- package/dist/tui/features/vc/pull/components/vc-pull-flow.js +83 -0
- package/dist/tui/features/vc/push/api/execute-vc-push.d.ts +8 -0
- package/dist/tui/features/vc/push/api/execute-vc-push.js +13 -0
- package/dist/tui/features/vc/push/components/vc-push-flow.d.ts +8 -0
- package/dist/tui/features/vc/push/components/vc-push-flow.js +83 -0
- package/dist/tui/features/vc/remote/api/execute-vc-remote.d.ts +8 -0
- package/dist/tui/features/vc/remote/api/execute-vc-remote.js +13 -0
- package/dist/tui/features/vc/remote/components/vc-remote-flow.d.ts +9 -0
- package/dist/tui/features/vc/remote/components/vc-remote-flow.js +42 -0
- package/dist/tui/features/vc/reset/api/execute-vc-reset.d.ts +8 -0
- package/dist/tui/features/vc/reset/api/execute-vc-reset.js +13 -0
- package/dist/tui/features/vc/reset/components/vc-reset-flow.d.ts +10 -0
- package/dist/tui/features/vc/reset/components/vc-reset-flow.js +63 -0
- package/dist/tui/features/vc/status/api/execute-vc-status.d.ts +8 -0
- package/dist/tui/features/vc/status/api/execute-vc-status.js +13 -0
- package/dist/tui/features/vc/status/components/vc-status-flow.d.ts +10 -0
- package/dist/tui/features/vc/status/components/vc-status-flow.js +133 -0
- package/dist/tui/lib/environment.d.ts +8 -0
- package/dist/tui/lib/environment.js +8 -0
- package/dist/tui/utils/error-messages.d.ts +5 -1
- package/dist/tui/utils/error-messages.js +32 -3
- package/oclif.manifest.json +1018 -98
- package/package.json +9 -3
- package/dist/oclif/hooks/prerun/validate-brv-config-version.d.ts +0 -33
- package/dist/oclif/hooks/prerun/validate-brv-config-version.js +0 -86
- package/dist/tui/components/init.d.ts +0 -33
- package/dist/tui/components/init.js +0 -234
- package/dist/tui/features/space/api/get-spaces.d.ts +0 -16
- package/dist/tui/features/space/api/get-spaces.js +0 -17
- package/dist/tui/features/space/api/switch-space.d.ts +0 -11
- package/dist/tui/features/space/api/switch-space.js +0 -24
- package/dist/tui/features/space/components/space-list-view.d.ts +0 -12
- package/dist/tui/features/space/components/space-list-view.js +0 -56
- package/dist/tui/features/space/components/space-switch-flow.d.ts +0 -13
- package/dist/tui/features/space/components/space-switch-flow.js +0 -97
|
@@ -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
|
+
}
|