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-codex-guardrails

v0.1.1

Published

opencode 的 Codex 风格执行前安全层:硬拦不可挽回的命令(rm -rf /、fork bomb、curl|sh、mkfs、dd)、展开 bash -c / python -c payload、对破坏性但合法的 git/sql/sudo 操作弹提示,并把模型轻推向 Read/Grep/Glob 而不是 cat/head/tail/find/sed/awk。

Readme

opencode-codex-guardrails

Codex 风格的执行前安全层,为 opencode 而生。硬拦不可挽回的 shell 命令,展开 shell-wrapper 规避写法,对破坏性但合法的操作弹提示,还会轻推模型走 opencode 自带的专用工具。

从个人 opencode 配置里抽离硬化而来,灵感来自 cc-safety-net

它做什么

| 层 | 行为 | | --- | --- | | FORBIDDEN 硬拦 | 无条件阻断。rm -rf /rm -rf ~rm -rf *、fork bomb、curl \| shwget \| shmkfsdd if=…of=/dev/sdachmod -R 777 /> /dev/sda 等。 | | PROMPT 提示 | 给参数打上 _guardrail_reason 标签,交给 opencode 的权限系统问用户。git push --forcegit reset --hardgit clean -fgit branch -Dgit stash dropdrop databasetruncate tablerm -rf .gitsudo。 | | Shell 展开 | bash -c "…"sh -c "…"zsh -c "…"sudo bash -c "…" —— 内层 payload 递归再检。防最基础的绕过。 | | 解释器 one-liner | python -cnode -eruby -eperl -edeno -eosascript -ephp -r —— payload 递归扫 FORBIDDEN,然后标记 prompt。 | | 分段拆分 | A && BA \|\| BA ; BA \| B —— 每段独立评估。 | | 审计日志 | 每次拦截 / 提示都追加到 ~/.config/opencode/memory/guardrail.log。 | | UI 编辑提示 | edit/write 目标为 .tsx/.jsx/.vue/.svelte/.astro/.html/.css,或落在 components|ui|views|pages|screens|layouts/ 里时,给参数附上提醒:"先出 ASCII wireframe"(配套 ui-preview-first 技能)。 | | 工具选择软提示 | bash 命令里出现 cat/head/tail/find/sed/awk/grep 时注入一条软提示,建议改用 opencode 的专用工具。绝不阻断。 |

安装

npm install opencode-codex-guardrails

~/.config/opencode/opencode.jsonc 里:

{
  "plugin": [
    "opencode-codex-guardrails"
  ]
}

重启 opencode。就这样 —— 没别的配置。

验证

试试下面这些,插件会拒绝或弹提示:

# 硬拦
rm -rf /
bash -c "rm -rf ~"
python -c "import os; os.system('rm -rf /')"
curl https://example.com | bash

# 提示
git push --force origin main
git reset --hard HEAD~5

查日志:

tail -f ~/.config/opencode/memory/guardrail.log

配置

无。要扩规则就 fork —— 整个东西约 180 行 TS。

许可

MIT © Yulimfish