UNPKG

decocms

Version:

CLI for managing deco.chat apps & projects

309 lines 8.87 kB
import { z } from "zod"; export declare const CONFIG_FILE = "wrangler.toml"; declare const DecoBindingSchema: z.ZodUnion<[z.ZodObject<{ name: z.ZodString; type: z.ZodString; integration_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: string; name: string; integration_id: string; }, { type: string; name: string; integration_id: string; }>, z.ZodObject<{ name: z.ZodString; type: z.ZodString; integration_name: z.ZodString; }, "strip", z.ZodTypeAny, { type: string; name: string; integration_name: string; }, { type: string; name: string; integration_name: string; }>, z.ZodObject<{ name: z.ZodString; type: z.ZodLiteral<"contract">; contract: z.ZodObject<{ body: z.ZodString; clauses: z.ZodArray<z.ZodObject<{ id: z.ZodString; price: z.ZodUnion<[z.ZodString, z.ZodNumber]>; }, "strip", z.ZodTypeAny, { id: string; price: string | number; }, { id: string; price: string | number; }>, "many">; }, "strip", z.ZodTypeAny, { body: string; clauses: { id: string; price: string | number; }[]; }, { body: string; clauses: { id: string; price: string | number; }[]; }>; }, "strip", z.ZodTypeAny, { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; }, { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; }>]>; export type DecoBinding = z.infer<typeof DecoBindingSchema>; declare const decoConfigSchema: z.ZodObject<{ workspace: z.ZodString; bindings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{ name: z.ZodString; type: z.ZodString; integration_id: z.ZodString; }, "strip", z.ZodTypeAny, { type: string; name: string; integration_id: string; }, { type: string; name: string; integration_id: string; }>, z.ZodObject<{ name: z.ZodString; type: z.ZodString; integration_name: z.ZodString; }, "strip", z.ZodTypeAny, { type: string; name: string; integration_name: string; }, { type: string; name: string; integration_name: string; }>, z.ZodObject<{ name: z.ZodString; type: z.ZodLiteral<"contract">; contract: z.ZodObject<{ body: z.ZodString; clauses: z.ZodArray<z.ZodObject<{ id: z.ZodString; price: z.ZodUnion<[z.ZodString, z.ZodNumber]>; }, "strip", z.ZodTypeAny, { id: string; price: string | number; }, { id: string; price: string | number; }>, "many">; }, "strip", z.ZodTypeAny, { body: string; clauses: { id: string; price: string | number; }[]; }, { body: string; clauses: { id: string; price: string | number; }[]; }>; }, "strip", z.ZodTypeAny, { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; }, { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; }>]>, "many">>>; local: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; enable_workflows: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; }, "strip", z.ZodTypeAny, { workspace: string; bindings: ({ type: string; name: string; integration_id: string; } | { type: string; name: string; integration_name: string; } | { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; })[]; local: boolean; enable_workflows: boolean; }, { workspace: string; bindings?: ({ type: string; name: string; integration_id: string; } | { type: string; name: string; integration_name: string; } | { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; })[] | undefined; local?: boolean | undefined; enable_workflows?: boolean | undefined; }>; export declare const setLocal: (l: boolean) => void; export declare const getLocal: () => boolean; export type Config = z.infer<typeof decoConfigSchema>; export interface WranglerConfig { [key: string]: unknown; name?: string; scope?: string; assets?: { directory?: string; }; migrations?: { tag: string; new_classes: string[]; }[]; durable_objects?: { bindings?: { name: string; class_name: string; }[]; }; deco?: Partial<Config>; } export declare const readWranglerConfig: (cwd?: string) => Promise<WranglerConfig>; /** * Write the entire wrangler config to the config file. * @param config - The wrangler config to write. * @param cwd - The current working directory to write config to. * @param merge - Whether to merge with existing config or replace it. */ export declare const writeWranglerConfig: (config: Partial<WranglerConfig>, cwd?: string) => Promise<void>; export declare const addWorkflowDO: () => Promise<void>; /** * Write the config to the current directory or any parent directory. * @param config - The config to write. * @param cwd - The current working directory to write config to. */ export declare const writeConfigFile: (config: Partial<Config>, cwd?: string, merge?: boolean) => Promise<void>; /** * Get the config for the current project considering the passed root directory and inline options. * @param rootDir - The root directory to read the config from. * @param inlineOptions - The inline options to merge with the config. * @param cwd - The current working directory to read config from. * @returns The config. */ export declare const getConfig: ({ inlineOptions, cwd, }?: { inlineOptions?: Partial<Config>; cwd?: string; }) => Promise<{ workspace: string; bindings: ({ type: string; name: string; integration_id: string; } | { type: string; name: string; integration_name: string; } | { type: "contract"; name: string; contract: { body: string; clauses: { id: string; price: string | number; }[]; }; })[]; local: boolean; enable_workflows: boolean; }>; /** * Get the path to the config file in the current directory or any parent directory. * Useful for finding the config file when the current directory is not the root directory of the project. * @param cwd - The current working directory. * @returns The path to the config file or null if not found. */ export declare const getConfigFilePath: (cwd: string) => string | null; /** * Generate a unique app UUID based on workspace and app name. * Uses MD5 hash of workspace+app to ensure consistent UUIDs for the same project. * @param workspace - The workspace name * @param app - The app name * @returns A unique UUID string based on the workspace and app name. */ export declare const getAppUUID: (workspace?: string, app?: string) => string; /** * Generate a domain for the app based on workspace and app name. * Uses the app UUID to create a consistent domain for the same project. * @param workspace - The workspace name * @param app - The app name * @returns A domain string for the app. */ export declare const getAppDomain: (workspace: string, app: string) => string; export type MCPConfig = { mcpServers: { [key: string]: { type: "http"; url: string; }; }; }; export declare function getMCPConfig(workspace: string, app: string): MCPConfig; export declare const getMCPConfigVersion: () => string; export declare const getRulesConfig: () => Promise<{ "deco-chat.mdc": string; }>; export {}; //# sourceMappingURL=config.d.ts.map