@pixpilot/scaffoldfy 0.34.0 → 0.36.0
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/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +28 -18
- package/dist/index.d.ts +28 -18
- package/dist/index.js +1 -1
- package/dist/run-tasks-Bj88BeF9.js +26 -0
- package/dist/run-tasks-Cgq9q7tb.cjs +26 -0
- package/dist/run-tasks-D7y78ZbB.js +1 -0
- package/dist/run-tasks-DTD_VKiq.cjs +1 -0
- package/dist/src-lHDE7_Zd.cjs +1 -0
- package/dist/src-mfRU6tIv.js +1 -0
- package/dist/template-inheritance-CwBAv1Q9.cjs +1 -0
- package/dist/template-inheritance-bPw0ciBi.js +1 -0
- package/dist/utils-Bj8gkhe3.js +1 -0
- package/dist/utils-CRe7Fw3m.cjs +1 -0
- package/package.json +3 -3
- package/schema/scaffoldfy.schema.json +76 -1
- package/dist/run-tasks-A6tQe8q1.js +0 -1
- package/dist/run-tasks-BsR0t7C5.js +0 -26
- package/dist/run-tasks-CSR8df5O.cjs +0 -26
- package/dist/run-tasks-CcH22QWc.cjs +0 -1
- package/dist/src-CaQ2gXYF.js +0 -1
- package/dist/src-IYqxnNOO.cjs +0 -1
- package/dist/utils-B6BwGcug.cjs +0 -1
- package/dist/utils-B6WSsvMT.js +0 -1
- package/dist/utils-Bz23aLK_.cjs +0 -1
- package/dist/utils-CrJkuEEG.js +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./chunk-DjWAcSYV.cjs`);require(`./config-DlJs75hK.cjs`);const t=require(`./
|
|
2
|
+
const e=require(`./chunk-DjWAcSYV.cjs`);require(`./config-DlJs75hK.cjs`);const t=require(`./template-inheritance-CwBAv1Q9.cjs`);require(`./run-tasks-Cgq9q7tb.cjs`),require(`./validate-scaffoldfy-json-Dkaz9ueq.cjs`),require(`./scaffoldfy-config-json-validator-CpEXHRsI.cjs`);const n=require(`./src-lHDE7_Zd.cjs`);let r=require(`node:fs`);r=e.t(r);let i=require(`node:path`);i=e.t(i);let a=require(`node:process`);a=e.t(a);let o=require(`commander`);o=e.t(o);let s=require(`node:url`);s=e.t(s);let c=require(`ajv`);c=e.t(c);const l=1,u=(0,s.fileURLToPath)(require(`url`).pathToFileURL(__filename).href),d=i.default.dirname(u);function f(){return new c.default({allErrors:!0,verbose:!0,strict:!1,discriminator:!0})}function p(){let e=i.default.join(d,`..`,`schema`,`scaffoldfy.schema.json`);try{let t=r.default.readFileSync(e,`utf-8`);return JSON.parse(t)}catch(t){throw Error(`Failed to load tasks schema from ${e}: ${t instanceof Error?t.message:String(t)}`)}}function m(e){return e.filter(t=>{if(t.keyword===`oneOf`){let e=t.params;if(e.passingSchemas&&e.passingSchemas.length>0)return!1}if(t.keyword===`required`){let n=e.find(e=>e.keyword===`oneOf`&&e.instancePath===t.instancePath);if(n){let e=n.params;if(e.passingSchemas&&e.passingSchemas.length>0)return!1}}return!0}).map(e=>{let t=e.instancePath||`root`,n=e.message??`Unknown error`;switch(e.keyword){case`required`:return`${t}: Missing required property "${String(e.params.missingProperty??`unknown`)}"`;case`type`:return`${t}: Expected type "${String(e.params.type??`unknown`)}", received "${typeof e.data}"`;case`enum`:{let r=e.params.allowedValues;return`${t}: ${n}. Allowed values: ${Array.isArray(r)?r.join(`, `):String(r)}`}case`pattern`:{let{pattern:r}=e.params;return`${t}: ${n}. Value must match pattern: ${String(r)}`}case`oneOf`:return`${t}: ${n}. Configuration must match exactly one of the allowed schemas`;case`additionalProperties`:return`${t}: ${n}. Unknown property: "${String(e.params.additionalProperty??`unknown`)}"`;default:return`${t}: ${n}`}})}function h(e,n={}){try{let t=f(),r=p(),i=t.compile(r);if(!i(e)&&i.errors){let e=m(i.errors);return e.length===0?{valid:!0,errors:[]}:(n.silent||g(e),{valid:!1,errors:e})}return{valid:!0,errors:[]}}catch(e){let r=e instanceof Error?e.message:`Unknown error occurred during schema validation`;return n.silent||(t.u(`❌ Schema validation error:`,`error`),t.u(` ${r}`,`error`)),{valid:!1,errors:[r]}}}function g(e){t.u(`❌ Schema validation failed:`,`error`),t.u(``,`error`),t.u(`The following validation errors were found:`,`error`),t.u(``,`error`);for(let n of e)t.u(` • ${n}`,`error`);t.u(``,`error`),t.u(`Please fix these errors in your template configuration file.`,`error`),t.u(``,`error`),t.u(`For schema documentation, see: https://github.com/pixpilot/scaffoldfy/tree/main/packages/scaffoldfy/schema`,`info`)}const _=new o.Command,v=i.default.join(__dirname,`..`,`package.json`);let y=`0.0.0`;try{y=JSON.parse(r.default.readFileSync(v,`utf-8`)).version??`0.0.0`}catch{}_.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(y),_.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path to task configuration file (JSON or TypeScript)`,`./template-tasks.json`).option(`--no-validate`,`Skip schema validation of task configuration (validation is enabled by default)`).option(`--debug`,`Enable debug logging for verbose output`).action(async e=>{e.debug===!0&&t.b(!0);try{let o=[],s,c,l,u,d;if(e.config!=null&&e.config!==``){let n=i.default.resolve(a.default.cwd(),e.config);if(r.default.existsSync(n))if(d=n,n.endsWith(`.ts`)||n.endsWith(`.mts`)){t.u(`Loading tasks from TypeScript file: ${e.config}`,`info`);try{let e=await import(n);o=e.default??e.tasks??[],(!Array.isArray(o)||o.length===0)&&(t.u(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),t.u(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(n){t.u(`Failed to load TypeScript config file: ${e.config}`,`error`),n instanceof Error&&t.u(` Error: ${n.message}`,`error`),a.default.exit(1)}}else try{if(e.validate!==!1){t.v(`Validating task configuration against schema...`);let e=r.default.readFileSync(n,`utf-8`);h(JSON.parse(e),{silent:!1}).valid||(t.u(``,`error`),t.u(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),a.default.exit(1)),t.u(`Configuration validated`,`success`)}let i=await t.i(n,{sequential:!0});if(i.templates!=null&&i.templates.length>0){let{runTemplatesSequentially:t}=await Promise.resolve().then(()=>require(`./run-tasks-DTD_VKiq.cjs`)),{createInitialConfig:r}=await Promise.resolve().then(()=>require(`./config-DmK0Erv2.cjs`));await t(i.templates,{dryRun:e.dryRun??!1,force:e.force??!1,tasksFilePath:n},r()),a.default.exit(0)}o=i.tasks,s=i.variables,c=i.prompts,l=i.enabled,u=i.transformers,Array.isArray(o)||(t.u(`❌ Invalid config file format`,`error`),t.u(`Expected JSON with { "tasks": [...] } structure`,`info`),a.default.exit(1))}catch(n){t.u(`Failed to load JSON config file: ${e.config}`,`error`),n instanceof Error&&t.u(` Error: ${n.message}`,`error`),a.default.exit(1)}else t.u(`Config file not found: ${e.config}`,`warn`)}let f=c!=null&&c.length>0||s!=null&&s.length>0;o.length===0&&!f&&(t.u(`❌ No tasks defined`,`error`),t.u(`Please provide tasks using one of these methods:`,`info`),t.u(` 1. Create a template-tasks.json file in the current directory`,`info`),t.u(` 2. Create a template-tasks.ts file in the current directory`,`info`),t.u(` 3. Use --config option to specify a different config file`,`info`),t.u(`Example JSON structure:`,`info`),console.log(JSON.stringify({tasks:[{id:`update-package`,name:`Update package.json`,description:`Update package.json with repository information`,required:!0,enabled:!0,type:`update-json`,prompts:[{id:`projectName`,type:`input`,message:`What is your project name?`,default:`my-project`,required:!0},{id:`includeTests`,type:`confirm`,message:`Include test files?`,default:!0}],config:{file:`package.json`,updates:{name:`{{projectName}}`,author:`{{author}}`}}}]},null,2)),a.default.exit(1)),o.length===0?t.u(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):t.u(`Loaded ${o.length} task(s)`,`success`),await n.n(o,{dryRun:e.dryRun,force:e.force,tasksFilePath:d,variables:s,prompts:c,templateEnabled:l,transformers:u})}catch(e){if(t.u(`❌ CLI execution failed`,`error`),e instanceof Error){t.u(`Error: ${e.message}`,`error`);let n=a.default.env.DEBUG;n!=null&&n!==``&&console.error(e.stack)}else console.error(e);a.default.exit(1)}}),_.parse(a.default.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./config-DfRbCqsT.js";import{
|
|
2
|
+
import"./config-DfRbCqsT.js";import{b as e,i as t,u as n,v as r}from"./template-inheritance-bPw0ciBi.js";import"./run-tasks-Bj88BeF9.js";import"./validate-scaffoldfy-json-Cfq-nQjy.js";import"./scaffoldfy-config-json-validator-DP8-e4Yy.js";import{n as i}from"./src-mfRU6tIv.js";import a from"node:path";import{fileURLToPath as o}from"node:url";import s from"node:fs";import c from"node:process";import{Command as l}from"commander";import u from"ajv";const d=()=>o(import.meta.url),f=(()=>a.dirname(d()))(),p=o(import.meta.url),m=a.dirname(p);function h(){return new u({allErrors:!0,verbose:!0,strict:!1,discriminator:!0})}function g(){let e=a.join(m,`..`,`schema`,`scaffoldfy.schema.json`);try{let t=s.readFileSync(e,`utf-8`);return JSON.parse(t)}catch(t){throw Error(`Failed to load tasks schema from ${e}: ${t instanceof Error?t.message:String(t)}`)}}function _(e){return e.filter(t=>{if(t.keyword===`oneOf`){let e=t.params;if(e.passingSchemas&&e.passingSchemas.length>0)return!1}if(t.keyword===`required`){let n=e.find(e=>e.keyword===`oneOf`&&e.instancePath===t.instancePath);if(n){let e=n.params;if(e.passingSchemas&&e.passingSchemas.length>0)return!1}}return!0}).map(e=>{let t=e.instancePath||`root`,n=e.message??`Unknown error`;switch(e.keyword){case`required`:return`${t}: Missing required property "${String(e.params.missingProperty??`unknown`)}"`;case`type`:return`${t}: Expected type "${String(e.params.type??`unknown`)}", received "${typeof e.data}"`;case`enum`:{let r=e.params.allowedValues;return`${t}: ${n}. Allowed values: ${Array.isArray(r)?r.join(`, `):String(r)}`}case`pattern`:{let{pattern:r}=e.params;return`${t}: ${n}. Value must match pattern: ${String(r)}`}case`oneOf`:return`${t}: ${n}. Configuration must match exactly one of the allowed schemas`;case`additionalProperties`:return`${t}: ${n}. Unknown property: "${String(e.params.additionalProperty??`unknown`)}"`;default:return`${t}: ${n}`}})}function v(e,t={}){try{let n=h(),r=g(),i=n.compile(r);if(!i(e)&&i.errors){let e=_(i.errors);return e.length===0?{valid:!0,errors:[]}:(t.silent||y(e),{valid:!1,errors:e})}return{valid:!0,errors:[]}}catch(e){let r=e instanceof Error?e.message:`Unknown error occurred during schema validation`;return t.silent||(n(`❌ Schema validation error:`,`error`),n(` ${r}`,`error`)),{valid:!1,errors:[r]}}}function y(e){n(`❌ Schema validation failed:`,`error`),n(``,`error`),n(`The following validation errors were found:`,`error`),n(``,`error`);for(let t of e)n(` • ${t}`,`error`);n(``,`error`),n(`Please fix these errors in your template configuration file.`,`error`),n(``,`error`),n(`For schema documentation, see: https://github.com/pixpilot/scaffoldfy/tree/main/packages/scaffoldfy/schema`,`info`)}const b=new l,x=a.join(f,`..`,`package.json`);let S=`0.0.0`;try{S=JSON.parse(s.readFileSync(x,`utf-8`)).version??`0.0.0`}catch{}b.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(S),b.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path to task configuration file (JSON or TypeScript)`,`./template-tasks.json`).option(`--no-validate`,`Skip schema validation of task configuration (validation is enabled by default)`).option(`--debug`,`Enable debug logging for verbose output`).action(async o=>{o.debug===!0&&e(!0);try{let e=[],l,u,d,f,p;if(o.config!=null&&o.config!==``){let i=a.resolve(c.cwd(),o.config);if(s.existsSync(i))if(p=i,i.endsWith(`.ts`)||i.endsWith(`.mts`)){n(`Loading tasks from TypeScript file: ${o.config}`,`info`);try{let t=await import(i);e=t.default??t.tasks??[],(!Array.isArray(e)||e.length===0)&&(n(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),n(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(e){n(`Failed to load TypeScript config file: ${o.config}`,`error`),e instanceof Error&&n(` Error: ${e.message}`,`error`),c.exit(1)}}else try{if(o.validate!==!1){r(`Validating task configuration against schema...`);let e=s.readFileSync(i,`utf-8`);v(JSON.parse(e),{silent:!1}).valid||(n(``,`error`),n(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),c.exit(1)),n(`Configuration validated`,`success`)}let a=await t(i,{sequential:!0});if(a.templates!=null&&a.templates.length>0){let{runTemplatesSequentially:e}=await import(`./run-tasks-D7y78ZbB.js`),{createInitialConfig:t}=await import(`./config-C8hh88Lc.js`);await e(a.templates,{dryRun:o.dryRun??!1,force:o.force??!1,tasksFilePath:i},t()),c.exit(0)}e=a.tasks,l=a.variables,u=a.prompts,d=a.enabled,f=a.transformers,Array.isArray(e)||(n(`❌ Invalid config file format`,`error`),n(`Expected JSON with { "tasks": [...] } structure`,`info`),c.exit(1))}catch(e){n(`Failed to load JSON config file: ${o.config}`,`error`),e instanceof Error&&n(` Error: ${e.message}`,`error`),c.exit(1)}else n(`Config file not found: ${o.config}`,`warn`)}let m=u!=null&&u.length>0||l!=null&&l.length>0;e.length===0&&!m&&(n(`❌ No tasks defined`,`error`),n(`Please provide tasks using one of these methods:`,`info`),n(` 1. Create a template-tasks.json file in the current directory`,`info`),n(` 2. Create a template-tasks.ts file in the current directory`,`info`),n(` 3. Use --config option to specify a different config file`,`info`),n(`Example JSON structure:`,`info`),console.log(JSON.stringify({tasks:[{id:`update-package`,name:`Update package.json`,description:`Update package.json with repository information`,required:!0,enabled:!0,type:`update-json`,prompts:[{id:`projectName`,type:`input`,message:`What is your project name?`,default:`my-project`,required:!0},{id:`includeTests`,type:`confirm`,message:`Include test files?`,default:!0}],config:{file:`package.json`,updates:{name:`{{projectName}}`,author:`{{author}}`}}}]},null,2)),c.exit(1)),e.length===0?n(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):n(`Loaded ${e.length} task(s)`,`success`),await i(e,{dryRun:o.dryRun,force:o.force,tasksFilePath:p,variables:l,prompts:u,templateEnabled:d,transformers:f})}catch(e){if(n(`❌ CLI execution failed`,`error`),e instanceof Error){n(`Error: ${e.message}`,`error`);let t=c.env.DEBUG;t!=null&&t!==``&&console.error(e.stack)}else console.error(e);c.exit(1)}}),b.parse(c.argv);export{};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./config-DlJs75hK.cjs`);const e=require(`./
|
|
1
|
+
require(`./config-DlJs75hK.cjs`);const e=require(`./template-inheritance-CwBAv1Q9.cjs`),t=require(`./run-tasks-Cgq9q7tb.cjs`),n=require(`./validate-scaffoldfy-json-Dkaz9ueq.cjs`);require(`./scaffoldfy-config-json-validator-CpEXHRsI.cjs`);const r=require(`./src-lHDE7_Zd.cjs`);exports.callHook=t.h,exports.clearPlugins=t.g,exports.clearTemplateCache=e.t,exports.collectPrompts=t.p,exports.collectVariables=t.o,exports.createTaskPlugin=t._,exports.displayTasksDiff=t.O,exports.evaluateCondition=e.c,exports.executePluginTask=t.v,exports.executeTask=t.c,exports.getCreateDiff=t.k,exports.getDeleteDiff=t.A,exports.getExecDiff=t.j,exports.getGitInitDiff=t.M,exports.getPlugin=t.y,exports.getPluginForTaskType=t.b,exports.getPluginTaskDiff=t.x,exports.getRegexReplaceDiff=t.N,exports.getRenameDiff=t.P,exports.getReplaceInFileDiff=t.F,exports.getTaskDiff=t.I,exports.getTemplateSourceDescription=t.z,exports.getUpdateJsonDiff=t.L,exports.getWriteDiff=t.R,exports.hasInlineTemplate=t.B,exports.hasTemplateFile=t.V,exports.interpolateTemplate=e.l,exports.isPluginTaskType=t.S,exports.listPlugins=t.C,exports.loadAndMergeTemplate=e.r,exports.loadTasksWithInheritance=e.i,exports.loadTemplate=e.a,exports.loadTemplatesInOrder=e.o,exports.log=e.u,exports.main=r.t,exports.mergeTemplates=e.s,exports.processTemplate=t.H,exports.prompt=e.d,exports.promptYesNo=e.f,exports.registerBuiltInPlugins=t.l,exports.registerHooks=t.w,exports.registerPlugin=t.T,exports.resolveAllDefaultValues=t.f,exports.resolveAllVariableValues=t.a,exports.resolveDefaultValue=t.m,exports.resolveVariableValue=t.i,exports.runTask=t.u,exports.runTasks=t.t,exports.runTemplatesSequentially=t.n,exports.runWithTasks=r.n,exports.shouldUseHandlebars=t.U,exports.topologicalSort=t.s,exports.unregisterPlugin=t.E,exports.validatePluginTask=t.D,exports.validatePrompts=t.d,exports.validateScaffoldfyJsonFile=n.t,exports.validateTemplateConfig=t.W,exports.validateVariables=t.r;
|
package/dist/index.d.cts
CHANGED
|
@@ -185,8 +185,9 @@ type PromptType = 'input' | 'select' | 'confirm' | 'password' | 'number';
|
|
|
185
185
|
* - 'exec': Execute a command to get the value dynamically
|
|
186
186
|
* - 'conditional': Choose value based on a condition
|
|
187
187
|
* - 'interpolate': Reference string with {{variable}} placeholders that will be interpolated with previously resolved prompts/variables
|
|
188
|
+
* - 'exec-file': Execute a script file to get the value dynamically
|
|
188
189
|
*/
|
|
189
|
-
type DefaultValueType = 'static' | 'exec' | 'conditional' | 'interpolate';
|
|
190
|
+
type DefaultValueType = 'static' | 'exec' | 'conditional' | 'interpolate' | 'exec-file';
|
|
190
191
|
/**
|
|
191
192
|
* Conditional default value configuration
|
|
192
193
|
* Evaluates a condition and returns different values based on the result
|
|
@@ -197,6 +198,22 @@ interface ConditionalDefaultConfig<T = string | number | boolean> {
|
|
|
197
198
|
ifTrue: T | DefaultValueConfig<T>;
|
|
198
199
|
ifFalse: T | DefaultValueConfig<T>;
|
|
199
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Runtime environment for executing script files
|
|
203
|
+
*/
|
|
204
|
+
type ExecFileRuntime = 'node' | 'bash' | 'sh' | 'pwsh' | 'powershell';
|
|
205
|
+
/**
|
|
206
|
+
* Exec-file default value configuration
|
|
207
|
+
* Executes a script file to get the value dynamically
|
|
208
|
+
*/
|
|
209
|
+
interface ExecFileValueConfig {
|
|
210
|
+
type: 'exec-file';
|
|
211
|
+
file: string;
|
|
212
|
+
runtime?: ExecFileRuntime;
|
|
213
|
+
args?: string[];
|
|
214
|
+
parameters?: Record<string, string>;
|
|
215
|
+
cwd?: string;
|
|
216
|
+
}
|
|
200
217
|
/**
|
|
201
218
|
* Default value configuration for prompts
|
|
202
219
|
*/
|
|
@@ -211,8 +228,9 @@ interface DefaultValueConfig<T = string | number | boolean> {
|
|
|
211
228
|
* - For explicit static values, use { type: 'static', value: yourValue }
|
|
212
229
|
* - For conditional defaults, use { type: 'conditional', condition: 'expression', ifTrue: value, ifFalse: value }
|
|
213
230
|
* - For interpolate strings, use { type: 'interpolate', value: '{{variable}}' } (will be interpolated with previously resolved prompts/variables)
|
|
231
|
+
* - For exec-file, use { type: 'exec-file', file: 'path/to/script.js', args: [...], parameters: {...} }
|
|
214
232
|
*/
|
|
215
|
-
type DefaultValue<T = string | number | boolean> = T | DefaultValueConfig<T> | ConditionalDefaultConfig<T
|
|
233
|
+
type DefaultValue<T = string | number | boolean> = T | DefaultValueConfig<T> | ConditionalDefaultConfig<T> | ExecFileValueConfig;
|
|
216
234
|
/**
|
|
217
235
|
* Conditional enabled/required configuration with new structure
|
|
218
236
|
* Evaluates a JavaScript expression at runtime
|
|
@@ -250,6 +268,7 @@ interface BasePrompt {
|
|
|
250
268
|
enabled?: DynamicBooleanValue;
|
|
251
269
|
override?: MergeStrategy;
|
|
252
270
|
$templateEnabled?: DynamicBooleanValue;
|
|
271
|
+
$sourceUrl?: string;
|
|
253
272
|
transformers?: string[];
|
|
254
273
|
}
|
|
255
274
|
interface InputPrompt extends BasePrompt {
|
|
@@ -289,6 +308,7 @@ interface VariableDefinition {
|
|
|
289
308
|
required?: DynamicBooleanValue;
|
|
290
309
|
override?: MergeStrategy;
|
|
291
310
|
$templateEnabled?: DynamicBooleanValue;
|
|
311
|
+
$sourceUrl?: string;
|
|
292
312
|
transformers?: string[];
|
|
293
313
|
}
|
|
294
314
|
/**
|
|
@@ -299,7 +319,7 @@ interface VariableDefinition {
|
|
|
299
319
|
* @example "packageManager === 'pnpm'"
|
|
300
320
|
*/
|
|
301
321
|
type ConditionExpression = string;
|
|
302
|
-
type TaskType = 'update-json' | 'write' | 'create' | 'regex-replace' | 'replace-in-file' | 'delete' | 'rename' | 'git-init' | 'exec' | 'move' | 'copy' | 'append' | 'mkdir';
|
|
322
|
+
type TaskType = 'update-json' | 'write' | 'create' | 'regex-replace' | 'replace-in-file' | 'delete' | 'rename' | 'git-init' | 'exec' | 'exec-file' | 'move' | 'copy' | 'append' | 'mkdir';
|
|
303
323
|
interface RollbackConfig {
|
|
304
324
|
type: TaskType;
|
|
305
325
|
config: unknown;
|
|
@@ -540,9 +560,10 @@ declare function resolveAllDefaultValues(prompts: PromptDefinition[], context?:
|
|
|
540
560
|
* @param defaultValue - The default value configuration
|
|
541
561
|
* @param promptId - The prompt ID for error reporting
|
|
542
562
|
* @param context - Optional context for interpolating template variables in string defaults
|
|
563
|
+
* @param prompt - Optional prompt definition for accessing $sourceUrl
|
|
543
564
|
* @returns The resolved default value
|
|
544
565
|
*/
|
|
545
|
-
declare function resolveDefaultValue<T = string | number | boolean>(defaultValue: DefaultValue<T> | undefined, promptId: string, context?: InitConfig): Promise<T | undefined>;
|
|
566
|
+
declare function resolveDefaultValue<T = string | number | boolean>(defaultValue: DefaultValue<T> | undefined, promptId: string, context?: InitConfig, prompt?: PromptDefinition): Promise<T | undefined>;
|
|
546
567
|
//#endregion
|
|
547
568
|
//#region src/prompts/validate-prompts.d.ts
|
|
548
569
|
/**
|
|
@@ -716,14 +737,6 @@ declare function processTemplate(config: TemplateSource, initConfig: InitConfig,
|
|
|
716
737
|
declare function getTemplateSourceDescription(config: TemplateSource): string;
|
|
717
738
|
//#endregion
|
|
718
739
|
//#region src/utils.d.ts
|
|
719
|
-
/**
|
|
720
|
-
* Get Git repository information from the current directory
|
|
721
|
-
*/
|
|
722
|
-
declare function getGitRepoInfo(): {
|
|
723
|
-
owner: string;
|
|
724
|
-
name: string;
|
|
725
|
-
url: string;
|
|
726
|
-
} | null;
|
|
727
740
|
/**
|
|
728
741
|
* Prompt user for input with optional default value
|
|
729
742
|
*/
|
|
@@ -741,10 +754,6 @@ declare function log(message: string, type?: 'info' | 'success' | 'error' | 'war
|
|
|
741
754
|
* Interpolate template variables in a string
|
|
742
755
|
*/
|
|
743
756
|
declare function interpolateTemplate(template: string, config: InitConfig): string;
|
|
744
|
-
/**
|
|
745
|
-
* Set a nested property in an object using dot notation
|
|
746
|
-
*/
|
|
747
|
-
declare function setNestedProperty(obj: Record<string, unknown>, propertyPath: string, value: unknown): void;
|
|
748
757
|
/**
|
|
749
758
|
* Evaluate a condition expression with the given config
|
|
750
759
|
* @param condition - JavaScript expression to evaluate
|
|
@@ -792,9 +801,10 @@ declare function resolveAllVariableValues(variables: VariableDefinition[], conte
|
|
|
792
801
|
* @param value - The variable value configuration
|
|
793
802
|
* @param variableId - The variable ID for error reporting
|
|
794
803
|
* @param context - Optional context for evaluating conditional values
|
|
804
|
+
* @param sourceUrl - Optional source URL for resolving relative file paths in exec-file
|
|
795
805
|
* @returns The resolved variable value
|
|
796
806
|
*/
|
|
797
|
-
declare function resolveVariableValue<T = string | number | boolean>(value: DefaultValue<T>, variableId: string, context?: InitConfig): Promise<T | undefined>;
|
|
807
|
+
declare function resolveVariableValue<T = string | number | boolean>(value: DefaultValue<T>, variableId: string, context?: InitConfig, sourceUrl?: string): Promise<T | undefined>;
|
|
798
808
|
//#endregion
|
|
799
809
|
//#region src/variables/validate-variables.d.ts
|
|
800
810
|
/**
|
|
@@ -832,4 +842,4 @@ declare function runWithTasks(customTasks: TaskDefinition[], options?: {
|
|
|
832
842
|
transformers?: Transformer[] | undefined;
|
|
833
843
|
}): Promise<void>;
|
|
834
844
|
//#endregion
|
|
835
|
-
export { type AppendConfig, BasePrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecutableConfig, type GitInitConfig, InitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, TasksConfiguration, type UpdateJsonConfig, VariableDefinition, type WriteConfig, callHook, clearPlugins, clearTemplateCache, collectPrompts, collectVariables, createTaskPlugin, displayTasksDiff, evaluateCondition, executePluginTask, executeTask, getCreateDiff, getDeleteDiff, getExecDiff, getGitInitDiff,
|
|
845
|
+
export { type AppendConfig, BasePrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig, InitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, TasksConfiguration, type UpdateJsonConfig, VariableDefinition, type WriteConfig, callHook, clearPlugins, clearTemplateCache, collectPrompts, collectVariables, createTaskPlugin, displayTasksDiff, evaluateCondition, executePluginTask, executeTask, getCreateDiff, getDeleteDiff, getExecDiff, getGitInitDiff, getPlugin, getPluginForTaskType, getPluginTaskDiff, getRegexReplaceDiff, getRenameDiff, getReplaceInFileDiff, getTaskDiff, getTemplateSourceDescription, getUpdateJsonDiff, getWriteDiff, hasInlineTemplate, hasTemplateFile, interpolateTemplate, isPluginTaskType, listPlugins, loadAndMergeTemplate, loadTasksWithInheritance, loadTemplate, loadTemplatesInOrder, log, main, mergeTemplates, processTemplate, prompt, promptYesNo, registerBuiltInPlugins, registerHooks, registerPlugin, resolveAllDefaultValues, resolveAllVariableValues, resolveDefaultValue, resolveVariableValue, runTask, runTasks, runTemplatesSequentially, runWithTasks, shouldUseHandlebars, topologicalSort, unregisterPlugin, validatePluginTask, validatePrompts, validateScaffoldfyJsonFile, validateTemplateConfig, validateVariables };
|
package/dist/index.d.ts
CHANGED
|
@@ -185,8 +185,9 @@ type PromptType = 'input' | 'select' | 'confirm' | 'password' | 'number';
|
|
|
185
185
|
* - 'exec': Execute a command to get the value dynamically
|
|
186
186
|
* - 'conditional': Choose value based on a condition
|
|
187
187
|
* - 'interpolate': Reference string with {{variable}} placeholders that will be interpolated with previously resolved prompts/variables
|
|
188
|
+
* - 'exec-file': Execute a script file to get the value dynamically
|
|
188
189
|
*/
|
|
189
|
-
type DefaultValueType = 'static' | 'exec' | 'conditional' | 'interpolate';
|
|
190
|
+
type DefaultValueType = 'static' | 'exec' | 'conditional' | 'interpolate' | 'exec-file';
|
|
190
191
|
/**
|
|
191
192
|
* Conditional default value configuration
|
|
192
193
|
* Evaluates a condition and returns different values based on the result
|
|
@@ -197,6 +198,22 @@ interface ConditionalDefaultConfig<T = string | number | boolean> {
|
|
|
197
198
|
ifTrue: T | DefaultValueConfig<T>;
|
|
198
199
|
ifFalse: T | DefaultValueConfig<T>;
|
|
199
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Runtime environment for executing script files
|
|
203
|
+
*/
|
|
204
|
+
type ExecFileRuntime = 'node' | 'bash' | 'sh' | 'pwsh' | 'powershell';
|
|
205
|
+
/**
|
|
206
|
+
* Exec-file default value configuration
|
|
207
|
+
* Executes a script file to get the value dynamically
|
|
208
|
+
*/
|
|
209
|
+
interface ExecFileValueConfig {
|
|
210
|
+
type: 'exec-file';
|
|
211
|
+
file: string;
|
|
212
|
+
runtime?: ExecFileRuntime;
|
|
213
|
+
args?: string[];
|
|
214
|
+
parameters?: Record<string, string>;
|
|
215
|
+
cwd?: string;
|
|
216
|
+
}
|
|
200
217
|
/**
|
|
201
218
|
* Default value configuration for prompts
|
|
202
219
|
*/
|
|
@@ -211,8 +228,9 @@ interface DefaultValueConfig<T = string | number | boolean> {
|
|
|
211
228
|
* - For explicit static values, use { type: 'static', value: yourValue }
|
|
212
229
|
* - For conditional defaults, use { type: 'conditional', condition: 'expression', ifTrue: value, ifFalse: value }
|
|
213
230
|
* - For interpolate strings, use { type: 'interpolate', value: '{{variable}}' } (will be interpolated with previously resolved prompts/variables)
|
|
231
|
+
* - For exec-file, use { type: 'exec-file', file: 'path/to/script.js', args: [...], parameters: {...} }
|
|
214
232
|
*/
|
|
215
|
-
type DefaultValue<T = string | number | boolean> = T | DefaultValueConfig<T> | ConditionalDefaultConfig<T
|
|
233
|
+
type DefaultValue<T = string | number | boolean> = T | DefaultValueConfig<T> | ConditionalDefaultConfig<T> | ExecFileValueConfig;
|
|
216
234
|
/**
|
|
217
235
|
* Conditional enabled/required configuration with new structure
|
|
218
236
|
* Evaluates a JavaScript expression at runtime
|
|
@@ -250,6 +268,7 @@ interface BasePrompt {
|
|
|
250
268
|
enabled?: DynamicBooleanValue;
|
|
251
269
|
override?: MergeStrategy;
|
|
252
270
|
$templateEnabled?: DynamicBooleanValue;
|
|
271
|
+
$sourceUrl?: string;
|
|
253
272
|
transformers?: string[];
|
|
254
273
|
}
|
|
255
274
|
interface InputPrompt extends BasePrompt {
|
|
@@ -289,6 +308,7 @@ interface VariableDefinition {
|
|
|
289
308
|
required?: DynamicBooleanValue;
|
|
290
309
|
override?: MergeStrategy;
|
|
291
310
|
$templateEnabled?: DynamicBooleanValue;
|
|
311
|
+
$sourceUrl?: string;
|
|
292
312
|
transformers?: string[];
|
|
293
313
|
}
|
|
294
314
|
/**
|
|
@@ -299,7 +319,7 @@ interface VariableDefinition {
|
|
|
299
319
|
* @example "packageManager === 'pnpm'"
|
|
300
320
|
*/
|
|
301
321
|
type ConditionExpression = string;
|
|
302
|
-
type TaskType = 'update-json' | 'write' | 'create' | 'regex-replace' | 'replace-in-file' | 'delete' | 'rename' | 'git-init' | 'exec' | 'move' | 'copy' | 'append' | 'mkdir';
|
|
322
|
+
type TaskType = 'update-json' | 'write' | 'create' | 'regex-replace' | 'replace-in-file' | 'delete' | 'rename' | 'git-init' | 'exec' | 'exec-file' | 'move' | 'copy' | 'append' | 'mkdir';
|
|
303
323
|
interface RollbackConfig {
|
|
304
324
|
type: TaskType;
|
|
305
325
|
config: unknown;
|
|
@@ -540,9 +560,10 @@ declare function resolveAllDefaultValues(prompts: PromptDefinition[], context?:
|
|
|
540
560
|
* @param defaultValue - The default value configuration
|
|
541
561
|
* @param promptId - The prompt ID for error reporting
|
|
542
562
|
* @param context - Optional context for interpolating template variables in string defaults
|
|
563
|
+
* @param prompt - Optional prompt definition for accessing $sourceUrl
|
|
543
564
|
* @returns The resolved default value
|
|
544
565
|
*/
|
|
545
|
-
declare function resolveDefaultValue<T = string | number | boolean>(defaultValue: DefaultValue<T> | undefined, promptId: string, context?: InitConfig): Promise<T | undefined>;
|
|
566
|
+
declare function resolveDefaultValue<T = string | number | boolean>(defaultValue: DefaultValue<T> | undefined, promptId: string, context?: InitConfig, prompt?: PromptDefinition): Promise<T | undefined>;
|
|
546
567
|
//#endregion
|
|
547
568
|
//#region src/prompts/validate-prompts.d.ts
|
|
548
569
|
/**
|
|
@@ -716,14 +737,6 @@ declare function processTemplate(config: TemplateSource, initConfig: InitConfig,
|
|
|
716
737
|
declare function getTemplateSourceDescription(config: TemplateSource): string;
|
|
717
738
|
//#endregion
|
|
718
739
|
//#region src/utils.d.ts
|
|
719
|
-
/**
|
|
720
|
-
* Get Git repository information from the current directory
|
|
721
|
-
*/
|
|
722
|
-
declare function getGitRepoInfo(): {
|
|
723
|
-
owner: string;
|
|
724
|
-
name: string;
|
|
725
|
-
url: string;
|
|
726
|
-
} | null;
|
|
727
740
|
/**
|
|
728
741
|
* Prompt user for input with optional default value
|
|
729
742
|
*/
|
|
@@ -741,10 +754,6 @@ declare function log(message: string, type?: 'info' | 'success' | 'error' | 'war
|
|
|
741
754
|
* Interpolate template variables in a string
|
|
742
755
|
*/
|
|
743
756
|
declare function interpolateTemplate(template: string, config: InitConfig): string;
|
|
744
|
-
/**
|
|
745
|
-
* Set a nested property in an object using dot notation
|
|
746
|
-
*/
|
|
747
|
-
declare function setNestedProperty(obj: Record<string, unknown>, propertyPath: string, value: unknown): void;
|
|
748
757
|
/**
|
|
749
758
|
* Evaluate a condition expression with the given config
|
|
750
759
|
* @param condition - JavaScript expression to evaluate
|
|
@@ -792,9 +801,10 @@ declare function resolveAllVariableValues(variables: VariableDefinition[], conte
|
|
|
792
801
|
* @param value - The variable value configuration
|
|
793
802
|
* @param variableId - The variable ID for error reporting
|
|
794
803
|
* @param context - Optional context for evaluating conditional values
|
|
804
|
+
* @param sourceUrl - Optional source URL for resolving relative file paths in exec-file
|
|
795
805
|
* @returns The resolved variable value
|
|
796
806
|
*/
|
|
797
|
-
declare function resolveVariableValue<T = string | number | boolean>(value: DefaultValue<T>, variableId: string, context?: InitConfig): Promise<T | undefined>;
|
|
807
|
+
declare function resolveVariableValue<T = string | number | boolean>(value: DefaultValue<T>, variableId: string, context?: InitConfig, sourceUrl?: string): Promise<T | undefined>;
|
|
798
808
|
//#endregion
|
|
799
809
|
//#region src/variables/validate-variables.d.ts
|
|
800
810
|
/**
|
|
@@ -832,4 +842,4 @@ declare function runWithTasks(customTasks: TaskDefinition[], options?: {
|
|
|
832
842
|
transformers?: Transformer[] | undefined;
|
|
833
843
|
}): Promise<void>;
|
|
834
844
|
//#endregion
|
|
835
|
-
export { type AppendConfig, BasePrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecutableConfig, type GitInitConfig, InitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, TasksConfiguration, type UpdateJsonConfig, VariableDefinition, type WriteConfig, callHook, clearPlugins, clearTemplateCache, collectPrompts, collectVariables, createTaskPlugin, displayTasksDiff, evaluateCondition, executePluginTask, executeTask, getCreateDiff, getDeleteDiff, getExecDiff, getGitInitDiff,
|
|
845
|
+
export { type AppendConfig, BasePrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig, InitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, TasksConfiguration, type UpdateJsonConfig, VariableDefinition, type WriteConfig, callHook, clearPlugins, clearTemplateCache, collectPrompts, collectVariables, createTaskPlugin, displayTasksDiff, evaluateCondition, executePluginTask, executeTask, getCreateDiff, getDeleteDiff, getExecDiff, getGitInitDiff, getPlugin, getPluginForTaskType, getPluginTaskDiff, getRegexReplaceDiff, getRenameDiff, getReplaceInFileDiff, getTaskDiff, getTemplateSourceDescription, getUpdateJsonDiff, getWriteDiff, hasInlineTemplate, hasTemplateFile, interpolateTemplate, isPluginTaskType, listPlugins, loadAndMergeTemplate, loadTasksWithInheritance, loadTemplate, loadTemplatesInOrder, log, main, mergeTemplates, processTemplate, prompt, promptYesNo, registerBuiltInPlugins, registerHooks, registerPlugin, resolveAllDefaultValues, resolveAllVariableValues, resolveDefaultValue, resolveVariableValue, runTask, runTasks, runTemplatesSequentially, runWithTasks, shouldUseHandlebars, topologicalSort, unregisterPlugin, validatePluginTask, validatePrompts, validateScaffoldfyJsonFile, validateTemplateConfig, validateVariables };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./config-DfRbCqsT.js";import{a as e,c as t,
|
|
1
|
+
import"./config-DfRbCqsT.js";import{a as e,c as t,d as n,f as r,i,l as a,o,r as s,s as c,t as l,u}from"./template-inheritance-bPw0ciBi.js";import{A as d,B as f,C as p,D as m,E as h,F as g,H as _,I as v,L as y,M as b,N as x,O as S,P as C,R as w,S as T,T as E,U as D,V as O,W as k,_ as A,a as j,b as M,c as N,d as P,f as F,g as I,h as L,i as R,j as z,k as B,l as V,m as H,n as U,o as W,p as G,r as K,s as q,t as J,u as Y,v as X,w as Z,x as Q,y as $,z as ee}from"./run-tasks-Bj88BeF9.js";import{t as te}from"./validate-scaffoldfy-json-Cfq-nQjy.js";import"./scaffoldfy-config-json-validator-DP8-e4Yy.js";import{n as ne,t as re}from"./src-mfRU6tIv.js";export{L as callHook,I as clearPlugins,l as clearTemplateCache,G as collectPrompts,W as collectVariables,A as createTaskPlugin,S as displayTasksDiff,t as evaluateCondition,X as executePluginTask,N as executeTask,B as getCreateDiff,d as getDeleteDiff,z as getExecDiff,b as getGitInitDiff,$ as getPlugin,M as getPluginForTaskType,Q as getPluginTaskDiff,x as getRegexReplaceDiff,C as getRenameDiff,g as getReplaceInFileDiff,v as getTaskDiff,ee as getTemplateSourceDescription,y as getUpdateJsonDiff,w as getWriteDiff,f as hasInlineTemplate,O as hasTemplateFile,a as interpolateTemplate,T as isPluginTaskType,p as listPlugins,s as loadAndMergeTemplate,i as loadTasksWithInheritance,e as loadTemplate,o as loadTemplatesInOrder,u as log,re as main,c as mergeTemplates,_ as processTemplate,n as prompt,r as promptYesNo,V as registerBuiltInPlugins,Z as registerHooks,E as registerPlugin,F as resolveAllDefaultValues,j as resolveAllVariableValues,H as resolveDefaultValue,R as resolveVariableValue,Y as runTask,J as runTasks,U as runTemplatesSequentially,ne as runWithTasks,D as shouldUseHandlebars,q as topologicalSort,h as unregisterPlugin,m as validatePluginTask,P as validatePrompts,te as validateScaffoldfyJsonFile,k as validateTemplateConfig,K as validateVariables};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{t as e}from"./config-DfRbCqsT.js";import{C as t,S as n,T as r,_ as i,c as a,g as o,h as s,l as c,m as l,n as u,p as d,u as f,v as p,w as m,x as ee,y as h}from"./template-inheritance-bPw0ciBi.js";import g from"node:path";import _ from"node:fs";import v from"node:process";import{promisify as y}from"node:util";import{execSync as b}from"node:child_process";import{confirm as x,input as te,number as S,password as ne,select as re}from"@inquirer/prompts";import{camelCase as ie,capitalCase as ae,constantCase as oe,kebabCase as se,lowerCase as ce,pascalCase as le,snakeCase as ue,upperCase as de}from"case-anything";var fe=class e extends r{constructor(e,t){super(e,`TASK_NOT_FOUND`),this.taskId=t,this.name=`TaskNotFoundError`}static forId(t){return new e(`Task not found: ${t}`,t)}},C=class e extends r{constructor(e,t,n){super(e,`PROMPT_VALIDATION_ERROR`),this.promptId=t,this.reason=n,this.name=`PromptValidationError`}static required(t){return new e(`Prompt "${t}" is required`,t,`required`)}static unknownType(t){return new e(`Unknown prompt type: ${t}`,t,`unknown_type`)}},w=class e extends r{constructor(e,t,n){super(e,`PLUGIN_CONFIGURATION_ERROR`),this.pluginType=t,this.configIssue=n,this.name=`PluginConfigurationError`}static templateMissingTemplateOrFile(){return new e(`Template task requires either "template" (inline) or "templateFile" (file path) to be specified`,`template`,`missing_template_or_file`)}static templateHasBothTemplateAndFile(){return new e(`Template task cannot have both "template" and "templateFile" specified. Use one or the other.`,`template`,`both_template_and_file`)}static createMissingTemplateOrFile(){return new e(`Create task requires either "template" (inline) or "templateFile" (file path) to be specified`,`create`,`missing_template_or_file`)}static createHasBothTemplateAndFile(){return new e(`Create task cannot have both "template" and "templateFile" specified. Use one or the other.`,`create`,`both_template_and_file`)}},T=class e extends r{constructor(e,t,n){super(e,`TRANSFORMER_ERROR`),this.transformerId=t,this.reason=n,this.name=`TransformerError`}static notFound(t){return new e(`Transformer "${t}" not found`,t,`not_found`)}static executionFailed(t,n){return new e(`Transformer "${t}" execution failed: ${n}`,t,`execution_failed`)}static invalidType(t,n){return new e(`Invalid transformer type "${n}" for transformer "${t}"`,t,`invalid_type`)}};function E(e){return e.template!=null&&e.template!==``}function D(e){return e.templateFile!=null&&e.templateFile!==``}function pe(e){return e.endsWith(`.hbs`)}function O(e){let t=E(e),n=D(e);return!t&&!n?{isValid:!1,hasInlineTemplate:t,hasTemplateFile:n,error:`Template configuration requires either "template" (inline) or "templateFile" (file path) to be specified`}:t&&n?{isValid:!1,hasInlineTemplate:t,hasTemplateFile:n,error:`Template configuration cannot have both "template" and "templateFile" specified. Use one or the other.`}:{isValid:!0,hasInlineTemplate:t,hasTemplateFile:n}}async function k(e,t,n,r={}){let{enableHandlebars:i=!0,sourceUrl:a=n?.$sourceUrl}=r,o=E(e),l=D(e);if(o)return c(e.template,t);if(l){let n=e.templateFile,r=i&&pe(n),o=await u(s(n,a));return r?(await import(`handlebars`)).default.compile(o)(t):c(o,t)}throw Error(`No template content available`)}function me(e){return E(e)?`inline template`:D(e)?`template file: ${e.templateFile}`:`no template source`}const A=y(_.readFile),j={reset:`\x1B[0m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`};function M(e,t){switch(t){case`add`:return`${j.green}+ ${e}${j.reset}`;case`remove`:return`${j.red}- ${e}${j.reset}`;case`context`:return`${j.gray} ${e}${j.reset}`;default:return e}}function N(e,t){let n=e.split(`
|
|
2
|
+
`),r=t.split(`
|
|
3
|
+
`),i=[],a=Math.max(n.length,r.length);for(let e=0;e<a;e++){let t=n[e],a=r[e];t===a?t!==void 0&&i.push(M(t,`context`)):(t!==void 0&&i.push(M(t,`remove`)),a!==void 0&&i.push(M(a,`add`)))}return i}async function he(e,n){if(e.condition!=null&&e.condition!==``&&!a(e.condition,n))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let r=g.join(v.cwd(),e.file);if(!_.existsSync(r))return`${j.red}✗ File not found: ${e.file}${j.reset}`;try{let i=await A(r,`utf-8`),a=JSON.parse(i),o={...a};function s(e){if(typeof e==`string`)return c(e,n);if(Array.isArray(e))return e.map(e=>s(e));if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=s(r);return t}return e}for(let[n,r]of Object.entries(e.updates)){let e=s(r);n.includes(`.`)?t(a,n,e):a[n]=e}let l=JSON.stringify(o,null,2),u=JSON.stringify(a,null,2);if(l===u)return`${j.cyan}→ No changes${j.reset}`;let d=N(l,u);return`${j.blue}File: ${e.file}${j.reset}\n${d.join(`
|
|
4
|
+
`)}`}catch(e){return`${j.red}✗ Error: ${e instanceof Error?e.message:String(e)}${j.reset}`}}async function ge(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;if(e.template==null||e.template===``)return`${j.red}✗ No template content provided for file: ${e.file}${j.reset}`;let n=g.join(v.cwd(),e.file),r=c(e.template,t);if(!_.existsSync(n)){let t=r.split(`
|
|
5
|
+
`).slice(0,10).join(`
|
|
6
|
+
`),n=r.split(`
|
|
7
|
+
`).length>10;return`${j.blue}File: ${e.file}${j.reset}\n${j.green}+ New file would be created${j.reset}\n${j.gray}Content preview:${j.reset}\n${t}${n?`
|
|
8
|
+
...`:``}`}try{let t=await A(n,`utf-8`);if(t===r)return`${j.cyan}→ No changes${j.reset}`;let i=N(t,r);return`${j.blue}File: ${e.file}${j.reset}\n${i.join(`
|
|
9
|
+
`)}`}catch(e){return`${j.red}✗ Error: ${e instanceof Error?e.message:String(e)}${j.reset}`}}async function _e(e,t,n){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let r=g.join(v.cwd(),e.file);if(_.existsSync(r))return`${j.cyan}→ File already exists, would be skipped: ${e.file}${j.reset}`;try{if(E(e)){let r=await k(e,t,n),i=r.split(`
|
|
10
|
+
`).slice(0,10).join(`
|
|
11
|
+
`),a=r.split(`
|
|
12
|
+
`).length>10;return`${j.blue}File: ${e.file}${j.reset}\n${j.green}+ New file would be created${j.reset}\n${j.gray}Content preview:${j.reset}\n${i}${a?`
|
|
13
|
+
...`:``}`}let r=me(e);return`${j.blue}File: ${e.file}${j.reset}\n${j.green}+ New file would be created from ${r}${j.reset}`}catch(e){return`${j.red}✗ Error: ${e instanceof Error?e.message:String(e)}${j.reset}`}}async function ve(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=g.join(v.cwd(),e.file);if(!_.existsSync(n))return`${j.red}✗ File not found: ${e.file}${j.reset}`;try{let r=await A(n,`utf-8`),i=new RegExp(e.pattern,e.flags??`g`),a=c(e.replacement,t),o=r.replace(i,a);if(r===o)return`${j.cyan}→ No matches found${j.reset}`;let s=N(r,o);return`${j.blue}File: ${e.file}${j.reset}\n${s.join(`
|
|
14
|
+
`)}`}catch(e){return`${j.red}✗ Error: ${e instanceof Error?e.message:String(e)}${j.reset}`}}async function ye(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=g.join(v.cwd(),e.file);if(!_.existsSync(n))return`${j.red}✗ File not found: ${e.file}${j.reset}`;try{let r=await A(n,`utf-8`),i=r;for(let{find:n,replace:i}of e.replacements){let e=c(n,t),a=c(i,t);r=r.replace(e,a)}if(i===r)return`${j.cyan}→ No changes${j.reset}`;let a=N(i,r);return`${j.blue}File: ${e.file}${j.reset}\n${a.join(`
|
|
15
|
+
`)}`}catch(e){return`${j.red}✗ Error: ${e instanceof Error?e.message:String(e)}${j.reset}`}}function be(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=e.paths.map(e=>c(e,t)).filter(e=>_.existsSync(g.join(v.cwd(),e)));return n.length===0?`${j.cyan}→ No files/directories to delete${j.reset}`:`${j.red}Would delete:${j.reset}\n${n.map(e=>`${j.red} - ${e}${j.reset}`).join(`
|
|
16
|
+
`)}`}function xe(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=c(e.from,t),r=c(e.to,t),i=g.join(v.cwd(),n),o=g.join(v.cwd(),r);return _.existsSync(i)?_.existsSync(o)?`${j.yellow}⚠ Destination already exists: ${r}${j.reset}\n${j.cyan}Would rename: ${n} → ${r}${j.reset}`:`${j.cyan}Would rename: ${n} → ${r}${j.reset}`:`${j.red}✗ Source not found: ${n}${j.reset}`}function Se(e){if(e.condition!=null&&e.condition!==``)return`${j.yellow}⊘ Condition check skipped in dry-run${j.reset}`;let t=g.join(v.cwd(),`.git`),n=_.existsSync(t),r=[];if(e.removeExisting&&n&&r.push(`${j.red}Would remove existing .git directory${j.reset}`),r.push(`${j.green}Would initialize git repository${j.reset}`),e.initialCommit){let t=e.message??`Initial commit`;r.push(`${j.green}Would create initial commit: "${t}"${j.reset}`)}return r.join(`
|
|
17
|
+
`)}function P(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=c(e.command,t),r=e.cwd==null?v.cwd():c(e.cwd,t);return`${j.yellow}Would execute:${j.reset}\n${j.cyan} Command: ${n}${j.reset}\n${j.cyan} Working directory: ${r}${j.reset}`}function Ce(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=c(e.from,t),r=c(e.to,t),i=g.join(v.cwd(),n),o=g.join(v.cwd(),r);return _.existsSync(i)?_.existsSync(o)?`${j.yellow}⚠ Destination already exists: ${r}${j.reset}\n${j.cyan}Would move: ${n} → ${r}${j.reset}`:`${j.cyan}Would move: ${n} → ${r}${j.reset}`:`${j.red}✗ Source not found: ${n}${j.reset}`}function we(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=c(e.from,t),r=c(e.to,t),i=g.join(v.cwd(),n),o=g.join(v.cwd(),r);if(!_.existsSync(i))return`${j.red}✗ Source not found: ${n}${j.reset}`;let s=_.statSync(i).isDirectory()?`directory`:`file`;return _.existsSync(o)?`${j.yellow}⚠ Destination already exists: ${r}${j.reset}\n${j.cyan}Would copy ${s}: ${n} → ${r}${j.reset}`:`${j.cyan}Would copy ${s}: ${n} → ${r}${j.reset}`}async function Te(e,t,n){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let r=g.join(v.cwd(),e.file),i={};e.content==null?e.template!=null&&(i.template=e.template):i.template=e.content,e.templateFile!=null&&(i.templateFile=e.templateFile);try{let a=await k(i,t,n),o=a.split(`
|
|
18
|
+
`).slice(0,10).join(`
|
|
19
|
+
`),s=a.split(`
|
|
20
|
+
`).length>10;return _.existsSync(r)?`${j.blue}File: ${e.file}${j.reset}\n${j.green}+ Would append content${j.reset}\n${j.gray}Content preview:${j.reset}\n${o}${s?`
|
|
21
|
+
...`:``}`:`${j.blue}File: ${e.file}${j.reset}\n${j.green}+ New file would be created with content${j.reset}\n${j.gray}Content preview:${j.reset}\n${o}${s?`
|
|
22
|
+
...`:``}`}catch(e){return`${j.red}✗ Error: ${e instanceof Error?e.message:String(e)}${j.reset}`}}function Ee(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t))return`${j.yellow}⊘ Condition not met - task would be skipped${j.reset}`;let n=c(e.path,t),r=g.join(v.cwd(),n);return _.existsSync(r)?`${j.cyan}→ Directory already exists: ${n}${j.reset}`:`${j.green}+ Would create directory: ${n}${j.reset}`}async function De(e,t){try{switch(e.type){case`update-json`:return await he(e.config,t);case`write`:return await ge(e.config,t);case`create`:return await _e(e.config,t,e);case`regex-replace`:return await ve(e.config,t);case`replace-in-file`:return await ye(e.config,t);case`delete`:return be(e.config,t);case`rename`:return xe(e.config,t);case`move`:return Ce(e.config,t);case`copy`:return we(e.config,t);case`append`:return await Te(e.config,t,e);case`mkdir`:return Ee(e.config,t);case`git-init`:return Se(e.config);case`exec`:return P(e.config,t);case`exec-file`:return P(e.config,t);default:{let t=e.type;return`${j.yellow}⚠ Diff not available for task type: ${t}${j.reset}`}}}catch(e){return`${j.red}✗ Error generating diff: ${e instanceof Error?e.message:String(e)}${j.reset}`}}async function F(e,t){console.log(`${j.blue}═══════════════════════════════════════════════════════${j.reset}`),console.log(`${j.blue} DRY RUN - Preview of changes${j.reset}`),console.log(`${j.blue}═══════════════════════════════════════════════════════${j.reset}`);for(let n of e){console.log(`${j.cyan}▶ Task: ${n.name}${j.reset}`),n.description!=null&&n.description!==``&&console.log(`${j.gray} ${n.description}${j.reset}`);let e=await De(n,t);console.log(e),console.log(`${j.gray}${`─`.repeat(55)}${j.reset}`)}console.log(`${j.blue}═══════════════════════════════════════════════════════${j.reset}`),console.log(`${j.yellow} No changes were applied (dry-run mode)${j.reset}`),console.log(`${j.blue}═══════════════════════════════════════════════════════${j.reset}`)}const I=new Map,L={},R=new Map;function z(e){if(e.name==null||e.name===``)throw TypeError(`Plugin name is required`);if(!Array.isArray(e.taskTypes)||e.taskTypes.length===0)throw TypeError(`Plugin ${e.name} must define at least one task type`);if(typeof e.execute!=`function`)throw TypeError(`Plugin ${e.name} must provide an execute function`);if(I.has(e.name))throw TypeError(`Plugin ${e.name} is already registered`);for(let t of e.taskTypes)if(R.has(t)){let e=R.get(t);throw TypeError(`Task type "${t}" is already registered by plugin "${e}"`)}I.set(e.name,e);for(let t of e.taskTypes)R.set(t,e.name);p(`Registered plugin: ${e.name}${e.version==null?``:` v${e.version}`}`)}function Oe(e){let t=I.get(e);if(t!=null){for(let e of t.taskTypes)R.delete(e);I.delete(e)}}function ke(e){return I.get(e)}function B(e){let t=R.get(e);if(t!=null)return I.get(t)}function V(e){return R.has(e)}function Ae(){return Array.from(I.keys())}function je(){I.clear(),R.clear()}function Me(e){e.beforeAll!=null&&(L.beforeAll=e.beforeAll),e.afterAll!=null&&(L.afterAll=e.afterAll),e.beforeTask!=null&&(L.beforeTask=e.beforeTask),e.afterTask!=null&&(L.afterTask=e.afterTask),e.onError!=null&&(L.onError=e.onError)}async function H(e,...t){let n=L[e];if(n!=null)try{e===`beforeAll`||e===`afterAll`?await n(t[0]):(e===`beforeTask`||e===`afterTask`||e===`onError`)&&await n(t[0],t[1])}catch(t){f(`Error in ${e} hook: ${t instanceof Error?t.message:String(t)}`,`error`)}}async function Ne(e,t,n){let r=B(e.type);if(r==null)throw TypeError(`No plugin found for task type: ${e.type}`);await r.execute(e,t,n)}async function Pe(e,t){let n=B(e.type);if(!(n==null||n.getDiff==null))return n.getDiff(e,t)}function Fe(e){let t=B(e.type);return t==null?[`No plugin found for task type: ${e.type}`]:t.validate==null?[]:t.validate(e)}function Ie(e,t,n,r){return{name:e,...r?.version!=null&&{version:r.version},taskTypes:[t],execute:n,...r?.getDiff!=null&&{getDiff:r.getDiff},...r?.validate!=null&&{validate:r.validate}}}const U=new class{transformers=new Map;constructor(){this.registerBuiltInTransformers()}registerBuiltInTransformers(){for(let e of[{id:`lowercase`,type:`lowercase`},{id:`uppercase`,type:`uppercase`},{id:`trim`,type:`trim`},{id:`slugify`,type:`slugify`},{id:`capitalize`,type:`capitalize`},{id:`titlecase`,type:`titlecase`},{id:`camelcase`,type:`camelcase`},{id:`pascalcase`,type:`pascalcase`},{id:`snakecase`,type:`snakecase`},{id:`kebabcase`,type:`kebabcase`},{id:`constantcase`,type:`constantcase`},{id:`alphanumeric`,type:`alphanumeric`},{id:`collapse-spaces`,type:`collapse-spaces`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&f(`Transformer with id "${e.id}" is already registered. Overwriting.`,`warn`),this.transformers.set(e.id,e)}registerAll(e){for(let t of e)this.register(t)}get(e){return this.transformers.get(e)}has(e){return this.transformers.has(e)}async execute(e,t,n={}){let r=this.transformers.get(e);if(!r)throw T.notFound(e);try{return await this.executeTransformer(r,t,n)}catch(t){throw t instanceof T?t:T.executionFailed(e,t instanceof Error?t.message:String(t))}}async executeChain(e,t,n={}){let r=t;for(let t of e)r=await this.execute(t,r,n);return r}async apply(e,t,n={}){return e===void 0?t:this.executeChain(e,t,n)}validate(e){if(e===void 0)return[];let t=e,n=[];for(let e of t)this.has(e)||n.push(`Transformer "${e}" not found`);return n}async executeTransformer(e,t,n){switch(e.type){case`regex`:return this.executeRegex(e,t);case`computed`:return this.executeComputed(e,t,n);case`lowercase`:return this.executeLowercase(t);case`uppercase`:return this.executeUppercase(t);case`trim`:return this.executeTrim(t);case`slugify`:return this.executeSlugify(t);case`capitalize`:return this.executeCapitalize(t);case`titlecase`:return this.executeTitlecase(t);case`camelcase`:return this.executeCamelcase(t);case`pascalcase`:return this.executePascalcase(t);case`snakecase`:return this.executeSnakecase(t);case`kebabcase`:return this.executeKebabcase(t);case`constantcase`:return this.executeConstantcase(t);case`alphanumeric`:return this.executeAlphanumeric(t);case`collapse-spaces`:return this.executeCollapseSpaces(t);case`remove-spaces`:return this.executeRemoveSpaces(t);case`urlencode`:return this.executeUrlencode(t);case`dasherize`:return this.executeDasherize(t);case`underscore`:return this.executeUnderscore(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw T.invalidType(t.id,t.type)}}}executeRegex(e,t){let n=String(t),{pattern:r,flags:i,replacement:a}=e.config;try{let e=new RegExp(r,i);return n.replace(e,a)}catch(t){throw T.executionFailed(e.id,`Invalid regex pattern: ${t instanceof Error?t.message:String(t)}`)}}executeComputed(e,t,n){let{expression:r}=e.config;try{return Function(`value`,`context`,...Object.keys(n),`return ${r}`)(t,n,...Object.values(n))}catch(t){throw T.executionFailed(e.id,`Expression evaluation failed: ${t instanceof Error?t.message:String(t)}`)}}executeLowercase(e){return ce(String(e))}executeUppercase(e){return de(String(e))}executeTrim(e){return String(e).trim()}executeSlugify(e){return String(e).toLowerCase().trim().replace(/[\s_]+/gu,`-`).replace(/[^\w-]+/gu,``).replace(/-{2,}/gu,`-`).replace(/^-+/u,``).replace(/-+$/u,``)}async executeCustom(e,t,n){let{handler:r}=e.config;if(typeof r==`function`)return r(t,n);throw T.executionFailed(e.id,`String-based custom handlers are not yet supported. Please use function handlers.`)}async executeChainTransformer(e,t,n){let{transformers:r}=e.config;if(r.length===0)throw T.executionFailed(e.id,`Chain transformer must have at least one transformer`);return this.executeChain(r,t,n)}executeCapitalize(e){return ae(String(e))}executeTitlecase(e){return ae(String(e))}executeCamelcase(e){return ie(String(e))}executePascalcase(e){return le(String(e))}executeSnakecase(e){return ue(String(e))}executeKebabcase(e){return se(String(e))}executeConstantcase(e){return oe(String(e))}executeAlphanumeric(e){return String(e).replace(/[^a-zA-Z0-9]/gu,``)}executeCollapseSpaces(e){return String(e).replace(/\s+/gu,` `)}executeRemoveSpaces(e){return String(e).replace(/\s/gu,``)}executeUrlencode(e){return encodeURIComponent(String(e))}executeDasherize(e){return se(String(e))}executeUnderscore(e){return ue(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};function Le(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function Re(e){return e===void 0||typeof e==`boolean`?e:typeof e==`string`?{type:`condition`,value:e}:typeof e==`object`&&e&&`condition`in e&&!(`type`in e)?{type:`condition`,value:e.condition}:e}async function W(e,t){let n=Re(e);if(n===void 0)return!0;if(typeof n==`boolean`)return n;if(typeof n==`object`&&n&&`type`in n){if(n.type===`exec`)try{let{execSync:e}=await import(`node:child_process`),{interpolateTemplate:r}=await import(`./utils-Bj8gkhe3.js`);return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await import(`./utils-Bj8gkhe3.js`);if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let{status:r}=e;if(r>=1&&r<=255)return t(`Failed to execute required command: ${n.value}`,`warn`),e instanceof Error&&t(` Error: ${e.message}`,`warn`),!1}return t(`Failed to execute required command: ${n.value}`,`warn`),e instanceof Error&&t(` Error: ${e.message}`,`warn`),!1}if(n.type===`condition`)return Le(n.value,t)}return!0}async function G(e,t,n,r){if(e!==void 0)return d(e,{id:t,contextType:`Prompt`,...n!=null&&{context:n},...r?.$sourceUrl!=null&&{sourceUrl:r.$sourceUrl}})}async function K(e,t=new Map,n={}){let r={};if(e.length===0)return r;for(let a of e){if(a.$templateEnabled!=null&&!await i(a.$templateEnabled,{...n,...r}))continue;let e={...n,...r};if(await i(a.enabled,e))try{let n,i=t.get(a.id);switch(a.default!==void 0&&(i=await G(a.default,a.id,e,a)),a.type){case`input`:{let t={message:a.message};i!==void 0&&(t.default=String(i));let r=await W(a.required,e);if(r!==void 0&&(t.required=r),n=await te(t),r&&(n==null||typeof n==`string`&&n.trim()===``))throw f(`${a.message} is required`,`error`),C.required(a.id);break}case`password`:if(n=await ne({message:a.message,mask:`*`}),await W(a.required,e)&&(n==null||typeof n==`string`&&n.trim()===``))throw f(`${a.message} is required`,`error`),C.required(a.id);break;case`number`:{let t={message:a.message};i!==void 0&&(t.default=Number(i));let r=await W(a.required,e);if(r!==void 0&&(t.required=r),a.min!==void 0&&(t.min=a.min),a.max!==void 0&&(t.max=a.max),n=await S(t),r&&n==null)throw f(`${a.message} is required`,`error`),C.required(a.id);break}case`select`:{let e={message:a.message,choices:a.choices.map(e=>({name:e.name,value:e.value}))};i!==void 0&&(e.default=i),n=await re(e);break}case`confirm`:{let e=i===void 0?!1:!!i;n=await x({message:a.message,default:e});break}default:throw f(`Unknown prompt type: ${a.type}`,`error`),C.unknownType(a.type)}a.transformers!==void 0&&(n=await U.apply(a.transformers,n,{...e,...r})),r[a.id]=n}catch(e){throw e instanceof Error&&f(`Failed to collect prompt "${a.id}": ${e.message}`,`error`),e}}return r}async function q(e,t){let n=new Map,r=e.map(async e=>{if(e.default!==void 0){let r=await G(e.default,e.id,t,e);r!==void 0&&n.set(e.id,r)}});return await Promise.all(r),n}function J(e){let t=[],n=new Set;for(let r of e){if(n.has(r.id)&&t.push(`Duplicate prompt ID: ${r.id}`),n.add(r.id),/^[a-zA-Z_$][a-zA-Z0-9_$]*$/u.test(r.id)||t.push(`Invalid prompt ID "${r.id}": must be a valid JavaScript identifier (start with letter, underscore, or $, followed by letters, digits, underscores, or $)`),(!r.message||r.message.trim()===``)&&t.push(`Prompt "${r.id}" must have a non-empty message`),r.type===`select`){r.choices.length===0&&t.push(`Select prompt "${r.id}" must have at least one choice`);for(let e of r.choices)(!e.name||e.name.trim()===``)&&t.push(`Select prompt "${r.id}" has a choice with empty name`),e.value===void 0&&t.push(`Select prompt "${r.id}" has a choice with undefined value`)}r.type===`number`&&r.min!==void 0&&r.max!==void 0&&r.min>r.max&&t.push(`Number prompt "${r.id}" has min greater than max`)}return t}const ze=y(_.appendFile),Be=y(_.readFile),Ve=y(_.stat);async function He(e,t,n){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping append task`,`info`);return}let r=g.join(v.cwd(),e.file),i={};e.content==null?e.template!=null&&(i.template=e.template):i.template=e.content,e.templateFile!=null&&(i.templateFile=e.templateFile);let o=O(i);if(!o.isValid)throw o.error?.includes(`cannot have both`)?w.templateHasBothTemplateAndFile():w.templateMissingTemplateOrFile();let s=await k(i,t,n),c=!1,l=!1;try{await Ve(r),c=!0;let t=await Be(r,`utf-8`);t.length>0&&!t.endsWith(`
|
|
23
|
+
`)&&(l=e.newline!==!1)}catch{}c&&l?await ze(r,`\n${s}`):await ze(r,s),f(`Appended content to ${e.file}`,`success`)}const Ue={name:`append`,version:`1.0.0`,taskTypes:[`append`],execute:async(e,t,n)=>{n.dryRun||await He(e.config,t,e)}},We=y(_.copyFile),Ge=y(_.stat),Ke=y(_.mkdir),qe=y(_.readdir);async function Je(e,t){await Ke(t,{recursive:!0});let n=await qe(e,{withFileTypes:!0});await Promise.all(n.map(async n=>{let r=g.join(e,n.name),i=g.join(t,n.name);n.isDirectory()?await Je(r,i):await We(r,i)}))}async function Ye(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping copy task`,`info`);return}let n=g.join(v.cwd(),e.from),r=g.join(v.cwd(),e.to),i;try{i=await Ge(n)}catch{f(`Source path does not exist: ${n}`,`warn`);return}await Ke(g.dirname(r),{recursive:!0}),i.isDirectory()?(await Je(n,r),f(`Copied directory ${e.from} to ${e.to}`,`success`)):(await We(n,r),f(`Copied file ${e.from} to ${e.to}`,`success`))}const Xe={name:`copy`,version:`1.0.0`,taskTypes:[`copy`],execute:async(e,t,n)=>{n.dryRun||await Ye(e.config,t)}},Ze=y(_.writeFile);async function Qe(e,t,n){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping create task`,`info`);return}let r=g.join(v.cwd(),e.file);if(_.existsSync(r)){f(`File already exists, skipping: ${e.file}`,`info`);return}let i=O(e);if(!i.isValid)throw i.error?.includes(`cannot have both`)?w.createHasBothTemplateAndFile():w.createMissingTemplateOrFile();let o=await k(e,t,n),s=g.dirname(r);_.existsSync(s)||_.mkdirSync(s,{recursive:!0}),await Ze(r,o),f(`Created file: ${e.file}`,`success`)}const $e={name:`create`,version:`1.0.0`,taskTypes:[`create`],execute:async(e,t,n)=>{n.dryRun||await Qe(e.config,t,e)}};async function et(e,t){let{paths:n,condition:r}=e;if(r!=null&&r!==``){if(!t){f(`Condition specified but no config provided, skipping deletion`,`warn`);return}if(!a(r,t)){f(`Condition not met, skipping deletion`,`info`);return}}for(let e of n){let t=g.join(v.cwd(),e);_.existsSync(t)&&_.rmSync(t,{recursive:!0,force:!0})}}const tt={name:`delete`,version:`1.0.0`,taskTypes:[`delete`],execute:async(e,t,n)=>{n.dryRun||await et(e.config,t)}};async function nt(e,t,n){e.condition!=null&&e.condition!==``&&!a(e.condition,t)||await l({file:e.file,...e.runtime&&{runtime:e.runtime},...e.args&&{args:e.args},...e.parameters&&{parameters:e.parameters},...e.cwd!=null&&e.cwd.trim()!==``&&{cwd:e.cwd},...n?.$sourceUrl!=null&&n.$sourceUrl.trim()!==``&&{sourceUrl:n.$sourceUrl},captureOutput:!1},t)}const rt={name:`exec-file`,version:`1.0.0`,taskTypes:[`exec-file`],execute:async(e,t,n)=>{n.dryRun||await nt(e.config,t,e)}};async function it(e,t){if(e.condition!=null&&e.condition!==``){if(!t){f(`Condition specified but no config provided, skipping exec`,`warn`);return}if(!a(e.condition,t)){f(`Condition not met, skipping exec task`,`info`);return}}let n=e.cwd==null?v.cwd():g.join(v.cwd(),e.cwd);b(e.command,{cwd:n,stdio:`inherit`})}const at={name:`exec`,version:`1.0.0`,taskTypes:[`exec`],execute:async(e,t,n)=>{n.dryRun||await it(e.config,t)}};async function ot(e,t){if(e.condition!=null&&e.condition!==``){if(!t){f(`Condition specified but no config provided, skipping git-init`,`warn`);return}if(!a(e.condition,t)){f(`Condition not met, skipping git-init task`,`info`);return}}if(e.removeExisting){let e=g.join(v.cwd(),`.git`);_.existsSync(e)&&_.rmSync(e,{recursive:!0,force:!0})}if(b(`git init`,{stdio:`inherit`}),e.initialCommit){let t=e.message??`Initial commit`;b(`git add .`,{stdio:`inherit`}),b(`git commit -m "${t}"`,{stdio:`inherit`})}}const st={name:`git-init`,version:`1.0.0`,taskTypes:[`git-init`],execute:async(e,t,n)=>{n.dryRun||await ot(e.config,t)}},ct=y(_.mkdir);async function lt(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping mkdir task`,`info`);return}await ct(g.join(v.cwd(),e.path),{recursive:!0}),f(`Created directory: ${e.path}`,`success`)}const ut={name:`mkdir`,version:`1.0.0`,taskTypes:[`mkdir`],execute:async(e,t,n)=>{n.dryRun||await lt(e.config,t)}},dt=y(_.rename),ft=y(_.stat),pt=y(_.mkdir);async function mt(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping move task`,`info`);return}let n=g.join(v.cwd(),e.from),r=g.join(v.cwd(),e.to);try{await ft(n)}catch{f(`Source path does not exist: ${n}`,`warn`);return}await pt(g.dirname(r),{recursive:!0}),await dt(n,r),f(`Moved ${e.from} to ${e.to}`,`success`)}const ht={name:`move`,version:`1.0.0`,taskTypes:[`move`],execute:async(e,t,n)=>{n.dryRun||await mt(e.config,t)}},gt=y(_.readFile),_t=y(_.writeFile);async function vt(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping regex-replace task`,`info`);return}let n=g.join(v.cwd(),e.file),{pattern:r}=e,i=e.flags??``,o=e.replacement||``,s=await gt(n,`utf-8`),l=new RegExp(r,i);s=s.replace(l,c(o,t)),await _t(n,s)}const yt={name:`regex-replace`,version:`1.0.0`,taskTypes:[`regex-replace`],execute:async(e,t,n)=>{n.dryRun||await vt(e.config,t)}},bt=y(_.rename);async function xt(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping rename task`,`info`);return}let n=g.join(v.cwd(),c(e.from,t)),r=g.join(v.cwd(),c(e.to,t));if(!_.existsSync(n)){f(`Source path does not exist: ${n}`,`warn`);return}await bt(n,r)}const St={name:`rename`,version:`1.0.0`,taskTypes:[`rename`],execute:async(e,t,n)=>{n.dryRun||await xt(e.config,t)}},Ct=y(_.readFile),wt=y(_.writeFile);async function Tt(e,t){if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping replace-in-file task`,`info`);return}let n=g.join(v.cwd(),e.file),{replacements:r}=e;if(!_.existsSync(n)){f(`File not found: ${n}, skipping`,`warn`);return}let i=await Ct(n,`utf-8`);for(let{find:e,replace:n}of r){let r=c(n,t);i=i.replace(new RegExp(e,`gu`),r)}await wt(n,i)}const Et={name:`replace-in-file`,version:`1.0.0`,taskTypes:[`replace-in-file`],execute:async(e,t,n)=>{n.dryRun||await Tt(e.config,t)}},Dt=y(_.readFile),Ot=y(_.writeFile);async function kt(e,n){if(e.condition!=null&&e.condition!==``&&!a(e.condition,n)){f(`Condition not met, skipping update-json task`,`info`);return}let r=g.join(v.cwd(),e.file),{updates:i}=e,o=await Dt(r,`utf-8`),s=JSON.parse(o);function l(e){if(typeof e==`string`)return c(e,n);if(Array.isArray(e))return e.map(e=>l(e));if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=l(r);return t}return e}for(let[e,n]of Object.entries(i)){let r=l(n);e.includes(`.`)?t(s,e,r):s[e]=r}await Ot(r,`${JSON.stringify(s,null,2)}\n`)}const At={name:`update-json`,version:`1.0.0`,taskTypes:[`update-json`],execute:async(e,t,n)=>{n.dryRun||await kt(e.config,t)}},jt=y(_.writeFile);async function Mt(e,t,n){let{allowCreate:r=!0}=e;if(e.condition!=null&&e.condition!==``&&!a(e.condition,t)){f(`Condition not met, skipping write task`,`info`);return}let i=g.join(v.cwd(),e.file);if(!_.existsSync(i)){if(r===!1)throw Error(`Write task failed: file does not exist (${e.file})`);f(`File not found, creating new file: ${e.file}`,`info`)}let o=O(e);if(!o.isValid)throw o.error?.includes(`cannot have both`)?w.templateHasBothTemplateAndFile():w.templateMissingTemplateOrFile();let s=await k(e,t,n),c=g.dirname(i);_.existsSync(c)||_.mkdirSync(c,{recursive:!0}),await jt(i,s)}const Nt={name:`write`,version:`1.0.0`,taskTypes:[`write`],execute:async(e,t,n)=>{n.dryRun||await Mt(e.config,t,e)}};function Y(){V(`update-json`)||(z(At),z(Nt),z($e),z(yt),z(Et),z(tt),z(St),z(st),z(at),z(rt),z(ht),z(Xe),z(Ue),z(ut))}async function Pt(e,t,n=!1){if(Y(),n){f(`[DRY RUN] Would execute: ${e.name}`,`info`);return}if(V(e.type)){await Ne(e,t,{dryRun:n});return}throw TypeError(`Unknown task type: ${e.type}`)}async function Ft(e,t,n,r,i=!1){try{return f(`[${n}/${r}] Running: ${e.name}...`,`info`),await Pt(e,t,i),f(`[${n}/${r}] Completed: ${e.name}...`,`success`),!0}catch(t){return f(`Failed: ${e.name}`,`error`),t instanceof Error&&(f(` Reason: ${t.message}`,`error`),t.stack!=null&&v.env.DEBUG!=null&&console.error(t.stack)),!1}}function X(e){let t=[],n=new Set,r=new Set,i=new Map(e.map(e=>[e.id,e]));function a(e){if(n.has(e))return;if(r.has(e))throw m.forTaskDependency(e);r.add(e);let o=i.get(e);if(!o)throw fe.forId(e);if(o.dependencies)for(let e of o.dependencies)a(e);r.delete(e),n.add(e),t.push(o)}for(let t of e)n.has(t.id)||a(t.id);return t}function It(e){let t=[];for(let n of e)if(!V(n.type))t.push(`Task "${n.id}" (${n.name}): Unknown task type "${n.type}"`);else if(n.type===`write`){let e=Lt(n);t.push(...e)}return t}function Lt(e){let t=[],n=e.config,r=typeof n.template==`string`?n.template:void 0,i=typeof n.templateFile==`string`?n.templateFile:void 0,a=O({...r!==void 0&&{template:r},...i!==void 0&&{templateFile:i}});return!a.isValid&&a.error!=null&&a.error!==``&&t.push(`Task "${e.id}" (${e.name}): ${a.error}`),(n.file==null||n.file===``)&&t.push(`Task "${e.id}" (${e.name}): Write task requires "file" property to specify the output file path`),t}function Rt(e){f(`❌ Template validation failed:`,`error`),f(``,`error`);for(let t of e)f(` • ${t}`,`error`);f(``,`error`),f(`Please fix these errors before continuing.`,`error`)}async function Z(e,t=new Map,n={}){let r={};for(let i of e){let e=t.get(i.id);e!==void 0&&(i.transformers!==void 0&&(e=await U.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}async function Q(e,t,n){let r=new Map;for(let a of e){if(n?.skipConditional===!0&&typeof a.value==`object`&&a.value!==null&&!Array.isArray(a.value)&&a.value.type===`conditional`)continue;if(a.$templateEnabled!=null){let e={...t};for(let[t,n]of r.entries())e[t]=n;if(!await i(a.$templateEnabled,e))continue}let e={...t};for(let[t,n]of r.entries())e[t]=n;let o=await d(a.value,{id:a.id,contextType:`Variable`,context:e,...a.$sourceUrl!=null&&{sourceUrl:a.$sourceUrl}});o!==void 0&&r.set(a.id,o)}return r}async function zt(e,t,n,r){if(e==null)return;if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e;if(i.type===`conditional`){if(!n){f(`Variable "${t}": conditional value requires context but none provided`,`warn`);return}if(typeof i.condition!=`string`){f(`Variable "${t}": conditional value must have a string condition`,`error`);return}try{let{evaluateCondition:e}=await import(`./utils-Bj8gkhe3.js`),a=e(i.condition,n)?i.ifTrue:i.ifFalse;return typeof a==`object`&&a?await zt(a,t,n,r):a}catch(e){f(`Variable "${t}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(i.type===`exec`){let e=i.value;if(typeof e!=`string`){f(`Variable "${t}": exec value must have a string command`,`error`);return}try{let t=b(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{return JSON.parse(t)}catch{return t}if(/^-?\d+(?:\.\d+)?$/u.test(t)){let e=Number.parseFloat(t);if(!Number.isNaN(e))return e}return t===`true`||t===`false`?t===`true`:t}catch(e){f(`Variable "${t}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}else if(i.type===`static`)return i.value;else if(i.type===`interpolate`){let e=i.value;if(typeof e!=`string`){f(`Variable "${t}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!n)return f(`Variable "${t}": interpolate value requires context but none provided`,`warn`),e;try{return c(e,n)}catch(n){return f(`Variable "${t}": failed to interpolate interpolate value: ${n instanceof Error?n.message:`Unknown error`}`,`warn`),e}}else if(i.type===`exec-file`){if(!n){f(`Variable "${t}": exec-file value requires context but none provided`,`warn`);return}let e=i;if(typeof e.file!=`string`){f(`Variable "${t}": exec-file value must have a file path`,`error`);return}try{let t=await l({file:e.file,...e.runtime!=null&&e.runtime.trim()!==``&&{runtime:e.runtime},...e.args&&{args:e.args},...e.parameters&&{parameters:e.parameters},...e.cwd!==void 0&&e.cwd.trim()!==``&&{cwd:e.cwd},...r!=null&&{sourceUrl:r},captureOutput:!0},n);if(t===void 0)return;let i=t.trim();if(i.startsWith(`{`)||i.startsWith(`[`))try{return JSON.parse(i)}catch{return i}if(/^-?\d+(?:\.\d+)?$/u.test(i)){let e=Number.parseFloat(i);if(!Number.isNaN(e))return e}return i===`true`||i===`false`?i===`true`:i}catch(e){f(`Variable "${t}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}else if(i.type!==void 0){f(`Variable "${t}": unknown value type "${i.type}". Expected "static", "exec", "conditional", "interpolate", or "exec-file".`,`error`);return}return e}function $(e){let t=[],n=new Set;for(let r of e)n.has(r.id)&&t.push(`Duplicate variable ID: "${r.id}"`),n.add(r.id);return t}async function Bt(t,r){let a=e();if(!await i(r.templateEnabled,a,{lazy:!0})){h(`⊘ Template is disabled - skipping all execution`);return}r.transformers!==void 0&&r.transformers.length>0&&(p(`Registering ${r.transformers.length} transformer(s)...`),U.registerAll(r.transformers)),p(`Registering built-in plugins...`),Y(),p(`Validating task configurations...`);let s=It(t);s.length>0&&(Rt(s),v.exit(1)),p(`All tasks validated successfully`);let c=t.filter(t=>o(t.enabled,e(),{lazy:!0}));p(`Resolving task dependencies...`);let l=X(c);p(`Sorted ${l.length} task(s) by dependencies`),h(`Welcome! Let's execute your tasks.`),r.dryRun&&n(`🔍 DRY RUN MODE - No changes will be made`),h(`This will execute your project tasks based on the defined configuration.`);let u=a,d=[...r.variables??[]];if(d.length>0){let e=$(d);e.length>0&&(f(`❌ Variable validation errors:`,`error`),e.forEach(e=>f(` - ${e}`,`error`)),v.exit(1)),p(`Resolving variable values...`);let t=await Z(d,await Q(d,u,{skipConditional:!0}),u);Object.assign(u,t),Object.keys(t).length>0&&(p(`Resolved ${Object.keys(t).length} variable(s)`),p(`Variable values: ${JSON.stringify(t)}`))}let m=r.prompts??[],g=[...m];if(g.length>0){let e=J(g);e.length>0&&(f(`❌ Prompt validation errors:`,`error`),e.forEach(e=>f(` - ${e}`,`error`)),v.exit(1)),p(`Resolving prompt default values...`);let t=await q(g,u);if(m.length>0){h(`📋 Collecting prompts (available to all tasks):`);let e=await K(m,t,u);Object.assign(u,e)}}if(d.length>0){let e=d.filter(e=>typeof e.value==`object`&&e.value!==null&&!Array.isArray(e.value)?e.value.type===`conditional`:!1);if(e.length>0){p(`Re-resolving conditional variables with prompt values...`);let t=await Z(e,await Q(e,u),u);Object.assign(u,t),Object.keys(t).length>0&&p(`Resolved ${Object.keys(t).length} conditional variable(s)`)}}if(!await i(r.templateEnabled,u)){h(`⊘ Template is disabled after variable resolution - skipping all execution`);return}let _=[];for(let e of l)e.$templateEnabled!=null&&!await i(e.$templateEnabled,u)||await i(e.enabled,u)&&_.push(e);if(f(`${_.length} of ${l.length} task(s) enabled for execution`,`info`),r.dryRun){await F(_,u),h(`🔍 Dry run completed - no changes were made`),h(`Run without --dry-run to apply changes`);return}p(`Calling beforeAll hook...`),await H(`beforeAll`,u);let y=_.length,b=0,x=0,te=[],S=[];for(let e=0;e<_.length;e++){let t=_[e];t!=null&&(p(`Calling beforeTask hook for task: ${t.name}`),await H(`beforeTask`,t,u),await Ft(t,u,e+1,y,r.dryRun)?(b++,te.push(t.id),p(`Calling afterTask hook for task: ${t.name}`),await H(`afterTask`,t,u)):(await W(t.required,u)&&(x++,S.push(t.name)),p(`Calling onError hook for task: ${t.name}`),await H(`onError`,Error(`Task ${t.name} failed`),t),n(`⚠️ Task "${t.name}" failed, continuing with remaining tasks...`)))}x>0&&(f(`\n❌ Task execution completed with ${x} error(s)`,`error`),f(`Completed: ${b}/${y} tasks`,`info`),f(`Failed tasks: ${S.join(`, `)}`,`error`),v.exit(1)),p(`Calling afterAll hook...`),await H(`afterAll`,u),ee(`✅ All tasks completed successfully!`),ee(` Completed: ${b}/${y} tasks`)}async function Vt(e,t,r={}){p(`Running templates with sequential variable/prompt resolution...`),p(`Total templates to process: ${e.length}`),p(`Registering built-in plugins...`),Y();let a=[];console.log(``),h(`📋 Collecting input...`),console.log(``);for(let t=0;t<e.length;t++){let n=e[t];if(n==null)continue;let o=`=`.repeat(60);if(p(`\n${o}`),p(`Processing template ${t+1}/${e.length}: "${n.name}"`),p(o),p(`Current config keys: ${Object.keys(r).join(`, `)}`),!await i(n.enabled,r)){h(`⊘ Template "${n.name}" is disabled - skipping`),p(` Enabled condition: ${JSON.stringify(n.enabled)}`);continue}let s=n.variables??[];if(s.length>0){p(`Processing ${s.length} variable(s) for template "${n.name}"...`);let e=$(s);e.length>0&&(f(`❌ Variable validation errors:`,`error`),e.forEach(e=>f(` - ${e}`,`error`)),v.exit(1));let t=await Z(s,await Q(s,r,{skipConditional:!0}),r);Object.assign(r,t);let i=s.filter(e=>typeof e.value==`object`&&e.value!==null&&!Array.isArray(e.value)?e.value.type===`conditional`:!1),a=0;if(i.length>0){let e=await Z(i,await Q(i,r),r);if(a=Object.keys(e).length,Object.assign(r,e),a>0){p(`Resolved ${a} conditional variable(s)`);for(let[t,n]of Object.entries(e))p(` ${t} = ${JSON.stringify(n)}`)}}let o=Object.keys(t).length+a;if(o>0){p(`Total variables resolved for template: ${o}`);for(let[e,n]of Object.entries(t))p(` ${e} = ${JSON.stringify(n)}`)}}let c=n.prompts??[];if(c.length>0){p(`Processing ${c.length} prompt(s) for template "${n.name}"...`);let e=J(c);e.length>0&&(f(`❌ Prompt validation errors:`,`error`),e.forEach(e=>f(` - ${e}`,`error`)),v.exit(1));let t=await K(c,await q(c,r),r);Object.assign(r,t),p(`Collected ${Object.keys(t).length} prompt answer(s)`)}if(!await i(n.enabled,r)){h(`⊘ Template "${n.name}" became disabled after variable/prompt resolution - skipping tasks`);continue}let l=n.tasks??[];l.length>0&&(p(`Found ${l.length} task(s) in template "${n.name}" (will execute later)`),a.push(...l))}if(p(`
|
|
24
|
+
🔧 Validating and filtering all collected tasks...`),a.length===0){f(`No tasks found in any template`,`info`);return}let o=It(a);o.length>0&&(Rt(o),v.exit(1)),console.log(``),f(`🛠️ Preparing tasks...`,`info`);let s=[];for(let e of a)await i(e.enabled,r)&&s.push(e);if(console.log(``),f(`Found ${a.length} tasks (${s.length} enabled)`,`info`),f(`All tasks validated successfully`,`success`),s.length===0){f(`No enabled tasks to execute`,`info`);return}let c=X(s);if(t.dryRun){f(`
|
|
25
|
+
🔍 Dry run - showing task changes...`,`info`),await F(c,r),f(`
|
|
26
|
+
🔍 Dry run completed - no changes were made`,`info`),f(`Run without --dry-run to apply changes`,`info`);return}console.log(``),h(`⚙️ Executing tasks...`),console.log(``),await H(`beforeAll`,r);let l=0,u=0,d=[];for(let e=0;e<c.length;e++){let i=c[e];i!=null&&(await H(`beforeTask`,i,r),await Ft(i,r,e+1,c.length,t.dryRun)?(l++,await H(`afterTask`,i,r)):(await W(i.required,r)&&(u++,d.push(i.name)),await H(`onError`,Error(`Task ${i.name} failed`),i),n(`⚠️ Task "${i.name}" failed, continuing with remaining tasks...`)))}await H(`afterAll`,r),u>0&&(f(`\n❌ Task execution completed with ${u} error(s)`,`error`),f(`Completed: ${l}/${c.length} tasks`,`info`),f(`Failed tasks: ${d.join(`, `)}`,`error`),v.exit(1)),f(`Completed: ${l}/${c.length} tasks`,`success`)}export{be as A,E as B,Ae as C,Fe as D,Oe as E,ye as F,k as H,De as I,he as L,Se as M,ve as N,F as O,xe as P,ge as R,V as S,z as T,pe as U,D as V,O as W,Ie as _,Q as a,B as b,Pt as c,J as d,q as f,je as g,H as h,zt as i,P as j,_e as k,Y as l,G as m,Vt as n,Z as o,K as p,$ as r,X as s,Bt as t,Ft as u,Ne as v,Me as w,Pe as x,ke as y,me as z};
|