@boyingliu01/opencode-plugin

中文文档
0.35.18发布于 2026/11/01MITTypeScriptES Module构建来源已验证

XP-Gate quality gates + AI workflow skills for OpenCode

原始使用文档
文档目录5 节
  1. Tools
  2. Installation
  3. OpenCode v2
  4. Requirements
  5. Graceful Degradation

XP-Gate OpenCode Plugin

OpenCode plugin exposing xp-gate quality gates and AI workflow skills.

Tools

  • gate-check ⇄ xp-gate check <path>: Run user-invokable quality gates (Gate 4 Principles + Gate 6 Architecture) on a file or directory.

  • gate-principles ⇄ xp-gate principles <path>: Run Clean Code + SOLID principles checker (Gate 4 standalone).

  • gate-arch ⇄ xp-gate arch: Run architecture validation (Gate 6 standalone) with the pinned local @archlinter/cli built-in rules and baseline ratchet; an optional config file opts into archlint's own --config path.

  • session-reload-model: Reload session model from config. After switching provider configs (opencode.json + oh-my-openagent.json via switch-coding-plan.sh), updates the session model in OpenCode DB to match the new config, so restarted sessions use the current provider/model.

    Usage:

    // Reload current session model from config
    session-reload-model()
    
    // Reload a specific session
    session-reload-model({ sessionId: "ses_xxx" })
    
  • session-rename: Rename an OpenCode session. When called without a newTitle, analyzes the session's recent user messages and auto-generates a descriptive title. Works by directly updating the OpenCode SQLite database (~/.local/share/opencode/opencode.db).

    Usage:

    // Rename current session with auto-generated title
    session-rename()
    
    // Rename a specific session with a custom title
    session-rename({ sessionId: "ses_xxx", newTitle: "Fix auth middleware bug" })
    

Earlier docs said "all 6 quality gates" — that was inaccurate. gate-check intentionally runs only the two user-invokable gates (Principles + Arch); the full 10-gate pre-commit suite (Gate 0-9) is enforced by xp-gate init's git hooks, not by this tool. Fixes #208.

Installation

In your opencode.json:

{
  "plugin": ["@boyingliu01/opencode-plugin"]
}

Or via local path (development):

{
  "plugin": ["./plugins/opencode"]
}

OpenCode v2

v2 validates the plugin's default export against a schema requiring id plus effect or setup. This package ships both keys from 0.35.15 onwards, so the same published version loads under v1 and v2 — no separate build, no manifest change on your side.

Register it the same way (v2 reads the same plugin array):

{
  "plugin": ["@boyingliu01/opencode-plugin"]
}

Do not register @boyingliu01/opencode-plugin/tui. The TUI panel was abandoned in v0.13.0 and there is no /tui entry; v2's npm installer treats the whole string as a package name, so it fails on every startup with NpmInstallFailedError. The subpath export was removed in 0.35.15 for exactly that reason.

Requirements

  • OpenCode v0.11+ (v2.1.4+ supported)
  • One of:
    • xp-gate CLI installed globally (npm install -g @boyingliu01/xp-gate) — preferred, or
    • the xp-gate repo checked out locally with src/principles/index.ts reachable — fallback (the tool will shell out via npx -y tsx)
  • @archlinter/cli installed locally or on PATH (for gate-arch only; the default built-in-rules path needs no architecture.yaml — passing one opts into archlint's own --config schema validation, which rejects pre-0.16 files)

Graceful Degradation

Every tool runs a chained shell-out: it first tries xp-gate <subcommand> and, only if that's not on PATH, falls back to invoking the underlying checker source directly. If both paths fail, the tool returns install instructions instead of throwing.

版本与发布记录

@boyingliu01/opencode-plugin 共发布 166 个版本,首次发布于 2026/06/09;过去 12 个月发布了 166 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.35.18latest2026/11/012 天前
0.35.172026/10/313 天前
0.35.162026/10/313 天前
0.35.152026/10/313 天前
0.35.142026/10/313 天前
0.35.132026/10/313 天前

关于 @boyingliu01/opencode-plugin 的常见问题

@boyingliu01/opencode-plugin 是什么?

XP-Gate质量闸门+ OpenCode AI工作流技能

如何安装 @boyingliu01/opencode-plugin?

在项目目录运行 npm install @boyingliu01/opencode-plugin,或使用 pnpm add / yarn add / bun add。

@boyingliu01/opencode-plugin 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@boyingliu01/opencode-plugin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@boyingliu01/opencode-plugin 可以商用吗?

@boyingliu01/opencode-plugin 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@boyingliu01/opencode-plugin 还在维护吗?

最新版本 0.35.18 发布于 2026/11/01(2 天前);至今共发布 166 个版本,其中过去 12 个月发布了 166 个;首次发布于 2026/06/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。