cli-anything-pm2
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecli-anything-pm2
cli-anything-pm2
A stateless command-line interface for PM2 process management.
Communicates via the PM2 CLI subprocess. No local state or session.
一款用于PM2进程管理的无状态命令行界面。通过PM2 CLI子进程进行通信,无本地状态或会话。
Installation
安装
bash
pip install -e .Prerequisites:
- Python 3.10+
- PM2 installed globally ()
npm install -g pm2
bash
pip install -e .前置要求:
- Python 3.10及以上版本
- 全局安装PM2(执行)
npm install -g pm2
Usage
使用方法
Basic Commands
基础命令
bash
undefinedbash
undefinedShow help
显示帮助
cli-anything-pm2 --help
cli-anything-pm2 --help
Start interactive REPL mode
启动交互式REPL模式
cli-anything-pm2
cli-anything-pm2
Run with JSON output (for agent consumption)
以JSON格式输出(供Agent使用)
cli-anything-pm2 --json process list
cli-anything-pm2 --json system version
undefinedcli-anything-pm2 --json process list
cli-anything-pm2 --json system version
undefinedREPL Mode
REPL模式
When invoked without a subcommand, the CLI enters an interactive REPL session:
bash
cli-anything-pm2当不指定子命令调用时,该CLI会进入交互式REPL会话:
bash
cli-anything-pm2Enter commands interactively with tab-completion and history
可通过交互式方式输入命令,支持自动补全和历史记录
undefinedundefinedCommand Groups
命令分组
process
进程
Process inspection commands.
| Command | Description |
|---|---|
| List all PM2 processes |
| Get detailed info for a process |
| Get metrics for all processes |
进程检查命令。
| 命令 | 描述 |
|---|---|
| 列出所有PM2进程 |
| 获取指定进程的详细信息 |
| 获取所有进程的指标数据 |
lifecycle
生命周期
Process lifecycle commands.
| Command | Description |
|---|---|
| Start a new process |
| Stop a process |
| Restart a process |
| Delete a process |
进程生命周期命令。
| 命令 | 描述 |
|---|---|
| 启动新进程 |
| 停止指定进程 |
| 重启指定进程 |
| 删除指定进程 |
logs
日志
Log management commands.
| Command | Description |
|---|---|
| View recent logs |
| Flush logs |
日志管理命令。
| 命令 | 描述 |
|---|---|
| 查看近期日志 |
| 清空日志 |
system
系统
System-level commands.
| Command | Description |
|---|---|
| Save current process list |
| Generate startup script |
| Get PM2 version |
系统级命令。
| 命令 | 描述 |
|---|---|
| 保存当前进程列表 |
| 生成开机启动脚本 |
| 获取PM2版本 |
Output Formats
输出格式
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (flag): Structured JSON for agent consumption
--json
bash
undefined所有命令支持两种输出模式:
- 人类可读格式(默认):表格、彩色文本、格式化内容
- 机器可读格式(参数):供Agent使用的结构化JSON格式
--json
bash
undefinedHuman output
人类可读格式输出
cli-anything-pm2 process list
cli-anything-pm2 process list
JSON output for agents
供Agent使用的JSON格式输出
cli-anything-pm2 --json process list
undefinedcli-anything-pm2 --json process list
undefinedFor AI Agents
面向AI Agent的使用说明
When using this CLI programmatically:
- Always use flag for parseable output
--json - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
当以编程方式使用此CLI时:
- 始终使用参数以获得可解析的输出
--json - 检查返回码 - 0表示成功,非零表示错误
- 解析stderr以获取失败时的错误信息
Version
版本
1.0.0
1.0.0