@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,613 @@
1
+ /**
2
+ * Template Tool Implementation for Recipe Step System
3
+ *
4
+ * This tool processes template files using Hypergen's existing template engines,
5
+ * handles frontmatter processing, and generates files to the filesystem.
6
+ * It integrates seamlessly with the Jig template engine while supporting
7
+ * all existing template features like composition and variable substitution.
8
+ */
9
+ import path from "node:path";
10
+ import { ErrorCode, ErrorHandler, HypergenError, } from "@hypercli/core";
11
+ import fm from "front-matter";
12
+ import fs from "fs-extra";
13
+ import addOp from "#ops/add";
14
+ import injectOp from "#ops/inject";
15
+ import { isTemplateStep, } from "#recipe-engine/types";
16
+ import { getJig, renderTemplate as jigRenderTemplate } from "#template-engines/index";
17
+ import { Tool } from "./base.js";
18
+ /**
19
+ * Template Tool for processing template files in the Recipe Step System
20
+ *
21
+ * Features:
22
+ * - Integration with the Jig template engine
23
+ * - Frontmatter processing (to:, skip_if:, inject:, unless_exists:, force:)
24
+ * - Template discovery and resolution
25
+ * - Variable substitution and context management
26
+ * - File generation with path resolution
27
+ * - Template composition support
28
+ * - Comprehensive error handling and validation
29
+ */
30
+ export class TemplateTool extends Tool {
31
+ templateEnginesInitialized = false;
32
+ templateCache = new Map();
33
+ constructor(name = "template-tool", options = {}) {
34
+ super("template", name, options);
35
+ }
36
+ /**
37
+ * Initialize template engines and prepare tool for execution
38
+ */
39
+ async onInitialize() {
40
+ this.debug("Initializing template engines");
41
+ try {
42
+ // Use getJig() to reuse the existing singleton rather than
43
+ // creating a fresh instance per tool. This preserves any
44
+ // globals/filters registered before recipe execution.
45
+ getJig();
46
+ this.templateEnginesInitialized = true;
47
+ this.registerResource({
48
+ id: "template-cache",
49
+ type: "cache",
50
+ cleanup: () => {
51
+ this.templateCache.clear();
52
+ },
53
+ metadata: { cacheSize: 0 },
54
+ });
55
+ this.debug("Template engines initialized successfully");
56
+ }
57
+ catch (error) {
58
+ throw ErrorHandler.createError(ErrorCode.INTERNAL_ERROR, `Failed to initialize template engines: ${error instanceof Error ? error.message : String(error)}`, { phase: "initialize", cause: error });
59
+ }
60
+ }
61
+ /**
62
+ * Validate template step configuration
63
+ */
64
+ async onValidate(step, context) {
65
+ const errors = [];
66
+ const warnings = [];
67
+ const suggestions = [];
68
+ // Validate step is a template step
69
+ if (!isTemplateStep(step)) {
70
+ errors.push("Step is not a valid TemplateStep");
71
+ return { isValid: false, errors, warnings, suggestions };
72
+ }
73
+ // Validate required fields
74
+ if (!step.template) {
75
+ errors.push("Template identifier is required");
76
+ }
77
+ // Validate template exists and is accessible
78
+ if (step.template) {
79
+ try {
80
+ const resolution = await this.resolveTemplate(step.template, context);
81
+ if (!resolution.metadata.exists) {
82
+ errors.push(`Template file not found: ${step.template}`);
83
+ }
84
+ }
85
+ catch (error) {
86
+ errors.push(`Template resolution failed: ${error instanceof Error ? error.message : String(error)}`);
87
+ }
88
+ }
89
+ // Validate output directory
90
+ if (step.outputDir) {
91
+ if (path.isAbsolute(step.outputDir)) {
92
+ warnings.push("Output directory should be relative to project root");
93
+ }
94
+ const outputPath = path.resolve(context.projectRoot, step.outputDir);
95
+ if (!(await fs.pathExists(path.dirname(outputPath)))) {
96
+ warnings.push(`Output directory parent does not exist: ${path.dirname(outputPath)}`);
97
+ }
98
+ }
99
+ // Validate exclude patterns
100
+ if (step.exclude) {
101
+ for (const pattern of step.exclude) {
102
+ if (typeof pattern !== "string") {
103
+ errors.push("Exclude patterns must be strings");
104
+ break;
105
+ }
106
+ }
107
+ }
108
+ // Validate template variables
109
+ if (step.templateConfig?.variables) {
110
+ for (const [key, variable] of Object.entries(step.templateConfig.variables)) {
111
+ if (!variable.type) {
112
+ warnings.push(`Template variable '${key}' is missing type definition`);
113
+ }
114
+ }
115
+ }
116
+ // Performance suggestions
117
+ if (step.templateConfig?.composition?.includes?.length &&
118
+ step.templateConfig.composition.includes.length > 10) {
119
+ suggestions.push("Consider reducing template includes for better performance");
120
+ }
121
+ // Estimate execution time based on template complexity
122
+ let estimatedTime = 100; // Base time in ms
123
+ if (step.templateConfig?.composition?.includes) {
124
+ estimatedTime += step.templateConfig.composition.includes.length * 50;
125
+ }
126
+ if (step.exclude?.length) {
127
+ estimatedTime += step.exclude.length * 10;
128
+ }
129
+ const resourceRequirements = {
130
+ memory: 10 * 1024 * 1024, // 10MB base memory
131
+ disk: 1 * 1024 * 1024, // 1MB estimated disk usage
132
+ network: false,
133
+ processes: 1,
134
+ };
135
+ return {
136
+ isValid: errors.length === 0,
137
+ errors,
138
+ warnings,
139
+ suggestions,
140
+ estimatedExecutionTime: estimatedTime,
141
+ resourceRequirements,
142
+ };
143
+ }
144
+ /**
145
+ * Execute the template tool
146
+ */
147
+ async onExecute(step, context, options) {
148
+ this.debug("Executing template step: %s", step.name);
149
+ const startTime = new Date();
150
+ const filesCreated = [];
151
+ const filesModified = [];
152
+ const filesDeleted = [];
153
+ try {
154
+ // Ensure template engines are initialized
155
+ if (!this.templateEnginesInitialized) {
156
+ await this.onInitialize();
157
+ }
158
+ // Resolve template
159
+ const templateResolution = await this.resolveTemplate(step.template, context);
160
+ this.debug("Template resolved: %s -> %s", step.template, templateResolution.filePath);
161
+ // Process template composition if configured
162
+ const templateFiles = await this.processTemplateComposition(step, context, templateResolution);
163
+ this.debug("Found %d template files to process", templateFiles.length);
164
+ // Render all template files
165
+ const renderedFiles = [];
166
+ for (const templateFile of templateFiles) {
167
+ const rendered = await this.renderTemplateFile(templateFile, step, context);
168
+ renderedFiles.push(rendered);
169
+ }
170
+ // Filter out skipped files
171
+ const filesToGenerate = renderedFiles.filter((file) => !file.shouldSkip);
172
+ const skippedFiles = renderedFiles.filter((file) => file.shouldSkip);
173
+ this.debug("Processing %d files, skipping %d files", filesToGenerate.length, skippedFiles.length);
174
+ // In collect mode (Pass 1), skip all file generation — templates were
175
+ // rendered only to trigger @ai block collection
176
+ if (context.collectMode) {
177
+ this.debug("Collect mode: skipping file generation (Pass 1)");
178
+ const endTime = new Date();
179
+ const duration = endTime.getTime() - startTime.getTime();
180
+ return {
181
+ status: "completed",
182
+ stepName: step.name,
183
+ toolType: "template",
184
+ startTime,
185
+ endTime,
186
+ duration,
187
+ retryCount: 0,
188
+ dependenciesSatisfied: true,
189
+ toolResult: {
190
+ templateName: step.template,
191
+ templatePath: templateResolution.filePath,
192
+ engine: templateResolution.engine,
193
+ filesGenerated: [],
194
+ variables: context.variables,
195
+ },
196
+ output: {
197
+ collectMode: true,
198
+ templatesRendered: renderedFiles.length,
199
+ },
200
+ };
201
+ }
202
+ // Generate files
203
+ for (const renderedFile of filesToGenerate) {
204
+ const result = await this.generateFile(renderedFile, step, context, options);
205
+ if (result.status === "added" || result.status === "forced") {
206
+ filesCreated.push(renderedFile.targetPath);
207
+ }
208
+ else if (result.status === "injected") {
209
+ filesModified.push(renderedFile.targetPath);
210
+ }
211
+ }
212
+ // Update cache metadata
213
+ const cacheResource = this.resources.get("template-cache");
214
+ if (cacheResource) {
215
+ cacheResource.metadata.cacheSize = this.templateCache.size;
216
+ }
217
+ const endTime = new Date();
218
+ const duration = endTime.getTime() - startTime.getTime();
219
+ // Create tool-specific result
220
+ const templateResult = {
221
+ templateName: step.template,
222
+ templatePath: templateResolution.filePath,
223
+ engine: templateResolution.engine,
224
+ filesGenerated: filesCreated,
225
+ variables: context.variables,
226
+ };
227
+ return {
228
+ status: "completed",
229
+ stepName: step.name,
230
+ toolType: "template",
231
+ startTime,
232
+ endTime,
233
+ duration,
234
+ retryCount: 0,
235
+ dependenciesSatisfied: true,
236
+ toolResult: templateResult,
237
+ filesCreated,
238
+ filesModified,
239
+ filesDeleted,
240
+ output: {
241
+ templateEngine: templateResolution.engine,
242
+ totalFiles: renderedFiles.length,
243
+ generatedFiles: filesToGenerate.length,
244
+ skippedFiles: skippedFiles.length,
245
+ skippedReasons: skippedFiles.map((f) => ({
246
+ path: f.templatePath,
247
+ reason: f.skipReason,
248
+ })),
249
+ },
250
+ metadata: {
251
+ templateResolution: {
252
+ originalTemplate: step.template,
253
+ resolvedPath: templateResolution.filePath,
254
+ engine: templateResolution.engine,
255
+ },
256
+ performance: {
257
+ cacheHits: 0, // Could be enhanced with cache hit tracking
258
+ templateCompileTime: duration,
259
+ },
260
+ },
261
+ };
262
+ }
263
+ catch (error) {
264
+ const endTime = new Date();
265
+ const duration = endTime.getTime() - startTime.getTime();
266
+ return {
267
+ status: "failed",
268
+ stepName: step.name,
269
+ toolType: "template",
270
+ startTime,
271
+ endTime,
272
+ duration,
273
+ retryCount: 0,
274
+ dependenciesSatisfied: true,
275
+ filesCreated,
276
+ filesModified,
277
+ filesDeleted,
278
+ error: {
279
+ message: error instanceof Error ? error.message : String(error),
280
+ code: error instanceof HypergenError ? error.code : "TEMPLATE_EXECUTION_ERROR",
281
+ stack: error instanceof Error ? error.stack : undefined,
282
+ cause: error,
283
+ },
284
+ };
285
+ }
286
+ }
287
+ /**
288
+ * Tool-specific cleanup logic
289
+ */
290
+ async onCleanup() {
291
+ this.debug("Cleaning up template tool resources");
292
+ this.templateCache.clear();
293
+ }
294
+ /**
295
+ * Resolve template identifier to file path and content
296
+ */
297
+ async resolveTemplate(templateId, context) {
298
+ // Check cache first
299
+ const cacheKey = `${templateId}:${context.projectRoot}`;
300
+ const cached = this.templateCache.get(cacheKey);
301
+ if (cached?.metadata.exists) {
302
+ return cached;
303
+ }
304
+ let filePath = "";
305
+ let exists = false;
306
+ let extension = "";
307
+ // Try different resolution strategies
308
+ const resolutionPaths = [
309
+ // Absolute path
310
+ templateId,
311
+ // Relative to project root
312
+ path.resolve(context.projectRoot, templateId),
313
+ // Relative to template path if available (recipe directory)
314
+ context.templatePath ? path.resolve(context.templatePath, templateId) : null,
315
+ // With common extensions
316
+ path.resolve(context.projectRoot, `${templateId}.jig`),
317
+ path.resolve(context.projectRoot, `${templateId}.jig.t`),
318
+ ].filter(Boolean);
319
+ this.debug("Resolving template: %s", templateId);
320
+ this.debug(" projectRoot: %s", context.projectRoot);
321
+ this.debug(" templatePath: %s", context.templatePath);
322
+ this.debug(" Trying paths: %o", resolutionPaths);
323
+ for (const candidatePath of resolutionPaths) {
324
+ if (await fs.pathExists(candidatePath)) {
325
+ filePath = candidatePath;
326
+ exists = true;
327
+ extension = path.extname(candidatePath);
328
+ break;
329
+ }
330
+ }
331
+ if (!exists) {
332
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_NOT_FOUND, `Template not found: ${templateId}`, { template: templateId, path: resolutionPaths.join(", ") });
333
+ }
334
+ // Read template content
335
+ let content;
336
+ let stats;
337
+ try {
338
+ content = await fs.readFile(filePath, "utf8");
339
+ stats = await fs.stat(filePath);
340
+ }
341
+ catch (error) {
342
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_EXECUTION_ERROR, `Failed to read template file: ${filePath}`, { template: templateId, path: filePath, cause: error });
343
+ }
344
+ const resolution = {
345
+ filePath: filePath,
346
+ content,
347
+ engine: "jig",
348
+ metadata: {
349
+ exists: true,
350
+ size: stats.size,
351
+ extension,
352
+ lastModified: stats.mtime,
353
+ },
354
+ };
355
+ // Cache the resolution
356
+ this.templateCache.set(cacheKey, resolution);
357
+ return resolution;
358
+ }
359
+ /**
360
+ * Process template composition (includes, extends)
361
+ */
362
+ async processTemplateComposition(step, context, baseTemplate) {
363
+ const templateFiles = [baseTemplate.filePath];
364
+ // Process includes if configured
365
+ if (step.templateConfig?.composition?.includes) {
366
+ for (const include of step.templateConfig.composition.includes) {
367
+ // Evaluate condition if present
368
+ if (include.condition && !context.evaluateCondition(include.condition, context.variables)) {
369
+ continue;
370
+ }
371
+ try {
372
+ const includeResolution = await this.resolveTemplate(include.template, context);
373
+ templateFiles.push(includeResolution.filePath);
374
+ }
375
+ catch (error) {
376
+ this.logger.warn(`Failed to resolve include template '${include.template}': ${error instanceof Error ? error.message : String(error)}`);
377
+ }
378
+ }
379
+ }
380
+ return templateFiles;
381
+ }
382
+ /**
383
+ * Render a template file with frontmatter processing
384
+ */
385
+ async renderTemplateFile(templatePath, step, context) {
386
+ this.debug("Rendering template file: %s", templatePath);
387
+ // Read and parse frontmatter
388
+ const templateContent = await fs.readFile(templatePath, "utf8");
389
+ const { attributes, body } = fm(templateContent, {
390
+ allowUnsafe: true,
391
+ });
392
+ // Merge variables for rendering context
393
+ const renderContext = this.buildRenderContext(step, context, attributes);
394
+ // Render frontmatter attributes
395
+ const renderedAttributes = {};
396
+ for (const [key, value] of Object.entries(attributes)) {
397
+ renderedAttributes[key] = await this.renderTemplate(value, renderContext, templatePath);
398
+ }
399
+ // Render template body
400
+ const renderedBody = await this.renderTemplate(body, { ...renderContext, attributes: renderedAttributes }, templatePath);
401
+ // Determine if file should be skipped
402
+ const shouldSkip = this.shouldSkipFile(renderedAttributes, renderContext);
403
+ const skipReason = shouldSkip
404
+ ? this.getSkipReason(renderedAttributes, renderContext)
405
+ : undefined;
406
+ // Resolve target path
407
+ const outputRoot = step.outputDir
408
+ ? path.resolve(context.projectRoot, step.outputDir)
409
+ : context.projectRoot;
410
+ let targetPath;
411
+ if (renderedAttributes.to) {
412
+ targetPath = path.resolve(outputRoot, renderedAttributes.to);
413
+ }
414
+ else {
415
+ // Default: mirror the template's relative path from the templates directory,
416
+ // stripping the .jig extension. e.g. templates/.claude/skills/foo/SKILL.md.jig
417
+ // becomes .claude/skills/foo/SKILL.md in the output root.
418
+ const templatesDir = context.templatePath
419
+ ? path.resolve(context.templatePath, "templates")
420
+ : path.dirname(templatePath);
421
+ const relativePath = path.relative(templatesDir, templatePath);
422
+ const outputFileName = relativePath.replace(/\.jig$/, "");
423
+ targetPath = path.resolve(outputRoot, outputFileName);
424
+ }
425
+ return {
426
+ templatePath,
427
+ attributes: renderedAttributes,
428
+ body: renderedBody,
429
+ targetPath,
430
+ shouldSkip,
431
+ skipReason,
432
+ };
433
+ }
434
+ /**
435
+ * Render a template string with the appropriate engine
436
+ */
437
+ async renderTemplate(template, renderContext, filePath) {
438
+ if (typeof template !== "string") {
439
+ return template;
440
+ }
441
+ try {
442
+ this.debug("Rendering with Jig engine");
443
+ return await jigRenderTemplate(template, renderContext);
444
+ }
445
+ catch (error) {
446
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_EXECUTION_ERROR, `Template rendering failed: ${error instanceof Error ? error.message : String(error)}`, { template: filePath, cause: error });
447
+ }
448
+ }
449
+ /**
450
+ * Build render context by merging step and recipe variables.
451
+ *
452
+ * Helpers are registered as Jig globals (not spread into context),
453
+ * so the context only contains data: variables, step results, and utilities.
454
+ */
455
+ buildRenderContext(step, context, attributes) {
456
+ // Merge variables: recipe vars < context vars < step vars
457
+ const mergedVars = {
458
+ ...context.recipeVariables,
459
+ ...context.variables,
460
+ ...step.variables,
461
+ };
462
+ return {
463
+ ...mergedVars,
464
+ // Recipe-specific context
465
+ recipe: context.recipe,
466
+ step: { name: step.name, description: step.description },
467
+ // Utility functions
468
+ utils: context.utils,
469
+ // Step results for dependency access
470
+ stepResults: context.stepResults ? Object.fromEntries(context.stepResults) : {},
471
+ // 2-pass AI generation state
472
+ answers: context.answers,
473
+ __hypergenCollectMode: context.collectMode || false,
474
+ // provide() helper — allows templates to export values to subsequent steps
475
+ provide: (key, value) => {
476
+ context.variables[key] = value;
477
+ return "";
478
+ },
479
+ };
480
+ }
481
+ /**
482
+ * Check if file should be skipped based on attributes
483
+ */
484
+ shouldSkipFile(attributes, context) {
485
+ // Check skip_if condition
486
+ if (attributes.skip_if) {
487
+ if (attributes.skip_if === true || attributes.skip_if === "true") {
488
+ return true;
489
+ }
490
+ // If it's an expression, it should have been evaluated during rendering
491
+ if (typeof attributes.skip_if === "string" && attributes.skip_if !== "false") {
492
+ // Try to evaluate as boolean
493
+ try {
494
+ return Boolean(attributes.skip_if);
495
+ }
496
+ catch {
497
+ return false;
498
+ }
499
+ }
500
+ }
501
+ // Check unless_exists condition
502
+ if (attributes.unless_exists && attributes.to) {
503
+ const targetPath = path.resolve(context.projectRoot || process.cwd(), attributes.to);
504
+ return fs.existsSync(targetPath);
505
+ }
506
+ return false;
507
+ }
508
+ /**
509
+ * Get skip reason for debugging
510
+ */
511
+ getSkipReason(attributes, context) {
512
+ if (attributes.skip_if) {
513
+ return "skip_if condition evaluated to true";
514
+ }
515
+ if (attributes.unless_exists && attributes.to) {
516
+ return "unless_exists condition: file already exists";
517
+ }
518
+ return "unknown";
519
+ }
520
+ /**
521
+ * Generate file using existing file operations
522
+ */
523
+ async generateFile(renderedFile, step, context, options) {
524
+ if (!renderedFile.targetPath) {
525
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_MISSING_VARIABLES, 'Template file has no target path (missing "to" attribute)', { template: renderedFile.templatePath });
526
+ }
527
+ // Create rendered action for existing ops
528
+ // Ensure `to` attribute is set — it may have been inferred from the template's
529
+ // relative path rather than specified in frontmatter
530
+ const renderedAction = {
531
+ file: renderedFile.templatePath,
532
+ attributes: {
533
+ ...renderedFile.attributes,
534
+ to: renderedFile.attributes.to || renderedFile.targetPath,
535
+ force: step.overwrite || renderedFile.attributes.force || false,
536
+ },
537
+ body: renderedFile.body,
538
+ };
539
+ // Create runner config for ops
540
+ const runnerConfig = {
541
+ logger: context.logger || console,
542
+ cwd: step.outputDir ? path.resolve(context.projectRoot, step.outputDir) : context.projectRoot,
543
+ createPrompter: () => ({
544
+ prompt: async (arg) => ({
545
+ overwrite: step.overwrite || false,
546
+ }),
547
+ }),
548
+ };
549
+ // Create args object for ops (includes dry run flag)
550
+ const opArgs = {
551
+ ...context.variables,
552
+ dry: options?.dryRun || context.dryRun || false,
553
+ };
554
+ try {
555
+ // Use inject operation if inject attribute is present
556
+ if (renderedFile.attributes.inject) {
557
+ this.debug("Injecting content into file: %s", renderedFile.targetPath);
558
+ const result = await injectOp(renderedAction, opArgs, runnerConfig);
559
+ return { status: result.status || "injected" };
560
+ }
561
+ // Use add operation for file creation
562
+ this.debug("Adding/creating file: %s", renderedFile.targetPath);
563
+ const result = await addOp(renderedAction, opArgs, runnerConfig);
564
+ return { status: result.status || "added" };
565
+ }
566
+ catch (error) {
567
+ // For testing purposes, if it's a simple write operation, try direct file write
568
+ if (options?.dryRun || context.dryRun) {
569
+ return { status: "added" };
570
+ }
571
+ throw ErrorHandler.createError(ErrorCode.TEMPLATE_EXECUTION_ERROR, `Failed to generate file: ${renderedFile.targetPath}. Error: ${error instanceof Error ? error.message : String(error)}`, {
572
+ template: renderedFile.templatePath,
573
+ path: renderedFile.targetPath,
574
+ cause: error,
575
+ });
576
+ }
577
+ }
578
+ }
579
+ /**
580
+ * Template Tool Factory
581
+ */
582
+ export class TemplateToolFactory {
583
+ create(name = "template-tool", options = {}) {
584
+ return new TemplateTool(name, options);
585
+ }
586
+ getToolType() {
587
+ return "template";
588
+ }
589
+ validateConfig(config) {
590
+ const errors = [];
591
+ const warnings = [];
592
+ const suggestions = [];
593
+ // Validate template engine configuration
594
+ if (config.templateEngineConfig) {
595
+ if (typeof config.templateEngineConfig !== "object") {
596
+ errors.push("templateEngineConfig must be an object");
597
+ }
598
+ }
599
+ // Validate cache settings
600
+ if (config.cacheEnabled !== undefined && typeof config.cacheEnabled !== "boolean") {
601
+ warnings.push("cacheEnabled should be a boolean");
602
+ }
603
+ return {
604
+ isValid: errors.length === 0,
605
+ errors,
606
+ warnings,
607
+ suggestions,
608
+ };
609
+ }
610
+ }
611
+ // Export default instance
612
+ export const templateToolFactory = new TemplateToolFactory();
613
+ //# sourceMappingURL=template-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-tool.js","sourceRoot":"","sources":["../../../src/recipe-engine/tools/template-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACN,SAAS,EACT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