Cli Anything Pm2

hkuds/cli-anything/skills/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 從公開儲存庫中收錄這些內容。

檢舉或申請下架