byterover-cli 2.5.2 → 2.6.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 (85) hide show
  1. package/.env.production +7 -0
  2. package/LICENSE +44 -0
  3. package/bin/dev.js +8 -1
  4. package/bin/run.js +8 -1
  5. package/dist/server/config/environment.d.ts +0 -19
  6. package/dist/server/config/environment.js +29 -38
  7. package/dist/server/constants.d.ts +0 -9
  8. package/dist/server/constants.js +0 -12
  9. package/dist/server/core/domain/errors/auth-error.d.ts +0 -6
  10. package/dist/server/core/domain/errors/auth-error.js +0 -12
  11. package/dist/server/core/domain/errors/task-error.d.ts +0 -3
  12. package/dist/server/core/domain/errors/task-error.js +0 -8
  13. package/dist/server/core/domain/errors/transport-error.d.ts +0 -31
  14. package/dist/server/core/domain/errors/transport-error.js +0 -50
  15. package/dist/server/infra/connectors/rules/rules-connector-config.d.ts +0 -4
  16. package/dist/server/infra/http/models-dev-client.d.ts +0 -4
  17. package/dist/server/infra/http/models-dev-client.js +0 -6
  18. package/dist/server/infra/http/openrouter-api-client.d.ts +0 -8
  19. package/dist/server/infra/http/openrouter-api-client.js +0 -13
  20. package/dist/server/infra/http/provider-model-fetcher-registry.d.ts +0 -5
  21. package/dist/server/infra/http/provider-model-fetcher-registry.js +0 -7
  22. package/dist/server/infra/provider/env-provider-detector.d.ts +0 -20
  23. package/dist/server/infra/provider/env-provider-detector.js +0 -27
  24. package/dist/server/infra/storage/file-provider-config-store.d.ts +0 -4
  25. package/dist/server/infra/storage/file-provider-config-store.js +0 -6
  26. package/dist/server/utils/file-content-reader.d.ts +2 -1
  27. package/dist/server/utils/file-helpers.d.ts +0 -24
  28. package/dist/server/utils/file-helpers.js +0 -81
  29. package/dist/server/utils/process-logger.d.ts +0 -13
  30. package/dist/server/utils/process-logger.js +1 -78
  31. package/node_modules/@campfirein/brv-transport-client/LICENSE +95 -0
  32. package/node_modules/@campfirein/brv-transport-client/README.md +3 -4
  33. package/node_modules/@campfirein/brv-transport-client/package.json +2 -2
  34. package/oclif.manifest.json +132 -132
  35. package/package.json +5 -3
  36. package/dist/server/core/domain/entities/bullet.d.ts +0 -51
  37. package/dist/server/core/domain/entities/bullet.js +0 -94
  38. package/dist/server/core/domain/entities/memory.d.ts +0 -55
  39. package/dist/server/core/domain/entities/memory.js +0 -90
  40. package/dist/server/core/domain/entities/playbook.d.ts +0 -80
  41. package/dist/server/core/domain/entities/playbook.js +0 -214
  42. package/dist/server/core/domain/entities/presigned-url.d.ts +0 -9
  43. package/dist/server/core/domain/entities/presigned-url.js +0 -18
  44. package/dist/server/core/domain/entities/presigned-urls-response.d.ts +0 -10
  45. package/dist/server/core/domain/entities/presigned-urls-response.js +0 -18
  46. package/dist/server/core/domain/entities/retrieve-result.d.ts +0 -35
  47. package/dist/server/core/domain/entities/retrieve-result.js +0 -35
  48. package/dist/server/core/domain/errors/headless-prompt-error.d.ts +0 -11
  49. package/dist/server/core/domain/errors/headless-prompt-error.js +0 -18
  50. package/dist/server/core/interfaces/services/i-legacy-rule-detector.d.ts +0 -56
  51. package/dist/server/core/interfaces/services/i-legacy-rule-detector.js +0 -1
  52. package/dist/server/core/interfaces/services/i-memory-retrieval-service.d.ts +0 -39
  53. package/dist/server/core/interfaces/services/i-memory-retrieval-service.js +0 -1
  54. package/dist/server/core/interfaces/services/i-memory-storage-service.d.ts +0 -53
  55. package/dist/server/core/interfaces/services/i-memory-storage-service.js +0 -1
  56. package/dist/server/core/interfaces/services/i-terminal.d.ts +0 -146
  57. package/dist/server/core/interfaces/services/i-terminal.js +0 -1
  58. package/dist/server/core/interfaces/services/i-workspace-detector-service.d.ts +0 -8
  59. package/dist/server/core/interfaces/services/i-workspace-detector-service.js +0 -1
  60. package/dist/server/core/interfaces/storage/i-onboarding-preference-store.d.ts +0 -20
  61. package/dist/server/core/interfaces/storage/i-onboarding-preference-store.js +0 -1
  62. package/dist/server/infra/connectors/rules/legacy-rule-detector.d.ts +0 -21
  63. package/dist/server/infra/connectors/rules/legacy-rule-detector.js +0 -106
  64. package/dist/server/infra/memory/http-memory-retrieval-service.d.ts +0 -18
  65. package/dist/server/infra/memory/http-memory-retrieval-service.js +0 -64
  66. package/dist/server/infra/memory/http-memory-storage-service.d.ts +0 -18
  67. package/dist/server/infra/memory/http-memory-storage-service.js +0 -72
  68. package/dist/server/infra/memory/memory-to-playbook-mapper.d.ts +0 -33
  69. package/dist/server/infra/memory/memory-to-playbook-mapper.js +0 -51
  70. package/dist/server/infra/storage/file-onboarding-preference-store.d.ts +0 -10
  71. package/dist/server/infra/storage/file-onboarding-preference-store.js +0 -45
  72. package/dist/server/infra/terminal/headless-terminal.d.ts +0 -91
  73. package/dist/server/infra/terminal/headless-terminal.js +0 -211
  74. package/dist/server/infra/workspace/workspace-detector-service.d.ts +0 -57
  75. package/dist/server/infra/workspace/workspace-detector-service.js +0 -165
  76. package/dist/server/utils/crash-log.d.ts +0 -14
  77. package/dist/server/utils/crash-log.js +0 -19
  78. package/dist/server/utils/emoji-helpers.d.ts +0 -38
  79. package/dist/server/utils/emoji-helpers.js +0 -42
  80. package/dist/server/utils/error-handler.d.ts +0 -51
  81. package/dist/server/utils/error-handler.js +0 -169
  82. package/dist/server/utils/oclif-error-helpers.d.ts +0 -40
  83. package/dist/server/utils/oclif-error-helpers.js +0 -46
  84. package/dist/server/utils/tool-display-formatter.d.ts +0 -53
  85. package/dist/server/utils/tool-display-formatter.js +0 -257
@@ -1,38 +0,0 @@
1
- /**
2
- * Emoji and message formatting helpers
3
- *
4
- * Provides utilities for checking and handling emoji prefixes in error messages
5
- * to prevent duplicate prefixes like "❌ Error: ❌ Billing error: ..."
6
- */
7
- /**
8
- * Check if a message already has an emoji prefix
9
- *
10
- * Detects common emoji prefixes used in CLI output:
11
- * - ❌ (error)
12
- * - ✓ (success)
13
- * - ⚠️ (warning)
14
- * - Any Unicode emoji in ranges U+1F300–U+1F9FF
15
- *
16
- * @param message - Message to check
17
- * @returns true if message starts with emoji, false otherwise
18
- *
19
- * @example
20
- * hasEmojiPrefix("❌ Error message") // true
21
- * hasEmojiPrefix("✓ Success") // true
22
- * hasEmojiPrefix("Normal message") // false
23
- */
24
- export declare function hasEmojiPrefix(message: string): boolean;
25
- /**
26
- * Add error prefix to message if it doesn't already have emoji prefix
27
- *
28
- * Prevents duplicate prefixes by checking if message already starts with emoji.
29
- * If message has emoji prefix, returns as-is. Otherwise, adds "❌ Error: " prefix.
30
- *
31
- * @param message - Error message to format
32
- * @returns Formatted error message with prefix
33
- *
34
- * @example
35
- * addErrorPrefix("❌ Billing error") // "❌ Billing error" (no duplicate)
36
- * addErrorPrefix("Something went wrong") // "❌ Error: Something went wrong"
37
- */
38
- export declare function addErrorPrefix(message: string): string;
@@ -1,42 +0,0 @@
1
- /**
2
- * Emoji and message formatting helpers
3
- *
4
- * Provides utilities for checking and handling emoji prefixes in error messages
5
- * to prevent duplicate prefixes like "❌ Error: ❌ Billing error: ..."
6
- */
7
- /**
8
- * Check if a message already has an emoji prefix
9
- *
10
- * Detects common emoji prefixes used in CLI output:
11
- * - ❌ (error)
12
- * - ✓ (success)
13
- * - ⚠️ (warning)
14
- * - Any Unicode emoji in ranges U+1F300–U+1F9FF
15
- *
16
- * @param message - Message to check
17
- * @returns true if message starts with emoji, false otherwise
18
- *
19
- * @example
20
- * hasEmojiPrefix("❌ Error message") // true
21
- * hasEmojiPrefix("✓ Success") // true
22
- * hasEmojiPrefix("Normal message") // false
23
- */
24
- export function hasEmojiPrefix(message) {
25
- return /^[\u{1F300}-\u{1F9FF}]|^❌|^✓|^⚠️/u.test(message);
26
- }
27
- /**
28
- * Add error prefix to message if it doesn't already have emoji prefix
29
- *
30
- * Prevents duplicate prefixes by checking if message already starts with emoji.
31
- * If message has emoji prefix, returns as-is. Otherwise, adds "❌ Error: " prefix.
32
- *
33
- * @param message - Error message to format
34
- * @returns Formatted error message with prefix
35
- *
36
- * @example
37
- * addErrorPrefix("❌ Billing error") // "❌ Billing error" (no duplicate)
38
- * addErrorPrefix("Something went wrong") // "❌ Error: Something went wrong"
39
- */
40
- export function addErrorPrefix(message) {
41
- return hasEmojiPrefix(message) ? message : `❌ Error: ${message}`;
42
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * Centralized error handling utility for CLI commands
3
- *
4
- * Provides user-friendly error messages based on error type:
5
- * - Network errors: Check internet connection
6
- * - Server errors: Retry later
7
- * - Billing errors: Check account/payment
8
- * - Auth errors: Re-login required
9
- * - Validation errors: Check input
10
- */
11
- export declare enum ErrorType {
12
- AUTH = "AUTH",
13
- BILLING = "BILLING",
14
- NETWORK = "NETWORK",
15
- SERVER = "SERVER",
16
- UNKNOWN = "UNKNOWN",
17
- VALIDATION = "VALIDATION"
18
- }
19
- export interface ClassifiedError {
20
- message: string;
21
- originalError: Error;
22
- type: ErrorType;
23
- userMessage: string;
24
- }
25
- /**
26
- * Classify error and return user-friendly message
27
- */
28
- export declare function classifyError(error: unknown): ClassifiedError;
29
- /**
30
- * Format error for display to user
31
- *
32
- * @param error - Error to format
33
- * @returns User-friendly error message
34
- */
35
- export declare function formatError(error: unknown): string;
36
- /**
37
- * Check if error is a network error
38
- */
39
- export declare function isNetworkError(error: unknown): boolean;
40
- /**
41
- * Check if error is a server error
42
- */
43
- export declare function isServerError(error: unknown): boolean;
44
- /**
45
- * Check if error is an authentication error
46
- */
47
- export declare function isAuthError(error: unknown): boolean;
48
- /**
49
- * Check if error is a billing error
50
- */
51
- export declare function isBillingError(error: unknown): boolean;
@@ -1,169 +0,0 @@
1
- /**
2
- * Centralized error handling utility for CLI commands
3
- *
4
- * Provides user-friendly error messages based on error type:
5
- * - Network errors: Check internet connection
6
- * - Server errors: Retry later
7
- * - Billing errors: Check account/payment
8
- * - Auth errors: Re-login required
9
- * - Validation errors: Check input
10
- */
11
- import { isAxiosError } from 'axios';
12
- import { addErrorPrefix } from './emoji-helpers.js';
13
- export var ErrorType;
14
- (function (ErrorType) {
15
- ErrorType["AUTH"] = "AUTH";
16
- ErrorType["BILLING"] = "BILLING";
17
- ErrorType["NETWORK"] = "NETWORK";
18
- ErrorType["SERVER"] = "SERVER";
19
- ErrorType["UNKNOWN"] = "UNKNOWN";
20
- ErrorType["VALIDATION"] = "VALIDATION";
21
- })(ErrorType || (ErrorType = {}));
22
- /**
23
- * Helper to create a ClassifiedError object
24
- */
25
- function createClassifiedError(err, type, userMessage, customMessage) {
26
- return {
27
- message: customMessage || err.message,
28
- originalError: err,
29
- type,
30
- userMessage,
31
- };
32
- }
33
- /**
34
- * Classify axios-specific errors
35
- * Returns null if error is not an axios error
36
- */
37
- function classifyAxiosError(error, err) {
38
- if (!isAxiosError(error)) {
39
- return null;
40
- }
41
- // Network connectivity issues
42
- if (error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED' || error.code === 'ETIMEDOUT') {
43
- return createClassifiedError(err, ErrorType.NETWORK, '❌ Network error: Unable to connect to ByteRover servers. Please check your internet connection and try again.');
44
- }
45
- // DNS resolution failed
46
- if (error.code === 'EAI_AGAIN') {
47
- return createClassifiedError(err, ErrorType.NETWORK, '❌ Network error: DNS resolution failed. Please check your internet connection and DNS settings.');
48
- }
49
- // Server returned error response
50
- if (error.response) {
51
- const { status } = error.response;
52
- // Authentication errors (401, 403)
53
- if (status === 401 || status === 403) {
54
- return createClassifiedError(err, ErrorType.AUTH, '❌ Authentication failed: Your session has expired or is invalid. Please run "brv login" to re-authenticate.');
55
- }
56
- // Billing/quota errors (402, 429)
57
- if (status === 402 || status === 429) {
58
- return createClassifiedError(err, ErrorType.BILLING, '❌ Billing error: Your ByteRover account may not have sufficient credits or has reached quota limits. Please check your account settings.');
59
- }
60
- // Server errors (500, 502, 503, 504)
61
- if (status >= 500) {
62
- return createClassifiedError(err, ErrorType.SERVER, '❌ Server error: ByteRover servers are experiencing issues. Please try again in a few moments.');
63
- }
64
- // Client errors (400, 404, etc.)
65
- if (status >= 400 && status < 500) {
66
- // Try to extract error message from response
67
- const responseData = error.response.data;
68
- const errorMessage = typeof responseData === 'string' ? responseData : responseData?.message || responseData?.error || err.message;
69
- return createClassifiedError(err, ErrorType.VALIDATION, `❌ Request error: ${errorMessage}`, errorMessage);
70
- }
71
- }
72
- // Request was made but no response received
73
- if (error.request) {
74
- return createClassifiedError(err, ErrorType.NETWORK, '❌ Network error: No response from ByteRover servers. Please check your internet connection and try again.');
75
- }
76
- return null;
77
- }
78
- /**
79
- * Classify error based on message keywords
80
- * Returns null if no keywords match
81
- */
82
- function classifyByMessageKeywords(err) {
83
- const errorMessage = err.message.toLowerCase();
84
- // Network-related keywords
85
- if (errorMessage.includes('network') ||
86
- errorMessage.includes('connection') ||
87
- errorMessage.includes('timeout') ||
88
- errorMessage.includes('enotfound') ||
89
- errorMessage.includes('econnrefused')) {
90
- return createClassifiedError(err, ErrorType.NETWORK, '❌ Network error: Unable to connect to ByteRover servers. Please check your internet connection and try again.');
91
- }
92
- // Authentication keywords
93
- if (errorMessage.includes('authentication') ||
94
- errorMessage.includes('unauthorized') ||
95
- errorMessage.includes('forbidden') ||
96
- errorMessage.includes('token') ||
97
- errorMessage.includes('login')) {
98
- return createClassifiedError(err, ErrorType.AUTH, '❌ Authentication failed: Your session has expired or is invalid. Please run "brv login" to re-authenticate.');
99
- }
100
- // Billing keywords
101
- if (errorMessage.includes('billing') ||
102
- errorMessage.includes('quota') ||
103
- errorMessage.includes('limit') ||
104
- errorMessage.includes('credits') ||
105
- errorMessage.includes('payment')) {
106
- return createClassifiedError(err, ErrorType.BILLING, '❌ Billing error: Your ByteRover account may not have sufficient credits or has reached quota limits. Please check your account settings.');
107
- }
108
- // Validation keywords
109
- if (errorMessage.includes('invalid') ||
110
- errorMessage.includes('required') ||
111
- errorMessage.includes('missing') ||
112
- errorMessage.includes('validation')) {
113
- return createClassifiedError(err, ErrorType.VALIDATION, `❌ Validation error: ${err.message}`);
114
- }
115
- return null;
116
- }
117
- /**
118
- * Classify error and return user-friendly message
119
- */
120
- export function classifyError(error) {
121
- const err = error instanceof Error ? error : new Error(String(error));
122
- // Try axios error classification first
123
- const axiosResult = classifyAxiosError(error, err);
124
- if (axiosResult) {
125
- return axiosResult;
126
- }
127
- // Try message-based classification
128
- const messageResult = classifyByMessageKeywords(err);
129
- if (messageResult) {
130
- return messageResult;
131
- }
132
- // Default: unknown error
133
- // Don't add prefix if error message already has emoji prefix
134
- return createClassifiedError(err, ErrorType.UNKNOWN, addErrorPrefix(err.message));
135
- }
136
- /**
137
- * Format error for display to user
138
- *
139
- * @param error - Error to format
140
- * @returns User-friendly error message
141
- */
142
- export function formatError(error) {
143
- const classified = classifyError(error);
144
- return classified.userMessage;
145
- }
146
- /**
147
- * Check if error is a network error
148
- */
149
- export function isNetworkError(error) {
150
- return classifyError(error).type === ErrorType.NETWORK;
151
- }
152
- /**
153
- * Check if error is a server error
154
- */
155
- export function isServerError(error) {
156
- return classifyError(error).type === ErrorType.SERVER;
157
- }
158
- /**
159
- * Check if error is an authentication error
160
- */
161
- export function isAuthError(error) {
162
- return classifyError(error).type === ErrorType.AUTH;
163
- }
164
- /**
165
- * Check if error is a billing error
166
- */
167
- export function isBillingError(error) {
168
- return classifyError(error).type === ErrorType.BILLING;
169
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Helper utilities for handling oclif-specific errors
3
- *
4
- * These utilities help avoid duplicating error handling logic across commands
5
- */
6
- /**
7
- * Handle oclif error exit codes
8
- *
9
- * If the error has an oclif.exit property (set by this.error()), exit the process
10
- * with that code. This prevents oclif from re-logging errors that were already displayed.
11
- *
12
- * @param error - Error with optional oclif metadata
13
- * @returns true if error was handled (process exited), false if error should be re-thrown
14
- *
15
- * @example
16
- * public async catch(error: Error & {oclif?: {exit: number}}): Promise<void> {
17
- * if (handleOclifExit(error)) return
18
- * // Handle other error cases...
19
- * }
20
- */
21
- export declare function handleOclifExit(error: Error & {
22
- oclif?: {
23
- exit: number;
24
- };
25
- }): boolean;
26
- /**
27
- * Check if error is an oclif validation error
28
- *
29
- * Validation errors include missing arguments, unexpected arguments, and missing flags.
30
- * These should be re-thrown to let oclif's error handler display them properly.
31
- *
32
- * @param error - Error to check
33
- * @returns true if error is a validation error
34
- *
35
- * @example
36
- * if (isValidationError(error)) {
37
- * throw error // Let oclif handle it
38
- * }
39
- */
40
- export declare function isValidationError(error: Error): boolean;
@@ -1,46 +0,0 @@
1
- /**
2
- * Helper utilities for handling oclif-specific errors
3
- *
4
- * These utilities help avoid duplicating error handling logic across commands
5
- */
6
- /**
7
- * Handle oclif error exit codes
8
- *
9
- * If the error has an oclif.exit property (set by this.error()), exit the process
10
- * with that code. This prevents oclif from re-logging errors that were already displayed.
11
- *
12
- * @param error - Error with optional oclif metadata
13
- * @returns true if error was handled (process exited), false if error should be re-thrown
14
- *
15
- * @example
16
- * public async catch(error: Error & {oclif?: {exit: number}}): Promise<void> {
17
- * if (handleOclifExit(error)) return
18
- * // Handle other error cases...
19
- * }
20
- */
21
- export function handleOclifExit(error) {
22
- if (error.oclif?.exit !== undefined) {
23
- // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
24
- process.exit(error.oclif.exit);
25
- }
26
- return false;
27
- }
28
- /**
29
- * Check if error is an oclif validation error
30
- *
31
- * Validation errors include missing arguments, unexpected arguments, and missing flags.
32
- * These should be re-thrown to let oclif's error handler display them properly.
33
- *
34
- * @param error - Error to check
35
- * @returns true if error is a validation error
36
- *
37
- * @example
38
- * if (isValidationError(error)) {
39
- * throw error // Let oclif handle it
40
- * }
41
- */
42
- export function isValidationError(error) {
43
- return (error.message.includes('Unexpected argument') ||
44
- error.message.includes('Missing') ||
45
- error.message.includes('required'));
46
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * Tool Display Formatter
3
- *
4
- * Utilities for formatting tool call arguments and results in a concise,
5
- * readable format for CLI display.
6
- */
7
- /**
8
- * Format a tool call with its arguments for display.
9
- *
10
- * Creates a concise, single-line representation of a tool call:
11
- * - Truncates long strings with ellipsis
12
- * - Shows relative paths or basenames for file paths
13
- * - Omits undefined/null optional parameters
14
- * - Formats arrays and objects as summaries
15
- *
16
- * @param toolName - Name of the tool being called
17
- * @param args - Tool arguments object
18
- * @returns Formatted string like "tool_name(arg1: value1, arg2: value2)"
19
- *
20
- * @example
21
- * ```typescript
22
- * formatToolCall('read_file', { filePath: '/long/path/to/file.ts', limit: 100 })
23
- * // Returns: 'read_file(filePath: "file.ts", limit: 100)'
24
- *
25
- * formatToolCall('write_file', { filePath: 'test.ts', content: 'very long content...', createDirs: true })
26
- * // Returns: 'write_file(filePath: "test.ts", content: "very long conte...", createDirs: true)'
27
- * ```
28
- */
29
- export declare function formatToolCall(toolName: string, args: Record<string, unknown>): string;
30
- /**
31
- * Format a tool result for display.
32
- *
33
- * Creates a concise summary of the tool execution result:
34
- * - For success: shows relevant metrics (file size, match count, etc.)
35
- * - For errors: shows error message
36
- * - Truncates long values
37
- *
38
- * @param toolName - Name of the tool that was executed
39
- * @param success - Whether the tool execution succeeded
40
- * @param result - Tool result (if successful)
41
- * @param error - Error message (if failed)
42
- * @returns Formatted result string
43
- *
44
- * @example
45
- * ```typescript
46
- * formatToolResult('write_file', true, { bytesWritten: 245 })
47
- * // Returns: 'File written (245 bytes)'
48
- *
49
- * formatToolResult('read_file', false, undefined, 'ENOENT: no such file or directory')
50
- * // Returns: 'ENOENT: no such file or directory'
51
- * ```
52
- */
53
- export declare function formatToolResult(toolName: string, success: boolean, result?: unknown, error?: string): string;