Summary
opencode-plugin/src/tracking.ts repeats the same boilerplate across all four tracker methods (sessionStart, toolExecuted, sessionEnd, heartbeat) plus the internal send function. This creates maintenance risk: changes to config resolution, user identity, default model, or cost calculation must be applied in multiple places.
Additionally, opencode-plugin/src/index.ts duplicates the exact same multi-line config-not-found error message at lines 33-34 and 121-122.
Evidence
tracking.ts — repeated patterns across methods:
| Pattern |
Occurrences |
Lines |
readConfig() + if (!config) return |
5× |
91-92, 112-113, 145-146, 188-189, 225-226 |
readTeamConfig(ctx.directory || process.cwd()) |
4× |
114, 147, 190, 227 |
config.user_email || userInfo().username |
4× |
126, 169, 199, 236 |
lastModel || "claude-opus-4-6" (hardcoded default) |
4× |
128, 161, 191, 228 |
Math.round(calculateCost(...) * 1e6) / 1e6 cost block |
2× |
208-218, 247-257 |
index.ts — duplicated string:
The config-not-found message ("No Fyso credentials found. Run the sync-team skill first...") is identical at lines 33-34 and 121-122.
Acceptance criteria
Suggested validation
cd opencode-plugin && npm test
# Verify all existing tests pass unchanged
# Grep for "claude-opus-4-6" — should appear only in the DEFAULT_MODEL constant
# Grep for "No Fyso credentials" — should appear only in the shared constant
Pipeline
- Esta issue fue solicitada por un agente de mantenimiento programado.
- Entra sin labels para publicarse en triage; segun configuracion puede requerir aceptacion manual o autoaceptarse.
Summary
opencode-plugin/src/tracking.tsrepeats the same boilerplate across all four tracker methods (sessionStart,toolExecuted,sessionEnd,heartbeat) plus the internalsendfunction. This creates maintenance risk: changes to config resolution, user identity, default model, or cost calculation must be applied in multiple places.Additionally,
opencode-plugin/src/index.tsduplicates the exact same multi-line config-not-found error message at lines 33-34 and 121-122.Evidence
tracking.ts — repeated patterns across methods:
readConfig()+if (!config) returnreadTeamConfig(ctx.directory || process.cwd())config.user_email || userInfo().usernamelastModel || "claude-opus-4-6"(hardcoded default)Math.round(calculateCost(...) * 1e6) / 1e6cost blockindex.ts — duplicated string:
The config-not-found message (
"No Fyso credentials found. Run the sync-team skill first...") is identical at lines 33-34 and 121-122.Acceptance criteria
DEFAULT_MODELconstant intracking.tsto replace the 4 hardcoded"claude-opus-4-6"strings.config.ts, used by both tools inindex.ts.resolveContext) that performsreadConfig+readTeamConfig+ user resolution, reducing the repeated 3-line preamble in each tracker method.sessionEndandheartbeat.tracking.test.ts,config.test.ts,create-team.test.ts) continue to pass.Suggested validation
Pipeline