request-recorder

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Recorder CLI

Recorder CLI

Purpose

用途

Provide a Node.js (18+) CLI that uses PM2 to start/stop a lightweight HTTP service. The service stores up to N incoming payloads in-memory (FIFO), and a
log
command outputs the stored entries in reverse order (newest first) as JSONL.
Always stop the server when finishing a debugging session.
提供一个基于Node.js(18+)的CLI工具,使用PM2来启动/停止轻量级HTTP服务。该服务会在内存中存储最多N个传入请求负载(采用FIFO先进先出机制),
log
命令会以JSONL格式倒序输出存储的条目(最新的在前)。
调试会话结束后请务必停止服务器。

Commands

命令

  • start
    runs the service under PM2 (daemonized).
  • serve
    runs the HTTP server in the current process (for PM2 or local debugging).
  • stop
    stops the PM2 service.
  • log
    prints logs in JSONL format, newest first.
  • --help
    prints usage and exits.
  • start
    :通过PM2以守护进程模式启动服务。
  • serve
    :在当前进程中运行HTTP服务器(适用于PM2或本地调试)。
  • stop
    :停止PM2管理的服务。
  • log
    :以JSONL格式打印日志,最新条目在前。
  • --help
    :打印使用说明并退出。

Inputs

输入参数

  • --port
    (default
    4105
    )
  • --window
    (default
    100
    )
  • Env
    PORT
    (fallback if
    --port
    not set)
  • Env
    PAYLOAD_WINDOW
    (fallback if
    --window
    not set)
  • --port
    (默认值
    4105
  • --window
    (默认值
    100
  • 环境变量
    PORT
    (如果未设置
    --port
    则使用此 fallback 值)
  • 环境变量
    PAYLOAD_WINDOW
    (如果未设置
    --window
    则使用此 fallback 值)

Usage

使用示例

  • node recorder-cli.js start --port 4105
  • node recorder-cli.js start --port 4105 --window 100
  • node recorder-cli.js log --port 4105
  • node recorder-cli.js stop
  • node recorder-cli.js --help
  • node recorder-cli.js start --port 4105
  • node recorder-cli.js start --port 4105 --window 100
  • node recorder-cli.js log --port 4105
  • node recorder-cli.js stop
  • node recorder-cli.js --help

Tool location

工具位置

  • The tool lives at
    .claude/skills/lbp-create-check/recorder-cli.js
    .
  • 工具位于
    .claude/skills/lbp-create-check/recorder-cli.js

Operational notes

操作说明

  • If the configured port is already in use by this service, attempt to stop it before starting again.
  • All HTTP methods are recorded (POST, PUT, PATCH, DELETE, etc). Only
    GET /_logs
    is handled specially.
  • 如果配置的端口已被本服务占用,请先尝试停止服务后再重新启动。
  • 所有HTTP方法的请求都会被记录(POST、PUT、PATCH、DELETE等)。仅
    GET /_logs
    请求会被特殊处理。