chore(plugin): add package metadata and plugin file checker

This commit is contained in:
2026-02-25 10:44:33 +00:00
parent d1f4252f37
commit 0e98f0877b
2 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
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');