byterover-cli 3.1.0 → 3.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 (158) hide show
  1. package/README.md +17 -0
  2. package/dist/agent/infra/agent/agent-schemas.d.ts +8 -0
  3. package/dist/agent/infra/agent/agent-schemas.js +1 -0
  4. package/dist/agent/infra/sandbox/curate-service.js +14 -0
  5. package/dist/agent/infra/sandbox/sandbox-service.js +1 -0
  6. package/dist/agent/infra/sandbox/tools-sdk.d.ts +10 -0
  7. package/dist/agent/infra/sandbox/tools-sdk.js +9 -1
  8. package/dist/agent/infra/tools/implementations/search-knowledge-service.js +226 -103
  9. package/dist/agent/infra/tools/implementations/write-file-tool.d.ts +2 -1
  10. package/dist/agent/infra/tools/implementations/write-file-tool.js +16 -2
  11. package/dist/agent/infra/tools/tool-registry.js +1 -1
  12. package/dist/agent/infra/tools/write-guard.d.ts +11 -0
  13. package/dist/agent/infra/tools/write-guard.js +48 -0
  14. package/dist/agent/resources/prompts/system-prompt.yml +9 -0
  15. package/dist/agent/resources/tools/expand_knowledge.txt +4 -0
  16. package/dist/agent/resources/tools/search_knowledge.txt +11 -1
  17. package/dist/oclif/commands/curate/index.d.ts +1 -0
  18. package/dist/oclif/commands/curate/index.js +19 -4
  19. package/dist/oclif/commands/curate/view.js +2 -2
  20. package/dist/oclif/commands/main.js +13 -0
  21. package/dist/oclif/commands/query.d.ts +1 -0
  22. package/dist/oclif/commands/query.js +19 -4
  23. package/dist/oclif/commands/search.d.ts +20 -0
  24. package/dist/oclif/commands/search.js +186 -0
  25. package/dist/oclif/commands/source/add.d.ts +12 -0
  26. package/dist/oclif/commands/source/add.js +42 -0
  27. package/dist/oclif/commands/source/index.d.ts +6 -0
  28. package/dist/oclif/commands/source/index.js +8 -0
  29. package/dist/oclif/commands/source/list.d.ts +6 -0
  30. package/dist/oclif/commands/source/list.js +32 -0
  31. package/dist/oclif/commands/source/remove.d.ts +9 -0
  32. package/dist/oclif/commands/source/remove.js +33 -0
  33. package/dist/oclif/commands/status.d.ts +5 -1
  34. package/dist/oclif/commands/status.js +45 -6
  35. package/dist/oclif/commands/worktree/add.d.ts +12 -0
  36. package/dist/oclif/commands/worktree/add.js +44 -0
  37. package/dist/oclif/commands/worktree/index.d.ts +6 -0
  38. package/dist/oclif/commands/worktree/index.js +8 -0
  39. package/dist/oclif/commands/worktree/list.d.ts +6 -0
  40. package/dist/oclif/commands/worktree/list.js +28 -0
  41. package/dist/oclif/commands/worktree/remove.d.ts +9 -0
  42. package/dist/oclif/commands/worktree/remove.js +35 -0
  43. package/dist/oclif/hooks/init/validate-brv-config.js +4 -0
  44. package/dist/oclif/lib/daemon-client.d.ts +4 -2
  45. package/dist/oclif/lib/daemon-client.js +19 -4
  46. package/dist/oclif/lib/search-format.d.ts +10 -0
  47. package/dist/oclif/lib/search-format.js +25 -0
  48. package/dist/oclif/lib/task-client.d.ts +6 -0
  49. package/dist/oclif/lib/task-client.js +10 -3
  50. package/dist/server/constants.d.ts +7 -1
  51. package/dist/server/constants.js +10 -0
  52. package/dist/server/core/domain/client/client-info.d.ts +7 -0
  53. package/dist/server/core/domain/client/client-info.js +11 -0
  54. package/dist/server/core/domain/errors/task-error.d.ts +2 -2
  55. package/dist/server/core/domain/errors/task-error.js +5 -4
  56. package/dist/server/core/domain/project/worktrees-schema.d.ts +29 -0
  57. package/dist/server/core/domain/project/worktrees-schema.js +17 -0
  58. package/dist/server/core/domain/source/source-operations.d.ts +31 -0
  59. package/dist/server/core/domain/source/source-operations.js +201 -0
  60. package/dist/server/core/domain/source/source-schema.d.ts +94 -0
  61. package/dist/server/core/domain/source/source-schema.js +121 -0
  62. package/dist/server/core/domain/transport/schemas.d.ts +18 -10
  63. package/dist/server/core/domain/transport/schemas.js +7 -3
  64. package/dist/server/core/domain/transport/task-info.d.ts +2 -0
  65. package/dist/server/core/interfaces/client/i-client-manager.d.ts +13 -0
  66. package/dist/server/core/interfaces/executor/i-curate-executor.d.ts +4 -0
  67. package/dist/server/core/interfaces/executor/i-folder-pack-executor.d.ts +7 -3
  68. package/dist/server/core/interfaces/executor/i-query-executor.d.ts +2 -0
  69. package/dist/server/core/interfaces/executor/i-search-executor.d.ts +34 -0
  70. package/dist/server/core/interfaces/executor/i-search-executor.js +1 -0
  71. package/dist/server/core/interfaces/executor/index.d.ts +1 -0
  72. package/dist/server/core/interfaces/executor/index.js +1 -0
  73. package/dist/server/infra/client/client-manager.d.ts +1 -0
  74. package/dist/server/infra/client/client-manager.js +16 -0
  75. package/dist/server/infra/daemon/agent-process.js +35 -12
  76. package/dist/server/infra/executor/curate-executor.js +4 -2
  77. package/dist/server/infra/executor/direct-search-responder.js +5 -1
  78. package/dist/server/infra/executor/folder-pack-executor.js +23 -12
  79. package/dist/server/infra/executor/query-executor.d.ts +23 -0
  80. package/dist/server/infra/executor/query-executor.js +115 -21
  81. package/dist/server/infra/executor/search-executor.d.ts +17 -0
  82. package/dist/server/infra/executor/search-executor.js +30 -0
  83. package/dist/server/infra/mcp/mcp-mode-detector.d.ts +7 -5
  84. package/dist/server/infra/mcp/mcp-mode-detector.js +11 -18
  85. package/dist/server/infra/mcp/mcp-server.d.ts +1 -0
  86. package/dist/server/infra/mcp/mcp-server.js +11 -6
  87. package/dist/server/infra/mcp/tools/brv-curate-tool.d.ts +2 -1
  88. package/dist/server/infra/mcp/tools/brv-curate-tool.js +9 -16
  89. package/dist/server/infra/mcp/tools/brv-query-tool.d.ts +2 -1
  90. package/dist/server/infra/mcp/tools/brv-query-tool.js +9 -16
  91. package/dist/server/infra/mcp/tools/mcp-project-context.d.ts +11 -0
  92. package/dist/server/infra/mcp/tools/mcp-project-context.js +54 -0
  93. package/dist/server/infra/process/connection-coordinator.js +11 -0
  94. package/dist/server/infra/process/feature-handlers.js +4 -1
  95. package/dist/server/infra/process/task-router.d.ts +1 -0
  96. package/dist/server/infra/process/task-router.js +60 -5
  97. package/dist/server/infra/project/resolve-project.d.ts +106 -0
  98. package/dist/server/infra/project/resolve-project.js +473 -0
  99. package/dist/server/infra/transport/handlers/index.d.ts +4 -0
  100. package/dist/server/infra/transport/handlers/index.js +2 -0
  101. package/dist/server/infra/transport/handlers/pull-handler.js +3 -3
  102. package/dist/server/infra/transport/handlers/push-handler.js +3 -3
  103. package/dist/server/infra/transport/handlers/source-handler.d.ts +12 -0
  104. package/dist/server/infra/transport/handlers/source-handler.js +37 -0
  105. package/dist/server/infra/transport/handlers/status-handler.js +76 -27
  106. package/dist/server/infra/transport/handlers/worktree-handler.d.ts +12 -0
  107. package/dist/server/infra/transport/handlers/worktree-handler.js +67 -0
  108. package/dist/server/infra/transport/transport-connector.d.ts +10 -4
  109. package/dist/server/infra/transport/transport-connector.js +2 -2
  110. package/dist/server/templates/skill/SKILL.md +25 -5
  111. package/dist/server/utils/path-utils.d.ts +5 -0
  112. package/dist/server/utils/path-utils.js +11 -1
  113. package/dist/shared/transport/events/client-events.d.ts +3 -0
  114. package/dist/shared/transport/events/client-events.js +3 -0
  115. package/dist/shared/transport/events/index.d.ts +13 -0
  116. package/dist/shared/transport/events/index.js +9 -0
  117. package/dist/shared/transport/events/source-events.d.ts +30 -0
  118. package/dist/shared/transport/events/source-events.js +5 -0
  119. package/dist/shared/transport/events/status-events.d.ts +5 -0
  120. package/dist/shared/transport/events/task-events.d.ts +4 -1
  121. package/dist/shared/transport/events/worktree-events.d.ts +31 -0
  122. package/dist/shared/transport/events/worktree-events.js +5 -0
  123. package/dist/shared/transport/search-content.d.ts +28 -0
  124. package/dist/shared/transport/search-content.js +38 -0
  125. package/dist/shared/transport/types/dto.d.ts +20 -1
  126. package/dist/tui/features/commands/definitions/index.js +6 -0
  127. package/dist/tui/features/commands/definitions/source-add.d.ts +2 -0
  128. package/dist/tui/features/commands/definitions/source-add.js +48 -0
  129. package/dist/tui/features/commands/definitions/source-list.d.ts +2 -0
  130. package/dist/tui/features/commands/definitions/source-list.js +47 -0
  131. package/dist/tui/features/commands/definitions/source-remove.d.ts +2 -0
  132. package/dist/tui/features/commands/definitions/source-remove.js +38 -0
  133. package/dist/tui/features/commands/definitions/source.d.ts +2 -0
  134. package/dist/tui/features/commands/definitions/source.js +8 -0
  135. package/dist/tui/features/commands/definitions/worktree-add.d.ts +2 -0
  136. package/dist/tui/features/commands/definitions/worktree-add.js +35 -0
  137. package/dist/tui/features/commands/definitions/worktree-list.d.ts +2 -0
  138. package/dist/tui/features/commands/definitions/worktree-list.js +36 -0
  139. package/dist/tui/features/commands/definitions/worktree-remove.d.ts +2 -0
  140. package/dist/tui/features/commands/definitions/worktree-remove.js +33 -0
  141. package/dist/tui/features/commands/definitions/worktree.d.ts +2 -0
  142. package/dist/tui/features/commands/definitions/worktree.js +8 -0
  143. package/dist/tui/features/curate/api/create-curate-task.js +3 -1
  144. package/dist/tui/features/query/api/create-query-task.js +3 -1
  145. package/dist/tui/features/source/api/source-api.d.ts +4 -0
  146. package/dist/tui/features/source/api/source-api.js +22 -0
  147. package/dist/tui/features/status/api/get-status.js +2 -1
  148. package/dist/tui/features/status/utils/format-status.js +28 -1
  149. package/dist/tui/features/transport/components/transport-initializer.js +36 -1
  150. package/dist/tui/features/worktree/api/worktree-api.d.ts +4 -0
  151. package/dist/tui/features/worktree/api/worktree-api.js +22 -0
  152. package/dist/tui/repl-startup.d.ts +2 -0
  153. package/dist/tui/repl-startup.js +5 -3
  154. package/dist/tui/stores/transport-store.d.ts +6 -0
  155. package/dist/tui/stores/transport-store.js +6 -0
  156. package/dist/tui/utils/error-messages.js +2 -2
  157. package/oclif.manifest.json +380 -36
  158. package/package.json +1 -1
@@ -154,6 +154,17 @@ export class ConnectionCoordinator {
154
154
  return { error: 'Client not registered', success: false };
155
155
  }
156
156
  if (client.hasProject) {
157
+ // Idempotent: same path → no-op
158
+ if (client.projectPath === data.projectPath) {
159
+ return { success: true };
160
+ }
161
+ // Reassociation: path changed (e.g. after worktree add/remove)
162
+ const oldPath = this.clientManager.updateProjectPath(clientId, data.projectPath);
163
+ transportLog(`Client ${clientId} reassociated: ${oldPath} → ${data.projectPath}`);
164
+ if (oldPath) {
165
+ this.removeFromProjectRoom(clientId, oldPath);
166
+ }
167
+ this.addToProjectRoom(clientId, data.projectPath);
157
168
  return { success: true };
158
169
  }
159
170
  this.clientManager.associateProject(clientId, data.projectPath);
@@ -36,7 +36,7 @@ import { FileReviewBackupStore } from '../storage/file-review-backup-store.js';
36
36
  import { createTokenStore } from '../storage/token-store.js';
37
37
  import { HttpTeamService } from '../team/http-team-service.js';
38
38
  import { FsTemplateLoader } from '../template/fs-template-loader.js';
39
- import { AuthHandler, ConfigHandler, ConnectorsHandler, HubHandler, InitHandler, LocationsHandler, ModelHandler, ProviderHandler, PullHandler, PushHandler, ResetHandler, ReviewHandler, SpaceHandler, StatusHandler, VcHandler, } from '../transport/handlers/index.js';
39
+ import { AuthHandler, ConfigHandler, ConnectorsHandler, HubHandler, InitHandler, LocationsHandler, ModelHandler, ProviderHandler, PullHandler, PushHandler, ResetHandler, ReviewHandler, SourceHandler, SpaceHandler, StatusHandler, VcHandler, WorktreeHandler, } from '../transport/handlers/index.js';
40
40
  import { HttpUserService } from '../user/http-user-service.js';
41
41
  import { FileVcGitConfigStore } from '../vc/file-vc-git-config-store.js';
42
42
  /**
@@ -211,5 +211,8 @@ export async function setupFeatureHandlers({ authStateStore, broadcastToProject,
211
211
  vcGitConfigStore: new FileVcGitConfigStore(),
212
212
  webAppUrl: envConfig.webAppUrl,
213
213
  }).setup();
214
+ // Worktree & source handlers
215
+ new WorktreeHandler({ resolveProjectPath, transport }).setup();
216
+ new SourceHandler({ resolveProjectPath, transport }).setup();
214
217
  log('Feature handlers registered');
215
218
  }
@@ -124,6 +124,7 @@ export declare class TaskRouter {
124
124
  */
125
125
  private notifyHooksError;
126
126
  private registerLlmEvent;
127
+ private resolveTaskContext;
127
128
  /**
128
129
  * Generic handler for routing LLM events from Agent to clients.
129
130
  * Checks both active and recently completed tasks (within grace period).
@@ -16,8 +16,10 @@
16
16
  */
17
17
  import { AgentNotAvailableError, serializeTaskError } from '../../core/domain/errors/task-error.js';
18
18
  import { LlmEventNames, TransportLlmEventList, TransportTaskEventNames } from '../../core/domain/transport/schemas.js';
19
+ import { isDescendantOf } from '../../utils/path-utils.js';
19
20
  import { transportLog } from '../../utils/process-logger.js';
20
21
  import { isValidTaskType } from '../../utils/type-guards.js';
22
+ import { resolveProject } from '../project/resolve-project.js';
21
23
  import { broadcastToProjectRoom } from './broadcast-utils.js';
22
24
  /**
23
25
  * Grace period (in ms) to keep completed tasks in memory for late-arriving events.
@@ -245,11 +247,27 @@ export class TaskRouter {
245
247
  broadcastToProjectRoom(this.projectRegistry, this.projectRouter, projectPath, TransportTaskEventNames.ERROR, { error, taskId }, clientId);
246
248
  return { taskId };
247
249
  }
248
- // ── Resolve projectPath & store task synchronously ────────────────────────
249
- // Resolve projectPath: explicit field > client's registered projectPath > clientCwd.
250
- // Client's registered projectPath is the walked-up project root (where .brv/ lives),
251
- // while clientCwd is the raw working directory (may be a subdirectory).
252
- const projectPath = data.projectPath ?? this.resolveClientProjectPath?.(clientId) ?? data.clientCwd;
250
+ // ── Resolve projectPath & worktreeRoot, store task synchronously ─────────
251
+ let projectPath;
252
+ let worktreeRoot;
253
+ try {
254
+ const taskContext = this.resolveTaskContext(data, clientId);
255
+ if (taskContext.error) {
256
+ const error = serializeTaskError(new Error(taskContext.error));
257
+ this.transport.sendTo(clientId, TransportTaskEventNames.ERROR, { error, taskId });
258
+ broadcastToProjectRoom(this.projectRegistry, this.projectRouter, taskContext.projectPath, TransportTaskEventNames.ERROR, { error, taskId }, clientId);
259
+ return { taskId };
260
+ }
261
+ projectPath = taskContext.projectPath;
262
+ worktreeRoot = taskContext.worktreeRoot;
263
+ }
264
+ catch (error_) {
265
+ const error = serializeTaskError(error_ instanceof Error ? error_ : new Error(String(error_)));
266
+ const fallbackProjectPath = data.projectPath ?? this.resolveClientProjectPath?.(clientId) ?? data.clientCwd;
267
+ this.transport.sendTo(clientId, TransportTaskEventNames.ERROR, { error, taskId });
268
+ broadcastToProjectRoom(this.projectRegistry, this.projectRouter, fallbackProjectPath, TransportTaskEventNames.ERROR, { error, taskId }, clientId);
269
+ return { taskId };
270
+ }
253
271
  transportLog(`Task accepted: ${taskId} (type=${data.type}, client=${clientId})`);
254
272
  this.tasks.set(taskId, {
255
273
  clientId,
@@ -261,6 +279,7 @@ export class TaskRouter {
261
279
  ...(projectPath ? { projectPath } : {}),
262
280
  taskId,
263
281
  type: data.type,
282
+ ...(worktreeRoot ? { worktreeRoot } : {}),
264
283
  });
265
284
  // ── Send task:created synchronously (before any await) ────────────────────
266
285
  const createdPayload = {
@@ -294,6 +313,7 @@ export class TaskRouter {
294
313
  ...(projectPath ? { projectPath } : {}),
295
314
  taskId,
296
315
  type: data.type,
316
+ ...(worktreeRoot ? { worktreeRoot } : {}),
297
317
  };
298
318
  // eslint-disable-next-line no-void
299
319
  void this.agentPool
@@ -467,6 +487,41 @@ export class TaskRouter {
467
487
  this.routeLlmEvent(eventName, data);
468
488
  });
469
489
  }
490
+ resolveTaskContext(data, clientId) {
491
+ // When both projectPath and worktreeRoot are explicitly provided,
492
+ // skip the resolver entirely — a broken link under clientCwd must not
493
+ // reject an otherwise valid explicit payload.
494
+ if (data.projectPath && data.worktreeRoot) {
495
+ if (!isDescendantOf(data.worktreeRoot, data.projectPath)) {
496
+ return {
497
+ error: `worktreeRoot "${data.worktreeRoot}" must be equal to or within projectPath "${data.projectPath}".`,
498
+ projectPath: data.projectPath,
499
+ };
500
+ }
501
+ return { projectPath: data.projectPath, worktreeRoot: data.worktreeRoot };
502
+ }
503
+ // Resolve from clientCwd (fresh, workspace-link-aware) when needed.
504
+ let resolvedProjectPath;
505
+ let resolvedWorkspaceRoot;
506
+ if (data.clientCwd) {
507
+ const resolution = resolveProject({ cwd: data.clientCwd });
508
+ resolvedProjectPath = resolution?.projectRoot;
509
+ resolvedWorkspaceRoot = resolution?.worktreeRoot;
510
+ }
511
+ // Fallback order: explicit > fresh cwd resolution > stale registration > raw clientCwd.
512
+ // Fresh resolution is preferred over registered path because the registered path
513
+ // may be stale (e.g. in-flight reassociation after worktree add/remove).
514
+ const registeredProjectPath = this.resolveClientProjectPath?.(clientId);
515
+ const projectPath = data.projectPath ?? resolvedProjectPath ?? registeredProjectPath ?? data.clientCwd;
516
+ const worktreeRoot = data.worktreeRoot ?? resolvedWorkspaceRoot ?? projectPath;
517
+ if (projectPath && worktreeRoot && !isDescendantOf(worktreeRoot, projectPath)) {
518
+ return {
519
+ error: `worktreeRoot "${worktreeRoot}" must be equal to or within projectPath "${projectPath}".`,
520
+ projectPath,
521
+ };
522
+ }
523
+ return { projectPath, worktreeRoot };
524
+ }
470
525
  /**
471
526
  * Generic handler for routing LLM events from Agent to clients.
472
527
  * Checks both active and recently completed tasks (within grace period).
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Result of canonical project resolution.
3
+ */
4
+ export interface ProjectResolution {
5
+ /** Directory containing .brv/config.json */
6
+ projectRoot: string;
7
+ /** How the project root was discovered */
8
+ source: 'direct' | 'flag' | 'linked';
9
+ /** Worktree root (equals projectRoot when direct, equals cwd when linked) */
10
+ worktreeRoot: string;
11
+ }
12
+ /**
13
+ * Error thrown when a .brv pointer file points to a project root that no longer has .brv/.
14
+ */
15
+ export declare class BrokenWorktreePointerError extends Error {
16
+ readonly pointerDir: string;
17
+ readonly targetProjectRoot: string;
18
+ constructor(pointerDir: string, targetProjectRoot: string);
19
+ }
20
+ /**
21
+ * Error thrown when a .brv file (pointer) exists but contains malformed/invalid content.
22
+ */
23
+ export declare class MalformedWorktreePointerError extends Error {
24
+ readonly pointerDir: string;
25
+ readonly reason: string;
26
+ constructor(pointerDir: string, reason: string);
27
+ }
28
+ export declare function hasBrvConfig(dir: string): boolean;
29
+ /**
30
+ * Checks if a directory is a git root (.git directory or .git file for worktrees/submodules).
31
+ */
32
+ export declare function isGitRoot(dir: string): boolean;
33
+ /**
34
+ * Checks if .brv in the given directory is a FILE (pointer), not a directory.
35
+ */
36
+ export declare function isWorktreePointer(dir: string): boolean;
37
+ /**
38
+ * Reads and validates a .brv pointer file.
39
+ * @throws MalformedWorktreePointerError if the file has invalid content
40
+ */
41
+ export declare function readWorktreePointer(dir: string): string;
42
+ export interface ResolveProjectOptions {
43
+ /** Override cwd (defaults to process.cwd()) */
44
+ cwd?: string;
45
+ /** Explicit --project-root flag value */
46
+ projectRootFlag?: string;
47
+ }
48
+ /**
49
+ * Canonical project resolver — single source of truth for discovering
50
+ * which .brv/ project a given working directory belongs to.
51
+ *
52
+ * Git-style resolution: walks up from cwd to find the nearest `.brv`
53
+ * (file or directory), just like git walks up to find `.git`.
54
+ *
55
+ * 1. --project-root flag
56
+ * 2. Walk up from cwd looking for .brv:
57
+ * a. .brv is a directory with config.json → source: 'direct'
58
+ * b. .brv is a file (pointer) → follow to parent → source: 'linked'
59
+ * 3. null (no .brv found at cwd or any ancestor)
60
+ *
61
+ * The walk-up stops at the **first** .brv found — it does NOT skip past
62
+ * a .brv to find a "better" one higher up. This prevents accidental
63
+ * inheritance from stale .brv/ directories in ancestor directories.
64
+ *
65
+ * @throws BrokenWorktreePointerError if .brv file points to a missing project
66
+ * @throws MalformedWorktreePointerError if .brv file has invalid content
67
+ */
68
+ export declare function resolveProject(options?: ResolveProjectOptions): null | ProjectResolution;
69
+ export interface AddWorktreeResult {
70
+ backedUp?: boolean;
71
+ message: string;
72
+ success: boolean;
73
+ }
74
+ /**
75
+ * Register a worktree: writes .brv pointer file in the target directory
76
+ * and creates a registry entry in the parent's .brv/worktrees/.
77
+ *
78
+ * If the target already has a .brv/ directory (e.g., auto-init'd), it is
79
+ * backed up to .brv-backup/ and replaced with a pointer file.
80
+ */
81
+ export declare function addWorktree(projectRoot: string, worktreePath: string, options?: {
82
+ force?: boolean;
83
+ }): AddWorktreeResult;
84
+ export interface RemoveWorktreeResult {
85
+ message: string;
86
+ success: boolean;
87
+ }
88
+ /**
89
+ * Remove a worktree: deletes the .brv pointer file and cleans up the registry entry.
90
+ * If a .brv-backup/ exists, restores it.
91
+ */
92
+ export declare function removeWorktree(worktreePath: string): RemoveWorktreeResult;
93
+ export interface WorktreeInfo {
94
+ name: string;
95
+ worktreePath: string;
96
+ }
97
+ /**
98
+ * List all registered worktrees for a project by scanning .brv/worktrees/ entries.
99
+ */
100
+ export declare function listWorktrees(projectRoot: string): WorktreeInfo[];
101
+ /**
102
+ * Walk up from startDir looking for the nearest directory with .brv/ DIRECTORY
103
+ * (not a .brv file). Used only by `brv worktree add` auto-detect mode.
104
+ * NOT used by the resolver.
105
+ */
106
+ export declare function findParentProject(startDir: string): string | undefined;