@shell-shock/core 0.17.2 → 0.17.4

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 (138) 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 +91 -99
  9. package/dist/components/exec-builtin.mjs +90 -97
  10. package/dist/components/exec-builtin.mjs.map +1 -1
  11. package/dist/components/helpers.cjs +1 -2
  12. package/dist/components/options-parser-logic.cjs +1 -2
  13. package/dist/components/state-builtin.cjs +2 -3
  14. package/dist/components/state-builtin.mjs +2 -2
  15. package/dist/components/state-builtin.mjs.map +1 -1
  16. package/dist/components/usage.cjs +1 -2
  17. package/dist/components/utils-builtin.cjs +2 -17
  18. package/dist/components/utils-builtin.mjs +1 -15
  19. package/dist/components/utils-builtin.mjs.map +1 -1
  20. package/dist/config.cjs +3 -3
  21. package/dist/config.mjs +2 -1
  22. package/dist/contexts/command.cjs +6 -3
  23. package/dist/contexts/command.mjs +5 -1
  24. package/dist/contexts/command.mjs.map +1 -1
  25. package/dist/contexts/options.cjs +7 -4
  26. package/dist/contexts/options.mjs +5 -1
  27. package/dist/contexts/options.mjs.map +1 -1
  28. package/dist/helpers/automd.cjs +1 -2
  29. package/dist/helpers/docs-helpers.cjs +3 -3
  30. package/dist/helpers/docs-helpers.mjs +2 -1
  31. package/dist/helpers/docs-helpers.mjs.map +1 -1
  32. package/dist/helpers/paths.cjs +3 -3
  33. package/dist/helpers/paths.mjs +2 -1
  34. package/dist/helpers/paths.mjs.map +1 -1
  35. package/dist/helpers/persistence.cjs +7 -5
  36. package/dist/helpers/persistence.mjs +6 -3
  37. package/dist/helpers/persistence.mjs.map +1 -1
  38. package/dist/helpers/update-package-json.cjs +1 -2
  39. package/dist/helpers/utilities.cjs +3 -3
  40. package/dist/helpers/utilities.mjs +2 -1
  41. package/dist/helpers/utilities.mjs.map +1 -1
  42. package/dist/helpers/validations.cjs +1 -2
  43. package/dist/plugin-utils/context-helpers.cjs +21 -12
  44. package/dist/plugin-utils/context-helpers.mjs +20 -10
  45. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  46. package/dist/plugin-utils/deepkit.cjs +5 -6
  47. package/dist/plugin-utils/deepkit.mjs +5 -5
  48. package/dist/plugin-utils/deepkit.mjs.map +1 -1
  49. package/dist/plugin-utils/description-helpers.cjs +14 -8
  50. package/dist/plugin-utils/description-helpers.mjs +13 -6
  51. package/dist/plugin-utils/description-helpers.mjs.map +1 -1
  52. package/dist/plugin-utils/get-command-tree.cjs +5 -4
  53. package/dist/plugin-utils/get-command-tree.mjs +4 -2
  54. package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
  55. package/dist/plugin-utils/reflect.cjs +3 -3
  56. package/dist/plugin-utils/reflect.mjs +2 -1
  57. package/dist/plugin-utils/traverse-command-tree.cjs +5 -4
  58. package/dist/plugin-utils/traverse-command-tree.mjs +4 -2
  59. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
  60. package/dist/plugin-utils/type-checks.cjs +11 -7
  61. package/dist/plugin-utils/type-checks.mjs +10 -5
  62. package/dist/plugin-utils/type-checks.mjs.map +1 -1
  63. package/dist/plugin.cjs +8 -5
  64. package/dist/plugin.d.cts.map +1 -1
  65. package/dist/plugin.d.mts.map +1 -1
  66. package/dist/plugin.mjs +7 -4
  67. package/dist/plugin.mjs.map +1 -1
  68. package/dist/resolver/deepkit.cjs +4 -9
  69. package/dist/resolver/deepkit.mjs +4 -8
  70. package/dist/resolver/deepkit.mjs.map +1 -1
  71. package/dist/resolver/helpers.cjs +5 -4
  72. package/dist/resolver/helpers.mjs +4 -2
  73. package/dist/resolver/helpers.mjs.map +1 -1
  74. package/dist/resolver/module.cjs +1 -2
  75. package/dist/resolver/resolve.cjs +8 -5
  76. package/dist/resolver/resolve.mjs +7 -3
  77. package/dist/resolver/resolve.mjs.map +1 -1
  78. package/dist/types/command.cjs +65 -12
  79. package/dist/types/command.d.cts +9 -1
  80. package/dist/types/command.d.cts.map +1 -1
  81. package/dist/types/command.d.mts +9 -1
  82. package/dist/types/command.d.mts.map +1 -1
  83. package/dist/types/command.mjs +64 -10
  84. package/dist/types/command.mjs.map +1 -1
  85. package/dist/types/config.cjs +20 -7
  86. package/dist/types/config.d.cts +3 -2
  87. package/dist/types/config.d.cts.map +1 -1
  88. package/dist/types/config.d.mts +3 -2
  89. package/dist/types/config.d.mts.map +1 -1
  90. package/dist/types/config.mjs +19 -5
  91. package/dist/types/config.mjs.map +1 -1
  92. package/dist/types/context.cjs +6 -3
  93. package/dist/types/context.mjs +5 -1
  94. package/dist/types/env.cjs +38 -3
  95. package/dist/types/env.d.cts +3 -1
  96. package/dist/types/env.d.cts.map +1 -1
  97. package/dist/types/env.d.mts +3 -1
  98. package/dist/types/env.d.mts.map +1 -1
  99. package/dist/types/env.mjs +37 -1
  100. package/dist/types/env.mjs.map +1 -1
  101. package/dist/types/options.cjs +1 -2
  102. package/package.json +11 -11
  103. package/dist/api.cjs.map +0 -1
  104. package/dist/components/command-validation-logic.cjs.map +0 -1
  105. package/dist/components/docs.cjs.map +0 -1
  106. package/dist/components/exec-builtin.cjs.map +0 -1
  107. package/dist/components/helpers.cjs.map +0 -1
  108. package/dist/components/options-parser-logic.cjs.map +0 -1
  109. package/dist/components/state-builtin.cjs.map +0 -1
  110. package/dist/components/usage.cjs.map +0 -1
  111. package/dist/components/utils-builtin.cjs.map +0 -1
  112. package/dist/config.cjs.map +0 -1
  113. package/dist/contexts/command.cjs.map +0 -1
  114. package/dist/contexts/options.cjs.map +0 -1
  115. package/dist/helpers/automd.cjs.map +0 -1
  116. package/dist/helpers/docs-helpers.cjs.map +0 -1
  117. package/dist/helpers/paths.cjs.map +0 -1
  118. package/dist/helpers/persistence.cjs.map +0 -1
  119. package/dist/helpers/update-package-json.cjs.map +0 -1
  120. package/dist/helpers/utilities.cjs.map +0 -1
  121. package/dist/helpers/validations.cjs.map +0 -1
  122. package/dist/plugin-utils/context-helpers.cjs.map +0 -1
  123. package/dist/plugin-utils/deepkit.cjs.map +0 -1
  124. package/dist/plugin-utils/description-helpers.cjs.map +0 -1
  125. package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
  126. package/dist/plugin-utils/reflect.cjs.map +0 -1
  127. package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
  128. package/dist/plugin-utils/type-checks.cjs.map +0 -1
  129. package/dist/plugin.cjs.map +0 -1
  130. package/dist/resolver/deepkit.cjs.map +0 -1
  131. package/dist/resolver/helpers.cjs.map +0 -1
  132. package/dist/resolver/module.cjs.map +0 -1
  133. package/dist/resolver/resolve.cjs.map +0 -1
  134. package/dist/types/command.cjs.map +0 -1
  135. package/dist/types/config.cjs.map +0 -1
  136. package/dist/types/context.cjs.map +0 -1
  137. package/dist/types/env.cjs.map +0 -1
  138. package/dist/types/options.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,mBAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,WAAW,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,WAAA,uBAAA;;AAEvB,mBAAS,SAAA,CAAA,sBAAuC,QAAQ;;AAEtD,QAAA,QAAA,OAAA,cAAA,KAAA,WAAA;AACK,MAAA,UAAW,OAAU,KAAA,MAAY,OAAI,EAC1C,MAAA,UAAA,OAAA,KAAA,EACK,EAAA,IAAM,OAAA,SAAA,EAAA,EAAsB,OAAE;AACnC,MAAA,OAAA,SAA0B,sBAAsB,+BAEhD,KAAA,UAAA,OAAA,aAAA,IAAA,OAAA,EACS,MAAW,UAAA,OAAgB,aAAO,EAC5C,EAAA,IAAA,OAAA,iBAAA,EAAA,EAAA;GACG,GAAA;GACY,KAAA,YAAgB,OAAG,IAAO,GAAK,MAAM,OAAO,QAAO;GAClE,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,OAAA,KAAA;GACa,cAAgB,UAAQ,OAAQ,KAAA;GAC5C,SAAA,CAAA,OAAA;GACK,CAAA;AAEP,SAAA;;;;;;;;AAGA,gBAAgB,SAAO;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { BooleanCommandOption, CommandOption } from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(options: CommandOption[]) {\n return options.reduce(\n (ret, option) => {\n ret[camelCase(option.name)] ??= defu(\n {\n name: camelCase(option.name)\n },\n ret[option.name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${option.name}.`,\n isNegativeOf: camelCase(option.name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,mBAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,WAAW,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,WAAA,uBAAA;;AAEvB,mBAAS,SAAA;CAAA;CAAuC;CAAQ;CAAA;;AAEtD,QAAA,QAAA,OAAA,cAAA,KAAA,WAAA;AACK,MAAA,UAAW,OAAU,KAAA,MAAY,OAAI,EAC1C,MAAA,UAAA,OAAA,KAAA,EACK,EAAA,IAAM,OAAA,SAAA,EAAA,EAAsB,OAAE;AACnC,MAAA,OAAA,SAA0B,sBAAsB,+BAEhD,KAAA,UAAA,OAAA,aAAA,IAAA,OAAA,EACS,MAAW,UAAA,OAAgB,aAAO,EAC5C,EAAA,IAAA,OAAA,iBAAA,EAAA,EAAA;GACG,GAAA;GACY,KAAA,YAAgB,OAAG,IAAO,GAAK,MAAM,OAAO,QAAO;GAClE,aAAA,GAAA,OAAA,YAAA,QAAA,QAAA,GAAA,CAAA,0CAAA,OAAA,KAAA;GACa,cAAgB,UAAQ,OAAQ,KAAA;GAC5C,SAAA,CAAA,OAAA;GACK,CAAA;AAEP,SAAA;;;;;;;;AAGA,gBAAgB,SAAO;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -53,5 +53,4 @@ const commands = (context) => (0, automd.defineGenerator)({
53
53
  });
54
54
 
55
55
  //#endregion
56
- exports.commands = commands;
57
- //# sourceMappingURL=automd.cjs.map
56
+ exports.commands = commands;
@@ -15,9 +15,9 @@ getDocsOutputPath.__type = [
15
15
  "Context",
16
16
  "context",
17
17
  "getDocsOutputPath",
18
- "P\"w!2\"&/#"
18
+ "Gets the output path for the generated documentation.",
19
+ "P\"w!2\"&/#?$"
19
20
  ];
20
21
 
21
22
  //#endregion
22
- exports.getDocsOutputPath = getDocsOutputPath;
23
- //# sourceMappingURL=docs-helpers.cjs.map
23
+ exports.getDocsOutputPath = getDocsOutputPath;
@@ -14,7 +14,8 @@ getDocsOutputPath.__type = [
14
14
  "Context",
15
15
  "context",
16
16
  "getDocsOutputPath",
17
- "P\"w!2\"&/#"
17
+ "Gets the output path for the generated documentation.",
18
+ "P\"w!2\"&/#?$"
18
19
  ];
19
20
 
20
21
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,QAAO,UAAK,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA"}
1
+ {"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,QAAO,UAAK,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA;CAAA"}
@@ -49,7 +49,8 @@ function resolveCommandName(file) {
49
49
  resolveCommandName.__type = [
50
50
  "file",
51
51
  "resolveCommandName",
52
- "P&2!\"/\""
52
+ "Finds the command name from the given file path.",
53
+ "P&2!\"/\"?#"
53
54
  ];
54
55
  function resolveCommandPath(context, file) {
55
56
  return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !require_context_helpers.isPathSegmentGroup(path), [
@@ -133,5 +134,4 @@ findCommandsRoot.__type = [
133
134
  exports.findCommandsRoot = findCommandsRoot;
134
135
  exports.resolveCommandId = resolveCommandId;
135
136
  exports.resolveCommandName = resolveCommandName;
136
- exports.resolveCommandPath = resolveCommandPath;
137
- //# sourceMappingURL=paths.cjs.map
137
+ exports.resolveCommandPath = resolveCommandPath;
@@ -48,7 +48,8 @@ function resolveCommandName(file) {
48
48
  resolveCommandName.__type = [
49
49
  "file",
50
50
  "resolveCommandName",
51
- "P&2!\"/\""
51
+ "Finds the command name from the given file path.",
52
+ "P&2!\"/\"?#"
52
53
  ];
53
54
  function resolveCommandPath(context, file) {
54
55
  return replacePath(findFilePath(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !isPathSegmentGroup(path), [
@@ -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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EAAA;AAC1B,iBAAA,UAAA,QAAA,OAAA,MAAA,WAAA;AACD,MAAA,CAAA,WAAA,aAAA,EAAA;AACO,kBAAA,UAAA,QAAA,OAAA,MAAA,MAAA;AACF,OAAA,CAAO,WAAS,aAAe,CAC7B,gBAAmB,QAAG,OAAA;;;AAI9B,UAAI,MAAQ,QAAO,IAAM,CACrB,UAAE,UAAS,WAAA,cAAA,QAAA,gBAAA,cAAA,EAAA,gBAAA,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,E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QAAA,OAAA,MAAA,MAAA;AACF,OAAA,CAAO,WAAS,aAAe,CAC7B,gBAAmB,QAAG,OAAA;;;AAI9B,UAAI,MAAQ,QAAO,IAAM,CACrB,UAAE,UAAS,WAAA,cAAA,QAAA,gBAAA,cAAA,EAAA,gBAAA,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"}
@@ -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;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AAmB,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"}
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;E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 @@ 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,a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A;;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,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;AAElD,0BAAE,SAAA;CAAA;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;CAAA;;;;;;;;;;;;;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;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