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-read-file

v1.0.0

Published

OpenCode 文件读取助手 - macOS 26.3 兼容版,替代附件上传功能

Readme

OpenCode 文件读取助手 (opencode-read-file)

macOS 26.3 兼容版 - 解决附件上传功能失效问题

背景

macOS 26.3 系统下,OpenCode Desktop 的附件上传按钮因 Tauri dialog plugin 兼容性问题无法正常工作(GitHub Issue #14669)。

本插件提供替代的文件读取功能,通过命令行工具直接读取本地文件,绕过原生附件上传逻辑。

功能特点

  • 支持 20+ 种文件格式
  • JSON/YAML/CSV 自动格式化
  • 代码文件语法高亮
  • 文件元信息获取
  • 文件大小限制保护(默认 10MB)
  • 详细错误信息提示

支持的文件类型

Tier 1(完全支持)

| 类型 | 扩展名 | |------|--------| | 文本 | .txt, .md, .log | | 数据 | .json, .yaml, .yml, .csv | | 代码 | .js, .ts, .py, .go, .java, .c, .cpp, .rs, .rb, .php | | 脚本 | .sh, .bash, .zsh |

Tier 2(支持读取)

| 类型 | 扩展名 | |------|--------| | 文档 | .pdf, .html, .xml |

Tier 3(计划支持)

| 类型 | 扩展名 | |------|--------| | 思维导图 | .xmind | | Office | .docx, .xlsx | | 图片 | .png, .jpg, .gif, .webp |

工具列表

| 工具名 | 说明 | |--------|------| | /read-file | 通用文件读取,支持所有格式 | | /read-json | JSON 文件专用,自动格式化 | | /read-csv | CSV 文件专用,输出 Markdown 表格 | | /read-code | 代码文件专用,带语法高亮 | | /file-info | 获取文件元信息(名称、大小、类型等) |

安装

方法一:本地安装

git clone https://github.com/Jones-BIGBIG/opencode-read-file.git
cd opencode-read-file
bun install
bun run build

方法二:NPM 安装(计划中)

bun add -g opencode-read-file

配置

在项目根目录创建 opencode.json

{
  "plugins": [
    {
      "name": "opencode-read-file",
      "path": "/path/to/opencode-read-file/dist/index.js"
    }
  ]
}

使用示例

读取 JSON 文件

用户: 读取 /Users/xxx/data.json
Agent: [调用 read-file 工具]

输出:

📝 **文件内容**

{
  "name": "example",
  "version": "1.0.0"
}

读取 CSV 文件

用户: 读取 /Users/xxx/data.csv

输出(Markdown 表格):

| id | name | age |
| -- | ---- | --- |
| 1  | Alice | 25 |
| 2  | Bob | 30 |

获取文件信息

用户: 查看 /Users/xxx/script.ts 的文件信息

输出:

📄 **文件信息**
- 名称: script.ts
- 扩展名: ts
- 类型: typescript
- 层级: tier_1
- 大小: 1.5 KB
- MIME: application/typescript
- 修改时间: 2025-01-15T10:30:00.000Z

开发

环境要求

  • Bun >= 1.0.0
  • Node.js >= 18.0.0(可选)

构建

bun run build

测试

bun test

类型检查

bun run typecheck

项目结构

opencode-read-file/
├── src/
│   ├── index.ts          # 插件入口
│   ├── tools/
│   │   └── read-file.ts  # 核心读取逻辑
│   └── types/
│       └── index.ts      # 类型定义
├── dist/
│   └── index.js          # 编译输出
├── package.json
├── tsconfig.json
└── README.md

技术栈

常见问题

Q: 为什么不直接修复附件上传按钮?

A: 附件上传按钮是 Tauri dialog plugin 的原生功能,问题出在 macOS 26.3 系统层面的兼容性。插件系统无法修改宿主应用的原生代码,只能提供替代方案。

Q: 支持二进制文件吗?

A: 目前支持 PDF 文本提取。图片、Office 文档等二进制格式的支持正在开发中。

Q: 文件大小有限制吗?

A: 默认限制 10MB,可通过 maxBytes 参数调整。

贡献

欢迎提交 Issue 和 Pull Request!

许可证

MIT

相关链接