@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,223 @@
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
+ // Main Recipe Engine
12
+ export { RecipeEngine, createRecipeEngine, executeRecipe, loadRecipe, validateRecipe, } from "./recipe-engine.js";
13
+ // Step Execution Engine
14
+ export { StepExecutor, } from "./step-executor.js";
15
+ // Complete Tool Framework
16
+ export * from "./tools/index.js";
17
+ // Complete Type System
18
+ export * from "./types.js";
19
+ // Export type guards from types
20
+ export { isTemplateStep, isActionStep, isCodeModStep, isRecipeStep, isAIStep, isInstallStep, isQueryStep, isPatchStep, isEnsureDirsStep, StepExecutionError, RecipeDependencyError, CircularDependencyError, } from "./types.js";
21
+ // Recipe Engine Constants and Utilities
22
+ export const RECIPE_ENGINE_VERSION = "8.0.0";
23
+ /**
24
+ * Supported recipe features in this version
25
+ */
26
+ export const RECIPE_ENGINE_FEATURES = [
27
+ "step-orchestration",
28
+ "dependency-management",
29
+ "parallel-execution",
30
+ "conditional-logic",
31
+ "error-handling",
32
+ "progress-tracking",
33
+ "metrics-collection",
34
+ "tool-registry",
35
+ "action-pipelines",
36
+ "codemod-transformations",
37
+ "sub-recipe-execution",
38
+ ];
39
+ /**
40
+ * Initialize the Recipe Engine with all components
41
+ *
42
+ * This is the main entry point for setting up the complete Recipe Step System.
43
+ * Call this once during application startup to configure all components.
44
+ */
45
+ export function initializeRecipeEngine(config = {}) {
46
+ // Initialize tools framework first
47
+ const { initializeToolsFramework } = require("./tools/index.js");
48
+ const toolRegistry = initializeToolsFramework({
49
+ enableDebugLogging: config.enableDebugLogging,
50
+ });
51
+ // Initialize step executor
52
+ const { StepExecutor } = require("./step-executor.js");
53
+ const stepExecutor = new StepExecutor(toolRegistry, config.stepExecutor);
54
+ // Enable additional debug logging if requested
55
+ if (config.enableDebugLogging) {
56
+ const existing = process.env.DEBUG || "";
57
+ const recipeDebug = "hyper:recipe:*";
58
+ process.env.DEBUG = existing ? `${existing},${recipeDebug}` : recipeDebug;
59
+ }
60
+ const enabledFeatures = config.enabledFeatures || [...RECIPE_ENGINE_FEATURES];
61
+ return {
62
+ stepExecutor,
63
+ toolRegistry,
64
+ version: RECIPE_ENGINE_VERSION,
65
+ features: enabledFeatures,
66
+ };
67
+ }
68
+ /**
69
+ * Quick setup for common Recipe Engine use cases
70
+ */
71
+ export const RecipeEnginePresets = {
72
+ /**
73
+ * Development preset - optimized for fast feedback
74
+ */
75
+ development: () => ({
76
+ stepExecutor: {
77
+ maxConcurrency: 5,
78
+ defaultTimeout: 15000,
79
+ collectMetrics: true,
80
+ enableProgressTracking: true,
81
+ continueOnError: true,
82
+ },
83
+ enableDebugLogging: true,
84
+ }),
85
+ /**
86
+ * Production preset - optimized for reliability and performance
87
+ */
88
+ production: () => ({
89
+ stepExecutor: {
90
+ maxConcurrency: 20,
91
+ defaultTimeout: 60000,
92
+ collectMetrics: false,
93
+ enableProgressTracking: false,
94
+ continueOnError: false,
95
+ },
96
+ enableDebugLogging: false,
97
+ }),
98
+ /**
99
+ * Testing preset - optimized for test isolation and debugging
100
+ */
101
+ testing: () => ({
102
+ stepExecutor: {
103
+ maxConcurrency: 1, // Sequential execution for predictable tests
104
+ defaultTimeout: 5000,
105
+ collectMetrics: true,
106
+ enableProgressTracking: true,
107
+ continueOnError: true,
108
+ },
109
+ enableDebugLogging: true,
110
+ }),
111
+ /**
112
+ * High performance preset - optimized for speed
113
+ */
114
+ performance: () => ({
115
+ stepExecutor: {
116
+ maxConcurrency: 50,
117
+ defaultTimeout: 30000,
118
+ collectMetrics: false,
119
+ enableProgressTracking: false,
120
+ continueOnError: false,
121
+ },
122
+ enableDebugLogging: false,
123
+ }),
124
+ };
125
+ /**
126
+ * Recipe Engine health check utility
127
+ */
128
+ export function checkRecipeEngineHealth() {
129
+ const issues = [];
130
+ let stepExecutorHealthy = true;
131
+ let toolRegistryHealthy = true;
132
+ try {
133
+ // Check if StepExecutor can be imported
134
+ const { StepExecutor } = require("./step-executor.js");
135
+ if (!StepExecutor) {
136
+ stepExecutorHealthy = false;
137
+ issues.push("StepExecutor not available");
138
+ }
139
+ }
140
+ catch (error) {
141
+ stepExecutorHealthy = false;
142
+ issues.push(`StepExecutor import failed: ${error instanceof Error ? error.message : String(error)}`);
143
+ }
144
+ try {
145
+ // Check tool registry health
146
+ const { checkRegistryHealth } = require("./tools/index.js");
147
+ const registryHealth = checkRegistryHealth();
148
+ if (!registryHealth.healthy) {
149
+ toolRegistryHealthy = false;
150
+ issues.push(...registryHealth.issues.map((issue) => `Tool Registry: ${issue}`));
151
+ }
152
+ return {
153
+ healthy: issues.length === 0,
154
+ version: RECIPE_ENGINE_VERSION,
155
+ issues,
156
+ components: {
157
+ stepExecutor: stepExecutorHealthy,
158
+ toolRegistry: toolRegistryHealthy,
159
+ },
160
+ toolRegistryHealth: registryHealth,
161
+ };
162
+ }
163
+ catch (error) {
164
+ toolRegistryHealthy = false;
165
+ issues.push(`Tool registry health check failed: ${error instanceof Error ? error.message : String(error)}`);
166
+ return {
167
+ healthy: false,
168
+ version: RECIPE_ENGINE_VERSION,
169
+ issues,
170
+ components: {
171
+ stepExecutor: stepExecutorHealthy,
172
+ toolRegistry: false,
173
+ },
174
+ toolRegistryHealth: {
175
+ healthy: false,
176
+ issues: ["Registry health check unavailable"],
177
+ stats: {},
178
+ },
179
+ };
180
+ }
181
+ }
182
+ /**
183
+ * Development utilities for Recipe Engine
184
+ */
185
+ export const RecipeEngineDevUtils = {
186
+ /**
187
+ * Create a minimal step executor for testing
188
+ */
189
+ createTestStepExecutor: (config = {}) => {
190
+ const { StepExecutor } = require("./step-executor.js");
191
+ return new StepExecutor(undefined, {
192
+ maxConcurrency: 1,
193
+ collectMetrics: true,
194
+ enableProgressTracking: true,
195
+ continueOnError: true,
196
+ ...config,
197
+ });
198
+ },
199
+ /**
200
+ * Reset all Recipe Engine components for testing
201
+ */
202
+ resetForTesting: () => {
203
+ const { DevUtils } = require("./tools/index.js");
204
+ DevUtils.resetRegistry();
205
+ },
206
+ /**
207
+ * Get comprehensive debug information
208
+ */
209
+ getDebugInfo: () => {
210
+ const health = checkRecipeEngineHealth();
211
+ const { DevUtils } = require("./tools/index.js");
212
+ const registryInfo = DevUtils.getRegistryDebugInfo();
213
+ return {
214
+ engine: {
215
+ version: RECIPE_ENGINE_VERSION,
216
+ features: RECIPE_ENGINE_FEATURES,
217
+ health,
218
+ },
219
+ toolFramework: registryInfo,
220
+ };
221
+ },
222
+ };
223
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/recipe-engine/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,qBAAqB;AACrB,OAAO,EACN,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,GAKd,MAAM,oBAAoB,CAAC;AAE5B,wBAAwB;AACxB,OAAO,EACN,YAAY,GAIZ,MAAM,oBAAoB,CAAC;AAE5B,0BAA0B;AAC1B,cAAc,kBAAkB,CAAC;AAEjC,uBAAuB;AACvB,cAAc,YAAY,CAAC;AAE3B,gCAAgC;AAChC,OAAO,EACN,cAAc,EACd,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,W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M;aACN;YACD,aAAa,EAAE,YAAY;SAC3B,CAAC;IACH,CAAC;CACQ,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Output Expression Evaluator
3
+ *
4
+ * Evaluates step `output` expressions against tool results after step execution.
5
+ * Expressions use Jig template syntax for full flexibility.
6
+ *
7
+ * Example recipe YAML:
8
+ * ```yaml
9
+ * steps:
10
+ * - name: generate-route
11
+ * tool: template
12
+ * template: ./templates/route.jig
13
+ * output:
14
+ * update-route-path: "{{ result.filesGenerated[0] }}"
15
+ * route-name: "{{ result.variables.routeName | kebabCase }}"
16
+ * ```
17
+ */
18
+ import type { StepContext } from "./types.js";
19
+ /**
20
+ * Evaluate output expressions from a step's `output` field.
21
+ *
22
+ * @param outputExpressions Map of variable names to Jig template expressions
23
+ * @param toolResult The raw result returned by the tool
24
+ * @param context Current step context (for access to variables etc.)
25
+ * @returns Map of variable name -> evaluated value
26
+ */
27
+ export declare function evaluateStepOutputs(outputExpressions: Record<string, string>, toolResult: any, context: StepContext): Promise<Record<string, any>>;
28
+ //# sourceMappingURL=output-evaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-evaluator.d.ts","sourceRoot":"","sources":["../../src/recipe-engine/output-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACxC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,UAAU,EAAE,GAAG,EACf,OAAO,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAwC9B"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Output Expression Evaluator
3
+ *
4
+ * Evaluates step `output` expressions against tool results after step execution.
5
+ * Expressions use Jig template syntax for full flexibility.
6
+ *
7
+ * Example recipe YAML:
8
+ * ```yaml
9
+ * steps:
10
+ * - name: generate-route
11
+ * tool: template
12
+ * template: ./templates/route.jig
13
+ * output:
14
+ * update-route-path: "{{ result.filesGenerated[0] }}"
15
+ * route-name: "{{ result.variables.routeName | kebabCase }}"
16
+ * ```
17
+ */
18
+ import createDebug from "debug";
19
+ import { renderTemplate } from "#template-engines/index";
20
+ const debug = createDebug("hyper:recipe:output-evaluator");
21
+ /**
22
+ * Evaluate output expressions from a step's `output` field.
23
+ *
24
+ * @param outputExpressions Map of variable names to Jig template expressions
25
+ * @param toolResult The raw result returned by the tool
26
+ * @param context Current step context (for access to variables etc.)
27
+ * @returns Map of variable name -> evaluated value
28
+ */
29
+ export async function evaluateStepOutputs(outputExpressions, toolResult, context) {
30
+ const outputs = {};
31
+ // Build evaluation context
32
+ const evalContext = {
33
+ result: toolResult ?? {},
34
+ step: context.step?.name,
35
+ status: "completed",
36
+ ...context.variables,
37
+ };
38
+ for (const [varName, expression] of Object.entries(outputExpressions)) {
39
+ try {
40
+ debug("Evaluating output expression: %s = %s", varName, expression);
41
+ // If the expression looks like a Jig template (contains {{ }}), render it
42
+ if (expression.includes("{{") || expression.includes("@")) {
43
+ const rendered = await renderTemplate(expression, evalContext);
44
+ // Trim whitespace that Jig may add
45
+ const trimmed = typeof rendered === "string" ? rendered.trim() : rendered;
46
+ outputs[varName] = trimmed;
47
+ }
48
+ else {
49
+ // Plain expression — evaluate as property access on the context
50
+ outputs[varName] = evaluateSimpleExpression(expression, evalContext);
51
+ }
52
+ debug("Output evaluated: %s = %o", varName, outputs[varName]);
53
+ }
54
+ catch (error) {
55
+ debug("Output expression evaluation failed: %s = %s (%s)", varName, expression, error instanceof Error ? error.message : String(error));
56
+ // Set to undefined on error rather than failing the whole step
57
+ outputs[varName] = undefined;
58
+ }
59
+ }
60
+ return outputs;
61
+ }
62
+ /**
63
+ * Evaluate a simple dot-notation expression against a context.
64
+ * e.g., "result.filesGenerated[0]" or "result.variables.name"
65
+ */
66
+ function evaluateSimpleExpression(expression, context) {
67
+ try {
68
+ // Use Function constructor for safe(r) expression evaluation
69
+ const keys = Object.keys(context);
70
+ const values = Object.values(context);
71
+ const fn = new Function(...keys, `return ${expression}`);
72
+ return fn(...values);
73
+ }
74
+ catch {
75
+ return undefined;
76
+ }
77
+ }
78
+ //# sourceMappingURL=output-evaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-evaluator.js","sourceRoot":"","sources":["../../src/recipe-engine/output-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,MAAM,KAAK,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,iBAAyC,EACzC,UAAe,EACf,OAAoB;IAEpB,MAAM,OAAO,GAAwB,EAAE,CAAC;IAExC,2BAA2B;IAC3B,MAAM,WAAW,GAAwB;QACxC,MAAM,EAAE,UAAU,IAAI,EAAE;QACxB,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI;QACxB,MAAM,EAAE,WAAW;QACnB,GAAG,OAAO,CAAC,SAAS;KACpB,CAAC;IAEF,KAAK,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACvE,IAAI,CAAC;YACJ,KAAK,CAAC,uCAAuC,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAEpE,0EAA0E;YAC1E,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC3D,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;gBAC/D,mCAAmC;gBACnC,MAAM,OAAO,G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entry point for executing recipes in HyperDev.
5
+ * It provides recipe discovery, loading, validation, variable resolution, and execution
6
+ * coordination through the complete Recipe Step System.
7
+ */
8
+ import { EventEmitter } from "node:events";
9
+ import { Logger } from "@hypercli/core";
10
+ import type { AiServiceConfig } from "#ai/ai-config";
11
+ import { type StepExecutorConfig } from "./step-executor.js";
12
+ import type { RecipeConfig, RecipeExecution, RecipeValidationResult, StepExecutionOptions, StepResult } from "./types.js";
13
+ /**
14
+ * Recipe source types for loading
15
+ */
16
+ export type RecipeSource = {
17
+ type: "content";
18
+ content: string;
19
+ name: string;
20
+ } | {
21
+ type: "file";
22
+ path: string;
23
+ };
24
+ /**
25
+ * Recipe execution options
26
+ */
27
+ export interface RecipeExecutionOptions {
28
+ /** Variables to pass to the recipe */
29
+ variables?: Record<string, any>;
30
+ /** Environment variables */
31
+ environment?: Record<string, string>;
32
+ /** Working directory for execution */
33
+ workingDir?: string;
34
+ /** Whether to run in dry-run mode */
35
+ dryRun?: boolean;
36
+ /** Whether to force overwrite existing files */
37
+ force?: boolean;
38
+ /** Whether to continue on step failures */
39
+ continueOnError?: boolean;
40
+ /** Custom step execution options */
41
+ stepOptions?: Partial<StepExecutionOptions>;
42
+ /** Whether to skip user prompts (use defaults/existing values) */
43
+ skipPrompts?: boolean;
44
+ /** Who resolves missing variables: 'me' (interactive), 'ai', 'nobody' (error) */
45
+ askMode?: "me" | "ai" | "nobody";
46
+ /** Don't auto-apply default values — treat all vars as unresolved */
47
+ noDefaults?: boolean;
48
+ /** AI config for --ask=ai mode (from hypergen.config.js) */
49
+ aiConfig?: AiServiceConfig;
50
+ /** Custom logger for output */
51
+ logger?: Logger;
52
+ /** Progress callback */
53
+ onProgress?: (progress: {
54
+ step: string;
55
+ phase: string;
56
+ percentage: number;
57
+ }) => void;
58
+ /** Step completion callback */
59
+ onStepComplete?: (result: StepResult) => void;
60
+ /** AI answers for 2-pass generation (Pass 2) */
61
+ answers?: Record<string, any>;
62
+ }
63
+ /**
64
+ * Recipe engine configuration
65
+ */
66
+ export interface RecipeEngineConfig {
67
+ /** Step executor configuration */
68
+ stepExecutor?: Partial<StepExecutorConfig>;
69
+ /** Working directory for all operations */
70
+ workingDir?: string;
71
+ /** Default timeout for all operations */
72
+ defaultTimeout?: number;
73
+ /** Whether to enable debug logging */
74
+ enableDebugLogging?: boolean;
75
+ }
76
+ /**
77
+ * Recipe execution result
78
+ */
79
+ export interface RecipeExecutionResult {
80
+ /** Execution ID */
81
+ executionId: string;
82
+ /** Recipe that was executed */
83
+ recipe: RecipeConfig;
84
+ /** Overall execution status */
85
+ success: boolean;
86
+ /** Step execution results */
87
+ stepResults: StepResult[];
88
+ /** Total execution time in milliseconds */
89
+ duration: number;
90
+ /** Files created during execution */
91
+ filesCreated: string[];
92
+ /** Files modified during execution */
93
+ filesModified: string[];
94
+ /** Files deleted during execution */
95
+ filesDeleted: string[];
96
+ /** Execution errors */
97
+ errors: string[];
98
+ /** Execution warnings */
99
+ warnings: string[];
100
+ /** Final resolved variables */
101
+ variables: Record<string, any>;
102
+ /** Execution metadata */
103
+ metadata: {
104
+ startTime: Date;
105
+ endTime: Date;
106
+ workingDir: string;
107
+ totalSteps: number;
108
+ completedSteps: number;
109
+ failedSteps: number;
110
+ skippedSteps: number;
111
+ /** Values collected from recipe.provides declarations */
112
+ providedValues?: Record<string, any>;
113
+ };
114
+ }
115
+ /**
116
+ * Recipe loading result
117
+ */
118
+ export interface RecipeLoadResult {
119
+ recipe: RecipeConfig;
120
+ source: RecipeSource;
121
+ validation: RecipeValidationResult;
122
+ dependencies: RecipeConfig[];
123
+ }
124
+ /**
125
+ * Main Recipe Engine
126
+ *
127
+ * The RecipeEngine provides the primary API for executing recipes. It handles:
128
+ * - Recipe discovery and loading from various sources
129
+ * - Recipe validation and preprocessing
130
+ * - Variable resolution with user prompts
131
+ * - Step orchestration through StepExecutor
132
+ * - Result aggregation and reporting
133
+ * - Error handling and recovery
134
+ */
135
+ export declare class RecipeEngine extends EventEmitter {
136
+ private readonly config;
137
+ private readonly logger;
138
+ private readonly debug;
139
+ private readonly stepExecutor;
140
+ private readonly toolRegistry;
141
+ private readonly activeExecutions;
142
+ private executionCounter;
143
+ private readonly recipeCache;
144
+ constructor(config?: RecipeEngineConfig);
145
+ /**
146
+ * Execute a recipe from various sources
147
+ *
148
+ * @param source Recipe source (file path, URL, package name, or content)
149
+ * @param options Execution options including variables and behavior settings
150
+ * @returns Promise resolving to execution result
151
+ */
152
+ executeRecipe(source: string | RecipeSource, options?: RecipeExecutionOptions): Promise<RecipeExecutionResult>;
153
+ /**
154
+ * Load a recipe from a source without executing it
155
+ */
156
+ loadRecipe(source: string | RecipeSource): Promise<RecipeLoadResult>;
157
+ /**
158
+ * Validate a recipe configuration
159
+ */
160
+ validateRecipe(recipe: RecipeConfig): Promise<RecipeValidationResult>;
161
+ /**
162
+ * Get current execution status
163
+ */
164
+ getExecutions(): RecipeExecution[];
165
+ /**
166
+ * Cancel a recipe execution
167
+ */
168
+ cancelExecution(executionId: string): Promise<void>;
169
+ /**
170
+ * Cancel all active executions
171
+ */
172
+ cancelAllExecutions(): Promise<void>;
173
+ /**
174
+ * Clean up resources
175
+ */
176
+ cleanup(): Promise<void>;
177
+ private normalizeSource;
178
+ private getCacheKey;
179
+ private loadRecipeContent;
180
+ private loadFileContent;
181
+ private parseRecipeContent;
182
+ /**
183
+ * Parse the `provides` field from recipe YAML
184
+ */
185
+ private parseProvides;
186
+ /**
187
+ * Normalize steps to infer tool types from shorthands
188
+ */
189
+ private normalizeSteps;
190
+ private resolveVariables;
191
+ private getPromptType;
192
+ private createExecutionContext;
193
+ private createConditionEvaluator;
194
+ /**
195
+ * Recursively count steps including those nested in sequence/parallel tools
196
+ */
197
+ private countNestedSteps;
198
+ private aggregateResults;
199
+ /**
200
+ * Render and print onSuccess or onError message after recipe execution
201
+ */
202
+ private renderLifecycleMessage;
203
+ private loadDependencies;
204
+ private dependencyToSource;
205
+ private validateVariable;
206
+ private validateStep;
207
+ private validateStepDependencies;
208
+ private validateDependency;
209
+ private generateExecutionId;
210
+ }
211
+ /**
212
+ * Create a new recipe engine instance
213
+ */
214
+ export declare function createRecipeEngine(config?: RecipeEngineConfig): RecipeEngine;
215
+ /**
216
+ * Execute a recipe with default configuration
217
+ */
218
+ export declare function executeRecipe(source: string | RecipeSource, options?: RecipeExecutionOptions): Promise<RecipeExecutionResult>;
219
+ /**
220
+ * Load and validate a recipe without executing
221
+ */
222
+ export declare function loadRecipe(source: string | RecipeSource, config?: RecipeEngineConfig): Promise<RecipeLoadResult>;
223
+ /**
224
+ * Validate a recipe configuration
225
+ */
226
+ export declare function validateRecipe(recipe: RecipeConfig, config?: RecipeEngineConfig): Promise<RecipeValidationResult>;
227
+ //# sourceMappingURL=recipe-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe-engine.d.ts","sourceRoot":"","sources":["../../src/recipe-engine/recipe-engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKrD,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAG3E,OAAO,KAAK,EACX,YAAY,EACZ,eAAe,EAGf,sBAAsB,EAEtB,oBAAoB,EACpB,UAAU,EACV,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,MAAM,MAAM,YAAY,GACrB;IACA,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACZ,GACD;IACA,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACZ,CAAC;AAEL;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAA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