byterover-cli 0.1.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/README.md +781 -0
- package/bin/dev.cmd +4 -0
- package/bin/dev.js +7 -0
- package/bin/run.cmd +4 -0
- package/bin/run.js +7 -0
- package/dist/commands/add.d.ts +60 -0
- package/dist/commands/add.js +230 -0
- package/dist/commands/clear.d.ts +13 -0
- package/dist/commands/clear.js +57 -0
- package/dist/commands/complete.d.ts +108 -0
- package/dist/commands/complete.js +340 -0
- package/dist/commands/gen-rules.d.ts +26 -0
- package/dist/commands/gen-rules.js +89 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.js +135 -0
- package/dist/commands/login.d.ts +22 -0
- package/dist/commands/login.js +103 -0
- package/dist/commands/push.d.ts +33 -0
- package/dist/commands/push.js +150 -0
- package/dist/commands/retrieve.d.ts +26 -0
- package/dist/commands/retrieve.js +101 -0
- package/dist/commands/space/list.d.ts +22 -0
- package/dist/commands/space/list.js +105 -0
- package/dist/commands/space/switch.d.ts +20 -0
- package/dist/commands/space/switch.js +110 -0
- package/dist/commands/status.d.ts +22 -0
- package/dist/commands/status.js +116 -0
- package/dist/config/auth.config.d.ts +32 -0
- package/dist/config/auth.config.js +35 -0
- package/dist/config/environment.d.ts +35 -0
- package/dist/config/environment.js +39 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +12 -0
- package/dist/core/domain/entities/agent.d.ts +5 -0
- package/dist/core/domain/entities/agent.js +23 -0
- package/dist/core/domain/entities/auth-token.d.ts +43 -0
- package/dist/core/domain/entities/auth-token.js +70 -0
- package/dist/core/domain/entities/br-config.d.ts +25 -0
- package/dist/core/domain/entities/br-config.js +58 -0
- package/dist/core/domain/entities/bullet.d.ts +51 -0
- package/dist/core/domain/entities/bullet.js +94 -0
- package/dist/core/domain/entities/curator-output.d.ts +14 -0
- package/dist/core/domain/entities/curator-output.js +23 -0
- package/dist/core/domain/entities/delta-batch.d.ts +30 -0
- package/dist/core/domain/entities/delta-batch.js +52 -0
- package/dist/core/domain/entities/delta-operation.d.ts +31 -0
- package/dist/core/domain/entities/delta-operation.js +50 -0
- package/dist/core/domain/entities/event.d.ts +8 -0
- package/dist/core/domain/entities/event.js +15 -0
- package/dist/core/domain/entities/executor-output.d.ts +27 -0
- package/dist/core/domain/entities/executor-output.js +33 -0
- package/dist/core/domain/entities/memory.d.ts +55 -0
- package/dist/core/domain/entities/memory.js +90 -0
- package/dist/core/domain/entities/oauth-token-data.d.ts +13 -0
- package/dist/core/domain/entities/oauth-token-data.js +20 -0
- package/dist/core/domain/entities/playbook.d.ts +97 -0
- package/dist/core/domain/entities/playbook.js +275 -0
- package/dist/core/domain/entities/presigned-url.d.ts +9 -0
- package/dist/core/domain/entities/presigned-url.js +18 -0
- package/dist/core/domain/entities/presigned-urls-response.d.ts +10 -0
- package/dist/core/domain/entities/presigned-urls-response.js +18 -0
- package/dist/core/domain/entities/reflector-output.d.ts +38 -0
- package/dist/core/domain/entities/reflector-output.js +44 -0
- package/dist/core/domain/entities/retrieve-result.d.ts +35 -0
- package/dist/core/domain/entities/retrieve-result.js +35 -0
- package/dist/core/domain/entities/space.d.ts +24 -0
- package/dist/core/domain/entities/space.js +52 -0
- package/dist/core/domain/entities/team.d.ts +42 -0
- package/dist/core/domain/entities/team.js +89 -0
- package/dist/core/domain/entities/user.d.ts +20 -0
- package/dist/core/domain/entities/user.js +32 -0
- package/dist/core/domain/errors/ace-error.d.ts +34 -0
- package/dist/core/domain/errors/ace-error.js +53 -0
- package/dist/core/domain/errors/auth-error.d.ts +10 -0
- package/dist/core/domain/errors/auth-error.js +20 -0
- package/dist/core/domain/errors/discovery-error.d.ts +21 -0
- package/dist/core/domain/errors/discovery-error.js +33 -0
- package/dist/core/domain/errors/rule-error.d.ts +6 -0
- package/dist/core/domain/errors/rule-error.js +12 -0
- package/dist/core/interfaces/i-ace-prompt-builder.d.ts +48 -0
- package/dist/core/interfaces/i-ace-prompt-builder.js +1 -0
- package/dist/core/interfaces/i-auth-service.d.ts +35 -0
- package/dist/core/interfaces/i-auth-service.js +1 -0
- package/dist/core/interfaces/i-browser-launcher.d.ts +11 -0
- package/dist/core/interfaces/i-browser-launcher.js +1 -0
- package/dist/core/interfaces/i-bullet-content-store.d.ts +36 -0
- package/dist/core/interfaces/i-bullet-content-store.js +1 -0
- package/dist/core/interfaces/i-callback-handler.d.ts +35 -0
- package/dist/core/interfaces/i-callback-handler.js +1 -0
- package/dist/core/interfaces/i-delta-store.d.ts +15 -0
- package/dist/core/interfaces/i-delta-store.js +1 -0
- package/dist/core/interfaces/i-executor-output-store.d.ts +14 -0
- package/dist/core/interfaces/i-executor-output-store.js +1 -0
- package/dist/core/interfaces/i-file-service.d.ts +34 -0
- package/dist/core/interfaces/i-file-service.js +1 -0
- package/dist/core/interfaces/i-http-client.d.ts +33 -0
- package/dist/core/interfaces/i-http-client.js +1 -0
- package/dist/core/interfaces/i-memory-retrieval-service.d.ts +40 -0
- package/dist/core/interfaces/i-memory-retrieval-service.js +1 -0
- package/dist/core/interfaces/i-memory-storage-service.d.ts +55 -0
- package/dist/core/interfaces/i-memory-storage-service.js +1 -0
- package/dist/core/interfaces/i-oidc-discovery-service.d.ts +20 -0
- package/dist/core/interfaces/i-oidc-discovery-service.js +1 -0
- package/dist/core/interfaces/i-playbook-service.d.ts +69 -0
- package/dist/core/interfaces/i-playbook-service.js +1 -0
- package/dist/core/interfaces/i-playbook-store.d.ts +38 -0
- package/dist/core/interfaces/i-playbook-store.js +1 -0
- package/dist/core/interfaces/i-project-config-store.d.ts +26 -0
- package/dist/core/interfaces/i-project-config-store.js +1 -0
- package/dist/core/interfaces/i-reflection-store.d.ts +21 -0
- package/dist/core/interfaces/i-reflection-store.js +1 -0
- package/dist/core/interfaces/i-rule-template-service.d.ts +17 -0
- package/dist/core/interfaces/i-rule-template-service.js +4 -0
- package/dist/core/interfaces/i-rule-writer-service.d.ts +13 -0
- package/dist/core/interfaces/i-rule-writer-service.js +1 -0
- package/dist/core/interfaces/i-space-service.d.ts +28 -0
- package/dist/core/interfaces/i-space-service.js +1 -0
- package/dist/core/interfaces/i-team-service.d.ts +29 -0
- package/dist/core/interfaces/i-team-service.js +1 -0
- package/dist/core/interfaces/i-template-loader.d.ts +29 -0
- package/dist/core/interfaces/i-template-loader.js +1 -0
- package/dist/core/interfaces/i-token-store.d.ts +22 -0
- package/dist/core/interfaces/i-token-store.js +1 -0
- package/dist/core/interfaces/i-tracking-service.d.ts +21 -0
- package/dist/core/interfaces/i-tracking-service.js +1 -0
- package/dist/core/interfaces/i-user-service.d.ts +14 -0
- package/dist/core/interfaces/i-user-service.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/infra/ace/ace-file-utils.d.ts +46 -0
- package/dist/infra/ace/ace-file-utils.js +83 -0
- package/dist/infra/ace/ace-prompt-templates.d.ts +13 -0
- package/dist/infra/ace/ace-prompt-templates.js +177 -0
- package/dist/infra/ace/file-bullet-content-store.d.ts +27 -0
- package/dist/infra/ace/file-bullet-content-store.js +89 -0
- package/dist/infra/ace/file-delta-store.d.ts +9 -0
- package/dist/infra/ace/file-delta-store.js +26 -0
- package/dist/infra/ace/file-executor-output-store.d.ts +9 -0
- package/dist/infra/ace/file-executor-output-store.js +26 -0
- package/dist/infra/ace/file-playbook-store.d.ts +29 -0
- package/dist/infra/ace/file-playbook-store.js +107 -0
- package/dist/infra/ace/file-reflection-store.d.ts +10 -0
- package/dist/infra/ace/file-reflection-store.js +55 -0
- package/dist/infra/auth/oauth-service.d.ts +49 -0
- package/dist/infra/auth/oauth-service.js +126 -0
- package/dist/infra/auth/oidc-discovery-service.d.ts +51 -0
- package/dist/infra/auth/oidc-discovery-service.js +145 -0
- package/dist/infra/browser/system-browser-launcher.d.ts +10 -0
- package/dist/infra/browser/system-browser-launcher.js +18 -0
- package/dist/infra/config/file-config-store.d.ts +21 -0
- package/dist/infra/config/file-config-store.js +57 -0
- package/dist/infra/file/fs-file-service.d.ts +28 -0
- package/dist/infra/file/fs-file-service.js +57 -0
- package/dist/infra/http/authenticated-http-client.d.ts +46 -0
- package/dist/infra/http/authenticated-http-client.js +99 -0
- package/dist/infra/http/callback-handler.d.ts +13 -0
- package/dist/infra/http/callback-handler.js +24 -0
- package/dist/infra/http/callback-server.d.ts +18 -0
- package/dist/infra/http/callback-server.js +93 -0
- package/dist/infra/memory/http-memory-retrieval-service.d.ts +18 -0
- package/dist/infra/memory/http-memory-retrieval-service.js +63 -0
- package/dist/infra/memory/http-memory-storage-service.d.ts +18 -0
- package/dist/infra/memory/http-memory-storage-service.js +67 -0
- package/dist/infra/memory/memory-to-playbook-mapper.d.ts +33 -0
- package/dist/infra/memory/memory-to-playbook-mapper.js +51 -0
- package/dist/infra/playbook/file-playbook-service.d.ts +43 -0
- package/dist/infra/playbook/file-playbook-service.js +133 -0
- package/dist/infra/rule/agent-rule-config.d.ts +19 -0
- package/dist/infra/rule/agent-rule-config.js +77 -0
- package/dist/infra/rule/rule-template-service.d.ts +18 -0
- package/dist/infra/rule/rule-template-service.js +80 -0
- package/dist/infra/rule/rule-writer-service.d.ts +19 -0
- package/dist/infra/rule/rule-writer-service.js +43 -0
- package/dist/infra/space/http-space-service.d.ts +20 -0
- package/dist/infra/space/http-space-service.js +67 -0
- package/dist/infra/storage/keychain-token-store.d.ts +10 -0
- package/dist/infra/storage/keychain-token-store.js +40 -0
- package/dist/infra/team/http-team-service.d.ts +21 -0
- package/dist/infra/team/http-team-service.js +71 -0
- package/dist/infra/template/fs-template-loader.d.ts +33 -0
- package/dist/infra/template/fs-template-loader.js +62 -0
- package/dist/infra/tracking/mixpanel-tracking-service.d.ts +14 -0
- package/dist/infra/tracking/mixpanel-tracking-service.js +44 -0
- package/dist/infra/user/http-user-service.d.ts +12 -0
- package/dist/infra/user/http-user-service.js +26 -0
- package/dist/templates/README.md +103 -0
- package/dist/templates/base.md +3 -0
- package/dist/templates/sections/command-reference.md +141 -0
- package/dist/templates/sections/workflow.md +46 -0
- package/dist/utils/file-helpers.d.ts +15 -0
- package/dist/utils/file-helpers.js +45 -0
- package/oclif.manifest.json +476 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
# ByteRover CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for ByteRover, enabling seamless project management, authentication, and workspace operations directly from your terminal.
|
|
4
|
+
|
|
5
|
+
[](https://oclif.io)
|
|
6
|
+
[](https://npmjs.org/package/byterover-cli)
|
|
7
|
+
[](https://npmjs.org/package/byterover-cli)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
<!-- toc -->
|
|
14
|
+
* [Development Testing](#development-testing)
|
|
15
|
+
* [Installation](#installation)
|
|
16
|
+
* [Quick Start](#quick-start)
|
|
17
|
+
* [Agentic Context Engineering (ACE)](#agentic-context-engineering-ace)
|
|
18
|
+
* [Authentication](#authentication)
|
|
19
|
+
* [Usage](#usage)
|
|
20
|
+
* [Commands](#commands)
|
|
21
|
+
* [Configuration](#configuration)
|
|
22
|
+
* [Development](#development)
|
|
23
|
+
* [Architecture](#architecture)
|
|
24
|
+
<!-- tocstop -->
|
|
25
|
+
|
|
26
|
+
## Development Testing
|
|
27
|
+
|
|
28
|
+
Make sure you're on the `develop` branch.
|
|
29
|
+
|
|
30
|
+
Build:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
In `./bin/run.js`, change `process.env.BR_ENV` to `'development'`.
|
|
37
|
+
|
|
38
|
+
Run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm link
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This will:
|
|
45
|
+
|
|
46
|
+
- Create a **folder symlink** `<npm_global_prefix>/lib/node_modules/<package_name>`
|
|
47
|
+
which points to the **package's directory**.
|
|
48
|
+
- Create a symlink for **the package's bin**
|
|
49
|
+
in
|
|
50
|
+
`<npm_global_prefix>/bin/<package_bin_command_or_package_name>`
|
|
51
|
+
which points to
|
|
52
|
+
`<npm_global_prefix>/lib/node_modules/<package_name>/<path_to_executable>`.
|
|
53
|
+
- Register the package as being globally installed.
|
|
54
|
+
|
|
55
|
+
Once testing is done, the package can be "unlink" by:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm uninstall -g package-name
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
### Requirements
|
|
64
|
+
|
|
65
|
+
- **Node.js**: >= 22.0.0
|
|
66
|
+
- **Operating System**: macOS (keychain integration for secure token storage)
|
|
67
|
+
|
|
68
|
+
### Install globally via npm
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install -g byterover-cli
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Verify installation
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
br --version
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
Get started with ByteRover CLI in three simple steps:
|
|
83
|
+
|
|
84
|
+
### 1. Authenticate
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
br login
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This opens your browser to complete OAuth authentication. Your credentials are securely stored in the system keychain.
|
|
91
|
+
|
|
92
|
+
### 2. Initialize a project
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd your-project-directory
|
|
96
|
+
br init
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Select a workspace from your available spaces and configure your project.
|
|
100
|
+
|
|
101
|
+
### 3. Start using ByteRover
|
|
102
|
+
|
|
103
|
+
You're ready to use ByteRover commands in your project!
|
|
104
|
+
|
|
105
|
+
## Agentic Context Engineering (ACE)
|
|
106
|
+
|
|
107
|
+
**ACE** is a systematic workflow for coding agents (like Claude Code, Cursor, etc.) to capture their work, learn from feedback, and build cumulative knowledge in a living playbook.
|
|
108
|
+
|
|
109
|
+
This implementation is based on the research paper: [**Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models**](https://arxiv.org/abs/2510.04618) by Dang et al., which introduces a framework for language models to iteratively improve their performance through structured context evolution.
|
|
110
|
+
|
|
111
|
+
### Why Use ACE?
|
|
112
|
+
|
|
113
|
+
- **Build Knowledge**: Each task completed by an agent teaches the system
|
|
114
|
+
- **Learn from Experience**: Capture both successes and failures as insights
|
|
115
|
+
- **Context Persistence**: Maintain project-specific best practices that improve over time
|
|
116
|
+
- **Traceability**: Track what worked, what didn't, and why
|
|
117
|
+
|
|
118
|
+
### The ACE Workflow
|
|
119
|
+
|
|
120
|
+
ACE follows a 3-phase cycle:
|
|
121
|
+
|
|
122
|
+
1. **Executor** - Agent performs coding task and saves output with detailed context
|
|
123
|
+
2. **Reflector** - Agent analyzes results and provides honest feedback
|
|
124
|
+
3. **Curator** - Agent transforms insights into playbook updates (automatically applied)
|
|
125
|
+
|
|
126
|
+
### Quick ACE Example
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Complete ACE workflow in a single command
|
|
130
|
+
br complete "auth-feature" \
|
|
131
|
+
"Implemented JWT authentication with secure token handling" \
|
|
132
|
+
"Successfully added OAuth2 authentication" \
|
|
133
|
+
--tool-usage "Read:src/auth.ts,Edit:src/auth.ts,Bash:npm test" \
|
|
134
|
+
--feedback "All tests passed, auth works correctly"
|
|
135
|
+
|
|
136
|
+
# Update an existing playbook bullet
|
|
137
|
+
br complete "auth-update" \
|
|
138
|
+
"Improved error handling in auth flow" \
|
|
139
|
+
"Better error messages for failed login" \
|
|
140
|
+
--tool-usage "Edit:src/auth.ts" \
|
|
141
|
+
--feedback "Tests passed" \
|
|
142
|
+
--update-bullet "bullet-5"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### For Coding Agents
|
|
146
|
+
|
|
147
|
+
**📘 Complete ACE Guide**: See [rules](./src/templates/README.md) for comprehensive instructions on using ACE in your development workflow.
|
|
148
|
+
|
|
149
|
+
`br gen-rules` (integrated into `br init`) helps users quickly set up their coding agents with the ACE workflow.
|
|
150
|
+
|
|
151
|
+
### ACE Commands
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Complete ACE workflow (executor + reflector + curator in one command)
|
|
155
|
+
br complete <hint> <reasoning> <answer> \
|
|
156
|
+
--tool-usage <tools> \
|
|
157
|
+
--feedback <feedback> \
|
|
158
|
+
[--bullet-ids <ids>] \
|
|
159
|
+
[--update-bullet <id>] # Complete workflow: save, reflect, and update playbook
|
|
160
|
+
|
|
161
|
+
# Direct playbook manipulation (bypasses ACE workflow)
|
|
162
|
+
br add -s "Section" -c "Content" # Add new bullet (auto-generates ID)
|
|
163
|
+
br add -s "Section" -c "Updated" -b "bullet-id" # Update existing bullet
|
|
164
|
+
|
|
165
|
+
# Memory operations
|
|
166
|
+
br push [--branch name] # Push playbook to blob storage and cleanup local files
|
|
167
|
+
br retrieve --query <text> [--node-keys <paths>] # Retrieve memories from ByteRover and load into playbook
|
|
168
|
+
|
|
169
|
+
# Utility commands
|
|
170
|
+
br status # View CLI status and playbook statistics
|
|
171
|
+
br clear [--yes] # Reset playbook
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Quick Add Command
|
|
175
|
+
|
|
176
|
+
For agents that need to quickly add context without the full ACE workflow:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# 1. First, check the current playbook
|
|
180
|
+
br show
|
|
181
|
+
|
|
182
|
+
# 2. Add a new bullet to an existing or new section
|
|
183
|
+
br add -s "Common Errors" -c "Always validate API responses before processing"
|
|
184
|
+
|
|
185
|
+
# 3. Update an existing bullet (use ID from br show)
|
|
186
|
+
br add -s "Common Errors" -c "Updated content" -b "common-00001"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
The `add` command automatically tags bullets with `['manual']` and is ideal for quick knowledge capture during development.
|
|
190
|
+
|
|
191
|
+
### Memory Push
|
|
192
|
+
|
|
193
|
+
The `br push` command uploads your playbook to ByteRover's memory storage (blob storage) and automatically cleans up local ACE files. This is useful when you want to:
|
|
194
|
+
|
|
195
|
+
- **Share playbook knowledge** with other team members or agents
|
|
196
|
+
- **Archive completed work** to cloud storage
|
|
197
|
+
- **Reset local state** after pushing insights to the system
|
|
198
|
+
- **Free up local storage** by removing processed ACE outputs
|
|
199
|
+
|
|
200
|
+
#### Usage
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Push to default branch (main)
|
|
204
|
+
br push
|
|
205
|
+
|
|
206
|
+
# Push to a specific branch
|
|
207
|
+
br push --branch develop
|
|
208
|
+
br push -b feature-auth
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### What Gets Pushed
|
|
212
|
+
|
|
213
|
+
- `.br/ace/playbook.json` - Your accumulated knowledge base
|
|
214
|
+
|
|
215
|
+
#### What Gets Cleaned Up (After Successful Push)
|
|
216
|
+
|
|
217
|
+
After successfully uploading to blob storage, the command automatically:
|
|
218
|
+
|
|
219
|
+
1. **Clears playbook content** - Resets to empty playbook (file remains, content cleared)
|
|
220
|
+
2. **Removes executor outputs** - Deletes all files in `.br/ace/executor-outputs/`
|
|
221
|
+
3. **Removes reflections** - Deletes all files in `.br/ace/reflections/`
|
|
222
|
+
4. **Removes deltas** - Deletes all files in `.br/ace/deltas/`
|
|
223
|
+
|
|
224
|
+
**Note**: Cleanup only happens after successful upload. If the upload fails, your local files remain unchanged.
|
|
225
|
+
|
|
226
|
+
#### Example Output
|
|
227
|
+
|
|
228
|
+
```text
|
|
229
|
+
Requesting upload URLs... done
|
|
230
|
+
Loading playbook... done
|
|
231
|
+
|
|
232
|
+
Uploading files...
|
|
233
|
+
Uploading playbook.json... ✓
|
|
234
|
+
|
|
235
|
+
Cleaning up local files...
|
|
236
|
+
Clearing playbook... ✓
|
|
237
|
+
Cleaning executor outputs... ✓ (3 files removed)
|
|
238
|
+
Cleaning reflections... ✓ (2 files removed)
|
|
239
|
+
Cleaning deltas... ✓ (5 files removed)
|
|
240
|
+
|
|
241
|
+
✓ Successfully pushed playbook to ByteRover memory storage!
|
|
242
|
+
Branch: main
|
|
243
|
+
Files uploaded: 1
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Branches
|
|
247
|
+
|
|
248
|
+
The `--branch` parameter refers to **ByteRover's internal branching system**, not Git branches. This allows you to organize different versions of your playbook in blob storage (e.g., `main`, `develop`, `experimental`).
|
|
249
|
+
|
|
250
|
+
### File Organization
|
|
251
|
+
|
|
252
|
+
ACE stores all outputs in `.br/ace/` with hint-based naming for traceability:
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
.br/ace/
|
|
256
|
+
├── playbook.json # Living knowledge base
|
|
257
|
+
├── executor-outputs/
|
|
258
|
+
│ └── executor-{hint}-{timestamp}.json # Your coding work
|
|
259
|
+
├── reflections/
|
|
260
|
+
│ └── reflection-{hint}-{timestamp}.json # Analysis and feedback
|
|
261
|
+
└── deltas/
|
|
262
|
+
└── delta-{hint}-{timestamp}.json # Playbook updates
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Note**: When you run `br push`, all files in `executor-outputs/`, `reflections/`, and `deltas/` are removed after successful upload. The `playbook.json` is cleared (reset to empty). This keeps your local workspace clean while preserving your knowledge in ByteRover's blob storage.
|
|
266
|
+
|
|
267
|
+
### Memory Retrieve
|
|
268
|
+
|
|
269
|
+
The `br retrieve` command fetches memories from ByteRover's Memora service and loads them to `stdout` as parts of the coding agents' current context. This is useful when you want to:
|
|
270
|
+
|
|
271
|
+
- **Access team knowledge** - Retrieve insights and best practices shared by your team
|
|
272
|
+
- **Find relevant context** - Search for specific topics or code patterns
|
|
273
|
+
- **Filter by files** - Narrow results to specific file paths using `--node-keys`
|
|
274
|
+
- **Start with knowledge** - Begin work with relevant memories already in your playbook
|
|
275
|
+
|
|
276
|
+
#### Retrieve Usage
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Retrieve memories by query
|
|
280
|
+
br retrieve --query "authentication best practices"
|
|
281
|
+
|
|
282
|
+
# Retrieve with file path filtering
|
|
283
|
+
br retrieve -q "error handling" -n "src/auth/login.ts,src/auth/oauth.ts"
|
|
284
|
+
|
|
285
|
+
# Short form
|
|
286
|
+
br retrieve -q "database connection issues"
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### How Retrieve Works
|
|
290
|
+
|
|
291
|
+
1. **Searches** ByteRover's memory storage for matches to your query
|
|
292
|
+
2. **Filters** results by node keys (file paths) if specified
|
|
293
|
+
3. **Clears** your existing local playbook
|
|
294
|
+
4. **Loads** retrieved memories and related memories into `stdout`.
|
|
295
|
+
|
|
296
|
+
## Authentication
|
|
297
|
+
|
|
298
|
+
ByteRover CLI uses **OAuth 2.0 with PKCE** (Proof Key for Code Exchange) for secure authentication:
|
|
299
|
+
|
|
300
|
+
### How it works
|
|
301
|
+
|
|
302
|
+
1. Run `br login` to initiate authentication
|
|
303
|
+
2. A local callback server starts on a random port
|
|
304
|
+
3. Your default browser opens to the ByteRover authorization page
|
|
305
|
+
4. After successful authentication, tokens are securely stored in your system keychain
|
|
306
|
+
5. All subsequent commands automatically use your stored credentials
|
|
307
|
+
|
|
308
|
+
### Security features
|
|
309
|
+
|
|
310
|
+
- **PKCE flow**: Prevents authorization code interception attacks
|
|
311
|
+
- **System keychain**: Tokens stored using native OS secure storage (macOS Keychain)
|
|
312
|
+
- **Session tracking**: Each authentication session includes a session key for request tracking
|
|
313
|
+
- **Auto-refresh**: Refresh tokens enable seamless credential renewal
|
|
314
|
+
|
|
315
|
+
### Environment-aware
|
|
316
|
+
|
|
317
|
+
The CLI supports separate development and production environments:
|
|
318
|
+
|
|
319
|
+
- **Development**: Uses `./bin/dev.js` and points to dev authentication servers
|
|
320
|
+
- **Production**: Uses `./bin/run.js` and points to production servers
|
|
321
|
+
|
|
322
|
+
### Token storage
|
|
323
|
+
|
|
324
|
+
After authentication, the CLI stores:
|
|
325
|
+
|
|
326
|
+
- **Access token**: For API authorization (`Authorization: Bearer {token}`)
|
|
327
|
+
- **Refresh token**: For obtaining new access tokens
|
|
328
|
+
- **Session key**: For request tracking (`x-byterover-session-id` header)
|
|
329
|
+
- **Expiration time**: For automatic token refresh
|
|
330
|
+
|
|
331
|
+
All tokens are stored in your system keychain via the `keytar` library.
|
|
332
|
+
|
|
333
|
+
## Usage
|
|
334
|
+
|
|
335
|
+
```sh-session
|
|
336
|
+
$ npm install -g byterover-cli
|
|
337
|
+
$ br COMMAND
|
|
338
|
+
running command...
|
|
339
|
+
$ br (--version)
|
|
340
|
+
byterover-cli/0.0.0 darwin-arm64 node-v22.19.0
|
|
341
|
+
$ br --help [COMMAND]
|
|
342
|
+
USAGE
|
|
343
|
+
$ br COMMAND
|
|
344
|
+
...
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Commands
|
|
348
|
+
|
|
349
|
+
* [`br add`](#br-add)
|
|
350
|
+
* [`br clear`](#br-clear)
|
|
351
|
+
* [`br complete`](#br-complete)
|
|
352
|
+
* [`br gen-rules`](#br-gen-rules)
|
|
353
|
+
* [`br help [COMMAND]`](#br-help-command)
|
|
354
|
+
* [`br init`](#br-init)
|
|
355
|
+
* [`br login`](#br-login)
|
|
356
|
+
* [`br push`](#br-push)
|
|
357
|
+
* [`br retrieve`](#br-retrieve)
|
|
358
|
+
* [`br space list`](#br-space-list)
|
|
359
|
+
* [`br space switch`](#br-space-switch)
|
|
360
|
+
* [`br status`](#br-status)
|
|
361
|
+
|
|
362
|
+
## `br add`
|
|
363
|
+
|
|
364
|
+
Add or update a bullet in the playbook (bypasses ACE workflow for direct agent usage)
|
|
365
|
+
|
|
366
|
+
```txt
|
|
367
|
+
USAGE
|
|
368
|
+
$ br add -c <value> -s <value> [-b <value>]
|
|
369
|
+
|
|
370
|
+
FLAGS
|
|
371
|
+
-b, --bullet-id=<value> Bullet ID to update (if not provided, a new bullet will be created)
|
|
372
|
+
-c, --content=<value> (required) Content of the bullet
|
|
373
|
+
-s, --section=<value> (required) Section name for the bullet
|
|
374
|
+
|
|
375
|
+
DESCRIPTION
|
|
376
|
+
Add or update a bullet in the playbook (bypasses ACE workflow for direct agent usage)
|
|
377
|
+
|
|
378
|
+
This command allows agents to directly manipulate the playbook without going through
|
|
379
|
+
the full ACE workflow (executor → reflector → curator → apply-delta). Use this for
|
|
380
|
+
quick knowledge capture during development.
|
|
381
|
+
|
|
382
|
+
Before using this command, run 'br show' to view existing sections and bullet IDs.
|
|
383
|
+
|
|
384
|
+
EXAMPLES
|
|
385
|
+
$ br add --section "Common Errors" --content "Always validate API responses"
|
|
386
|
+
|
|
387
|
+
$ br add --section "Common Errors" --bullet-id "common-00001" --content "Updated: Validate and sanitize API responses"
|
|
388
|
+
|
|
389
|
+
$ br add -s "Best Practices" -c "Use dependency injection for better testability"
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## `br clear`
|
|
393
|
+
|
|
394
|
+
Clear local ACE context (playbook) managed by ByteRover CLI
|
|
395
|
+
|
|
396
|
+
```txt
|
|
397
|
+
USAGE
|
|
398
|
+
$ br clear [DIRECTORY] [-y]
|
|
399
|
+
|
|
400
|
+
ARGUMENTS
|
|
401
|
+
DIRECTORY Project directory (defaults to current directory)
|
|
402
|
+
|
|
403
|
+
FLAGS
|
|
404
|
+
-y, --yes Skip confirmation prompt
|
|
405
|
+
|
|
406
|
+
DESCRIPTION
|
|
407
|
+
Clear local ACE context (playbook) managed by ByteRover CLI
|
|
408
|
+
|
|
409
|
+
EXAMPLES
|
|
410
|
+
$ br clear
|
|
411
|
+
|
|
412
|
+
$ br clear --yes
|
|
413
|
+
|
|
414
|
+
$ br clear /path/to/project
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## `br complete`
|
|
418
|
+
|
|
419
|
+
Complete ACE workflow: save executor output, generate reflection, and update playbook in one command
|
|
420
|
+
|
|
421
|
+
```txt
|
|
422
|
+
USAGE
|
|
423
|
+
$ br complete HINT REASONING FINALANSWER -t <value> -f <value> [-b <value>] [-u <value>]
|
|
424
|
+
|
|
425
|
+
ARGUMENTS
|
|
426
|
+
HINT Short hint for naming output files (e.g., "user-auth", "bug-fix")
|
|
427
|
+
REASONING Detailed reasoning and approach for completing the task
|
|
428
|
+
FINALANSWER The final answer/solution to the task
|
|
429
|
+
|
|
430
|
+
FLAGS
|
|
431
|
+
-b, --bullet-ids=<value> Comma-separated list of playbook bullet IDs referenced
|
|
432
|
+
-f, --feedback=<value> (required) Environment feedback about task execution (e.g., "Tests passed", "Build failed")
|
|
433
|
+
-t, --tool-usage=<value> (required) Comma-separated list of tool calls with arguments (format: "ToolName:argument", e.g., "Read:src/file.ts,Bash:npm test")
|
|
434
|
+
-u, --update-bullet=<value> Bullet ID to update with new knowledge (if not provided, adds new bullet)
|
|
435
|
+
|
|
436
|
+
DESCRIPTION
|
|
437
|
+
Complete ACE workflow: save executor output, generate reflection, and update playbook in one command
|
|
438
|
+
|
|
439
|
+
This command executes the full ACE (Agentic Context Engineering) workflow in a single step:
|
|
440
|
+
1. Executor phase: Saves your task output with detailed context
|
|
441
|
+
2. Reflector phase: Analyzes results and generates reflection
|
|
442
|
+
3. Curator phase: Updates the playbook with new knowledge
|
|
443
|
+
|
|
444
|
+
EXAMPLES
|
|
445
|
+
$ br complete "user-auth" "Implemented OAuth2 flow" "Auth works" --tool-usage "Read:src/auth.ts,Edit:src/auth.ts,Bash:npm test" --feedback "All tests passed"
|
|
446
|
+
|
|
447
|
+
$ br complete "validation-fix" "Analyzed validator" "Fixed bug" --tool-usage "Grep:pattern:\"validate\",Read:src/validator.ts" --bullet-ids "bullet-123" --feedback "Tests passed"
|
|
448
|
+
|
|
449
|
+
$ br complete "auth-update" "Improved error handling" "Better errors" --tool-usage "Edit:src/auth.ts" --feedback "Tests passed" --update-bullet "bullet-5"
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## `br gen-rules`
|
|
453
|
+
|
|
454
|
+
Generate rule instructions for coding agents to work with ByteRover correctly
|
|
455
|
+
|
|
456
|
+
```txt
|
|
457
|
+
USAGE
|
|
458
|
+
$ br gen-rules
|
|
459
|
+
|
|
460
|
+
DESCRIPTION
|
|
461
|
+
Generate rule instructions for coding agents to work with ByteRover correctly
|
|
462
|
+
|
|
463
|
+
This command generates agent-specific rule files that provide instructions for coding agents
|
|
464
|
+
(like Claude Code, Cursor, Aider, etc.) to work correctly with ByteRover CLI and the ACE workflow.
|
|
465
|
+
|
|
466
|
+
EXAMPLES
|
|
467
|
+
$ br gen-rules
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
## `br login`
|
|
471
|
+
|
|
472
|
+
Authenticate with ByteRover
|
|
473
|
+
|
|
474
|
+
```txt
|
|
475
|
+
USAGE
|
|
476
|
+
$ br login
|
|
477
|
+
|
|
478
|
+
DESCRIPTION
|
|
479
|
+
Authenticate with ByteRover
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
## `br help [COMMAND]`
|
|
483
|
+
|
|
484
|
+
Display help for br.
|
|
485
|
+
|
|
486
|
+
```txt
|
|
487
|
+
USAGE
|
|
488
|
+
$ br help [COMMAND...] [-n]
|
|
489
|
+
|
|
490
|
+
ARGUMENTS
|
|
491
|
+
COMMAND... Command to show help for.
|
|
492
|
+
|
|
493
|
+
FLAGS
|
|
494
|
+
-n, --nested-commands Include all nested commands in the output.
|
|
495
|
+
|
|
496
|
+
DESCRIPTION
|
|
497
|
+
Display help for br.
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
## `br init`
|
|
501
|
+
|
|
502
|
+
Initialize a project with ByteRover
|
|
503
|
+
|
|
504
|
+
```txt
|
|
505
|
+
USAGE
|
|
506
|
+
$ br init
|
|
507
|
+
|
|
508
|
+
DESCRIPTION
|
|
509
|
+
Initialize a project with ByteRover
|
|
510
|
+
|
|
511
|
+
EXAMPLES
|
|
512
|
+
$ br init
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## `br push`
|
|
516
|
+
|
|
517
|
+
Push playbook to ByteRover memory storage and clean up local ACE files
|
|
518
|
+
|
|
519
|
+
```txt
|
|
520
|
+
USAGE
|
|
521
|
+
$ br push [-b <value>]
|
|
522
|
+
|
|
523
|
+
FLAGS
|
|
524
|
+
-b, --branch=<value> [default: main] ByteRover branch name (not Git branch)
|
|
525
|
+
|
|
526
|
+
DESCRIPTION
|
|
527
|
+
Push playbook to ByteRover memory storage and clean up local ACE files
|
|
528
|
+
|
|
529
|
+
This command uploads your playbook to ByteRover's memory storage and automatically cleans up
|
|
530
|
+
local ACE files after successful upload. The cleanup includes:
|
|
531
|
+
- Clearing playbook content
|
|
532
|
+
- Removing executor outputs
|
|
533
|
+
- Removing reflections
|
|
534
|
+
- Removing deltas
|
|
535
|
+
|
|
536
|
+
EXAMPLES
|
|
537
|
+
$ br push
|
|
538
|
+
|
|
539
|
+
$ br push --branch develop
|
|
540
|
+
|
|
541
|
+
$ br push -b feature-auth
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
## `br retrieve`
|
|
545
|
+
|
|
546
|
+
Retrieve memories from ByteRover Memora service and output as JSON
|
|
547
|
+
|
|
548
|
+
```txt
|
|
549
|
+
USAGE
|
|
550
|
+
$ br retrieve -q <value> [-n <value>] [--compact]
|
|
551
|
+
|
|
552
|
+
FLAGS
|
|
553
|
+
-n, --node-keys=<value> Comma-separated list of node keys (file paths) to filter results
|
|
554
|
+
-q, --query=<value> (required) Search query string
|
|
555
|
+
--compact Output compact JSON (single line)
|
|
556
|
+
|
|
557
|
+
DESCRIPTION
|
|
558
|
+
Retrieve memories from ByteRover Memora service and output as JSON
|
|
559
|
+
|
|
560
|
+
This command fetches memories from ByteRover's memory storage based on your query.
|
|
561
|
+
You can optionally filter results by specific file paths using the --node-keys flag.
|
|
562
|
+
|
|
563
|
+
EXAMPLES
|
|
564
|
+
$ br retrieve --query "authentication best practices"
|
|
565
|
+
|
|
566
|
+
$ br retrieve -q "error handling" -n "src/auth/login.ts,src/auth/oauth.ts"
|
|
567
|
+
|
|
568
|
+
$ br retrieve -q "database connection issues" --compact
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
## `br status`
|
|
572
|
+
|
|
573
|
+
Show CLI status and project information
|
|
574
|
+
|
|
575
|
+
```txt
|
|
576
|
+
USAGE
|
|
577
|
+
$ br status
|
|
578
|
+
|
|
579
|
+
DESCRIPTION
|
|
580
|
+
Show CLI status and project information
|
|
581
|
+
|
|
582
|
+
Displays comprehensive information about your ByteRover CLI setup including:
|
|
583
|
+
- CLI version
|
|
584
|
+
- Authentication status (with user email if logged in)
|
|
585
|
+
- Current working directory
|
|
586
|
+
- Project initialization status (with connected space if initialized)
|
|
587
|
+
|
|
588
|
+
EXAMPLES
|
|
589
|
+
$ br status
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
## `br space list`
|
|
593
|
+
|
|
594
|
+
List all spaces for the current team (requires project initialization)
|
|
595
|
+
|
|
596
|
+
```txt
|
|
597
|
+
USAGE
|
|
598
|
+
$ br space list [-a] [-j] [-l <value>] [-o <value>]
|
|
599
|
+
|
|
600
|
+
FLAGS
|
|
601
|
+
-a, --all Fetch all spaces (may be slow for large teams)
|
|
602
|
+
-j, --json Output in JSON format
|
|
603
|
+
-l, --limit=<value> [default: 50] Maximum number of spaces to fetch
|
|
604
|
+
-o, --offset=<value> [default: 0] Number of spaces to skip
|
|
605
|
+
|
|
606
|
+
DESCRIPTION
|
|
607
|
+
List all spaces for the current team (requires project initialization)
|
|
608
|
+
|
|
609
|
+
This command lists all available spaces in the current team. By default, it shows 50 spaces.
|
|
610
|
+
Use --all to fetch all spaces or use --limit and --offset for manual pagination.
|
|
611
|
+
|
|
612
|
+
EXAMPLES
|
|
613
|
+
$ br space list
|
|
614
|
+
|
|
615
|
+
$ br space list --all
|
|
616
|
+
|
|
617
|
+
$ br space list --limit 10
|
|
618
|
+
|
|
619
|
+
$ br space list --limit 10 --offset 20
|
|
620
|
+
|
|
621
|
+
$ br space list --json
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
## `br space switch`
|
|
625
|
+
|
|
626
|
+
Switch to a different team or space (updates .br/config.json)
|
|
627
|
+
|
|
628
|
+
```txt
|
|
629
|
+
USAGE
|
|
630
|
+
$ br space switch
|
|
631
|
+
|
|
632
|
+
DESCRIPTION
|
|
633
|
+
Switch to a different team or space (updates .br/config.json)
|
|
634
|
+
|
|
635
|
+
This command allows you to switch your project to a different team or space.
|
|
636
|
+
It shows your current configuration, then prompts you to select a new team and space.
|
|
637
|
+
The configuration is updated in .br/config.json.
|
|
638
|
+
|
|
639
|
+
EXAMPLES
|
|
640
|
+
$ br space switch
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
## Configuration
|
|
644
|
+
|
|
645
|
+
### Environment Configuration
|
|
646
|
+
|
|
647
|
+
ByteRover CLI supports runtime environment selection:
|
|
648
|
+
|
|
649
|
+
* **Development Environment** (`./bin/dev.js`)
|
|
650
|
+
* Issuer URL: `https://dev-beta-iam.byterover.dev/api/v1/oidc`
|
|
651
|
+
* Client ID: `byterover-cli-client`
|
|
652
|
+
* Scopes: `read`, `write`, `debug`
|
|
653
|
+
|
|
654
|
+
* **Production Environment** (`./bin/run.js`)
|
|
655
|
+
* Issuer URL: `https://prod-beta-iam.byterover.dev/api/v1/oidc`
|
|
656
|
+
* Client ID: `byterover-cli-prod`
|
|
657
|
+
* Scopes: `read`, `write`
|
|
658
|
+
|
|
659
|
+
The environment is automatically set when you run the CLI:
|
|
660
|
+
|
|
661
|
+
```bash
|
|
662
|
+
# Development mode
|
|
663
|
+
./bin/dev.js [command]
|
|
664
|
+
|
|
665
|
+
# Production mode (installed globally)
|
|
666
|
+
br [command]
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### Environment Variables
|
|
670
|
+
|
|
671
|
+
* **BR_ENV** - Runtime environment (`development` | `production`) - automatically set by launcher scripts
|
|
672
|
+
|
|
673
|
+
### Project Configuration
|
|
674
|
+
|
|
675
|
+
When you run `br init`, a configuration file is created at `.byterover/config.json` in your project directory. This file contains:
|
|
676
|
+
|
|
677
|
+
* **Space ID**: The ByteRover workspace/space associated with this project
|
|
678
|
+
* **Project settings**: Project-specific configuration
|
|
679
|
+
* **User's information**: User's ID and user's email.
|
|
680
|
+
|
|
681
|
+
## Development
|
|
682
|
+
|
|
683
|
+
### Clone and Setup
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
git clone https://github.com/campfirein/byterover-cli.git
|
|
687
|
+
cd byterover-cli
|
|
688
|
+
npm install
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
### Build
|
|
692
|
+
|
|
693
|
+
```bash
|
|
694
|
+
npm run build
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
Compiles TypeScript to JavaScript in the `dist/` directory.
|
|
698
|
+
|
|
699
|
+
### Test
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
# Run all tests
|
|
703
|
+
npm test
|
|
704
|
+
|
|
705
|
+
# Run a specific test file
|
|
706
|
+
npx mocha --forbid-only "test/path/to/file.test.ts"
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
Tests use Mocha + Chai and are organized in `test/` with subdirectories:
|
|
710
|
+
|
|
711
|
+
* `test/commands/` - Command integration tests
|
|
712
|
+
* `test/unit/` - Unit tests mirroring `src/` structure
|
|
713
|
+
* `test/learning/` - Learning/exploration tests
|
|
714
|
+
|
|
715
|
+
### Lint
|
|
716
|
+
|
|
717
|
+
```bash
|
|
718
|
+
npm run lint
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
Runs ESLint with oclif and prettier configurations.
|
|
722
|
+
|
|
723
|
+
### Run Locally
|
|
724
|
+
|
|
725
|
+
```bash
|
|
726
|
+
# Development mode (uses ts-node, points to dev environment)
|
|
727
|
+
./bin/dev.js [command]
|
|
728
|
+
|
|
729
|
+
# Production mode (uses compiled dist/, points to prod environment)
|
|
730
|
+
./bin/run.js [command]
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
### Create New Command
|
|
734
|
+
|
|
735
|
+
```bash
|
|
736
|
+
npx oclif generate command
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
### Distribution
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
# Create development tarball
|
|
743
|
+
npm run pack:dev
|
|
744
|
+
|
|
745
|
+
# Create production tarball
|
|
746
|
+
npm run pack:prod
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
## Architecture
|
|
750
|
+
|
|
751
|
+
ByteRover CLI follows **Clean Architecture** principles with a clear separation of concerns:
|
|
752
|
+
|
|
753
|
+
### Layers
|
|
754
|
+
|
|
755
|
+
* **Core Layer** (`src/core/`) - Domain logic independent of frameworks
|
|
756
|
+
* `domain/entities/` - Business entities with validation and behavior
|
|
757
|
+
* `domain/errors/` - Domain-specific error types
|
|
758
|
+
* `interfaces/` - Port definitions (dependency inversion)
|
|
759
|
+
|
|
760
|
+
* **Infrastructure Layer** (`src/infra/`) - Concrete implementations using external dependencies
|
|
761
|
+
* `auth/` - OAuth 2.0 + PKCE implementation
|
|
762
|
+
* `http/` - HTTP clients and callback servers
|
|
763
|
+
* `storage/` - Keychain token storage
|
|
764
|
+
* `space/` - Space/workspace service implementations
|
|
765
|
+
|
|
766
|
+
* **Application Layer** (`src/commands/`) - oclif command definitions
|
|
767
|
+
|
|
768
|
+
### Key Technologies
|
|
769
|
+
|
|
770
|
+
* **[oclif](https://oclif.io) v4** - CLI framework with plugin system
|
|
771
|
+
* **TypeScript** - Strict mode, ES2022 target, Node16 modules
|
|
772
|
+
* **axios** - HTTP client for OAuth and API operations
|
|
773
|
+
* **express** - Local callback server for OAuth flows
|
|
774
|
+
* **keytar** - Secure system keychain access
|
|
775
|
+
* **Mocha + Chai** - Testing framework
|
|
776
|
+
|
|
777
|
+
### Detailed Documentation
|
|
778
|
+
|
|
779
|
+
For comprehensive architecture documentation, design patterns, and development guidelines, see [CLAUDE.md](CLAUDE.md).
|
|
780
|
+
|
|
781
|
+
Copyright (c) ByteRover
|