builder.io 1.6.97 → 1.6.99
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.
- package/cli/index.cjs +484 -360
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +2 -2
- package/core/index.mjs +2 -2
- package/figma/index.cjs +1 -1
- package/figma/index.mjs +1 -1
- package/node/index.cjs +1 -1
- package/node/index.mjs +1 -1
- package/package.json +1 -1
- package/server/index.cjs +23 -23
- package/server/index.mjs +23 -23
- package/types/cli/codegen.d.ts +23 -14
- package/types/cli/launch/InitStateMachine.d.ts +47 -91
- package/types/cli/launch/server.d.ts +4 -1
- package/types/cli/utils/repo-indexing-group-prompts.d.ts +1 -1
- package/types/figma/index.d.ts +2 -0
- package/types/tsconfig.tsbuildinfo +1 -1
package/types/cli/codegen.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../types";
|
|
2
2
|
import { type Credentials } from "./credentials";
|
|
3
|
-
import type { CodegenFeedback, CodegenTurn, CommitMode, CustomInstruction, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext, WorkspaceConfiguration, WorkspaceFolder } from "$/ai-utils";
|
|
3
|
+
import type { CodegenFeedback, CodegenTurn, CommitMode, CustomInstruction, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext, WorkspaceConfiguration, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult } from "$/ai-utils";
|
|
4
4
|
import prettier from "prettier";
|
|
5
5
|
import { type FusionContext } from "./code-tools";
|
|
6
6
|
import EventEmitter from "node:events";
|
|
@@ -46,18 +46,8 @@ export declare class CodeGenSession {
|
|
|
46
46
|
constructor(options: CodeGenSessionOptions);
|
|
47
47
|
get workingDirectory(): string;
|
|
48
48
|
initializeSession(): Promise<void>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
getAll?: boolean;
|
|
52
|
-
}): Promise<{
|
|
53
|
-
sessionId: string;
|
|
54
|
-
title: string | undefined;
|
|
55
|
-
beforeCommit: string | undefined;
|
|
56
|
-
createdUnixTime: number;
|
|
57
|
-
updatedUnixTime: number;
|
|
58
|
-
addedTurns: number;
|
|
59
|
-
turns: CodegenTurn[];
|
|
60
|
-
}>;
|
|
49
|
+
loadHistory(): Promise<LoadHistoryResult>;
|
|
50
|
+
loadWholeSession(opts?: LoadWholeSessionOptions): Promise<LoadWholeSessionResult>;
|
|
61
51
|
loadMoreTurns(): Promise<CodegenTurn[]>;
|
|
62
52
|
setRepoUrl(repoUrl: string): void;
|
|
63
53
|
getRepoUrl(): string | undefined;
|
|
@@ -116,6 +106,15 @@ export declare class CodeGenSession {
|
|
|
116
106
|
}>;
|
|
117
107
|
hasChangesRelativeToRemote(): Promise<boolean>;
|
|
118
108
|
pullLatestFromRemote(): Promise<void>;
|
|
109
|
+
syncChangesFromMain(mainBranchName: string): Promise<{
|
|
110
|
+
success: boolean;
|
|
111
|
+
message: string;
|
|
112
|
+
conflicts?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
success: boolean;
|
|
115
|
+
conflicts: boolean;
|
|
116
|
+
message: string;
|
|
117
|
+
}>;
|
|
119
118
|
/**
|
|
120
119
|
* Get the current commit hash
|
|
121
120
|
*/
|
|
@@ -151,9 +150,19 @@ export declare class CodeGenSession {
|
|
|
151
150
|
* @param dryRun If true, only simulate the restoration without making changes
|
|
152
151
|
* @returns Array of file paths that were changed
|
|
153
152
|
*/
|
|
154
|
-
restore(location
|
|
153
|
+
restore({ location, predicate, dryRun, forceReplay, }: {
|
|
154
|
+
location: "before" | "after";
|
|
155
|
+
predicate: (turn: CodegenTurn | null, index: number) => boolean;
|
|
156
|
+
dryRun?: boolean;
|
|
157
|
+
forceReplay?: boolean;
|
|
158
|
+
}): Promise<string[] | null>;
|
|
155
159
|
restoreHEAD(): Promise<string[] | null>;
|
|
156
160
|
restoreAll(): Promise<string[] | null>;
|
|
161
|
+
restoreFromCompletionId({ location, completionId, forceReplay, }: {
|
|
162
|
+
location: "before" | "after";
|
|
163
|
+
completionId: string;
|
|
164
|
+
forceReplay?: boolean;
|
|
165
|
+
}): Promise<string[] | null>;
|
|
157
166
|
restoreBeforeCompletionId(completionId: string): Promise<string[] | null>;
|
|
158
167
|
/**
|
|
159
168
|
* Undo all changes back to the last user message
|
|
@@ -1,108 +1,64 @@
|
|
|
1
1
|
import type { DevToolsSys } from "@builder.io/dev-tools/core";
|
|
2
|
-
import {
|
|
3
|
-
import type { FusionConfig } from "$/ai-utils";
|
|
4
|
-
export declare enum InitState {
|
|
5
|
-
IDLE = "IDLE",
|
|
6
|
-
CHECKING_DIRECTORIES = "CHECKING_DIRECTORIES",
|
|
7
|
-
CONFIGURING_GIT_REPO = "CONFIGURING_GIT_REPO",
|
|
8
|
-
CONFIGURING_GIT_USER = "CONFIGURING_GIT_USER",
|
|
9
|
-
INSTALLING_DEPENDENCIES = "INSTALLING_DEPENDENCIES",
|
|
10
|
-
STASHING_CHANGES = "STASHING_CHANGES",
|
|
11
|
-
COMPLETED = "COMPLETED",
|
|
12
|
-
FAILED = "FAILED",
|
|
13
|
-
CANCELLED = "CANCELLED"
|
|
14
|
-
}
|
|
2
|
+
import type { FusionConfig, WorkspaceFolder } from "$/ai-utils";
|
|
15
3
|
export interface InitConfig {
|
|
16
4
|
fusionConfig: FusionConfig;
|
|
17
|
-
retryDelayMs?: number;
|
|
18
|
-
maxRetryDelayMs?: number;
|
|
19
5
|
sys: DevToolsSys;
|
|
20
6
|
debug?: boolean;
|
|
21
7
|
runSetupCommand: boolean;
|
|
22
8
|
}
|
|
23
|
-
export declare enum InitErrorType {
|
|
24
|
-
FATAL = "fatal",
|
|
25
|
-
SOFT_ERROR = "soft-error",
|
|
26
|
-
HARD_ERROR = "hard-error"
|
|
27
|
-
}
|
|
28
|
-
export interface InitError {
|
|
29
|
-
userMessage: string;
|
|
30
|
-
contextForLLMs?: string;
|
|
31
|
-
type: InitErrorType;
|
|
32
|
-
}
|
|
33
|
-
export interface InitExecutionResult {
|
|
34
|
-
success: boolean;
|
|
35
|
-
errors: InitError[];
|
|
36
|
-
}
|
|
37
9
|
export interface InitStatus {
|
|
38
|
-
state: InitState;
|
|
39
|
-
progress: number;
|
|
40
10
|
message: string;
|
|
41
11
|
error?: string;
|
|
42
|
-
metadata?: Record<string, any>;
|
|
43
12
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
error: (error: string, state: InitState) => void;
|
|
59
|
-
complete: (success: boolean, finalState: InitState) => void;
|
|
60
|
-
abort: (state: InitState) => void;
|
|
13
|
+
declare enum InitStateStep {
|
|
14
|
+
Init = "init",
|
|
15
|
+
Validation = "validation",
|
|
16
|
+
CheckDirectories = "check-directories",
|
|
17
|
+
CreateDirectories = "create-directories",
|
|
18
|
+
ConfigureGitRepos = "configure-git-repos",
|
|
19
|
+
CheckExistingGit = "check-existing-git",
|
|
20
|
+
UpdateRemoteUrl = "update-remote-url",
|
|
21
|
+
CloneRepo = "clone-repo",
|
|
22
|
+
ConfigureGitUser = "configure-git-user",
|
|
23
|
+
InstallDependencies = "install-dependencies",
|
|
24
|
+
StashChanges = "stash-changes",
|
|
25
|
+
InitSuccess = "init-success",
|
|
26
|
+
InitFailed = "init-failed"
|
|
61
27
|
}
|
|
62
|
-
export interface
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
28
|
+
export interface InitStatusLog {
|
|
29
|
+
id: number;
|
|
30
|
+
timestamp: string;
|
|
31
|
+
type: "status" | "log" | "error" | "complete";
|
|
32
|
+
message: string;
|
|
33
|
+
step?: InitStateStep;
|
|
34
|
+
error?: string;
|
|
35
|
+
success?: boolean;
|
|
66
36
|
}
|
|
67
|
-
export declare class InitStateMachine
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
private checkDirectories;
|
|
37
|
+
export declare class InitStateMachine {
|
|
38
|
+
logIdCounter: number;
|
|
39
|
+
initStatusLogs: InitStatusLog[];
|
|
40
|
+
initState: {
|
|
41
|
+
isRunning: boolean;
|
|
42
|
+
isComplete: boolean;
|
|
43
|
+
success: boolean;
|
|
44
|
+
currentStep: string;
|
|
45
|
+
error: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
init(config: InitConfig, signal?: AbortSignal): Promise<boolean>;
|
|
48
|
+
addInitLog(type: "status" | "log" | "error" | "complete", message: string, options?: {
|
|
49
|
+
step?: InitStateStep;
|
|
50
|
+
error?: string;
|
|
51
|
+
success?: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
clearInitLogs(): void;
|
|
54
|
+
step1CheckDirectories(config: InitConfig, repositories: Required<WorkspaceFolder>[], signal?: AbortSignal): Promise<void>;
|
|
55
|
+
step2ConfigureGitRepositories(config: InitConfig, repositories: Required<WorkspaceFolder>[], signal?: AbortSignal): Promise<void>;
|
|
56
|
+
step3ConfigureGitUser(config: InitConfig, repositories: Required<WorkspaceFolder>[], signal?: AbortSignal): Promise<void>;
|
|
57
|
+
step4InstallDependencies(config: InitConfig, signal?: AbortSignal): Promise<void>;
|
|
58
|
+
step5StashChanges(config: InitConfig, repositories: Required<WorkspaceFolder>[], signal?: AbortSignal): Promise<void>;
|
|
90
59
|
private isGitConfigured;
|
|
91
60
|
private getGitRemoteUrl;
|
|
92
61
|
private sanitizeGitRemoteUrl;
|
|
93
|
-
|
|
94
|
-
private configureGitRepos;
|
|
95
|
-
private configureGitUser;
|
|
96
|
-
private installDependencies;
|
|
97
|
-
private stashChanges;
|
|
98
|
-
execute(signal?: AbortSignal): Promise<InitExecutionResult>;
|
|
99
|
-
getCurrentState(): InitState;
|
|
100
|
-
getMetadata(): Record<string, any>;
|
|
101
|
-
getOperationLog(): OperationLogEntry[];
|
|
102
|
-
cleanup(): Promise<void>;
|
|
103
|
-
private startOperation;
|
|
104
|
-
private completeOperation;
|
|
105
|
-
private failOperation;
|
|
106
|
-
private abortOperation;
|
|
107
|
-
private getPerformanceStats;
|
|
62
|
+
cloneRepository(repo: Required<WorkspaceFolder>, repoPath: string, debug?: boolean, signal?: AbortSignal): Promise<boolean>;
|
|
108
63
|
}
|
|
64
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Express } from "express";
|
|
2
|
+
import type { InitStateMachine } from "./InitStateMachine";
|
|
2
3
|
export declare const BUILDER_ENDPOINT_PREFIX = "/_builder.io";
|
|
3
4
|
export declare const BUILDER_API_ENDPOINT_PREFIX: string;
|
|
4
5
|
/**
|
|
@@ -7,10 +8,12 @@ export declare const BUILDER_API_ENDPOINT_PREFIX: string;
|
|
|
7
8
|
export declare const NON_AUTHENTICATED_ENDPOINTS: {
|
|
8
9
|
readonly STATUS: "/status";
|
|
9
10
|
readonly PROXY_STATUS: "/proxy-status";
|
|
11
|
+
readonly STATUS_V2: "/status-v2";
|
|
10
12
|
};
|
|
11
|
-
export declare const configureServer: ({ app, validBuilderPrivateKey, authenticateProxy, isLocal, }: {
|
|
13
|
+
export declare const configureServer: ({ app, validBuilderPrivateKey, authenticateProxy, isLocal, initStateMachine, }: {
|
|
12
14
|
app: Express;
|
|
13
15
|
validBuilderPrivateKey: string | undefined;
|
|
14
16
|
authenticateProxy: boolean;
|
|
15
17
|
isLocal: boolean;
|
|
18
|
+
initStateMachine?: InitStateMachine;
|
|
16
19
|
}) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const REPO_INDEXING_GROUP_PROMPT
|
|
1
|
+
export declare const REPO_INDEXING_GROUP_PROMPT: string;
|
package/types/figma/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface FigmaNode {
|
|
|
6
6
|
$name: string;
|
|
7
7
|
$type: FigmaNodeType;
|
|
8
8
|
$inputs: readonly FigmaComponentInput[];
|
|
9
|
+
inputs: readonly FigmaComponentInput[];
|
|
9
10
|
$componentName?: string;
|
|
10
11
|
$rawNode: SceneNode;
|
|
11
12
|
/** Represents the text content of the node and its descendants */
|
|
@@ -38,6 +39,7 @@ export interface BaseFigmaProps {
|
|
|
38
39
|
$imageUrl: string;
|
|
39
40
|
/** Direct children of the root component node or instance */
|
|
40
41
|
$children: readonly FigmaNode[];
|
|
42
|
+
$getInputs: () => readonly FigmaComponentInput[];
|
|
41
43
|
/** Recursively finds the first figma child with the given name */
|
|
42
44
|
$findOneByName(name: string | RegExp): FigmaNode | undefined;
|
|
43
45
|
/** Recursively finds the first node that matches the callback */
|