Skip to content

feat: support repo-local config for context selection - #85

Open
Karnak19 wants to merge 2 commits into
coollabsio:mainfrom
Karnak19:Karnak19/feat-repo-local-context
Open

Karnak19 wants to merge 2 commits into
coollabsio:mainfrom
Karnak19:Karnak19/feat-repo-local-context

Conversation

@Karnak19

@Karnak19 Karnak19 commented Aug 17, 2026 •

Copy link
Copy Markdown

Changes

Adds a repo-local config file so a repository can pin which context every coolify command inside it targets, without anyone having to remember --context or flip the global default back and forth.

.coolify.json (or .coolifyrc) at the repo root:

{
  "context": "production"
}

The CLI walks up from the working directory and uses the nearest one.

Resolution order:

  1. --context flag
  2. repo-local .coolify.json / .coolifyrc
  3. global default context
  • No credentials in the repo. The file only names a context that already exists in ~/.config/coolify/config.json; tokens stay global.
  • Both file names are plain JSON, so no new dependency (.coolify.toml would need a TOML parser for a single key — happy to add it if you'd prefer that shape).
  • A repo-local file naming a context that doesn't exist is a hard error that prints both paths, rather than a silent fallback to the default instance — silently deploying to the wrong place is the thing the issue is about. Malformed JSON errors too, for the same reason.
  • --debug prints which file the context came from.
  • Wired into cli.GetAPIClient, the single point where every command resolves its context, so all commands pick it up. No command surface changes.
  • internal/config/local.go + local_test.go, docs in README.md, CLAUDE.md and ARCHITECTURE.md.

Testing: internal/config/local_test.go covers discovery from a nested directory, nearest-file-wins, absence, and parse failure. go test -race ./internal/... (config package at 83.3%), gofmt -s, and go vet ./... are green; also verified against a built binary for the flag-override, repo-local hit, and repo-local miss paths.

Issues & Discussions

🤖 Generated with Claude Code

Karnak19 and others added 2 commits August 17, 2026 15:42
- Add .coolify.json / .coolifyrc discovery, walking up from the working
  directory; nearest file wins, malformed JSON errors instead of silently
  falling back to the global default
- Resolve contexts as: --context flag > repo-local file > global default
- Point a missing repo-local context at both the file and the global config
  in the error, and log the source file under --debug
- Keep credentials global: the repo file only names an existing context
- Add tests for discovery, precedence and parse failures; document in README

Closes coollabsio#58

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Note the .coolify.json / .coolifyrc override and the
flag > repo-local > global default precedence in CLAUDE.md and
ARCHITECTURE.md, per the CONTRIBUTING PR checklist.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Support repo-local config for context selection

1 participant