From 858538aaad7037130f8fbf3bacaf8555c09ef72f Mon Sep 17 00:00:00 2001 From: zhi Date: Thu, 5 Mar 2026 14:51:37 +0000 Subject: [PATCH] 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 --- index.js | 28 ++++++++++++-------------- install.mjs | 57 ++++++----------------------------------------------- 2 files changed, 19 insertions(+), 66 deletions(-) diff --git a/index.js b/index.js index 9fa470b..e5d4e86 100644 --- a/index.js +++ b/index.js @@ -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, }; diff --git a/install.mjs b/install.mjs index 42b63c3..cef4a01 100755 --- a/install.mjs +++ b/install.mjs @@ -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 });