UNPKG

@inkeep/create-agents

Version:

Create an Inkeep Agent Framework project

21 lines (20 loc) 842 B
import degit from 'degit'; import fs from 'fs-extra'; //Duplicating function here so we dont have to add a dependency on the agents-cli package export async function cloneTemplate(templatePath, targetPath) { await fs.mkdir(targetPath, { recursive: true }); const templatePathSuffix = templatePath.replace('https://github.com/', ''); const emitter = degit(templatePathSuffix); try { await emitter.clone(targetPath); } catch (error) { process.exit(1); } } export async function getAvailableTemplates() { // Fetch the list of templates from your repo const response = await fetch('https://api.github.com/repos/inkeep/agents-cookbook/contents/template-projects'); const contents = await response.json(); return contents.filter((item) => item.type === 'dir').map((item) => item.name); }