Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

1.4 KB
Raw Blame
// Spec + operations -> SKILL.md (frontmatter + prose, specs/SKILL_SPEC.md).

function yamlList(items) {
	if (!items.length) return '[]';
	return `\n${items.map((t) => `    - ${t}`).join('\n')}`;
}

/**
 * @param {object} manifest from generateManifest()
 * @param {object} doc parsed OpenAPI document
 * @param {Array} operations from listOperations()
 */
export function generateSkillMd(manifest, doc, operations) {
	const info = doc.info || {};
	const triggers = manifest.provides.triggers;

	const toolLines = operations
		.map((op) => `- **${op.operationId}** (${op.method} ${op.path}): ${op.description}`)
		.join('\n');

	const secretLines = manifest.requires.secrets.length
		? `\n## Authentication\n\nThis skill needs the following secrets, provided by the host as \`ctx.secrets\`, never hardcoded:\n\n${manifest.requires.secrets.map((s) => `- \`${s}\``).join('\n')}\n`
		: '';

	const body = `---
name: ${manifest.name}
description: ${manifest.description.replace(/\n/g, ' ')}
triggers:${yamlList(triggers)}
cost: low
---

# ${info.title || manifest.name}

${info.description || `Imported from an OpenAPI spec (version ${info.version || 'unknown'}).`}

## Tools

${toolLines || '_No operations were found in this spec._'}
${secretLines}
## Source

Generated by @three-ws/skill-import from an OpenAPI document. Re-import to pick up spec changes;
this bundle is not hand-maintained.
`;
	return body;
}