@hypercli/gen 0.1.1

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 (306) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/actions/communication.d.ts +201 -0
  4. package/dist/actions/communication.d.ts.map +1 -0
  5. package/dist/actions/communication.js +515 -0
  6. package/dist/actions/communication.js.map +1 -0
  7. package/dist/actions/decorator.d.ts +22 -0
  8. package/dist/actions/decorator.d.ts.map +1 -0
  9. package/dist/actions/decorator.js +110 -0
  10. package/dist/actions/decorator.js.map +1 -0
  11. package/dist/actions/executor.d.ts +85 -0
  12. package/dist/actions/executor.d.ts.map +1 -0
  13. package/dist/actions/executor.js +289 -0
  14. package/dist/actions/executor.js.map +1 -0
  15. package/dist/actions/index.d.ts +14 -0
  16. package/dist/actions/index.d.ts.map +1 -0
  17. package/dist/actions/index.js +15 -0
  18. package/dist/actions/index.js.map +1 -0
  19. package/dist/actions/parameter-resolver.d.ts +54 -0
  20. package/dist/actions/parameter-resolver.d.ts.map +1 -0
  21. package/dist/actions/parameter-resolver.js +300 -0
  22. package/dist/actions/parameter-resolver.js.map +1 -0
  23. package/dist/actions/registry.d.ts +78 -0
  24. package/dist/actions/registry.d.ts.map +1 -0
  25. package/dist/actions/registry.js +221 -0
  26. package/dist/actions/registry.js.map +1 -0
  27. package/dist/actions/types.d.ts +109 -0
  28. package/dist/actions/types.d.ts.map +1 -0
  29. package/dist/actions/types.js +31 -0
  30. package/dist/actions/types.js.map +1 -0
  31. package/dist/actions/utils.d.ts +42 -0
  32. package/dist/actions/utils.d.ts.map +1 -0
  33. package/dist/actions/utils.js +144 -0
  34. package/dist/actions/utils.js.map +1 -0
  35. package/dist/ai/ai-collector.d.ts +52 -0
  36. package/dist/ai/ai-collector.d.ts.map +1 -0
  37. package/dist/ai/ai-collector.js +64 -0
  38. package/dist/ai/ai-collector.js.map +1 -0
  39. package/dist/ai/ai-config.d.ts +230 -0
  40. package/dist/ai/ai-config.d.ts.map +1 -0
  41. package/dist/ai/ai-config.js +8 -0
  42. package/dist/ai/ai-config.js.map +1 -0
  43. package/dist/ai/ai-service.d.ts +66 -0
  44. package/dist/ai/ai-service.d.ts.map +1 -0
  45. package/dist/ai/ai-service.js +198 -0
  46. package/dist/ai/ai-service.js.map +1 -0
  47. package/dist/ai/ai-variable-resolver.d.ts +59 -0
  48. package/dist/ai/ai-variable-resolver.d.ts.map +1 -0
  49. package/dist/ai/ai-variable-resolver.js +219 -0
  50. package/dist/ai/ai-variable-resolver.js.map +1 -0
  51. package/dist/ai/context-collector.d.ts +30 -0
  52. package/dist/ai/context-collector.d.ts.map +1 -0
  53. package/dist/ai/context-collector.js +158 -0
  54. package/dist/ai/context-collector.js.map +1 -0
  55. package/dist/ai/cost-tracker.d.ts +41 -0
  56. package/dist/ai/cost-tracker.d.ts.map +1 -0
  57. package/dist/ai/cost-tracker.js +131 -0
  58. package/dist/ai/cost-tracker.js.map +1 -0
  59. package/dist/ai/env.d.ts +36 -0
  60. package/dist/ai/env.d.ts.map +1 -0
  61. package/dist/ai/env.js +100 -0
  62. package/dist/ai/env.js.map +1 -0
  63. package/dist/ai/index.d.ts +17 -0
  64. package/dist/ai/index.d.ts.map +1 -0
  65. package/dist/ai/index.js +25 -0
  66. package/dist/ai/index.js.map +1 -0
  67. package/dist/ai/model-router.d.ts +32 -0
  68. package/dist/ai/model-router.d.ts.map +1 -0
  69. package/dist/ai/model-router.js +113 -0
  70. package/dist/ai/model-router.js.map +1 -0
  71. package/dist/ai/output-validator.d.ts +24 -0
  72. package/dist/ai/output-validator.d.ts.map +1 -0
  73. package/dist/ai/output-validator.js +279 -0
  74. package/dist/ai/output-validator.js.map +1 -0
  75. package/dist/ai/prompt-assembler.d.ts +30 -0
  76. package/dist/ai/prompt-assembler.d.ts.map +1 -0
  77. package/dist/ai/prompt-assembler.js +93 -0
  78. package/dist/ai/prompt-assembler.js.map +1 -0
  79. package/dist/ai/prompt-pipeline.d.ts +63 -0
  80. package/dist/ai/prompt-pipeline.d.ts.map +1 -0
  81. package/dist/ai/prompt-pipeline.js +119 -0
  82. package/dist/ai/prompt-pipeline.js.map +1 -0
  83. package/dist/ai/prompt-template.jig +88 -0
  84. package/dist/ai/transports/api-transport.d.ts +12 -0
  85. package/dist/ai/transports/api-transport.d.ts.map +1 -0
  86. package/dist/ai/transports/api-transport.js +86 -0
  87. package/dist/ai/transports/api-transport.js.map +1 -0
  88. package/dist/ai/transports/command-transport.d.ts +20 -0
  89. package/dist/ai/transports/command-transport.d.ts.map +1 -0
  90. package/dist/ai/transports/command-transport.js +203 -0
  91. package/dist/ai/transports/command-transport.js.map +1 -0
  92. package/dist/ai/transports/index.d.ts +11 -0
  93. package/dist/ai/transports/index.d.ts.map +1 -0
  94. package/dist/ai/transports/index.js +10 -0
  95. package/dist/ai/transports/index.js.map +1 -0
  96. package/dist/ai/transports/resolve-transport.d.ts +15 -0
  97. package/dist/ai/transports/resolve-transport.d.ts.map +1 -0
  98. package/dist/ai/transports/resolve-transport.js +96 -0
  99. package/dist/ai/transports/resolve-transport.js.map +1 -0
  100. package/dist/ai/transports/stdout-transport.d.ts +14 -0
  101. package/dist/ai/transports/stdout-transport.d.ts.map +1 -0
  102. package/dist/ai/transports/stdout-transport.js +27 -0
  103. package/dist/ai/transports/stdout-transport.js.map +1 -0
  104. package/dist/ai/transports/types.d.ts +77 -0
  105. package/dist/ai/transports/types.d.ts.map +1 -0
  106. package/dist/ai/transports/types.js +8 -0
  107. package/dist/ai/transports/types.js.map +1 -0
  108. package/dist/commands/cookbook/info.d.ts +22 -0
  109. package/dist/commands/cookbook/info.d.ts.map +1 -0
  110. package/dist/commands/cookbook/info.js +217 -0
  111. package/dist/commands/cookbook/info.js.map +1 -0
  112. package/dist/commands/cookbook/list.d.ts +20 -0
  113. package/dist/commands/cookbook/list.d.ts.map +1 -0
  114. package/dist/commands/cookbook/list.js +133 -0
  115. package/dist/commands/cookbook/list.js.map +1 -0
  116. package/dist/commands/gen.d.ts +65 -0
  117. package/dist/commands/gen.d.ts.map +1 -0
  118. package/dist/commands/gen.js +478 -0
  119. package/dist/commands/gen.js.map +1 -0
  120. package/dist/commands/recipe/info.d.ts +18 -0
  121. package/dist/commands/recipe/info.d.ts.map +1 -0
  122. package/dist/commands/recipe/info.js +89 -0
  123. package/dist/commands/recipe/info.js.map +1 -0
  124. package/dist/commands/recipe/list.d.ts +29 -0
  125. package/dist/commands/recipe/list.d.ts.map +1 -0
  126. package/dist/commands/recipe/list.js +215 -0
  127. package/dist/commands/recipe/list.js.map +1 -0
  128. package/dist/commands/recipe/run.d.ts +44 -0
  129. package/dist/commands/recipe/run.d.ts.map +1 -0
  130. package/dist/commands/recipe/run.js +239 -0
  131. package/dist/commands/recipe/run.js.map +1 -0
  132. package/dist/commands/recipe/validate.d.ts +19 -0
  133. package/dist/commands/recipe/validate.d.ts.map +1 -0
  134. package/dist/commands/recipe/validate.js +66 -0
  135. package/dist/commands/recipe/validate.js.map +1 -0
  136. package/dist/discovery/generator-discovery.d.ts +130 -0
  137. package/dist/discovery/generator-discovery.d.ts.map +1 -0
  138. package/dist/discovery/generator-discovery.js +674 -0
  139. package/dist/discovery/generator-discovery.js.map +1 -0
  140. package/dist/discovery/index.d.ts +8 -0
  141. package/dist/discovery/index.d.ts.map +1 -0
  142. package/dist/discovery/index.js +7 -0
  143. package/dist/discovery/index.js.map +1 -0
  144. package/dist/hooks/command-not-found.d.ts +18 -0
  145. package/dist/hooks/command-not-found.d.ts.map +1 -0
  146. package/dist/hooks/command-not-found.js +182 -0
  147. package/dist/hooks/command-not-found.js.map +1 -0
  148. package/dist/hooks/suggest.d.ts +13 -0
  149. package/dist/hooks/suggest.d.ts.map +1 -0
  150. package/dist/hooks/suggest.js +28 -0
  151. package/dist/hooks/suggest.js.map +1 -0
  152. package/dist/index.d.ts +2 -0
  153. package/dist/index.d.ts.map +1 -0
  154. package/dist/index.js +3 -0
  155. package/dist/index.js.map +1 -0
  156. package/dist/lib/base-command.d.ts +26 -0
  157. package/dist/lib/base-command.d.ts.map +1 -0
  158. package/dist/lib/base-command.js +24 -0
  159. package/dist/lib/base-command.js.map +1 -0
  160. package/dist/lib/flags.d.ts +33 -0
  161. package/dist/lib/flags.d.ts.map +1 -0
  162. package/dist/lib/flags.js +64 -0
  163. package/dist/lib/flags.js.map +1 -0
  164. package/dist/ops/add.d.ts +4 -0
  165. package/dist/ops/add.d.ts.map +1 -0
  166. package/dist/ops/add.js +85 -0
  167. package/dist/ops/add.js.map +1 -0
  168. package/dist/ops/inject.d.ts +4 -0
  169. package/dist/ops/inject.d.ts.map +1 -0
  170. package/dist/ops/inject.js +28 -0
  171. package/dist/ops/inject.js.map +1 -0
  172. package/dist/ops/injector.d.ts +4 -0
  173. package/dist/ops/injector.d.ts.map +1 -0
  174. package/dist/ops/injector.js +68 -0
  175. package/dist/ops/injector.js.map +1 -0
  176. package/dist/ops/result.d.ts +3 -0
  177. package/dist/ops/result.d.ts.map +1 -0
  178. package/dist/ops/result.js +8 -0
  179. package/dist/ops/result.js.map +1 -0
  180. package/dist/prompts/interactive-prompts.d.ts +152 -0
  181. package/dist/prompts/interactive-prompts.d.ts.map +1 -0
  182. package/dist/prompts/interactive-prompts.js +574 -0
  183. package/dist/prompts/interactive-prompts.js.map +1 -0
  184. package/dist/recipe-engine/group-executor.d.ts +97 -0
  185. package/dist/recipe-engine/group-executor.d.ts.map +1 -0
  186. package/dist/recipe-engine/group-executor.js +293 -0
  187. package/dist/recipe-engine/group-executor.js.map +1 -0
  188. package/dist/recipe-engine/index.d.ts +112 -0
  189. package/dist/recipe-engine/index.d.ts.map +1 -0
  190. package/dist/recipe-engine/index.js +223 -0
  191. package/dist/recipe-engine/index.js.map +1 -0
  192. package/dist/recipe-engine/output-evaluator.d.ts +28 -0
  193. package/dist/recipe-engine/output-evaluator.d.ts.map +1 -0
  194. package/dist/recipe-engine/output-evaluator.js +78 -0
  195. package/dist/recipe-engine/output-evaluator.js.map +1 -0
  196. package/dist/recipe-engine/recipe-engine.d.ts +227 -0
  197. package/dist/recipe-engine/recipe-engine.d.ts.map +1 -0
  198. package/dist/recipe-engine/recipe-engine.js +1036 -0
  199. package/dist/recipe-engine/recipe-engine.js.map +1 -0
  200. package/dist/recipe-engine/step-executor.d.ts +172 -0
  201. package/dist/recipe-engine/step-executor.d.ts.map +1 -0
  202. package/dist/recipe-engine/step-executor.js +802 -0
  203. package/dist/recipe-engine/step-executor.js.map +1 -0
  204. package/dist/recipe-engine/tools/action-tool.d.ts +103 -0
  205. package/dist/recipe-engine/tools/action-tool.d.ts.map +1 -0
  206. package/dist/recipe-engine/tools/action-tool.js +473 -0
  207. package/dist/recipe-engine/tools/action-tool.js.map +1 -0
  208. package/dist/recipe-engine/tools/ai-tool.d.ts +26 -0
  209. package/dist/recipe-engine/tools/ai-tool.d.ts.map +1 -0
  210. package/dist/recipe-engine/tools/ai-tool.js +233 -0
  211. package/dist/recipe-engine/tools/ai-tool.js.map +1 -0
  212. package/dist/recipe-engine/tools/base.d.ts +214 -0
  213. package/dist/recipe-engine/tools/base.d.ts.map +1 -0
  214. package/dist/recipe-engine/tools/base.js +397 -0
  215. package/dist/recipe-engine/tools/base.js.map +1 -0
  216. package/dist/recipe-engine/tools/codemod-tool.d.ts +130 -0
  217. package/dist/recipe-engine/tools/codemod-tool.d.ts.map +1 -0
  218. package/dist/recipe-engine/tools/codemod-tool.js +786 -0
  219. package/dist/recipe-engine/tools/codemod-tool.js.map +1 -0
  220. package/dist/recipe-engine/tools/ensure-dirs-tool.d.ts +21 -0
  221. package/dist/recipe-engine/tools/ensure-dirs-tool.d.ts.map +1 -0
  222. package/dist/recipe-engine/tools/ensure-dirs-tool.js +130 -0
  223. package/dist/recipe-engine/tools/ensure-dirs-tool.js.map +1 -0
  224. package/dist/recipe-engine/tools/index.d.ts +126 -0
  225. package/dist/recipe-engine/tools/index.d.ts.map +1 -0
  226. package/dist/recipe-engine/tools/index.js +290 -0
  227. package/dist/recipe-engine/tools/index.js.map +1 -0
  228. package/dist/recipe-engine/tools/install-tool.d.ts +20 -0
  229. package/dist/recipe-engine/tools/install-tool.d.ts.map +1 -0
  230. package/dist/recipe-engine/tools/install-tool.js +194 -0
  231. package/dist/recipe-engine/tools/install-tool.js.map +1 -0
  232. package/dist/recipe-engine/tools/parallel-tool.d.ts +21 -0
  233. package/dist/recipe-engine/tools/parallel-tool.d.ts.map +1 -0
  234. package/dist/recipe-engine/tools/parallel-tool.js +134 -0
  235. package/dist/recipe-engine/tools/parallel-tool.js.map +1 -0
  236. package/dist/recipe-engine/tools/patch-tool.d.ts +21 -0
  237. package/dist/recipe-engine/tools/patch-tool.d.ts.map +1 -0
  238. package/dist/recipe-engine/tools/patch-tool.js +248 -0
  239. package/dist/recipe-engine/tools/patch-tool.js.map +1 -0
  240. package/dist/recipe-engine/tools/prompt-tool.d.ts +25 -0
  241. package/dist/recipe-engine/tools/prompt-tool.d.ts.map +1 -0
  242. package/dist/recipe-engine/tools/prompt-tool.js +162 -0
  243. package/dist/recipe-engine/tools/prompt-tool.js.map +1 -0
  244. package/dist/recipe-engine/tools/query-tool.d.ts +21 -0
  245. package/dist/recipe-engine/tools/query-tool.d.ts.map +1 -0
  246. package/dist/recipe-engine/tools/query-tool.js +249 -0
  247. package/dist/recipe-engine/tools/query-tool.js.map +1 -0
  248. package/dist/recipe-engine/tools/recipe-tool.d.ts +103 -0
  249. package/dist/recipe-engine/tools/recipe-tool.d.ts.map +1 -0
  250. package/dist/recipe-engine/tools/recipe-tool.js +617 -0
  251. package/dist/recipe-engine/tools/recipe-tool.js.map +1 -0
  252. package/dist/recipe-engine/tools/registry.d.ts +151 -0
  253. package/dist/recipe-engine/tools/registry.d.ts.map +1 -0
  254. package/dist/recipe-engine/tools/registry.js +244 -0
  255. package/dist/recipe-engine/tools/registry.js.map +1 -0
  256. package/dist/recipe-engine/tools/sequence-tool.d.ts +22 -0
  257. package/dist/recipe-engine/tools/sequence-tool.d.ts.map +1 -0
  258. package/dist/recipe-engine/tools/sequence-tool.js +122 -0
  259. package/dist/recipe-engine/tools/sequence-tool.js.map +1 -0
  260. package/dist/recipe-engine/tools/shell-tool.d.ts +25 -0
  261. package/dist/recipe-engine/tools/shell-tool.d.ts.map +1 -0
  262. package/dist/recipe-engine/tools/shell-tool.js +149 -0
  263. package/dist/recipe-engine/tools/shell-tool.js.map +1 -0
  264. package/dist/recipe-engine/tools/template-tool.d.ts +88 -0
  265. package/dist/recipe-engine/tools/template-tool.d.ts.map +1 -0
  266. package/dist/recipe-engine/tools/template-tool.js +613 -0
  267. package/dist/recipe-engine/tools/template-tool.js.map +1 -0
  268. package/dist/recipe-engine/types.d.ts +963 -0
  269. package/dist/recipe-engine/types.d.ts.map +1 -0
  270. package/dist/recipe-engine/types.js +94 -0
  271. package/dist/recipe-engine/types.js.map +1 -0
  272. package/dist/template-engines/ai-tags.d.ts +26 -0
  273. package/dist/template-engines/ai-tags.d.ts.map +1 -0
  274. package/dist/template-engines/ai-tags.js +233 -0
  275. package/dist/template-engines/ai-tags.js.map +1 -0
  276. package/dist/template-engines/index.d.ts +8 -0
  277. package/dist/template-engines/index.d.ts.map +1 -0
  278. package/dist/template-engines/index.js +8 -0
  279. package/dist/template-engines/index.js.map +1 -0
  280. package/dist/template-engines/jig-engine.d.ts +47 -0
  281. package/dist/template-engines/jig-engine.d.ts.map +1 -0
  282. package/dist/template-engines/jig-engine.js +173 -0
  283. package/dist/template-engines/jig-engine.js.map +1 -0
  284. package/dist/utils/coerce-value.d.ts +7 -0
  285. package/dist/utils/coerce-value.d.ts.map +1 -0
  286. package/dist/utils/coerce-value.js +18 -0
  287. package/dist/utils/coerce-value.js.map +1 -0
  288. package/dist/utils/diff.d.ts +8 -0
  289. package/dist/utils/diff.d.ts.map +1 -0
  290. package/dist/utils/diff.js +10 -0
  291. package/dist/utils/diff.js.map +1 -0
  292. package/dist/utils/global-packages.d.ts +11 -0
  293. package/dist/utils/global-packages.d.ts.map +1 -0
  294. package/dist/utils/global-packages.js +88 -0
  295. package/dist/utils/global-packages.js.map +1 -0
  296. package/dist/utils/pager.d.ts +6 -0
  297. package/dist/utils/pager.d.ts.map +1 -0
  298. package/dist/utils/pager.js +41 -0
  299. package/dist/utils/pager.js.map +1 -0
  300. package/help/cookbook/info.md +35 -0
  301. package/help/cookbook/list.md +37 -0
  302. package/help/gen.md +26 -0
  303. package/help/recipe/run.md +52 -0
  304. package/help/recipe/validate.md +51 -0
  305. package/oclif.manifest.json +580 -0
  306. package/package.json +120 -0
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Tool Registry System
3
+ *
4
+ * Centralized registry for managing tool factories and creating tool instances.
5
+ * Tools are created fresh for each use — no instance caching, since this is a
6
+ * short-lived CLI process where cache overhead exceeds any reuse benefit.
7
+ */
8
+ import type { ToolType } from "#recipe-engine/types";
9
+ import type { Tool } from "./base.js";
10
+ import type { ToolFactory } from "./base.js";
11
+ /**
12
+ * Tool registration metadata
13
+ */
14
+ export interface ToolRegistration {
15
+ /** Tool type */
16
+ toolType: ToolType;
17
+ /** Tool name/identifier */
18
+ name: string;
19
+ /** Tool factory for creating instances */
20
+ factory: ToolFactory;
21
+ /** Tool version */
22
+ version?: string;
23
+ /** Tool description */
24
+ description?: string;
25
+ /** Tool category for organization */
26
+ category?: string;
27
+ /** Tool tags for searchability */
28
+ tags?: string[];
29
+ /** Whether this tool is enabled */
30
+ enabled: boolean;
31
+ /** Registration timestamp */
32
+ registeredAt: Date;
33
+ /** Tool metadata */
34
+ metadata?: Record<string, any>;
35
+ }
36
+ /**
37
+ * Tool registry statistics
38
+ */
39
+ export interface ToolRegistryStats {
40
+ /** Total number of registered tool types */
41
+ totalRegistrations: number;
42
+ /** Registry statistics by tool type */
43
+ byType: Record<ToolType, {
44
+ registrations: number;
45
+ }>;
46
+ }
47
+ /**
48
+ * Tool search criteria
49
+ */
50
+ export interface ToolSearchCriteria {
51
+ /** Tool type filter */
52
+ type?: ToolType;
53
+ /** Name pattern (regex support) */
54
+ namePattern?: string;
55
+ /** Category filter */
56
+ category?: string;
57
+ /** Tag filters (all must match) */
58
+ tags?: string[];
59
+ /** Whether to include only enabled tools */
60
+ enabledOnly?: boolean;
61
+ /** Text search in description */
62
+ description?: string;
63
+ }
64
+ /**
65
+ * Tool resolution options
66
+ */
67
+ export interface ToolResolutionOptions {
68
+ /** Tool instance options */
69
+ instanceOptions?: Record<string, any>;
70
+ /** Whether to validate the tool after creation */
71
+ validate?: boolean;
72
+ }
73
+ /**
74
+ * Centralized registry for managing tool factories
75
+ *
76
+ * The ToolRegistry provides a singleton pattern for tool registration,
77
+ * discovery, and instance creation.
78
+ */
79
+ export declare class ToolRegistry {
80
+ private static instance;
81
+ private readonly registrations;
82
+ private readonly debug;
83
+ private constructor();
84
+ /**
85
+ * Get the singleton registry instance
86
+ */
87
+ static getInstance(): ToolRegistry;
88
+ /**
89
+ * Reset the singleton instance (primarily for testing)
90
+ */
91
+ static reset(): void;
92
+ /**
93
+ * Register a tool factory
94
+ */
95
+ register(toolType: ToolType, name: string, factory: ToolFactory, metadata?: Partial<ToolRegistration>): void;
96
+ /**
97
+ * Unregister a tool
98
+ */
99
+ unregister(toolType: ToolType, name: string): boolean;
100
+ /**
101
+ * Check if a tool is registered
102
+ */
103
+ isRegistered(toolType: ToolType, name: string): boolean;
104
+ /**
105
+ * Get tool registration information
106
+ */
107
+ getRegistration(toolType: ToolType, name: string): ToolRegistration | null;
108
+ /**
109
+ * Create a tool instance by type and name
110
+ */
111
+ resolve(toolType: ToolType, name: string, options?: ToolResolutionOptions): Promise<Tool>;
112
+ /**
113
+ * Release a tool instance (no-op — instances are not cached)
114
+ */
115
+ release(_toolType: ToolType, _name: string, _instance: Tool): void;
116
+ /**
117
+ * Search for tools based on criteria
118
+ */
119
+ search(criteria?: ToolSearchCriteria): ToolRegistration[];
120
+ /**
121
+ * Get all registered tools of a specific type
122
+ */
123
+ getByType(toolType: ToolType): ToolRegistration[];
124
+ /**
125
+ * Get all tool types with registrations
126
+ */
127
+ getRegisteredTypes(): ToolType[];
128
+ /**
129
+ * Get all categories
130
+ */
131
+ getCategories(): string[];
132
+ /**
133
+ * Get registry statistics
134
+ */
135
+ getStats(): ToolRegistryStats;
136
+ private getRegistrationKey;
137
+ private matchesCriteria;
138
+ }
139
+ /**
140
+ * Get the global tool registry instance
141
+ */
142
+ export declare function getToolRegistry(): ToolRegistry;
143
+ /**
144
+ * Register a tool factory with the global registry
145
+ */
146
+ export declare function registerTool(toolType: ToolType, name: string, factory: ToolFactory, metadata?: Partial<ToolRegistration>): void;
147
+ /**
148
+ * Resolve a tool instance from the global registry
149
+ */
150
+ export declare function resolveTool(toolType: ToolType, name: string, options?: ToolResolutionOptions): Promise<Tool>;
151
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/recipe-engine/tools/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,gBAAgB;IAChB,QAAQ,EAAE,QAAQ,CAAC;IAEnB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IAEb,0CAA0C;IAC1C,OAAO,EAAE,WAAW,CAAC;IAErB,mBAAmB;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IAEjB,6BAA6B;IAC7B,YAAY,EAAE,IAAI,CAAC;IAEnB,o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GAC7B,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Tool Registry System
3
+ *
4
+ * Centralized registry for managing tool factories and creating tool instances.
5
+ * Tools are created fresh for each use — no instance caching, since this is a
6
+ * short-lived CLI process where cache overhead exceeds any reuse benefit.
7
+ */
8
+ import { ErrorCode, ErrorHandler, HypergenError } from "@hypercli/core";
9
+ import createDebug from "debug";
10
+ /**
11
+ * Centralized registry for managing tool factories
12
+ *
13
+ * The ToolRegistry provides a singleton pattern for tool registration,
14
+ * discovery, and instance creation.
15
+ */
16
+ export class ToolRegistry {
17
+ static instance = null;
18
+ registrations = new Map();
19
+ debug;
20
+ constructor() {
21
+ this.debug = createDebug("hyper:recipe:registry");
22
+ this.debug("Tool registry initialized");
23
+ }
24
+ /**
25
+ * Get the singleton registry instance
26
+ */
27
+ static getInstance() {
28
+ if (!ToolRegistry.instance) {
29
+ ToolRegistry.instance = new ToolRegistry();
30
+ }
31
+ return ToolRegistry.instance;
32
+ }
33
+ /**
34
+ * Reset the singleton instance (primarily for testing)
35
+ */
36
+ static reset() {
37
+ ToolRegistry.instance = null;
38
+ }
39
+ /**
40
+ * Register a tool factory
41
+ */
42
+ register(toolType, name, factory, metadata) {
43
+ const registrationKey = this.getRegistrationKey(toolType, name);
44
+ if (this.registrations.has(registrationKey)) {
45
+ this.debug("Overwriting existing tool registration: %s", registrationKey);
46
+ }
47
+ const registration = {
48
+ toolType,
49
+ name,
50
+ factory,
51
+ version: metadata?.version,
52
+ description: metadata?.description,
53
+ category: metadata?.category || "general",
54
+ tags: metadata?.tags || [],
55
+ enabled: metadata?.enabled ?? true,
56
+ registeredAt: new Date(),
57
+ metadata: metadata?.metadata,
58
+ };
59
+ // Validate factory configuration
60
+ try {
61
+ const validation = factory.validateConfig(metadata?.metadata || {});
62
+ if (!validation.isValid) {
63
+ throw ErrorHandler.createError(ErrorCode.VALIDATION_ERROR, `Tool factory validation failed: ${validation.errors.join(", ")}`, { toolType, toolName: name, errors: validation.errors });
64
+ }
65
+ }
66
+ catch (error) {
67
+ this.debug("Factory validation failed for %s: %s", registrationKey, error instanceof Error ? error.message : String(error));
68
+ throw error;
69
+ }
70
+ this.registrations.set(registrationKey, registration);
71
+ this.debug("Tool registered: %s (%s) - %s", name, toolType, registration.description || "no description");
72
+ }
73
+ /**
74
+ * Unregister a tool
75
+ */
76
+ unregister(toolType, name) {
77
+ const registrationKey = this.getRegistrationKey(toolType, name);
78
+ const removed = this.registrations.delete(registrationKey);
79
+ if (removed) {
80
+ this.debug("Tool unregistered: %s", registrationKey);
81
+ }
82
+ return removed;
83
+ }
84
+ /**
85
+ * Check if a tool is registered
86
+ */
87
+ isRegistered(toolType, name) {
88
+ const registrationKey = this.getRegistrationKey(toolType, name);
89
+ return this.registrations.has(registrationKey);
90
+ }
91
+ /**
92
+ * Get tool registration information
93
+ */
94
+ getRegistration(toolType, name) {
95
+ const registrationKey = this.getRegistrationKey(toolType, name);
96
+ return this.registrations.get(registrationKey) || null;
97
+ }
98
+ /**
99
+ * Create a tool instance by type and name
100
+ */
101
+ async resolve(toolType, name, options) {
102
+ const registrationKey = this.getRegistrationKey(toolType, name);
103
+ const registration = this.registrations.get(registrationKey);
104
+ if (!registration) {
105
+ throw ErrorHandler.createError(ErrorCode.ACTION_NOT_FOUND, `Tool not found: ${name} (${toolType})`, { toolType, toolName: name });
106
+ }
107
+ if (!registration.enabled) {
108
+ throw ErrorHandler.createError(ErrorCode.ACTION_EXECUTION_FAILED, `Tool is disabled: ${name} (${toolType})`, { toolType, toolName: name });
109
+ }
110
+ this.debug("Creating tool instance: %s", registrationKey);
111
+ try {
112
+ const instance = registration.factory.create(name, options?.instanceOptions);
113
+ this.debug("Tool instance created: %s", registrationKey);
114
+ return instance;
115
+ }
116
+ catch (error) {
117
+ this.debug("Failed to create tool instance: %s - %s", registrationKey, error instanceof Error ? error.message : String(error));
118
+ if (error instanceof HypergenError) {
119
+ throw error;
120
+ }
121
+ throw ErrorHandler.createError(ErrorCode.INTERNAL_ERROR, `Failed to create tool instance: ${error instanceof Error ? error.message : String(error)}`, { toolType, toolName: name });
122
+ }
123
+ }
124
+ /**
125
+ * Release a tool instance (no-op — instances are not cached)
126
+ */
127
+ release(_toolType, _name, _instance) {
128
+ // No-op: tools are created fresh each time, no cache to return to.
129
+ }
130
+ /**
131
+ * Search for tools based on criteria
132
+ */
133
+ search(criteria = {}) {
134
+ const results = [];
135
+ for (const registration of this.registrations.values()) {
136
+ if (this.matchesCriteria(registration, criteria)) {
137
+ results.push(registration);
138
+ }
139
+ }
140
+ results.sort((a, b) => a.name.localeCompare(b.name));
141
+ this.debug("Tool search returned %d results for criteria: %o", results.length, criteria);
142
+ return results;
143
+ }
144
+ /**
145
+ * Get all registered tools of a specific type
146
+ */
147
+ getByType(toolType) {
148
+ return this.search({ type: toolType, enabledOnly: false });
149
+ }
150
+ /**
151
+ * Get all tool types with registrations
152
+ */
153
+ getRegisteredTypes() {
154
+ const types = new Set();
155
+ for (const registration of this.registrations.values()) {
156
+ types.add(registration.toolType);
157
+ }
158
+ return Array.from(types).sort();
159
+ }
160
+ /**
161
+ * Get all categories
162
+ */
163
+ getCategories() {
164
+ const categories = new Set();
165
+ for (const registration of this.registrations.values()) {
166
+ if (registration.category) {
167
+ categories.add(registration.category);
168
+ }
169
+ }
170
+ return Array.from(categories).sort();
171
+ }
172
+ /**
173
+ * Get registry statistics
174
+ */
175
+ getStats() {
176
+ const stats = {
177
+ totalRegistrations: this.registrations.size,
178
+ byType: {},
179
+ };
180
+ for (const registration of this.registrations.values()) {
181
+ const type = registration.toolType;
182
+ if (!stats.byType[type]) {
183
+ stats.byType[type] = { registrations: 0 };
184
+ }
185
+ stats.byType[type].registrations++;
186
+ }
187
+ return stats;
188
+ }
189
+ // Private helper methods
190
+ getRegistrationKey(toolType, name) {
191
+ return `${toolType}:${name}`;
192
+ }
193
+ matchesCriteria(registration, criteria) {
194
+ if (criteria.type && registration.toolType !== criteria.type) {
195
+ return false;
196
+ }
197
+ if (criteria.enabledOnly && !registration.enabled) {
198
+ return false;
199
+ }
200
+ if (criteria.namePattern) {
201
+ const regex = new RegExp(criteria.namePattern, "i");
202
+ if (!regex.test(registration.name)) {
203
+ return false;
204
+ }
205
+ }
206
+ if (criteria.category && registration.category !== criteria.category) {
207
+ return false;
208
+ }
209
+ if (criteria.tags && criteria.tags.length > 0) {
210
+ const registrationTags = registration.tags || [];
211
+ if (!criteria.tags.every((tag) => registrationTags.includes(tag))) {
212
+ return false;
213
+ }
214
+ }
215
+ if (criteria.description && registration.description) {
216
+ const regex = new RegExp(criteria.description, "i");
217
+ if (!regex.test(registration.description)) {
218
+ return false;
219
+ }
220
+ }
221
+ return true;
222
+ }
223
+ }
224
+ /**
225
+ * Get the global tool registry instance
226
+ */
227
+ export function getToolRegistry() {
228
+ return ToolRegistry.getInstance();
229
+ }
230
+ /**
231
+ * Register a tool factory with the global registry
232
+ */
233
+ export function registerTool(toolType, name, factory, metadata) {
234
+ const registry = getToolRegistry();
235
+ registry.register(toolType, name, factory, metadata);
236
+ }
237
+ /**
238
+ * Resolve a tool instance from the global registry
239
+ */
240
+ export async function resolveTool(toolType, name, options) {
241
+ const registry = getToolRegistry();
242
+ return await registry.resolve(toolType, name, options);
243
+ }
244
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/recipe-engine/tools/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,WAAW,MAAM,OAAO,CAAC;AA0FhC;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,QAAQ,GAAwB,IAAI,CAAC;IAEnC,aAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;IACpD,KAAK,CAAiC;IAEvD;QACC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,u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GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;YACpD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC3C,OAAO,KAAK,CAAC;YACd,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC;;AAGF;;GAEG;AACH,MAAM,UAAU,eAAe;IAC9B,OAAO,YAAY,CAAC,WAAW,EAAE,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC3B,QAAkB,EAClB,IAAY,EACZ,OAAoB,EACpB,QAAoC;IAEpC,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAChC,QAAkB,EAClB,IAAY,EACZ,OAA+B;IAE/B,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAO,MAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Sequence Tool Implementation for Recipe Step System
3
+ *
4
+ * This tool executes a list of recipe steps sequentially.
5
+ * It is a direct replacement for the generic GroupTool, offering
6
+ * clearer semantics for sequential execution.
7
+ */
8
+ import type { SequenceStep, StepContext, StepExecutionOptions, StepResult } from "#recipe-engine/types";
9
+ import { Tool, type ToolValidationResult } from "./base.js";
10
+ export declare class SequenceTool extends Tool<SequenceStep> {
11
+ constructor(name?: string, options?: Record<string, any>);
12
+ protected onValidate(step: SequenceStep, context: StepContext): Promise<ToolValidationResult>;
13
+ protected onExecute(step: SequenceStep, context: StepContext, options?: StepExecutionOptions): Promise<StepResult>;
14
+ private createResult;
15
+ }
16
+ export declare class SequenceToolFactory {
17
+ create(name?: string, options?: Record<string, any>): SequenceTool;
18
+ getToolType(): "sequence";
19
+ validateConfig(config: Record<string, any>): ToolValidationResult;
20
+ }
21
+ export declare const sequenceToolFactory: SequenceToolFactory;
22
+ //# sourceMappingURL=sequence-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequence-tool.d.ts","sourceRoot":"","sources":["../../../src/recipe-engine/tools/sequence-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAEX,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE5D,qBAAa,YAAa,SAAQ,IAAI,CAAC,YAAY,CAAC;gBACvC,IAAI,SAAkB,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;cAIrD,UAAU,CACzB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,WAAW,GAClB,OAAO,CAAC,oBAAoB,CAAC;cAsBhB,SAAS,CACxB,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC;IA6CtB,OAAO,CAAC,YAAY;CAwCpB;AAED,qBAAa,mBAAmB;IAC/B,MAAM,CAAC,IAAI,SAAkB,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,YAAY;IAI/E,WAAW,IAAI,UAAU;IAIzB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,oBAAoB;CAQjE;AAED,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Sequence Tool Implementation for Recipe Step System
3
+ *
4
+ * This tool executes a list of recipe steps sequentially.
5
+ * It is a direct replacement for the generic GroupTool, offering
6
+ * clearer semantics for sequential execution.
7
+ */
8
+ import { ErrorCode, ErrorHandler } from "@hypercli/core";
9
+ import { StepExecutor } from "#recipe-engine/step-executor";
10
+ import { Tool } from "./base.js";
11
+ export class SequenceTool extends Tool {
12
+ constructor(name = "sequence-tool", options = {}) {
13
+ super("sequence", name, options);
14
+ }
15
+ async onValidate(step, context) {
16
+ const errors = [];
17
+ if (!step.steps || !Array.isArray(step.steps) || step.steps.length === 0) {
18
+ errors.push("Sequence steps must be a non-empty array");
19
+ }
20
+ return {
21
+ isValid: errors.length === 0,
22
+ errors,
23
+ warnings: [],
24
+ suggestions: [],
25
+ estimatedExecutionTime: (step.steps?.length || 0) * 1000,
26
+ resourceRequirements: {
27
+ memory: 0,
28
+ disk: 0,
29
+ network: false,
30
+ processes: 0,
31
+ },
32
+ };
33
+ }
34
+ async onExecute(step, context, options) {
35
+ const startTime = new Date();
36
+ this.debug("Executing sequence step: %s with %d steps", step.name, step.steps.length);
37
+ try {
38
+ const executor = new StepExecutor(undefined, {
39
+ collectMetrics: false,
40
+ enableProgressTracking: false,
41
+ });
42
+ const results = await executor.executeSteps(step.steps, context, options);
43
+ const failed = results.filter((r) => r.status === "failed");
44
+ if (failed.length > 0 && !step.continueOnError && !options?.continueOnError) {
45
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_EXECUTION_ERROR, `Sequence execution failed: ${failed.map((f) => f.stepName).join(", ")}`, { template: step.name, cause: failed[0].error });
46
+ }
47
+ this.debug("Sequence execution completed");
48
+ return this.createResult(step, results, startTime, "completed");
49
+ }
50
+ catch (error) {
51
+ const endTime = new Date();
52
+ return {
53
+ status: "failed",
54
+ stepName: step.name,
55
+ toolType: "sequence",
56
+ startTime,
57
+ endTime,
58
+ duration: endTime.getTime() - startTime.getTime(),
59
+ retryCount: 0,
60
+ dependenciesSatisfied: true,
61
+ error: {
62
+ message: error.message,
63
+ code: error.code || "SEQUENCE_EXECUTION_ERROR",
64
+ cause: error,
65
+ },
66
+ };
67
+ }
68
+ }
69
+ createResult(step, results, startTime, status) {
70
+ const endTime = new Date();
71
+ const filesCreated = [];
72
+ const filesModified = [];
73
+ const filesDeleted = [];
74
+ results.forEach((r) => {
75
+ if (r.filesCreated)
76
+ filesCreated.push(...r.filesCreated);
77
+ if (r.filesModified)
78
+ filesModified.push(...r.filesModified);
79
+ if (r.filesDeleted)
80
+ filesDeleted.push(...r.filesDeleted);
81
+ });
82
+ return {
83
+ status,
84
+ stepName: step.name,
85
+ toolType: "sequence",
86
+ startTime,
87
+ endTime,
88
+ duration: endTime.getTime() - startTime.getTime(),
89
+ retryCount: 0,
90
+ dependenciesSatisfied: true,
91
+ filesCreated,
92
+ filesModified,
93
+ filesDeleted,
94
+ toolResult: {
95
+ steps: results,
96
+ },
97
+ output: {
98
+ totalSteps: results.length,
99
+ completed: results.filter((r) => r.status === "completed").length,
100
+ failed: results.filter((r) => r.status === "failed").length,
101
+ },
102
+ };
103
+ }
104
+ }
105
+ export class SequenceToolFactory {
106
+ create(name = "sequence-tool", options = {}) {
107
+ return new SequenceTool(name, options);
108
+ }
109
+ getToolType() {
110
+ return "sequence";
111
+ }
112
+ validateConfig(config) {
113
+ return {
114
+ isValid: true,
115
+ errors: [],
116
+ warnings: [],
117
+ suggestions: [],
118
+ };
119
+ }
120
+ }
121
+ export const sequenceToolFactory = new SequenceToolFactory();
122
+ //# sourceMappingURL=sequence-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sequence-tool.js","sourceRoot":"","sources":["../../../src/recipe-engine/tools/sequence-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAQ5D,OAAO,EAAE,IAAI,EAA6B,MAAM,WAAW,CAAC;AAE5D,MAAM,OAAO,YAAa,SAAQ,IAAkB;IACnD,YAAY,IAAI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ACD;AAED,MAAM,OAAO,mBAAmB;IAC/B,MAAM,CAAC,IAAI,GAAG,eAAe,EAAE,UAA+B,EAAE;QAC/D,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,WAAW;QACV,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,cAAc,CAAC,MAA2B;QACzC,OAAO;YACN,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,EAAE;SACf,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Shell Tool Implementation for Recipe Step System
3
+ *
4
+ * This tool executes shell commands as part of the recipe execution pipeline.
5
+ * It integrates with the existing shell operations in src/ops/shell.ts.
6
+ */
7
+ import type { ShellStep, StepContext, StepExecutionOptions, StepResult } from "#recipe-engine/types";
8
+ import { Tool, type ToolValidationResult } from "./base.js";
9
+ export declare class ShellTool extends Tool<ShellStep> {
10
+ constructor(name?: string, options?: Record<string, any>);
11
+ protected onValidate(step: ShellStep, context: StepContext): Promise<ToolValidationResult>;
12
+ protected onExecute(step: ShellStep, context: StepContext, options?: StepExecutionOptions): Promise<StepResult>;
13
+ /**
14
+ * Build render context by merging step and recipe variables.
15
+ * This matches the pattern used in template-tool.ts for consistency.
16
+ */
17
+ private buildRenderContext;
18
+ }
19
+ export declare class ShellToolFactory {
20
+ create(name?: string, options?: Record<string, any>): ShellTool;
21
+ getToolType(): "shell";
22
+ validateConfig(config: Record<string, any>): ToolValidationResult;
23
+ }
24
+ export declare const shellToolFactory: ShellToolFactory;
25
+ //# sourceMappingURL=shell-tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-tool.d.ts","sourceRoot":"","sources":["../../../src/recipe-engine/tools/shell-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,SAAS,EACT,WAAW,EACX,oBAAoB,EACpB,UAAU,EACV,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,IAAI,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE5D,qBAAa,SAAU,SAAQ,IAAI,CAAC,SAAS,CAAC;gBACjC,IAAI,SAAe,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;cAIlD,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;cA4BhF,SAAS,CACxB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC;IAiFtB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CAmB1B;AAED,qBAAa,gBAAgB;IAC5B,MAAM,CAAC,IAAI,SAAe,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,SAAS;IAIzE,WAAW,IAAI,OAAO;IAItB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,oBAAoB;CASjE;AAED,eAAO,MAAM,gBAAgB,kBAAyB,CAAC"}