@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
@@ -1 +1 @@
1
- {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/helpers/paths.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport async function findCommandsRoot(context: Context): Promise<string> {\n let paths = [] as string[];\n if (isSetString(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input, context.config.root),\n context.workspaceConfig.workspaceRoot\n )\n );\n } else if (isTypeDefinition(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input.file, context.config.root),\n context.workspaceConfig.workspaceRoot\n )\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n paths = (\n await Promise.all(\n context.config.input.map(async input =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat();\n } else if (isSetObject(context.config.input)) {\n paths = (\n await Promise.all(\n Object.values(context.config.input).map(async input =>\n Array.isArray(input)\n ? (\n await Promise.all(\n input.map(async i =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(i) ? i : i.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat()\n : listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat();\n }\n\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n paths = (\n await Promise.all([\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.workspaceConfig.workspaceRoot),\n \"**/command.ts\"\n )\n ),\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.workspaceConfig.workspaceRoot),\n \"**/command.tsx\"\n )\n )\n ])\n ).flat();\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n return appendPath(commandsPath, context.workspaceConfig.workspaceRoot);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA+BX,SAAW,iBAAqB,SAAQ,MAAA;AACxC,QAAW,YAAY,aAAU,KAAM,EAAA,QAAQ,aAAA,YAExC,OAAS,cAAA,MAAiB,QAAS,EAAA,IAAA,CAAO,qBAAiB,EAAM,EAAC;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAChE,KAAA,IAAA,CACJ,WAAS,SAAA,GAAA,CACT,WAAY,SAAY,GAAG,CACvB,WAAI,KAAA,IAAA;;AAEb,iBAAiB,SAAS;CAAC;CAAA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AA,CAAA,EACX,UAAI,UAAU,WAAA,cAAA,QAAA,gBAAA,cAAA,EAAA,iBAAA,CAAA,CACjB,CAAC,EAAE,MAAM;AACV,KAAI,MAAM,SAAE,EACR,QAAO,WAAS,MAAO,IAAA,cAAA,MAAA,aAAA,EAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;AAE3B,QAAO,WAAW,cAAA,QAAgB,gBAAA,cAAA;;AAEtC,iBAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/helpers/paths.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 { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport async function findCommandsRoot(context: Context): Promise<string> {\n let paths = [] as string[];\n if (isSetString(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input, context.config.root),\n context.workspaceConfig.workspaceRoot\n )\n );\n } else if (isTypeDefinition(context.config.input)) {\n paths = await listFiles(\n appendPath(\n appendPath(context.config.input.file, context.config.root),\n context.workspaceConfig.workspaceRoot\n )\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n paths = (\n await Promise.all(\n context.config.input.map(async input =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat();\n } else if (isSetObject(context.config.input)) {\n paths = (\n await Promise.all(\n Object.values(context.config.input).map(async input =>\n Array.isArray(input)\n ? (\n await Promise.all(\n input.map(async i =>\n listFiles(\n appendPath(\n appendPath(\n isSetString(i) ? i : i.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat()\n : listFiles(\n appendPath(\n appendPath(\n isSetString(input) ? input : input.file,\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n )\n ).flat();\n }\n\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n paths = (\n await Promise.all([\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.workspaceConfig.workspaceRoot),\n \"**/command.ts\"\n )\n ),\n listFiles(\n joinPaths(\n appendPath(commandsPath, context.workspaceConfig.workspaceRoot),\n \"**/command.tsx\"\n )\n )\n ])\n ).flat();\n if (paths.length > 0) {\n return commonPath(paths.map(p => findFilePath(p)));\n }\n\n return appendPath(commandsPath, context.workspaceConfig.workspaceRoot);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA+BX,SAAW,iBAAqB,SAAQ,MAAA;AACxC,QAAW,YAAY,aAAU,KAAM,EAAA,QAAQ,aAAA,YAExC,OAAS,cAAA,MAAiB,QAAS,EAAA,IAAA,CAAO,qBAAiB,EAAM,EAAC;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAChE,KAAA,IAAA,CACJ,WAAS,SAAA,GAAA,CACT,WAAY,SAAY,GAAG,CACvB,WAAI,KAAA,IAAA;;AAEb,iBAAiB,SAAS;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,mBAAkB,MAAO;CACrC,IAAA,OAAW,aAAa,KAAA;CAC1B,IAAA,OAAA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V,KAAI,MAAM,SAAE,EACR,QAAO,WAAS,MAAO,IAAA,cAAA,MAAA,aAAA,EAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;AAE3B,QAAO,WAAW,cAAA,QAAgB,gBAAA,cAAA;;AAEtC,iBAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -59,7 +59,8 @@ getCommandsPersistencePath.__type = [
59
59
  "Context",
60
60
  "context",
61
61
  "getCommandsPersistencePath",
62
- "P\"w!2\"&/#"
62
+ "Gets the file path for persisting CLI command reflections.",
63
+ "P\"w!2\"&/#?$"
63
64
  ];
64
65
  /**
65
66
  * Reads the persisted CLI command reflections from the file system and populates the context's commands.
@@ -80,7 +81,8 @@ readCommandsPersistence.__type = [
80
81
  "Context",
81
82
  "context",
82
83
  "readCommandsPersistence",
83
- "P\"w!2\"\"/#"
84
+ "Reads the persisted CLI command reflections from the file system and populates the context's commands.",
85
+ "P\"w!2\"\"/#?$"
84
86
  ];
85
87
  /**
86
88
  * Writes the current CLI command reflections from the context to the file system for persistence.
@@ -101,11 +103,11 @@ writeCommandsPersistence.__type = [
101
103
  "Context",
102
104
  "context",
103
105
  "writeCommandsPersistence",
104
- "P\"w!2\"\"/#"
106
+ "Writes the current CLI command reflections from the context to the file system for persistence.",
107
+ "P\"w!2\"\"/#?$"
105
108
  ];
106
109
 
107
110
  //#endregion
108
111
  exports.getCommandsPersistencePath = getCommandsPersistencePath;
109
112
  exports.readCommandsPersistence = readCommandsPersistence;
110
- exports.writeCommandsPersistence = writeCommandsPersistence;
111
- //# sourceMappingURL=persistence.cjs.map
113
+ exports.writeCommandsPersistence = writeCommandsPersistence;
@@ -58,7 +58,8 @@ getCommandsPersistencePath.__type = [
58
58
  "Context",
59
59
  "context",
60
60
  "getCommandsPersistencePath",
61
- "P\"w!2\"&/#"
61
+ "Gets the file path for persisting CLI command reflections.",
62
+ "P\"w!2\"&/#?$"
62
63
  ];
63
64
  /**
64
65
  * Reads the persisted CLI command reflections from the file system and populates the context's commands.
@@ -79,7 +80,8 @@ readCommandsPersistence.__type = [
79
80
  "Context",
80
81
  "context",
81
82
  "readCommandsPersistence",
82
- "P\"w!2\"\"/#"
83
+ "Reads the persisted CLI command reflections from the file system and populates the context's commands.",
84
+ "P\"w!2\"\"/#?$"
83
85
  ];
84
86
  /**
85
87
  * Writes the current CLI command reflections from the context to the file system for persistence.
@@ -100,7 +102,8 @@ writeCommandsPersistence.__type = [
100
102
  "Context",
101
103
  "context",
102
104
  "writeCommandsPersistence",
103
- "P\"w!2\"\"/#"
105
+ "Writes the current CLI command reflections from the context to the file system for persistence.",
106
+ "P\"w!2\"\"/#?$"
104
107
  ];
105
108
 
106
109
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport type { CommandTree, SerializedCommandTree } from \"../types\";\nimport type { Context } from \"../types/context\";\n\nfunction serialize(command: CommandTree): SerializedCommandTree {\n return {\n ...command,\n parent: command.parent?.name ? command.parent.name : null,\n children: Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n serialize(child)\n ])\n )\n };\n}\n\nfunction deserialize(\n command: SerializedCommandTree,\n parent: CommandTree | null = null\n): CommandTree {\n const result: CommandTree = {\n ...command,\n parent: parent ?? null,\n children: {}\n };\n\n result.children = Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n deserialize(child, result)\n ])\n );\n\n return result;\n}\n\n/**\n * Gets the file path for persisting CLI command reflections.\n *\n * @param context - The Shell Shock context.\n * @returns The file path for persisting CLI command reflections.\n */\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\n/**\n * Reads the persisted CLI command reflections from the file system and populates the context's commands.\n *\n * @param context - The Shell Shock context.\n * @throws Will throw an error if the reflections file is empty or cannot be read.\n */\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = Object.fromEntries(\n Object.entries(\n (JSON.parse(reflections) ?? {}) as Record<string, SerializedCommandTree>\n ).map(([name, command]) => [name, deserialize(command)])\n );\n}\n\n/**\n * Writes the current CLI command reflections from the context to the file system for persistence.\n *\n * @param context - The Shell Shock context.\n * @returns A promise that resolves when the reflections have been successfully written to the file system.\n * @throws Will throw an error if there is an issue writing the reflections to the file system.\n */\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n Object.fromEntries(\n Object.entries(context.commands).map(([name, command]) => [\n name,\n serialize(command)\n ])\n ),\n null,\n context.config.mode === \"production\" ? 0 : 2\n )\n );\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AAoBX,SAAS,UAAU,SAAS;AAC1B,QAAO;EACF,GAAA;EACH,QAAQ,QAAQ,QAAY,OAAG,QAAQ,OAAW,OAAO;EACzD,UAAU,OAAO,YAAW,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACpB,MACA,UAAA,MAAA,CACJ,EAAA;GAAA;GAAU;GAAK;GAAA,CAAA,CAAA,CAAA;EACl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A,IAAA,EAAA,CAAA;;AAElB,yBAAyB,SAAO;CAAA;CAAM;CAAmB;CAAE;CAAA"}
1
+ {"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport type { CommandTree, SerializedCommandTree } from \"../types\";\nimport type { Context } from \"../types/context\";\n\nfunction serialize(command: CommandTree): SerializedCommandTree {\n return {\n ...command,\n parent: command.parent?.name ? command.parent.name : null,\n children: Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n serialize(child)\n ])\n )\n };\n}\n\nfunction deserialize(\n command: SerializedCommandTree,\n parent: CommandTree | null = null\n): CommandTree {\n const result: CommandTree = {\n ...command,\n parent: parent ?? null,\n children: {}\n };\n\n result.children = Object.fromEntries(\n Object.entries(command.children || {}).map(([name, child]) => [\n name,\n deserialize(child, result)\n ])\n );\n\n return result;\n}\n\n/**\n * Gets the file path for persisting CLI command reflections.\n *\n * @param context - The Shell Shock context.\n * @returns The file path for persisting CLI command reflections.\n */\nexport function getCommandsPersistencePath(context: Context): string {\n return joinPaths(context.dataPath, \"reflections\", \"commands.json\");\n}\n\n/**\n * Reads the persisted CLI command reflections from the file system and populates the context's commands.\n *\n * @param context - The Shell Shock context.\n * @throws Will throw an error if the reflections file is empty or cannot be read.\n */\nexport async function readCommandsPersistence(context: Context) {\n const reflections = await context.fs.read(\n getCommandsPersistencePath(context)\n );\n if (!reflections || !reflections.length) {\n throw new Error(\n `CLI Command reflection file ${getCommandsPersistencePath(context)} is empty`\n );\n }\n\n context.commands = Object.fromEntries(\n Object.entries(\n (JSON.parse(reflections) ?? {}) as Record<string, SerializedCommandTree>\n ).map(([name, command]) => [name, deserialize(command)])\n );\n}\n\n/**\n * Writes the current CLI command reflections from the context to the file system for persistence.\n *\n * @param context - The Shell Shock context.\n * @returns A promise that resolves when the reflections have been successfully written to the file system.\n * @throws Will throw an error if there is an issue writing the reflections to the file system.\n */\nexport async function writeCommandsPersistence(context: Context) {\n const filePath = getCommandsPersistencePath(context);\n\n await context.fs.write(\n filePath,\n JSON.stringify(\n Object.fromEntries(\n Object.entries(context.commands).map(([name, command]) => [\n name,\n serialize(command)\n ])\n ),\n null,\n context.config.mode === \"production\" ? 0 : 2\n )\n );\n}\n"],"mappings":";;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AAoBX,SAAS,UAAU,SAAS;AAC1B,QAAO;EACF,GAAA;EACH,QAAQ,QAAQ,QAAY,OAAG,QAAQ,OAAW,OAAO;EACzD,UAAU,OAAO,YAAW,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACpB,MACA,UAAA,MAAA,CACJ,EAAA;GAAA;GAAU;GAAK;GAAA,CAAA,CAAA,CAAA;EAClB;;AAEL,UAAG,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACH,SAAA,YAAA,SAAA,SAAA,MAAA;;EAEQ,GAAC;EACP,QAAS,UAAA;EACH,UAAE,EAAA;EACP;AACD,QAAM,WAAQ,OAAa,YAAC,OAAA,QAAA,QAAA,YAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,WAAA,CACvB,MACH,YAAgB,OAAM,OAAA,CACtB,EAAA;EAAA;EAAW;EAAA;EAAA,CAAA,CAAA,CAAA;AACZ,QAAA;;AAEH,YAAS,SAAW;CAAA;CAAkB;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;AAOtC,SAAe,2BAAA,SAAA;AACf,QAAA,UAAA,QAAA,UAAA,eAAA,gBAAA;;AAEA,2BAAE,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOF,eAAmB,wBAAmB,SAAe;CACrD,MAAA,cAAA,MAAA,QAAA,GAAA,KAAA,2BAAA,QAAA,CAAA;yCAEE,OAAA,IAAA,MAAA,+BAAA,2BAAA,QAAA,CAAA,WAAA;AAED,SAAA,WAAA,OAAA,YAAA,OAAA,QAAA,KAAA,MAAA,YAAA,IAAA,EAAA,CAAA,CAAA,IAAA,cAAA,CAAA,MAAA,aAAA,CAAA,MAAA,YAAA,QAAA,CAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAED,wBAAwB,SAAS;CAAC;CAAI;CAAiB;CAA0B;CAAA;CAAA;;;;;;;;AAQjF,eAAmB,yBAAkB,SAAA;CACjC,MAAC,WAAA,2BAAA,QAAA;AACH,OAAA,QAAA,GAAA,MAAA,UAAA,KAAA,UAAA,OAAA,YAAA,OAAA,QAAA,QAAA,SAAA,CAAA,IAAA,cAAA,CAAA,MAAA,aAAA,OAEA,UAAgB,QAAG,CACjB,EAAA;EAAA;EAAc;EAAA;EAAA,CAAA,CAAA,CAAA,EAAA,MAAA,QAAA,OAAA,SAAA,eAAA,IAAA,EAAA,CAAA;;AAElB,yBAAyB,SAAO;CAAA;CAAM;CAAmB;CAAE;CAAA;CAAA"}
@@ -56,5 +56,4 @@ updatePackageJsonBinary.__type = [
56
56
 
57
57
  //#endregion
58
58
  exports.formatBinaryPath = formatBinaryPath;
59
- exports.updatePackageJsonBinary = updatePackageJsonBinary;
60
- //# sourceMappingURL=update-package-json.cjs.map
59
+ exports.updatePackageJsonBinary = updatePackageJsonBinary;
@@ -86,10 +86,10 @@ getGlobalOptions.__type = [
86
86
  () => __ΩRecord,
87
87
  "CommandOption",
88
88
  "getGlobalOptions",
89
- "P\"w!2\"\"w#2$&\"w&o%#/'"
89
+ "Retrieves the global command options based on the context configuration.",
90
+ "P\"w!2\"\"w#2$&\"w&o%#/'?("
90
91
  ];
91
92
 
92
93
  //#endregion
93
94
  exports.formatCommandTree = formatCommandTree;
94
- exports.getGlobalOptions = getGlobalOptions;
95
- //# sourceMappingURL=utilities.cjs.map
95
+ exports.getGlobalOptions = getGlobalOptions;
@@ -85,7 +85,8 @@ getGlobalOptions.__type = [
85
85
  () => __ΩRecord,
86
86
  "CommandOption",
87
87
  "getGlobalOptions",
88
- "P\"w!2\"\"w#2$&\"w&o%#/'"
88
+ "Retrieves the global command options based on the context configuration.",
89
+ "P\"w!2\"\"w#2$&\"w&o%#/'?("
89
90
  ];
90
91
 
91
92
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.mjs","names":[],"sources":["../../src/helpers/utilities.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 { TreeItem } from \"@stryke/cli/utils/tree\";\nimport { formatTree } from \"@stryke/cli/utils/tree\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport type { CommandBase, CommandOption, CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\nfunction innerFormatCommandTree(command: CommandTree): TreeItem {\n return {\n name: `${command.name}${command.isVirtual ? \" (virtual)\" : \"\"}`,\n children: Object.values(command.children ?? {}).map(innerFormatCommandTree)\n };\n}\n\nexport function formatCommandTree(context: Context): string {\n return formatTree({\n name: context.config.name,\n children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)\n });\n}\n\n/**\n * Retrieves the global command options based on the context configuration.\n *\n * @param context - The build context.\n * @param command - The command for which to retrieve global options.\n * @returns A record of global command options.\n */\nexport function getGlobalOptions(\n context: Context,\n command: CommandBase\n): Record<string, CommandOption> {\n let options!: Record<string, CommandOption>;\n if (Array.isArray(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions,\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else if (isFunction(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions(context, command),\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else {\n options = {};\n }\n\n return Object.fromEntries(\n Object.entries(options).map(([key, value]) => [\n key,\n { ...value, env: value.env ?? constantCase(key) }\n ])\n );\n}\n"],"mappings":";;;;;;AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;;AAE5D,IAAG,SAAS;;;AAOhB,SAAS,uBAAuB,SAAG;AAClC,QAAU;EACV,MAAa,GAAG,QAAQ,OAAO,QAAQ,YAAA,eAA2B;EAC3D,UAAU,OAAO,OAAO,QAAG,YAAiB,EAAC,CAAA,CAAA,IAAA,uBAAA;;;;;;;;;AAIrD,SAAgB,kBAAkB,SAAS;;EAEpC,MAAO,QAAQ,OAAO;EACrB,UAAC,OAAa,OAAO,QAAW,YAAW,EAAA,CAAA,CAAA,IAAA,uBAAA;EACnD,CAAM;;AAEN,kBAAS,SAAkB;CAAC;CAAQ;CAAc;CAAU;CAAA;;;;;;;;AAQ5D,SAAG,iBAAA,SAAA,SAAA;CACH,IAAA;iDAEO,WAAS,OAAA,YAAkB,YAAS,QAAU,OAAO,eAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;UAElD,WAAc,QAAK,OAAA,cAAA,CACzB,WAAU,OAAO,YAAe,YAAa,QAAO,OAAA,cAAsB,SAAA,QAAA,EAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAK3E,QAAA,OAAc,YAAO,OAAQ,QAAa,QAAQ,CAAA,IAAA,cAAQ,CAAA,KAAa,WAAA,CACzE,KACG;EAAM,GAAA;EAAU,KAAI,MAAM,OAAO,aAAA,IAAA;EAAA,CACjC,EAAA;EAAA;EAAc;EAAE;EAAY,CAAA,CAAA,CAAG;;AAEnC,iBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"utilities.mjs","names":[],"sources":["../../src/helpers/utilities.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 { TreeItem } from \"@stryke/cli/utils/tree\";\nimport { formatTree } from \"@stryke/cli/utils/tree\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport type { CommandBase, CommandOption, CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\nfunction innerFormatCommandTree(command: CommandTree): TreeItem {\n return {\n name: `${command.name}${command.isVirtual ? \" (virtual)\" : \"\"}`,\n children: Object.values(command.children ?? {}).map(innerFormatCommandTree)\n };\n}\n\nexport function formatCommandTree(context: Context): string {\n return formatTree({\n name: context.config.name,\n children: Object.values(context.commands ?? {}).map(innerFormatCommandTree)\n });\n}\n\n/**\n * Retrieves the global command options based on the context configuration.\n *\n * @param context - The build context.\n * @param command - The command for which to retrieve global options.\n * @returns A record of global command options.\n */\nexport function getGlobalOptions(\n context: Context,\n command: CommandBase\n): Record<string, CommandOption> {\n let options!: Record<string, CommandOption>;\n if (Array.isArray(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions,\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else if (isFunction(context.config.globalOptions)) {\n options = Object.fromEntries(\n getUniqueBy(\n context.config.globalOptions(context, command),\n (item: CommandOption) => item.name\n ).map(option => [option.name, option])\n );\n } else {\n options = {};\n }\n\n return Object.fromEntries(\n Object.entries(options).map(([key, value]) => [\n key,\n { ...value, env: value.env ?? constantCase(key) }\n ])\n );\n}\n"],"mappings":";;;;;;AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;;AAE5D,IAAG,SAAS;;;AAOhB,SAAS,uBAAuB,SAAG;AAClC,QAAU;EACV,MAAa,GAAG,QAAQ,OAAO,QAAQ,YAAA,eAA2B;EAC3D,UAAU,OAAO,OAAO,QAAG,YAAiB,EAAC,CAAA,CAAA,IAAA,uBAAA;;;;;;;;;AAIrD,SAAgB,kBAAkB,SAAS;;EAEpC,MAAO,QAAQ,OAAO;EACrB,UAAC,OAAa,OAAO,QAAW,YAAW,EAAA,CAAA,CAAA,IAAA,uBAAA;EACnD,CAAM;;AAEN,kBAAS,SAAkB;CAAC;CAAQ;CAAc;CAAU;CAAA;;;;;;;;AAQ5D,SAAG,iBAAA,SAAA,SAAA;CACH,IAAA;iDAEO,WAAS,OAAA,YAAkB,YAAS,QAAU,OAAO,eAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;UAElD,WAAc,QAAK,OAAA,cAAA,CACzB,WAAU,OAAO,YAAe,YAAa,QAAO,OAAA,cAAsB,SAAA,QAAA,EAAA,cAAA,SAAA,KAAA,MAAA;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,IAAA,cAAA,WAAA,CAAA,OAAA,MAAA,OAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;AAK3E,QAAA,OAAc,YAAO,OAAQ,QAAa,QAAQ,CAAA,IAAA,cAAQ,CAAA,KAAa,WAAA,CACzE,KACG;EAAM,GAAA;EAAU,KAAI,MAAM,OAAO,aAAA,IAAA;EAAA,CACjC,EAAA;EAAA;EAAc;EAAE;EAAY,CAAA,CAAA,CAAG;;AAEnC,iBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -68,5 +68,4 @@ validateCommand.__type = [
68
68
  ];
69
69
 
70
70
  //#endregion
71
- exports.validateCommand = validateCommand;
72
- //# sourceMappingURL=validations.cjs.map
71
+ exports.validateCommand = validateCommand;
@@ -37,7 +37,8 @@ function sortArgAliases(aliases) {
37
37
  sortArgAliases.__type = [
38
38
  "aliases",
39
39
  "sortArgAliases",
40
- "P&F2!&F/\""
40
+ "Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.",
41
+ "P&F2!&F/\"?#"
41
42
  ];
42
43
  /**
43
44
  * Retrieves the application name from the context and configuration.
@@ -56,7 +57,8 @@ getAppName.__type = [
56
57
  "Context",
57
58
  "context",
58
59
  "getAppName",
59
- "PP\"w!\"w\"J2#&/$"
60
+ "Retrieves the application name from the context and configuration.",
61
+ "PP\"w!\"w\"J2#&/$?%"
60
62
  ];
61
63
  /**
62
64
  * Retrieves the application title from the context and configuration.
@@ -75,7 +77,8 @@ getAppTitle.__type = [
75
77
  "context",
76
78
  "replaceCLI",
77
79
  "getAppTitle",
78
- "PP\"w!\"w\"J2#\"2$&/%"
80
+ "Retrieves the application title from the context and configuration.",
81
+ "PP\"w!\"w\"J2#\"2$&/%?&"
79
82
  ];
80
83
  /**
81
84
  * Retrieves the application description from the context and configuration.
@@ -91,7 +94,8 @@ getAppDescription.__type = [
91
94
  "Context",
92
95
  "context",
93
96
  "getAppDescription",
94
- "PP\"w!\"w\"J2#&/$"
97
+ "Retrieves the application description from the context and configuration.",
98
+ "PP\"w!\"w\"J2#&/$?%"
95
99
  ];
96
100
  /**
97
101
  * Retrieves the primary binary name for the application.
@@ -106,7 +110,8 @@ getAppBin.__type = [
106
110
  "Context",
107
111
  "context",
108
112
  "getAppBin",
109
- "P\"w!2\"&/#"
113
+ "Retrieves the primary binary name for the application.",
114
+ "P\"w!2\"&/#?$"
110
115
  ];
111
116
  /**
112
117
  * Determines if a given command path segment is variable (enclosed in square brackets).
@@ -126,7 +131,8 @@ function isDynamicPathSegment(path) {
126
131
  isDynamicPathSegment.__type = [
127
132
  "path",
128
133
  "isDynamicPathSegment",
129
- "P&2!)/\""
134
+ "Determines if a given command path segment is variable (enclosed in square brackets).",
135
+ "P&2!)/\"?#"
130
136
  ];
131
137
  /**
132
138
  * Extracts the variable name from a command path segment by removing enclosing square brackets.
@@ -145,7 +151,8 @@ function getDynamicPathSegmentName(path) {
145
151
  getDynamicPathSegmentName.__type = [
146
152
  "path",
147
153
  "getDynamicPathSegmentName",
148
- "P&2!&/\""
154
+ "Extracts the variable name from a command path segment by removing enclosing square brackets.",
155
+ "P&2!&/\"?#"
149
156
  ];
150
157
  /**
151
158
  * Determines if a given command path segment is a path segment group (enclosed in parentheses).
@@ -166,7 +173,8 @@ function isPathSegmentGroup(path) {
166
173
  isPathSegmentGroup.__type = [
167
174
  "path",
168
175
  "isPathSegmentGroup",
169
- "P&2!)/\""
176
+ "Determines if a given command path segment is a path segment group (enclosed in parentheses).",
177
+ "P&2!)/\"?#"
170
178
  ];
171
179
  /**
172
180
  * Extracts the group name from a command path segment by removing enclosing parentheses.
@@ -186,7 +194,8 @@ function getPathSegmentGroupName(path) {
186
194
  getPathSegmentGroupName.__type = [
187
195
  "path",
188
196
  "getPathSegmentGroupName",
189
- "P&2!&/\""
197
+ "Extracts the group name from a command path segment by removing enclosing parentheses.",
198
+ "P&2!&/\"?#"
190
199
  ];
191
200
  /**
192
201
  * Extracts the variable name from a command path segment by removing enclosing square brackets.
@@ -205,7 +214,8 @@ function getPathSegmentName(path) {
205
214
  getPathSegmentName.__type = [
206
215
  "path",
207
216
  "getPathSegmentName",
208
- "P&2!&/\""
217
+ "Extracts the variable name from a command path segment by removing enclosing square brackets.",
218
+ "P&2!&/\"?#"
209
219
  ];
210
220
 
211
221
  //#endregion
@@ -218,5 +228,4 @@ exports.getPathSegmentGroupName = getPathSegmentGroupName;
218
228
  exports.getPathSegmentName = getPathSegmentName;
219
229
  exports.isDynamicPathSegment = isDynamicPathSegment;
220
230
  exports.isPathSegmentGroup = isPathSegmentGroup;
221
- exports.sortArgAliases = sortArgAliases;
222
- //# sourceMappingURL=context-helpers.cjs.map
231
+ exports.sortArgAliases = sortArgAliases;
@@ -36,7 +36,8 @@ function sortArgAliases(aliases) {
36
36
  sortArgAliases.__type = [
37
37
  "aliases",
38
38
  "sortArgAliases",
39
- "P&F2!&F/\""
39
+ "Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.",
40
+ "P&F2!&F/\"?#"
40
41
  ];
41
42
  /**
42
43
  * Retrieves the application name from the context and configuration.
@@ -55,7 +56,8 @@ getAppName.__type = [
55
56
  "Context",
56
57
  "context",
57
58
  "getAppName",
58
- "PP\"w!\"w\"J2#&/$"
59
+ "Retrieves the application name from the context and configuration.",
60
+ "PP\"w!\"w\"J2#&/$?%"
59
61
  ];
60
62
  /**
61
63
  * Retrieves the application title from the context and configuration.
@@ -74,7 +76,8 @@ getAppTitle.__type = [
74
76
  "context",
75
77
  "replaceCLI",
76
78
  "getAppTitle",
77
- "PP\"w!\"w\"J2#\"2$&/%"
79
+ "Retrieves the application title from the context and configuration.",
80
+ "PP\"w!\"w\"J2#\"2$&/%?&"
78
81
  ];
79
82
  /**
80
83
  * Retrieves the application description from the context and configuration.
@@ -90,7 +93,8 @@ getAppDescription.__type = [
90
93
  "Context",
91
94
  "context",
92
95
  "getAppDescription",
93
- "PP\"w!\"w\"J2#&/$"
96
+ "Retrieves the application description from the context and configuration.",
97
+ "PP\"w!\"w\"J2#&/$?%"
94
98
  ];
95
99
  /**
96
100
  * Retrieves the primary binary name for the application.
@@ -105,7 +109,8 @@ getAppBin.__type = [
105
109
  "Context",
106
110
  "context",
107
111
  "getAppBin",
108
- "P\"w!2\"&/#"
112
+ "Retrieves the primary binary name for the application.",
113
+ "P\"w!2\"&/#?$"
109
114
  ];
110
115
  /**
111
116
  * Determines if a given command path segment is variable (enclosed in square brackets).
@@ -125,7 +130,8 @@ function isDynamicPathSegment(path) {
125
130
  isDynamicPathSegment.__type = [
126
131
  "path",
127
132
  "isDynamicPathSegment",
128
- "P&2!)/\""
133
+ "Determines if a given command path segment is variable (enclosed in square brackets).",
134
+ "P&2!)/\"?#"
129
135
  ];
130
136
  /**
131
137
  * Extracts the variable name from a command path segment by removing enclosing square brackets.
@@ -144,7 +150,8 @@ function getDynamicPathSegmentName(path) {
144
150
  getDynamicPathSegmentName.__type = [
145
151
  "path",
146
152
  "getDynamicPathSegmentName",
147
- "P&2!&/\""
153
+ "Extracts the variable name from a command path segment by removing enclosing square brackets.",
154
+ "P&2!&/\"?#"
148
155
  ];
149
156
  /**
150
157
  * Determines if a given command path segment is a path segment group (enclosed in parentheses).
@@ -165,7 +172,8 @@ function isPathSegmentGroup(path) {
165
172
  isPathSegmentGroup.__type = [
166
173
  "path",
167
174
  "isPathSegmentGroup",
168
- "P&2!)/\""
175
+ "Determines if a given command path segment is a path segment group (enclosed in parentheses).",
176
+ "P&2!)/\"?#"
169
177
  ];
170
178
  /**
171
179
  * Extracts the group name from a command path segment by removing enclosing parentheses.
@@ -185,7 +193,8 @@ function getPathSegmentGroupName(path) {
185
193
  getPathSegmentGroupName.__type = [
186
194
  "path",
187
195
  "getPathSegmentGroupName",
188
- "P&2!&/\""
196
+ "Extracts the group name from a command path segment by removing enclosing parentheses.",
197
+ "P&2!&/\"?#"
189
198
  ];
190
199
  /**
191
200
  * Extracts the variable name from a command path segment by removing enclosing square brackets.
@@ -204,7 +213,8 @@ function getPathSegmentName(path) {
204
213
  getPathSegmentName.__type = [
205
214
  "path",
206
215
  "getPathSegmentName",
207
- "P&2!&/\""
216
+ "Extracts the variable name from a command path segment by removing enclosing square brackets.",
217
+ "P&2!&/\"?#"
208
218
  ];
209
219
 
210
220
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-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\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { Context, UnresolvedContext } from \"../types\";\n\n/**\n * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.\n *\n * @param aliases - An array of argument aliases to sort.\n * @returns A new array of sorted aliases.\n */\nexport function sortArgAliases(aliases: string[]): string[] {\n if (aliases.length === 0) {\n return [];\n }\n\n const result = aliases.filter(alias => alias.length === 1);\n result.push(...aliases.filter(alias => alias.length > 1));\n\n return result.sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Retrieves the application name from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application name in kebab-case format.\n * @throws An error if no valid application name is found.\n */\nexport function getAppName(context: UnresolvedContext | Context): string {\n const result =\n context.config.name ||\n (isSetString(context.config.bin) ||\n (Array.isArray(context.config.bin) &&\n context.config.bin.length > 0 &&\n isSetString(context.config.bin[0]))\n ? isSetString(context.config.bin)\n ? context.config.bin\n : context.config.bin[0]\n : context.packageJson?.name);\n if (!isSetString(result)) {\n throw new Error(\n \"No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.\"\n );\n }\n\n return kebabCase(result);\n}\n\n/**\n * Retrieves the application title from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @param replaceCLI - Whether to replace CLI-related terms in the title with the application name.\n * @returns The application title in title-case format.\n */\nexport function getAppTitle(\n context: UnresolvedContext | Context,\n replaceCLI = false\n): string {\n const title =\n context.config.title ||\n titleCase(context.config.name || getAppName(context));\n\n return (\n replaceCLI\n ? title.replace(\n /(?:cli|command-line|command line)\\s*(?:interface\\s*)?(?:application|app)?$/gi,\n \"\"\n )\n : title\n ).trim();\n}\n\n/**\n * Retrieves the application description from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application description.\n */\nexport function getAppDescription(\n context: UnresolvedContext | Context\n): string {\n return (\n context.config.description ||\n context.packageJson?.description ||\n `The ${getAppTitle(context, true)} command-line interface application.`\n );\n}\n\n/**\n * Retrieves the primary binary name for the application.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The primary binary name as a string.\n */\nexport function getAppBin(context: Context): string {\n return isSetObject(context.config.bin)\n ? Object.keys(context.config.bin)[0]!\n : kebabCase(getAppName(context));\n}\n\n/**\n * Determines if a given command path segment is variable (enclosed in square brackets).\n *\n * @example\n * ```typescript\n * isDynamicPathSegment(\"[user]\"); // true\n * isDynamicPathSegment(\"user\"); // false\n * ```\n *\n * @param path - The command path segment to check.\n * @returns True if the path is variable, false otherwise.\n */\nexport function isDynamicPathSegment(path: string): boolean {\n return path.startsWith(\"[\") && path.endsWith(\"]\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @example\n * ```typescript\n * getDynamicPathSegmentName(\"[user]\"); // \"user\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getDynamicPathSegmentName(path: string): string {\n return path.replaceAll(/^\\[+/g, \"\").replaceAll(/\\]+$/g, \"\");\n}\n\n/**\n * Determines if a given command path segment is a path segment group (enclosed in parentheses).\n *\n * @example\n * ```typescript\n * isPathSegmentGroup(\"(user)\"); // true\n * isPathSegmentGroup(\"[user]\"); // false\n * isPathSegmentGroup(\"user\"); // false\n * ```\n *\n * @param path - The command path segment to check.\n * @returns True if the path is a path segment group, false otherwise.\n */\nexport function isPathSegmentGroup(path: string): boolean {\n return (path.startsWith(\"(\") && path.endsWith(\")\")) || path.startsWith(\"_\");\n}\n\n/**\n * Extracts the group name from a command path segment by removing enclosing parentheses.\n *\n * @example\n * ```typescript\n * getPathSegmentGroupName(\"(admin)\"); // \"admin\"\n * getPathSegmentGroupName(\"((group))\"); // \"group\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The group name without parentheses.\n */\nexport function getPathSegmentGroupName(path: string): string {\n return path\n .replaceAll(/^\\(+/g, \"\")\n .replaceAll(/\\)+$/g, \"\")\n .replaceAll(/^_+/g, \"\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @example\n * ```typescript\n * getDynamicPathSegmentName(\"[user]\"); // \"user\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getPathSegmentName(path: string): string {\n return getPathSegmentGroupName(getDynamicPathSegmentName(path));\n}\n"],"mappings":";;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AA6BX,SAAc,eAAc,SAAA;AACxB,KAAA,QAAS,WAAA,EACX,QAAA,EAAA;CAEA,MAAM,SAAS,QAAQ,OAAO,cAAe,UAAS,MAAI,WAAA,GAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;AAC1D,QAAO,KAAO,GAAC,QAAQ,OAAO,cAAe,UAAS,MAAG,SAAA,GAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;;;;;;;AAG3D,eAAA,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQA,SAAE,WAAA,SAAA;CACF,MAAO,SAAS,QAAW,OAAO,SAC1B,YAAO,QAAA,OAAA,IAAA,IACH,MAAO,QAAM,QAAA,OAAA,IAAA,IACT,QAAQ,OAAO,IAAI,SAAG,KAC3B,YAAgB,QAAO,OAAM,IAAA,GAAA,GAC1B,YAAW,QAAS,OAAG,IAAA,GACnB,QAAQ,OAAO,MACzB,QAAY,OAAQ,IAAO,KACzB,QAAQ,aAAO;AACrB,KAAI,CAAC,YAAS,OAAU,CACpB,OAAA,IAAQ,MAAA,qIAAkB;AAE9B,QAAM,UAAS,OAAA;;AAEnB,WAAK,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQL,SAAC,YAAA,SAAA,aAAA,OAAA;CACG,MAAM,QAAQ,QAAM,OAAM,SAC1B,UAAM,QAAa,OAAU,QAAQ,WAAK,QAAc,CAAA;AACxD,SAAQ,aACV,MAAA,QAAA,gFAAA,GAAA,GACK,OAAS,MAAA;;AAEhB,YAAY,SAAG;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOf,SAAI,kBAAA,SAAA;AACA,QAAI,QAAM,OAAO,eACb,QAAM,aAAY,eAClB,OAAG,YAAA,SAAA,KAAA,CAAA;;AAEX,kBAAQ,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOR,SAAU,UAAc,SAAM;AAC1B,QAAO,YAAK,QAAY,OAAA,IAAW,GACrC,OAAA,KAAA,QAAA,OAAA,IAAA,CAAA,KACK,UAAS,WAAA,QAAiB,CAAA;;AAEjC,UAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;;AAaV,SAAE,qBAAA,MAAA;AACF,QAAO,KAAS,WAAU,IAAA,IAAS,KAAA,SAAU,IAAO;;AAEpD,qBAAkB,SAAQ;CAAA;CAAa;CAAC;CAAA;;;;;;;;;;;;AAYxC,SAAC,0BAAA,MAAA;AACG,QAAM,KAAM,WAAK,SAAa,GAAA,CAAA,WAAgB,SAAA,GAAA;;AAElD,0BAAE,SAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;;;AAcF,SAAgB,mBAAc,MAAQ;AACpC,QAAA,KAAA,WAAA,IAAA,IAAA,KAAA,SAAA,IAAA,IAAA,KAAA,WAAA,IAAA;;AAEF,mBAAc,SAAc;CAAC;CAAQ;CAAsB;CAAE;;;;;;;;;;;;;AAa7D,SAAgB,wBAAkB,MAAW;AACzC,QAAO,KACT,WAAA,SAAA,GAAA,CACK,WAAS,SAAA,GAAA,CACP,WAAM,QAAa,GAAG;;;;;;;;;;;;;;;;;;AAc/B,SAAE,mBAAA,MAAA;AACF,QAAO,wBAAS,0BAA6C,KAAC,CAAA;;AAE9D,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-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\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport type { Context, UnresolvedContext } from \"../types\";\n\n/**\n * Sorts command argument aliases, placing single-character aliases first, followed by multi-character aliases, and then sorting them alphabetically.\n *\n * @param aliases - An array of argument aliases to sort.\n * @returns A new array of sorted aliases.\n */\nexport function sortArgAliases(aliases: string[]): string[] {\n if (aliases.length === 0) {\n return [];\n }\n\n const result = aliases.filter(alias => alias.length === 1);\n result.push(...aliases.filter(alias => alias.length > 1));\n\n return result.sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * Retrieves the application name from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application name in kebab-case format.\n * @throws An error if no valid application name is found.\n */\nexport function getAppName(context: UnresolvedContext | Context): string {\n const result =\n context.config.name ||\n (isSetString(context.config.bin) ||\n (Array.isArray(context.config.bin) &&\n context.config.bin.length > 0 &&\n isSetString(context.config.bin[0]))\n ? isSetString(context.config.bin)\n ? context.config.bin\n : context.config.bin[0]\n : context.packageJson?.name);\n if (!isSetString(result)) {\n throw new Error(\n \"No application name found. Please provide a 'bin' option in the configuration or ensure the package.json has a valid 'name' field.\"\n );\n }\n\n return kebabCase(result);\n}\n\n/**\n * Retrieves the application title from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @param replaceCLI - Whether to replace CLI-related terms in the title with the application name.\n * @returns The application title in title-case format.\n */\nexport function getAppTitle(\n context: UnresolvedContext | Context,\n replaceCLI = false\n): string {\n const title =\n context.config.title ||\n titleCase(context.config.name || getAppName(context));\n\n return (\n replaceCLI\n ? title.replace(\n /(?:cli|command-line|command line)\\s*(?:interface\\s*)?(?:application|app)?$/gi,\n \"\"\n )\n : title\n ).trim();\n}\n\n/**\n * Retrieves the application description from the context and configuration.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The application description.\n */\nexport function getAppDescription(\n context: UnresolvedContext | Context\n): string {\n return (\n context.config.description ||\n context.packageJson?.description ||\n `The ${getAppTitle(context, true)} command-line interface application.`\n );\n}\n\n/**\n * Retrieves the primary binary name for the application.\n *\n * @param context - The build context containing workspace and package information.\n * @returns The primary binary name as a string.\n */\nexport function getAppBin(context: Context): string {\n return isSetObject(context.config.bin)\n ? Object.keys(context.config.bin)[0]!\n : kebabCase(getAppName(context));\n}\n\n/**\n * Determines if a given command path segment is variable (enclosed in square brackets).\n *\n * @example\n * ```typescript\n * isDynamicPathSegment(\"[user]\"); // true\n * isDynamicPathSegment(\"user\"); // false\n * ```\n *\n * @param path - The command path segment to check.\n * @returns True if the path is variable, false otherwise.\n */\nexport function isDynamicPathSegment(path: string): boolean {\n return path.startsWith(\"[\") && path.endsWith(\"]\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @example\n * ```typescript\n * getDynamicPathSegmentName(\"[user]\"); // \"user\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getDynamicPathSegmentName(path: string): string {\n return path.replaceAll(/^\\[+/g, \"\").replaceAll(/\\]+$/g, \"\");\n}\n\n/**\n * Determines if a given command path segment is a path segment group (enclosed in parentheses).\n *\n * @example\n * ```typescript\n * isPathSegmentGroup(\"(user)\"); // true\n * isPathSegmentGroup(\"[user]\"); // false\n * isPathSegmentGroup(\"user\"); // false\n * ```\n *\n * @param path - The command path segment to check.\n * @returns True if the path is a path segment group, false otherwise.\n */\nexport function isPathSegmentGroup(path: string): boolean {\n return (path.startsWith(\"(\") && path.endsWith(\")\")) || path.startsWith(\"_\");\n}\n\n/**\n * Extracts the group name from a command path segment by removing enclosing parentheses.\n *\n * @example\n * ```typescript\n * getPathSegmentGroupName(\"(admin)\"); // \"admin\"\n * getPathSegmentGroupName(\"((group))\"); // \"group\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The group name without parentheses.\n */\nexport function getPathSegmentGroupName(path: string): string {\n return path\n .replaceAll(/^\\(+/g, \"\")\n .replaceAll(/\\)+$/g, \"\")\n .replaceAll(/^_+/g, \"\");\n}\n\n/**\n * Extracts the variable name from a command path segment by removing enclosing square brackets.\n *\n * @example\n * ```typescript\n * getDynamicPathSegmentName(\"[user]\"); // \"user\"\n * ```\n *\n * @param path - The command path segment.\n * @returns The variable name without square brackets.\n */\nexport function getPathSegmentName(path: string): string {\n return getPathSegmentGroupName(getDynamicPathSegmentName(path));\n}\n"],"mappings":";;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;;;;AA6BX,SAAc,eAAc,SAAA;AACxB,KAAA,QAAS,WAAA,EACX,QAAA,EAAA;CAEA,MAAM,SAAS,QAAQ,OAAO,cAAe,UAAS,MAAI,WAAA,GAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;AAC1D,QAAO,KAAO,GAAC,QAAQ,OAAO,cAAe,UAAS,MAAG,SAAA,GAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;;;;;;;;AAG3D,eAAA,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQA,SAAE,WAAA,SAAA;CACF,MAAO,SAAS,QAAW,OAAO,SAC1B,YAAO,QAAA,OAAA,IAAA,IACH,MAAO,QAAM,QAAA,OAAA,IAAA,IACT,QAAQ,OAAO,IAAI,SAAG,KAC3B,YAAgB,QAAO,OAAM,IAAA,GAAA,GAC1B,YAAW,QAAS,OAAG,IAAA,GACnB,QAAQ,OAAO,MACzB,QAAY,OAAQ,IAAO,KACzB,QAAQ,aAAO;AACrB,KAAI,CAAC,YAAS,OAAU,CACpB,OAAA,IAAQ,MAAA,qIAAkB;AAE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O,KACT,WAAA,SAAA,GAAA,CACK,WAAS,SAAA,GAAA,CACP,WAAM,QAAa,GAAG;;;;;;;;;;;;;;;;;;;AAc/B,SAAE,mBAAA,MAAA;AACF,QAAO,wBAAS,0BAA6C,KAAC,CAAA;;AAE9D,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -23,9 +23,9 @@ extractReflectionKind.__type = [
23
23
  "CommandParameterKind",
24
24
  "command",
25
25
  "checkVariadic",
26
- () => _powerlines_deepkit_vendor_type.__ΩReflectionKind,
27
26
  "extractReflectionKind",
28
- "PP\"w!\"w\"J2#\"2$n%/&"
27
+ "Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.",
28
+ "PP\"w!\"w\"J2#\"2$!/%?&"
29
29
  ];
30
30
  /**
31
31
  * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
@@ -61,12 +61,11 @@ extractType.__type = [
61
61
  "CommandParameterKind",
62
62
  "command",
63
63
  "checkVariadic",
64
- "Type",
65
64
  "extractType",
66
- "PP\"w!\"w\"J2#\"2$\"w%/&"
65
+ "Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.",
66
+ "PP\"w!\"w\"J2#\"2$!/%?&"
67
67
  ];
68
68
 
69
69
  //#endregion
70
70
  exports.extractReflectionKind = extractReflectionKind;
71
- exports.extractType = extractType;
72
- //# sourceMappingURL=deepkit.cjs.map
71
+ exports.extractType = extractType;
@@ -1,7 +1,7 @@
1
1
  import { CommandParameterKinds } from "../types/command.mjs";
2
2
  import { isCommandParameterKind } from "./type-checks.mjs";
3
3
  import { isSetObject } from "@stryke/type-checks/is-set-object";
4
- import { ReflectionKind, __ΩReflectionKind } from "@powerlines/deepkit/vendor/type";
4
+ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
5
5
 
6
6
  //#region src/plugin-utils/deepkit.ts
7
7
  /**
@@ -22,9 +22,9 @@ extractReflectionKind.__type = [
22
22
  "CommandParameterKind",
23
23
  "command",
24
24
  "checkVariadic",
25
- () => __ΩReflectionKind,
26
25
  "extractReflectionKind",
27
- "PP\"w!\"w\"J2#\"2$n%/&"
26
+ "Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.",
27
+ "PP\"w!\"w\"J2#\"2$!/%?&"
28
28
  ];
29
29
  /**
30
30
  * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.
@@ -60,9 +60,9 @@ extractType.__type = [
60
60
  "CommandParameterKind",
61
61
  "command",
62
62
  "checkVariadic",
63
- "Type",
64
63
  "extractType",
65
- "PP\"w!\"w\"J2#\"2$\"w%/&"
64
+ "Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.",
65
+ "PP\"w!\"w\"J2#\"2$!/%?&"
66
66
  ];
67
67
 
68
68
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/plugin-utils/deepkit.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 { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAcC,KAAK,uBAAqB,QAAS,gDAE3B,YAAY,QAAQ,kDAEtB,QAAO,iBAAc,QAAW,WAC9B,eAAiB,QACjB,eAAoB;UAE3B,uBAAoB,QAAA,IACpB,YAAA,sBAAoB,UACpB,YAAA,QAAA,IACS,QAAM,SAAQ,sBAAA,OACjB,QAAC,iBAAuB,QAAQ,WAC/B,eAAA;UAGK,uBAAuB,QAAQ,IAC5C,YAAA,sBAAA,WACQ,YAAW,QAAI,IAAQ,QAAS,SAAS,sBAAe,QAC7D,QAAM,eAAgB;KAGnB,QAAQ,eAAC;;AAGhB,sBAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;AAQlB,SAAQ,YAAe,SAAA,gBAAA,MAAA;CACnB,MAAI,iBAAe,sBAAM,SAAA,cAAA;AACzB,KAAI,mBAAI,eAAA,OACP,QAAA,EAAA,MAAA,eAAiC,QAAA;UAEjC,mBAAuB,eAAA,OACrB,QAAQ,EAAE,MAAC,eAAoB,QAAQ;UAEnC,mBAAkB,eAAgB,QACrC,QAAA,EAAA,MAAe,eAAA,SAAA;UAEX,mBAAA,eAAA,MACP,KAAA,uBAA8B,QAAG,CAChC,QAAY;EACF,MAAC,eAAoB;EACjC,MAAA,YAAA,EACO,MAAe,SACjB,EAAA,MAAA;EACE;UAEX,YAAA,QAAA;EAEE,MAAA,eAAA;EACc,MAAK,YAAa;GACjC,GAAA;GACmB,MAAI,QAAQ;GACtB,EAAA,MAAe;EACb;KAGD,QAAA;EACK,MAAE,eAAA;EACV,MAAA,EAAA,MAAA,eAAA,QAAA;EACA;KAIJ,QAAS,EAAI,MAAE,eAAe,QAAQ;;AAG1C,YAAY,SAAC;CAAA;CAAiC;CAAQ;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"deepkit.mjs","names":[],"sources":["../../src/plugin-utils/deepkit.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 { Type } from \"@powerlines/deepkit/vendor/type\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type {\n BaseCommandParameter,\n CommandParameterKind,\n StringCommandParameter\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\nimport { isCommandParameterKind } from \"./type-checks\";\n\n/**\n * Extracts a {@link ReflectionKind} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the reflection kind from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link ReflectionKind}.\n */\nexport function extractReflectionKind(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): ReflectionKind {\n if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.string) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.string)\n ) {\n return checkVariadic && (command as StringCommandParameter).variadic\n ? ReflectionKind.array\n : ReflectionKind.string;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.number) ||\n (isSetObject(command as BaseCommandParameter) &&\n (command as BaseCommandParameter).kind === CommandParameterKinds.number)\n ) {\n return checkVariadic && (command as any).variadic\n ? ReflectionKind.array\n : ReflectionKind.number;\n } else if (\n (isCommandParameterKind(command) &&\n command === CommandParameterKinds.boolean) ||\n (isSetObject(command) && command.kind === CommandParameterKinds.boolean)\n ) {\n return ReflectionKind.boolean;\n } else {\n return ReflectionKind.string;\n }\n}\n\n/**\n * Extracts a {@link Type} from a {@link BaseCommandParameter} or {@link CommandParameterKind}.\n *\n * @param command - The command parameter or kind to extract the type from.\n * @param checkVariadic - Whether to check for variadic parameters (arrays).\n * @returns The extracted {@link Type}.\n */\nexport function extractType(\n command: BaseCommandParameter | CommandParameterKind,\n checkVariadic = true\n): Type {\n const reflectionKind = extractReflectionKind(command, checkVariadic);\n if (reflectionKind === ReflectionKind.string) {\n return { kind: ReflectionKind.string };\n } else if (reflectionKind === ReflectionKind.number) {\n return { kind: ReflectionKind.number };\n } else if (reflectionKind === ReflectionKind.boolean) {\n return { kind: ReflectionKind.boolean };\n } else if (reflectionKind === ReflectionKind.array) {\n if (isCommandParameterKind(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n kind: command\n } as BaseCommandParameter,\n false\n )\n };\n } else if (isSetObject(command)) {\n return {\n kind: ReflectionKind.array,\n type: extractType(\n {\n ...command,\n kind: command.kind\n } as BaseCommandParameter,\n false\n )\n };\n } else {\n return {\n kind: ReflectionKind.array,\n type: { kind: ReflectionKind.string }\n };\n }\n } else {\n return { kind: ReflectionKind.string };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA6BE,KAAA,uBAAA,QAAA,IACC,YAAiB,sBAAsB,UACzC,YAAA,QAAA,IACS,QAAU,SAAI,sBAA0B,OAC9C,QAAM,iBAAgB,QAAW,WACzB,eAAgB,QAC1B,eAAA;UAES,uBAAuB,QAAA,IAChC,YAAgB,sBAAA,UACf,YAAe,QAAA,IACb,QAAA,SAAA,sBAAA,OACA,QAAA,iBAAuB,QAAU,WACxB,eAAI,QACb,eAAuB;UAExB,uBAAA,QAAA,IACA,YAAO,sBAA6B,WAChC,YAAA,QAAe,IAAA,QAAA,SAAA,sBAAA,QACf,QAAA,eAAqB;KAGvB,QAAS,eAAG;;AAGlB,sBAAI,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQJ,SAAI,YAAA,SAAA,gBAAA,MAAA;CACA,MAAM,iBAAgB,sBAAO,SAAA,cAAA;AAC7B,KAAI,mBAAC,eAAA,OACL,QAAO,EAAA,MAAA,eAAqB,QAAA;UAEhC,mBAAA,eAAA;UAGa,mBAAmB,eAAS,QACxC,QAAA,EAAA,MAAA,eAAA,SAAA;UAES,mBAAgB,eAAqB,MAC3C,KAAQ,uBAAqB,QAAK,CACpC,QAAA;EACc,MAAA,eAAW;EAChB,MAAA,YAAuB,EAChB,MAAA,SACV,EAAA,MAAA;EACA;UAES,YAAE,QAAe,CACtB,QAAC;EACA,MAAM,eAAe;EACrB,MAAA,YAAmB;GACb,GAAA;GACN,MAAA,QAAmB;GACxB,EAAA,MAAA;EACK;KAGH,QAAA;EACM,MAAE,eAAA;EACH,MAAA,EAAA,MAAA,eAAoB,QAAA;EACzB;KAIJ,QAAO,EAAA,MAAA,eAAA,QAAA;;AAGb,YAAU,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -3,9 +3,11 @@
3
3
  const __ΩFormatDescriptionOptions = [
4
4
  "replaceNewlines",
5
5
  true,
6
+ "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.",
6
7
  "collapseWhitespace",
8
+ "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.",
7
9
  "FormatDescriptionOptions",
8
- "P)4!8>\")4#8>\"Mw$y"
10
+ "P)4!8>\"?#)4$8>\"?%Mw&y"
9
11
  ];
10
12
  /**
11
13
  * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
@@ -28,7 +30,8 @@ formatDescriptionWhitespace.__type = [
28
30
  "options",
29
31
  () => ({}),
30
32
  "formatDescriptionWhitespace",
31
- "P&2!n\"2#>$&/%"
33
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
34
+ "P&2!n\"2#>$&/%?&"
32
35
  ];
33
36
  /**
34
37
  * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
@@ -45,7 +48,8 @@ function formatDescriptionEscapes(description) {
45
48
  formatDescriptionEscapes.__type = [
46
49
  "description",
47
50
  "formatDescriptionEscapes",
48
- "P&2!&/\""
51
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
52
+ "P&2!&/\"?#"
49
53
  ];
50
54
  /**
51
55
  * Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.
@@ -65,14 +69,16 @@ formatDescription.__type = [
65
69
  "options",
66
70
  () => ({}),
67
71
  "formatDescription",
68
- "P&2!n\"2#>$&/%"
72
+ "Formats a description string by trimming whitespace, replacing newlines with spaces (optionally), collapsing multiple spaces into a single space (optionally), and escaping special characters.",
73
+ "P&2!n\"2#>$&/%?&"
69
74
  ];
70
75
  const __ΩFormatShortDescriptionOptions = [
71
76
  () => __ΩFormatDescriptionOptions,
72
77
  "length",
73
78
  62,
79
+ "The maximum length of the short description. If the first sentence exceeds this length, it will be truncated.",
74
80
  "FormatShortDescriptionOptions",
75
- "Pn!'4\"8>#Mw$y"
81
+ "Pn!'4\"8>#?$Mw%y"
76
82
  ];
77
83
  /**
78
84
  * Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.
@@ -94,12 +100,12 @@ formatShortDescription.__type = [
94
100
  "options",
95
101
  () => ({}),
96
102
  "formatShortDescription",
97
- "P&2!n\"2#>$&/%"
103
+ "Extracts the short description from a longer description string. The short description is typically the first sentence or the first line of the description.",
104
+ "P&2!n\"2#>$&/%?&"
98
105
  ];
99
106
 
100
107
  //#endregion
101
108
  exports.__ΩFormatDescriptionOptions = __ΩFormatDescriptionOptions;
102
109
  exports.__ΩFormatShortDescriptionOptions = __ΩFormatShortDescriptionOptions;
103
110
  exports.formatDescription = formatDescription;
104
- exports.formatShortDescription = formatShortDescription;
105
- //# sourceMappingURL=description-helpers.cjs.map
111
+ exports.formatShortDescription = formatShortDescription;