@shell-shock/core 0.17.2 → 0.17.3

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 (129) hide show
  1. package/dist/api.cjs +5 -4
  2. package/dist/api.mjs +4 -2
  3. package/dist/api.mjs.map +1 -1
  4. package/dist/components/command-validation-logic.cjs +44 -11
  5. package/dist/components/command-validation-logic.mjs +44 -10
  6. package/dist/components/command-validation-logic.mjs.map +1 -1
  7. package/dist/components/docs.cjs +1 -2
  8. package/dist/components/exec-builtin.cjs +1 -2
  9. package/dist/components/helpers.cjs +1 -2
  10. package/dist/components/options-parser-logic.cjs +1 -2
  11. package/dist/components/state-builtin.cjs +1 -2
  12. package/dist/components/state-builtin.mjs +1 -1
  13. package/dist/components/usage.cjs +1 -2
  14. package/dist/components/utils-builtin.cjs +1 -7
  15. package/dist/components/utils-builtin.mjs +0 -5
  16. package/dist/components/utils-builtin.mjs.map +1 -1
  17. package/dist/config.cjs +3 -3
  18. package/dist/config.mjs +2 -1
  19. package/dist/contexts/command.cjs +6 -3
  20. package/dist/contexts/command.mjs +5 -1
  21. package/dist/contexts/command.mjs.map +1 -1
  22. package/dist/contexts/options.cjs +6 -3
  23. package/dist/contexts/options.mjs +5 -1
  24. package/dist/contexts/options.mjs.map +1 -1
  25. package/dist/helpers/automd.cjs +1 -2
  26. package/dist/helpers/docs-helpers.cjs +3 -3
  27. package/dist/helpers/docs-helpers.mjs +2 -1
  28. package/dist/helpers/docs-helpers.mjs.map +1 -1
  29. package/dist/helpers/paths.cjs +3 -3
  30. package/dist/helpers/paths.mjs +2 -1
  31. package/dist/helpers/paths.mjs.map +1 -1
  32. package/dist/helpers/persistence.cjs +7 -5
  33. package/dist/helpers/persistence.mjs +6 -3
  34. package/dist/helpers/persistence.mjs.map +1 -1
  35. package/dist/helpers/update-package-json.cjs +1 -2
  36. package/dist/helpers/utilities.cjs +3 -3
  37. package/dist/helpers/utilities.mjs +2 -1
  38. package/dist/helpers/utilities.mjs.map +1 -1
  39. package/dist/helpers/validations.cjs +1 -2
  40. package/dist/plugin-utils/context-helpers.cjs +21 -12
  41. package/dist/plugin-utils/context-helpers.mjs +20 -10
  42. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  43. package/dist/plugin-utils/deepkit.cjs +5 -6
  44. package/dist/plugin-utils/deepkit.mjs +5 -5
  45. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  46. package/dist/plugin-utils/description-helpers.cjs +14 -8
  47. package/dist/plugin-utils/description-helpers.mjs +13 -6
  48. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  49. package/dist/plugin-utils/get-command-tree.cjs +5 -4
  50. package/dist/plugin-utils/get-command-tree.mjs +4 -2
  51. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  52. package/dist/plugin-utils/reflect.cjs +3 -3
  53. package/dist/plugin-utils/reflect.mjs +2 -1
  54. package/dist/plugin-utils/traverse-command-tree.cjs +5 -4
  55. package/dist/plugin-utils/traverse-command-tree.mjs +4 -2
  56. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  57. package/dist/plugin-utils/type-checks.cjs +11 -7
  58. package/dist/plugin-utils/type-checks.mjs +10 -5
  59. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  60. package/dist/plugin.cjs +5 -5
  61. package/dist/plugin.mjs +5 -4
  62. package/dist/plugin.mjs.map +1 -1
  63. package/dist/resolver/deepkit.cjs +4 -9
  64. package/dist/resolver/deepkit.mjs +4 -8
  65. package/dist/resolver/deepkit.mjs.map +1 -1
  66. package/dist/resolver/helpers.cjs +5 -4
  67. package/dist/resolver/helpers.mjs +4 -2
  68. package/dist/resolver/helpers.mjs.map +1 -1
  69. package/dist/resolver/module.cjs +1 -2
  70. package/dist/resolver/resolve.cjs +8 -5
  71. package/dist/resolver/resolve.mjs +7 -3
  72. package/dist/resolver/resolve.mjs.map +1 -1
  73. package/dist/types/command.cjs +65 -12
  74. package/dist/types/command.d.cts +9 -1
  75. package/dist/types/command.d.cts.map +1 -1
  76. package/dist/types/command.d.mts +9 -1
  77. package/dist/types/command.d.mts.map +1 -1
  78. package/dist/types/command.mjs +64 -10
  79. package/dist/types/command.mjs.map +1 -1
  80. package/dist/types/config.cjs +19 -7
  81. package/dist/types/config.mjs +18 -5
  82. package/dist/types/config.mjs.map +1 -1
  83. package/dist/types/context.cjs +6 -3
  84. package/dist/types/context.mjs +5 -1
  85. package/dist/types/env.cjs +8 -3
  86. package/dist/types/env.d.cts +3 -1
  87. package/dist/types/env.d.cts.map +1 -1
  88. package/dist/types/env.d.mts +3 -1
  89. package/dist/types/env.d.mts.map +1 -1
  90. package/dist/types/env.mjs +7 -1
  91. package/dist/types/env.mjs.map +1 -1
  92. package/dist/types/options.cjs +1 -2
  93. package/package.json +10 -10
  94. package/dist/api.cjs.map +0 -1
  95. package/dist/components/command-validation-logic.cjs.map +0 -1
  96. package/dist/components/docs.cjs.map +0 -1
  97. package/dist/components/exec-builtin.cjs.map +0 -1
  98. package/dist/components/helpers.cjs.map +0 -1
  99. package/dist/components/options-parser-logic.cjs.map +0 -1
  100. package/dist/components/state-builtin.cjs.map +0 -1
  101. package/dist/components/usage.cjs.map +0 -1
  102. package/dist/components/utils-builtin.cjs.map +0 -1
  103. package/dist/config.cjs.map +0 -1
  104. package/dist/contexts/command.cjs.map +0 -1
  105. package/dist/contexts/options.cjs.map +0 -1
  106. package/dist/helpers/automd.cjs.map +0 -1
  107. package/dist/helpers/docs-helpers.cjs.map +0 -1
  108. package/dist/helpers/paths.cjs.map +0 -1
  109. package/dist/helpers/persistence.cjs.map +0 -1
  110. package/dist/helpers/update-package-json.cjs.map +0 -1
  111. package/dist/helpers/utilities.cjs.map +0 -1
  112. package/dist/helpers/validations.cjs.map +0 -1
  113. package/dist/plugin-utils/context-helpers.cjs.map +0 -1
  114. package/dist/plugin-utils/deepkit.cjs.map +0 -1
  115. package/dist/plugin-utils/description-helpers.cjs.map +0 -1
  116. package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
  117. package/dist/plugin-utils/reflect.cjs.map +0 -1
  118. package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
  119. package/dist/plugin-utils/type-checks.cjs.map +0 -1
  120. package/dist/plugin.cjs.map +0 -1
  121. package/dist/resolver/deepkit.cjs.map +0 -1
  122. package/dist/resolver/helpers.cjs.map +0 -1
  123. package/dist/resolver/module.cjs.map +0 -1
  124. package/dist/resolver/resolve.cjs.map +0 -1
  125. package/dist/types/command.cjs.map +0 -1
  126. package/dist/types/config.cjs.map +0 -1
  127. package/dist/types/context.cjs.map +0 -1
  128. package/dist/types/env.cjs.map +0 -1
  129. package/dist/types/options.cjs.map +0 -1
@@ -2,9 +2,11 @@
2
2
  const __ΩFormatDescriptionOptions = [
3
3
  "replaceNewlines",
4
4
  true,
5
+ "If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.",
5
6
  "collapseWhitespace",
7
+ "If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.",
6
8
  "FormatDescriptionOptions",
7
- "P)4!8>\")4#8>\"Mw$y"
9
+ "P)4!8>\"?#)4$8>\"?%Mw&y"
8
10
  ];
9
11
  /**
10
12
  * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
@@ -27,7 +29,8 @@ formatDescriptionWhitespace.__type = [
27
29
  "options",
28
30
  () => ({}),
29
31
  "formatDescriptionWhitespace",
30
- "P&2!n\"2#>$&/%"
32
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
33
+ "P&2!n\"2#>$&/%?&"
31
34
  ];
32
35
  /**
33
36
  * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
@@ -44,7 +47,8 @@ function formatDescriptionEscapes(description) {
44
47
  formatDescriptionEscapes.__type = [
45
48
  "description",
46
49
  "formatDescriptionEscapes",
47
- "P&2!&/\""
50
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
51
+ "P&2!&/\"?#"
48
52
  ];
49
53
  /**
50
54
  * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
@@ -64,14 +68,16 @@ formatDescription.__type = [
64
68
  "options",
65
69
  () => ({}),
66
70
  "formatDescription",
67
- "P&2!n\"2#>$&/%"
71
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
72
+ "P&2!n\"2#>$&/%?&"
68
73
  ];
69
74
  const __ΩFormatShortDescriptionOptions = [
70
75
  () => __ΩFormatDescriptionOptions,
71
76
  "length",
72
77
  62,
78
+ "The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.",
73
79
  "FormatShortDescriptionOptions",
74
- "Pn!'4\"8>#Mw$y"
80
+ "Pn!'4\"8>#?$Mw%y"
75
81
  ];
76
82
  /**
77
83
  * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
@@ -93,7 +99,8 @@ formatShortDescription.__type = [
93
99
  "options",
94
100
  () => ({}),
95
101
  "formatShortDescription",
96
- "P&2!n\"2#>$&/%"
102
+ "Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.",
103
+ "P&2!n\"2#>$&/%?&"
97
104
  ];
98
105
 
99
106
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,SAAG,4BAAA,aAAA,UAAA,EAAA,EAAA;CACC,IAAE,uBAAa,YAAA,MAAA;AACf,KAAA,QAAA,gBACF,wBAA4B,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAAsB,SAAc;CAAA;OAAiB;CAAgC;QAAqB,EAAE;CAAC;CAAa;CAAA;;;;;;;;;;AAU1H,SAAM,yBAAyB,aAAA;AAC3B,QAAA,YACF,WAAA,KAAA,MAAA,CACI,WAAQ,MAAA,OAAA,CACV,WAAA,KAAqB,MAAE,CACzB,QAAA,SAAA,OAAA;;AAEF,yBAAS,SAAyB;CAAC;CAAC;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAU,aAAkB,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAS,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;AACT,MAAK,mCAAqB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAI,uBAAA,aAAA,UAAA,EAAA,EAAA;CACD,MAAO,SAAQ,QAAI,UAAc;CACnC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CASG,IAAA,WARwB,qBAAuB,QAAA,KAAA,GAAA,SAAA,KAC/C,qBAAsB,OAAA,eAAkB,GAAA,SAAA,IAC1C,qBACK,MAAS,kBAAiB,GAAA,IACnB,MAAC,EACJ,MAAA,GAAA,GAAA,EACD,MAAA,GACD,WACuB,sBAAoB,MAAA;AACjD,KAAA,OAAA,MAAA,CAAA,SAAA,OACH,UAAA,GAAA,OAAA,UAAA,GAAA,KAAA,IAAA,GAAA,SAAA,EAAA,CAAA,CAAA,MAAA,CAAA;AAEA,QAAO,yBAAU,OAAA;;AAEjB,uBAAuB,SAAQ;CAAA;OAAsB;CAAgC;QAAmB,EAAA;CAAA;CAAS;CAAA"}
1
+ {"version":3,"file":"description-helpers.mjs","names":[],"sources":["../../src/plugin-utils/description-helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface FormatDescriptionOptions {\n /**\n * If true, replaces newlines in the description with spaces. This is useful for ensuring that descriptions are displayed as a single line in contexts where multiline descriptions may not be supported or may cause formatting issues.\n *\n * @defaultValue false\n */\n replaceNewlines?: boolean;\n\n /**\n * If true, collapses multiple consecutive spaces in the description into a single space. This helps to ensure that descriptions are concise and do not contain unnecessary whitespace.\n *\n * @defaultValue false\n */\n collapseWhitespace?: boolean;\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionWhitespace(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n let formattedDescription = description.trim();\n if (options.replaceNewlines) {\n formattedDescription = formattedDescription.replace(/\\s*\\n\\s*/g, \" \");\n }\n if (options.collapseWhitespace) {\n formattedDescription = formattedDescription.replace(/\\s{2,}/g, \" \");\n }\n\n return formattedDescription.trim();\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nfunction formatDescriptionEscapes(description: string): string {\n return description\n .replaceAll(\"'\", \"\\\\'\")\n .replaceAll('\"', '\\\\\"')\n .replaceAll(\"`\", \"\\\\`\")\n .replace(/\\$\\{/g, \"\\\\${\");\n}\n\n/**\n * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.\n *\n * @remarks\n * This is useful for ensuring that descriptions are concise and well-formatted when displayed in the CLI or documentation.\n *\n * @param description - The full description string.\n * @returns The formatted description string.\n */\nexport function formatDescription(\n description: string,\n options: FormatDescriptionOptions = {}\n): string {\n return formatDescriptionEscapes(\n formatDescriptionWhitespace(description, options)\n );\n}\n\nexport interface FormatShortDescriptionOptions extends FormatDescriptionOptions {\n /**\n * The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.\n *\n * @defaultValue 62\n */\n length?: number;\n}\n\n/**\n * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.\n *\n * @param description - The full description string.\n * @param options - Options for formatting the short description, including the maximum length.\n * @returns The extracted short description.\n */\nexport function formatShortDescription(\n description: string,\n options: FormatShortDescriptionOptions = {}\n): string {\n const length = options.length ?? 62;\n const formattedDescription = formatDescriptionWhitespace(\n description,\n options\n );\n\n const firstSentenceMatch =\n formattedDescription.indexOf(\"\\n\") < length - 3 ||\n formattedDescription.search(/[.!?\\n]\\s*\\S/) > length - 3\n ? formattedDescription\n .match(/^.*[.!?\\n]\\s?\\S/)?.[0]\n ?.trim()\n ?.slice(0, -1)\n ?.trim()\n : undefined;\n\n let result = (firstSentenceMatch || formattedDescription).trim();\n if (result.trim().length > length) {\n result = `${result.substring(0, Math.max(0, length - 3)).trim()}...`;\n }\n\n return formatDescriptionEscapes(result);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,SAAG,4BAAA,aAAA,UAAA,EAAA,EAAA;CACC,IAAE,uBAAa,YAAA,MAAA;AACf,KAAA,QAAA,gBACF,wBAA4B,qBAAA,QAAA,aAAA,IAAA;gCAG5B,wBAAA,qBAAA,QAAA,WAAA,IAAA;AAED,QAAA,qBAAA,MAAA;;AAED,4BAAsB,SAAc;CAAA;OAAiB;CAAgC;QAAqB,EAAE;CAAC;CAAa;CAAA;CAAA;;;;;;;;;;AAU1H,SAAM,yBAAyB,aAAA;AAC3B,QAAA,YACF,WAAA,KAAA,MAAA,CACI,WAAQ,MAAA,OAAA,CACV,WAAA,KAAqB,MAAE,CACzB,QAAA,SAAA,OAAA;;AAEF,yBAAS,SAAyB;CAAC;CAAC;CAAA;CAAA;CAAA;;;;;;;;;;AAUpC,SAAgB,kBAAU,aAAkB,UAAA,EAAA,EAAA;AAC1C,QAAA,yBAAA,4BAAA,aAAA,QAAA,CAAA;;AAEF,kBAAS,SAAA;CAAA;OAAA;CAAA;QAAA,EAAA;CAAA;CAAA;CAAA;CAAA;AACT,MAAK,mCAAqB;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAS1B,SAAI,uBAAA,aAAA,UAAA,EAAA,EAAA;CACD,MAAO,SAAQ,QAAI,UAAc;CACnC,MAAA,uBAAA,4BAAA,aAAA,QAAA;CASG,IAAA,WARwB,qBAAuB,QAAA,KAAA,GAAA,SAAA,KAC/C,qBAAsB,OAAA,eAAkB,GAAA,SAAA,IAC1C,qBACK,MAAS,kBAAiB,GAAA,IACnB,MAAC,EACJ,MAAA,GAAA,GAAA,EACD,MAAA,GACD,WACuB,sBAAoB,MAAA;AACjD,KAAA,OAAA,MAAA,CAAA,SAAA,OACH,UAAA,GAAA,OAAA,UAAA,GAAA,KAAA,IAAA,GAAA,SAAA,EAAA,CAAA,CAAA,MAAA,CAAA;AAEA,QAAO,yBAAU,OAAA;;AAEjB,uBAAuB,SAAQ;CAAA;OAAsB;CAAgC;QAAmB,EAAA;CAAA;CAAS;CAAA;CAAA"}
@@ -33,7 +33,8 @@ getCommandTree.__type = [
33
33
  "path",
34
34
  "CommandTree",
35
35
  "getCommandTree",
36
- "P\"w!2\"\"2#P\"w$,J/%"
36
+ "Retrieves a specific command tree based on the provided path.",
37
+ "P\"w!2\"\"2#P\"w$,J/%?&"
37
38
  ];
38
39
  /**
39
40
  * Retrieves a list of all command trees defined in the context.
@@ -57,10 +58,10 @@ getCommandList.__type = [
57
58
  "context",
58
59
  "CommandTree",
59
60
  "getCommandList",
60
- "P\"w!2\"\"w#F`/$"
61
+ "Retrieves a list of all command trees defined in the context.",
62
+ "P\"w!2\"\"w#F`/$?%"
61
63
  ];
62
64
 
63
65
  //#endregion
64
66
  exports.getCommandList = getCommandList;
65
- exports.getCommandTree = getCommandTree;
66
- //# sourceMappingURL=get-command-tree.cjs.map
67
+ exports.getCommandTree = getCommandTree;
@@ -33,7 +33,8 @@ getCommandTree.__type = [
33
33
  "path",
34
34
  "CommandTree",
35
35
  "getCommandTree",
36
- "P\"w!2\"\"2#P\"w$,J/%"
36
+ "Retrieves a specific command tree based on the provided path.",
37
+ "P\"w!2\"\"2#P\"w$,J/%?&"
37
38
  ];
38
39
  /**
39
40
  * Retrieves a list of all command trees defined in the context.
@@ -57,7 +58,8 @@ getCommandList.__type = [
57
58
  "context",
58
59
  "CommandTree",
59
60
  "getCommandList",
60
- "P\"w!2\"\"w#F`/$"
61
+ "Retrieves a list of all command trees defined in the context.",
62
+ "P\"w!2\"\"w#F`/$?%"
61
63
  ];
62
64
 
63
65
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;AAYV,KAAK,KAAO,WAAW;;AAIxB,KAAO,KAAM,SAAC,GAAW;EAClB,MAAO,WAAU,KACf,MAAA,EAAA,CACA,OAAA,cAAwB,YAAW,CAAC,qBAAa,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAExD,KAAA,aAAA,YACa,OAAQ,UAAS,eAAc,KAAI,YAAa,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAIrB,QAAS;;AAEX,eAAW,SAAa;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOzB,eAAc,eAAA,SAAA;CACV,MAAG,cAAiB,EAAE;AACtB,OAAK,iBAAiB,SAAU,cAAA,gBAAA;AAC5B,cAAC,KAAA,YAAA;IACF;EAAC;EAAa;EAAA;EAAU,CAAA,CAAA;AAC3B,QAAI;;AAER,eAAQ,SAAc;CAAA;CAAY;CAAS;CAAgB;CAAA;CAAA"}
1
+ {"version":3,"file":"get-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/get-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { isDynamicPathSegment } from \"./context-helpers\";\nimport { traverseCommands } from \"./traverse-command-tree\";\n\n/**\n * Retrieves a specific command tree based on the provided path.\n *\n * @param context - The build context containing the command definitions.\n * @param path - An array of strings representing the command path.\n * @returns The command tree at the specified path, or null if not found.\n */\nexport function getCommandTree(\n context: Context,\n path = [] as string[]\n): CommandTree | null {\n if (path.length === 0) {\n return null;\n }\n\n let currentTree: CommandTree | null = context.commands[path[0]!] ?? null;\n if (path.length > 1) {\n const segments = path\n .slice(1)\n .filter(segment => !isDynamicPathSegment(segment));\n for (const segment of segments) {\n if (\n currentTree?.children &&\n Object.prototype.hasOwnProperty.call(currentTree.children, segment)\n ) {\n currentTree = currentTree.children[segment] ?? null;\n } else {\n return null;\n }\n }\n }\n\n return currentTree;\n}\n\n/**\n * Retrieves a list of all command trees defined in the context.\n *\n * @param context - The build context containing the command definitions.\n * @returns A promise that resolves to an array of all command trees in the context.\n */\nexport async function getCommandList(context: Context): Promise<CommandTree[]> {\n const commandList: CommandTree[] = [];\n await traverseCommands(context, commandTree => {\n commandList.push(commandTree);\n });\n\n return commandList;\n}\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;;;AAYV,KAAK,KAAO,WAAW;;AAIxB,KAAO,KAAM,SAAC,GAAW;EAClB,MAAO,WAAU,KACf,MAAA,EAAA,CACA,OAAA,cAAwB,YAAW,CAAC,qBAAa,QAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;iCAExD,KAAA,aAAA,YACa,OAAQ,UAAS,eAAc,KAAI,YAAa,UAAA,QAAA,CAC9D,eAAA,YAAA,SAAA,YAAA;MAGe,QAAO;;AAIrB,QAAS;;AAEX,eAAW,SAAa;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOzB,eAAc,eAAA,SAAA;CACV,MAAG,cAAiB,EAAE;AACtB,OAAK,iBAAiB,SAAU,cAAA,gBAAA;AAC5B,cAAC,KAAA,YAAA;IACF;EAAC;EAAa;EAAA;EAAU,CAAA,CAAA;AAC3B,QAAI;;AAER,eAAQ,SAAc;CAAA;CAAY;CAAS;CAAgB;CAAA;CAAA;CAAA"}
@@ -44,9 +44,9 @@ sortOptions.__type = [
44
44
  "CommandOption",
45
45
  "options",
46
46
  "sortOptions",
47
- "P\"w!F2\"\"w!F/#"
47
+ "Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
48
+ "P\"w!F2\"\"w!F/#?$"
48
49
  ];
49
50
 
50
51
  //#endregion
51
- exports.sortOptions = sortOptions;
52
- //# sourceMappingURL=reflect.cjs.map
52
+ exports.sortOptions = sortOptions;
@@ -44,7 +44,8 @@ sortOptions.__type = [
44
44
  "CommandOption",
45
45
  "options",
46
46
  "sortOptions",
47
- "P\"w!F2\"\"w!F/#"
47
+ "Sort command options alphabetically by name, placing boolean options with negatives appropriately.",
48
+ "P\"w!F2\"\"w!F/#?$"
48
49
  ];
49
50
 
50
51
  //#endregion
@@ -28,7 +28,8 @@ traverseCommandTree.__type = [
28
28
  "",
29
29
  "visitor",
30
30
  "traverseCommandTree",
31
- "P\"w!2\"P\"w!2#!/$2%$`/&"
31
+ "Traverses a command tree and applies a visitor function to each node.",
32
+ "P\"w!2\"P\"w!2#!/$2%$`/&?'"
32
33
  ];
33
34
  /**
34
35
  * Traverses all commands in the context and applies a visitor function to each command tree.
@@ -54,10 +55,10 @@ traverseCommands.__type = [
54
55
  "",
55
56
  "visitor",
56
57
  "traverseCommands",
57
- "P\"2!P\"w\"2#!/$2%$`/&"
58
+ "Traverses all commands in the context and applies a visitor function to each command tree.",
59
+ "P\"2!P\"w\"2#!/$2%$`/&?'"
58
60
  ];
59
61
 
60
62
  //#endregion
61
63
  exports.traverseCommandTree = traverseCommandTree;
62
- exports.traverseCommands = traverseCommands;
63
- //# sourceMappingURL=traverse-command-tree.cjs.map
64
+ exports.traverseCommands = traverseCommands;
@@ -27,7 +27,8 @@ traverseCommandTree.__type = [
27
27
  "",
28
28
  "visitor",
29
29
  "traverseCommandTree",
30
- "P\"w!2\"P\"w!2#!/$2%$`/&"
30
+ "Traverses a command tree and applies a visitor function to each node.",
31
+ "P\"w!2\"P\"w!2#!/$2%$`/&?'"
31
32
  ];
32
33
  /**
33
34
  * Traverses all commands in the context and applies a visitor function to each command tree.
@@ -53,7 +54,8 @@ traverseCommands.__type = [
53
54
  "",
54
55
  "visitor",
55
56
  "traverseCommands",
56
- "P\"2!P\"w\"2#!/$2%$`/&"
57
+ "Traverses all commands in the context and applies a visitor function to each command tree.",
58
+ "P\"2!P\"w\"2#!/$2%$`/&?'"
57
59
  ];
58
60
 
59
61
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AAQX,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAoB,SACb;AAEP,OAAK,QAAQ,IAAA,OAAa,OAAS,YAAA,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAE5B,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGrD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACK;AAEL,OAAQ,QAAQ,IAAA,OAAW,OAAK,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAQ,QAAM,QAAA,QAAA,UAAA,CAAA;AACV,QAAA,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"traverse-command-tree.mjs","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AAQX,eAAsB,oBAAoB,aAAU,SAAS;AAC5D,KAAA,CAAA,YAAoB,SACb;AAEP,OAAK,QAAQ,IAAA,OAAa,OAAS,YAAA,SAAA,CAAA,IAAA,aAAA,OAAA,cAAA;;AAE5B,QAAM,oBAAoB,WAAW,QAAQ;;;;;;;AAGrD,oBAAc,SAAc;CAAA;CAAe;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOnD,eAAoB,iBAAY,SAAY,SAAa;AACvD,KAAA,CAAA,QAAA,SACK;AAEL,OAAQ,QAAQ,IAAA,OAAW,OAAK,QAAA,SAAiB,CAAA,IAAA,aAAA,OAAA,cAAA;AAChD,QAAQ,QAAM,QAAA,QAAA,UAAA,CAAA;AACV,QAAA,oBAAsB,WAAA,QAAA;IACzB;EAAA;EAAM;EAAA;EAAA,CAAA,CAAA,CAAA"}
@@ -21,7 +21,8 @@ function isCommandParameterKind(obj) {
21
21
  isCommandParameterKind.__type = [
22
22
  "obj",
23
23
  "isCommandParameterKind",
24
- "P\"2!!/\""
24
+ "Type guard to check if a value is a valid {@link CommandParameterKind} type.",
25
+ "P\"2!!/\"?#"
25
26
  ];
26
27
  /**
27
28
  * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
@@ -35,7 +36,8 @@ function isCommandParameterConfig(obj) {
35
36
  isCommandParameterConfig.__type = [
36
37
  "obj",
37
38
  "isCommandParameterConfig",
38
- "P\"2!!/\""
39
+ "Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
40
+ "P\"2!!/\"?#"
39
41
  ];
40
42
  /**
41
43
  * Type guard to check if a value is a valid {@link CommandParameter} type.
@@ -49,7 +51,8 @@ function isCommandParameter(obj) {
49
51
  isCommandParameter.__type = [
50
52
  "obj",
51
53
  "isCommandParameter",
52
- "P\"2!!/\""
54
+ "Type guard to check if a value is a valid {@link CommandParameter} type.",
55
+ "P\"2!!/\"?#"
53
56
  ];
54
57
  /**
55
58
  * Type guard to check if a value is a valid {@link CommandOption} type.
@@ -63,7 +66,8 @@ function isCommandOption(obj) {
63
66
  isCommandOption.__type = [
64
67
  "obj",
65
68
  "isCommandOption",
66
- "P\"2!!/\""
69
+ "Type guard to check if a value is a valid {@link CommandOption} type.",
70
+ "P\"2!!/\"?#"
67
71
  ];
68
72
  /**
69
73
  * Type guard to check if a value is a valid {@link CommandArgument} type.
@@ -77,7 +81,8 @@ function isCommandArgument(obj) {
77
81
  isCommandArgument.__type = [
78
82
  "obj",
79
83
  "isCommandArgument",
80
- "P\"2!!/\""
84
+ "Type guard to check if a value is a valid {@link CommandArgument} type.",
85
+ "P\"2!!/\"?#"
81
86
  ];
82
87
 
83
88
  //#endregion
@@ -85,5 +90,4 @@ exports.isCommandArgument = isCommandArgument;
85
90
  exports.isCommandOption = isCommandOption;
86
91
  exports.isCommandParameter = isCommandParameter;
87
92
  exports.isCommandParameterConfig = isCommandParameterConfig;
88
- exports.isCommandParameterKind = isCommandParameterKind;
89
- //# sourceMappingURL=type-checks.cjs.map
93
+ exports.isCommandParameterKind = isCommandParameterKind;
@@ -20,7 +20,8 @@ function isCommandParameterKind(obj) {
20
20
  isCommandParameterKind.__type = [
21
21
  "obj",
22
22
  "isCommandParameterKind",
23
- "P\"2!!/\""
23
+ "Type guard to check if a value is a valid {@link CommandParameterKind} type.",
24
+ "P\"2!!/\"?#"
24
25
  ];
25
26
  /**
26
27
  * Type guard to check if a value is a valid {@link CommandParameterConfig} type.
@@ -34,7 +35,8 @@ function isCommandParameterConfig(obj) {
34
35
  isCommandParameterConfig.__type = [
35
36
  "obj",
36
37
  "isCommandParameterConfig",
37
- "P\"2!!/\""
38
+ "Type guard to check if a value is a valid {@link CommandParameterConfig} type.",
39
+ "P\"2!!/\"?#"
38
40
  ];
39
41
  /**
40
42
  * Type guard to check if a value is a valid {@link CommandParameter} type.
@@ -48,7 +50,8 @@ function isCommandParameter(obj) {
48
50
  isCommandParameter.__type = [
49
51
  "obj",
50
52
  "isCommandParameter",
51
- "P\"2!!/\""
53
+ "Type guard to check if a value is a valid {@link CommandParameter} type.",
54
+ "P\"2!!/\"?#"
52
55
  ];
53
56
  /**
54
57
  * Type guard to check if a value is a valid {@link CommandOption} type.
@@ -62,7 +65,8 @@ function isCommandOption(obj) {
62
65
  isCommandOption.__type = [
63
66
  "obj",
64
67
  "isCommandOption",
65
- "P\"2!!/\""
68
+ "Type guard to check if a value is a valid {@link CommandOption} type.",
69
+ "P\"2!!/\"?#"
66
70
  ];
67
71
  /**
68
72
  * Type guard to check if a value is a valid {@link CommandArgument} type.
@@ -76,7 +80,8 @@ function isCommandArgument(obj) {
76
80
  isCommandArgument.__type = [
77
81
  "obj",
78
82
  "isCommandArgument",
79
- "P\"2!!/\""
83
+ "Type guard to check if a value is a valid {@link CommandArgument} type.",
84
+ "P\"2!!/\"?#"
80
85
  ];
81
86
 
82
87
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,uBAAS,KAAA;AACzB,QAAS,YAAA,IAAA;EAEP,sBAAA;EACM,sBAA0B;EACjC,sBAAA;EACQ,CAAC,SAAS,IAAC;;AAEpB,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,SAAM,yBAAsB,KAAA;AACxB,QAAE,YAAgB,IAAA,IAAA,UAAA,OAAoB,uBAAA,IAAA,KAAA;;AAE1C,yBAAA,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOA,SAAE,mBAAA,KAAA;AACF,QAAO,yBAAS,IAAwB,IACjC,UAAA,OACA,YAAG,IAAA,KAAA,IACF,WAAC,OACT,YAAA,IAAA,MAAA,4BAEE,YAAA,IAAA,YAAA,IACM,WAAS,OAChB,MAAA,QAAA,IAAA,MAAA,IACG,SAAY,QACZ,YAAgB,IAAI,IAAK,IAAI,IAAE,QAAQ,UACzC,cAAA,OACK,UAAS,IAAA,SAAA,IACR,cAAC,OACL,UAAA,IAAA,SAAyB;;AAE7B,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,gBAAE,KAAA;AACd,QAAC,yBAAgC,IAAI,IAAA,mBAAQ,IAAA,IAAA,aAAA;;AAEjD,gBAAc,SAAI;CAAQ;CAAG;CAAA;CAAA;;;;;;;AAO7B,SAAgB,kBAAkB,KAAK;AACtC,QAAA,yBAAA,IAAA,IAAA,mBAAA,IAAA;;AAED,kBAAiB,SAAO;CAAA;CAAW;CAAa;CAAe"}
1
+ {"version":3,"file":"type-checks.mjs","names":[],"sources":["../../src/plugin-utils/type-checks.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type {\n CommandArgument,\n CommandOption,\n CommandParameter,\n CommandParameterConfig,\n CommandParameterKind\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterKind} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterKind} type, false otherwise.\n */\nexport function isCommandParameterKind(obj: any): obj is CommandParameterKind {\n return (\n isSetString(obj) &&\n [\n CommandParameterKinds.string,\n CommandParameterKinds.number,\n CommandParameterKinds.boolean\n ].includes(obj as CommandParameterKind)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameterConfig} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameterConfig} type, false otherwise.\n */\nexport function isCommandParameterConfig(\n obj: any\n): obj is CommandParameterConfig {\n return isSetObject(obj) && \"kind\" in obj && isCommandParameterKind(obj.kind);\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandParameter} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandParameter} type, false otherwise.\n */\nexport function isCommandParameter(obj: any): obj is CommandParameter {\n return (\n isCommandParameterConfig(obj) &&\n \"name\" in obj &&\n isSetString(obj.name) &&\n \"title\" in obj &&\n isSetString(obj.title) &&\n \"description\" in obj &&\n isSetString(obj.description) &&\n \"alias\" in obj &&\n Array.isArray(obj.alias) &&\n \"env\" in obj &&\n (isSetString(obj.env) || obj.env === false) &&\n \"optional\" in obj &&\n isBoolean(obj.optional) &&\n \"variadic\" in obj &&\n isBoolean(obj.variadic)\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandOption} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandOption} type, false otherwise.\n */\nexport function isCommandOption(obj: any): obj is CommandOption {\n return (\n isCommandParameterConfig(obj) && isCommandParameter(obj) && \"default\" in obj\n );\n}\n\n/**\n * Type guard to check if a value is a valid {@link CommandArgument} type.\n *\n * @param obj - The value to check.\n * @returns True if the value is a valid {@link CommandArgument} type, false otherwise.\n */\nexport function isCommandArgument(obj: any): obj is CommandArgument {\n return isCommandParameterConfig(obj) && isCommandParameter(obj);\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,SAAgB,uBAAS,KAAA;AACzB,QAAS,YAAA,IAAA;EAEP,sBAAA;EACM,sBAA0B;EACjC,sBAAA;EACQ,CAAC,SAAS,IAAC;;AAEpB,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,SAAM,yBAAsB,KAAA;AACxB,QAAE,YAAgB,IAAA,IAAA,UAAA,OAAoB,uBAAA,IAAA,KAAA;;AAE1C,yBAAA,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOA,SAAE,mBAAA,KAAA;AACF,QAAO,yBAAS,IAAwB,IACjC,UAAA,OACA,YAAG,IAAA,KAAA,IACF,WAAC,OACT,YAAA,IAAA,MAAA,4BAEE,YAAA,IAAA,YAAA,IACM,WAAS,OAChB,MAAA,QAAA,IAAA,MAAA,IACG,SAAY,QACZ,YAAgB,IAAI,IAAK,IAAI,IAAE,QAAQ,UACzC,cAAA,OACK,UAAS,IAAA,SAAA,IACR,cAAC,OACL,UAAA,IAAA,SAAyB;;AAE7B,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,gBAAE,KAAA;AACd,QAAC,yBAAgC,IAAI,IAAA,mBAAQ,IAAA,IAAA,aAAA;;AAEjD,gBAAc,SAAI;CAAQ;CAAG;CAAA;CAAA;CAAA;;;;;;;AAO7B,SAAgB,kBAAkB,KAAK;AACtC,QAAA,yBAAA,IAAA,IAAA,mBAAA,IAAA;;AAED,kBAAiB,SAAO;CAAA;CAAW;CAAa;CAAoC;CAAA"}
package/dist/plugin.cjs CHANGED
@@ -146,6 +146,7 @@ const plugin = (options = {}) => {
146
146
  alias: [],
147
147
  tags: [],
148
148
  isVirtual: false,
149
+ source: "file",
149
150
  entry: {
150
151
  ...entry,
151
152
  file: entry.file,
@@ -177,7 +178,6 @@ const plugin = (options = {}) => {
177
178
  async handler() {
178
179
  if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
179
180
  else {
180
- this.debug(`Shell Shock will create an application with the following commands: \n${this.inputs.filter((cmd) => !cmd.isVirtual).map((command) => ` - ${command.id}: ${(0, _stryke_path_is_parent_path.isParentPath)(command.entry.file, this.commandsPath) ? (0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath) : (0, _stryke_path_file_path_fns.relativePath)(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
181
181
  this.debug("Finding and adding virtual command inputs for each command previously found.");
182
182
  this.inputs = this.inputs.reduce((ret, command) => {
183
183
  let depth = 0;
@@ -203,7 +203,8 @@ const plugin = (options = {}) => {
203
203
  alias: [],
204
204
  tags: [],
205
205
  isVirtual: true,
206
- entry: { file }
206
+ entry: { file },
207
+ source: "file"
207
208
  });
208
209
  }
209
210
  }
@@ -211,7 +212,7 @@ const plugin = (options = {}) => {
211
212
  }
212
213
  return ret;
213
214
  }, this.inputs).sort((a, b) => a.segments.length - b.segments.length);
214
- this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}: ${(0, _stryke_path_is_parent_path.isParentPath)(command.entry.file, this.commandsPath) ? (0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath) : (0, _stryke_path_replace.replacePath)(command.entry.file, this.config.root)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
215
+ this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}${command.isVirtual ? " (virtual)" : ""}: ${command.source === "file" ? (0, _stryke_path_replace.replacePath)(command.entry.file, this.commandsPath) : `added by ${command.source}`}`).join("\n")}`);
215
216
  }
216
217
  }
217
218
  }
@@ -307,5 +308,4 @@ const plugin = (options = {}) => {
307
308
 
308
309
  //#endregion
309
310
  exports.default = plugin;
310
- exports.plugin = plugin;
311
- //# sourceMappingURL=plugin.cjs.map
311
+ exports.plugin = plugin;
package/dist/plugin.mjs CHANGED
@@ -21,7 +21,7 @@ import tsdown from "@powerlines/plugin-tsdown";
21
21
  import { toArray } from "@stryke/convert/to-array";
22
22
  import { chmodX } from "@stryke/fs/chmod-x";
23
23
  import { appendPath } from "@stryke/path/append";
24
- import { findFilePath, relativePath } from "@stryke/path/file-path-fns";
24
+ import { findFilePath } from "@stryke/path/file-path-fns";
25
25
  import { isParentPath } from "@stryke/path/is-parent-path";
26
26
  import { joinPaths } from "@stryke/path/join-paths";
27
27
  import { replacePath } from "@stryke/path/replace";
@@ -141,6 +141,7 @@ const plugin = (options = {}) => {
141
141
  alias: [],
142
142
  tags: [],
143
143
  isVirtual: false,
144
+ source: "file",
144
145
  entry: {
145
146
  ...entry,
146
147
  file: entry.file,
@@ -172,7 +173,6 @@ const plugin = (options = {}) => {
172
173
  async handler() {
173
174
  if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
174
175
  else {
175
- this.debug(`Shell Shock will create an application with the following commands: \n${this.inputs.filter((cmd) => !cmd.isVirtual).map((command) => ` - ${command.id}: ${isParentPath(command.entry.file, this.commandsPath) ? replacePath(command.entry.file, this.commandsPath) : relativePath(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
176
176
  this.debug("Finding and adding virtual command inputs for each command previously found.");
177
177
  this.inputs = this.inputs.reduce((ret, command) => {
178
178
  let depth = 0;
@@ -198,7 +198,8 @@ const plugin = (options = {}) => {
198
198
  alias: [],
199
199
  tags: [],
200
200
  isVirtual: true,
201
- entry: { file }
201
+ entry: { file },
202
+ source: "file"
202
203
  });
203
204
  }
204
205
  }
@@ -206,7 +207,7 @@ const plugin = (options = {}) => {
206
207
  }
207
208
  return ret;
208
209
  }, this.inputs).sort((a, b) => a.segments.length - b.segments.length);
209
- this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}: ${isParentPath(command.entry.file, this.commandsPath) ? replacePath(command.entry.file, this.commandsPath) : replacePath(command.entry.file, this.config.root)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
210
+ this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}${command.isVirtual ? " (virtual)" : ""}: ${command.source === "file" ? replacePath(command.entry.file, this.commandsPath) : `added by ${command.source}`}`).join("\n")}`);
210
211
  }
211
212
  }
212
213
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport nodejs from \"@powerlines/plugin-nodejs\";\nimport tsdown from \"@powerlines/plugin-tsdown\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { chmodX } from \"@stryke/fs/chmod-x\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFilePath, relativePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { resolveInputs } from \"powerlines/utils\";\nimport type { BuildContext, RolldownChunk, TsdownHooks } from \"tsdown\";\nimport { CommandDocsFile } from \"./components/docs\";\nimport { ExecBuiltin } from \"./components/exec-builtin\";\nimport { StateBuiltin } from \"./components/state-builtin\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { commands } from \"./helpers/automd\";\nimport {\n findCommandsRoot,\n resolveCommandId,\n resolveCommandName,\n resolveCommandPath\n} from \"./helpers/paths\";\nimport {\n getCommandsPersistencePath,\n readCommandsPersistence,\n writeCommandsPersistence\n} from \"./helpers/persistence\";\nimport {\n formatBinaryPath,\n updatePackageJsonBinary\n} from \"./helpers/update-package-json\";\nimport { formatCommandTree, getGlobalOptions } from \"./helpers/utilities\";\nimport { validateCommand } from \"./helpers/validations\";\nimport {\n getAppDescription,\n getAppName,\n getAppTitle,\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"./plugin-utils/context-helpers\";\nimport { getCommandTree } from \"./plugin-utils/get-command-tree\";\nimport { traverseCommands } from \"./plugin-utils/traverse-command-tree\";\nimport { resolve } from \"./resolver/resolve\";\nimport type { CommandOption, CommandTree } from \"./types/command\";\nimport type { Options } from \"./types/config\";\nimport type { Context } from \"./types/context\";\n\nconst MAX_DEPTH = 50;\n\n/**\n * The core Powerlines plugin to build Shell Shock projects.\n */\nexport const plugin = <TContext extends Context = Context>(\n options: Options = {}\n): Plugin<TContext>[] => {\n return [\n tsdown<TContext>(),\n automd<TContext>(),\n {\n name: \"shell-shock:config\",\n async config() {\n this.debug(\"Resolving the Shell Shock configuration.\");\n\n await updatePackageJsonBinary(this);\n\n const result = defu(\n {\n output: {\n path: joinPaths(this.config.root, \"dist\")\n }\n },\n options,\n {\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n platform: \"node\",\n projectType: \"application\",\n framework: \"shell-shock\",\n isCaseSensitive: false,\n output: {\n format: \"esm\",\n dts: false\n },\n input:\n !this.config.input ||\n (Array.isArray(this.config.input) &&\n this.config.input.length === 0) ||\n (isObject(this.config.input) &&\n Object.keys(this.config.input).length === 0)\n ? [\n joinPaths(this.config.root, \"src/**/command.ts\"),\n joinPaths(this.config.root, \"src/**/command.tsx\")\n ]\n : undefined,\n resolve: {\n external: [\"@powerlines/deepkit\"],\n skipNodeModulesBundle: true\n },\n tsdown: {\n dts: false,\n nodeProtocol: true,\n unbundle: false\n }\n }\n );\n\n return result;\n },\n configResolved: {\n order: \"pre\",\n async handler() {\n this.debug(\"Shell Shock configuration has been resolved.\");\n\n this.config.appSpecificEnvPrefix = isSetString(\n this.config.autoAssignEnv\n )\n ? this.config.autoAssignEnv\n : constantCase(getAppName(this));\n if (\n !this.config.env.prefix ||\n !Array.isArray(this.config.env.prefix)\n ) {\n this.config.env.prefix = toArray(this.config.env.prefix);\n }\n\n if (\n !this.config.env.prefix.includes(this.config.appSpecificEnvPrefix)\n ) {\n this.config.env.prefix.push(this.config.appSpecificEnvPrefix);\n }\n\n this.config.bin = (isSetString(this.packageJson.bin)\n ? { [kebabCase(this.config.name)]: this.packageJson.bin }\n : this.packageJson.bin) ?? {\n [kebabCase(this.config.name)]: formatBinaryPath(\n this.config.output.format\n )\n };\n\n if (isSetString(this.config.reference)) {\n if (this.config.reference.includes(\"{command}\")) {\n this.config.reference = {\n app: this.config.reference\n .substring(0, this.config.reference.indexOf(\"{command}\"))\n .replace(/\\/?$/, \"/\"),\n commands: this.config.reference\n };\n } else if (this.config.reference.includes(\"{commands}\")) {\n this.config.reference = {\n app: this.config.reference\n .substring(0, this.config.reference.indexOf(\"{commands}\"))\n .replace(/\\/?$/, \"/\"),\n commands: this.config.reference\n };\n } else {\n this.config.reference = {\n app: this.config.reference\n };\n }\n }\n\n this.inputs ??= [];\n this.options = Object.values(\n getGlobalOptions(this, {\n id: null,\n name: this.config.name,\n path: null,\n segments: [],\n title: this.config.title,\n description: this.config.description,\n alias: [],\n isVirtual: false\n })\n );\n\n this.options = this.options.map(\n option =>\n ({\n ...option,\n name: camelCase(option.name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n }) as CommandOption\n );\n }\n }\n },\n ...nodejs<TContext>(\n defu(options ?? {}, {\n env: {\n types: \"@shell-shock/core/types/env#ShellShockEnv\",\n validate: false\n }\n })\n ),\n {\n name: \"shell-shock:inputs\",\n async configResolved() {\n this.debug(\"Finding command entry point files.\");\n\n this.debug(\n `Checking for commands using input: ${JSON.stringify(this.config.input)}`\n );\n\n this.commandsPath = await findCommandsRoot(this);\n this.debug(`Resolved commands root path: ${this.commandsPath}`);\n\n const inputs = await resolveInputs(this, this.config.input);\n\n this.debug(\n `Found ${\n inputs.length\n } entry points specified in the configuration options.`\n );\n\n this.inputs = inputs.reduce((ret, entry) => {\n if (\n entry.file !== this.commandsPath &&\n !isParentPath(entry.file, this.commandsPath)\n ) {\n throw new Error(\n `Command entry point \"${\n entry.file\n }\" is not located within the commands root \"${\n this.commandsPath\n }\". Please ensure that all command entry points are located within the current project.`\n );\n }\n\n const id = resolveCommandId(this, entry.file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(entry.file);\n let segments = resolveCommandPath(this, entry.file)\n .split(\"/\")\n .filter(Boolean);\n\n // Ensure unique segment names by appending an index suffix to duplicates\n segments = segments.map((segment, index) => {\n const found = segments.findIndex(\n existing => existing === segment\n );\n if (found !== -1 && found !== index) {\n segment += `_${\n segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(\n /_\\d+$/,\n \"\"\n ) === segment\n ).length\n }`;\n }\n\n return segment;\n });\n\n ret.push({\n id,\n path: segments.join(\"/\"),\n segments,\n name,\n alias: [],\n tags: [],\n isVirtual: false,\n entry: {\n ...entry,\n file: entry.file,\n input: {\n file: entry.file,\n name: entry.name\n },\n output: name\n }\n });\n }\n\n return ret;\n }, this.inputs);\n\n this.debug(\n `Shell Shock will process ${\n this.inputs.length\n } command entry files: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}: ${replacePath(\n command.entry.file,\n this.commandsPath\n )}`\n )\n .join(\"\\n\")}`\n );\n },\n async prepare() {\n this.debug(\n \"Rendering base built-in modules for the Shell Shock application.\"\n );\n\n return render(\n this,\n <>\n <StateBuiltin />\n <UtilsBuiltin />\n <ExecBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:virtual-inputs\",\n configResolved: {\n order: \"post\",\n async handler() {\n if (this.inputs.length === 0) {\n this.warn(\n \"No commands were found in the project. Please ensure at least one command exists.\"\n );\n } else {\n this.debug(\n `Shell Shock will create an application with the following commands: \\n${this.inputs\n .filter(cmd => !cmd.isVirtual)\n .map(\n command =>\n ` - ${command.id}: ${\n isParentPath(command.entry.file, this.commandsPath)\n ? replacePath(command.entry.file, this.commandsPath)\n : relativePath(command.entry.file, this.commandsPath)\n }${command.isVirtual ? \" (virtual)\" : \"\"}`\n )\n .join(\"\\n\")}`\n );\n\n this.debug(\n \"Finding and adding virtual command inputs for each command previously found.\"\n );\n\n this.inputs = this.inputs\n .reduce((ret, command) => {\n let depth = 0;\n\n let parentPath = resolveParentPath(\n findFilePath(command.entry.file)\n );\n if (isParentPath(parentPath, this.commandsPath)) {\n while (parentPath !== this.commandsPath) {\n if (depth++ > MAX_DEPTH) {\n throw new Error(\n `Unable to process virtual commands for ${\n command.name\n } \\n\\nPlease ensure ${\n command.entry.file\n } is a valid command entry file and does not have an invalid path.`\n );\n }\n\n if (\n !ret.some(\n existing =>\n findFilePath(existing.entry.file) === parentPath\n )\n ) {\n const file = joinPaths(parentPath, \"command.ts\");\n const id = resolveCommandId(this, file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(file);\n\n let segments = resolveCommandPath(this, file)\n .split(\"/\")\n .filter(Boolean);\n\n // Ensure unique segment names by appending an index suffix to duplicates\n segments = segments.map((segment, index) => {\n const found = segments.findIndex(\n existing => existing === segment\n );\n if (found !== -1 && found !== index) {\n segment += `_${\n segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(\n /_\\d+$/,\n \"\"\n ) === segment\n ).length\n }`;\n }\n\n return segment;\n });\n\n ret.push({\n id,\n path: segments.join(\"/\"),\n segments,\n name,\n alias: [],\n tags: [],\n isVirtual: true,\n entry: {\n file\n }\n });\n }\n }\n\n parentPath = resolveParentPath(parentPath);\n }\n }\n\n return ret;\n }, this.inputs)\n .sort((a, b) => a.segments.length - b.segments.length);\n\n this.debug(\n `Final command input list: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}: ${\n isParentPath(command.entry.file, this.commandsPath)\n ? replacePath(command.entry.file, this.commandsPath)\n : replacePath(command.entry.file, this.config.root)\n }${command.isVirtual ? \" (virtual)\" : \"\"}`\n )\n .join(\"\\n\")}`\n );\n }\n }\n }\n },\n {\n name: \"shell-shock:resolve-commands\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Initializing the CLI application's command tree.\");\n\n this.commands = {};\n if (\n this.config.command !== \"prepare\" &&\n this.config.skipCache !== true &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n this.fs.existsSync(getCommandsPersistencePath(this))\n ) {\n this.debug(\n `Skipping command resolution as the meta checksum has not changed.`\n );\n\n await readCommandsPersistence(this);\n } else {\n for (const input of this.inputs.filter(\n input =>\n input.segments.filter(\n segment =>\n !isDynamicPathSegment(segment) &&\n !isPathSegmentGroup(segment)\n ).length === 1\n )) {\n this.commands[input.name] = await resolve({\n context: this,\n command: input\n });\n }\n\n this.debug(\"Post-processing commands to ensure proper reflection.\");\n\n await traverseCommands(this, command => {\n command.options = Object.fromEntries(\n Object.entries(command.options).map(([name, option]) => [\n camelCase(name),\n {\n ...option,\n name: camelCase(name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n } as CommandOption\n ])\n );\n });\n\n await writeCommandsPersistence(this);\n }\n\n this.debug(\"Validating the CLI applications command tree.\");\n\n let isValid = true;\n await traverseCommands(this, command => {\n const failures = validateCommand(command);\n if (failures.length > 0) {\n this.error(\n `Found ${failures.length} issue${failures.length > 1 ? \"s\" : \"\"} with the ${\n command.title\n } command: \\n${failures\n .map(failure => ` - ${failure.code}: ${failure.details}`)\n .join(\"\\n\")}\\n`\n );\n isValid = false;\n }\n });\n if (!isValid) {\n throw new Error(\n `One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`\n );\n }\n\n this.info(\n `\\nCreating an application with the following command tree: \\n${formatCommandTree(\n this\n )}\\n`\n );\n }\n }\n },\n {\n name: \"shell-shock:chmod+x\",\n configResolved() {\n this.config.tsdown.hooks ??= {} as TsdownHooks;\n (this.config.tsdown.hooks as TsdownHooks)[\"build:done\"] = async (\n _: BuildContext & {\n chunks: RolldownChunk[];\n }\n ) => {\n await Promise.all(\n Object.values(this.config.bin).map(async bin => {\n const path = appendPath(\n bin,\n joinPaths(this.workspaceConfig.workspaceRoot, this.config.root)\n );\n if (this.fs.existsSync(path)) {\n this.debug(\n `Adding hashbang to binary executable output file: ${path}`\n );\n\n const content = await this.fs.read(path);\n if (content && !content.startsWith(\"#!\")) {\n await this.fs.write(\n path,\n `#!/usr/bin/env ${\n this.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node\\n\\n${content}`\n );\n }\n\n this.debug(\n `Adding executable permissions (chmod+x) to binary executable output file: ${\n path\n }`\n );\n\n await chmodX(path);\n } else {\n this.warn(\n `Expected binary output file not found at path: ${\n path\n }. Skipping adding hashbang and executable permissions (chmod+x).`\n );\n }\n })\n );\n };\n }\n },\n {\n name: \"shell-shock:docs\",\n configResolved() {\n this.config.automd ??= {};\n this.config.automd.generators = {\n ...(this.config.automd.generators ?? {}),\n commands: commands(this)\n };\n },\n async docs() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <For each={Object.values(commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs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EH,MAAC,OAAA;AACD,SAAA,MAAA,oEAAA;IACE,MAAM,WAAO,KAAM,OAAQ,KAAM,UAAC,eAAA,MAAA,MAAA,SAAA,CAAA,CAAA,OAAA,QAAA;AAClC,WAAA,OAAc,MAAE,gBAAA,KAAA;KACd,IAAA,OAAQ;AACR,aAAM,OAAU,OAAA,SAAA;;KAEhB,gBAAa;KACb,WAAU,UAAS,gBAAkB,MAAA;MACnC,IAAG,OAAA;AACD,cAAK,CAAA,MAAA;;MAEP,IAAI,WAAO;AACT,cAAK,gBAAmB,iBAAS,EAC/B,SAAM,OACP,CAAC;;MAEL,CAAC;KACH,CAAC,CAAC;;GAEN;EAAC"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport nodejs from \"@powerlines/plugin-nodejs\";\nimport tsdown from \"@powerlines/plugin-tsdown\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { chmodX } from \"@stryke/fs/chmod-x\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFilePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { resolveInputs } from \"powerlines/utils\";\nimport type { BuildContext, RolldownChunk, TsdownHooks } from \"tsdown\";\nimport { CommandDocsFile } from \"./components/docs\";\nimport { ExecBuiltin } from \"./components/exec-builtin\";\nimport { StateBuiltin } from \"./components/state-builtin\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { commands } from \"./helpers/automd\";\nimport {\n findCommandsRoot,\n resolveCommandId,\n resolveCommandName,\n resolveCommandPath\n} from \"./helpers/paths\";\nimport {\n getCommandsPersistencePath,\n readCommandsPersistence,\n writeCommandsPersistence\n} from \"./helpers/persistence\";\nimport {\n formatBinaryPath,\n updatePackageJsonBinary\n} from \"./helpers/update-package-json\";\nimport { formatCommandTree, getGlobalOptions } from \"./helpers/utilities\";\nimport { validateCommand } from \"./helpers/validations\";\nimport {\n getAppDescription,\n getAppName,\n getAppTitle,\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"./plugin-utils/context-helpers\";\nimport { getCommandTree } from \"./plugin-utils/get-command-tree\";\nimport { traverseCommands } from \"./plugin-utils/traverse-command-tree\";\nimport { resolve } from \"./resolver/resolve\";\nimport type { CommandOption, CommandTree } from \"./types/command\";\nimport type { Options } from \"./types/config\";\nimport type { Context } from \"./types/context\";\n\nconst MAX_DEPTH = 50;\n\n/**\n * The core Powerlines plugin to build Shell Shock projects.\n */\nexport const plugin = <TContext extends Context = Context>(\n options: Options = {}\n): Plugin<TContext>[] => {\n return [\n tsdown<TContext>(),\n automd<TContext>(),\n {\n name: \"shell-shock:config\",\n async config() {\n this.debug(\"Resolving the Shell Shock configuration.\");\n\n await updatePackageJsonBinary(this);\n\n const result = defu(\n {\n output: {\n path: joinPaths(this.config.root, \"dist\")\n }\n },\n options,\n {\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n platform: \"node\",\n projectType: \"application\",\n framework: \"shell-shock\",\n isCaseSensitive: false,\n output: {\n format: \"esm\",\n dts: false\n },\n input:\n !this.config.input ||\n (Array.isArray(this.config.input) &&\n this.config.input.length === 0) ||\n (isObject(this.config.input) &&\n Object.keys(this.config.input).length === 0)\n ? [\n joinPaths(this.config.root, \"src/**/command.ts\"),\n joinPaths(this.config.root, \"src/**/command.tsx\")\n ]\n : undefined,\n resolve: {\n external: [\"@powerlines/deepkit\"],\n skipNodeModulesBundle: true\n },\n tsdown: {\n dts: false,\n nodeProtocol: true,\n unbundle: false\n }\n }\n );\n\n return result;\n },\n configResolved: {\n order: \"pre\",\n async handler() {\n this.debug(\"Shell Shock configuration has been resolved.\");\n\n this.config.appSpecificEnvPrefix = isSetString(\n this.config.autoAssignEnv\n )\n ? this.config.autoAssignEnv\n : constantCase(getAppName(this));\n if (\n !this.config.env.prefix ||\n !Array.isArray(this.config.env.prefix)\n ) {\n this.config.env.prefix = toArray(this.config.env.prefix);\n }\n\n if (\n !this.config.env.prefix.includes(this.config.appSpecificEnvPrefix)\n ) {\n this.config.env.prefix.push(this.config.appSpecificEnvPrefix);\n }\n\n this.config.bin = (isSetString(this.packageJson.bin)\n ? { [kebabCase(this.config.name)]: this.packageJson.bin }\n : this.packageJson.bin) ?? {\n [kebabCase(this.config.name)]: formatBinaryPath(\n this.config.output.format\n )\n };\n\n if (isSetString(this.config.reference)) {\n if (this.config.reference.includes(\"{command}\")) {\n this.config.reference = {\n app: this.config.reference\n .substring(0, this.config.reference.indexOf(\"{command}\"))\n .replace(/\\/?$/, \"/\"),\n commands: this.config.reference\n };\n } else if (this.config.reference.includes(\"{commands}\")) {\n this.config.reference = {\n app: this.config.reference\n .substring(0, this.config.reference.indexOf(\"{commands}\"))\n .replace(/\\/?$/, \"/\"),\n commands: this.config.reference\n };\n } else {\n this.config.reference = {\n app: this.config.reference\n };\n }\n }\n\n this.inputs ??= [];\n this.options = Object.values(\n getGlobalOptions(this, {\n id: null,\n name: this.config.name,\n path: null,\n segments: [],\n title: this.config.title,\n description: this.config.description,\n alias: [],\n isVirtual: false\n })\n );\n\n this.options = this.options.map(\n option =>\n ({\n ...option,\n name: camelCase(option.name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n }) as CommandOption\n );\n }\n }\n },\n ...nodejs<TContext>(\n defu(options ?? {}, {\n env: {\n types: \"@shell-shock/core/types/env#ShellShockEnv\",\n validate: false\n }\n })\n ),\n {\n name: \"shell-shock:inputs\",\n async configResolved() {\n this.debug(\"Finding command entry point files.\");\n\n this.debug(\n `Checking for commands using input: ${JSON.stringify(this.config.input)}`\n );\n\n this.commandsPath = await findCommandsRoot(this);\n this.debug(`Resolved commands root path: ${this.commandsPath}`);\n\n const inputs = await resolveInputs(this, this.config.input);\n\n this.debug(\n `Found ${\n inputs.length\n } entry points specified in the configuration options.`\n );\n\n this.inputs = inputs.reduce((ret, entry) => {\n if (\n entry.file !== this.commandsPath &&\n !isParentPath(entry.file, this.commandsPath)\n ) {\n throw new Error(\n `Command entry point \"${\n entry.file\n }\" is not located within the commands root \"${\n this.commandsPath\n }\". Please ensure that all command entry points are located within the current project.`\n );\n }\n\n const id = resolveCommandId(this, entry.file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(entry.file);\n let segments = resolveCommandPath(this, entry.file)\n .split(\"/\")\n .filter(Boolean);\n\n // Ensure unique segment names by appending an index suffix to duplicates\n segments = segments.map((segment, index) => {\n const found = segments.findIndex(\n existing => existing === segment\n );\n if (found !== -1 && found !== index) {\n segment += `_${\n segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(\n /_\\d+$/,\n \"\"\n ) === segment\n ).length\n }`;\n }\n\n return segment;\n });\n\n ret.push({\n id,\n path: segments.join(\"/\"),\n segments,\n name,\n alias: [],\n tags: [],\n isVirtual: false,\n source: \"file\",\n entry: {\n ...entry,\n file: entry.file,\n input: {\n file: entry.file,\n name: entry.name\n },\n output: name\n }\n });\n }\n\n return ret;\n }, this.inputs);\n\n this.debug(\n `Shell Shock will process ${\n this.inputs.length\n } command entry files: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}: ${replacePath(\n command.entry.file,\n this.commandsPath\n )}`\n )\n .join(\"\\n\")}`\n );\n },\n async prepare() {\n this.debug(\n \"Rendering base built-in modules for the Shell Shock application.\"\n );\n\n return render(\n this,\n <>\n <StateBuiltin />\n <UtilsBuiltin />\n <ExecBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:virtual-inputs\",\n configResolved: {\n order: \"post\",\n async handler() {\n if (this.inputs.length === 0) {\n this.warn(\n \"No commands were found in the project. Please ensure at least one command exists.\"\n );\n } else {\n this.debug(\n \"Finding and adding virtual command inputs for each command previously found.\"\n );\n\n this.inputs = this.inputs\n .reduce((ret, command) => {\n let depth = 0;\n\n let parentPath = resolveParentPath(\n findFilePath(command.entry.file)\n );\n if (isParentPath(parentPath, this.commandsPath)) {\n while (parentPath !== this.commandsPath) {\n if (depth++ > MAX_DEPTH) {\n throw new Error(\n `Unable to process virtual commands for ${\n command.name\n } \\n\\nPlease ensure ${\n command.entry.file\n } is a valid command entry file and does not have an invalid path.`\n );\n }\n\n if (\n !ret.some(\n existing =>\n findFilePath(existing.entry.file) === parentPath\n )\n ) {\n const file = joinPaths(parentPath, \"command.ts\");\n const id = resolveCommandId(this, file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(file);\n\n let segments = resolveCommandPath(this, file)\n .split(\"/\")\n .filter(Boolean);\n\n // Ensure unique segment names by appending an index suffix to duplicates\n segments = segments.map((segment, index) => {\n const found = segments.findIndex(\n existing => existing === segment\n );\n if (found !== -1 && found !== index) {\n segment += `_${\n segments.filter(\n segment =>\n isDynamicPathSegment(segment) &&\n getDynamicPathSegmentName(segment).replace(\n /_\\d+$/,\n \"\"\n ) === segment\n ).length\n }`;\n }\n\n return segment;\n });\n\n ret.push({\n id,\n path: segments.join(\"/\"),\n segments,\n name,\n alias: [],\n tags: [],\n isVirtual: true,\n entry: {\n file\n },\n source: \"file\"\n });\n }\n }\n\n parentPath = resolveParentPath(parentPath);\n }\n }\n\n return ret;\n }, this.inputs)\n .sort((a, b) => a.segments.length - b.segments.length);\n\n this.debug(\n `Final command input list: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}${command.isVirtual ? \" (virtual)\" : \"\"}: ${\n command.source === \"file\"\n ? replacePath(command.entry.file, this.commandsPath)\n : `added by ${command.source}`\n }`\n )\n .join(\"\\n\")}`\n );\n }\n }\n }\n },\n {\n name: \"shell-shock:resolve-commands\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Initializing the CLI application's command tree.\");\n\n this.commands = {};\n if (\n this.config.command !== \"prepare\" &&\n this.config.skipCache !== true &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n this.fs.existsSync(getCommandsPersistencePath(this))\n ) {\n this.debug(\n `Skipping command resolution as the meta checksum has not changed.`\n );\n\n await readCommandsPersistence(this);\n } else {\n for (const input of this.inputs.filter(\n input =>\n input.segments.filter(\n segment =>\n !isDynamicPathSegment(segment) &&\n !isPathSegmentGroup(segment)\n ).length === 1\n )) {\n this.commands[input.name] = await resolve({\n context: this,\n command: input\n });\n }\n\n this.debug(\"Post-processing commands to ensure proper reflection.\");\n\n await traverseCommands(this, command => {\n command.options = Object.fromEntries(\n Object.entries(command.options).map(([name, option]) => [\n camelCase(name),\n {\n ...option,\n name: camelCase(name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n } as CommandOption\n ])\n );\n });\n\n await writeCommandsPersistence(this);\n }\n\n this.debug(\"Validating the CLI applications command tree.\");\n\n let isValid = true;\n await traverseCommands(this, command => {\n const failures = validateCommand(command);\n if (failures.length > 0) {\n this.error(\n `Found ${failures.length} issue${failures.length > 1 ? \"s\" : \"\"} with the ${\n command.title\n } command: \\n${failures\n .map(failure => ` - ${failure.code}: ${failure.details}`)\n .join(\"\\n\")}\\n`\n );\n isValid = false;\n }\n });\n if (!isValid) {\n throw new Error(\n `One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`\n );\n }\n\n this.info(\n `\\nCreating an application with the following command tree: \\n${formatCommandTree(\n this\n )}\\n`\n );\n }\n }\n },\n {\n name: \"shell-shock:chmod+x\",\n configResolved() {\n this.config.tsdown.hooks ??= {} as TsdownHooks;\n (this.config.tsdown.hooks as TsdownHooks)[\"build:done\"] = async (\n _: BuildContext & {\n chunks: RolldownChunk[];\n }\n ) => {\n await Promise.all(\n Object.values(this.config.bin).map(async bin => {\n const path = appendPath(\n bin,\n joinPaths(this.workspaceConfig.workspaceRoot, this.config.root)\n );\n if (this.fs.existsSync(path)) {\n this.debug(\n `Adding hashbang to binary executable output file: ${path}`\n );\n\n const content = await this.fs.read(path);\n if (content && !content.startsWith(\"#!\")) {\n await this.fs.write(\n path,\n `#!/usr/bin/env ${\n this.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node\\n\\n${content}`\n );\n }\n\n this.debug(\n `Adding executable permissions (chmod+x) to binary executable output file: ${\n path\n }`\n );\n\n await chmodX(path);\n } else {\n this.warn(\n `Expected binary output file not found at path: ${\n path\n }. Skipping adding hashbang and executable permissions (chmod+x).`\n );\n }\n })\n );\n };\n }\n },\n {\n name: \"shell-shock:docs\",\n configResolved() {\n this.config.automd ??= {};\n this.config.automd.generators = {\n ...(this.config.automd.generators ?? {}),\n commands: commands(this)\n };\n },\n async docs() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <For each={Object.values(commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocsFile command={child} />\n </Show>\n )}\n </For>\n );\n }\n }\n ];\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