@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.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/actions/communication.d.ts +201 -0
- package/dist/actions/communication.d.ts.map +1 -0
- package/dist/actions/communication.js +515 -0
- package/dist/actions/communication.js.map +1 -0
- package/dist/actions/decorator.d.ts +22 -0
- package/dist/actions/decorator.d.ts.map +1 -0
- package/dist/actions/decorator.js +110 -0
- package/dist/actions/decorator.js.map +1 -0
- package/dist/actions/executor.d.ts +85 -0
- package/dist/actions/executor.d.ts.map +1 -0
- package/dist/actions/executor.js +289 -0
- package/dist/actions/executor.js.map +1 -0
- package/dist/actions/index.d.ts +14 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +15 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/parameter-resolver.d.ts +54 -0
- package/dist/actions/parameter-resolver.d.ts.map +1 -0
- package/dist/actions/parameter-resolver.js +300 -0
- package/dist/actions/parameter-resolver.js.map +1 -0
- package/dist/actions/registry.d.ts +78 -0
- package/dist/actions/registry.d.ts.map +1 -0
- package/dist/actions/registry.js +221 -0
- package/dist/actions/registry.js.map +1 -0
- package/dist/actions/types.d.ts +109 -0
- package/dist/actions/types.d.ts.map +1 -0
- package/dist/actions/types.js +31 -0
- package/dist/actions/types.js.map +1 -0
- package/dist/actions/utils.d.ts +42 -0
- package/dist/actions/utils.d.ts.map +1 -0
- package/dist/actions/utils.js +144 -0
- package/dist/actions/utils.js.map +1 -0
- package/dist/ai/ai-collector.d.ts +52 -0
- package/dist/ai/ai-collector.d.ts.map +1 -0
- package/dist/ai/ai-collector.js +64 -0
- package/dist/ai/ai-collector.js.map +1 -0
- package/dist/ai/ai-config.d.ts +230 -0
- package/dist/ai/ai-config.d.ts.map +1 -0
- package/dist/ai/ai-config.js +8 -0
- package/dist/ai/ai-config.js.map +1 -0
- package/dist/ai/ai-service.d.ts +66 -0
- package/dist/ai/ai-service.d.ts.map +1 -0
- package/dist/ai/ai-service.js +198 -0
- package/dist/ai/ai-service.js.map +1 -0
- package/dist/ai/ai-variable-resolver.d.ts +59 -0
- package/dist/ai/ai-variable-resolver.d.ts.map +1 -0
- package/dist/ai/ai-variable-resolver.js +219 -0
- package/dist/ai/ai-variable-resolver.js.map +1 -0
- package/dist/ai/context-collector.d.ts +30 -0
- package/dist/ai/context-collector.d.ts.map +1 -0
- package/dist/ai/context-collector.js +158 -0
- package/dist/ai/context-collector.js.map +1 -0
- package/dist/ai/cost-tracker.d.ts +41 -0
- package/dist/ai/cost-tracker.d.ts.map +1 -0
- package/dist/ai/cost-tracker.js +131 -0
- package/dist/ai/cost-tracker.js.map +1 -0
- package/dist/ai/env.d.ts +36 -0
- package/dist/ai/env.d.ts.map +1 -0
- package/dist/ai/env.js +100 -0
- package/dist/ai/env.js.map +1 -0
- package/dist/ai/index.d.ts +17 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +25 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/model-router.d.ts +32 -0
- package/dist/ai/model-router.d.ts.map +1 -0
- package/dist/ai/model-router.js +113 -0
- package/dist/ai/model-router.js.map +1 -0
- package/dist/ai/output-validator.d.ts +24 -0
- package/dist/ai/output-validator.d.ts.map +1 -0
- package/dist/ai/output-validator.js +279 -0
- package/dist/ai/output-validator.js.map +1 -0
- package/dist/ai/prompt-assembler.d.ts +30 -0
- package/dist/ai/prompt-assembler.d.ts.map +1 -0
- package/dist/ai/prompt-assembler.js +93 -0
- package/dist/ai/prompt-assembler.js.map +1 -0
- package/dist/ai/prompt-pipeline.d.ts +63 -0
- package/dist/ai/prompt-pipeline.d.ts.map +1 -0
- package/dist/ai/prompt-pipeline.js +119 -0
- package/dist/ai/prompt-pipeline.js.map +1 -0
- package/dist/ai/prompt-template.jig +88 -0
- package/dist/ai/transports/api-transport.d.ts +12 -0
- package/dist/ai/transports/api-transport.d.ts.map +1 -0
- package/dist/ai/transports/api-transport.js +86 -0
- package/dist/ai/transports/api-transport.js.map +1 -0
- package/dist/ai/transports/command-transport.d.ts +20 -0
- package/dist/ai/transports/command-transport.d.ts.map +1 -0
- package/dist/ai/transports/command-transport.js +203 -0
- package/dist/ai/transports/command-transport.js.map +1 -0
- package/dist/ai/transports/index.d.ts +11 -0
- package/dist/ai/transports/index.d.ts.map +1 -0
- package/dist/ai/transports/index.js +10 -0
- package/dist/ai/transports/index.js.map +1 -0
- package/dist/ai/transports/resolve-transport.d.ts +15 -0
- package/dist/ai/transports/resolve-transport.d.ts.map +1 -0
- package/dist/ai/transports/resolve-transport.js +96 -0
- package/dist/ai/transports/resolve-transport.js.map +1 -0
- package/dist/ai/transports/stdout-transport.d.ts +14 -0
- package/dist/ai/transports/stdout-transport.d.ts.map +1 -0
- package/dist/ai/transports/stdout-transport.js +27 -0
- package/dist/ai/transports/stdout-transport.js.map +1 -0
- package/dist/ai/transports/types.d.ts +77 -0
- package/dist/ai/transports/types.d.ts.map +1 -0
- package/dist/ai/transports/types.js +8 -0
- package/dist/ai/transports/types.js.map +1 -0
- package/dist/commands/cookbook/info.d.ts +22 -0
- package/dist/commands/cookbook/info.d.ts.map +1 -0
- package/dist/commands/cookbook/info.js +217 -0
- package/dist/commands/cookbook/info.js.map +1 -0
- package/dist/commands/cookbook/list.d.ts +20 -0
- package/dist/commands/cookbook/list.d.ts.map +1 -0
- package/dist/commands/cookbook/list.js +133 -0
- package/dist/commands/cookbook/list.js.map +1 -0
- package/dist/commands/gen.d.ts +65 -0
- package/dist/commands/gen.d.ts.map +1 -0
- package/dist/commands/gen.js +478 -0
- package/dist/commands/gen.js.map +1 -0
- package/dist/commands/recipe/info.d.ts +18 -0
- package/dist/commands/recipe/info.d.ts.map +1 -0
- package/dist/commands/recipe/info.js +89 -0
- package/dist/commands/recipe/info.js.map +1 -0
- package/dist/commands/recipe/list.d.ts +29 -0
- package/dist/commands/recipe/list.d.ts.map +1 -0
- package/dist/commands/recipe/list.js +215 -0
- package/dist/commands/recipe/list.js.map +1 -0
- package/dist/commands/recipe/run.d.ts +44 -0
- package/dist/commands/recipe/run.d.ts.map +1 -0
- package/dist/commands/recipe/run.js +239 -0
- package/dist/commands/recipe/run.js.map +1 -0
- package/dist/commands/recipe/validate.d.ts +19 -0
- package/dist/commands/recipe/validate.d.ts.map +1 -0
- package/dist/commands/recipe/validate.js +66 -0
- package/dist/commands/recipe/validate.js.map +1 -0
- package/dist/discovery/generator-discovery.d.ts +130 -0
- package/dist/discovery/generator-discovery.d.ts.map +1 -0
- package/dist/discovery/generator-discovery.js +674 -0
- package/dist/discovery/generator-discovery.js.map +1 -0
- package/dist/discovery/index.d.ts +8 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +7 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/hooks/command-not-found.d.ts +18 -0
- package/dist/hooks/command-not-found.d.ts.map +1 -0
- package/dist/hooks/command-not-found.js +182 -0
- package/dist/hooks/command-not-found.js.map +1 -0
- package/dist/hooks/suggest.d.ts +13 -0
- package/dist/hooks/suggest.d.ts.map +1 -0
- package/dist/hooks/suggest.js +28 -0
- package/dist/hooks/suggest.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/base-command.d.ts +26 -0
- package/dist/lib/base-command.d.ts.map +1 -0
- package/dist/lib/base-command.js +24 -0
- package/dist/lib/base-command.js.map +1 -0
- package/dist/lib/flags.d.ts +33 -0
- package/dist/lib/flags.d.ts.map +1 -0
- package/dist/lib/flags.js +64 -0
- package/dist/lib/flags.js.map +1 -0
- package/dist/ops/add.d.ts +4 -0
- package/dist/ops/add.d.ts.map +1 -0
- package/dist/ops/add.js +85 -0
- package/dist/ops/add.js.map +1 -0
- package/dist/ops/inject.d.ts +4 -0
- package/dist/ops/inject.d.ts.map +1 -0
- package/dist/ops/inject.js +28 -0
- package/dist/ops/inject.js.map +1 -0
- package/dist/ops/injector.d.ts +4 -0
- package/dist/ops/injector.d.ts.map +1 -0
- package/dist/ops/injector.js +68 -0
- package/dist/ops/injector.js.map +1 -0
- package/dist/ops/result.d.ts +3 -0
- package/dist/ops/result.d.ts.map +1 -0
- package/dist/ops/result.js +8 -0
- package/dist/ops/result.js.map +1 -0
- package/dist/prompts/interactive-prompts.d.ts +152 -0
- package/dist/prompts/interactive-prompts.d.ts.map +1 -0
- package/dist/prompts/interactive-prompts.js +574 -0
- package/dist/prompts/interactive-prompts.js.map +1 -0
- package/dist/recipe-engine/group-executor.d.ts +97 -0
- package/dist/recipe-engine/group-executor.d.ts.map +1 -0
- package/dist/recipe-engine/group-executor.js +293 -0
- package/dist/recipe-engine/group-executor.js.map +1 -0
- package/dist/recipe-engine/index.d.ts +112 -0
- package/dist/recipe-engine/index.d.ts.map +1 -0
- package/dist/recipe-engine/index.js +223 -0
- package/dist/recipe-engine/index.js.map +1 -0
- package/dist/recipe-engine/output-evaluator.d.ts +28 -0
- package/dist/recipe-engine/output-evaluator.d.ts.map +1 -0
- package/dist/recipe-engine/output-evaluator.js +78 -0
- package/dist/recipe-engine/output-evaluator.js.map +1 -0
- package/dist/recipe-engine/recipe-engine.d.ts +227 -0
- package/dist/recipe-engine/recipe-engine.d.ts.map +1 -0
- package/dist/recipe-engine/recipe-engine.js +1036 -0
- package/dist/recipe-engine/recipe-engine.js.map +1 -0
- package/dist/recipe-engine/step-executor.d.ts +172 -0
- package/dist/recipe-engine/step-executor.d.ts.map +1 -0
- package/dist/recipe-engine/step-executor.js +802 -0
- package/dist/recipe-engine/step-executor.js.map +1 -0
- package/dist/recipe-engine/tools/action-tool.d.ts +103 -0
- package/dist/recipe-engine/tools/action-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/action-tool.js +473 -0
- package/dist/recipe-engine/tools/action-tool.js.map +1 -0
- package/dist/recipe-engine/tools/ai-tool.d.ts +26 -0
- package/dist/recipe-engine/tools/ai-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/ai-tool.js +233 -0
- package/dist/recipe-engine/tools/ai-tool.js.map +1 -0
- package/dist/recipe-engine/tools/base.d.ts +214 -0
- package/dist/recipe-engine/tools/base.d.ts.map +1 -0
- package/dist/recipe-engine/tools/base.js +397 -0
- package/dist/recipe-engine/tools/base.js.map +1 -0
- package/dist/recipe-engine/tools/codemod-tool.d.ts +130 -0
- package/dist/recipe-engine/tools/codemod-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/codemod-tool.js +786 -0
- package/dist/recipe-engine/tools/codemod-tool.js.map +1 -0
- package/dist/recipe-engine/tools/ensure-dirs-tool.d.ts +21 -0
- package/dist/recipe-engine/tools/ensure-dirs-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/ensure-dirs-tool.js +130 -0
- package/dist/recipe-engine/tools/ensure-dirs-tool.js.map +1 -0
- package/dist/recipe-engine/tools/index.d.ts +126 -0
- package/dist/recipe-engine/tools/index.d.ts.map +1 -0
- package/dist/recipe-engine/tools/index.js +290 -0
- package/dist/recipe-engine/tools/index.js.map +1 -0
- package/dist/recipe-engine/tools/install-tool.d.ts +20 -0
- package/dist/recipe-engine/tools/install-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/install-tool.js +194 -0
- package/dist/recipe-engine/tools/install-tool.js.map +1 -0
- package/dist/recipe-engine/tools/parallel-tool.d.ts +21 -0
- package/dist/recipe-engine/tools/parallel-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/parallel-tool.js +134 -0
- package/dist/recipe-engine/tools/parallel-tool.js.map +1 -0
- package/dist/recipe-engine/tools/patch-tool.d.ts +21 -0
- package/dist/recipe-engine/tools/patch-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/patch-tool.js +248 -0
- package/dist/recipe-engine/tools/patch-tool.js.map +1 -0
- package/dist/recipe-engine/tools/prompt-tool.d.ts +25 -0
- package/dist/recipe-engine/tools/prompt-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/prompt-tool.js +162 -0
- package/dist/recipe-engine/tools/prompt-tool.js.map +1 -0
- package/dist/recipe-engine/tools/query-tool.d.ts +21 -0
- package/dist/recipe-engine/tools/query-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/query-tool.js +249 -0
- package/dist/recipe-engine/tools/query-tool.js.map +1 -0
- package/dist/recipe-engine/tools/recipe-tool.d.ts +103 -0
- package/dist/recipe-engine/tools/recipe-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/recipe-tool.js +617 -0
- package/dist/recipe-engine/tools/recipe-tool.js.map +1 -0
- package/dist/recipe-engine/tools/registry.d.ts +151 -0
- package/dist/recipe-engine/tools/registry.d.ts.map +1 -0
- package/dist/recipe-engine/tools/registry.js +244 -0
- package/dist/recipe-engine/tools/registry.js.map +1 -0
- package/dist/recipe-engine/tools/sequence-tool.d.ts +22 -0
- package/dist/recipe-engine/tools/sequence-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/sequence-tool.js +122 -0
- package/dist/recipe-engine/tools/sequence-tool.js.map +1 -0
- package/dist/recipe-engine/tools/shell-tool.d.ts +25 -0
- package/dist/recipe-engine/tools/shell-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/shell-tool.js +149 -0
- package/dist/recipe-engine/tools/shell-tool.js.map +1 -0
- package/dist/recipe-engine/tools/template-tool.d.ts +88 -0
- package/dist/recipe-engine/tools/template-tool.d.ts.map +1 -0
- package/dist/recipe-engine/tools/template-tool.js +613 -0
- package/dist/recipe-engine/tools/template-tool.js.map +1 -0
- package/dist/recipe-engine/types.d.ts +963 -0
- package/dist/recipe-engine/types.d.ts.map +1 -0
- package/dist/recipe-engine/types.js +94 -0
- package/dist/recipe-engine/types.js.map +1 -0
- package/dist/template-engines/ai-tags.d.ts +26 -0
- package/dist/template-engines/ai-tags.d.ts.map +1 -0
- package/dist/template-engines/ai-tags.js +233 -0
- package/dist/template-engines/ai-tags.js.map +1 -0
- package/dist/template-engines/index.d.ts +8 -0
- package/dist/template-engines/index.d.ts.map +1 -0
- package/dist/template-engines/index.js +8 -0
- package/dist/template-engines/index.js.map +1 -0
- package/dist/template-engines/jig-engine.d.ts +47 -0
- package/dist/template-engines/jig-engine.d.ts.map +1 -0
- package/dist/template-engines/jig-engine.js +173 -0
- package/dist/template-engines/jig-engine.js.map +1 -0
- package/dist/utils/coerce-value.d.ts +7 -0
- package/dist/utils/coerce-value.d.ts.map +1 -0
- package/dist/utils/coerce-value.js +18 -0
- package/dist/utils/coerce-value.js.map +1 -0
- package/dist/utils/diff.d.ts +8 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/diff.js +10 -0
- package/dist/utils/diff.js.map +1 -0
- package/dist/utils/global-packages.d.ts +11 -0
- package/dist/utils/global-packages.d.ts.map +1 -0
- package/dist/utils/global-packages.js +88 -0
- package/dist/utils/global-packages.js.map +1 -0
- package/dist/utils/pager.d.ts +6 -0
- package/dist/utils/pager.d.ts.map +1 -0
- package/dist/utils/pager.js +41 -0
- package/dist/utils/pager.js.map +1 -0
- package/help/cookbook/info.md +35 -0
- package/help/cookbook/list.md +37 -0
- package/help/gen.md +26 -0
- package/help/recipe/run.md +52 -0
- package/help/recipe/validate.md +51 -0
- package/oclif.manifest.json +580 -0
- package/package.json +120 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Transport
|
|
3
|
+
*
|
|
4
|
+
* Resolves @ai blocks by piping the prompt to a CLI command.
|
|
5
|
+
* Supports two sub-modes:
|
|
6
|
+
* - 'batched' (default): one invocation, JSON response with all keys
|
|
7
|
+
* - 'per-block': one invocation per @ai block, raw text response per key
|
|
8
|
+
*
|
|
9
|
+
* Command template:
|
|
10
|
+
* - Contains {prompt} → shell-escape and substitute into args
|
|
11
|
+
* - No {prompt} → pipe prompt to subprocess stdin
|
|
12
|
+
*/
|
|
13
|
+
import { execFile } from "node:child_process";
|
|
14
|
+
import { ErrorCode, ErrorHandler } from "@hypercli/core";
|
|
15
|
+
import createDebug from "debug";
|
|
16
|
+
import { PromptAssembler } from "#ai/prompt-assembler";
|
|
17
|
+
const debug = createDebug("hypergen:ai:transport:command");
|
|
18
|
+
export class CommandTransport {
|
|
19
|
+
name = "command";
|
|
20
|
+
async resolve(ctx) {
|
|
21
|
+
const command = ctx.config.command;
|
|
22
|
+
if (!command) {
|
|
23
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, "Command transport requires ai.command to be set in config", {});
|
|
24
|
+
}
|
|
25
|
+
const commandMode = ctx.config.commandMode || "batched";
|
|
26
|
+
const entries = ctx.collector.getEntries();
|
|
27
|
+
const expectedKeys = [...entries.keys()];
|
|
28
|
+
debug("Resolving %d AI blocks via command (%s mode): %s", expectedKeys.length, commandMode, command);
|
|
29
|
+
if (commandMode === "per-block") {
|
|
30
|
+
return this.resolvePerBlock(ctx, command, entries);
|
|
31
|
+
}
|
|
32
|
+
return this.resolveBatched(ctx, command, expectedKeys);
|
|
33
|
+
}
|
|
34
|
+
async resolveBatched(ctx, command, expectedKeys) {
|
|
35
|
+
const assembler = new PromptAssembler();
|
|
36
|
+
const prompt = assembler.assemble(ctx.collector, {
|
|
37
|
+
originalCommand: ctx.originalCommand,
|
|
38
|
+
answersPath: ctx.answersPath,
|
|
39
|
+
promptTemplate: ctx.promptTemplate,
|
|
40
|
+
});
|
|
41
|
+
// Append JSON-only instruction
|
|
42
|
+
const fullPrompt = `${prompt}\n\nIMPORTANT: Respond with ONLY a valid JSON object. No markdown fences, no explanation.\n`;
|
|
43
|
+
const stdout = await executeCommand(command, fullPrompt);
|
|
44
|
+
const answers = parseBatchedResponse(stdout, expectedKeys);
|
|
45
|
+
debug("Command resolved %d keys", Object.keys(answers).length);
|
|
46
|
+
return { status: "resolved", answers };
|
|
47
|
+
}
|
|
48
|
+
async resolvePerBlock(ctx, command, entries) {
|
|
49
|
+
const answers = {};
|
|
50
|
+
for (const [key, entry] of entries) {
|
|
51
|
+
debug('Resolving block "%s" via command', key);
|
|
52
|
+
// Build a single-block prompt
|
|
53
|
+
const parts = [];
|
|
54
|
+
if (entry.contexts.length > 0) {
|
|
55
|
+
parts.push("## Context\n");
|
|
56
|
+
for (const c of entry.contexts)
|
|
57
|
+
parts.push(`${c}\n`);
|
|
58
|
+
}
|
|
59
|
+
parts.push("## Prompt\n");
|
|
60
|
+
parts.push(`${entry.prompt}\n`);
|
|
61
|
+
if (entry.outputDescription.trim()) {
|
|
62
|
+
parts.push("## Expected Output Format\n");
|
|
63
|
+
parts.push(`${entry.outputDescription}\n`);
|
|
64
|
+
}
|
|
65
|
+
if (entry.examples.length > 0) {
|
|
66
|
+
parts.push("## Examples\n");
|
|
67
|
+
for (const ex of entry.examples) {
|
|
68
|
+
parts.push(`\`\`\`\n${ex}\n\`\`\`\n`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
parts.push("\nRespond with ONLY the generated content. No explanation, no markdown fences.\n");
|
|
72
|
+
const prompt = parts.join("\n");
|
|
73
|
+
const stdout = await executeCommand(command, prompt);
|
|
74
|
+
answers[key] = stdout.trim();
|
|
75
|
+
}
|
|
76
|
+
debug("Command (per-block) resolved %d keys", Object.keys(answers).length);
|
|
77
|
+
return { status: "resolved", answers };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Execute a command, either by substituting {prompt} into args or piping via stdin.
|
|
82
|
+
*/
|
|
83
|
+
function executeCommand(commandTemplate, prompt) {
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
const usesSubstitution = commandTemplate.includes("{prompt}");
|
|
86
|
+
let cmd;
|
|
87
|
+
let args;
|
|
88
|
+
if (usesSubstitution) {
|
|
89
|
+
// Shell-escape the prompt and substitute
|
|
90
|
+
const escaped = shellEscape(prompt);
|
|
91
|
+
const full = commandTemplate.replace(/\{prompt\}/g, escaped);
|
|
92
|
+
// Use shell execution for substituted commands
|
|
93
|
+
cmd = "/bin/sh";
|
|
94
|
+
args = ["-c", full];
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
// Parse the command into parts
|
|
98
|
+
const parts = parseCommand(commandTemplate);
|
|
99
|
+
cmd = parts[0];
|
|
100
|
+
args = parts.slice(1);
|
|
101
|
+
}
|
|
102
|
+
debug("Executing: %s %s", cmd, usesSubstitution ? "(with substitution)" : "(with stdin pipe)");
|
|
103
|
+
// Strip CLAUDECODE to avoid "nested session" errors inside Claude Code
|
|
104
|
+
const { CLAUDECODE: _cc, ...cleanEnv } = process.env;
|
|
105
|
+
const child = execFile(cmd, args, {
|
|
106
|
+
maxBuffer: 10 * 1024 * 1024, // 10MB
|
|
107
|
+
timeout: 300_000, // 5 minutes
|
|
108
|
+
env: cleanEnv,
|
|
109
|
+
}, (error, stdout, stderr) => {
|
|
110
|
+
if (error) {
|
|
111
|
+
const msg = stderr?.trim() || error.message;
|
|
112
|
+
reject(ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, `Command failed (exit ${error.code ?? "unknown"}): ${msg}`, { cause: error }));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
resolve(stdout);
|
|
116
|
+
});
|
|
117
|
+
// Pipe prompt via stdin if no {prompt} substitution
|
|
118
|
+
if (!usesSubstitution && child.stdin) {
|
|
119
|
+
child.stdin.on("error", () => {
|
|
120
|
+
// Ignore EPIPE errors - the process may have already exited
|
|
121
|
+
});
|
|
122
|
+
child.stdin.write(prompt);
|
|
123
|
+
child.stdin.end();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parse a batched JSON response from a command.
|
|
129
|
+
*/
|
|
130
|
+
function parseBatchedResponse(raw, expectedKeys) {
|
|
131
|
+
let text = raw.trim();
|
|
132
|
+
// Strip markdown code fences
|
|
133
|
+
const fenceMatch = text.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?\s*```$/m);
|
|
134
|
+
if (fenceMatch) {
|
|
135
|
+
text = fenceMatch[1].trim();
|
|
136
|
+
}
|
|
137
|
+
// Try to extract JSON object from the response
|
|
138
|
+
const jsonStart = text.indexOf("{");
|
|
139
|
+
const jsonEnd = text.lastIndexOf("}");
|
|
140
|
+
if (jsonStart >= 0 && jsonEnd > jsonStart) {
|
|
141
|
+
text = text.slice(jsonStart, jsonEnd + 1);
|
|
142
|
+
}
|
|
143
|
+
let parsed;
|
|
144
|
+
try {
|
|
145
|
+
parsed = JSON.parse(text);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, `Failed to parse JSON from command output. Output starts with: "${raw.slice(0, 100)}..."`, { cause: err });
|
|
149
|
+
}
|
|
150
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
151
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, `Command output is not a JSON object. Got: ${typeof parsed}`, {});
|
|
152
|
+
}
|
|
153
|
+
const missing = expectedKeys.filter((k) => !(k in parsed));
|
|
154
|
+
if (missing.length > 0) {
|
|
155
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, `Command response missing expected keys: ${missing.join(", ")}`, {
|
|
156
|
+
expected: expectedKeys.join(", "),
|
|
157
|
+
received: Object.keys(parsed).join(", "),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
const answers = {};
|
|
161
|
+
for (const key of expectedKeys) {
|
|
162
|
+
const val = parsed[key];
|
|
163
|
+
answers[key] = typeof val === "string" ? val : JSON.stringify(val);
|
|
164
|
+
}
|
|
165
|
+
return answers;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Simple shell escape for single-quoting a string.
|
|
169
|
+
*/
|
|
170
|
+
function shellEscape(s) {
|
|
171
|
+
return `'${s.replace(/'/g, "'\\''")}'`;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Parse a command string into parts, respecting quotes.
|
|
175
|
+
*/
|
|
176
|
+
function parseCommand(cmd) {
|
|
177
|
+
const parts = [];
|
|
178
|
+
let current = "";
|
|
179
|
+
let inSingle = false;
|
|
180
|
+
let inDouble = false;
|
|
181
|
+
for (let i = 0; i < cmd.length; i++) {
|
|
182
|
+
const ch = cmd[i];
|
|
183
|
+
if (ch === "'" && !inDouble) {
|
|
184
|
+
inSingle = !inSingle;
|
|
185
|
+
}
|
|
186
|
+
else if (ch === '"' && !inSingle) {
|
|
187
|
+
inDouble = !inDouble;
|
|
188
|
+
}
|
|
189
|
+
else if (ch === " " && !inSingle && !inDouble) {
|
|
190
|
+
if (current) {
|
|
191
|
+
parts.push(current);
|
|
192
|
+
current = "";
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
current += ch;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (current)
|
|
200
|
+
parts.push(current);
|
|
201
|
+
return parts;
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=command-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-transport.js","sourceRoot":"","sources":["../../../src/ai/transports/command-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD,MAAM,KAAK,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;AAE3D,MAAM,OAAO,gBAAgB;IACnB,IAAI,GAAG,SAAS,CAAC;IAE1B,KAAK,CAAC,OAAO,CAAC,GAAqB;QAClC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,MAAM,YAAY,CAAC,WAAW,CAC7B,SAAS,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AAC,QAAQ,CAAC;QACtB,CAAC;aAAM,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjD,IAAI,OAAO,EAAE,CAAC;gBACb,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpB,OAAO,GAAG,EAAE,CAAC;YACd,CAAC;QACF,CAAC;aAAM,CAAC;YACP,OAAO,IAAI,EAAE,CAAC;QACf,CAAC;IACF,CAAC;IACD,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEjC,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Transport Module
|
|
3
|
+
*
|
|
4
|
+
* Pluggable transport layer for resolving @ai blocks during 2-pass generation.
|
|
5
|
+
*/
|
|
6
|
+
export type { AiTransport, TransportResult, TransportContext, } from "./types.js";
|
|
7
|
+
export { resolveTransport } from "./resolve-transport.js";
|
|
8
|
+
export { StdoutTransport } from "./stdout-transport.js";
|
|
9
|
+
export { ApiTransport } from "./api-transport.js";
|
|
10
|
+
export { CommandTransport } from "./command-transport.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai/transports/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Transport Module
|
|
3
|
+
*
|
|
4
|
+
* Pluggable transport layer for resolving @ai blocks during 2-pass generation.
|
|
5
|
+
*/
|
|
6
|
+
export { resolveTransport } from "./resolve-transport.js";
|
|
7
|
+
export { StdoutTransport } from "./stdout-transport.js";
|
|
8
|
+
export { ApiTransport } from "./api-transport.js";
|
|
9
|
+
export { CommandTransport } from "./command-transport.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/transports/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport Resolution
|
|
3
|
+
*
|
|
4
|
+
* Maps ai.mode to the appropriate AiTransport instance.
|
|
5
|
+
* Handles 'auto' mode detection based on config.
|
|
6
|
+
*/
|
|
7
|
+
import type { AiServiceConfig } from "../ai-config.js";
|
|
8
|
+
import type { AiTransport } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the AI transport to use based on config and mode.
|
|
11
|
+
*
|
|
12
|
+
* Pure function — no side effects.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveTransport(config: AiServiceConfig | undefined): AiTransport;
|
|
15
|
+
//# sourceMappingURL=resolve-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-transport.d.ts","sourceRoot":"","sources":["../../../src/ai/transports/resolve-transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAIvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,WAAW,CAkCjF"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport Resolution
|
|
3
|
+
*
|
|
4
|
+
* Maps ai.mode to the appropriate AiTransport instance.
|
|
5
|
+
* Handles 'auto' mode detection based on config.
|
|
6
|
+
*/
|
|
7
|
+
import { ErrorCode, ErrorHandler } from "@hypercli/core";
|
|
8
|
+
import createDebug from "debug";
|
|
9
|
+
import { getExpectedEnvVar, hasApiKeyAvailable } from "#ai/env";
|
|
10
|
+
import { ApiTransport } from "./api-transport.js";
|
|
11
|
+
import { CommandTransport } from "./command-transport.js";
|
|
12
|
+
import { StdoutTransport } from "./stdout-transport.js";
|
|
13
|
+
const debug = createDebug("hypergen:ai:transport:resolve");
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the AI transport to use based on config and mode.
|
|
16
|
+
*
|
|
17
|
+
* Pure function — no side effects.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveTransport(config) {
|
|
20
|
+
const mode = config?.mode ?? "auto";
|
|
21
|
+
debug("Resolving transport for mode: %s", mode);
|
|
22
|
+
switch (mode) {
|
|
23
|
+
case "api":
|
|
24
|
+
validateApiConfig(config);
|
|
25
|
+
return new ApiTransport();
|
|
26
|
+
case "command":
|
|
27
|
+
validateCommandConfig(config);
|
|
28
|
+
return new CommandTransport();
|
|
29
|
+
case "stdout":
|
|
30
|
+
return new StdoutTransport();
|
|
31
|
+
case "off":
|
|
32
|
+
// Same as stdout for now; future: interactive prompts
|
|
33
|
+
return new StdoutTransport();
|
|
34
|
+
case "auto":
|
|
35
|
+
return autoDetect(config);
|
|
36
|
+
default: {
|
|
37
|
+
// Exhaustive check
|
|
38
|
+
const _never = mode;
|
|
39
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, `Unknown AI mode: '${_never}'`, {});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Auto-detect the best transport based on what's configured.
|
|
45
|
+
*
|
|
46
|
+
* Priority:
|
|
47
|
+
* 1. Provider + API key available → ApiTransport
|
|
48
|
+
* 2. ai.command set → CommandTransport
|
|
49
|
+
* 3. Otherwise → StdoutTransport
|
|
50
|
+
*/
|
|
51
|
+
function autoDetect(config) {
|
|
52
|
+
if (config && hasApiKeyAvailable(config.apiKeyEnvVar, config.provider)) {
|
|
53
|
+
debug("Auto-detected: api (provider + API key available)");
|
|
54
|
+
return new ApiTransport();
|
|
55
|
+
}
|
|
56
|
+
if (config?.command) {
|
|
57
|
+
debug("Auto-detected: command (ai.command is set)");
|
|
58
|
+
return new CommandTransport();
|
|
59
|
+
}
|
|
60
|
+
debug("Auto-detected: stdout (no API key or command configured)");
|
|
61
|
+
return new StdoutTransport();
|
|
62
|
+
}
|
|
63
|
+
function validateApiConfig(config) {
|
|
64
|
+
if (!config?.provider) {
|
|
65
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, "AI mode 'api' requires ai.provider to be set in config", {}, [
|
|
66
|
+
{
|
|
67
|
+
title: "Set AI provider",
|
|
68
|
+
description: "Add ai.provider to hypergen.config.js (e.g., 'anthropic', 'openai')",
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
}
|
|
72
|
+
if (!hasApiKeyAvailable(config.apiKeyEnvVar, config.provider)) {
|
|
73
|
+
const envVar = getExpectedEnvVar(config.apiKeyEnvVar, config.provider);
|
|
74
|
+
throw ErrorHandler.createError(ErrorCode.AI_API_KEY_MISSING, `AI mode 'api' requires ${envVar} to be set (provider: '${config.provider}')`, {}, [
|
|
75
|
+
{
|
|
76
|
+
title: "Set API key in .env",
|
|
77
|
+
description: `Add ${envVar}=your-key to your .env file`,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
title: "Or set the environment variable directly",
|
|
81
|
+
description: `export ${envVar}=your-key`,
|
|
82
|
+
},
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function validateCommandConfig(config) {
|
|
87
|
+
if (!config?.command) {
|
|
88
|
+
throw ErrorHandler.createError(ErrorCode.AI_TRANSPORT_FAILED, "AI mode 'command' requires ai.command to be set in config", {}, [
|
|
89
|
+
{
|
|
90
|
+
title: "Set AI command",
|
|
91
|
+
description: "Add ai.command to hypergen.config.js (e.g., 'claude -p {prompt}', 'llm')",
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=resolve-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-transport.js","sourceRoot":"","sources":["../../../src/ai/transports/resolve-transport.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,MAAM,KAAK,GAAG,WAAW,CAAC,+BAA+B,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAmC;IACnE,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC;IAEpC,KAAK,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;IAEhD,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,KAAK;YACT,iBAAiB,CAAC,MAAM,CAAC,CAAC;YAC1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ACD,CACD,CAAC;IACH,CAAC;IAED,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/D,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvE,MAAM,YAAY,CAAC,WAAW,CAC7B,SAAS,CAAC,kBAAkB,EAC5B,0BAA0B,MAAM,0BAA0B,MAAM,CAAC,QAAQ,IAAI,EAC7E,EAAE,EACF;YACC;gBACC,KAAK,EAAE,qBAAqB;gBAC5B,WAAW,EAAE,OAAO,MAAM,6BAA6B;aACvD;YACD;gBACC,KAAK,EAAE,0CAA0C;gBACjD,WAAW,EAAE,UAAU,MAAM,WAAW;aACxC;SACD,CACD,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAmC;IACjE,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;QACtB,MAAM,YAAY,CAAC,WAAW,CAC7B,SAAS,CAAC,mBAAmB,EAC7B,2DAA2D,EAC3D,EAAE,EACF;YACC;gBACC,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EAAE,0EAA0E;aACvF;SACD,CACD,CAAC;IACH,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdout Transport
|
|
3
|
+
*
|
|
4
|
+
* Extracts the original Pass 1 behavior: assemble the prompt document,
|
|
5
|
+
* write it to stdout, and signal exit code 2 (deferred resolution).
|
|
6
|
+
*
|
|
7
|
+
* Used by both 'stdout' and 'off' AI modes.
|
|
8
|
+
*/
|
|
9
|
+
import type { AiTransport, TransportContext, TransportResult } from "./types.js";
|
|
10
|
+
export declare class StdoutTransport implements AiTransport {
|
|
11
|
+
readonly name = "stdout";
|
|
12
|
+
resolve(ctx: TransportContext): Promise<TransportResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=stdout-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdout-transport.d.ts","sourceRoot":"","sources":["../../../src/ai/transports/stdout-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIjF,qBAAa,eAAgB,YAAW,WAAW;IAClD,QAAQ,CAAC,IAAI,YAAY;IAEnB,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CAc9D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stdout Transport
|
|
3
|
+
*
|
|
4
|
+
* Extracts the original Pass 1 behavior: assemble the prompt document,
|
|
5
|
+
* write it to stdout, and signal exit code 2 (deferred resolution).
|
|
6
|
+
*
|
|
7
|
+
* Used by both 'stdout' and 'off' AI modes.
|
|
8
|
+
*/
|
|
9
|
+
import createDebug from "debug";
|
|
10
|
+
import { PromptAssembler } from "#ai/prompt-assembler";
|
|
11
|
+
const debug = createDebug("hypergen:ai:transport:stdout");
|
|
12
|
+
export class StdoutTransport {
|
|
13
|
+
name = "stdout";
|
|
14
|
+
async resolve(ctx) {
|
|
15
|
+
const assembler = new PromptAssembler();
|
|
16
|
+
const prompt = assembler.assemble(ctx.collector, {
|
|
17
|
+
originalCommand: ctx.originalCommand,
|
|
18
|
+
answersPath: ctx.answersPath,
|
|
19
|
+
promptTemplate: ctx.promptTemplate,
|
|
20
|
+
variables: ctx.variables,
|
|
21
|
+
});
|
|
22
|
+
debug("Writing prompt to stdout (%d chars)", prompt.length);
|
|
23
|
+
process.stdout.write(prompt);
|
|
24
|
+
return { status: "deferred", exitCode: 2 };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=stdout-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdout-transport.js","sourceRoot":"","sources":["../../../src/ai/transports/stdout-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,MAAM,KAAK,GAAG,WAAW,CAAC,8BAA8B,CAAC,CAAC;AAE1D,MAAM,OAAO,eAAe;IAClB,IAAI,GAAG,QAAQ,CAAC;IAEzB,KAAK,CAAC,OAAO,CAAC,GAAqB;QAClC,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE;YAChD,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,cAAc,EAAE,GAAG,CAAC,cAAc;YAClC,SAAS,EAAE,GAAG,CAAC,SAAS;SACxB,CAAC,CAAC;QAEH,KAAK,CAAC,qCAAqC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE7B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAC5C,CAAC;CACD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Transport Interface
|
|
3
|
+
*
|
|
4
|
+
* Defines the contract for resolving @ai blocks collected during Pass 1.
|
|
5
|
+
* Transports handle delivering the prompt to an AI and returning answers.
|
|
6
|
+
*/
|
|
7
|
+
import type { AiCollector } from "../ai-collector.js";
|
|
8
|
+
import type { AiServiceConfig } from "../ai-config.js";
|
|
9
|
+
/**
|
|
10
|
+
* Result of a transport resolution attempt.
|
|
11
|
+
* Either answers are resolved inline (auto Pass 2), or deferred (user re-runs with --answers).
|
|
12
|
+
*/
|
|
13
|
+
export type TransportResult = {
|
|
14
|
+
status: "resolved";
|
|
15
|
+
answers: Record<string, string>;
|
|
16
|
+
} | {
|
|
17
|
+
status: "deferred";
|
|
18
|
+
exitCode: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Context passed to a transport's resolve method.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Describes a recipe variable for inclusion in the prompt document.
|
|
25
|
+
*/
|
|
26
|
+
export interface PromptVariable {
|
|
27
|
+
/** Variable name (JSON key in answers file) */
|
|
28
|
+
name: string;
|
|
29
|
+
/** Variable type */
|
|
30
|
+
type: string;
|
|
31
|
+
/** Whether a value is required */
|
|
32
|
+
required: boolean;
|
|
33
|
+
/** Default value, if any */
|
|
34
|
+
default?: unknown;
|
|
35
|
+
/** Prompt question for the variable */
|
|
36
|
+
prompt?: string;
|
|
37
|
+
/** Human-readable description */
|
|
38
|
+
description?: string;
|
|
39
|
+
/** Allowed values for enum types */
|
|
40
|
+
values?: string[];
|
|
41
|
+
/** Whether the user already provided a value */
|
|
42
|
+
provided: boolean;
|
|
43
|
+
/** The value the user provided (if any) */
|
|
44
|
+
providedValue?: unknown;
|
|
45
|
+
}
|
|
46
|
+
export interface TransportContext {
|
|
47
|
+
/** The collector with accumulated @ai block data */
|
|
48
|
+
collector: AiCollector;
|
|
49
|
+
/** AI configuration from hypergen.config.js */
|
|
50
|
+
config: AiServiceConfig;
|
|
51
|
+
/** The original CLI command (for callback instructions) */
|
|
52
|
+
originalCommand: string;
|
|
53
|
+
/** Suggested path for the answers JSON file */
|
|
54
|
+
answersPath: string;
|
|
55
|
+
/** Project root directory */
|
|
56
|
+
projectRoot: string;
|
|
57
|
+
/** Optional custom prompt template path */
|
|
58
|
+
promptTemplate?: string;
|
|
59
|
+
/** Recipe variables with their definitions and current values */
|
|
60
|
+
variables?: PromptVariable[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A transport knows how to resolve AiBlockEntry[] into answers.
|
|
64
|
+
*
|
|
65
|
+
* Implementations:
|
|
66
|
+
* - StdoutTransport: prints prompt to stdout, exits with code 2
|
|
67
|
+
* - ApiTransport: calls LLM via Vercel AI SDK, returns answers inline
|
|
68
|
+
* - CommandTransport: pipes prompt to a CLI command, parses response
|
|
69
|
+
*
|
|
70
|
+
* Future:
|
|
71
|
+
* - StdioTransport: persistent subprocess with JSON protocol
|
|
72
|
+
*/
|
|
73
|
+
export interface AiTransport {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
resolve(ctx: TransportContext): Promise<TransportResult>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ai/transports/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,eAAe,GACxB;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACvD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C;;GAEG;AACH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAChC,oDAAoD;IACpD,SAAS,EAAE,WAAW,CAAC;IAEvB,+CAA+C;IAC/C,MAAM,EAAE,eAAe,CAAC;IAExB,2DAA2D;IAC3D,eAAe,EAAE,MAAM,CAAC;IAExB,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAC;IAEpB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAC;IAEpB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,iEAAiE;IACjE,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ai/transports/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show detailed information about a cookbook
|
|
3
|
+
*/
|
|
4
|
+
import { BaseCommand } from "#lib/base-command";
|
|
5
|
+
export default class CookbookInfo extends BaseCommand<typeof CookbookInfo> {
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
cwd: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
debug: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
static args: {
|
|
14
|
+
cookbook: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Display available cookbooks grouped by kit when a cookbook is not found
|
|
19
|
+
*/
|
|
20
|
+
private suggestAvailableCookbooks;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/commands/cookbook/info.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW,CAAC,OAAO,YAAY,CAAC;IACzE,OAAgB,WAAW,SAAgD;IAE3E,OAAgB,QAAQ,WAGtB;IAEF,OAAgB,KAAK;;;;MAMnB;IAEF,OAAgB,IAAI;;MAKlB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAqL1B;;OAEG;YACW,yBAAyB;CAmEvC"}
|