- service: true/false is now a required field in manyplug.json - init --service creates background service template - list shows ● for services, ○ for standard plugins - validate checks service field and warns on mismatches - templates document service vs non-service behavior Services run regardless of isPluginRunning lock, but can choose to respect it. Non-services are blocked automatically.
67 lines
2.0 KiB
JavaScript
Executable File
67 lines
2.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { program } from 'commander';
|
|
import { createRequire } from 'module';
|
|
import { initCommand } from '../src/commands/init.js';
|
|
import { installCommand } from '../src/commands/install.js';
|
|
import { listCommand } from '../src/commands/list.js';
|
|
import { validateCommand } from '../src/commands/validate.js';
|
|
import { syncCommand } from '../src/commands/sync.js';
|
|
import { updateCommand } from '../src/commands/update.js';
|
|
import { removeCommand } from '../src/commands/remove.js';
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const pkg = require('../package.json');
|
|
|
|
program
|
|
.name('manyplug')
|
|
.description('CLI plugin manager for ManyBot')
|
|
.version(pkg.version);
|
|
|
|
program
|
|
.command('init <name>')
|
|
.description('Create a new plugin boilerplate')
|
|
.option('-c, --category <cat>', 'Plugin category', 'utility')
|
|
.option('-s, --service', 'Create as a background service', false)
|
|
.action(initCommand);
|
|
|
|
program
|
|
.command('install [plugin]')
|
|
.description('Install a plugin from registry or local path')
|
|
.option('-l, --local <path>', 'Install from local path')
|
|
.option('-g, --global', 'Install to global registry')
|
|
.action(installCommand);
|
|
|
|
program
|
|
.command('remove <plugin>')
|
|
.alias('rm')
|
|
.description('Remove an installed plugin')
|
|
.option('-y, --yes', 'Skip confirmation prompt')
|
|
.option('--remove-deps', 'Also remove npm dependencies')
|
|
.action(removeCommand);
|
|
|
|
program
|
|
.command('list')
|
|
.alias('ls')
|
|
.description('List installed plugins')
|
|
.option('-a, --all', 'Include disabled plugins')
|
|
.action(listCommand);
|
|
|
|
program
|
|
.command('sync')
|
|
.description('Sync registry.json with installed plugins')
|
|
.action(syncCommand);
|
|
|
|
program
|
|
.command('update [plugin]')
|
|
.description('Update plugins to match registry versions')
|
|
.option('-a, --all', 'Update all plugins (default if no name given)')
|
|
.action(updateCommand);
|
|
|
|
program
|
|
.command('validate [path]')
|
|
.description('Validate manyplug.json syntax')
|
|
.action(validateCommand);
|
|
|
|
program.parse();
|