UNPKG

@sogni-ai/sogni-creative-agent-skill

Version:

Sogni Creative Agent Skill: agent skill and CLI for Sogni AI image, video, and music generation.

61 lines (49 loc) 2.11 kB
import { copyFileSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; const repoRoot = dirname(dirname(fileURLToPath(import.meta.url))); // SOGNI_OPENCLAW_LINK_DIR lets tests regenerate the link surface in a temp dir // instead of mutating the working tree. const pluginRoot = process.env.SOGNI_OPENCLAW_LINK_DIR || join(repoRoot, '.openclaw-link'); mkdirSync(pluginRoot, { recursive: true }); for (const filename of ['SKILL.md', 'openclaw.plugin.json', 'openclaw-plugin.mjs']) { copyFileSync(join(repoRoot, filename), join(pluginRoot, filename)); } // SKILL.md defers deep guides to references/ — ship them with the plugin so // the pointers resolve inside OpenClaw installs too. mkdirSync(join(pluginRoot, 'references'), { recursive: true }); for (const filename of readdirSync(join(repoRoot, 'references'))) { if (!filename.endsWith('.md')) continue; copyFileSync(join(repoRoot, 'references', filename), join(pluginRoot, 'references', filename)); } const rootPackage = JSON.parse(readFileSync(join(repoRoot, 'package.json'), 'utf8')); const pluginPackage = { name: 'sogni-creative-agent-skill', version: rootPackage.version, private: true, type: 'module', description: 'Minimal OpenClaw link target for Sogni Creative Agent Skill.', openclaw: { extensions: [ './openclaw-plugin.mjs' ] } }; writeFileSync( join(pluginRoot, 'package.json'), `${JSON.stringify(pluginPackage, null, 2)}\n` ); writeFileSync( join(pluginRoot, 'README.md'), `# Sogni Creative Agent Skill OpenClaw Link Target This directory is generated by \`npm run openclaw:sync\`. Use it when linking a local checkout into OpenClaw: \`\`\`bash openclaw plugins install -l "$PWD/.openclaw-link" \`\`\` Do not link the repository root. The root contains development tests that use \`child_process\`, and OpenClaw correctly blocks those files during plugin safety scanning. This directory contains only the plugin manifest, skill, and no-op runtime module needed by OpenClaw. ` );