Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import * as fs from 'node:fs'; |
| 2 | import * as os from 'node:os'; |
| 3 | import * as path from 'node:path'; |
| 4 | import { |
| 5 | buildComposioCliSkill, |
| 6 | renderComposioCliSkill, |
| 7 | validateSkillSources, |
| 8 | } from '../skills-src/composio-cli/index'; |
| 9 | |
| 10 | const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'composio-skill-validate-')); |
| 11 | |
| 12 | try { |
| 13 | const sourceErrors = validateSkillSources(); |
| 14 | if (sourceErrors.length > 0) { |
| 15 | throw new Error(sourceErrors.join('\n')); |
| 16 | } |
| 17 | |
| 18 | const stableDir = buildComposioCliSkill({ |
| 19 | channel: 'stable', |
| 20 | outputRoot: path.join(tempRoot, 'stable'), |
| 21 | }); |
| 22 | const betaDir = buildComposioCliSkill({ |
| 23 | channel: 'beta', |
| 24 | outputRoot: path.join(tempRoot, 'beta'), |
| 25 | }); |
| 26 | |
| 27 | const stableSkill = fs.readFileSync(path.join(stableDir, 'SKILL.md'), 'utf8'); |
| 28 | const betaSkill = fs.readFileSync(path.join(betaDir, 'SKILL.md'), 'utf8'); |
| 29 | |
| 30 | if (!stableSkill.includes('<!-- release-channel: stable -->')) { |
| 31 | throw new Error('Stable skill output is missing its release channel marker.'); |
| 32 | } |
| 33 | |
| 34 | if (!betaSkill.includes('<!-- release-channel: beta -->')) { |
| 35 | throw new Error('Beta skill output is missing its release channel marker.'); |
| 36 | } |
| 37 | |
| 38 | if (stableSkill.includes('## `listen` - Subscribe To Trigger Events')) { |
| 39 | throw new Error('Stable skill output unexpectedly includes beta-only listen guidance.'); |
| 40 | } |
| 41 | |
| 42 | if (!betaSkill.includes('## `listen` - Subscribe To Trigger Events')) { |
| 43 | throw new Error('Beta skill output is missing beta-only listen guidance.'); |
| 44 | } |
| 45 | |
| 46 | if (stableSkill !== renderComposioCliSkill('stable')) { |
| 47 | throw new Error('Stable skill build is not reproducible from the renderer.'); |
| 48 | } |
| 49 | |
| 50 | if (betaSkill !== renderComposioCliSkill('beta')) { |
| 51 | throw new Error('Beta skill build is not reproducible from the renderer.'); |
| 52 | } |
| 53 | |
| 54 | for (const relativePath of [ |
| 55 | 'agents/openai.yaml', |
| 56 | 'references/composio-dev.md', |
| 57 | 'references/power-user-examples.md', |
| 58 | 'references/troubleshooting.md', |
| 59 | ]) { |
| 60 | if (!fs.existsSync(path.join(stableDir, relativePath))) { |
| 61 | throw new Error(`Stable build is missing ${relativePath}`); |
| 62 | } |
| 63 | if (!fs.existsSync(path.join(betaDir, relativePath))) { |
| 64 | throw new Error(`Beta build is missing ${relativePath}`); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | console.log('Validated composio-cli skill builds for stable and beta.'); |
| 69 | } finally { |
| 70 | fs.rmSync(tempRoot, { recursive: true, force: true }); |
| 71 | } |