@builder.io/dev-tools 1.6.40 → 1.6.41-dev.202505081902.3b00ea72

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.
File without changes
@@ -12,12 +12,13 @@ export interface ToolResolution {
12
12
  isError: boolean;
13
13
  title?: string;
14
14
  }
15
+ export type CommitMode = "commits" | "draft-prs" | "prs";
15
16
  export interface ProvidedToolContext {
16
17
  commandCtx?: RunCommandCtx;
17
18
  checkCommand?: string;
18
19
  localServerUrl?: string;
19
20
  allowedCommands?: RegExp[];
20
- commitMode?: "auto" | "manual";
21
+ commitMode?: CommitMode;
21
22
  }
22
23
  export interface ToolContext extends ProvidedToolContext {
23
24
  sys: DevToolsSys;
@@ -3,7 +3,7 @@ import type { CLIArgs } from "./index";
3
3
  import { type Credentials } from "./credentials";
4
4
  import type { CodegenTurn, CustomInstruction, GenerateCompletionState, GenerateCompletionStep, GenerateUserMessage, UserContext } from "$/ai-utils";
5
5
  import prettier from "prettier";
6
- import { type ProvidedToolContext } from "./code-tools";
6
+ import { type CommitMode, type ProvidedToolContext } from "./code-tools";
7
7
  export interface RunCommandCtx {
8
8
  command: string;
9
9
  state: "running" | "stopped";
@@ -59,6 +59,38 @@ export declare class CodeGenSession {
59
59
  constructor(options: CodeGenSessionOptions);
60
60
  get workingDirectory(): string;
61
61
  initializeSession(): Promise<void>;
62
+ setRepoUrl(repoUrl: string): void;
63
+ setPrUrl(prUrl: string): void;
64
+ pushRepo(repoFullName: string, githubToken: string): Promise<{
65
+ success: boolean;
66
+ error: string;
67
+ details?: undefined;
68
+ } | {
69
+ success: boolean;
70
+ error?: undefined;
71
+ details?: undefined;
72
+ } | {
73
+ success: boolean;
74
+ error: string;
75
+ details: string;
76
+ }>;
77
+ createPR(repoFullName: string, githubToken: string, branchName: string): Promise<{
78
+ success: boolean;
79
+ prUrl: any;
80
+ prNumber: any;
81
+ error?: undefined;
82
+ details?: undefined;
83
+ } | {
84
+ success: boolean;
85
+ error: string;
86
+ details: unknown;
87
+ prUrl?: undefined;
88
+ prNumber?: undefined;
89
+ }>;
90
+ setCommitMode(commitMode: CommitMode): void;
91
+ pushChanges(pullFirst?: boolean): Promise<void>;
92
+ hasChangesRelativeToRemote(): Promise<boolean>;
93
+ pullLatestFromRemote(): Promise<void>;
62
94
  /**
63
95
  * Get the current commit hash
64
96
  */
@@ -120,7 +152,7 @@ export declare class CodeGenSession {
120
152
  abort(): void;
121
153
  stopEventLoop(): Promise<void>;
122
154
  close(): Promise<void>;
123
- connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void): () => void;
155
+ connectToEventLoop(shouldReplay: boolean, onStep: (step: GenerateCompletionStep) => void): Promise<() => void>;
124
156
  waitForEventLoop(): Promise<void>;
125
157
  agentCompletion(userMessage: GenerateUserMessage, signal: AbortSignal | undefined, onStep: (step: GenerateCompletionStep) => void): Promise<void>;
126
158
  commitWorkInProgress(lastTurn: CodegenTurn): Promise<string | undefined>;
@@ -0,0 +1,86 @@
1
+ import { type SelectOptions, type ConfirmOptions, type TextOptions } from "@clack/prompts";
2
+ import { spinner } from "./spinner";
3
+ import type { WebSocket } from "ws";
4
+ export interface IOService {
5
+ log(str: string): void;
6
+ info(str: string): void;
7
+ warn(str: string): void;
8
+ error(str: string): void;
9
+ write(text: string): void;
10
+ writeMetadata(metadata: Record<string, any>): void;
11
+ confirm(options: ConfirmOptions): Promise<boolean | symbol>;
12
+ text(options: TextOptions): Promise<string | symbol>;
13
+ select<Value>(options: SelectOptions<Value>): Promise<Value | symbol>;
14
+ createSpinner(): ReturnType<typeof spinner>;
15
+ isInteractive(): boolean;
16
+ isTTY(): boolean;
17
+ exit(code: number): Promise<void>;
18
+ }
19
+ export declare class ConsoleIOService implements IOService {
20
+ log(str: string): void;
21
+ info(str: string): void;
22
+ warn(str: string): void;
23
+ error(str: string): void;
24
+ write(text: string): void;
25
+ writeMetadata(_: Record<string, any>): void;
26
+ confirm(options: ConfirmOptions): Promise<boolean | symbol>;
27
+ text(options: TextOptions): Promise<string | symbol>;
28
+ select<Value>(options: SelectOptions<Value>): Promise<Value | symbol>;
29
+ createSpinner(): ReturnType<typeof spinner>;
30
+ isInteractive(): boolean;
31
+ isTTY(): boolean;
32
+ exit(code: number): Promise<void>;
33
+ }
34
+ export interface BaseMessage {
35
+ type: string;
36
+ [key: string]: any;
37
+ }
38
+ export interface LogMessage extends BaseMessage {
39
+ type: "log";
40
+ level: "info" | "warn" | "error";
41
+ message: string;
42
+ }
43
+ export interface WriteMessage extends BaseMessage {
44
+ type: "write";
45
+ text: string;
46
+ }
47
+ export interface SpinnerMessage extends BaseMessage {
48
+ type: "spinner";
49
+ status: "start" | "stop";
50
+ message: string;
51
+ code?: number;
52
+ }
53
+ export interface PromptRequest extends BaseMessage {
54
+ type: "prompt";
55
+ promptType: "text" | "confirm" | "select";
56
+ options: any;
57
+ requestId: string;
58
+ }
59
+ export interface PromptResponse extends BaseMessage {
60
+ type: "prompt_response";
61
+ requestId: string;
62
+ value: any;
63
+ cancelled?: boolean;
64
+ }
65
+ export declare class WebSocketIOService implements IOService {
66
+ private ws;
67
+ private promptCallbacks;
68
+ private messageQueue;
69
+ private isProcessing;
70
+ constructor(ws: WebSocket);
71
+ private sendMessage;
72
+ private prompt;
73
+ log(...args: any[]): void;
74
+ info(...args: any[]): void;
75
+ warn(...args: any[]): void;
76
+ error(...args: any[]): void;
77
+ write(text: string): void;
78
+ writeMetadata(metadata: Record<string, any>): void;
79
+ confirm(options: ConfirmOptions): Promise<boolean | symbol>;
80
+ text(options: TextOptions): Promise<string | symbol>;
81
+ select<Value>(options: SelectOptions<Value>): Promise<Value | symbol>;
82
+ createSpinner(): ReturnType<typeof spinner>;
83
+ isInteractive(): boolean;
84
+ isTTY(): boolean;
85
+ exit(code: number): Promise<void>;
86
+ }
@@ -0,0 +1,20 @@
1
+ import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
+ import type { Credentials } from "cli/credentials";
3
+ import type { LaunchArgs } from "cli/launch";
4
+ export declare const getInitialDescription: (projectId: string) => string;
5
+ export declare function updatePRDescription({ repoFullName, githubToken, prNumber, projectId, sys, credentials, args, builderProjectBranchName, }: {
6
+ repoFullName: string;
7
+ githubToken: string;
8
+ prNumber: number;
9
+ projectId: string | undefined;
10
+ sys: DevToolsSys;
11
+ credentials: Credentials;
12
+ args: LaunchArgs;
13
+ builderProjectBranchName: string | undefined;
14
+ }): Promise<{
15
+ success: boolean;
16
+ lastTurn: any;
17
+ responseText: string;
18
+ generatedTitle: string;
19
+ generatedDescription: string;
20
+ }>;
@@ -70,4 +70,5 @@ export declare const getGitHubRemoteUrl: ({ repoFullName, githubToken, }: {
70
70
  repoFullName: string;
71
71
  githubToken: string | undefined;
72
72
  }) => string;
73
- export declare const getActiveBranch: () => string;
73
+ export declare const getActiveBranchCommand: () => string;
74
+ export declare const getActiveBranch: (cwd?: string) => string;
@@ -4,10 +4,6 @@ import type { CLIArgs } from "./index";
4
4
  * Large random-ish port number that is unlikely to be used
5
5
  */
6
6
  export declare const PROXY_PORT = 48752;
7
- /**
8
- * Maximum number of attempts to generate PR description
9
- */
10
- export declare const MAX_PR_CONTENT_ATTEMPTS = 2;
11
7
  export interface LaunchArgs extends CLIArgs {
12
8
  cwdAgent?: string;
13
9
  /** Fusion project ID */
@@ -17,7 +17,7 @@ export declare const NUMBER_TYPES: string[];
17
17
  export declare const BOOLEAN_TYPES: string[];
18
18
  export declare const ARRAY_TYPES: string[];
19
19
  export declare const OBJECT_TYPES: string[];
20
- export declare function getPrimitiveType(t: string): "number" | "string" | "boolean" | "object" | "array";
20
+ export declare function getPrimitiveType(t: string): "string" | "object" | "number" | "boolean" | "array";
21
21
  export declare function removeQuotes(text: string): string;
22
22
  export declare const resolveType: (sys: DevToolsSys, checker: ts.TypeChecker, type: ts.Type) => string[] | undefined;
23
23
  export declare const typeToString: (sys: DevToolsSys, checker: ts.TypeChecker, type: ts.Type) => string;
@@ -8,4 +8,4 @@ export declare function objectExpressionToObjectValue(sys: DevToolsSys, objectLi
8
8
  };
9
9
  export declare function convertArrayExpressionToJsArray(sys: DevToolsSys, arr: ts.ArrayLiteralExpression): any[];
10
10
  export declare function getTextOfPropertyName(sys: DevToolsSys, prop: ts.PropertyAssignment | ts.ObjectLiteralElementLike | undefined): string | undefined;
11
- export declare function valueToExpression(sys: DevToolsSys, val: any): ts.ObjectLiteralExpression | ts.Identifier | ts.StringLiteral | ts.NumericLiteral | ts.TrueLiteral | ts.FalseLiteral | ts.ArrayLiteralExpression;
11
+ export declare function valueToExpression(sys: DevToolsSys, val: any): ts.ObjectLiteralExpression | ts.Identifier | ts.StringLiteral | ts.NumericLiteral | ts.ArrayLiteralExpression | ts.TrueLiteral | ts.FalseLiteral;
@@ -0,0 +1,6 @@
1
+ import type { DevToolsSys } from "../..";
2
+ import type { EnsureConfigResult } from "../../../types";
3
+ /**
4
+ * Ensure the Remix Vite config has the necessary plugins and settings
5
+ */
6
+ export declare function ensureRemixConfig(sys: DevToolsSys, configFilePath: string, configContent: string): Promise<EnsureConfigResult>;
@@ -0,0 +1,10 @@
1
+ import type { DevToolsSys } from "../..";
2
+ import type ts from "typescript";
3
+ /**
4
+ * Check if the current project is using Remix framework
5
+ */
6
+ export declare function isRemixFramework(sys: DevToolsSys): boolean;
7
+ /**
8
+ * Update an object literal to include the external dependencies for Remix
9
+ */
10
+ export declare function updateCommonJsLibrary(sys: DevToolsSys, config: ts.ObjectLiteralExpression): ts.ObjectLiteralExpression | null;
@@ -0,0 +1,6 @@
1
+ import type { DevToolsSys } from "../..";
2
+ import type { EnsureConfigResult } from "../../../types";
3
+ /**
4
+ * Update a Vite config file to include a plugin
5
+ */
6
+ export declare function updateViteConfig(sys: DevToolsSys, configFilePath: string, configContent: string, pluginName: string, importPath: string): Promise<EnsureConfigResult>;