feat: TypeScript installation wizard with @clack/prompts TUI (#1)

Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
This commit was merged in pull request #1.
This commit is contained in:
2026-02-21 18:25:51 +00:00
committed by jason.woltje
parent e3ec3e32e5
commit 6a84f7e210
56 changed files with 20647 additions and 31 deletions

26
src/template/engine.ts Normal file
View File

@@ -0,0 +1,26 @@
export interface TemplateVars {
[key: string]: string;
}
/**
* Replaces {{PLACEHOLDER}} tokens with provided values.
* Does NOT expand ${ENV_VAR} syntax — those pass through for shell resolution.
*/
export function renderTemplate(
template: string,
vars: TemplateVars,
options: { strict?: boolean } = {},
): string {
return template.replace(
/\{\{([A-Z_][A-Z0-9_]*)\}\}/g,
(match, varName: string) => {
if (varName in vars) {
return vars[varName];
}
if (options.strict) {
throw new Error(`Template variable not provided: {{${varName}}}`);
}
return '';
},
);
}