### Getting Started with ByteRover CLI Source: https://docs.byterover.dev/beta/reference/cli-reference Initializes your project by authenticating with ByteRover and setting up the project configuration. Authentication uses OAuth 2.0 with PKCE flow, storing credentials securely. The 'brv init' command creates a '.brv/' directory for configuration and context tree structure. ```bash brv login brv init ``` -------------------------------- ### Install ByteRover CLI Source: https://docs.byterover.dev/beta/migration-br-brv Instructions for uninstalling the old ByteRover CLI and installing the new version using npm. This ensures the 'brv' command is available for use. ```bash npm uninstall -g byterover-cli npm install -g byterover-cli ``` -------------------------------- ### Troubleshoot ByteRover CLI Installation Source: https://docs.byterover.dev/beta/migration-br-brv Commands to verify the ByteRover CLI installation and check the installed version. This helps resolve 'command not found: brv' errors. ```bash npm install -g byterover-cli npm list -g # byterover-cli should show version 0.2.0 or higher ``` -------------------------------- ### Example context.md File Content Source: https://docs.byterover.dev/beta/context-tree/local-space-structure Demonstrates the content of a `context.md` file, including markdown explanations, TypeScript code examples for custom error classes, and how to define relations to other topics. ```markdown Always use custom error classes for better error handling in the Express API: ```typescript // Custom error class pattern class ValidationError extends Error { constructor(message: string) { super(message) this.name = 'ValidationError' } } ``` Use try-catch blocks at route level and pass errors to middleware. ## Relations @code_style/naming-conventions @testing/integration-tests/api-tests ``` ```markdown ## Relations @code_style/error-handling @testing/integration-tests @structure/api-endpoints/validation ``` -------------------------------- ### Project Migration Steps for ByteRover CLI Source: https://docs.byterover.dev/beta/migration-br-brv Steps to migrate an existing ByteRover project to use the new 'brv' command. This includes removing old configurations, re-authenticating, and re-initializing the project. ```bash cd to/your/project br push ``` ```bash rm -rf .br ``` ```bash brv login ``` ```bash brv init ``` ```bash brv status ``` ```bash brv retrieve --query "your project context" ``` -------------------------------- ### Verify ByteRover CLI Installation Source: https://docs.byterover.dev/beta/migration-br-brv Command to check the installed version of the ByteRover CLI. It should display version 0.2.0 or higher after successful installation. ```bash brv --version ``` -------------------------------- ### Update Scripts and CI/CD for ByteRover CLI Source: https://docs.byterover.dev/beta/migration-br-brv Example of updating ByteRover CLI commands in scripts and pipelines from 'br' to 'brv'. This is crucial for automated workflows. ```bash # Before: br login br init br push # After: brv login brv init brv push ``` -------------------------------- ### Example Context Tree Directory Structure Source: https://docs.byterover.dev/beta/context-tree/local-space-structure Illustrates the hierarchical organization of the context tree within the `.brv/context-tree/` directory, showing domains, topics, and the optional nesting of subtopics. ```tree .brv/context-tree/ ├── code_style/ │ ├── error-handling/ │ ├── naming-conventions/ │ └── api-design/ ├── testing/ │ ├── integration-tests/ │ └── unit-tests/ └── structure/ ├── api-endpoints/ └── database-schema/ ``` ```tree .brv/context-tree/ └── testing/ └── integration-tests/ ├── context.md # Overview of integration testing └── api-tests/ # Subtopic └── context.md # Specific to API testing ``` -------------------------------- ### Curate Context with Customization via Chat Prompt Source: https://docs.byterover.dev/beta/common-workflows/add This example demonstrates how to use a chat interface with ByteRover to customize context curation. Users can provide instructions, such as breaking context into smaller pieces or keeping it together, which are then translated into ByteRover CLI commands. This allows for flexible organization of knowledge. ```markdown > curate the following context about health check implementation > [Your content here] > break it into small context pieces ``` ```markdown > curate the following context, break it into small focused pieces > [Your content here] ``` ```markdown > curate the following context, keep it together as one topic > [Your content here] ``` -------------------------------- ### Create ByteRover CLI Alias Source: https://docs.byterover.dev/beta/migration-br-brv Example of creating a shell alias to map the old 'br' command to the new 'brv' command. This can be added to shell configuration files like .bashrc or .zshrc. ```bash # Add to your ~/.bashrc or ~/.zshrc alias br='brv' ``` -------------------------------- ### Run Bytrover Curate Command Source: https://docs.byterover.dev/beta/common-workflows/add This command initiates the Bytrover context curation process. It is used in interactive mode to start the manual selection of domains and topics for adding new content to the context tree. ```bash $ brv curate ``` -------------------------------- ### Example Context for Health Check Endpoint Source: https://docs.byterover.dev/beta/common-workflows/add This markdown content outlines the task, steps, and success criteria for adding a health check endpoint to an Express server. It serves as an example of the content that can be curated into the Bytrover context tree. ```markdown # Health Check Endpoint Task: Add a health check endpoint to the Express server Steps: 1. Create basic Express server setup - File: src/server.ts - Set up Express app with TypeScript - Configure basic middleware 2. Create health check route - File: src/routes/health.ts - Implement GET /health endpoint - Return status, timestamp, uptime 3. Add types for response - File: src/types/health.ts - Define TypeScript interface 4. Create tests - File: tests/health.test.ts - Test endpoint returns 200 - Validate response structure 5. Update package.json scripts - Add dev script - Add test script Success Criteria: - GET /health returns 200 status - Response includes: status, timestamp, uptime - TypeScript compiles without errors - Tests pass ``` -------------------------------- ### Get ByteRover Status as JSON Source: https://docs.byterover.dev/beta/reference/cli-reference The `brv status --format json` command outputs the current status of the ByteRover CLI and project in JSON format. This includes CLI version, authentication status, current directory, project initialization details, and context tree status. ```bash brv status --format json ``` -------------------------------- ### Initialize ByteRover Project Source: https://docs.byterover.dev/beta/reference/cli-reference The `brv init` command initializes a new ByteRover project. It creates a `.brv/config.json` file for team and space selection and sets up the project's context tree structure. It can be run interactively or with the `--force` flag for automation. ```bash # Initialize project (interactive team/space selection) brv init # Complete first-time setup brv login brv init # Force re-initialization without confirmation (for scripts/automation) brv init --force ``` -------------------------------- ### Initializing a ByteRover Project Source: https://docs.byterover.dev/beta/reference/cli-reference Initializes a new project for use with ByteRover CLI. This command prompts the user to select a team and space and creates a '.brv/' directory in the project with necessary configuration files and context tree structure. ```bash brv init ``` -------------------------------- ### ByteRover CLI Global Options Source: https://docs.byterover.dev/beta/reference/cli-reference Provides global options for the ByteRover CLI that can be used with any command. These options include '--help' to display command-specific help information and '--version' to show the current version of the CLI. ```bash brv --help brv init --help brv --version ``` -------------------------------- ### Curate Project Context with ByteRover CLI Source: https://docs.byterover.dev/beta/common-workflows/add This command uses ByteRover's autonomous mode to curate and organize project context. It analyzes the provided task description, detects relevant domains, searches for existing knowledge, and creates or updates context topics hierarchically. Dependencies include the ByteRover CLI tool. ```bash $ brv curate "Task: Add a health check endpoint to the Express server Steps: 1. Create basic Express server setup - File: src/server.ts - Set up Express app with TypeScript - Configure basic middleware 2. Create health check route - File: src/routes/health.ts - Implement GET /health endpoint - Return status, timestamp, uptime 3. Add types for response - File: src/types/health.ts - Define TypeScript interface 4. Create tests - File: tests/health.test.ts - Test endpoint returns 200 - Validate response structure 5. Update package.json scripts - Add dev script - Add test script Success Criteria: - GET /health returns 200 status - Response includes: status, timestamp, uptime - TypeScript compiles without errors - Tests pass" ``` -------------------------------- ### Query ByteRover Context Tree Source: https://docs.byterover.dev/beta/reference/cli-reference The `brv query` command enables agentic search within the project's context tree using natural language. It performs multi-step reasoning to find and synthesize comprehensive answers to questions about the codebase or project. Requires login and initialization. ```bash # Query context tree about authentication brv query "How is user authentication implemented?" # Query about implementation details brv query "What are the API rate limits and where are they enforced?" # Query about project structure brv query "What testing strategies are used?" ``` -------------------------------- ### Agent and Utility Commands Source: https://docs.byterover.dev/beta/reference/cli-reference Commands for generating rules for coding agents and general help. ```APIDOC ## `brv gen-rules` ### Description Generate rule instructions for coding agents based on the current project context and codebase. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash brv gen-rules ``` ### Response #### Success Response (200) Generated rule instructions for coding agents. #### Response Example ```json { "rules": [ "Follow SOLID principles.", "Use async/await for non-blocking operations.", "Document all public functions." ] } ``` ``` -------------------------------- ### Authenticating with ByteRover CLI Source: https://docs.byterover.dev/beta/reference/cli-reference Logs the user into the ByteRover CLI using OAuth 2.0 with PKCE flow. This command opens a browser for authentication and securely stores tokens in the system's keychain. It's the first command to run when setting up ByteRover. ```bash brv login ``` -------------------------------- ### Project and Status Commands Source: https://docs.byterover.dev/beta/reference/cli-reference Commands for initializing and checking the status of a ByteRover project. ```APIDOC ## `brv init` ### Description Initialize a project with ByteRover. This command prompts for team and space selection and creates a `.brv/` directory with configuration and context tree structure. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash brv init ``` ### Response #### Success Response (200) Project initialized. `.brv/` directory created. #### Response Example (No direct output, indicates success via creation of `.brv/` directory and setup) ``` ```APIDOC ## `brv status [DIRECTORY]` ### Description Show CLI status and project information. Displays local context tree managed by ByteRover CLI for the specified or current directory. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters #### Path Parameters - `DIRECTORY` (string) - Optional - Project directory (defaults to current directory) #### Query Parameters - `-f, --format