Skip to content

v0.3.0 — Remote knowledge sources (git remotes, sync log, self-origin guard)

Latest

Choose a tag to compare

@likai-hust likai-hust released this 10 Sep 09:24

v0.3.0 — Remote knowledge sources

Team-distribution channel for OKF knowledge bases: the KB author pushes to git, every agent pulls automatically.

New

  • remotes config — point at git-hosted knowledge bases; they are shallow-cloned/updated into a shared local cache (~/.cache/opencode-okf/remotes/<hash(url+ref)>) before discovery and registered like local bundles (same L0/L1/L2 disclosure, same unload semantics). Multi-bundle repos register one bundle per root.
  • Failures never break the session — an unreachable origin degrades to the existing cache (stderr warning); a first-clone failure skips that remote.
  • Read-only by design — okf_write refuses remote bundles (the next sync's reset --hard would clobber local edits). The git repo is the source of truth.
  • Auth — auth: "env:VARNAME" reads tokens from the environment at sync time; tokens never live in okf.jsonc. ssh URLs use your ssh agent.
  • Sync log — every sync appends to ~/.cache/opencode-okf/sync.log ($OKF_SYNC_LOG): status, duration, pulled commit, registered bundles — success included. Lines never contain the remote URL (ssh URLs embed user@host); git errors are sanitized. debug: true mirrors lines to stderr.
  • Self-origin guard — a remote that IS the current project's own git origin is detected (protocol/git@/.git-insensitive comparison) and skipped: no redundant clone, no duplicate bundle.
  • okf sync CLI — force-updates all remotes (exit 1 on failure — CI gate); other okf commands clone on first use then run from cache (--sync / --no-sync to override).
  • Hardening — git subprocesses run with BatchMode=yes + ConnectTimeout=10 + GIT_TERMINAL_PROMPT=0: unreachable hosts and interactive prompts fail in seconds instead of hanging the session.

Quality

  • 168 tests (was 146), including real-git-repo E2E for the sync lifecycle; verified in a live opencode session (manifest injection + remote okf_read + sync.log).

Full Changelog: v0.2.0...v0.3.0


v0.3.0 — 远程知识源

OKF 知识库的团队分发通道:知识库作者 push 到 git,所有 agent 自动拉取。

  • remotes 配置:git 托管知识库在发现前被浅克隆/更新到共享本地缓存,并像本地 bundle 一样注册(同样的 L0/L1/L2 渐进披露与卸载语义);多 bundle 仓库按根目录各注册一个。
  • 故障绝不阻断会话:源不可达时降级用缓存;首次 clone 失败跳过该 remote。
  • 设计上只读:okf_write 拒绝 remote bundle(下次同步的 reset --hard 会冲掉本地改动),git 仓库是唯一事实源。
  • 鉴权:auth: "env:VARNAME" 同步时从环境变量读 token,绝不落进 okf.jsonc;ssh URL 走 ssh agent。
  • 同步日志:~/.cache/opencode-okf/sync.log 记录每次同步的状态/耗时/commit/注册 bundle(成功也留痕);日志行绝不包含 remote URL,git 报错已消毒;debug: true 镜像到 stderr。
  • 自仓库守卫:把当前项目自己的 origin 配成 remote 会被识别并跳过——不冗余克隆、不重复注册。
  • okf sync CLI:强制更新全部 remote(失败退出码 1,可作 CI 门禁);其余命令首次 clone 后走缓存(--sync/--no-sync 可覆盖)。
  • 加固:git 子进程带 BatchMode=yes + ConnectTimeout=10 + GIT_TERMINAL_PROMPT=0,不可达主机与交互提示秒级失败,不再挂起会话。

质量:168 个测试(原 146),含真实 git 仓库同步全流程 E2E;已在真实 opencode 会话中验证(manifest 注入 + 远程 okf_read + 同步日志)。