UNPKG

@builder.io/dev-tools

Version:

Builder.io Visual CMS Devtools

114 lines (113 loc) 5.59 kB
import type { DevToolsSys } from "../../core"; import { type Credentials } from "../credentials"; import type { DesignSystem, GenerateUserMessage, WorkspaceConfiguration, UpdateDesignSystemInput, DesignSystemScope, DisplayDesignSystem, IndexDocumentV1, AclPolicy, PrivacyMode } from "$/ai-utils"; export declare const AGENT_FILE = "AGENTS.md"; export declare const ICONS_FILE = "icons.mdx"; export declare const TOKENS_FILE = "tokens.mdx"; export declare const INSTALLATION_FILE = "installation.md"; export declare const REPO_INDEXING_FOLDER = "repo-indexing"; export interface UserSettings { isAdminInOrganization: boolean; email: string; } interface GetAllDesignSystemsOpts { /** * If true, only design systems that the user has permission to edit will be * returned. If false, all design systems that the user has permission to edit * as well as design systems that the user has permission to read but not edit * will be returned. Defaults to false. */ onlyEditAccess?: boolean; /** * If true, design systems that are scoped to the global space will be included. * Defaults to false. */ includeGlobalScopeDesignSystems?: boolean; /** * If true, the # of component docs in each design system will also be returned. * Defaults to false. */ includeDocumentCount?: boolean; } export declare const promptForDesignSystemScope: (credentials: Credentials, userSettings: UserSettings | null, selectedScope?: DesignSystemScope) => Promise<DesignSystemScope | undefined>; export declare const parseDesignSystem: (sys: DevToolsSys, designSystemPackage?: string) => Promise<{ name: any; version: string | undefined; }>; export declare const storeComponentDocs: (credentials: Credentials, body: IndexDocumentV1, debug?: boolean) => Promise<any>; export declare const runCodeGen: (sys: DevToolsSys, credentials: Credentials, sessionId: string, message: GenerateUserMessage, debug?: boolean, designSystemPackage?: string, workspaceConfig?: WorkspaceConfiguration, opts?: { tags?: object; maxTokens?: number; retriesAllowed?: number; /** * What kind of file to expect from the LLM. * `'tool'`: The LLM will use the Write tool to output the file. We will intercept that * and keep the file contents in-memory. File is not written to disk. * `string`: The LLM will write the file directly to the file system. We will read the * contents into memory and then delete the file from the file system. This is useful * for writing large files that would otherwise consume a lot of tokens. */ expectFile?: "tool" | string; /** * Glob pattern(s) to include for access control. * When specified, only these patterns will be accessible by default. * Can be a single string or array of strings. */ include?: string | string[]; /** * Glob pattern(s) to exclude for access control. * These patterns will be denied access even if included. * Can be a single string or array of strings. */ exclude?: string | string[]; /** * Extra instructions to be taken into account during repo indexing. */ instructions?: string; /** * Privacy mode settings for encryption key handling. */ privacyMode?: PrivacyMode; }, metadata?: any) => Promise<string>; /** * Generates an ACL policy for repo indexing based on include/exclude patterns. * * @param include - Glob pattern(s) to include. When specified, only these patterns * will be accessible by default. Can be a single string or array. * @param exclude - Glob pattern(s) to exclude. These patterns will be denied access * even if included. Can be a single string or array. * @returns AclPolicy object with entries and denyDescription * * @example * ```typescript * // Allow only src directory, exclude tests * const policy = generateRepoIndexingAclPolicy( * ["src/**\/*", "lib/**\/*"], * ["**\/*.test.ts", "**\/__tests__/**"] * ); * * // Single pattern * const policy2 = generateRepoIndexingAclPolicy("src/**\/*", "dist/**"); * ``` */ export declare const generateRepoIndexingAclPolicy: (include?: string | string[], exclude?: string | string[]) => AclPolicy; export declare function getAllDesignSystems(credentials: Credentials, opts: { includeDocumentCount: true; } & Omit<GetAllDesignSystemsOpts, "includeDocumentCount">): Promise<DisplayDesignSystem[]>; export declare function getAllDesignSystems(credentials: Credentials, opts?: GetAllDesignSystemsOpts): Promise<DesignSystem[]>; export declare const getDesignSystemsByScope: (scope: DesignSystemScope, designSystems: DesignSystem[]) => DesignSystem[]; export declare const getDesignSystemByName: (designSystemName: string, designSystems: DesignSystem[]) => DesignSystem | null; export declare const getDesignSystemByNameAndScope: (credentials: Credentials, designSystemName: string, scope: DesignSystemScope, designSystems: DesignSystem[]) => DesignSystem | null; export declare const addDesignSystem: (credentials: Credentials, body: { designSystemName: string; designSystemVersion?: string; designSystemPackage?: string; status: string; scope: DesignSystemScope; gitOriginUrl: string | undefined; gitRelativePath: string | undefined; cliArgs: string[]; }) => Promise<any>; export declare const updateDesignSystem: (credentials: Credentials, body: UpdateDesignSystemInput) => Promise<any>; export declare const checkRepoIndexingFolder: (sys: DevToolsSys) => Promise<boolean>; export {};