chore(plugin): add package metadata and plugin file checker
This commit is contained in:
10
plugin/package.json
Normal file
10
plugin/package.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "whispergate-plugin",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"description": "WhisperGate OpenClaw plugin",
|
||||||
|
"scripts": {
|
||||||
|
"check": "node ../scripts/check-plugin-files.mjs"
|
||||||
|
}
|
||||||
|
}
|
||||||
29
scripts/check-plugin-files.mjs
Normal file
29
scripts/check-plugin-files.mjs
Normal 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');
|
||||||
Reference in New Issue
Block a user