@shell-shock/core 0.1.0 → 0.2.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 (43) hide show
  1. package/dist/api.cjs +1 -1
  2. package/dist/api.d.cts +7 -0
  3. package/dist/api.d.mts +7 -0
  4. package/dist/api.mjs +1 -1
  5. package/dist/helpers/get-default-options.cjs +1 -0
  6. package/dist/helpers/get-default-options.d.cts +15 -0
  7. package/dist/helpers/get-default-options.d.mts +15 -0
  8. package/dist/helpers/get-default-options.mjs +1 -0
  9. package/dist/helpers/persistence.cjs +1 -0
  10. package/dist/helpers/persistence.mjs +1 -0
  11. package/dist/helpers/resolve-command.cjs +1 -1
  12. package/dist/helpers/resolve-command.mjs +1 -1
  13. package/dist/helpers/update-package-json.cjs +1 -1
  14. package/dist/helpers/update-package-json.mjs +1 -1
  15. package/dist/helpers/utilities.cjs +1 -0
  16. package/dist/helpers/utilities.mjs +1 -0
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.cts +16 -2
  19. package/dist/index.d.mts +16 -2
  20. package/dist/index.mjs +1 -1
  21. package/dist/powerlines.cjs +3 -2
  22. package/dist/powerlines.d.cts +2 -2
  23. package/dist/powerlines.d.mts +2 -2
  24. package/dist/powerlines.mjs +3 -2
  25. package/dist/types/command.d.cts +63 -0
  26. package/dist/types/command.d.mts +63 -0
  27. package/dist/types/config.d.cts +5 -7
  28. package/dist/types/config.d.mts +5 -7
  29. package/dist/types/context.cjs +0 -0
  30. package/dist/types/context.d.cts +25 -0
  31. package/dist/types/context.d.mts +25 -0
  32. package/dist/types/context.mjs +1 -0
  33. package/dist/types/index.d.cts +4 -2
  34. package/dist/types/index.d.mts +4 -2
  35. package/dist/types/options.cjs +0 -0
  36. package/dist/types/options.d.cts +7 -0
  37. package/dist/types/options.d.mts +7 -0
  38. package/dist/types/options.mjs +1 -0
  39. package/package.json +9 -6
  40. package/dist/types/build.d.cts +0 -66
  41. package/dist/types/build.d.mts +0 -66
  42. /package/dist/types/{build.cjs → command.cjs} +0 -0
  43. /package/dist/types/{build.mjs → command.mjs} +0 -0
package/dist/api.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines.cjs`);let n=require(`powerlines`);var r=class e{#e;static async from(r={}){return new e(await(0,n.createPowerlines)({...r,plugins:(r.plugins??[]).concat(t.shellShock())}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};exports.ShellShockAPI=r;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines.cjs`);let n=require(`@powerlines/plugin-tsdown`);n=e.__toESM(n);let r=require(`powerlines`);var i=class e{#e;static async from(i={}){return new e(await(0,r.createPowerlines)({...i,plugins:[(0,n.default)(),t.shellShock(),...i.plugins??[]]}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};exports.ShellShockAPI=i;
package/dist/api.d.cts CHANGED
@@ -2,6 +2,13 @@ import { UserConfig } from "./types/config.cjs";
2
2
  import { BuildInlineConfig, CleanInlineConfig, DocsInlineConfig, LintInlineConfig, PrepareInlineConfig } from "powerlines/types/config";
3
3
 
4
4
  //#region src/api.d.ts
5
+
6
+ /**
7
+ * The Shell Shock API class.
8
+ *
9
+ * @remarks
10
+ * This class provides methods to interact with the Shell Shock build system, including cleaning, preparing, linting, building, generating documentation, and finalizing projects.
11
+ */
5
12
  declare class ShellShockAPI {
6
13
  #private;
7
14
  static from(config?: UserConfig): Promise<ShellShockAPI>;
package/dist/api.d.mts CHANGED
@@ -2,6 +2,13 @@ import { UserConfig } from "./types/config.mjs";
2
2
  import { BuildInlineConfig, CleanInlineConfig, DocsInlineConfig, LintInlineConfig, PrepareInlineConfig } from "powerlines/types/config";
3
3
 
4
4
  //#region src/api.d.ts
5
+
6
+ /**
7
+ * The Shell Shock API class.
8
+ *
9
+ * @remarks
10
+ * This class provides methods to interact with the Shell Shock build system, including cleaning, preparing, linting, building, generating documentation, and finalizing projects.
11
+ */
5
12
  declare class ShellShockAPI {
6
13
  #private;
7
14
  static from(config?: UserConfig): Promise<ShellShockAPI>;
package/dist/api.mjs CHANGED
@@ -1 +1 @@
1
- import{shellShock as e}from"./powerlines.mjs";import{createPowerlines as t}from"powerlines";var n=class n{#e;static async from(r={}){return new n(await t({...r,plugins:(r.plugins??[]).concat(e())}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};export{n as ShellShockAPI};
1
+ import{shellShock as e}from"./powerlines.mjs";import t from"@powerlines/plugin-tsdown";import{createPowerlines as n}from"powerlines";var r=class r{#e;static async from(i={}){return new r(await n({...i,plugins:[t(),e(),...i.plugins??[]]}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};export{r as ShellShockAPI};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@powerlines/deepkit/vendor/type`),n=require(`@stryke/type-checks/is-function`);function r(e,r){return e.config.defaultOptions===!1?[]:Array.isArray(e.config.defaultOptions)?e.config.defaultOptions:(0,n.isFunction)(e.config.defaultOptions)?e.config.defaultOptions(e,r):[{name:`help`,title:`Help`,description:`Show help information.`,alias:[`h`,`?`],kind:t.ReflectionKind.boolean,optional:!0,default:!1,skipAddingNegative:!0},{name:`version`,title:`Version`,description:`Show the version of the application.`,alias:[`v`],kind:t.ReflectionKind.boolean,optional:!0,default:!1,skipAddingNegative:!0}]}exports.getDefaultOptions=r;
@@ -0,0 +1,15 @@
1
+ import { CommandBase, CommandOption } from "../types/command.cjs";
2
+ import { Context } from "../types/context.cjs";
3
+
4
+ //#region src/helpers/get-default-options.d.ts
5
+
6
+ /**
7
+ * Get the default command options.
8
+ *
9
+ * @param context - The build context.
10
+ * @param command - The command input.
11
+ * @returns The default command options.
12
+ */
13
+ declare function getDefaultOptions(context: Context, command: CommandBase): CommandOption[];
14
+ //#endregion
15
+ export { getDefaultOptions };
@@ -0,0 +1,15 @@
1
+ import { CommandBase, CommandOption } from "../types/command.mjs";
2
+ import { Context } from "../types/context.mjs";
3
+
4
+ //#region src/helpers/get-default-options.d.ts
5
+
6
+ /**
7
+ * Get the default command options.
8
+ *
9
+ * @param context - The build context.
10
+ * @param command - The command input.
11
+ * @returns The default command options.
12
+ */
13
+ declare function getDefaultOptions(context: Context, command: CommandBase): CommandOption[];
14
+ //#endregion
15
+ export { getDefaultOptions };
@@ -0,0 +1 @@
1
+ import{ReflectionKind as e}from"@powerlines/deepkit/vendor/type";import{isFunction as t}from"@stryke/type-checks/is-function";function n(n,r){return n.config.defaultOptions===!1?[]:Array.isArray(n.config.defaultOptions)?n.config.defaultOptions:t(n.config.defaultOptions)?n.config.defaultOptions(n,r):[{name:`help`,title:`Help`,description:`Show help information.`,alias:[`h`,`?`],kind:e.boolean,optional:!0,default:!1,skipAddingNegative:!0},{name:`version`,title:`Version`,description:`Show the version of the application.`,alias:[`v`],kind:e.boolean,optional:!0,default:!1,skipAddingNegative:!0}]}export{n as getDefaultOptions};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`);function n(e){return(0,t.joinPaths)(e.dataPath,`commands.json`)}function r(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,e.id);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}function i(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,r);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}async function a(e){let t=await e.fs.read(n(e));if(!t||!t.length)throw Error(`CLI Command reflection file ${n(e)} is empty`);e.commands=i(JSON.parse(t))}async function o(e){let t=n(e);await e.fs.write(t,JSON.stringify(r(e.commands),null,e.config.mode===`development`?2:0))}exports.getCommandsPersistencePath=n,exports.readCommandsPersistence=a,exports.writeCommandsPersistence=o;
@@ -0,0 +1 @@
1
+ import{joinPaths as e}from"@stryke/path/join-paths";function t(t){return e(t.dataPath,`commands.json`)}function n(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,e.id);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}function r(e){let t=(e,n=null)=>{let r={...e,parent:n,children:{}};for(let[n,i]of Object.entries(e.children||{}))r.children[n]=t(i,r);return r},n={};for(let[r,i]of Object.entries(e))n[r]=t(i,null);return n}async function i(e){let n=await e.fs.read(t(e));if(!n||!n.length)throw Error(`CLI Command reflection file ${t(e)} is empty`);e.commands=r(JSON.parse(n))}async function a(e){let r=t(e);await e.fs.write(r,JSON.stringify(n(e.commands),null,e.config.mode===`development`?2:0))}export{t as getCommandsPersistencePath,i as readCommandsPersistence,a as writeCommandsPersistence};
@@ -1 +1 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`@stryke/path/file-path-fns`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/path/common`),a=require(`@stryke/path/normalize`),o=require(`@stryke/path/replace`),s=require(`@stryke/type-checks/is-set-string`);function c(e,t){return(0,o.replacePath)((0,n.findFilePath)(t),e.commandsRoot).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function l(e){return(0,s.isSetString)(e.config.entry)?(0,t.appendPath)((0,t.appendPath)((0,a.stripStars)(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):(0,r.isSetObject)(e.config.entry)&&`file`in e.config.entry?(0,t.appendPath)((0,t.appendPath)((0,a.stripStars)(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?(0,i.commonPath)(e.config.entry.map(n=>(0,t.appendPath)((0,t.appendPath)((0,a.stripStars)((0,s.isSetString)(n)?n:n.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):(0,t.appendPath)(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}exports.findCommandsRoot=l,exports.resolveCommandPath=c;
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./get-default-options.cjs`);let n=require(`@stryke/path/append`),r=require(`@stryke/path/file-path-fns`),i=require(`@stryke/path/replace`),a=require(`@stryke/path/resolve-parent-path`),o=require(`@stryke/string-format/title-case`),s=require(`@stryke/type-checks/is-set-object`),c=require(`@powerlines/deepkit/vendor/type`),l=require(`@powerlines/deepkit/reflect-type`),u=require(`@stryke/path/common`),d=require(`@stryke/path/normalize`),f=require(`@stryke/type-checks/is-set-string`);function p(e,t){return(0,i.replacePath)((0,r.findFilePath)(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function m(e){return(0,f.isSetString)(e.config.entry)?(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):(0,s.isSetObject)(e.config.entry)&&`file`in e.config.entry?(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?(0,u.commonPath)(e.config.entry.map(t=>(0,n.appendPath)((0,n.appendPath)((0,d.stripStars)((0,f.isSetString)(t)?t:t.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):(0,n.appendPath)(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}function h(e){let t=(0,r.findFolderName)(e),n=1;for(;t.startsWith(`[`)&&t.endsWith(`]`);)t=(0,r.findFolderName)((0,a.resolveParentPath)(e,n++));return t}async function g(e,n,r){let i=n.title||`${r?.title?`${r.title} - `:``}${(0,o.titleCase)(n.name)}`,a={...n,title:i,description:n.description||`The ${i} ${r?`sub-`:``}command.`,options:Object.fromEntries(t.getDefaultOptions(e,n).map(e=>[e.name,e])),params:[],parent:r??null,children:{}};if(n.isVirtual)e.trace(`Adding reflection for virtual command: ${n.id}`);else{if(!n.entry.input?.file||!e.fs.existsSync(n.entry.input.file))throw Error(`${n.entry.input?.file?`Non-existent`:`Missing`} command entry file for "${n.name}"`);e.trace(`Adding reflection for user-defined command: ${n.id} (file: ${n.entry.input.file})`);let t=await(0,l.reflectType)(e,n.entry.input);if(t.kind!==c.ReflectionKind.function)throw Error(`The command entry file "${n.entry.input.file}" does not export a valid function.`);if(t.parameters.length>0&&t.parameters[0]){let e=t.parameters[0];if(e.type.kind===c.ReflectionKind.objectLiteral||e.type.kind===c.ReflectionKind.class){let t=c.ReflectionClass.from(e.type);for(let e of t.getProperties()){let t=e.getType();if(a.options[e.getNameAsString()]={name:e.getNameAsString(),alias:e.getTags().alias??[],title:e.getTags().title||(0,o.titleCase)(e.getNameAsString()),description:e.getDescription(),kind:t.kind,optional:e.isOptional(),default:e.getDefaultValue(),variadic:!1},a.options[e.getNameAsString()].description??=`The ${a.options[e.getNameAsString()].title} option.`,t.kind===c.ReflectionKind.array)if(t.type.kind===c.ReflectionKind.string||t.type.kind===c.ReflectionKind.number)a.options[e.getNameAsString()].variadic=!0,a.options[e.getNameAsString()].kind=t.type.kind;else throw Error(`Unsupported array type for option "${e.getNameAsString()}" in command "${n.name}". Only string[] and number[] are supported.`);else if(t.kind!==c.ReflectionKind.boolean&&t.kind!==c.ReflectionKind.string&&t.kind!==c.ReflectionKind.number)throw Error(`Unsupported type for option "${e.getNameAsString()}" in command "${n.name}". Only string, number, boolean, string[] and number[] are supported, received ${(0,c.stringifyType)(t).trim().replaceAll(` | `,`, or `)}.`)}}}}for(let t of e.inputs.filter(e=>e.path.length===n.path.length+1&&e.path.slice(0,n.path.length).every((e,t)=>e===n.path[t])))a.children[t.name]=await g(e,t,a);return a}exports.findCommandName=h,exports.findCommandsRoot=m,exports.reflectCommandTree=g,exports.resolveCommandPath=p;
@@ -1 +1 @@
1
- import{appendPath as e}from"@stryke/path/append";import{findFilePath as t}from"@stryke/path/file-path-fns";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{commonPath as r}from"@stryke/path/common";import{stripStars as i}from"@stryke/path/normalize";import{replacePath as a}from"@stryke/path/replace";import{isSetString as o}from"@stryke/type-checks/is-set-string";function s(e,n){return a(t(n),e.commandsRoot).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function c(t){return o(t.config.entry)?e(e(i(t.config.entry),t.config.projectRoot),t.workspaceConfig.workspaceRoot):n(t.config.entry)&&`file`in t.config.entry?e(e(i(t.config.entry.file),t.config.projectRoot),t.workspaceConfig.workspaceRoot):Array.isArray(t.config.entry)&&t.config.entry.length>0?r(t.config.entry.map(n=>e(e(i(o(n)?n:n.file),t.config.projectRoot),t.workspaceConfig.workspaceRoot))):e(t.config.sourceRoot||t.config.projectRoot,t.workspaceConfig.workspaceRoot)}export{c as findCommandsRoot,s as resolveCommandPath};
1
+ import{getDefaultOptions as e}from"./get-default-options.mjs";import{appendPath as t}from"@stryke/path/append";import{findFilePath as n,findFolderName as r}from"@stryke/path/file-path-fns";import{replacePath as i}from"@stryke/path/replace";import{resolveParentPath as a}from"@stryke/path/resolve-parent-path";import{titleCase as o}from"@stryke/string-format/title-case";import{isSetObject as s}from"@stryke/type-checks/is-set-object";import{ReflectionClass as c,ReflectionKind as l,stringifyType as u}from"@powerlines/deepkit/vendor/type";import{reflectType as d}from"@powerlines/deepkit/reflect-type";import{commonPath as f}from"@stryke/path/common";import{stripStars as p}from"@stryke/path/normalize";import{isSetString as m}from"@stryke/type-checks/is-set-string";function h(e,t){return i(n(t),e.commandsPath).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function g(e){return m(e.config.entry)?t(t(p(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):s(e.config.entry)&&`file`in e.config.entry?t(t(p(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?f(e.config.entry.map(n=>t(t(p(m(n)?n:n.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):t(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}function _(e){let t=r(e),n=1;for(;t.startsWith(`[`)&&t.endsWith(`]`);)t=r(a(e,n++));return t}async function v(t,n,r){let i=n.title||`${r?.title?`${r.title} - `:``}${o(n.name)}`,a={...n,title:i,description:n.description||`The ${i} ${r?`sub-`:``}command.`,options:Object.fromEntries(e(t,n).map(e=>[e.name,e])),params:[],parent:r??null,children:{}};if(n.isVirtual)t.trace(`Adding reflection for virtual command: ${n.id}`);else{if(!n.entry.input?.file||!t.fs.existsSync(n.entry.input.file))throw Error(`${n.entry.input?.file?`Non-existent`:`Missing`} command entry file for "${n.name}"`);t.trace(`Adding reflection for user-defined command: ${n.id} (file: ${n.entry.input.file})`);let e=await d(t,n.entry.input);if(e.kind!==l.function)throw Error(`The command entry file "${n.entry.input.file}" does not export a valid function.`);if(e.parameters.length>0&&e.parameters[0]){let t=e.parameters[0];if(t.type.kind===l.objectLiteral||t.type.kind===l.class){let e=c.from(t.type);for(let t of e.getProperties()){let e=t.getType();if(a.options[t.getNameAsString()]={name:t.getNameAsString(),alias:t.getTags().alias??[],title:t.getTags().title||o(t.getNameAsString()),description:t.getDescription(),kind:e.kind,optional:t.isOptional(),default:t.getDefaultValue(),variadic:!1},a.options[t.getNameAsString()].description??=`The ${a.options[t.getNameAsString()].title} option.`,e.kind===l.array)if(e.type.kind===l.string||e.type.kind===l.number)a.options[t.getNameAsString()].variadic=!0,a.options[t.getNameAsString()].kind=e.type.kind;else throw Error(`Unsupported array type for option "${t.getNameAsString()}" in command "${n.name}". Only string[] and number[] are supported.`);else if(e.kind!==l.boolean&&e.kind!==l.string&&e.kind!==l.number)throw Error(`Unsupported type for option "${t.getNameAsString()}" in command "${n.name}". Only string, number, boolean, string[] and number[] are supported, received ${u(e).trim().replaceAll(` | `,`, or `)}.`)}}}}for(let e of t.inputs.filter(e=>e.path.length===n.path.length+1&&e.path.slice(0,n.path.length).every((e,t)=>e===n.path[t])))a.children[e.name]=await v(t,e,a);return a}export{_ as findCommandName,g as findCommandsRoot,v as reflectCommandTree,h as resolveCommandPath};
@@ -1 +1 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/type-checks/is-set-object`),r=require(`@stryke/path/replace`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/helpers/get-unique`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/string-format/kebab-case`);function c(e,t){return`./bin/${(0,s.kebabCase)((0,r.replaceExtension)(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function l(e){let r=(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`package.json`);if(e.config.bin&&Array.isArray(e.config.bin)&&e.config.bin.length>0?(e.packageJson.bin=Object.fromEntries((0,a.getUnique)((0,i.toArray)(e.config.bin)).map(t=>[t,c(t,e.config.output.format)])),await e.fs.write(r,o.StormJSON.stringify(e.packageJson))):!(0,n.isSetObject)(e.packageJson.bin)&&(e.config.name||e.packageJson.name)&&(e.packageJson.bin={[e.config.name||e.packageJson.name]:c(e.config.name||e.packageJson.name,e.config.output.format)},await e.fs.write(r,o.StormJSON.stringify(e.packageJson))),!(0,n.isSetObject)(e.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");e.config.bin=Object.keys(e.packageJson.bin)}exports.updatePackageJsonBinary=l;
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/path/replace`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/helpers/get-unique`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/string-format/kebab-case`);function c(e,t){return`./bin/${(0,s.kebabCase)((0,n.replaceExtension)(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function l(e){let n=(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`package.json`);if(e.config.bin&&Array.isArray(e.config.bin)&&e.config.bin.length>0?(e.packageJson.bin=Object.fromEntries((0,a.getUnique)((0,i.toArray)(e.config.bin)).map(t=>[t,c(t,e.config.output.format)])),await e.fs.write(n,o.StormJSON.stringify(e.packageJson))):!(0,r.isSetObject)(e.packageJson.bin)&&(e.config.name||e.packageJson.name)&&(e.packageJson.bin={[e.config.name||e.packageJson.name]:c(e.config.name||e.packageJson.name,e.config.output.format)},await e.fs.write(n,o.StormJSON.stringify(e.packageJson))),!(0,r.isSetObject)(e.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");e.config.bin=Object.keys(e.packageJson.bin)}exports.updatePackageJsonBinary=l;
@@ -1 +1 @@
1
- import{joinPaths as e}from"@stryke/path/join-paths";import{isSetObject as t}from"@stryke/type-checks/is-set-object";import{replaceExtension as n}from"@stryke/path/replace";import{toArray as r}from"@stryke/convert/to-array";import{getUnique as i}from"@stryke/helpers/get-unique";import{StormJSON as a}from"@stryke/json/storm-json";import{kebabCase as o}from"@stryke/string-format/kebab-case";function s(e,t){return`./bin/${o(n(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function c(n){let o=e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`package.json`);if(n.config.bin&&Array.isArray(n.config.bin)&&n.config.bin.length>0?(n.packageJson.bin=Object.fromEntries(i(r(n.config.bin)).map(e=>[e,s(e,n.config.output.format)])),await n.fs.write(o,a.stringify(n.packageJson))):!t(n.packageJson.bin)&&(n.config.name||n.packageJson.name)&&(n.packageJson.bin={[n.config.name||n.packageJson.name]:s(n.config.name||n.packageJson.name,n.config.output.format)},await n.fs.write(o,a.stringify(n.packageJson))),!t(n.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");n.config.bin=Object.keys(n.packageJson.bin)}export{c as updatePackageJsonBinary};
1
+ import{joinPaths as e}from"@stryke/path/join-paths";import{replaceExtension as t}from"@stryke/path/replace";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{toArray as r}from"@stryke/convert/to-array";import{getUnique as i}from"@stryke/helpers/get-unique";import{StormJSON as a}from"@stryke/json/storm-json";import{kebabCase as o}from"@stryke/string-format/kebab-case";function s(e,n){return`./bin/${o(t(e))}.${n===`cjs`||Array.isArray(n)&&n.includes(`cjs`)?`cjs`:`mjs`}`}async function c(t){let o=e(t.workspaceConfig.workspaceRoot,t.config.projectRoot,`package.json`);if(t.config.bin&&Array.isArray(t.config.bin)&&t.config.bin.length>0?(t.packageJson.bin=Object.fromEntries(i(r(t.config.bin)).map(e=>[e,s(e,t.config.output.format)])),await t.fs.write(o,a.stringify(t.packageJson))):!n(t.packageJson.bin)&&(t.config.name||t.packageJson.name)&&(t.packageJson.bin={[t.config.name||t.packageJson.name]:s(t.config.name||t.packageJson.name,t.config.output.format)},await t.fs.write(o,a.stringify(t.packageJson))),!n(t.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");t.config.bin=Object.keys(t.packageJson.bin)}export{c as updatePackageJsonBinary};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/string-format/title-case`),n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/string-format/kebab-case`);function i(e){let t=e.config.bin&&((0,n.isSetString)(e.config.bin)||Array.isArray(e.config.bin)&&e.config.bin.length>0&&e.config.bin[0])?(0,n.isSetString)(e.config.bin)?e.config.bin:e.config.bin[0]:e.config.name||e.packageJson?.name;if(!(0,n.isSetString)(t))throw Error(`No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.`);return(0,r.kebabCase)(t)}function a(e){return(0,t.titleCase)(e.config.name||i(e))}function o(e){return e.config.description||e.packageJson?.description||`The ${a(e)} command-line interface application.`}exports.getAppDescription=o,exports.getAppName=i,exports.getAppTitle=a;
@@ -0,0 +1 @@
1
+ import{titleCase as e}from"@stryke/string-format/title-case";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{kebabCase as n}from"@stryke/string-format/kebab-case";function r(e){let r=e.config.bin&&(t(e.config.bin)||Array.isArray(e.config.bin)&&e.config.bin.length>0&&e.config.bin[0])?t(e.config.bin)?e.config.bin:e.config.bin[0]:e.config.name||e.packageJson?.name;if(!t(r))throw Error(`No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.`);return n(r)}function i(t){return e(t.config.name||r(t))}function a(e){return e.config.description||e.packageJson?.description||`The ${i(e)} command-line interface application.`}export{a as getAppDescription,r as getAppName,i as getAppTitle};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./powerlines.cjs`),t=require(`./api.cjs`),n=require(`./config.cjs`);exports.ShellShockAPI=t.ShellShockAPI,exports.defineConfig=n.defineConfig,exports.shellShock=e.shellShock;
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./helpers/get-default-options.cjs`),t=require(`./powerlines.cjs`),n=require(`./api.cjs`),r=require(`./config.cjs`);async function i(e={}){return e.root??=process.cwd(),n.ShellShockAPI.from(e)}var a=n.ShellShockAPI;exports.ShellShockAPI=n.ShellShockAPI,exports.createShellShock=i,exports.default=a,exports.defineConfig=r.defineConfig,exports.getDefaultOptions=e.getDefaultOptions,exports.shellShock=t.shellShock;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,20 @@
1
+ import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./types/command.cjs";
2
+ import { Context } from "./types/context.cjs";
1
3
  import { Options, ResolvedConfig, UserConfig } from "./types/config.cjs";
2
4
  import { ShellShockAPI } from "./api.cjs";
3
5
  import { defineConfig } from "./config.cjs";
4
- import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./types/build.cjs";
6
+ import { getDefaultOptions } from "./helpers/get-default-options.cjs";
5
7
  import shellShock from "./powerlines.cjs";
6
- export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, ShellShockAPI, UserConfig, defineConfig, shellShock };
8
+ import { BaseCommandOptions } from "./types/options.cjs";
9
+
10
+ //#region src/index.d.ts
11
+
12
+ /**
13
+ * Creates a new {@link ShellShockAPI} instance.
14
+ *
15
+ * @param options - The user configuration options.
16
+ * @returns A promise that resolves to a {@link ShellShockAPI} instance.
17
+ */
18
+ declare function createShellShock(options?: Partial<UserConfig>): Promise<ShellShockAPI>;
19
+ //#endregion
20
+ export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, getDefaultOptions, shellShock };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,21 @@
1
+ import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./types/command.mjs";
2
+ import { Context } from "./types/context.mjs";
1
3
  import { Options, ResolvedConfig, UserConfig } from "./types/config.mjs";
2
4
  import { ShellShockAPI } from "./api.mjs";
3
5
  import { defineConfig } from "./config.mjs";
4
- import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./types/build.mjs";
6
+ import { getDefaultOptions } from "./helpers/get-default-options.mjs";
5
7
  import shellShock from "./powerlines.mjs";
8
+ import { BaseCommandOptions } from "./types/options.mjs";
6
9
  import "./types/index.mjs";
7
- export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, ShellShockAPI, UserConfig, defineConfig, shellShock };
10
+
11
+ //#region src/index.d.ts
12
+
13
+ /**
14
+ * Creates a new {@link ShellShockAPI} instance.
15
+ *
16
+ * @param options - The user configuration options.
17
+ * @returns A promise that resolves to a {@link ShellShockAPI} instance.
18
+ */
19
+ declare function createShellShock(options?: Partial<UserConfig>): Promise<ShellShockAPI>;
20
+ //#endregion
21
+ export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, ShellShockAPI, ShellShockAPI as default, StringCommandOption, UserConfig, createShellShock, defineConfig, getDefaultOptions, shellShock };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{shellShock as e}from"./powerlines.mjs";import{ShellShockAPI as t}from"./api.mjs";import{defineConfig as n}from"./config.mjs";export{t as ShellShockAPI,n as defineConfig,e as shellShock};
1
+ import{getDefaultOptions as e}from"./helpers/get-default-options.mjs";import{shellShock as t}from"./powerlines.mjs";import{ShellShockAPI as n}from"./api.mjs";import{defineConfig as r}from"./config.mjs";async function i(e={}){return e.root??=process.cwd(),n.from(e)}var a=n;export{n as ShellShockAPI,i as createShellShock,a as default,r as defineConfig,e as getDefaultOptions,t as shellShock};
@@ -1,2 +1,3 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./helpers/resolve-command.cjs`),n=require(`./helpers/update-package-json.cjs`);let r=require(`@powerlines/plugin-tsdown`);r=e.__toESM(r);let i=require(`@stryke/fs/chmod-x`),a=require(`@stryke/path/append`),o=require(`@stryke/path/file-path-fns`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/join-paths`),l=require(`@stryke/path/resolve-parent-path`),u=require(`@stryke/string-format/title-case`),d=require(`@stryke/type-checks/is-set-object`),f=require(`defu`),p=require(`node:fs`);const m=50,h=(e={})=>({name:`shell-shock`,dependsOn:[(0,r.default)()],async config(){return this.trace(`Resolving the Shell Shock configuration.`),(0,f.defu)(e,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[(0,c.joinPaths)(this.config.sourceRoot,`**/*`)]:void 0,build:{variant:`tsdown`},interactive:!0,skipDefaultArgs:!1,type:`application`,framework:`shell-shock`,singleBuild:!0})},async configResolved(){this.trace(`Shell Shock configuration has been resolved.`),await n.updatePackageJsonBinary(this),this.commandsRoot=t.findCommandsRoot(this),this.commands??=[],this.commands=this.entry.filter(e=>(0,o.findFileName)(e.file,{withExtension:!1})===`command`).reduce((e,n)=>{let r=(0,a.appendPath)((0,a.appendPath)(n.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!(0,s.isParentPath)(r,this.commandsRoot))throw Error(`Command entry point "${r}" is not located within the commands root "${this.commandsRoot}". Please ensure that all command entry points are located within the current project.`);let i=t.resolveCommandPath(this,r),o=i.replaceAll(`/`,`-`);return e.some(e=>e.name===o)||e.push({path:i.split(`/`).filter(Boolean),name:o,title:(0,u.titleCase)(o),isVirtual:!1,entry:{...n,file:r,input:n,output:o}}),e},this.commands)},async prepare(){if(this.trace(`Finding and adding virtual commands to the entry points.`),this.commands=this.commands.reduce((e,n)=>{let r=0,i=(0,l.resolveParentPath)((0,o.findFilePath)(n.entry.file));for(;i!==this.commandsRoot;){if(r++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${n.name}`);let a=(0,o.findFolderName)(i);if(!e.some(e=>(0,o.findFilePath)(e.entry.file)===i)&&(!a.startsWith(`[`)||!a.endsWith(`]`))){let n=t.resolveCommandPath(this,i),r=n.replaceAll(`/`,`-`);e.push({path:n.split(`/`).filter(Boolean),name:r,title:(0,u.titleCase)(r),isVirtual:!0,entry:{file:(0,c.joinPaths)(i,`command.ts`),input:{file:(0,c.joinPaths)(i,`command.ts`)},output:a}})}i=(0,l.resolveParentPath)(i)}return e},this.commands).sort((e,t)=>e.name.localeCompare(t.name)),this.commands.length===0){this.warn(`No commands were found in the project. Please ensure at least one command exists.`);return}this.info(`Creating an application with the following commands: \n${this.commands.map(e=>` - ${e.title} (${e.name}): ${e.entry.file}${e.isVirtual?` (virtual)`:``}`).join(`
2
- `)}`),this.entry=[]},async buildEnd(){if(!(0,d.isSetObject)(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))(0,p.existsSync)((0,a.appendPath)(e,this.config.output.buildPath))&&await(0,i.chmodX)((0,a.appendPath)(e,this.config.output.buildPath))}});var g=h;exports.default=g,exports.shellShock=h;
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./helpers/get-default-options.cjs`),n=require(`./helpers/persistence.cjs`),r=require(`./helpers/resolve-command.cjs`),i=require(`./helpers/update-package-json.cjs`),a=require(`./helpers/utilities.cjs`);let o=require(`@stryke/fs/chmod-x`),s=require(`@stryke/path/append`),c=require(`@stryke/path/file-path-fns`),l=require(`@stryke/path/is-parent-path`),u=require(`@stryke/path/join-paths`),d=require(`@stryke/path/replace`),f=require(`@stryke/path/resolve-parent-path`),p=require(`@stryke/string-format/title-case`),m=require(`@stryke/type-checks/is-set-object`),h=require(`defu`),g=require(`node:fs`);const _=50,v=(e={})=>[{name:`shell-shock:config`,async config(){return this.trace(`Resolving the Shell Shock configuration.`),(0,h.defu)(e,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[(0,u.joinPaths)(this.config.sourceRoot,`**/*`)]:void 0,build:{target:`node22`,platform:`node`},interactive:!0,type:`application`,framework:`shell-shock`})},configResolved:{order:`pre`,async handler(){this.trace(`Shell Shock configuration has been resolved.`),await i.updatePackageJsonBinary(this),this.config.name=a.getAppName(this),this.config.title=a.getAppTitle(this),this.config.description=a.getAppDescription(this),this.options=t.getDefaultOptions(this,{id:null,name:this.config.name,title:this.config.title,description:this.config.description,path:[],isVirtual:!1}),this.inputs??=[]}}},{name:`shell-shock:inputs`,async configResolved(){this.trace(`Finding command entry points.`),this.commandsPath=r.findCommandsRoot(this),this.inputs=this.entry.filter(e=>(0,c.findFileName)(e.file,{withExtension:!1})===`command`).reduce((e,t)=>{let n=(0,s.appendPath)((0,s.appendPath)(t.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!(0,l.isParentPath)(n,this.commandsPath))throw Error(`Command entry point "${n}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);let i=r.resolveCommandPath(this,n),a=i.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let o=r.findCommandName(n);e.push({id:a,path:i.split(`/`).filter(Boolean),name:o,title:(0,p.titleCase)(o),isVirtual:!1,entry:{...t,file:n,input:{file:t.file,name:t.name},output:o}})}return e},this.inputs)}},{name:`shell-shock:virtual-inputs`,configResolved:{order:`post`,async handler(){this.inputs.length===0?this.warn(`No commands were found in the project. Please ensure at least one command exists.`):(this.info(`Shell Shock will create an application with the following commands: \n${this.inputs.filter(e=>!e.isVirtual).map(e=>` - ${e.id}: ${(0,d.replacePath)(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
2
+ `)}`),this.trace(`Finding and adding virtual command inputs for each command previously found.`),this.inputs=this.inputs.reduce((e,t)=>{let n=0,i=(0,f.resolveParentPath)((0,c.findFilePath)(t.entry.file));for(;i!==this.commandsPath;){if(n++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${t.name}`);if(!e.some(e=>(0,c.findFilePath)(e.entry.file)===i)){let t=(0,u.joinPaths)(i,`command.ts`),n=r.resolveCommandPath(this,t),a=n.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let i=r.findCommandName(t);e.push({id:a,path:n.split(`/`).filter(Boolean),name:i,title:(0,p.titleCase)(i),isVirtual:!0,entry:{file:t,input:{file:t}}})}}i=(0,f.resolveParentPath)(i)}return e},this.inputs).sort((e,t)=>e.path.length-t.path.length),this.trace(`Final command input list: \n${this.inputs.map(e=>` - ${e.id}: ${(0,d.replacePath)(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
3
+ `)}`))}}},{name:`shell-shock:reflect-commands`,async prepare(){if(this.entry=[],this.commands={},this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&this.fs.existsSync(n.getCommandsPersistencePath(this)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),await n.readCommandsPersistence(this);else{for(let e of this.inputs.filter(e=>e.path.length===1))this.commands[e.name]=await r.reflectCommandTree(this,e);await n.writeCommandsPersistence(this)}}},{name:`shell-shock:chmod+x`,async buildEnd(){if(!(0,m.isSetObject)(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))(0,g.existsSync)((0,s.appendPath)(e,this.config.output.buildPath))&&await(0,o.chmodX)((0,s.appendPath)(e,this.config.output.buildPath))}}];var y=v;exports.default=y,exports.shellShock=v;
@@ -1,5 +1,5 @@
1
+ import { Context } from "./types/context.cjs";
1
2
  import { Options } from "./types/config.cjs";
2
- import { BuildContext } from "./types/build.cjs";
3
3
  import { Plugin } from "powerlines";
4
4
 
5
5
  //#region src/powerlines.d.ts
@@ -7,6 +7,6 @@ import { Plugin } from "powerlines";
7
7
  /**
8
8
  * The core Powerlines plugin to build Shell Shock projects.
9
9
  */
10
- declare const shellShock: <TContext extends BuildContext = BuildContext>(options?: Options) => Plugin<TContext>;
10
+ declare const shellShock: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
11
11
  //#endregion
12
12
  export { shellShock as default, shellShock };
@@ -1,5 +1,5 @@
1
+ import { Context } from "./types/context.mjs";
1
2
  import { Options } from "./types/config.mjs";
2
- import { BuildContext } from "./types/build.mjs";
3
3
  import { Plugin } from "powerlines";
4
4
 
5
5
  //#region src/powerlines.d.ts
@@ -7,6 +7,6 @@ import { Plugin } from "powerlines";
7
7
  /**
8
8
  * The core Powerlines plugin to build Shell Shock projects.
9
9
  */
10
- declare const shellShock: <TContext extends BuildContext = BuildContext>(options?: Options) => Plugin<TContext>;
10
+ declare const shellShock: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
11
11
  //#endregion
12
12
  export { shellShock as default, shellShock };
@@ -1,2 +1,3 @@
1
- import{findCommandsRoot as e,resolveCommandPath as t}from"./helpers/resolve-command.mjs";import{updatePackageJsonBinary as n}from"./helpers/update-package-json.mjs";import r from"@powerlines/plugin-tsdown";import{chmodX as i}from"@stryke/fs/chmod-x";import{appendPath as a}from"@stryke/path/append";import{findFileName as o,findFilePath as s,findFolderName as c}from"@stryke/path/file-path-fns";import{isParentPath as l}from"@stryke/path/is-parent-path";import{joinPaths as u}from"@stryke/path/join-paths";import{resolveParentPath as d}from"@stryke/path/resolve-parent-path";import{titleCase as f}from"@stryke/string-format/title-case";import{isSetObject as p}from"@stryke/type-checks/is-set-object";import{defu as m}from"defu";import{existsSync as h}from"node:fs";const g=(g={})=>({name:`shell-shock`,dependsOn:[r()],async config(){return this.trace(`Resolving the Shell Shock configuration.`),m(g,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[u(this.config.sourceRoot,`**/*`)]:void 0,build:{variant:`tsdown`},interactive:!0,skipDefaultArgs:!1,type:`application`,framework:`shell-shock`,singleBuild:!0})},async configResolved(){this.trace(`Shell Shock configuration has been resolved.`),await n(this),this.commandsRoot=e(this),this.commands??=[],this.commands=this.entry.filter(e=>o(e.file,{withExtension:!1})===`command`).reduce((e,n)=>{let r=a(a(n.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!l(r,this.commandsRoot))throw Error(`Command entry point "${r}" is not located within the commands root "${this.commandsRoot}". Please ensure that all command entry points are located within the current project.`);let i=t(this,r),o=i.replaceAll(`/`,`-`);return e.some(e=>e.name===o)||e.push({path:i.split(`/`).filter(Boolean),name:o,title:f(o),isVirtual:!1,entry:{...n,file:r,input:n,output:o}}),e},this.commands)},async prepare(){if(this.trace(`Finding and adding virtual commands to the entry points.`),this.commands=this.commands.reduce((e,n)=>{let r=0,i=d(s(n.entry.file));for(;i!==this.commandsRoot;){if(r++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${n.name}`);let a=c(i);if(!e.some(e=>s(e.entry.file)===i)&&(!a.startsWith(`[`)||!a.endsWith(`]`))){let n=t(this,i),r=n.replaceAll(`/`,`-`);e.push({path:n.split(`/`).filter(Boolean),name:r,title:f(r),isVirtual:!0,entry:{file:u(i,`command.ts`),input:{file:u(i,`command.ts`)},output:a}})}i=d(i)}return e},this.commands).sort((e,t)=>e.name.localeCompare(t.name)),this.commands.length===0){this.warn(`No commands were found in the project. Please ensure at least one command exists.`);return}this.info(`Creating an application with the following commands: \n${this.commands.map(e=>` - ${e.title} (${e.name}): ${e.entry.file}${e.isVirtual?` (virtual)`:``}`).join(`
2
- `)}`),this.entry=[]},async buildEnd(){if(!p(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))h(a(e,this.config.output.buildPath))&&await i(a(e,this.config.output.buildPath))}});var _=g;export{_ as default,g as shellShock};
1
+ import{getDefaultOptions as e}from"./helpers/get-default-options.mjs";import{getCommandsPersistencePath as t,readCommandsPersistence as n,writeCommandsPersistence as r}from"./helpers/persistence.mjs";import{findCommandName as i,findCommandsRoot as a,reflectCommandTree as o,resolveCommandPath as s}from"./helpers/resolve-command.mjs";import{updatePackageJsonBinary as c}from"./helpers/update-package-json.mjs";import{getAppDescription as l,getAppName as u,getAppTitle as d}from"./helpers/utilities.mjs";import{chmodX as f}from"@stryke/fs/chmod-x";import{appendPath as p}from"@stryke/path/append";import{findFileName as m,findFilePath as h}from"@stryke/path/file-path-fns";import{isParentPath as g}from"@stryke/path/is-parent-path";import{joinPaths as _}from"@stryke/path/join-paths";import{replacePath as v}from"@stryke/path/replace";import{resolveParentPath as y}from"@stryke/path/resolve-parent-path";import{titleCase as b}from"@stryke/string-format/title-case";import{isSetObject as x}from"@stryke/type-checks/is-set-object";import{defu as S}from"defu";import{existsSync as C}from"node:fs";const w=(w={})=>[{name:`shell-shock:config`,async config(){return this.trace(`Resolving the Shell Shock configuration.`),S(w,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[_(this.config.sourceRoot,`**/*`)]:void 0,build:{target:`node22`,platform:`node`},interactive:!0,type:`application`,framework:`shell-shock`})},configResolved:{order:`pre`,async handler(){this.trace(`Shell Shock configuration has been resolved.`),await c(this),this.config.name=u(this),this.config.title=d(this),this.config.description=l(this),this.options=e(this,{id:null,name:this.config.name,title:this.config.title,description:this.config.description,path:[],isVirtual:!1}),this.inputs??=[]}}},{name:`shell-shock:inputs`,async configResolved(){this.trace(`Finding command entry points.`),this.commandsPath=a(this),this.inputs=this.entry.filter(e=>m(e.file,{withExtension:!1})===`command`).reduce((e,t)=>{let n=p(p(t.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!g(n,this.commandsPath))throw Error(`Command entry point "${n}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);let r=s(this,n),a=r.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let o=i(n);e.push({id:a,path:r.split(`/`).filter(Boolean),name:o,title:b(o),isVirtual:!1,entry:{...t,file:n,input:{file:t.file,name:t.name},output:o}})}return e},this.inputs)}},{name:`shell-shock:virtual-inputs`,configResolved:{order:`post`,async handler(){this.inputs.length===0?this.warn(`No commands were found in the project. Please ensure at least one command exists.`):(this.info(`Shell Shock will create an application with the following commands: \n${this.inputs.filter(e=>!e.isVirtual).map(e=>` - ${e.id}: ${v(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
2
+ `)}`),this.trace(`Finding and adding virtual command inputs for each command previously found.`),this.inputs=this.inputs.reduce((e,t)=>{let n=0,r=y(h(t.entry.file));for(;r!==this.commandsPath;){if(n++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${t.name}`);if(!e.some(e=>h(e.entry.file)===r)){let t=_(r,`command.ts`),n=s(this,t),a=n.replaceAll(`/`,`-`);if(!e.some(e=>e.id===a)){let r=i(t);e.push({id:a,path:n.split(`/`).filter(Boolean),name:r,title:b(r),isVirtual:!0,entry:{file:t,input:{file:t}}})}}r=y(r)}return e},this.inputs).sort((e,t)=>e.path.length-t.path.length),this.trace(`Final command input list: \n${this.inputs.map(e=>` - ${e.id}: ${v(e.entry.file,this.commandsPath)}${e.isVirtual?` (virtual)`:``}`).join(`
3
+ `)}`))}}},{name:`shell-shock:reflect-commands`,async prepare(){if(this.entry=[],this.commands={},this.config.command!==`prepare`&&this.persistedMeta?.checksum===this.meta.checksum&&this.fs.existsSync(t(this)))this.debug(`Skipping reflection initialization as the meta checksum has not changed.`),await n(this);else{for(let e of this.inputs.filter(e=>e.path.length===1))this.commands[e.name]=await o(this,e);await r(this)}}},{name:`shell-shock:chmod+x`,async buildEnd(){if(!x(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))C(p(e,this.config.output.buildPath))&&await f(p(e,this.config.output.buildPath))}}];var T=w;export{T as default,w as shellShock};
@@ -0,0 +1,63 @@
1
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
2
+ import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
3
+
4
+ //#region src/types/command.d.ts
5
+ interface BaseCommandOption {
6
+ name: string;
7
+ kind: ReflectionKind;
8
+ title: string;
9
+ description?: string;
10
+ alias: string[];
11
+ optional: boolean;
12
+ }
13
+ interface StringCommandOption extends BaseCommandOption {
14
+ kind: ReflectionKind.string;
15
+ format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
16
+ default?: string;
17
+ variadic: boolean;
18
+ }
19
+ interface NumberCommandOption extends BaseCommandOption {
20
+ kind: ReflectionKind.number;
21
+ default?: number;
22
+ variadic: boolean;
23
+ }
24
+ interface BooleanCommandOption extends BaseCommandOption {
25
+ kind: ReflectionKind.boolean;
26
+ default?: boolean;
27
+ isNegativeOf?: string;
28
+ skipAddingNegative?: boolean;
29
+ }
30
+ type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
31
+ interface CommandParam {
32
+ name: string;
33
+ description?: string;
34
+ default?: string;
35
+ optional: boolean;
36
+ variadic: boolean;
37
+ }
38
+ interface CommandBase {
39
+ id: string | null;
40
+ name: string;
41
+ title?: string;
42
+ description?: string;
43
+ path: string[];
44
+ isVirtual: boolean;
45
+ }
46
+ interface CommandInput extends CommandBase {
47
+ id: string;
48
+ entry: ResolvedEntryTypeDefinition;
49
+ }
50
+ type CommandTree = CommandInput & {
51
+ title: string;
52
+ description: string;
53
+ options: Record<string, CommandOption>;
54
+ params: CommandParam[];
55
+ parent: null | CommandTree;
56
+ children: Record<string, CommandTree>;
57
+ };
58
+ type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
59
+ parent: null | string;
60
+ children: Record<string, SerializedCommandTree>;
61
+ };
62
+ //#endregion
63
+ export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption };
@@ -0,0 +1,63 @@
1
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
2
+ import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
3
+
4
+ //#region src/types/command.d.ts
5
+ interface BaseCommandOption {
6
+ name: string;
7
+ kind: ReflectionKind;
8
+ title: string;
9
+ description?: string;
10
+ alias: string[];
11
+ optional: boolean;
12
+ }
13
+ interface StringCommandOption extends BaseCommandOption {
14
+ kind: ReflectionKind.string;
15
+ format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
16
+ default?: string;
17
+ variadic: boolean;
18
+ }
19
+ interface NumberCommandOption extends BaseCommandOption {
20
+ kind: ReflectionKind.number;
21
+ default?: number;
22
+ variadic: boolean;
23
+ }
24
+ interface BooleanCommandOption extends BaseCommandOption {
25
+ kind: ReflectionKind.boolean;
26
+ default?: boolean;
27
+ isNegativeOf?: string;
28
+ skipAddingNegative?: boolean;
29
+ }
30
+ type CommandOption = StringCommandOption | NumberCommandOption | BooleanCommandOption;
31
+ interface CommandParam {
32
+ name: string;
33
+ description?: string;
34
+ default?: string;
35
+ optional: boolean;
36
+ variadic: boolean;
37
+ }
38
+ interface CommandBase {
39
+ id: string | null;
40
+ name: string;
41
+ title?: string;
42
+ description?: string;
43
+ path: string[];
44
+ isVirtual: boolean;
45
+ }
46
+ interface CommandInput extends CommandBase {
47
+ id: string;
48
+ entry: ResolvedEntryTypeDefinition;
49
+ }
50
+ type CommandTree = CommandInput & {
51
+ title: string;
52
+ description: string;
53
+ options: Record<string, CommandOption>;
54
+ params: CommandParam[];
55
+ parent: null | CommandTree;
56
+ children: Record<string, CommandTree>;
57
+ };
58
+ type SerializedCommandTree = Omit<CommandTree, "parent" | "children"> & {
59
+ parent: null | string;
60
+ children: Record<string, SerializedCommandTree>;
61
+ };
62
+ //#endregion
63
+ export { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption };
@@ -1,3 +1,5 @@
1
+ import { CommandBase, CommandOption } from "./command.cjs";
2
+ import { Context } from "./context.cjs";
1
3
  import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
2
4
 
3
5
  //#region src/types/config.d.ts
@@ -15,20 +17,16 @@ interface Options {
15
17
  */
16
18
  interactive?: boolean | "never";
17
19
  /**
18
- * Whether to skip adding the default arguments to commands.
20
+ * A set of default command options to apply to each command.
19
21
  *
20
22
  * @remarks
21
23
  * By default, Shell Shock adds the following set of default arguments to each command:
22
24
  * - `--help` (`-h`, `-?`): Show help information.
23
25
  * - `--version` (`-v`): Show the version of the application.
24
- * - `--interactive` (`-i`, `--interact`): Enable interactive mode.
25
- * - `--no-interactive`: Disable interactive mode.
26
- * - `--no-banner`: Hide the banner displayed while running the CLI application.
27
- * - `--verbose`: Enable verbose output.
28
26
  *
29
- * @defaultValue `false`
27
+ * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
30
28
  */
31
- skipDefaultArgs?: boolean;
29
+ defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
32
30
  /**
33
31
  * The name(s) of the binary that will be generated to run the CLI
34
32
  */
@@ -1,3 +1,5 @@
1
+ import { CommandBase, CommandOption } from "./command.mjs";
2
+ import { Context } from "./context.mjs";
1
3
  import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
2
4
 
3
5
  //#region src/types/config.d.ts
@@ -15,20 +17,16 @@ interface Options {
15
17
  */
16
18
  interactive?: boolean | "never";
17
19
  /**
18
- * Whether to skip adding the default arguments to commands.
20
+ * A set of default command options to apply to each command.
19
21
  *
20
22
  * @remarks
21
23
  * By default, Shell Shock adds the following set of default arguments to each command:
22
24
  * - `--help` (`-h`, `-?`): Show help information.
23
25
  * - `--version` (`-v`): Show the version of the application.
24
- * - `--interactive` (`-i`, `--interact`): Enable interactive mode.
25
- * - `--no-interactive`: Disable interactive mode.
26
- * - `--no-banner`: Hide the banner displayed while running the CLI application.
27
- * - `--verbose`: Enable verbose output.
28
26
  *
29
- * @defaultValue `false`
27
+ * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
30
28
  */
31
- skipDefaultArgs?: boolean;
29
+ defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
32
30
  /**
33
31
  * The name(s) of the binary that will be generated to run the CLI
34
32
  */
File without changes
@@ -0,0 +1,25 @@
1
+ import { CommandInput, CommandOption, CommandTree } from "./command.cjs";
2
+ import { ResolvedConfig } from "./config.cjs";
3
+ import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
4
+
5
+ //#region src/types/context.d.ts
6
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
7
+ /**
8
+ * The root path where commands are located.
9
+ */
10
+ commandsPath: string;
11
+ /**
12
+ * The default command arguments to apply to all application commands.
13
+ */
14
+ options: CommandOption[];
15
+ /**
16
+ * The list of commands discovered in the project.
17
+ */
18
+ inputs: CommandInput[];
19
+ /**
20
+ * The command-line application structure.
21
+ */
22
+ commands: Record<string, CommandTree>;
23
+ };
24
+ //#endregion
25
+ export { Context };
@@ -0,0 +1,25 @@
1
+ import { CommandInput, CommandOption, CommandTree } from "./command.mjs";
2
+ import { ResolvedConfig } from "./config.mjs";
3
+ import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
4
+
5
+ //#region src/types/context.d.ts
6
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
7
+ /**
8
+ * The root path where commands are located.
9
+ */
10
+ commandsPath: string;
11
+ /**
12
+ * The default command arguments to apply to all application commands.
13
+ */
14
+ options: CommandOption[];
15
+ /**
16
+ * The list of commands discovered in the project.
17
+ */
18
+ inputs: CommandInput[];
19
+ /**
20
+ * The command-line application structure.
21
+ */
22
+ commands: Record<string, CommandTree>;
23
+ };
24
+ //#endregion
25
+ export { Context };
@@ -0,0 +1 @@
1
+ export{};
@@ -1,3 +1,5 @@
1
+ import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./command.cjs";
2
+ import { Context } from "./context.cjs";
1
3
  import { Options, ResolvedConfig, UserConfig } from "./config.cjs";
2
- import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./build.cjs";
3
- export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, UserConfig };
4
+ import { BaseCommandOptions } from "./options.cjs";
5
+ export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, StringCommandOption, UserConfig };
@@ -1,3 +1,5 @@
1
+ import { BaseCommandOption, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, NumberCommandOption, SerializedCommandTree, StringCommandOption } from "./command.mjs";
2
+ import { Context } from "./context.mjs";
1
3
  import { Options, ResolvedConfig, UserConfig } from "./config.mjs";
2
- import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./build.mjs";
3
- export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, UserConfig };
4
+ import { BaseCommandOptions } from "./options.mjs";
5
+ export { BaseCommandOption, BaseCommandOptions, BooleanCommandOption, CommandBase, CommandInput, CommandOption, CommandParam, CommandTree, Context, NumberCommandOption, Options, ResolvedConfig, SerializedCommandTree, StringCommandOption, UserConfig };
File without changes
@@ -0,0 +1,7 @@
1
+ //#region src/types/options.d.ts
2
+ interface BaseCommandOptions {
3
+ help: boolean;
4
+ version: boolean;
5
+ }
6
+ //#endregion
7
+ export { BaseCommandOptions };
@@ -0,0 +1,7 @@
1
+ //#region src/types/options.d.ts
2
+ interface BaseCommandOptions {
3
+ help: boolean;
4
+ version: boolean;
5
+ }
6
+ //#endregion
7
+ export { BaseCommandOptions };
@@ -0,0 +1 @@
1
+ export{};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@shell-shock/core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
- "description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
5
+ "description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
6
6
  "repository": {
7
7
  "type": "github",
8
8
  "url": "https://github.com/storm-software/shell-shock.git",
@@ -136,8 +136,9 @@
136
136
  "files": ["dist/**/*"],
137
137
  "keywords": ["shell-shock", "powerlines", "storm-software"],
138
138
  "dependencies": {
139
- "@powerlines/plugin-plugin": "^0.12.36",
140
- "@powerlines/plugin-tsdown": "^0.1.36",
139
+ "@powerlines/deepkit": "^0.5.10",
140
+ "@powerlines/plugin-plugin": "^0.12.47",
141
+ "@powerlines/plugin-tsdown": "^0.1.47",
141
142
  "@stryke/convert": "^0.6.29",
142
143
  "@stryke/helpers": "^0.9.31",
143
144
  "@stryke/json": "^0.9.32",
@@ -145,9 +146,11 @@
145
146
  "@stryke/string-format": "^0.12.29",
146
147
  "@stryke/type-checks": "^0.5.14",
147
148
  "defu": "^6.1.4",
148
- "powerlines": "^0.34.2"
149
+ "powerlines": "^0.36.0",
150
+ "@stryke/capnp": "^0.12.51",
151
+ "@stryke/fs": "^0.33.26"
149
152
  },
150
153
  "devDependencies": { "@types/node": "^24.10.4", "typescript": "^5.9.3" },
151
154
  "publishConfig": { "access": "public" },
152
- "gitHead": "b81e1096d70d05cb3c5947f8ac5a926964a7af27"
155
+ "gitHead": "e7794a7d008c5d32b5a999b62421281d370166cd"
153
156
  }
@@ -1,66 +0,0 @@
1
- import { ResolvedConfig } from "./config.cjs";
2
- import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
3
- import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
4
-
5
- //#region src/types/build.d.ts
6
- type CommandArg = {
7
- name: string;
8
- title: string;
9
- description?: string;
10
- alias: string[];
11
- optional: boolean;
12
- } & (({
13
- type: "string";
14
- format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
15
- } & ({
16
- variadic: false;
17
- default?: string;
18
- } | {
19
- variadic: true;
20
- default?: string[];
21
- })) | ({
22
- type: "number";
23
- } & ({
24
- variadic: false;
25
- default?: number;
26
- } | {
27
- variadic: true;
28
- default?: number[];
29
- })) | {
30
- type: "boolean";
31
- default?: boolean;
32
- isNegativeOf?: string;
33
- });
34
- interface CommandEntry {
35
- path: string[];
36
- name: string;
37
- title: string;
38
- description?: string;
39
- isVirtual: boolean;
40
- entry: ResolvedEntryTypeDefinition;
41
- }
42
- type CommandTree = CommandEntry & {
43
- args: CommandArg[];
44
- parent: null | CommandTree;
45
- children: Record<string, CommandTree>;
46
- };
47
- interface CommandRelations {
48
- parent: string | null;
49
- children: string[];
50
- }
51
- type BuildContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
52
- /**
53
- * The root path where commands are located.
54
- */
55
- commandsRoot: string;
56
- /**
57
- * The list of commands discovered in the project.
58
- */
59
- commands: CommandEntry[];
60
- /**
61
- * The command hierarchy tree.
62
- */
63
- tree: CommandTree;
64
- };
65
- //#endregion
66
- export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree };
@@ -1,66 +0,0 @@
1
- import { ResolvedConfig } from "./config.mjs";
2
- import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
3
- import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
4
-
5
- //#region src/types/build.d.ts
6
- type CommandArg = {
7
- name: string;
8
- title: string;
9
- description?: string;
10
- alias: string[];
11
- optional: boolean;
12
- } & (({
13
- type: "string";
14
- format?: "path" | "url" | "date" | "time" | "datetime" | "json" | "regex" | string;
15
- } & ({
16
- variadic: false;
17
- default?: string;
18
- } | {
19
- variadic: true;
20
- default?: string[];
21
- })) | ({
22
- type: "number";
23
- } & ({
24
- variadic: false;
25
- default?: number;
26
- } | {
27
- variadic: true;
28
- default?: number[];
29
- })) | {
30
- type: "boolean";
31
- default?: boolean;
32
- isNegativeOf?: string;
33
- });
34
- interface CommandEntry {
35
- path: string[];
36
- name: string;
37
- title: string;
38
- description?: string;
39
- isVirtual: boolean;
40
- entry: ResolvedEntryTypeDefinition;
41
- }
42
- type CommandTree = CommandEntry & {
43
- args: CommandArg[];
44
- parent: null | CommandTree;
45
- children: Record<string, CommandTree>;
46
- };
47
- interface CommandRelations {
48
- parent: string | null;
49
- children: string[];
50
- }
51
- type BuildContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
52
- /**
53
- * The root path where commands are located.
54
- */
55
- commandsRoot: string;
56
- /**
57
- * The list of commands discovered in the project.
58
- */
59
- commands: CommandEntry[];
60
- /**
61
- * The command hierarchy tree.
62
- */
63
- tree: CommandTree;
64
- };
65
- //#endregion
66
- export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree };
File without changes
File without changes