Add OpenClaw manifest and configure install
This commit is contained in:
46
install.mjs
46
install.mjs
@@ -73,7 +73,7 @@ function install() {
|
|||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
// 1. Build
|
// 1. Build
|
||||||
log('[1/3] Building...', 'cyan');
|
log('[1/4] Building...', 'cyan');
|
||||||
execSync('npm install', { cwd: __dirname, stdio: 'inherit' });
|
execSync('npm install', { cwd: __dirname, stdio: 'inherit' });
|
||||||
execSync('npm run build', { cwd: __dirname, stdio: 'inherit' });
|
execSync('npm run build', { cwd: __dirname, stdio: 'inherit' });
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ function install() {
|
|||||||
logOk('Build complete');
|
logOk('Build complete');
|
||||||
|
|
||||||
// 2. Copy to plugins dir
|
// 2. Copy to plugins dir
|
||||||
log('[2/3] Installing...', 'cyan');
|
log('[2/4] Installing...', 'cyan');
|
||||||
const openclawPath = resolveOpenclawPath();
|
const openclawPath = resolveOpenclawPath();
|
||||||
const destDir = join(openclawPath, 'plugins', PLUGIN_NAME);
|
const destDir = join(openclawPath, 'plugins', PLUGIN_NAME);
|
||||||
|
|
||||||
@@ -94,8 +94,29 @@ function install() {
|
|||||||
copyDir(SRC_DIST_DIR, destDir);
|
copyDir(SRC_DIST_DIR, destDir);
|
||||||
logOk(`Plugin files → ${destDir}`);
|
logOk(`Plugin files → ${destDir}`);
|
||||||
|
|
||||||
// 3. Summary
|
// 3. Configure OpenClaw
|
||||||
log('[3/3] Done!', 'cyan');
|
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('');
|
console.log('');
|
||||||
log('✓ Yonexus installed successfully!', 'green');
|
log('✓ Yonexus installed successfully!', 'green');
|
||||||
console.log('');
|
console.log('');
|
||||||
@@ -104,6 +125,23 @@ function install() {
|
|||||||
console.log('');
|
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 ───────────────────────────────────────────────────────────
|
// ── Uninstall ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
function uninstall() {
|
function uninstall() {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"main": "dist/yonexus/index.js",
|
"main": "dist/yonexus/index.js",
|
||||||
"types": "dist/yonexus/index.d.ts",
|
"types": "dist/yonexus/index.d.ts",
|
||||||
"scripts": {
|
"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",
|
"clean": "rm -rf dist",
|
||||||
"prepare": "npm run clean && npm run build",
|
"prepare": "npm run clean && npm run build",
|
||||||
"test:smoke": "tsx tests/smoke.ts",
|
"test:smoke": "tsx tests/smoke.ts",
|
||||||
|
|||||||
13
plugin/openclaw.plugin.json
Normal file
13
plugin/openclaw.plugin.json
Normal 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 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user