@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,617 @@
1
+ /**
2
+ * Recipe Tool Implementation for Recipe Step System
3
+ *
4
+ * This tool handles recipe composition by loading and executing sub-recipes as
5
+ * orchestrated components. It replaces complex inheritance systems with simple
6
+ * execution-based composition, making recipe systems intuitive and powerful.
7
+ *
8
+ * Key Features:
9
+ * - Recipe discovery from multiple sources (local, npm, GitHub, URLs)
10
+ * - Variable inheritance and override patterns
11
+ * - Sub-recipe execution with proper context isolation
12
+ * - Result aggregation and error handling
13
+ * - Circular dependency detection
14
+ * - Recipe caching for performance
15
+ * - Variable mapping and transformation
16
+ */
17
+ import path from "node:path";
18
+ import { ErrorCode, ErrorHandler, HypergenError } from "@hypercli/core";
19
+ import fs from "fs-extra";
20
+ import yaml from "js-yaml";
21
+ import { StepExecutor } from "#recipe-engine/step-executor";
22
+ import { isRecipeStep, } from "#recipe-engine/types";
23
+ import { Tool } from "./base.js";
24
+ /**
25
+ * Recipe Tool for processing recipe composition in the Recipe Step System
26
+ *
27
+ * This tool implements the core insight that composition is simpler than inheritance.
28
+ * Instead of complex configuration merging and template inheritance, recipes are
29
+ * executed as orchestrated steps that can call other recipes with clear variable
30
+ * passing patterns.
31
+ *
32
+ * Features:
33
+ * - Recipe source discovery (local files, npm packages)
34
+ * - Variable inheritance with clear override patterns
35
+ * - Sub-recipe execution with proper context management
36
+ * - Result aggregation from child recipes
37
+ * - Error handling and rollback for failed sub-recipes
38
+ * - Circular dependency detection with clear error messages
39
+ * - Recipe caching for performance optimization
40
+ * - Variable mapping and transformation support
41
+ */
42
+ export class RecipeTool extends Tool {
43
+ recipeCache = new Map();
44
+ executionStack = [];
45
+ constructor(name = "recipe-tool", options = {}) {
46
+ super("recipe", name, options);
47
+ }
48
+ /**
49
+ * Initialize the recipe tool
50
+ */
51
+ async onInitialize() {
52
+ this.debug("Initializing recipe tool");
53
+ try {
54
+ // Register cache resource for cleanup
55
+ this.registerResource({
56
+ id: "recipe-cache",
57
+ type: "cache",
58
+ cleanup: () => {
59
+ this.recipeCache.clear();
60
+ },
61
+ metadata: { cacheSize: 0 },
62
+ });
63
+ this.debug("Recipe tool initialized successfully");
64
+ }
65
+ catch (error) {
66
+ throw ErrorHandler.createError(ErrorCode.INTERNAL_ERROR, `Failed to initialize recipe tool: ${error instanceof Error ? error.message : String(error)}`, { phase: "initialize", cause: error });
67
+ }
68
+ }
69
+ /**
70
+ * Validate recipe step configuration
71
+ */
72
+ async onValidate(step, context) {
73
+ const errors = [];
74
+ const warnings = [];
75
+ const suggestions = [];
76
+ // Validate step is a recipe step
77
+ if (!isRecipeStep(step)) {
78
+ errors.push("Step is not a valid RecipeStep");
79
+ return { isValid: false, errors, warnings, suggestions };
80
+ }
81
+ // Validate required fields
82
+ if (!step.recipe) {
83
+ errors.push("Recipe identifier is required");
84
+ }
85
+ // Validate recipe exists and is accessible
86
+ if (step.recipe) {
87
+ try {
88
+ const resolution = await this.resolveRecipe(step.recipe, context);
89
+ if (!resolution.metadata.exists) {
90
+ errors.push(`Recipe not found: ${step.recipe}`);
91
+ }
92
+ else {
93
+ // Validate recipe configuration
94
+ const configValidation = this.validateRecipeConfig(resolution.config);
95
+ errors.push(...configValidation.errors);
96
+ warnings.push(...configValidation.warnings);
97
+ }
98
+ }
99
+ catch (error) {
100
+ errors.push(`Recipe resolution failed: ${error instanceof Error ? error.message : String(error)}`);
101
+ }
102
+ }
103
+ // Check for circular dependencies
104
+ try {
105
+ await this.detectCircularDependencies(step.recipe, context, []);
106
+ }
107
+ catch (error) {
108
+ if (error instanceof Error && error.name === "CircularDependencyError") {
109
+ errors.push(error.message);
110
+ }
111
+ }
112
+ // Validate version constraint
113
+ if (step.version && !/^[\d\w.-]+$/.test(step.version)) {
114
+ warnings.push("Version constraint should follow semantic versioning format");
115
+ }
116
+ // Validate variable overrides
117
+ if (step.variableOverrides) {
118
+ if (typeof step.variableOverrides !== "object") {
119
+ errors.push("Variable overrides must be an object");
120
+ }
121
+ }
122
+ // Validate recipe configuration options
123
+ const recipeConfig = step.recipeConfig;
124
+ if (recipeConfig) {
125
+ if (recipeConfig.execution?.timeout && recipeConfig.execution.timeout <= 0) {
126
+ errors.push("Recipe execution timeout must be positive");
127
+ }
128
+ if (recipeConfig.execution?.workingDir &&
129
+ path.isAbsolute(recipeConfig.execution.workingDir)) {
130
+ warnings.push("Working directory should be relative to project root");
131
+ }
132
+ if (recipeConfig.variableMapping) {
133
+ for (const [from, to] of Object.entries(recipeConfig.variableMapping)) {
134
+ if (typeof to !== "string") {
135
+ errors.push(`Variable mapping '${from}' must map to a string`);
136
+ }
137
+ }
138
+ }
139
+ }
140
+ // Performance considerations
141
+ if (step.inheritVariables === false && !step.variableOverrides) {
142
+ suggestions.push("Consider providing variable overrides when disabling variable inheritance");
143
+ }
144
+ // Estimate execution time
145
+ let estimatedTime = 500; // Base time for recipe resolution
146
+ try {
147
+ if (step.recipe) {
148
+ const resolution = await this.resolveRecipe(step.recipe, context);
149
+ estimatedTime += (resolution.config.steps?.length || 0) * 200; // Estimate per step
150
+ }
151
+ }
152
+ catch {
153
+ estimatedTime = 1000; // Conservative estimate if resolution fails
154
+ }
155
+ const resourceRequirements = {
156
+ memory: 50 * 1024 * 1024, // 50MB base memory for recipe execution
157
+ disk: 10 * 1024 * 1024, // 10MB estimated disk usage
158
+ network: typeof step.recipe === "string" &&
159
+ (step.recipe.startsWith("http://") || step.recipe.startsWith("https://")),
160
+ processes: 1,
161
+ };
162
+ return {
163
+ isValid: errors.length === 0,
164
+ errors,
165
+ warnings,
166
+ suggestions,
167
+ estimatedExecutionTime: estimatedTime,
168
+ resourceRequirements,
169
+ };
170
+ }
171
+ /**
172
+ * Execute the recipe tool
173
+ */
174
+ async onExecute(step, context, options) {
175
+ this.debug("Executing recipe step: %s -> %s", step.name, step.recipe);
176
+ const startTime = new Date();
177
+ const filesCreated = [];
178
+ const filesModified = [];
179
+ const filesDeleted = [];
180
+ try {
181
+ // Check for circular dependencies before execution
182
+ await this.detectCircularDependencies(step.recipe, context, this.executionStack);
183
+ // Add current recipe to execution stack
184
+ this.executionStack.push(step.recipe);
185
+ // Resolve recipe
186
+ const recipeResolution = await this.resolveRecipe(step.recipe, context);
187
+ this.debug("Recipe resolved: %s -> %s", step.recipe, recipeResolution.source);
188
+ // Build sub-recipe context
189
+ const subContext = this.buildSubRecipeContext(step, context, recipeResolution);
190
+ // Execute sub-recipe steps
191
+ const recipe = recipeResolution.config;
192
+ this.debug("Executing %d steps in sub-recipe: %s", recipe.steps.length, recipe.name);
193
+ // Execute sub-recipe steps using StepExecutor
194
+ const executor = new StepExecutor(undefined, {
195
+ continueOnError: options?.continueOnError,
196
+ });
197
+ const stepResults = await executor.executeSteps(recipe.steps, subContext, {
198
+ ...options,
199
+ timeout: subContext.isolation.timeout || options?.timeout,
200
+ });
201
+ // Update files lists from results
202
+ for (const result of stepResults) {
203
+ if (result.filesCreated)
204
+ filesCreated.push(...result.filesCreated);
205
+ if (result.filesModified)
206
+ filesModified.push(...result.filesModified);
207
+ if (result.filesDeleted)
208
+ filesDeleted.push(...result.filesDeleted);
209
+ }
210
+ // Update cache metadata
211
+ const cacheResource = this.resources.get("recipe-cache");
212
+ if (cacheResource) {
213
+ cacheResource.metadata.cacheSize = this.recipeCache.size;
214
+ }
215
+ const endTime = new Date();
216
+ const duration = endTime.getTime() - startTime.getTime();
217
+ // Create tool-specific result
218
+ const recipeResult = {
219
+ recipeName: recipe.name,
220
+ recipePath: recipeResolution.source,
221
+ subSteps: stepResults,
222
+ totalDuration: duration,
223
+ inheritedVariables: subContext.inheritance.inherit ? context.variables : {},
224
+ };
225
+ // Check for failures
226
+ const failedStep = stepResults.find((r) => r.status === "failed" && !options?.continueOnError);
227
+ if (failedStep) {
228
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_EXECUTION_ERROR, `Sub-recipe execution failed: ${failedStep.error?.message || "Unknown error"}`, {
229
+ template: step.recipe,
230
+ cause: failedStep.error?.cause,
231
+ });
232
+ }
233
+ return {
234
+ status: "completed",
235
+ stepName: step.name,
236
+ toolType: "recipe",
237
+ startTime,
238
+ endTime,
239
+ duration,
240
+ retryCount: 0,
241
+ dependenciesSatisfied: true,
242
+ toolResult: recipeResult,
243
+ filesCreated,
244
+ filesModified,
245
+ filesDeleted,
246
+ output: {
247
+ subRecipe: recipe.name,
248
+ totalSteps: recipe.steps.length,
249
+ completedSteps: stepResults.filter((r) => r.status === "completed").length,
250
+ failedSteps: stepResults.filter((r) => r.status === "failed").length,
251
+ skippedSteps: stepResults.filter((r) => r.status === "skipped").length,
252
+ inheritedVariables: Object.keys(subContext.inheritance.inherit ? context.variables : {}),
253
+ variableOverrides: Object.keys(step.variableOverrides || {}),
254
+ },
255
+ metadata: {
256
+ recipeResolution: {
257
+ originalRecipe: step.recipe,
258
+ resolvedSource: recipeResolution.source,
259
+ cached: recipeResolution.metadata.cached,
260
+ },
261
+ execution: {
262
+ workingDir: subContext.isolation.workingDir || context.projectRoot,
263
+ variableInheritance: step.inheritVariables !== false,
264
+ totalSubSteps: stepResults.length,
265
+ },
266
+ performance: {
267
+ resolutionTime: 0, // Could be tracked separately
268
+ executionTime: duration,
269
+ },
270
+ },
271
+ };
272
+ }
273
+ catch (error) {
274
+ const endTime = new Date();
275
+ const duration = endTime.getTime() - startTime.getTime();
276
+ return {
277
+ status: "failed",
278
+ stepName: step.name,
279
+ toolType: "recipe",
280
+ startTime,
281
+ endTime,
282
+ duration,
283
+ retryCount: 0,
284
+ dependenciesSatisfied: true,
285
+ filesCreated,
286
+ filesModified,
287
+ filesDeleted,
288
+ error: {
289
+ message: error instanceof Error ? error.message : String(error),
290
+ code: error instanceof HypergenError ? error.code : "RECIPE_EXECUTION_ERROR",
291
+ stack: error instanceof Error ? error.stack : undefined,
292
+ cause: error,
293
+ },
294
+ };
295
+ }
296
+ finally {
297
+ // Remove from execution stack
298
+ this.executionStack.pop();
299
+ }
300
+ }
301
+ /**
302
+ * Tool-specific cleanup logic
303
+ */
304
+ async onCleanup() {
305
+ this.debug("Cleaning up recipe tool resources");
306
+ this.recipeCache.clear();
307
+ this.executionStack.length = 0;
308
+ }
309
+ /**
310
+ * Resolve recipe identifier to configuration
311
+ */
312
+ async resolveRecipe(recipeId, context) {
313
+ // Check cache first
314
+ const cacheKey = `${recipeId}:${context.projectRoot}`;
315
+ const cached = this.recipeCache.get(cacheKey);
316
+ if (cached?.metadata.exists) {
317
+ cached.metadata.cached = true;
318
+ return cached;
319
+ }
320
+ let source;
321
+ let config;
322
+ let metadata;
323
+ let workingDir = context.projectRoot;
324
+ try {
325
+ // Try different resolution strategies
326
+ if (this.isLocalPath(recipeId)) {
327
+ ({ source, config, metadata, workingDir } = await this.resolveLocalRecipe(recipeId, context));
328
+ }
329
+ else if (this.isNpmPackage(recipeId)) {
330
+ ({ source, config, metadata, workingDir } = await this.resolveNpmRecipe(recipeId, context));
331
+ }
332
+ else {
333
+ // Default: try local first, then treat as npm package
334
+ try {
335
+ ({ source, config, metadata, workingDir } = await this.resolveLocalRecipe(recipeId, context));
336
+ }
337
+ catch {
338
+ ({ source, config, metadata, workingDir } = await this.resolveNpmRecipe(recipeId, context));
339
+ }
340
+ }
341
+ const resolution = {
342
+ id: recipeId,
343
+ source,
344
+ config,
345
+ metadata: { ...metadata, cached: false },
346
+ workingDir,
347
+ };
348
+ // Cache the resolution
349
+ this.recipeCache.set(cacheKey, resolution);
350
+ return resolution;
351
+ }
352
+ catch (error) {
353
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_NOT_FOUND, `Failed to resolve recipe '${recipeId}': ${error instanceof Error ? error.message : String(error)}`, { template: recipeId, cause: error });
354
+ }
355
+ }
356
+ /**
357
+ * Resolve local recipe file
358
+ */
359
+ async resolveLocalRecipe(recipeId, context) {
360
+ const possiblePaths = [
361
+ path.resolve(context.projectRoot, recipeId),
362
+ path.resolve(context.projectRoot, `${recipeId}.yml`),
363
+ path.resolve(context.projectRoot, `${recipeId}/recipe.yml`),
364
+ path.resolve(context.projectRoot, `recipes/${recipeId}/recipe.yml`),
365
+ path.resolve(context.projectRoot, `recipes/${recipeId}.yml`),
366
+ path.resolve(context.projectRoot, `recipes/${recipeId}/recipe.yml`),
367
+ ];
368
+ // If templatePath is available (from parent recipe), try resolving relative to it
369
+ if (context.templatePath) {
370
+ possiblePaths.unshift(path.resolve(context.templatePath, recipeId), path.resolve(context.templatePath, `${recipeId}.yml`));
371
+ }
372
+ for (const filePath of possiblePaths) {
373
+ if (await fs.pathExists(filePath)) {
374
+ const stats = await fs.stat(filePath);
375
+ const content = await fs.readFile(filePath, "utf8");
376
+ const rawConfig = yaml.load(content);
377
+ const config = {
378
+ ...rawConfig,
379
+ steps: this.normalizeSteps(rawConfig.steps || []),
380
+ };
381
+ return {
382
+ source: filePath,
383
+ config,
384
+ metadata: {
385
+ exists: true,
386
+ cached: false,
387
+ lastModified: stats.mtime,
388
+ size: stats.size,
389
+ source: "local",
390
+ },
391
+ workingDir: path.dirname(filePath),
392
+ };
393
+ }
394
+ }
395
+ throw new Error(`Local recipe not found: ${recipeId}`);
396
+ }
397
+ /**
398
+ * Resolve recipe from npm package
399
+ */
400
+ async resolveNpmRecipe(recipeId, context) {
401
+ const packagePath = path.resolve(context.projectRoot, "node_modules", recipeId);
402
+ const recipeFile = path.join(packagePath, "recipe.yml");
403
+ if (!(await fs.pathExists(recipeFile))) {
404
+ throw new Error(`npm recipe not found: ${recipeId}`);
405
+ }
406
+ const stats = await fs.stat(recipeFile);
407
+ const content = await fs.readFile(recipeFile, "utf8");
408
+ const rawConfig = yaml.load(content);
409
+ const config = {
410
+ ...rawConfig,
411
+ steps: this.normalizeSteps(rawConfig.steps || []),
412
+ };
413
+ return {
414
+ source: recipeFile,
415
+ config,
416
+ metadata: {
417
+ exists: true,
418
+ cached: false,
419
+ lastModified: stats.mtime,
420
+ size: stats.size,
421
+ source: "npm",
422
+ },
423
+ workingDir: packagePath,
424
+ };
425
+ }
426
+ /**
427
+ * Build sub-recipe context with variable inheritance
428
+ */
429
+ buildSubRecipeContext(step, parentContext, resolution) {
430
+ // Determine variable inheritance
431
+ const inheritVariables = step.inheritVariables !== false;
432
+ const variableOverrides = step.variableOverrides || {};
433
+ const variableMapping = step.recipeConfig?.variableMapping || {};
434
+ // Apply variable mapping
435
+ const mappedVariables = {};
436
+ if (inheritVariables) {
437
+ for (const [parentKey, parentValue] of Object.entries(parentContext.variables)) {
438
+ const mappedKey = variableMapping[parentKey] || parentKey;
439
+ mappedVariables[mappedKey] = parentValue;
440
+ }
441
+ }
442
+ // Merge variables with overrides taking precedence
443
+ const variables = {
444
+ ...mappedVariables,
445
+ ...variableOverrides,
446
+ };
447
+ // Determine working directory
448
+ const workingDir = step.recipeConfig?.execution?.workingDir
449
+ ? path.resolve(parentContext.projectRoot, step.recipeConfig.execution.workingDir)
450
+ : resolution.workingDir;
451
+ return {
452
+ ...parentContext,
453
+ variables,
454
+ projectRoot: workingDir,
455
+ stepResults: new Map(), // Fresh step results for sub-recipe
456
+ parent: {
457
+ recipeId: parentContext.recipe.id,
458
+ stepName: step.name,
459
+ variables: parentContext.variables,
460
+ projectRoot: parentContext.projectRoot,
461
+ },
462
+ inheritance: {
463
+ inherit: inheritVariables,
464
+ overrides: variableOverrides,
465
+ mapping: variableMapping,
466
+ },
467
+ isolation: {
468
+ workingDir,
469
+ environment: step.environment,
470
+ timeout: step.recipeConfig?.execution?.timeout || step.timeout,
471
+ },
472
+ };
473
+ }
474
+ /**
475
+ * Detect circular dependencies in recipe chain
476
+ */
477
+ async detectCircularDependencies(recipeId, context, currentPath) {
478
+ if (currentPath.includes(recipeId)) {
479
+ const cycle = [...currentPath, recipeId];
480
+ const error = new Error(`Circular dependency detected: ${cycle.join(" -> ")}`);
481
+ error.name = "CircularDependencyError";
482
+ error.cycle = cycle;
483
+ throw error;
484
+ }
485
+ // In a complete implementation, this would:
486
+ // 1. Resolve the recipe
487
+ // 2. Check all recipe steps that use the 'recipe' tool
488
+ // 3. Recursively check their dependencies
489
+ // For now, we just check the current path
490
+ }
491
+ /**
492
+ * Normalize steps to infer tool types from shorthands
493
+ */
494
+ normalizeSteps(steps) {
495
+ return steps.map((step) => {
496
+ if (!step.tool) {
497
+ if (step.command) {
498
+ step.tool = "shell";
499
+ }
500
+ else if (step.recipe) {
501
+ step.tool = "recipe";
502
+ }
503
+ else if (step.promptType) {
504
+ // Inference for prompt
505
+ step.tool = "prompt";
506
+ }
507
+ else if (step.sequence) {
508
+ // Inference for sequence shorthand
509
+ step.tool = "sequence";
510
+ step.steps = step.sequence;
511
+ step.sequence = undefined;
512
+ }
513
+ else if (step.parallel) {
514
+ // Inference for parallel shorthand
515
+ step.tool = "parallel";
516
+ step.steps = step.parallel;
517
+ step.parallel = undefined;
518
+ }
519
+ else if (step.steps) {
520
+ // Default to sequence for generic steps property
521
+ step.tool = "sequence";
522
+ }
523
+ else if (step.template) {
524
+ step.tool = "template";
525
+ }
526
+ else if (step.action) {
527
+ step.tool = "action";
528
+ }
529
+ else if (step.codemod) {
530
+ step.tool = "codemod";
531
+ }
532
+ }
533
+ return step;
534
+ });
535
+ }
536
+ /**
537
+ * Tool-specific cleanup logicipe configuration
538
+ */
539
+ validateRecipeConfig(config) {
540
+ const errors = [];
541
+ const warnings = [];
542
+ if (!config.name) {
543
+ errors.push("Recipe must have a name");
544
+ }
545
+ if (!config.steps || config.steps.length === 0) {
546
+ errors.push("Recipe must have at least one step");
547
+ }
548
+ if (config.steps) {
549
+ for (let i = 0; i < config.steps.length; i++) {
550
+ const step = config.steps[i];
551
+ const stepAny = step;
552
+ if (!stepAny.name) {
553
+ errors.push(`Step ${i + 1} must have a name`);
554
+ }
555
+ if (!stepAny.tool) {
556
+ errors.push(`Step '${stepAny.name}' must specify a tool`);
557
+ }
558
+ }
559
+ }
560
+ return { errors, warnings };
561
+ }
562
+ /**
563
+ * Check if recipe identifier is a local path
564
+ */
565
+ isLocalPath(recipeId) {
566
+ return (recipeId.startsWith("./") ||
567
+ recipeId.startsWith("../") ||
568
+ path.isAbsolute(recipeId) ||
569
+ !recipeId.includes(":"));
570
+ }
571
+ /**
572
+ * Check if recipe identifier is an npm package
573
+ */
574
+ isNpmPackage(recipeId) {
575
+ return (/^[@]?[a-z0-9-~][a-z0-9-._~]*\/[a-z0-9-~][a-z0-9-._~]*$/.test(recipeId) ||
576
+ /^[a-z0-9-~][a-z0-9-._~]*$/.test(recipeId));
577
+ }
578
+ }
579
+ /**
580
+ * Recipe Tool Factory
581
+ */
582
+ export class RecipeToolFactory {
583
+ create(name = "recipe-tool", options = {}) {
584
+ return new RecipeTool(name, options);
585
+ }
586
+ getToolType() {
587
+ return "recipe";
588
+ }
589
+ validateConfig(config) {
590
+ const errors = [];
591
+ const warnings = [];
592
+ const suggestions = [];
593
+ // Validate cache settings
594
+ if (config.cacheEnabled !== undefined && typeof config.cacheEnabled !== "boolean") {
595
+ warnings.push("cacheEnabled should be a boolean");
596
+ }
597
+ // Validate timeout
598
+ if (config.timeout !== undefined) {
599
+ if (typeof config.timeout !== "number" || config.timeout <= 0) {
600
+ errors.push("timeout must be a positive number");
601
+ }
602
+ }
603
+ // Validate cache directory
604
+ if (config.cacheDirectory !== undefined && typeof config.cacheDirectory !== "string") {
605
+ warnings.push("cacheDirectory should be a string");
606
+ }
607
+ return {
608
+ isValid: errors.length === 0,
609
+ errors,
610
+ warnings,
611
+ suggestions,
612
+ };
613
+ }
614
+ }
615
+ // Export default instance
616
+ export const recipeToolFactory = new RecipeToolFactory();
617
+ //# sourceMappingURL=recipe-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe-tool.js","sourceRoot":"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