fix: add source index.js, install script copies from source

- Add index.js to project root as source
- Add configSchema to openclaw.plugin.json
- Install script now copies these files from source to dist/
- Ensures dist/ is reproducible from source
This commit is contained in:
zhi
2026-03-05 14:51:37 +00:00
parent e97ce0208e
commit 858538aaad
2 changed files with 19 additions and 66 deletions

View File

@@ -1,21 +1,19 @@
// PaddedCell Plugin Entry Point
export const id = 'padded-cell';
export const name = 'PaddedCell';
export const version = '0.1.0';
// Export tools (will be loaded by OpenClaw)
export { pcexec } from './pcexec/dist/index.js';
export {
const { pcexec } = require('./pcexec/dist/index.js');
const {
safeRestart,
createSafeRestartTool,
StatusManager,
createApiServer,
startApiServer
} from './safe-restart/dist/index.js';
startApiServer,
SlashCommandHandler
} = require('./safe-restart/dist/index.js');
// Default export
export default {
id,
name,
version,
module.exports = {
pcexec,
safeRestart,
createSafeRestartTool,
StatusManager,
createApiServer,
startApiServer,
SlashCommandHandler,
};

View File

@@ -299,58 +299,13 @@ async function installComponents(env) {
copyDir(join(__dirname, 'safe-restart'), join(DIST_DIR, 'safe-restart'));
logSuccess('Copied safe-restart to dist/padded-cell/');
// Create root index.js entry point
const indexJs = `const { pcexec } = require('./pcexec/dist/index.js');
const {
safeRestart,
createSafeRestartTool,
StatusManager,
createApiServer,
startApiServer,
SlashCommandHandler
} = require('./safe-restart/dist/index.js');
// Create root index.js entry point (copy from source)
copyFileSync(join(__dirname, 'index.js'), join(DIST_DIR, 'index.js'));
logSuccess('Copied index.js entry point');
module.exports = {
pcexec,
safeRestart,
createSafeRestartTool,
StatusManager,
createApiServer,
startApiServer,
SlashCommandHandler,
};
`;
writeFileSync(join(DIST_DIR, 'index.js'), indexJs);
logSuccess('Created index.js entry point');
// Create openclaw.plugin.json
const manifest = {
id: PLUGIN_NAME,
name: 'PaddedCell',
version: '0.1.0',
description: 'Secure password management, safe execution, and coordinated restart',
entry: './index.js',
configSchema: {
type: 'object',
properties: {
enabled: { type: 'boolean', default: true }
}
},
tools: [
{
name: 'pcexec',
entry: './pcexec/dist/index.js',
description: 'Safe exec with password sanitization'
},
{
name: 'safe_restart',
entry: './safe-restart/dist/index.js',
description: 'Safe coordinated restart'
}
]
};
writeFileSync(join(DIST_DIR, 'openclaw.plugin.json'), JSON.stringify(manifest, null, 2));
logSuccess('Created openclaw.plugin.json');
// Copy openclaw.plugin.json from source
copyFileSync(join(__dirname, 'openclaw.plugin.json'), join(DIST_DIR, 'openclaw.plugin.json'));
logSuccess('Copied openclaw.plugin.json');
// Create bin directory and install pass_mgr binary
mkdirSync(binDir, { recursive: true });