byterover-cli 0.1.1 → 0.2.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 +37 -27
- package/bin/dev.cmd +1 -1
- package/bin/dev.js +1 -1
- package/bin/run.cmd +1 -1
- package/bin/run.js +1 -1
- package/dist/commands/add.js +1 -1
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +73 -27
- package/dist/commands/logout.d.ts +16 -0
- package/dist/commands/logout.js +61 -0
- package/dist/commands/push.d.ts +5 -5
- package/dist/commands/push.js +11 -11
- package/dist/commands/retrieve.d.ts +2 -2
- package/dist/commands/retrieve.js +3 -3
- package/dist/commands/space/list.js +10 -5
- package/dist/commands/space/switch.js +8 -7
- package/dist/commands/status.js +5 -5
- package/dist/config/environment.d.ts +3 -2
- package/dist/config/environment.js +5 -3
- package/dist/constants.d.ts +8 -1
- package/dist/constants.js +8 -1
- package/dist/core/domain/entities/{br-config.d.ts → brv-config.d.ts} +5 -5
- package/dist/core/domain/entities/{br-config.js → brv-config.js} +5 -5
- package/dist/core/domain/entities/event.d.ts +1 -1
- package/dist/core/domain/entities/event.js +1 -0
- package/dist/core/interfaces/i-playbook-service.d.ts +1 -1
- package/dist/core/interfaces/i-project-config-store.d.ts +10 -10
- package/dist/core/interfaces/i-rule-template-service.d.ts +0 -4
- package/dist/core/interfaces/i-rule-template-service.js +1 -4
- package/dist/hooks/init/welcome.d.ts +3 -0
- package/dist/hooks/init/welcome.js +31 -0
- package/dist/infra/ace/ace-file-utils.js +2 -2
- package/dist/infra/ace/file-bullet-content-store.d.ts +4 -4
- package/dist/infra/ace/file-bullet-content-store.js +7 -7
- package/dist/infra/ace/file-delta-store.d.ts +1 -1
- package/dist/infra/ace/file-delta-store.js +1 -1
- package/dist/infra/ace/file-executor-output-store.d.ts +1 -1
- package/dist/infra/ace/file-executor-output-store.js +1 -1
- package/dist/infra/ace/file-playbook-store.d.ts +3 -3
- package/dist/infra/ace/file-playbook-store.js +6 -6
- package/dist/infra/ace/file-reflection-store.d.ts +1 -1
- package/dist/infra/ace/file-reflection-store.js +1 -1
- package/dist/infra/config/file-config-store.d.ts +6 -8
- package/dist/infra/config/file-config-store.js +10 -11
- package/dist/infra/playbook/file-playbook-service.d.ts +0 -1
- package/dist/infra/playbook/file-playbook-service.js +7 -8
- package/dist/infra/rule/constants.d.ts +4 -0
- package/dist/infra/rule/constants.js +4 -0
- package/dist/infra/rule/rule-template-service.js +1 -1
- package/dist/infra/rule/rule-writer-service.js +1 -5
- package/dist/templates/README.md +5 -5
- package/dist/templates/sections/command-reference.md +41 -23
- package/dist/templates/sections/workflow.md +11 -12
- package/oclif.manifest.json +44 -4
- package/package.json +9 -8
|
@@ -51,13 +51,18 @@ export default class SpaceList extends Command {
|
|
|
51
51
|
// Check project initialization
|
|
52
52
|
const projectConfig = await projectConfigStore.read();
|
|
53
53
|
if (projectConfig === undefined) {
|
|
54
|
-
this.error('Project not initialized. Run "
|
|
54
|
+
this.error('Project not initialized. Run "brv init" first.');
|
|
55
55
|
}
|
|
56
56
|
const token = await this.validateAuth(tokenStore);
|
|
57
57
|
// Fetch spaces for the team from project config
|
|
58
58
|
ux.action.start(`Fetching spaces for ${projectConfig.teamName}`);
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
let result;
|
|
60
|
+
try {
|
|
61
|
+
result = await spaceService.getSpaces(token.accessToken, token.sessionKey, projectConfig.teamId, flags.all ? { fetchAll: true } : { limit: flags.limit, offset: flags.offset });
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
ux.action.stop();
|
|
65
|
+
}
|
|
61
66
|
// Handle empty results
|
|
62
67
|
if (result.spaces.length === 0) {
|
|
63
68
|
this.log(`No spaces found in team "${projectConfig.teamName}".`);
|
|
@@ -95,10 +100,10 @@ export default class SpaceList extends Command {
|
|
|
95
100
|
async validateAuth(tokenStore) {
|
|
96
101
|
const token = await tokenStore.load();
|
|
97
102
|
if (token === undefined) {
|
|
98
|
-
this.error('Not authenticated. Please run "
|
|
103
|
+
this.error('Not authenticated. Please run "brv login" first.');
|
|
99
104
|
}
|
|
100
105
|
if (!token.isValid()) {
|
|
101
|
-
this.error('Authentication token expired. Please run "
|
|
106
|
+
this.error('Authentication token expired. Please run "brv login" again.');
|
|
102
107
|
}
|
|
103
108
|
return token;
|
|
104
109
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { select } from '@inquirer/prompts';
|
|
2
2
|
import { Command, ux } from '@oclif/core';
|
|
3
3
|
import { getCurrentConfig } from '../../config/environment.js';
|
|
4
|
-
import {
|
|
4
|
+
import { BRV_DIR, PROJECT_CONFIG_FILE } from '../../constants.js';
|
|
5
|
+
import { BrvConfig } from '../../core/domain/entities/brv-config.js';
|
|
5
6
|
import { ProjectConfigStore } from '../../infra/config/file-config-store.js';
|
|
6
7
|
import { HttpSpaceService } from '../../infra/space/http-space-service.js';
|
|
7
8
|
import { KeychainTokenStore } from '../../infra/storage/keychain-token-store.js';
|
|
8
9
|
import { HttpTeamService } from '../../infra/team/http-team-service.js';
|
|
9
10
|
export default class SpaceSwitch extends Command {
|
|
10
|
-
static description =
|
|
11
|
+
static description = `Switch to a different team or space (updates ${BRV_DIR}/${PROJECT_CONFIG_FILE})`;
|
|
11
12
|
static examples = [
|
|
12
13
|
'<%= config.bin %> <%= command.id %>',
|
|
13
14
|
'# Shows current configuration, then prompts for new team/space selection',
|
|
@@ -59,7 +60,7 @@ export default class SpaceSwitch extends Command {
|
|
|
59
60
|
// Check project initialization (MUST exist for switch)
|
|
60
61
|
const currentConfig = await projectConfigStore.read();
|
|
61
62
|
if (currentConfig === undefined) {
|
|
62
|
-
this.error('Project not initialized. Run "
|
|
63
|
+
this.error('Project not initialized. Run "brv init" first.');
|
|
63
64
|
}
|
|
64
65
|
// Show current configuration
|
|
65
66
|
this.log('Current configuration:');
|
|
@@ -69,10 +70,10 @@ export default class SpaceSwitch extends Command {
|
|
|
69
70
|
// Validate authentication
|
|
70
71
|
const token = await tokenStore.load();
|
|
71
72
|
if (token === undefined) {
|
|
72
|
-
this.error('Not authenticated. Please run "
|
|
73
|
+
this.error('Not authenticated. Please run "brv login" first.');
|
|
73
74
|
}
|
|
74
75
|
if (!token.isValid()) {
|
|
75
|
-
this.error('Authentication token expired. Please run "
|
|
76
|
+
this.error('Authentication token expired. Please run "brv login" again.');
|
|
76
77
|
}
|
|
77
78
|
// Fetch all teams
|
|
78
79
|
ux.action.start('Fetching all teams');
|
|
@@ -97,11 +98,11 @@ export default class SpaceSwitch extends Command {
|
|
|
97
98
|
this.log();
|
|
98
99
|
const selectedSpace = await this.promptForSpaceSelection(spaceResult.spaces);
|
|
99
100
|
// Update configuration
|
|
100
|
-
const newConfig =
|
|
101
|
+
const newConfig = BrvConfig.fromSpace(selectedSpace);
|
|
101
102
|
await projectConfigStore.write(newConfig);
|
|
102
103
|
// Display success
|
|
103
104
|
this.log(`\n✓ Successfully switched to space: ${selectedSpace.getDisplayName()}`);
|
|
104
|
-
this.log(`✓ Configuration updated in:
|
|
105
|
+
this.log(`✓ Configuration updated in: ${BRV_DIR}/${PROJECT_CONFIG_FILE}`);
|
|
105
106
|
}
|
|
106
107
|
catch (error) {
|
|
107
108
|
this.error(error instanceof Error ? error.message : 'Switch failed');
|
package/dist/commands/status.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Command, Flags } from '@oclif/core';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import { ACE_DIR,
|
|
3
|
+
import { ACE_DIR, BRV_DIR, BULLETS_DIR } from '../constants.js';
|
|
4
4
|
import { FilePlaybookStore } from '../infra/ace/file-playbook-store.js';
|
|
5
5
|
import { ProjectConfigStore } from '../infra/config/file-config-store.js';
|
|
6
6
|
import { KeychainTokenStore } from '../infra/storage/keychain-token-store.js';
|
|
@@ -80,7 +80,7 @@ export default class Status extends Command {
|
|
|
80
80
|
try {
|
|
81
81
|
const playbook = await playbookStore.load(args.directory);
|
|
82
82
|
if (!playbook) {
|
|
83
|
-
this.error('Playbook not found. Run `
|
|
83
|
+
this.error('Playbook not found. Run `brv init` to initialize.');
|
|
84
84
|
}
|
|
85
85
|
// Display based on format
|
|
86
86
|
if (flags.format === 'json') {
|
|
@@ -90,7 +90,7 @@ export default class Status extends Command {
|
|
|
90
90
|
const bullets = playbook.getBullets();
|
|
91
91
|
const sections = playbook.getSections();
|
|
92
92
|
if (bullets.length === 0) {
|
|
93
|
-
this.log('Playbook is empty. Use "
|
|
93
|
+
this.log('Playbook is empty. Use "brv add" commands to add knowledge.');
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
this.log(`\nMemory not pushed to cloud:`);
|
|
@@ -101,12 +101,12 @@ export default class Status extends Command {
|
|
|
101
101
|
this.log(`# ${section}`);
|
|
102
102
|
const sectionBullets = playbook.getBulletsInSection(section);
|
|
103
103
|
for (const bullet of sectionBullets) {
|
|
104
|
-
const relativePath = `${
|
|
104
|
+
const relativePath = `${BRV_DIR}/${ACE_DIR}/${BULLETS_DIR}/${bullet.id}.md`;
|
|
105
105
|
// Display like git status: red path
|
|
106
106
|
this.log(` ${chalk.red(relativePath)}`);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
this.log(`\nUse "
|
|
109
|
+
this.log(`\nUse "brv push" to push playbook to ByteRover memory storage.`);
|
|
110
110
|
}
|
|
111
111
|
catch (error) {
|
|
112
112
|
this.error(error instanceof Error ? error.message : 'Failed to load playbook statistics');
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
type Environment = 'development' | 'production';
|
|
5
5
|
/**
|
|
6
6
|
* Current environment - set at runtime by the launcher scripts.
|
|
7
|
-
* - `./bin/dev.js` sets
|
|
8
|
-
* - `./bin/run.js` sets
|
|
7
|
+
* - `./bin/dev.js` sets BRV_ENV=development
|
|
8
|
+
* - `./bin/run.js` sets BRV_ENV=production
|
|
9
9
|
*/
|
|
10
10
|
export declare const ENVIRONMENT: Environment;
|
|
11
11
|
/**
|
|
@@ -21,6 +21,7 @@ type EnvironmentConfig = {
|
|
|
21
21
|
mixpanelToken: string;
|
|
22
22
|
scopes: string[];
|
|
23
23
|
tokenUrl: string;
|
|
24
|
+
webAppUrl: string;
|
|
24
25
|
};
|
|
25
26
|
/**
|
|
26
27
|
* Configuration for each environment.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Current environment - set at runtime by the launcher scripts.
|
|
3
|
-
* - `./bin/dev.js` sets
|
|
4
|
-
* - `./bin/run.js` sets
|
|
3
|
+
* - `./bin/dev.js` sets BRV_ENV=development
|
|
4
|
+
* - `./bin/run.js` sets BRV_ENV=production
|
|
5
5
|
*/
|
|
6
|
-
export const ENVIRONMENT = process.env.
|
|
6
|
+
export const ENVIRONMENT = process.env.BRV_ENV ?? 'development';
|
|
7
7
|
/**
|
|
8
8
|
* Configuration for each environment.
|
|
9
9
|
* These values are bundled at build time.
|
|
@@ -19,6 +19,7 @@ export const ENV_CONFIG = {
|
|
|
19
19
|
mixpanelToken: '258e1a2b3d44cc634ef28964771b1da0',
|
|
20
20
|
scopes: ['read', 'write', 'debug'],
|
|
21
21
|
tokenUrl: 'https://dev-beta-iam.byterover.dev/api/v1/oidc/token',
|
|
22
|
+
webAppUrl: 'https://dev-beta-app.byterover.dev/',
|
|
22
23
|
},
|
|
23
24
|
production: {
|
|
24
25
|
apiBaseUrl: 'https://beta-iam.byterover.dev/api/v1',
|
|
@@ -30,6 +31,7 @@ export const ENV_CONFIG = {
|
|
|
30
31
|
mixpanelToken: '4d1198b346d2d6ac75f2e77905cc65ac',
|
|
31
32
|
scopes: ['read', 'write'],
|
|
32
33
|
tokenUrl: 'https://beta-iam.byterover.dev/api/v1/oidc/token',
|
|
34
|
+
webAppUrl: 'https://beta-app.byterover.dev',
|
|
33
35
|
},
|
|
34
36
|
};
|
|
35
37
|
/**
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const BRV_DIR = ".brv";
|
|
2
|
+
export declare const PROJECT_CONFIG_FILE = "config.json";
|
|
2
3
|
export declare const ACE_DIR = "ace";
|
|
3
4
|
export declare const EXECUTOR_OUTPUTS_DIR = "executor-outputs";
|
|
4
5
|
export declare const REFLECTIONS_DIR = "reflections";
|
|
5
6
|
export declare const DELTAS_DIR = "deltas";
|
|
6
7
|
export declare const BULLETS_DIR = "bullets";
|
|
8
|
+
export declare const PLAYBOOK_FILE = "playbook.json";
|
|
7
9
|
/**
|
|
8
10
|
* Default ByteRover branch name for memory storage.
|
|
9
11
|
* This is ByteRover's internal branching mechanism, not Git branches.
|
|
10
12
|
*/
|
|
11
13
|
export declare const DEFAULT_BRANCH = "main";
|
|
14
|
+
/**
|
|
15
|
+
* ByteRover documentation URL.
|
|
16
|
+
* Used in CLI help output to direct users to online documentation.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DOCS_URL = "https://docs.byterover.dev/beta";
|
package/dist/constants.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
export const BRV_DIR = '.brv';
|
|
2
|
+
export const PROJECT_CONFIG_FILE = 'config.json';
|
|
1
3
|
// ACE directory structure constants
|
|
2
|
-
export const BR_DIR = '.br';
|
|
3
4
|
export const ACE_DIR = 'ace';
|
|
4
5
|
export const EXECUTOR_OUTPUTS_DIR = 'executor-outputs';
|
|
5
6
|
export const REFLECTIONS_DIR = 'reflections';
|
|
6
7
|
export const DELTAS_DIR = 'deltas';
|
|
7
8
|
export const BULLETS_DIR = 'bullets';
|
|
9
|
+
export const PLAYBOOK_FILE = 'playbook.json';
|
|
8
10
|
/**
|
|
9
11
|
* Default ByteRover branch name for memory storage.
|
|
10
12
|
* This is ByteRover's internal branching mechanism, not Git branches.
|
|
11
13
|
*/
|
|
12
14
|
export const DEFAULT_BRANCH = 'main';
|
|
15
|
+
/**
|
|
16
|
+
* ByteRover documentation URL.
|
|
17
|
+
* Used in CLI help output to direct users to online documentation.
|
|
18
|
+
*/
|
|
19
|
+
export const DOCS_URL = 'https://docs.byterover.dev/beta';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Space } from './space.js';
|
|
2
2
|
/**
|
|
3
|
-
* Represents the configuration stored in .
|
|
3
|
+
* Represents the configuration stored in .brv/config.json
|
|
4
4
|
* This config links a project directory to a ByteRover space.
|
|
5
5
|
*/
|
|
6
|
-
export declare class
|
|
6
|
+
export declare class BrvConfig {
|
|
7
7
|
readonly createdAt: string;
|
|
8
8
|
readonly spaceId: string;
|
|
9
9
|
readonly spaceName: string;
|
|
@@ -13,11 +13,11 @@ export declare class BrConfig {
|
|
|
13
13
|
/**
|
|
14
14
|
* Deserializes config from JSON format
|
|
15
15
|
*/
|
|
16
|
-
static fromJson(json: Record<string, string>):
|
|
16
|
+
static fromJson(json: Record<string, string>): BrvConfig;
|
|
17
17
|
/**
|
|
18
|
-
* Creates a
|
|
18
|
+
* Creates a BrvConfig from a Space entity
|
|
19
19
|
*/
|
|
20
|
-
static fromSpace(space: Space):
|
|
20
|
+
static fromSpace(space: Space): BrvConfig;
|
|
21
21
|
/**
|
|
22
22
|
* Serializes the config to JSON format
|
|
23
23
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Represents the configuration stored in .
|
|
2
|
+
* Represents the configuration stored in .brv/config.json
|
|
3
3
|
* This config links a project directory to a ByteRover space.
|
|
4
4
|
*/
|
|
5
|
-
export class
|
|
5
|
+
export class BrvConfig {
|
|
6
6
|
createdAt;
|
|
7
7
|
spaceId;
|
|
8
8
|
spaceName;
|
|
@@ -35,13 +35,13 @@ export class BrConfig {
|
|
|
35
35
|
* Deserializes config from JSON format
|
|
36
36
|
*/
|
|
37
37
|
static fromJson(json) {
|
|
38
|
-
return new
|
|
38
|
+
return new BrvConfig(json.createdAt, json.spaceId, json.spaceName, json.teamId, json.teamName);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* Creates a
|
|
41
|
+
* Creates a BrvConfig from a Space entity
|
|
42
42
|
*/
|
|
43
43
|
static fromSpace(space) {
|
|
44
|
-
return new
|
|
44
|
+
return new BrvConfig(new Date().toISOString(), space.id, space.name, space.teamId, space.teamName);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Serializes the config to JSON format
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Array of all supported Events.
|
|
3
3
|
*/
|
|
4
|
-
export declare const EVENT_VALUES: readonly ["auth:signed_in", "space:init", "space:changed", "rule:generate", "ace:add_bullet", "ace:update_bullet", "ace:remove_bullet", "ace:view_status", "mem:push", "mem:retrieve"];
|
|
4
|
+
export declare const EVENT_VALUES: readonly ["auth:signed_in", "auth:signed_out", "space:init", "space:changed", "rule:generate", "ace:add_bullet", "ace:update_bullet", "ace:remove_bullet", "ace:view_status", "mem:push", "mem:retrieve"];
|
|
5
5
|
export type EventName = (typeof EVENT_VALUES)[number];
|
|
6
6
|
export interface PropertyDict {
|
|
7
7
|
[key: string]: any;
|
|
@@ -60,7 +60,7 @@ export interface IPlaybookService {
|
|
|
60
60
|
}>;
|
|
61
61
|
/**
|
|
62
62
|
* Initializes the ACE playbook directory structure and creates an empty playbook.
|
|
63
|
-
* Creates .
|
|
63
|
+
* Creates .brv/ace/ directory with subdirectories: reflections/, executor-outputs/, deltas/
|
|
64
64
|
* @param directory - Optional base directory (defaults to current working directory)
|
|
65
65
|
* @returns The absolute path to the created playbook file
|
|
66
66
|
* @throws Error if playbook already exists or initialization fails
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BrvConfig } from '../domain/entities/brv-config.js';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for storing and retrieving ByteRover CLI configuration.
|
|
4
|
-
* Implementations handle persistence of .
|
|
4
|
+
* Implementations handle persistence of .brv/config.json files.
|
|
5
5
|
*/
|
|
6
6
|
export interface IProjectConfigStore {
|
|
7
7
|
/**
|
|
8
|
-
* Checks if a configuration file exists in the .
|
|
8
|
+
* Checks if a configuration file exists in the .brv directory.
|
|
9
9
|
* @param directory The project directory to check (defaults to current working directory).
|
|
10
|
-
* @returns True if .
|
|
10
|
+
* @returns True if .brv/config.json exists, false otherwise.
|
|
11
11
|
*/
|
|
12
12
|
exists: (directory?: string) => Promise<boolean>;
|
|
13
13
|
/**
|
|
14
|
-
* Reads the configuration from the .
|
|
15
|
-
* @param directory The project directory containing .
|
|
14
|
+
* Reads the configuration from the .brv directory.
|
|
15
|
+
* @param directory The project directory containing .brv folder (defaults to current working directory)
|
|
16
16
|
* @returns The configuration if found, undefined otherwise
|
|
17
17
|
*/
|
|
18
|
-
read: (directory?: string) => Promise<
|
|
18
|
+
read: (directory?: string) => Promise<BrvConfig | undefined>;
|
|
19
19
|
/**
|
|
20
|
-
* Writes the configuration to the .
|
|
20
|
+
* Writes the configuration to the .brv directory.
|
|
21
21
|
* @param config The configuration to write.
|
|
22
|
-
* @param directory The project directory to create .
|
|
22
|
+
* @param directory The project directory to create .brv folder in (defaults to current working directory)
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
|
-
write: (config:
|
|
25
|
+
write: (config: BrvConfig, directory?: string) => Promise<void>;
|
|
26
26
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { DOCS_URL } from '../../constants.js';
|
|
3
|
+
const hook = async function (options) {
|
|
4
|
+
// Detect root help commands only (not command-specific help)
|
|
5
|
+
const isRootHelp = (options.id === undefined && options.argv.length === 0) || // bare `brv`
|
|
6
|
+
(options.id === '--help' && options.argv.length === 0) || // `brv --help`
|
|
7
|
+
(options.id === 'help' && options.argv.length === 0); // `brv help`
|
|
8
|
+
if (isRootHelp) {
|
|
9
|
+
const logo = [
|
|
10
|
+
chalk.greenBright(' ____ _ ____ '),
|
|
11
|
+
chalk.greenBright(String.raw ` | __ ) _ _| |_ ___| _ \ _____ _____ _ __ `),
|
|
12
|
+
chalk.green(String.raw ` | _ \| | | | __/ _ \ |_) / _ \ \ / / _ \ '__| `),
|
|
13
|
+
chalk.greenBright(String.raw ` | |_) | |_| | || __/ _ < (_) \ V / __/ | `),
|
|
14
|
+
chalk.cyan(String.raw ` |____/ \__, |\__\___|_| \_\___/ \_/ \___|_| `),
|
|
15
|
+
chalk.cyan(' |___/ '),
|
|
16
|
+
].join('\n');
|
|
17
|
+
const onboardingText = [
|
|
18
|
+
'ByteRover CLI quick start:',
|
|
19
|
+
'',
|
|
20
|
+
' 1. Authenticate with ByteRover:',
|
|
21
|
+
' brv login',
|
|
22
|
+
' 2. Link your workspace:',
|
|
23
|
+
' brv init',
|
|
24
|
+
'',
|
|
25
|
+
'After setup, run `brv status` to confirm connection and explore commands like `brv retrieve` or `brv complete`.',
|
|
26
|
+
].join('\n');
|
|
27
|
+
const docsLink = `For more information, run 'brv --help', 'brv [command] --help' or visit ${DOCS_URL}`;
|
|
28
|
+
this.log(`\n${logo}\n\n${onboardingText}\n\n${docsLink}\n\n`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
export default hook;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir, readFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { ACE_DIR,
|
|
3
|
+
import { ACE_DIR, BRV_DIR } from '../../constants.js';
|
|
4
4
|
import { DeltaBatch } from '../../core/domain/entities/delta-batch.js';
|
|
5
5
|
import { ExecutorOutput } from '../../core/domain/entities/executor-output.js';
|
|
6
6
|
import { ReflectorOutput } from '../../core/domain/entities/reflector-output.js';
|
|
@@ -38,7 +38,7 @@ export function generateTimestampedFilename(type, hint) {
|
|
|
38
38
|
*/
|
|
39
39
|
export async function ensureAceDirectory(baseDir, subdir) {
|
|
40
40
|
const resolvedBaseDir = baseDir ?? process.cwd();
|
|
41
|
-
const aceSubdir = join(resolvedBaseDir,
|
|
41
|
+
const aceSubdir = join(resolvedBaseDir, BRV_DIR, ACE_DIR, subdir);
|
|
42
42
|
await mkdir(aceSubdir, { recursive: true });
|
|
43
43
|
return aceSubdir;
|
|
44
44
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IBulletContentStore } from '../../core/interfaces/i-bullet-content-store.js';
|
|
2
2
|
/**
|
|
3
3
|
* File-based implementation of IBulletContentStore.
|
|
4
|
-
* Stores bullet content in .
|
|
4
|
+
* Stores bullet content in .brv/ace/bullets/{bullet-id}.md files.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FileBulletContentStore implements IBulletContentStore {
|
|
7
7
|
delete(bulletId: string, directory?: string): Promise<void>;
|
|
@@ -9,15 +9,15 @@ export declare class FileBulletContentStore implements IBulletContentStore {
|
|
|
9
9
|
load(bulletId: string, directory?: string): Promise<string | undefined>;
|
|
10
10
|
save(bulletId: string, content: string, directory?: string): Promise<string>;
|
|
11
11
|
/**
|
|
12
|
-
* Gets the full path to the .
|
|
12
|
+
* Gets the full path to the .brv/ace directory
|
|
13
13
|
*/
|
|
14
14
|
private getAceDirPath;
|
|
15
15
|
/**
|
|
16
|
-
* Gets the full path to the .
|
|
16
|
+
* Gets the full path to the .brv directory
|
|
17
17
|
*/
|
|
18
18
|
private getBrDirPath;
|
|
19
19
|
/**
|
|
20
|
-
* Gets the full path to the .
|
|
20
|
+
* Gets the full path to the .brv/ace/bullets directory
|
|
21
21
|
*/
|
|
22
22
|
private getBulletsDirPath;
|
|
23
23
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { ACE_DIR,
|
|
4
|
+
import { ACE_DIR, BRV_DIR, BULLETS_DIR } from '../../constants.js';
|
|
5
5
|
/**
|
|
6
6
|
* File-based implementation of IBulletContentStore.
|
|
7
|
-
* Stores bullet content in .
|
|
7
|
+
* Stores bullet content in .brv/ace/bullets/{bullet-id}.md files.
|
|
8
8
|
*/
|
|
9
9
|
export class FileBulletContentStore {
|
|
10
10
|
async delete(bulletId, directory) {
|
|
@@ -43,7 +43,7 @@ export class FileBulletContentStore {
|
|
|
43
43
|
const bulletsDirPath = this.getBulletsDirPath(directory);
|
|
44
44
|
const contentPath = this.getContentPath(bulletId, directory);
|
|
45
45
|
try {
|
|
46
|
-
// Create .
|
|
46
|
+
// Create .brv/ace/bullets directory if it doesn't exist
|
|
47
47
|
await mkdir(bulletsDirPath, { recursive: true });
|
|
48
48
|
// Add warning header to content
|
|
49
49
|
const header = `<!--
|
|
@@ -62,20 +62,20 @@ Renaming this file will break the link to the playbook metadata.
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Gets the full path to the .
|
|
65
|
+
* Gets the full path to the .brv/ace directory
|
|
66
66
|
*/
|
|
67
67
|
getAceDirPath(directory) {
|
|
68
68
|
return join(this.getBrDirPath(directory), ACE_DIR);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
|
-
* Gets the full path to the .
|
|
71
|
+
* Gets the full path to the .brv directory
|
|
72
72
|
*/
|
|
73
73
|
getBrDirPath(directory) {
|
|
74
74
|
const baseDir = directory ?? process.cwd();
|
|
75
|
-
return join(baseDir,
|
|
75
|
+
return join(baseDir, BRV_DIR);
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
|
-
* Gets the full path to the .
|
|
78
|
+
* Gets the full path to the .brv/ace/bullets directory
|
|
79
79
|
*/
|
|
80
80
|
getBulletsDirPath(directory) {
|
|
81
81
|
return join(this.getAceDirPath(directory), BULLETS_DIR);
|
|
@@ -2,7 +2,7 @@ import type { DeltaBatch } from '../../core/domain/entities/delta-batch.js';
|
|
|
2
2
|
import type { IDeltaStore } from '../../core/interfaces/i-delta-store.js';
|
|
3
3
|
/**
|
|
4
4
|
* File-based implementation of IDeltaStore.
|
|
5
|
-
* Stores delta batches as JSON files in .
|
|
5
|
+
* Stores delta batches as JSON files in .brv/ace/deltas/ directory.
|
|
6
6
|
*/
|
|
7
7
|
export declare class FileDeltaStore implements IDeltaStore {
|
|
8
8
|
save(deltaBatch: DeltaBatch, hint?: string, directory?: string): Promise<string>;
|
|
@@ -4,7 +4,7 @@ import { DELTAS_DIR } from '../../constants.js';
|
|
|
4
4
|
import { ensureAceDirectory, generateTimestampedFilename } from './ace-file-utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* File-based implementation of IDeltaStore.
|
|
7
|
-
* Stores delta batches as JSON files in .
|
|
7
|
+
* Stores delta batches as JSON files in .brv/ace/deltas/ directory.
|
|
8
8
|
*/
|
|
9
9
|
export class FileDeltaStore {
|
|
10
10
|
async save(deltaBatch, hint, directory) {
|
|
@@ -2,7 +2,7 @@ import type { ExecutorOutput } from '../../core/domain/entities/executor-output.
|
|
|
2
2
|
import type { IExecutorOutputStore } from '../../core/interfaces/i-executor-output-store.js';
|
|
3
3
|
/**
|
|
4
4
|
* File-based implementation of IExecutorOutputStore.
|
|
5
|
-
* Stores executor outputs as JSON files in .
|
|
5
|
+
* Stores executor outputs as JSON files in .brv/ace/executor-outputs/ directory.
|
|
6
6
|
*/
|
|
7
7
|
export declare class FileExecutorOutputStore implements IExecutorOutputStore {
|
|
8
8
|
save(output: ExecutorOutput, directory?: string): Promise<string>;
|
|
@@ -4,7 +4,7 @@ import { EXECUTOR_OUTPUTS_DIR } from '../../constants.js';
|
|
|
4
4
|
import { ensureAceDirectory, generateTimestampedFilename } from './ace-file-utils.js';
|
|
5
5
|
/**
|
|
6
6
|
* File-based implementation of IExecutorOutputStore.
|
|
7
|
-
* Stores executor outputs as JSON files in .
|
|
7
|
+
* Stores executor outputs as JSON files in .brv/ace/executor-outputs/ directory.
|
|
8
8
|
*/
|
|
9
9
|
export class FileExecutorOutputStore {
|
|
10
10
|
async save(output, directory) {
|
|
@@ -3,7 +3,7 @@ import type { IPlaybookStore } from '../../core/interfaces/i-playbook-store.js';
|
|
|
3
3
|
import { Playbook } from '../../core/domain/entities/playbook.js';
|
|
4
4
|
/**
|
|
5
5
|
* File-based implementation of IPlaybookStore.
|
|
6
|
-
* Stores playbook metadata in .
|
|
6
|
+
* Stores playbook metadata in .brv/ace/playbook.json and bullet content in .brv/ace/bullets/{id}.md files.
|
|
7
7
|
*/
|
|
8
8
|
export declare class FilePlaybookStore implements IPlaybookStore {
|
|
9
9
|
private static readonly PLAYBOOK_FILE;
|
|
@@ -15,11 +15,11 @@ export declare class FilePlaybookStore implements IPlaybookStore {
|
|
|
15
15
|
load(directory?: string): Promise<Playbook | undefined>;
|
|
16
16
|
save(playbook: Playbook, directory?: string): Promise<void>;
|
|
17
17
|
/**
|
|
18
|
-
* Gets the full path to the .
|
|
18
|
+
* Gets the full path to the .brv/ace directory
|
|
19
19
|
*/
|
|
20
20
|
private getAceDirPath;
|
|
21
21
|
/**
|
|
22
|
-
* Gets the full path to the .
|
|
22
|
+
* Gets the full path to the .brv directory
|
|
23
23
|
*/
|
|
24
24
|
private getBrDirPath;
|
|
25
25
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import { ACE_DIR,
|
|
4
|
+
import { ACE_DIR, BRV_DIR } from '../../constants.js';
|
|
5
5
|
import { Playbook } from '../../core/domain/entities/playbook.js';
|
|
6
6
|
import { PlaybookNotFoundError } from '../../core/domain/errors/ace-error.js';
|
|
7
7
|
import { FileBulletContentStore } from './file-bullet-content-store.js';
|
|
8
8
|
/**
|
|
9
9
|
* File-based implementation of IPlaybookStore.
|
|
10
|
-
* Stores playbook metadata in .
|
|
10
|
+
* Stores playbook metadata in .brv/ace/playbook.json and bullet content in .brv/ace/bullets/{id}.md files.
|
|
11
11
|
*/
|
|
12
12
|
export class FilePlaybookStore {
|
|
13
13
|
static PLAYBOOK_FILE = 'playbook.json';
|
|
@@ -72,7 +72,7 @@ export class FilePlaybookStore {
|
|
|
72
72
|
const aceDirPath = this.getAceDirPath(directory);
|
|
73
73
|
const playbookPath = this.getPlaybookPath(directory);
|
|
74
74
|
try {
|
|
75
|
-
// Create .
|
|
75
|
+
// Create .brv/ace directory if it doesn't exist
|
|
76
76
|
await mkdir(aceDirPath, { recursive: true });
|
|
77
77
|
// Save all bullet content to separate files
|
|
78
78
|
const bullets = playbook.getBullets();
|
|
@@ -86,17 +86,17 @@ export class FilePlaybookStore {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Gets the full path to the .
|
|
89
|
+
* Gets the full path to the .brv/ace directory
|
|
90
90
|
*/
|
|
91
91
|
getAceDirPath(directory) {
|
|
92
92
|
return join(this.getBrDirPath(directory), ACE_DIR);
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Gets the full path to the .
|
|
95
|
+
* Gets the full path to the .brv directory
|
|
96
96
|
*/
|
|
97
97
|
getBrDirPath(directory) {
|
|
98
98
|
const baseDir = directory ?? process.cwd();
|
|
99
|
-
return join(baseDir,
|
|
99
|
+
return join(baseDir, BRV_DIR);
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Gets the full path to the playbook.json file
|
|
@@ -2,7 +2,7 @@ import type { IReflectionStore } from '../../core/interfaces/i-reflection-store.
|
|
|
2
2
|
import { ReflectorOutput } from '../../core/domain/entities/reflector-output.js';
|
|
3
3
|
/**
|
|
4
4
|
* File-based implementation of IReflectionStore.
|
|
5
|
-
* Stores reflections as JSON files in .
|
|
5
|
+
* Stores reflections as JSON files in .brv/ace/reflections/ directory.
|
|
6
6
|
*/
|
|
7
7
|
export declare class FileReflectionStore implements IReflectionStore {
|
|
8
8
|
loadRecent(directory?: string, count?: number): Promise<ReflectorOutput[]>;
|
|
@@ -5,7 +5,7 @@ import { ReflectorOutput } from '../../core/domain/entities/reflector-output.js'
|
|
|
5
5
|
import { ensureAceDirectory, generateTimestampedFilename } from './ace-file-utils.js';
|
|
6
6
|
/**
|
|
7
7
|
* File-based implementation of IReflectionStore.
|
|
8
|
-
* Stores reflections as JSON files in .
|
|
8
|
+
* Stores reflections as JSON files in .brv/ace/reflections/ directory.
|
|
9
9
|
*/
|
|
10
10
|
export class FileReflectionStore {
|
|
11
11
|
async loadRecent(directory, count = 3) {
|