Files
Dirigent/scripts/check-plugin-files.mjs

30 lines
798 B
JavaScript

import fs from 'node:fs';
import path from 'node:path';
const root = path.resolve(process.cwd(), '..');
const pluginDir = path.join(root, 'plugin');
const required = ['index.ts', 'rules.ts', 'openclaw.plugin.json', 'README.md', 'package.json'];
let ok = true;
for (const f of required) {
const p = path.join(pluginDir, f);
if (!fs.existsSync(p)) {
ok = false;
console.error(`missing: ${p}`);
}
}
const manifestPath = path.join(pluginDir, 'openclaw.plugin.json');
if (fs.existsSync(manifestPath)) {
const m = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
for (const k of ['id', 'entry', 'configSchema']) {
if (!(k in m)) {
ok = false;
console.error(`manifest missing key: ${k}`);
}
}
}
if (!ok) process.exit(1);
console.log('plugin file check: ok');