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

opencode-dir-tree-tui

v1.0.3

Published

OpenCode V2 TUI plugin: VS Code-style file tree in the sidebar with git status coloring and click-to-open

Readme

🌳 opencode-dir-tree-tui

给 OpenCode 的侧边栏加一棵文件树。展开目录、查看 Git 变更、打开文件,在终端里就能搞定。

文件树演示

✨ 有什么好用的

  • 用颜色区分文件的 Git 状态。
  • 右键或 Ctrl+点击,用系统默认程序打开文件和目录。
  • 按名称或 *.log 这样的通配符隐藏杂项。
  • 自动刷新,面板可以折叠,展开过的目录也会记住。

📦 安装

请根据已安装的 OpenCode 版本选择下方指导。OpenCode V1 使用固定的旧版插件,V2 使用当前版本。

让 Agent 帮你装(推荐)

把这段话发给 OpenCode 或你常用的编程 Agent:

请按照这份 README 的手动安装部分安装 opencode-dir-tree-tui。先检查我已安装的 OpenCode 版本,再选择对应指导,保留已有配置:
https://raw.githubusercontent.com/aihaipeng/opencode-dir-tree-tui/main/README.zh-CN.md

手动安装

先检查你正在使用的 OpenCode 版本:

opencode --version

| OpenCode 版本 | 插件包 | 配置文件与字段 | | --- | --- | --- | | 1.x(V1) | [email protected] | ~/.config/opencode/tui.json → plugin | | 2.x(V2) | opencode-dir-tree-tui | ~/.config/opencode/cli.json → plugins |

如果无法确定版本,请先确认再修改配置。将对应条目合并到已有文件,保留其他插件和设置;若已配置本插件,更新原条目并保留原有选项,避免重复添加。

OpenCode V2

在 ~/.config/opencode/cli.json 中添加以下条目:

{
  "$schema": "https://opencode.ai/v2/cli.json",
  "plugins": [
    {
      "package": "opencode-dir-tree-tui",
      "options": {
        "hiddenDirs": ["node_modules", "__pycache__", "*.pyc"]
      }
    }
  ]
}

OpenCode 会自动从 npm 下载,并自动重载受监控的配置改动。

OpenCode V1

在 ~/.config/opencode/tui.json 中,将固定版本和选项放在嵌套数组里:

{
  "$schema": "https://opencode.ai/tui.json",
  "plugin": [
    [
      "[email protected]",
      {
        "hiddenDirs": ["node_modules", "__pycache__", ".git"]
      }
    ]
  ]
}

重启 OpenCode 后会自动下载并加载插件。使用 V1 时,即使出现更新提示也请保留 @0.5.1,不带版本号会安装面向 V2 的版本。

下方使用说明面向 V2。V1 的 hiddenDirs 只支持精确名称,其他功能请参考 V1 使用说明。

🖱️ 怎么点

| 操作 | 效果 | | --- | --- | | 点击目录 | 展开 / 折叠 | | 右键或 Ctrl+点击文件、目录 | 用系统默认程序打开 | | 点击 Dir Tree | 收起 / 展开面板 |

🧹 隐藏杂项

上面配置里的 hiddenDirs 对文件和目录都生效。不写或设为 [],就显示服务端返回的所有条目,包括 gitignore 忽略的文件。

| 规则 | 匹配内容 | | --- | --- | | node_modules | 名称完全相同的条目 | | *.log | 以 .log 结尾的名称 | | .env* | .env、.env.local 等 | | temp? | temp1、tempA 等 |

按完整名称匹配,区分大小写,任意层级都生效。* 表示零个或多个字符(包括开头的点),? 表示一个字符;其余字符按字面匹配。不支持路径模式、否定规则、字符组或读取 .gitignore。隐藏只影响文件树显示。

🔧 几个小提示

  • 没看到文件树? 检查 OpenCode 版本和插件配置,然后重启。需要排查加载问题时,启用 OPENCODE_LOG_LEVEL=DEBUG,在 ~/.local/share/opencode/log/opencode.log 中找 stage=setup + opencode-dir-tree-tui。
  • Ctrl+点击没反应? 可能是终端不转发修饰键,试试右键。
  • 没有 Git 颜色? 检查 git 是否可用,以及当前目录是否在 Git 仓库里。状态色是固定的 VS Code Git 装饰色(绿=新增、黄=修改、红=删除),不跟随主题。
  • 改动没生效? V2 会自动重载受监控的插件和配置文件;未被监控的本地依赖可能仍需重启。

🛠️ 开发

想改插件代码?克隆仓库,再装好开发工具需要的 Bun:

git clone https://github.com/aihaipeng/opencode-dir-tree-tui.git
cd opencode-dir-tree-tui
bun install
bun run typecheck
bun run test
bun run test:package

作为本地插件加载仓库前,请先运行 bun run build。npm 发布包包含预编译的 Solid 代码,确保点击后目录树能更新。bun run test:package 会从 node_modules 路径测试实际 npm 压缩包。

插件安装说明 · V2 插件 API · MIT 许可证