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

@marscore-archi/oh-my-opencode-slim-preset-pin

v1.0.3

Published

零依赖 CLI:将 oh-my-opencode-slim 的某个 preset 固化到当前项目级配置

Downloads

639

Readme

@marscore-archi/oh-my-opencode-slim-preset-pin

零依赖 CLI:将 oh-my-opencode-slim 的某个 preset 固化到当前项目级配置,使其在进入该项目时自动生效且不被外部漂移影响,离开项目后恢复用户全局设置。

安装

全局安装(任意目录可用 preset-pin 命令):

npm install -g @marscore-archi/oh-my-opencode-slim-preset-pin

或用 npx 临时运行(无需安装):

npx @marscore-archi/oh-my-opencode-slim-preset-pin <preset-name>

用法

直接固化指定 preset

preset-pin archi-glm

跳过交互,直接将 archi-glm 固化到当前项目的 .opencode/oh-my-opencode-slim.json。

交互式选择

preset-pin

以 numbered list 列出所有可用 preset(含当前活跃 preset 标记 (current)),输入序号完成选择:

可用 preset:
  1) archi-deepseek
  2) archi-glm (current)
  3) archi-gpt
  4) archi-kimi
  5) archi-qwen
请输入序号: 2

无效输入会提示重新输入,不退出。

帮助

preset-pin --help
preset-pin -h

preset 不存在

preset-pin nonexistent

向 stderr 列出可用 preset 并以非零状态码退出。

工作原理

preset-pin <name>(或交互选择)
   │
   ├─ 加载本地 ~/.config/opencode/oh-my-opencode-slim.jsonc(优先)/ .json
   │   └─ 支持 JSONC(剥离 // 与 /* */ 注释 + 尾逗号后 JSON.parse)
   ├─ 拉取远程 https://archi.marscore.net/guide/oh-my-opencode-slim.json
   │   └─ 全局 fetch,8s 超时;非 2xx/异常时 console.warn 并降级到本地
   ├─ 合并 presets:{ ...local, ...remote }(同名 preset 远程覆盖本地)
   ├─ 校验/选择 preset 名
   ├─ 展平 extends 继承链(深度优先,子层覆盖父层同名 agent)
   │   └─ 检测循环 / 缺失父级 → 报错退出
   │   └─ inheritModelFrom 原样保留不展开
   └─ 写入当前项目 .opencode/oh-my-opencode-slim.json
       ├─ 目录不存在 → mkdirSync recursive
       ├─ 目标已存在 → copyFileSync 备份为 .bak
       ├─ 合并写入:只覆盖 preset 与 presets.<name>.agents
       │   └─ 保留其他字段(disabled_agents / multiplexer / council 等)
       └─ canonical 语法:{ "preset": "<name>", "presets": { "<name>": { "agents": {...} } } }
           └─ 不写顶层 agents 字段(仅固化选中 preset 的 agent map)

进入项目后,oh-my-opencode-slim 插件的配置加载链(user config → project config,project 覆盖 user)会自动切到固化的 preset;离开项目后恢复用户全局设置。

固化输出示例

{
  "preset": "archi-glm",
  "presets": {
    "archi-glm": {
      "agents": {
        "orchestrator": { "model": "...", "variant": "max", "skills": ["*"], "mcps": ["*", "!context7"] },
        "oracle": { "model": "...", "variant": "max", "skills": ["simplify"], "mcps": [] },
        "explorer": { "model": "...", "skills": [], "mcps": [] },
        "designer": { "model": "...", "variant": "medium", "skills": ["agent-browser"], "mcps": [] },
        "fixer": { "model": "...", "variant": "max", "skills": [], "mcps": [] },
        "librarian": { "model": "...", "skills": [], "mcps": ["websearch", "context7", "grep_app"] },
        "council": { "model": "...", "variant": "xhigh", "skills": [], "mcps": [] }
      }
    }
  }
}

设计决策

  • canonical 语法:输出 { "preset": "<name>", "presets": { "<name>": { "agents": {...} } } },agent map 包在 agents 键下,不摊平到 root agents。保留 preset 语义(项目内仍可被 /preset 命令列出)。
  • 自实现展平:不依赖 oh-my-opencode-slim 插件导出,在 CLI 内自实现 extends 深度优先展平与循环检测,零耦合。
  • 零运行时依赖:仅 Node.js 标准库(fs / os / path / readline / process)+ Node 18+ 全局 fetch。
  • 合并+备份策略:目标已存在时备份为 .bak,只覆盖 preset 与 presets.<name>,保留项目已有的其他定制。

许可证

UNLICENSED - 内部使用