@pixpilot/scaffoldfy 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/configurations-CKshmsrJ.js +1 -0
- package/dist/configurations-Dzwqq0PK.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +52 -44
- package/dist/index.d.ts +52 -44
- package/dist/index.js +1 -1
- package/dist/initial-config-CbzFPdT_.cjs +1 -0
- package/dist/initial-config-V9mm6hls.js +1 -0
- package/dist/run-configuration-sequentially-BXM4VcVd.js +4 -0
- package/dist/run-configuration-sequentially-aFTL6LLG.cjs +4 -0
- package/dist/scaffoldfy-config-validator/cli.cjs +3 -0
- package/dist/scaffoldfy-config-validator/cli.js +3 -0
- package/dist/scaffoldfy-config-validator/index.cjs +1 -0
- package/dist/scaffoldfy-config-validator/index.d.cts +3 -0
- package/dist/scaffoldfy-config-validator/index.d.ts +3 -0
- package/dist/scaffoldfy-config-validator/index.js +1 -0
- package/dist/scaffoldfy-config-validator/validate-scaffoldfy-json.cjs +1 -0
- package/dist/scaffoldfy-config-validator/validate-scaffoldfy-json.d.cts +2 -0
- package/dist/scaffoldfy-config-validator/validate-scaffoldfy-json.d.ts +2 -0
- package/dist/scaffoldfy-config-validator/validate-scaffoldfy-json.js +1 -0
- package/dist/src-B1q4_DaV.cjs +1 -0
- package/dist/src-DEgwCQk3.js +1 -0
- package/dist/tasks-B4iFJaO9.js +23 -0
- package/dist/tasks-CLC3xylo.cjs +23 -0
- package/dist/utils-BWYwAqXM.js +1 -0
- package/dist/utils-CkNjiSuw.cjs +1 -0
- package/dist/validate-scaffoldfy-json-BDtysLEj.d.cts +38 -0
- package/dist/validate-scaffoldfy-json-Bic4iKqc.cjs +1 -0
- package/dist/validate-scaffoldfy-json-CgAoowJb.d.ts +38 -0
- package/dist/validate-scaffoldfy-json-CwWx82nG.js +1 -0
- package/package.json +4 -4
- package/dist/chunk-DjWAcSYV.cjs +0 -1
- package/dist/config-DFR0mwj6.js +0 -1
- package/dist/config-DZmWkoaW.cjs +0 -1
- package/dist/configurations-Bjun5iKX.js +0 -1
- package/dist/configurations-KSynsxPT.cjs +0 -1
- package/dist/run-tasks--KK3MvU0.js +0 -26
- package/dist/run-tasks-B0buAbAD.cjs +0 -1
- package/dist/run-tasks-BPQFQ9vD.js +0 -1
- package/dist/run-tasks-DU00U3qI.cjs +0 -26
- package/dist/scaffoldfy-config-json-validator/cli.cjs +0 -3
- package/dist/scaffoldfy-config-json-validator/cli.js +0 -3
- package/dist/scaffoldfy-config-json-validator/index.cjs +0 -1
- package/dist/scaffoldfy-config-json-validator/index.d.cts +0 -3
- package/dist/scaffoldfy-config-json-validator/index.d.ts +0 -3
- package/dist/scaffoldfy-config-json-validator/index.js +0 -1
- package/dist/scaffoldfy-config-json-validator/validate-scaffoldfy-json.cjs +0 -1
- package/dist/scaffoldfy-config-json-validator/validate-scaffoldfy-json.d.cts +0 -2
- package/dist/scaffoldfy-config-json-validator/validate-scaffoldfy-json.d.ts +0 -2
- package/dist/scaffoldfy-config-json-validator/validate-scaffoldfy-json.js +0 -1
- package/dist/src-BYAwq7zv.cjs +0 -1
- package/dist/src-DBk71cIW.js +0 -1
- package/dist/utils-C-yGs5_V.cjs +0 -1
- package/dist/utils-DXSrTxhI.js +0 -1
- package/dist/validate-scaffoldfy-json-Cfq-nQjy.js +0 -1
- package/dist/validate-scaffoldfy-json-Dkaz9ueq.cjs +0 -1
- package/dist/validate-scaffoldfy-json-bRhG4eG3.d.cts +0 -10
- package/dist/validate-scaffoldfy-json-vYYlnkxk.d.ts +0 -10
- /package/dist/{config-CQ-mWBG5.cjs → initial-config-CESipc-c.cjs} +0 -0
- /package/dist/{config-nfiOxhDM.js → initial-config-Dt0jw4Vs.js} +0 -0
- /package/dist/{scaffoldfy-config-json-validator → scaffoldfy-config-validator}/cli.d.cts +0 -0
- /package/dist/{scaffoldfy-config-json-validator → scaffoldfy-config-validator}/cli.d.ts +0 -0
- /package/dist/{scaffoldfy-config-json-validator-CpEXHRsI.cjs → scaffoldfy-config-validator-BvNnGMO1.cjs} +0 -0
- /package/dist/{scaffoldfy-config-json-validator-DP8-e4Yy.js → scaffoldfy-config-validator-D1iJBnRE.js} +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./
|
|
2
|
+
const e=require(`./configurations-Dzwqq0PK.cjs`);require(`./initial-config-CESipc-c.cjs`),require(`./tasks-CLC3xylo.cjs`);const t=require(`./validate-scaffoldfy-json-Bic4iKqc.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const n=require(`./src-B1q4_DaV.cjs`);let r=require(`node:fs`);r=e.I(r);let i=require(`node:path`);i=e.I(i);let a=require(`node:process`);a=e.I(a);let o=require(`commander`);o=e.I(o);const s=1,c=new o.Command,l=i.default.join(__dirname,`..`,`package.json`);let u=`0.0.0`;try{u=JSON.parse(r.default.readFileSync(l,`utf-8`)).version??`0.0.0`}catch{}c.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(u),c.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path to task configuration file (JSON or TypeScript)`,`./scaffoldfy.json`).option(`--no-validate`,`Skip schema validation of task configuration (validation is enabled by default)`).option(`--debug`,`Enable debug logging for verbose output`).action(async o=>{o.debug===!0&&e.O(!0);try{let s=[],c,l,u,d,f;if(o.config!=null&&o.config!==``){let n=i.default.resolve(a.default.cwd(),o.config);if(r.default.existsSync(n))if(f=n,n.endsWith(`.ts`)||n.endsWith(`.mts`)){e.D(`Loading tasks from TypeScript file: ${o.config}`,`info`);try{let t=await import(n);s=t.default??t.tasks??[],(!Array.isArray(s)||s.length===0)&&(e.D(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e.D(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e.D(`Failed to load TypeScript config file: ${o.config}`,`error`),t instanceof Error&&e.D(` Error: ${t.message}`,`error`),a.default.exit(1)}}else try{if(o.validate!==!1){e.w(`Validating task configuration against schema...`);let i=r.default.readFileSync(n,`utf-8`);t.r(JSON.parse(i),{silent:!1}).valid||(e.D(``,`error`),e.D(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),a.default.exit(1)),e.D(`Configuration validated`,`success`)}let i=await e.n(n,{sequential:!0});if(i.configs!=null&&i.configs.length>0){let{runConfigurationSequentially:e}=await Promise.resolve().then(()=>require(`./run-configuration-sequentially-aFTL6LLG.cjs`)),{createInitialConfig:t}=await Promise.resolve().then(()=>require(`./initial-config-CbzFPdT_.cjs`));await e(i.configs,{dryRun:o.dryRun??!1,force:o.force??!1,configFilePath:n},t()),a.default.exit(0)}s=i.tasks,c=i.variables,l=i.prompts,u=i.enabled,d=i.transformers,Array.isArray(s)||(e.D(`❌ Invalid config file format`,`error`),e.D(`Expected JSON with { "tasks": [...] } structure`,`info`),a.default.exit(1))}catch(t){e.D(`Failed to load JSON config file: ${o.config}`,`error`),t instanceof Error&&e.D(` Error: ${t.message}`,`error`),a.default.exit(1)}else e.D(`Config file not found: ${o.config}`,`warn`)}let p=l!=null&&l.length>0||c!=null&&c.length>0;s.length===0&&!p&&(e.D(`❌ No tasks defined`,`error`),e.D(`Please provide tasks using one of these methods:`,`info`),e.D(` 1. Create a template-tasks.json file in the current directory`,`info`),e.D(` 2. Create a template-tasks.ts file in the current directory`,`info`),e.D(` 3. Use --config option to specify a different config file`,`info`),e.D(`Example JSON structure:`,`info`),console.log(JSON.stringify({tasks:[{id:`update-package`,name:`Update package.json`,description:`Update package.json with repository information`,required:!0,enabled:!0,type:`update-json`,prompts:[{id:`projectName`,type:`input`,message:`What is your project name?`,default:`my-project`,required:!0},{id:`includeTests`,type:`confirm`,message:`Include test files?`,default:!0}],config:{file:`package.json`,updates:{name:`{{projectName}}`,author:`{{author}}`}}}]},null,2)),a.default.exit(1)),s.length===0?e.D(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e.D(`Loaded ${s.length} task(s)`,`success`),await n.t(s,{dryRun:o.dryRun,force:o.force,configFilePath:f,variables:c,prompts:l,configEnabled:u,transformers:d})}catch(t){if(e.D(`❌ CLI execution failed`,`error`),t instanceof Error){e.D(`Error: ${t.message}`,`error`);let n=a.default.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);a.default.exit(1)}}),c.parse(a.default.argv);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{D as e,O as t,n,w as r}from"./configurations-CKshmsrJ.js";import"./initial-config-Dt0jw4Vs.js";import"./tasks-B4iFJaO9.js";import{r as i}from"./validate-scaffoldfy-json-CwWx82nG.js";import"./scaffoldfy-config-validator-D1iJBnRE.js";import{t as a}from"./src-DEgwCQk3.js";import o from"node:path";import{fileURLToPath as s}from"node:url";import c from"node:fs";import l from"node:process";import{Command as u}from"commander";const d=()=>s(import.meta.url),f=(()=>o.dirname(d()))(),p=new u,m=o.join(f,`..`,`package.json`);let h=`0.0.0`;try{h=JSON.parse(c.readFileSync(m,`utf-8`)).version??`0.0.0`}catch{}p.name(`scaffoldfy`).description(`Automate project setup and configuration with customizable tasks`).version(h),p.option(`--dry-run`,`Run in dry mode without making any changes`).option(`--force`,`Force execution even if checks fail`).option(`--config <path>`,`Path to task configuration file (JSON or TypeScript)`,`./scaffoldfy.json`).option(`--no-validate`,`Skip schema validation of task configuration (validation is enabled by default)`).option(`--debug`,`Enable debug logging for verbose output`).action(async s=>{s.debug===!0&&t(!0);try{let t=[],u,d,f,p,m;if(s.config!=null&&s.config!==``){let a=o.resolve(l.cwd(),s.config);if(c.existsSync(a))if(m=a,a.endsWith(`.ts`)||a.endsWith(`.mts`)){e(`Loading tasks from TypeScript file: ${s.config}`,`info`);try{let n=await import(a);t=n.default??n.tasks??[],(!Array.isArray(t)||t.length===0)&&(e(`⚠️ No tasks found in TypeScript file or invalid format`,`warn`),e(`Expected default export or named export "tasks" with TaskDefinition[]`,`info`))}catch(t){e(`Failed to load TypeScript config file: ${s.config}`,`error`),t instanceof Error&&e(` Error: ${t.message}`,`error`),l.exit(1)}}else try{if(s.validate!==!1){r(`Validating task configuration against schema...`);let t=c.readFileSync(a,`utf-8`);i(JSON.parse(t),{silent:!1}).valid||(e(``,`error`),e(`💡 You can skip validation with --no-validate flag, but this is not recommended.`,`info`),l.exit(1)),e(`Configuration validated`,`success`)}let o=await n(a,{sequential:!0});if(o.configs!=null&&o.configs.length>0){let{runConfigurationSequentially:e}=await import(`./run-configuration-sequentially-BXM4VcVd.js`),{createInitialConfig:t}=await import(`./initial-config-V9mm6hls.js`);await e(o.configs,{dryRun:s.dryRun??!1,force:s.force??!1,configFilePath:a},t()),l.exit(0)}t=o.tasks,u=o.variables,d=o.prompts,f=o.enabled,p=o.transformers,Array.isArray(t)||(e(`❌ Invalid config file format`,`error`),e(`Expected JSON with { "tasks": [...] } structure`,`info`),l.exit(1))}catch(t){e(`Failed to load JSON config file: ${s.config}`,`error`),t instanceof Error&&e(` Error: ${t.message}`,`error`),l.exit(1)}else e(`Config file not found: ${s.config}`,`warn`)}let h=d!=null&&d.length>0||u!=null&&u.length>0;t.length===0&&!h&&(e(`❌ No tasks defined`,`error`),e(`Please provide tasks using one of these methods:`,`info`),e(` 1. Create a template-tasks.json file in the current directory`,`info`),e(` 2. Create a template-tasks.ts file in the current directory`,`info`),e(` 3. Use --config option to specify a different config file`,`info`),e(`Example JSON structure:`,`info`),console.log(JSON.stringify({tasks:[{id:`update-package`,name:`Update package.json`,description:`Update package.json with repository information`,required:!0,enabled:!0,type:`update-json`,prompts:[{id:`projectName`,type:`input`,message:`What is your project name?`,default:`my-project`,required:!0},{id:`includeTests`,type:`confirm`,message:`Include test files?`,default:!0}],config:{file:`package.json`,updates:{name:`{{projectName}}`,author:`{{author}}`}}}]},null,2)),l.exit(1)),t.length===0?e(`Loaded template with 0 tasks (template may only provide prompts/variables for extending)`,`info`):e(`Loaded ${t.length} task(s)`,`success`),await a(t,{dryRun:s.dryRun,force:s.force,configFilePath:m,variables:u,prompts:d,configEnabled:f,transformers:p})}catch(t){if(e(`❌ CLI execution failed`,`error`),t instanceof Error){e(`Error: ${t.message}`,`error`);let n=l.env.DEBUG;n!=null&&n!==``&&console.error(t.stack)}else console.error(t);l.exit(1)}}),p.parse(l.argv);export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"node:path";import t from"node:fs";import n from"node:process";import{promisify as r}from"node:util";import"handlebars";import i from"node:os";import{execSync as a}from"node:child_process";import{camelCase as o,capitalCase as s,constantCase as c,kebabCase as l,lowerCase as u,pascalCase as d,snakeCase as f,upperCase as p}from"case-anything";import{log as m}from"node:console";const h=new Map;function ee(){h.clear()}var g=class extends Error{constructor(e,t){super(e),this.code=t,this.name=this.constructor.name}},_=class e extends g{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)}},v=class e extends g{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 g{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 g{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 g{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 g{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 g{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 g{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 g{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`)}},ie=class e extends g{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 g{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 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 oe(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-BWYwAqXM.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-BWYwAqXM.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 se(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function ce(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 le(e,t){let n=ce(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-BWYwAqXM.js`);return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await import(`./utils-BWYwAqXM.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 se(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 ue(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(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)}async function B(n){let{file:r,sourceUrl:a,tempFileExtension:o=`.tmp`,tempFilePrefix:s=`scaffoldfy`}=n,c=r,l,u,d=!1;if(I(r)){l=r,O(`Fetching remote file: ${l}`);let n=await q(l);d=!0;let a=i.tmpdir(),c=`${s}-${Date.now()}${o}`;u=e.join(a,c),t.writeFileSync(u,n,`utf-8`),O(`Remote file saved to temporary location: ${u}`)}else if(l=z(r,a),I(l)){O(`Fetching remote file: ${l}`);let n=await q(l);d=!0;let r=i.tmpdir(),a=`${s}-${Date.now()}${o}`;u=e.join(r,a),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 V(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 H(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 de(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 fe(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function U(t,r){let i=K(t.file,r),o=t.args?.map(e=>K(e,r))??[],s={};if(t.parameters)for(let[e,n]of Object.entries(t.parameters))s[e]=K(n,r);let c=t.cwd!=null&&t.cwd!==``?e.join(n.cwd(),K(t.cwd,r)):n.cwd(),l=await B({file:i,...t.sourceUrl!=null&&t.sourceUrl!==``&&{sourceUrl:t.sourceUrl},tempFileExtension:fe(t.runtime??H(i)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:u}=l,d=t.runtime??H(u)??`node`;!t.runtime&&!H(u)&&N(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let e=de(d,u),r=o.join(` `),i=r?`${e} ${r}`:e;O(`Executing: ${i}`);let l=a(i,{cwd:c,stdio:t.captureOutput?[`pipe`,`pipe`,`pipe`]:`inherit`,env:{...n.env,...s},encoding:t.captureOutput?`utf-8`:void 0});if(t.captureOutput)return O(`Script executed successfully with output`),typeof l==`string`?l:void 0;O(`Script executed successfully`);return}finally{V(l)}}async function W(e,t){let{id:n,contextType:r,context:i,sourceUrl:o}=t;if(e==null)return;if(typeof e!=`object`||!e||Array.isArray(e))return e;let s=e;if(s.type===`conditional`){if(!i){N(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof s.condition!=`string`){N(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=P(s.condition,i)?s.ifTrue:s.ifFalse;return typeof e==`object`&&e?await W(e,t):e}catch(e){N(`${r} "${n}": failed to evaluate conditional value: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`exec`){let e=s.value;if(typeof e!=`string`){N(`${r} "${n}": exec value must have a string command`,`error`);return}try{return G(a(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(s.type===`exec-file`){let e=s;if(typeof e.file!=`string`){N(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await U({file:e.file,...e.runtime!=null&&e.runtime.trim()!==``&&{runtime:e.runtime},...e.args&&{args:e.args},...e.parameters&&{parameters:e.parameters},...e.cwd!==void 0&&e.cwd.trim()!==``&&{cwd:e.cwd},...o!=null&&{sourceUrl:o},captureOutput:!0},i??{});return t===void 0?void 0:G(t.trim())}catch(e){N(`${r} "${n}": failed to execute script file: ${e instanceof Error?e.message:`Unknown error`}`,`warn`);return}}if(s.type===`static`)return s.value;if(s.type===`interpolate`){let e=s.value;if(typeof e!=`string`){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 K(e,i)}catch(t){return N(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(s.type!==void 0){N(`${r} "${n}": unknown value type "${s.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function G(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 K(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>R(t,n)?.toString()??``)}const pe=r(t.readFile);async function q(e){if(I(e))return J(e);if(!t.existsSync(e))throw v.forPath(e);return pe(e,`utf-8`)}async function J(e){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)}}const me=r(t.readFile);async function Y(r,i=new Set){let a=I(r),o;if(o=a||e.isAbsolute(r)?r:e.resolve(n.cwd(),r),h.has(o))return h.get(o);if(i.has(o))throw _.forConfigurationInheritance(i,o);i.add(o);let s;if(a)s=await J(o);else{if(!t.existsSync(o))throw v.forPath(o);s=await me(o,`utf-8`)}let c;try{c=JSON.parse(s)}catch(e){throw te.forFile(o,e instanceof Error?e:Error(String(e)))}if(c.name==null||c.name.trim()===``)throw b.missingName(o);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(c.name))throw b.invalidNameFormat(o,c.name);if(c.tasks!==void 0&&!Array.isArray(c.tasks))throw b.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 h.set(o,c),c}function he(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 _.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 X(t,r,i,a,o){let s=I(t),c;if(c=s||e.isAbsolute(t)?t:r==null?e.resolve(n.cwd(),t):I(r)?new URL(t,r).href:e.resolve(r,t),i.has(c))return;if(a.has(c))throw _.forConfigurationInheritance(a,c);a.add(c);let l=await Y(c),u=I(c)?new URL(`.`,c).href:e.dirname(c);if(l.extends!=null&&l.extends!==``){let e=Array.isArray(l.extends)?l.extends:[l.extends];for(let t of e)await X(t,u,i,a,o)}a.delete(c),i.add(c),o.push(l)}async function Z(e,t,n=new Set){let r=[];return await X(e,t,n,new Set,r),he(r)}const Q=new class{transformers=new Map;constructor(){this.registerBuiltInTransformers()}registerBuiltInTransformers(){for(let e of[{id:`lowercase`,type:`lowercase`},{id:`uppercase`,type:`uppercase`},{id:`trim`,type:`trim`},{id:`slugify`,type:`slugify`},{id:`capitalize`,type:`capitalize`},{id:`titlecase`,type:`titlecase`},{id:`camelcase`,type:`camelcase`},{id:`pascalcase`,type:`pascalcase`},{id:`snakecase`,type:`snakecase`},{id:`kebabcase`,type:`kebabcase`},{id:`constantcase`,type:`constantcase`},{id:`alphanumeric`,type:`alphanumeric`},{id:`collapse-spaces`,type:`collapse-spaces`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&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 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`camelcase`:return this.executeCamelcase(t);case`pascalcase`:return this.executePascalcase(t);case`snakecase`:return this.executeSnakecase(t);case`kebabcase`:return this.executeKebabcase(t);case`constantcase`:return this.executeConstantcase(t);case`alphanumeric`:return this.executeAlphanumeric(t);case`collapse-spaces`:return this.executeCollapseSpaces(t);case`remove-spaces`:return this.executeRemoveSpaces(t);case`urlencode`:return this.executeUrlencode(t);case`dasherize`:return this.executeDasherize(t);case`underscore`:return this.executeUnderscore(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw 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 u(String(e))}executeUppercase(e){return p(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 s(String(e))}executeTitlecase(e){return s(String(e))}executeCamelcase(e){return o(String(e))}executePascalcase(e){return d(String(e))}executeSnakecase(e){return f(String(e))}executeKebabcase(e){return l(String(e))}executeConstantcase(e){return c(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 l(String(e))}executeUnderscore(e){return f(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};async function ge(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 Q.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}function _e(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 ve(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 W(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 ye(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 be(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 $={template:[[`template`,`templateFile`]]};function xe(e,t,n){let r={...e},i=$[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 Se(e,t){let n=$[e];if(!n)return null;for(let e of n){let n=e.filter(e=>e in t&&t[e]!=null);if(n.length>1)return n}return null}function Ce(e,t){if((t.override??`merge`)===`replace`){m(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),m(` Base: ${L(e.$sourceUrl)}`,`info`),m(` Override: ${L(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}m(` → Merging task "${t.id}"`,`info`),m(` Base: ${L(e.$sourceUrl)}`,`info`),m(` Override: ${L(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=xe(e.config,t.config,t.type);let r=Se(t.type,n);r!==null&&r.length>0&&(m(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),m(` 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 we(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 Te(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return we(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 S.forPrompt(e.id);let t=be(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=_e(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,L(n.$sourceUrl),L(e.$sourceUrl))}let n=Ce(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;we(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 Ee(e,t,n=new Set){return Te(await Z(e,t,n))}async function De(e,t){if(O(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await Z(e);return O(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await Ee(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{j as A,P as C,N as D,k as E,ee as F,re as M,ne as N,ae as O,_ as P,F as S,M as T,ue as _,ve as a,le as b,Y as c,W as d,U as f,R as g,z as h,ye as i,ie as j,A as k,q as l,B as m,De as n,ge as o,V as p,Te as r,Q as s,Ee as t,K as u,L as v,O as w,oe as x,I as y};
|
|
@@ -0,0 +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(`node:os`);f=s(f);let p=require(`node:child_process`);p=s(p);let m=require(`case-anything`);m=s(m);let h=require(`node:console`);h=s(h);const g=new Map;function ee(){g.clear()}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)}},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)}},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`)}},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`)}},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`)}},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 T=!1;function ae(e){T=e}const E={debug:`🐛`,info:`ℹ`,success:`✓`,warn:`⚠`,error:`✗`},D={debug:`\x1B[35m`,info:`\x1B[36m`,success:`\x1B[32m`,warn:`\x1B[33m`,error:`\x1B[31m`},O=`\x1B[0m`;function k(e){T&&console.log(`${D.debug}${E.debug} ${e}${O}`)}function A(e){console.log(`${D.info}${E.info} ${e}${O}`)}function j(e){console.log(`${D.success}${E.success} ${e}${O}`)}function M(e){console.log(`${D.warn}${E.warn} ${e}${O}`)}function N(e){console.log(`${D.error}${E.error} ${e}${O}`)}function P(e,t=`info`){switch(t){case`debug`:k(e);break;case`info`:A(e);break;case`success`:j(e);break;case`warn`:M(e);break;case`error`:N(e);break}}function F(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&&(P(`Failed to evaluate condition: ${e}`,`warn`),t instanceof Error&&P(` Error: ${t.message}`,`warn`)),!1)}}function oe(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 F(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}async function I(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-CkNjiSuw.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-CkNjiSuw.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 F(e.value,t,n?.lazy===!0?{lazy:!0}:void 0)}return!1}function se(e,t){try{let n={...t};return Function(...Object.keys(n),`'use strict'; return (${e})`)(...Object.values(n))}catch{return!0}}function ce(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 le(e,t){let n=ce(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-CkNjiSuw.cjs`));return e(r(n.value,t),{encoding:`utf-8`,stdio:`ignore`}),!0}catch(e){let{log:t}=await Promise.resolve().then(()=>require(`./utils-CkNjiSuw.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 se(n.value,t)}return!0}function L(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function R(e){if(e==null||e===``)return`current configuration`;if(L(e))return e;let t=u.default.cwd();return e.startsWith(t)?l.default.relative(t,e):e}function ue(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 z(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 B(e,t){if(L(e))return e;if(t==null||t===``)return l.default.isAbsolute(e)?e:l.default.resolve(u.default.cwd(),e);if(L(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)}async function V(e){let{file:t,sourceUrl:n,tempFileExtension:r=`.tmp`,tempFilePrefix:i=`scaffoldfy`}=e,a=t,o,s,u=!1;if(L(t)){o=t,k(`Fetching remote file: ${o}`);let e=await J(o);u=!0;let n=f.default.tmpdir(),a=`${i}-${Date.now()}${r}`;s=l.default.join(n,a),c.default.writeFileSync(s,e,`utf-8`),k(`Remote file saved to temporary location: ${s}`)}else if(o=B(t,n),L(o)){k(`Fetching remote file: ${o}`);let e=await J(o);u=!0;let t=f.default.tmpdir(),n=`${i}-${Date.now()}${r}`;s=l.default.join(t,n),c.default.writeFileSync(s,e,`utf-8`),k(`Remote file saved to temporary location: ${s}`)}else{if(!c.default.existsSync(o))throw Error(`File not found: ${o}`);s=o,k(`Using local file: ${s}`)}return{localFilePath:s,isRemote:u,originalPath:a,resolvedPath:o}}function H(e){if(e.isRemote&&c.default.existsSync(e.localFilePath))try{c.default.unlinkSync(e.localFilePath),k(`Temporary file cleaned up: ${e.localFilePath}`)}catch(e){k(`Warning: Failed to clean up temporary file: ${e instanceof Error?e.message:String(e)}`)}}function U(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 de(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 fe(e){switch(e){case`node`:return`.js`;case`bash`:case`sh`:return`.sh`;case`pwsh`:case`powershell`:return`.ps1`;default:return`.js`}}async function W(e,t){let n=q(e.file,t),r=e.args?.map(e=>q(e,t))??[],i={};if(e.parameters)for(let[n,r]of Object.entries(e.parameters))i[n]=q(r,t);let a=e.cwd!=null&&e.cwd!==``?l.default.join(u.default.cwd(),q(e.cwd,t)):u.default.cwd(),o=await V({file:n,...e.sourceUrl!=null&&e.sourceUrl!==``&&{sourceUrl:e.sourceUrl},tempFileExtension:fe(e.runtime??U(n)??`node`),tempFilePrefix:`scaffoldfy-exec`}),{localFilePath:s}=o,c=e.runtime??U(s)??`node`;!e.runtime&&!U(s)&&P(`Could not detect runtime from file extension, defaulting to 'node'`,`warn`);try{let t=de(c,s),n=r.join(` `),o=n?`${t} ${n}`:t;k(`Executing: ${o}`);let l=(0,p.execSync)(o,{cwd:a,stdio:e.captureOutput?[`pipe`,`pipe`,`pipe`]:`inherit`,env:{...u.default.env,...i},encoding:e.captureOutput?`utf-8`:void 0});if(e.captureOutput)return k(`Script executed successfully with output`),typeof l==`string`?l:void 0;k(`Script executed successfully`);return}finally{H(o)}}async function G(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){P(`${r} "${n}": conditional value requires context but none provided`,`warn`);return}if(typeof o.condition!=`string`){P(`${r} "${n}": conditional value must have a string condition`,`error`);return}try{let e=F(o.condition,i)?o.ifTrue:o.ifFalse;return typeof e==`object`&&e?await G(e,t):e}catch(e){P(`${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`){P(`${r} "${n}": exec value must have a string command`,`error`);return}try{return K((0,p.execSync)(e,{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`pipe`],timeout:1e4}).trim())}catch(e){P(`${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`){P(`${r} "${n}": exec-file value must have a file path`,`error`);return}try{let t=await W({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:K(t.trim())}catch(e){P(`${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`){P(`${r} "${n}": interpolate value must be a string with {{variable}} placeholders`,`error`);return}if(!i)return P(`${r} "${n}": interpolate value requires context but none provided`,`warn`),e;try{return q(e,i)}catch(t){return P(`${r} "${n}": failed to interpolate value: ${t instanceof Error?t.message:`Unknown error`}`,`warn`),e}}if(o.type!==void 0){P(`${r} "${n}": unknown value type "${o.type}". Expected "static", "exec", "exec-file", "conditional", or "interpolate".`,`error`);return}return e}function K(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 q(e,t){return e.replace(/\{\{(?<key>[\w.]+)\}\}/gu,(e,n)=>z(t,n)?.toString()??``)}const pe=(0,d.promisify)(c.default.readFile);async function J(e){if(L(e))return Y(e);if(!c.default.existsSync(e))throw y.forPath(e);return pe(e,`utf-8`)}async function Y(e){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)}}const me=(0,d.promisify)(c.default.readFile);async function X(e,t=new Set){let n=L(e),r;if(r=n||l.default.isAbsolute(e)?e:l.default.resolve(u.default.cwd(),e),g.has(r))return g.get(r);if(t.has(r))throw v.forConfigurationInheritance(t,r);t.add(r);let i;if(n)i=await Y(r);else{if(!c.default.existsSync(r))throw y.forPath(r);i=await me(r,`utf-8`)}let a;try{a=JSON.parse(i)}catch(e){throw te.forFile(r,e instanceof Error?e:Error(String(e)))}if(a.name==null||a.name.trim()===``)throw x.missingName(r);if(!/^[a-z\d]+(?:-[a-z\d]+)*$/u.test(a.name))throw x.invalidNameFormat(r,a.name);if(a.tasks!==void 0&&!Array.isArray(a.tasks))throw x.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 g.set(r,a),a}function he(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 Z(e,t,n,r,i){let a=L(e),o;if(o=a||l.default.isAbsolute(e)?e:t==null?l.default.resolve(u.default.cwd(),e):L(t)?new URL(e,t).href:l.default.resolve(t,e),n.has(o))return;if(r.has(o))throw v.forConfigurationInheritance(r,o);r.add(o);let s=await X(o),c=L(o)?new URL(`.`,o).href:l.default.dirname(o);if(s.extends!=null&&s.extends!==``){let e=Array.isArray(s.extends)?s.extends:[s.extends];for(let t of e)await Z(t,c,n,r,i)}r.delete(o),n.add(o),i.push(s)}async function Q(e,t,n=new Set){let r=[];return await Z(e,t,n,new Set,r),he(r)}var ge=class{transformers=new Map;constructor(){this.registerBuiltInTransformers()}registerBuiltInTransformers(){for(let e of[{id:`lowercase`,type:`lowercase`},{id:`uppercase`,type:`uppercase`},{id:`trim`,type:`trim`},{id:`slugify`,type:`slugify`},{id:`capitalize`,type:`capitalize`},{id:`titlecase`,type:`titlecase`},{id:`camelcase`,type:`camelcase`},{id:`pascalcase`,type:`pascalcase`},{id:`snakecase`,type:`snakecase`},{id:`kebabcase`,type:`kebabcase`},{id:`constantcase`,type:`constantcase`},{id:`alphanumeric`,type:`alphanumeric`},{id:`collapse-spaces`,type:`collapse-spaces`},{id:`remove-spaces`,type:`remove-spaces`},{id:`urlencode`,type:`urlencode`},{id:`dasherize`,type:`dasherize`},{id:`underscore`,type:`underscore`}])this.transformers.set(e.id,e)}register(e){this.transformers.has(e.id)&&P(`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`camelcase`:return this.executeCamelcase(t);case`pascalcase`:return this.executePascalcase(t);case`snakecase`:return this.executeSnakecase(t);case`kebabcase`:return this.executeKebabcase(t);case`constantcase`:return this.executeConstantcase(t);case`alphanumeric`:return this.executeAlphanumeric(t);case`collapse-spaces`:return this.executeCollapseSpaces(t);case`remove-spaces`:return this.executeRemoveSpaces(t);case`urlencode`:return this.executeUrlencode(t);case`dasherize`:return this.executeDasherize(t);case`underscore`:return this.executeUnderscore(t);case`custom`:return this.executeCustom(e,t,n);case`chain`:return this.executeChainTransformer(e,t,n);default:{let t=e;throw 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(0,m.lowerCase)(String(e))}executeUppercase(e){return(0,m.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 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(0,m.capitalCase)(String(e))}executeTitlecase(e){return(0,m.capitalCase)(String(e))}executeCamelcase(e){return(0,m.camelCase)(String(e))}executePascalcase(e){return(0,m.pascalCase)(String(e))}executeSnakecase(e){return(0,m.snakeCase)(String(e))}executeKebabcase(e){return(0,m.kebabCase)(String(e))}executeConstantcase(e){return(0,m.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,m.kebabCase)(String(e))}executeUnderscore(e){return(0,m.snakeCase)(String(e))}clear(){this.transformers.clear()}getIds(){return Array.from(this.transformers.keys())}};const $=new ge;async function _e(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 $.apply(i.transformers,e,{...n,...r})),r[i.id]=e)}return r}function ve(e,t){if((t.override??`merge`)===`replace`){P(` → Variable "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}P(` → 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 ye(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 I(i.$configEnabled,e))continue}let e={...t};for(let[t,n]of r.entries())e[t]=n;let a=await G(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 be(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 xe(e,t){if((t.override??`merge`)===`replace`){P(` → Prompt "${t.id}" using 'replace' strategy`,`info`);let{override:e,...n}=t;return n}P(` → Prompt "${t.id}" merged`,`info`);let n=t.$sourceUrl??e.$sourceUrl,r={...e,...t,...n!=null&&{$sourceUrl:n}};return delete r.override,r}const Se={template:[[`template`,`templateFile`]]};function Ce(e,t,n){let r={...e},i=Se[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 we(e,t){let n=Se[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 Te(e,t){if((t.override??`merge`)===`replace`){(0,h.log)(` → Task "${t.id}" using 'replace' strategy - completely replacing base task`,`info`),(0,h.log)(` Base: ${R(e.$sourceUrl)}`,`info`),(0,h.log)(` Override: ${R(t.$sourceUrl)}`,`info`);let{override:n,...r}=t;return r}(0,h.log)(` → Merging task "${t.id}"`,`info`),(0,h.log)(` Base: ${R(e.$sourceUrl)}`,`info`),(0,h.log)(` Override: ${R(t.$sourceUrl)}`,`info`);let n;if(typeof e.config==`object`&&e.config!==null&&typeof t.config==`object`&&t.config!==null){n=Ce(e.config,t.config,t.type);let r=we(t.type,n);r!==null&&r.length>0&&((0,h.log)(` ⚠️ Warning: Conflicting config fields detected: ${r.join(`, `)}`,`warn`),(0,h.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 Ee(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 De(e){if(e.length===0)return{name:`Empty Configuration`,tasks:[]};if(e.length===1){let t=e[0];return Ee(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){P(`⊘ 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=xe(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=ve(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,R(n.$sourceUrl),R(e.$sourceUrl))}let n=Te(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;Ee(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 Oe(e,t,n=new Set){return De(await Q(e,t,n))}async function ke(e,t){if(k(`Loading tasks from ${e}...`),t?.sequential===!0){let t=await Q(e);return k(`Loaded ${t.length} configuration(s) for processing`),{tasks:[],configs:t}}let n=await Oe(e);P(`Loaded ${n.tasks?.length??0} task(s)`,`info`),n.extends!=null&&n.extends!==``&&P(`Extended from: ${(Array.isArray(n.extends)?n.extends:[n.extends]).join(`, `)}`,`info`),n.prompts!=null&&n.prompts.length>0&&P(`Found ${n.prompts.length} top-level prompt(s)`,`info`),n.variables!=null&&n.variables.length>0&&P(`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 M}}),Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`F`,{enumerable:!0,get:function(){return ee}}),Object.defineProperty(exports,`I`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`M`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`N`,{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,`P`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return ue}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,`j`,{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,`k`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return L}});
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./configurations-
|
|
1
|
+
const e=require(`./configurations-Dzwqq0PK.cjs`);require(`./initial-config-CESipc-c.cjs`);const t=require(`./tasks-CLC3xylo.cjs`),n=require(`./validate-scaffoldfy-json-Bic4iKqc.cjs`);require(`./scaffoldfy-config-validator-BvNnGMO1.cjs`);const r=require(`./src-B1q4_DaV.cjs`);exports.clearConfigurationCache=e.F,exports.clearPlugins=t.h,exports.createTaskPlugin=t.d,exports.displayTasksDiff=t.S,exports.executePluginTask=t.f,exports.getDeleteDiff=t.E,exports.getExecDiff=t.w,exports.getGitInitDiff=t.T,exports.getPlugin=t.g,exports.getPluginForTaskType=t.p,exports.getRegexReplaceDiff=t.O,exports.getRenameDiff=t.D,exports.getReplaceInFileDiff=t.k,exports.getTaskDiff=t.C,exports.getUpdateJsonDiff=t.A,exports.isPluginTaskType=t.m,exports.listPlugins=t._,exports.loadAndMergeConfiguration=e.t,exports.loadConfiguration=e.c,exports.loadTasksWithInheritance=e.n,exports.mergeConfigurations=e.r,exports.registerHooks=t.x,exports.registerPlugin=t.v,exports.runWithTasks=r.t,exports.unregisterPlugin=t.y,exports.validateScaffoldfyJsonFile=n.n;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as validateScaffoldfyJsonFile } from "./validate-scaffoldfy-json-BDtysLEj.cjs";
|
|
2
2
|
import "./index-BtBZHVmz.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/transformers/types.d.ts
|
|
@@ -172,7 +172,7 @@ interface WriteConfig {
|
|
|
172
172
|
}
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/types.d.ts
|
|
175
|
-
interface
|
|
175
|
+
interface CurrentConfigurationContext {
|
|
176
176
|
[key: string]: unknown;
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
@@ -345,9 +345,9 @@ interface TaskDefinition {
|
|
|
345
345
|
$configEnabled?: DynamicBooleanValue;
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
348
|
-
* Configuration file structure for
|
|
348
|
+
* Configuration file structure for config tasks
|
|
349
349
|
*/
|
|
350
|
-
interface
|
|
350
|
+
interface ScaffoldfyConfiguration {
|
|
351
351
|
name: string;
|
|
352
352
|
description?: string;
|
|
353
353
|
enabled?: DynamicBooleanValue;
|
|
@@ -365,20 +365,20 @@ interface TaskPlugin {
|
|
|
365
365
|
name: string;
|
|
366
366
|
version?: string;
|
|
367
367
|
taskTypes: string[];
|
|
368
|
-
execute: (task: TaskDefinition, config:
|
|
368
|
+
execute: (task: TaskDefinition, config: CurrentConfigurationContext, options: {
|
|
369
369
|
dryRun: boolean;
|
|
370
370
|
}) => Promise<void>;
|
|
371
|
-
getDiff?: (task: TaskDefinition, config:
|
|
371
|
+
getDiff?: (task: TaskDefinition, config: CurrentConfigurationContext) => Promise<string>;
|
|
372
372
|
validate?: (task: TaskDefinition) => string[];
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Plugin lifecycle hooks
|
|
376
376
|
*/
|
|
377
377
|
interface PluginHooks {
|
|
378
|
-
beforeAll?: (config:
|
|
379
|
-
afterAll?: (config:
|
|
380
|
-
beforeTask?: (task: TaskDefinition, config:
|
|
381
|
-
afterTask?: (task: TaskDefinition, config:
|
|
378
|
+
beforeAll?: (config: CurrentConfigurationContext) => Promise<void>;
|
|
379
|
+
afterAll?: (config: CurrentConfigurationContext) => Promise<void>;
|
|
380
|
+
beforeTask?: (task: TaskDefinition, config: CurrentConfigurationContext) => Promise<void>;
|
|
381
|
+
afterTask?: (task: TaskDefinition, config: CurrentConfigurationContext) => Promise<void>;
|
|
382
382
|
onError?: (error: Error, task?: TaskDefinition) => Promise<void>;
|
|
383
383
|
}
|
|
384
384
|
//#endregion
|
|
@@ -395,7 +395,7 @@ declare function clearConfigurationCache(): void;
|
|
|
395
395
|
* @param visitedPaths - Set of already visited paths to detect circular dependencies
|
|
396
396
|
* @returns The loaded configuration
|
|
397
397
|
*/
|
|
398
|
-
declare function loadConfiguration(configPath: string, visitedPaths?: Set<string>): Promise<
|
|
398
|
+
declare function loadConfiguration(configPath: string, visitedPaths?: Set<string>): Promise<ScaffoldfyConfiguration>;
|
|
399
399
|
//#endregion
|
|
400
400
|
//#region src/configurations/load-tasks-with-inheritance.d.ts
|
|
401
401
|
/**
|
|
@@ -405,7 +405,7 @@ declare function loadConfiguration(configPath: string, visitedPaths?: Set<string
|
|
|
405
405
|
* @param visitedPaths - Set of already visited paths
|
|
406
406
|
* @returns Merged configuration
|
|
407
407
|
*/
|
|
408
|
-
declare function loadAndMergeConfiguration(configPath: string, baseDir?: string, visitedPaths?: Set<string>): Promise<
|
|
408
|
+
declare function loadAndMergeConfiguration(configPath: string, baseDir?: string, visitedPaths?: Set<string>): Promise<ScaffoldfyConfiguration>;
|
|
409
409
|
/**
|
|
410
410
|
* Load tasks from a configuration file with configuration inheritance support
|
|
411
411
|
* @param tasksFilePath - Path to the tasks configuration file
|
|
@@ -420,7 +420,7 @@ declare function loadTasksWithInheritance(tasksFilePath: string, options?: {
|
|
|
420
420
|
variables?: VariableDefinition[];
|
|
421
421
|
prompts?: PromptDefinition[];
|
|
422
422
|
enabled?: EnabledValue;
|
|
423
|
-
configs?:
|
|
423
|
+
configs?: ScaffoldfyConfiguration[];
|
|
424
424
|
transformers?: Transformer[];
|
|
425
425
|
}>;
|
|
426
426
|
//#endregion
|
|
@@ -431,31 +431,31 @@ declare function loadTasksWithInheritance(tasksFilePath: string, options?: {
|
|
|
431
431
|
* @param configurations - Array of configurations to merge (in priority order)
|
|
432
432
|
* @returns Merged configuration
|
|
433
433
|
*/
|
|
434
|
-
declare function mergeConfigurations(configurations:
|
|
434
|
+
declare function mergeConfigurations(configurations: ScaffoldfyConfiguration[]): ScaffoldfyConfiguration;
|
|
435
435
|
//#endregion
|
|
436
436
|
//#region src/dry-run/content-tasks.d.ts
|
|
437
437
|
/**
|
|
438
438
|
* Get diff for update-json task
|
|
439
439
|
*/
|
|
440
|
-
declare function getUpdateJsonDiff(config: UpdateJsonConfig, initConfig:
|
|
440
|
+
declare function getUpdateJsonDiff(config: UpdateJsonConfig, initConfig: CurrentConfigurationContext): Promise<string>;
|
|
441
441
|
/**
|
|
442
442
|
* Get diff for regex-replace task
|
|
443
443
|
*/
|
|
444
|
-
declare function getRegexReplaceDiff(config: RegexReplaceConfig, initConfig:
|
|
444
|
+
declare function getRegexReplaceDiff(config: RegexReplaceConfig, initConfig: CurrentConfigurationContext): Promise<string>;
|
|
445
445
|
/**
|
|
446
446
|
* Get diff for replace-in-file task
|
|
447
447
|
*/
|
|
448
|
-
declare function getReplaceInFileDiff(config: ReplaceInFileConfig, initConfig:
|
|
448
|
+
declare function getReplaceInFileDiff(config: ReplaceInFileConfig, initConfig: CurrentConfigurationContext): Promise<string>;
|
|
449
449
|
//#endregion
|
|
450
450
|
//#region src/dry-run/file-tasks.d.ts
|
|
451
451
|
/**
|
|
452
452
|
* Get diff for delete task
|
|
453
453
|
*/
|
|
454
|
-
declare function getDeleteDiff(config: DeleteConfig, initConfig:
|
|
454
|
+
declare function getDeleteDiff(config: DeleteConfig, initConfig: CurrentConfigurationContext): string;
|
|
455
455
|
/**
|
|
456
456
|
* Get diff for rename task
|
|
457
457
|
*/
|
|
458
|
-
declare function getRenameDiff(config: RenameConfig, initConfig:
|
|
458
|
+
declare function getRenameDiff(config: RenameConfig, initConfig: CurrentConfigurationContext): string;
|
|
459
459
|
//#endregion
|
|
460
460
|
//#region src/dry-run/system-tasks.d.ts
|
|
461
461
|
/**
|
|
@@ -465,19 +465,26 @@ declare function getGitInitDiff(config: GitInitConfig): string;
|
|
|
465
465
|
/**
|
|
466
466
|
* Get diff for exec task
|
|
467
467
|
*/
|
|
468
|
-
declare function getExecDiff(config: ExecConfig, initConfig:
|
|
468
|
+
declare function getExecDiff(config: ExecConfig, initConfig: CurrentConfigurationContext): string;
|
|
469
469
|
//#endregion
|
|
470
470
|
//#region src/dry-run/index.d.ts
|
|
471
471
|
/**
|
|
472
472
|
* Get diff for any task type
|
|
473
473
|
*/
|
|
474
|
-
declare function getTaskDiff(task: TaskDefinition, initConfig:
|
|
474
|
+
declare function getTaskDiff(task: TaskDefinition, initConfig: CurrentConfigurationContext): Promise<string>;
|
|
475
475
|
/**
|
|
476
476
|
* Display diffs for all tasks
|
|
477
477
|
*/
|
|
478
|
-
declare function displayTasksDiff(tasks: TaskDefinition[], initConfig:
|
|
478
|
+
declare function displayTasksDiff(tasks: TaskDefinition[], initConfig: CurrentConfigurationContext): Promise<void>;
|
|
479
479
|
//#endregion
|
|
480
|
-
//#region src/plugin.d.ts
|
|
480
|
+
//#region src/plugin-registry/hooks.d.ts
|
|
481
|
+
/**
|
|
482
|
+
* Register global lifecycle hooks
|
|
483
|
+
* @param hooks - Hook functions to register
|
|
484
|
+
*/
|
|
485
|
+
declare function registerHooks(hooks: Partial<PluginHooks>): void;
|
|
486
|
+
//#endregion
|
|
487
|
+
//#region src/plugin-registry/plugin-registration.d.ts
|
|
481
488
|
/**
|
|
482
489
|
* Register a plugin
|
|
483
490
|
* @param plugin - The plugin to register
|
|
@@ -494,18 +501,6 @@ declare function unregisterPlugin(pluginName: string): void;
|
|
|
494
501
|
* @returns The plugin or undefined if not found
|
|
495
502
|
*/
|
|
496
503
|
declare function getPlugin(pluginName: string): TaskPlugin | undefined;
|
|
497
|
-
/**
|
|
498
|
-
* Get a plugin for a task type
|
|
499
|
-
* @param taskType - The task type
|
|
500
|
-
* @returns The plugin or undefined if not found
|
|
501
|
-
*/
|
|
502
|
-
declare function getPluginForTaskType(taskType: string): TaskPlugin | undefined;
|
|
503
|
-
/**
|
|
504
|
-
* Check if a task type is handled by a plugin
|
|
505
|
-
* @param taskType - The task type to check
|
|
506
|
-
* @returns True if a plugin handles this task type
|
|
507
|
-
*/
|
|
508
|
-
declare function isPluginTaskType(taskType: string): boolean;
|
|
509
504
|
/**
|
|
510
505
|
* List all registered plugins
|
|
511
506
|
* @returns Array of plugin names
|
|
@@ -515,11 +510,8 @@ declare function listPlugins(): string[];
|
|
|
515
510
|
* Clear all registered plugins (useful for testing)
|
|
516
511
|
*/
|
|
517
512
|
declare function clearPlugins(): void;
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
* @param hooks - Hook functions to register
|
|
521
|
-
*/
|
|
522
|
-
declare function registerHooks(hooks: Partial<PluginHooks>): void;
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/plugin-registry/task-execution.d.ts
|
|
523
515
|
/**
|
|
524
516
|
* Execute a plugin task
|
|
525
517
|
* @param task - The task to execute
|
|
@@ -528,9 +520,25 @@ declare function registerHooks(hooks: Partial<PluginHooks>): void;
|
|
|
528
520
|
* @param options.dryRun - Whether to run in dry-run mode
|
|
529
521
|
* @returns Promise that resolves when the task is complete
|
|
530
522
|
*/
|
|
531
|
-
declare function executePluginTask(task: TaskDefinition, config:
|
|
523
|
+
declare function executePluginTask(task: TaskDefinition, config: CurrentConfigurationContext, options: {
|
|
532
524
|
dryRun: boolean;
|
|
533
525
|
}): Promise<void>;
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/plugin-registry/task-type-mapping.d.ts
|
|
528
|
+
/**
|
|
529
|
+
* Get a plugin for a task type
|
|
530
|
+
* @param taskType - The task type
|
|
531
|
+
* @returns The plugin or undefined if not found
|
|
532
|
+
*/
|
|
533
|
+
declare function getPluginForTaskType(taskType: string): TaskPlugin | undefined;
|
|
534
|
+
/**
|
|
535
|
+
* Check if a task type is handled by a plugin
|
|
536
|
+
* @param taskType - The task type to check
|
|
537
|
+
* @returns True if a plugin handles this task type
|
|
538
|
+
*/
|
|
539
|
+
declare function isPluginTaskType(taskType: string): boolean;
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/plugin-registry/utils.d.ts
|
|
534
542
|
/**
|
|
535
543
|
* Create a simple task plugin
|
|
536
544
|
* @param name - Plugin name
|
|
@@ -542,11 +550,11 @@ declare function executePluginTask(task: TaskDefinition, config: InitConfig, opt
|
|
|
542
550
|
* @param options.validate - Function to validate task configuration
|
|
543
551
|
* @returns A TaskPlugin object
|
|
544
552
|
*/
|
|
545
|
-
declare function createTaskPlugin(name: string, taskType: string, execute: (task: TaskDefinition, config:
|
|
553
|
+
declare function createTaskPlugin(name: string, taskType: string, execute: (task: TaskDefinition, config: CurrentConfigurationContext, options: {
|
|
546
554
|
dryRun: boolean;
|
|
547
555
|
}) => Promise<void>, options?: {
|
|
548
556
|
version?: string;
|
|
549
|
-
getDiff?: (task: TaskDefinition, config:
|
|
557
|
+
getDiff?: (task: TaskDefinition, config: CurrentConfigurationContext) => Promise<string>;
|
|
550
558
|
validate?: (task: TaskDefinition) => string[];
|
|
551
559
|
}): TaskPlugin;
|
|
552
560
|
//#endregion
|
|
@@ -573,4 +581,4 @@ declare function runWithTasks(customTasks: TaskDefinition[], options?: {
|
|
|
573
581
|
transformers?: Transformer[] | undefined;
|
|
574
582
|
}): Promise<void>;
|
|
575
583
|
//#endregion
|
|
576
|
-
export { type AppendConfig, BasePrompt, ConditionExpression, ConditionalConfig, ConditionalDefaultConfig, ConfirmPrompt, type CopyConfig, type CreateConfig, DefaultValue, DefaultValueConfig, DefaultValueType, type DeleteConfig, DynamicBooleanValue, EnabledValue, type ExecConfig, ExecFileRuntime, ExecFileValueConfig, ExecutableConfig, type GitInitConfig,
|
|
584
|
+
export { type AppendConfig, BasePrompt, 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 };
|