builder.io 1.9.8 → 1.9.11

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.
@@ -26,11 +26,34 @@ export interface BackupGitRepoResultInvalid {
26
26
  reason: "project_removed";
27
27
  }
28
28
  export type BackupGitRepoResult = BackupGitRepoResultValid | BackupGitRepoResultInvalid;
29
+ /**
30
+ * Creates a backup of git repository changes made by the AI system.
31
+ *
32
+ * This function handles both partial and full backups:
33
+ * - Partial backups: Only include commits created locally (on aiBranch) that aren't in upstream.
34
+ * This keeps backups small and doesn't store the entire repo's code. Requires a clone from
35
+ * upstream plus applying the backup to restore.
36
+ * - Full backups: Complete repo backup that can be directly cloned from.
37
+ *
38
+ * The aiBranch is where the AI creates commits as work progresses, while featureBranch
39
+ * is the base branch where work started (usually "main").
40
+ */
29
41
  export declare function backupGitRepo({ sys, credentials, projectId, branchName, repoPath, aiBranch, featureBranch, workspace, originalRepoUrl, debug, }: BackupGitRepoOptions): Promise<BackupGitRepoResult>;
30
42
  interface InitialCommitHashResult {
43
+ initialBranch: string;
31
44
  initialCommitHash: string;
32
45
  partial: boolean;
33
46
  }
47
+ /**
48
+ * Determines the initial commit hash and whether to create a partial or full backup.
49
+ *
50
+ * Partial backups are preferred to keep backup sizes small, but full backups are needed when:
51
+ * - The repo is an example/starter template (users can't push to origin, need to fork)
52
+ * - There's no origin remote configured
53
+ *
54
+ * For partial backups, we fetch the latest state of the feature branch from origin
55
+ * to ensure the backup has the correct commit range reference.
56
+ */
34
57
  export declare function getInitialCommitHash({ sys, repoPath, featureBranch, debug, workspace, }: {
35
58
  sys: DevToolsSys;
36
59
  repoPath: string;
@@ -60,19 +83,30 @@ export interface GitBackupDownloadResultInvalid {
60
83
  }
61
84
  export type GitBackupDownloadResult = GitBackupDownloadResultValid | GitBackupDownloadResultInvalid;
62
85
  /**
63
- * Downloads a git backup bundle
64
- * @returns The path to the downloaded bundle file, or null if no backup exists
86
+ * Downloads a git backup bundle from remote storage.
87
+ * Handles both empty backups (no bundle file) and regular backups with bundle files.
88
+ * @returns The path to the downloaded bundle file, or undefined if it's an empty backup
65
89
  */
66
90
  export declare function downloadGitBackup(sys: DevToolsSys, response: BackupMetadata): Promise<GitBackupDownloadResult>;
67
91
  /**
68
- * Uploads a file stream to a signed URL
92
+ * Uploads a file stream to a signed URL (Google Cloud Storage).
93
+ * Uses MD5 hash for content verification as required by GCS.
69
94
  */
70
95
  export declare function uploadFileStream(filePath: string, signedUrl: string, size: number, contentMd5: string): Promise<Response>;
71
96
  export declare function computeMD5Hash(bundlePath: string): Promise<{
72
97
  contentMd5: string;
73
98
  size: number;
74
99
  }>;
100
+ /**
101
+ * Updates the last commit hash in the database for tracking purposes.
102
+ * This is called frequently throughout the codebase (after every commit creation)
103
+ * to track the current state and determine if backups are up-to-date.
104
+ */
75
105
  export declare function setLastCommit(sys: DevToolsSys, credentials: Credentials, data: CodegenSetLastCommit, verbose: boolean): Promise<any>;
106
+ /**
107
+ * Computes a unique backup reference string that combines version, repo URL, and commit hash.
108
+ * This reference can be used to identify and retrieve specific backups.
109
+ */
76
110
  export declare function computeBackupRef(input: {
77
111
  version: string | undefined;
78
112
  originalRepoUrl: string | undefined;
@@ -77,7 +77,7 @@ export declare class CodeGenSession {
77
77
  needsBackup(): Promise<boolean>;
78
78
  uploadBackup(): Promise<import("./backup").BackupGitRepoResultValid | import("./backup").BackupGitRepoResultInvalid | {
79
79
  success: boolean;
80
- error: Error;
80
+ error: unknown;
81
81
  }>;
82
82
  getCommitMode(): CommitMode | undefined;
83
83
  setCommitMode(commitMode: CommitMode): void;
@@ -271,7 +271,11 @@ export declare class CodeGenSession {
271
271
  * @returns True if the delete was successful, false otherwise
272
272
  */
273
273
  deleteFile(filePath: string): Promise<boolean>;
274
- getNetLinesChanged(): number;
274
+ getLinesStats(): {
275
+ net: number;
276
+ added: number;
277
+ removed: number;
278
+ };
275
279
  /**
276
280
  * Get git diff between current commit and remote branch
277
281
  * If remote current branch doesn't exist, gets diff between default branch and current branch