Commit 9bc1ba9
feat: detect OpenCode origin + activate PLANNOTATOR_ORIGIN override (#590)
* 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>1 parent 104be99 commit 9bc1ba9
2 files changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
144 | 153 | | |
| 154 | + | |
145 | 155 | | |
146 | 156 | | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
0 commit comments