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 🙏

© 2025 – Pkg Stats / Ryan Hefner

koishi-plugin-shell-pro

v1.0.4

Published

通过指令在服务器执行终端命令的插件。

Readme

Koishi-Plugin-Shell-Pro

npm

通过指令在服务器执行终端命令的插件。


主要特性

  • 交互式持久会话: 为每个用户或频道创建独立的 Shell 进程。 cd 等命令会真实地改变当前工作目录,会话状态将被保留,直到超时或手动执行 exit

  • 输出系统:

    • 默认使用合并转发来发送命令结果。
    • 处理超长消息,当单条输出内容过长时,会自动分割成多个子消息节点。
    • 拆分转发消息,当输出内容庞大时,会自动拆分为多条合并转发消息发送,确保消息总能成功送达。
  • 别名系统: 为常用或复杂的命令创建快捷方式,提高效率。插件已内置 .. (cd ..), ip (ipconfig) 等常用别名,也可以在配置中自由扩展。

  • 安全管理: 通过三层权限——基础权限、命令白名单和超级用户——来控制命令的执行权限,保障服务器安全。

  • 可自定义: 支持自定义 Shell 程序路径、初始工作目录、特定命令的输出编码(解决乱码问题)以及会话超时策略等,适应各种使用场景。


安装与使用

  1. 在 Koishi 插件市场搜索 shell-pro 并安装。
  2. 前往插件配置页,仔细阅读并配置安全设置

基础指令:

# 基础语法
shell <command>

# 查看当前目录文件 (Linux)
shell ls -alF

# 查看网络配置 (Windows, 使用了内置别名)
shell ip

# 返回上一级目录 (使用了内置别名)
shell ..

# 手动关闭当前会话
shell exit

安全指南

本插件给予了 Koishi 用户在服务器上执行命令的能力,配置不当将带来 极高的安全风险。为了您的服务器安全,请 务必 在插件配置中:

  1. 配置「命令白名单」: 只允许安全可信任的命令。
  2. 谨慎添加「超级用户」: 列表中的用户将 无视所有限制,可以执行任意命令。
  3. 设置合理的「基础权限」: 配合admin插件使用。建议设置为 3 或 4,以防止普通用户(权限等级通常为 1)意外触发。

配置示例

    # [推荐] 用户模式可避免多人在同一频道互相干扰
    sessionScope: user
    # [推荐] 启用会话超时,防止进程累积
    enableSessionTimeout: true
    sessionTimeout: 5 # 5 分钟无操作则自动关闭

    # [推荐] 将基础权限设置为机器人管理员级别
    baseAuthority: 4

    # [示例] 命令白名单,只允许明确指定的安全命令
    whitelist:
      - command: ping

    # [示例] 超级用户,不受任何限制 (请谨慎添加)
    superuserWhitelist:
      - platform: onebot      # 平台名称,如 onebot, qq
        userId: '123456789' # 你的用户 ID

    # [示例] 命令别名,简化常用操作
    aliases:
      - key: update
        value: git pull
      - key: '..'
        value: cd ..

    # [示例] 为 Windows 下的命令指定编码,防止乱码
    commandEncodings:
      - key: ping
        value: gbk
      - key: ipconfig
        value: gbk