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.
- package/.env.production +7 -0
- package/LICENSE +44 -0
- package/bin/dev.js +8 -1
- package/bin/run.js +8 -1
- package/dist/server/config/environment.d.ts +0 -19
- package/dist/server/config/environment.js +29 -38
- package/dist/server/constants.d.ts +0 -9
- package/dist/server/constants.js +0 -12
- package/dist/server/core/domain/errors/auth-error.d.ts +0 -6
- package/dist/server/core/domain/errors/auth-error.js +0 -12
- package/dist/server/core/domain/errors/task-error.d.ts +0 -3
- package/dist/server/core/domain/errors/task-error.js +0 -8
- package/dist/server/core/domain/errors/transport-error.d.ts +0 -31
- package/dist/server/core/domain/errors/transport-error.js +0 -50
- package/dist/server/infra/connectors/rules/rules-connector-config.d.ts +0 -4
- package/dist/server/infra/http/models-dev-client.d.ts +0 -4
- package/dist/server/infra/http/models-dev-client.js +0 -6
- package/dist/server/infra/http/openrouter-api-client.d.ts +0 -8
- package/dist/server/infra/http/openrouter-api-client.js +0 -13
- package/dist/server/infra/http/provider-model-fetcher-registry.d.ts +0 -5
- package/dist/server/infra/http/provider-model-fetcher-registry.js +0 -7
- package/dist/server/infra/provider/env-provider-detector.d.ts +0 -20
- package/dist/server/infra/provider/env-provider-detector.js +0 -27
- package/dist/server/infra/storage/file-provider-config-store.d.ts +0 -4
- package/dist/server/infra/storage/file-provider-config-store.js +0 -6
- package/dist/server/utils/file-content-reader.d.ts +2 -1
- package/dist/server/utils/file-helpers.d.ts +0 -24
- package/dist/server/utils/file-helpers.js +0 -81
- package/dist/server/utils/process-logger.d.ts +0 -13
- package/dist/server/utils/process-logger.js +1 -78
- package/node_modules/@campfirein/brv-transport-client/LICENSE +95 -0
- package/node_modules/@campfirein/brv-transport-client/README.md +3 -4
- package/node_modules/@campfirein/brv-transport-client/package.json +2 -2
- package/oclif.manifest.json +132 -132
- package/package.json +5 -3
- package/dist/server/core/domain/entities/bullet.d.ts +0 -51
- package/dist/server/core/domain/entities/bullet.js +0 -94
- package/dist/server/core/domain/entities/memory.d.ts +0 -55
- package/dist/server/core/domain/entities/memory.js +0 -90
- package/dist/server/core/domain/entities/playbook.d.ts +0 -80
- package/dist/server/core/domain/entities/playbook.js +0 -214
- package/dist/server/core/domain/entities/presigned-url.d.ts +0 -9
- package/dist/server/core/domain/entities/presigned-url.js +0 -18
- package/dist/server/core/domain/entities/presigned-urls-response.d.ts +0 -10
- package/dist/server/core/domain/entities/presigned-urls-response.js +0 -18
- package/dist/server/core/domain/entities/retrieve-result.d.ts +0 -35
- package/dist/server/core/domain/entities/retrieve-result.js +0 -35
- package/dist/server/core/domain/errors/headless-prompt-error.d.ts +0 -11
- package/dist/server/core/domain/errors/headless-prompt-error.js +0 -18
- package/dist/server/core/interfaces/services/i-legacy-rule-detector.d.ts +0 -56
- package/dist/server/core/interfaces/services/i-legacy-rule-detector.js +0 -1
- package/dist/server/core/interfaces/services/i-memory-retrieval-service.d.ts +0 -39
- package/dist/server/core/interfaces/services/i-memory-retrieval-service.js +0 -1
- package/dist/server/core/interfaces/services/i-memory-storage-service.d.ts +0 -53
- package/dist/server/core/interfaces/services/i-memory-storage-service.js +0 -1
- package/dist/server/core/interfaces/services/i-terminal.d.ts +0 -146
- package/dist/server/core/interfaces/services/i-terminal.js +0 -1
- package/dist/server/core/interfaces/services/i-workspace-detector-service.d.ts +0 -8
- package/dist/server/core/interfaces/services/i-workspace-detector-service.js +0 -1
- package/dist/server/core/interfaces/storage/i-onboarding-preference-store.d.ts +0 -20
- package/dist/server/core/interfaces/storage/i-onboarding-preference-store.js +0 -1
- package/dist/server/infra/connectors/rules/legacy-rule-detector.d.ts +0 -21
- package/dist/server/infra/connectors/rules/legacy-rule-detector.js +0 -106
- package/dist/server/infra/memory/http-memory-retrieval-service.d.ts +0 -18
- package/dist/server/infra/memory/http-memory-retrieval-service.js +0 -64
- package/dist/server/infra/memory/http-memory-storage-service.d.ts +0 -18
- package/dist/server/infra/memory/http-memory-storage-service.js +0 -72
- package/dist/server/infra/memory/memory-to-playbook-mapper.d.ts +0 -33
- package/dist/server/infra/memory/memory-to-playbook-mapper.js +0 -51
- package/dist/server/infra/storage/file-onboarding-preference-store.d.ts +0 -10
- package/dist/server/infra/storage/file-onboarding-preference-store.js +0 -45
- package/dist/server/infra/terminal/headless-terminal.d.ts +0 -91
- package/dist/server/infra/terminal/headless-terminal.js +0 -211
- package/dist/server/infra/workspace/workspace-detector-service.d.ts +0 -57
- package/dist/server/infra/workspace/workspace-detector-service.js +0 -165
- package/dist/server/utils/crash-log.d.ts +0 -14
- package/dist/server/utils/crash-log.js +0 -19
- package/dist/server/utils/emoji-helpers.d.ts +0 -38
- package/dist/server/utils/emoji-helpers.js +0 -42
- package/dist/server/utils/error-handler.d.ts +0 -51
- package/dist/server/utils/error-handler.js +0 -169
- package/dist/server/utils/oclif-error-helpers.d.ts +0 -40
- package/dist/server/utils/oclif-error-helpers.js +0 -46
- package/dist/server/utils/tool-display-formatter.d.ts +0 -53
- package/dist/server/utils/tool-display-formatter.js +0 -257
|
@@ -1,257 +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
|
-
* Maximum length for string values before truncation
|
|
9
|
-
*/
|
|
10
|
-
const MAX_STRING_LENGTH = 50;
|
|
11
|
-
/**
|
|
12
|
-
* Maximum total line length for formatted output
|
|
13
|
-
*/
|
|
14
|
-
const MAX_LINE_LENGTH = 100;
|
|
15
|
-
/**
|
|
16
|
-
* Format a tool call with its arguments for display.
|
|
17
|
-
*
|
|
18
|
-
* Creates a concise, single-line representation of a tool call:
|
|
19
|
-
* - Truncates long strings with ellipsis
|
|
20
|
-
* - Shows relative paths or basenames for file paths
|
|
21
|
-
* - Omits undefined/null optional parameters
|
|
22
|
-
* - Formats arrays and objects as summaries
|
|
23
|
-
*
|
|
24
|
-
* @param toolName - Name of the tool being called
|
|
25
|
-
* @param args - Tool arguments object
|
|
26
|
-
* @returns Formatted string like "tool_name(arg1: value1, arg2: value2)"
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* formatToolCall('read_file', { filePath: '/long/path/to/file.ts', limit: 100 })
|
|
31
|
-
* // Returns: 'read_file(filePath: "file.ts", limit: 100)'
|
|
32
|
-
*
|
|
33
|
-
* formatToolCall('write_file', { filePath: 'test.ts', content: 'very long content...', createDirs: true })
|
|
34
|
-
* // Returns: 'write_file(filePath: "test.ts", content: "very long conte...", createDirs: true)'
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export function formatToolCall(toolName, args) {
|
|
38
|
-
const formattedArgs = Object.entries(args)
|
|
39
|
-
.filter(([_, value]) => value !== undefined && value !== null)
|
|
40
|
-
.map(([key, value]) => `${key}: ${formatValue(value)}`)
|
|
41
|
-
.join(', ');
|
|
42
|
-
const result = `${toolName}(${formattedArgs})`;
|
|
43
|
-
// Truncate if too long
|
|
44
|
-
if (result.length > MAX_LINE_LENGTH) {
|
|
45
|
-
return result.slice(0, MAX_LINE_LENGTH - 3) + '...';
|
|
46
|
-
}
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Format a tool result for display.
|
|
51
|
-
*
|
|
52
|
-
* Creates a concise summary of the tool execution result:
|
|
53
|
-
* - For success: shows relevant metrics (file size, match count, etc.)
|
|
54
|
-
* - For errors: shows error message
|
|
55
|
-
* - Truncates long values
|
|
56
|
-
*
|
|
57
|
-
* @param toolName - Name of the tool that was executed
|
|
58
|
-
* @param success - Whether the tool execution succeeded
|
|
59
|
-
* @param result - Tool result (if successful)
|
|
60
|
-
* @param error - Error message (if failed)
|
|
61
|
-
* @returns Formatted result string
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* formatToolResult('write_file', true, { bytesWritten: 245 })
|
|
66
|
-
* // Returns: 'File written (245 bytes)'
|
|
67
|
-
*
|
|
68
|
-
* formatToolResult('read_file', false, undefined, 'ENOENT: no such file or directory')
|
|
69
|
-
* // Returns: 'ENOENT: no such file or directory'
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export function formatToolResult(toolName, success, result, error) {
|
|
73
|
-
if (!success) {
|
|
74
|
-
return error ? truncateString(error, 80) : 'Unknown error';
|
|
75
|
-
}
|
|
76
|
-
// Tool-specific result formatting
|
|
77
|
-
switch (toolName) {
|
|
78
|
-
case 'edit_file': {
|
|
79
|
-
return formatEditFileResult(result);
|
|
80
|
-
}
|
|
81
|
-
case 'glob_files': {
|
|
82
|
-
return formatGlobFilesResult(result);
|
|
83
|
-
}
|
|
84
|
-
case 'grep_content': {
|
|
85
|
-
return formatGrepContentResult(result);
|
|
86
|
-
}
|
|
87
|
-
case 'read_file': {
|
|
88
|
-
return formatReadFileResult(result);
|
|
89
|
-
}
|
|
90
|
-
case 'search_history': {
|
|
91
|
-
return formatSearchHistoryResult(result);
|
|
92
|
-
}
|
|
93
|
-
case 'write_file': {
|
|
94
|
-
return formatWriteFileResult(result);
|
|
95
|
-
}
|
|
96
|
-
default: {
|
|
97
|
-
return formatGenericResult(result);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Format a value for display based on its type.
|
|
103
|
-
*
|
|
104
|
-
* @param value - Value to format
|
|
105
|
-
* @returns Formatted string representation
|
|
106
|
-
*/
|
|
107
|
-
function formatValue(value) {
|
|
108
|
-
if (value === null) {
|
|
109
|
-
return 'null';
|
|
110
|
-
}
|
|
111
|
-
if (value === undefined) {
|
|
112
|
-
return 'undefined';
|
|
113
|
-
}
|
|
114
|
-
if (typeof value === 'string') {
|
|
115
|
-
// Special handling for file paths
|
|
116
|
-
if (value.includes('/') || value.includes('\\')) {
|
|
117
|
-
return `"${formatPath(value)}"`;
|
|
118
|
-
}
|
|
119
|
-
return `"${truncateString(value, MAX_STRING_LENGTH)}"`;
|
|
120
|
-
}
|
|
121
|
-
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
122
|
-
return String(value);
|
|
123
|
-
}
|
|
124
|
-
if (Array.isArray(value)) {
|
|
125
|
-
return `[${value.length} items]`;
|
|
126
|
-
}
|
|
127
|
-
if (typeof value === 'object') {
|
|
128
|
-
const keys = Object.keys(value);
|
|
129
|
-
return `{${keys.length} fields}`;
|
|
130
|
-
}
|
|
131
|
-
return String(value);
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Format a file path for display.
|
|
135
|
-
* Shows basename for long paths, or relative path if reasonable.
|
|
136
|
-
*
|
|
137
|
-
* @param path - File path to format
|
|
138
|
-
* @returns Formatted path
|
|
139
|
-
*/
|
|
140
|
-
function formatPath(path) {
|
|
141
|
-
// If path is already short, return as-is
|
|
142
|
-
if (path.length <= MAX_STRING_LENGTH) {
|
|
143
|
-
return path;
|
|
144
|
-
}
|
|
145
|
-
// Extract filename
|
|
146
|
-
const parts = path.split(/[/\\]/);
|
|
147
|
-
const filename = parts.at(-1) || path;
|
|
148
|
-
// If just filename is short enough, use it
|
|
149
|
-
if (filename.length <= MAX_STRING_LENGTH) {
|
|
150
|
-
return filename;
|
|
151
|
-
}
|
|
152
|
-
// Otherwise truncate
|
|
153
|
-
return truncateString(path, MAX_STRING_LENGTH);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Truncate a string to a maximum length with ellipsis.
|
|
157
|
-
*
|
|
158
|
-
* @param str - String to truncate
|
|
159
|
-
* @param maxLength - Maximum length
|
|
160
|
-
* @returns Truncated string
|
|
161
|
-
*/
|
|
162
|
-
function truncateString(str, maxLength) {
|
|
163
|
-
if (str.length <= maxLength) {
|
|
164
|
-
return str;
|
|
165
|
-
}
|
|
166
|
-
return str.slice(0, maxLength - 3) + '...';
|
|
167
|
-
}
|
|
168
|
-
// Tool-specific result formatters
|
|
169
|
-
function formatReadFileResult(result) {
|
|
170
|
-
if (typeof result === 'object' && result !== null) {
|
|
171
|
-
const { lines } = result;
|
|
172
|
-
if (typeof lines === 'number') {
|
|
173
|
-
return `Read ${lines} lines`;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (typeof result === 'string') {
|
|
177
|
-
const lineCount = result.split('\n').length;
|
|
178
|
-
const byteCount = new Blob([result]).size;
|
|
179
|
-
return `Read ${lineCount} lines (${byteCount} bytes)`;
|
|
180
|
-
}
|
|
181
|
-
return 'File read successfully';
|
|
182
|
-
}
|
|
183
|
-
function formatWriteFileResult(result) {
|
|
184
|
-
if (typeof result === 'object' && result !== null) {
|
|
185
|
-
const { bytesWritten: bytes } = result;
|
|
186
|
-
if (typeof bytes === 'number') {
|
|
187
|
-
return `File written (${bytes} bytes)`;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
return 'File written successfully';
|
|
191
|
-
}
|
|
192
|
-
function formatEditFileResult(result) {
|
|
193
|
-
if (typeof result === 'object' && result !== null) {
|
|
194
|
-
const { changes } = result;
|
|
195
|
-
if (typeof changes === 'number') {
|
|
196
|
-
return `File edited (${changes} changes)`;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return 'File edited successfully';
|
|
200
|
-
}
|
|
201
|
-
function formatGlobFilesResult(result) {
|
|
202
|
-
if (Array.isArray(result)) {
|
|
203
|
-
return `Found ${result.length} files`;
|
|
204
|
-
}
|
|
205
|
-
if (typeof result === 'object' && result !== null) {
|
|
206
|
-
const { files } = result;
|
|
207
|
-
if (Array.isArray(files)) {
|
|
208
|
-
return `Found ${files.length} files`;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return 'Files found';
|
|
212
|
-
}
|
|
213
|
-
function formatGrepContentResult(result) {
|
|
214
|
-
if (Array.isArray(result)) {
|
|
215
|
-
return `Found ${result.length} matches`;
|
|
216
|
-
}
|
|
217
|
-
if (typeof result === 'object' && result !== null) {
|
|
218
|
-
const { matchCount: count, matches } = result;
|
|
219
|
-
if (Array.isArray(matches)) {
|
|
220
|
-
return `Found ${matches.length} matches`;
|
|
221
|
-
}
|
|
222
|
-
if (typeof count === 'number') {
|
|
223
|
-
return `Found ${count} matches`;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return 'Matches found';
|
|
227
|
-
}
|
|
228
|
-
function formatSearchHistoryResult(result) {
|
|
229
|
-
if (Array.isArray(result)) {
|
|
230
|
-
return `Found ${result.length} history items`;
|
|
231
|
-
}
|
|
232
|
-
if (typeof result === 'object' && result !== null) {
|
|
233
|
-
const { items } = result;
|
|
234
|
-
if (Array.isArray(items)) {
|
|
235
|
-
return `Found ${items.length} history items`;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
return 'History searched';
|
|
239
|
-
}
|
|
240
|
-
function formatGenericResult(result) {
|
|
241
|
-
if (result === null || result === undefined) {
|
|
242
|
-
return 'Success';
|
|
243
|
-
}
|
|
244
|
-
if (typeof result === 'string') {
|
|
245
|
-
return truncateString(result, 60);
|
|
246
|
-
}
|
|
247
|
-
if (typeof result === 'number' || typeof result === 'boolean') {
|
|
248
|
-
return String(result);
|
|
249
|
-
}
|
|
250
|
-
if (Array.isArray(result)) {
|
|
251
|
-
return `Returned ${result.length} items`;
|
|
252
|
-
}
|
|
253
|
-
if (typeof result === 'object') {
|
|
254
|
-
return 'Success';
|
|
255
|
-
}
|
|
256
|
-
return 'Success';
|
|
257
|
-
}
|