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
|
@@ -7,28 +7,6 @@ export class TransportError extends Error {
|
|
|
7
7
|
this.name = 'TransportError';
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Error thrown when connection to server fails.
|
|
12
|
-
*/
|
|
13
|
-
export class TransportConnectionError extends TransportError {
|
|
14
|
-
originalError;
|
|
15
|
-
url;
|
|
16
|
-
constructor(url, originalError) {
|
|
17
|
-
super(`Connection failed to ${url}${originalError ? `: ${originalError.message}` : ''}`);
|
|
18
|
-
this.name = 'TransportConnectionError';
|
|
19
|
-
this.url = url;
|
|
20
|
-
this.originalError = originalError;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Error thrown when client is not connected to server.
|
|
25
|
-
*/
|
|
26
|
-
export class TransportNotConnectedError extends TransportError {
|
|
27
|
-
constructor(operation = 'operation') {
|
|
28
|
-
super(`Not connected to server. Cannot perform: ${operation}`);
|
|
29
|
-
this.name = 'TransportNotConnectedError';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
10
|
/**
|
|
33
11
|
* Error thrown when server is not started.
|
|
34
12
|
*/
|
|
@@ -84,31 +62,3 @@ export class TransportRequestError extends TransportError {
|
|
|
84
62
|
this.event = event;
|
|
85
63
|
}
|
|
86
64
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Error thrown when room operations fail.
|
|
89
|
-
*/
|
|
90
|
-
export class TransportRoomError extends TransportError {
|
|
91
|
-
operation;
|
|
92
|
-
room;
|
|
93
|
-
constructor(room, operation) {
|
|
94
|
-
super(`Failed to ${operation} room '${room}'`);
|
|
95
|
-
this.name = 'TransportRoomError';
|
|
96
|
-
this.room = room;
|
|
97
|
-
this.operation = operation;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Error thrown when room operation times out.
|
|
102
|
-
*/
|
|
103
|
-
export class TransportRoomTimeoutError extends TransportError {
|
|
104
|
-
operation;
|
|
105
|
-
room;
|
|
106
|
-
timeoutMs;
|
|
107
|
-
constructor(room, operation, timeoutMs) {
|
|
108
|
-
super(`${operation === 'join' ? 'Join' : 'Leave'} room '${room}' timed out after ${timeoutMs}ms`);
|
|
109
|
-
this.name = 'TransportRoomTimeoutError';
|
|
110
|
-
this.room = room;
|
|
111
|
-
this.operation = operation;
|
|
112
|
-
this.timeoutMs = timeoutMs;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
@@ -48,9 +48,11 @@ export interface ContextData {
|
|
|
48
48
|
name: string;
|
|
49
49
|
narrative?: Narrative;
|
|
50
50
|
rawConcept?: RawConcept;
|
|
51
|
+
reason?: string;
|
|
51
52
|
relations?: string[];
|
|
52
53
|
scoring?: FrontmatterScoring;
|
|
53
54
|
snippets: string[];
|
|
55
|
+
summary?: string;
|
|
54
56
|
tags: string[];
|
|
55
57
|
}
|
|
56
58
|
interface Frontmatter {
|
|
@@ -61,6 +63,7 @@ interface Frontmatter {
|
|
|
61
63
|
maturity?: 'core' | 'draft' | 'validated';
|
|
62
64
|
recency?: number;
|
|
63
65
|
related: string[];
|
|
66
|
+
summary?: string;
|
|
64
67
|
tags: string[];
|
|
65
68
|
title?: string;
|
|
66
69
|
updateCount?: number;
|
|
@@ -88,7 +91,7 @@ export declare function parseFrontmatterScoring(content: string): FrontmatterSco
|
|
|
88
91
|
export declare function updateScoringInContent(content: string, scoring: FrontmatterScoring): string;
|
|
89
92
|
export declare const MarkdownWriter: {
|
|
90
93
|
generateContext(data: ContextData): string;
|
|
91
|
-
mergeContexts(sourceContent: string, targetContent: string): string;
|
|
94
|
+
mergeContexts(sourceContent: string, targetContent: string, reason?: string, summary?: string): string;
|
|
92
95
|
parseContent(content: string, name?: string): ContextData;
|
|
93
96
|
};
|
|
94
97
|
export {};
|
|
@@ -5,12 +5,15 @@ import { normalizeRelationPath, parseRelations } from './relation-parser.js';
|
|
|
5
5
|
* Generate YAML frontmatter block from context data.
|
|
6
6
|
* Only includes fields that have values.
|
|
7
7
|
*/
|
|
8
|
-
function generateFrontmatter(title, relations, tags = [], keywords = [], scoring) {
|
|
8
|
+
function generateFrontmatter(title, relations, tags = [], keywords = [], scoring, summary) {
|
|
9
9
|
const normalizedRelations = (relations || []).map(rel => normalizeRelationPath(rel));
|
|
10
10
|
const fm = {};
|
|
11
11
|
if (title) {
|
|
12
12
|
fm.title = title;
|
|
13
13
|
}
|
|
14
|
+
if (summary) {
|
|
15
|
+
fm.summary = summary;
|
|
16
|
+
}
|
|
14
17
|
fm.tags = tags;
|
|
15
18
|
if (normalizedRelations.length > 0) {
|
|
16
19
|
fm.related = normalizedRelations;
|
|
@@ -74,6 +77,9 @@ function parseFrontmatter(content) {
|
|
|
74
77
|
if (typeof parsed.title === 'string') {
|
|
75
78
|
frontmatter.title = parsed.title;
|
|
76
79
|
}
|
|
80
|
+
if (typeof parsed.summary === 'string') {
|
|
81
|
+
frontmatter.summary = parsed.summary;
|
|
82
|
+
}
|
|
77
83
|
// Scoring fields (backward compatible — absent in old files)
|
|
78
84
|
if (typeof parsed.importance === 'number') {
|
|
79
85
|
frontmatter.importance = parsed.importance;
|
|
@@ -333,6 +339,18 @@ function parseFactsSection(content) {
|
|
|
333
339
|
}
|
|
334
340
|
return facts.length > 0 ? facts : undefined;
|
|
335
341
|
}
|
|
342
|
+
function generateReasonSection(reason) {
|
|
343
|
+
if (!reason)
|
|
344
|
+
return '';
|
|
345
|
+
return `\n## Reason\n${reason}\n`;
|
|
346
|
+
}
|
|
347
|
+
function parseReasonSection(content) {
|
|
348
|
+
const match = content.match(/##\s*Reason\s*\n([\s\S]*?)(?=\n##\s|\n---\n|$)/i);
|
|
349
|
+
if (!match)
|
|
350
|
+
return undefined;
|
|
351
|
+
const text = match[1].trim();
|
|
352
|
+
return text || undefined;
|
|
353
|
+
}
|
|
336
354
|
function extractSnippetsFromContent(content) {
|
|
337
355
|
let snippetContent = content;
|
|
338
356
|
// Forgiving regex patterns for section removal
|
|
@@ -340,6 +358,10 @@ function extractSnippetsFromContent(content) {
|
|
|
340
358
|
if (relationsMatch) {
|
|
341
359
|
snippetContent = snippetContent.replace(relationsMatch[0], '').trim();
|
|
342
360
|
}
|
|
361
|
+
const reasonMatch = snippetContent.match(/##\s*Reason[\s\S]*?(?=\n##\s|\n---\n|$)/i);
|
|
362
|
+
if (reasonMatch) {
|
|
363
|
+
snippetContent = snippetContent.replace(reasonMatch[0], '').trim();
|
|
364
|
+
}
|
|
343
365
|
const rawConceptMatch = snippetContent.match(/##\s*Raw Concept[\s\S]*?(?=\n##\s|\n---\n|$)/i);
|
|
344
366
|
if (rawConceptMatch) {
|
|
345
367
|
snippetContent = snippetContent.replace(rawConceptMatch[0], '').trim();
|
|
@@ -518,7 +540,7 @@ export function updateScoringInContent(content, scoring) {
|
|
|
518
540
|
return content;
|
|
519
541
|
}
|
|
520
542
|
const { body, frontmatter } = parsed;
|
|
521
|
-
const updatedFrontmatter = generateFrontmatter(frontmatter.title ?? '', frontmatter.related, frontmatter.tags, frontmatter.keywords, scoring);
|
|
543
|
+
const updatedFrontmatter = generateFrontmatter(frontmatter.title ?? '', frontmatter.related, frontmatter.tags, frontmatter.keywords, scoring, frontmatter.summary);
|
|
522
544
|
return updatedFrontmatter + body;
|
|
523
545
|
}
|
|
524
546
|
function parseContentWithFrontmatter(content) {
|
|
@@ -529,6 +551,7 @@ function parseContentWithFrontmatter(content) {
|
|
|
529
551
|
keywords: parsed.frontmatter.keywords,
|
|
530
552
|
relations: parsed.frontmatter.related,
|
|
531
553
|
scoring: extractScoring(parsed.frontmatter),
|
|
554
|
+
summary: parsed.frontmatter.summary,
|
|
532
555
|
tags: parsed.frontmatter.tags,
|
|
533
556
|
title: parsed.frontmatter.title,
|
|
534
557
|
};
|
|
@@ -545,15 +568,16 @@ export const MarkdownWriter = {
|
|
|
545
568
|
generateContext(data) {
|
|
546
569
|
const snippets = (data.snippets || []).filter(s => s && s.trim());
|
|
547
570
|
const relations = data.relations || [];
|
|
548
|
-
const frontmatter = generateFrontmatter(data.name, relations, data.tags, data.keywords, data.scoring);
|
|
571
|
+
const frontmatter = generateFrontmatter(data.name, relations, data.tags, data.keywords, data.scoring, data.summary);
|
|
572
|
+
const reasonSection = generateReasonSection(data.reason);
|
|
549
573
|
const rawConceptSection = generateRawConceptSection(data.rawConcept);
|
|
550
574
|
const narrativeSection = generateNarrativeSection(data.narrative);
|
|
551
575
|
const factsSection = generateFactsSection(data.facts);
|
|
552
576
|
const hasSnippets = snippets.length > 0;
|
|
553
577
|
// Build the content parts
|
|
554
578
|
const parts = [];
|
|
555
|
-
// Add sections (
|
|
556
|
-
const sectionsContent = `${rawConceptSection}${narrativeSection}${factsSection}`.trim();
|
|
579
|
+
// Add sections — reason first (WHY), then content sections, relations in frontmatter
|
|
580
|
+
const sectionsContent = `${reasonSection}${rawConceptSection}${narrativeSection}${factsSection}`.trim();
|
|
557
581
|
if (sectionsContent) {
|
|
558
582
|
parts.push(sectionsContent);
|
|
559
583
|
}
|
|
@@ -570,12 +594,14 @@ export const MarkdownWriter = {
|
|
|
570
594
|
const body = parts.length > 0 ? parts.join('\n\n---\n\n') + '\n' : '';
|
|
571
595
|
return `${frontmatter}${body}`;
|
|
572
596
|
},
|
|
573
|
-
mergeContexts(sourceContent, targetContent) {
|
|
597
|
+
mergeContexts(sourceContent, targetContent, reason, summary) {
|
|
574
598
|
const sourceParsed = parseContentWithFrontmatter(sourceContent);
|
|
575
599
|
const targetParsed = parseContentWithFrontmatter(targetContent);
|
|
576
600
|
const mergedRelations = [...new Set([...sourceParsed.relations, ...targetParsed.relations])];
|
|
577
601
|
const mergedTags = [...new Set([...sourceParsed.tags, ...targetParsed.tags])];
|
|
578
602
|
const mergedKeywords = [...new Set([...sourceParsed.keywords, ...targetParsed.keywords])];
|
|
603
|
+
// reason: explicit override wins, then source (newer), then target (older)
|
|
604
|
+
const mergedReason = reason ?? parseReasonSection(sourceParsed.body) ?? parseReasonSection(targetParsed.body);
|
|
579
605
|
// Merge scoring metadata (FinMem-inspired lifecycle)
|
|
580
606
|
const defaultScoring = { importance: 50, maturity: 'draft', recency: 1 };
|
|
581
607
|
let mergedScoringData;
|
|
@@ -609,23 +635,27 @@ export const MarkdownWriter = {
|
|
|
609
635
|
name: sourceParsed.title || targetParsed.title || '',
|
|
610
636
|
narrative: mergedNarrative,
|
|
611
637
|
rawConcept: mergedRawConcept,
|
|
638
|
+
reason: mergedReason,
|
|
612
639
|
relations: mergedRelations,
|
|
613
640
|
scoring: mergedScoringData,
|
|
614
641
|
snippets: mergedSnippets,
|
|
642
|
+
summary: summary ?? sourceParsed.summary ?? targetParsed.summary,
|
|
615
643
|
tags: mergedTags,
|
|
616
644
|
});
|
|
617
645
|
},
|
|
618
646
|
parseContent(content, name = '') {
|
|
619
|
-
const { body, keywords, relations, scoring, tags, title } = parseContentWithFrontmatter(content);
|
|
647
|
+
const { body, keywords, relations, scoring, summary, tags, title } = parseContentWithFrontmatter(content);
|
|
620
648
|
return {
|
|
621
649
|
facts: parseFactsSection(body),
|
|
622
650
|
keywords,
|
|
623
651
|
name: title || name,
|
|
624
652
|
narrative: parseNarrativeSection(body),
|
|
625
653
|
rawConcept: parseRawConceptSection(body),
|
|
654
|
+
reason: parseReasonSection(body),
|
|
626
655
|
relations,
|
|
627
656
|
scoring,
|
|
628
657
|
snippets: extractSnippetsFromContent(body),
|
|
658
|
+
summary,
|
|
629
659
|
tags,
|
|
630
660
|
};
|
|
631
661
|
},
|
|
@@ -521,18 +521,18 @@ export declare const TaskExecuteSchema: z.ZodObject<{
|
|
|
521
521
|
taskId: string;
|
|
522
522
|
clientId: string;
|
|
523
523
|
files?: string[] | undefined;
|
|
524
|
+
projectPath?: string | undefined;
|
|
524
525
|
folderPath?: string | undefined;
|
|
525
526
|
clientCwd?: string | undefined;
|
|
526
|
-
projectPath?: string | undefined;
|
|
527
527
|
}, {
|
|
528
528
|
type: "curate" | "query" | "curate-folder";
|
|
529
529
|
content: string;
|
|
530
530
|
taskId: string;
|
|
531
531
|
clientId: string;
|
|
532
532
|
files?: string[] | undefined;
|
|
533
|
+
projectPath?: string | undefined;
|
|
533
534
|
folderPath?: string | undefined;
|
|
534
535
|
clientCwd?: string | undefined;
|
|
535
|
-
projectPath?: string | undefined;
|
|
536
536
|
}>;
|
|
537
537
|
/**
|
|
538
538
|
* task:cancel - Transport tells Agent to cancel a task
|
|
@@ -718,14 +718,14 @@ export declare const TaskStartedEventSchema: z.ZodObject<{
|
|
|
718
718
|
}, "strip", z.ZodTypeAny, {
|
|
719
719
|
taskId: string;
|
|
720
720
|
type?: string | undefined;
|
|
721
|
-
content?: string | undefined;
|
|
722
721
|
files?: string[] | undefined;
|
|
722
|
+
content?: string | undefined;
|
|
723
723
|
clientCwd?: string | undefined;
|
|
724
724
|
}, {
|
|
725
725
|
taskId: string;
|
|
726
726
|
type?: string | undefined;
|
|
727
|
-
content?: string | undefined;
|
|
728
727
|
files?: string[] | undefined;
|
|
728
|
+
content?: string | undefined;
|
|
729
729
|
clientCwd?: string | undefined;
|
|
730
730
|
}>;
|
|
731
731
|
/**
|
|
@@ -965,17 +965,17 @@ export declare const TaskCreateRequestSchema: z.ZodObject<{
|
|
|
965
965
|
content: string;
|
|
966
966
|
taskId: string;
|
|
967
967
|
files?: string[] | undefined;
|
|
968
|
+
projectPath?: string | undefined;
|
|
968
969
|
folderPath?: string | undefined;
|
|
969
970
|
clientCwd?: string | undefined;
|
|
970
|
-
projectPath?: string | undefined;
|
|
971
971
|
}, {
|
|
972
972
|
type: "curate" | "query" | "curate-folder";
|
|
973
973
|
content: string;
|
|
974
974
|
taskId: string;
|
|
975
975
|
files?: string[] | undefined;
|
|
976
|
+
projectPath?: string | undefined;
|
|
976
977
|
folderPath?: string | undefined;
|
|
977
978
|
clientCwd?: string | undefined;
|
|
978
|
-
projectPath?: string | undefined;
|
|
979
979
|
}>;
|
|
980
980
|
/**
|
|
981
981
|
* Response after task creation
|
|
@@ -15,6 +15,12 @@ export interface IContextTreeService {
|
|
|
15
15
|
* @returns True if context tree directory exists
|
|
16
16
|
*/
|
|
17
17
|
exists(directory?: string): Promise<boolean>;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if a git repository (.git directory) exists in the context tree.
|
|
20
|
+
* @param directory - Base directory
|
|
21
|
+
* @returns True if .git directory exists inside the context tree
|
|
22
|
+
*/
|
|
23
|
+
hasGitRepo(directory: string): Promise<boolean>;
|
|
18
24
|
/**
|
|
19
25
|
* Initializes the context tree directory structure.
|
|
20
26
|
* Creates .brv/context-tree/ directory with domain subdirectories and context.md files.
|
|
@@ -23,4 +29,9 @@ export interface IContextTreeService {
|
|
|
23
29
|
* @throws Error if context tree already exists or initialization fails
|
|
24
30
|
*/
|
|
25
31
|
initialize(directory?: string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns the absolute path to the context tree directory without creating it.
|
|
34
|
+
* @param directory - Base directory
|
|
35
|
+
*/
|
|
36
|
+
resolvePath(directory: string): string;
|
|
26
37
|
}
|
|
@@ -12,6 +12,12 @@ import type { TaskInfo } from '../../domain/transport/task-info.js';
|
|
|
12
12
|
export interface ITaskLifecycleHook {
|
|
13
13
|
/** Called after onTaskCompleted, onTaskError, or onTaskCancelled to release in-memory resources. */
|
|
14
14
|
cleanup?(taskId: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Synchronous hook called just before task:completed is emitted.
|
|
17
|
+
* Returns extra data to merge into the task:completed payload (e.g. {pendingReviewCount: 2}).
|
|
18
|
+
* Must be synchronous and must not throw.
|
|
19
|
+
*/
|
|
20
|
+
getTaskCompletionData?(taskId: string): Record<string, unknown>;
|
|
15
21
|
/** Called when a task is cancelled by the user. Distinct from onTaskError. */
|
|
16
22
|
onTaskCancelled?(taskId: string, task: TaskInfo): Promise<void>;
|
|
17
23
|
/** Called when a task completes successfully. */
|
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
}
|