mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
9bc1ba97d3
* feat: detect OpenCode origin + activate PLANNOTATOR_ORIGIN override Extend the origin detection chain in apps/hook/server/index.ts to recognize OpenCode via `process.env.OPENCODE`, the stable runtime flag set by the OpenCode binary (also sets OPENCODE_RUN_ID, OPENCODE_PID, OPENCODE_PROCESS_ROLE, but OPENCODE=1 is the canonical detection flag). Additionally, activate `PLANNOTATOR_ORIGIN` as an explicit override. The comment in packages/server/index.ts already documented this variable, but it was never actually read. It is now honored at the top of the detection chain and validated against AGENT_CONFIG so only known origins take effect — invalid values fall through to env-based detection. Priority order after this change: PLANNOTATOR_ORIGIN > Codex > Copilot CLI > OpenCode > Claude Code (default) Single-point fix: all five existing `detectedOrigin` usages (lines 405, 568, 694, 741, 999) pick up the new chain automatically. The `'opencode'` origin key is already defined in packages/shared/agents.ts (AGENT_CONFIG), complete with a UI badge — the detection chain was the last missing piece. Closes the gap noted in packages/shared/agents.ts header comment: "If detection is via environment variable, add it to the detection chain in apps/hook/server/index.ts (detectedOrigin constant)". * fix: remove stray project argument from getServerConfig calls getServerConfig only accepts gitUser — the project argument was silently ignored at runtime but fails the typecheck. Reverts the two call sites to their correct single-argument form. For provenance purposes, this commit was AI assisted. --------- Co-authored-by: Michael Ramos <mdramos8@gmail.com>