byterover-cli 0.1.0 → 0.1.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 +93 -648
- package/dist/commands/add.d.ts +4 -15
- package/dist/commands/add.js +31 -69
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.js +32 -2
- package/dist/commands/status.js +1 -2
- package/dist/config/environment.js +8 -8
- package/dist/core/domain/entities/playbook.d.ts +4 -0
- package/dist/core/domain/entities/playbook.js +7 -0
- package/oclif.manifest.json +8 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,69 +1,35 @@
|
|
|
1
1
|
# ByteRover CLI
|
|
2
2
|
|
|
3
|
-
Command-line interface for ByteRover, enabling seamless
|
|
3
|
+
Command-line interface for ByteRover, enabling seamless team/space management, authentication, and space's memory operations directly from your terminal.
|
|
4
4
|
|
|
5
|
-
[](https://oclif.io)
|
|
6
5
|
[](https://npmjs.org/package/byterover-cli)
|
|
7
6
|
[](https://npmjs.org/package/byterover-cli)
|
|
8
|
-
[](https://nodejs.org)
|
|
7
|
+
[](https://nodejs.org)
|
|
10
8
|
|
|
11
9
|
## Table of Contents
|
|
12
10
|
|
|
13
|
-
<!-- toc -->
|
|
14
|
-
* [Development Testing](#development-testing)
|
|
15
11
|
* [Installation](#installation)
|
|
16
12
|
* [Quick Start](#quick-start)
|
|
17
|
-
* [
|
|
13
|
+
* [What is ACE?](#what-is-ace)
|
|
14
|
+
* [Core Workflow](#core-workflow)
|
|
15
|
+
* [Essential Commands](#essential-commands)
|
|
18
16
|
* [Authentication](#authentication)
|
|
19
|
-
* [Usage](#usage)
|
|
20
|
-
* [Commands](#commands)
|
|
21
17
|
* [Configuration](#configuration)
|
|
22
|
-
* [
|
|
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
|
-
```
|
|
18
|
+
* [Getting Help](#getting-help)
|
|
60
19
|
|
|
61
20
|
## Installation
|
|
62
21
|
|
|
63
22
|
### Requirements
|
|
64
23
|
|
|
65
|
-
- **Node.js**: >=
|
|
66
|
-
- **Operating System**:
|
|
24
|
+
- **Node.js**: >= 18.0.0
|
|
25
|
+
- **Operating System**:
|
|
26
|
+
- macOS
|
|
27
|
+
- Windows
|
|
28
|
+
- Linux
|
|
29
|
+
- Currently this CLI uses `libsecret`. Depending on your distribution, you will need to run the following command:
|
|
30
|
+
- Debian/Ubuntu: `sudo apt-get install libsecret-1-dev`
|
|
31
|
+
- Red Hat-based: `sudo yum install libsecret-devel`
|
|
32
|
+
- Arch Linux: `sudo pacman -S libsecret`
|
|
67
33
|
|
|
68
34
|
### Install globally via npm
|
|
69
35
|
|
|
@@ -96,17 +62,17 @@ cd your-project-directory
|
|
|
96
62
|
br init
|
|
97
63
|
```
|
|
98
64
|
|
|
99
|
-
Select a
|
|
65
|
+
Select a space from your available spaces and configure your project.
|
|
100
66
|
|
|
101
67
|
### 3. Start using ByteRover
|
|
102
68
|
|
|
103
69
|
You're ready to use ByteRover commands in your project!
|
|
104
70
|
|
|
105
|
-
##
|
|
71
|
+
## What is ACE?
|
|
106
72
|
|
|
107
|
-
**ACE** is a systematic workflow
|
|
73
|
+
**Agentic Context Engineering (ACE)** is a systematic workflow that helps coding agents (like Claude Code, Cursor, etc.) capture their work, learn from feedback, and build cumulative knowledge in a living playbook.
|
|
108
74
|
|
|
109
|
-
|
|
75
|
+
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., ACE enables language models to iteratively improve their performance through structured context evolution.
|
|
110
76
|
|
|
111
77
|
### Why Use ACE?
|
|
112
78
|
|
|
@@ -115,15 +81,22 @@ This implementation is based on the research paper: [**Agentic Context Engineeri
|
|
|
115
81
|
- **Context Persistence**: Maintain project-specific best practices that improve over time
|
|
116
82
|
- **Traceability**: Track what worked, what didn't, and why
|
|
117
83
|
|
|
118
|
-
|
|
84
|
+
## Core Workflow
|
|
85
|
+
|
|
86
|
+
ACE follows a simple 3-phase cycle that coding agents can use to improve over time:
|
|
87
|
+
|
|
88
|
+
### 1. Executor
|
|
89
|
+
Agent performs coding task and saves detailed output with context.
|
|
119
90
|
|
|
120
|
-
|
|
91
|
+
### 2. Reflector
|
|
92
|
+
Agent analyzes results and provides honest feedback on what worked and what didn't.
|
|
121
93
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
3. **Curator** - Agent transforms insights into playbook updates (automatically applied)
|
|
94
|
+
### 3. Curator
|
|
95
|
+
Agent transforms insights into playbook updates that are automatically applied to improve future work.
|
|
125
96
|
|
|
126
|
-
### Quick
|
|
97
|
+
### Quick Example
|
|
98
|
+
|
|
99
|
+
If you're using a coding agent like Claude Code:
|
|
127
100
|
|
|
128
101
|
```bash
|
|
129
102
|
# Complete ACE workflow in a single command
|
|
@@ -132,650 +105,122 @@ br complete "auth-feature" \
|
|
|
132
105
|
"Successfully added OAuth2 authentication" \
|
|
133
106
|
--tool-usage "Read:src/auth.ts,Edit:src/auth.ts,Bash:npm test" \
|
|
134
107
|
--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
108
|
```
|
|
144
109
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
**📘 Complete ACE Guide**: See [rules](./src/templates/README.md) for comprehensive instructions on using ACE in your development workflow.
|
|
110
|
+
For comprehensive ACE instructions for coding agents, check the corresponding coding agents' instruction files after `br init` or `br gen-rules`.
|
|
148
111
|
|
|
149
|
-
|
|
112
|
+
## Essential Commands
|
|
150
113
|
|
|
151
|
-
###
|
|
114
|
+
### Authentication
|
|
152
115
|
|
|
153
116
|
```bash
|
|
154
|
-
#
|
|
155
|
-
br
|
|
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
|
|
117
|
+
# Log in to ByteRover
|
|
118
|
+
br login
|
|
168
119
|
|
|
169
|
-
#
|
|
170
|
-
br status
|
|
171
|
-
br clear [--yes] # Reset playbook
|
|
120
|
+
# Check your authentication and project status
|
|
121
|
+
br status
|
|
172
122
|
```
|
|
173
123
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
For agents that need to quickly add context without the full ACE workflow:
|
|
124
|
+
### Project Setup
|
|
177
125
|
|
|
178
126
|
```bash
|
|
179
|
-
#
|
|
180
|
-
br
|
|
127
|
+
# Initialize project with ByteRover
|
|
128
|
+
br init
|
|
181
129
|
|
|
182
|
-
#
|
|
183
|
-
br
|
|
130
|
+
# List available spaces
|
|
131
|
+
br space list
|
|
184
132
|
|
|
185
|
-
#
|
|
186
|
-
br
|
|
133
|
+
# Switch to a different space or team
|
|
134
|
+
br space switch
|
|
187
135
|
```
|
|
188
136
|
|
|
189
|
-
|
|
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
|
|
137
|
+
### Memory Operations
|
|
201
138
|
|
|
202
139
|
```bash
|
|
203
|
-
#
|
|
204
|
-
br
|
|
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:
|
|
140
|
+
# Retrieve memories from ByteRover (outputs to stdout for agent context)
|
|
141
|
+
br retrieve --query "authentication best practices"
|
|
142
|
+
br retrieve -q "error handling" -n "src/auth/login.ts,src/auth/oauth.ts"
|
|
253
143
|
|
|
144
|
+
# Push your playbook to ByteRover's memory storage
|
|
145
|
+
br push
|
|
254
146
|
```
|
|
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
147
|
|
|
271
|
-
|
|
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
|
|
148
|
+
### For Coding Agents
|
|
277
149
|
|
|
278
150
|
```bash
|
|
279
|
-
#
|
|
280
|
-
br
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
br retrieve -q "error handling" -n "src/auth/login.ts,src/auth/oauth.ts"
|
|
151
|
+
# Complete ACE workflow (recommended for agents)
|
|
152
|
+
br complete <hint> <reasoning> <answer> \
|
|
153
|
+
--tool-usage <tools> \
|
|
154
|
+
--feedback <feedback>
|
|
284
155
|
|
|
285
|
-
#
|
|
286
|
-
br
|
|
156
|
+
# Generate agent rules (sets up ACE workflow for your coding agent)
|
|
157
|
+
br gen-rules
|
|
287
158
|
```
|
|
288
159
|
|
|
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
160
|
## Authentication
|
|
297
161
|
|
|
298
|
-
ByteRover CLI uses **OAuth 2.0 with PKCE** (Proof Key for Code Exchange) for secure authentication
|
|
162
|
+
ByteRover CLI uses **OAuth 2.0 with PKCE** (Proof Key for Code Exchange) for secure authentication.
|
|
299
163
|
|
|
300
164
|
### How it works
|
|
301
165
|
|
|
302
|
-
1. Run `br login` to
|
|
303
|
-
2.
|
|
304
|
-
3.
|
|
305
|
-
4.
|
|
306
|
-
5. All subsequent commands automatically use your stored credentials
|
|
166
|
+
1. Run `br login` to start authentication
|
|
167
|
+
2. Your browser opens to the ByteRover authorization page
|
|
168
|
+
3. After successful login, tokens are securely stored in your system keychain
|
|
169
|
+
4. All subsequent commands automatically use your stored credentials
|
|
307
170
|
|
|
308
171
|
### Security features
|
|
309
172
|
|
|
310
173
|
- **PKCE flow**: Prevents authorization code interception attacks
|
|
311
|
-
- **System keychain**: Tokens stored
|
|
312
|
-
- **Session tracking**: Each
|
|
174
|
+
- **System keychain**: Tokens stored in macOS Keychain
|
|
175
|
+
- **Session tracking**: Each session includes a session key for request tracking
|
|
313
176
|
- **Auto-refresh**: Refresh tokens enable seamless credential renewal
|
|
314
177
|
|
|
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
178
|
## Configuration
|
|
644
179
|
|
|
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
180
|
### Project Configuration
|
|
674
181
|
|
|
675
|
-
When you run `br init`, a configuration file is created at `.
|
|
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
|
|
182
|
+
When you run `br init`, a configuration file is created at `.br/config.json` in your project directory containing:
|
|
684
183
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
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.
|
|
184
|
+
- **Space ID**: The ByteRover workspace/space associated with this project
|
|
185
|
+
- **User information**: Your user ID and email
|
|
186
|
+
- **Project settings**: Project-specific configuration
|
|
698
187
|
|
|
699
|
-
###
|
|
188
|
+
### ACE File Structure
|
|
700
189
|
|
|
701
|
-
|
|
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:
|
|
190
|
+
ACE stores all outputs in `.br/ace/`:
|
|
710
191
|
|
|
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
192
|
```
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
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]
|
|
193
|
+
.br/ace/
|
|
194
|
+
├── playbook.json # Your living knowledge base
|
|
195
|
+
├── executor-outputs/ # Coding task outputs
|
|
196
|
+
├── reflections/ # Task analysis and feedback
|
|
197
|
+
└── deltas/ # Playbook updates
|
|
731
198
|
```
|
|
732
199
|
|
|
733
|
-
|
|
200
|
+
**Note**: When you run `br push`, the playbook is uploaded to ByteRover's memory storage, and local ACE files are automatically cleaned up to keep your workspace organized.
|
|
734
201
|
|
|
735
|
-
|
|
736
|
-
npx oclif generate command
|
|
737
|
-
```
|
|
202
|
+
## Getting Help
|
|
738
203
|
|
|
739
|
-
###
|
|
204
|
+
### Command Help
|
|
740
205
|
|
|
741
206
|
```bash
|
|
742
|
-
#
|
|
743
|
-
|
|
207
|
+
# Get general help
|
|
208
|
+
br help
|
|
744
209
|
|
|
745
|
-
#
|
|
746
|
-
|
|
210
|
+
# Get help for a specific command
|
|
211
|
+
br help login
|
|
212
|
+
br help init
|
|
213
|
+
br help push
|
|
747
214
|
```
|
|
748
215
|
|
|
749
|
-
|
|
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
|
|
216
|
+
### Support
|
|
769
217
|
|
|
770
|
-
|
|
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
|
|
218
|
+
If you encounter issues or have questions:
|
|
776
219
|
|
|
777
|
-
|
|
220
|
+
1. Check the command help: `br help [command]`
|
|
221
|
+
2. Review your status: `br status`
|
|
222
|
+
3. Contact ByteRover support
|
|
778
223
|
|
|
779
|
-
|
|
224
|
+
---
|
|
780
225
|
|
|
781
|
-
Copyright (c) ByteRover
|
|
226
|
+
**Copyright (c) ByteRover**
|
package/dist/commands/add.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
-
import type { Bullet } from '../core/domain/entities/bullet.js';
|
|
3
2
|
import type { IPlaybookService } from '../core/interfaces/i-playbook-service.js';
|
|
4
3
|
import type { IPlaybookStore } from '../core/interfaces/i-playbook-store.js';
|
|
5
4
|
import type { ITrackingService } from '../core/interfaces/i-tracking-service.js';
|
|
6
|
-
type UserAction = 'add' | 'update';
|
|
7
5
|
interface SectionPromptOptions {
|
|
8
6
|
readonly existingSections: readonly string[];
|
|
9
7
|
readonly suggestedSections: readonly string[];
|
|
10
8
|
}
|
|
11
|
-
interface ContentPromptContext {
|
|
12
|
-
readonly action: UserAction;
|
|
13
|
-
readonly existingContent?: string;
|
|
14
|
-
readonly section: string;
|
|
15
|
-
}
|
|
16
9
|
export default class Add extends Command {
|
|
17
10
|
static description: string;
|
|
18
11
|
static examples: string[];
|
|
@@ -28,24 +21,20 @@ export default class Add extends Command {
|
|
|
28
21
|
trackingService: ITrackingService;
|
|
29
22
|
};
|
|
30
23
|
/**
|
|
31
|
-
* Prompt user to
|
|
32
|
-
*/
|
|
33
|
-
protected promptForAction(): Promise<UserAction>;
|
|
34
|
-
/**
|
|
35
|
-
* Prompt user to select a bullet to update
|
|
24
|
+
* Prompt user to confirm adding the bullet
|
|
36
25
|
*/
|
|
37
|
-
protected
|
|
26
|
+
protected promptForConfirmation(bulletId: string, section: string, content: string): Promise<boolean>;
|
|
38
27
|
/**
|
|
39
28
|
* Prompt user to enter bullet content
|
|
40
29
|
*/
|
|
41
|
-
protected promptForContent(
|
|
30
|
+
protected promptForContent(section: string): Promise<string>;
|
|
42
31
|
/**
|
|
43
32
|
* Prompt user to select or create a section name
|
|
44
33
|
*/
|
|
45
34
|
protected promptForSection(options: SectionPromptOptions): Promise<string>;
|
|
46
35
|
run(): Promise<void>;
|
|
47
36
|
/**
|
|
48
|
-
* Display success message after adding
|
|
37
|
+
* Display success message after adding a bullet
|
|
49
38
|
*/
|
|
50
39
|
private displaySuccess;
|
|
51
40
|
/**
|
package/dist/commands/add.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { input, search
|
|
1
|
+
import { confirm, input, search } from '@inquirer/prompts';
|
|
2
2
|
import { Command, Flags } from '@oclif/core';
|
|
3
3
|
import { Playbook } from '../core/domain/entities/playbook.js';
|
|
4
4
|
import { FilePlaybookStore } from '../infra/ace/file-playbook-store.js';
|
|
@@ -54,55 +54,27 @@ export default class Add extends Command {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Prompt user to
|
|
57
|
+
* Prompt user to confirm adding the bullet
|
|
58
58
|
*/
|
|
59
|
-
async
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
async promptForConfirmation(bulletId, section, content) {
|
|
60
|
+
this.log('\nReview your bullet:');
|
|
61
|
+
this.log(` ID: ${bulletId}`);
|
|
62
|
+
this.log(` Section: ${section}`);
|
|
63
|
+
const contentDisplay = content.length > 200 ? `${content.slice(0, 200)}...` : content;
|
|
64
|
+
this.log(` Content: ${contentDisplay}`);
|
|
65
|
+
this.log('\nTip: Use `br status` to view and update bullets later');
|
|
66
|
+
const confirmed = await confirm({
|
|
67
|
+
default: true,
|
|
68
|
+
message: 'Add this bullet?',
|
|
66
69
|
});
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Prompt user to select a bullet to update
|
|
71
|
-
*/
|
|
72
|
-
async promptForBullet(bullets) {
|
|
73
|
-
const displayBullets = bullets.map((bullet) => ({
|
|
74
|
-
contentPreview: bullet.content.length > 60 ? `${bullet.content.slice(0, 60)}...` : bullet.content,
|
|
75
|
-
id: bullet.id,
|
|
76
|
-
section: bullet.section,
|
|
77
|
-
tags: bullet.metadata.tags,
|
|
78
|
-
timestamp: new Date(bullet.metadata.timestamp).toLocaleDateString(),
|
|
79
|
-
}));
|
|
80
|
-
const bulletId = await search({
|
|
81
|
-
message: 'Select a bullet to update:',
|
|
82
|
-
async source(input) {
|
|
83
|
-
const filtered = input
|
|
84
|
-
? displayBullets.filter((b) => b.section.toLowerCase().includes(input.toLowerCase()) ||
|
|
85
|
-
b.contentPreview.toLowerCase().includes(input.toLowerCase()) ||
|
|
86
|
-
b.id.toLowerCase().includes(input.toLowerCase()))
|
|
87
|
-
: displayBullets;
|
|
88
|
-
return filtered.map((b) => ({
|
|
89
|
-
description: `Tags: ${b.tags.join(', ')} | Date: ${b.timestamp}`,
|
|
90
|
-
name: `[${b.id}] ${b.section}: ${b.contentPreview}`,
|
|
91
|
-
value: b.id,
|
|
92
|
-
}));
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
return bulletId;
|
|
70
|
+
return confirmed;
|
|
96
71
|
}
|
|
97
72
|
/**
|
|
98
73
|
* Prompt user to enter bullet content
|
|
99
74
|
*/
|
|
100
|
-
async promptForContent(
|
|
101
|
-
const message =
|
|
102
|
-
? `Enter new content for bullet in "${context.section}":`
|
|
103
|
-
: `Enter content for new bullet in "${context.section}":`;
|
|
75
|
+
async promptForContent(section) {
|
|
76
|
+
const message = `Enter content for new bullet in "${section}":`;
|
|
104
77
|
const content = await input({
|
|
105
|
-
default: context.existingContent,
|
|
106
78
|
message,
|
|
107
79
|
validate(value) {
|
|
108
80
|
if (!validateContent(value)) {
|
|
@@ -139,11 +111,10 @@ export default class Add extends Command {
|
|
|
139
111
|
return flags.interactive ? this.runInteractive() : this.runFlagBased(flags);
|
|
140
112
|
}
|
|
141
113
|
/**
|
|
142
|
-
* Display success message after adding
|
|
114
|
+
* Display success message after adding a bullet
|
|
143
115
|
*/
|
|
144
|
-
displaySuccess(bullet
|
|
145
|
-
|
|
146
|
-
this.log(`\n✓ ${actionText} bullet successfully!`);
|
|
116
|
+
displaySuccess(bullet) {
|
|
117
|
+
this.log(`\n✓ Added bullet successfully!`);
|
|
147
118
|
this.log(` ID: ${bullet.id}`);
|
|
148
119
|
this.log(` Section: ${bullet.section}`);
|
|
149
120
|
this.log(` Content: ${bullet.content}`);
|
|
@@ -173,7 +144,7 @@ export default class Add extends Command {
|
|
|
173
144
|
content: flags.content,
|
|
174
145
|
section: flags.section,
|
|
175
146
|
});
|
|
176
|
-
this.displaySuccess(bullet
|
|
147
|
+
this.displaySuccess(bullet);
|
|
177
148
|
}
|
|
178
149
|
catch (error) {
|
|
179
150
|
this.error(error instanceof Error ? error.message : 'Unexpected error occurred');
|
|
@@ -185,43 +156,34 @@ export default class Add extends Command {
|
|
|
185
156
|
async runInteractive() {
|
|
186
157
|
const { playbookService, playbookStore, trackingService } = this.createServices();
|
|
187
158
|
try {
|
|
159
|
+
// Display welcome message
|
|
160
|
+
this.log('Press Ctrl+C at any time to cancel the process\n');
|
|
188
161
|
// Load existing playbook or create new one
|
|
189
162
|
let playbook = await playbookStore.load();
|
|
190
163
|
if (!playbook) {
|
|
191
164
|
playbook = new Playbook();
|
|
192
165
|
}
|
|
193
|
-
const action = await this.promptForAction();
|
|
194
166
|
const sectionOptions = {
|
|
195
167
|
existingSections: playbook.getSections(),
|
|
196
168
|
suggestedSections: SUGGESTED_SECTIONS,
|
|
197
169
|
};
|
|
198
170
|
const section = await this.promptForSection(sectionOptions);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
bulletId = await this.promptForBullet(bullets);
|
|
208
|
-
const bullet = playbook.getBullet(bulletId);
|
|
209
|
-
existingContent = bullet?.content;
|
|
210
|
-
}
|
|
171
|
+
const content = await this.promptForContent(section);
|
|
172
|
+
// Get next bullet ID for confirmation
|
|
173
|
+
const nextId = playbook.getNextId();
|
|
174
|
+
// Prompt for confirmation
|
|
175
|
+
const confirmed = await this.promptForConfirmation(nextId, section, content);
|
|
176
|
+
if (!confirmed) {
|
|
177
|
+
this.log('\nBullet not added. Operation cancelled.');
|
|
178
|
+
return;
|
|
211
179
|
}
|
|
212
|
-
const contentContext = {
|
|
213
|
-
action: bulletId ? 'update' : 'add',
|
|
214
|
-
existingContent,
|
|
215
|
-
section,
|
|
216
|
-
};
|
|
217
|
-
const content = await this.promptForContent(contentContext);
|
|
218
180
|
const bullet = await playbookService.addOrUpdateBullet({
|
|
219
|
-
bulletId,
|
|
181
|
+
bulletId: undefined,
|
|
220
182
|
content,
|
|
221
183
|
section,
|
|
222
184
|
});
|
|
223
185
|
await trackingService.track('ace:add_bullet');
|
|
224
|
-
this.displaySuccess(bullet
|
|
186
|
+
this.displaySuccess(bullet);
|
|
225
187
|
}
|
|
226
188
|
catch (error) {
|
|
227
189
|
this.error(error instanceof Error ? error.message : 'Unexpected error occurred');
|
package/dist/commands/push.d.ts
CHANGED
|
@@ -13,9 +13,11 @@ export default class Push extends Command {
|
|
|
13
13
|
static examples: string[];
|
|
14
14
|
static flags: {
|
|
15
15
|
branch: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
17
|
};
|
|
17
18
|
protected checkProjectInit(projectConfigStore: IProjectConfigStore): Promise<BrConfig>;
|
|
18
19
|
protected cleanUpLocalFiles(playbookStore: IPlaybookStore): Promise<void>;
|
|
20
|
+
protected confirmPush(projectConfig: BrConfig, branch: string, fileCount: number): Promise<boolean>;
|
|
19
21
|
protected confirmUpload(memoryService: IMemoryStorageService, token: AuthToken, projectConfig: BrConfig, requestId: string): Promise<void>;
|
|
20
22
|
protected createServices(): {
|
|
21
23
|
memoryService: IMemoryStorageService;
|
package/dist/commands/push.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { confirm } from '@inquirer/prompts';
|
|
1
2
|
import { Command, Flags, ux } from '@oclif/core';
|
|
2
3
|
import { join } from 'node:path';
|
|
3
4
|
import { getCurrentConfig } from '../config/environment.js';
|
|
@@ -22,6 +23,11 @@ export default class Push extends Command {
|
|
|
22
23
|
default: DEFAULT_BRANCH,
|
|
23
24
|
description: 'ByteRover branch name (not Git branch)',
|
|
24
25
|
}),
|
|
26
|
+
yes: Flags.boolean({
|
|
27
|
+
char: 'y',
|
|
28
|
+
default: false,
|
|
29
|
+
description: 'Skip confirmation prompt',
|
|
30
|
+
}),
|
|
25
31
|
};
|
|
26
32
|
async checkProjectInit(projectConfigStore) {
|
|
27
33
|
const projectConfig = await projectConfigStore.read();
|
|
@@ -32,8 +38,8 @@ export default class Push extends Command {
|
|
|
32
38
|
}
|
|
33
39
|
async cleanUpLocalFiles(playbookStore) {
|
|
34
40
|
this.log('\nCleaning up local files...');
|
|
35
|
-
// Clear playbook content
|
|
36
|
-
ux.action.start(' Clearing playbook');
|
|
41
|
+
// Clear playbook content and bullet files
|
|
42
|
+
ux.action.start(' Clearing playbook and bullet files');
|
|
37
43
|
await playbookStore.clear();
|
|
38
44
|
ux.action.stop('✓');
|
|
39
45
|
// Clean executor outputs
|
|
@@ -54,6 +60,22 @@ export default class Push extends Command {
|
|
|
54
60
|
const deltaCount = await clearDirectory(deltasDir);
|
|
55
61
|
ux.action.stop(`✓ (${deltaCount} files removed)`);
|
|
56
62
|
}
|
|
63
|
+
async confirmPush(projectConfig, branch, fileCount) {
|
|
64
|
+
this.log('\nYou are about to push to ByteRover memory storage:');
|
|
65
|
+
this.log(` Space: ${projectConfig.spaceName}`);
|
|
66
|
+
this.log(` Branch: ${branch}`);
|
|
67
|
+
this.log(` Files to upload: ${fileCount}`);
|
|
68
|
+
this.log('\nAfter successful push, these local files will be cleaned up:');
|
|
69
|
+
this.log(' - Playbook content');
|
|
70
|
+
this.log(' - Bullet files (.br/ace/bullets/)');
|
|
71
|
+
this.log(' - Executor outputs (.br/ace/executor-outputs/)');
|
|
72
|
+
this.log(' - Reflections (.br/ace/reflections/)');
|
|
73
|
+
this.log(' - Deltas (.br/ace/deltas/)');
|
|
74
|
+
return confirm({
|
|
75
|
+
default: false,
|
|
76
|
+
message: 'Push to ByteRover and clean up local files?',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
57
79
|
async confirmUpload(memoryService, token, projectConfig, requestId) {
|
|
58
80
|
ux.action.start('Confirming upload');
|
|
59
81
|
await memoryService.confirmUpload({
|
|
@@ -111,6 +133,14 @@ export default class Push extends Command {
|
|
|
111
133
|
const token = await this.validateAuth(tokenStore);
|
|
112
134
|
const projectConfig = await this.checkProjectInit(projectConfigStore);
|
|
113
135
|
await this.verifyPlaybookExists(playbookStore);
|
|
136
|
+
// Prompt for confirmation unless --yes flag is provided
|
|
137
|
+
if (!flags.yes) {
|
|
138
|
+
const confirmed = await this.confirmPush(projectConfig, flags.branch, 1);
|
|
139
|
+
if (!confirmed) {
|
|
140
|
+
this.log('Push cancelled. No files were uploaded or cleaned.');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
114
144
|
const response = await this.getPresignedUrls(memoryService, token, projectConfig);
|
|
115
145
|
const playbookContent = await this.loadPlaybookContent(playbookStore);
|
|
116
146
|
await this.uploadFiles(memoryService, response.presignedUrls, playbookContent);
|
package/dist/commands/status.js
CHANGED
|
@@ -106,8 +106,7 @@ export default class Status extends Command {
|
|
|
106
106
|
this.log(` ${chalk.red(relativePath)}`);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
this.log(`Use "br push" to push memory to cloud.`);
|
|
109
|
+
this.log(`\nUse "br push" to push playbook to ByteRover memory storage.`);
|
|
111
110
|
}
|
|
112
111
|
catch (error) {
|
|
113
112
|
this.error(error instanceof Error ? error.message : 'Failed to load playbook statistics');
|
|
@@ -21,15 +21,15 @@ export const ENV_CONFIG = {
|
|
|
21
21
|
tokenUrl: 'https://dev-beta-iam.byterover.dev/api/v1/oidc/token',
|
|
22
22
|
},
|
|
23
23
|
production: {
|
|
24
|
-
apiBaseUrl: 'https://
|
|
25
|
-
authorizationUrl: 'https://
|
|
26
|
-
clientId: 'byterover-cli
|
|
27
|
-
cogitApiBaseUrl: 'https://
|
|
28
|
-
issuerUrl: 'https://
|
|
29
|
-
memoraApiBaseUrl: 'https://
|
|
30
|
-
mixpanelToken: '
|
|
24
|
+
apiBaseUrl: 'https://beta-iam.byterover.dev/api/v1',
|
|
25
|
+
authorizationUrl: 'https://beta-iam.byterover.dev/api/v1/oidc/authorize',
|
|
26
|
+
clientId: 'byterover-cli',
|
|
27
|
+
cogitApiBaseUrl: 'https://beta-cogit.byterover.dev/api/v1',
|
|
28
|
+
issuerUrl: 'https://beta-iam.byterover.dev/api/v1/oidc',
|
|
29
|
+
memoraApiBaseUrl: 'https://beta-memora-retrieve.byterover.dev/api/v3',
|
|
30
|
+
mixpanelToken: '4d1198b346d2d6ac75f2e77905cc65ac',
|
|
31
31
|
scopes: ['read', 'write'],
|
|
32
|
-
tokenUrl: 'https://
|
|
32
|
+
tokenUrl: 'https://beta-iam.byterover.dev/api/v1/oidc/token',
|
|
33
33
|
},
|
|
34
34
|
};
|
|
35
35
|
/**
|
|
@@ -68,6 +68,10 @@ export declare class Playbook {
|
|
|
68
68
|
* Returns bullets in a specific section
|
|
69
69
|
*/
|
|
70
70
|
getBulletsInSection(section: string): Bullet[];
|
|
71
|
+
/**
|
|
72
|
+
* Returns the next bullet ID that will be generated
|
|
73
|
+
*/
|
|
74
|
+
getNextId(): string;
|
|
71
75
|
/**
|
|
72
76
|
* Returns all section names
|
|
73
77
|
*/
|
|
@@ -149,6 +149,13 @@ export class Playbook {
|
|
|
149
149
|
const bulletIds = this.sections.get(section) ?? [];
|
|
150
150
|
return bulletIds.map((id) => this.bullets.get(id)).filter((b) => b !== undefined);
|
|
151
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Returns the next bullet ID that will be generated
|
|
154
|
+
*/
|
|
155
|
+
getNextId() {
|
|
156
|
+
// Use "temp" as prefix since we don't know the section yet
|
|
157
|
+
return String(this.nextId).padStart(5, '0');
|
|
158
|
+
}
|
|
152
159
|
/**
|
|
153
160
|
* Returns all section names
|
|
154
161
|
*/
|
package/oclif.manifest.json
CHANGED
|
@@ -269,6 +269,13 @@
|
|
|
269
269
|
"hasDynamicHelp": false,
|
|
270
270
|
"multiple": false,
|
|
271
271
|
"type": "option"
|
|
272
|
+
},
|
|
273
|
+
"yes": {
|
|
274
|
+
"char": "y",
|
|
275
|
+
"description": "Skip confirmation prompt",
|
|
276
|
+
"name": "yes",
|
|
277
|
+
"allowNo": false,
|
|
278
|
+
"type": "boolean"
|
|
272
279
|
}
|
|
273
280
|
},
|
|
274
281
|
"hasDynamicHelp": false,
|
|
@@ -472,5 +479,5 @@
|
|
|
472
479
|
]
|
|
473
480
|
}
|
|
474
481
|
},
|
|
475
|
-
"version": "0.1.
|
|
482
|
+
"version": "0.1.1"
|
|
476
483
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "byterover-cli",
|
|
3
3
|
"description": "ByteRover's CLI",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"author": "ByteRover",
|
|
6
6
|
"bin": {
|
|
7
7
|
"br": "./bin/run.js"
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"keywords": [
|
|
52
52
|
"oclif"
|
|
53
53
|
],
|
|
54
|
-
"license": "
|
|
54
|
+
"license": "UNLICENSED",
|
|
55
55
|
"main": "dist/index.js",
|
|
56
56
|
"type": "module",
|
|
57
57
|
"oclif": {
|