UNPKG

@meldscience/meld

Version:

pipeable one-shot prompt scripting toolkit

37 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Oneshotcat = void 0; const oneshot_1 = require("./oneshot"); const meld_1 = require("./meld"); const anthropic_1 = require("./providers/anthropic"); const config_1 = require("./config"); const fs_1 = require("fs"); class Oneshotcat { constructor(options) { this.options = options; } async process() { // First, process the prompt script const meld = new meld_1.Meld(this.options); const processedContent = await meld.process(); // Load config and create provider const config = (0, config_1.loadConfig)(); const provider = new anthropic_1.AnthropicProvider(config.anthropicApiKey || ''); // Create a temporary file for the processed content const tempFile = '.temp-oneshot-expanded.md'; (0, fs_1.writeFileSync)(tempFile, processedContent); // Then send to AI const oneshot = new oneshot_1.Oneshot({ model: this.options.model || 'claude-3', promptFile: tempFile, system: this.options.system, systemFile: this.options.systemFile }, provider); const responses = await oneshot.process(); // Clean up temp file (0, fs_1.unlinkSync)(tempFile); return responses; } } exports.Oneshotcat = Oneshotcat; //# sourceMappingURL=oneshotcat.js.map