builder.io 1.6.49 → 1.6.51

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,18 +1,6 @@
1
1
  import type { DevToolsSys } from "../types";
2
2
  import type { Credentials } from "./credentials";
3
- import type { CLIArgs } from "cli";
4
- import type { SessionContext } from "./codegen";
5
- import type { CodebaseSearchOptions, CodebaseSearchResponse, RepoInfo } from "$/ai-utils";
6
- export interface GitRankingParams {
7
- sys: DevToolsSys;
8
- appRootDir: string;
9
- allFiles: string[];
10
- files: string[];
11
- hiddenFiles: string[];
12
- selectedFilePaths: Map<string, number>;
13
- promptRelevantFiles: string[];
14
- }
15
- export declare function processGitBasedRanking({ sys, appRootDir, allFiles, files, hiddenFiles, selectedFilePaths, promptRelevantFiles, }: GitRankingParams): Promise<void>;
3
+ import type { CodebaseSearchOptions, CodebaseSearchResponse } from "$/ai-utils";
16
4
  export declare function shouldIncludeFile(inputFile: string, ctx: {
17
5
  foundFiles: string[];
18
6
  allFiles: string[];
@@ -21,30 +9,4 @@ export declare function shouldIncludeFile(inputFile: string, ctx: {
21
9
  appRootDir: string;
22
10
  fallbackImportance: number | 0;
23
11
  }): number | 0;
24
- export interface GitFileInfo {
25
- filePath: string;
26
- lastModified: Date;
27
- frequency: number;
28
- commitIds: string[];
29
- relatedFiles: Set<string>;
30
- }
31
- export declare function getFileMetadata(sys: DevToolsSys, appRootDir: string, file: string): {
32
- tokens: number;
33
- content: string;
34
- };
35
- export declare function calculateMaxFileTokens(fileImportance: number, highImportanceCount: number): number;
36
- /**
37
- * Get recently modified files using git commands with commit relationship tracking
38
- */
39
- export declare function getGitModifiedFiles(sys: DevToolsSys, appRootDir: string, commitCount?: number): Promise<Map<string, GitFileInfo>>;
40
- /**
41
- * Update file relationships based on files modified in the same commit
42
- */
43
- export declare function updateFileRelationships(fileInfoMap: Map<string, GitFileInfo>, files: string[], commitId: string): void;
44
- /**
45
- * Calculate importance based on git history and relevant paths
46
- */
47
- export declare function calculateGitImportance(file: string, gitFiles: Map<string, GitFileInfo>, baseImportance: number, relevantPaths: string[]): number;
48
- export declare function shouldIncludeHiddenFile(sys: DevToolsSys, file: string): boolean;
49
- export declare function performSearch(sys: DevToolsSys, appRootDir: string, credentials: Credentials, args: CLIArgs, sessionContext: SessionContext, repoInfo: RepoInfo, files: string[], hiddenFiles: string[], userPrompt: string, allFiles: string[], packageJson: any, signal: AbortSignal | undefined): Promise<CodebaseSearchResponse | null>;
50
- export declare function searchCodeBase(sys: DevToolsSys, credentials: Credentials, args: CLIArgs, signal: AbortSignal | undefined, body: CodebaseSearchOptions): Promise<CodebaseSearchResponse | null>;
12
+ export declare function searchCodeBase(sys: DevToolsSys, credentials: Credentials, signal: AbortSignal | undefined, body: CodebaseSearchOptions): Promise<CodebaseSearchResponse | null>;
@@ -13,14 +13,18 @@ export interface ToolResolution {
13
13
  title?: string;
14
14
  }
15
15
  export type CommitMode = "commits" | "draft-prs" | "prs";
16
- export interface ProvidedToolContext {
16
+ export interface FusionContext {
17
17
  commandCtx?: RunCommandCtx;
18
18
  checkCommand?: string;
19
- localServerUrl?: string;
20
- allowedCommands?: RegExp[];
21
- commitMode?: CommitMode;
19
+ serverUrl: string;
20
+ allowedCommands: RegExp[];
21
+ commitMode: CommitMode;
22
+ git: boolean;
23
+ gitRemote?: string;
24
+ gitAutoInit?: boolean;
25
+ gitFeatureBranch?: string;
22
26
  }
23
- export interface ToolContext extends ProvidedToolContext {
27
+ export interface ToolContext extends Partial<FusionContext> {
24
28
  sys: DevToolsSys;
25
29
  files: ProjectFile[];
26
30
  emitter: EventEmitter<{
@@ -1,9 +1,8 @@
1
1
  import type { DevToolsSys } from "../types";
2
- import type { CLIArgs } from "./index";
3
2
  import { type Credentials } from "./credentials";
4
3
  import type { CodegenFeedback, CodegenTurn, CustomInstruction, GenerateCompletionState, GenerateCompletionStep, GenerateUserMessage, UserContext } from "$/ai-utils";
5
4
  import prettier from "prettier";
6
- import { type CommitMode, type ProvidedToolContext } from "./code-tools";
5
+ import { type CommitMode, type FusionContext } from "./code-tools";
7
6
  export interface RunCommandCtx {
8
7
  command: string;
9
8
  state: "running" | "stopped";
@@ -23,7 +22,6 @@ export interface RunCommandCtx {
23
22
  export interface SessionContext {
24
23
  sessionId: string;
25
24
  turns: CodegenTurn[];
26
- selectedFilePaths: Map<string, number>;
27
25
  customInstructions: CustomInstruction[];
28
26
  userContext: UserContext;
29
27
  prettierConfig: prettier.Config | null;
@@ -36,16 +34,11 @@ export interface SessionContext {
36
34
  export interface CodeGenSessionOptionsBase {
37
35
  sys: DevToolsSys;
38
36
  credentials: Credentials;
39
- args: CLIArgs;
40
37
  position: string;
41
38
  maxTokens?: number;
42
39
  mode?: "quality" | "quality-v3" | "fast";
43
- fusion?: boolean;
44
- fusionRemote?: string;
45
- fusionAutoInitGit?: boolean;
46
40
  builtInCustomInstructions?: CustomInstruction[];
47
- featureBranch?: string;
48
- providedToolContext?: ProvidedToolContext;
41
+ fusionContext?: FusionContext;
49
42
  workingDirectory?: string;
50
43
  }
51
44
  export interface CodeGenSessionOptionsSession extends CodeGenSessionOptionsBase {
@@ -66,16 +59,16 @@ export declare class CodeGenSession {
66
59
  success: boolean;
67
60
  error: string;
68
61
  details?: undefined;
69
- } | {
70
- success: boolean;
71
- error?: undefined;
72
- details?: undefined;
73
62
  } | {
74
63
  success: boolean;
75
64
  error: string;
76
65
  details: string;
66
+ } | {
67
+ success: boolean;
68
+ error?: undefined;
69
+ details?: undefined;
77
70
  }>;
78
- createPR(repoFullName: string, githubToken: string, branchName: string): Promise<{
71
+ createPR(repoFullName: string, githubToken: string, branchName: string, projectId: string): Promise<{
79
72
  success: boolean;
80
73
  prUrl: any;
81
74
  prNumber: any;
@@ -116,10 +109,6 @@ export declare class CodeGenSession {
116
109
  code: number;
117
110
  logs: string;
118
111
  } | null>;
119
- /**
120
- * Check if Fusion is enabled for this session
121
- */
122
- isFusionEnabled(): boolean;
123
112
  setDebug(debug: boolean): void;
124
113
  getAllFiles(): Promise<string[]>;
125
114
  isNextPage(): boolean;
@@ -148,10 +137,10 @@ export declare class CodeGenSession {
148
137
  getNextMessage(): Promise<GenerateUserMessage>;
149
138
  sendFeedback(feedback: Partial<CodegenFeedback>): Promise<void>;
150
139
  lastTurnHasChanges(): Promise<boolean>;
151
- sendMessage(message: GenerateUserMessage, immediate?: boolean): void;
140
+ sendMessage(message: GenerateUserMessage, immediate?: boolean): Promise<void>;
152
141
  getTurns(): CodegenTurn[];
153
142
  getSessionContext(): SessionContext;
154
- abort(): void;
143
+ abort(): Promise<boolean>;
155
144
  stopEventLoop(): Promise<void>;
156
145
  close(): Promise<void>;
157
146
  connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void): Promise<() => void>;
@@ -39,8 +39,6 @@ export interface CLIArgs {
39
39
  debug?: boolean;
40
40
  /** Raw command line arguments */
41
41
  _: string[];
42
- /** Auto-initialize a git repository if none exists (for Fusion) */
43
- fusionAutoInitGit?: boolean;
44
42
  /** Builder private key, used for authentication. */
45
43
  builderPrivateKey?: string;
46
44
  /** Builder public key, used for authentication. */
@@ -1,15 +1,13 @@
1
1
  import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
2
  import type { Credentials } from "cli/credentials";
3
- import type { LaunchArgs } from "cli/launch";
4
3
  export declare const getInitialDescription: (projectId: string) => string;
5
- export declare function updatePRDescription({ repoFullName, githubToken, prNumber, projectId, sys, credentials, args, builderProjectBranchName, }: {
4
+ export declare function updatePRDescription({ repoFullName, githubToken, prNumber, projectId, sys, credentials, builderProjectBranchName, }: {
6
5
  repoFullName: string;
7
6
  githubToken: string;
8
7
  prNumber: number;
9
8
  projectId: string | undefined;
10
9
  sys: DevToolsSys;
11
10
  credentials: Credentials;
12
- args: LaunchArgs;
13
11
  builderProjectBranchName: string | undefined;
14
12
  }): Promise<{
15
13
  success: boolean;
@@ -1,12 +1,13 @@
1
1
  import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
2
  import type { CLIArgs } from "./index";
3
+ import type { CommitMode } from "./code-tools";
3
4
  /**
4
5
  * Large random-ish port number that is unlikely to be used
5
6
  */
6
7
  export declare const PROXY_PORT = 48752;
7
8
  export interface LaunchArgs extends CLIArgs {
8
9
  cwdAgent?: string;
9
- /** Fusion project ID */
10
+ /** Project ID for the dev server. Only needed when running in a remote container. */
10
11
  projectId?: string;
11
12
  /** Silent mode for launch command */
12
13
  silent?: boolean;
@@ -22,6 +23,12 @@ export interface LaunchArgs extends CLIArgs {
22
23
  dev?: boolean;
23
24
  /** Skip browser auto-open (flag form) */
24
25
  open?: boolean;
26
+ /**
27
+ * If true, CLI will be interactive and prompt the user for input.
28
+ *
29
+ * @default true
30
+ */
31
+ interactive?: boolean;
25
32
  /**
26
33
  * Decides whether to skip authentication for the user's proxy server.
27
34
  * Our own _builder.io/ endpoitns are always authenticated.
@@ -36,7 +43,17 @@ export interface LaunchArgs extends CLIArgs {
36
43
  */
37
44
  dockerImageType?: "fusion-starter" | "node";
38
45
  }
39
- export declare function runLaunchCommand({ sys, args, }: {
46
+ export interface FusionConfig {
47
+ command: string;
48
+ projectId?: string;
49
+ checkCommand?: string;
50
+ workingDirectory: string;
51
+ authenticateProxy: boolean;
52
+ allowedCommands: string[];
53
+ commitMode: CommitMode;
54
+ serverUrl: string;
55
+ }
56
+ export declare function runFusionCommand({ sys, args, }: {
40
57
  sys: DevToolsSys;
41
58
  args: LaunchArgs;
42
59
  }): Promise<undefined>;
@@ -0,0 +1 @@
1
+ export declare function openBrowser(href: string): Promise<void>;