mirror of
https://github.com/Heretek-AI/heretek-openclaw-cli.git
synced 2026-07-01 19:54:16 -04:00
a2cba717c6
P6-7: Agent File Completion (34 files - 11 agents × 3 files + guides) - Added BOOTSTRAP.md, IDENTITY.md, TOOLS.md for all 11 agents - Created AGENT_CREATION_GUIDE.md P6-2: Per-Agent Model Configuration (9 files) - Agent model router and config library - YAML configs for arbiter, coder agents - Configuration documentation P6-3: Health Check Dashboard (20+ files) - Complete frontend React application - API endpoints, WebSocket server - Collectors for agents, resources, services - Alert management and configuration P6-4: LiteLLM Observability Integration (10 files) - LiteLLM metrics collector and API - Frontend components for model/budget tracking - Integration documentation P6-1: Non-Docker Deployment (16 files) - Bare metal and VM deployment docs - Systemd service files - Installation scripts for Ubuntu/RHEL - Migration guide and troubleshooting P6-6: Cloud-Native Deployments (45+ files) - AWS, Azure, GCP Terraform configurations - Kubernetes base deployments with Kustomize overlays - Cloud deployment documentation P6-5: Unified Deployment CLI (28 files) - Complete CLI with 12 commands - Deployers for Docker, Kubernetes, cloud, baremetal - Health checker, backup manager, config manager P6-8: Plugin Installation Guide (15 files) - Plugin development and installation guides - Plugin CLI documentation and registry - Templates for basic, skill, and tool plugins
103 lines
2.5 KiB
JavaScript
103 lines
2.5 KiB
JavaScript
/**
|
|
* Stop Command
|
|
*
|
|
* Stop OpenClaw deployment gracefully.
|
|
*/
|
|
|
|
import { Command } from 'commander';
|
|
import log from '../lib/logger.js';
|
|
import DeploymentManager from '../lib/deployment-manager.js';
|
|
import { promptConfirm } from '../lib/prompts.js';
|
|
|
|
const command = new Command('stop');
|
|
|
|
command
|
|
.description('Stop OpenClaw deployment')
|
|
.option('-t, --type <type>', 'Deployment type (auto-detect if not specified)')
|
|
.option('-f, --force', 'Force stop (kill containers/processes)')
|
|
.option('--volumes', 'Remove volumes (Docker only)')
|
|
.option('--backup', 'Create backup before stopping')
|
|
.option('-y, --yes', 'Skip confirmation prompt')
|
|
.action(async (options) => {
|
|
await handleStop(options);
|
|
});
|
|
|
|
/**
|
|
* Handle stop command
|
|
*/
|
|
async function handleStop(options) {
|
|
log.section('Stopping OpenClaw');
|
|
|
|
// Confirm stop
|
|
if (!options.yes) {
|
|
const confirmed = await promptConfirm(
|
|
'Are you sure you want to stop OpenClaw? This will stop all services.',
|
|
{ default: false }
|
|
);
|
|
|
|
if (!confirmed) {
|
|
log.info('Stop cancelled');
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Create backup if requested
|
|
if (options.backup) {
|
|
log.info('Creating backup before stopping...');
|
|
try {
|
|
const BackupManager = (await import('../lib/backup-manager.js')).default;
|
|
const backupManager = new BackupManager();
|
|
await backupManager.create({ type: 'incremental' });
|
|
log.success('Backup created');
|
|
} catch (error) {
|
|
log.warn(`Backup failed: ${error.message}`);
|
|
// Continue with stop even if backup fails
|
|
}
|
|
}
|
|
|
|
const manager = new DeploymentManager({
|
|
rootDir: process.cwd(),
|
|
deploymentType: options.type,
|
|
});
|
|
|
|
try {
|
|
log.info('Stopping services...');
|
|
|
|
const success = await manager.stop({
|
|
removeVolumes: options.volumes,
|
|
});
|
|
|
|
if (success) {
|
|
log.success('OpenClaw stopped successfully');
|
|
|
|
// Show post-stop message
|
|
printPostStopMessage(options);
|
|
} else {
|
|
log.error('Failed to stop OpenClaw');
|
|
process.exit(1);
|
|
}
|
|
} catch (error) {
|
|
log.error(`Failed to stop: ${error.message}`);
|
|
log.debug(error.stack);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Print post-stop message
|
|
*/
|
|
function printPostStopMessage(options) {
|
|
console.log(`
|
|
${log.symbols.info} OpenClaw has been stopped.
|
|
|
|
To start again:
|
|
${options.type === 'docker' ? 'docker compose up -d' : 'openclaw deploy'}
|
|
|
|
${options.volumes ? `
|
|
Note: Volumes were removed. Data may need to be restored from backup.` : `
|
|
Data is preserved. To remove data as well, use --volumes flag.`}
|
|
`);
|
|
}
|
|
|
|
export default command;
|