byterover-cli 3.2.0 → 3.4.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 +0 -4
- package/dist/agent/core/domain/swarm/types.d.ts +132 -0
- package/dist/agent/core/domain/swarm/types.js +128 -0
- package/dist/agent/core/domain/tools/constants.d.ts +2 -0
- package/dist/agent/core/domain/tools/constants.js +2 -0
- package/dist/agent/core/interfaces/i-memory-provider.d.ts +45 -0
- package/dist/agent/core/interfaces/i-memory-provider.js +1 -0
- package/dist/agent/core/interfaces/i-sandbox-service.d.ts +8 -0
- package/dist/agent/core/interfaces/i-swarm-coordinator.d.ts +127 -0
- package/dist/agent/core/interfaces/i-swarm-coordinator.js +1 -0
- package/dist/agent/infra/agent/service-initializer.js +48 -0
- package/dist/agent/infra/map/map-shared.d.ts +2 -2
- package/dist/agent/infra/sandbox/sandbox-service.d.ts +10 -0
- package/dist/agent/infra/sandbox/sandbox-service.js +13 -0
- package/dist/agent/infra/sandbox/tools-sdk.d.ts +25 -0
- package/dist/agent/infra/sandbox/tools-sdk.js +24 -1
- package/dist/agent/infra/swarm/adapters/byterover-adapter.d.ts +39 -0
- package/dist/agent/infra/swarm/adapters/byterover-adapter.js +62 -0
- package/dist/agent/infra/swarm/adapters/gbrain-adapter.d.ts +63 -0
- package/dist/agent/infra/swarm/adapters/gbrain-adapter.js +209 -0
- package/dist/agent/infra/swarm/adapters/local-markdown-adapter.d.ts +41 -0
- package/dist/agent/infra/swarm/adapters/local-markdown-adapter.js +256 -0
- package/dist/agent/infra/swarm/adapters/memory-wiki-adapter.d.ts +29 -0
- package/dist/agent/infra/swarm/adapters/memory-wiki-adapter.js +244 -0
- package/dist/agent/infra/swarm/adapters/obsidian-adapter.d.ts +37 -0
- package/dist/agent/infra/swarm/adapters/obsidian-adapter.js +201 -0
- package/dist/agent/infra/swarm/cli/query-renderer.d.ts +15 -0
- package/dist/agent/infra/swarm/cli/query-renderer.js +126 -0
- package/dist/agent/infra/swarm/config/swarm-config-loader.d.ts +14 -0
- package/dist/agent/infra/swarm/config/swarm-config-loader.js +82 -0
- package/dist/agent/infra/swarm/config/swarm-config-schema.d.ts +667 -0
- package/dist/agent/infra/swarm/config/swarm-config-schema.js +305 -0
- package/dist/agent/infra/swarm/provider-factory.d.ts +21 -0
- package/dist/agent/infra/swarm/provider-factory.js +67 -0
- package/dist/agent/infra/swarm/search-precision.d.ts +95 -0
- package/dist/agent/infra/swarm/search-precision.js +141 -0
- package/dist/agent/infra/swarm/swarm-coordinator.d.ts +59 -0
- package/dist/agent/infra/swarm/swarm-coordinator.js +436 -0
- package/dist/agent/infra/swarm/swarm-graph.d.ts +63 -0
- package/dist/agent/infra/swarm/swarm-graph.js +167 -0
- package/dist/agent/infra/swarm/swarm-merger.d.ts +29 -0
- package/dist/agent/infra/swarm/swarm-merger.js +66 -0
- package/dist/agent/infra/swarm/swarm-router.d.ts +12 -0
- package/dist/agent/infra/swarm/swarm-router.js +40 -0
- package/dist/agent/infra/swarm/swarm-write-router.d.ts +23 -0
- package/dist/agent/infra/swarm/swarm-write-router.js +45 -0
- package/dist/agent/infra/swarm/validation/config-validator.d.ts +16 -0
- package/dist/agent/infra/swarm/validation/config-validator.js +402 -0
- package/dist/agent/infra/swarm/validation/memory-swarm-validation-error.d.ts +33 -0
- package/dist/agent/infra/swarm/validation/memory-swarm-validation-error.js +27 -0
- package/dist/agent/infra/swarm/wizard/config-scaffolder.d.ts +36 -0
- package/dist/agent/infra/swarm/wizard/config-scaffolder.js +96 -0
- package/dist/agent/infra/swarm/wizard/provider-detector.d.ts +54 -0
- package/dist/agent/infra/swarm/wizard/provider-detector.js +153 -0
- package/dist/agent/infra/swarm/wizard/swarm-wizard.d.ts +61 -0
- package/dist/agent/infra/swarm/wizard/swarm-wizard.js +187 -0
- package/dist/agent/infra/system-prompt/contributors/index.d.ts +1 -0
- package/dist/agent/infra/system-prompt/contributors/index.js +1 -0
- package/dist/agent/infra/system-prompt/contributors/swarm-state-contributor.d.ts +15 -0
- package/dist/agent/infra/system-prompt/contributors/swarm-state-contributor.js +65 -0
- package/dist/agent/infra/tools/implementations/curate-tool.d.ts +14 -14
- package/dist/agent/infra/tools/implementations/curate-tool.js +2 -0
- package/dist/agent/infra/tools/implementations/search-knowledge-service.js +12 -2
- package/dist/agent/infra/tools/implementations/swarm-query-tool.d.ts +9 -0
- package/dist/agent/infra/tools/implementations/swarm-query-tool.js +44 -0
- package/dist/agent/infra/tools/implementations/swarm-store-tool.d.ts +9 -0
- package/dist/agent/infra/tools/implementations/swarm-store-tool.js +43 -0
- package/dist/agent/infra/tools/tool-provider.js +1 -0
- package/dist/agent/infra/tools/tool-registry.d.ts +3 -0
- package/dist/agent/infra/tools/tool-registry.js +25 -1
- package/dist/agent/resources/tools/code_exec.txt +2 -0
- package/dist/agent/resources/tools/swarm_query.txt +38 -0
- package/dist/agent/resources/tools/swarm_store.txt +35 -0
- package/dist/oclif/commands/curate/index.d.ts +1 -0
- package/dist/oclif/commands/curate/index.js +15 -1
- package/dist/oclif/commands/query.d.ts +1 -0
- package/dist/oclif/commands/query.js +17 -3
- package/dist/oclif/commands/search.d.ts +20 -0
- package/dist/oclif/commands/search.js +186 -0
- package/dist/oclif/commands/status.js +4 -0
- package/dist/oclif/commands/swarm/curate.d.ts +13 -0
- package/dist/oclif/commands/swarm/curate.js +81 -0
- package/dist/oclif/commands/swarm/onboard.d.ts +6 -0
- package/dist/oclif/commands/swarm/onboard.js +233 -0
- package/dist/oclif/commands/swarm/query.d.ts +14 -0
- package/dist/oclif/commands/swarm/query.js +84 -0
- package/dist/oclif/commands/swarm/status.d.ts +41 -0
- package/dist/oclif/commands/swarm/status.js +278 -0
- package/dist/oclif/lib/daemon-client.js +0 -1
- package/dist/oclif/lib/search-format.d.ts +10 -0
- package/dist/oclif/lib/search-format.js +25 -0
- package/dist/oclif/lib/task-client.d.ts +6 -0
- package/dist/oclif/lib/task-client.js +10 -3
- package/dist/server/constants.d.ts +3 -2
- package/dist/server/constants.js +10 -7
- package/dist/server/core/domain/errors/task-error.d.ts +2 -2
- package/dist/server/core/domain/errors/task-error.js +5 -4
- package/dist/server/core/domain/source/source-schema.d.ts +6 -6
- package/dist/server/core/domain/transport/schemas.d.ts +14 -14
- package/dist/server/core/domain/transport/schemas.js +3 -3
- package/dist/server/core/interfaces/executor/i-search-executor.d.ts +34 -0
- package/dist/server/core/interfaces/executor/i-search-executor.js +1 -0
- package/dist/server/core/interfaces/executor/index.d.ts +1 -0
- package/dist/server/core/interfaces/executor/index.js +1 -0
- package/dist/server/infra/daemon/agent-process.js +20 -7
- package/dist/server/infra/executor/search-executor.d.ts +17 -0
- package/dist/server/infra/executor/search-executor.js +30 -0
- package/dist/server/infra/http/provider-model-fetchers.js +1 -0
- package/dist/server/infra/process/feature-handlers.js +13 -0
- package/dist/server/infra/project/project-registry.js +13 -1
- package/dist/server/infra/transport/handlers/locations-handler.d.ts +2 -0
- package/dist/server/infra/transport/handlers/locations-handler.js +16 -1
- package/dist/server/infra/transport/handlers/pull-handler.js +3 -3
- package/dist/server/infra/transport/handlers/push-handler.js +3 -3
- package/dist/server/infra/transport/handlers/status-handler.js +25 -18
- package/dist/server/infra/transport/handlers/vc-handler.d.ts +0 -4
- package/dist/server/infra/transport/handlers/vc-handler.js +5 -16
- package/dist/server/templates/skill/SKILL.md +188 -5
- package/dist/server/utils/gitignore.d.ts +1 -0
- package/dist/server/utils/gitignore.js +36 -4
- package/dist/shared/transport/search-content.d.ts +28 -0
- package/dist/shared/transport/search-content.js +38 -0
- package/dist/shared/transport/types/dto.d.ts +1 -1
- package/dist/tui/features/status/utils/format-status.js +5 -0
- package/dist/tui/utils/error-messages.js +2 -2
- package/oclif.manifest.json +581 -317
- package/package.json +2 -2
|
@@ -34,7 +34,27 @@ Knowledge is stored in `.brv/context-tree/` as human-readable Markdown files.
|
|
|
34
34
|
brv query "How is authentication implemented?"
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### 2.
|
|
37
|
+
### 2. Search Context Tree
|
|
38
|
+
**Overview:** Retrieve a ranked list of matching files from `.brv/context-tree/` via pure BM25 lookup. Unlike `brv query`, this does NOT call an LLM — no synthesis, no token cost, no provider setup needed. Returns structured results with paths, scores, and excerpts.
|
|
39
|
+
|
|
40
|
+
**Use this skill when:**
|
|
41
|
+
- You need file paths to read rather than a synthesized answer
|
|
42
|
+
- You want fast, cheap retrieval with no LLM overhead
|
|
43
|
+
- You're in an automated pipeline that consumes structured results
|
|
44
|
+
|
|
45
|
+
**Do NOT use this skill when:**
|
|
46
|
+
- You need a natural-language answer synthesized from multiple files — use `brv query` instead
|
|
47
|
+
- The information is already present in your current context
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
brv search "authentication patterns"
|
|
51
|
+
brv search "JWT tokens" --limit 5 --scope "auth/"
|
|
52
|
+
brv search "auth" --format json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Flags:** `--limit N` (1-50, default 10), `--scope "domain/"` (path prefix filter), `--format json` (structured output for automation).
|
|
56
|
+
|
|
57
|
+
### 3. Curate Context
|
|
38
58
|
**Overview:** Analyze and save knowledge to the local knowledge base. Uses a configured LLM provider to categorize and structure the context you provide.
|
|
39
59
|
|
|
40
60
|
**Use this skill when:**
|
|
@@ -79,7 +99,7 @@ brv curate view --since 1h --status completed
|
|
|
79
99
|
brv curate view --help
|
|
80
100
|
```
|
|
81
101
|
|
|
82
|
-
###
|
|
102
|
+
### 4. Review Pending Changes
|
|
83
103
|
**Overview:** After a curate operation, some changes may require human review before being applied. Use `brv review` to list, approve, or reject pending operations.
|
|
84
104
|
|
|
85
105
|
**Use this when:**
|
|
@@ -142,7 +162,7 @@ brv review approve <taskId> --format json
|
|
|
142
162
|
brv review reject <taskId> --format json
|
|
143
163
|
```
|
|
144
164
|
|
|
145
|
-
###
|
|
165
|
+
### 5. LLM Provider Setup
|
|
146
166
|
`brv query` and `brv curate` require a configured LLM provider. Connect the default ByteRover provider (no API key needed):
|
|
147
167
|
|
|
148
168
|
```bash
|
|
@@ -156,7 +176,7 @@ brv providers list
|
|
|
156
176
|
brv providers connect openai --api-key sk-xxx --model gpt-4.1
|
|
157
177
|
```
|
|
158
178
|
|
|
159
|
-
###
|
|
179
|
+
### 6. Project Locations
|
|
160
180
|
**Overview:** List registered projects and their context tree paths. Returns project metadata including initialization status and active state. Use `-f json` for machine-readable output.
|
|
161
181
|
|
|
162
182
|
**Use this when:**
|
|
@@ -174,7 +194,7 @@ brv locations -f json
|
|
|
174
194
|
|
|
175
195
|
JSON fields: `projectPath`, `contextTreePath`, `isCurrent`, `isActive`, `isInitialized`.
|
|
176
196
|
|
|
177
|
-
###
|
|
197
|
+
### 7. Version Control
|
|
178
198
|
**Overview:** `brv vc` provides git-based version control for your context tree. It uses standard git semantics — branching, committing, merging, history, and conflict resolution — all working locally with no authentication required. Remote sync with a team is optional. The legacy `brv push`, `brv pull`, and `brv space` commands are deprecated — use `brv vc push`, `brv vc pull`, and `brv vc clone`/`brv vc remote add` instead.
|
|
179
199
|
|
|
180
200
|
**Use this when:**
|
|
@@ -290,6 +310,169 @@ brv vc push -u origin main # push and set upstream tracking
|
|
|
290
310
|
brv vc clone https://byterover.dev/<team>/<space>.git
|
|
291
311
|
```
|
|
292
312
|
|
|
313
|
+
### 8. Swarm Query
|
|
314
|
+
**Overview:** Search across all active memory providers simultaneously — ByteRover context tree, Obsidian vault, Local Markdown folders, GBrain, and Memory Wiki. Results are fused via Reciprocal Rank Fusion (RRF) and ranked by provider weight and relevance. No LLM call — pure algorithmic search.
|
|
315
|
+
|
|
316
|
+
**Use this skill when:**
|
|
317
|
+
- You need to search across multiple knowledge sources at once
|
|
318
|
+
- The user has configured multiple memory providers (check with `brv swarm status`)
|
|
319
|
+
- You want results from Obsidian notes, GBrain entities, or wiki pages alongside ByteRover context
|
|
320
|
+
|
|
321
|
+
**Do NOT use this skill when:**
|
|
322
|
+
- The user only has ByteRover configured — use `brv query` instead (it synthesizes via LLM)
|
|
323
|
+
- You need an LLM-synthesized answer — `brv swarm query` returns raw search results, not synthesized text
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
brv swarm query "How does JWT refresh work?"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
Output:
|
|
330
|
+
```
|
|
331
|
+
Swarm Query: "How does JWT refresh work?"
|
|
332
|
+
Type: factual | Providers: 4 queried | Latency: 398ms
|
|
333
|
+
──────────────────────────────────────────────────
|
|
334
|
+
1. [memory-wiki] sources/jwt-token-lifecycle.md score: 0.0150 [keyword]
|
|
335
|
+
# JWT Token Lifecycle ...
|
|
336
|
+
2. [obsidian] SwarmTestData/Authentication System.md score: 0.0142 [keyword]
|
|
337
|
+
# Authentication System ...
|
|
338
|
+
3. [gbrain] alex-chen score: 0.0117 [semantic]
|
|
339
|
+
# Alex Chen — Senior Backend Engineer ...
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
**With explain mode** (shows classification, provider selection, enrichment):
|
|
343
|
+
```bash
|
|
344
|
+
brv swarm query "authentication patterns" --explain
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
Output:
|
|
348
|
+
```
|
|
349
|
+
Classification: factual
|
|
350
|
+
Provider selection: 4 of 4 available
|
|
351
|
+
✓ byterover (healthy, selected, 0 results, 14ms)
|
|
352
|
+
✓ obsidian (healthy, selected, 5 results, 91ms)
|
|
353
|
+
✓ memory-wiki (healthy, selected, 2 results, 15ms)
|
|
354
|
+
✓ gbrain (healthy, selected, 1 results, 260ms)
|
|
355
|
+
Enrichment:
|
|
356
|
+
byterover → obsidian
|
|
357
|
+
byterover → memory-wiki
|
|
358
|
+
Results: 8 raw → 7 after RRF fusion + precision filtering
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**JSON output:**
|
|
362
|
+
```bash
|
|
363
|
+
brv swarm query "rate limiting" --format json
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Output:
|
|
367
|
+
```json
|
|
368
|
+
{
|
|
369
|
+
"meta": {
|
|
370
|
+
"queryType": "factual",
|
|
371
|
+
"totalLatencyMs": 340,
|
|
372
|
+
"providers": {
|
|
373
|
+
"byterover": { "selected": true, "resultCount": 0 },
|
|
374
|
+
"obsidian": { "selected": true, "resultCount": 5 },
|
|
375
|
+
"gbrain": { "selected": true, "resultCount": 1 },
|
|
376
|
+
"memory-wiki": { "selected": true, "resultCount": 1 }
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"results": [
|
|
380
|
+
{ "provider": "memory-wiki", "providerType": "memory-wiki", "score": 0.015, "content": "# Rate Limiting ..." }
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Limit results:**
|
|
386
|
+
```bash
|
|
387
|
+
brv swarm query "testing strategy" -n 5
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**Flags:** `--explain` (show routing details), `--format json` (structured output), `-n <value>` (max results).
|
|
391
|
+
|
|
392
|
+
### 9. Swarm Curate
|
|
393
|
+
**Overview:** Store knowledge in the best available external memory provider. ByteRover automatically classifies the content type and routes accordingly: entities (people, orgs) go to GBrain, notes (meeting notes, TODOs) go to Local Markdown, general content goes to the first writable provider. Falls back to ByteRover context tree if no external providers are available.
|
|
394
|
+
|
|
395
|
+
**Use this skill when:**
|
|
396
|
+
- You want to store knowledge in an external provider (GBrain, Local Markdown, Memory Wiki)
|
|
397
|
+
- The user has configured writable swarm providers
|
|
398
|
+
|
|
399
|
+
**Do NOT use this skill when:**
|
|
400
|
+
- You want to store in ByteRover's context tree specifically — use `brv curate` instead
|
|
401
|
+
- No swarm providers are configured — use `brv curate` instead
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
brv swarm curate "Jane Smith is the CTO of TechCorp"
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Output:
|
|
408
|
+
```
|
|
409
|
+
Stored to gbrain as concept/jane-smith-cto
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Target a specific provider:**
|
|
413
|
+
```bash
|
|
414
|
+
brv swarm curate "meeting notes: decided on JWT" --provider local-markdown:notes
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
Output:
|
|
418
|
+
```
|
|
419
|
+
Stored to local-markdown:notes as note-1776052527043.md
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
brv swarm curate "Architecture uses event sourcing" --provider gbrain
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Output:
|
|
427
|
+
```
|
|
428
|
+
Stored to gbrain as concept/event-sourcing-architecture
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
**JSON output:**
|
|
432
|
+
```bash
|
|
433
|
+
brv swarm curate "Test content" --format json
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Output:
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"id": "note-1776052594462.md",
|
|
440
|
+
"provider": "local-markdown:project-docs",
|
|
441
|
+
"success": true,
|
|
442
|
+
"latencyMs": 1
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
**Flags:** `--provider <id>` (target specific provider), `--format json` (structured output).
|
|
447
|
+
|
|
448
|
+
### 10. Swarm Status
|
|
449
|
+
**Overview:** Check provider health and write targets before running swarm query or curate. Use this to verify which providers are available and operational.
|
|
450
|
+
|
|
451
|
+
**Use this skill when:**
|
|
452
|
+
- Before running `brv swarm query` or `brv swarm curate` to check available providers
|
|
453
|
+
- Diagnosing why swarm results are missing from a specific provider
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
brv swarm status
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
Output:
|
|
460
|
+
```
|
|
461
|
+
Memory Swarm Health Check
|
|
462
|
+
════════════════════════════════════════
|
|
463
|
+
✓ ByteRover context-tree (always on)
|
|
464
|
+
✓ Obsidian /Users/you/Documents/MyObsidian
|
|
465
|
+
✓ Local .md 1 folder(s)
|
|
466
|
+
✓ GBrain /Users/you/workspaces/gbrain
|
|
467
|
+
✓ Memory Wiki /Users/you/.openclaw/wiki/main
|
|
468
|
+
|
|
469
|
+
Write Targets:
|
|
470
|
+
gbrain (entity, general)
|
|
471
|
+
local-markdown:project-docs (note, general)
|
|
472
|
+
|
|
473
|
+
Swarm is operational (5/5 providers configured).
|
|
474
|
+
```
|
|
475
|
+
|
|
293
476
|
## Data Handling
|
|
294
477
|
|
|
295
478
|
**Storage**: All knowledge is stored as Markdown files in `.brv/context-tree/` within the project directory. Files are human-readable and version-controllable.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { access, readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { CONTEXT_TREE_GITIGNORE_HEADER, CONTEXT_TREE_GITIGNORE_PATTERNS } from '../constants.js';
|
|
3
4
|
const GITIGNORE_ENTRIES = `# ByteRover — .brv/context-tree/ contains a nested .git managed by brv vc.
|
|
4
5
|
# Without these entries, \`git add .\` fails with "does not have a commit checked out".
|
|
5
6
|
.brv/
|
|
@@ -14,10 +15,8 @@ const GITIGNORE_ENTRIES = `# ByteRover — .brv/context-tree/ contains a nested
|
|
|
14
15
|
*/
|
|
15
16
|
export async function ensureGitignoreEntries(directory) {
|
|
16
17
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await access(join(dir, '.git'));
|
|
20
|
-
const gitignorePath = join(dir, '.gitignore');
|
|
18
|
+
await access(join(directory, '.git'));
|
|
19
|
+
const gitignorePath = join(directory, '.gitignore');
|
|
21
20
|
let existing = '';
|
|
22
21
|
try {
|
|
23
22
|
existing = await readFile(gitignorePath, 'utf8');
|
|
@@ -45,3 +44,36 @@ export async function ensureGitignoreEntries(directory) {
|
|
|
45
44
|
// Best-effort — gitignore failure should not block the caller
|
|
46
45
|
}
|
|
47
46
|
}
|
|
47
|
+
export async function ensureContextTreeGitignore(contextTreeDir) {
|
|
48
|
+
try {
|
|
49
|
+
const gitignorePath = join(contextTreeDir, '.gitignore');
|
|
50
|
+
let existing = '';
|
|
51
|
+
try {
|
|
52
|
+
existing = await readFile(gitignorePath, 'utf8');
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// File doesn't exist — will create with full content
|
|
56
|
+
}
|
|
57
|
+
if (existing.length === 0) {
|
|
58
|
+
await writeFile(gitignorePath, CONTEXT_TREE_GITIGNORE_HEADER + '\n' + CONTEXT_TREE_GITIGNORE_PATTERNS.join('\n') + '\n', 'utf8');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const existingLines = existing.split('\n').map((l) => l.trim());
|
|
62
|
+
const toAppend = [];
|
|
63
|
+
if (!existingLines.includes(CONTEXT_TREE_GITIGNORE_HEADER)) {
|
|
64
|
+
toAppend.push(CONTEXT_TREE_GITIGNORE_HEADER);
|
|
65
|
+
}
|
|
66
|
+
for (const pattern of CONTEXT_TREE_GITIGNORE_PATTERNS) {
|
|
67
|
+
if (existingLines.some((el) => el.includes(pattern)))
|
|
68
|
+
continue;
|
|
69
|
+
toAppend.push(pattern);
|
|
70
|
+
}
|
|
71
|
+
if (toAppend.length === 0)
|
|
72
|
+
return;
|
|
73
|
+
const separator = existing.endsWith('\n') ? '\n' : '\n\n';
|
|
74
|
+
await writeFile(gitignorePath, existing + separator + toAppend.join('\n') + '\n', 'utf8');
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Best-effort — gitignore sync should never block the caller
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode/decode helpers for search task content payloads.
|
|
3
|
+
*
|
|
4
|
+
* The transport layer's TaskCreateRequest has a single `content: string`
|
|
5
|
+
* field. For search tasks, we pack {query, limit?, scope?} as JSON so
|
|
6
|
+
* the agent process can reconstruct the structured options.
|
|
7
|
+
*
|
|
8
|
+
* Lives in shared/ because both the CLI (encoder) and the daemon
|
|
9
|
+
* agent-process (decoder) depend on it. Keeping it in oclif/ would
|
|
10
|
+
* create a circular dependency (server → oclif).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Encode search options as JSON content payload for the transport layer.
|
|
14
|
+
*/
|
|
15
|
+
export declare function encodeSearchContent(options: {
|
|
16
|
+
limit?: number;
|
|
17
|
+
query: string;
|
|
18
|
+
scope?: string;
|
|
19
|
+
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* Parse a JSON-encoded search content payload back into options.
|
|
22
|
+
* Falls back to treating the entire string as a plain query if parsing fails.
|
|
23
|
+
*/
|
|
24
|
+
export declare function decodeSearchContent(content: string): {
|
|
25
|
+
limit?: number;
|
|
26
|
+
query: string;
|
|
27
|
+
scope?: string;
|
|
28
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode/decode helpers for search task content payloads.
|
|
3
|
+
*
|
|
4
|
+
* The transport layer's TaskCreateRequest has a single `content: string`
|
|
5
|
+
* field. For search tasks, we pack {query, limit?, scope?} as JSON so
|
|
6
|
+
* the agent process can reconstruct the structured options.
|
|
7
|
+
*
|
|
8
|
+
* Lives in shared/ because both the CLI (encoder) and the daemon
|
|
9
|
+
* agent-process (decoder) depend on it. Keeping it in oclif/ would
|
|
10
|
+
* create a circular dependency (server → oclif).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Encode search options as JSON content payload for the transport layer.
|
|
14
|
+
*/
|
|
15
|
+
export function encodeSearchContent(options) {
|
|
16
|
+
return JSON.stringify({
|
|
17
|
+
limit: options.limit,
|
|
18
|
+
query: options.query,
|
|
19
|
+
scope: options.scope,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse a JSON-encoded search content payload back into options.
|
|
24
|
+
* Falls back to treating the entire string as a plain query if parsing fails.
|
|
25
|
+
*/
|
|
26
|
+
export function decodeSearchContent(content) {
|
|
27
|
+
try {
|
|
28
|
+
const parsed = JSON.parse(content);
|
|
29
|
+
return {
|
|
30
|
+
limit: typeof parsed.limit === 'number' ? parsed.limit : undefined,
|
|
31
|
+
query: typeof parsed.query === 'string' ? parsed.query : content,
|
|
32
|
+
scope: typeof parsed.scope === 'string' ? parsed.scope : undefined,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return { query: content };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -133,7 +133,7 @@ export interface StatusDTO {
|
|
|
133
133
|
contextTreeDir?: string;
|
|
134
134
|
/** Relative path to the context tree directory from project root (e.g., '.brv/context-tree') */
|
|
135
135
|
contextTreeRelativeDir?: string;
|
|
136
|
-
contextTreeStatus: 'git_vc' | 'has_changes' | 'no_changes' | 'not_initialized' | 'unknown';
|
|
136
|
+
contextTreeStatus: 'git_vc' | 'has_changes' | 'no_changes' | 'no_vc' | 'not_initialized' | 'unknown';
|
|
137
137
|
/** @deprecated Use projectRoot instead. Kept for backward compatibility. */
|
|
138
138
|
currentDirectory: string;
|
|
139
139
|
/** Number of files with pending HITL review (0 if none or unavailable). */
|
|
@@ -76,6 +76,10 @@ export function formatStatus(status, version) {
|
|
|
76
76
|
lines.push('Context Tree: No changes');
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
|
+
case 'no_vc': {
|
|
80
|
+
lines.push('Context Tree: Managed by Byterover version control (use /vc commands)');
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
79
83
|
case 'not_initialized': {
|
|
80
84
|
lines.push('Context Tree: Not initialized');
|
|
81
85
|
break;
|
|
@@ -89,5 +93,6 @@ export function formatStatus(status, version) {
|
|
|
89
93
|
lines.push(chalk.yellow(`Pending Reviews: ${status.pendingReviewCount} ${fileLabel} need review`) +
|
|
90
94
|
(status.reviewUrl ? `\n Review: ${chalk.blue(status.reviewUrl)}` : ''));
|
|
91
95
|
}
|
|
96
|
+
lines.push('', 'Tip: Version control is now available for your context tree.', 'Learn more: https://docs.byterover.dev/git-semantic/overview');
|
|
92
97
|
return lines.join('\n');
|
|
93
98
|
}
|
|
@@ -9,20 +9,20 @@
|
|
|
9
9
|
const USER_FRIENDLY_MESSAGES = {
|
|
10
10
|
ERR_AGENT_NOT_INITIALIZED: "Agent failed to initialize. Run 'brv restart' to force a clean restart.",
|
|
11
11
|
ERR_CONTEXT_TREE_NOT_INIT: 'Context tree not initialized.',
|
|
12
|
+
ERR_LEGACY_SYNC_UNAVAILABLE: 'Legacy cloud sync (push/pull) is not available for this project. Use /vc init to start using version control. Learn more: https://docs.byterover.dev/git-semantic/overview',
|
|
12
13
|
ERR_LOCAL_CHANGES_EXIST: 'You have local changes. Run /push to save your changes before pulling.',
|
|
13
14
|
ERR_NOT_AUTHENTICATED: 'Not authenticated. This is required for cloud sync. Run /login to connect your account.',
|
|
14
15
|
ERR_OAUTH_REFRESH_FAILED: 'OAuth token refresh failed. Run /providers to reconnect your provider.',
|
|
15
16
|
ERR_OAUTH_TOKEN_EXPIRED: 'OAuth token has expired. Run /providers to reconnect your provider.',
|
|
16
17
|
ERR_PROJECT_NOT_INIT: "Project not initialized. Run 'brv restart' to reinitialize.",
|
|
17
18
|
ERR_PROVIDER_NOT_CONFIGURED: 'No provider connected. Run /providers connect byterover to use the free built-in provider, or connect another provider.',
|
|
18
|
-
ERR_SPACE_NOT_CONFIGURED: 'No space configured. Run /space switch to select a space first.',
|
|
19
19
|
ERR_SPACE_NOT_FOUND: 'Space not found. Check your configuration.',
|
|
20
20
|
ERR_VC_AUTH_FAILED: 'Authentication failed. Run /login.',
|
|
21
21
|
ERR_VC_BRANCH_ALREADY_EXISTS: 'Branch already exists.',
|
|
22
22
|
ERR_VC_CANNOT_DELETE_CURRENT_BRANCH: 'Cannot delete the currently checked-out branch.',
|
|
23
23
|
ERR_VC_CONFIG_KEY_NOT_SET: 'Config key is not set.',
|
|
24
24
|
ERR_VC_CONFLICT_MARKERS_PRESENT: 'Conflict markers detected. Run /vc conflicts to view them. Resolve conflicts and run /vc add before pushing.',
|
|
25
|
-
ERR_VC_GIT_INITIALIZED: 'ByteRover version control is active. Use /vc commands instead of legacy sync commands.',
|
|
25
|
+
ERR_VC_GIT_INITIALIZED: 'ByteRover version control is active. Use /vc commands instead of legacy sync commands. Learn more: https://docs.byterover.dev/git-semantic/overview',
|
|
26
26
|
ERR_VC_GIT_NOT_INITIALIZED: 'ByteRover version control not initialized. Run /vc init first.',
|
|
27
27
|
ERR_VC_INVALID_ACTION: 'Invalid action.',
|
|
28
28
|
// ERR_VC_INVALID_BRANCH_NAME intentionally omitted: fall through to server's message with actual branch name
|