跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    tjvjk

    Policy

    v0.1.4其他
    opencode-policy

    OpenCode plugin for blocked file patterns and prompt injection policies

    GitHub 星标

    20

    月装机量

    47

    近 7 天 9

    综合评分SCORE

    34.9

    生态多维模型

    最近提交

    3 个月前

    2026-04-24

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-policy@0.1.4"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    OpenCode security plugin with:

    You can review the full rule sets there and add or remove patterns to fit your workspace.

    Unsafe tool patterns Unsafe tool patterns

    Prompt injection patterns Prompt injection patterns

    Use it when you want stronger workspace safety out of the box: it helps prevent secret exposure, exfiltration, unsafe shell execution, reverse shells, denial-of-service commands, cross-workspace access, and common instruction-override attacks. Matching events are logged to .opencode/opencode-policy.log for review.

    Simple install

    opencode plugin opencode-policy@latest --global
    

    Install from npm

    Install the package:

    npm install opencode-policy
    

    Then add it to one of these OpenCode config files:

    • ~/.config/opencode/opencode.json for your user
    • opencode.json in your project root for one project
    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-policy"]
    }
    

    License

    MIT

    Thanks

    Pattern research and source material were adapted in part from vakovalskii/topsha