byterover-cli 0.1.1 → 0.2.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 +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.js +13 -8
- 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/interfaces/i-playbook-service.d.ts +1 -1
- package/dist/core/interfaces/i-project-config-store.d.ts +10 -10
- 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/templates/README.md +5 -5
- package/dist/templates/sections/command-reference.md +23 -23
- package/dist/templates/sections/workflow.md +3 -4
- package/oclif.manifest.json +3 -3
- package/package.json +7 -4
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
|
|
@@ -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) {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
|
|
2
|
-
import {
|
|
2
|
+
import { BrvConfig } from '../../core/domain/entities/brv-config.js';
|
|
3
3
|
/**
|
|
4
4
|
* File-based implementation of IProjectConfigStore.
|
|
5
|
-
* Stores configuration in .
|
|
5
|
+
* Stores configuration in .brv/config.json in the project directory.
|
|
6
6
|
*/
|
|
7
7
|
export declare class ProjectConfigStore implements IProjectConfigStore {
|
|
8
|
-
private static readonly BR_DIR;
|
|
9
|
-
private static readonly CONFIG_FILE;
|
|
10
8
|
exists(directory?: string): Promise<boolean>;
|
|
11
|
-
read(directory?: string): Promise<
|
|
12
|
-
write(config:
|
|
9
|
+
read(directory?: string): Promise<BrvConfig | undefined>;
|
|
10
|
+
write(config: BrvConfig, directory?: string): Promise<void>;
|
|
13
11
|
/**
|
|
14
|
-
* Gets the full path to the .
|
|
12
|
+
* Gets the full path to the .brv directory.
|
|
15
13
|
*/
|
|
16
|
-
private
|
|
14
|
+
private getBrvDirPath;
|
|
17
15
|
/**
|
|
18
16
|
* Gets the full path to the config.json file.
|
|
19
17
|
*/
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { BRV_DIR, PROJECT_CONFIG_FILE } from '../../constants.js';
|
|
5
|
+
import { BrvConfig } from '../../core/domain/entities/brv-config.js';
|
|
5
6
|
/**
|
|
6
7
|
* File-based implementation of IProjectConfigStore.
|
|
7
|
-
* Stores configuration in .
|
|
8
|
+
* Stores configuration in .brv/config.json in the project directory.
|
|
8
9
|
*/
|
|
9
10
|
export class ProjectConfigStore {
|
|
10
|
-
static BR_DIR = '.br';
|
|
11
|
-
static CONFIG_FILE = 'config.json';
|
|
12
11
|
async exists(directory) {
|
|
13
12
|
const configPath = this.getConfigPath(directory);
|
|
14
13
|
return existsSync(configPath);
|
|
@@ -21,17 +20,17 @@ export class ProjectConfigStore {
|
|
|
21
20
|
try {
|
|
22
21
|
const content = await readFile(configPath, 'utf8');
|
|
23
22
|
const json = JSON.parse(content);
|
|
24
|
-
return
|
|
23
|
+
return BrvConfig.fromJson(json);
|
|
25
24
|
}
|
|
26
25
|
catch (error) {
|
|
27
26
|
throw new Error(`Failed to read config from ${configPath}: ${error.message}`);
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
async write(config, directory) {
|
|
31
|
-
const brDirPath = this.
|
|
30
|
+
const brDirPath = this.getBrvDirPath(directory);
|
|
32
31
|
const configPath = this.getConfigPath(directory);
|
|
33
32
|
try {
|
|
34
|
-
// Create .
|
|
33
|
+
// Create .brv directory if it doesn't exist
|
|
35
34
|
await mkdir(brDirPath, { recursive: true });
|
|
36
35
|
// Write config.json
|
|
37
36
|
const content = JSON.stringify(config.toJson(), undefined, 2);
|
|
@@ -42,16 +41,16 @@ export class ProjectConfigStore {
|
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
/**
|
|
45
|
-
* Gets the full path to the .
|
|
44
|
+
* Gets the full path to the .brv directory.
|
|
46
45
|
*/
|
|
47
|
-
|
|
46
|
+
getBrvDirPath(directory) {
|
|
48
47
|
const baseDir = directory ?? process.cwd();
|
|
49
|
-
return join(baseDir,
|
|
48
|
+
return join(baseDir, BRV_DIR);
|
|
50
49
|
}
|
|
51
50
|
/**
|
|
52
51
|
* Gets the full path to the config.json file.
|
|
53
52
|
*/
|
|
54
53
|
getConfigPath(directory) {
|
|
55
|
-
return join(this.
|
|
54
|
+
return join(this.getBrvDirPath(directory), PROJECT_CONFIG_FILE);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
@@ -13,7 +13,6 @@ export type PlaybookServiceConfig = {
|
|
|
13
13
|
* bullet management, delta application, and reflection tag processing.
|
|
14
14
|
*/
|
|
15
15
|
export declare class FilePlaybookService implements IPlaybookService {
|
|
16
|
-
private static readonly BULLETS_DIR;
|
|
17
16
|
private static readonly SUBDIRS;
|
|
18
17
|
private readonly config;
|
|
19
18
|
private readonly playbookStore;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mkdir } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import { ACE_DIR,
|
|
3
|
+
import { ACE_DIR, BRV_DIR, BULLETS_DIR, DELTAS_DIR, EXECUTOR_OUTPUTS_DIR, REFLECTIONS_DIR } from '../../constants.js';
|
|
4
4
|
import { Playbook } from '../../core/domain/entities/playbook.js';
|
|
5
5
|
import { FilePlaybookStore } from '../ace/file-playbook-store.js';
|
|
6
6
|
/**
|
|
@@ -9,8 +9,7 @@ import { FilePlaybookStore } from '../ace/file-playbook-store.js';
|
|
|
9
9
|
* bullet management, delta application, and reflection tag processing.
|
|
10
10
|
*/
|
|
11
11
|
export class FilePlaybookService {
|
|
12
|
-
static
|
|
13
|
-
static SUBDIRS = [REFLECTIONS_DIR, EXECUTOR_OUTPUTS_DIR, DELTAS_DIR, FilePlaybookService.BULLETS_DIR];
|
|
12
|
+
static SUBDIRS = [REFLECTIONS_DIR, EXECUTOR_OUTPUTS_DIR, DELTAS_DIR, BULLETS_DIR];
|
|
14
13
|
config;
|
|
15
14
|
playbookStore;
|
|
16
15
|
constructor(config = {}, playbookStore = new FilePlaybookStore()) {
|
|
@@ -87,7 +86,7 @@ export class FilePlaybookService {
|
|
|
87
86
|
// Load playbook
|
|
88
87
|
const playbook = await this.playbookStore.load(directory);
|
|
89
88
|
if (!playbook) {
|
|
90
|
-
throw new Error('Playbook not found. Run `
|
|
89
|
+
throw new Error('Playbook not found. Run `brv init` to initialize.');
|
|
91
90
|
}
|
|
92
91
|
// Apply tags from reflection
|
|
93
92
|
let tagsApplied = 0;
|
|
@@ -114,16 +113,16 @@ export class FilePlaybookService {
|
|
|
114
113
|
}
|
|
115
114
|
async initialize(directory) {
|
|
116
115
|
const baseDir = directory ?? this.config.baseDirectory ?? process.cwd();
|
|
117
|
-
const
|
|
118
|
-
const aceDir = join(
|
|
119
|
-
// Create .
|
|
116
|
+
const brvDir = join(baseDir, BRV_DIR);
|
|
117
|
+
const aceDir = join(brvDir, ACE_DIR);
|
|
118
|
+
// Create .brv/ace/ directory
|
|
120
119
|
await mkdir(aceDir, { recursive: true });
|
|
121
120
|
// Create subdirectories
|
|
122
121
|
await Promise.all(FilePlaybookService.SUBDIRS.map((subdir) => mkdir(join(aceDir, subdir), { recursive: true })));
|
|
123
122
|
// Check if playbook already exists
|
|
124
123
|
const exists = await this.playbookStore.exists(directory ?? this.config.baseDirectory);
|
|
125
124
|
if (exists) {
|
|
126
|
-
throw new Error('Playbook already exists. Use `
|
|
125
|
+
throw new Error('Playbook already exists. Use `brv clear` to remove it first.');
|
|
127
126
|
}
|
|
128
127
|
// Create empty playbook
|
|
129
128
|
const playbook = new Playbook();
|
package/dist/templates/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ByteRover CLI Template System
|
|
2
2
|
|
|
3
|
-
This directory contains template files used to generate agent instructions via the `
|
|
3
|
+
This directory contains template files used to generate agent instructions via the `brv gen-rules` command.
|
|
4
4
|
|
|
5
5
|
## Directory Structure
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ Each command includes:
|
|
|
44
44
|
|
|
45
45
|
## How It Works
|
|
46
46
|
|
|
47
|
-
1. User runs `
|
|
47
|
+
1. User runs `brv gen-rules`
|
|
48
48
|
2. User selects an agent (e.g., "Claude Code")
|
|
49
49
|
3. `RuleTemplateService` loads templates via `FsTemplateLoader`
|
|
50
50
|
4. Templates are assembled:
|
|
@@ -62,10 +62,10 @@ The template system supports simple variable substitution using `{{variable_name
|
|
|
62
62
|
## Updating Templates
|
|
63
63
|
|
|
64
64
|
### To Update Command Documentation:
|
|
65
|
-
Edit `sections/command-reference.md` - changes will be reflected next time `
|
|
65
|
+
Edit `sections/command-reference.md` - changes will be reflected next time `brv gen-rules` runs.
|
|
66
66
|
|
|
67
67
|
### To Update ACE Workflow Guide:
|
|
68
|
-
Edit `sections/workflow.md` - changes will be reflected next time `
|
|
68
|
+
Edit `sections/workflow.md` - changes will be reflected next time `brv gen-rules` runs.
|
|
69
69
|
|
|
70
70
|
### To Change Output Structure:
|
|
71
71
|
Edit `base.md` - modify how sections are combined.
|
|
@@ -75,7 +75,7 @@ Edit `base.md` - modify how sections are combined.
|
|
|
75
75
|
1. **Keep templates in sync with code**: When adding/modifying commands, update `command-reference.md`
|
|
76
76
|
2. **Use clear examples**: Show realistic use cases in examples
|
|
77
77
|
3. **Maintain markdown formatting**: Ensure proper headers, code blocks, and lists
|
|
78
|
-
4. **Test after changes**: Run `
|
|
78
|
+
4. **Test after changes**: Run `brv gen-rules` and verify output in `.clinerules/byterover-rules.md`
|
|
79
79
|
|
|
80
80
|
## Future Enhancements
|
|
81
81
|
|