Add OpenClaw manifest and configure install

This commit is contained in:
2026-03-10 18:25:54 +00:00
parent 3b26f3d083
commit 00108c357b
3 changed files with 56 additions and 5 deletions

View File

@@ -73,7 +73,7 @@ function install() {
console.log('');
// 1. Build
log('[1/3] Building...', 'cyan');
log('[1/4] Building...', 'cyan');
execSync('npm install', { cwd: __dirname, stdio: 'inherit' });
execSync('npm run build', { cwd: __dirname, stdio: 'inherit' });
@@ -84,7 +84,7 @@ function install() {
logOk('Build complete');
// 2. Copy to plugins dir
log('[2/3] Installing...', 'cyan');
log('[2/4] Installing...', 'cyan');
const openclawPath = resolveOpenclawPath();
const destDir = join(openclawPath, 'plugins', PLUGIN_NAME);
@@ -94,8 +94,29 @@ function install() {
copyDir(SRC_DIST_DIR, destDir);
logOk(`Plugin files → ${destDir}`);
// 3. Summary
log('[3/3] Done!', 'cyan');
// 3. Configure OpenClaw
log('[3/4] Configuring OpenClaw...', 'cyan');
try {
const pluginPath = destDir;
const allow = ensureArray(getConfigValue('plugins.allow'));
const loadPaths = ensureArray(getConfigValue('plugins.load.paths'));
if (!allow.includes(PLUGIN_NAME)) allow.push(PLUGIN_NAME);
if (!loadPaths.includes(pluginPath)) loadPaths.push(pluginPath);
execSync(`openclaw config set plugins.allow '${JSON.stringify(allow)}'`);
execSync(`openclaw config set plugins.load.paths '${JSON.stringify(loadPaths)}'`);
execSync(`openclaw config set plugins.entries.${PLUGIN_NAME}.enabled true`);
execSync(`openclaw config set plugins.entries.${PLUGIN_NAME}.config '{"enabled": true}'`);
logOk('OpenClaw config updated');
} catch (err) {
logErr('Failed to update OpenClaw config via `openclaw config set`');
throw err;
}
// 4. Summary
log('[4/4] Done!', 'cyan');
console.log('');
log('✓ Yonexus installed successfully!', 'green');
console.log('');
@@ -104,6 +125,23 @@ function install() {
console.log('');
}
function getConfigValue(path) {
try {
const out = execSync(`openclaw config get ${path}`, { encoding: 'utf8' }).trim();
if (!out || out === 'undefined' || out === 'null') return undefined;
try { return JSON.parse(out); } catch { return out; }
} catch {
return undefined;
}
}
function ensureArray(value) {
if (Array.isArray(value)) return value;
if (value === undefined || value === null || value === '') return [];
return [value];
}
// ── Uninstall ───────────────────────────────────────────────────────────
function uninstall() {

View File

@@ -5,7 +5,7 @@
"main": "dist/yonexus/index.js",
"types": "dist/yonexus/index.d.ts",
"scripts": {
"build": "tsc -p tsconfig.json && cp plugin.json dist/yonexus/plugin.json",
"build": "tsc -p tsconfig.json && cp plugin.json dist/yonexus/plugin.json && cp plugin/openclaw.plugin.json dist/yonexus/openclaw.plugin.json",
"clean": "rm -rf dist",
"prepare": "npm run clean && npm run build",
"test:smoke": "tsx tests/smoke.ts",

View File

@@ -0,0 +1,13 @@
{
"id": "yonexus",
"name": "Yonexus",
"version": "0.2.0",
"description": "Organization hierarchy, agent identity management, query DSL, and scope memory for OpenClaw",
"configSchema": {
"type": "object",
"additionalProperties": true,
"properties": {
"enabled": { "type": "boolean", "default": true }
}
}
}