dev/zhi #1

Merged
hzhang merged 28 commits from dev/zhi into main 2026-03-05 19:08:00 +00:00
Showing only changes of commit 6454004d66 - Show all commits

View File

@@ -95,7 +95,7 @@ function getOpenclawConfig(pathKey, defaultValue = undefined) {
}
function setOpenclawConfig(pathKey, value) {
const cmd = `openclaw config set ${pathKey} --json '${JSON.stringify(value)}'`;
const cmd = `openclaw config set ${pathKey} '${JSON.stringify(value)}' --json`;
execSync(cmd, { cwd: __dirname, encoding: 'utf8' });
}
@@ -365,7 +365,25 @@ async function configure(env) {
log('\n Configuring OpenClaw plugin...', 'blue');
try {
// 1. Add to plugins.allow
// 1. Add plugin path to plugins.load.paths FIRST (required for validation)
const currentPaths = getOpenclawConfig('plugins.load.paths', []);
log(` Current paths: ${JSON.stringify(currentPaths)}`, 'blue');
log(` DIST_DIR: ${DIST_DIR}`, 'blue');
if (!currentPaths.includes(DIST_DIR)) {
currentPaths.push(DIST_DIR);
log(` Adding plugin path...`, 'blue');
try {
setOpenclawConfig('plugins.load.paths', currentPaths);
logSuccess(`Added ${DIST_DIR} to plugins.load.paths`);
} catch (err) {
logError(`Failed to set paths: ${err.message}`);
throw err;
}
} else {
log(' Plugin path already in plugins.load.paths', 'green');
}
// 2. Add to plugins.allow (after path is set)
const allowList = getOpenclawConfig('plugins.allow', []);
if (!allowList.includes(PLUGIN_NAME)) {
allowList.push(PLUGIN_NAME);
@@ -375,7 +393,7 @@ async function configure(env) {
log(' Already in plugins.allow', 'green');
}
// 2. Add plugin entry
// 3. Add plugin entry
const plugins = getOpenclawConfig('plugins', {});
plugins.entries = plugins.entries || {};
plugins.entries[PLUGIN_NAME] = {
@@ -387,16 +405,6 @@ async function configure(env) {
};
setOpenclawConfig('plugins', plugins);
logSuccess(`Configured ${PLUGIN_NAME} plugin entry`);
// 3. Add plugin path to plugins.load.paths
const currentPaths = getOpenclawConfig('plugins.load.paths', []);
if (!currentPaths.includes(DIST_DIR)) {
currentPaths.push(DIST_DIR);
setOpenclawConfig('plugins.load.paths', currentPaths);
logSuccess(`Added ${DIST_DIR} to plugins.load.paths`);
} else {
log(' Plugin path already in plugins.load.paths', 'green');
}
} catch (err) {
logWarning(`Failed to configure OpenClaw: ${err.message}`);
log(' Please manually configure:', 'yellow');