npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fraq-plugin-remotecmd

v1.0.4

Published

基于fraq编写的通过Bot远程执行shell和js命令

Readme

fraq-plugin-remotecmd

基于 fraq 的远程命令插件:通过 Bot 远程执行 Shell / JavaScript 命令,并将执行结果或代码片段渲染为图片回复。

功能

| 命令 | 说明 | | --- | --- | | rjs <code> | 在 vm 沙盒中执行 JavaScript(30 秒超时),沙盒内可访问 fraq API、ctxsession 等 | | rc <cmd> | 执行 Shell 命令,以终端提示符风格的纯文本回复 | | rcp <cmd> | 执行 Shell 命令,渲染为 macOS 窗口风格图片回复(还原 ANSI 颜色、识别日志级别高亮)¹ | | sc <文件路径> [起始行] [~结束行] | 将代码文件片段渲染为带语法高亮和行号的图片,如 sc src/index.ts 10~30¹ |

¹ 需要安装可选依赖 @fraqjs/plugin-takumi;未安装时 rcp 自动回退为文本回复,sc 不可用。

所有命令仅 Master 可用(由 fraq-plugin-master 获取主人列表)。

效果预览

rcp 命令执行效果:

rcp 效果

sc 代码快照效果:

sc 效果

效果以实际使用为准

安装与配置

将插件添加到 fraq.ymlplugins 字段下:

plugins:
  remotecmd:

本插件依赖 fraq-plugin-master 提供 Master 判定,需一并添加:

plugins:
  master:
  remotecmd:

图片渲染功能(rcp / sc 命令)由 @fraqjs/plugin-takumi 提供,为可选依赖,需要时一并添加:

plugins:
  master:
  fraqjs/takumi:
  remotecmd:

未安装 fraqjs/takumi 时插件可正常加载,rc / rjs 不受影响,rcp 回退为文本回复。

注意:@fraqjs/plugin-takumi 依赖 Takumi 原生渲染器,仅支持 Windows / macOS / Linux 的 x64 与 arm64 平台。

本地开发

pnpm install
pnpm build   # 使用 tsdown 构建到 dist/
pnpm dev     # 运行 test/smoke.ts 连接真实环境调试

pnpm dev 需要在项目根目录创建 .env 文件:

URL=http://127.0.0.1:7003
TOKEN=访问令牌

实现说明

  • 图片渲染由 Takumi 完成:HTML 模板(resources/)经占位符插值后交给 fromHtml 解析渲染为 PNG,样式通过 <link> 声明并在渲染时内联
  • 代码高亮使用 highlight.js,输出行识别 WARN / ERR / 成功等关键词着色,ANSI 颜色序列还原为 HTML span
  • Windows 中文系统的 Shell 输出自动从 GBK 回退解码

License

MIT