@hypercli/core 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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/config/config-loader.d.ts +117 -0
- package/dist/config/config-loader.d.ts.map +1 -0
- package/dist/config/config-loader.js +287 -0
- package/dist/config/config-loader.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load-helpers.d.ts +13 -0
- package/dist/config/load-helpers.d.ts.map +1 -0
- package/dist/config/load-helpers.js +67 -0
- package/dist/config/load-helpers.js.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/hypergen-errors.d.ts +162 -0
- package/dist/errors/hypergen-errors.d.ts.map +1 -0
- package/dist/errors/hypergen-errors.js +944 -0
- package/dist/errors/hypergen-errors.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +2 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/helpers.d.ts +25 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +20 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/cli-html-types.d.ts +36 -0
- package/dist/logger/cli-html-types.d.ts.map +1 -0
- package/dist/logger/cli-html-types.js +2 -0
- package/dist/logger/cli-html-types.js.map +1 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +3 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.d.ts +17 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +42 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/logger/types.d.ts +16 -0
- package/dist/logger/types.d.ts.map +1 -0
- package/dist/logger/types.js +2 -0
- package/dist/logger/types.js.map +1 -0
- package/dist/parsers/cookbook-parser.d.ts +30 -0
- package/dist/parsers/cookbook-parser.d.ts.map +1 -0
- package/dist/parsers/cookbook-parser.js +155 -0
- package/dist/parsers/cookbook-parser.js.map +1 -0
- package/dist/parsers/index.d.ts +10 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/parsers/index.js +16 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/kit-parser.d.ts +44 -0
- package/dist/parsers/kit-parser.d.ts.map +1 -0
- package/dist/parsers/kit-parser.js +195 -0
- package/dist/parsers/kit-parser.js.map +1 -0
- package/dist/parsers/path-resolver.d.ts +72 -0
- package/dist/parsers/path-resolver.d.ts.map +1 -0
- package/dist/parsers/path-resolver.js +281 -0
- package/dist/parsers/path-resolver.js.map +1 -0
- package/dist/parsers/template-parser.d.ts +142 -0
- package/dist/parsers/template-parser.d.ts.map +1 -0
- package/dist/parsers/template-parser.js +896 -0
- package/dist/parsers/template-parser.js.map +1 -0
- package/dist/types/actions.d.ts +109 -0
- package/dist/types/actions.d.ts.map +1 -0
- package/dist/types/actions.js +31 -0
- package/dist/types/actions.js.map +1 -0
- package/dist/types/ai-config.d.ts +170 -0
- package/dist/types/ai-config.d.ts.map +1 -0
- package/dist/types/ai-config.js +10 -0
- package/dist/types/ai-config.js.map +1 -0
- package/dist/types/common.d.ts +24 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +10 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/index.d.ts +19 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +11 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/kit.d.ts +92 -0
- package/dist/types/kit.d.ts.map +1 -0
- package/dist/types/kit.js +17 -0
- package/dist/types/kit.js.map +1 -0
- package/dist/types/recipe.d.ts +953 -0
- package/dist/types/recipe.d.ts.map +1 -0
- package/dist/types/recipe.js +92 -0
- package/dist/types/recipe.js.map +1 -0
- package/dist/types/template.d.ts +49 -0
- package/dist/types/template.d.ts.map +1 -0
- package/dist/types/template.js +7 -0
- package/dist/types/template.js.map +1 -0
- package/dist/ui/index.d.ts +4 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +4 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/messages.d.ts +16 -0
- package/dist/ui/messages.d.ts.map +1 -0
- package/dist/ui/messages.js +57 -0
- package/dist/ui/messages.js.map +1 -0
- package/dist/ui/styles.d.ts +7 -0
- package/dist/ui/styles.d.ts.map +1 -0
- package/dist/ui/styles.js +8 -0
- package/dist/ui/styles.js.map +1 -0
- package/dist/ui/symbols.d.ts +9 -0
- package/dist/ui/symbols.d.ts.map +1 -0
- package/dist/ui/symbols.js +10 -0
- package/dist/ui/symbols.js.map +1 -0
- package/dist/utils/display-utils.d.ts +65 -0
- package/dist/utils/display-utils.d.ts.map +1 -0
- package/dist/utils/display-utils.js +101 -0
- package/dist/utils/display-utils.js.map +1 -0
- package/dist/utils/find-project-root.d.ts +32 -0
- package/dist/utils/find-project-root.d.ts.map +1 -0
- package/dist/utils/find-project-root.js +133 -0
- package/dist/utils/find-project-root.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/newline.d.ts +3 -0
- package/dist/utils/newline.d.ts.map +1 -0
- package/dist/utils/newline.js +12 -0
- package/dist/utils/newline.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recipe Step System Types
|
|
3
|
+
*
|
|
4
|
+
* Complete TypeScript type definitions for the step-based recipe execution system
|
|
5
|
+
* that coordinates Template, Action, CodeMod, and Recipe tools through sequential steps.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActionLogger, ActionResult, ActionUtils } from "./actions.js";
|
|
8
|
+
import type { AIBudgetConfig, AIContextConfig, AIExample, AIExecutionResult, AIGuardrailConfig, AIOutputConfig } from "./ai-config.js";
|
|
9
|
+
import type { TemplateVariable } from "./template.js";
|
|
10
|
+
/**
|
|
11
|
+
* Declares a value that a recipe provides to its callers or sibling recipes
|
|
12
|
+
*/
|
|
13
|
+
export interface RecipeProvides {
|
|
14
|
+
/** Name of the provided variable */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Expected type of the provided value */
|
|
17
|
+
type?: "string" | "number" | "boolean" | "object" | "array";
|
|
18
|
+
/** Human-readable description */
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Core step execution status
|
|
23
|
+
*/
|
|
24
|
+
export type StepStatus = "pending" | "running" | "completed" | "failed" | "skipped" | "cancelled";
|
|
25
|
+
/**
|
|
26
|
+
* Tool types supported by the recipe system
|
|
27
|
+
*/
|
|
28
|
+
export type ToolType = "template" | "action" | "codemod" | "recipe" | "shell" | "prompt" | "sequence" | "parallel" | "ai" | "install" | "query" | "patch" | "ensure-dirs";
|
|
29
|
+
/**
|
|
30
|
+
* Base interface for all recipe steps
|
|
31
|
+
*/
|
|
32
|
+
export interface BaseRecipeStep {
|
|
33
|
+
/** Unique identifier for this step */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Human-readable description of what this step does */
|
|
36
|
+
description?: string;
|
|
37
|
+
/** Conditional expression that determines if this step should execute */
|
|
38
|
+
when?: string;
|
|
39
|
+
/** Steps that must complete successfully before this step can run */
|
|
40
|
+
dependsOn?: string[];
|
|
41
|
+
/** Whether this step can run in parallel with other steps */
|
|
42
|
+
parallel?: boolean;
|
|
43
|
+
/** Whether to continue recipe execution if this step fails */
|
|
44
|
+
continueOnError?: boolean;
|
|
45
|
+
/** Timeout in milliseconds for step execution */
|
|
46
|
+
timeout?: number;
|
|
47
|
+
/** Number of retry attempts on failure */
|
|
48
|
+
retries?: number;
|
|
49
|
+
/** Tags for categorization and filtering */
|
|
50
|
+
tags?: string[];
|
|
51
|
+
/** Variables to pass to the tool (merged with recipe-level variables) */
|
|
52
|
+
variables?: Record<string, any>;
|
|
53
|
+
/** Environment variables specific to this step */
|
|
54
|
+
environment?: Record<string, string>;
|
|
55
|
+
/** Output expressions evaluated against the step's toolResult after execution.
|
|
56
|
+
* Keys become variable names, values are Jig template expressions.
|
|
57
|
+
* Extracted values are injected into context.variables for subsequent steps. */
|
|
58
|
+
exports?: Record<string, string>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Template step configuration
|
|
62
|
+
* Executes a template to generate files
|
|
63
|
+
*/
|
|
64
|
+
export interface TemplateStep extends BaseRecipeStep {
|
|
65
|
+
tool: "template";
|
|
66
|
+
/** Template identifier or path */
|
|
67
|
+
template: string;
|
|
68
|
+
/** Output directory override (relative to project root) */
|
|
69
|
+
outputDir?: string;
|
|
70
|
+
/** Whether to overwrite existing files */
|
|
71
|
+
overwrite?: boolean;
|
|
72
|
+
/** File patterns to exclude from generation */
|
|
73
|
+
exclude?: string[];
|
|
74
|
+
/** Template-specific configuration */
|
|
75
|
+
templateConfig?: {
|
|
76
|
+
/** Template variables with type definitions */
|
|
77
|
+
variables?: Record<string, TemplateVariable>;
|
|
78
|
+
/** Template composition settings */
|
|
79
|
+
composition?: {
|
|
80
|
+
extends?: string;
|
|
81
|
+
includes?: Array<{
|
|
82
|
+
template: string;
|
|
83
|
+
variables?: Record<string, any>;
|
|
84
|
+
condition?: string;
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Action step configuration
|
|
91
|
+
* Executes a decorator-based action
|
|
92
|
+
*/
|
|
93
|
+
export interface ActionStep extends BaseRecipeStep {
|
|
94
|
+
tool: "action";
|
|
95
|
+
/** Action name to execute */
|
|
96
|
+
action: string;
|
|
97
|
+
/** Action parameters with validation */
|
|
98
|
+
parameters?: Record<string, any>;
|
|
99
|
+
/** Whether to run in dry-run mode */
|
|
100
|
+
dryRun?: boolean;
|
|
101
|
+
/** Whether to force execution (overwrite files) */
|
|
102
|
+
force?: boolean;
|
|
103
|
+
/** Action-specific configuration */
|
|
104
|
+
actionConfig?: {
|
|
105
|
+
/** Communication settings for multi-action workflows */
|
|
106
|
+
communication?: {
|
|
107
|
+
/** ID for this action instance */
|
|
108
|
+
actionId?: string;
|
|
109
|
+
/** Message types this action listens for */
|
|
110
|
+
subscribeTo?: string[];
|
|
111
|
+
/** Shared data keys this action reads */
|
|
112
|
+
reads?: string[];
|
|
113
|
+
/** Shared data keys this action writes */
|
|
114
|
+
writes?: string[];
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* CodeMod step configuration
|
|
120
|
+
* Executes code transformations
|
|
121
|
+
*/
|
|
122
|
+
export interface CodeModStep extends BaseRecipeStep {
|
|
123
|
+
tool: "codemod";
|
|
124
|
+
/** CodeMod identifier or path */
|
|
125
|
+
codemod: string;
|
|
126
|
+
/** File patterns to transform */
|
|
127
|
+
files: string[];
|
|
128
|
+
/** Whether to create backup files */
|
|
129
|
+
backup?: boolean;
|
|
130
|
+
/** Parser to use for code analysis */
|
|
131
|
+
parser?: "typescript" | "javascript" | "json" | "auto";
|
|
132
|
+
/** CodeMod parameters with validation */
|
|
133
|
+
parameters?: Record<string, any>;
|
|
134
|
+
/** Whether to force overwrite files */
|
|
135
|
+
force?: boolean;
|
|
136
|
+
/** CodeMod-specific configuration */
|
|
137
|
+
codemodConfig?: {
|
|
138
|
+
/** Transform options */
|
|
139
|
+
transform?: {
|
|
140
|
+
/** Preserve formatting */
|
|
141
|
+
preserveFormatting?: boolean;
|
|
142
|
+
/** Include comments in transformation */
|
|
143
|
+
includeComments?: boolean;
|
|
144
|
+
/** Custom transform rules */
|
|
145
|
+
rules?: Record<string, any>;
|
|
146
|
+
};
|
|
147
|
+
/** Validation settings */
|
|
148
|
+
validation?: {
|
|
149
|
+
/** Run syntax validation after transformation */
|
|
150
|
+
validateSyntax?: boolean;
|
|
151
|
+
/** Run type checking (for TypeScript) */
|
|
152
|
+
validateTypes?: boolean;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Recipe step configuration
|
|
158
|
+
* Executes another recipe as a sub-recipe
|
|
159
|
+
*/
|
|
160
|
+
export interface RecipeStep extends BaseRecipeStep {
|
|
161
|
+
tool: "recipe";
|
|
162
|
+
/** Recipe identifier or path */
|
|
163
|
+
recipe: string;
|
|
164
|
+
/** Recipe version constraint */
|
|
165
|
+
version?: string;
|
|
166
|
+
/** Whether to inherit parent recipe variables */
|
|
167
|
+
inheritVariables?: boolean;
|
|
168
|
+
/** Variable overrides for the sub-recipe */
|
|
169
|
+
variableOverrides?: Record<string, any>;
|
|
170
|
+
/** Recipe-specific configuration */
|
|
171
|
+
recipeConfig?: {
|
|
172
|
+
/** Execution mode */
|
|
173
|
+
execution?: {
|
|
174
|
+
/** Whether to run sub-recipe in isolation */
|
|
175
|
+
isolated?: boolean;
|
|
176
|
+
/** Working directory for sub-recipe */
|
|
177
|
+
workingDir?: string;
|
|
178
|
+
/** Timeout for entire sub-recipe */
|
|
179
|
+
timeout?: number;
|
|
180
|
+
};
|
|
181
|
+
/** Variable mapping from parent to child */
|
|
182
|
+
variableMapping?: Record<string, string>;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Shell step configuration
|
|
187
|
+
* Executes a shell command
|
|
188
|
+
*/
|
|
189
|
+
export interface ShellStep extends BaseRecipeStep {
|
|
190
|
+
tool: "shell";
|
|
191
|
+
/** Command to execute */
|
|
192
|
+
command: string;
|
|
193
|
+
/** Working directory override */
|
|
194
|
+
cwd?: string;
|
|
195
|
+
/** Environment variables */
|
|
196
|
+
env?: Record<string, string>;
|
|
197
|
+
/** Stream output to stdout/stderr */
|
|
198
|
+
stream?: boolean;
|
|
199
|
+
/** Shell executable to use */
|
|
200
|
+
shell?: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Prompt step configuration
|
|
204
|
+
* Interactive prompt for user input
|
|
205
|
+
*/
|
|
206
|
+
export interface PromptStep extends BaseRecipeStep {
|
|
207
|
+
tool: "prompt";
|
|
208
|
+
/** Prompt message */
|
|
209
|
+
message?: string;
|
|
210
|
+
/** Target variable to store answer */
|
|
211
|
+
variable: string;
|
|
212
|
+
/** Prompt type */
|
|
213
|
+
promptType: "text" | "confirm" | "select" | "multiselect";
|
|
214
|
+
/** Default value */
|
|
215
|
+
default?: any;
|
|
216
|
+
/** Options for select/multiselect */
|
|
217
|
+
options?: Array<{
|
|
218
|
+
label: string;
|
|
219
|
+
value: any;
|
|
220
|
+
hint?: string;
|
|
221
|
+
}> | string[];
|
|
222
|
+
/** Validation function or regex pattern */
|
|
223
|
+
validate?: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Install step configuration
|
|
227
|
+
* Installs packages using the project's package manager
|
|
228
|
+
*/
|
|
229
|
+
export interface InstallStep extends BaseRecipeStep {
|
|
230
|
+
tool: "install";
|
|
231
|
+
/** Packages to install */
|
|
232
|
+
packages: string[];
|
|
233
|
+
/** Install as dev dependencies */
|
|
234
|
+
dev?: boolean;
|
|
235
|
+
/** Don't fail if install fails */
|
|
236
|
+
optional?: boolean;
|
|
237
|
+
/** Package manager override (auto-detected from lockfiles if omitted) */
|
|
238
|
+
packageManager?: "bun" | "pnpm" | "yarn" | "npm";
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Query step configuration
|
|
242
|
+
* Reads structured data files and evaluates expressions against them.
|
|
243
|
+
* Supports JSON, YAML, TOML, and .env files.
|
|
244
|
+
*/
|
|
245
|
+
export interface QueryStep extends BaseRecipeStep {
|
|
246
|
+
tool: "query";
|
|
247
|
+
/** Path to the file to query (relative to project root) */
|
|
248
|
+
file: string;
|
|
249
|
+
/** File format (auto-detected from extension if omitted) */
|
|
250
|
+
format?: "json" | "yaml" | "toml" | "env";
|
|
251
|
+
/**
|
|
252
|
+
* Dot-path checks to evaluate.
|
|
253
|
+
* Each check tests whether a path exists in the data and optionally exports the value.
|
|
254
|
+
*/
|
|
255
|
+
checks?: Array<{
|
|
256
|
+
/** Dot-path into the data (e.g. "dependencies.drizzle-orm") */
|
|
257
|
+
path: string;
|
|
258
|
+
/** Variable name to export the resolved value to */
|
|
259
|
+
export?: string;
|
|
260
|
+
/** Variable name to export a boolean (true if path exists and is truthy) */
|
|
261
|
+
exportExists?: string;
|
|
262
|
+
}>;
|
|
263
|
+
/**
|
|
264
|
+
* A single expression to evaluate against the parsed data.
|
|
265
|
+
* The parsed data is available as `data` in the expression scope.
|
|
266
|
+
* Result is placed in toolResult.value.
|
|
267
|
+
*/
|
|
268
|
+
expression?: string;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Patch step configuration
|
|
272
|
+
* Deep-merges structured data into an existing file.
|
|
273
|
+
* Creates the file if it doesn't exist.
|
|
274
|
+
*/
|
|
275
|
+
export interface PatchStep extends BaseRecipeStep {
|
|
276
|
+
tool: "patch";
|
|
277
|
+
/** Path to the file to patch (relative to project root) */
|
|
278
|
+
file: string;
|
|
279
|
+
/** File format (auto-detected from extension if omitted) */
|
|
280
|
+
format?: "json" | "yaml" | "toml";
|
|
281
|
+
/** Data to deep-merge into the file */
|
|
282
|
+
merge: Record<string, any>;
|
|
283
|
+
/** If true, create the file when it doesn't exist (default: true) */
|
|
284
|
+
createIfMissing?: boolean;
|
|
285
|
+
/** Indentation for JSON output (default: 2) */
|
|
286
|
+
indent?: number;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* EnsureDirs step configuration
|
|
290
|
+
* Creates directories (mkdir -p) for each path in the array.
|
|
291
|
+
*/
|
|
292
|
+
export interface EnsureDirsStep extends BaseRecipeStep {
|
|
293
|
+
tool: "ensure-dirs";
|
|
294
|
+
/** Array of directory paths to create (relative to project root) */
|
|
295
|
+
paths: string[];
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Sequence step configuration
|
|
299
|
+
* Executes a list of steps sequentially
|
|
300
|
+
*/
|
|
301
|
+
export interface SequenceStep extends BaseRecipeStep {
|
|
302
|
+
tool: "sequence";
|
|
303
|
+
/** Steps to execute in sequence */
|
|
304
|
+
steps: RecipeStepUnion[];
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Parallel step configuration
|
|
308
|
+
* Executes a list of steps concurrently
|
|
309
|
+
*/
|
|
310
|
+
export interface ParallelStep extends BaseRecipeStep {
|
|
311
|
+
tool: "parallel";
|
|
312
|
+
/** Steps to execute in parallel */
|
|
313
|
+
steps: RecipeStepUnion[];
|
|
314
|
+
/** Maximum number of concurrent steps */
|
|
315
|
+
limit?: number;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* AI step configuration
|
|
319
|
+
* Generates code or content using an LLM via Vercel AI SDK
|
|
320
|
+
*/
|
|
321
|
+
export interface AIStep extends BaseRecipeStep {
|
|
322
|
+
tool: "ai";
|
|
323
|
+
/** Prompt template (supports Liquid variable interpolation) */
|
|
324
|
+
prompt: string;
|
|
325
|
+
/** System prompt override */
|
|
326
|
+
system?: string;
|
|
327
|
+
/** Model override (e.g., 'claude-sonnet-4-5', 'gpt-4o') */
|
|
328
|
+
model?: string;
|
|
329
|
+
/** Provider override (e.g., 'anthropic', 'openai', 'ollama') */
|
|
330
|
+
provider?: string;
|
|
331
|
+
/** How the AI output is used */
|
|
332
|
+
output: AIOutputConfig;
|
|
333
|
+
/** Context files to include in the prompt */
|
|
334
|
+
context?: AIContextConfig;
|
|
335
|
+
/** Few-shot examples to improve generation quality */
|
|
336
|
+
examples?: AIExample[];
|
|
337
|
+
/** Validation guardrails */
|
|
338
|
+
guardrails?: AIGuardrailConfig;
|
|
339
|
+
/** Per-step cost limits */
|
|
340
|
+
budget?: AIBudgetConfig;
|
|
341
|
+
/** Stream output to terminal */
|
|
342
|
+
stream?: boolean;
|
|
343
|
+
/** Temperature (0-2) */
|
|
344
|
+
temperature?: number;
|
|
345
|
+
/** Max output tokens */
|
|
346
|
+
maxTokens?: number;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Union type for all step types (discriminated union)
|
|
350
|
+
*/
|
|
351
|
+
export type RecipeStepUnion = TemplateStep | ActionStep | CodeModStep | RecipeStep | ShellStep | PromptStep | SequenceStep | ParallelStep | AIStep | InstallStep | QueryStep | PatchStep | EnsureDirsStep;
|
|
352
|
+
/**
|
|
353
|
+
* Step execution context
|
|
354
|
+
*/
|
|
355
|
+
export interface StepContext {
|
|
356
|
+
/** Current step being executed */
|
|
357
|
+
step: RecipeStepUnion;
|
|
358
|
+
/** Resolved variables (merged from recipe and step levels) */
|
|
359
|
+
variables: Record<string, any>;
|
|
360
|
+
/** Project root directory */
|
|
361
|
+
projectRoot: string;
|
|
362
|
+
/** Template path (if applicable) */
|
|
363
|
+
templatePath?: string;
|
|
364
|
+
/** Recipe-level variables */
|
|
365
|
+
recipeVariables: Record<string, any>;
|
|
366
|
+
/** Results from previous steps */
|
|
367
|
+
stepResults: Map<string, StepResult>;
|
|
368
|
+
/** Recipe execution metadata */
|
|
369
|
+
recipe: {
|
|
370
|
+
id: string;
|
|
371
|
+
name: string;
|
|
372
|
+
version?: string;
|
|
373
|
+
startTime: Date;
|
|
374
|
+
};
|
|
375
|
+
/** Step-specific data storage */
|
|
376
|
+
stepData: Record<string, any>;
|
|
377
|
+
/** Condition evaluator */
|
|
378
|
+
evaluateCondition: (expression: string, context: Record<string, any>) => boolean;
|
|
379
|
+
/** AI answers for 2-pass generation (Pass 2) */
|
|
380
|
+
answers?: Record<string, any>;
|
|
381
|
+
/** Whether we're in AI collect mode (Pass 1) */
|
|
382
|
+
collectMode?: boolean;
|
|
383
|
+
/** Dry run mode */
|
|
384
|
+
dryRun?: boolean;
|
|
385
|
+
/** Force overwrite existing files */
|
|
386
|
+
force?: boolean;
|
|
387
|
+
/** Logger for step output */
|
|
388
|
+
logger?: ActionLogger;
|
|
389
|
+
/** Utility functions */
|
|
390
|
+
utils?: ActionUtils;
|
|
391
|
+
/** Inter-step communication */
|
|
392
|
+
communication?: {
|
|
393
|
+
/** Send data to other steps */
|
|
394
|
+
send: (target: string, data: any) => void;
|
|
395
|
+
/** Receive data from other steps */
|
|
396
|
+
receive: (source: string) => any;
|
|
397
|
+
/** Wait for step completion */
|
|
398
|
+
waitForStep: (stepName: string, timeout?: number) => Promise<StepResult>;
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Step execution result
|
|
403
|
+
*/
|
|
404
|
+
export interface StepResult {
|
|
405
|
+
/** Step execution status */
|
|
406
|
+
status: StepStatus;
|
|
407
|
+
/** Step name */
|
|
408
|
+
stepName: string;
|
|
409
|
+
/** Tool type that was executed */
|
|
410
|
+
toolType: ToolType;
|
|
411
|
+
/** Execution start time */
|
|
412
|
+
startTime: Date;
|
|
413
|
+
/** Execution end time */
|
|
414
|
+
endTime?: Date;
|
|
415
|
+
/** Execution duration in milliseconds */
|
|
416
|
+
duration?: number;
|
|
417
|
+
/** Number of retry attempts made */
|
|
418
|
+
retryCount: number;
|
|
419
|
+
/** Whether step dependencies were satisfied */
|
|
420
|
+
dependenciesSatisfied: boolean;
|
|
421
|
+
/** Condition evaluation result (if applicable) */
|
|
422
|
+
conditionResult?: boolean;
|
|
423
|
+
/** Tool-specific execution result */
|
|
424
|
+
toolResult?: ActionResult | TemplateExecutionResult | CodeModExecutionResult | RecipeExecutionResult | ShellExecutionResult | PromptExecutionResult | SequenceExecutionResult | ParallelExecutionResult | AIExecutionResult | InstallExecutionResult | QueryExecutionResult | PatchExecutionResult | EnsureDirsExecutionResult;
|
|
425
|
+
/** Files created by this step */
|
|
426
|
+
filesCreated?: string[];
|
|
427
|
+
/** Files modified by this step */
|
|
428
|
+
filesModified?: string[];
|
|
429
|
+
/** Files deleted by this step */
|
|
430
|
+
filesDeleted?: string[];
|
|
431
|
+
/** Error information (if failed) */
|
|
432
|
+
error?: {
|
|
433
|
+
message: string;
|
|
434
|
+
code?: string;
|
|
435
|
+
stack?: string;
|
|
436
|
+
cause?: any;
|
|
437
|
+
};
|
|
438
|
+
/** Step output data */
|
|
439
|
+
output?: Record<string, any>;
|
|
440
|
+
/** Metadata for debugging and analysis */
|
|
441
|
+
metadata?: Record<string, any>;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Template execution result
|
|
445
|
+
*/
|
|
446
|
+
export interface TemplateExecutionResult {
|
|
447
|
+
templateName: string;
|
|
448
|
+
templatePath: string;
|
|
449
|
+
engine: string;
|
|
450
|
+
filesGenerated: string[];
|
|
451
|
+
variables: Record<string, any>;
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* CodeMod execution result
|
|
455
|
+
*/
|
|
456
|
+
export interface CodeModExecutionResult {
|
|
457
|
+
codemodName: string;
|
|
458
|
+
codemodPath: string;
|
|
459
|
+
filesProcessed: string[];
|
|
460
|
+
transformationsSummary: {
|
|
461
|
+
totalFiles: number;
|
|
462
|
+
modifiedFiles: number;
|
|
463
|
+
errors: number;
|
|
464
|
+
};
|
|
465
|
+
backupFiles?: string[];
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Shell execution result
|
|
469
|
+
*/
|
|
470
|
+
export interface ShellExecutionResult {
|
|
471
|
+
exitCode: number;
|
|
472
|
+
stdout: string;
|
|
473
|
+
stderr: string;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Prompt execution result
|
|
477
|
+
*/
|
|
478
|
+
export interface PromptExecutionResult {
|
|
479
|
+
variable: string;
|
|
480
|
+
value: any;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Sequence execution result
|
|
484
|
+
*/
|
|
485
|
+
export interface SequenceExecutionResult {
|
|
486
|
+
steps: StepResult[];
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Parallel execution result
|
|
490
|
+
*/
|
|
491
|
+
export interface ParallelExecutionResult {
|
|
492
|
+
steps: StepResult[];
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Install execution result
|
|
496
|
+
*/
|
|
497
|
+
export interface InstallExecutionResult {
|
|
498
|
+
packageManager?: string;
|
|
499
|
+
packages: string[];
|
|
500
|
+
dev?: boolean;
|
|
501
|
+
dryRun?: boolean;
|
|
502
|
+
command?: string;
|
|
503
|
+
optional?: boolean;
|
|
504
|
+
warning?: string;
|
|
505
|
+
exitCode?: number;
|
|
506
|
+
stdout?: string;
|
|
507
|
+
stderr?: string;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Query execution result
|
|
511
|
+
*/
|
|
512
|
+
export interface QueryExecutionResult {
|
|
513
|
+
file: string;
|
|
514
|
+
format: string;
|
|
515
|
+
checks?: Array<{
|
|
516
|
+
path: string;
|
|
517
|
+
exists: boolean;
|
|
518
|
+
value?: any;
|
|
519
|
+
}>;
|
|
520
|
+
value?: any;
|
|
521
|
+
expression?: string;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Patch execution result
|
|
525
|
+
*/
|
|
526
|
+
export interface PatchExecutionResult {
|
|
527
|
+
file: string;
|
|
528
|
+
format: string;
|
|
529
|
+
created: boolean;
|
|
530
|
+
merged: Record<string, any>;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* EnsureDirs execution result
|
|
534
|
+
*/
|
|
535
|
+
export interface EnsureDirsExecutionResult {
|
|
536
|
+
paths: string[];
|
|
537
|
+
created: string[];
|
|
538
|
+
alreadyExisted: string[];
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Recipe execution result
|
|
542
|
+
*/
|
|
543
|
+
export interface RecipeExecutionResult {
|
|
544
|
+
recipeName: string;
|
|
545
|
+
recipePath: string;
|
|
546
|
+
subSteps: StepResult[];
|
|
547
|
+
totalDuration: number;
|
|
548
|
+
inheritedVariables: Record<string, any>;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Recipe configuration - replaces TemplateConfig
|
|
552
|
+
*/
|
|
553
|
+
export interface RecipeConfig {
|
|
554
|
+
/** Recipe name */
|
|
555
|
+
name: string;
|
|
556
|
+
/** Recipe description */
|
|
557
|
+
description?: string;
|
|
558
|
+
/** Recipe version */
|
|
559
|
+
version?: string;
|
|
560
|
+
/** Recipe author */
|
|
561
|
+
author?: string;
|
|
562
|
+
/** Recipe category for organization */
|
|
563
|
+
category?: string;
|
|
564
|
+
/** Tags for searchability */
|
|
565
|
+
tags?: string[];
|
|
566
|
+
/** Recipe variables with type definitions and validation */
|
|
567
|
+
variables: Record<string, TemplateVariable>;
|
|
568
|
+
/** Recipe execution steps */
|
|
569
|
+
steps: RecipeStepUnion[];
|
|
570
|
+
/** Example configurations */
|
|
571
|
+
examples?: RecipeExample[];
|
|
572
|
+
/** Recipe dependencies */
|
|
573
|
+
dependencies?: RecipeDependency[];
|
|
574
|
+
/** Values this recipe provides to callers or sibling recipes in group execution */
|
|
575
|
+
provides?: RecipeProvides[];
|
|
576
|
+
/** Expected outputs */
|
|
577
|
+
outputs?: string[];
|
|
578
|
+
/** Engine version requirements */
|
|
579
|
+
engines?: {
|
|
580
|
+
hypergen?: string;
|
|
581
|
+
node?: string;
|
|
582
|
+
};
|
|
583
|
+
/** Lifecycle hooks */
|
|
584
|
+
hooks?: {
|
|
585
|
+
/** Before recipe starts */
|
|
586
|
+
beforeRecipe?: string[];
|
|
587
|
+
/** After recipe completes */
|
|
588
|
+
afterRecipe?: string[];
|
|
589
|
+
/** Before each step */
|
|
590
|
+
beforeStep?: string[];
|
|
591
|
+
/** After each step */
|
|
592
|
+
afterStep?: string[];
|
|
593
|
+
/** On recipe error */
|
|
594
|
+
onError?: string[];
|
|
595
|
+
/** On step error */
|
|
596
|
+
onStepError?: string[];
|
|
597
|
+
};
|
|
598
|
+
/** Recipe execution settings */
|
|
599
|
+
settings?: {
|
|
600
|
+
/** Default timeout for all steps */
|
|
601
|
+
timeout?: number;
|
|
602
|
+
/** Default retry count */
|
|
603
|
+
retries?: number;
|
|
604
|
+
/** Whether to continue on step failures */
|
|
605
|
+
continueOnError?: boolean;
|
|
606
|
+
/** Maximum number of parallel steps */
|
|
607
|
+
maxParallelSteps?: number;
|
|
608
|
+
/** Working directory */
|
|
609
|
+
workingDir?: string;
|
|
610
|
+
};
|
|
611
|
+
/** Message rendered and printed after successful execution (Jig template) */
|
|
612
|
+
onSuccess?: string;
|
|
613
|
+
/** Message rendered and printed after failed execution (Jig template) */
|
|
614
|
+
onError?: string;
|
|
615
|
+
/** Advanced composition features */
|
|
616
|
+
composition?: {
|
|
617
|
+
/** Base recipe to extend */
|
|
618
|
+
extends?: string;
|
|
619
|
+
/** Recipes to include */
|
|
620
|
+
includes?: Array<{
|
|
621
|
+
recipe: string;
|
|
622
|
+
version?: string;
|
|
623
|
+
variables?: Record<string, any>;
|
|
624
|
+
condition?: string;
|
|
625
|
+
strategy?: "merge" | "replace" | "extend";
|
|
626
|
+
}>;
|
|
627
|
+
/** Conflict resolution strategy */
|
|
628
|
+
conflicts?: {
|
|
629
|
+
strategy: "merge" | "replace" | "extend" | "error";
|
|
630
|
+
rules?: Record<string, "merge" | "replace" | "extend" | "error">;
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Recipe example configuration
|
|
636
|
+
*/
|
|
637
|
+
export interface RecipeExample {
|
|
638
|
+
/** Example title */
|
|
639
|
+
title: string;
|
|
640
|
+
/** Example description */
|
|
641
|
+
description?: string;
|
|
642
|
+
/** Example variables */
|
|
643
|
+
variables: Record<string, any>;
|
|
644
|
+
/** Expected execution result */
|
|
645
|
+
expectedResult?: {
|
|
646
|
+
/** Expected number of steps */
|
|
647
|
+
totalSteps?: number;
|
|
648
|
+
/** Expected files to be created */
|
|
649
|
+
filesCreated?: string[];
|
|
650
|
+
/** Expected execution time range */
|
|
651
|
+
executionTime?: {
|
|
652
|
+
min?: number;
|
|
653
|
+
max?: number;
|
|
654
|
+
};
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Recipe dependency definition
|
|
659
|
+
*/
|
|
660
|
+
export interface RecipeDependency {
|
|
661
|
+
/** Dependency name */
|
|
662
|
+
name: string;
|
|
663
|
+
/** Version constraint */
|
|
664
|
+
version?: string;
|
|
665
|
+
/** Dependency type */
|
|
666
|
+
type?: "recipe" | "template" | "action" | "codemod" | "npm" | "github" | "local" | "http";
|
|
667
|
+
/** Source URL for external dependencies */
|
|
668
|
+
url?: string;
|
|
669
|
+
/** Whether dependency is optional */
|
|
670
|
+
optional?: boolean;
|
|
671
|
+
/** Whether dependency is only needed for development */
|
|
672
|
+
dev?: boolean;
|
|
673
|
+
/** Dependency description */
|
|
674
|
+
description?: string;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Recipe execution instance
|
|
678
|
+
*/
|
|
679
|
+
export interface RecipeExecution {
|
|
680
|
+
/** Unique execution ID */
|
|
681
|
+
id: string;
|
|
682
|
+
/** Recipe identifier */
|
|
683
|
+
recipeId: string;
|
|
684
|
+
/** Recipe configuration used */
|
|
685
|
+
recipe: RecipeConfig;
|
|
686
|
+
/** Current execution status */
|
|
687
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
688
|
+
/** Execution start time */
|
|
689
|
+
startTime: Date;
|
|
690
|
+
/** Execution end time */
|
|
691
|
+
endTime?: Date;
|
|
692
|
+
/** Total execution duration */
|
|
693
|
+
duration?: number;
|
|
694
|
+
/** Step execution results */
|
|
695
|
+
steps: StepResult[];
|
|
696
|
+
/** Recipe-level variables */
|
|
697
|
+
variables: Record<string, any>;
|
|
698
|
+
/** Environment variables */
|
|
699
|
+
environment: Record<string, string>;
|
|
700
|
+
/** Execution errors */
|
|
701
|
+
errors: string[];
|
|
702
|
+
/** Execution warnings */
|
|
703
|
+
warnings: string[];
|
|
704
|
+
/** Execution metadata */
|
|
705
|
+
metadata: {
|
|
706
|
+
/** Total number of steps */
|
|
707
|
+
totalSteps: number;
|
|
708
|
+
/** Number of completed steps */
|
|
709
|
+
completedSteps: number;
|
|
710
|
+
/** Number of failed steps */
|
|
711
|
+
failedSteps: number;
|
|
712
|
+
/** Number of skipped steps */
|
|
713
|
+
skippedSteps: number;
|
|
714
|
+
/** Number of cancelled steps */
|
|
715
|
+
cancelledSteps: number;
|
|
716
|
+
/** Peak memory usage */
|
|
717
|
+
peakMemory?: number;
|
|
718
|
+
/** Execution context */
|
|
719
|
+
context: {
|
|
720
|
+
/** Working directory */
|
|
721
|
+
workingDir: string;
|
|
722
|
+
/** User ID */
|
|
723
|
+
userId?: string;
|
|
724
|
+
/** Session ID */
|
|
725
|
+
sessionId?: string;
|
|
726
|
+
};
|
|
727
|
+
};
|
|
728
|
+
/** Execution artifacts */
|
|
729
|
+
artifacts?: {
|
|
730
|
+
/** Generated files */
|
|
731
|
+
files: string[];
|
|
732
|
+
/** Log files */
|
|
733
|
+
logs: string[];
|
|
734
|
+
/** Report files */
|
|
735
|
+
reports: string[];
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Recipe validation result
|
|
740
|
+
*/
|
|
741
|
+
export interface RecipeValidationResult {
|
|
742
|
+
/** Whether the recipe is valid */
|
|
743
|
+
isValid: boolean;
|
|
744
|
+
/** Validation errors */
|
|
745
|
+
errors: RecipeValidationErrorDetails[];
|
|
746
|
+
/** Validation warnings */
|
|
747
|
+
warnings: RecipeValidationWarning[];
|
|
748
|
+
/** Recipe being validated */
|
|
749
|
+
recipe: RecipeConfig;
|
|
750
|
+
/** Validation context */
|
|
751
|
+
context: {
|
|
752
|
+
/** Validation timestamp */
|
|
753
|
+
timestamp: Date;
|
|
754
|
+
/** Validator version */
|
|
755
|
+
validatorVersion: string;
|
|
756
|
+
/** Validation scope */
|
|
757
|
+
scope: "syntax" | "semantic" | "full";
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Recipe validation error details
|
|
762
|
+
*/
|
|
763
|
+
export interface RecipeValidationErrorDetails {
|
|
764
|
+
/** Error code */
|
|
765
|
+
code: string;
|
|
766
|
+
/** Error message */
|
|
767
|
+
message: string;
|
|
768
|
+
/** Location of error */
|
|
769
|
+
location?: {
|
|
770
|
+
/** Step name (if applicable) */
|
|
771
|
+
step?: string;
|
|
772
|
+
/** Field path */
|
|
773
|
+
field?: string;
|
|
774
|
+
/** Line number (if applicable) */
|
|
775
|
+
line?: number;
|
|
776
|
+
/** Column number (if applicable) */
|
|
777
|
+
column?: number;
|
|
778
|
+
};
|
|
779
|
+
/** Error severity */
|
|
780
|
+
severity: "error" | "critical";
|
|
781
|
+
/** Suggested fix */
|
|
782
|
+
suggestion?: string;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Recipe validation warning
|
|
786
|
+
*/
|
|
787
|
+
export interface RecipeValidationWarning {
|
|
788
|
+
/** Warning code */
|
|
789
|
+
code: string;
|
|
790
|
+
/** Warning message */
|
|
791
|
+
message: string;
|
|
792
|
+
/** Location of warning */
|
|
793
|
+
location?: {
|
|
794
|
+
/** Step name (if applicable) */
|
|
795
|
+
step?: string;
|
|
796
|
+
/** Field path */
|
|
797
|
+
field?: string;
|
|
798
|
+
/** Line number (if applicable) */
|
|
799
|
+
line?: number;
|
|
800
|
+
/** Column number (if applicable) */
|
|
801
|
+
column?: number;
|
|
802
|
+
};
|
|
803
|
+
/** Warning severity */
|
|
804
|
+
severity: "warning" | "info";
|
|
805
|
+
/** Suggested improvement */
|
|
806
|
+
suggestion?: string;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Step dependency graph node
|
|
810
|
+
*/
|
|
811
|
+
export interface StepDependencyNode {
|
|
812
|
+
/** Step name */
|
|
813
|
+
stepName: string;
|
|
814
|
+
/** Dependencies (steps that must complete first) */
|
|
815
|
+
dependencies: string[];
|
|
816
|
+
/** Dependents (steps that depend on this one) */
|
|
817
|
+
dependents: string[];
|
|
818
|
+
/** Execution order priority */
|
|
819
|
+
priority: number;
|
|
820
|
+
/** Whether this step can run in parallel */
|
|
821
|
+
parallelizable: boolean;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Recipe execution plan
|
|
825
|
+
*/
|
|
826
|
+
export interface RecipeExecutionPlan {
|
|
827
|
+
/** Recipe being executed */
|
|
828
|
+
recipe: RecipeConfig;
|
|
829
|
+
/** Execution order phases */
|
|
830
|
+
phases: Array<{
|
|
831
|
+
/** Phase number */
|
|
832
|
+
phase: number;
|
|
833
|
+
/** Steps to execute in this phase */
|
|
834
|
+
steps: string[];
|
|
835
|
+
/** Whether steps in this phase can run in parallel */
|
|
836
|
+
parallel: boolean;
|
|
837
|
+
}>;
|
|
838
|
+
/** Dependency graph */
|
|
839
|
+
dependencyGraph: Map<string, StepDependencyNode>;
|
|
840
|
+
/** Estimated execution time */
|
|
841
|
+
estimatedDuration?: number;
|
|
842
|
+
/** Resource requirements */
|
|
843
|
+
resources?: {
|
|
844
|
+
/** Memory requirements (MB) */
|
|
845
|
+
memory?: number;
|
|
846
|
+
/** CPU requirements */
|
|
847
|
+
cpu?: number;
|
|
848
|
+
/** Disk space requirements (MB) */
|
|
849
|
+
disk?: number;
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Step execution options
|
|
854
|
+
*/
|
|
855
|
+
export interface StepExecutionOptions {
|
|
856
|
+
/** Execution timeout */
|
|
857
|
+
timeout?: number;
|
|
858
|
+
/** Number of retries */
|
|
859
|
+
retries?: number;
|
|
860
|
+
/** Whether to continue on error */
|
|
861
|
+
continueOnError?: boolean;
|
|
862
|
+
/** Whether to run in dry-run mode */
|
|
863
|
+
dryRun?: boolean;
|
|
864
|
+
/** Whether to run in parallel with other steps */
|
|
865
|
+
parallel?: boolean;
|
|
866
|
+
/** Custom execution context */
|
|
867
|
+
context?: Partial<StepContext>;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Recipe engine configuration
|
|
871
|
+
*/
|
|
872
|
+
export interface RecipeEngineConfig {
|
|
873
|
+
/** Maximum number of concurrent step executions */
|
|
874
|
+
maxConcurrency?: number;
|
|
875
|
+
/** Default step timeout */
|
|
876
|
+
defaultTimeout?: number;
|
|
877
|
+
/** Default retry count */
|
|
878
|
+
defaultRetries?: number;
|
|
879
|
+
/** Working directory */
|
|
880
|
+
workingDir?: string;
|
|
881
|
+
/** Logging configuration */
|
|
882
|
+
logging?: {
|
|
883
|
+
/** Log level */
|
|
884
|
+
level: "debug" | "info" | "warn" | "error";
|
|
885
|
+
/** Log file path */
|
|
886
|
+
file?: string;
|
|
887
|
+
/** Whether to log to console */
|
|
888
|
+
console?: boolean;
|
|
889
|
+
};
|
|
890
|
+
/** Security settings */
|
|
891
|
+
security?: {
|
|
892
|
+
/** Whether to allow external recipes */
|
|
893
|
+
allowExternalRecipes?: boolean;
|
|
894
|
+
/** Trusted recipe sources */
|
|
895
|
+
trustedSources?: string[];
|
|
896
|
+
/** Sandboxing options */
|
|
897
|
+
sandbox?: boolean;
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Type guard functions for step types
|
|
902
|
+
*/
|
|
903
|
+
export declare function isTemplateStep(step: RecipeStepUnion): step is TemplateStep;
|
|
904
|
+
export declare function isActionStep(step: RecipeStepUnion): step is ActionStep;
|
|
905
|
+
export declare function isCodeModStep(step: RecipeStepUnion): step is CodeModStep;
|
|
906
|
+
export declare function isRecipeStep(step: RecipeStepUnion): step is RecipeStep;
|
|
907
|
+
export declare function isShellStep(step: BaseRecipeStep): step is ShellStep;
|
|
908
|
+
export declare function isPromptStep(step: BaseRecipeStep): step is PromptStep;
|
|
909
|
+
export declare function isSequenceStep(step: BaseRecipeStep): step is SequenceStep;
|
|
910
|
+
export declare function isParallelStep(step: BaseRecipeStep): step is ParallelStep;
|
|
911
|
+
export declare function isAIStep(step: BaseRecipeStep): step is AIStep;
|
|
912
|
+
export declare function isInstallStep(step: BaseRecipeStep): step is InstallStep;
|
|
913
|
+
export declare function isQueryStep(step: BaseRecipeStep): step is QueryStep;
|
|
914
|
+
export declare function isPatchStep(step: BaseRecipeStep): step is PatchStep;
|
|
915
|
+
export declare function isEnsureDirsStep(step: BaseRecipeStep): step is EnsureDirsStep;
|
|
916
|
+
/**
|
|
917
|
+
* Utility type for extracting step types
|
|
918
|
+
*/
|
|
919
|
+
export type StepByTool<T extends ToolType> = T extends "template" ? TemplateStep : T extends "action" ? ActionStep : T extends "codemod" ? CodeModStep : T extends "recipe" ? RecipeStep : T extends "ai" ? AIStep : never;
|
|
920
|
+
/**
|
|
921
|
+
* Recipe engine error types
|
|
922
|
+
*/
|
|
923
|
+
export declare class RecipeValidationError extends Error {
|
|
924
|
+
code: string;
|
|
925
|
+
location?: {
|
|
926
|
+
step?: string;
|
|
927
|
+
field?: string;
|
|
928
|
+
line?: number;
|
|
929
|
+
column?: number;
|
|
930
|
+
};
|
|
931
|
+
constructor(message: string, code: string, location?: {
|
|
932
|
+
step?: string;
|
|
933
|
+
field?: string;
|
|
934
|
+
line?: number;
|
|
935
|
+
column?: number;
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
export declare class StepExecutionError extends Error {
|
|
939
|
+
stepName: string;
|
|
940
|
+
toolType: ToolType;
|
|
941
|
+
cause?: Error;
|
|
942
|
+
constructor(message: string, stepName: string, toolType: ToolType, cause?: Error);
|
|
943
|
+
}
|
|
944
|
+
export declare class RecipeDependencyError extends Error {
|
|
945
|
+
dependency: string;
|
|
946
|
+
version?: string;
|
|
947
|
+
constructor(message: string, dependency: string, version?: string);
|
|
948
|
+
}
|
|
949
|
+
export declare class CircularDependencyError extends Error {
|
|
950
|
+
cycle: string[];
|
|
951
|
+
constructor(message: string, cycle: string[]);
|
|
952
|
+
}
|
|
953
|
+
//# sourceMappingURL=recipe.d.ts.map
|