cli-anything-pm2
它能做什么
这个技能让 AI 智能体管理由 PM2 运行的程序。PM2 是一款保持 Node.js 应用持续运行的工具。适合在服务器上运行网站或服务、并希望快速检查状态的人。
适用场景
- ✓当你想查看哪些由 PM2 管理的应用正在运行,以及运行状况如何的时候。
- ✓当某个应用已停止,你需要重新启动它的时候。
- ✓当你想读取某个应用最近的日志以查找错误的时候。
技能链接
https://github.com/HKUDS/CLI-Anything/blob/main/pm2/agent-harness/cli_anything/pm2/skills/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我检查我的网站进程在 PM2 中是否在运行,并查看最后 50 行日志。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体向你电脑上的 PM2 程序发送命令,并读回结果。它在两次运行之间不保留自己的记忆。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
cli-anything-pm2
A stateless command-line interface for PM2 process management. Communicates via the PM2 CLI subprocess. No local state or session.
Installation
pip install -e .
Prerequisites:
- Python 3.10+
- PM2 installed globally (
npm install -g pm2)
Usage
Basic Commands
# Show help
cli-anything-pm2 --help
# Start interactive REPL mode
cli-anything-pm2
# Run with JSON output (for agent consumption)
cli-anything-pm2 --json process list
cli-anything-pm2 --json system version
REPL Mode
When invoked without a subcommand, the CLI enters an interactive REPL session:
cli-anything-pm2
# Enter commands interactively with tab-completion and history
Command Groups
process
Process inspection commands.
| Command | Description |
|---|---|
list |
List all PM2 processes |
describe <name> |
Get detailed info for a process |
metrics |
Get metrics for all processes |
lifecycle
Process lifecycle commands.
| Command | Description |
|---|---|
start <script> --name <name> |
Start a new process |
stop <name> |
Stop a process |
restart <name> |
Restart a process |
delete <name> |
Delete a process |
logs
Log management commands.
| Command | Description |
|---|---|
view <name> --lines 50 |
View recent logs |
flush [name] |
Flush logs |
system
System-level commands.
| Command | Description |
|---|---|
save |
Save current process list |
startup |
Generate startup script |
version |
Get PM2 version |
Output Formats
All commands support dual output modes:
- Human-readable (default): Tables, colors, formatted text
- Machine-readable (
--jsonflag): Structured JSON for agent consumption
# Human output
cli-anything-pm2 process list
# JSON output for agents
cli-anything-pm2 --json process list
For AI Agents
When using this CLI programmatically:
- Always use
--jsonflag for parseable output - Check return codes - 0 for success, non-zero for errors
- Parse stderr for error messages on failure
Version
1.0.0
常见问题
我需要安装 PM2 吗?
需要。PM2 必须全局安装,通常通过 npm 安装,该技能才能使用它。
它可以移除进程吗?
可以。delete 命令会把进程从 PM2 中移除,因此请谨慎使用。
它可以显示应用占用了多少资源吗?
可以。metrics 命令会显示所有进程的指标。
详情
作者的原始描述
Command-line interface for PM2 - A stateless CLI for Node.js process management via the PM2 CLI. List, start, stop, restart processes, view logs, and manage system configuration.
repo: HKUDS/CLI-Anything
热度
- GitHub 星标
- 58k
- 排名
- #3237
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
cli-anything-3mf
58k帮你的智能体检查和修复 3D 打印文件,包括查找圆孔、调整孔径、修复网格,以及比较两个文件。
cli-anything-qgis
58k帮你的智能体在终端中打开、编辑和导出 QGIS 地图项目,包括图层、要素、打印布局和处理工具。
cli-anything-adguardhome
58k帮你的智能体管理 AdGuard Home,这是一款全网络广告拦截器,可管理过滤规则、DNS 重写、客户端和查询日志。
cli-anything-anygen
58k帮你的智能体借助 AnyGen 服务,根据文字提示生成幻灯片、文档、网站和图表。