@builder.io/dev-tools 1.21.15 → 1.21.16

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.
@@ -1,6 +1,6 @@
1
1
  import type { DevToolsSys } from "../types";
2
2
  import { type Credentials } from "./credentials";
3
- import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, SessionMode, UserContext, UserSource, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, CodeGenMode, ApplyActionsResult, PrivacyMode, CodeGenPosition, BackupGitRepoResult, SuggestedActionBuildError, PushChangesArgs, CodegenApiResult, CodegenApiTerminal, ConfigureDevOrchestratorOpts, ConfigureDevOrchestratorUpdates, RepoMetrics, FolderWatchEvent, MCPServerConfig, CodegenApiCreateTerminal, SyncChangesFromRemote, SearchFilesOptions, SearchFilesResult, SearchFileTreeOptions, SearchFileTreeResult, ExplorationMetadataToolInput, CodegenAbortOptions, MessageUpdateOptions, SystemReminderObj } from "$/ai-utils";
3
+ import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, SessionMode, UserContext, UserSource, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, CodeGenMode, ApplyActionsResult, PrivacyMode, CodeGenPosition, BackupGitRepoResult, SuggestedActionBuildError, PushChangesArgs, CodegenApiResult, CodegenApiTerminal, ConfigureDevOrchestratorOpts, ConfigureDevOrchestratorUpdates, RepoMetrics, FolderWatchEvent, MCPServerConfig, CodegenApiCreateTerminal, SyncChangesFromRemote, SearchFilesOptions, SearchFilesResult, SearchFileTreeOptions, SearchFileTreeResult, ExplorationMetadataToolInput, CodegenAbortOptions, MessageUpdateOptions, GitRepoContext, SystemReminderObj } from "$/ai-utils";
4
4
  import { type FusionContext, type ToolResolution } from "./code-tools";
5
5
  import { type SubAgent } from "./utils/agent-discovery";
6
6
  import EventEmitter from "node:events";
@@ -12,6 +12,12 @@ export interface SyncChangesFromBranches {
12
12
  allowUnrelatedHistory: boolean;
13
13
  fastForward: "never" | "required" | "auto";
14
14
  requestRefresh?: boolean;
15
+ /**
16
+ * When true, compute the remote branch per-repo using #getRemoteBranch(ctx)
17
+ * instead of using the passed branches array. This handles multi-repo
18
+ * scenarios where each repo may have a different feature branch.
19
+ */
20
+ syncRemoteBranch?: boolean;
15
21
  }
16
22
  export interface SessionContext {
17
23
  sessionId: string;
@@ -77,7 +83,12 @@ export declare class CodeGenSession {
77
83
  #private;
78
84
  constructor(options: CodeGenSessionOptions);
79
85
  get fusionConfig(): FusionConfig | undefined;
86
+ /** Returns the first git-enabled folder for backwards compatibility */
80
87
  get gitEnabledFolder(): WorkspaceFolder | undefined;
88
+ /** Returns all git-enabled folders */
89
+ get gitEnabledFolders(): WorkspaceFolder[];
90
+ /** Returns runtime git repo contexts for all enabled repos */
91
+ get gitRepoContexts(): readonly GitRepoContext[];
81
92
  get workingDirectory(): string;
82
93
  getSessionMode(): SessionMode;
83
94
  switchSessionMode(newMode: SessionMode): Promise<void>;
@@ -117,8 +128,8 @@ export declare class CodeGenSession {
117
128
  /**
118
129
  * Get the current commit hash
119
130
  */
120
- getCurrentCommitHash(branchName?: string): Promise<string | undefined>;
121
- getCurrentBranch(): Promise<string>;
131
+ getCurrentCommitHash(branchName?: string, repoPath?: string): Promise<string | undefined>;
132
+ getCurrentBranch(repoPath?: string): Promise<string>;
122
133
  /**
123
134
  * Get the feature branch name
124
135
  */
@@ -127,7 +138,7 @@ export declare class CodeGenSession {
127
138
  * Get the AI branch name
128
139
  */
129
140
  getAiBranch(): string;
130
- git(args: string[], opts?: string | RunCommandOptions): Promise<string>;
141
+ git(args: string[], opts?: string | Partial<RunCommandOptions>): Promise<string>;
131
142
  setDebug(debug: boolean): void;
132
143
  createTerminal(options?: CodegenApiCreateTerminal): Promise<CodegenApiTerminal>;
133
144
  emitTerminals(): void;
@@ -177,6 +188,7 @@ export declare class CodeGenSession {
177
188
  searchFileTree(options: SearchFileTreeOptions): Promise<SearchFileTreeResult>;
178
189
  collectRepoMetrics(opts?: {
179
190
  rootPath?: string;
191
+ folderName?: string;
180
192
  }): Promise<RepoMetrics>;
181
193
  getSessionId(): string;
182
194
  getSpaceId(): string | undefined;
@@ -312,6 +324,7 @@ export declare class CodeGenSession {
312
324
  manualCommit(options: {
313
325
  add: string;
314
326
  commitMessage: string;
327
+ folderName?: string;
315
328
  }): Promise<boolean>;
316
329
  getLastSuggestedAction(): SuggestedActionBuildError | undefined;
317
330
  connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void): () => void;
@@ -319,12 +332,12 @@ export declare class CodeGenSession {
319
332
  waitUntilBlockingPendingPromises(signal?: AbortSignal): Promise<void>;
320
333
  waitUntilIdle(signal?: AbortSignal): Promise<void>;
321
334
  waitForEventLoop(): Promise<void>;
322
- commitWorkInProgress(lastTurn: CodegenTurn, changedFiles: string[]): Promise<string | false | undefined>;
335
+ commitWorkInProgress(lastTurn: CodegenTurn, changedFiles: string[]): Promise<string | false>;
323
336
  getChangesReport(): Promise<{
324
337
  diff: string;
325
338
  files: string[];
326
339
  } | undefined>;
327
- isCleanWorkTree(): Promise<boolean>;
340
+ isCleanWorkTree(repoPath?: string): Promise<boolean>;
328
341
  /**
329
342
  * Resolves a workspace file path to its actual file system path
330
343
  * @param filePath A file path that may include a workspace prefix (e.g., "workspace1/path/to/file.js")
@@ -368,23 +381,33 @@ export declare class CodeGenSession {
368
381
  * @param gitRef - The git reference (branch, commit, tag) - defaults to parent branch
369
382
  * @returns The file content at that reference, or null if not found
370
383
  */
371
- getFileAtRef(filePath: string, gitRef?: string): Promise<string | null>;
384
+ getFileAtRef(filePath: string, gitRef?: string, repoPathOverride?: string): Promise<string | null>;
372
385
  /**
373
386
  * Gets the diff information for a single file including full content
374
- * @param filePath - The file path to get diff for
387
+ * @param args - Either an options object or a file path string (legacy)
388
+ * @param opts.path - The file path, can be folder-prefixed (e.g., 'builder-anime-works/client/App.tsx') or relative
389
+ * @param opts.folderName - Optional folder name (deprecated, prefer folder-prefixed path)
375
390
  * @returns Object with oldContent (from parent branch) and newContent (current)
376
391
  */
377
- getSingleFileDiff(filePath: string): Promise<{
392
+ getSingleFileDiff(args: {
393
+ path: string;
394
+ folderName?: string;
395
+ } | string): Promise<{
378
396
  oldContent: string | null;
379
397
  newContent: string | null;
380
398
  action: "create" | "update" | "delete";
381
399
  }>;
382
400
  /**
383
401
  * Discards changes for a specific file by creating a revert commit
384
- * @param filePath - The file path to discard changes for
402
+ * @param args - Either an options object or a file path string (legacy)
403
+ * @param opts.filePath - The file path, can be folder-prefixed (e.g., 'builder-anime-works/client/App.tsx')
404
+ * @param opts.folderName - Optional folder name (deprecated, prefer folder-prefixed path)
385
405
  * @returns success status, commit hash for reverting, and optional error message
386
406
  */
387
- discardFileChanges(filePath: string): Promise<{
407
+ discardFileChanges(args: {
408
+ filePath: string;
409
+ folderName?: string;
410
+ } | string): Promise<{
388
411
  success: boolean;
389
412
  commitHash?: string;
390
413
  error?: string;
@@ -392,10 +415,12 @@ export declare class CodeGenSession {
392
415
  /**
393
416
  * Reverts a discard commit using git revert
394
417
  * @param commitHash - The commit hash to revert
418
+ * @param folderName - Optional folder name to target specific repo (more efficient)
395
419
  * @returns success status and optional error message
396
420
  */
397
421
  revertDiscard(options: {
398
422
  commitHash: string;
423
+ folderName?: string;
399
424
  }): Promise<{
400
425
  success: boolean;
401
426
  error?: string;
@@ -457,11 +482,13 @@ export declare class CodeGenSession {
457
482
  * @param numberOfContextLines - Optional number of context lines to include in the diff
458
483
  * @param includeFilesOnly - If true, only return filePath and action properties
459
484
  * @param filePaths - Optional array of file paths to limit the diff to specific files
485
+ * @param folderName - Optional folder name to specify which repo to get diff from
460
486
  */
461
- getDiffFromRemote({ numberOfContextLines, includeFilesOnly, filePaths, }: {
487
+ getDiffFromRemote({ numberOfContextLines, includeFilesOnly, filePaths, folderName, }: {
462
488
  numberOfContextLines?: number;
463
489
  includeFilesOnly?: boolean;
464
490
  filePaths?: Array<string>;
491
+ folderName?: string;
465
492
  }): Promise<ApplyActionsResult[]>;
466
493
  /**
467
494
  * Get git diff based on the specified mode
@@ -469,12 +496,14 @@ export declare class CodeGenSession {
469
496
  * @param numberOfContextLines - Optional number of context lines to include in the diff (e.g., 999 for -U999)
470
497
  * @param includeFilesOnly - If true, only return filePath and action properties
471
498
  * @param filePaths - Optional array of file paths to limit the diff to specific files
499
+ * @param folderName - Optional folder name to specify which repo to get diff from
472
500
  */
473
- getDiff({ mode, numberOfContextLines, includeFilesOnly, filePaths, }: {
501
+ getDiff({ mode, numberOfContextLines, includeFilesOnly, filePaths, folderName, }: {
474
502
  mode: "remote-parent-branch" | "remote-current-branch";
475
503
  numberOfContextLines?: number;
476
504
  includeFilesOnly?: boolean;
477
505
  filePaths?: Array<string>;
506
+ folderName?: string;
478
507
  }): Promise<{
479
508
  state: "error" | "success";
480
509
  diff?: ApplyActionsResult[];
@@ -483,6 +512,7 @@ export declare class CodeGenSession {
483
512
  /**
484
513
  * Get the default branch name from remote repository
485
514
  * Falls back to checking common default branch names
515
+ * @param repoPath - Optional repo path to check default branch for
486
516
  */
487
517
  private getDefaultBranch;
488
518
  /**
@@ -490,6 +520,7 @@ export declare class CodeGenSession {
490
520
  * @param numberOfContextLines - Optional number of context lines to include in the diff
491
521
  * @param includeFilesOnly - If true, only return filePath and action properties
492
522
  * @param filePaths - Optional array of file paths to limit the diff to specific files
523
+ * @param folderName - Optional folder name to specify which repo to get diff from
493
524
  */
494
525
  private getDiffFromParentBranch;
495
526
  }
@@ -1,7 +1,7 @@
1
1
  import type { DevToolsSys } from "../../core";
2
2
  import { type Credentials } from "../credentials";
3
3
  export { getCustomInstructions } from "./rules-discovery";
4
- import type { CodeGenInputOptions, CodegenSetLastCompletion, CodegenTurn, GenerateCodeEvent, GenerateUserMessage, GetSessionTurnsResult, UserContext, WorkspaceConfiguration, EnvironmentVariable, PushChangesArgs, GenerateCompletionStepDevServerState, FusionConfig, GenerateCompletionStepGit, WorkspaceFolder } from "$/ai-utils";
4
+ import type { CodeGenInputOptions, CodegenSetLastCompletion, CodegenTurn, GenerateCodeEvent, GenerateUserMessage, GetSessionTurnsResult, UserContext, WorkspaceConfiguration, WorkspaceFolder, EnvironmentVariable, PushChangesArgs, GenerateCompletionStepDevServerState, FusionConfig, GenerateCompletionStepGit } from "$/ai-utils";
5
5
  import type { SessionContext } from "../codegen";
6
6
  import type { DevServerOrchestrator } from "../launch/dev-server-orchestrator";
7
7
  export declare const DEFAULT_MAX_COMPLETIONS = 40;
@@ -80,7 +80,7 @@ export declare function moveArrayElement<T>(arr: T[], old_index: number, new_ind
80
80
  export declare function canCollapseWorkspace(workspace: WorkspaceConfiguration | undefined): boolean;
81
81
  export declare function computeRecommendedRootDir(workspace: WorkspaceConfiguration | undefined): string;
82
82
  export declare const getEnvironmentVariablesPrompt: (envs: EnvironmentVariable[]) => string;
83
- export declare function generateGitStatusReminder(gitStatus: GenerateCompletionStepGit, gitEnabledFolder: WorkspaceFolder | undefined, context: {
83
+ export declare function generateGitStatusReminder(gitStatus: GenerateCompletionStepGit, gitEnabledFolders: WorkspaceFolder[], context: {
84
84
  trigger: "session-start" | "sync-success" | "push-success" | "pull-success";
85
85
  syncedBranches?: string[];
86
86
  pushedToRemote?: boolean;