跳到正文
Skillpedia
部署与云(DevOps)58k · #3237

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/CLI-Anything/blob/main/pm2/agent-harness/cli_anything/pm2/skills/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 (--json flag): 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:

  1. Always use --json flag for parseable output
  2. Check return codes - 0 for success, non-zero for errors
  3. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能