fix: create OpenClaw config if not exists and simplify install summary
- Create ~/.openclaw/config.json if it doesn't exist - Automatically add plugin path to config - Simplify post-install steps (remove redundant 'add to profile' step)
This commit is contained in:
66
install.mjs
66
install.mjs
@@ -460,36 +460,37 @@ async function configure(env) {
|
|||||||
log('\n Updating OpenClaw plugin configuration...', 'blue');
|
log('\n Updating OpenClaw plugin configuration...', 'blue');
|
||||||
const openclawConfigPath = join(installDir, 'config.json');
|
const openclawConfigPath = join(installDir, 'config.json');
|
||||||
|
|
||||||
if (existsSync(openclawConfigPath)) {
|
try {
|
||||||
try {
|
let config = {};
|
||||||
|
|
||||||
|
// Load existing config if present
|
||||||
|
if (existsSync(openclawConfigPath)) {
|
||||||
const configContent = readFileSync(openclawConfigPath, 'utf8');
|
const configContent = readFileSync(openclawConfigPath, 'utf8');
|
||||||
const config = JSON.parse(configContent);
|
config = JSON.parse(configContent);
|
||||||
|
|
||||||
// Ensure plugins.load.paths exists
|
|
||||||
if (!config.plugins) {
|
|
||||||
config.plugins = {};
|
|
||||||
}
|
|
||||||
if (!config.plugins.load) {
|
|
||||||
config.plugins.load = {};
|
|
||||||
}
|
|
||||||
if (!config.plugins.load.paths) {
|
|
||||||
config.plugins.load.paths = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add paddedcell skills path if not already present
|
|
||||||
const skillsPath = join(installDir, 'skills', 'paddedcell');
|
|
||||||
if (!config.plugins.load.paths.includes(skillsPath)) {
|
|
||||||
config.plugins.load.paths.push(skillsPath);
|
|
||||||
writeFileSync(openclawConfigPath, JSON.stringify(config, null, 2));
|
|
||||||
logSuccess(`Added plugin path to OpenClaw config: ${skillsPath}`);
|
|
||||||
} else {
|
|
||||||
log(' Plugin path already in OpenClaw config', 'green');
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
logWarning(`Failed to update OpenClaw config: ${err.message}`);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
logWarning(`OpenClaw config not found at ${openclawConfigPath}`);
|
// Ensure plugins.load.paths exists
|
||||||
|
if (!config.plugins) {
|
||||||
|
config.plugins = {};
|
||||||
|
}
|
||||||
|
if (!config.plugins.load) {
|
||||||
|
config.plugins.load = {};
|
||||||
|
}
|
||||||
|
if (!config.plugins.load.paths) {
|
||||||
|
config.plugins.load.paths = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add paddedcell skills path if not already present
|
||||||
|
const skillsPath = join(installDir, 'skills', 'paddedcell');
|
||||||
|
if (!config.plugins.load.paths.includes(skillsPath)) {
|
||||||
|
config.plugins.load.paths.push(skillsPath);
|
||||||
|
writeFileSync(openclawConfigPath, JSON.stringify(config, null, 2));
|
||||||
|
logSuccess(`Added plugin path to OpenClaw config: ${skillsPath}`);
|
||||||
|
} else {
|
||||||
|
log(' Plugin path already in OpenClaw config', 'green');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logWarning(`Failed to update OpenClaw config: ${err.message}`);
|
||||||
log(' Please manually add the following to your OpenClaw config:', 'yellow');
|
log(' Please manually add the following to your OpenClaw config:', 'yellow');
|
||||||
log(` plugins.load.paths: ["${join(installDir, 'skills', 'paddedcell')}"]`, 'cyan');
|
log(` plugins.load.paths: ["${join(installDir, 'skills', 'paddedcell')}"]`, 'cyan');
|
||||||
}
|
}
|
||||||
@@ -585,16 +586,13 @@ function printSummary(env) {
|
|||||||
|
|
||||||
log('Next steps:', 'blue');
|
log('Next steps:', 'blue');
|
||||||
console.log('');
|
console.log('');
|
||||||
log('1. Add to your shell profile (~/.bashrc, ~/.zshrc):', 'yellow');
|
log('1. Reload your shell or run:', 'yellow');
|
||||||
log(` source ${join(installDir, 'paddedcell.env')}`, 'cyan');
|
log(` source ${join(installDir, 'paddedcell.env')}`, 'cyan');
|
||||||
console.log('');
|
console.log('');
|
||||||
log('2. Reload your shell or run:', 'yellow');
|
log('2. Initialize pass_mgr (required before first use):', 'yellow');
|
||||||
log(` source ${join(installDir, 'paddedcell.env')}`, 'cyan');
|
|
||||||
console.log('');
|
|
||||||
log('3. Initialize pass_mgr (required before first use):', 'yellow');
|
|
||||||
log(' pass_mgr admin init', 'cyan');
|
log(' pass_mgr admin init', 'cyan');
|
||||||
console.log('');
|
console.log('');
|
||||||
log('4. Test pass_mgr:', 'yellow');
|
log('3. Test pass_mgr:', 'yellow');
|
||||||
log(' pass_mgr set test_key mypass # Set a test password', 'cyan');
|
log(' pass_mgr set test_key mypass # Set a test password', 'cyan');
|
||||||
log(' pass_mgr get test_key # Retrieve password', 'cyan');
|
log(' pass_mgr get test_key # Retrieve password', 'cyan');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user