builder.io 1.6.81 → 1.6.83
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 +546 -529
- 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 +866 -267
- package/server/index.mjs +866 -267
- package/types/cli/code-tools.d.ts +5 -12
- package/types/cli/codegen.d.ts +8 -17
- package/types/cli/index.d.ts +2 -0
- package/types/cli/launch/InitStateMachine.d.ts +16 -1
- package/types/cli/launch/dev-server-orchestrator.d.ts +33 -0
- package/types/cli/launch/errors.d.ts +3 -0
- package/types/cli/launch/proxy.d.ts +3 -0
- package/types/cli/launch/server.d.ts +2 -1
- package/types/cli/launch.d.ts +7 -1
- package/types/cli/utils/component-group-mdx-prompt.d.ts +1 -1
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type { CodeGenTools, CommitMode, ContentMessageItemToolResult,
|
|
1
|
+
import type { CodeGenTools, CommitMode, ContentMessageItemToolResult, ProjectFile, WorkspaceFolder } from "$/ai-utils";
|
|
2
2
|
import type { DevToolsSys } from "../core";
|
|
3
|
-
import { type
|
|
4
|
-
import type {
|
|
5
|
-
import type EventEmitter from "events";
|
|
6
|
-
import type { Readable } from "stream";
|
|
3
|
+
import { type DevServerOrchestrator } from "./launch/dev-server-orchestrator";
|
|
4
|
+
import type { CodeGenEventEmitter } from "./codegen";
|
|
7
5
|
export interface LLMToolCalls {
|
|
8
6
|
name: CodeGenTools;
|
|
9
7
|
input: Record<string, any>;
|
|
@@ -15,9 +13,8 @@ export interface ToolResolution {
|
|
|
15
13
|
title?: string;
|
|
16
14
|
}
|
|
17
15
|
export interface FusionContext {
|
|
18
|
-
|
|
16
|
+
devServerOrchestrator?: DevServerOrchestrator;
|
|
19
17
|
checkCommand?: string;
|
|
20
|
-
serverUrl: string;
|
|
21
18
|
allowedCommands: RegExp[];
|
|
22
19
|
commitMode: CommitMode;
|
|
23
20
|
git: boolean;
|
|
@@ -28,10 +25,7 @@ export interface FusionContext {
|
|
|
28
25
|
export interface ToolContext extends Partial<FusionContext> {
|
|
29
26
|
sys: DevToolsSys;
|
|
30
27
|
files: ProjectFile[];
|
|
31
|
-
emitter:
|
|
32
|
-
step: [GenerateCompletionStep];
|
|
33
|
-
idle: [];
|
|
34
|
-
}>;
|
|
28
|
+
emitter: CodeGenEventEmitter;
|
|
35
29
|
signal: AbortSignal | undefined;
|
|
36
30
|
workingDirectory: string;
|
|
37
31
|
resolveWorkspacePath: (path: string, forceWorkspace: boolean) => {
|
|
@@ -63,5 +57,4 @@ interface RipgrepResult {
|
|
|
63
57
|
}
|
|
64
58
|
export declare function runRipgrep(sys: DevToolsSys, workingDirectory: string, pattern: string, includeGlob?: string, excludeGlob?: string): Promise<RipgrepResult>;
|
|
65
59
|
export declare function newAbortError(): Error;
|
|
66
|
-
export declare function killProcess(sys: DevToolsSys, proc: ChildProcessByStdio<null, Readable, Readable> | undefined, abortSignal?: AbortSignal, timeout?: number): Promise<boolean>;
|
|
67
60
|
export {};
|
package/types/cli/codegen.d.ts
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
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, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, UserContext, WorkspaceConfiguration, WorkspaceFolder } from "$/ai-utils";
|
|
4
4
|
import prettier from "prettier";
|
|
5
5
|
import { type FusionContext } from "./code-tools";
|
|
6
|
-
|
|
7
|
-
command: string;
|
|
8
|
-
state: "running" | "stopped";
|
|
9
|
-
ensureRunning: (abortSignal?: AbortSignal) => Promise<boolean>;
|
|
10
|
-
addCheckpoint: () => void;
|
|
11
|
-
getCheckpoints: (n: number, mode: "all" | "out" | "err") => string;
|
|
12
|
-
getAllStdout: () => string;
|
|
13
|
-
getAllStderr: () => string;
|
|
14
|
-
getOutput: () => string;
|
|
15
|
-
waitUntilIdle: (initialWaitMs?: number, idleTimeMs?: number) => Promise<void>;
|
|
16
|
-
pid: number | undefined;
|
|
17
|
-
onClose: (callback: (code: number | null) => void) => void;
|
|
18
|
-
onStdout: (callback: (data: string) => void) => void;
|
|
19
|
-
onStderr: (callback: (data: string) => void) => void;
|
|
20
|
-
restart: (abortSignal?: AbortSignal) => Promise<void>;
|
|
21
|
-
}
|
|
6
|
+
import EventEmitter from "node:events";
|
|
22
7
|
export interface SessionContext {
|
|
23
8
|
sessionId: string;
|
|
24
9
|
turns: CodegenTurn[];
|
|
@@ -42,6 +27,7 @@ export interface CodeGenSessionOptionsBase {
|
|
|
42
27
|
workingDirectory?: string;
|
|
43
28
|
workspace?: WorkspaceConfiguration;
|
|
44
29
|
mcpServers?: boolean;
|
|
30
|
+
enabledTools?: string;
|
|
45
31
|
}
|
|
46
32
|
export interface CodeGenSessionOptionsSession extends CodeGenSessionOptionsBase {
|
|
47
33
|
sessionOrCompletionId?: string;
|
|
@@ -50,6 +36,11 @@ export interface CodeGenSessionOptionsInitialUrl extends CodeGenSessionOptionsBa
|
|
|
50
36
|
initialUrl: string;
|
|
51
37
|
}
|
|
52
38
|
export type CodeGenSessionOptions = CodeGenSessionOptionsSession | CodeGenSessionOptionsInitialUrl;
|
|
39
|
+
export type CodeGenEventEmitter = EventEmitter<{
|
|
40
|
+
step: [GenerateCompletionStep];
|
|
41
|
+
idle: [];
|
|
42
|
+
fusionConfigPatch: [Partial<FusionConfig>];
|
|
43
|
+
}>;
|
|
53
44
|
export declare class CodeGenSession {
|
|
54
45
|
#private;
|
|
55
46
|
constructor(options: CodeGenSessionOptions);
|
package/types/cli/index.d.ts
CHANGED
|
@@ -57,4 +57,6 @@ export interface CLIArgs {
|
|
|
57
57
|
serverUrl?: string;
|
|
58
58
|
/** Remove all mappings from the space, publishing zero mappings even if mapper files exist */
|
|
59
59
|
clearMappings?: boolean;
|
|
60
|
+
/** Enabled tools, list of strings separated by commas */
|
|
61
|
+
enabledTools?: string;
|
|
60
62
|
}
|
|
@@ -19,6 +19,20 @@ export interface InitConfig {
|
|
|
19
19
|
sys: DevToolsSys;
|
|
20
20
|
debug?: boolean;
|
|
21
21
|
}
|
|
22
|
+
export declare enum InitErrorType {
|
|
23
|
+
FATAL = "fatal",
|
|
24
|
+
SOFT_ERROR = "soft-error",
|
|
25
|
+
HARD_ERROR = "hard-error"
|
|
26
|
+
}
|
|
27
|
+
export interface InitError {
|
|
28
|
+
userMessage: string;
|
|
29
|
+
contextForLLMs?: string;
|
|
30
|
+
type: InitErrorType;
|
|
31
|
+
}
|
|
32
|
+
export interface InitExecutionResult {
|
|
33
|
+
success: boolean;
|
|
34
|
+
errors: InitError[];
|
|
35
|
+
}
|
|
22
36
|
export interface InitStatus {
|
|
23
37
|
state: InitState;
|
|
24
38
|
progress: number;
|
|
@@ -62,6 +76,7 @@ export declare class InitStateMachine extends EventEmitter implements TypedEvent
|
|
|
62
76
|
private operationLog;
|
|
63
77
|
private operationCounter;
|
|
64
78
|
private readonly repositories;
|
|
79
|
+
private allInitErrors;
|
|
65
80
|
constructor(config: InitConfig);
|
|
66
81
|
private updateStatus;
|
|
67
82
|
private sanitizeError;
|
|
@@ -79,7 +94,7 @@ export declare class InitStateMachine extends EventEmitter implements TypedEvent
|
|
|
79
94
|
private configureGitUser;
|
|
80
95
|
private installDependencies;
|
|
81
96
|
private stashChanges;
|
|
82
|
-
execute(signal?: AbortSignal): Promise<
|
|
97
|
+
execute(signal?: AbortSignal): Promise<InitExecutionResult>;
|
|
83
98
|
getCurrentState(): InitState;
|
|
84
99
|
getMetadata(): Record<string, any>;
|
|
85
100
|
getOperationLog(): OperationLogEntry[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DevToolsSys } from "@builder.io/dev-tools/core";
|
|
2
|
+
import { type RequestHandler as ProxyRequestHandler } from "http-proxy-middleware";
|
|
3
|
+
import { type ChildProcessByStdio } from "node:child_process";
|
|
4
|
+
import type { Readable } from "node:stream";
|
|
5
|
+
import type { FusionConfig } from "$/ai-utils";
|
|
6
|
+
export type RunCommandState = "running" | "stopped" | "idle";
|
|
7
|
+
export interface DevServerOrchestrator {
|
|
8
|
+
command: string;
|
|
9
|
+
state: RunCommandState;
|
|
10
|
+
proxyTarget: string;
|
|
11
|
+
proxyPort: number;
|
|
12
|
+
proxyMiddleware: ProxyRequestHandler | undefined;
|
|
13
|
+
pid: number | undefined;
|
|
14
|
+
ensureRunning: (abortSignal?: AbortSignal) => Promise<boolean>;
|
|
15
|
+
setCommand: (newCommand: string, signal?: AbortSignal) => Promise<boolean>;
|
|
16
|
+
setPort: (newPort: number) => Promise<boolean>;
|
|
17
|
+
pingServer: (signal?: AbortSignal) => Promise<Response>;
|
|
18
|
+
addCheckpoint: () => void;
|
|
19
|
+
getOpenPorts: () => Promise<number[]>;
|
|
20
|
+
getCheckpoints: (n: number, mode: "all" | "out" | "err") => string;
|
|
21
|
+
getAllStdout: () => string;
|
|
22
|
+
getAllStderr: () => string;
|
|
23
|
+
getOutput: () => string;
|
|
24
|
+
waitUntilIdle: (initialWaitMs?: number, idleTimeMs?: number) => Promise<void>;
|
|
25
|
+
onClose: (callback: (code: number | null) => void) => void;
|
|
26
|
+
onStdout: (callback: (data: string) => void) => void;
|
|
27
|
+
onStderr: (callback: (data: string) => void) => void;
|
|
28
|
+
restart: (abortSignal?: AbortSignal) => Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare function devServerOrchestrator(sys: DevToolsSys, fusionConfig: FusionConfig): Promise<DevServerOrchestrator>;
|
|
31
|
+
export declare function createMockRunCommandCtx(): DevServerOrchestrator;
|
|
32
|
+
export declare const checkPortsListenedByPid: (pid: number) => number[];
|
|
33
|
+
export declare function killProcess(sys: DevToolsSys, proc: ChildProcessByStdio<null, Readable, Readable> | undefined, abortSignal?: AbortSignal, timeout?: number): Promise<boolean>;
|
|
@@ -8,8 +8,9 @@ export declare const NON_AUTHENTICATED_ENDPOINTS: {
|
|
|
8
8
|
readonly STATUS: "/status";
|
|
9
9
|
readonly PROXY_STATUS: "/proxy-status";
|
|
10
10
|
};
|
|
11
|
-
export declare const configureServer: ({ app, validBuilderPrivateKey, authenticateProxy, }: {
|
|
11
|
+
export declare const configureServer: ({ app, validBuilderPrivateKey, authenticateProxy, isLocal, }: {
|
|
12
12
|
app: Express;
|
|
13
13
|
validBuilderPrivateKey: string | undefined;
|
|
14
14
|
authenticateProxy: boolean;
|
|
15
|
+
isLocal: boolean;
|
|
15
16
|
}) => void;
|
package/types/cli/launch.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ export interface LaunchArgs extends CLIArgs {
|
|
|
23
23
|
dev?: boolean;
|
|
24
24
|
/** Skip browser auto-open (flag form) */
|
|
25
25
|
open?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If true, CLI will run the init command instead of the launch command.
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
fusionInit?: boolean;
|
|
26
32
|
/**
|
|
27
33
|
* If true, CLI will be interactive and prompt the user for input.
|
|
28
34
|
*
|
|
@@ -60,4 +66,4 @@ export interface LaunchArgs extends CLIArgs {
|
|
|
60
66
|
export declare function runFusionCommand({ sys, args, }: {
|
|
61
67
|
sys: DevToolsSys;
|
|
62
68
|
args: LaunchArgs;
|
|
63
|
-
}): Promise<
|
|
69
|
+
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const COMPONENT_GROUP_MDX_PROMPT = "# Component Group Documentation Generation\n\n## Objective\nGenerate comprehensive MDX documentation for a specific component group, analyzing their interfaces, relationships, and usage patterns using only the relevant files provided in the input.\n\n## Instructions\n\n### 1. Component Analysis\nFor the given component group, analyze each relevant file by:\n- **Interface examination** - Extract and document all props, their types, and descriptions\n- **Usage pattern analysis** - Identify how components work together\n- **Relationship mapping** - Document dependencies and coupling between components\n- **Example extraction** - Find real usage examples from the codebase\n\n### 2. Documentation Structure\nCreate comprehensive documentation covering:\n- **Group overview** - Purpose and architectural decisions\n- **Component interfaces** - Detailed prop documentation\n- **Usage examples** - Practical code examples\n- **Best practices** - Recommended usage patterns\n\n## Required Output Format\n\nGenerate an MDX file with this structure:\n\n```mdx\n---\
|
|
1
|
+
export declare const COMPONENT_GROUP_MDX_PROMPT = "# Component Group Documentation Generation\n\n## Objective\nGenerate comprehensive MDX documentation for a specific component group, analyzing their interfaces, relationships, and usage patterns using only the relevant files provided in the input.\n\n## Instructions\n\n### 1. Component Analysis\nFor the given component group, analyze each relevant file by:\n- **Interface examination** - Extract and document all props, their types, and descriptions\n- **Usage pattern analysis** - Identify how components work together\n- **Relationship mapping** - Document dependencies and coupling between components\n- **Example extraction** - Find real usage examples from the codebase\n\n### 2. Documentation Structure\nCreate comprehensive documentation covering:\n- **Group overview** - Purpose and architectural decisions\n- **Component interfaces** - Detailed prop documentation\n- **Usage examples** - Practical code examples\n- **Best practices** - Recommended usage patterns\n\n## Required Output Format\n\nGenerate an MDX file with this structure:\n\n```mdx\n---\n# {{GROUP_NAME}} Components\n\n## Overview\n[Detailed description of the component group, its purpose, and architectural decisions]\n\n## Components\n\n### [Component1Name]\n\n**Interface:**\n```typescript\ninterface [Component1]Props {\n // Document all props with types and descriptions\n property: string; // Description of what this prop does\n onAction?: () => void; // Optional callback description\n}\n```\n\n**Usage Example:**\n```tsx\nimport { [Component1] } from '@cloudscape-design/components';\n\nfunction Example() {\n return (\n <[Component1]\n property=\"value\"\n onAction={() => console.log('action')}\n >\n Content\n </[Component1]>\n );\n}\n```\n\n### [Component2Name]\n[Repeat structure for each component]\n\n## Component Relationships\n\n[Explain how components in this group work together, including:]\n- Shared contexts or state\n- Compositional patterns\n- Data flow between components\n- Common usage combinations\n\n## Best Practices\n\n- [Practice 1: Specific recommendation]\n- [Practice 2: Another recommendation]\n- [Practice 3: Usage pattern guidance]\n\n## Common Patterns\n\n### Pattern 1: [Pattern Name]\n```tsx\n// Example of common usage pattern\n<[ParentComponent]>\n <[ChildComponent1] />\n <[ChildComponent2] />\n</[ParentComponent]>\n```\n\n### Pattern 2: [Another Pattern]\n```tsx\n// Another common pattern\n```\n\n## Related Groups\n\n- [Link to related component groups]\n- [Cross-references to components used together]\n```\n\n## File Generation Requirements\n\n**File Naming:**\n- Use kebab-case derived from group name: `{{GROUP_NAME_KEBAB}}.mdx`\n- Place in `repo-indexing/` folder\n- Example: `repo-indexing/{{GROUP_NAME_KEBAB}}.mdx`\n\n**Content Requirements:**\n1. **Extract real interfaces** - Don't create placeholder interfaces, extract actual TypeScript interfaces from the codebase\n2. **Include practical examples** - Use realistic, working code examples\n3. **Document all props** - Include type information, default values, and descriptions\n4. **Explain relationships** - Focus on how components work together within the group\n5. **Provide context** - Explain architectural decisions and design patterns\n\n**Quality Standards:**\n- All code examples must be syntactically correct\n- Interface documentation must match actual component props\n- Examples should demonstrate real-world usage scenarios\n- Include accessibility considerations where relevant\n\n## Input Format\nYou will receive a single component group object:\n```json\n{\n \"name\": \"{{GROUP_NAME}}\", \n \"description\": \"{{GROUP_DESCRIPTION}}\",\n \"components\": [{{COMPONENT_LIST}}],\n \"relevantFiles\": [{{FILE_LIST}}]\n}\n```\n\n## Output\nReturn only the complete MDX file content, ready to be saved as `repo-indexing/{{GROUP_NAME_KEBAB}}.mdx`";
|