@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
36 lines (35 loc) • 1.32 kB
TypeScript
/**
* Dynamic context substitution for prompts.
* Supports:
* - Shell command interpolation: !`command` → stdout
* - Environment variable substitution: ${VAR} → value
*
* Shell commands are validated against the same security ACL
* used for Bash tool commands. If a command is not allowed,
* the pattern is left unmodified (no error, no execution).
*/
/**
* Resolves dynamic context in a prompt string or array of strings.
* First executes shell command interpolations (!`cmd`),
* then applies environment variable substitution (${VAR}).
*
* Commands that fail security validation are left as-is (not executed).
*/
export declare function resolvePromptDynamicContext(content: string, options: {
cwd: string;
env: Record<string, string | undefined>;
allowedCommands?: RegExp[];
skipCommandSecurity?: boolean;
}): string;
export declare function resolvePromptDynamicContext(content: string[], options: {
cwd: string;
env: Record<string, string | undefined>;
allowedCommands?: RegExp[];
skipCommandSecurity?: boolean;
}): string[];
export declare function resolvePromptDynamicContext(content: string | string[], options: {
cwd: string;
env: Record<string, string | undefined>;
allowedCommands?: RegExp[];
skipCommandSecurity?: boolean;
}): string | string[];