builder.io 1.17.27 → 1.17.29
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 +791 -639
- 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 +292 -286
- package/server/index.mjs +292 -286
- package/types/cli/code-tools.d.ts +4 -2
- package/types/cli/codegen.d.ts +43 -23
- package/types/cli/index.d.ts +32 -2
- package/types/cli/mcp-local.d.ts +2 -4
- package/types/cli/repo-connect/git-detector.d.ts +1 -1
- package/types/cli/repo-indexing/component-discovery.d.ts +3 -0
- package/types/cli/repo-indexing/component-indexing.d.ts +3 -0
- package/types/cli/repo-indexing/icons.d.ts +3 -0
- package/types/cli/repo-indexing/installation.d.ts +3 -0
- package/types/cli/repo-indexing/repo-indexing-utils.d.ts +56 -15
- package/types/cli/repo-indexing/repo-indexing-utils.test.d.ts +1 -0
- package/types/cli/repo-indexing/tokens.d.ts +6 -0
- package/types/cli/utils/agent-discovery.d.ts +22 -0
- package/types/cli/utils/agent-parser.d.ts +41 -0
- package/types/cli/utils/agent-parser.test.d.ts +1 -0
- package/types/cli/utils/browser-testing-agent.d.ts +2 -0
- package/types/cli/utils/codegen-utils.d.ts +70 -0
- package/types/cli/utils/rules-discovery.d.ts +26 -0
- package/types/cli/utils/rules-parser.d.ts +17 -0
- package/types/cli/utils/rules-parser.test.d.ts +1 -0
- package/types/cli/utils/yaml-frontmatter.d.ts +32 -0
- package/types/cli/utils/yaml-frontmatter.test.d.ts +1 -0
- package/types/tsconfig.tsbuildinfo +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { AccessResult, CodeGenPosition, CodeGenTools, CodegenTurn, ContentMessageItemToolResult, FusionConfig, GenerateCompletionStep, Permission, ProjectFile, UserSource, WorkspaceFolder } from "$/ai-utils";
|
|
1
|
+
import type { AccessResult, CodeGenPosition, CodeGenTools, CodegenTurn, ContentMessageItemImage, ContentMessageItemText, ContentMessageItemToolResult, FusionConfig, GenerateCompletionStep, Permission, ProjectFile, UserSource, WorkspaceFolder } from "$/ai-utils";
|
|
2
2
|
import type { DevToolsSys } from "../core";
|
|
3
3
|
import { type DevServerOrchestrator } from "./launch/dev-server-orchestrator";
|
|
4
4
|
import type { CodeGenEventEmitter } from "./codegen";
|
|
5
|
+
import { CodeGenSession } from "./codegen";
|
|
5
6
|
import type { Credentials } from "./credentials";
|
|
6
7
|
import type { LocalMCPClientManager } from "./mcp-local";
|
|
7
8
|
export interface LLMToolCalls {
|
|
@@ -11,7 +12,7 @@ export interface LLMToolCalls {
|
|
|
11
12
|
abortController: AbortController;
|
|
12
13
|
}
|
|
13
14
|
export interface ToolResolution {
|
|
14
|
-
toolResult: string;
|
|
15
|
+
toolResult: string | (ContentMessageItemText | ContentMessageItemImage)[];
|
|
15
16
|
isError: boolean;
|
|
16
17
|
title?: string;
|
|
17
18
|
}
|
|
@@ -34,6 +35,7 @@ export interface ToolContext extends Partial<FusionContext> {
|
|
|
34
35
|
workingDirectory: string;
|
|
35
36
|
allowedCommands: RegExp[];
|
|
36
37
|
localMCPManager: LocalMCPClientManager | undefined;
|
|
38
|
+
session: CodeGenSession;
|
|
37
39
|
getAllFiles: (options: {
|
|
38
40
|
getDotFiles?: boolean;
|
|
39
41
|
pattern?: string;
|
package/types/cli/codegen.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../types";
|
|
2
2
|
import { type Credentials } from "./credentials";
|
|
3
|
-
import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, SessionMode, UserContext,
|
|
3
|
+
import type { CodegenFeedback, CodeGenToolMap, CodegenTurn, CustomInstruction, FusionConfig, GenerateCompletionState, GenerateCompletionStep, GenerateCompletionStepGit, GenerateUserMessage, SessionMode, UserContext, UserSource, WorkspaceFolder, LoadWholeSessionOptions, LoadWholeSessionResult, LoadHistoryResult, CodeGenMode, ApplyActionsResult, PrivacyMode, CodeGenPosition, BackupGitRepoResult, PushChangesArgs, CodegenApiResult, CodegenApiTerminal, ConfigureDevOrchestratorOpts, ConfigureDevOrchestratorUpdates, RepoMetrics, SetImportantFilesToolInput, MCPServerConfig, CodegenApiCreateTerminal } from "$/ai-utils";
|
|
4
4
|
import prettier from "prettier";
|
|
5
5
|
import { type FusionContext, type ToolResolution } from "./code-tools";
|
|
6
|
+
import { type SubAgent } from "./utils/agent-discovery";
|
|
6
7
|
import EventEmitter from "node:events";
|
|
7
8
|
import { type RunCommandOptions } from "./utils/git";
|
|
8
9
|
export interface SessionContext {
|
|
9
10
|
sessionId: string;
|
|
10
11
|
turns: CodegenTurn[];
|
|
11
12
|
customInstructions: CustomInstruction[];
|
|
13
|
+
customAgents: SubAgent[];
|
|
12
14
|
userContext: UserContext;
|
|
13
15
|
prettierConfig: prettier.Config | null;
|
|
14
16
|
state: GenerateCompletionState;
|
|
@@ -27,6 +29,10 @@ export interface CodeGenSessionOptionsBase {
|
|
|
27
29
|
mode: CodeGenMode;
|
|
28
30
|
privacyMode?: PrivacyMode;
|
|
29
31
|
builtInCustomInstructions?: CustomInstruction[];
|
|
32
|
+
builtInCustomAgents?: SubAgent[];
|
|
33
|
+
builtInMCPServerConfig?: MCPServerConfig;
|
|
34
|
+
autoImportLocalMCPs?: boolean;
|
|
35
|
+
systemPromptOverride?: string;
|
|
30
36
|
fusionContext?: FusionContext;
|
|
31
37
|
fusionConfig?: FusionConfig;
|
|
32
38
|
workingDirectory?: string;
|
|
@@ -41,6 +47,15 @@ export interface CodeGenSessionOptionsInitialUrl extends CodeGenSessionOptionsBa
|
|
|
41
47
|
initialUrl: string;
|
|
42
48
|
}
|
|
43
49
|
export type CodeGenSessionOptions = CodeGenSessionOptionsSession | CodeGenSessionOptionsInitialUrl;
|
|
50
|
+
export interface SpawnAgentResult {
|
|
51
|
+
success: boolean;
|
|
52
|
+
response: string;
|
|
53
|
+
importantFiles: SetImportantFilesToolInput;
|
|
54
|
+
lastTurn?: CodegenTurn;
|
|
55
|
+
}
|
|
56
|
+
export { type SubAgent } from "./utils/agent-discovery";
|
|
57
|
+
export { resolveModelShortcut } from "./utils/agent-parser";
|
|
58
|
+
export { getCustomAgents } from "./utils/agent-discovery";
|
|
44
59
|
export type CodeGenEventEmitter = EventEmitter<{
|
|
45
60
|
step: [GenerateCompletionStep];
|
|
46
61
|
idle: [];
|
|
@@ -61,6 +76,21 @@ export declare class CodeGenSession {
|
|
|
61
76
|
loadWholeSession(opts?: LoadWholeSessionOptions): Promise<LoadWholeSessionResult>;
|
|
62
77
|
loadMoreTurns(): Promise<CodegenTurn[]>;
|
|
63
78
|
setCustomInstructions(instructions: CustomInstruction[]): Promise<void>;
|
|
79
|
+
setCustomAgents(agents: SubAgent[]): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Spawn a named custom agent by ID or name
|
|
82
|
+
* @param agentNameOrId - The agent's name or ID
|
|
83
|
+
* @param options - Additional spawning options
|
|
84
|
+
* @returns SpawnAgentResult
|
|
85
|
+
*/
|
|
86
|
+
spawnNamedAgent(agentName: string | undefined, options: {
|
|
87
|
+
prompt: string;
|
|
88
|
+
user: UserSource;
|
|
89
|
+
onStep?: (step: GenerateCompletionStep) => void;
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
maxCompletions?: number;
|
|
92
|
+
sessionId?: string;
|
|
93
|
+
}): Promise<SpawnAgentResult>;
|
|
64
94
|
pushRepoV2(repoInfo: {
|
|
65
95
|
repoFullName: string;
|
|
66
96
|
repoUrl: string;
|
|
@@ -198,6 +228,18 @@ export declare class CodeGenSession {
|
|
|
198
228
|
waitUntilState(state: GenerateCompletionState, timeout?: number): Promise<void>;
|
|
199
229
|
clearSession(): Promise<void>;
|
|
200
230
|
sendMessage(message: GenerateUserMessage): Promise<void>;
|
|
231
|
+
spawnAgent(options: {
|
|
232
|
+
prompt: string;
|
|
233
|
+
user: UserSource;
|
|
234
|
+
onStep?: (step: GenerateCompletionStep) => void;
|
|
235
|
+
signal?: AbortSignal;
|
|
236
|
+
maxCompletions?: number;
|
|
237
|
+
sessionId?: string;
|
|
238
|
+
tools?: string[];
|
|
239
|
+
model?: string;
|
|
240
|
+
mode?: CodeGenMode;
|
|
241
|
+
systemPrompt?: string;
|
|
242
|
+
}): Promise<SpawnAgentResult>;
|
|
201
243
|
getTurns(): CodegenTurn[];
|
|
202
244
|
getSessionContext(): SessionContext;
|
|
203
245
|
runSetupCommand(): Promise<import("$/ai-utils").SetupCommandResult | undefined>;
|
|
@@ -363,25 +405,3 @@ export declare class CodeGenSession {
|
|
|
363
405
|
*/
|
|
364
406
|
private getDiffFromParentBranch;
|
|
365
407
|
}
|
|
366
|
-
export declare function getUserContext(sys: DevToolsSys, gitWorkingDirectory?: string): Promise<UserContext>;
|
|
367
|
-
export declare function makeAsyncIterator<T>(): readonly [AsyncGenerator<T, void, void>, (event: T) => void, () => void];
|
|
368
|
-
/**
|
|
369
|
-
* Loads a workspace configuration from a JSON file
|
|
370
|
-
* @param sys DevToolsSys instance
|
|
371
|
-
* @param workspaceFile Path to the workspace JSON file
|
|
372
|
-
* @returns The workspace configuration and working directory
|
|
373
|
-
*/
|
|
374
|
-
export declare function loadWorkspace(sys: DevToolsSys, workspaceFile: string): Promise<{
|
|
375
|
-
workspace: WorkspaceConfiguration;
|
|
376
|
-
workingDirectory: string;
|
|
377
|
-
}>;
|
|
378
|
-
export declare function keepAlive(): () => void;
|
|
379
|
-
export declare class BashError extends Error {
|
|
380
|
-
readonly code: number | string | undefined;
|
|
381
|
-
readonly stdout: string;
|
|
382
|
-
readonly stderr: string;
|
|
383
|
-
readonly command: string;
|
|
384
|
-
constructor(command: string, code: number | string | undefined, stdout: string, stderr: string, opts?: {
|
|
385
|
-
cause?: Error;
|
|
386
|
-
});
|
|
387
|
-
}
|
package/types/cli/index.d.ts
CHANGED
|
@@ -37,9 +37,9 @@ export interface CLIArgs {
|
|
|
37
37
|
* where the design system name is different than the npm package name.
|
|
38
38
|
* Example: --designSystemPackage=@adobe/react-spectrum --designSystemName="Adobe React Spectrum"
|
|
39
39
|
*
|
|
40
|
-
* This flag can also be used with
|
|
40
|
+
* This flag can also be used with addDirectory to specify a name for design systems
|
|
41
41
|
* that are not npm packages.
|
|
42
|
-
* Example: --
|
|
42
|
+
* Example: --addDirectory "path/to/swift/ui/components" --designSystemName="Native UI"
|
|
43
43
|
**/
|
|
44
44
|
designSystemName?: string;
|
|
45
45
|
/**
|
|
@@ -47,8 +47,19 @@ export interface CLIArgs {
|
|
|
47
47
|
* Use this when component implementations live in a different place
|
|
48
48
|
* than the workspace package you are indexing.
|
|
49
49
|
* Example: --includeDirectories "packages/foo, packages/bar"
|
|
50
|
+
*
|
|
51
|
+
* @deprecated Use addDirectory instead
|
|
50
52
|
**/
|
|
51
53
|
includeDirectories?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Additional directories to look in for repo indexing.
|
|
56
|
+
* Use this when component implementations live in a different place
|
|
57
|
+
* than the workspace package you are indexing.
|
|
58
|
+
*
|
|
59
|
+
* @alias add
|
|
60
|
+
* Example: --addDirectory "../docs" --addDirectory "../../bar"
|
|
61
|
+
*/
|
|
62
|
+
addDirectory?: string | string[];
|
|
52
63
|
/** The scope of the design system to index */
|
|
53
64
|
scope?: DesignSystemScope;
|
|
54
65
|
/** Token to use for figma */
|
|
@@ -102,4 +113,23 @@ export interface CLIArgs {
|
|
|
102
113
|
app?: boolean;
|
|
103
114
|
/** Skip browser auto-open (flag form) */
|
|
104
115
|
open?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Glob pattern(s) to include for repo indexing access control.
|
|
118
|
+
* When specified, only these patterns will be accessible by default.
|
|
119
|
+
* Can be a single string or array of strings (when flag is repeated).
|
|
120
|
+
* Example: --include "src/components/*.tsx" --include "src/lib/*.ts"
|
|
121
|
+
*/
|
|
122
|
+
include?: string | string[];
|
|
123
|
+
/**
|
|
124
|
+
* Glob pattern(s) to exclude for repo indexing access control.
|
|
125
|
+
* These patterns will be denied access even if included.
|
|
126
|
+
* Can be a single string or array of strings (when flag is repeated).
|
|
127
|
+
* Example: --exclude "*.test.ts" --exclude "__tests__/**"
|
|
128
|
+
*/
|
|
129
|
+
exclude?: string | string[];
|
|
130
|
+
/**
|
|
131
|
+
* Extra instructions to be taken into account during repo indexing.
|
|
132
|
+
* Example: --instructions "Do not index mapper files."
|
|
133
|
+
*/
|
|
134
|
+
instructions?: string;
|
|
105
135
|
}
|
package/types/cli/mcp-local.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Tools are prefixed with server name: `mcp__servername__toolname`
|
|
9
9
|
* - This prevents conflicts with built-in tools and other MCP tools
|
|
10
10
|
*/
|
|
11
|
-
import type { MCPClientStatus } from "$/ai-utils";
|
|
11
|
+
import type { MCPClientStatus, MCPServerConfig } from "$/ai-utils";
|
|
12
12
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
13
13
|
import type { DevToolsSys } from "../core";
|
|
14
14
|
import { type ChildProcess } from "child_process";
|
|
@@ -76,6 +76,4 @@ export declare function applyEnvSubstitution(serverConfig: Omit<MCPServerStdioDe
|
|
|
76
76
|
* Servers from fusionConfig will be merged with servers from mcp.json
|
|
77
77
|
* If a server with the same name exists in both, fusionConfig takes precedence
|
|
78
78
|
*/
|
|
79
|
-
export declare function loadMCPConfig(sys: DevToolsSys, workingDirectory: string,
|
|
80
|
-
mcpServers?: Record<string, Omit<MCPServerStdioDefinition, "name">>;
|
|
81
|
-
}): Promise<MCPServerStdioDefinition[]>;
|
|
79
|
+
export declare function loadMCPConfig(sys: DevToolsSys, workingDirectory: string, serverConfigs: MCPServerConfig, autoImportLocalMCPs: boolean): Promise<MCPServerStdioDefinition[]>;
|
|
@@ -14,7 +14,7 @@ export interface GitInfo {
|
|
|
14
14
|
/**
|
|
15
15
|
* Detect git repository information
|
|
16
16
|
*/
|
|
17
|
-
export declare function detectGitInfo(sys: DevToolsSys): Promise<GitInfo>;
|
|
17
|
+
export declare function detectGitInfo(sys: DevToolsSys): Promise<GitInfo | undefined>;
|
|
18
18
|
/**
|
|
19
19
|
* Display git info in a user-friendly format
|
|
20
20
|
*/
|
|
@@ -9,6 +9,9 @@ export declare const discoverComponents: (sys: DevToolsSys, credentials: Credent
|
|
|
9
9
|
workspaceConfig?: WorkspaceConfiguration;
|
|
10
10
|
debug?: boolean;
|
|
11
11
|
specificComponents?: string[];
|
|
12
|
+
include?: string | string[];
|
|
13
|
+
exclude?: string | string[];
|
|
14
|
+
instructions?: string;
|
|
12
15
|
}) => Promise<{
|
|
13
16
|
numComponentsFound: number;
|
|
14
17
|
componentsToIndex: ComponentTask[];
|
|
@@ -8,6 +8,9 @@ export declare const processComponent: (sys: DevToolsSys, credentials: Credentia
|
|
|
8
8
|
designSystemVersion?: string;
|
|
9
9
|
workspaceConfig?: WorkspaceConfiguration;
|
|
10
10
|
debug?: boolean;
|
|
11
|
+
include?: string | string[];
|
|
12
|
+
exclude?: string | string[];
|
|
13
|
+
instructions?: string;
|
|
11
14
|
}) => Promise<void>;
|
|
12
15
|
export declare const processAgent: (sys: DevToolsSys, credentials: Credentials, discoveredComponents: ComponentTask[], opts: {
|
|
13
16
|
hasIcons?: boolean;
|
|
@@ -5,6 +5,9 @@ export declare const discoverIcons: (sys: DevToolsSys, credentials: Credentials,
|
|
|
5
5
|
designSystemPackage?: string;
|
|
6
6
|
workspaceConfig?: WorkspaceConfiguration;
|
|
7
7
|
debug?: boolean;
|
|
8
|
+
include?: string | string[];
|
|
9
|
+
exclude?: string | string[];
|
|
10
|
+
instructions?: string;
|
|
8
11
|
}) => Promise<{
|
|
9
12
|
icons: string[];
|
|
10
13
|
usage: string;
|
|
@@ -7,6 +7,9 @@ export declare const discoverInstallation: (sys: DevToolsSys, credentials: Crede
|
|
|
7
7
|
designSystemVersion?: string;
|
|
8
8
|
workspaceConfig?: WorkspaceConfiguration;
|
|
9
9
|
debug?: boolean;
|
|
10
|
+
include?: string | string[];
|
|
11
|
+
exclude?: string | string[];
|
|
12
|
+
instructions?: string;
|
|
10
13
|
}) => Promise<{
|
|
11
14
|
hash: string;
|
|
12
15
|
relevantFiles: string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DevToolsSys } from "../../core";
|
|
2
2
|
import { type Credentials } from "../credentials";
|
|
3
|
-
import type { DesignSystem, GenerateUserMessage, WorkspaceConfiguration, UpdateDesignSystemInput, DesignSystemScope, DisplayDesignSystem, IndexDocumentV1 } from "$/ai-utils";
|
|
3
|
+
import type { DesignSystem, GenerateUserMessage, WorkspaceConfiguration, UpdateDesignSystemInput, DesignSystemScope, DisplayDesignSystem, IndexDocumentV1, AclPolicy } from "$/ai-utils";
|
|
4
4
|
export declare const AGENT_FILE = "AGENTS.md";
|
|
5
5
|
export declare const ICONS_FILE = "icons.mdx";
|
|
6
6
|
export declare const TOKENS_FILE = "tokens.mdx";
|
|
@@ -10,6 +10,25 @@ export interface UserSettings {
|
|
|
10
10
|
isAdminInOrganization: boolean;
|
|
11
11
|
email: string;
|
|
12
12
|
}
|
|
13
|
+
interface GetAllDesignSystemsOpts {
|
|
14
|
+
/**
|
|
15
|
+
* If true, only design systems that the user has permission to edit will be
|
|
16
|
+
* returned. If false, all design systems that the user has permission to edit
|
|
17
|
+
* as well as design systems that the user has permission to read but not edit
|
|
18
|
+
* will be returned. Defaults to false.
|
|
19
|
+
*/
|
|
20
|
+
onlyEditAccess?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* If true, design systems that are scoped to the global space will be included.
|
|
23
|
+
* Defaults to false.
|
|
24
|
+
*/
|
|
25
|
+
includeGlobalScopeDesignSystems?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If true, the # of component docs in each design system will also be returned.
|
|
28
|
+
* Defaults to false.
|
|
29
|
+
*/
|
|
30
|
+
includeDocumentCount?: boolean;
|
|
31
|
+
}
|
|
13
32
|
export declare const promptForDesignSystemScope: (credentials: Credentials, userSettings: UserSettings | null, selectedScope?: DesignSystemScope) => Promise<DesignSystemScope | undefined>;
|
|
14
33
|
export declare const parseDesignSystem: (sys: DevToolsSys, designSystemPackage?: string) => Promise<{
|
|
15
34
|
name: any;
|
|
@@ -29,26 +48,45 @@ export declare const runCodeGen: (sys: DevToolsSys, credentials: Credentials, se
|
|
|
29
48
|
* for writing large files that would otherwise consume a lot of tokens.
|
|
30
49
|
*/
|
|
31
50
|
expectFile?: "tool" | string;
|
|
32
|
-
}, metadata?: any) => Promise<string>;
|
|
33
|
-
interface GetAllDesignSystemsOpts {
|
|
34
51
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* will be returned. Defaults to false.
|
|
52
|
+
* Glob pattern(s) to include for access control.
|
|
53
|
+
* When specified, only these patterns will be accessible by default.
|
|
54
|
+
* Can be a single string or array of strings.
|
|
39
55
|
*/
|
|
40
|
-
|
|
56
|
+
include?: string | string[];
|
|
41
57
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
58
|
+
* Glob pattern(s) to exclude for access control.
|
|
59
|
+
* These patterns will be denied access even if included.
|
|
60
|
+
* Can be a single string or array of strings.
|
|
44
61
|
*/
|
|
45
|
-
|
|
62
|
+
exclude?: string | string[];
|
|
46
63
|
/**
|
|
47
|
-
*
|
|
48
|
-
* Defaults to false.
|
|
64
|
+
* Extra instructions to be taken into account during repo indexing.
|
|
49
65
|
*/
|
|
50
|
-
|
|
51
|
-
}
|
|
66
|
+
instructions?: string;
|
|
67
|
+
}, metadata?: any) => Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Generates an ACL policy for repo indexing based on include/exclude patterns.
|
|
70
|
+
*
|
|
71
|
+
* @param include - Glob pattern(s) to include. When specified, only these patterns
|
|
72
|
+
* will be accessible by default. Can be a single string or array.
|
|
73
|
+
* @param exclude - Glob pattern(s) to exclude. These patterns will be denied access
|
|
74
|
+
* even if included. Can be a single string or array.
|
|
75
|
+
* @returns AclPolicy object with entries and denyDescription
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* // Allow only src directory, exclude tests
|
|
80
|
+
* const policy = generateRepoIndexingAclPolicy(
|
|
81
|
+
* ["src/**\/*", "lib/**\/*"],
|
|
82
|
+
* ["**\/*.test.ts", "**\/__tests__/**"]
|
|
83
|
+
* );
|
|
84
|
+
*
|
|
85
|
+
* // Single pattern
|
|
86
|
+
* const policy2 = generateRepoIndexingAclPolicy("src/**\/*", "dist/**");
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare const generateRepoIndexingAclPolicy: (include?: string | string[], exclude?: string | string[]) => AclPolicy;
|
|
52
90
|
export declare function getAllDesignSystems(credentials: Credentials, opts: {
|
|
53
91
|
includeDocumentCount: true;
|
|
54
92
|
} & Omit<GetAllDesignSystemsOpts, "includeDocumentCount">): Promise<DisplayDesignSystem[]>;
|
|
@@ -62,6 +100,9 @@ export declare const addDesignSystem: (credentials: Credentials, body: {
|
|
|
62
100
|
designSystemPackage?: string;
|
|
63
101
|
status: string;
|
|
64
102
|
scope: DesignSystemScope;
|
|
103
|
+
gitOriginUrl: string | undefined;
|
|
104
|
+
gitRelativePath: string | undefined;
|
|
105
|
+
cliArgs: string[];
|
|
65
106
|
}) => Promise<any>;
|
|
66
107
|
export declare const updateDesignSystem: (credentials: Credentials, body: UpdateDesignSystemInput) => Promise<any>;
|
|
67
108
|
export declare const checkRepoIndexingFolder: (sys: DevToolsSys) => Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,6 +7,9 @@ export declare const discoverTokens: (sys: DevToolsSys, credentials: Credentials
|
|
|
7
7
|
designSystemPackage?: string;
|
|
8
8
|
workspaceConfig?: WorkspaceConfiguration;
|
|
9
9
|
debug?: boolean;
|
|
10
|
+
include?: string | string[];
|
|
11
|
+
exclude?: string | string[];
|
|
12
|
+
instructions?: string;
|
|
10
13
|
}) => Promise<{
|
|
11
14
|
tokenGroupsToIndex: TokenTask[];
|
|
12
15
|
discoveredTokenGroups: TokenTask[];
|
|
@@ -17,4 +20,7 @@ export declare const processTokens: (sys: DevToolsSys, credentials: Credentials,
|
|
|
17
20
|
designSystemVersion?: string;
|
|
18
21
|
debug?: boolean;
|
|
19
22
|
workspaceConfig?: WorkspaceConfiguration;
|
|
23
|
+
include?: string | string[];
|
|
24
|
+
exclude?: string | string[];
|
|
25
|
+
instructions?: string;
|
|
20
26
|
}) => Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent discovery utilities
|
|
3
|
+
* Handles finding and loading custom agent definitions from the filesystem
|
|
4
|
+
*/
|
|
5
|
+
import type { DevToolsSys } from "../../types";
|
|
6
|
+
import { type SubAgent } from "./agent-parser";
|
|
7
|
+
export type { SubAgent };
|
|
8
|
+
/**
|
|
9
|
+
* Get custom agents from the filesystem
|
|
10
|
+
* Searches for agent definitions in .claude/agents, .builder/agents, and .cursor/agents
|
|
11
|
+
* @param sys - System utilities
|
|
12
|
+
* @param projectDir - Project directory (used for relative paths)
|
|
13
|
+
* @param currentDir - Starting directory for search
|
|
14
|
+
* @param rootDir - Root directory to stop search
|
|
15
|
+
* @returns Array of discovered agents
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCustomAgents({ sys, projectDir, currentDir, rootDir, }: {
|
|
18
|
+
sys: DevToolsSys;
|
|
19
|
+
projectDir: string;
|
|
20
|
+
currentDir: string;
|
|
21
|
+
rootDir: string;
|
|
22
|
+
}): Promise<SubAgent[]>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent definition parsing utilities
|
|
3
|
+
* Handles parsing of custom agent definition files
|
|
4
|
+
*/
|
|
5
|
+
import type { CodeGenMode } from "$/ai-utils";
|
|
6
|
+
export interface SubAgent {
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
systemPrompt?: string;
|
|
10
|
+
tools?: string[];
|
|
11
|
+
model?: string;
|
|
12
|
+
mode?: CodeGenMode;
|
|
13
|
+
filePath?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolves model shortcut to full model name
|
|
17
|
+
* @param modelOrShortcut - Model name or shortcut
|
|
18
|
+
* @returns Resolved model name or undefined
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveModelShortcut(modelOrShortcut?: string): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Parses an agent definition file (Markdown with YAML frontmatter)
|
|
23
|
+
* Expected format (following Claude Code sub-agents format):
|
|
24
|
+
* ```yaml
|
|
25
|
+
* ---
|
|
26
|
+
* name: Agent Name
|
|
27
|
+
* description: Description of what the agent does
|
|
28
|
+
* model: sonnet # Optional: supports shortcuts like sonnet, opus, haiku, mini
|
|
29
|
+
* tools: # Optional: list of tools to enable
|
|
30
|
+
* - Read
|
|
31
|
+
* - Grep
|
|
32
|
+
* - WebSearch
|
|
33
|
+
* mode: quality-v4-agent # Optional: agent mode
|
|
34
|
+
* ---
|
|
35
|
+
* System prompt content here (Markdown)
|
|
36
|
+
* ```
|
|
37
|
+
* @param fileContent - The raw file content
|
|
38
|
+
* @param filePath - The file path (used for fallback name)
|
|
39
|
+
* @returns Parsed SubAgent or null if parsing fails
|
|
40
|
+
*/
|
|
41
|
+
export declare function parseAgentFile(fileContent: string, filePath: string): SubAgent | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { DevToolsSys } from "../../core";
|
|
2
|
+
import { type Credentials } from "../credentials";
|
|
3
|
+
export { getCustomInstructions } from "./rules-discovery";
|
|
4
|
+
import type { CodeGenInputOptions, CodegenSetLastCompletion, CodegenTurn, GenerateCodeEvent, GenerateUserMessage, GetSessionTurnsResult, UserContext, WorkspaceConfiguration, EnvironmentVariable, PushChangesArgs } from "$/ai-utils";
|
|
5
|
+
import type { SessionContext } from "../codegen";
|
|
6
|
+
export declare const DEFAULT_MAX_COMPLETIONS = 30;
|
|
7
|
+
/**
|
|
8
|
+
* Merges and deduplicates items by name.
|
|
9
|
+
* Built-in items come first, discovered items can override them by name.
|
|
10
|
+
* @param builtIn - Built-in items
|
|
11
|
+
* @param discovered - Discovered items from project
|
|
12
|
+
* @returns Deduplicated array with discovered overriding built-in
|
|
13
|
+
*/
|
|
14
|
+
export declare function mergeByName<T extends {
|
|
15
|
+
name: string;
|
|
16
|
+
}>(builtIn: T[], discovered: T[]): T[];
|
|
17
|
+
export declare function getLastGoodTurn(sessionContext: SessionContext): CodegenTurn | undefined;
|
|
18
|
+
export declare function getLastUserTurn(sessionContext: SessionContext): CodegenTurn | undefined;
|
|
19
|
+
export declare function getLastApplyResultsTurn(sessionContext: SessionContext): CodegenTurn | undefined;
|
|
20
|
+
export declare function getLastOne<T>(array: T[]): T | undefined;
|
|
21
|
+
export declare function inPlaceRemovePendingTurns(turns: CodegenTurn[]): void;
|
|
22
|
+
export declare function restoreConsumedCredit(sys: DevToolsSys, credentials: Credentials, sessionId: string, restoreCredits: number): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Analyzes the payload to identify what's making it large
|
|
25
|
+
*/
|
|
26
|
+
export declare function analyzePayloadBreakdown(body: CodeGenInputOptions, jsonString: string): Record<string, any>;
|
|
27
|
+
export declare function completionStream(sys: DevToolsSys, credentials: Credentials, body: CodeGenInputOptions, signal: AbortSignal): AsyncGenerator<GenerateCodeEvent, void, unknown>;
|
|
28
|
+
export declare function codegenEndpoint(sys: DevToolsSys, credentials: Credentials, endpoint: string, body: Record<string, any>): Promise<boolean>;
|
|
29
|
+
export declare function setLastCompletionOfSession(sys: DevToolsSys, credentials: Credentials, data: CodegenSetLastCompletion, _verbose: boolean): Promise<boolean>;
|
|
30
|
+
export declare function getTurnsBySessionId(sys: DevToolsSys, credentials: Credentials, sessionId: string, linear: boolean, completionIdCursor?: string): Promise<GetSessionTurnsResult>;
|
|
31
|
+
export declare const parseCLIURL: (url: string | undefined) => {
|
|
32
|
+
id: undefined;
|
|
33
|
+
isInitial: boolean;
|
|
34
|
+
} | {
|
|
35
|
+
isInitial: boolean;
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function getUserContext(sys: DevToolsSys, gitWorkingDirectory?: string): Promise<UserContext>;
|
|
39
|
+
export declare function makeAsyncIterator<T>(): readonly [AsyncGenerator<T, void, void>, (event: T) => void, () => void];
|
|
40
|
+
export declare function isAGENTSFile(filePath: string): boolean;
|
|
41
|
+
export declare function isBaseImportantFile(filePath: string): boolean;
|
|
42
|
+
export declare function hasBuildError(text: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Loads a workspace configuration from a JSON file
|
|
45
|
+
* @param sys DevToolsSys instance
|
|
46
|
+
* @param workspaceFile Path to the workspace JSON file
|
|
47
|
+
* @returns The workspace configuration and working directory
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadWorkspace(sys: DevToolsSys, workspaceFile: string): Promise<{
|
|
50
|
+
workspace: WorkspaceConfiguration;
|
|
51
|
+
workingDirectory: string;
|
|
52
|
+
}>;
|
|
53
|
+
export declare function mergeUserMessages(currentMessage: GenerateUserMessage, newMessage: GenerateUserMessage): GenerateUserMessage;
|
|
54
|
+
export declare function keepAlive(): () => void;
|
|
55
|
+
export declare function parseAheadBehind(line: string): {
|
|
56
|
+
ahead: number;
|
|
57
|
+
behind: number;
|
|
58
|
+
};
|
|
59
|
+
export declare class BashError extends Error {
|
|
60
|
+
readonly code: number | string | undefined;
|
|
61
|
+
readonly stdout: string;
|
|
62
|
+
readonly stderr: string;
|
|
63
|
+
readonly command: string;
|
|
64
|
+
constructor(command: string, code: number | string | undefined, stdout: string, stderr: string, opts?: {
|
|
65
|
+
cause?: Error;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export declare function mergeEnvironmentVariables(envVariables: EnvironmentVariable[], extraEnvVariables: EnvironmentVariable[]): EnvironmentVariable[];
|
|
69
|
+
export declare function processPushChangesArgs(opts: PushChangesArgs): import("$/ai-utils").PushChangesOptions;
|
|
70
|
+
export declare function getErrorMessage(err: unknown): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom instruction/rules discovery utilities
|
|
3
|
+
* Handles finding and loading custom instructions from the filesystem
|
|
4
|
+
*/
|
|
5
|
+
import type { DevToolsSys } from "../../types";
|
|
6
|
+
import type { CustomInstruction } from "$/ai-utils";
|
|
7
|
+
/**
|
|
8
|
+
* Get custom instructions from the filesystem
|
|
9
|
+
* Searches for instruction files in:
|
|
10
|
+
* - .cursor/rules/
|
|
11
|
+
* - .builder/rules/
|
|
12
|
+
* - .cursorrules, .builderrules, .windsurfrules
|
|
13
|
+
* - .github/copilot-instructions.md
|
|
14
|
+
*
|
|
15
|
+
* @param sys - System utilities
|
|
16
|
+
* @param projectDir - Project directory (used for relative paths)
|
|
17
|
+
* @param currentDir - Starting directory for search
|
|
18
|
+
* @param rootDir - Root directory to stop search
|
|
19
|
+
* @returns Array of discovered custom instructions
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCustomInstructions({ sys, projectDir, currentDir, rootDir, }: {
|
|
22
|
+
sys: DevToolsSys;
|
|
23
|
+
projectDir: string;
|
|
24
|
+
currentDir: string;
|
|
25
|
+
rootDir: string;
|
|
26
|
+
}): Promise<CustomInstruction[]>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom instruction/rules parsing utilities
|
|
3
|
+
* Handles parsing of custom instruction files (.mdc, .cursorrules, etc.)
|
|
4
|
+
*/
|
|
5
|
+
import type { CustomInstruction } from "$/ai-utils";
|
|
6
|
+
/**
|
|
7
|
+
* Parse a custom instruction file
|
|
8
|
+
* Supports both:
|
|
9
|
+
* - .mdc files with YAML frontmatter
|
|
10
|
+
* - Plain text files (.cursorrules, .builderrules, etc.)
|
|
11
|
+
*
|
|
12
|
+
* @param fileContent - Raw file content
|
|
13
|
+
* @param filePath - File path (for generating name and id)
|
|
14
|
+
* @param hashFunction - Optional hash function for generating unique IDs
|
|
15
|
+
* @returns Parsed CustomInstruction or null
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseCustomInstructionFile(fileContent: string, filePath: string, hashFunction?: (content: string) => string): CustomInstruction | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic YAML frontmatter parser for Markdown files
|
|
3
|
+
* Supports both simple key-value pairs and arrays
|
|
4
|
+
*/
|
|
5
|
+
export interface YamlFrontmatterResult<T = Record<string, any>> {
|
|
6
|
+
frontmatter: T;
|
|
7
|
+
body: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks if content has YAML frontmatter
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasYamlFrontmatter(content: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parses YAML frontmatter from a string
|
|
15
|
+
* Handles simple YAML: key-value pairs, arrays, and comments
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseYamlFrontmatter(yamlContent: string): Record<string, any>;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts YAML frontmatter and body from Markdown content
|
|
20
|
+
* @param content - The raw Markdown content with frontmatter
|
|
21
|
+
* @returns Object with frontmatter and body, or null if no frontmatter found
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractYamlFrontmatter(content: string): {
|
|
24
|
+
frontmatterContent: string;
|
|
25
|
+
body: string;
|
|
26
|
+
} | null;
|
|
27
|
+
/**
|
|
28
|
+
* Parse Markdown file with YAML frontmatter
|
|
29
|
+
* @param content - The raw file content
|
|
30
|
+
* @returns Parsed frontmatter and body
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseMarkdownWithYaml<T = Record<string, any>>(content: string): YamlFrontmatterResult<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|