Skip to main content

Module opencode

Module opencode 

Source
Expand description

OpenCode 配置读写模块

管理 code-repo-wiki 插件在 opencode.json 中的注册状态。 搜索顺序:项目根 .opencode.json → ~/.config/opencode/opencode.json

使用 serde_json::Value 操作 JSON,不依赖 OpenCode 的 schema 类型, 避免与 OpenCode 版本耦合。

§插件加载机制(opencode 1.18.10,实测验证)

  • .opencode/plugins/*.ts 目录自动扫描加载,无需任何 config 条目 (官方加载器 glob {plugin,plugins}/*.{ts,js}
  • 官方配置仅认单数 plugin 字段(字符串数组);不存在 plugins 复数键, 多余顶层键会触发配置解析 Unrecognized key 错误
  • 因此本模块不再向配置写入插件条目;install/uninstall 仅负责 幂等清理历史遗留的无效 plugins(旧版本曾错误写入), is_installed 以插件文件存在性为准

Structs§

OpenCodeConfig
OpenCode 配置管理器