byterover-cli 2.6.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.production +1 -0
- package/README.md +240 -14
- package/dist/agent/core/domain/knowledge/conflict-detector.d.ts +38 -0
- package/dist/agent/core/domain/knowledge/conflict-detector.js +71 -0
- package/dist/agent/core/domain/knowledge/conflict-resolver.d.ts +17 -0
- package/dist/agent/core/domain/knowledge/conflict-resolver.js +118 -0
- package/dist/agent/core/domain/knowledge/utils.d.ts +4 -0
- package/dist/agent/core/domain/knowledge/utils.js +6 -0
- package/dist/agent/core/interfaces/i-curate-service.d.ts +6 -0
- package/dist/agent/infra/tools/implementations/curate-tool.d.ts +67 -34
- package/dist/agent/infra/tools/implementations/curate-tool.js +294 -47
- package/dist/agent/resources/prompts/system-prompt.yml +15 -8
- package/dist/agent/resources/tools/code_exec.txt +3 -0
- package/dist/agent/resources/tools/curate.txt +12 -3
- package/dist/oclif/commands/connectors/install.d.ts +2 -1
- package/dist/oclif/commands/connectors/install.js +38 -3
- package/dist/oclif/commands/curate/index.d.ts +18 -0
- package/dist/oclif/commands/curate/index.js +78 -1
- package/dist/oclif/commands/init.d.ts +12 -0
- package/dist/oclif/commands/init.js +75 -0
- package/dist/oclif/commands/locations.js +1 -1
- package/dist/oclif/commands/providers/connect.d.ts +31 -1
- package/dist/oclif/commands/providers/connect.js +307 -27
- package/dist/oclif/commands/pull.d.ts +1 -0
- package/dist/oclif/commands/pull.js +7 -0
- package/dist/oclif/commands/push.d.ts +1 -0
- package/dist/oclif/commands/push.js +8 -0
- package/dist/oclif/commands/review/approve.d.ts +17 -0
- package/dist/oclif/commands/review/approve.js +37 -0
- package/dist/oclif/commands/review/base-review-decision.d.ts +18 -0
- package/dist/oclif/commands/review/base-review-decision.js +71 -0
- package/dist/oclif/commands/review/pending.d.ts +13 -0
- package/dist/oclif/commands/review/pending.js +94 -0
- package/dist/oclif/commands/review/reject.d.ts +17 -0
- package/dist/oclif/commands/review/reject.js +38 -0
- package/dist/oclif/commands/space/list.d.ts +2 -2
- package/dist/oclif/commands/space/list.js +13 -35
- package/dist/oclif/commands/space/switch.d.ts +2 -7
- package/dist/oclif/commands/space/switch.js +13 -56
- package/dist/oclif/commands/status.d.ts +1 -0
- package/dist/oclif/commands/status.js +11 -1
- package/dist/oclif/commands/vc/add.d.ts +7 -0
- package/dist/oclif/commands/vc/add.js +29 -0
- package/dist/oclif/commands/vc/branch.d.ts +15 -0
- package/dist/oclif/commands/vc/branch.js +70 -0
- package/dist/oclif/commands/vc/checkout.d.ts +14 -0
- package/dist/oclif/commands/vc/checkout.js +47 -0
- package/dist/oclif/commands/vc/clone.d.ts +9 -0
- package/dist/oclif/commands/vc/clone.js +61 -0
- package/dist/oclif/commands/vc/commit.d.ts +10 -0
- package/dist/oclif/commands/vc/commit.js +32 -0
- package/dist/oclif/commands/vc/config.d.ts +10 -0
- package/dist/oclif/commands/vc/config.js +30 -0
- package/dist/oclif/commands/vc/fetch.d.ts +10 -0
- package/dist/oclif/commands/vc/fetch.js +42 -0
- package/dist/oclif/commands/vc/index.d.ts +6 -0
- package/dist/oclif/commands/vc/index.js +8 -0
- package/dist/oclif/commands/vc/init.d.ts +6 -0
- package/dist/oclif/commands/vc/init.js +25 -0
- package/dist/oclif/commands/vc/log.d.ts +13 -0
- package/dist/oclif/commands/vc/log.js +48 -0
- package/dist/oclif/commands/vc/merge.d.ts +19 -0
- package/dist/oclif/commands/vc/merge.js +130 -0
- package/dist/oclif/commands/vc/pull.d.ts +13 -0
- package/dist/oclif/commands/vc/pull.js +60 -0
- package/dist/oclif/commands/vc/push.d.ts +13 -0
- package/dist/oclif/commands/vc/push.js +60 -0
- package/dist/oclif/commands/vc/remote/add.d.ts +10 -0
- package/dist/oclif/commands/vc/remote/add.js +30 -0
- package/dist/oclif/commands/vc/remote/index.d.ts +6 -0
- package/dist/oclif/commands/vc/remote/index.js +16 -0
- package/dist/oclif/commands/vc/remote/set-url.d.ts +10 -0
- package/dist/oclif/commands/vc/remote/set-url.js +30 -0
- package/dist/oclif/commands/vc/reset.d.ts +13 -0
- package/dist/oclif/commands/vc/reset.js +62 -0
- package/dist/oclif/commands/vc/status.d.ts +8 -0
- package/dist/oclif/commands/vc/status.js +106 -0
- package/dist/oclif/hooks/init/validate-brv-config.d.ts +26 -0
- package/dist/oclif/hooks/init/validate-brv-config.js +62 -0
- package/dist/oclif/lib/daemon-client.d.ts +2 -0
- package/dist/oclif/lib/daemon-client.js +36 -10
- package/dist/oclif/lib/prompt-utils.d.ts +43 -0
- package/dist/oclif/lib/prompt-utils.js +84 -0
- package/dist/oclif/lib/spinner.d.ts +8 -0
- package/dist/oclif/lib/spinner.js +23 -0
- package/dist/oclif/lib/task-client.d.ts +5 -0
- package/dist/oclif/lib/task-client.js +15 -2
- package/dist/server/config/environment.d.ts +2 -0
- package/dist/server/config/environment.js +2 -0
- package/dist/server/constants.d.ts +3 -0
- package/dist/server/constants.js +9 -0
- package/dist/server/core/domain/entities/auth-token.d.ts +2 -0
- package/dist/server/core/domain/entities/auth-token.js +7 -1
- package/dist/server/core/domain/entities/curate-log-entry.d.ts +11 -0
- package/dist/server/core/domain/entities/space.d.ts +4 -0
- package/dist/server/core/domain/entities/space.js +8 -0
- package/dist/server/core/domain/entities/team.d.ts +2 -0
- package/dist/server/core/domain/entities/team.js +4 -0
- package/dist/server/core/domain/errors/git-error.d.ts +6 -0
- package/dist/server/core/domain/errors/git-error.js +12 -0
- package/dist/server/core/domain/errors/task-error.d.ts +4 -0
- package/dist/server/core/domain/errors/task-error.js +8 -0
- package/dist/server/core/domain/errors/vc-error.d.ts +5 -0
- package/dist/server/core/domain/errors/vc-error.js +8 -0
- package/dist/server/core/domain/knowledge/markdown-writer.d.ts +4 -1
- package/dist/server/core/domain/knowledge/markdown-writer.js +37 -7
- package/dist/server/core/domain/transport/schemas.d.ts +6 -6
- package/dist/server/core/interfaces/context-tree/i-context-tree-service.d.ts +11 -0
- package/dist/server/core/interfaces/process/i-task-lifecycle-hook.d.ts +6 -0
- package/dist/server/core/interfaces/services/i-git-service.d.ts +234 -0
- package/dist/server/core/interfaces/services/i-git-service.js +1 -0
- package/dist/server/core/interfaces/storage/i-curate-log-store.d.ts +5 -0
- package/dist/server/core/interfaces/storage/i-review-backup-store.d.ts +19 -0
- package/dist/server/core/interfaces/storage/i-review-backup-store.js +1 -0
- package/dist/server/core/interfaces/vc/i-vc-git-config-store.d.ts +8 -0
- package/dist/server/core/interfaces/vc/i-vc-git-config-store.js +1 -0
- package/dist/server/infra/config/auto-init.d.ts +0 -2
- package/dist/server/infra/config/auto-init.js +0 -1
- package/dist/server/infra/context-tree/file-context-tree-service.d.ts +2 -0
- package/dist/server/infra/context-tree/file-context-tree-service.js +13 -0
- package/dist/server/infra/daemon/brv-server.js +23 -3
- package/dist/server/infra/git/cogit-url.d.ts +17 -0
- package/dist/server/infra/git/cogit-url.js +39 -0
- package/dist/server/infra/git/git-http-wrapper.d.ts +20 -0
- package/dist/server/infra/git/git-http-wrapper.js +334 -0
- package/dist/server/infra/git/isomorphic-git-service.d.ts +78 -0
- package/dist/server/infra/git/isomorphic-git-service.js +983 -0
- package/dist/server/infra/http/review-api-handler.d.ts +13 -0
- package/dist/server/infra/http/review-api-handler.js +286 -0
- package/dist/server/infra/http/review-ui.d.ts +7 -0
- package/dist/server/infra/http/review-ui.js +606 -0
- package/dist/server/infra/mcp/tools/brv-curate-tool.d.ts +2 -2
- package/dist/server/infra/process/curate-log-handler.d.ts +18 -2
- package/dist/server/infra/process/curate-log-handler.js +50 -13
- package/dist/server/infra/process/feature-handlers.js +41 -1
- package/dist/server/infra/process/task-router.js +16 -0
- package/dist/server/infra/space/http-space-service.js +2 -0
- package/dist/server/infra/storage/file-curate-log-store.d.ts +10 -0
- package/dist/server/infra/storage/file-curate-log-store.js +35 -0
- package/dist/server/infra/storage/file-review-backup-store.d.ts +29 -0
- package/dist/server/infra/storage/file-review-backup-store.js +121 -0
- package/dist/server/infra/transport/handlers/auth-handler.js +9 -5
- package/dist/server/infra/transport/handlers/handler-types.d.ts +9 -0
- package/dist/server/infra/transport/handlers/handler-types.js +11 -0
- package/dist/server/infra/transport/handlers/index.d.ts +4 -0
- package/dist/server/infra/transport/handlers/index.js +2 -0
- package/dist/server/infra/transport/handlers/init-handler.d.ts +1 -0
- package/dist/server/infra/transport/handlers/init-handler.js +13 -1
- package/dist/server/infra/transport/handlers/pull-handler.d.ts +3 -0
- package/dist/server/infra/transport/handlers/pull-handler.js +5 -1
- package/dist/server/infra/transport/handlers/push-handler.d.ts +20 -0
- package/dist/server/infra/transport/handlers/push-handler.js +116 -14
- package/dist/server/infra/transport/handlers/reset-handler.d.ts +11 -0
- package/dist/server/infra/transport/handlers/reset-handler.js +37 -1
- package/dist/server/infra/transport/handlers/review-handler.d.ts +35 -0
- package/dist/server/infra/transport/handlers/review-handler.js +162 -0
- package/dist/server/infra/transport/handlers/space-handler.d.ts +3 -0
- package/dist/server/infra/transport/handlers/space-handler.js +4 -1
- package/dist/server/infra/transport/handlers/status-handler.d.ts +5 -0
- package/dist/server/infra/transport/handlers/status-handler.js +51 -16
- package/dist/server/infra/transport/handlers/vc-handler.d.ts +100 -0
- package/dist/server/infra/transport/handlers/vc-handler.js +1050 -0
- package/dist/server/infra/transport/socket-io-transport-server.d.ts +7 -0
- package/dist/server/infra/transport/socket-io-transport-server.js +12 -1
- package/dist/server/infra/transport/transport-connector.d.ts +1 -1
- package/dist/server/infra/transport/transport-connector.js +2 -1
- package/dist/server/infra/vc/file-vc-git-config-store.d.ts +11 -0
- package/dist/server/infra/vc/file-vc-git-config-store.js +43 -0
- package/dist/server/templates/skill/SKILL.md +167 -33
- package/dist/server/utils/curate-result-parser.d.ts +64 -0
- package/dist/server/utils/curate-result-parser.js +8 -0
- package/dist/server/utils/gitignore.d.ts +9 -0
- package/dist/server/utils/gitignore.js +47 -0
- package/dist/shared/transport/events/index.d.ts +6 -0
- package/dist/shared/transport/events/index.js +3 -0
- package/dist/shared/transport/events/init-events.d.ts +8 -0
- package/dist/shared/transport/events/init-events.js +1 -0
- package/dist/shared/transport/events/push-events.d.ts +6 -0
- package/dist/shared/transport/events/review-events.d.ts +41 -0
- package/dist/shared/transport/events/review-events.js +5 -0
- package/dist/shared/transport/events/vc-events.d.ts +257 -0
- package/dist/shared/transport/events/vc-events.js +67 -0
- package/dist/shared/transport/types/dto.d.ts +6 -1
- package/dist/tui/app/pages/init-project-page.d.ts +9 -0
- package/dist/tui/app/pages/init-project-page.js +54 -0
- package/dist/tui/app/pages/protected-routes.js +14 -6
- package/dist/tui/components/index.d.ts +0 -2
- package/dist/tui/components/index.js +0 -1
- package/dist/tui/features/activity/hooks/use-activity-logs.js +7 -1
- package/dist/tui/features/commands/definitions/index.js +3 -0
- package/dist/tui/features/commands/definitions/space-list.js +9 -18
- package/dist/tui/features/commands/definitions/space-switch.js +10 -6
- package/dist/tui/features/commands/definitions/vc-add.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-add.js +15 -0
- package/dist/tui/features/commands/definitions/vc-branch.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-branch.js +33 -0
- package/dist/tui/features/commands/definitions/vc-checkout.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-checkout.js +32 -0
- package/dist/tui/features/commands/definitions/vc-clone.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-clone.js +18 -0
- package/dist/tui/features/commands/definitions/vc-commit.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-commit.js +32 -0
- package/dist/tui/features/commands/definitions/vc-config.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-config.js +40 -0
- package/dist/tui/features/commands/definitions/vc-fetch.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-fetch.js +37 -0
- package/dist/tui/features/commands/definitions/vc-init.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-init.js +11 -0
- package/dist/tui/features/commands/definitions/vc-log.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-log.js +25 -0
- package/dist/tui/features/commands/definitions/vc-merge.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-merge.js +48 -0
- package/dist/tui/features/commands/definitions/vc-pull.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-pull.js +42 -0
- package/dist/tui/features/commands/definitions/vc-push.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-push.js +38 -0
- package/dist/tui/features/commands/definitions/vc-remote.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-remote.js +57 -0
- package/dist/tui/features/commands/definitions/vc-reset.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-reset.js +35 -0
- package/dist/tui/features/commands/definitions/vc-status.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc-status.js +11 -0
- package/dist/tui/features/commands/definitions/vc.d.ts +2 -0
- package/dist/tui/features/commands/definitions/vc.js +36 -0
- package/dist/tui/features/commands/hooks/use-slash-command-processor.js +5 -5
- package/dist/tui/features/log/api/execute-log.d.ts +8 -0
- package/dist/tui/features/log/api/execute-log.js +13 -0
- package/dist/tui/features/log/components/log-flow.d.ts +14 -0
- package/dist/tui/features/log/components/log-flow.js +29 -0
- package/dist/tui/features/log/utils/format-log.d.ts +3 -0
- package/dist/tui/features/log/utils/format-log.js +42 -0
- package/dist/tui/features/onboarding/hooks/use-app-view-mode.d.ts +9 -5
- package/dist/tui/features/onboarding/hooks/use-app-view-mode.js +12 -5
- package/dist/tui/features/push/components/push-flow.js +9 -2
- package/dist/tui/features/reset/components/reset-flow.js +2 -1
- package/dist/tui/features/status/components/status-view.js +2 -1
- package/dist/tui/features/status/utils/format-status.js +9 -0
- package/dist/tui/features/tasks/hooks/use-task-subscriptions.js +11 -0
- package/dist/tui/features/tasks/stores/tasks-store.d.ts +10 -0
- package/dist/tui/features/tasks/stores/tasks-store.js +16 -0
- package/dist/tui/features/vc/add/api/execute-vc-add.d.ts +8 -0
- package/dist/tui/features/vc/add/api/execute-vc-add.js +13 -0
- package/dist/tui/features/vc/add/components/vc-add-flow.d.ts +7 -0
- package/dist/tui/features/vc/add/components/vc-add-flow.js +35 -0
- package/dist/tui/features/vc/branch/api/execute-vc-branch.d.ts +8 -0
- package/dist/tui/features/vc/branch/api/execute-vc-branch.js +13 -0
- package/dist/tui/features/vc/branch/components/vc-branch-flow.d.ts +8 -0
- package/dist/tui/features/vc/branch/components/vc-branch-flow.js +53 -0
- package/dist/tui/features/vc/branch/utils/format-branch.d.ts +4 -0
- package/dist/tui/features/vc/branch/utils/format-branch.js +12 -0
- package/dist/tui/features/vc/checkout/api/execute-vc-checkout.d.ts +8 -0
- package/dist/tui/features/vc/checkout/api/execute-vc-checkout.js +13 -0
- package/dist/tui/features/vc/checkout/components/vc-checkout-flow.d.ts +8 -0
- package/dist/tui/features/vc/checkout/components/vc-checkout-flow.js +33 -0
- package/dist/tui/features/vc/clone/api/execute-vc-clone.d.ts +8 -0
- package/dist/tui/features/vc/clone/api/execute-vc-clone.js +13 -0
- package/dist/tui/features/vc/clone/components/vc-clone-flow.d.ts +7 -0
- package/dist/tui/features/vc/clone/components/vc-clone-flow.js +79 -0
- package/dist/tui/features/vc/commit/api/execute-vc-commit.d.ts +8 -0
- package/dist/tui/features/vc/commit/api/execute-vc-commit.js +13 -0
- package/dist/tui/features/vc/commit/components/vc-commit-flow.d.ts +7 -0
- package/dist/tui/features/vc/commit/components/vc-commit-flow.js +29 -0
- package/dist/tui/features/vc/config/api/execute-vc-config.d.ts +8 -0
- package/dist/tui/features/vc/config/api/execute-vc-config.js +13 -0
- package/dist/tui/features/vc/config/components/vc-config-flow.d.ts +9 -0
- package/dist/tui/features/vc/config/components/vc-config-flow.js +30 -0
- package/dist/tui/features/vc/fetch/api/execute-vc-fetch.d.ts +8 -0
- package/dist/tui/features/vc/fetch/api/execute-vc-fetch.js +13 -0
- package/dist/tui/features/vc/fetch/components/vc-fetch-flow.d.ts +8 -0
- package/dist/tui/features/vc/fetch/components/vc-fetch-flow.js +75 -0
- package/dist/tui/features/vc/init/api/execute-vc-init.d.ts +8 -0
- package/dist/tui/features/vc/init/api/execute-vc-init.js +13 -0
- package/dist/tui/features/vc/init/components/vc-init-flow.d.ts +10 -0
- package/dist/tui/features/vc/init/components/vc-init-flow.js +37 -0
- package/dist/tui/features/vc/merge/api/execute-vc-merge.d.ts +8 -0
- package/dist/tui/features/vc/merge/api/execute-vc-merge.js +13 -0
- package/dist/tui/features/vc/merge/components/vc-merge-flow.d.ts +11 -0
- package/dist/tui/features/vc/merge/components/vc-merge-flow.js +72 -0
- package/dist/tui/features/vc/pull/api/execute-vc-pull.d.ts +8 -0
- package/dist/tui/features/vc/pull/api/execute-vc-pull.js +13 -0
- package/dist/tui/features/vc/pull/components/vc-pull-flow.d.ts +9 -0
- package/dist/tui/features/vc/pull/components/vc-pull-flow.js +83 -0
- package/dist/tui/features/vc/push/api/execute-vc-push.d.ts +8 -0
- package/dist/tui/features/vc/push/api/execute-vc-push.js +13 -0
- package/dist/tui/features/vc/push/components/vc-push-flow.d.ts +8 -0
- package/dist/tui/features/vc/push/components/vc-push-flow.js +83 -0
- package/dist/tui/features/vc/remote/api/execute-vc-remote.d.ts +8 -0
- package/dist/tui/features/vc/remote/api/execute-vc-remote.js +13 -0
- package/dist/tui/features/vc/remote/components/vc-remote-flow.d.ts +9 -0
- package/dist/tui/features/vc/remote/components/vc-remote-flow.js +42 -0
- package/dist/tui/features/vc/reset/api/execute-vc-reset.d.ts +8 -0
- package/dist/tui/features/vc/reset/api/execute-vc-reset.js +13 -0
- package/dist/tui/features/vc/reset/components/vc-reset-flow.d.ts +10 -0
- package/dist/tui/features/vc/reset/components/vc-reset-flow.js +63 -0
- package/dist/tui/features/vc/status/api/execute-vc-status.d.ts +8 -0
- package/dist/tui/features/vc/status/api/execute-vc-status.js +13 -0
- package/dist/tui/features/vc/status/components/vc-status-flow.d.ts +10 -0
- package/dist/tui/features/vc/status/components/vc-status-flow.js +133 -0
- package/dist/tui/lib/environment.d.ts +8 -0
- package/dist/tui/lib/environment.js +8 -0
- package/dist/tui/utils/error-messages.d.ts +5 -1
- package/dist/tui/utils/error-messages.js +32 -3
- package/oclif.manifest.json +1018 -98
- package/package.json +9 -3
- package/dist/oclif/hooks/prerun/validate-brv-config-version.d.ts +0 -33
- package/dist/oclif/hooks/prerun/validate-brv-config-version.js +0 -86
- package/dist/tui/components/init.d.ts +0 -33
- package/dist/tui/components/init.js +0 -234
- package/dist/tui/features/space/api/get-spaces.d.ts +0 -16
- package/dist/tui/features/space/api/get-spaces.js +0 -17
- package/dist/tui/features/space/api/switch-space.d.ts +0 -11
- package/dist/tui/features/space/api/switch-space.js +0 -24
- package/dist/tui/features/space/components/space-list-view.d.ts +0 -12
- package/dist/tui/features/space/components/space-list-view.js +0 -56
- package/dist/tui/features/space/components/space-switch-flow.d.ts +0 -13
- package/dist/tui/features/space/components/space-switch-flow.js +0 -97
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
export type BaseGitParams = {
|
|
2
|
+
directory: string;
|
|
3
|
+
};
|
|
4
|
+
export type GitStatusFile = {
|
|
5
|
+
path: string;
|
|
6
|
+
staged: boolean;
|
|
7
|
+
status: 'added' | 'deleted' | 'modified' | 'untracked';
|
|
8
|
+
};
|
|
9
|
+
export type GitStatus = {
|
|
10
|
+
/** Only contains files with changes. Empty when the working tree is clean. */
|
|
11
|
+
files: GitStatusFile[];
|
|
12
|
+
isClean: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type GitCommit = {
|
|
15
|
+
author: {
|
|
16
|
+
email: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
message: string;
|
|
20
|
+
sha: string;
|
|
21
|
+
timestamp: Date;
|
|
22
|
+
};
|
|
23
|
+
export type GitBranch = {
|
|
24
|
+
isCurrent: boolean;
|
|
25
|
+
isRemote: boolean;
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
28
|
+
export type GitConflict = {
|
|
29
|
+
path: string;
|
|
30
|
+
type: 'both_added' | 'both_modified' | 'deleted_modified';
|
|
31
|
+
};
|
|
32
|
+
export type GitRemote = {
|
|
33
|
+
remote: string;
|
|
34
|
+
url: string;
|
|
35
|
+
};
|
|
36
|
+
export type PushResult = {
|
|
37
|
+
alreadyUpToDate?: boolean;
|
|
38
|
+
success: true;
|
|
39
|
+
} | {
|
|
40
|
+
message?: string;
|
|
41
|
+
reason: 'non_fast_forward';
|
|
42
|
+
success: false;
|
|
43
|
+
};
|
|
44
|
+
export type PullResult = {
|
|
45
|
+
alreadyUpToDate?: boolean;
|
|
46
|
+
success: true;
|
|
47
|
+
} | {
|
|
48
|
+
conflicts: GitConflict[];
|
|
49
|
+
success: false;
|
|
50
|
+
};
|
|
51
|
+
export type MergeResult = {
|
|
52
|
+
alreadyUpToDate?: boolean;
|
|
53
|
+
success: true;
|
|
54
|
+
} | {
|
|
55
|
+
conflicts: GitConflict[];
|
|
56
|
+
success: false;
|
|
57
|
+
};
|
|
58
|
+
export type TrackingBranch = {
|
|
59
|
+
remote: string;
|
|
60
|
+
remoteBranch: string;
|
|
61
|
+
};
|
|
62
|
+
export type AheadBehind = {
|
|
63
|
+
ahead: number;
|
|
64
|
+
behind: number;
|
|
65
|
+
};
|
|
66
|
+
export type InitGitParams = BaseGitParams & {
|
|
67
|
+
defaultBranch?: string;
|
|
68
|
+
};
|
|
69
|
+
export type AddGitParams = BaseGitParams & {
|
|
70
|
+
filePaths: string[];
|
|
71
|
+
};
|
|
72
|
+
export type CommitGitParams = BaseGitParams & {
|
|
73
|
+
author?: {
|
|
74
|
+
email: string;
|
|
75
|
+
name: string;
|
|
76
|
+
};
|
|
77
|
+
message: string;
|
|
78
|
+
};
|
|
79
|
+
export type LogGitParams = BaseGitParams & {
|
|
80
|
+
depth?: number;
|
|
81
|
+
ref?: string;
|
|
82
|
+
};
|
|
83
|
+
export type PushGitParams = BaseGitParams & {
|
|
84
|
+
branch?: string;
|
|
85
|
+
remote?: string;
|
|
86
|
+
};
|
|
87
|
+
export type PullGitParams = BaseGitParams & {
|
|
88
|
+
allowUnrelatedHistories?: boolean;
|
|
89
|
+
author?: {
|
|
90
|
+
email: string;
|
|
91
|
+
name: string;
|
|
92
|
+
};
|
|
93
|
+
branch?: string;
|
|
94
|
+
remote?: string;
|
|
95
|
+
};
|
|
96
|
+
export type FetchGitParams = BaseGitParams & {
|
|
97
|
+
ref?: string;
|
|
98
|
+
remote?: string;
|
|
99
|
+
};
|
|
100
|
+
export type AbortMergeGitParams = BaseGitParams;
|
|
101
|
+
export type MergeGitParams = BaseGitParams & {
|
|
102
|
+
allowUnrelatedHistories?: boolean;
|
|
103
|
+
author?: {
|
|
104
|
+
email: string;
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
107
|
+
branch: string;
|
|
108
|
+
message?: string;
|
|
109
|
+
};
|
|
110
|
+
export type CreateBranchGitParams = BaseGitParams & {
|
|
111
|
+
branch: string;
|
|
112
|
+
checkout?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export type DeleteBranchGitParams = BaseGitParams & {
|
|
115
|
+
branch: string;
|
|
116
|
+
};
|
|
117
|
+
export type ListBranchesGitParams = BaseGitParams & {
|
|
118
|
+
remote?: string;
|
|
119
|
+
};
|
|
120
|
+
export type CheckoutGitParams = BaseGitParams & {
|
|
121
|
+
force?: boolean;
|
|
122
|
+
ref: string;
|
|
123
|
+
};
|
|
124
|
+
export type AddRemoteGitParams = BaseGitParams & {
|
|
125
|
+
remote: string;
|
|
126
|
+
url: string;
|
|
127
|
+
};
|
|
128
|
+
export type RemoveRemoteGitParams = BaseGitParams & {
|
|
129
|
+
remote: string;
|
|
130
|
+
};
|
|
131
|
+
export type GetRemoteUrlGitParams = BaseGitParams & {
|
|
132
|
+
remote: string;
|
|
133
|
+
};
|
|
134
|
+
export type GetTrackingBranchParams = BaseGitParams & {
|
|
135
|
+
branch: string;
|
|
136
|
+
};
|
|
137
|
+
export type SetTrackingBranchParams = BaseGitParams & {
|
|
138
|
+
branch: string;
|
|
139
|
+
remote: string;
|
|
140
|
+
remoteBranch: string;
|
|
141
|
+
};
|
|
142
|
+
export type GetAheadBehindParams = BaseGitParams & {
|
|
143
|
+
localRef: string;
|
|
144
|
+
remoteRef: string;
|
|
145
|
+
};
|
|
146
|
+
export type ResetMode = 'hard' | 'mixed' | 'soft';
|
|
147
|
+
export type ResetGitParams = BaseGitParams & {
|
|
148
|
+
filePaths?: string[];
|
|
149
|
+
mode?: ResetMode;
|
|
150
|
+
ref?: string;
|
|
151
|
+
};
|
|
152
|
+
export type ResetResult = {
|
|
153
|
+
filesChanged: number;
|
|
154
|
+
headSha: string;
|
|
155
|
+
};
|
|
156
|
+
export type CloneGitParams = BaseGitParams & {
|
|
157
|
+
onProgress?: (progress: {
|
|
158
|
+
loaded: number;
|
|
159
|
+
phase: string;
|
|
160
|
+
total?: number;
|
|
161
|
+
}) => void;
|
|
162
|
+
url: string;
|
|
163
|
+
};
|
|
164
|
+
export interface IGitService {
|
|
165
|
+
abortMerge(params: AbortMergeGitParams): Promise<void>;
|
|
166
|
+
add(params: AddGitParams): Promise<void>;
|
|
167
|
+
addRemote(params: AddRemoteGitParams): Promise<void>;
|
|
168
|
+
checkout(params: CheckoutGitParams): Promise<void>;
|
|
169
|
+
clone(params: CloneGitParams): Promise<void>;
|
|
170
|
+
commit(params: CommitGitParams): Promise<GitCommit>;
|
|
171
|
+
createBranch(params: CreateBranchGitParams): Promise<void>;
|
|
172
|
+
deleteBranch(params: DeleteBranchGitParams): Promise<void>;
|
|
173
|
+
fetch(params: FetchGitParams): Promise<void>;
|
|
174
|
+
/** Returns how many commits the local ref is ahead/behind relative to the remote ref. */
|
|
175
|
+
getAheadBehind(params: GetAheadBehindParams): Promise<AheadBehind>;
|
|
176
|
+
/**
|
|
177
|
+
* Returns conflicts currently present in the working tree.
|
|
178
|
+
* Detects all three conflict types (both_modified, both_added, deleted_modified)
|
|
179
|
+
* by inspecting the git status matrix.
|
|
180
|
+
*
|
|
181
|
+
* Returns an empty array when no merge is in progress (MERGE_HEAD absent).
|
|
182
|
+
*
|
|
183
|
+
* Use this to inspect conflict state when the original `merge()` / `pull()` result is
|
|
184
|
+
* no longer available — e.g. after a process restart or when refreshing a conflict UI.
|
|
185
|
+
*/
|
|
186
|
+
getConflicts(params: BaseGitParams): Promise<GitConflict[]>;
|
|
187
|
+
/** Returns the current branch name, or `undefined` when in detached HEAD state. */
|
|
188
|
+
getCurrentBranch(params: BaseGitParams): Promise<string | undefined>;
|
|
189
|
+
/**
|
|
190
|
+
* Scans tracked files for git conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`).
|
|
191
|
+
* Unlike `getConflicts()`, this works regardless of merge state — it detects
|
|
192
|
+
* leftover markers even after a merge is completed or aborted.
|
|
193
|
+
*/
|
|
194
|
+
getFilesWithConflictMarkers(params: BaseGitParams): Promise<string[]>;
|
|
195
|
+
getRemoteUrl(params: GetRemoteUrlGitParams): Promise<string | undefined>;
|
|
196
|
+
/** Returns the upstream tracking branch config, or `undefined` if not configured. */
|
|
197
|
+
getTrackingBranch(params: GetTrackingBranchParams): Promise<TrackingBranch | undefined>;
|
|
198
|
+
init(params: InitGitParams): Promise<void>;
|
|
199
|
+
/** Returns true if `ancestor` commit is reachable from `commit`. */
|
|
200
|
+
isAncestor(params: BaseGitParams & {
|
|
201
|
+
ancestor: string;
|
|
202
|
+
commit: string;
|
|
203
|
+
}): Promise<boolean>;
|
|
204
|
+
/** Returns true if the repository is freshly initialized with no commits, remotes, branches, tags, or untracked files. */
|
|
205
|
+
isEmptyRepository(params: BaseGitParams): Promise<boolean>;
|
|
206
|
+
/** Returns true if a git repository (.git directory) exists at the given directory. */
|
|
207
|
+
isInitialized(params: BaseGitParams): Promise<boolean>;
|
|
208
|
+
/** Lists local branches. When `remote` is specified, also includes remote-tracking branches. */
|
|
209
|
+
listBranches(params: ListBranchesGitParams): Promise<GitBranch[]>;
|
|
210
|
+
listRemotes(params: BaseGitParams): Promise<GitRemote[]>;
|
|
211
|
+
log(params: LogGitParams): Promise<GitCommit[]>;
|
|
212
|
+
merge(params: MergeGitParams): Promise<MergeResult>;
|
|
213
|
+
pull(params: PullGitParams): Promise<PullResult>;
|
|
214
|
+
/**
|
|
215
|
+
* Pushes local commits to the remote.
|
|
216
|
+
* Returns `{success: false, reason: 'non_fast_forward'}` when the remote has
|
|
217
|
+
* diverged (recoverable — caller can pull or force-push).
|
|
218
|
+
* Throws for unrecoverable failures (network error, auth failure, remote not found).
|
|
219
|
+
*/
|
|
220
|
+
push(params: PushGitParams): Promise<PushResult>;
|
|
221
|
+
removeRemote(params: RemoveRemoteGitParams): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Resets the index and/or HEAD.
|
|
224
|
+
* - filePaths provided: unstages specific files (always mixed, ignores mode)
|
|
225
|
+
* - mode=mixed (default): resets index to ref. If ref is HEAD, unstages all.
|
|
226
|
+
* If ref is a commit (e.g. HEAD~1), moves HEAD back and unstages.
|
|
227
|
+
* - mode=soft: moves HEAD to ref, keeps index and working tree intact
|
|
228
|
+
* - mode=hard: moves HEAD to ref, resets index and working tree
|
|
229
|
+
*/
|
|
230
|
+
reset(params: ResetGitParams): Promise<ResetResult>;
|
|
231
|
+
/** Writes upstream tracking config: `branch.<name>.remote` and `branch.<name>.merge`. */
|
|
232
|
+
setTrackingBranch(params: SetTrackingBranchParams): Promise<void>;
|
|
233
|
+
status(params: BaseGitParams): Promise<GitStatus>;
|
|
234
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { CurateLogEntry } from '../../domain/entities/curate-log-entry.js';
|
|
2
2
|
export type CurateLogStatus = 'cancelled' | 'completed' | 'error' | 'processing';
|
|
3
3
|
export interface ICurateLogStore {
|
|
4
|
+
/** Batch-update reviewStatus for multiple operations within a single log entry. Reads once, writes once. */
|
|
5
|
+
batchUpdateOperationReviewStatus(logId: string, updates: Array<{
|
|
6
|
+
operationIndex: number;
|
|
7
|
+
reviewStatus: 'approved' | 'rejected';
|
|
8
|
+
}>): Promise<boolean>;
|
|
4
9
|
/** Retrieve an entry by ID. Returns null if not found or if the file is corrupt. */
|
|
5
10
|
getById(id: string): Promise<CurateLogEntry | null>;
|
|
6
11
|
/** Generate the next monotonic log entry ID. */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store for pre-curate file content backups.
|
|
3
|
+
*
|
|
4
|
+
* When a curate operation modifies a file that was previously pushed (exists in snapshot),
|
|
5
|
+
* the original content is backed up here. The review UI uses these backups to compute diffs
|
|
6
|
+
* (snapshot version → current version). Backups are cleared after a successful push.
|
|
7
|
+
*/
|
|
8
|
+
export interface IReviewBackupStore {
|
|
9
|
+
/** Remove all backups. Called after a successful push creates a new snapshot. */
|
|
10
|
+
clear(): Promise<void>;
|
|
11
|
+
/** Delete the backup for a given relative path. No-op if no backup exists. */
|
|
12
|
+
delete(relativePath: string): Promise<void>;
|
|
13
|
+
/** Check if a backup exists for the given relative path. */
|
|
14
|
+
has(relativePath: string): Promise<boolean>;
|
|
15
|
+
/** Read the backed-up content for a relative path. Returns null if no backup exists. */
|
|
16
|
+
read(relativePath: string): Promise<null | string>;
|
|
17
|
+
/** Save a backup of file content. No-op if a backup already exists (first-write wins). */
|
|
18
|
+
save(relativePath: string, content: string): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { IContextTreeService } from '../../core/interfaces/context-tree/i-context-tree-service.js';
|
|
2
|
-
import type { IContextTreeSnapshotService } from '../../core/interfaces/context-tree/i-context-tree-snapshot-service.js';
|
|
3
2
|
import type { IProjectConfigStore } from '../../core/interfaces/storage/i-project-config-store.js';
|
|
4
3
|
export interface AutoInitDeps {
|
|
5
4
|
contextTreeService: IContextTreeService;
|
|
6
|
-
contextTreeSnapshotService: IContextTreeSnapshotService;
|
|
7
5
|
projectConfigStore: IProjectConfigStore;
|
|
8
6
|
}
|
|
9
7
|
/**
|
|
@@ -14,5 +14,4 @@ export async function ensureProjectInitialized(deps, directory) {
|
|
|
14
14
|
await deps.projectConfigStore.write(config, directory);
|
|
15
15
|
await syncConfigToXdg(config, cwd);
|
|
16
16
|
await deps.contextTreeService.initialize(directory);
|
|
17
|
-
await deps.contextTreeSnapshotService.initEmptySnapshot(directory);
|
|
18
17
|
}
|
|
@@ -11,5 +11,7 @@ export declare class FileContextTreeService implements IContextTreeService {
|
|
|
11
11
|
constructor(config?: ContextTreeServiceConfig);
|
|
12
12
|
delete(directory?: string): Promise<void>;
|
|
13
13
|
exists(directory?: string): Promise<boolean>;
|
|
14
|
+
hasGitRepo(directory: string): Promise<boolean>;
|
|
14
15
|
initialize(directory?: string): Promise<string>;
|
|
16
|
+
resolvePath(directory: string): string;
|
|
15
17
|
}
|
|
@@ -27,6 +27,16 @@ export class FileContextTreeService {
|
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
+
async hasGitRepo(directory) {
|
|
31
|
+
const contextTreeDir = this.resolvePath(directory);
|
|
32
|
+
try {
|
|
33
|
+
await access(join(contextTreeDir, '.git'));
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
30
40
|
async initialize(directory) {
|
|
31
41
|
const baseDir = directory ?? this.config.baseDirectory ?? process.cwd();
|
|
32
42
|
const brvDir = join(baseDir, BRV_DIR);
|
|
@@ -36,4 +46,7 @@ export class FileContextTreeService {
|
|
|
36
46
|
await mkdir(contextTreeDir, { recursive: true });
|
|
37
47
|
return contextTreeDir;
|
|
38
48
|
}
|
|
49
|
+
resolvePath(directory) {
|
|
50
|
+
return join(directory, BRV_DIR, CONTEXT_TREE_DIR);
|
|
51
|
+
}
|
|
39
52
|
}
|
|
@@ -21,16 +21,20 @@
|
|
|
21
21
|
* 10. Start idle timer + register signal handlers
|
|
22
22
|
*/
|
|
23
23
|
import { GlobalInstanceManager } from '@campfirein/brv-transport-client';
|
|
24
|
+
import express from 'express';
|
|
24
25
|
import { fork } from 'node:child_process';
|
|
25
26
|
import { mkdirSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';
|
|
26
27
|
import { dirname, join } from 'node:path';
|
|
27
28
|
import { fileURLToPath } from 'node:url';
|
|
28
|
-
import {
|
|
29
|
+
import { ReviewEvents } from '../../../shared/transport/events/review-events.js';
|
|
30
|
+
import { AGENT_IDLE_CHECK_INTERVAL_MS, AGENT_IDLE_TIMEOUT_MS, AGENT_POOL_MAX_SIZE, BRV_DIR, HEARTBEAT_FILE, } from '../../constants.js';
|
|
29
31
|
import { TransportStateEventNames } from '../../core/domain/transport/schemas.js';
|
|
30
32
|
import { getGlobalDataDir } from '../../utils/global-data-path.js';
|
|
33
|
+
import { getProjectDataDir } from '../../utils/path-utils.js';
|
|
31
34
|
import { crashLog, processLog } from '../../utils/process-logger.js';
|
|
32
35
|
import { ClientManager } from '../client/client-manager.js';
|
|
33
36
|
import { ProjectConfigStore } from '../config/file-config-store.js';
|
|
37
|
+
import { createReviewApiRouter } from '../http/review-api-handler.js';
|
|
34
38
|
import { broadcastToProjectRoom } from '../process/broadcast-utils.js';
|
|
35
39
|
import { CurateLogHandler } from '../process/curate-log-handler.js';
|
|
36
40
|
import { setupFeatureHandlers } from '../process/feature-handlers.js';
|
|
@@ -42,7 +46,9 @@ import { clearStaleProviderConfig, resolveProviderConfig } from '../provider/pro
|
|
|
42
46
|
import { ProjectRouter } from '../routing/project-router.js';
|
|
43
47
|
import { AuthStateStore } from '../state/auth-state-store.js';
|
|
44
48
|
import { ProjectStateLoader } from '../state/project-state-loader.js';
|
|
49
|
+
import { FileCurateLogStore } from '../storage/file-curate-log-store.js';
|
|
45
50
|
import { FileProviderConfigStore } from '../storage/file-provider-config-store.js';
|
|
51
|
+
import { FileReviewBackupStore } from '../storage/file-review-backup-store.js';
|
|
46
52
|
import { createProviderKeychainStore } from '../storage/provider-keychain-store.js';
|
|
47
53
|
import { createTokenStore } from '../storage/token-store.js';
|
|
48
54
|
import { SocketIOTransportServer } from '../transport/socket-io-transport-server.js';
|
|
@@ -145,8 +151,14 @@ async function main() {
|
|
|
145
151
|
let authStateStore;
|
|
146
152
|
let agentPool;
|
|
147
153
|
try {
|
|
148
|
-
// 4. Start Socket.IO transport server
|
|
154
|
+
// 4. Start Socket.IO transport server (with Express for HTTP routes)
|
|
149
155
|
transportServer = new SocketIOTransportServer();
|
|
156
|
+
const app = express();
|
|
157
|
+
app.use(createReviewApiRouter({
|
|
158
|
+
curateLogStoreFactory: (projectPath) => new FileCurateLogStore({ baseDir: getProjectDataDir(projectPath) }),
|
|
159
|
+
reviewBackupStoreFactory: (projectPath) => new FileReviewBackupStore(join(projectPath, BRV_DIR)),
|
|
160
|
+
}));
|
|
161
|
+
transportServer.setHttpRequestHandler(app);
|
|
150
162
|
await transportServer.start(port);
|
|
151
163
|
log(`Transport server started on port ${port}`);
|
|
152
164
|
// 5. Start heartbeat writer
|
|
@@ -226,7 +238,15 @@ async function main() {
|
|
|
226
238
|
});
|
|
227
239
|
// Start agent idle timeout policy
|
|
228
240
|
agentIdleTimeoutPolicy.start();
|
|
229
|
-
const curateLogHandler = new CurateLogHandler()
|
|
241
|
+
const curateLogHandler = new CurateLogHandler(undefined, (info) => {
|
|
242
|
+
const encoded = Buffer.from(info.projectPath).toString('base64url');
|
|
243
|
+
const reviewUrl = `http://127.0.0.1:${port}/review?project=${encoded}`;
|
|
244
|
+
const payload = { pendingCount: info.pendingCount, reviewUrl, taskId: info.taskId };
|
|
245
|
+
// Send directly to the task originator (covers CLI clients not in the project room)
|
|
246
|
+
transportServer.sendTo(info.clientId, ReviewEvents.NOTIFY, payload);
|
|
247
|
+
// Also broadcast to the project room so TUI and other connected clients are notified
|
|
248
|
+
broadcastToProjectRoom(projectRegistry, projectRouter, info.projectPath, ReviewEvents.NOTIFY, payload, info.clientId);
|
|
249
|
+
});
|
|
230
250
|
const transportHandlers = new TransportHandlers({
|
|
231
251
|
agentPool,
|
|
232
252
|
clientManager,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the CoGit Git remote URL for a given team and space.
|
|
3
|
+
* Format: {baseUrl}/{teamName}/{spaceName}.git
|
|
4
|
+
*/
|
|
5
|
+
export declare function buildCogitRemoteUrl(baseUrl: string, teamName: string, spaceName: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Parse a .git URL to extract team and space names.
|
|
8
|
+
* Expected path: /{teamName}/{spaceName}.git
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseUserFacingUrl(url: string): null | {
|
|
11
|
+
spaceName: string;
|
|
12
|
+
teamName: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Validate git branch name (same rules as native git).
|
|
16
|
+
*/
|
|
17
|
+
export declare function isValidBranchName(name: string): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build the CoGit Git remote URL for a given team and space.
|
|
3
|
+
* Format: {baseUrl}/{teamName}/{spaceName}.git
|
|
4
|
+
*/
|
|
5
|
+
export function buildCogitRemoteUrl(baseUrl, teamName, spaceName) {
|
|
6
|
+
const base = baseUrl.replace(/\/$/, '');
|
|
7
|
+
return `${base}/${teamName}/${spaceName}.git`;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Parse a .git URL to extract team and space names.
|
|
11
|
+
* Expected path: /{teamName}/{spaceName}.git
|
|
12
|
+
*/
|
|
13
|
+
export function parseUserFacingUrl(url) {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = new URL(url);
|
|
16
|
+
const match = parsed.pathname.match(/^\/([^/]+)\/([^/]+?)\.git$/);
|
|
17
|
+
if (!match)
|
|
18
|
+
return null;
|
|
19
|
+
return { spaceName: match[2], teamName: match[1] };
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validate git branch name (same rules as native git).
|
|
27
|
+
*/
|
|
28
|
+
export function isValidBranchName(name) {
|
|
29
|
+
if (!name)
|
|
30
|
+
return false;
|
|
31
|
+
if (name.startsWith('-') || name.startsWith('.') || name.startsWith('/'))
|
|
32
|
+
return false;
|
|
33
|
+
if (name.endsWith('.lock') || name.endsWith('/') || name.endsWith('.'))
|
|
34
|
+
return false;
|
|
35
|
+
if (name.includes('//') || name.includes('@{') || name.includes(' '))
|
|
36
|
+
return false;
|
|
37
|
+
// eslint-disable-next-line no-control-regex
|
|
38
|
+
return !/\.\.|[~^:?*[\\\u0000-\u001F\u007F]/.test(name);
|
|
39
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { request as httpRequest } from 'isomorphic-git/http/node';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps isomorphic-git's HTTP client to ensure Git Smart HTTP Protocol v1 compliance.
|
|
4
|
+
*
|
|
5
|
+
* ByteRover CoGit exhibits two non-standard behaviours:
|
|
6
|
+
*
|
|
7
|
+
* 1. git-receive-pack (push): Returns a valid pktline ref advertisement with the
|
|
8
|
+
* correct Content-Type, but OMITS the required `# service=git-receive-pack\n`
|
|
9
|
+
* preamble. This wrapper injects the missing preamble.
|
|
10
|
+
*
|
|
11
|
+
* 2. git-upload-pack (fetch/clone): Always returns a Git Protocol v2 capability
|
|
12
|
+
* advertisement, even when the client does not request v2. isomorphic-git uses
|
|
13
|
+
* Protocol v1 internally and cannot use a v2 response for its fetch logic.
|
|
14
|
+
* This wrapper:
|
|
15
|
+
* a. Translates the info/refs v2 response to v1 (ls-refs POST + synthetic refs advertisement)
|
|
16
|
+
* b. Intercepts the subsequent pack-data POST and converts it from v1 to v2 fetch command
|
|
17
|
+
*/
|
|
18
|
+
export declare const gitHttpWrapper: {
|
|
19
|
+
request: typeof httpRequest;
|
|
20
|
+
};
|