@pixpilot/scaffoldfy 0.38.0 → 0.40.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 CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- const e=require(`./chunk-DjWAcSYV.cjs`),t=require(`./config-inheritance-CtSb5haE.cjs`);require(`./run-tasks-CgFJyU4i.cjs`),require(`./config-CQ-mWBG5.cjs`),require(`./validate-scaffoldfy-json-Dkaz9ueq.cjs`),require(`./scaffoldfy-config-json-validator-CpEXHRsI.cjs`);const n=require(`./src-B0yHfPGS.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.O(`❌ Schema validation error:`,`error`),t.O(` ${r}`,`error`)),{valid:!1,errors:[r]}}}function g(e){t.O(`❌ Schema validation failed:`,`error`),t.O(``,`error`),t.O(`The following validation errors were found:`,`error`),t.O(``,`error`);for(let n of e)t.O(` • ${n}`,`error`);t.O(``,`error`),t.O(`Please fix these errors in your template configuration file.`,`error`),t.O(``,`error`),t.O(`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)`,`./scaffoldfy.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.v(!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.O(`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.O(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),t.O(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(n){t.O(`Failed to load TypeScript config file: ${e.config}`,`error`),n instanceof Error&&t.O(` Error: ${n.message}`,`error`),a.default.exit(1)}}else try{if(e.validate!==!1){t.g(`Validating task configuration against schema...`);let e=r.default.readFileSync(n,`utf-8`);h(JSON.parse(e),{silent:!1}).valid||(t.O(``,`error`),t.O(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),a.default.exit(1)),t.O(`Configuration validated`,`success`)}let i=await t.a(n,{sequential:!0});if(i.templates!=null&&i.templates.length>0){let{runTemplatesSequentially:t}=await Promise.resolve().then(()=>require(`./run-tasks-BOQ90AJk.cjs`)),{createInitialConfig:r}=await Promise.resolve().then(()=>require(`./config-DZmWkoaW.cjs`));await t(i.templates,{dryRun:e.dryRun??!1,force:e.force??!1,configFilePath: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.O(`❌ Invalid config file format`,`error`),t.O(`Expected JSON with { "tasks": [...] } structure`,`info`),a.default.exit(1))}catch(n){t.O(`Failed to load JSON config file: ${e.config}`,`error`),n instanceof Error&&t.O(` Error: ${n.message}`,`error`),a.default.exit(1)}else t.O(`Config file not found: ${e.config}`,`warn`)}let f=c!=null&&c.length>0||s!=null&&s.length>0;o.length===0&&!f&&(t.O(`❌ No tasks defined`,`error`),t.O(`Please provide tasks using one of these methods:`,`info`),t.O(` 1. Create a template-tasks.json file in the current directory`,`info`),t.O(` 2. Create a template-tasks.ts file in the current directory`,`info`),t.O(` 3. Use --config option to specify a different config file`,`info`),t.O(`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.O(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):t.O(`Loaded ${o.length} task(s)`,`success`),await n.t(o,{dryRun:e.dryRun,force:e.force,configFilePath:d,variables:s,prompts:c,configEnabled:l,transformers:u})}catch(e){if(t.O(`❌ CLI execution failed`,`error`),e instanceof Error){t.O(`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);
2
+ const e=require(`./chunk-DjWAcSYV.cjs`),t=require(`./configurations-KSynsxPT.cjs`);require(`./run-tasks-CwrcjBpP.cjs`),require(`./config-CQ-mWBG5.cjs`),require(`./validate-scaffoldfy-json-Dkaz9ueq.cjs`),require(`./scaffoldfy-config-json-validator-CpEXHRsI.cjs`);const n=require(`./src-BB92j9Us.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.S(`❌ Schema validation error:`,`error`),t.S(` ${r}`,`error`)),{valid:!1,errors:[r]}}}function g(e){t.S(`❌ Schema validation failed:`,`error`),t.S(``,`error`),t.S(`The following validation errors were found:`,`error`),t.S(``,`error`);for(let n of e)t.S(` • ${n}`,`error`);t.S(``,`error`),t.S(`Please fix these errors in your template configuration file.`,`error`),t.S(``,`error`),t.S(`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)`,`./scaffoldfy.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.C(!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.S(`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.S(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),t.S(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(n){t.S(`Failed to load TypeScript config file: ${e.config}`,`error`),n instanceof Error&&t.S(` Error: ${n.message}`,`error`),a.default.exit(1)}}else try{if(e.validate!==!1){t.y(`Validating task configuration against schema...`);let e=r.default.readFileSync(n,`utf-8`);h(JSON.parse(e),{silent:!1}).valid||(t.S(``,`error`),t.S(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),a.default.exit(1)),t.S(`Configuration validated`,`success`)}let i=await t.n(n,{sequential:!0});if(i.configs!=null&&i.configs.length>0){let{runTemplatesSequentially:t}=await Promise.resolve().then(()=>require(`./run-tasks-CYqXNGt_.cjs`)),{createInitialConfig:r}=await Promise.resolve().then(()=>require(`./config-DZmWkoaW.cjs`));await t(i.configs,{dryRun:e.dryRun??!1,force:e.force??!1,configFilePath: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.S(`❌ Invalid config file format`,`error`),t.S(`Expected JSON with { "tasks": [...] } structure`,`info`),a.default.exit(1))}catch(n){t.S(`Failed to load JSON config file: ${e.config}`,`error`),n instanceof Error&&t.S(` Error: ${n.message}`,`error`),a.default.exit(1)}else t.S(`Config file not found: ${e.config}`,`warn`)}let f=c!=null&&c.length>0||s!=null&&s.length>0;o.length===0&&!f&&(t.S(`❌ No tasks defined`,`error`),t.S(`Please provide tasks using one of these methods:`,`info`),t.S(` 1. Create a template-tasks.json file in the current directory`,`info`),t.S(` 2. Create a template-tasks.ts file in the current directory`,`info`),t.S(` 3. Use --config option to specify a different config file`,`info`),t.S(`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.S(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):t.S(`Loaded ${o.length} task(s)`,`success`),await n.t(o,{dryRun:e.dryRun,force:e.force,configFilePath:d,variables:s,prompts:c,configEnabled:l,transformers:u})}catch(e){if(t.S(`❌ CLI execution failed`,`error`),e instanceof Error){t.S(`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{O as e,a as t,g as n,v as r}from"./config-inheritance-DLd3amMI.js";import"./run-tasks-C0IZQ4SX.js";import"./config-nfiOxhDM.js";import"./validate-scaffoldfy-json-Cfq-nQjy.js";import"./scaffoldfy-config-json-validator-DP8-e4Yy.js";import{t as i}from"./src-CfaEuN4Q.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(t,n={}){try{let e=h(),r=g(),i=e.compile(r);if(!i(t)&&i.errors){let e=_(i.errors);return e.length===0?{valid:!0,errors:[]}:(n.silent||y(e),{valid:!1,errors:e})}return{valid:!0,errors:[]}}catch(t){let r=t instanceof Error?t.message:`Unknown error occurred during schema validation`;return n.silent||(e(`❌ Schema validation error:`,`error`),e(` ${r}`,`error`)),{valid:!1,errors:[r]}}}function y(t){e(`❌ Schema validation failed:`,`error`),e(``,`error`),e(`The following validation errors were found:`,`error`),e(``,`error`);for(let n of t)e(` • ${n}`,`error`);e(``,`error`),e(`Please fix these errors in your template configuration file.`,`error`),e(``,`error`),e(`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)`,`./scaffoldfy.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&&r(!0);try{let r=[],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`)){e(`Loading tasks from TypeScript file: ${o.config}`,`info`);try{let t=await import(i);r=t.default??t.tasks??[],(!Array.isArray(r)||r.length===0)&&(e(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e(`Failed to load TypeScript config file: ${o.config}`,`error`),t instanceof Error&&e(` Error: ${t.message}`,`error`),c.exit(1)}}else try{if(o.validate!==!1){n(`Validating task configuration against schema...`);let t=s.readFileSync(i,`utf-8`);v(JSON.parse(t),{silent:!1}).valid||(e(``,`error`),e(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),c.exit(1)),e(`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-i1yaGln9.js`),{createInitialConfig:t}=await import(`./config-DFR0mwj6.js`);await e(a.templates,{dryRun:o.dryRun??!1,force:o.force??!1,configFilePath:i},t()),c.exit(0)}r=a.tasks,l=a.variables,u=a.prompts,d=a.enabled,f=a.transformers,Array.isArray(r)||(e(`❌ Invalid config file format`,`error`),e(`Expected JSON with { "tasks": [...] } structure`,`info`),c.exit(1))}catch(t){e(`Failed to load JSON config file: ${o.config}`,`error`),t instanceof Error&&e(` Error: ${t.message}`,`error`),c.exit(1)}else e(`Config file not found: ${o.config}`,`warn`)}let m=u!=null&&u.length>0||l!=null&&l.length>0;r.length===0&&!m&&(e(`❌ No tasks defined`,`error`),e(`Please provide tasks using one of these methods:`,`info`),e(` 1. Create a template-tasks.json file in the current directory`,`info`),e(` 2. Create a template-tasks.ts file in the current directory`,`info`),e(` 3. Use --config option to specify a different config file`,`info`),e(`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)),r.length===0?e(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e(`Loaded ${r.length} task(s)`,`success`),await i(r,{dryRun:o.dryRun,force:o.force,configFilePath:p,variables:l,prompts:u,configEnabled:d,transformers:f})}catch(t){if(e(`❌ CLI execution failed`,`error`),t instanceof Error){e(`Error: ${t.message}`,`error`);let n=c.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);c.exit(1)}}),b.parse(c.argv);export{};
2
+ import{C as e,S as t,n,y as r}from"./configurations-Bjun5iKX.js";import"./run-tasks-Bd7MRNHo.js";import"./config-nfiOxhDM.js";import"./validate-scaffoldfy-json-Cfq-nQjy.js";import"./scaffoldfy-config-json-validator-DP8-e4Yy.js";import{t as i}from"./src-D8T_2x3i.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,n={}){try{let t=h(),r=g(),i=t.compile(r);if(!i(e)&&i.errors){let e=_(i.errors);return e.length===0?{valid:!0,errors:[]}:(n.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 n.silent||(t(`❌ Schema validation error:`,`error`),t(` ${r}`,`error`)),{valid:!1,errors:[r]}}}function y(e){t(`❌ Schema validation failed:`,`error`),t(``,`error`),t(`The following validation errors were found:`,`error`),t(``,`error`);for(let n of e)t(` • ${n}`,`error`);t(``,`error`),t(`Please fix these errors in your template configuration file.`,`error`),t(``,`error`),t(`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)`,`./scaffoldfy.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`)){t(`Loading tasks from TypeScript file: ${o.config}`,`info`);try{let n=await import(i);e=n.default??n.tasks??[],(!Array.isArray(e)||e.length===0)&&(t(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),t(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(e){t(`Failed to load TypeScript config file: ${o.config}`,`error`),e instanceof Error&&t(` 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||(t(``,`error`),t(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),c.exit(1)),t(`Configuration validated`,`success`)}let a=await n(i,{sequential:!0});if(a.configs!=null&&a.configs.length>0){let{runTemplatesSequentially:e}=await import(`./run-tasks-D2K5zjO-.js`),{createInitialConfig:t}=await import(`./config-DFR0mwj6.js`);await e(a.configs,{dryRun:o.dryRun??!1,force:o.force??!1,configFilePath:i},t()),c.exit(0)}e=a.tasks,l=a.variables,u=a.prompts,d=a.enabled,f=a.transformers,Array.isArray(e)||(t(`❌ Invalid config file format`,`error`),t(`Expected JSON with { "tasks": [...] } structure`,`info`),c.exit(1))}catch(e){t(`Failed to load JSON config file: ${o.config}`,`error`),e instanceof Error&&t(` Error: ${e.message}`,`error`),c.exit(1)}else t(`Config file not found: ${o.config}`,`warn`)}let m=u!=null&&u.length>0||l!=null&&l.length>0;e.length===0&&!m&&(t(`❌ No tasks defined`,`error`),t(`Please provide tasks using one of these methods:`,`info`),t(` 1. Create a template-tasks.json file in the current directory`,`info`),t(` 2. Create a template-tasks.ts file in the current directory`,`info`),t(` 3. Use --config option to specify a different config file`,`info`),t(`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?t(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):t(`Loaded ${e.length} task(s)`,`success`),await i(e,{dryRun:o.dryRun,force:o.force,configFilePath:p,variables:l,prompts:u,configEnabled:d,transformers:f})}catch(e){if(t(`❌ CLI execution failed`,`error`),e instanceof Error){t(`Error: ${e.message}`,`error`);let n=c.env.DEBUG;n!=null&&n!==``&&console.error(e.stack)}else console.error(e);c.exit(1)}}),b.parse(c.argv);export{};
@@ -0,0 +1 @@
1
+ import e from"node:path";import t from"node:fs";import n from"node:process";import{promisify as r}from"node:util";import"handlebars";import i from"node:os";import{execSync as a}from"node:child_process";const o=new Map;function s(){o.clear()}var c=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},l=class e extends c{constructor(e,t,n){super(e,`CIRCULAR_DEPENDENCY`),this.dependencyChain=t,this.resolvedPath=n,this.name=`CircularDependencyError`}static forConfigurationInheritance(t,n){let r=Array.from(t);return new e(`Circular dependency detected: ${r.join(` -> `)} -> ${n}`,r,n)}static forTemplateInheritance(t,n){return e.forConfigurationInheritance(t,n)}static forTaskDependency(t){return new e(`Circular dependency detected involving task: ${t}`,[t])}static forTemplateDependencies(t,n){let r=[...t,n];return new e(`Circular dependency detected in template dependencies: ${r.join(` -> `)}`,r)}},u=class e extends c{constructor(e,t){super(e,`CONFIG_FILE_NOT_FOUND`),this.filePath=t,this.name=`ConfigFileNotFoundError`}static forPath(t){return new e(`Configuration file not found: ${t}`,t)}},d=class e extends c{constructor(e,t,n){super(e,`CONFIG_FETCH_ERROR`),this.url=t,this.originalError=n,this.name=`ConfigFetchError`}static forUrl(t,n,r){return typeof n==`number`?new e(`Failed to fetch configuration from ${t}: ${n} ${r??``}`.trim(),t):new e(`Failed to fetch configuration from ${t}: ${n?.message??String(n??`Unknown error`)}`,t,n)}},f=class e extends c{constructor(e,t,n){super(e,`CONFIG_PARSE_ERROR`),this.filePath=t,this.originalError=n,this.name=`ConfigParseError`}static forFile(t,n){return new e(`Failed to parse configuration file ${t}: ${n.message}`,t,n)}},p=class e extends c{constructor(e,t){super(e,`INVALID_CONFIG`),this.filePath=t,this.name=`InvalidConfigError`}static forFile(t,n){return new e(`Invalid configuration file ${t}: ${n}`,t)}static tasksNotArray(t){return new e(`Invalid configuration file ${t}: 'tasks' must be an array if provided`,t)}static missingName(t){return new e(`Invalid configuration file ${t}: 'name' field is required`,t)}static invalidNameFormat(t,n){return new e(`Invalid configuration file ${t}: 'name' field "${n}" must contain only lowercase letters, digits, and hyphens. It cannot start or end with a hyphen, and cannot contain consecutive hyphens.`,t)}},m=class e extends c{constructor(e,t,n,r){super(e,`DUPLICATE_ID`),this.id=t,this.type=n,this.existingType=r,this.name=`DuplicateIdError`}static forId(t,n,r){return new e(`Duplicate ID "${t}" found in ${n}. This ID is already used in ${r??`unknown`}`,t,n,r)}},h=class e extends c{constructor(e,t,n,r,i){super(e,`ID_CONFLICT`),this.id=t,this.type=n,this.baseSource=r,this.overrideSource=i,this.name=`IdConflictError`}static forTask(t,n,r){return new e(`Task ID conflict: "${t}" is defined in multiple templates.\n Base task from: ${n??`unknown`}\n Override task from: ${r??`unknown`}\n You must specify an override strategy: add "override": "merge" or "override": "replace" to the task.\n Task is being extended/overridden but no override strategy was specified.`,t,`task`,n,r)}static forVariable(t){return new e(`Variable ID conflict: "${t}" is defined in multiple templates.\n You must specify an override strategy: add "override": "merge" or "override": "replace" to the variable.\n Variable is being extended/overridden but no override strategy was specified.`,t,`variable`)}static forPrompt(t){return new e(`Prompt ID conflict: "${t}" is defined in multiple templates.\n You must specify an override strategy: add "override": "merge" or "override": "replace" to the prompt.\n Prompt is being extended/overridden but no override strategy was specified.`,t,`prompt`)}};let g=!1;function ee(e){g=e}const _={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},v={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},y=`\x1B[0m`;function b(e){g&&console.log(`${v.debug}${_.debug} ${e}${y}`)}function x(e){console.log(`${v.info}${_.info} ${e}${y}`)}function S(e){console.log(`${v.success}${_.success} ${e}${y}`)}function C(e){console.log(`${v.warn}${_.warn} ${e}${y}`)}function w(e){console.log(`${v.error}${_.error} ${e}${y}`)}function T(e,t=`info`){switch(t){case`debug`:b(e);break;case`info`:x(e);break;case`success`:S(e);break;case`warn`:C(e);break;case`error`:w(e);break}}function E(e,t,n){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch(t){return n?.lazy===!0&&t instanceof ReferenceError?!0:(n?.silent!==!0&&(T(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&T(` Error: ${t.message}`,`warn`)),!1)}}function te(e,t,n){if(e===void 0)return!0;if(typeof e==`boolean`)return e;if(typeof e==`object`&&`type`in e){if(e.type===`exec`)return n?.lazy===!0;if(e.type===`condition`)return E(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function D(e,t,n){if(e===void 0)return!0;if(typeof e==`boolean`)return e;if(typeof e==`object`&&`type`in e){if(e.type===`exec`)try{let{execSync:n}=await import(`node:child_process`),{interpolateTemplate:r}=await import(`./utils-DXSrTxhI.js`),i=n(r(e.value,t),{encoding:`utf-8`}).trim();if(i===``||i===`0`)return!1;let a=i.toLowerCase();return!(a===`false`||a===`no`)}catch(t){let{log:n}=await import(`./utils-DXSrTxhI.js`);return n(`Failed to execute enabled command: ${e.value}`,`warn`),t instanceof Error&&n(` Error: ${t.message}`,`warn`),!1}if(e.type===`condition`)return E(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function O(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function ne(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 k(e,t){let n=ne(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-DXSrTxhI.js`);return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await import(`./utils-DXSrTxhI.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 O(n.value,t)}return!0}function A(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function re(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];t!=null&&t!==``&&((!(t in i)||typeof i[t]!=`object`||i[t]===null)&&(i[t]={}),i=i[t])}let a=r[r.length-1];a!=null&&a!==``&&(i[a]=n)}function j(e,t){let n=t.split(`.`),r=e;for(let e of n)if(e!==``&&typeof r==`object`&&r)r=r[e];else return;return r}function M(t,r){if(A(t))return t;if(r==null||r===``)return e.isAbsolute(t)?t:e.resolve(n.cwd(),t);if(A(r))try{let e=new URL(`.`,r);return new URL(t,e).href}catch{throw Error(`Failed to resolve file path '${t}' relative to source URL '${r}'`)}let i=e.dirname(r);return e.isAbsolute(t)?t:e.resolve(i,t)}async function N(n){let{file:r,sourceUrl:a,tempFileExtension:o=`.tmp`,tempFilePrefix:s=`scaffoldfy`}=n,c=r,l,u,d=!1;if(A(r)){l=r,b(`Fetching remote file: ${l}`);let n=await H(l);d=!0;let a=i.tmpdir(),c=`${s}-${Date.now()}${o}`;u=e.join(a,c),t.writeFileSync(u,n,`utf-8`),b(`Remote file saved to temporary location: ${u}`)}else if(l=M(r,a),A(l)){b(`Fetching remote file: ${l}`);let n=await H(l);d=!0;let r=i.tmpdir(),a=`${s}-${Date.now()}${o}`;u=e.join(r,a),t.writeFileSync(u,n,`utf-8`),b(`Remote file saved to temporary location: ${u}`)}else{if(!t.existsSync(l))throw Error(`File not found: ${l}`);u=l,b(`Using local file: ${u}`)}return{localFilePath:u,isRemote:d,originalPath:c,resolvedPath:l}}function P(e){if(e.isRemote&&t.existsSync(e.localFilePath))try{t.unlinkSync(e.localFilePath),b(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){b(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function F(t){switch(e.extname(t).toLowerCase()){case`.js`:case`.cjs`:case`.mjs`:return`node`;case`.sh`:return`bash`;case`.bash`:return`bash`;case`.ps1`:return`pwsh`;default:return}}function I(e,t){switch(e){case`node`:return`node "${t}"`;case`bash`:return`bash "${t}"`;case`sh`:return`sh "${t}"`;case`pwsh`:return`pwsh -File "${t}"`;case`powershell`:return`powershell -File "${t}"`;default:return`node "${t}"`}}function L(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function R(t,r){let i=V(t.file,r),o=t.args?.map(e=>V(e,r))??[],s={};if(t.parameters)for(let[e,n]of Object.entries(t.parameters))s[e]=V(n,r);let c=t.cwd!=null&&t.cwd!==``?e.join(n.cwd(),V(t.cwd,r)):n.cwd(),l=await N({file:i,...t.sourceUrl!=null&&t.sourceUrl!==``&&{sourceUrl:t.sourceUrl},tempFileExtension:L(t.runtime??F(i)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:u}=l,d=t.runtime??F(u)??`node`;!t.runtime&&!F(u)&&T(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let e=I(d,u),r=o.join(` `),i=r?`${e} ${r}`:e;b(`Executing: ${i}`);let l=a(i,{cwd:c,stdio:t.captureOutput?[`pipe`,`pipe`,`pipe`]:`inherit`,env:{...n.env,...s},encoding:t.captureOutput?`utf-8`:void 0});if(t.captureOutput)return b(`Script executed successfully with output`),typeof l==`string`?l:void 0;b(`Script executed successfully`);return}finally{P(l)}}async function z(e,t){let{id:n,contextType:r,context:i,sourceUrl:o}=t;if(e==null)return;if(typeof e!=`object`||!e||Array.isArray(e))return e;let s=e;if(s.type===`conditional`){if(!i){T(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof s.condition!=`string`){T(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=E(s.condition,i)?s.ifTrue:s.ifFalse;return typeof e==`object`&&e?await z(e,t):e}catch(e){T(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`exec`){let e=s.value;if(typeof e!=`string`){T(`${r} "${n}": exec value must have a string command`,`error`);return}try{return B(a(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){T(`${r} "${n}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`exec-file`){let e=s;if(typeof e.file!=`string`){T(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await R({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},...o!=null&&{sourceUrl:o},captureOutput:!0},i??{});return t===void 0?void 0:B(t.trim())}catch(e){T(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`static`)return s.value;if(s.type===`interpolate`){let e=s.value;if(typeof e!=`string`){T(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return T(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return V(e,i)}catch(t){return T(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(s.type!==void 0){T(`${r} "${n}": unknown value type "${s.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function B(e){if(e.startsWith(`{`)||e.startsWith(`[`))try{return JSON.parse(e)}catch{return e}if(/^-?\d+(?:\.\d+)?$/u.test(e)){let t=Number.parseFloat(e);if(!Number.isNaN(t))return t}return e===`true`||e===`false`?e===`true`:e}function V(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>j(t,n)?.toString()??``)}const ie=r(t.readFile);async function H(e){if(A(e))return U(e);if(!t.existsSync(e))throw u.forPath(e);return ie(e,`utf-8`)}async function U(e){try{let t=await fetch(e);if(!t.ok)throw d.forUrl(e,t.status,t.statusText);return await t.text()}catch(t){throw t instanceof Error&&t.message.includes(`Failed to fetch`)?t:d.forUrl(e,t instanceof Error?t:void 0)}}const W=r(t.readFile);async function G(r,i=new Set){let a=A(r),s;if(s=a||e.isAbsolute(r)?r:e.resolve(n.cwd(),r),o.has(s))return o.get(s);if(i.has(s))throw l.forConfigurationInheritance(i,s);i.add(s);let c;if(a)c=await U(s);else{if(!t.existsSync(s))throw u.forPath(s);c=await W(s,`utf-8`)}let d;try{d=JSON.parse(c)}catch(e){throw f.forFile(s,e instanceof Error?e:Error(String(e)))}if(d.name==null||d.name.trim()===``)throw p.missingName(s);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(d.name))throw p.invalidNameFormat(s,d.name);if(d.tasks!==void 0&&!Array.isArray(d.tasks))throw p.tasksNotArray(s);d.tasks===void 0&&(d.tasks=[]);for(let e of d.tasks)e.$sourceUrl=s;if(d.variables!==void 0)for(let e of d.variables)e.$sourceUrl=s;if(d.prompts!==void 0)for(let e of d.prompts)e.$sourceUrl=s;return o.set(s,d),d}function K(e){let t=new Map;for(let n of e){let e=t.get(n.name)||[];e.push(n),t.set(n.name,e)}if(Array.from(t.values()).some(e=>e.length>1))return e;let n=new Map,r=new Map,i=new Map;for(let t of e)if(n.set(t.name,t),i.set(t.name,new Set),t.dependencies!=null&&t.dependencies.length>0)for(let e of t.dependencies)i.get(t.name).add(e),r.has(e)||r.set(e,new Set),r.get(e).add(t.name);let a=new Set,o=new Map;for(let t=0;t<e.length;t++){let n=e[t],s=i.get(n.name).size>0,c=r.has(n.name)&&r.get(n.name).size>0;!s&&!c&&(a.add(n.name),o.set(n.name,t))}let s=e.filter(e=>!a.has(e.name)),c=[],u=new Set,d=new Set;function f(e){if(u.has(e))return;if(d.has(e))throw l.forTemplateDependencies(Array.from(d),e);d.add(e);let t=n.get(e);if(t!=null){let t=i.get(e);if(t!=null&&t.size>0)for(let e of t)f(e)}d.delete(e),u.add(e),t!=null&&!a.has(e)&&c.push(t)}for(let e of s)f(e.name);let p=[],m=0;for(let t=0;t<e.length;t++){let n=e[t];a.has(n.name)?p.push(n):m<c.length&&(p.push(c[m]),m++)}return p}async function q(t,r,i,a,o){let s=A(t),c;if(c=s||e.isAbsolute(t)?t:r==null?e.resolve(n.cwd(),t):A(r)?new URL(t,r).href:e.resolve(r,t),i.has(c))return;if(a.has(c))throw l.forConfigurationInheritance(a,c);a.add(c);let u=await G(c),d=A(c)?new URL(`.`,c).href:e.dirname(c);if(u.extends!=null&&u.extends!==``){let e=Array.isArray(u.extends)?u.extends:[u.extends];for(let t of e)await q(t,d,i,a,o)}a.delete(c),i.add(c),o.push(u)}async function J(e,t,n=new Set){let r=[];return await q(e,t,n,new Set,r),K(r)}function Y(e,t,n){let r=new Map;for(let t of e){if(r.has(t.id))throw m.forId(t.id,`task`,r.get(t.id));r.set(t.id,`task`)}if(t!=null)for(let e of t){if(r.has(e.id))throw m.forId(e.id,`variable`,r.get(e.id));r.set(e.id,`variable`)}if(n!=null)for(let e of n){if(r.has(e.id))throw m.forId(e.id,`prompt`,r.get(e.id));r.set(e.id,`prompt`)}}const X={template:[[`template`,`templateFile`]]};function Z(t){if(t==null||t===``)return`current configuration`;if(A(t))return t;let r=n.cwd();return t.startsWith(r)?e.relative(r,t):t}function ae(e,t){if((t.override??`merge`)===`replace`){T(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}T(` → Variable "${t.id}" merged (value replaced)`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}function oe(e,t){if((t.override??`merge`)===`replace`){T(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}T(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}function Q(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return Y(t.tasks??[],t.variables,t.prompts),t}let t=new Map,n=new Map,r=new Map,i={};for(let a of e){if(a.enabled!=null&&(i[a.name]=a.enabled),a.enabled===!1){T(`⊘ Skipping disabled configuration "${a.name}" - its tasks, prompts, and variables will not be included`,`info`);continue}if(a.prompts!=null)for(let e of a.prompts)if(r.has(e.id)){if(e.override==null)throw h.forPrompt(e.id);let t=oe(r.get(e.id),e);a.enabled!=null&&(t.$configEnabled=a.enabled),r.set(e.id,t)}else{let t={...e};a.enabled!=null&&(t.$configEnabled=a.enabled),r.set(e.id,t)}if(a.variables!=null)for(let e of a.variables)if(n.has(e.id)){if(e.override==null)throw h.forVariable(e.id);let t=ae(n.get(e.id),e);a.enabled!=null&&(t.$configEnabled=a.enabled),n.set(e.id,t)}else{let t={...e};a.enabled!=null&&(t.$configEnabled=a.enabled),n.set(e.id,t)}for(let e of a.tasks??[])if(t.has(e.id)){if(e.override==null){let n=t.get(e.id);throw h.forTask(e.id,Z(n.$sourceUrl),Z(e.$sourceUrl))}let n=le(t.get(e.id),e);a.enabled!=null&&(n.$configEnabled=a.enabled),t.set(e.id,n)}else{let n={...e};a.enabled!=null&&(n.$configEnabled=a.enabled),t.set(e.id,n)}}let a=Array.from(t.values()),o=r.size>0?Array.from(r.values()):void 0,s=n.size>0?Array.from(n.values()):void 0;Y(a,s,o);let c=e[e.length-1],l={name:c.name,tasks:a};return c.description!=null&&(l.description=c.description),c.dependencies!=null&&(l.dependencies=c.dependencies),c.enabled!=null&&(l.enabled=c.enabled),o!=null&&(l.prompts=o),s!=null&&(l.variables=s),l}function se(e,t){let n=X[e];if(!n)return null;for(let e of n){let n=e.filter(e=>e in t&&t[e]!=null);if(n.length>1)return n}return null}function ce(e,t,n){let r={...e},i=X[n]??[];for(let[e,n]of Object.entries(t)){for(let t of i)if(t.includes(e)){for(let n of t)n!==e&&delete r[n];break}r[e]=n}return r}function le(e,t){if((t.override??`merge`)===`replace`){T(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),T(` Base: ${Z(e.$sourceUrl)}`,`info`),T(` Override: ${Z(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}T(` → Merging task "${t.id}"`,`info`),T(` Base: ${Z(e.$sourceUrl)}`,`info`),T(` Override: ${Z(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=ce(e.config,t.config,t.type);let r=se(t.type,n);r!==null&&r.length>0&&(T(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),T(` Please use override: "replace" or specify only one of these fields`,`warn`))}else n=t.config??e.config;let r=[...e.dependencies??[],...t.dependencies??[]],i=r.length>0?[...new Set(r)]:void 0,a=t.$sourceUrl??e.$sourceUrl,o={...e,...t,config:n,...i!=null&&{dependencies:i},...a!=null&&{$sourceUrl:a}};return delete o.override,o}async function $(e,t,n=new Set){return Q(await J(e,t,n))}async function ue(e,t){if(b(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await J(e);return b(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await $(e);T(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&T(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&T(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&T(`Found ${n.variables.length} top-level variable(s)`,`info`);let r={tasks:n.tasks??[]};return n.prompts!=null&&(r.prompts=n.prompts),n.variables!=null&&(r.variables=n.variables),n.enabled!=null&&(r.enabled=n.enabled),n.transformers!=null&&(r.transformers=n.transformers),r}export{ee as C,c as D,l as E,s as O,T as S,C as T,D as _,H as a,w as b,R as c,M as d,j as f,te as g,k as h,G as i,P as l,A as m,ue as n,V as o,re as p,Q as r,z as s,$ as t,N as u,E as v,S as w,x,b as y};
@@ -0,0 +1 @@
1
+ const e=require(`./chunk-DjWAcSYV.cjs`);let t=require(`node:fs`);t=e.t(t);let n=require(`node:path`);n=e.t(n);let r=require(`node:process`);r=e.t(r);let i=require(`node:util`);i=e.t(i),require(`handlebars`);let a=require(`node:os`);a=e.t(a);let o=require(`node:child_process`);o=e.t(o);const s=new Map;function c(){s.clear()}var l=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},u=class e extends l{constructor(e,t,n){super(e,`CIRCULAR_DEPENDENCY`),this.dependencyChain=t,this.resolvedPath=n,this.name=`CircularDependencyError`}static forConfigurationInheritance(t,n){let r=Array.from(t);return new e(`Circular dependency detected: ${r.join(` -> `)} -> ${n}`,r,n)}static forTemplateInheritance(t,n){return e.forConfigurationInheritance(t,n)}static forTaskDependency(t){return new e(`Circular dependency detected involving task: ${t}`,[t])}static forTemplateDependencies(t,n){let r=[...t,n];return new e(`Circular dependency detected in template dependencies: ${r.join(` -> `)}`,r)}},d=class e extends l{constructor(e,t){super(e,`CONFIG_FILE_NOT_FOUND`),this.filePath=t,this.name=`ConfigFileNotFoundError`}static forPath(t){return new e(`Configuration file not found: ${t}`,t)}},f=class e extends l{constructor(e,t,n){super(e,`CONFIG_FETCH_ERROR`),this.url=t,this.originalError=n,this.name=`ConfigFetchError`}static forUrl(t,n,r){return typeof n==`number`?new e(`Failed to fetch configuration from ${t}: ${n} ${r??``}`.trim(),t):new e(`Failed to fetch configuration from ${t}: ${n?.message??String(n??`Unknown error`)}`,t,n)}},p=class e extends l{constructor(e,t,n){super(e,`CONFIG_PARSE_ERROR`),this.filePath=t,this.originalError=n,this.name=`ConfigParseError`}static forFile(t,n){return new e(`Failed to parse configuration file ${t}: ${n.message}`,t,n)}},m=class e extends l{constructor(e,t){super(e,`INVALID_CONFIG`),this.filePath=t,this.name=`InvalidConfigError`}static forFile(t,n){return new e(`Invalid configuration file ${t}: ${n}`,t)}static tasksNotArray(t){return new e(`Invalid configuration file ${t}: 'tasks' must be an array if provided`,t)}static missingName(t){return new e(`Invalid configuration file ${t}: 'name' field is required`,t)}static invalidNameFormat(t,n){return new e(`Invalid configuration file ${t}: 'name' field "${n}" must contain only lowercase letters, digits, and hyphens. It cannot start or end with a hyphen, and cannot contain consecutive hyphens.`,t)}},h=class e extends l{constructor(e,t,n,r){super(e,`DUPLICATE_ID`),this.id=t,this.type=n,this.existingType=r,this.name=`DuplicateIdError`}static forId(t,n,r){return new e(`Duplicate ID "${t}" found in ${n}. This ID is already used in ${r??`unknown`}`,t,n,r)}},g=class e extends l{constructor(e,t,n,r,i){super(e,`ID_CONFLICT`),this.id=t,this.type=n,this.baseSource=r,this.overrideSource=i,this.name=`IdConflictError`}static forTask(t,n,r){return new e(`Task ID conflict: "${t}" is defined in multiple templates.\n Base task from: ${n??`unknown`}\n Override task from: ${r??`unknown`}\n You must specify an override strategy: add "override": "merge" or "override": "replace" to the task.\n Task is being extended/overridden but no override strategy was specified.`,t,`task`,n,r)}static forVariable(t){return new e(`Variable ID conflict: "${t}" is defined in multiple templates.\n You must specify an override strategy: add "override": "merge" or "override": "replace" to the variable.\n Variable is being extended/overridden but no override strategy was specified.`,t,`variable`)}static forPrompt(t){return new e(`Prompt ID conflict: "${t}" is defined in multiple templates.\n You must specify an override strategy: add "override": "merge" or "override": "replace" to the prompt.\n Prompt is being extended/overridden but no override strategy was specified.`,t,`prompt`)}};let _=!1;function v(e){_=e}const y={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},b={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},x=`\x1B[0m`;function S(e){_&&console.log(`${b.debug}${y.debug} ${e}${x}`)}function C(e){console.log(`${b.info}${y.info} ${e}${x}`)}function w(e){console.log(`${b.success}${y.success} ${e}${x}`)}function T(e){console.log(`${b.warn}${y.warn} ${e}${x}`)}function E(e){console.log(`${b.error}${y.error} ${e}${x}`)}function D(e,t=`info`){switch(t){case`debug`:S(e);break;case`info`:C(e);break;case`success`:w(e);break;case`warn`:T(e);break;case`error`:E(e);break}}function O(e,t,n){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch(t){return n?.lazy===!0&&t instanceof ReferenceError?!0:(n?.silent!==!0&&(D(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&D(` Error: ${t.message}`,`warn`)),!1)}}function ee(e,t,n){if(e===void 0)return!0;if(typeof e==`boolean`)return e;if(typeof e==`object`&&`type`in e){if(e.type===`exec`)return n?.lazy===!0;if(e.type===`condition`)return O(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function k(e,t,n){if(e===void 0)return!0;if(typeof e==`boolean`)return e;if(typeof e==`object`&&`type`in e){if(e.type===`exec`)try{let{execSync:n}=await import(`node:child_process`),{interpolateTemplate:r}=await Promise.resolve().then(()=>require(`./utils-C-yGs5_V.cjs`)),i=n(r(e.value,t),{encoding:`utf-8`}).trim();if(i===``||i===`0`)return!1;let a=i.toLowerCase();return!(a===`false`||a===`no`)}catch(t){let{log:n}=await Promise.resolve().then(()=>require(`./utils-C-yGs5_V.cjs`));return n(`Failed to execute enabled command: ${e.value}`,`warn`),t instanceof Error&&n(` Error: ${t.message}`,`warn`),!1}if(e.type===`condition`)return O(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function A(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function te(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 j(e,t){let n=te(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 Promise.resolve().then(()=>require(`./utils-C-yGs5_V.cjs`));return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await Promise.resolve().then(()=>require(`./utils-C-yGs5_V.cjs`));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 A(n.value,t)}return!0}function M(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function ne(e,t,n){let r=t.split(`.`),i=e;for(let e=0;e<r.length-1;e++){let t=r[e];t!=null&&t!==``&&((!(t in i)||typeof i[t]!=`object`||i[t]===null)&&(i[t]={}),i=i[t])}let a=r[r.length-1];a!=null&&a!==``&&(i[a]=n)}function N(e,t){let n=t.split(`.`),r=e;for(let e of n)if(e!==``&&typeof r==`object`&&r)r=r[e];else return;return r}function P(e,t){if(M(e))return e;if(t==null||t===``)return n.default.isAbsolute(e)?e:n.default.resolve(r.default.cwd(),e);if(M(t))try{let n=new URL(`.`,t);return new URL(e,n).href}catch{throw Error(`Failed to resolve file path '${e}' relative to source URL '${t}'`)}let i=n.default.dirname(t);return n.default.isAbsolute(e)?e:n.default.resolve(i,e)}async function F(e){let{file:r,sourceUrl:i,tempFileExtension:o=`.tmp`,tempFilePrefix:s=`scaffoldfy`}=e,c=r,l,u,d=!1;if(M(r)){l=r,S(`Fetching remote file: ${l}`);let e=await H(l);d=!0;let i=a.default.tmpdir(),c=`${s}-${Date.now()}${o}`;u=n.default.join(i,c),t.default.writeFileSync(u,e,`utf-8`),S(`Remote file saved to temporary location: ${u}`)}else if(l=P(r,i),M(l)){S(`Fetching remote file: ${l}`);let e=await H(l);d=!0;let r=a.default.tmpdir(),i=`${s}-${Date.now()}${o}`;u=n.default.join(r,i),t.default.writeFileSync(u,e,`utf-8`),S(`Remote file saved to temporary location: ${u}`)}else{if(!t.default.existsSync(l))throw Error(`File not found: ${l}`);u=l,S(`Using local file: ${u}`)}return{localFilePath:u,isRemote:d,originalPath:c,resolvedPath:l}}function I(e){if(e.isRemote&&t.default.existsSync(e.localFilePath))try{t.default.unlinkSync(e.localFilePath),S(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){S(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function L(e){switch(n.default.extname(e).toLowerCase()){case`.js`:case`.cjs`:case`.mjs`:return`node`;case`.sh`:return`bash`;case`.bash`:return`bash`;case`.ps1`:return`pwsh`;default:return}}function re(e,t){switch(e){case`node`:return`node "${t}"`;case`bash`:return`bash "${t}"`;case`sh`:return`sh "${t}"`;case`pwsh`:return`pwsh -File "${t}"`;case`powershell`:return`powershell -File "${t}"`;default:return`node "${t}"`}}function ie(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function R(e,t){let i=V(e.file,t),a=e.args?.map(e=>V(e,t))??[],s={};if(e.parameters)for(let[n,r]of Object.entries(e.parameters))s[n]=V(r,t);let c=e.cwd!=null&&e.cwd!==``?n.default.join(r.default.cwd(),V(e.cwd,t)):r.default.cwd(),l=await F({file:i,...e.sourceUrl!=null&&e.sourceUrl!==``&&{sourceUrl:e.sourceUrl},tempFileExtension:ie(e.runtime??L(i)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:u}=l,d=e.runtime??L(u)??`node`;!e.runtime&&!L(u)&&D(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let t=re(d,u),n=a.join(` `),i=n?`${t} ${n}`:t;S(`Executing: ${i}`);let l=(0,o.execSync)(i,{cwd:c,stdio:e.captureOutput?[`pipe`,`pipe`,`pipe`]:`inherit`,env:{...r.default.env,...s},encoding:e.captureOutput?`utf-8`:void 0});if(e.captureOutput)return S(`Script executed successfully with output`),typeof l==`string`?l:void 0;S(`Script executed successfully`);return}finally{I(l)}}async function z(e,t){let{id:n,contextType:r,context:i,sourceUrl:a}=t;if(e==null)return;if(typeof e!=`object`||!e||Array.isArray(e))return e;let s=e;if(s.type===`conditional`){if(!i){D(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof s.condition!=`string`){D(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=O(s.condition,i)?s.ifTrue:s.ifFalse;return typeof e==`object`&&e?await z(e,t):e}catch(e){D(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`exec`){let e=s.value;if(typeof e!=`string`){D(`${r} "${n}": exec value must have a string command`,`error`);return}try{return B((0,o.execSync)(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){D(`${r} "${n}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`exec-file`){let e=s;if(typeof e.file!=`string`){D(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await R({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},...a!=null&&{sourceUrl:a},captureOutput:!0},i??{});return t===void 0?void 0:B(t.trim())}catch(e){D(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`static`)return s.value;if(s.type===`interpolate`){let e=s.value;if(typeof e!=`string`){D(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return D(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return V(e,i)}catch(t){return D(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(s.type!==void 0){D(`${r} "${n}": unknown value type "${s.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function B(e){if(e.startsWith(`{`)||e.startsWith(`[`))try{return JSON.parse(e)}catch{return e}if(/^-?\d+(?:\.\d+)?$/u.test(e)){let t=Number.parseFloat(e);if(!Number.isNaN(t))return t}return e===`true`||e===`false`?e===`true`:e}function V(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>N(t,n)?.toString()??``)}const ae=(0,i.promisify)(t.default.readFile);async function H(e){if(M(e))return U(e);if(!t.default.existsSync(e))throw d.forPath(e);return ae(e,`utf-8`)}async function U(e){try{let t=await fetch(e);if(!t.ok)throw f.forUrl(e,t.status,t.statusText);return await t.text()}catch(t){throw t instanceof Error&&t.message.includes(`Failed to fetch`)?t:f.forUrl(e,t instanceof Error?t:void 0)}}const W=(0,i.promisify)(t.default.readFile);async function G(e,i=new Set){let a=M(e),o;if(o=a||n.default.isAbsolute(e)?e:n.default.resolve(r.default.cwd(),e),s.has(o))return s.get(o);if(i.has(o))throw u.forConfigurationInheritance(i,o);i.add(o);let c;if(a)c=await U(o);else{if(!t.default.existsSync(o))throw d.forPath(o);c=await W(o,`utf-8`)}let l;try{l=JSON.parse(c)}catch(e){throw p.forFile(o,e instanceof Error?e:Error(String(e)))}if(l.name==null||l.name.trim()===``)throw m.missingName(o);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(l.name))throw m.invalidNameFormat(o,l.name);if(l.tasks!==void 0&&!Array.isArray(l.tasks))throw m.tasksNotArray(o);l.tasks===void 0&&(l.tasks=[]);for(let e of l.tasks)e.$sourceUrl=o;if(l.variables!==void 0)for(let e of l.variables)e.$sourceUrl=o;if(l.prompts!==void 0)for(let e of l.prompts)e.$sourceUrl=o;return s.set(o,l),l}function K(e){let t=new Map;for(let n of e){let e=t.get(n.name)||[];e.push(n),t.set(n.name,e)}if(Array.from(t.values()).some(e=>e.length>1))return e;let n=new Map,r=new Map,i=new Map;for(let t of e)if(n.set(t.name,t),i.set(t.name,new Set),t.dependencies!=null&&t.dependencies.length>0)for(let e of t.dependencies)i.get(t.name).add(e),r.has(e)||r.set(e,new Set),r.get(e).add(t.name);let a=new Set,o=new Map;for(let t=0;t<e.length;t++){let n=e[t],s=i.get(n.name).size>0,c=r.has(n.name)&&r.get(n.name).size>0;!s&&!c&&(a.add(n.name),o.set(n.name,t))}let s=e.filter(e=>!a.has(e.name)),c=[],l=new Set,d=new Set;function f(e){if(l.has(e))return;if(d.has(e))throw u.forTemplateDependencies(Array.from(d),e);d.add(e);let t=n.get(e);if(t!=null){let t=i.get(e);if(t!=null&&t.size>0)for(let e of t)f(e)}d.delete(e),l.add(e),t!=null&&!a.has(e)&&c.push(t)}for(let e of s)f(e.name);let p=[],m=0;for(let t=0;t<e.length;t++){let n=e[t];a.has(n.name)?p.push(n):m<c.length&&(p.push(c[m]),m++)}return p}async function q(e,t,i,a,o){let s=M(e),c;if(c=s||n.default.isAbsolute(e)?e:t==null?n.default.resolve(r.default.cwd(),e):M(t)?new URL(e,t).href:n.default.resolve(t,e),i.has(c))return;if(a.has(c))throw u.forConfigurationInheritance(a,c);a.add(c);let l=await G(c),d=M(c)?new URL(`.`,c).href:n.default.dirname(c);if(l.extends!=null&&l.extends!==``){let e=Array.isArray(l.extends)?l.extends:[l.extends];for(let t of e)await q(t,d,i,a,o)}a.delete(c),i.add(c),o.push(l)}async function J(e,t,n=new Set){let r=[];return await q(e,t,n,new Set,r),K(r)}function Y(e,t,n){let r=new Map;for(let t of e){if(r.has(t.id))throw h.forId(t.id,`task`,r.get(t.id));r.set(t.id,`task`)}if(t!=null)for(let e of t){if(r.has(e.id))throw h.forId(e.id,`variable`,r.get(e.id));r.set(e.id,`variable`)}if(n!=null)for(let e of n){if(r.has(e.id))throw h.forId(e.id,`prompt`,r.get(e.id));r.set(e.id,`prompt`)}}const X={template:[[`template`,`templateFile`]]};function Z(e){if(e==null||e===``)return`current configuration`;if(M(e))return e;let t=r.default.cwd();return e.startsWith(t)?n.default.relative(t,e):e}function oe(e,t){if((t.override??`merge`)===`replace`){D(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}D(` → Variable "${t.id}" merged (value replaced)`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}function se(e,t){if((t.override??`merge`)===`replace`){D(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}D(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}function Q(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return Y(t.tasks??[],t.variables,t.prompts),t}let t=new Map,n=new Map,r=new Map,i={};for(let a of e){if(a.enabled!=null&&(i[a.name]=a.enabled),a.enabled===!1){D(`⊘ Skipping disabled configuration "${a.name}" - its tasks, prompts, and variables will not be included`,`info`);continue}if(a.prompts!=null)for(let e of a.prompts)if(r.has(e.id)){if(e.override==null)throw g.forPrompt(e.id);let t=se(r.get(e.id),e);a.enabled!=null&&(t.$configEnabled=a.enabled),r.set(e.id,t)}else{let t={...e};a.enabled!=null&&(t.$configEnabled=a.enabled),r.set(e.id,t)}if(a.variables!=null)for(let e of a.variables)if(n.has(e.id)){if(e.override==null)throw g.forVariable(e.id);let t=oe(n.get(e.id),e);a.enabled!=null&&(t.$configEnabled=a.enabled),n.set(e.id,t)}else{let t={...e};a.enabled!=null&&(t.$configEnabled=a.enabled),n.set(e.id,t)}for(let e of a.tasks??[])if(t.has(e.id)){if(e.override==null){let n=t.get(e.id);throw g.forTask(e.id,Z(n.$sourceUrl),Z(e.$sourceUrl))}let n=ue(t.get(e.id),e);a.enabled!=null&&(n.$configEnabled=a.enabled),t.set(e.id,n)}else{let n={...e};a.enabled!=null&&(n.$configEnabled=a.enabled),t.set(e.id,n)}}let a=Array.from(t.values()),o=r.size>0?Array.from(r.values()):void 0,s=n.size>0?Array.from(n.values()):void 0;Y(a,s,o);let c=e[e.length-1],l={name:c.name,tasks:a};return c.description!=null&&(l.description=c.description),c.dependencies!=null&&(l.dependencies=c.dependencies),c.enabled!=null&&(l.enabled=c.enabled),o!=null&&(l.prompts=o),s!=null&&(l.variables=s),l}function ce(e,t){let n=X[e];if(!n)return null;for(let e of n){let n=e.filter(e=>e in t&&t[e]!=null);if(n.length>1)return n}return null}function le(e,t,n){let r={...e},i=X[n]??[];for(let[e,n]of Object.entries(t)){for(let t of i)if(t.includes(e)){for(let n of t)n!==e&&delete r[n];break}r[e]=n}return r}function ue(e,t){if((t.override??`merge`)===`replace`){D(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),D(` Base: ${Z(e.$sourceUrl)}`,`info`),D(` Override: ${Z(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}D(` → Merging task "${t.id}"`,`info`),D(` Base: ${Z(e.$sourceUrl)}`,`info`),D(` Override: ${Z(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=le(e.config,t.config,t.type);let r=ce(t.type,n);r!==null&&r.length>0&&(D(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),D(` Please use override: "replace" or specify only one of these fields`,`warn`))}else n=t.config??e.config;let r=[...e.dependencies??[],...t.dependencies??[]],i=r.length>0?[...new Set(r)]:void 0,a=t.$sourceUrl??e.$sourceUrl,o={...e,...t,config:n,...i!=null&&{dependencies:i},...a!=null&&{$sourceUrl:a}};return delete o.override,o}async function $(e,t,n=new Set){return Q(await J(e,t,n))}async function de(e,t){if(S(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await J(e);return S(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await $(e);D(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&D(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&D(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&D(`Found ${n.variables.length} top-level variable(s)`,`info`);let r={tasks:n.tasks??[]};return n.prompts!=null&&(r.prompts=n.prompts),n.variables!=null&&(r.variables=n.variables),n.enabled!=null&&(r.enabled=n.enabled),n.transformers!=null&&(r.transformers=n.transformers),r}Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return S}});
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./config-inheritance-CtSb5haE.cjs`),t=require(`./run-tasks-CgFJyU4i.cjs`);require(`./config-CQ-mWBG5.cjs`);const n=require(`./validate-scaffoldfy-json-Dkaz9ueq.cjs`);require(`./scaffoldfy-config-json-validator-CpEXHRsI.cjs`);const r=require(`./src-B0yHfPGS.cjs`);exports.clearConfigurationCache=e.t,exports.clearPlugins=t.r,exports.createTaskPlugin=t.i,exports.displayTasksDiff=t.p,exports.executePluginTask=t.a,exports.getDeleteDiff=t.m,exports.getExecDiff=t.h,exports.getGitInitDiff=t.g,exports.getPlugin=t.o,exports.getPluginForTaskType=t.s,exports.getRegexReplaceDiff=t._,exports.getRenameDiff=t.v,exports.getReplaceInFileDiff=t.y,exports.getTaskDiff=t.b,exports.getUpdateJsonDiff=t.x,exports.isPluginTaskType=t.c,exports.listPlugins=t.l,exports.loadAndMergeConfiguration=e.r,exports.loadConfiguration=e.i,exports.loadTasksWithInheritance=e.a,exports.mergeConfigurations=e.o,exports.registerHooks=t.u,exports.registerPlugin=t.d,exports.runWithTasks=r.t,exports.unregisterPlugin=t.f,exports.validateScaffoldfyJsonFile=n.t;
1
+ const e=require(`./configurations-KSynsxPT.cjs`),t=require(`./run-tasks-CwrcjBpP.cjs`);require(`./config-CQ-mWBG5.cjs`);const n=require(`./validate-scaffoldfy-json-Dkaz9ueq.cjs`);require(`./scaffoldfy-config-json-validator-CpEXHRsI.cjs`);const r=require(`./src-BB92j9Us.cjs`);exports.clearConfigurationCache=e.O,exports.clearPlugins=t.s,exports.createTaskPlugin=t.r,exports.displayTasksDiff=t.p,exports.executePluginTask=t.i,exports.getDeleteDiff=t._,exports.getExecDiff=t.h,exports.getGitInitDiff=t.g,exports.getPlugin=t.c,exports.getPluginForTaskType=t.a,exports.getRegexReplaceDiff=t.y,exports.getRenameDiff=t.v,exports.getReplaceInFileDiff=t.b,exports.getTaskDiff=t.m,exports.getUpdateJsonDiff=t.x,exports.isPluginTaskType=t.o,exports.listPlugins=t.l,exports.loadAndMergeConfiguration=e.t,exports.loadConfiguration=e.i,exports.loadTasksWithInheritance=e.n,exports.mergeConfigurations=e.r,exports.registerHooks=t.f,exports.registerPlugin=t.u,exports.runWithTasks=r.t,exports.unregisterPlugin=t.d,exports.validateScaffoldfyJsonFile=n.t;
package/dist/index.d.cts CHANGED
@@ -228,7 +228,7 @@ interface DefaultValueConfig<T = string | number | boolean> {
228
228
  * - For explicit static values, use { type: 'static', value: yourValue }
229
229
  * - For conditional defaults, use { type: 'conditional', condition: 'expression', ifTrue: value, ifFalse: value }
230
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: {...} }
231
+ * - For exec-file, use { type: 'exec-file', file: 'path/to/script', args: [...], parameters: {...} }
232
232
  */
233
233
  type DefaultValue<T = string | number | boolean> = T | DefaultValueConfig<T> | ConditionalDefaultConfig<T> | ExecFileValueConfig;
234
234
  /**
@@ -382,7 +382,13 @@ interface PluginHooks {
382
382
  onError?: (error: Error, task?: TaskDefinition) => Promise<void>;
383
383
  }
384
384
  //#endregion
385
- //#region src/config-inheritance.d.ts
385
+ //#region src/configurations/cache.d.ts
386
+ /**
387
+ * Clear the configuration cache (useful for testing)
388
+ */
389
+ declare function clearConfigurationCache(): void;
390
+ //#endregion
391
+ //#region src/configurations/load-configuration.d.ts
386
392
  /**
387
393
  * Load a configuration file from local path or remote URL
388
394
  * @param configPath - Path or URL to the configuration file
@@ -390,6 +396,8 @@ interface PluginHooks {
390
396
  * @returns The loaded configuration
391
397
  */
392
398
  declare function loadConfiguration(configPath: string, visitedPaths?: Set<string>): Promise<TasksConfiguration>;
399
+ //#endregion
400
+ //#region src/configurations/load-tasks-with-inheritance.d.ts
393
401
  /**
394
402
  * Recursively load and merge configurations
395
403
  * @param configPath - Path or URL to the configuration file
@@ -398,17 +406,6 @@ declare function loadConfiguration(configPath: string, visitedPaths?: Set<string
398
406
  * @returns Merged configuration
399
407
  */
400
408
  declare function loadAndMergeConfiguration(configPath: string, baseDir?: string, visitedPaths?: Set<string>): Promise<TasksConfiguration>;
401
- /**
402
- * Merge multiple configurations
403
- * Later configurations override earlier ones for conflicting task IDs
404
- * @param configurations - Array of configurations to merge (in priority order)
405
- * @returns Merged configuration
406
- */
407
- declare function mergeConfigurations(configurations: TasksConfiguration[]): TasksConfiguration;
408
- /**
409
- * Clear the configuration cache (useful for testing)
410
- */
411
- declare function clearConfigurationCache(): void;
412
409
  /**
413
410
  * Load tasks from a configuration file with configuration inheritance support
414
411
  * @param tasksFilePath - Path to the tasks configuration file
@@ -423,11 +420,20 @@ declare function loadTasksWithInheritance(tasksFilePath: string, options?: {
423
420
  variables?: VariableDefinition[];
424
421
  prompts?: PromptDefinition[];
425
422
  enabled?: EnabledValue;
426
- templates?: TasksConfiguration[];
423
+ configs?: TasksConfiguration[];
427
424
  transformers?: Transformer[];
428
425
  }>;
429
426
  //#endregion
430
- //#region src/dry-run.d.ts
427
+ //#region src/configurations/merge-configurations.d.ts
428
+ /**
429
+ * Merge multiple configurations
430
+ * Later configurations override earlier ones for conflicting task IDs
431
+ * @param configurations - Array of configurations to merge (in priority order)
432
+ * @returns Merged configuration
433
+ */
434
+ declare function mergeConfigurations(configurations: TasksConfiguration[]): TasksConfiguration;
435
+ //#endregion
436
+ //#region src/dry-run/content-tasks.d.ts
431
437
  /**
432
438
  * Get diff for update-json task
433
439
  */
@@ -440,6 +446,8 @@ declare function getRegexReplaceDiff(config: RegexReplaceConfig, initConfig: Ini
440
446
  * Get diff for replace-in-file task
441
447
  */
442
448
  declare function getReplaceInFileDiff(config: ReplaceInFileConfig, initConfig: InitConfig): Promise<string>;
449
+ //#endregion
450
+ //#region src/dry-run/file-tasks.d.ts
443
451
  /**
444
452
  * Get diff for delete task
445
453
  */
@@ -448,6 +456,8 @@ declare function getDeleteDiff(config: DeleteConfig, initConfig: InitConfig): st
448
456
  * Get diff for rename task
449
457
  */
450
458
  declare function getRenameDiff(config: RenameConfig, initConfig: InitConfig): string;
459
+ //#endregion
460
+ //#region src/dry-run/system-tasks.d.ts
451
461
  /**
452
462
  * Get diff for git-init task
453
463
  */
@@ -456,6 +466,8 @@ declare function getGitInitDiff(config: GitInitConfig): string;
456
466
  * Get diff for exec task
457
467
  */
458
468
  declare function getExecDiff(config: ExecConfig, initConfig: InitConfig): string;
469
+ //#endregion
470
+ //#region src/dry-run/index.d.ts
459
471
  /**
460
472
  * Get diff for any task type
461
473
  */
@@ -465,7 +477,14 @@ declare function getTaskDiff(task: TaskDefinition, initConfig: InitConfig): Prom
465
477
  */
466
478
  declare function displayTasksDiff(tasks: TaskDefinition[], initConfig: InitConfig): Promise<void>;
467
479
  //#endregion
468
- //#region src/plugin.d.ts
480
+ //#region src/plugin-registry/hooks.d.ts
481
+ /**
482
+ * Register global lifecycle hooks
483
+ * @param hooks - Hook functions to register
484
+ */
485
+ declare function registerHooks(hooks: Partial<PluginHooks>): void;
486
+ //#endregion
487
+ //#region src/plugin-registry/plugin-registration.d.ts
469
488
  /**
470
489
  * Register a plugin
471
490
  * @param plugin - The plugin to register
@@ -482,18 +501,6 @@ declare function unregisterPlugin(pluginName: string): void;
482
501
  * @returns The plugin or undefined if not found
483
502
  */
484
503
  declare function getPlugin(pluginName: string): TaskPlugin | undefined;
485
- /**
486
- * Get a plugin for a task type
487
- * @param taskType - The task type
488
- * @returns The plugin or undefined if not found
489
- */
490
- declare function getPluginForTaskType(taskType: string): TaskPlugin | undefined;
491
- /**
492
- * Check if a task type is handled by a plugin
493
- * @param taskType - The task type to check
494
- * @returns True if a plugin handles this task type
495
- */
496
- declare function isPluginTaskType(taskType: string): boolean;
497
504
  /**
498
505
  * List all registered plugins
499
506
  * @returns Array of plugin names
@@ -503,11 +510,8 @@ declare function listPlugins(): string[];
503
510
  * Clear all registered plugins (useful for testing)
504
511
  */
505
512
  declare function clearPlugins(): void;
506
- /**
507
- * Register global lifecycle hooks
508
- * @param hooks - Hook functions to register
509
- */
510
- declare function registerHooks(hooks: Partial<PluginHooks>): void;
513
+ //#endregion
514
+ //#region src/plugin-registry/task-execution.d.ts
511
515
  /**
512
516
  * Execute a plugin task
513
517
  * @param task - The task to execute
@@ -519,6 +523,22 @@ declare function registerHooks(hooks: Partial<PluginHooks>): void;
519
523
  declare function executePluginTask(task: TaskDefinition, config: InitConfig, options: {
520
524
  dryRun: boolean;
521
525
  }): Promise<void>;
526
+ //#endregion
527
+ //#region src/plugin-registry/task-type-mapping.d.ts
528
+ /**
529
+ * Get a plugin for a task type
530
+ * @param taskType - The task type
531
+ * @returns The plugin or undefined if not found
532
+ */
533
+ declare function getPluginForTaskType(taskType: string): TaskPlugin | undefined;
534
+ /**
535
+ * Check if a task type is handled by a plugin
536
+ * @param taskType - The task type to check
537
+ * @returns True if a plugin handles this task type
538
+ */
539
+ declare function isPluginTaskType(taskType: string): boolean;
540
+ //#endregion
541
+ //#region src/plugin-registry/utils.d.ts
522
542
  /**
523
543
  * Create a simple task plugin
524
544
  * @param name - Plugin name
package/dist/index.d.ts CHANGED
@@ -228,7 +228,7 @@ interface DefaultValueConfig<T = string | number | boolean> {
228
228
  * - For explicit static values, use { type: 'static', value: yourValue }
229
229
  * - For conditional defaults, use { type: 'conditional', condition: 'expression', ifTrue: value, ifFalse: value }
230
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: {...} }
231
+ * - For exec-file, use { type: 'exec-file', file: 'path/to/script', args: [...], parameters: {...} }
232
232
  */
233
233
  type DefaultValue<T = string | number | boolean> = T | DefaultValueConfig<T> | ConditionalDefaultConfig<T> | ExecFileValueConfig;
234
234
  /**
@@ -382,7 +382,13 @@ interface PluginHooks {
382
382
  onError?: (error: Error, task?: TaskDefinition) => Promise<void>;
383
383
  }
384
384
  //#endregion
385
- //#region src/config-inheritance.d.ts
385
+ //#region src/configurations/cache.d.ts
386
+ /**
387
+ * Clear the configuration cache (useful for testing)
388
+ */
389
+ declare function clearConfigurationCache(): void;
390
+ //#endregion
391
+ //#region src/configurations/load-configuration.d.ts
386
392
  /**
387
393
  * Load a configuration file from local path or remote URL
388
394
  * @param configPath - Path or URL to the configuration file
@@ -390,6 +396,8 @@ interface PluginHooks {
390
396
  * @returns The loaded configuration
391
397
  */
392
398
  declare function loadConfiguration(configPath: string, visitedPaths?: Set<string>): Promise<TasksConfiguration>;
399
+ //#endregion
400
+ //#region src/configurations/load-tasks-with-inheritance.d.ts
393
401
  /**
394
402
  * Recursively load and merge configurations
395
403
  * @param configPath - Path or URL to the configuration file
@@ -398,17 +406,6 @@ declare function loadConfiguration(configPath: string, visitedPaths?: Set<string
398
406
  * @returns Merged configuration
399
407
  */
400
408
  declare function loadAndMergeConfiguration(configPath: string, baseDir?: string, visitedPaths?: Set<string>): Promise<TasksConfiguration>;
401
- /**
402
- * Merge multiple configurations
403
- * Later configurations override earlier ones for conflicting task IDs
404
- * @param configurations - Array of configurations to merge (in priority order)
405
- * @returns Merged configuration
406
- */
407
- declare function mergeConfigurations(configurations: TasksConfiguration[]): TasksConfiguration;
408
- /**
409
- * Clear the configuration cache (useful for testing)
410
- */
411
- declare function clearConfigurationCache(): void;
412
409
  /**
413
410
  * Load tasks from a configuration file with configuration inheritance support
414
411
  * @param tasksFilePath - Path to the tasks configuration file
@@ -423,11 +420,20 @@ declare function loadTasksWithInheritance(tasksFilePath: string, options?: {
423
420
  variables?: VariableDefinition[];
424
421
  prompts?: PromptDefinition[];
425
422
  enabled?: EnabledValue;
426
- templates?: TasksConfiguration[];
423
+ configs?: TasksConfiguration[];
427
424
  transformers?: Transformer[];
428
425
  }>;
429
426
  //#endregion
430
- //#region src/dry-run.d.ts
427
+ //#region src/configurations/merge-configurations.d.ts
428
+ /**
429
+ * Merge multiple configurations
430
+ * Later configurations override earlier ones for conflicting task IDs
431
+ * @param configurations - Array of configurations to merge (in priority order)
432
+ * @returns Merged configuration
433
+ */
434
+ declare function mergeConfigurations(configurations: TasksConfiguration[]): TasksConfiguration;
435
+ //#endregion
436
+ //#region src/dry-run/content-tasks.d.ts
431
437
  /**
432
438
  * Get diff for update-json task
433
439
  */
@@ -440,6 +446,8 @@ declare function getRegexReplaceDiff(config: RegexReplaceConfig, initConfig: Ini
440
446
  * Get diff for replace-in-file task
441
447
  */
442
448
  declare function getReplaceInFileDiff(config: ReplaceInFileConfig, initConfig: InitConfig): Promise<string>;
449
+ //#endregion
450
+ //#region src/dry-run/file-tasks.d.ts
443
451
  /**
444
452
  * Get diff for delete task
445
453
  */
@@ -448,6 +456,8 @@ declare function getDeleteDiff(config: DeleteConfig, initConfig: InitConfig): st
448
456
  * Get diff for rename task
449
457
  */
450
458
  declare function getRenameDiff(config: RenameConfig, initConfig: InitConfig): string;
459
+ //#endregion
460
+ //#region src/dry-run/system-tasks.d.ts
451
461
  /**
452
462
  * Get diff for git-init task
453
463
  */
@@ -456,6 +466,8 @@ declare function getGitInitDiff(config: GitInitConfig): string;
456
466
  * Get diff for exec task
457
467
  */
458
468
  declare function getExecDiff(config: ExecConfig, initConfig: InitConfig): string;
469
+ //#endregion
470
+ //#region src/dry-run/index.d.ts
459
471
  /**
460
472
  * Get diff for any task type
461
473
  */
@@ -465,7 +477,14 @@ declare function getTaskDiff(task: TaskDefinition, initConfig: InitConfig): Prom
465
477
  */
466
478
  declare function displayTasksDiff(tasks: TaskDefinition[], initConfig: InitConfig): Promise<void>;
467
479
  //#endregion
468
- //#region src/plugin.d.ts
480
+ //#region src/plugin-registry/hooks.d.ts
481
+ /**
482
+ * Register global lifecycle hooks
483
+ * @param hooks - Hook functions to register
484
+ */
485
+ declare function registerHooks(hooks: Partial<PluginHooks>): void;
486
+ //#endregion
487
+ //#region src/plugin-registry/plugin-registration.d.ts
469
488
  /**
470
489
  * Register a plugin
471
490
  * @param plugin - The plugin to register
@@ -482,18 +501,6 @@ declare function unregisterPlugin(pluginName: string): void;
482
501
  * @returns The plugin or undefined if not found
483
502
  */
484
503
  declare function getPlugin(pluginName: string): TaskPlugin | undefined;
485
- /**
486
- * Get a plugin for a task type
487
- * @param taskType - The task type
488
- * @returns The plugin or undefined if not found
489
- */
490
- declare function getPluginForTaskType(taskType: string): TaskPlugin | undefined;
491
- /**
492
- * Check if a task type is handled by a plugin
493
- * @param taskType - The task type to check
494
- * @returns True if a plugin handles this task type
495
- */
496
- declare function isPluginTaskType(taskType: string): boolean;
497
504
  /**
498
505
  * List all registered plugins
499
506
  * @returns Array of plugin names
@@ -503,11 +510,8 @@ declare function listPlugins(): string[];
503
510
  * Clear all registered plugins (useful for testing)
504
511
  */
505
512
  declare function clearPlugins(): void;
506
- /**
507
- * Register global lifecycle hooks
508
- * @param hooks - Hook functions to register
509
- */
510
- declare function registerHooks(hooks: Partial<PluginHooks>): void;
513
+ //#endregion
514
+ //#region src/plugin-registry/task-execution.d.ts
511
515
  /**
512
516
  * Execute a plugin task
513
517
  * @param task - The task to execute
@@ -519,6 +523,22 @@ declare function registerHooks(hooks: Partial<PluginHooks>): void;
519
523
  declare function executePluginTask(task: TaskDefinition, config: InitConfig, options: {
520
524
  dryRun: boolean;
521
525
  }): Promise<void>;
526
+ //#endregion
527
+ //#region src/plugin-registry/task-type-mapping.d.ts
528
+ /**
529
+ * Get a plugin for a task type
530
+ * @param taskType - The task type
531
+ * @returns The plugin or undefined if not found
532
+ */
533
+ declare function getPluginForTaskType(taskType: string): TaskPlugin | undefined;
534
+ /**
535
+ * Check if a task type is handled by a plugin
536
+ * @param taskType - The task type to check
537
+ * @returns True if a plugin handles this task type
538
+ */
539
+ declare function isPluginTaskType(taskType: string): boolean;
540
+ //#endregion
541
+ //#region src/plugin-registry/utils.d.ts
522
542
  /**
523
543
  * Create a simple task plugin
524
544
  * @param name - Plugin name
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,i as t,o as n,r,t as i}from"./config-inheritance-DLd3amMI.js";import{_ as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,o as g,p as _,r as v,s as y,u as b,v as x,x as S,y as C}from"./run-tasks-C0IZQ4SX.js";import"./config-nfiOxhDM.js";import{t as w}from"./validate-scaffoldfy-json-Cfq-nQjy.js";import"./scaffoldfy-config-json-validator-DP8-e4Yy.js";import{t as T}from"./src-CfaEuN4Q.js";export{i as clearConfigurationCache,v as clearPlugins,p as createTaskPlugin,_ as displayTasksDiff,o as executePluginTask,h as getDeleteDiff,f as getExecDiff,d as getGitInitDiff,g as getPlugin,y as getPluginForTaskType,a as getRegexReplaceDiff,x as getRenameDiff,C as getReplaceInFileDiff,s as getTaskDiff,S as getUpdateJsonDiff,c as isPluginTaskType,m as listPlugins,r as loadAndMergeConfiguration,t as loadConfiguration,e as loadTasksWithInheritance,n as mergeConfigurations,b as registerHooks,l as registerPlugin,T as runWithTasks,u as unregisterPlugin,w as validateScaffoldfyJsonFile};
1
+ import{O as e,i as t,n,r,t as i}from"./configurations-Bjun5iKX.js";import{_ as a,a as o,b as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,o as g,p as _,r as v,s as y,u as b,v as x,x as S,y as C}from"./run-tasks-Bd7MRNHo.js";import"./config-nfiOxhDM.js";import{t as w}from"./validate-scaffoldfy-json-Cfq-nQjy.js";import"./scaffoldfy-config-json-validator-DP8-e4Yy.js";import{t as T}from"./src-D8T_2x3i.js";export{e as clearConfigurationCache,y as clearPlugins,v as createTaskPlugin,_ as displayTasksDiff,p as executePluginTask,a as getDeleteDiff,f as getExecDiff,d as getGitInitDiff,c as getPlugin,o as getPluginForTaskType,C as getRegexReplaceDiff,x as getRenameDiff,s as getReplaceInFileDiff,h as getTaskDiff,S as getUpdateJsonDiff,g as isPluginTaskType,m as listPlugins,i as loadAndMergeConfiguration,t as loadConfiguration,n as loadTasksWithInheritance,r as mergeConfigurations,u as registerHooks,b as registerPlugin,T as runWithTasks,l as unregisterPlugin,w as validateScaffoldfyJsonFile};