@builder.io/dev-tools 1.19.14 → 1.20.1
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 +718 -714
- package/cli/index.cjs.map +4 -4
- package/core/index.cjs +1 -1
- package/core/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 +252 -252
- package/server/index.mjs +252 -252
- package/types/cli/launch/InitStateMachine.d.ts +6 -1
- package/types/cli/launch/server.d.ts +1 -0
- package/types/cli/launch/vscode-tunnel-manager.d.ts +108 -0
- package/types/cli/mcp-local.d.ts +23 -5
- package/types/cli/utils/env-substitution.d.ts +10 -1
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -28,7 +28,7 @@ export declare class InitStateMachine {
|
|
|
28
28
|
constructor(config: InitConfig);
|
|
29
29
|
checkout(branchName: string, ref: string, repoPath: string): Promise<boolean>;
|
|
30
30
|
execAsync(exec: string, args: string[], cwd?: string, retry?: number): Promise<string>;
|
|
31
|
-
git(args: string[], cwd
|
|
31
|
+
git(args: string[], cwd: string, retry?: number, timeout?: number): Promise<string>;
|
|
32
32
|
performBackup({ sys, credentials, fusionConfig, volumePath, repositories, isConnectedToProvider, forcedFullBackup, }: {
|
|
33
33
|
sys: DevToolsSys;
|
|
34
34
|
credentials: Credentials;
|
|
@@ -67,6 +67,11 @@ export declare class InitStateMachine {
|
|
|
67
67
|
private checkHostConnectivity;
|
|
68
68
|
private checkConnectivityDirect;
|
|
69
69
|
private checkConnectivityViaProxy;
|
|
70
|
+
/**
|
|
71
|
+
* Ensures the parent directory of the given path exists.
|
|
72
|
+
* Handles nested repo.path like "subdir/myproject".
|
|
73
|
+
*/
|
|
74
|
+
private ensureParentDirExists;
|
|
70
75
|
private cleanupLockFiles;
|
|
71
76
|
validateGitRepo(repoPath: string): Promise<void>;
|
|
72
77
|
/**
|
|
@@ -11,6 +11,7 @@ export declare const NON_AUTHENTICATED_ENDPOINTS: {
|
|
|
11
11
|
readonly PROXY_STATUS: "/proxy-status";
|
|
12
12
|
readonly STATUS_V2: "/status-v2";
|
|
13
13
|
readonly INIT_LOGS: "/init-logs";
|
|
14
|
+
readonly TUNNEL_STATUS: "/tunnel/status";
|
|
14
15
|
};
|
|
15
16
|
export declare const configureServer: ({ sys, app, validBuilderPrivateKey, authenticateProxy, isLocal, sharedState, }: {
|
|
16
17
|
sys: DevToolsSys;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { EventEmitter } from "events";
|
|
2
|
+
/**
|
|
3
|
+
* VS Code Tunnel status
|
|
4
|
+
*/
|
|
5
|
+
export type TunnelStatus = "stopped" | "starting" | "running" | "error";
|
|
6
|
+
/**
|
|
7
|
+
* VS Code Tunnel information
|
|
8
|
+
*/
|
|
9
|
+
export interface TunnelInfo {
|
|
10
|
+
status: TunnelStatus;
|
|
11
|
+
name: string | null;
|
|
12
|
+
url: string | null;
|
|
13
|
+
vscodeUri: string | null;
|
|
14
|
+
cursorUri: string | null;
|
|
15
|
+
webUrl: string | null;
|
|
16
|
+
error: string | null;
|
|
17
|
+
workspacePath: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for starting a VS Code tunnel
|
|
21
|
+
*/
|
|
22
|
+
export interface TunnelOptions {
|
|
23
|
+
name: string;
|
|
24
|
+
workspacePath?: string;
|
|
25
|
+
acceptLicense?: boolean;
|
|
26
|
+
autoRestart?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* VS Code Tunnel Manager
|
|
30
|
+
*
|
|
31
|
+
* Manages the lifecycle of a VS Code tunnel process, providing:
|
|
32
|
+
* - Start/stop functionality
|
|
33
|
+
* - URL parsing from CLI output
|
|
34
|
+
* - Health monitoring
|
|
35
|
+
* - Automatic restart on failure
|
|
36
|
+
* - Cleanup on shutdown
|
|
37
|
+
*/
|
|
38
|
+
export declare class VSCodeTunnelManager extends EventEmitter {
|
|
39
|
+
private process;
|
|
40
|
+
private status;
|
|
41
|
+
private tunnelName;
|
|
42
|
+
private tunnelUrl;
|
|
43
|
+
private error;
|
|
44
|
+
private workspacePath;
|
|
45
|
+
private autoRestart;
|
|
46
|
+
private restartAttempts;
|
|
47
|
+
private maxRestartAttempts;
|
|
48
|
+
private restartDelay;
|
|
49
|
+
private isShuttingDown;
|
|
50
|
+
constructor();
|
|
51
|
+
/**
|
|
52
|
+
* Start the VS Code tunnel
|
|
53
|
+
*/
|
|
54
|
+
start(options: TunnelOptions): Promise<TunnelInfo>;
|
|
55
|
+
/**
|
|
56
|
+
* Spawn the tunnel process
|
|
57
|
+
*/
|
|
58
|
+
private spawnTunnel;
|
|
59
|
+
/**
|
|
60
|
+
* Parse tunnel output to extract URL
|
|
61
|
+
*/
|
|
62
|
+
private parseOutput;
|
|
63
|
+
/**
|
|
64
|
+
* Stop the VS Code tunnel
|
|
65
|
+
*/
|
|
66
|
+
stop(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Get current tunnel information
|
|
69
|
+
*/
|
|
70
|
+
getInfo(): TunnelInfo;
|
|
71
|
+
/**
|
|
72
|
+
* Get tunnel status
|
|
73
|
+
*/
|
|
74
|
+
getStatus(): TunnelStatus;
|
|
75
|
+
/**
|
|
76
|
+
* Check if tunnel is enabled
|
|
77
|
+
* Enabled by default for cloud environments, can be disabled with VSCODE_TUNNEL_ENABLED=false
|
|
78
|
+
*/
|
|
79
|
+
static isEnabled(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Check if auto-start is enabled
|
|
82
|
+
*/
|
|
83
|
+
static isAutoStartEnabled(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Get the configured tunnel name from environment or generate one
|
|
86
|
+
*/
|
|
87
|
+
static getTunnelName(projectId?: string, branchName?: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Get the configured workspace path
|
|
90
|
+
*/
|
|
91
|
+
static getWorkspacePath(): string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get the singleton tunnel manager instance
|
|
95
|
+
*/
|
|
96
|
+
export declare function getTunnelManager(): VSCodeTunnelManager;
|
|
97
|
+
/**
|
|
98
|
+
* Generate VS Code deep link for a tunnel
|
|
99
|
+
*/
|
|
100
|
+
export declare function generateVSCodeDeepLink(tunnelName: string, workspacePath?: string): string;
|
|
101
|
+
/**
|
|
102
|
+
* Generate Cursor deep link for a tunnel
|
|
103
|
+
*/
|
|
104
|
+
export declare function generateCursorDeepLink(tunnelName: string, workspacePath?: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Generate web editor link for a tunnel
|
|
107
|
+
*/
|
|
108
|
+
export declare function generateWebEditorLink(tunnelName: string, workspacePath?: string): string;
|
package/types/cli/mcp-local.d.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
import type { ContentMessageItemImage, ContentMessageItemText, MCPClientStatus, MCPServerConfig } from "$/ai-utils";
|
|
12
12
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
13
13
|
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
14
|
+
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
15
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
14
16
|
import type { DevToolsSys } from "../core";
|
|
15
17
|
export interface MCPServerStdioDefinition {
|
|
16
18
|
name: string;
|
|
@@ -19,15 +21,25 @@ export interface MCPServerStdioDefinition {
|
|
|
19
21
|
env?: Record<string, string>;
|
|
20
22
|
envFile?: string;
|
|
21
23
|
}
|
|
24
|
+
export interface MCPServerRemoteDefinition {
|
|
25
|
+
name: string;
|
|
26
|
+
type: "http" | "sse";
|
|
27
|
+
url: string;
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
envFile?: string;
|
|
30
|
+
}
|
|
31
|
+
export type MCPServerDefinition = MCPServerStdioDefinition | MCPServerRemoteDefinition;
|
|
22
32
|
export interface MCPConfig {
|
|
23
|
-
mcpServers: Record<string, Omit<MCPServerStdioDefinition, "name">>;
|
|
33
|
+
mcpServers: Record<string, Omit<MCPServerStdioDefinition, "name"> | Omit<MCPServerRemoteDefinition, "name">>;
|
|
24
34
|
}
|
|
25
35
|
export interface LocalMCPClient {
|
|
26
36
|
client: Client | undefined;
|
|
27
|
-
transport: StdioClientTransport | undefined;
|
|
37
|
+
transport: StdioClientTransport | SSEClientTransport | StreamableHTTPClientTransport | undefined;
|
|
28
38
|
status: MCPClientStatus;
|
|
29
39
|
serverName: string;
|
|
30
|
-
|
|
40
|
+
serverType: "stdio" | "http" | "sse";
|
|
41
|
+
command?: string;
|
|
42
|
+
url?: string;
|
|
31
43
|
resources?: {
|
|
32
44
|
uri: string;
|
|
33
45
|
name?: string;
|
|
@@ -61,15 +73,21 @@ export interface LocalMCPClientManager {
|
|
|
61
73
|
/**
|
|
62
74
|
* Create a local MCP client manager from server definitions
|
|
63
75
|
*/
|
|
64
|
-
export declare function createLocalMCPClientManager(servers:
|
|
76
|
+
export declare function createLocalMCPClientManager(servers: MCPServerDefinition[], sys: DevToolsSys, workingDirectory: string, signal?: AbortSignal): Promise<LocalMCPClientManager>;
|
|
65
77
|
/**
|
|
66
78
|
* Apply environment variable substitution to MCP server configuration
|
|
67
79
|
* This is separated from loadMCPConfig to allow easy unit testing
|
|
68
80
|
*/
|
|
69
81
|
export declare function applyEnvSubstitution(serverConfig: Omit<MCPServerStdioDefinition, "name">, name: string, baseEnv: Record<string, string | undefined>, envFileVars: Record<string, string>): MCPServerStdioDefinition;
|
|
82
|
+
/**
|
|
83
|
+
* Apply environment variable substitution to remote MCP server configuration
|
|
84
|
+
* This is separated from loadMCPConfig to allow easy unit testing
|
|
85
|
+
*/
|
|
86
|
+
export declare function applyEnvSubstitutionRemote(serverConfig: Omit<MCPServerRemoteDefinition, "name">, name: string, baseEnv: Record<string, string | undefined>, envFileVars: Record<string, string>): MCPServerRemoteDefinition;
|
|
70
87
|
/**
|
|
71
88
|
* Discover and load MCP configuration from working directory and fusionConfig
|
|
72
89
|
* Servers from fusionConfig will be merged with servers from mcp.json
|
|
73
90
|
* If a server with the same name exists in both, fusionConfig takes precedence
|
|
91
|
+
* Supports both stdio (command-based) and remote (http/sse) server definitions
|
|
74
92
|
*/
|
|
75
|
-
export declare function loadMCPConfig(sys: DevToolsSys, workingDirectory: string, serverConfigs: MCPServerConfig, autoImportLocalMCPs: boolean): Promise<
|
|
93
|
+
export declare function loadMCPConfig(sys: DevToolsSys, workingDirectory: string, serverConfigs: MCPServerConfig, autoImportLocalMCPs: boolean): Promise<MCPServerDefinition[]>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Substitutes environment variables in a string.
|
|
3
3
|
* Replaces ${VAR_NAME} patterns with their corresponding values from the env object.
|
|
4
|
-
*
|
|
4
|
+
* Supports default values with ${VAR_NAME:-default} syntax.
|
|
5
|
+
* If a variable is not found in env and no default is provided, the pattern is left as-is.
|
|
5
6
|
*
|
|
6
7
|
* @param str - The string containing environment variable patterns
|
|
7
8
|
* @param env - A record of environment variable names to their values
|
|
@@ -18,5 +19,13 @@
|
|
|
18
19
|
* @example
|
|
19
20
|
* substituteEnvVars("Missing: ${UNKNOWN}", {})
|
|
20
21
|
* // Returns: "Missing: ${UNKNOWN}"
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* substituteEnvVars("URL: ${API_URL:-https://api.example.com}", {})
|
|
25
|
+
* // Returns: "URL: https://api.example.com"
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* substituteEnvVars("URL: ${API_URL:-https://api.example.com}", { API_URL: "https://custom.com" })
|
|
29
|
+
* // Returns: "URL: https://custom.com"
|
|
21
30
|
*/
|
|
22
31
|
export declare function substituteEnvVars(str: string, env: Record<string, string | undefined>): string;
|