byterover-cli 0.3.5 → 0.4.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/README.md +119 -63
- package/bin/dev.js +8 -1
- package/bin/run.js +7 -0
- package/dist/commands/cipher-agent/run.d.ts +30 -0
- package/dist/commands/cipher-agent/run.js +123 -61
- package/dist/commands/cipher-agent/set-prompt.d.ts +2 -0
- package/dist/commands/cipher-agent/set-prompt.js +13 -8
- package/dist/commands/cipher-agent/show-prompt.d.ts +2 -0
- package/dist/commands/cipher-agent/show-prompt.js +17 -12
- package/dist/commands/curate.d.ts +3 -60
- package/dist/commands/curate.js +45 -341
- package/dist/commands/foo.d.ts +4 -2
- package/dist/commands/foo.js +21 -16
- package/dist/commands/main.d.ts +9 -0
- package/dist/commands/main.js +34 -0
- package/dist/commands/query.d.ts +2 -48
- package/dist/commands/query.js +19 -287
- package/dist/commands/status.d.ts +2 -13
- package/dist/commands/status.js +12 -91
- package/dist/commands/watch.d.ts +2 -0
- package/dist/commands/watch.js +23 -19
- package/dist/config/environment.d.ts +1 -1
- package/dist/config/environment.js +2 -2
- package/dist/constants.d.ts +4 -5
- package/dist/constants.js +5 -5
- package/dist/core/domain/cipher/errors/storage-error.d.ts +89 -0
- package/dist/core/domain/cipher/errors/storage-error.js +130 -0
- package/dist/core/domain/cipher/queue/types.d.ts +71 -0
- package/dist/core/domain/cipher/queue/types.js +9 -0
- package/dist/core/domain/cipher/storage/message-storage-types.d.ts +218 -0
- package/dist/core/domain/cipher/storage/message-storage-types.js +18 -0
- package/dist/core/domain/cipher/tools/constants.d.ts +1 -0
- package/dist/core/domain/cipher/tools/constants.js +1 -0
- package/dist/core/domain/entities/event.d.ts +1 -1
- package/dist/core/domain/entities/event.js +8 -1
- package/dist/core/domain/entities/global-config.d.ts +36 -0
- package/dist/core/domain/entities/global-config.js +66 -0
- package/dist/core/domain/knowledge/directory-manager.d.ts +10 -0
- package/dist/core/domain/knowledge/directory-manager.js +18 -0
- package/dist/core/domain/knowledge/markdown-writer.d.ts +9 -0
- package/dist/core/domain/knowledge/markdown-writer.js +51 -1
- package/dist/core/interfaces/cipher/i-agent-storage.d.ts +152 -0
- package/dist/core/interfaces/cipher/i-agent-storage.js +1 -0
- package/dist/core/interfaces/cipher/i-cipher-agent.d.ts +2 -0
- package/dist/core/interfaces/cipher/i-key-storage.d.ts +91 -0
- package/dist/core/interfaces/cipher/i-key-storage.js +1 -0
- package/dist/core/interfaces/i-global-config-store.d.ts +34 -0
- package/dist/core/interfaces/i-global-config-store.js +1 -0
- package/dist/core/interfaces/i-onboarding-preference-store.d.ts +20 -0
- package/dist/core/interfaces/i-onboarding-preference-store.js +1 -0
- package/dist/core/interfaces/i-terminal.d.ts +146 -0
- package/dist/core/interfaces/i-terminal.js +1 -0
- package/dist/core/interfaces/i-workspace-detector-service.d.ts +8 -0
- package/dist/core/interfaces/i-workspace-detector-service.js +1 -0
- package/dist/core/interfaces/usecase/i-clear-use-case.d.ts +6 -0
- package/dist/core/interfaces/usecase/i-clear-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-curate-use-case.d.ts +10 -0
- package/dist/core/interfaces/usecase/i-curate-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-generate-rules-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-generate-rules-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-init-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-init-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-login-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-login-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-logout-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-logout-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-pull-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-pull-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-push-use-case.d.ts +6 -0
- package/dist/core/interfaces/usecase/i-push-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-query-use-case.d.ts +9 -0
- package/dist/core/interfaces/usecase/i-query-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-space-list-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-space-list-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-space-switch-use-case.d.ts +3 -0
- package/dist/core/interfaces/usecase/i-space-switch-use-case.js +1 -0
- package/dist/core/interfaces/usecase/i-status-use-case.d.ts +5 -0
- package/dist/core/interfaces/usecase/i-status-use-case.js +1 -0
- package/dist/hooks/init/welcome.js +10 -26
- package/dist/infra/cipher/agent-service-factory.d.ts +13 -6
- package/dist/infra/cipher/agent-service-factory.js +40 -16
- package/dist/infra/cipher/cipher-agent.js +4 -4
- package/dist/infra/cipher/consumer/consumer-lock.d.ts +20 -0
- package/dist/infra/cipher/consumer/consumer-lock.js +40 -0
- package/dist/infra/cipher/consumer/consumer-service.d.ts +99 -0
- package/dist/infra/cipher/consumer/consumer-service.js +165 -0
- package/dist/infra/cipher/consumer/execution-consumer.d.ts +121 -0
- package/dist/infra/cipher/consumer/execution-consumer.js +523 -0
- package/dist/infra/cipher/consumer/index.d.ts +33 -0
- package/dist/infra/cipher/consumer/index.js +33 -0
- package/dist/infra/cipher/consumer/queue-polling-service.d.ts +120 -0
- package/dist/infra/cipher/consumer/queue-polling-service.js +248 -0
- package/dist/infra/cipher/http/internal-llm-http-service.d.ts +94 -0
- package/dist/infra/cipher/http/internal-llm-http-service.js +118 -0
- package/dist/infra/cipher/llm/context/compaction/compaction-service.d.ts +106 -0
- package/dist/infra/cipher/llm/context/compaction/compaction-service.js +132 -0
- package/dist/infra/cipher/llm/context/compaction/index.d.ts +9 -0
- package/dist/infra/cipher/llm/context/compaction/index.js +9 -0
- package/dist/infra/cipher/llm/context/context-manager.d.ts +46 -2
- package/dist/infra/cipher/llm/context/context-manager.js +68 -4
- package/dist/infra/cipher/llm/context/rw-lock.d.ts +72 -0
- package/dist/infra/cipher/llm/context/rw-lock.js +145 -0
- package/dist/infra/cipher/llm/generators/byterover-content-generator.d.ts +7 -7
- package/dist/infra/cipher/llm/generators/byterover-content-generator.js +8 -8
- package/dist/infra/cipher/llm/internal-llm-service.js +2 -0
- package/dist/infra/cipher/session/session-manager.d.ts +4 -4
- package/dist/infra/cipher/session/session-manager.js +5 -5
- package/dist/infra/cipher/storage/agent-storage.d.ts +246 -0
- package/dist/infra/cipher/storage/agent-storage.js +956 -0
- package/dist/infra/cipher/storage/dual-format-history-storage.d.ts +77 -0
- package/dist/infra/cipher/storage/dual-format-history-storage.js +149 -0
- package/dist/infra/cipher/storage/granular-history-storage.d.ts +65 -0
- package/dist/infra/cipher/storage/granular-history-storage.js +118 -0
- package/dist/infra/cipher/storage/message-storage-service.d.ts +108 -0
- package/dist/infra/cipher/storage/message-storage-service.js +529 -0
- package/dist/infra/cipher/storage/process-utils.d.ts +16 -0
- package/dist/infra/cipher/storage/process-utils.js +43 -0
- package/dist/infra/cipher/storage/sqlite-key-storage.d.ts +105 -0
- package/dist/infra/cipher/storage/sqlite-key-storage.js +404 -0
- package/dist/infra/cipher/system-prompt/simple-prompt-factory.d.ts +1 -0
- package/dist/infra/cipher/system-prompt/simple-prompt-factory.js +7 -0
- package/dist/infra/cipher/tools/default-policy-rules.js +1 -1
- package/dist/infra/cipher/tools/implementations/curate-tool.d.ts +10 -0
- package/dist/infra/cipher/tools/implementations/curate-tool.js +371 -0
- package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.js +11 -8
- package/dist/infra/cipher/tools/tool-manager.d.ts +8 -2
- package/dist/infra/cipher/tools/tool-manager.js +29 -2
- package/dist/infra/cipher/tools/tool-registry.js +7 -0
- package/dist/infra/http/authenticated-http-client.d.ts +21 -0
- package/dist/infra/http/authenticated-http-client.js +38 -0
- package/dist/infra/repl/commands/arg-parser.d.ts +97 -0
- package/dist/infra/repl/commands/arg-parser.js +129 -0
- package/dist/infra/repl/commands/clear-command.d.ts +5 -0
- package/dist/infra/repl/commands/clear-command.js +61 -0
- package/dist/infra/repl/commands/curate-command.d.ts +9 -0
- package/dist/infra/repl/commands/curate-command.js +88 -0
- package/dist/infra/repl/commands/gen-rules-command.d.ts +7 -0
- package/dist/infra/repl/commands/gen-rules-command.js +38 -0
- package/dist/infra/repl/commands/index.d.ts +8 -0
- package/dist/infra/repl/commands/index.js +36 -0
- package/dist/infra/repl/commands/init-command.d.ts +7 -0
- package/dist/infra/repl/commands/init-command.js +83 -0
- package/dist/infra/repl/commands/login-command.d.ts +7 -0
- package/dist/infra/repl/commands/login-command.js +50 -0
- package/dist/infra/repl/commands/logout-command.d.ts +5 -0
- package/dist/infra/repl/commands/logout-command.js +48 -0
- package/dist/infra/repl/commands/pull-command.d.ts +5 -0
- package/dist/infra/repl/commands/pull-command.js +61 -0
- package/dist/infra/repl/commands/push-command.d.ts +5 -0
- package/dist/infra/repl/commands/push-command.js +66 -0
- package/dist/infra/repl/commands/query-command.d.ts +5 -0
- package/dist/infra/repl/commands/query-command.js +66 -0
- package/dist/infra/repl/commands/space/index.d.ts +5 -0
- package/dist/infra/repl/commands/space/index.js +14 -0
- package/dist/infra/repl/commands/space/list-command.d.ts +5 -0
- package/dist/infra/repl/commands/space/list-command.js +70 -0
- package/dist/infra/repl/commands/space/switch-command.d.ts +5 -0
- package/dist/infra/repl/commands/space/switch-command.js +37 -0
- package/dist/infra/repl/commands/status-command.d.ts +5 -0
- package/dist/infra/repl/commands/status-command.js +39 -0
- package/dist/infra/repl/repl-startup.d.ts +18 -0
- package/dist/infra/repl/repl-startup.js +28 -0
- package/dist/infra/storage/file-global-config-store.d.ts +22 -0
- package/dist/infra/storage/file-global-config-store.js +65 -0
- package/dist/infra/storage/file-onboarding-preference-store.d.ts +10 -0
- package/dist/infra/storage/file-onboarding-preference-store.js +46 -0
- package/dist/infra/terminal/oclif-terminal.d.ts +19 -0
- package/dist/infra/terminal/oclif-terminal.js +60 -0
- package/dist/infra/terminal/repl-terminal.d.ts +31 -0
- package/dist/infra/terminal/repl-terminal.js +116 -0
- package/dist/infra/tracking/mixpanel-tracking-service.d.ts +11 -1
- package/dist/infra/tracking/mixpanel-tracking-service.js +18 -13
- package/dist/infra/usecase/clear-use-case.d.ts +20 -0
- package/dist/infra/usecase/clear-use-case.js +58 -0
- package/dist/infra/usecase/curate-use-case.d.ts +66 -0
- package/dist/infra/usecase/curate-use-case.js +288 -0
- package/dist/{commands/gen-rules.d.ts → infra/usecase/generate-rules-use-case.d.ts} +14 -20
- package/dist/{commands/gen-rules.js → infra/usecase/generate-rules-use-case.js} +59 -78
- package/dist/infra/usecase/init-use-case.d.ts +139 -0
- package/dist/{commands/init.js → infra/usecase/init-use-case.js} +197 -233
- package/dist/infra/usecase/login-use-case.d.ts +28 -0
- package/dist/infra/usecase/login-use-case.js +94 -0
- package/dist/infra/usecase/logout-use-case.d.ts +22 -0
- package/dist/infra/usecase/logout-use-case.js +51 -0
- package/dist/infra/usecase/pull-use-case.d.ts +35 -0
- package/dist/infra/usecase/pull-use-case.js +89 -0
- package/dist/infra/usecase/push-use-case.d.ts +37 -0
- package/dist/infra/usecase/push-use-case.js +124 -0
- package/dist/infra/usecase/query-use-case.d.ts +78 -0
- package/dist/infra/usecase/query-use-case.js +402 -0
- package/dist/infra/usecase/space-list-use-case.d.ts +27 -0
- package/dist/infra/usecase/space-list-use-case.js +64 -0
- package/dist/infra/usecase/space-switch-use-case.d.ts +36 -0
- package/dist/infra/usecase/space-switch-use-case.js +140 -0
- package/dist/infra/usecase/status-use-case.d.ts +27 -0
- package/dist/infra/usecase/status-use-case.js +97 -0
- package/dist/infra/workspace/workspace-detector-service.d.ts +3 -6
- package/dist/resources/prompts/curate-context-tree-curation.yml +23 -11
- package/dist/resources/prompts/query-context-tree-retrieval.yml +3 -4
- package/dist/resources/prompts/system-prompt.yml +1 -1
- package/dist/resources/prompts/tool-outputs.yml +4 -3
- package/dist/templates/sections/command-reference.md +12 -0
- package/dist/templates/sections/workflow.md +10 -1
- package/dist/tui/app.d.ts +9 -0
- package/dist/tui/app.js +26 -0
- package/dist/tui/components/enter-prompt.d.ts +13 -0
- package/dist/tui/components/enter-prompt.js +15 -0
- package/dist/tui/components/execution/execution-changes.d.ts +14 -0
- package/dist/tui/components/execution/execution-changes.js +15 -0
- package/dist/tui/components/execution/execution-content.d.ts +25 -0
- package/dist/tui/components/execution/execution-content.js +67 -0
- package/dist/tui/components/execution/execution-input.d.ts +12 -0
- package/dist/tui/components/execution/execution-input.js +16 -0
- package/dist/tui/components/execution/execution-progress.d.ts +21 -0
- package/dist/tui/components/execution/execution-progress.js +21 -0
- package/dist/tui/components/execution/execution-status.d.ts +13 -0
- package/dist/tui/components/execution/execution-status.js +19 -0
- package/dist/tui/components/execution/index.d.ts +11 -0
- package/dist/tui/components/execution/index.js +11 -0
- package/dist/tui/components/execution/log-item.d.ts +17 -0
- package/dist/tui/components/execution/log-item.js +25 -0
- package/dist/tui/components/footer.d.ts +5 -0
- package/dist/tui/components/footer.js +12 -0
- package/dist/tui/components/header.d.ts +18 -0
- package/dist/tui/components/header.js +18 -0
- package/dist/tui/components/index.d.ts +17 -0
- package/dist/tui/components/index.js +14 -0
- package/dist/tui/components/inline-prompts/index.d.ts +15 -0
- package/dist/tui/components/inline-prompts/index.js +10 -0
- package/dist/tui/components/inline-prompts/inline-confirm.d.ts +17 -0
- package/dist/tui/components/inline-prompts/inline-confirm.js +32 -0
- package/dist/tui/components/inline-prompts/inline-file-selector.d.ts +43 -0
- package/dist/tui/components/inline-prompts/inline-file-selector.js +185 -0
- package/dist/tui/components/inline-prompts/inline-input.d.ts +19 -0
- package/dist/tui/components/inline-prompts/inline-input.js +32 -0
- package/dist/tui/components/inline-prompts/inline-search.d.ts +20 -0
- package/dist/tui/components/inline-prompts/inline-search.js +50 -0
- package/dist/tui/components/inline-prompts/inline-select.d.ts +20 -0
- package/dist/tui/components/inline-prompts/inline-select.js +34 -0
- package/dist/tui/components/logo.d.ts +43 -0
- package/dist/tui/components/logo.js +103 -0
- package/dist/tui/components/message-item.d.ts +12 -0
- package/dist/tui/components/message-item.js +12 -0
- package/dist/tui/components/onboarding/copyable-prompt.d.ts +15 -0
- package/dist/tui/components/onboarding/copyable-prompt.js +65 -0
- package/dist/tui/components/onboarding/index.d.ts +7 -0
- package/dist/tui/components/onboarding/index.js +6 -0
- package/dist/tui/components/onboarding/onboarding-flow.d.ts +13 -0
- package/dist/tui/components/onboarding/onboarding-flow.js +304 -0
- package/dist/tui/components/onboarding/onboarding-step.d.ts +23 -0
- package/dist/tui/components/onboarding/onboarding-step.js +12 -0
- package/dist/tui/components/output-log.d.ts +14 -0
- package/dist/tui/components/output-log.js +13 -0
- package/dist/tui/components/scrollable-list.d.ts +30 -0
- package/dist/tui/components/scrollable-list.js +121 -0
- package/dist/tui/components/suggestions.d.ts +16 -0
- package/dist/tui/components/suggestions.js +162 -0
- package/dist/tui/components/tab-bar.d.ts +10 -0
- package/dist/tui/components/tab-bar.js +12 -0
- package/dist/tui/constants.d.ts +11 -0
- package/dist/tui/constants.js +13 -0
- package/dist/tui/contexts/auth-context.d.ts +30 -0
- package/dist/tui/contexts/auth-context.js +153 -0
- package/dist/tui/contexts/consumer.d.ts +31 -0
- package/dist/tui/contexts/consumer.js +56 -0
- package/dist/tui/contexts/index.d.ts +6 -0
- package/dist/tui/contexts/index.js +6 -0
- package/dist/tui/contexts/onboarding-context.d.ts +43 -0
- package/dist/tui/contexts/onboarding-context.js +181 -0
- package/dist/tui/contexts/services-context.d.ts +29 -0
- package/dist/tui/contexts/services-context.js +20 -0
- package/dist/tui/contexts/use-commands.d.ts +29 -0
- package/dist/tui/contexts/use-commands.js +54 -0
- package/dist/tui/contexts/use-mode.d.ts +43 -0
- package/dist/tui/contexts/use-mode.js +76 -0
- package/dist/tui/contexts/use-theme.d.ts +53 -0
- package/dist/tui/contexts/use-theme.js +60 -0
- package/dist/tui/hooks/index.d.ts +17 -0
- package/dist/tui/hooks/index.js +14 -0
- package/dist/tui/hooks/use-activity-logs.d.ts +26 -0
- package/dist/tui/hooks/use-activity-logs.js +90 -0
- package/dist/tui/hooks/use-consumer.d.ts +12 -0
- package/dist/tui/hooks/use-consumer.js +50 -0
- package/dist/tui/hooks/use-onboarding.d.ts +7 -0
- package/dist/tui/hooks/use-onboarding.js +6 -0
- package/dist/tui/hooks/use-queue-polling.d.ts +31 -0
- package/dist/tui/hooks/use-queue-polling.js +90 -0
- package/dist/tui/hooks/use-slash-command-processor.d.ts +16 -0
- package/dist/tui/hooks/use-slash-command-processor.js +132 -0
- package/dist/tui/hooks/use-slash-completion.d.ts +30 -0
- package/dist/tui/hooks/use-slash-completion.js +230 -0
- package/dist/tui/hooks/use-tab-navigation.d.ts +10 -0
- package/dist/tui/hooks/use-tab-navigation.js +35 -0
- package/dist/tui/hooks/use-visible-window.d.ts +22 -0
- package/dist/tui/hooks/use-visible-window.js +37 -0
- package/dist/tui/index.d.ts +1 -0
- package/dist/tui/index.js +1 -0
- package/dist/tui/providers/app-providers.d.ts +25 -0
- package/dist/tui/providers/app-providers.js +9 -0
- package/dist/tui/types/commands.d.ts +252 -0
- package/dist/tui/types/commands.js +16 -0
- package/dist/tui/types/dialogs.d.ts +37 -0
- package/dist/tui/types/dialogs.js +4 -0
- package/dist/tui/types/index.d.ts +11 -0
- package/dist/tui/types/index.js +7 -0
- package/dist/tui/types/messages.d.ts +55 -0
- package/dist/tui/types/messages.js +4 -0
- package/dist/tui/types/prompts.d.ts +100 -0
- package/dist/tui/types/prompts.js +4 -0
- package/dist/tui/types/ui.d.ts +14 -0
- package/dist/tui/types/ui.js +4 -0
- package/dist/tui/types.d.ts +1 -0
- package/dist/tui/types.js +1 -0
- package/dist/tui/views/command-view.d.ts +12 -0
- package/dist/tui/views/command-view.js +451 -0
- package/dist/tui/views/index.d.ts +6 -0
- package/dist/tui/views/index.js +6 -0
- package/dist/tui/views/login-view.d.ts +10 -0
- package/dist/tui/views/login-view.js +30 -0
- package/dist/tui/views/logs-view.d.ts +11 -0
- package/dist/tui/views/logs-view.js +73 -0
- package/dist/utils/file-validator.d.ts +16 -0
- package/dist/utils/file-validator.js +81 -0
- package/dist/utils/global-config-path.d.ts +15 -0
- package/dist/utils/global-config-path.js +38 -0
- package/oclif.manifest.json +29 -315
- package/package.json +11 -4
- package/dist/commands/clear.d.ts +0 -19
- package/dist/commands/clear.js +0 -78
- package/dist/commands/init.d.ts +0 -130
- package/dist/commands/login.d.ts +0 -22
- package/dist/commands/login.js +0 -108
- package/dist/commands/logout.d.ts +0 -16
- package/dist/commands/logout.js +0 -61
- package/dist/commands/pull.d.ts +0 -33
- package/dist/commands/pull.js +0 -115
- package/dist/commands/push.d.ts +0 -35
- package/dist/commands/push.js +0 -160
- package/dist/commands/space/list.d.ts +0 -25
- package/dist/commands/space/list.js +0 -114
- package/dist/commands/space/switch.d.ts +0 -36
- package/dist/commands/space/switch.js +0 -160
- package/dist/infra/cipher/grpc/internal-llm-grpc-service.d.ts +0 -149
- package/dist/infra/cipher/grpc/internal-llm-grpc-service.js +0 -364
- package/dist/infra/cipher/grpc/internal-llm-grpc.proto +0 -94
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ByteRover CLI
|
|
2
2
|
|
|
3
|
-
Command-line interface for ByteRover,
|
|
3
|
+
Command-line interface for ByteRover, featuring an interactive REPL with a modern terminal UI for managing your project's context tree and memory storage.
|
|
4
4
|
|
|
5
5
|
[](https://npmjs.org/package/byterover-cli)
|
|
6
6
|
[](https://npmjs.org/package/byterover-cli)
|
|
@@ -18,8 +18,9 @@ Please check the migration guide [here](https://docs.byterover.dev/beta/migratio
|
|
|
18
18
|
|
|
19
19
|
* [Installation](#installation)
|
|
20
20
|
* [Quick Start](#quick-start)
|
|
21
|
+
* [Interactive REPL](#interactive-repl)
|
|
21
22
|
* [What is Context Tree?](#what-is-context-tree)
|
|
22
|
-
* [
|
|
23
|
+
* [Slash Commands Reference](#slash-commands-reference)
|
|
23
24
|
* [Authentication](#authentication)
|
|
24
25
|
* [Configuration](#configuration)
|
|
25
26
|
* [Getting Help](#getting-help)
|
|
@@ -56,26 +57,58 @@ Visit [**ByteRover's Beta Docs**](https://docs.byterover.dev/beta) for more info
|
|
|
56
57
|
|
|
57
58
|
Get started with ByteRover CLI in three simple steps:
|
|
58
59
|
|
|
59
|
-
### 1.
|
|
60
|
+
### 1. Start the REPL
|
|
60
61
|
|
|
61
62
|
```bash
|
|
62
|
-
|
|
63
|
+
cd to/your/project
|
|
64
|
+
brv
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This launches the interactive REPL with a modern terminal UI.
|
|
68
|
+
|
|
69
|
+
### 2. Authenticate
|
|
70
|
+
|
|
71
|
+
In the REPL, type:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
/login
|
|
63
75
|
```
|
|
64
76
|
|
|
65
77
|
This opens your browser to complete OAuth authentication. Your credentials are securely stored in the system keychain.
|
|
66
78
|
|
|
67
|
-
###
|
|
79
|
+
### 3. Initialize your project
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
/init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Select a team and space from your available options, and ByteRover will set up your project's context tree.
|
|
86
|
+
|
|
87
|
+
You're now ready to use ByteRover! Try `/status` to see your project's current state.
|
|
88
|
+
|
|
89
|
+
## Interactive REPL
|
|
90
|
+
|
|
91
|
+
ByteRover CLI features an interactive REPL (Read-Eval-Print Loop) with a React/Ink-based terminal UI.
|
|
92
|
+
|
|
93
|
+
### Starting the REPL
|
|
68
94
|
|
|
69
95
|
```bash
|
|
70
|
-
|
|
71
|
-
brv init
|
|
96
|
+
brv
|
|
72
97
|
```
|
|
73
98
|
|
|
74
|
-
|
|
99
|
+
Running `brv` without arguments starts the interactive REPL. The REPL requires an interactive terminal (TTY).
|
|
100
|
+
|
|
101
|
+
### Using Commands
|
|
102
|
+
|
|
103
|
+
In the REPL, use slash commands (commands prefixed with `/`) to interact with ByteRover:
|
|
75
104
|
|
|
76
|
-
|
|
105
|
+
```
|
|
106
|
+
/status # Check your project status
|
|
107
|
+
/curate # Add context interactively
|
|
108
|
+
/push # Push changes to cloud
|
|
109
|
+
```
|
|
77
110
|
|
|
78
|
-
|
|
111
|
+
Commands support tab completion for quick navigation.
|
|
79
112
|
|
|
80
113
|
## What is Context Tree?
|
|
81
114
|
|
|
@@ -96,62 +129,88 @@ The context tree organizes knowledge into:
|
|
|
96
129
|
- **Topics**: Specific subjects within domains (e.g., Authentication, Components)
|
|
97
130
|
- **Context Files**: Markdown files containing your actual knowledge
|
|
98
131
|
|
|
99
|
-
For comprehensive instructions for coding agents,
|
|
132
|
+
For comprehensive instructions for coding agents, use `/gen-rules` to generate rule files.
|
|
100
133
|
|
|
101
|
-
##
|
|
134
|
+
## Slash Commands Reference
|
|
102
135
|
|
|
103
|
-
###
|
|
136
|
+
### Core Workflow
|
|
104
137
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
138
|
+
| Command | Description |
|
|
139
|
+
|---------|-------------|
|
|
140
|
+
| `/status` | Show CLI status and project information |
|
|
141
|
+
| `/curate [context] @files` | Curate context to the context tree |
|
|
142
|
+
| `/query <question>` | Query and retrieve information from the context tree |
|
|
108
143
|
|
|
109
|
-
|
|
110
|
-
|
|
144
|
+
**Curate examples:**
|
|
145
|
+
```
|
|
146
|
+
/curate # Interactive mode
|
|
147
|
+
/curate "Auth uses JWT tokens" # Autonomous mode with text
|
|
148
|
+
/curate "API docs" @src/api.ts @README.md # With file references (max 5)
|
|
149
|
+
```
|
|
111
150
|
|
|
112
|
-
|
|
113
|
-
|
|
151
|
+
**Query example:**
|
|
152
|
+
```
|
|
153
|
+
/query How is authentication implemented?
|
|
154
|
+
/q What endpoints exist? # /q is an alias for /query
|
|
114
155
|
```
|
|
115
156
|
|
|
116
|
-
###
|
|
157
|
+
### Sync Operations
|
|
117
158
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
159
|
+
| Command | Description |
|
|
160
|
+
|---------|-------------|
|
|
161
|
+
| `/push [-b branch] [-y]` | Push context tree to ByteRover memory storage |
|
|
162
|
+
| `/pull [-b branch]` | Pull context tree from ByteRover memory storage |
|
|
121
163
|
|
|
122
|
-
|
|
123
|
-
|
|
164
|
+
**Options:**
|
|
165
|
+
- `-b, --branch <name>`: ByteRover branch name (default: `main`)
|
|
166
|
+
- `-y, --yes`: Skip confirmation prompt
|
|
124
167
|
|
|
125
|
-
|
|
126
|
-
|
|
168
|
+
**Examples:**
|
|
169
|
+
```
|
|
170
|
+
/push # Push to main branch
|
|
171
|
+
/push -b feature-auth # Push to a specific branch
|
|
172
|
+
/push -y # Push without confirmation
|
|
173
|
+
/pull -b feature-auth # Pull from a specific branch
|
|
127
174
|
```
|
|
128
175
|
|
|
129
|
-
###
|
|
176
|
+
### Space Management
|
|
130
177
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
178
|
+
| Command | Description |
|
|
179
|
+
|---------|-------------|
|
|
180
|
+
| `/space list` | List all spaces for the current team |
|
|
181
|
+
| `/space switch` | Switch to a different space |
|
|
135
182
|
|
|
136
|
-
|
|
137
|
-
|
|
183
|
+
**Space list options:**
|
|
184
|
+
- `-a, --all`: Fetch all spaces
|
|
185
|
+
- `-j, --json`: Output in JSON format
|
|
186
|
+
- `-l, --limit <n>`: Maximum spaces to fetch (default: 50)
|
|
187
|
+
- `-o, --offset <n>`: Number of spaces to skip
|
|
138
188
|
|
|
139
|
-
|
|
140
|
-
brv pull
|
|
189
|
+
### Context Tree Management
|
|
141
190
|
|
|
142
|
-
|
|
143
|
-
|
|
191
|
+
| Command | Description |
|
|
192
|
+
|---------|-------------|
|
|
193
|
+
| `/gen-rules` | Generate rule instructions for coding agents |
|
|
194
|
+
| `/clear [-y] [directory]` | Reset context tree to default domains |
|
|
144
195
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
```
|
|
196
|
+
**Clear options:**
|
|
197
|
+
- `-y, --yes`: Skip confirmation prompt
|
|
148
198
|
|
|
149
|
-
###
|
|
199
|
+
### Project Setup
|
|
150
200
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
201
|
+
| Command | Description |
|
|
202
|
+
|---------|-------------|
|
|
203
|
+
| `/init [-f]` | Initialize a project with ByteRover |
|
|
204
|
+
|
|
205
|
+
**Options:**
|
|
206
|
+
- `-f, --force`: Force re-initialization without confirmation
|
|
207
|
+
|
|
208
|
+
### Authentication
|
|
209
|
+
|
|
210
|
+
| Command | Description |
|
|
211
|
+
|---------|-------------|
|
|
212
|
+
| `/login` | Authenticate with ByteRover using OAuth 2.0 + PKCE |
|
|
213
|
+
| `/logout [-y]` | Log out and clear authentication |
|
|
155
214
|
|
|
156
215
|
## Authentication
|
|
157
216
|
|
|
@@ -159,7 +218,7 @@ ByteRover CLI uses **OAuth 2.0 with PKCE** (Proof Key for Code Exchange) for sec
|
|
|
159
218
|
|
|
160
219
|
### How it works
|
|
161
220
|
|
|
162
|
-
1. Run
|
|
221
|
+
1. Run `/login` in the REPL to start authentication
|
|
163
222
|
2. Your browser opens to the ByteRover authorization page
|
|
164
223
|
3. After successful login, tokens are securely stored in your system keychain
|
|
165
224
|
4. All subsequent commands automatically use your stored credentials
|
|
@@ -167,7 +226,7 @@ ByteRover CLI uses **OAuth 2.0 with PKCE** (Proof Key for Code Exchange) for sec
|
|
|
167
226
|
### Security features
|
|
168
227
|
|
|
169
228
|
- **PKCE flow**: Prevents authorization code interception attacks
|
|
170
|
-
- **System keychain**: Tokens stored in macOS Keychain
|
|
229
|
+
- **System keychain**: Tokens stored in macOS Keychain, Windows Credential Manager, or Linux Secret Service
|
|
171
230
|
- **Session tracking**: Each session includes a session key for request tracking
|
|
172
231
|
- **Auto-refresh**: Refresh tokens enable seamless credential renewal
|
|
173
232
|
|
|
@@ -175,7 +234,7 @@ ByteRover CLI uses **OAuth 2.0 with PKCE** (Proof Key for Code Exchange) for sec
|
|
|
175
234
|
|
|
176
235
|
### Project Configuration
|
|
177
236
|
|
|
178
|
-
When you run
|
|
237
|
+
When you run `/init`, a configuration file is created at `.brv/config.json` in your project directory containing:
|
|
179
238
|
|
|
180
239
|
- **Space ID**: The ByteRover workspace/space associated with this project
|
|
181
240
|
- **User information**: Your user ID and email
|
|
@@ -204,33 +263,30 @@ The context tree is stored in `.brv/context-tree/`:
|
|
|
204
263
|
└── context.md
|
|
205
264
|
```
|
|
206
265
|
|
|
207
|
-
**Note**: When you run
|
|
266
|
+
**Note**: When you run `/push`, your context tree is uploaded to ByteRover's memory storage for version control and team collaboration.
|
|
208
267
|
|
|
209
268
|
## Getting Help
|
|
210
269
|
|
|
270
|
+
### In-REPL Help
|
|
271
|
+
|
|
272
|
+
Start typing `/` in the REPL to see available commands with tab completion.
|
|
273
|
+
|
|
211
274
|
### Command Help
|
|
212
275
|
|
|
213
276
|
```bash
|
|
214
277
|
# Get general help
|
|
215
278
|
brv --help
|
|
216
|
-
|
|
217
|
-
# Get help for a specific command
|
|
218
|
-
brv login --help
|
|
219
|
-
brv init --help
|
|
220
|
-
brv push --help
|
|
221
|
-
brv pull --help
|
|
222
|
-
brv query --help
|
|
223
|
-
brv clear --help
|
|
224
279
|
```
|
|
225
280
|
|
|
226
281
|
### Support
|
|
227
282
|
|
|
228
283
|
If you encounter issues or have questions:
|
|
229
284
|
|
|
230
|
-
1. Check the command help
|
|
231
|
-
2.
|
|
232
|
-
3.
|
|
285
|
+
1. Check the command help in the REPL
|
|
286
|
+
2. Run `/status` to review your project state
|
|
287
|
+
3. Visit [ByteRover Docs](https://docs.byterover.dev/beta)
|
|
288
|
+
4. Contact ByteRover support
|
|
233
289
|
|
|
234
290
|
---
|
|
235
291
|
|
|
236
|
-
**Copyright (c) ByteRover**
|
|
292
|
+
**Copyright (c) ByteRover**
|
package/bin/dev.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
#!/usr/bin/env -S node --
|
|
1
|
+
#!/usr/bin/env -S node --import tsx --no-warnings
|
|
2
2
|
|
|
3
3
|
process.env.BRV_ENV = 'development'
|
|
4
4
|
|
|
5
5
|
import {execute} from '@oclif/core'
|
|
6
6
|
|
|
7
|
+
// Inject default command 'main' (represents logic of a single 'brv' run) when no args provided
|
|
8
|
+
// process.argv = ['node', 'bin/dev.js', ...userArgs]
|
|
9
|
+
const userArgs = process.argv.slice(2)
|
|
10
|
+
if (userArgs.length === 0) {
|
|
11
|
+
process.argv.push('main')
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
await execute({development: true, dir: import.meta.url})
|
package/bin/run.js
CHANGED
|
@@ -4,4 +4,11 @@ process.env.BRV_ENV = 'production'
|
|
|
4
4
|
|
|
5
5
|
import {execute} from '@oclif/core'
|
|
6
6
|
|
|
7
|
+
// Inject default command 'main' (represents logic of a single 'brv' run) when no args provided
|
|
8
|
+
// process.argv = ['node', 'brv', ...userArgs]
|
|
9
|
+
const userArgs = process.argv.slice(2)
|
|
10
|
+
if (userArgs.length === 0) {
|
|
11
|
+
process.argv.push('main')
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
await execute({dir: import.meta.url})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
|
|
3
|
+
import type { ITerminal } from '../../core/interfaces/i-terminal.js';
|
|
3
4
|
import { CipherAgent } from '../../infra/cipher/cipher-agent.js';
|
|
4
5
|
export default class CipherAgentRun extends Command {
|
|
5
6
|
static args: {
|
|
@@ -19,6 +20,7 @@ export default class CipherAgentRun extends Command {
|
|
|
19
20
|
verbose?: import("@oclif/core/interfaces").BooleanFlag<boolean> | undefined;
|
|
20
21
|
};
|
|
21
22
|
static hidden: boolean;
|
|
23
|
+
protected terminal: ITerminal;
|
|
22
24
|
catch(error: Error & {
|
|
23
25
|
oclif?: {
|
|
24
26
|
exit: number;
|
|
@@ -70,6 +72,34 @@ export default class CipherAgentRun extends Command {
|
|
|
70
72
|
* @returns LLM configuration object
|
|
71
73
|
*/
|
|
72
74
|
private createLLMConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Format curate tool result summary
|
|
77
|
+
*
|
|
78
|
+
* @param result - Tool result data
|
|
79
|
+
* @returns Formatted summary string or empty
|
|
80
|
+
*/
|
|
81
|
+
private formatCurateResult;
|
|
82
|
+
/**
|
|
83
|
+
* Format find_knowledge_topics tool result summary
|
|
84
|
+
*
|
|
85
|
+
* @param result - Tool result data
|
|
86
|
+
* @returns Formatted summary string or empty
|
|
87
|
+
*/
|
|
88
|
+
private formatFindKnowledgeTopicsResult;
|
|
89
|
+
/**
|
|
90
|
+
* Format grep_content tool result summary
|
|
91
|
+
*
|
|
92
|
+
* @param result - Tool result data
|
|
93
|
+
* @returns Formatted summary string or empty
|
|
94
|
+
*/
|
|
95
|
+
private formatGrepContentResult;
|
|
96
|
+
/**
|
|
97
|
+
* Format list_directory tool result summary
|
|
98
|
+
*
|
|
99
|
+
* @param result - Tool result data
|
|
100
|
+
* @returns Formatted summary string or empty
|
|
101
|
+
*/
|
|
102
|
+
private formatListDirectoryResult;
|
|
73
103
|
/**
|
|
74
104
|
* Format tool call for concise display in interactive mode
|
|
75
105
|
*
|
|
@@ -7,6 +7,7 @@ import { displayInfo, startInteractiveLoop } from '../../infra/cipher/interactiv
|
|
|
7
7
|
import { WorkspaceNotInitializedError } from '../../infra/cipher/validation/workspace-validator.js';
|
|
8
8
|
import { ProjectConfigStore } from '../../infra/config/file-config-store.js';
|
|
9
9
|
import { KeychainTokenStore } from '../../infra/storage/keychain-token-store.js';
|
|
10
|
+
import { OclifTerminal } from '../../infra/terminal/oclif-terminal.js';
|
|
10
11
|
import { formatToolCall, formatToolResult } from '../../utils/tool-display-formatter.js';
|
|
11
12
|
export default class CipherAgentRun extends Command {
|
|
12
13
|
static args = {
|
|
@@ -90,6 +91,7 @@ export default class CipherAgentRun extends Command {
|
|
|
90
91
|
}),
|
|
91
92
|
};
|
|
92
93
|
static hidden = !isDevelopment();
|
|
94
|
+
terminal = {};
|
|
93
95
|
// Override catch to prevent oclif from logging errors that were already displayed
|
|
94
96
|
async catch(error) {
|
|
95
97
|
// Check if error is ExitError (message already displayed by exitWithCode)
|
|
@@ -105,6 +107,7 @@ export default class CipherAgentRun extends Command {
|
|
|
105
107
|
throw error;
|
|
106
108
|
}
|
|
107
109
|
createServices() {
|
|
110
|
+
this.terminal = new OclifTerminal(this);
|
|
108
111
|
return {
|
|
109
112
|
projectConfigStore: new ProjectConfigStore(),
|
|
110
113
|
};
|
|
@@ -149,8 +152,11 @@ export default class CipherAgentRun extends Command {
|
|
|
149
152
|
}
|
|
150
153
|
// eslint-disable-next-line complexity
|
|
151
154
|
async run() {
|
|
155
|
+
// Load services first to initialize terminal
|
|
156
|
+
const { projectConfigStore } = this.createServices();
|
|
152
157
|
if (!isDevelopment()) {
|
|
153
|
-
this.error('This command is only available in development environment');
|
|
158
|
+
this.terminal.error('This command is only available in development environment');
|
|
159
|
+
return;
|
|
154
160
|
}
|
|
155
161
|
const { args, flags } = await this.parse(CipherAgentRun);
|
|
156
162
|
try {
|
|
@@ -169,14 +175,13 @@ export default class CipherAgentRun extends Command {
|
|
|
169
175
|
: flags.interactive; // User explicitly set --interactive or --no-interactive
|
|
170
176
|
// Validate prompt requirement for non-interactive mode
|
|
171
177
|
if (!isInteractive && !currentPrompt) {
|
|
172
|
-
this.error('Prompt is required in non-interactive mode. Use --interactive flag for interactive mode.');
|
|
178
|
+
this.terminal.error('Prompt is required in non-interactive mode. Use --interactive flag for interactive mode.');
|
|
173
179
|
}
|
|
174
180
|
// Validate flags: In headless mode, prompt is required for session continuation
|
|
175
181
|
if ((flags.continue || flags.resume) && !isInteractive && !args.prompt) {
|
|
176
|
-
this.error('Session continuation flags (-c/--continue or -r/--resume) require a prompt in headless mode.');
|
|
182
|
+
this.terminal.error('Session continuation flags (-c/--continue or -r/--resume) require a prompt in headless mode.');
|
|
177
183
|
}
|
|
178
184
|
// Load ByteRover config to get custom system prompt (if configured)
|
|
179
|
-
const { projectConfigStore } = this.createServices();
|
|
180
185
|
const brvConfig = await projectConfigStore.read();
|
|
181
186
|
// Validate workspace is initialized
|
|
182
187
|
if (!brvConfig) {
|
|
@@ -186,7 +191,7 @@ export default class CipherAgentRun extends Command {
|
|
|
186
191
|
const llmConfig = this.createLLMConfig({ ...token, spaceId: brvConfig?.spaceId ?? '', teamId: brvConfig?.teamId ?? '' }, flags);
|
|
187
192
|
// Create CipherAgent with service factory pattern
|
|
188
193
|
const agent = new CipherAgent(llmConfig, brvConfig);
|
|
189
|
-
this.log('Starting CipherAgent...');
|
|
194
|
+
this.terminal.log('Starting CipherAgent...');
|
|
190
195
|
await agent.start();
|
|
191
196
|
try {
|
|
192
197
|
// Resolve session ID based on flags
|
|
@@ -204,15 +209,15 @@ export default class CipherAgentRun extends Command {
|
|
|
204
209
|
else {
|
|
205
210
|
// Non-interactive mode: single execution
|
|
206
211
|
if (!currentPrompt) {
|
|
207
|
-
this.error('Prompt is required in non-interactive mode.');
|
|
212
|
+
this.terminal.error('Prompt is required in non-interactive mode.');
|
|
208
213
|
}
|
|
209
|
-
this.log('Executing prompt...');
|
|
214
|
+
this.terminal.log('Executing prompt...');
|
|
210
215
|
const response = await agent.execute(currentPrompt, resolvedSessionId);
|
|
211
|
-
this.log('\nCipherAgent Response:');
|
|
212
|
-
this.log(response);
|
|
216
|
+
this.terminal.log('\nCipherAgent Response:');
|
|
217
|
+
this.terminal.log(response);
|
|
213
218
|
// Show agent state
|
|
214
219
|
const state = agent.getState();
|
|
215
|
-
this.log(`\n[Agent State: ${state.currentIteration} iterations]`);
|
|
220
|
+
this.terminal.log(`\n[Agent State: ${state.currentIteration} iterations]`);
|
|
216
221
|
}
|
|
217
222
|
}
|
|
218
223
|
finally {
|
|
@@ -264,13 +269,13 @@ export default class CipherAgentRun extends Command {
|
|
|
264
269
|
* @returns LLM configuration object
|
|
265
270
|
*/
|
|
266
271
|
createLLMConfig(token, flags) {
|
|
267
|
-
// Default model: google/gemini-2.5-pro for OpenRouter, gemini-2.5-pro for
|
|
272
|
+
// Default model: google/gemini-2.5-pro for OpenRouter, gemini-2.5-pro for HTTP
|
|
268
273
|
const model = flags.model ?? (flags.apiKey ? 'google/gemini-2.5-pro' : 'gemini-2.5-pro');
|
|
269
274
|
const envConfig = getCurrentConfig();
|
|
270
275
|
return {
|
|
271
276
|
accessToken: token.accessToken,
|
|
277
|
+
apiBaseUrl: envConfig.llmApiBaseUrl,
|
|
272
278
|
fileSystemConfig: flags.workingDirectory ? { workingDirectory: flags.workingDirectory } : undefined,
|
|
273
|
-
grpcEndpoint: envConfig.llmGrpcEndpoint,
|
|
274
279
|
maxIterations: 10, // Hardcoded default
|
|
275
280
|
maxTokens: flags.maxTokens ?? 8192, // Default: 8192
|
|
276
281
|
model,
|
|
@@ -283,6 +288,84 @@ export default class CipherAgentRun extends Command {
|
|
|
283
288
|
verbose: flags.verbose ?? false,
|
|
284
289
|
};
|
|
285
290
|
}
|
|
291
|
+
/**
|
|
292
|
+
* Format curate tool result summary
|
|
293
|
+
*
|
|
294
|
+
* @param result - Tool result data
|
|
295
|
+
* @returns Formatted summary string or empty
|
|
296
|
+
*/
|
|
297
|
+
formatCurateResult(result) {
|
|
298
|
+
if (typeof result !== 'string') {
|
|
299
|
+
return '';
|
|
300
|
+
}
|
|
301
|
+
try {
|
|
302
|
+
const parsed = JSON.parse(result);
|
|
303
|
+
if (!parsed.summary) {
|
|
304
|
+
return '';
|
|
305
|
+
}
|
|
306
|
+
const { added = 0, deleted = 0, failed = 0, merged = 0, updated = 0 } = parsed.summary;
|
|
307
|
+
const parts = [];
|
|
308
|
+
if (added > 0)
|
|
309
|
+
parts.push(`${added} added`);
|
|
310
|
+
if (updated > 0)
|
|
311
|
+
parts.push(`${updated} updated`);
|
|
312
|
+
if (merged > 0)
|
|
313
|
+
parts.push(`${merged} merged`);
|
|
314
|
+
if (deleted > 0)
|
|
315
|
+
parts.push(`${deleted} deleted`);
|
|
316
|
+
if (failed > 0)
|
|
317
|
+
parts.push(`${failed} failed`);
|
|
318
|
+
return parts.length > 0 ? parts.join(', ') : 'No operations';
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
return '';
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Format find_knowledge_topics tool result summary
|
|
326
|
+
*
|
|
327
|
+
* @param result - Tool result data
|
|
328
|
+
* @returns Formatted summary string or empty
|
|
329
|
+
*/
|
|
330
|
+
formatFindKnowledgeTopicsResult(result) {
|
|
331
|
+
if (typeof result !== 'string') {
|
|
332
|
+
return '';
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
335
|
+
const parsed = JSON.parse(result);
|
|
336
|
+
const count = Array.isArray(parsed) ? parsed.length : Object.keys(parsed).length;
|
|
337
|
+
return `${count} topics retrieved`;
|
|
338
|
+
}
|
|
339
|
+
catch {
|
|
340
|
+
return '';
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Format grep_content tool result summary
|
|
345
|
+
*
|
|
346
|
+
* @param result - Tool result data
|
|
347
|
+
* @returns Formatted summary string or empty
|
|
348
|
+
*/
|
|
349
|
+
formatGrepContentResult(result) {
|
|
350
|
+
if (typeof result !== 'string') {
|
|
351
|
+
return '';
|
|
352
|
+
}
|
|
353
|
+
const lines = result.split('\n').filter((line) => line.trim());
|
|
354
|
+
return `${lines.length} matches found`;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Format list_directory tool result summary
|
|
358
|
+
*
|
|
359
|
+
* @param result - Tool result data
|
|
360
|
+
* @returns Formatted summary string or empty
|
|
361
|
+
*/
|
|
362
|
+
formatListDirectoryResult(result) {
|
|
363
|
+
if (typeof result !== 'string') {
|
|
364
|
+
return '';
|
|
365
|
+
}
|
|
366
|
+
const lines = result.split('\n').filter((line) => line.trim());
|
|
367
|
+
return `${lines.length} items`;
|
|
368
|
+
}
|
|
286
369
|
/**
|
|
287
370
|
* Format tool call for concise display in interactive mode
|
|
288
371
|
*
|
|
@@ -301,6 +384,9 @@ export default class CipherAgentRun extends Command {
|
|
|
301
384
|
case 'create_knowledge_topic': {
|
|
302
385
|
return 'Creating knowledge topic...';
|
|
303
386
|
}
|
|
387
|
+
case 'curate': {
|
|
388
|
+
return 'Curating knowledge topics...';
|
|
389
|
+
}
|
|
304
390
|
case 'find_knowledge_topics': {
|
|
305
391
|
return 'Querying knowledge base...';
|
|
306
392
|
}
|
|
@@ -333,46 +419,22 @@ export default class CipherAgentRun extends Command {
|
|
|
333
419
|
* @returns Formatted summary string or empty if no summary needed
|
|
334
420
|
*/
|
|
335
421
|
formatToolResultSummary(toolName, result) {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
case 'grep_content': {
|
|
353
|
-
// Parse result to count matches
|
|
354
|
-
if (typeof result === 'string') {
|
|
355
|
-
const lines = result.split('\n').filter((line) => line.trim());
|
|
356
|
-
return `${lines.length} matches found`;
|
|
357
|
-
}
|
|
358
|
-
return '';
|
|
359
|
-
}
|
|
360
|
-
case 'list_directory': {
|
|
361
|
-
// Parse result to count items
|
|
362
|
-
if (typeof result === 'string') {
|
|
363
|
-
const lines = result.split('\n').filter((line) => line.trim());
|
|
364
|
-
return `${lines.length} items`;
|
|
365
|
-
}
|
|
366
|
-
return '';
|
|
367
|
-
}
|
|
368
|
-
default: {
|
|
369
|
-
return '';
|
|
370
|
-
}
|
|
422
|
+
switch (toolName) {
|
|
423
|
+
case 'curate': {
|
|
424
|
+
return this.formatCurateResult(result);
|
|
425
|
+
}
|
|
426
|
+
case 'find_knowledge_topics': {
|
|
427
|
+
return this.formatFindKnowledgeTopicsResult(result);
|
|
428
|
+
}
|
|
429
|
+
case 'grep_content': {
|
|
430
|
+
return this.formatGrepContentResult(result);
|
|
431
|
+
}
|
|
432
|
+
case 'list_directory': {
|
|
433
|
+
return this.formatListDirectoryResult(result);
|
|
434
|
+
}
|
|
435
|
+
default: {
|
|
436
|
+
return '';
|
|
371
437
|
}
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
// If parsing fails, just return empty
|
|
375
|
-
return '';
|
|
376
438
|
}
|
|
377
439
|
}
|
|
378
440
|
/**
|
|
@@ -405,7 +467,7 @@ export default class CipherAgentRun extends Command {
|
|
|
405
467
|
exitWithCode(ExitCode.VALIDATION_ERROR, `Session '${flags.resume}' not found. Use 'brv cipher-agent sessions' to see available sessions.`);
|
|
406
468
|
}
|
|
407
469
|
const metadata = await agent.getSessionMetadata(flags.resume);
|
|
408
|
-
this.log(`📌 Resuming session: ${flags.resume} (${metadata?.messageCount ?? 0} messages)\n`);
|
|
470
|
+
this.terminal.log(`📌 Resuming session: ${flags.resume} (${metadata?.messageCount ?? 0} messages)\n`);
|
|
409
471
|
return flags.resume;
|
|
410
472
|
}
|
|
411
473
|
if (flags.continue) {
|
|
@@ -415,12 +477,12 @@ export default class CipherAgentRun extends Command {
|
|
|
415
477
|
exitWithCode(ExitCode.VALIDATION_ERROR, 'No previous sessions found. Start a new conversation without -c flag.');
|
|
416
478
|
}
|
|
417
479
|
const metadata = await agent.getSessionMetadata(mostRecentSessionId);
|
|
418
|
-
this.log(`📌 Continuing most recent session: ${mostRecentSessionId} (${metadata?.messageCount ?? 0} messages)\n`);
|
|
480
|
+
this.terminal.log(`📌 Continuing most recent session: ${mostRecentSessionId} (${metadata?.messageCount ?? 0} messages)\n`);
|
|
419
481
|
return mostRecentSessionId;
|
|
420
482
|
}
|
|
421
483
|
// No continuation flags: generate new unique session ID
|
|
422
484
|
const newSessionId = this.generateSessionId();
|
|
423
|
-
this.log(`🚀 Starting new session: ${newSessionId}\n`);
|
|
485
|
+
this.terminal.log(`🚀 Starting new session: ${newSessionId}\n`);
|
|
424
486
|
return newSessionId;
|
|
425
487
|
}
|
|
426
488
|
/**
|
|
@@ -464,30 +526,30 @@ export default class CipherAgentRun extends Command {
|
|
|
464
526
|
}
|
|
465
527
|
// In non-interactive mode, show verbose event logs for debugging
|
|
466
528
|
eventBus.on('llmservice:thinking', () => {
|
|
467
|
-
this.log('🤔 [Event] LLM is thinking...');
|
|
529
|
+
this.terminal.log('🤔 [Event] LLM is thinking...');
|
|
468
530
|
});
|
|
469
531
|
eventBus.on('llmservice:response', (payload) => {
|
|
470
|
-
this.log(`✅ [Event] LLM Response (${payload.provider}/${payload.model})`);
|
|
532
|
+
this.terminal.log(`✅ [Event] LLM Response (${payload.provider}/${payload.model})`);
|
|
471
533
|
});
|
|
472
534
|
eventBus.on('llmservice:toolCall', (payload) => {
|
|
473
535
|
const formattedCall = formatToolCall(payload.toolName, payload.args);
|
|
474
|
-
this.log(`🔧 [Event] Tool Call: ${formattedCall}`);
|
|
536
|
+
this.terminal.log(`🔧 [Event] Tool Call: ${formattedCall}`);
|
|
475
537
|
});
|
|
476
538
|
eventBus.on('llmservice:toolResult', (payload) => {
|
|
477
539
|
const resultSummary = formatToolResult(payload.toolName, payload.success, payload.result, payload.error);
|
|
478
540
|
if (payload.success) {
|
|
479
|
-
this.log(`✓ [Event] Tool Success: ${payload.toolName} → ${resultSummary}`);
|
|
541
|
+
this.terminal.log(`✓ [Event] Tool Success: ${payload.toolName} → ${resultSummary}`);
|
|
480
542
|
}
|
|
481
543
|
else {
|
|
482
|
-
this.log(`✗ [Event] Tool Error: ${payload.toolName} → ${resultSummary}`);
|
|
544
|
+
this.terminal.log(`✗ [Event] Tool Error: ${payload.toolName} → ${resultSummary}`);
|
|
483
545
|
}
|
|
484
546
|
});
|
|
485
547
|
eventBus.on('llmservice:error', (payload) => {
|
|
486
548
|
const errorMessage = payload.error || 'Unknown error occurred';
|
|
487
|
-
this.log(`❌ [Event] LLM Error: ${errorMessage}`);
|
|
549
|
+
this.terminal.log(`❌ [Event] LLM Error: ${errorMessage}`);
|
|
488
550
|
});
|
|
489
551
|
eventBus.on('cipher:conversationReset', () => {
|
|
490
|
-
this.log('🔄 [Event] Conversation Reset');
|
|
552
|
+
this.terminal.log('🔄 [Event] Conversation Reset');
|
|
491
553
|
});
|
|
492
554
|
}
|
|
493
555
|
}
|