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

@holic512/slothtool

v1.3.6

Published

A plugin manager and dispatcher for CLI tools

Downloads

2,124

Readme

SlothTool

SlothTool 是一个 TUI-first 的插件管理器:日常使用默认进入 Ink 全屏界面,同时保留可脚本化的 CLI 命令。

根包通过 npm 分发,官方插件通过 GitHub Release .tgz 资产安装到本机用户目录。当前内置官方插件为 locimage-compress

npm install -g @holic512/slothtool
slothtool

Overview

SlothTool 把“插件管理器”作为默认交互入口:根命令负责安装、更新、卸载和调度插件;插件自身继续保留独立命令与 TUI。这样日常操作可以在全屏界面完成,自动化脚本仍然可以直接调用稳定的 CLI。

Features

| 能力 | 说明 | | --- | --- | | 默认 TUI | slothtool 无参数启动根管理器全屏 TUI。 | | CLI 兼容 | installlistupdateconfigrunself-update 等命令可直接脚本化调用。 | | 官方插件分发 | 内置官方插件清单,安装源限定为 GitHub Release 资产。 | | 平台资产选择 | image-compress 按当前系统和 CPU 架构选择匹配的预编译后端资产。 | | 双语界面 | 根管理器和官方插件支持中文 / English 文案。 | | 本地用户数据 | 设置、注册表、插件包和插件配置都保存在 ~/.slothtool/。 |

Requirements

  • Node.js >=22.0.0
  • npm >=10

Install

npm install -g @holic512/slothtool

验证入口:

slothtool --help
slothtool

Quick Start

启动根 TUI:

slothtool

安装并运行官方插件:

slothtool install loc
slothtool install image-compress

slothtool loc
slothtool image-compress

使用显式 CLI:

slothtool loc ./src
slothtool loc -v ./src

slothtool image-compress ./photo.jpg --dry-run
slothtool image-compress -r ./album --output-dir ./compressed

TUI Pages

根 TUI 的页面模型固定为:

| 页面 | 主要职责 | | --- | --- | | Home | 展示管理器入口信息与当前导航提示。 | | Run | 选择已安装插件并启动插件 TUI 或 CLI 能力。 | | Install | 从内置官方插件清单安装插件。 | | Update | 先检查可更新项,再执行更新。 | | Uninstall | 卸载已安装插件。 | | Settings | 切换语言、代理与 GitHub 源配置。 |

从根 TUI 启动插件后,插件退出会返回根 TUI,并恢复离开前的页面与选择位置。

Commands

| 命令 | 用途 | | --- | --- | | slothtool | 启动根全屏 TUI。 | | slothtool tui | 显式启动根全屏 TUI。 | | slothtool install <alias> | 安装内置官方插件。 | | slothtool uninstall <alias> | 卸载指定插件。 | | slothtool update <alias> | 更新指定插件。 | | slothtool --update-all | 更新全部可更新目标。 | | slothtool list | 查看已安装插件。 | | slothtool run <plugin> [args] | 运行指定插件。 | | slothtool <plugin> [args] | 插件简写运行方式。 | | slothtool config <...> | 管理语言、代理和 GitHub 源。 | | slothtool self-update | 更新根管理器包。 | | slothtool --uninstall-all | 删除 SlothTool 用户数据与已安装插件。 |

Official Plugins

| Alias | Package | 能力 | 入口 | | --- | --- | --- | --- | | loc | @holic512/plugin-loc | 统计目录代码行数、文件类型过滤、排除目录配置、详细模式。 | slothtool loc / loc | | image-compress | @holic512/plugin-image-compress | JPEG / PNG 图片压缩、目录批处理、拖拽路径 TUI、多平台 Go 后端资产。 | slothtool image-compress / image-compress |

loc

slothtool install loc

slothtool loc
slothtool loc .
slothtool loc -v ./src

loc config show
loc config ext md off
loc config exclude dist on
loc config reset

image-compress

slothtool install image-compress

slothtool image-compress
slothtool image-compress ./photo.jpg
slothtool image-compress ./photo.jpg --dry-run --json
slothtool image-compress -r ./album --output-dir ./compressed

常用压缩参数包括 --quality--max-width--max-height--overwrite--allow-larger--concurrency--dry-run--json--quiet

Configuration

全局设置默认保存在 ~/.slothtool/settings.json

{
  "language": "zh",
  "network": {
    "proxy": {
      "enabled": false,
      "protocol": "http",
      "host": "127.0.0.1",
      "port": 7980,
      "noProxy": "localhost,127.0.0.1,::1"
    },
    "github": {
      "preset": "gh-proxy",
      "customBaseUrl": ""
    }
  }
}

常用配置命令:

| 命令 | 说明 | | --- | --- | | slothtool config | 查看语言、代理和 GitHub 源摘要。 | | slothtool config language zh | 切换为中文。 | | slothtool config language en | 切换为 English。 | | slothtool config proxy show | 查看网络配置。 | | slothtool config proxy enabled on | 启用代理。 | | slothtool config proxy enabled off | 关闭代理。 | | slothtool config proxy host 127.0.0.1 | 设置代理主机。 | | slothtool config proxy port 7890 | 设置代理端口。 | | slothtool config proxy github official | 使用官方 GitHub 源。 | | slothtool config proxy github gh-proxy | 使用内置 GitHub 代理预设。 | | slothtool config proxy github-url https://proxy.example.com | 写入自定义 GitHub 代理地址,并切换到 custom。 |

Architecture

flowchart TD
    A["slothtool CLI"] --> B{"Has command?"}
    B -- "No" --> C["Root Ink TUI"]
    B -- "Root command" --> D["Command handlers"]
    B -- "Plugin alias" --> E["Plugin runner"]
    C --> D
    D --> F["Plugin service"]
    F --> G["official-plugins.json"]
    F --> H["GitHub Release .tgz"]
    F --> I["~/.slothtool/registry.json"]
    F --> J["~/.slothtool/plugins/<alias>/"]
    E --> I
    E --> K["Plugin bin"]
    K --> L{"No args / --tui?"}
    L -- "Yes" --> M["Plugin Ink TUI"]
    L -- "No" --> N["Plugin CLI behavior"]

安装流程:

  1. slothtool install <alias>lib/official-plugins.json 查找内置官方插件。
  2. SlothTool 根据插件策略、当前系统平台和 CPU 架构选择 GitHub Release .tgz 资产。
  3. 资产被解包并部署到 ~/.slothtool/plugins/<alias>/
  4. 插件入口、版本和来源信息写入 ~/.slothtool/registry.json
  5. slothtool <plugin> 从注册表解析插件入口;无额外参数时优先进入插件默认 TUI。

Data Layout

~/.slothtool/
├── settings.json
├── registry.json
├── plugins/
│   ├── image-compress/
│   └── loc/
└── plugin-configs/
    └── loc.json

Repository Layout

SlothTool/
├── bin/                     Root CLI entry
├── lib/                     Root commands, services, settings, i18n, and TUI
├── plugins/
│   ├── loc/                 Official LOC plugin workspace
│   ├── image-compress/      Official image compression plugin workspace
│   └── template-basic/      Plugin scaffold template
├── test/                    node:test regression suite
├── PLUGIN_DEVELOPMENT.md    Plugin contract and development notes
├── LOCAL_BUILD_GUIDE.md     Local build and release validation notes
└── package.json

Development

npm install
npm link

node bin/slothtool.js --help
node plugins/loc/bin/loc.js --help
node plugins/image-compress/bin/image-compress.js --help

Focused checks:

node --check bin/slothtool.js
node --check lib/tui/root-tui.js
SLOTHTOOL_TUI_TEST_ACTION=exit node bin/slothtool.js
SLOTHTOOL_LOC_TUI_TEST_ACTION=exit node plugins/loc/bin/loc.js
SLOTHTOOL_IMAGE_COMPRESS_TUI_TEST_ACTION=exit node plugins/image-compress/bin/image-compress.js

Full regression:

npm test

More project docs:

License

ISC, as declared in package.json. This repository does not currently include a standalone LICENSE file.