@pixpilot/scaffoldfy 0.56.0 → 0.58.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.
Files changed (30) hide show
  1. package/README.md +15 -8
  2. package/dist/cli.cjs +21 -1
  3. package/dist/cli.js +11 -1
  4. package/dist/{configurations-C9hGwa2c.cjs → configurations-iSmGgORy.cjs} +1 -1
  5. package/dist/{configurations-C6TwZWBm.js → configurations-sRFCjZJV.js} +1 -1
  6. package/dist/index.cjs +1 -1
  7. package/dist/index.d.cts +41 -1
  8. package/dist/index.d.ts +41 -1
  9. package/dist/index.js +1 -1
  10. package/dist/{run-configuration-sequentially-BK8SqkMc.cjs → run-configuration-sequentially-CJCntxv9.cjs} +2 -2
  11. package/dist/run-configuration-sequentially-Cj1kYWTZ.js +4 -0
  12. package/dist/scaffoldfy-config-validator/cli.cjs +2 -2
  13. package/dist/scaffoldfy-config-validator/cli.js +2 -2
  14. package/dist/scaffoldfy-config-validator/index.cjs +1 -1
  15. package/dist/scaffoldfy-config-validator/index.js +1 -1
  16. package/dist/scaffoldfy-config-validator/validate-scaffoldfy-json.cjs +1 -1
  17. package/dist/scaffoldfy-config-validator/validate-scaffoldfy-json.js +1 -1
  18. package/dist/{src-BN2NvYkL.cjs → src-CJxBSFwf.cjs} +1 -1
  19. package/dist/{src-DnGLJZBR.js → src-Clk5H1_d.js} +1 -1
  20. package/dist/tasks-D-wcmZrW.js +27 -0
  21. package/dist/tasks-shq57X_d.cjs +27 -0
  22. package/dist/{utils-C0leVEJZ.cjs → utils-Co7iWW4X.cjs} +1 -1
  23. package/dist/{utils-vMswJANY.js → utils-uPeG29Q4.js} +1 -1
  24. package/dist/{validate-scaffoldfy-json-C0CBAgLY.js → validate-scaffoldfy-json-DZ1arWdk.js} +1 -1
  25. package/dist/{validate-scaffoldfy-json-vxz6VQQa.cjs → validate-scaffoldfy-json-DgRRmNSc.cjs} +1 -1
  26. package/package.json +1 -1
  27. package/schema/scaffoldfy.schema.json +14 -0
  28. package/dist/run-configuration-sequentially-CCnrvgMw.js +0 -4
  29. package/dist/tasks-CfkqwNGd.cjs +0 -23
  30. package/dist/tasks-cEW0YvaN.js +0 -23
package/README.md CHANGED
@@ -56,18 +56,25 @@ npx @pixpilot/scaffoldfy@latest --config https://example.com/scaffoldfy.json
56
56
 
57
57
  # Preview changes (dry run)
58
58
  npx @pixpilot/scaffoldfy@latest --dry-run
59
+
60
+ # Answer prompts with flags instead of being asked (camelCase or kebab-case ids)
61
+ npx @pixpilot/scaffoldfy@latest --config ./config.json --keep-example-packages --project-name my-app
62
+
63
+ # List the prompts of a config (including extended configs)
64
+ npx @pixpilot/scaffoldfy@latest --config ./config.json --help
59
65
  ```
60
66
 
61
67
  ### CLI Options
62
68
 
63
- | Option | Description |
64
- | ----------------- | ---------------------------------------------------------------------------------------------- |
65
- | `--config <path>` | Path or URL to config file (JSON, or TypeScript for local files; default: `./scaffoldfy.json`) |
66
- | `--dry-run` | Preview changes without applying them |
67
- | `--no-validate` | Skip schema validation of task configuration (validation is enabled by default) |
68
- | `--set <k=v>` | Answer a prompt up front instead of being asked (repeatable) |
69
- | `-h, --help` | Show help message |
70
- | `-v, --version` | Show version |
69
+ | Option | Description |
70
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------- |
71
+ | `--config <path>` | Path or URL to config file (JSON, or TypeScript for local files; default: `./scaffoldfy.json`) |
72
+ | `--dry-run` | Preview changes without applying them |
73
+ | `--no-validate` | Skip schema validation of task configuration (validation is enabled by default) |
74
+ | `--set <k=v>` | Answer a prompt up front instead of being asked (repeatable) |
75
+ | `--<promptId> [value]` | Answer any prompt (also from `extends`) by its id, e.g. `--keep-example-packages`, `--project-name=my-app` |
76
+ | `-h, --help` | Show help message; with `--config`, also list that config's prompts |
77
+ | `-v, --version` | Show version |
71
78
 
72
79
  ### Programmatic API
73
80
 
package/dist/cli.cjs CHANGED
@@ -1,2 +1,22 @@
1
1
  #!/usr/bin/env node
2
- const e=require(`./configurations-C9hGwa2c.cjs`);require(`./initial-config-CESipc-c.cjs`);const t=require(`./tasks-CfkqwNGd.cjs`),n=require(`./validate-scaffoldfy-json-vxz6VQQa.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const r=require(`./src-BN2NvYkL.cjs`);let i=require(`node:fs`);i=e.z(i);let a=require(`node:path`);a=e.z(a);let o=require(`node:process`);o=e.z(o);let s=require(`commander`);s=e.z(s);const c=1;function l(e,t=[]){return[...t,e]}const u=new s.Command,d=a.default.join(__dirname,`..`,`package.json`);let f=`0.0.0`;try{f=JSON.parse(i.default.readFileSync(d,`utf-8`)).version??`0.0.0`}catch{}u.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(f),u.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path or URL to task configuration file (JSON, JSONC, 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`).option(`--set <key=value>`,`Answer a prompt up front instead of being asked (repeatable)`,l).action(async s=>{s.debug===!0&&e.M(!0);try{s.set!=null&&t.f(Object.fromEntries(s.set.map(t.d)));let c=[],l,u,d,f,p;if(s.config!=null&&s.config!==``){let t=e.C(s.config),r=t?s.config:a.default.resolve(o.default.cwd(),s.config);if(t||i.default.existsSync(r))if(p=r,r.endsWith(`.ts`)||r.endsWith(`.mts`)){t&&(e.j(`❌ Remote TypeScript config files are not supported`,`error`),e.j(`Only JSON config files can be loaded from a URL`,`info`),o.default.exit(1)),e.j(`Loading tasks from TypeScript file: ${s.config}`,`info`);try{let t=await import(r);c=t.default??t.tasks??[],(!Array.isArray(c)||c.length===0)&&(e.j(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e.j(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e.j(`Failed to load TypeScript config file: ${s.config}`,`error`),t instanceof Error&&e.j(` Error: ${t.message}`,`error`),o.default.exit(1)}}else try{s.validate!==!1&&(e.O(`Validating task configuration against schema...`),n.r(e.y(await e.u(r)),{silent:!1}).valid||(e.j(``,`error`),e.j(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),o.default.exit(1)),e.j(`Configuration validated`,`success`));let t=e.g(`Loading config`),i;try{i=await e.n(r,{sequential:!0})}finally{e._(t)}if(i.configs!=null&&i.configs.length>0){let{runConfigurationSequentially:e}=await Promise.resolve().then(()=>require(`./run-configuration-sequentially-BK8SqkMc.cjs`)),{createInitialConfig:t}=await Promise.resolve().then(()=>require(`./initial-config-CbzFPdT_.cjs`));await e(i.configs,{dryRun:s.dryRun??!1,force:s.force??!1,configFilePath:r},t()),o.default.exit(0)}c=i.tasks,l=i.variables,u=i.prompts,d=i.enabled,f=i.transformers,Array.isArray(c)||(e.j(`❌ Invalid config file format`,`error`),e.j(`Expected JSON with { "tasks": [...] } structure`,`info`),o.default.exit(1))}catch(t){e.j(`Failed to load JSON config file: ${s.config}`,`error`),t instanceof Error&&e.j(` Error: ${t.message}`,`error`),o.default.exit(1)}else e.j(`Config file not found: ${s.config}`,`warn`)}let m=u!=null&&u.length>0||l!=null&&l.length>0;c.length===0&&!m&&(e.j(`❌ No tasks defined`,`error`),e.j(`Please provide tasks using one of these methods:`,`info`),e.j(` 1. Create a template-tasks.json file in the current directory`,`info`),e.j(` 2. Create a template-tasks.ts file in the current directory`,`info`),e.j(` 3. Use --config option to specify a different config file`,`info`),e.j(`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)),o.default.exit(1)),c.length===0?e.j(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e.j(`Loaded ${c.length} task(s)`,`success`),await r.t(c,{dryRun:s.dryRun,force:s.force,configFilePath:p,variables:l,prompts:u,configEnabled:d,transformers:f})}catch(t){if(e.j(`❌ CLI execution failed`,`error`),t instanceof Error){e.j(`Error: ${t.message}`,`error`);let n=o.default.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);o.default.exit(1)}}),u.parse(o.default.argv);
2
+ const e=require(`./configurations-iSmGgORy.cjs`);require(`./initial-config-CESipc-c.cjs`);const t=require(`./tasks-shq57X_d.cjs`),n=require(`./validate-scaffoldfy-json-DgRRmNSc.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const r=require(`./src-CJxBSFwf.cjs`);let i=require(`node:process`);i=e.z(i);let a=require(`node:fs`);a=e.z(a);let o=require(`node:path`);o=e.z(o);let s=require(`commander`);s=e.z(s);const c=1,l=`
3
+ Prompt answers:
4
+ Any prompt in the configuration, including prompts from extended configurations,
5
+ can be answered with a flag named after its id (camelCase or kebab-case):
6
+
7
+ --keepExamplePackages answer a yes/no prompt with yes
8
+ --keep-example-packages=false answer a yes/no prompt with no
9
+ --no-keep-example-packages answer a yes/no prompt with no
10
+ --project-name my-app answer any other prompt (or --project-name=my-app)
11
+
12
+ Run with --config <path> --help to list the prompts of a configuration.`;function u(e,t=[]){return[...t,e]}function d(){let e=o.default.join(__dirname,`..`,`package.json`);try{return JSON.parse(a.default.readFileSync(e,`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}}async function f(n,r){r.outputHelp();let s=n.config??``,c=e.C(s),l=c?s:o.default.resolve(i.default.cwd(),s),u=r.getOptionValueSource(`config`)===`cli`;if(!(s===``||l.endsWith(`.ts`)||l.endsWith(`.mts`))){if(!c&&!a.default.existsSync(l)){if(!u)return;e.j(`Config file not found: ${s}`,`error`),i.default.exit(1)}try{let{configs:n=[]}=await e.n(l,{sequential:!0});i.default.stdout.write(`\n${t.p(n)}\n`)}catch(t){e.j(`Could not list the prompts of ${s}`,`error`),t instanceof Error&&e.j(` Error: ${t.message}`,`error`),i.default.exit(1)}}}async function p(s,c){if(s.debug===!0&&e.M(!0),s.help===!0){await f(s,c);return}try{let l=t.m(c.args),u=(s.set??[]).map(t.d),d=(n,r=[])=>{try{t.f({...t.g(r,n),...t._(l,u,n)})}catch(t){e.j(t instanceof Error?t.message:String(t),`error`),i.default.exit(1)}},f=[],p,m,h,g,_;if(s.config!=null&&s.config!==``){let t=e.C(s.config),r=t?s.config:o.default.resolve(i.default.cwd(),s.config);if(t||a.default.existsSync(r))if(_=r,r.endsWith(`.ts`)||r.endsWith(`.mts`)){t&&(e.j(`❌ Remote TypeScript config files are not supported`,`error`),e.j(`Only JSON config files can be loaded from a URL`,`info`),i.default.exit(1)),e.j(`Loading tasks from TypeScript file: ${s.config}`,`info`);try{let t=await import(r);f=t.default??t.tasks??[],(!Array.isArray(f)||f.length===0)&&(e.j(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e.j(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e.j(`Failed to load TypeScript config file: ${s.config}`,`error`),t instanceof Error&&e.j(` Error: ${t.message}`,`error`),i.default.exit(1)}}else try{s.validate!==!1&&(e.O(`Validating task configuration against schema...`),n.r(e.y(await e.u(r)),{silent:!1}).valid||(e.j(``,`error`),e.j(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),i.default.exit(1)),e.j(`Configuration validated`,`success`));let t=e.g(`Loading config`),a;try{a=await e.n(r,{sequential:!0})}finally{e._(t)}if(a.configs!=null&&a.configs.length>0){let{runConfigurationSequentially:e}=await Promise.resolve().then(()=>require(`./run-configuration-sequentially-CJCntxv9.cjs`)),{createInitialConfig:t}=await Promise.resolve().then(()=>require(`./initial-config-CbzFPdT_.cjs`));d(a.configs.flatMap(e=>e.prompts??[]),a.configs),await e(a.configs,{dryRun:s.dryRun??!1,force:s.force??!1,configFilePath:r},t()),i.default.exit(0)}f=a.tasks,p=a.variables,m=a.prompts,h=a.enabled,g=a.transformers,Array.isArray(f)||(e.j(`❌ Invalid config file format`,`error`),e.j(`Expected JSON with { "tasks": [...] } structure`,`info`),i.default.exit(1))}catch(t){e.j(`Failed to load JSON config file: ${s.config}`,`error`),t instanceof Error&&e.j(` Error: ${t.message}`,`error`),i.default.exit(1)}else e.j(`Config file not found: ${s.config}`,`warn`)}let v=m!=null&&m.length>0||p!=null&&p.length>0;f.length===0&&!v&&(e.j(`❌ No tasks defined`,`error`),e.j(`Please provide tasks using one of these methods:`,`info`),e.j(` 1. Create a template-tasks.json file in the current directory`,`info`),e.j(` 2. Create a template-tasks.ts file in the current directory`,`info`),e.j(` 3. Use --config option to specify a different config file`,`info`),e.j(`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)),i.default.exit(1)),f.length===0?e.j(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e.j(`Loaded ${f.length} task(s)`,`success`),d(m??[]),await r.t(f,{dryRun:s.dryRun,force:s.force,configFilePath:_,variables:p,prompts:m,configEnabled:h,transformers:g})}catch(t){if(e.j(`❌ CLI execution failed`,`error`),t instanceof Error){e.j(`Error: ${t.message}`,`error`);let n=i.default.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);i.default.exit(1)}}function m(){return new s.Command().name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(d()).helpOption(!1).option(`-h, --help`,`Display help; with --config, also list the prompts of that configuration`).option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path or URL to task configuration file (JSON, JSONC, 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`).option(`--set <key=value>`,`Answer a prompt up front instead of being asked (repeatable)`,u).allowUnknownOption().allowExcessArguments().addHelpText(`after`,`
13
+ Prompt answers:
14
+ Any prompt in the configuration, including prompts from extended configurations,
15
+ can be answered with a flag named after its id (camelCase or kebab-case):
16
+
17
+ --keepExamplePackages answer a yes/no prompt with yes
18
+ --keep-example-packages=false answer a yes/no prompt with no
19
+ --no-keep-example-packages answer a yes/no prompt with no
20
+ --project-name my-app answer any other prompt (or --project-name=my-app)
21
+
22
+ Run with --config <path> --help to list the prompts of a configuration.`).action(p)}m().parse(i.default.argv);
package/dist/cli.js CHANGED
@@ -1,2 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,M as t,O as n,_ as r,g as i,j as a,n as o,u as s,y as c}from"./configurations-C6TwZWBm.js";import"./initial-config-Dt0jw4Vs.js";import{d as l,f as u}from"./tasks-cEW0YvaN.js";import{r as d}from"./validate-scaffoldfy-json-C0CBAgLY.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as f}from"./src-DnGLJZBR.js";import p from"node:path";import{fileURLToPath as m}from"node:url";import h from"node:fs";import g from"node:process";import{Command as _}from"commander";const v=()=>m(import.meta.url),y=(()=>p.dirname(v()))();function b(e,t=[]){return[...t,e]}const x=new _,S=p.join(y,`..`,`package.json`);let C=`0.0.0`;try{C=JSON.parse(h.readFileSync(S,`utf-8`)).version??`0.0.0`}catch{}x.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(C),x.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path or URL to task configuration file (JSON, JSONC, 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`).option(`--set <key=value>`,`Answer a prompt up front instead of being asked (repeatable)`,b).action(async m=>{m.debug===!0&&t(!0);try{m.set!=null&&u(Object.fromEntries(m.set.map(l)));let t=[],_,v,y,b,x;if(m.config!=null&&m.config!==``){let l=e(m.config),u=l?m.config:p.resolve(g.cwd(),m.config);if(l||h.existsSync(u))if(x=u,u.endsWith(`.ts`)||u.endsWith(`.mts`)){l&&(a(`❌ Remote TypeScript config files are not supported`,`error`),a(`Only JSON config files can be loaded from a URL`,`info`),g.exit(1)),a(`Loading tasks from TypeScript file: ${m.config}`,`info`);try{let e=await import(u);t=e.default??e.tasks??[],(!Array.isArray(t)||t.length===0)&&(a(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),a(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(e){a(`Failed to load TypeScript config file: ${m.config}`,`error`),e instanceof Error&&a(` Error: ${e.message}`,`error`),g.exit(1)}}else try{m.validate!==!1&&(n(`Validating task configuration against schema...`),d(c(await s(u)),{silent:!1}).valid||(a(``,`error`),a(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),g.exit(1)),a(`Configuration validated`,`success`));let e=i(`Loading config`),l;try{l=await o(u,{sequential:!0})}finally{r(e)}if(l.configs!=null&&l.configs.length>0){let{runConfigurationSequentially:e}=await import(`./run-configuration-sequentially-CCnrvgMw.js`),{createInitialConfig:t}=await import(`./initial-config-V9mm6hls.js`);await e(l.configs,{dryRun:m.dryRun??!1,force:m.force??!1,configFilePath:u},t()),g.exit(0)}t=l.tasks,_=l.variables,v=l.prompts,y=l.enabled,b=l.transformers,Array.isArray(t)||(a(`❌ Invalid config file format`,`error`),a(`Expected JSON with { "tasks": [...] } structure`,`info`),g.exit(1))}catch(e){a(`Failed to load JSON config file: ${m.config}`,`error`),e instanceof Error&&a(` Error: ${e.message}`,`error`),g.exit(1)}else a(`Config file not found: ${m.config}`,`warn`)}let S=v!=null&&v.length>0||_!=null&&_.length>0;t.length===0&&!S&&(a(`❌ No tasks defined`,`error`),a(`Please provide tasks using one of these methods:`,`info`),a(` 1. Create a template-tasks.json file in the current directory`,`info`),a(` 2. Create a template-tasks.ts file in the current directory`,`info`),a(` 3. Use --config option to specify a different config file`,`info`),a(`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)),g.exit(1)),t.length===0?a(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):a(`Loaded ${t.length} task(s)`,`success`),await f(t,{dryRun:m.dryRun,force:m.force,configFilePath:x,variables:_,prompts:v,configEnabled:y,transformers:b})}catch(e){if(a(`❌ CLI execution failed`,`error`),e instanceof Error){a(`Error: ${e.message}`,`error`);let t=g.env.DEBUG;t!=null&&t!==``&&console.error(e.stack)}else console.error(e);g.exit(1)}}),x.parse(g.argv);export{};
2
+ import{C as e,M as t,O as n,_ as r,g as i,j as a,n as o,u as s,y as c}from"./configurations-sRFCjZJV.js";import"./initial-config-Dt0jw4Vs.js";import{_ as l,d as u,f as d,g as f,m as p,p as m}from"./tasks-D-wcmZrW.js";import{r as h}from"./validate-scaffoldfy-json-DZ1arWdk.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as g}from"./src-Clk5H1_d.js";import _ from"node:process";import v from"node:path";import{fileURLToPath as y}from"node:url";import b from"node:fs";import{Command as x}from"commander";const S=()=>y(import.meta.url),C=(()=>v.dirname(S()))();function w(e,t=[]){return[...t,e]}function T(){let e=v.join(C,`..`,`package.json`);try{return JSON.parse(b.readFileSync(e,`utf-8`)).version??`0.0.0`}catch{return`0.0.0`}}async function E(t,n){n.outputHelp();let r=t.config??``,i=e(r),s=i?r:v.resolve(_.cwd(),r),c=n.getOptionValueSource(`config`)===`cli`;if(!(r===``||s.endsWith(`.ts`)||s.endsWith(`.mts`))){if(!i&&!b.existsSync(s)){if(!c)return;a(`Config file not found: ${r}`,`error`),_.exit(1)}try{let{configs:e=[]}=await o(s,{sequential:!0});_.stdout.write(`\n${m(e)}\n`)}catch(e){a(`Could not list the prompts of ${r}`,`error`),e instanceof Error&&a(` Error: ${e.message}`,`error`),_.exit(1)}}}async function D(m,y){if(m.debug===!0&&t(!0),m.help===!0){await E(m,y);return}try{let t=p(y.args),x=(m.set??[]).map(u),S=(e,n=[])=>{try{d({...f(n,e),...l(t,x,e)})}catch(e){a(e instanceof Error?e.message:String(e),`error`),_.exit(1)}},C=[],w,T,E,D,O;if(m.config!=null&&m.config!==``){let t=e(m.config),l=t?m.config:v.resolve(_.cwd(),m.config);if(t||b.existsSync(l))if(O=l,l.endsWith(`.ts`)||l.endsWith(`.mts`)){t&&(a(`❌ Remote TypeScript config files are not supported`,`error`),a(`Only JSON config files can be loaded from a URL`,`info`),_.exit(1)),a(`Loading tasks from TypeScript file: ${m.config}`,`info`);try{let e=await import(l);C=e.default??e.tasks??[],(!Array.isArray(C)||C.length===0)&&(a(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),a(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(e){a(`Failed to load TypeScript config file: ${m.config}`,`error`),e instanceof Error&&a(` Error: ${e.message}`,`error`),_.exit(1)}}else try{m.validate!==!1&&(n(`Validating task configuration against schema...`),h(c(await s(l)),{silent:!1}).valid||(a(``,`error`),a(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),_.exit(1)),a(`Configuration validated`,`success`));let e=i(`Loading config`),t;try{t=await o(l,{sequential:!0})}finally{r(e)}if(t.configs!=null&&t.configs.length>0){let{runConfigurationSequentially:e}=await import(`./run-configuration-sequentially-Cj1kYWTZ.js`),{createInitialConfig:n}=await import(`./initial-config-V9mm6hls.js`);S(t.configs.flatMap(e=>e.prompts??[]),t.configs),await e(t.configs,{dryRun:m.dryRun??!1,force:m.force??!1,configFilePath:l},n()),_.exit(0)}C=t.tasks,w=t.variables,T=t.prompts,E=t.enabled,D=t.transformers,Array.isArray(C)||(a(`❌ Invalid config file format`,`error`),a(`Expected JSON with { "tasks": [...] } structure`,`info`),_.exit(1))}catch(e){a(`Failed to load JSON config file: ${m.config}`,`error`),e instanceof Error&&a(` Error: ${e.message}`,`error`),_.exit(1)}else a(`Config file not found: ${m.config}`,`warn`)}let k=T!=null&&T.length>0||w!=null&&w.length>0;C.length===0&&!k&&(a(`❌ No tasks defined`,`error`),a(`Please provide tasks using one of these methods:`,`info`),a(` 1. Create a template-tasks.json file in the current directory`,`info`),a(` 2. Create a template-tasks.ts file in the current directory`,`info`),a(` 3. Use --config option to specify a different config file`,`info`),a(`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)),_.exit(1)),C.length===0?a(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):a(`Loaded ${C.length} task(s)`,`success`),S(T??[]),await g(C,{dryRun:m.dryRun,force:m.force,configFilePath:O,variables:w,prompts:T,configEnabled:E,transformers:D})}catch(e){if(a(`❌ CLI execution failed`,`error`),e instanceof Error){a(`Error: ${e.message}`,`error`);let t=_.env.DEBUG;t!=null&&t!==``&&console.error(e.stack)}else console.error(e);_.exit(1)}}function O(){return new x().name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(T()).helpOption(!1).option(`-h, --help`,`Display help; with --config, also list the prompts of that configuration`).option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path or URL to task configuration file (JSON, JSONC, 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`).option(`--set <key=value>`,`Answer a prompt up front instead of being asked (repeatable)`,w).allowUnknownOption().allowExcessArguments().addHelpText(`after`,`
3
+ Prompt answers:
4
+ Any prompt in the configuration, including prompts from extended configurations,
5
+ can be answered with a flag named after its id (camelCase or kebab-case):
6
+
7
+ --keepExamplePackages answer a yes/no prompt with yes
8
+ --keep-example-packages=false answer a yes/no prompt with no
9
+ --no-keep-example-packages answer a yes/no prompt with no
10
+ --project-name my-app answer any other prompt (or --project-name=my-app)
11
+
12
+ Run with --config <path> --help to list the prompts of a configuration.`).action(D)}O().parse(_.argv);export{};
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:fs`);c=s(c);let l=require(`node:path`);l=s(l);let u=require(`node:process`);u=s(u);let d=require(`node:util`);d=s(d),require(`handlebars`);let f=require(`jsonc-parser`);f=s(f);let p=require(`node:os`);p=s(p);let m=require(`node:child_process`);m=s(m);let h=require(`case-anything`);h=s(h);let g=require(`node:console`);g=s(g);var _=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},v=class e extends _{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 forTaskDependency(t){return new e(`Circular dependency detected involving task: ${t}`,[t])}static forConfigDependencies(t,n){let r=[...t,n];return new e(`Circular dependency detected in template dependencies: ${r.join(` -> `)}`,r)}},ee=class e extends _{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)}},y=class e extends _{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)}},te=class e extends _{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)}},b=class e extends _{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)}},x=class e extends _{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)}},S=class e extends _{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`)}},ne=class e extends _{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)}},re=class e extends _{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`)}static invalidValue(t,n,r){return new e(`Invalid value "${n}" for prompt "${t}": ${r}`,t,`invalid_value`)}},ie=class e extends _{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`)}},C=class e extends _{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`)}};let w=!1;function ae(e){w=e}const T={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},E={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},D=`\x1B[0m`;function O(e){w&&console.log(`${E.debug}${T.debug} ${e}${D}`)}function oe(e){console.log(`${E.info}${T.info} ${e}${D}`)}function k(e){console.log(`${E.success}${T.success} ${e}${D}`)}function A(e){console.log(`${E.warn}${T.warn} ${e}${D}`)}function j(e){console.log(`${E.error}${T.error} ${e}${D}`)}function M(e,t=`info`){switch(t){case`debug`:O(e);break;case`info`:oe(e);break;case`success`:k(e);break;case`warn`:A(e);break;case`error`:j(e);break}}function N(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&&(M(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&M(` Error: ${t.message}`,`warn`)),!1)}}function se(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 N(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function ce(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-C0leVEJZ.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-C0leVEJZ.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 N(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function le(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function ue(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 de(e,t){let n=ue(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-C0leVEJZ.cjs`));return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await Promise.resolve().then(()=>require(`./utils-C0leVEJZ.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 le(n.value,t)}return!0}function P(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function F(e){if(e==null||e===``)return`current configuration`;if(P(e))return e;let t=u.default.cwd();return e.startsWith(t)?l.default.relative(t,e):e}function fe(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 I(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 L(e){let t=[],n=(0,f.parse)(e,t,{allowTrailingComma:!0});if(t.length>0){let e=t.map(e=>`${(0,f.printParseErrorCode)(e.error)} at offset ${e.offset}`).join(`, `);throw Error(`Invalid JSON or JSONC: ${e}`)}return n}function R(e,t){if(P(e))return e;if(t==null||t===``)return l.default.isAbsolute(e)?e:l.default.resolve(u.default.cwd(),e);if(P(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 n=l.default.dirname(t);return l.default.isAbsolute(e)?e:l.default.resolve(n,e)}let z=0;const B={};function V(e=`Loading`){let t=[`|`,`/`,`-`,`\\`,`.`,`..`,`...`],n=0;z++;let r=z;return process.stdout.write(`${e} `),B[r]=setInterval(()=>{process.stdout.write(`\r${e} ${t[n%t.length]} `),n++},120),r}function H(e){B[e]&&(clearInterval(B[e]),delete B[e],process.stdout.write(`\r`),process.stdout.write(`${` `.repeat(30)}\r`))}async function U(e){let t=new URL(e).pathname.split(`/`).pop(),n=V(`Loading ${t==null||t===``?e:t}`);try{return O(`Fetching remote file: ${e}`),await _e(e)}finally{H(n)}}async function W(e){let{file:t,sourceUrl:n,tempFileExtension:r=`.tmp`,tempFilePrefix:i=`scaffoldfy`}=e,a=t,o,s,u=!1;if(P(t)){o=t;let e=await U(o);u=!0;let n=p.default.tmpdir(),a=`${i}-${Date.now()}${r}`;s=l.default.join(n,a),c.default.writeFileSync(s,e,`utf-8`),O(`Remote file saved to temporary location: ${s}`)}else if(o=R(t,n),P(o)){let e=await U(o);u=!0;let t=p.default.tmpdir(),n=`${i}-${Date.now()}${r}`;s=l.default.join(t,n),c.default.writeFileSync(s,e,`utf-8`),O(`Remote file saved to temporary location: ${s}`)}else{if(!c.default.existsSync(o))throw Error(`File not found: ${o}`);s=o,O(`Using local file: ${s}`)}return{localFilePath:s,isRemote:u,originalPath:a,resolvedPath:o}}function G(e){if(e.isRemote&&c.default.existsSync(e.localFilePath))try{c.default.unlinkSync(e.localFilePath),O(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){O(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function K(e){switch(l.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 pe(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 me(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function q(e,t){let n=X(e.file,t),r=e.args?.map(e=>X(e,t))??[],i={};if(e.parameters)for(let[n,r]of Object.entries(e.parameters))i[n]=X(r,t);let a=e.cwd!=null&&e.cwd!==``?l.default.join(u.default.cwd(),X(e.cwd,t)):u.default.cwd(),o=await W({file:n,...e.sourceUrl!=null&&e.sourceUrl!==``&&{sourceUrl:e.sourceUrl},tempFileExtension:me(e.runtime??K(n)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:s}=o,c=e.runtime??K(s)??`node`;!e.runtime&&!K(s)&&M(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let t=pe(c,s),n=r.join(` `),o=n?`${t} ${n}`:t;O(`Executing: ${o}`);let l=(0,m.execSync)(o,{cwd:a,stdio:e.captureOutput?[`pipe`,`pipe`,`inherit`]:`inherit`,env:{...u.default.env,...i},encoding:e.captureOutput?`utf-8`:void 0});if(e.captureOutput)return O(`Script executed successfully with output`),typeof l==`string`?l:void 0;O(`Script executed successfully`);return}finally{G(o)}}async function J(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 o=e;if(o.type===`conditional`){if(!i){M(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof o.condition!=`string`){M(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=N(o.condition,i)?o.ifTrue:o.ifFalse;return typeof e==`object`&&e?await J(e,t):e}catch(e){M(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec`){let e=o.value;if(typeof e!=`string`){M(`${r} "${n}": exec value must have a string command`,`error`);return}try{return Y((0,m.execSync)(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){M(`${r} "${n}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec-file`){let e=o;if(typeof e.file!=`string`){M(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await q({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:Y(t.trim())}catch(e){M(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`static`)return o.value;if(o.type===`interpolate`){let e=o.value;if(typeof e!=`string`){M(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return M(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return X(e,i)}catch(t){return M(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(o.type!==void 0){M(`${r} "${n}": unknown value type "${o.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function Y(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 X(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>I(t,n)?.toString()??``)}const he=(0,d.promisify)(c.default.readFile),Z=new Map;function ge(){Z.clear()}async function _e(e){if(P(e))return ve(e);if(!c.default.existsSync(e))throw ee.forPath(e);return he(e,`utf-8`)}async function ve(e){let t=Z.get(e);if(t!=null)return t;let n=(async()=>{try{let t=await fetch(e);if(!t.ok)throw y.forUrl(e,t.status,t.statusText);return await t.text()}catch(t){throw t instanceof Error&&t.message.includes(`Failed to fetch`)?t:y.forUrl(e,t instanceof Error?t:void 0)}})();Z.set(e,n);try{return await n}catch(t){throw Z.delete(e),t}}const Q=new Map;function ye(){Q.clear(),ge()}const be=(0,d.promisify)(c.default.readFile);async function xe(e,t=new Set){let n=P(e),r;if(r=n||l.default.isAbsolute(e)?e:l.default.resolve(u.default.cwd(),e),Q.has(r))return Q.get(r);if(t.has(r))throw v.forConfigurationInheritance(t,r);t.add(r);let i;if(n)i=await ve(r);else{if(!c.default.existsSync(r))throw ee.forPath(r);i=await be(r,`utf-8`)}let a;try{a=L(i)}catch(e){throw te.forFile(r,e instanceof Error?e:Error(String(e)))}if(a.name==null||a.name.trim()===``)throw b.missingName(r);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(a.name))throw b.invalidNameFormat(r,a.name);if(a.tasks!==void 0&&!Array.isArray(a.tasks))throw b.tasksNotArray(r);a.tasks===void 0&&(a.tasks=[]);for(let e of a.tasks)e.$sourceUrl=r;if(a.variables!==void 0)for(let e of a.variables)e.$sourceUrl=r;if(a.prompts!==void 0)for(let e of a.prompts)e.$sourceUrl=r;return Q.set(r,a),a}function Se(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,u=new Set;function d(e){if(l.has(e))return;if(u.has(e))throw v.forConfigDependencies(Array.from(u),e);u.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)d(e)}u.delete(e),l.add(e),t!=null&&!a.has(e)&&c.push(t)}for(let e of s)d(e.name);let f=[],p=0;for(let t=0;t<e.length;t++){let n=e[t];a.has(n.name)?f.push(n):p<c.length&&(f.push(c[p]),p++)}return f}async function Ce(e,t,n,r,i,a){let o=P(e),s;if(s=o||l.default.isAbsolute(e)?e:t==null?l.default.resolve(u.default.cwd(),e):P(t)?new URL(e,t).href:l.default.resolve(t,e),n.has(s))return;if(r.has(s))throw v.forConfigurationInheritance(r,s);r.add(s);let c=await xe(s),d=P(s)?new URL(`.`,s).href:l.default.dirname(s);if(c.extends!=null&&c.extends!==``){let e=Array.isArray(c.extends)?c.extends:[c.extends],t=c.enabled??a;for(let a of e)await Ce(a,d,n,r,i,t)}r.delete(s),n.add(s);let f=c.enabled==null&&a!=null?{...c,enabled:a}:c;i.push(f)}async function we(e,t,n=new Set){let r=[];return await Ce(e,t,n,new Set,r),Se(r)}var Te=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:`capitalCase`,type:`capitalCase`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`},{id:`adaCase`,type:`adaCase`},{id:`cobolCase`,type:`cobolCase`},{id:`dotNotation`,type:`dotNotation`},{id:`pathCase`,type:`pathCase`},{id:`spaceCase`,type:`spaceCase`},{id:`trainCase`,type:`trainCase`},{id:`upperCamelCase`,type:`upperCamelCase`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&M(`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 C.notFound(e);try{return await this.executeTransformer(r,t,n)}catch(t){throw t instanceof C?t:C.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`capitalCase`:return this.executeCapitalCase(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`adaCase`:return this.executeAdaCase(t);case`cobolCase`:return this.executeCobolCase(t);case`dotNotation`:return this.executeDotNotation(t);case`pathCase`:return this.executePathCase(t);case`spaceCase`:return this.executeSpaceCase(t);case`trainCase`:return this.executeTrainCase(t);case`upperCamelCase`:return this.executeUpperCamelCase(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw C.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 C.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 C.executionFailed(e.id,`Expression evaluation failed: ${t instanceof Error?t.message:String(t)}`)}}executeLowercase(e){return(0,h.lowerCase)(String(e))}executeUppercase(e){return(0,h.upperCase)(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 C.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 C.executionFailed(e.id,`Chain transformer must have at least one transformer`);return this.executeChain(r,t,n)}executeCapitalize(e){return(0,h.capitalCase)(String(e))}executeTitlecase(e){return(0,h.kebabCase)(String(e)).split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}executeCamelcase(e){return(0,h.camelCase)(String(e))}executePascalcase(e){return(0,h.pascalCase)(String(e))}executeSnakecase(e){return(0,h.snakeCase)(String(e))}executeKebabcase(e){return(0,h.kebabCase)(String(e))}executeConstantcase(e){return(0,h.constantCase)(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(0,h.kebabCase)(String(e))}executeUnderscore(e){return(0,h.snakeCase)(String(e))}executeCapitalCase(e){return(0,h.capitalCase)(String(e))}executeAdaCase(e){return(0,h.adaCase)(String(e))}executeCobolCase(e){return(0,h.cobolCase)(String(e))}executeDotNotation(e){return(0,h.dotNotation)(String(e))}executePathCase(e){return(0,h.pathCase)(String(e))}executeSpaceCase(e){return(0,h.spaceCase)(String(e))}executeTrainCase(e){return(0,h.trainCase)(String(e))}executeUpperCamelCase(e){return(0,h.upperCamelCase)(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};const Ee=new Te;async function De(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 Ee.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}function Oe(e,t){if((t.override??`merge`)===`replace`){M(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}M(` → 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}async function ke(e,t,n){let r=new Map;for(let i of e){if(n?.skipConditional===!0&&typeof i.value==`object`&&i.value!==null&&!Array.isArray(i.value)&&i.value.type===`conditional`)continue;if(i.$configEnabled!=null){let e={...t};for(let[t,n]of r.entries())e[t]=n;if(!await ce(i.$configEnabled,e))continue}let e={...t};for(let[t,n]of r.entries())e[t]=n;let a=await J(i.value,{id:i.id,contextType:`Variable`,context:e,...i.$sourceUrl!=null&&{sourceUrl:i.$sourceUrl}});a!==void 0&&r.set(i.id,a)}return r}function Ae(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}function je(e,t){if((t.override??`merge`)===`replace`){M(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}M(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}const Me={template:[[`template`,`templateFile`]]};function Ne(e,t,n){let r={...e},i=Me[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 Pe(e,t){let n=Me[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 Fe(e,t){if((t.override??`merge`)===`replace`){(0,g.log)(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),(0,g.log)(` Base: ${F(e.$sourceUrl)}`,`info`),(0,g.log)(` Override: ${F(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}(0,g.log)(` → Merging task "${t.id}"`,`info`),(0,g.log)(` Base: ${F(e.$sourceUrl)}`,`info`),(0,g.log)(` Override: ${F(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=Ne(e.config,t.config,t.type);let r=Pe(t.type,n);r!==null&&r.length>0&&((0,g.log)(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),(0,g.log)(` 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}function $(e,t,n){let r=new Map;for(let t of e){if(r.has(t.id))throw x.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 x.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 x.forId(e.id,`prompt`,r.get(e.id));r.set(e.id,`prompt`)}}function Ie(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return $(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){M(`⊘ 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 S.forPrompt(e.id);let t=je(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 S.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 S.forTask(e.id,F(n.$sourceUrl),F(e.$sourceUrl))}let n=Fe(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;$(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}async function Le(e,t,n=new Set){return Ie(await we(e,t,n))}async function Re(e,t){if(O(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await we(e);return O(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await Le(e);M(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&M(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&M(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&M(`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,`A`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`L`,{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`R`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`z`,{enumerable:!0,get:function(){return s}});
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:process`);c=s(c);let l=require(`node:fs`);l=s(l);let u=require(`node:path`);u=s(u);let d=require(`node:util`);d=s(d),require(`handlebars`);let f=require(`jsonc-parser`);f=s(f);let p=require(`node:os`);p=s(p);let m=require(`node:child_process`);m=s(m);let h=require(`case-anything`);h=s(h);let g=require(`node:console`);g=s(g);var _=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},v=class e extends _{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 forTaskDependency(t){return new e(`Circular dependency detected involving task: ${t}`,[t])}static forConfigDependencies(t,n){let r=[...t,n];return new e(`Circular dependency detected in template dependencies: ${r.join(` -> `)}`,r)}},ee=class e extends _{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)}},y=class e extends _{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)}},te=class e extends _{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)}},b=class e extends _{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)}},x=class e extends _{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)}},S=class e extends _{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`)}},ne=class e extends _{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)}},re=class e extends _{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`)}static invalidValue(t,n,r){return new e(`Invalid value "${n}" for prompt "${t}": ${r}`,t,`invalid_value`)}},ie=class e extends _{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`)}},C=class e extends _{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`)}};let w=!1;function ae(e){w=e}const T={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},E={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},D=`\x1B[0m`;function O(e){w&&console.log(`${E.debug}${T.debug} ${e}${D}`)}function oe(e){console.log(`${E.info}${T.info} ${e}${D}`)}function k(e){console.log(`${E.success}${T.success} ${e}${D}`)}function A(e){console.log(`${E.warn}${T.warn} ${e}${D}`)}function j(e){console.log(`${E.error}${T.error} ${e}${D}`)}function M(e,t=`info`){switch(t){case`debug`:O(e);break;case`info`:oe(e);break;case`success`:k(e);break;case`warn`:A(e);break;case`error`:j(e);break}}function N(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&&(M(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&M(` Error: ${t.message}`,`warn`)),!1)}}function se(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 N(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function ce(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-Co7iWW4X.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-Co7iWW4X.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 N(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function le(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function ue(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 de(e,t){let n=ue(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-Co7iWW4X.cjs`));return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await Promise.resolve().then(()=>require(`./utils-Co7iWW4X.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 le(n.value,t)}return!0}function P(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function F(e){if(e==null||e===``)return`current configuration`;if(P(e))return e;let t=c.default.cwd();return e.startsWith(t)?u.default.relative(t,e):e}function fe(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 I(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 L(e){let t=[],n=(0,f.parse)(e,t,{allowTrailingComma:!0});if(t.length>0){let e=t.map(e=>`${(0,f.printParseErrorCode)(e.error)} at offset ${e.offset}`).join(`, `);throw Error(`Invalid JSON or JSONC: ${e}`)}return n}function R(e,t){if(P(e))return e;if(t==null||t===``)return u.default.isAbsolute(e)?e:u.default.resolve(c.default.cwd(),e);if(P(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 n=u.default.dirname(t);return u.default.isAbsolute(e)?e:u.default.resolve(n,e)}let z=0;const B={};function V(e=`Loading`){let t=[`|`,`/`,`-`,`\\`,`.`,`..`,`...`],n=0;z++;let r=z;return process.stdout.write(`${e} `),B[r]=setInterval(()=>{process.stdout.write(`\r${e} ${t[n%t.length]} `),n++},120),r}function H(e){B[e]&&(clearInterval(B[e]),delete B[e],process.stdout.write(`\r`),process.stdout.write(`${` `.repeat(30)}\r`))}async function U(e){let t=new URL(e).pathname.split(`/`).pop(),n=V(`Loading ${t==null||t===``?e:t}`);try{return O(`Fetching remote file: ${e}`),await _e(e)}finally{H(n)}}async function W(e){let{file:t,sourceUrl:n,tempFileExtension:r=`.tmp`,tempFilePrefix:i=`scaffoldfy`}=e,a=t,o,s,c=!1;if(P(t)){o=t;let e=await U(o);c=!0;let n=p.default.tmpdir(),a=`${i}-${Date.now()}${r}`;s=u.default.join(n,a),l.default.writeFileSync(s,e,`utf-8`),O(`Remote file saved to temporary location: ${s}`)}else if(o=R(t,n),P(o)){let e=await U(o);c=!0;let t=p.default.tmpdir(),n=`${i}-${Date.now()}${r}`;s=u.default.join(t,n),l.default.writeFileSync(s,e,`utf-8`),O(`Remote file saved to temporary location: ${s}`)}else{if(!l.default.existsSync(o))throw Error(`File not found: ${o}`);s=o,O(`Using local file: ${s}`)}return{localFilePath:s,isRemote:c,originalPath:a,resolvedPath:o}}function G(e){if(e.isRemote&&l.default.existsSync(e.localFilePath))try{l.default.unlinkSync(e.localFilePath),O(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){O(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function K(e){switch(u.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 pe(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 me(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function q(e,t){let n=X(e.file,t),r=e.args?.map(e=>X(e,t))??[],i={};if(e.parameters)for(let[n,r]of Object.entries(e.parameters))i[n]=X(r,t);let a=e.cwd!=null&&e.cwd!==``?u.default.join(c.default.cwd(),X(e.cwd,t)):c.default.cwd(),o=await W({file:n,...e.sourceUrl!=null&&e.sourceUrl!==``&&{sourceUrl:e.sourceUrl},tempFileExtension:me(e.runtime??K(n)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:s}=o,l=e.runtime??K(s)??`node`;!e.runtime&&!K(s)&&M(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let t=pe(l,s),n=r.join(` `),o=n?`${t} ${n}`:t;O(`Executing: ${o}`);let u=(0,m.execSync)(o,{cwd:a,stdio:e.captureOutput?[`pipe`,`pipe`,`inherit`]:`inherit`,env:{...c.default.env,...i},encoding:e.captureOutput?`utf-8`:void 0});if(e.captureOutput)return O(`Script executed successfully with output`),typeof u==`string`?u:void 0;O(`Script executed successfully`);return}finally{G(o)}}async function J(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 o=e;if(o.type===`conditional`){if(!i){M(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof o.condition!=`string`){M(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=N(o.condition,i)?o.ifTrue:o.ifFalse;return typeof e==`object`&&e?await J(e,t):e}catch(e){M(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec`){let e=o.value;if(typeof e!=`string`){M(`${r} "${n}": exec value must have a string command`,`error`);return}try{return Y((0,m.execSync)(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){M(`${r} "${n}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec-file`){let e=o;if(typeof e.file!=`string`){M(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await q({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:Y(t.trim())}catch(e){M(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`static`)return o.value;if(o.type===`interpolate`){let e=o.value;if(typeof e!=`string`){M(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return M(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return X(e,i)}catch(t){return M(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(o.type!==void 0){M(`${r} "${n}": unknown value type "${o.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function Y(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 X(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>I(t,n)?.toString()??``)}const he=(0,d.promisify)(l.default.readFile),Z=new Map;function ge(){Z.clear()}async function _e(e){if(P(e))return ve(e);if(!l.default.existsSync(e))throw ee.forPath(e);return he(e,`utf-8`)}async function ve(e){let t=Z.get(e);if(t!=null)return t;let n=(async()=>{try{let t=await fetch(e);if(!t.ok)throw y.forUrl(e,t.status,t.statusText);return await t.text()}catch(t){throw t instanceof Error&&t.message.includes(`Failed to fetch`)?t:y.forUrl(e,t instanceof Error?t:void 0)}})();Z.set(e,n);try{return await n}catch(t){throw Z.delete(e),t}}const Q=new Map;function ye(){Q.clear(),ge()}const be=(0,d.promisify)(l.default.readFile);async function xe(e,t=new Set){let n=P(e),r;if(r=n||u.default.isAbsolute(e)?e:u.default.resolve(c.default.cwd(),e),Q.has(r))return Q.get(r);if(t.has(r))throw v.forConfigurationInheritance(t,r);t.add(r);let i;if(n)i=await ve(r);else{if(!l.default.existsSync(r))throw ee.forPath(r);i=await be(r,`utf-8`)}let a;try{a=L(i)}catch(e){throw te.forFile(r,e instanceof Error?e:Error(String(e)))}if(a.name==null||a.name.trim()===``)throw b.missingName(r);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(a.name))throw b.invalidNameFormat(r,a.name);if(a.tasks!==void 0&&!Array.isArray(a.tasks))throw b.tasksNotArray(r);a.tasks===void 0&&(a.tasks=[]);for(let e of a.tasks)e.$sourceUrl=r;if(a.variables!==void 0)for(let e of a.variables)e.$sourceUrl=r;if(a.prompts!==void 0)for(let e of a.prompts)e.$sourceUrl=r;return Q.set(r,a),a}function Se(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,u=new Set;function d(e){if(l.has(e))return;if(u.has(e))throw v.forConfigDependencies(Array.from(u),e);u.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)d(e)}u.delete(e),l.add(e),t!=null&&!a.has(e)&&c.push(t)}for(let e of s)d(e.name);let f=[],p=0;for(let t=0;t<e.length;t++){let n=e[t];a.has(n.name)?f.push(n):p<c.length&&(f.push(c[p]),p++)}return f}async function Ce(e,t,n,r,i,a){let o=P(e),s;if(s=o||u.default.isAbsolute(e)?e:t==null?u.default.resolve(c.default.cwd(),e):P(t)?new URL(e,t).href:u.default.resolve(t,e),n.has(s))return;if(r.has(s))throw v.forConfigurationInheritance(r,s);r.add(s);let l=await xe(s),d=P(s)?new URL(`.`,s).href:u.default.dirname(s);if(l.extends!=null&&l.extends!==``){let e=Array.isArray(l.extends)?l.extends:[l.extends],t=l.enabled??a;for(let a of e)await Ce(a,d,n,r,i,t)}r.delete(s),n.add(s);let f=l.enabled==null&&a!=null?{...l,enabled:a}:l;i.push(f)}async function we(e,t,n=new Set){let r=[];return await Ce(e,t,n,new Set,r),Se(r)}var Te=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:`capitalCase`,type:`capitalCase`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`},{id:`adaCase`,type:`adaCase`},{id:`cobolCase`,type:`cobolCase`},{id:`dotNotation`,type:`dotNotation`},{id:`pathCase`,type:`pathCase`},{id:`spaceCase`,type:`spaceCase`},{id:`trainCase`,type:`trainCase`},{id:`upperCamelCase`,type:`upperCamelCase`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&M(`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 C.notFound(e);try{return await this.executeTransformer(r,t,n)}catch(t){throw t instanceof C?t:C.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`capitalCase`:return this.executeCapitalCase(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`adaCase`:return this.executeAdaCase(t);case`cobolCase`:return this.executeCobolCase(t);case`dotNotation`:return this.executeDotNotation(t);case`pathCase`:return this.executePathCase(t);case`spaceCase`:return this.executeSpaceCase(t);case`trainCase`:return this.executeTrainCase(t);case`upperCamelCase`:return this.executeUpperCamelCase(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw C.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 C.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 C.executionFailed(e.id,`Expression evaluation failed: ${t instanceof Error?t.message:String(t)}`)}}executeLowercase(e){return(0,h.lowerCase)(String(e))}executeUppercase(e){return(0,h.upperCase)(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 C.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 C.executionFailed(e.id,`Chain transformer must have at least one transformer`);return this.executeChain(r,t,n)}executeCapitalize(e){return(0,h.capitalCase)(String(e))}executeTitlecase(e){return(0,h.kebabCase)(String(e)).split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}executeCamelcase(e){return(0,h.camelCase)(String(e))}executePascalcase(e){return(0,h.pascalCase)(String(e))}executeSnakecase(e){return(0,h.snakeCase)(String(e))}executeKebabcase(e){return(0,h.kebabCase)(String(e))}executeConstantcase(e){return(0,h.constantCase)(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(0,h.kebabCase)(String(e))}executeUnderscore(e){return(0,h.snakeCase)(String(e))}executeCapitalCase(e){return(0,h.capitalCase)(String(e))}executeAdaCase(e){return(0,h.adaCase)(String(e))}executeCobolCase(e){return(0,h.cobolCase)(String(e))}executeDotNotation(e){return(0,h.dotNotation)(String(e))}executePathCase(e){return(0,h.pathCase)(String(e))}executeSpaceCase(e){return(0,h.spaceCase)(String(e))}executeTrainCase(e){return(0,h.trainCase)(String(e))}executeUpperCamelCase(e){return(0,h.upperCamelCase)(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};const Ee=new Te;async function De(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 Ee.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}function Oe(e,t){if((t.override??`merge`)===`replace`){M(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}M(` → 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}async function ke(e,t,n){let r=new Map;for(let i of e){if(n?.skipConditional===!0&&typeof i.value==`object`&&i.value!==null&&!Array.isArray(i.value)&&i.value.type===`conditional`)continue;if(i.$configEnabled!=null){let e={...t};for(let[t,n]of r.entries())e[t]=n;if(!await ce(i.$configEnabled,e))continue}let e={...t};for(let[t,n]of r.entries())e[t]=n;let a=await J(i.value,{id:i.id,contextType:`Variable`,context:e,...i.$sourceUrl!=null&&{sourceUrl:i.$sourceUrl}});a!==void 0&&r.set(i.id,a)}return r}function Ae(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}function je(e,t){if((t.override??`merge`)===`replace`){M(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}M(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}const Me={template:[[`template`,`templateFile`]]};function Ne(e,t,n){let r={...e},i=Me[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 Pe(e,t){let n=Me[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 Fe(e,t){if((t.override??`merge`)===`replace`){(0,g.log)(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),(0,g.log)(` Base: ${F(e.$sourceUrl)}`,`info`),(0,g.log)(` Override: ${F(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}(0,g.log)(` → Merging task "${t.id}"`,`info`),(0,g.log)(` Base: ${F(e.$sourceUrl)}`,`info`),(0,g.log)(` Override: ${F(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=Ne(e.config,t.config,t.type);let r=Pe(t.type,n);r!==null&&r.length>0&&((0,g.log)(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),(0,g.log)(` 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}function $(e,t,n){let r=new Map;for(let t of e){if(r.has(t.id))throw x.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 x.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 x.forId(e.id,`prompt`,r.get(e.id));r.set(e.id,`prompt`)}}function Ie(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return $(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){M(`⊘ 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 S.forPrompt(e.id);let t=je(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 S.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 S.forTask(e.id,F(n.$sourceUrl),F(e.$sourceUrl))}let n=Fe(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;$(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}async function Le(e,t,n=new Set){return Ie(await we(e,t,n))}async function Re(e,t){if(O(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await we(e);return O(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await Le(e);M(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&M(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&M(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&M(`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,`A`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`L`,{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`R`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`z`,{enumerable:!0,get:function(){return s}});
@@ -1 +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{parse as i,printParseErrorCode as a}from"jsonc-parser";import o from"node:os";import{execSync as s}from"node:child_process";import{adaCase as c,camelCase as l,capitalCase as u,cobolCase as d,constantCase as f,dotNotation as p,kebabCase as m,lowerCase as ee,pascalCase as te,pathCase as ne,snakeCase as h,spaceCase as re,trainCase as ie,upperCamelCase as ae,upperCase as oe}from"case-anything";import{log as g}from"node:console";var _=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},v=class e extends _{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 forTaskDependency(t){return new e(`Circular dependency detected involving task: ${t}`,[t])}static forConfigDependencies(t,n){let r=[...t,n];return new e(`Circular dependency detected in template dependencies: ${r.join(` -> `)}`,r)}},y=class e extends _{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)}},b=class e extends _{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)}},se=class e extends _{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)}},x=class e extends _{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)}},S=class e extends _{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)}},C=class e extends _{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`)}},ce=class e extends _{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)}},le=class e extends _{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`)}static invalidValue(t,n,r){return new e(`Invalid value "${n}" for prompt "${t}": ${r}`,t,`invalid_value`)}},ue=class e extends _{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`)}},w=class e extends _{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`)}};let de=!1;function fe(e){de=e}const T={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},E={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},D=`\x1B[0m`;function O(e){de&&console.log(`${E.debug}${T.debug} ${e}${D}`)}function k(e){console.log(`${E.info}${T.info} ${e}${D}`)}function A(e){console.log(`${E.success}${T.success} ${e}${D}`)}function j(e){console.log(`${E.warn}${T.warn} ${e}${D}`)}function M(e){console.log(`${E.error}${T.error} ${e}${D}`)}function N(e,t=`info`){switch(t){case`debug`:O(e);break;case`info`:k(e);break;case`success`:A(e);break;case`warn`:j(e);break;case`error`:M(e);break}}function P(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&&(N(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&N(` Error: ${t.message}`,`warn`)),!1)}}function pe(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 P(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function F(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-vMswJANY.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-vMswJANY.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 P(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function me(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function he(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 ge(e,t){let n=he(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-vMswJANY.js`);return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await import(`./utils-vMswJANY.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 me(n.value,t)}return!0}function I(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function L(t){if(t==null||t===``)return`current configuration`;if(I(t))return t;let r=n.cwd();return t.startsWith(r)?e.relative(r,t):t}function _e(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 R(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 z(e){let t=[],n=i(e,t,{allowTrailingComma:!0});if(t.length>0){let e=t.map(e=>`${a(e.error)} at offset ${e.offset}`).join(`, `);throw Error(`Invalid JSON or JSONC: ${e}`)}return n}function B(t,r){if(I(t))return t;if(r==null||r===``)return e.isAbsolute(t)?t:e.resolve(n.cwd(),t);if(I(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)}let V=0;const H={};function U(e=`Loading`){let t=[`|`,`/`,`-`,`\\`,`.`,`..`,`...`],n=0;V++;let r=V;return process.stdout.write(`${e} `),H[r]=setInterval(()=>{process.stdout.write(`\r${e} ${t[n%t.length]} `),n++},120),r}function W(e){H[e]&&(clearInterval(H[e]),delete H[e],process.stdout.write(`\r`),process.stdout.write(`${` `.repeat(30)}\r`))}async function G(e){let t=new URL(e).pathname.split(`/`).pop(),n=U(`Loading ${t==null||t===``?e:t}`);try{return O(`Fetching remote file: ${e}`),await Te(e)}finally{W(n)}}async function K(n){let{file:r,sourceUrl:i,tempFileExtension:a=`.tmp`,tempFilePrefix:s=`scaffoldfy`}=n,c=r,l,u,d=!1;if(I(r)){l=r;let n=await G(l);d=!0;let i=o.tmpdir(),c=`${s}-${Date.now()}${a}`;u=e.join(i,c),t.writeFileSync(u,n,`utf-8`),O(`Remote file saved to temporary location: ${u}`)}else if(l=B(r,i),I(l)){let n=await G(l);d=!0;let r=o.tmpdir(),i=`${s}-${Date.now()}${a}`;u=e.join(r,i),t.writeFileSync(u,n,`utf-8`),O(`Remote file saved to temporary location: ${u}`)}else{if(!t.existsSync(l))throw Error(`File not found: ${l}`);u=l,O(`Using local file: ${u}`)}return{localFilePath:u,isRemote:d,originalPath:c,resolvedPath:l}}function ve(e){if(e.isRemote&&t.existsSync(e.localFilePath))try{t.unlinkSync(e.localFilePath),O(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){O(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function q(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 ye(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 be(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function xe(t,r){let i=Y(t.file,r),a=t.args?.map(e=>Y(e,r))??[],o={};if(t.parameters)for(let[e,n]of Object.entries(t.parameters))o[e]=Y(n,r);let c=t.cwd!=null&&t.cwd!==``?e.join(n.cwd(),Y(t.cwd,r)):n.cwd(),l=await K({file:i,...t.sourceUrl!=null&&t.sourceUrl!==``&&{sourceUrl:t.sourceUrl},tempFileExtension:be(t.runtime??q(i)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:u}=l,d=t.runtime??q(u)??`node`;!t.runtime&&!q(u)&&N(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let e=ye(d,u),r=a.join(` `),i=r?`${e} ${r}`:e;O(`Executing: ${i}`);let l=s(i,{cwd:c,stdio:t.captureOutput?[`pipe`,`pipe`,`inherit`]:`inherit`,env:{...n.env,...o},encoding:t.captureOutput?`utf-8`:void 0});if(t.captureOutput)return O(`Script executed successfully with output`),typeof l==`string`?l:void 0;O(`Script executed successfully`);return}finally{ve(l)}}async function J(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 o=e;if(o.type===`conditional`){if(!i){N(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof o.condition!=`string`){N(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=P(o.condition,i)?o.ifTrue:o.ifFalse;return typeof e==`object`&&e?await J(e,t):e}catch(e){N(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec`){let e=o.value;if(typeof e!=`string`){N(`${r} "${n}": exec value must have a string command`,`error`);return}try{return Se(s(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){N(`${r} "${n}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec-file`){let e=o;if(typeof e.file!=`string`){N(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await xe({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:Se(t.trim())}catch(e){N(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`static`)return o.value;if(o.type===`interpolate`){let e=o.value;if(typeof e!=`string`){N(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return N(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return Y(e,i)}catch(t){return N(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(o.type!==void 0){N(`${r} "${n}": unknown value type "${o.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function Se(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 Y(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>R(t,n)?.toString()??``)}const Ce=r(t.readFile),X=new Map;function we(){X.clear()}async function Te(e){if(I(e))return Ee(e);if(!t.existsSync(e))throw y.forPath(e);return Ce(e,`utf-8`)}async function Ee(e){let t=X.get(e);if(t!=null)return t;let n=(async()=>{try{let t=await fetch(e);if(!t.ok)throw b.forUrl(e,t.status,t.statusText);return await t.text()}catch(t){throw t instanceof Error&&t.message.includes(`Failed to fetch`)?t:b.forUrl(e,t instanceof Error?t:void 0)}})();X.set(e,n);try{return await n}catch(t){throw X.delete(e),t}}const Z=new Map;function De(){Z.clear(),we()}const Oe=r(t.readFile);async function ke(r,i=new Set){let a=I(r),o;if(o=a||e.isAbsolute(r)?r:e.resolve(n.cwd(),r),Z.has(o))return Z.get(o);if(i.has(o))throw v.forConfigurationInheritance(i,o);i.add(o);let s;if(a)s=await Ee(o);else{if(!t.existsSync(o))throw y.forPath(o);s=await Oe(o,`utf-8`)}let c;try{c=z(s)}catch(e){throw se.forFile(o,e instanceof Error?e:Error(String(e)))}if(c.name==null||c.name.trim()===``)throw x.missingName(o);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(c.name))throw x.invalidNameFormat(o,c.name);if(c.tasks!==void 0&&!Array.isArray(c.tasks))throw x.tasksNotArray(o);c.tasks===void 0&&(c.tasks=[]);for(let e of c.tasks)e.$sourceUrl=o;if(c.variables!==void 0)for(let e of c.variables)e.$sourceUrl=o;if(c.prompts!==void 0)for(let e of c.prompts)e.$sourceUrl=o;return Z.set(o,c),c}function Ae(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,u=new Set;function d(e){if(l.has(e))return;if(u.has(e))throw v.forConfigDependencies(Array.from(u),e);u.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)d(e)}u.delete(e),l.add(e),t!=null&&!a.has(e)&&c.push(t)}for(let e of s)d(e.name);let f=[],p=0;for(let t=0;t<e.length;t++){let n=e[t];a.has(n.name)?f.push(n):p<c.length&&(f.push(c[p]),p++)}return f}async function je(t,r,i,a,o,s){let c=I(t),l;if(l=c||e.isAbsolute(t)?t:r==null?e.resolve(n.cwd(),t):I(r)?new URL(t,r).href:e.resolve(r,t),i.has(l))return;if(a.has(l))throw v.forConfigurationInheritance(a,l);a.add(l);let u=await ke(l),d=I(l)?new URL(`.`,l).href:e.dirname(l);if(u.extends!=null&&u.extends!==``){let e=Array.isArray(u.extends)?u.extends:[u.extends],t=u.enabled??s;for(let n of e)await je(n,d,i,a,o,t)}a.delete(l),i.add(l);let f=u.enabled==null&&s!=null?{...u,enabled:s}:u;o.push(f)}async function Q(e,t,n=new Set){let r=[];return await je(e,t,n,new Set,r),Ae(r)}const Me=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:`capitalCase`,type:`capitalCase`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`},{id:`adaCase`,type:`adaCase`},{id:`cobolCase`,type:`cobolCase`},{id:`dotNotation`,type:`dotNotation`},{id:`pathCase`,type:`pathCase`},{id:`spaceCase`,type:`spaceCase`},{id:`trainCase`,type:`trainCase`},{id:`upperCamelCase`,type:`upperCamelCase`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&N(`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 w.notFound(e);try{return await this.executeTransformer(r,t,n)}catch(t){throw t instanceof w?t:w.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`capitalCase`:return this.executeCapitalCase(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`adaCase`:return this.executeAdaCase(t);case`cobolCase`:return this.executeCobolCase(t);case`dotNotation`:return this.executeDotNotation(t);case`pathCase`:return this.executePathCase(t);case`spaceCase`:return this.executeSpaceCase(t);case`trainCase`:return this.executeTrainCase(t);case`upperCamelCase`:return this.executeUpperCamelCase(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw w.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 w.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 w.executionFailed(e.id,`Expression evaluation failed: ${t instanceof Error?t.message:String(t)}`)}}executeLowercase(e){return ee(String(e))}executeUppercase(e){return oe(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 w.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 w.executionFailed(e.id,`Chain transformer must have at least one transformer`);return this.executeChain(r,t,n)}executeCapitalize(e){return u(String(e))}executeTitlecase(e){return m(String(e)).split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}executeCamelcase(e){return l(String(e))}executePascalcase(e){return te(String(e))}executeSnakecase(e){return h(String(e))}executeKebabcase(e){return m(String(e))}executeConstantcase(e){return f(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 m(String(e))}executeUnderscore(e){return h(String(e))}executeCapitalCase(e){return u(String(e))}executeAdaCase(e){return c(String(e))}executeCobolCase(e){return d(String(e))}executeDotNotation(e){return p(String(e))}executePathCase(e){return ne(String(e))}executeSpaceCase(e){return re(String(e))}executeTrainCase(e){return ie(String(e))}executeUpperCamelCase(e){return ae(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};async function Ne(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 Me.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}function Pe(e,t){if((t.override??`merge`)===`replace`){N(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}N(` → 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}async function Fe(e,t,n){let r=new Map;for(let i of e){if(n?.skipConditional===!0&&typeof i.value==`object`&&i.value!==null&&!Array.isArray(i.value)&&i.value.type===`conditional`)continue;if(i.$configEnabled!=null){let e={...t};for(let[t,n]of r.entries())e[t]=n;if(!await F(i.$configEnabled,e))continue}let e={...t};for(let[t,n]of r.entries())e[t]=n;let a=await J(i.value,{id:i.id,contextType:`Variable`,context:e,...i.$sourceUrl!=null&&{sourceUrl:i.$sourceUrl}});a!==void 0&&r.set(i.id,a)}return r}function Ie(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}function Le(e,t){if((t.override??`merge`)===`replace`){N(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}N(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}const Re={template:[[`template`,`templateFile`]]};function ze(e,t,n){let r={...e},i=Re[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 Be(e,t){let n=Re[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 Ve(e,t){if((t.override??`merge`)===`replace`){g(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),g(` Base: ${L(e.$sourceUrl)}`,`info`),g(` Override: ${L(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}g(` → Merging task "${t.id}"`,`info`),g(` Base: ${L(e.$sourceUrl)}`,`info`),g(` Override: ${L(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=ze(e.config,t.config,t.type);let r=Be(t.type,n);r!==null&&r.length>0&&(g(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),g(` 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}function He(e,t,n){let r=new Map;for(let t of e){if(r.has(t.id))throw S.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 S.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 S.forId(e.id,`prompt`,r.get(e.id));r.set(e.id,`prompt`)}}function Ue(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return He(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){N(`⊘ 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 C.forPrompt(e.id);let t=Le(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 C.forVariable(e.id);let t=Pe(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 C.forTask(e.id,L(n.$sourceUrl),L(e.$sourceUrl))}let n=Ve(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;He(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}async function $(e,t,n=new Set){return Ue(await Q(e,t,n))}async function We(e,t){if(O(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await Q(e);return O(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await $(e);N(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&N(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&N(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&N(`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{k as A,I as C,P as D,F as E,ue as F,le as I,ce as L,fe as M,A as N,O,j as P,v as R,L as S,pe as T,W as _,Fe as a,R as b,ke as c,Y as d,J as f,U as g,K as h,Ie as i,N as j,M as k,De as l,ve as m,We as n,Ne as o,xe as p,Ue as r,Me as s,$ as t,Te as u,B as v,ge as w,_e as x,z as y};
1
+ import e from"node:process";import t from"node:path";import n from"node:fs";import{promisify as r}from"node:util";import"handlebars";import{parse as i,printParseErrorCode as a}from"jsonc-parser";import o from"node:os";import{execSync as s}from"node:child_process";import{adaCase as c,camelCase as l,capitalCase as u,cobolCase as d,constantCase as f,dotNotation as p,kebabCase as m,lowerCase as ee,pascalCase as te,pathCase as ne,snakeCase as h,spaceCase as re,trainCase as ie,upperCamelCase as ae,upperCase as oe}from"case-anything";import{log as g}from"node:console";var _=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},v=class e extends _{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 forTaskDependency(t){return new e(`Circular dependency detected involving task: ${t}`,[t])}static forConfigDependencies(t,n){let r=[...t,n];return new e(`Circular dependency detected in template dependencies: ${r.join(` -> `)}`,r)}},y=class e extends _{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)}},b=class e extends _{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)}},se=class e extends _{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)}},x=class e extends _{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)}},S=class e extends _{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)}},C=class e extends _{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`)}},ce=class e extends _{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)}},le=class e extends _{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`)}static invalidValue(t,n,r){return new e(`Invalid value "${n}" for prompt "${t}": ${r}`,t,`invalid_value`)}},ue=class e extends _{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`)}},w=class e extends _{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`)}};let de=!1;function fe(e){de=e}const T={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},E={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},D=`\x1B[0m`;function O(e){de&&console.log(`${E.debug}${T.debug} ${e}${D}`)}function k(e){console.log(`${E.info}${T.info} ${e}${D}`)}function A(e){console.log(`${E.success}${T.success} ${e}${D}`)}function j(e){console.log(`${E.warn}${T.warn} ${e}${D}`)}function M(e){console.log(`${E.error}${T.error} ${e}${D}`)}function N(e,t=`info`){switch(t){case`debug`:O(e);break;case`info`:k(e);break;case`success`:A(e);break;case`warn`:j(e);break;case`error`:M(e);break}}function P(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&&(N(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&N(` Error: ${t.message}`,`warn`)),!1)}}function pe(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 P(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function F(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-uPeG29Q4.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-uPeG29Q4.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 P(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function me(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function he(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 ge(e,t){let n=he(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-uPeG29Q4.js`);return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await import(`./utils-uPeG29Q4.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 me(n.value,t)}return!0}function I(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function L(n){if(n==null||n===``)return`current configuration`;if(I(n))return n;let r=e.cwd();return n.startsWith(r)?t.relative(r,n):n}function _e(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 R(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 z(e){let t=[],n=i(e,t,{allowTrailingComma:!0});if(t.length>0){let e=t.map(e=>`${a(e.error)} at offset ${e.offset}`).join(`, `);throw Error(`Invalid JSON or JSONC: ${e}`)}return n}function B(n,r){if(I(n))return n;if(r==null||r===``)return t.isAbsolute(n)?n:t.resolve(e.cwd(),n);if(I(r))try{let e=new URL(`.`,r);return new URL(n,e).href}catch{throw Error(`Failed to resolve file path '${n}' relative to source URL '${r}'`)}let i=t.dirname(r);return t.isAbsolute(n)?n:t.resolve(i,n)}let V=0;const H={};function U(e=`Loading`){let t=[`|`,`/`,`-`,`\\`,`.`,`..`,`...`],n=0;V++;let r=V;return process.stdout.write(`${e} `),H[r]=setInterval(()=>{process.stdout.write(`\r${e} ${t[n%t.length]} `),n++},120),r}function W(e){H[e]&&(clearInterval(H[e]),delete H[e],process.stdout.write(`\r`),process.stdout.write(`${` `.repeat(30)}\r`))}async function G(e){let t=new URL(e).pathname.split(`/`).pop(),n=U(`Loading ${t==null||t===``?e:t}`);try{return O(`Fetching remote file: ${e}`),await Te(e)}finally{W(n)}}async function K(e){let{file:r,sourceUrl:i,tempFileExtension:a=`.tmp`,tempFilePrefix:s=`scaffoldfy`}=e,c=r,l,u,d=!1;if(I(r)){l=r;let e=await G(l);d=!0;let i=o.tmpdir(),c=`${s}-${Date.now()}${a}`;u=t.join(i,c),n.writeFileSync(u,e,`utf-8`),O(`Remote file saved to temporary location: ${u}`)}else if(l=B(r,i),I(l)){let e=await G(l);d=!0;let r=o.tmpdir(),i=`${s}-${Date.now()}${a}`;u=t.join(r,i),n.writeFileSync(u,e,`utf-8`),O(`Remote file saved to temporary location: ${u}`)}else{if(!n.existsSync(l))throw Error(`File not found: ${l}`);u=l,O(`Using local file: ${u}`)}return{localFilePath:u,isRemote:d,originalPath:c,resolvedPath:l}}function ve(e){if(e.isRemote&&n.existsSync(e.localFilePath))try{n.unlinkSync(e.localFilePath),O(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){O(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function q(e){switch(t.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 ye(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 be(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function xe(n,r){let i=Y(n.file,r),a=n.args?.map(e=>Y(e,r))??[],o={};if(n.parameters)for(let[e,t]of Object.entries(n.parameters))o[e]=Y(t,r);let c=n.cwd!=null&&n.cwd!==``?t.join(e.cwd(),Y(n.cwd,r)):e.cwd(),l=await K({file:i,...n.sourceUrl!=null&&n.sourceUrl!==``&&{sourceUrl:n.sourceUrl},tempFileExtension:be(n.runtime??q(i)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:u}=l,d=n.runtime??q(u)??`node`;!n.runtime&&!q(u)&&N(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let t=ye(d,u),r=a.join(` `),i=r?`${t} ${r}`:t;O(`Executing: ${i}`);let l=s(i,{cwd:c,stdio:n.captureOutput?[`pipe`,`pipe`,`inherit`]:`inherit`,env:{...e.env,...o},encoding:n.captureOutput?`utf-8`:void 0});if(n.captureOutput)return O(`Script executed successfully with output`),typeof l==`string`?l:void 0;O(`Script executed successfully`);return}finally{ve(l)}}async function J(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 o=e;if(o.type===`conditional`){if(!i){N(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof o.condition!=`string`){N(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=P(o.condition,i)?o.ifTrue:o.ifFalse;return typeof e==`object`&&e?await J(e,t):e}catch(e){N(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec`){let e=o.value;if(typeof e!=`string`){N(`${r} "${n}": exec value must have a string command`,`error`);return}try{return Se(s(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){N(`${r} "${n}": failed to execute command: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`exec-file`){let e=o;if(typeof e.file!=`string`){N(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await xe({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:Se(t.trim())}catch(e){N(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(o.type===`static`)return o.value;if(o.type===`interpolate`){let e=o.value;if(typeof e!=`string`){N(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return N(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return Y(e,i)}catch(t){return N(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(o.type!==void 0){N(`${r} "${n}": unknown value type "${o.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function Se(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 Y(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>R(t,n)?.toString()??``)}const Ce=r(n.readFile),X=new Map;function we(){X.clear()}async function Te(e){if(I(e))return Ee(e);if(!n.existsSync(e))throw y.forPath(e);return Ce(e,`utf-8`)}async function Ee(e){let t=X.get(e);if(t!=null)return t;let n=(async()=>{try{let t=await fetch(e);if(!t.ok)throw b.forUrl(e,t.status,t.statusText);return await t.text()}catch(t){throw t instanceof Error&&t.message.includes(`Failed to fetch`)?t:b.forUrl(e,t instanceof Error?t:void 0)}})();X.set(e,n);try{return await n}catch(t){throw X.delete(e),t}}const Z=new Map;function De(){Z.clear(),we()}const Oe=r(n.readFile);async function ke(r,i=new Set){let a=I(r),o;if(o=a||t.isAbsolute(r)?r:t.resolve(e.cwd(),r),Z.has(o))return Z.get(o);if(i.has(o))throw v.forConfigurationInheritance(i,o);i.add(o);let s;if(a)s=await Ee(o);else{if(!n.existsSync(o))throw y.forPath(o);s=await Oe(o,`utf-8`)}let c;try{c=z(s)}catch(e){throw se.forFile(o,e instanceof Error?e:Error(String(e)))}if(c.name==null||c.name.trim()===``)throw x.missingName(o);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(c.name))throw x.invalidNameFormat(o,c.name);if(c.tasks!==void 0&&!Array.isArray(c.tasks))throw x.tasksNotArray(o);c.tasks===void 0&&(c.tasks=[]);for(let e of c.tasks)e.$sourceUrl=o;if(c.variables!==void 0)for(let e of c.variables)e.$sourceUrl=o;if(c.prompts!==void 0)for(let e of c.prompts)e.$sourceUrl=o;return Z.set(o,c),c}function Ae(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,u=new Set;function d(e){if(l.has(e))return;if(u.has(e))throw v.forConfigDependencies(Array.from(u),e);u.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)d(e)}u.delete(e),l.add(e),t!=null&&!a.has(e)&&c.push(t)}for(let e of s)d(e.name);let f=[],p=0;for(let t=0;t<e.length;t++){let n=e[t];a.has(n.name)?f.push(n):p<c.length&&(f.push(c[p]),p++)}return f}async function je(n,r,i,a,o,s){let c=I(n),l;if(l=c||t.isAbsolute(n)?n:r==null?t.resolve(e.cwd(),n):I(r)?new URL(n,r).href:t.resolve(r,n),i.has(l))return;if(a.has(l))throw v.forConfigurationInheritance(a,l);a.add(l);let u=await ke(l),d=I(l)?new URL(`.`,l).href:t.dirname(l);if(u.extends!=null&&u.extends!==``){let e=Array.isArray(u.extends)?u.extends:[u.extends],t=u.enabled??s;for(let n of e)await je(n,d,i,a,o,t)}a.delete(l),i.add(l);let f=u.enabled==null&&s!=null?{...u,enabled:s}:u;o.push(f)}async function Q(e,t,n=new Set){let r=[];return await je(e,t,n,new Set,r),Ae(r)}const Me=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:`capitalCase`,type:`capitalCase`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`},{id:`adaCase`,type:`adaCase`},{id:`cobolCase`,type:`cobolCase`},{id:`dotNotation`,type:`dotNotation`},{id:`pathCase`,type:`pathCase`},{id:`spaceCase`,type:`spaceCase`},{id:`trainCase`,type:`trainCase`},{id:`upperCamelCase`,type:`upperCamelCase`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&N(`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 w.notFound(e);try{return await this.executeTransformer(r,t,n)}catch(t){throw t instanceof w?t:w.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`capitalCase`:return this.executeCapitalCase(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`adaCase`:return this.executeAdaCase(t);case`cobolCase`:return this.executeCobolCase(t);case`dotNotation`:return this.executeDotNotation(t);case`pathCase`:return this.executePathCase(t);case`spaceCase`:return this.executeSpaceCase(t);case`trainCase`:return this.executeTrainCase(t);case`upperCamelCase`:return this.executeUpperCamelCase(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw w.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 w.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 w.executionFailed(e.id,`Expression evaluation failed: ${t instanceof Error?t.message:String(t)}`)}}executeLowercase(e){return ee(String(e))}executeUppercase(e){return oe(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 w.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 w.executionFailed(e.id,`Chain transformer must have at least one transformer`);return this.executeChain(r,t,n)}executeCapitalize(e){return u(String(e))}executeTitlecase(e){return m(String(e)).split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}executeCamelcase(e){return l(String(e))}executePascalcase(e){return te(String(e))}executeSnakecase(e){return h(String(e))}executeKebabcase(e){return m(String(e))}executeConstantcase(e){return f(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 m(String(e))}executeUnderscore(e){return h(String(e))}executeCapitalCase(e){return u(String(e))}executeAdaCase(e){return c(String(e))}executeCobolCase(e){return d(String(e))}executeDotNotation(e){return p(String(e))}executePathCase(e){return ne(String(e))}executeSpaceCase(e){return re(String(e))}executeTrainCase(e){return ie(String(e))}executeUpperCamelCase(e){return ae(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};async function Ne(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 Me.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}function Pe(e,t){if((t.override??`merge`)===`replace`){N(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}N(` → 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}async function Fe(e,t,n){let r=new Map;for(let i of e){if(n?.skipConditional===!0&&typeof i.value==`object`&&i.value!==null&&!Array.isArray(i.value)&&i.value.type===`conditional`)continue;if(i.$configEnabled!=null){let e={...t};for(let[t,n]of r.entries())e[t]=n;if(!await F(i.$configEnabled,e))continue}let e={...t};for(let[t,n]of r.entries())e[t]=n;let a=await J(i.value,{id:i.id,contextType:`Variable`,context:e,...i.$sourceUrl!=null&&{sourceUrl:i.$sourceUrl}});a!==void 0&&r.set(i.id,a)}return r}function Ie(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}function Le(e,t){if((t.override??`merge`)===`replace`){N(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}N(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}const Re={template:[[`template`,`templateFile`]]};function ze(e,t,n){let r={...e},i=Re[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 Be(e,t){let n=Re[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 Ve(e,t){if((t.override??`merge`)===`replace`){g(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),g(` Base: ${L(e.$sourceUrl)}`,`info`),g(` Override: ${L(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}g(` → Merging task "${t.id}"`,`info`),g(` Base: ${L(e.$sourceUrl)}`,`info`),g(` Override: ${L(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=ze(e.config,t.config,t.type);let r=Be(t.type,n);r!==null&&r.length>0&&(g(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),g(` 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}function He(e,t,n){let r=new Map;for(let t of e){if(r.has(t.id))throw S.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 S.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 S.forId(e.id,`prompt`,r.get(e.id));r.set(e.id,`prompt`)}}function Ue(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return He(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){N(`⊘ 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 C.forPrompt(e.id);let t=Le(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 C.forVariable(e.id);let t=Pe(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 C.forTask(e.id,L(n.$sourceUrl),L(e.$sourceUrl))}let n=Ve(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;He(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}async function $(e,t,n=new Set){return Ue(await Q(e,t,n))}async function We(e,t){if(O(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await Q(e);return O(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await $(e);N(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&N(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&N(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&N(`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{k as A,I as C,P as D,F as E,ue as F,le as I,ce as L,fe as M,A as N,O,j as P,v as R,L as S,pe as T,W as _,Fe as a,R as b,ke as c,Y as d,J as f,U as g,K as h,Ie as i,N as j,M as k,De as l,ve as m,We as n,Ne as o,xe as p,Ue as r,Me as s,$ as t,Te as u,B as v,ge as w,_e as x,z as y};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./configurations-C9hGwa2c.cjs`);require(`./initial-config-CESipc-c.cjs`);const t=require(`./tasks-CfkqwNGd.cjs`),n=require(`./validate-scaffoldfy-json-vxz6VQQa.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const r=require(`./src-BN2NvYkL.cjs`);exports.clearConfigurationCache=e.l,exports.clearPlugins=t._,exports.createTaskPlugin=t.p,exports.displayTasksDiff=t.w,exports.executePluginTask=t.m,exports.getDeleteDiff=t.O,exports.getExecDiff=t.E,exports.getGitInitDiff=t.D,exports.getPlugin=t.v,exports.getPluginForTaskType=t.h,exports.getRegexReplaceDiff=t.A,exports.getRenameDiff=t.k,exports.getReplaceInFileDiff=t.j,exports.getTaskDiff=t.T,exports.getUpdateJsonDiff=t.M,exports.isPluginTaskType=t.g,exports.listPlugins=t.y,exports.loadAndMergeConfiguration=e.t,exports.loadConfiguration=e.c,exports.loadTasksWithInheritance=e.n,exports.mergeConfigurations=e.r,exports.registerHooks=t.C,exports.registerPlugin=t.b,exports.runWithTasks=r.t,exports.unregisterPlugin=t.x,exports.validateScaffoldfyJsonFile=n.n;
1
+ const e=require(`./configurations-iSmGgORy.cjs`);require(`./initial-config-CESipc-c.cjs`);const t=require(`./tasks-shq57X_d.cjs`),n=require(`./validate-scaffoldfy-json-DgRRmNSc.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const r=require(`./src-CJxBSFwf.cjs`);exports.clearConfigurationCache=e.l,exports.clearPlugins=t.S,exports.createTaskPlugin=t.v,exports.displayTasksDiff=t.k,exports.executePluginTask=t.y,exports.getDeleteDiff=t.N,exports.getExecDiff=t.j,exports.getGitInitDiff=t.M,exports.getPlugin=t.C,exports.getPluginForTaskType=t.b,exports.getRegexReplaceDiff=t.F,exports.getRenameDiff=t.P,exports.getReplaceInFileDiff=t.I,exports.getTaskDiff=t.A,exports.getUpdateJsonDiff=t.L,exports.isPluginTaskType=t.x,exports.listPlugins=t.w,exports.loadAndMergeConfiguration=e.t,exports.loadConfiguration=e.c,exports.loadTasksWithInheritance=e.n,exports.mergeConfigurations=e.r,exports.parseAnswerFlags=t.m,exports.registerHooks=t.O,exports.registerPlugin=t.T,exports.resolveAnswerFlags=t.h,exports.resolveConfigAnswers=t.g,exports.runWithTasks=r.t,exports.unregisterPlugin=t.E,exports.validateScaffoldfyJsonFile=n.n;
package/dist/index.d.cts CHANGED
@@ -371,8 +371,14 @@ interface ScaffoldfyConfiguration {
371
371
  transformers?: Transformer[];
372
372
  variables?: VariableDefinition[];
373
373
  prompts?: PromptDefinition[];
374
+ answers?: Record<string, PromptAnswerValue>;
374
375
  tasks?: TaskDefinition[];
375
376
  }
377
+ /**
378
+ * Value of a pre-set prompt answer in a configuration's `answers`
379
+ * (checkbox prompts take an array of choice values)
380
+ */
381
+ type PromptAnswerValue = string | number | boolean | Array<string | number | boolean>;
376
382
  /**
377
383
  * Plugin interface for custom task types
378
384
  */
@@ -573,6 +579,40 @@ declare function createTaskPlugin(name: string, taskType: string, execute: (task
573
579
  validate?: (task: TaskDefinition) => string[];
574
580
  }): TaskPlugin;
575
581
  //#endregion
582
+ //#region src/prompts/answer-flags.d.ts
583
+ /**
584
+ * A `--name[=value]` flag that is not a built-in CLI option
585
+ */
586
+ interface AnswerFlag {
587
+ /** Flag as written, without the value (e.g. `--keep-example-packages`) */
588
+ flag: string;
589
+ /** Flag name without the leading dashes */
590
+ name: string;
591
+ /** Explicit value, or `undefined` for a bare flag */
592
+ value: string | undefined;
593
+ }
594
+ /**
595
+ * Parse the arguments commander did not recognize into answer flags.
596
+ * A flag takes its value from `--name=value`, or from the next argument when that
597
+ * argument does not start with `-`; otherwise it is a bare flag.
598
+ * @throws Error for short flags and arguments that are not flags
599
+ */
600
+ declare function parseAnswerFlags(args: readonly string[]): AnswerFlag[];
601
+ /**
602
+ * Match answer flags to prompts and return the raw answers keyed by prompt id.
603
+ * A bare flag answers a confirm prompt with `true`, and `--no-<promptId>` answers it with `false`.
604
+ * @throws Error listing every flag that matches no prompt or is missing a value
605
+ */
606
+ declare function resolveAnswerFlags(flags: readonly AnswerFlag[], prompts: readonly PromptDefinition[]): Record<string, string>;
607
+ /**
608
+ * Resolve the `answers` of every configuration into raw answers keyed by prompt id.
609
+ * Configurations are read in load order (extended configurations first), so the config
610
+ * passed to the CLI overrides the answers of the configs it extends.
611
+ * Keys use the same id matching as answer flags.
612
+ * @throws Error listing answers that match no prompt or have an unsupported value
613
+ */
614
+ declare function resolveConfigAnswers(configs: readonly ScaffoldfyConfiguration[], prompts?: readonly PromptDefinition[]): Record<string, string>;
615
+ //#endregion
576
616
  //#region src/index.d.ts
577
617
  /**
578
618
  * Execute tasks with custom task definitions
@@ -596,4 +636,4 @@ declare function runWithTasks(customTasks: TaskDefinition[], options?: {
596
636
  transformers?: Transformer[] | undefined;
597
637
  }): Promise<void>;
598
638
  //#endregion
599
- export { type AppendConfig, BasePrompt, CheckboxPrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, CurrentConfigurationContext, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, ScaffoldfyConfiguration, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, type UpdateJsonConfig, VariableDefinition, type WriteConfig, clearConfigurationCache, clearPlugins, createTaskPlugin, displayTasksDiff, executePluginTask, getDeleteDiff, getExecDiff, getGitInitDiff, getPlugin, getPluginForTaskType, getRegexReplaceDiff, getRenameDiff, getReplaceInFileDiff, getTaskDiff, getUpdateJsonDiff, isPluginTaskType, listPlugins, loadAndMergeConfiguration, loadConfiguration, loadTasksWithInheritance, mergeConfigurations, registerHooks, registerPlugin, runWithTasks, unregisterPlugin, validateScaffoldfyJsonFile };
639
+ export { type AnswerFlag, type AppendConfig, BasePrompt, CheckboxPrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, CurrentConfigurationContext, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptAnswerValue, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, ScaffoldfyConfiguration, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, type UpdateJsonConfig, VariableDefinition, type WriteConfig, clearConfigurationCache, clearPlugins, createTaskPlugin, displayTasksDiff, executePluginTask, getDeleteDiff, getExecDiff, getGitInitDiff, getPlugin, getPluginForTaskType, getRegexReplaceDiff, getRenameDiff, getReplaceInFileDiff, getTaskDiff, getUpdateJsonDiff, isPluginTaskType, listPlugins, loadAndMergeConfiguration, loadConfiguration, loadTasksWithInheritance, mergeConfigurations, parseAnswerFlags, registerHooks, registerPlugin, resolveAnswerFlags, resolveConfigAnswers, runWithTasks, unregisterPlugin, validateScaffoldfyJsonFile };
package/dist/index.d.ts CHANGED
@@ -371,8 +371,14 @@ interface ScaffoldfyConfiguration {
371
371
  transformers?: Transformer[];
372
372
  variables?: VariableDefinition[];
373
373
  prompts?: PromptDefinition[];
374
+ answers?: Record<string, PromptAnswerValue>;
374
375
  tasks?: TaskDefinition[];
375
376
  }
377
+ /**
378
+ * Value of a pre-set prompt answer in a configuration's `answers`
379
+ * (checkbox prompts take an array of choice values)
380
+ */
381
+ type PromptAnswerValue = string | number | boolean | Array<string | number | boolean>;
376
382
  /**
377
383
  * Plugin interface for custom task types
378
384
  */
@@ -573,6 +579,40 @@ declare function createTaskPlugin(name: string, taskType: string, execute: (task
573
579
  validate?: (task: TaskDefinition) => string[];
574
580
  }): TaskPlugin;
575
581
  //#endregion
582
+ //#region src/prompts/answer-flags.d.ts
583
+ /**
584
+ * A `--name[=value]` flag that is not a built-in CLI option
585
+ */
586
+ interface AnswerFlag {
587
+ /** Flag as written, without the value (e.g. `--keep-example-packages`) */
588
+ flag: string;
589
+ /** Flag name without the leading dashes */
590
+ name: string;
591
+ /** Explicit value, or `undefined` for a bare flag */
592
+ value: string | undefined;
593
+ }
594
+ /**
595
+ * Parse the arguments commander did not recognize into answer flags.
596
+ * A flag takes its value from `--name=value`, or from the next argument when that
597
+ * argument does not start with `-`; otherwise it is a bare flag.
598
+ * @throws Error for short flags and arguments that are not flags
599
+ */
600
+ declare function parseAnswerFlags(args: readonly string[]): AnswerFlag[];
601
+ /**
602
+ * Match answer flags to prompts and return the raw answers keyed by prompt id.
603
+ * A bare flag answers a confirm prompt with `true`, and `--no-<promptId>` answers it with `false`.
604
+ * @throws Error listing every flag that matches no prompt or is missing a value
605
+ */
606
+ declare function resolveAnswerFlags(flags: readonly AnswerFlag[], prompts: readonly PromptDefinition[]): Record<string, string>;
607
+ /**
608
+ * Resolve the `answers` of every configuration into raw answers keyed by prompt id.
609
+ * Configurations are read in load order (extended configurations first), so the config
610
+ * passed to the CLI overrides the answers of the configs it extends.
611
+ * Keys use the same id matching as answer flags.
612
+ * @throws Error listing answers that match no prompt or have an unsupported value
613
+ */
614
+ declare function resolveConfigAnswers(configs: readonly ScaffoldfyConfiguration[], prompts?: readonly PromptDefinition[]): Record<string, string>;
615
+ //#endregion
576
616
  //#region src/index.d.ts
577
617
  /**
578
618
  * Execute tasks with custom task definitions
@@ -596,4 +636,4 @@ declare function runWithTasks(customTasks: TaskDefinition[], options?: {
596
636
  transformers?: Transformer[] | undefined;
597
637
  }): Promise<void>;
598
638
  //#endregion
599
- export { type AppendConfig, BasePrompt, CheckboxPrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, CurrentConfigurationContext, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, ScaffoldfyConfiguration, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, type UpdateJsonConfig, VariableDefinition, type WriteConfig, clearConfigurationCache, clearPlugins, createTaskPlugin, displayTasksDiff, executePluginTask, getDeleteDiff, getExecDiff, getGitInitDiff, getPlugin, getPluginForTaskType, getRegexReplaceDiff, getRenameDiff, getReplaceInFileDiff, getTaskDiff, getUpdateJsonDiff, isPluginTaskType, listPlugins, loadAndMergeConfiguration, loadConfiguration, loadTasksWithInheritance, mergeConfigurations, registerHooks, registerPlugin, runWithTasks, unregisterPlugin, validateScaffoldfyJsonFile };
639
+ export { type AnswerFlag, type AppendConfig, BasePrompt, CheckboxPrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, CurrentConfigurationContext, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig, InputPrompt, MergeStrategy, type MkdirConfig, type MoveConfig, NumberPrompt, PluginHooks, PromptAnswerValue, PromptDefinition, PromptType, type RegexReplaceConfig, type RenameConfig, type ReplaceInFileConfig, RollbackConfig, ScaffoldfyConfiguration, SelectPrompt, TaskDefinition, TaskPlugin, TaskType, type UpdateJsonConfig, VariableDefinition, type WriteConfig, clearConfigurationCache, clearPlugins, createTaskPlugin, displayTasksDiff, executePluginTask, getDeleteDiff, getExecDiff, getGitInitDiff, getPlugin, getPluginForTaskType, getRegexReplaceDiff, getRenameDiff, getReplaceInFileDiff, getTaskDiff, getUpdateJsonDiff, isPluginTaskType, listPlugins, loadAndMergeConfiguration, loadConfiguration, loadTasksWithInheritance, mergeConfigurations, parseAnswerFlags, registerHooks, registerPlugin, resolveAnswerFlags, resolveConfigAnswers, runWithTasks, unregisterPlugin, validateScaffoldfyJsonFile };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{c as e,l as t,n,r,t as i}from"./configurations-C6TwZWBm.js";import"./initial-config-Dt0jw4Vs.js";import{A as a,C as o,D as s,E as c,M as l,O as u,T as d,_ as f,b as p,g as m,h,j as g,k as _,m as v,p as y,v as b,w as x,x as S,y as C}from"./tasks-cEW0YvaN.js";import{n as w}from"./validate-scaffoldfy-json-C0CBAgLY.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as T}from"./src-DnGLJZBR.js";export{t as clearConfigurationCache,f as clearPlugins,y as createTaskPlugin,x as displayTasksDiff,v as executePluginTask,u as getDeleteDiff,c as getExecDiff,s as getGitInitDiff,b as getPlugin,h as getPluginForTaskType,a as getRegexReplaceDiff,_ as getRenameDiff,g as getReplaceInFileDiff,d as getTaskDiff,l as getUpdateJsonDiff,m as isPluginTaskType,C as listPlugins,i as loadAndMergeConfiguration,e as loadConfiguration,n as loadTasksWithInheritance,r as mergeConfigurations,o as registerHooks,p as registerPlugin,T as runWithTasks,S as unregisterPlugin,w as validateScaffoldfyJsonFile};
1
+ import{c as e,l as t,n,r,t as i}from"./configurations-sRFCjZJV.js";import"./initial-config-Dt0jw4Vs.js";import{A as a,C as o,E as s,F as c,I as l,L as u,M as d,N as f,O as p,P as m,S as h,T as g,b as _,g as v,h as y,j as b,k as x,m as S,v as C,w,x as T,y as E}from"./tasks-D-wcmZrW.js";import{n as D}from"./validate-scaffoldfy-json-DZ1arWdk.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as O}from"./src-Clk5H1_d.js";export{t as clearConfigurationCache,h as clearPlugins,C as createTaskPlugin,x as displayTasksDiff,E as executePluginTask,f as getDeleteDiff,b as getExecDiff,d as getGitInitDiff,o as getPlugin,_ as getPluginForTaskType,c as getRegexReplaceDiff,m as getRenameDiff,l as getReplaceInFileDiff,a as getTaskDiff,u as getUpdateJsonDiff,T as isPluginTaskType,w as listPlugins,i as loadAndMergeConfiguration,e as loadConfiguration,n as loadTasksWithInheritance,r as mergeConfigurations,S as parseAnswerFlags,p as registerHooks,g as registerPlugin,y as resolveAnswerFlags,v as resolveConfigAnswers,O as runWithTasks,s as unregisterPlugin,D as validateScaffoldfyJsonFile};