byterover-cli 1.2.0 → 1.3.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.
Files changed (91) hide show
  1. package/README.md +87 -9
  2. package/dist/constants.d.ts +0 -5
  3. package/dist/constants.js +0 -5
  4. package/dist/core/domain/cipher/agent/agent-info.d.ts +17 -17
  5. package/dist/core/domain/cipher/llm/schemas.d.ts +14 -14
  6. package/dist/core/domain/cipher/session/session-metadata.d.ts +2 -2
  7. package/dist/core/domain/entities/agent.js +6 -6
  8. package/dist/core/domain/entities/connector-type.d.ts +2 -1
  9. package/dist/core/domain/entities/connector-type.js +2 -1
  10. package/dist/core/domain/transport/schemas.d.ts +66 -66
  11. package/dist/core/interfaces/cipher/i-chat-session.d.ts +3 -1
  12. package/dist/core/interfaces/connectors/i-connector.d.ts +2 -2
  13. package/dist/core/interfaces/i-file-service.d.ts +7 -0
  14. package/dist/infra/auth/oauth-service.d.ts +15 -0
  15. package/dist/infra/auth/oauth-service.js +38 -2
  16. package/dist/infra/cipher/agent/agent-schemas.d.ts +42 -42
  17. package/dist/infra/cipher/llm/context/context-manager.js +7 -9
  18. package/dist/infra/cipher/llm/internal-llm-service.d.ts +5 -1
  19. package/dist/infra/cipher/llm/internal-llm-service.js +57 -46
  20. package/dist/infra/cipher/session/chat-session.d.ts +3 -1
  21. package/dist/infra/cipher/session/chat-session.js +5 -3
  22. package/dist/infra/cipher/system-prompt/contributor-schemas.d.ts +8 -8
  23. package/dist/infra/cipher/system-prompt/schemas.d.ts +5 -5
  24. package/dist/infra/cipher/tools/implementations/task-tool.js +3 -3
  25. package/dist/infra/connectors/connector-manager.js +2 -0
  26. package/dist/infra/connectors/hook/hook-connector.d.ts +1 -1
  27. package/dist/infra/connectors/hook/hook-connector.js +3 -3
  28. package/dist/infra/connectors/mcp/mcp-connector.d.ts +1 -1
  29. package/dist/infra/connectors/mcp/mcp-connector.js +4 -4
  30. package/dist/infra/connectors/rules/rules-connector.d.ts +1 -1
  31. package/dist/infra/connectors/rules/rules-connector.js +4 -4
  32. package/dist/infra/connectors/shared/template-service.js +4 -0
  33. package/dist/infra/connectors/skill/index.d.ts +1 -0
  34. package/dist/infra/connectors/skill/index.js +1 -0
  35. package/dist/infra/connectors/skill/skill-connector-config.d.ts +45 -0
  36. package/dist/infra/connectors/skill/skill-connector-config.js +26 -0
  37. package/dist/infra/connectors/skill/skill-connector.d.ts +39 -0
  38. package/dist/infra/connectors/skill/skill-connector.js +160 -0
  39. package/dist/infra/connectors/skill/skill-content-loader.d.ts +18 -0
  40. package/dist/infra/connectors/skill/skill-content-loader.js +33 -0
  41. package/dist/infra/file/fs-file-service.d.ts +7 -0
  42. package/dist/infra/file/fs-file-service.js +15 -1
  43. package/dist/infra/mcp/tools/task-result-waiter.js +8 -0
  44. package/dist/infra/process/agent-worker.js +30 -14
  45. package/dist/infra/process/task-queue-manager.d.ts +23 -34
  46. package/dist/infra/process/task-queue-manager.js +57 -118
  47. package/dist/infra/process/transport-handlers.js +1 -7
  48. package/dist/infra/repl/commands/connectors-command.js +1 -1
  49. package/dist/infra/transport/socket-io-transport-client.d.ts +9 -0
  50. package/dist/infra/transport/socket-io-transport-client.js +21 -2
  51. package/dist/infra/usecase/connectors-use-case.js +8 -2
  52. package/dist/infra/usecase/init-use-case.js +1 -1
  53. package/dist/infra/usecase/reset-use-case.d.ts +1 -0
  54. package/dist/infra/usecase/reset-use-case.js +4 -1
  55. package/dist/{commands → oclif/commands}/curate.d.ts +1 -1
  56. package/dist/{commands → oclif/commands}/curate.js +6 -6
  57. package/dist/{commands → oclif/commands}/hook-prompt-submit.d.ts +1 -1
  58. package/dist/{commands → oclif/commands}/hook-prompt-submit.js +3 -3
  59. package/dist/{commands → oclif/commands}/main.js +10 -10
  60. package/dist/{commands → oclif/commands}/mcp.js +2 -2
  61. package/dist/{commands → oclif/commands}/query.d.ts +1 -1
  62. package/dist/{commands → oclif/commands}/query.js +6 -6
  63. package/dist/{commands → oclif/commands}/status.d.ts +1 -1
  64. package/dist/{commands → oclif/commands}/status.js +8 -8
  65. package/dist/{commands → oclif/commands}/watch.d.ts +3 -3
  66. package/dist/{commands → oclif/commands}/watch.js +6 -6
  67. package/dist/oclif/constants.d.ts +11 -0
  68. package/dist/oclif/constants.js +11 -0
  69. package/dist/{hooks → oclif/hooks}/prerun/validate-brv-config-version.d.ts +1 -1
  70. package/dist/{hooks → oclif/hooks}/prerun/validate-brv-config-version.js +2 -2
  71. package/dist/templates/sections/command-reference.md +5 -96
  72. package/dist/templates/sections/workflow.md +21 -16
  73. package/dist/templates/skill/SKILL.md +91 -0
  74. package/dist/templates/skill/TROUBLESHOOTING.md +50 -0
  75. package/dist/templates/skill/WORKFLOWS.md +229 -0
  76. package/dist/utils/type-guards.d.ts +11 -0
  77. package/dist/utils/type-guards.js +13 -0
  78. package/oclif.manifest.json +8 -1
  79. package/package.json +9 -9
  80. package/dist/infra/process/constants.d.ts +0 -1
  81. package/dist/infra/process/constants.js +0 -1
  82. /package/dist/{commands → oclif/commands}/main.d.ts +0 -0
  83. /package/dist/{commands → oclif/commands}/mcp.d.ts +0 -0
  84. /package/dist/{hooks → oclif/hooks}/command_not_found/handle-invalid-commands.d.ts +0 -0
  85. /package/dist/{hooks → oclif/hooks}/command_not_found/handle-invalid-commands.js +0 -0
  86. /package/dist/{hooks → oclif/hooks}/error/clean-errors.d.ts +0 -0
  87. /package/dist/{hooks → oclif/hooks}/error/clean-errors.js +0 -0
  88. /package/dist/{hooks → oclif/hooks}/init/update-notifier.d.ts +0 -0
  89. /package/dist/{hooks → oclif/hooks}/init/update-notifier.js +0 -0
  90. /package/dist/{hooks → oclif/hooks}/init/welcome.d.ts +0 -0
  91. /package/dist/{hooks → oclif/hooks}/init/welcome.js +0 -0
@@ -1,10 +1,10 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { isDevelopment } from '../config/environment.js';
3
- import { FileGlobalConfigStore } from '../infra/storage/file-global-config-store.js';
4
- import { createTokenStore } from '../infra/storage/token-store.js';
5
- import { OclifTerminal } from '../infra/terminal/oclif-terminal.js';
6
- import { MixpanelTrackingService } from '../infra/tracking/mixpanel-tracking-service.js';
7
- import { QueryUseCase } from '../infra/usecase/query-use-case.js';
2
+ import { isDevelopment } from '../../config/environment.js';
3
+ import { FileGlobalConfigStore } from '../../infra/storage/file-global-config-store.js';
4
+ import { createTokenStore } from '../../infra/storage/token-store.js';
5
+ import { OclifTerminal } from '../../infra/terminal/oclif-terminal.js';
6
+ import { MixpanelTrackingService } from '../../infra/tracking/mixpanel-tracking-service.js';
7
+ import { QueryUseCase } from '../../infra/usecase/query-use-case.js';
8
8
  export default class Query extends Command {
9
9
  static args = {
10
10
  query: Args.string({
@@ -1,5 +1,5 @@
1
1
  import { Command } from '@oclif/core';
2
- import type { IStatusUseCase } from '../core/interfaces/usecase/i-status-use-case.js';
2
+ import type { IStatusUseCase } from '../../core/interfaces/usecase/i-status-use-case.js';
3
3
  export default class Status extends Command {
4
4
  static args: {
5
5
  directory: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
@@ -1,12 +1,12 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
- import { ProjectConfigStore } from '../infra/config/file-config-store.js';
3
- import { FileContextTreeService } from '../infra/context-tree/file-context-tree-service.js';
4
- import { FileContextTreeSnapshotService } from '../infra/context-tree/file-context-tree-snapshot-service.js';
5
- import { FileGlobalConfigStore } from '../infra/storage/file-global-config-store.js';
6
- import { createTokenStore } from '../infra/storage/token-store.js';
7
- import { OclifTerminal } from '../infra/terminal/oclif-terminal.js';
8
- import { MixpanelTrackingService } from '../infra/tracking/mixpanel-tracking-service.js';
9
- import { StatusUseCase } from '../infra/usecase/status-use-case.js';
2
+ import { ProjectConfigStore } from '../../infra/config/file-config-store.js';
3
+ import { FileContextTreeService } from '../../infra/context-tree/file-context-tree-service.js';
4
+ import { FileContextTreeSnapshotService } from '../../infra/context-tree/file-context-tree-snapshot-service.js';
5
+ import { FileGlobalConfigStore } from '../../infra/storage/file-global-config-store.js';
6
+ import { createTokenStore } from '../../infra/storage/token-store.js';
7
+ import { OclifTerminal } from '../../infra/terminal/oclif-terminal.js';
8
+ import { MixpanelTrackingService } from '../../infra/tracking/mixpanel-tracking-service.js';
9
+ import { StatusUseCase } from '../../infra/usecase/status-use-case.js';
10
10
  export default class Status extends Command {
11
11
  static args = {
12
12
  directory: Args.string({ description: 'Project directory (defaults to current directory)', required: false }),
@@ -1,7 +1,7 @@
1
1
  import { Command } from '@oclif/core';
2
- import type { IFileWatcherService } from '../core/interfaces/i-file-watcher-service.js';
3
- import type { IProjectConfigStore } from '../core/interfaces/i-project-config-store.js';
4
- import type { ITerminal } from '../core/interfaces/i-terminal.js';
2
+ import type { IFileWatcherService } from '../../core/interfaces/i-file-watcher-service.js';
3
+ import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
4
+ import type { ITerminal } from '../../core/interfaces/i-terminal.js';
5
5
  export default class Watch extends Command {
6
6
  static description: string;
7
7
  static examples: string[];
@@ -1,10 +1,10 @@
1
1
  import { Command, Flags } from '@oclif/core';
2
- import { isDevelopment } from '../config/environment.js';
3
- import { ProjectConfigStore } from '../infra/config/file-config-store.js';
4
- import { CleanParserServiceFactory } from '../infra/parsers/clean/clean-parser-service-factory.js';
5
- import { RawParserServiceFactory } from '../infra/parsers/raw/raw-parser-service-factory.js';
6
- import { OclifTerminal } from '../infra/terminal/oclif-terminal.js';
7
- import { FileWatcherService } from '../infra/watcher/file-watcher-service.js';
2
+ import { isDevelopment } from '../../config/environment.js';
3
+ import { ProjectConfigStore } from '../../infra/config/file-config-store.js';
4
+ import { CleanParserServiceFactory } from '../../infra/parsers/clean/clean-parser-service-factory.js';
5
+ import { RawParserServiceFactory } from '../../infra/parsers/raw/raw-parser-service-factory.js';
6
+ import { OclifTerminal } from '../../infra/terminal/oclif-terminal.js';
7
+ import { FileWatcherService } from '../../infra/watcher/file-watcher-service.js';
8
8
  export default class Watch extends Command {
9
9
  static description = 'Watch file system directories for changes and trigger parsing pipeline [Development only]';
10
10
  static examples = [
@@ -0,0 +1,11 @@
1
+ /**
2
+ * oclif entry layer constants.
3
+ *
4
+ * Contains only constants actually used by oclif commands/hooks.
5
+ * Kept separate to maintain clean separation from core domain constants.
6
+ */
7
+ /**
8
+ * ByteRover documentation URL.
9
+ * Used in CLI help output to direct users to online documentation.
10
+ */
11
+ export declare const DOCS_URL = "https://docs.byterover.dev";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * oclif entry layer constants.
3
+ *
4
+ * Contains only constants actually used by oclif commands/hooks.
5
+ * Kept separate to maintain clean separation from core domain constants.
6
+ */
7
+ /**
8
+ * ByteRover documentation URL.
9
+ * Used in CLI help output to direct users to online documentation.
10
+ */
11
+ export const DOCS_URL = 'https://docs.byterover.dev';
@@ -1,5 +1,5 @@
1
1
  import type { Hook } from '@oclif/core';
2
- import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
2
+ import type { IProjectConfigStore } from '../../../core/interfaces/i-project-config-store.js';
3
3
  /**
4
4
  * Commands that should skip config version validation.
5
5
  * These commands either don't need config or create/recreate it.
@@ -1,5 +1,5 @@
1
- import { BrvConfigVersionError } from '../../core/domain/errors/brv-config-version-error.js';
2
- import { ProjectConfigStore } from '../../infra/config/file-config-store.js';
1
+ import { BrvConfigVersionError } from '../../../core/domain/errors/brv-config-version-error.js';
2
+ import { ProjectConfigStore } from '../../../infra/config/file-config-store.js';
3
3
  /**
4
4
  * Commands that should skip config version validation.
5
5
  * These commands either don't need config or create/recreate it.
@@ -1,100 +1,9 @@
1
1
  # ByteRover CLI Command Reference
2
2
 
3
- ## Memory Commands
3
+ ## Available Commands
4
4
 
5
- ### `brv curate`
5
+ - `brv curate` - Curate context to the context tree
6
+ - `brv query` - Query and retrieve information from the context tree
7
+ - `brv status` - Show CLI status and project information
6
8
 
7
- **Description:** Curate context to the context tree (interactive or autonomous mode)
8
-
9
- **Arguments:**
10
-
11
- - `CONTEXT`: Knowledge context: patterns, decisions, errors, or insights (triggers autonomous mode, optional)
12
-
13
- **Flags:**
14
-
15
- - `--files`, `-f`: Include file paths for critical context (max 5 files). Only text/code files from the current project directory are allowed. **CONTEXT argument must come BEFORE this flag.**
16
-
17
- **Good examples of context:**
18
-
19
- - "Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts"
20
- - "API rate limit is 100 req/min per user. Implemented using Redis with sliding window in rateLimiter.ts"
21
-
22
- **Bad examples:**
23
-
24
- - "Authentication" or "JWT tokens" (too vague, lacks context)
25
- - "Rate limiting" (no implementation details or file references)
26
-
27
- **Examples:**
28
-
29
- ```bash
30
- # Interactive mode (manually choose domain/topic)
31
- brv curate
32
-
33
- # Autonomous mode - LLM auto-categorizes your context
34
- brv curate "Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts"
35
-
36
- # Include files (CONTEXT must come before --files)
37
- # Single file
38
- brv curate "Authentication middleware validates JWT tokens" -f src/middleware/auth.ts
39
-
40
- # Multiple files - repeat --files flag for each file
41
- brv curate "JWT authentication implementation with refresh token rotation" --files src/auth/jwt.ts --files docs/auth.md
42
- ```
43
-
44
- **Behavior:**
45
-
46
- - Interactive mode: Navigate context tree, create topic folder, edit context.md
47
- - Autonomous mode: LLM automatically categorizes and places context in appropriate location
48
- - When `--files` is provided, agent reads files in parallel before creating knowledge topics
49
-
50
- **Requirements:** Project must be initialized (`brv init`) and authenticated (`brv login`)
51
-
52
- ---
53
-
54
- ### `brv query`
55
-
56
- **Description:** Query and retrieve information from the context tree
57
-
58
- **Arguments:**
59
-
60
- - `QUERY`: Natural language question about your codebase or project knowledge (required)
61
-
62
- **Good examples of queries:**
63
-
64
- - "How is user authentication implemented?"
65
- - "What are the API rate limits and where are they enforced?"
66
-
67
- **Bad examples:**
68
-
69
- - "auth" or "authentication" (too vague, not a question)
70
- - "show me code" (not specific about what information is needed)
71
-
72
- **Examples:**
73
-
74
- ```bash
75
- # Ask questions about patterns, decisions, or implementation details
76
- brv query What are the coding standards?
77
- brv query How is authentication implemented?
78
- ```
79
-
80
- **Behavior:**
81
-
82
- - Uses AI agent to search and answer questions about the context tree
83
- - Accepts natural language questions (not just keywords)
84
- - Displays tool execution progress in real-time
85
-
86
- **Requirements:** Project must be initialized (`brv init`) and authenticated (`brv login`)
87
-
88
- ---
89
-
90
- ## Best Practices
91
-
92
- ### Efficient Workflow
93
-
94
- 1. **Read only what's needed:** Check context tree with `brv status` to see changes before reading full content with `brv query`
95
- 2. **Update precisely:** Use `brv curate` to add/update specific context in context tree
96
- 3. **Push when appropriate:** Prompt user to run `brv push` after completing significant work
97
-
98
- ### Context tree Management
99
-
100
- - Use `brv curate` to directly add/update context in the context tree
9
+ Run `brv query --help` for query instruction and `brv curate --help` for curation instruction.
@@ -1,27 +1,32 @@
1
1
  # Workflow Instruction
2
2
 
3
3
  You are a coding agent focused on one codebase. Use the brv CLI to manage working context.
4
- Core Rules:
5
4
 
6
- - Start from memory. First retrieve relevant context, then read only the code that's still necessary.
7
- - Keep a local context tree. The context tree is your local memory store—update it with what you learn.
5
+ ## Core Rules
8
6
 
9
- ## Context Tree Guideline
10
-
11
- - Be specific ("Use React Query for data fetching in web modules").
12
- - Be actionable (clear instruction a future agent/dev can apply).
13
- - Be contextual (mention module/service, constraints, links to source).
14
- - Include source (file + lines or commit) when possible.
7
+ - **Start from memory.** First retrieve relevant context with `brv query`, then read only the code that's still necessary.
8
+ - **Keep a local context tree.** The context tree is your local memory store—update it with `brv curate` when you learn something valuable.
15
9
 
16
- ## Using `brv curate` with Files
10
+ ## When to Query
17
11
 
18
- When adding complex implementations, use `--files` to include relevant source files (max 5). Only text/code files from the current project directory are allowed. **CONTEXT argument must come BEFORE --files flag.** For multiple files, repeat the `--files` (or `-f`) flag for each file.
12
+ Use `brv query` **before** starting any code task that requires understanding the codebase:
13
+ - Writing, editing, or modifying code
14
+ - Understanding how something works
15
+ - Debugging or troubleshooting issues
16
+ - Making architectural decisions
19
17
 
20
- Examples:
18
+ ## When to Curate
21
19
 
22
- - Single file: `brv curate "JWT authentication with refresh token rotation" -f src/auth.ts`
23
- - Multiple files: `brv curate "Authentication system" --files src/auth/jwt.ts --files src/auth/middleware.ts --files docs/auth.md`
20
+ Use `brv curate` **after** you learn or create something valuable:
21
+ - Wrote or modified code
22
+ - Discovered how something works
23
+ - Made architectural/design decisions
24
+ - Found a bug root cause or fix pattern
24
25
 
25
- ## CLI Usage Notes
26
+ ## Context Tree Guideline
26
27
 
27
- - Use --help on any command to discover flags. Provide exact arguments for the scenario.
28
+ Good context is:
29
+ - **Specific** ("Use React Query for data fetching in web modules")
30
+ - **Actionable** (clear instruction a future agent/dev can apply)
31
+ - **Contextual** (mention module/service, constraints, links to source)
32
+ - **Sourced** (include file + lines or commit when possible)
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: byterover
3
+ description: "Manages project knowledge using ByteRover context tree. Provides two operations: query (retrieve knowledge) and curate (store knowledge). Invoke when user requests information lookup, pattern discovery, or knowledge persistence."
4
+ ---
5
+
6
+ # ByteRover Context Tree
7
+
8
+ A project-level knowledge repository that persists across sessions. Use it to avoid re-discovering patterns, conventions, and decisions.
9
+
10
+ ## Why Use ByteRover
11
+
12
+ - **Query before working**: Get existing knowledge about patterns, conventions, and past decisions before implementing
13
+ - **Curate after learning**: Capture insights, decisions, and bug fixes so future sessions start informed
14
+
15
+ ## Quick Reference
16
+
17
+ | Command | When | Example |
18
+ |---------|------|---------|
19
+ | `brv query "question"` | Before starting work | `brv query "How is auth implemented?"` |
20
+ | `brv curate "context" -f file` | After completing work | `brv curate "JWT 24h expiry" -f auth.ts` |
21
+ | `brv status` | To check prerequisites | `brv status` |
22
+
23
+ ## When to Use
24
+
25
+ **Query** when you need to understand something:
26
+ - "How does X work in this codebase?"
27
+ - "What patterns exist for Y?"
28
+ - "Are there conventions for Z?"
29
+
30
+ **Curate** when you learned or created something valuable:
31
+ - Implemented a feature using specific patterns
32
+ - Fixed a bug and found root cause
33
+ - Made an architecture decision
34
+
35
+ ## Curate Quality
36
+
37
+ Context must be **specific** and **actionable**:
38
+
39
+ ```bash
40
+ # Good - specific, explains where and why
41
+ brv curate "Auth uses JWT 24h expiry, tokens in httpOnly cookies" -f src/auth.ts
42
+
43
+ # Bad - too vague
44
+ brv curate "Fixed auth"
45
+ ```
46
+
47
+ **Note:** Context argument must come before `-f` flags. Max 5 files.
48
+
49
+ ## Best Practices
50
+
51
+ 1. **Break down large contexts** - Run multiple `brv curate` commands for complex topics rather than one massive context. Smaller chunks are easier to retrieve and update.
52
+
53
+ 2. **Let ByteRover read files** - Don't read files yourself before curating. Use `-f` flags to let ByteRover read them directly:
54
+ ```bash
55
+ # Good - ByteRover reads the files
56
+ brv curate "Auth implementation details" -f src/auth.ts -f src/middleware/jwt.ts
57
+
58
+ # Wasteful - reading files twice
59
+ # [agent reads files] then brv curate "..." -f same-files
60
+ ```
61
+
62
+ 3. **Be specific in queries** - Queries block your workflow. Use precise questions to get faster, more relevant results:
63
+ ```bash
64
+ # Good - specific
65
+ brv query "What validation library is used for API request schemas?"
66
+
67
+ # Bad - vague, slow
68
+ brv query "How is validation done?"
69
+ ```
70
+
71
+ 4. **Signal outdated context** - When curating updates that replace existing knowledge, explicitly tell ByteRover to clean up:
72
+ ```bash
73
+ brv curate "OUTDATED: Previous auth used sessions. NEW: Now uses JWT with refresh tokens. Clean up old session-based auth context." -f src/auth.ts
74
+ ```
75
+
76
+ 5. **Specify structure expectations** - Guide ByteRover on how to organize the knowledge:
77
+ ```bash
78
+ # Specify topics/domains
79
+ brv curate "Create separate topics for: 1) JWT validation, 2) refresh token flow, 3) logout handling" -f src/auth.ts
80
+
81
+ # Specify detail level
82
+ brv curate "Document the error handling patterns in detail (at least 30 lines covering all error types)" -f src/errors/
83
+ ```
84
+
85
+ ## Prerequisites
86
+
87
+ Run `brv status` first. If errors occur, the agent cannot fix them—instruct the user to take action in their brv terminal. See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for details.
88
+
89
+ ---
90
+
91
+ **See also:** [WORKFLOWS.md](WORKFLOWS.md) for detailed patterns and examples, [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for error handling
@@ -0,0 +1,50 @@
1
+ # ByteRover Troubleshooting
2
+
3
+ ## Quick Diagnosis
4
+
5
+ ```bash
6
+ brv status
7
+ ```
8
+
9
+ ## User Action Required
10
+
11
+ These errors require user intervention (agent cannot fix):
12
+
13
+ | Error | User Action |
14
+ |-------|-------------|
15
+ | "No ByteRover instance is running" | Start `brv` in separate terminal |
16
+ | "Not authenticated" | Run `/login` in brv REPL |
17
+ | "Project not initialized" | Run `/init` in brv REPL |
18
+ | "Connection failed" | Restart `brv` (Ctrl+C, then `brv`) |
19
+
20
+ **Template response:**
21
+ > Please [action] in your brv terminal, then I'll retry the command.
22
+
23
+ ## Agent-Fixable Errors
24
+
25
+ | Error | Fix |
26
+ |-------|-----|
27
+ | "Context argument required" | Add text before `-f`: `brv curate "text" -f file` |
28
+ | "Maximum 5 files allowed" | Reduce to 5 or fewer `-f` flags |
29
+ | "File not found" | Verify path with `ls`, use relative paths from project root |
30
+ | "No relevant context found" | Try different query phrasing, or curate knowledge first |
31
+
32
+ ## Architecture
33
+
34
+ ByteRover uses client-server architecture:
35
+ - User runs `brv` to start server (interactive REPL)
36
+ - Agent commands (`query`, `curate`, `status`) connect to server
37
+ - Server must be running for commands to work
38
+
39
+ ## Exit Codes
40
+
41
+ | Code | Meaning |
42
+ |------|---------|
43
+ | 0 | Success |
44
+ | 1 | General error |
45
+ | 2 | Connection error |
46
+
47
+ ## Getting Help
48
+
49
+ - Email: support@byterover.dev
50
+ - Discord: https://discord.com/invite/UMRrpNjh5W
@@ -0,0 +1,229 @@
1
+ # ByteRover Workflows
2
+
3
+ ## Pattern 1: Research Before Implementation
4
+
5
+ Use when starting new features or working in unfamiliar areas.
6
+
7
+ **Workflow:**
8
+ ```
9
+ Query existing knowledge → Implement following patterns → Curate new decisions
10
+ ```
11
+
12
+ **Example: Adding a new API endpoint**
13
+
14
+ ```bash
15
+ # 1. Query for existing patterns
16
+ # Be SPECIFIC to get faster, more relevant results
17
+ brv query "What middleware chain is used for authenticated API endpoints?"
18
+ brv query "What is the standard error response format for API routes?"
19
+
20
+ # 2. Implement following discovered patterns
21
+ # ... write code ...
22
+
23
+ # 3. Curate decisions made
24
+ # Don't read the file first - let ByteRover read it via -f flag
25
+ brv curate "Added /api/users/profile endpoint. Uses authMiddleware for JWT validation, returns UserProfileDTO. Error handling follows ApiError pattern" -f src/api/routes/users.ts
26
+ ```
27
+
28
+ **Example: Implementing a new React component**
29
+
30
+ ```bash
31
+ # 1. Query patterns - specific questions save time
32
+ brv query "What data fetching hook pattern is used in list components?"
33
+ brv query "Are CSS modules or styled-components used for component styling?"
34
+
35
+ # 2. Implement
36
+ # ... write component ...
37
+
38
+ # 3. Curate with file reference - ByteRover reads the file
39
+ brv curate "Created UserAvatar component. Uses React Query for data fetching, CSS modules for styling. Follows existing pattern in src/components/common/" -f src/components/UserAvatar.tsx
40
+ ```
41
+
42
+ ## Pattern 2: Debug and Document
43
+
44
+ Use when fixing bugs to capture learnings and prevent recurrence.
45
+
46
+ **Workflow:**
47
+ ```
48
+ Query known issues → Debug and fix → Curate root cause and solution
49
+ ```
50
+
51
+ **Example: Fixing a race condition**
52
+
53
+ ```bash
54
+ # 1. Query for context - be specific about the symptom
55
+ brv query "Are there known race condition patterns or AbortController usage in data fetching hooks?"
56
+
57
+ # 2. Debug and fix
58
+ # ... investigate, find root cause, implement fix ...
59
+
60
+ # 3. Curate the learning with structured format
61
+ brv curate "Bug: stale data after rapid navigation. Cause: useEffect cleanup not cancelling requests. Fix: AbortController with cleanup. Pattern: always abort fetch in useEffect cleanup" -f src/hooks/useUserData.ts
62
+ ```
63
+
64
+ **Example: Fixing an authentication issue**
65
+
66
+ ```bash
67
+ # 1. Specific query about the problem area
68
+ brv query "How are credentials and cookies configured in the API client fetch calls?"
69
+
70
+ # 2. Fix
71
+ # ... debug and fix ...
72
+
73
+ # 3. Curate with emphasis on the gotcha
74
+ brv curate "Bug: unexpected logouts. Cause: fetch missing credentials option. Fix: added 'credentials: include' to fetch config. IMPORTANT: all API calls must include credentials for cookie-based auth" -f src/lib/api-client.ts
75
+ ```
76
+
77
+ ## Pattern 3: Multi-File Changes
78
+
79
+ Use when changes span multiple files to maintain context.
80
+
81
+ **Example: Adding a new feature across layers**
82
+
83
+ ```bash
84
+ # 1. Query architecture - specific about the layers
85
+ brv query "How are full-stack features organized across API routes, service layer, and React components?"
86
+
87
+ # 2. Implement across files
88
+ # ... write code ...
89
+
90
+ # 3. Curate with multiple files (max 5)
91
+ # Let ByteRover read all files - don't read them yourself first
92
+ # Specify the topics you want created
93
+ brv curate "Added user notifications feature. Create separate topics for: 1) API endpoint structure, 2) NotificationService business logic, 3) useNotifications React hook pattern, 4) NotificationBell UI component" -f src/api/notifications.ts -f src/services/NotificationService.ts -f src/hooks/useNotifications.ts -f src/components/NotificationBell.tsx
94
+ ```
95
+
96
+ **Example: Database schema change with migrations**
97
+
98
+ ```bash
99
+ # 1. Query migration patterns
100
+ brv query "What is the migration naming convention and how are schema changes tested?"
101
+
102
+ # 2. Implement
103
+ # ... create migration, update models, update queries ...
104
+
105
+ # 3. Multiple curates for different concerns - break down large context
106
+ brv curate "Added user_preferences table with JSONB settings column. Migration: 20240115_add_user_preferences" -f migrations/20240115_add_user_preferences.ts
107
+
108
+ brv curate "UserPreferences model with type-safe JSONB access. Includes validation for theme, notifications, locale settings" -f src/models/UserPreferences.ts
109
+
110
+ brv curate "Updated UserService to load/save preferences. Uses transaction for atomic updates with user record" -f src/services/UserService.ts
111
+ ```
112
+
113
+ ## Pattern 4: Updating Existing Knowledge
114
+
115
+ Use when changes make previous context outdated.
116
+
117
+ **Example: Refactoring authentication system**
118
+
119
+ ```bash
120
+ # 1. Query current documented state
121
+ brv query "What is currently documented about authentication implementation and token handling?"
122
+
123
+ # 2. Implement refactor
124
+ # ... refactor code ...
125
+
126
+ # 3. Curate with explicit cleanup signal
127
+ # Tell ByteRover to clean up outdated context
128
+ brv curate "OUTDATED: Previous auth used session cookies stored in Redis. NEW: Migrated to JWT with refresh tokens. Access token in memory (15min), refresh token in httpOnly cookie (7d). Remove/update any session-based auth context in the tree" -f src/auth/jwt.ts -f src/auth/refresh.ts
129
+ ```
130
+
131
+ **Example: Replacing a library**
132
+
133
+ ```bash
134
+ # 1. Query what's documented about the old library
135
+ brv query "What patterns are documented for moment.js date handling?"
136
+
137
+ # 2. Implement replacement
138
+ # ... replace library usage ...
139
+
140
+ # 3. Curate the replacement with cleanup signal
141
+ brv curate "REPLACED: Removed moment.js (bloated, mutable). Now using date-fns (tree-shakeable, immutable). Clean up any moment.js context. New patterns: format(date, 'yyyy-MM-dd'), parseISO(string), differenceInDays(date1, date2)" -f src/utils/dates.ts
142
+ ```
143
+
144
+ **Example: API versioning change**
145
+
146
+ ```bash
147
+ # Curate with explicit version context
148
+ brv curate "OUTDATED: API v1 endpoints deprecated. NEW: All endpoints now v2 with breaking changes. v2 uses camelCase response keys, pagination via cursor (not offset), errors include requestId. Update any v1 API context" -f src/api/v2/routes.ts
149
+ ```
150
+
151
+ ## Pattern 5: Comprehensive Documentation
152
+
153
+ Use when documenting complex systems that need detailed breakdown.
154
+
155
+ **Example: Documenting a payment module**
156
+
157
+ ```bash
158
+ # Break into multiple curates - don't try to capture everything in one
159
+ # Specify structure and detail level for each topic
160
+
161
+ # Overview first
162
+ brv curate "Payment module overview: Stripe integration with webhooks for subscription management. Create 4 separate detailed topics covering the full payment lifecycle" -f src/payments/
163
+
164
+ # Topic 1 - detailed with line count guidance
165
+ brv curate "Topic: Payment checkout flow. Cover: 1) cart validation, 2) createPaymentIntent call, 3) client-side confirmation, 4) success/failure handling. Include error scenarios. At least 50 lines of detailed documentation" -f src/payments/checkout.ts -f src/payments/intent.ts
166
+
167
+ # Topic 2 - webhook handling
168
+ brv curate "Topic: Stripe webhook handling. Cover: 1) signature verification with STRIPE_WEBHOOK_SECRET, 2) idempotency with processed_events table, 3) event types (payment_intent.succeeded, payment_intent.failed, customer.subscription.*). At least 40 lines" -f src/payments/webhooks.ts
169
+
170
+ # Topic 3 - subscription management
171
+ brv curate "Topic: Subscription lifecycle. Cover: trial period handling, upgrade/downgrade proration, cancellation with grace period, reactivation flow" -f src/payments/subscriptions.ts
172
+
173
+ # Topic 4 - error handling
174
+ brv curate "Topic: Payment error handling. Cover: StripeError types (CardError, InvalidRequestError, APIError), retry logic for transient failures, user-facing error messages mapping" -f src/payments/errors.ts
175
+ ```
176
+
177
+ **Example: Documenting a state management system**
178
+
179
+ ```bash
180
+ # Multiple focused curates instead of one massive one
181
+
182
+ brv curate "State management overview: Using Zustand with persistence middleware. Create topics for: store structure, async actions, persistence, devtools integration" -f src/store/
183
+
184
+ brv curate "Topic: Store structure. Separate stores per domain (userStore, cartStore, uiStore). Each store follows pattern: state interface, actions, selectors. No cross-store dependencies" -f src/store/userStore.ts -f src/store/cartStore.ts
185
+
186
+ brv curate "Topic: Async actions. Pattern: set loading -> try/catch -> set data/error -> clear loading. All API calls go through apiClient. Optimistic updates for cart operations" -f src/store/cartStore.ts -f src/store/actions/
187
+
188
+ brv curate "Topic: Persistence. userStore persisted to localStorage (excluding sensitive data). cartStore persisted to sessionStorage. Custom serializer excludes functions and timestamps" -f src/store/middleware/persist.ts
189
+ ```
190
+
191
+ ## Pattern 6: Exploratory Documentation
192
+
193
+ Use when you need to document an unfamiliar codebase area.
194
+
195
+ **Example: Understanding and documenting an existing module**
196
+
197
+ ```bash
198
+ # 1. Query what's already known
199
+ brv query "What is documented about the notification system and real-time updates?"
200
+
201
+ # 2. Explore the code (agent reads files to understand)
202
+ # ... read and understand the code ...
203
+
204
+ # 3. Curate in chunks as you understand different parts
205
+ # First curate: high-level architecture
206
+ brv curate "Notification system uses WebSocket for real-time delivery with Redis pub/sub for horizontal scaling. Three components: NotificationService (creation/storage), NotificationGateway (WebSocket), NotificationWorker (background processing)" -f src/notifications/
207
+
208
+ # Second curate: specific implementation detail
209
+ brv curate "WebSocket authentication: JWT token passed in connection query params, validated on connect, stored in socket.data. Rooms: user_{id} for personal, team_{id} for team broadcasts" -f src/notifications/NotificationGateway.ts
210
+
211
+ # Third curate: gotchas discovered
212
+ brv curate "Notification gotchas: 1) Must call gateway.joinRoom after auth, 2) Unread count cached in Redis (5min TTL) - call invalidateUnreadCount after marking read, 3) Batch notifications throttled to max 10/second per user" -f src/notifications/NotificationService.ts
213
+ ```
214
+
215
+ ## What to Curate
216
+
217
+ **Do curate:**
218
+ - Architecture decisions: "Chose Redis for sessions because of horizontal scaling"
219
+ - Patterns: "All forms use react-hook-form with zod. Pattern in LoginForm.tsx"
220
+ - Non-obvious conventions: "File uploads go to /tmp first, then S3 after validation"
221
+ - Bug root causes: "Memory leak from event listeners not removed on unmount"
222
+ - Gotchas: "PostgreSQL JSONB queries need explicit casting for arrays"
223
+ - Replacements: "OUTDATED: X, NEW: Y" when refactoring
224
+
225
+ **Don't curate:**
226
+ - Obvious facts: "Uses TypeScript", "Has a README"
227
+ - Temporary states: "Currently debugging X"
228
+ - Personal preferences: "I prefer tabs"
229
+ - Trivial changes: "Fixed typo in comment"