Skip to content

feat(launch): add --project flag and warn when project config shadows user config#10

Merged
joch merged 1 commit into
mainfrom
project-config
May 7, 2026
Merged

feat(launch): add --project flag and warn when project config shadows user config#10
joch merged 1 commit into
mainfrom
project-config

Conversation

@joch
Copy link
Copy Markdown
Member

@joch joch commented May 7, 2026

Summary

  • OpenCode reads ./opencode.json (project config) when present, shadowing ~/.config/opencode/opencode.json (user config). Today, opper launch opencode writes the Opper provider into the user config — silently dead weight when a project config exists without it (opencode then falls back to whatever model the project config picks, e.g. gemini).
  • Default behaviour stays user-level. We do not silently mutate a project file the user didn't ask us to touch (those files are typically committed).
  • New `--project` flag opts into writing `./opencode.json` instead.
  • Without `--project`, we now warn at launch time when a project `opencode.json` exists but lacks the `provider.opper` entry, pointing at `--project`.

Plumbed via a new `SpawnOptions.configScope` (optional 3rd arg to `AgentAdapter.spawn`). Other adapters (claude, codex, hermes, pi) ignore it — none have a project-level config we manage.

Test plan

  • `npm test` — 265 passing (added 9 new tests)
  • `npm run typecheck` — clean
  • Manual: project dir with `opencode.json` lacking opper provider → warning fires; project file untouched
  • Manual: `--project` grafts opper provider into `./opencode.json` while preserving existing keys (e.g. `model`)
  • Manual: re-running without `--project` after project config has opper → warning suppressed

… user config

OpenCode's `./opencode.json` shadows `~/.config/opencode/opencode.json`,
so writing the Opper provider into the user-level config silently does
nothing when a project config exists without it — opencode falls back
to whatever model that project config picks (e.g. gemini).

- Default behaviour unchanged: write user-level config; never silently
  mutate a project file the user didn't ask us to touch.
- New `--project` flag opts into writing `./opencode.json` instead.
- Without `--project`, warn on launch when a project `opencode.json`
  exists but lacks the `provider.opper` entry.
- Plumbed via `SpawnOptions.configScope` (new optional 3rd arg to
  `AgentAdapter.spawn`); other adapters ignore it.
@joch joch merged commit 2ae0b07 into main May 7, 2026
4 checks passed
@joch joch deleted the project-config branch May 7, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant