@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,97 @@
1
+ /**
2
+ * Group Executor
3
+ *
4
+ * Discovers recipes in a directory, builds a dependency graph based on
5
+ * `provides` / required variables, resolves execution order via topological
6
+ * sort, and executes batches — piping providedValues between recipes.
7
+ */
8
+ import type { RecipeEngine, RecipeExecutionOptions, RecipeExecutionResult } from "./recipe-engine.js";
9
+ import type { RecipeConfig } from "./types.js";
10
+ /**
11
+ * A recipe discovered within a group directory
12
+ */
13
+ export interface GroupRecipeEntry {
14
+ /** Recipe name (directory name) */
15
+ name: string;
16
+ /** Path to recipe.yml */
17
+ recipeYmlPath: string;
18
+ /** Parsed recipe config (loaded lazily) */
19
+ config?: RecipeConfig;
20
+ }
21
+ /**
22
+ * A group of recipes in a directory
23
+ */
24
+ export interface RecipeGroup {
25
+ /** Directory path */
26
+ dirPath: string;
27
+ /** Discovered recipes */
28
+ recipes: GroupRecipeEntry[];
29
+ }
30
+ /**
31
+ * Result of a group execution
32
+ */
33
+ export interface GroupExecutionResult {
34
+ /** Overall success */
35
+ success: boolean;
36
+ /** Per-recipe results, in execution order */
37
+ recipeResults: Array<{
38
+ name: string;
39
+ result: RecipeExecutionResult;
40
+ }>;
41
+ /** Accumulated provided values from all recipes */
42
+ providedValues: Record<string, any>;
43
+ /** Total execution duration in ms */
44
+ duration: number;
45
+ /** Errors across all recipes */
46
+ errors: string[];
47
+ /** Recipes that require external parameters (not provided by siblings) */
48
+ externalParams: string[];
49
+ }
50
+ export declare class GroupExecutor {
51
+ private readonly recipeEngine;
52
+ constructor(recipeEngine: RecipeEngine);
53
+ /**
54
+ * Discover all recipes in a directory.
55
+ *
56
+ * Rules:
57
+ * - Scan immediate subdirectories
58
+ * - If a subdirectory has recipe.yml → include it, stop recursion
59
+ * - If a subdirectory has NO recipe.yml → recurse into it
60
+ */
61
+ discoverGroup(dirPath: string): Promise<RecipeGroup>;
62
+ /**
63
+ * Load all recipe configs in a group.
64
+ */
65
+ loadGroupConfigs(group: RecipeGroup): Promise<void>;
66
+ /**
67
+ * Build a dependency graph from provides/requires relationships.
68
+ *
69
+ * Returns:
70
+ * - depGraph: Map<recipeName, Set<recipeName it depends on>>
71
+ * - providesMap: Map<varName, recipeName that provides it>
72
+ */
73
+ buildDependencyGraph(recipes: GroupRecipeEntry[]): {
74
+ depGraph: Map<string, Set<string>>;
75
+ providesMap: Map<string, string>;
76
+ errors: string[];
77
+ };
78
+ /**
79
+ * Topological sort — returns batches of recipes that can run in parallel.
80
+ */
81
+ topologicalSort(depGraph: Map<string, Set<string>>): string[][];
82
+ /**
83
+ * Execute all recipes in a group with dependency resolution.
84
+ */
85
+ executeGroup(group: RecipeGroup, baseVars: Record<string, any>, options?: RecipeExecutionOptions): Promise<GroupExecutionResult>;
86
+ /**
87
+ * Compute parameters required by the group but not provided by any sibling.
88
+ * These must come from CLI args or user prompts.
89
+ */
90
+ private computeExternalParams;
91
+ /**
92
+ * Detect circular dependencies via DFS.
93
+ * Returns the cycle path if found, null otherwise.
94
+ */
95
+ private detectCycle;
96
+ }
97
+ //# sourceMappingURL=group-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-executor.d.ts","sourceRoot":"","sources":["../../src/recipe-engine/group-executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EACX,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C;;GA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M,EAAE,CAAC;KACjB;IA8CD;;OAEG;IACH,eAAe,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE;IAoC/D;;OAEG;IACG,YAAY,CACjB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,OAAO,GAAE,sBAA2B,GAClC,OAAO,CAAC,oBAAoB,CAAC;IA+GhC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAwB7B;;;OAGG;IACH,OAAO,CAAC,WAAW;CA8BnB"}
@@ -0,0 +1,293 @@
1
+ /**
2
+ * Group Executor
3
+ *
4
+ * Discovers recipes in a directory, builds a dependency graph based on
5
+ * `provides` / required variables, resolves execution order via topological
6
+ * sort, and executes batches — piping providedValues between recipes.
7
+ */
8
+ import fs from "node:fs";
9
+ import path from "node:path";
10
+ import createDebug from "debug";
11
+ const debug = createDebug("hyper:recipe:group-executor");
12
+ export class GroupExecutor {
13
+ recipeEngine;
14
+ constructor(recipeEngine) {
15
+ this.recipeEngine = recipeEngine;
16
+ }
17
+ /**
18
+ * Discover all recipes in a directory.
19
+ *
20
+ * Rules:
21
+ * - Scan immediate subdirectories
22
+ * - If a subdirectory has recipe.yml → include it, stop recursion
23
+ * - If a subdirectory has NO recipe.yml → recurse into it
24
+ */
25
+ async discoverGroup(dirPath) {
26
+ const recipes = [];
27
+ const scanDir = (dir) => {
28
+ if (!fs.existsSync(dir))
29
+ return;
30
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
31
+ for (const entry of entries) {
32
+ if (!entry.isDirectory())
33
+ continue;
34
+ const subDir = path.join(dir, entry.name);
35
+ const recipeYml = path.join(subDir, "recipe.yml");
36
+ if (fs.existsSync(recipeYml)) {
37
+ recipes.push({
38
+ name: entry.name,
39
+ recipeYmlPath: recipeYml,
40
+ });
41
+ }
42
+ else {
43
+ // Recurse — this might be a subgroup
44
+ scanDir(subDir);
45
+ }
46
+ }
47
+ };
48
+ scanDir(dirPath);
49
+ debug("Discovered %d recipes in group: %s", recipes.length, dirPath);
50
+ return { dirPath, recipes };
51
+ }
52
+ /**
53
+ * Load all recipe configs in a group.
54
+ */
55
+ async loadGroupConfigs(group) {
56
+ for (const entry of group.recipes) {
57
+ if (!entry.config) {
58
+ const loadResult = await this.recipeEngine.loadRecipe({
59
+ type: "file",
60
+ path: entry.recipeYmlPath,
61
+ });
62
+ entry.config = loadResult.recipe;
63
+ }
64
+ }
65
+ }
66
+ /**
67
+ * Build a dependency graph from provides/requires relationships.
68
+ *
69
+ * Returns:
70
+ * - depGraph: Map<recipeName, Set<recipeName it depends on>>
71
+ * - providesMap: Map<varName, recipeName that provides it>
72
+ */
73
+ buildDependencyGraph(recipes) {
74
+ const providesMap = new Map();
75
+ const depGraph = new Map();
76
+ const errors = [];
77
+ // Collect all provides
78
+ for (const entry of recipes) {
79
+ depGraph.set(entry.name, new Set());
80
+ if (!entry.config?.provides)
81
+ continue;
82
+ for (const p of entry.config.provides) {
83
+ if (providesMap.has(p.name)) {
84
+ errors.push(`Variable '${p.name}' is provided by both '${providesMap.get(p.name)}' and '${entry.name}'`);
85
+ }
86
+ else {
87
+ providesMap.set(p.name, entry.name);
88
+ }
89
+ }
90
+ }
91
+ // Build edges: if a recipe requires a variable that another provides, add a dependency
92
+ for (const entry of recipes) {
93
+ if (!entry.config?.variables)
94
+ continue;
95
+ for (const [varName, varDef] of Object.entries(entry.config.variables)) {
96
+ if (!varDef.required || varDef.default !== undefined)
97
+ continue;
98
+ const provider = providesMap.get(varName);
99
+ if (provider && provider !== entry.name) {
100
+ depGraph.get(entry.name)?.add(provider);
101
+ debug("Dependency: %s depends on %s (via %s)", entry.name, provider, varName);
102
+ }
103
+ }
104
+ }
105
+ // Detect circular dependencies
106
+ const cycle = this.detectCycle(depGraph);
107
+ if (cycle) {
108
+ errors.push(`Circular dependency detected: ${cycle.join(" -> ")}`);
109
+ }
110
+ return { depGraph, providesMap, errors };
111
+ }
112
+ /**
113
+ * Topological sort — returns batches of recipes that can run in parallel.
114
+ */
115
+ topologicalSort(depGraph) {
116
+ const batches = [];
117
+ const resolved = new Set();
118
+ const remaining = new Set(depGraph.keys());
119
+ while (remaining.size > 0) {
120
+ const batch = [];
121
+ for (const name of remaining) {
122
+ const deps = depGraph.get(name);
123
+ const allDepsResolved = [...deps].every((d) => resolved.has(d));
124
+ if (allDepsResolved) {
125
+ batch.push(name);
126
+ }
127
+ }
128
+ if (batch.length === 0) {
129
+ // Remaining recipes have unresolvable deps — break to avoid infinite loop
130
+ debug("Unresolvable dependencies for: %o", [...remaining]);
131
+ break;
132
+ }
133
+ // Sort batch alphabetically for deterministic ordering
134
+ batch.sort();
135
+ batches.push(batch);
136
+ for (const name of batch) {
137
+ resolved.add(name);
138
+ remaining.delete(name);
139
+ }
140
+ }
141
+ return batches;
142
+ }
143
+ /**
144
+ * Execute all recipes in a group with dependency resolution.
145
+ */
146
+ async executeGroup(group, baseVars, options = {}) {
147
+ const startTime = Date.now();
148
+ const recipeResults = [];
149
+ const accumulatedVars = { ...baseVars };
150
+ const errors = [];
151
+ // Load all configs
152
+ await this.loadGroupConfigs(group);
153
+ // Build dependency graph
154
+ const { depGraph, providesMap, errors: graphErrors } = this.buildDependencyGraph(group.recipes);
155
+ errors.push(...graphErrors);
156
+ if (graphErrors.length > 0) {
157
+ return {
158
+ success: false,
159
+ recipeResults,
160
+ providedValues: {},
161
+ duration: Date.now() - startTime,
162
+ errors,
163
+ externalParams: [],
164
+ };
165
+ }
166
+ // Compute external params (required by group but not provided by any sibling)
167
+ const externalParams = this.computeExternalParams(group.recipes, providesMap);
168
+ // Topological sort
169
+ const batches = this.topologicalSort(depGraph);
170
+ debug("Execution batches: %o", batches);
171
+ // Create a lookup map
172
+ const recipeMap = new Map(group.recipes.map((r) => [r.name, r]));
173
+ // Execute batches
174
+ for (const batch of batches) {
175
+ debug("Executing batch: %o", batch);
176
+ // Within a batch, recipes are independent — run them in parallel
177
+ const batchPromises = batch.map(async (recipeName) => {
178
+ const entry = recipeMap.get(recipeName);
179
+ try {
180
+ const result = await this.recipeEngine.executeRecipe({ type: "file", path: entry.recipeYmlPath }, {
181
+ ...options,
182
+ variables: { ...accumulatedVars, ...options.variables },
183
+ });
184
+ // Collect provided values
185
+ if (result.metadata.providedValues) {
186
+ Object.assign(accumulatedVars, result.metadata.providedValues);
187
+ }
188
+ return { name: recipeName, result };
189
+ }
190
+ catch (error) {
191
+ const errorMsg = error instanceof Error ? error.message : String(error);
192
+ errors.push(`Recipe '${recipeName}' failed: ${errorMsg}`);
193
+ return {
194
+ name: recipeName,
195
+ result: {
196
+ executionId: "",
197
+ recipe: entry.config,
198
+ success: false,
199
+ stepResults: [],
200
+ duration: 0,
201
+ filesCreated: [],
202
+ filesModified: [],
203
+ filesDeleted: [],
204
+ errors: [errorMsg],
205
+ warnings: [],
206
+ variables: accumulatedVars,
207
+ metadata: {
208
+ startTime: new Date(),
209
+ endTime: new Date(),
210
+ workingDir: options.workingDir || process.cwd(),
211
+ totalSteps: 0,
212
+ completedSteps: 0,
213
+ failedSteps: 0,
214
+ skippedSteps: 0,
215
+ },
216
+ },
217
+ };
218
+ }
219
+ });
220
+ const batchResults = await Promise.all(batchPromises);
221
+ recipeResults.push(...batchResults);
222
+ // Check for failures
223
+ const failures = batchResults.filter((r) => !r.result.success);
224
+ if (failures.length > 0 && !options.continueOnError) {
225
+ debug("Batch had failures, stopping: %o", failures.map((f) => f.name));
226
+ break;
227
+ }
228
+ }
229
+ return {
230
+ success: errors.length === 0 && recipeResults.every((r) => r.result.success),
231
+ recipeResults,
232
+ providedValues: accumulatedVars,
233
+ duration: Date.now() - startTime,
234
+ errors,
235
+ externalParams,
236
+ };
237
+ }
238
+ /**
239
+ * Compute parameters required by the group but not provided by any sibling.
240
+ * These must come from CLI args or user prompts.
241
+ */
242
+ computeExternalParams(recipes, providesMap) {
243
+ const allRequired = new Set();
244
+ for (const entry of recipes) {
245
+ if (!entry.config?.variables)
246
+ continue;
247
+ for (const [varName, varDef] of Object.entries(entry.config.variables)) {
248
+ if (varDef.required && varDef.default === undefined) {
249
+ allRequired.add(varName);
250
+ }
251
+ }
252
+ }
253
+ // Remove those that are provided by siblings
254
+ for (const provided of providesMap.keys()) {
255
+ allRequired.delete(provided);
256
+ }
257
+ return [...allRequired];
258
+ }
259
+ /**
260
+ * Detect circular dependencies via DFS.
261
+ * Returns the cycle path if found, null otherwise.
262
+ */
263
+ detectCycle(depGraph) {
264
+ const visited = new Set();
265
+ const visiting = new Set();
266
+ const visit = (node, path) => {
267
+ if (visiting.has(node)) {
268
+ return [...path, node];
269
+ }
270
+ if (visited.has(node))
271
+ return null;
272
+ visiting.add(node);
273
+ const deps = depGraph.get(node);
274
+ if (deps) {
275
+ for (const dep of deps) {
276
+ const cycle = visit(dep, [...path, node]);
277
+ if (cycle)
278
+ return cycle;
279
+ }
280
+ }
281
+ visiting.delete(node);
282
+ visited.add(node);
283
+ return null;
284
+ };
285
+ for (const node of depGraph.keys()) {
286
+ const cycle = visit(node, []);
287
+ if (cycle)
288
+ return cycle;
289
+ }
290
+ return null;
291
+ }
292
+ }
293
+ //# sourceMappingURL=group-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group-executor.js","sourceRoot":"","sources":["../../src/recipe-engine/group-executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,WAAW,MAAM,OAAO,CAAC;AAQhC,MAAM,KAAK,GAAG,WAAW,CAAC,6BAA6B,CAAC,CAAC;AA6CzD,MAAM,OAAO,aAAa;IACI;IAA7B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAE3D;;;;;;;OAOG;IACH,KAAK,CAAC,aAAa,CAAC,OAAe;QAClC,MAAM,OAAO,GAAuB,EAAE,CAAC;Q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;QAED,OAAO,IAAI,CAAC;IACb,CAAC;CACD"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Recipe Engine - Complete Recipe Step System
3
+ *
4
+ * Central export point for the entire Recipe Step System including:
5
+ * - Recipe Engine (main orchestrator and entry point)
6
+ * - Step Executor (orchestration engine)
7
+ * - Tool Framework (template, action, codemod, recipe tools)
8
+ * - Type System (comprehensive TypeScript definitions)
9
+ * - Registry System (tool management)
10
+ */
11
+ export { RecipeEngine, createRecipeEngine, executeRecipe, loadRecipe, validateRecipe, type RecipeSource, type RecipeExecutionOptions, type RecipeExecutionResult, type RecipeLoadResult, } from "./recipe-engine.js";
12
+ export { StepExecutor, type StepExecutorConfig, type StepExecutionMetrics, type StepExecutionProgress, } from "./step-executor.js";
13
+ export * from "./tools/index.js";
14
+ export * from "./types.js";
15
+ export { isTemplateStep, isActionStep, isCodeModStep, isRecipeStep, isAIStep, isInstallStep, isQueryStep, isPatchStep, isEnsureDirsStep, StepExecutionError, RecipeDependencyError, CircularDependencyError, } from "./types.js";
16
+ export declare const RECIPE_ENGINE_VERSION = "8.0.0";
17
+ /**
18
+ * Supported recipe features in this version
19
+ */
20
+ export declare const RECIPE_ENGINE_FEATURES: readonly ["step-orchestration", "dependency-management", "parallel-execution", "conditional-logic", "error-handling", "progress-tracking", "metrics-collection", "tool-registry", "action-pipelines", "codemod-transformations", "sub-recipe-execution"];
21
+ export type RecipeEngineFeature = (typeof RECIPE_ENGINE_FEATURES)[number];
22
+ /**
23
+ * Recipe Engine initialization configuration
24
+ */
25
+ export interface RecipeEngineConfig {
26
+ /** Step executor configuration */
27
+ stepExecutor?: Partial<import("./step-executor.js").StepExecutorConfig>;
28
+ /** Enable debug logging */
29
+ enableDebugLogging?: boolean;
30
+ /** Features to enable (all enabled by default) */
31
+ enabledFeatures?: RecipeEngineFeature[];
32
+ }
33
+ /**
34
+ * Initialize the Recipe Engine with all components
35
+ *
36
+ * This is the main entry point for setting up the complete Recipe Step System.
37
+ * Call this once during application startup to configure all components.
38
+ */
39
+ export declare function initializeRecipeEngine(config?: RecipeEngineConfig): {
40
+ stepExecutor: import("./step-executor.js").StepExecutor;
41
+ toolRegistry: import("./tools/registry.js").ToolRegistry;
42
+ version: string;
43
+ features: readonly RecipeEngineFeature[];
44
+ };
45
+ /**
46
+ * Quick setup for common Recipe Engine use cases
47
+ */
48
+ export declare const RecipeEnginePresets: {
49
+ /**
50
+ * Development preset - optimized for fast feedback
51
+ */
52
+ readonly development: () => RecipeEngineConfig;
53
+ /**
54
+ * Production preset - optimized for reliability and performance
55
+ */
56
+ readonly production: () => RecipeEngineConfig;
57
+ /**
58
+ * Testing preset - optimized for test isolation and debugging
59
+ */
60
+ readonly testing: () => RecipeEngineConfig;
61
+ /**
62
+ * High performance preset - optimized for speed
63
+ */
64
+ readonly performance: () => RecipeEngineConfig;
65
+ };
66
+ /**
67
+ * Recipe Engine health check utility
68
+ */
69
+ export declare function checkRecipeEngineHealth(): {
70
+ healthy: boolean;
71
+ version: string;
72
+ issues: string[];
73
+ components: {
74
+ stepExecutor: boolean;
75
+ toolRegistry: boolean;
76
+ };
77
+ toolRegistryHealth: ReturnType<typeof import("./tools/index.js").checkRegistryHealth>;
78
+ };
79
+ /**
80
+ * Development utilities for Recipe Engine
81
+ */
82
+ export declare const RecipeEngineDevUtils: {
83
+ /**
84
+ * Create a minimal step executor for testing
85
+ */
86
+ readonly createTestStepExecutor: (config?: Partial<import("./step-executor.js").StepExecutorConfig>) => any;
87
+ /**
88
+ * Reset all Recipe Engine components for testing
89
+ */
90
+ readonly resetForTesting: () => void;
91
+ /**
92
+ * Get comprehensive debug information
93
+ */
94
+ readonly getDebugInfo: () => {
95
+ engine: {
96
+ version: string;
97
+ features: readonly ["step-orchestration", "dependency-management", "parallel-execution", "conditional-logic", "error-handling", "progress-tracking", "metrics-collection", "tool-registry", "action-pipelines", "codemod-transformations", "sub-recipe-execution"];
98
+ health: {
99
+ healthy: boolean;
100
+ version: string;
101
+ issues: string[];
102
+ components: {
103
+ stepExecutor: boolean;
104
+ toolRegistry: boolean;
105
+ };
106
+ toolRegistryHealth: ReturnType<typeof import("./tools/index.js").checkRegistryHealth>;
107
+ };
108
+ };
109
+ toolFramework: any;
110
+ };
111
+ };
112
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/recipe-engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACrB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,GAC1B,MAAM,oBAAoB,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,YAAY,CAAC;AAG3B,OAAO,EACN,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,GACvB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0PAYzB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,kCAAkC;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;IAExE,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,kDAAkD;IAClD,eAAe,CAAC,EAAE,mBAAmB,EAAE,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