Cli Anything Pm2

作者 hkuds34f519533bc1无许可证51K 个星标收录于 2026年10月8日更新于 2026年10月8日仓库2周前更新

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.

仅含说明DevOps & Cloud
AI 生成的概览

面向 PM2 的无状态命令行封装,可列出、启动、停止、重启 Node.js 进程并查看日志。

功能
提供一个命令行界面,以子进程方式调用 PM2 CLI 来管理 Node.js 进程。命令分为进程检查(list、describe、metrics)、生命周期(start、stop、restart、delete)、日志(view、flush)和系统操作(save、startup、version)四组。命令默认输出人类可读的表格,使用 --json 参数时输出结构化 JSON;不带子命令时进入交互式 REPL。它不保存任何本地状态或会话。
适用场景
当智能体或运维人员需要从命令行查看或控制由 PM2 管理的 Node.js 进程时使用,例如列出运行中的进程、重启服务或查看近期日志。适合需要解析 JSON 输出和返回码的脚本化或智能体驱动场景。
运行要求
需要 Python 3.10+ 以及通过 npm 全局安装的 PM2。使用 pip install -e . 安装。该技能仅包含说明文档,不含脚本,并以子进程方式调用 PM2 CLI。

cli-anything-pm2

A stateless command-line interface for PM2 process management. Communicates via the PM2 CLI subprocess. No local state or session.

Installation

bash
pip install -e .

Prerequisites:

  • Python 3.10+
  • PM2 installed globally (npm install -g pm2)

Usage

Basic Commands

bash
# Show helpcli-anything-pm2 --help
# Start interactive REPL modecli-anything-pm2
# Run with JSON output (for agent consumption)cli-anything-pm2 --json process listcli-anything-pm2 --json system version

REPL Mode

When invoked without a subcommand, the CLI enters an interactive REPL session:

bash
cli-anything-pm2# Enter commands interactively with tab-completion and history

Command Groups

process

Process inspection commands.

CommandDescription
listList all PM2 processes
describe <name>Get detailed info for a process
metricsGet metrics for all processes

lifecycle

Process lifecycle commands.

CommandDescription
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.

CommandDescription
view <name> --lines 50View recent logs
flush [name]Flush logs

system

System-level commands.

CommandDescription
saveSave current process list
startupGenerate startup script
versionGet 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
bash
# Human outputcli-anything-pm2 process list
# JSON output for agentscli-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

来源与署名

来源:hkuds/cli-anything位于skills/cli-anything-pm2提交34f5195

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架