{ "kind": "open-flow-workflow", "version": 1, "name": "GitHub Prompt Runner", "content": { "modelVersion": 14, "document": { "bindings": {}, "graph": { "nodes": { "n_e136d9b09d921c7f": { "name": "Prompt variables", "kind": "start", "inputDefs": [ { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "variables" } ] }, "n_dd527a8abc292936": { "inputs": { "owner": { "kind": "value", "value": "YOUR_GITHUB_OWNER" }, "repo": { "kind": "value", "value": "YOUR_REPOSITORY" }, "path": { "kind": "value", "value": "prompts/example.md" } }, "name": "Read GitHub prompt file", "kind": "task", "task": { "inputs": [ { "description": "The repository owner.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The repository owner." }, "nullable": false, "handle": "owner" }, { "description": "The repository name.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The repository name." }, "nullable": false, "handle": "repo" }, { "description": "The file path.", "jsonSchema": { "type": "string", "minLength": 1, "description": "The file path." }, "nullable": false, "handle": "path" }, { "description": "The branch, tag, or commit SHA.", "jsonSchema": { "type": "string", "description": "The branch, tag, or commit SHA." }, "nullable": true, "handle": "ref", "value": null } ], "outputs": [ { "description": "A GitHub file content record with decoded content.", "jsonSchema": { "allOf": [ { "type": "object", "properties": { "type": { "type": "string", "enum": [ "file", "dir", "symlink", "submodule" ], "description": "The content entry type." }, "name": { "type": "string", "description": "The file or directory name." }, "path": { "type": "string", "description": "The file path." }, "sha": { "type": "string", "description": "The content SHA." }, "size": { "type": "integer", "description": "The file size in bytes." }, "html_url": { "type": [ "string", "null" ], "description": "The content URL." }, "download_url": { "type": [ "string", "null" ], "description": "The download URL." } }, "required": [ "type", "name", "path", "sha" ], "additionalProperties": true, "description": "A GitHub content entry record." }, { "type": "object", "properties": { "type": { "const": "file", "description": "The content type." }, "content_base64": { "type": "string", "description": "The file content encoded as base64." }, "decoded_content": { "type": [ "string", "null" ], "description": "The decoded file content." }, "encoding": { "type": "string", "description": "The content encoding." } }, "required": [ "type", "content_base64", "decoded_content" ], "additionalProperties": true, "description": "Additional object fields." } ], "description": "A GitHub file content record with decoded content." }, "nullable": false, "handle": "output" } ], "name": "Read GitHub prompt file", "executor": { "kind": "connector", "action": "github.get_file_contents", "outputMode": "value" } } }, "n_4c75873d1c8c4e6c": { "inputs": { "file": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_dd527a8abc292936", "output": "output" } ] }, "variables": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_e136d9b09d921c7f", "output": "variables" } ] } }, "name": "Check and fill prompt variables", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "file" }, { "jsonSchema": { "type": "object", "additionalProperties": { "type": "string" } }, "nullable": false, "handle": "variables" } ], "outputs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "prompt" } ], "name": "Check and fill prompt variables", "moduleId": "n_549e055dc49370d8", "capabilities": [ { "kind": "connector", "mode": "independent", "actions": [] } ] } }, "n_0aedbff219a28fef": { "inputs": { "prompt": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_4c75873d1c8c4e6c", "output": "prompt" } ] } }, "name": "Run completed prompt", "kind": "task", "task": { "inputs": [ { "jsonSchema": { "items": { "type": "object" }, "type": "array" }, "nullable": true, "handle": "messages", "value": null }, { "jsonSchema": { "items": { "type": "object" }, "minItems": 1, "type": "array" }, "nullable": false, "handle": "template", "value": [ { "role": "system", "content": "You are a helpful assistant" }, { "role": "user", "content": "{{prompt}}" } ] }, { "jsonSchema": { "type": "object" }, "nullable": false, "handle": "model", "value": { "model": "llama3.2" } }, { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "prompt" } ], "outputs": [ { "description": "Generated response.", "jsonSchema": { "type": "string" }, "nullable": false, "handle": "output" } ], "name": "Run completed prompt", "executor": { "kind": "llm", "mode": "chat" } } }, "n_12679c5f8f66067a": { "name": "Prompt response", "kind": "outputs", "outputDefs": [ { "jsonSchema": { "type": "string" }, "nullable": false, "handle": "promptResponse" } ], "outputMappings": { "promptResponse": { "kind": "sources", "sources": [ { "kind": "node", "nodeId": "n_0aedbff219a28fef", "output": "output" } ] } } } }, "edges": [ { "source": "n_e136d9b09d921c7f", "target": "n_dd527a8abc292936" }, { "source": "n_dd527a8abc292936", "target": "n_4c75873d1c8c4e6c" }, { "source": "n_4c75873d1c8c4e6c", "target": "n_0aedbff219a28fef" }, { "source": "n_0aedbff219a28fef", "target": "n_12679c5f8f66067a" } ] } }, "modules": { "n_549e055dc49370d8": { "name": "Check and fill prompt variables", "imports": [], "source": "export function substitutePrompt({ promptText, variables }) {\n if (typeof promptText !== 'string' || !promptText.trim()) throw new Error('The GitHub prompt file must contain UTF-8 text.');\n if (!variables || typeof variables !== 'object' || Array.isArray(variables) || Object.values(variables).some(value => typeof value !== 'string')) throw new Error('Prompt variables must be an object of strings.');\n const keys = [...new Set([...promptText.matchAll(/{{(.*?)}}/g)].map(match => match[1].trim().split('.').pop().trim()))];\n const missing = keys.filter(key => !Object.hasOwn(variables, key));\n if (missing.length) throw new Error('Missing prompt variables: ' + missing.join(', '));\n const prompt = promptText.replace(/{{(.*?)}}/g, (_, expression) => variables[expression.trim().split('.').pop().trim()]);\n return { prompt };\n}\n\nexport default function prepareGitHubPrompt({ file, variables }) {\n if (!file || file.type !== 'file' || typeof file.decoded_content !== 'string') throw new Error('GitHub must return a regular UTF-8 prompt file.');\n if ((typeof file.size === 'number' && file.size > 1048576) || new TextEncoder().encode(file.decoded_content).length > 1048576) throw new Error('The prompt file must be at most 1 MiB.');\n return substitutePrompt({ promptText: file.decoded_content, variables });\n}\n" } } }, "presentation": { "designer": { "version": 1, "flow": { "direction": "vertical" } } } }