byterover-cli 0.3.2 → 0.3.3
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/dist/commands/cipher-agent/run.d.ts +3 -2
- package/dist/config/environment.js +1 -1
- package/dist/core/domain/entities/brv-config.js +15 -6
- package/dist/core/interfaces/cipher/i-chat-session.d.ts +2 -1
- package/dist/infra/cipher/blob/sqlite-blob-storage.js +1 -1
- package/dist/infra/context-tree/file-context-tree-service.js +1 -2
- package/oclif.manifest.json +10 -97
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
|
|
3
|
+
import { CipherAgent } from '../../infra/cipher/cipher-agent.js';
|
|
3
4
|
export default class CipherAgentRun extends Command {
|
|
4
5
|
static args: {
|
|
5
6
|
prompt: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
@@ -41,7 +42,7 @@ export default class CipherAgentRun extends Command {
|
|
|
41
42
|
* @param agent - CipherAgent instance
|
|
42
43
|
* @returns Most recent session ID or undefined if no sessions found
|
|
43
44
|
*/
|
|
44
|
-
protected getMostRecentSessionId(agent:
|
|
45
|
+
protected getMostRecentSessionId(agent: CipherAgent): Promise<string | undefined>;
|
|
45
46
|
run(): Promise<void>;
|
|
46
47
|
/**
|
|
47
48
|
* Validate that a session exists in storage.
|
|
@@ -50,7 +51,7 @@ export default class CipherAgentRun extends Command {
|
|
|
50
51
|
* @param sessionId - Session ID to validate
|
|
51
52
|
* @returns True if session exists
|
|
52
53
|
*/
|
|
53
|
-
protected validateSessionExists(agent:
|
|
54
|
+
protected validateSessionExists(agent: CipherAgent, sessionId: string): Promise<boolean>;
|
|
54
55
|
/**
|
|
55
56
|
* Create LLM configuration from flags and environment
|
|
56
57
|
*
|
|
@@ -13,7 +13,7 @@ export const ENV_CONFIG = {
|
|
|
13
13
|
apiBaseUrl: 'https://dev-beta-iam.byterover.dev/api/v1',
|
|
14
14
|
authorizationUrl: 'https://dev-beta-iam.byterover.dev/api/v1/oidc/authorize',
|
|
15
15
|
clientId: 'byterover-cli-client',
|
|
16
|
-
cogitApiBaseUrl: 'https://dev-beta-
|
|
16
|
+
cogitApiBaseUrl: 'https://dev-beta-cgit.byterover.dev/api/v1',
|
|
17
17
|
issuerUrl: 'https://dev-beta-iam.byterover.dev/api/v1/oidc',
|
|
18
18
|
llmGrpcEndpoint: 'dev-beta-llm-grpc.byterover.dev',
|
|
19
19
|
memoraApiBaseUrl: 'https://dev-beta-memora-retrieve.byterover.dev/api/v3',
|
|
@@ -101,22 +101,31 @@ export class BrvConfig {
|
|
|
101
101
|
* @throws BrvConfigVersionError if version is missing or mismatched.
|
|
102
102
|
*/
|
|
103
103
|
static fromJson(json) {
|
|
104
|
-
if
|
|
105
|
-
|
|
104
|
+
// Minimal check if json is an object
|
|
105
|
+
if (typeof json !== 'object' || json === null || json === undefined) {
|
|
106
|
+
throw new Error('BrvConfig JSON must be an object');
|
|
106
107
|
}
|
|
107
|
-
|
|
108
|
+
// Check version FIRST (before full structure validation)
|
|
109
|
+
// This ensures outdated configs get a helpful version error
|
|
110
|
+
// instead of a generic structure error
|
|
111
|
+
const jsonObj = json;
|
|
112
|
+
const version = typeof jsonObj.version === 'string' ? jsonObj.version : undefined;
|
|
113
|
+
if (version === undefined) {
|
|
108
114
|
throw new BrvConfigVersionError({
|
|
109
115
|
currentVersion: undefined,
|
|
110
116
|
expectedVersion: BRV_CONFIG_VERSION,
|
|
111
117
|
});
|
|
112
118
|
}
|
|
113
|
-
if (
|
|
119
|
+
if (version !== BRV_CONFIG_VERSION) {
|
|
114
120
|
throw new BrvConfigVersionError({
|
|
115
|
-
currentVersion:
|
|
121
|
+
currentVersion: version,
|
|
116
122
|
expectedVersion: BRV_CONFIG_VERSION,
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
|
-
|
|
125
|
+
if (!isBrvConfigJson(json)) {
|
|
126
|
+
throw new Error('Invalid BrvConfig JSON structure');
|
|
127
|
+
}
|
|
128
|
+
return new BrvConfig({ ...json, version });
|
|
120
129
|
}
|
|
121
130
|
/**
|
|
122
131
|
* Creates a BrvConfig from a Space entity.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Message } from '../../domain/cipher/session/types.js';
|
|
2
|
+
import type { ExecutionContext } from './i-cipher-agent.js';
|
|
2
3
|
import type { ILLMService } from './i-llm-service.js';
|
|
3
4
|
/**
|
|
4
5
|
* Interface for a chat session.
|
|
@@ -56,7 +57,7 @@ export interface IChatSession {
|
|
|
56
57
|
* @throws LLMError if LLM call fails
|
|
57
58
|
*/
|
|
58
59
|
run(input: string, options?: {
|
|
59
|
-
executionContext?:
|
|
60
|
+
executionContext?: ExecutionContext;
|
|
60
61
|
mode?: 'autonomous' | 'default' | 'query';
|
|
61
62
|
}): Promise<string>;
|
|
62
63
|
}
|
|
@@ -2,6 +2,7 @@ import Database from 'better-sqlite3';
|
|
|
2
2
|
import * as fs from 'node:fs/promises';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { BlobError } from '../../../core/domain/cipher/errors/blob-error.js';
|
|
5
|
+
import { runMigrations } from './migrations.js';
|
|
5
6
|
/**
|
|
6
7
|
* SQLite-based blob storage implementation
|
|
7
8
|
*
|
|
@@ -149,7 +150,6 @@ export class SqliteBlobStorage {
|
|
|
149
150
|
// Enable WAL mode for better concurrent performance
|
|
150
151
|
this.db.pragma('journal_mode = WAL');
|
|
151
152
|
// Run migrations to ensure schema is up-to-date
|
|
152
|
-
const { runMigrations } = await import('./migrations.js');
|
|
153
153
|
const appliedCount = runMigrations(this.db, this.logger);
|
|
154
154
|
if (appliedCount > 0) {
|
|
155
155
|
this.logger.info(`💾 Initializing storage...`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
1
|
+
import { access, mkdir, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { CONTEXT_TREE_DOMAINS } from '../../config/context-tree-domains.js';
|
|
4
4
|
import { BRV_DIR, CONTEXT_FILE, CONTEXT_TREE_DIR } from '../../constants.js';
|
|
@@ -16,7 +16,6 @@ export class FileContextTreeService {
|
|
|
16
16
|
const contextTreeDir = join(baseDir, BRV_DIR, CONTEXT_TREE_DIR);
|
|
17
17
|
try {
|
|
18
18
|
// Check if context tree directory exists
|
|
19
|
-
const { access } = await import('node:fs/promises');
|
|
20
19
|
await access(contextTreeDir);
|
|
21
20
|
return true;
|
|
22
21
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -55,39 +55,9 @@
|
|
|
55
55
|
"",
|
|
56
56
|
"# Autonomous mode - LLM auto-categorizes your context",
|
|
57
57
|
"<%= config.bin %> <%= command.id %> \"Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts\"",
|
|
58
|
-
""
|
|
59
|
-
"# Autonomous mode with OpenRouter (development only)",
|
|
60
|
-
"<%= config.bin %> <%= command.id %> -k YOUR_API_KEY \"React components follow atomic design in src/components/. Atoms in atoms/, molecules in molecules/, organisms in organisms/\"",
|
|
61
|
-
"",
|
|
62
|
-
"# Autonomous mode with custom model (development only)",
|
|
63
|
-
"<%= config.bin %> <%= command.id %> -k YOUR_API_KEY -m anthropic/claude-sonnet-4 \"API rate limit is 100 req/min per user. Implemented using Redis with sliding window in rateLimiter.ts\""
|
|
58
|
+
""
|
|
64
59
|
],
|
|
65
|
-
"flags": {
|
|
66
|
-
"apiKey": {
|
|
67
|
-
"char": "k",
|
|
68
|
-
"description": "OpenRouter API key (use OpenRouter instead of internal gRPC backend) [Development only]",
|
|
69
|
-
"env": "OPENROUTER_API_KEY",
|
|
70
|
-
"name": "apiKey",
|
|
71
|
-
"hasDynamicHelp": false,
|
|
72
|
-
"multiple": false,
|
|
73
|
-
"type": "option"
|
|
74
|
-
},
|
|
75
|
-
"model": {
|
|
76
|
-
"char": "m",
|
|
77
|
-
"description": "Model to use (default: google/gemini-2.5-pro for OpenRouter, gemini-2.5-pro for gRPC) [Development only]",
|
|
78
|
-
"name": "model",
|
|
79
|
-
"hasDynamicHelp": false,
|
|
80
|
-
"multiple": false,
|
|
81
|
-
"type": "option"
|
|
82
|
-
},
|
|
83
|
-
"verbose": {
|
|
84
|
-
"char": "v",
|
|
85
|
-
"description": "Enable verbose debug output [Development only]",
|
|
86
|
-
"name": "verbose",
|
|
87
|
-
"allowNo": false,
|
|
88
|
-
"type": "boolean"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
60
|
+
"flags": {},
|
|
91
61
|
"hasDynamicHelp": false,
|
|
92
62
|
"hiddenAliases": [],
|
|
93
63
|
"id": "curate",
|
|
@@ -109,7 +79,7 @@
|
|
|
109
79
|
"description": "Purely for testing CodingAgentLogWatcher [Development only]",
|
|
110
80
|
"flags": {},
|
|
111
81
|
"hasDynamicHelp": false,
|
|
112
|
-
"hidden":
|
|
82
|
+
"hidden": true,
|
|
113
83
|
"hiddenAliases": [],
|
|
114
84
|
"id": "foo",
|
|
115
85
|
"pluginAlias": "byterover-cli",
|
|
@@ -337,42 +307,9 @@
|
|
|
337
307
|
"# Ask questions about patterns, decisions, or implementation details",
|
|
338
308
|
"<%= config.bin %> <%= command.id %> What are the coding standards?",
|
|
339
309
|
"<%= config.bin %> <%= command.id %> How is authentication implemented?",
|
|
340
|
-
""
|
|
341
|
-
"# Query with OpenRouter (development only)",
|
|
342
|
-
"<%= config.bin %> <%= command.id %> -k YOUR_API_KEY Show me all API endpoints",
|
|
343
|
-
"",
|
|
344
|
-
"# Query with custom model (development only)",
|
|
345
|
-
"<%= config.bin %> <%= command.id %> -k YOUR_API_KEY -m anthropic/claude-sonnet-4 Explain the database schema",
|
|
346
|
-
"",
|
|
347
|
-
"# Query with verbose output (development only)",
|
|
348
|
-
"<%= config.bin %> <%= command.id %> -v What testing strategies are used?"
|
|
310
|
+
""
|
|
349
311
|
],
|
|
350
|
-
"flags": {
|
|
351
|
-
"apiKey": {
|
|
352
|
-
"char": "k",
|
|
353
|
-
"description": "OpenRouter API key (use OpenRouter instead of internal gRPC backend) [Development only]",
|
|
354
|
-
"env": "OPENROUTER_API_KEY",
|
|
355
|
-
"name": "apiKey",
|
|
356
|
-
"hasDynamicHelp": false,
|
|
357
|
-
"multiple": false,
|
|
358
|
-
"type": "option"
|
|
359
|
-
},
|
|
360
|
-
"model": {
|
|
361
|
-
"char": "m",
|
|
362
|
-
"description": "Model to use (default: google/gemini-2.5-pro for OpenRouter, gemini-2.5-pro for gRPC) [Development only]",
|
|
363
|
-
"name": "model",
|
|
364
|
-
"hasDynamicHelp": false,
|
|
365
|
-
"multiple": false,
|
|
366
|
-
"type": "option"
|
|
367
|
-
},
|
|
368
|
-
"verbose": {
|
|
369
|
-
"char": "v",
|
|
370
|
-
"description": "Enable verbose debug output [Development only]",
|
|
371
|
-
"name": "verbose",
|
|
372
|
-
"allowNo": false,
|
|
373
|
-
"type": "boolean"
|
|
374
|
-
}
|
|
375
|
-
},
|
|
312
|
+
"flags": {},
|
|
376
313
|
"hasDynamicHelp": false,
|
|
377
314
|
"hiddenAliases": [],
|
|
378
315
|
"id": "query",
|
|
@@ -473,7 +410,7 @@
|
|
|
473
410
|
}
|
|
474
411
|
},
|
|
475
412
|
"hasDynamicHelp": false,
|
|
476
|
-
"hidden":
|
|
413
|
+
"hidden": true,
|
|
477
414
|
"hiddenAliases": [],
|
|
478
415
|
"id": "watch",
|
|
479
416
|
"pluginAlias": "byterover-cli",
|
|
@@ -527,30 +464,6 @@
|
|
|
527
464
|
"<%= config.bin %> <%= command.id %> --working-directory ~/myproject"
|
|
528
465
|
],
|
|
529
466
|
"flags": {
|
|
530
|
-
"apiKey": {
|
|
531
|
-
"char": "k",
|
|
532
|
-
"description": "OpenRouter API key (use OpenRouter instead of gRPC backend) [Development only]",
|
|
533
|
-
"env": "OPENROUTER_API_KEY",
|
|
534
|
-
"name": "apiKey",
|
|
535
|
-
"hasDynamicHelp": false,
|
|
536
|
-
"multiple": false,
|
|
537
|
-
"type": "option"
|
|
538
|
-
},
|
|
539
|
-
"model": {
|
|
540
|
-
"char": "m",
|
|
541
|
-
"description": "Model to use (default: google/gemini-2.5-pro for OpenRouter, gemini-2.5-pro for gRPC) [Development only]",
|
|
542
|
-
"name": "model",
|
|
543
|
-
"hasDynamicHelp": false,
|
|
544
|
-
"multiple": false,
|
|
545
|
-
"type": "option"
|
|
546
|
-
},
|
|
547
|
-
"verbose": {
|
|
548
|
-
"char": "v",
|
|
549
|
-
"description": "Enable verbose debug output for prompt loading and agent operations [Development only]",
|
|
550
|
-
"name": "verbose",
|
|
551
|
-
"allowNo": false,
|
|
552
|
-
"type": "boolean"
|
|
553
|
-
},
|
|
554
467
|
"continue": {
|
|
555
468
|
"char": "c",
|
|
556
469
|
"description": "Continue most recent session (requires prompt in headless mode)",
|
|
@@ -599,7 +512,7 @@
|
|
|
599
512
|
}
|
|
600
513
|
},
|
|
601
514
|
"hasDynamicHelp": false,
|
|
602
|
-
"hidden":
|
|
515
|
+
"hidden": true,
|
|
603
516
|
"hiddenAliases": [],
|
|
604
517
|
"id": "cipher-agent:run",
|
|
605
518
|
"pluginAlias": "byterover-cli",
|
|
@@ -631,7 +544,7 @@
|
|
|
631
544
|
],
|
|
632
545
|
"flags": {},
|
|
633
546
|
"hasDynamicHelp": false,
|
|
634
|
-
"hidden":
|
|
547
|
+
"hidden": true,
|
|
635
548
|
"hiddenAliases": [],
|
|
636
549
|
"id": "cipher-agent:set-prompt",
|
|
637
550
|
"pluginAlias": "byterover-cli",
|
|
@@ -656,7 +569,7 @@
|
|
|
656
569
|
],
|
|
657
570
|
"flags": {},
|
|
658
571
|
"hasDynamicHelp": false,
|
|
659
|
-
"hidden":
|
|
572
|
+
"hidden": true,
|
|
660
573
|
"hiddenAliases": [],
|
|
661
574
|
"id": "cipher-agent:show-prompt",
|
|
662
575
|
"pluginAlias": "byterover-cli",
|
|
@@ -759,5 +672,5 @@
|
|
|
759
672
|
]
|
|
760
673
|
}
|
|
761
674
|
},
|
|
762
|
-
"version": "0.3.
|
|
675
|
+
"version": "0.3.3"
|
|
763
676
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "byterover-cli",
|
|
3
3
|
"description": "ByteRover's CLI",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"author": "ByteRover",
|
|
6
6
|
"bin": {
|
|
7
7
|
"brv": "./bin/run.js"
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"lint": "eslint",
|
|
97
97
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
98
98
|
"posttest": "npm run lint",
|
|
99
|
-
"prepack": "npm run build && oclif manifest",
|
|
99
|
+
"prepack": "npm run build && BRV_ENV=production oclif manifest",
|
|
100
100
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
101
101
|
"version": "git add README.md"
|
|
102
102
|
},
|