feat(cli): config file resolution + command split#85
Merged
Conversation
Read optional ~/.config/ccas/config.conf (HOCON via zio-config). Server URL resolves --server flag > config api_url > built-in http://127.0.0.1:8080; default_clubs seeds the shell-completion cache; log_dir is parsed but not yet used. Missing file falls back to defaults; a malformed file fails fast with a file-naming error (exit 2). HOCON/config.conf instead of the issue's config.toml — reuses typesafe-config already in the dependency tree, so no new dependency. Split CliCommand into ServerCommand (HTTP-client subcommands carrying the resolved server URL) and local commands (Serve, now a case object with no --server; Completion). Removes the Completion server="" sentinel and the dead dispatcher branches; regenerated completions/ccas.bash. Closes #43 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #43.
What
The
ccasCLI now reads optional settings from${XDG_CONFIG_HOME:-~/.config}/ccas/config.conf:--server <url>flag → configapi_url→ built-inhttp://127.0.0.1:8080.default_clubsseeds the completionclubs.txton a fresh install (mtime stamped to epoch so the next server command still refreshes authoritative slugs).error: invalid config file <path>: …(exit 2).Decisions (diverge from the issue, with sign-off)
config.conf, not TOML — reusestypesafe-configalready in the tree via zio-configTypesafeConfigProvider.fromHoconFileZIO; no new dependency. (.toml→.confis the only issue-text deviation.)default_clubs-as-slug-fallback (a list; 2+ → error every call) was deliberately not built; a follow-up issue will design club-context (current_club+ccas use <slug>) which supersedes it.Refactor folded in
Split
CliCommandintoServerCommand(HTTP-client subcommands that carry the resolved server URL) vs local commands (Serve— now acase objectwith no--server;Completion). Removes theCompletion.server = ""sentinel and the deadServe/Completionbranches inDispatcher;Dispatcher.dispatch/runCommandnow takeServerCommandsocmd.serveris always real. Regeneratedcompletions/ccas.bash.Test plan
sbt test→ 797 passed (newTestCliConfig; resolution-order cases inTestCliParser;TestCcasCompletionbyte-equality after regen).api_urlused;--serveroverrides; malformed → clean exit 2;default_clubsseedsclubs.txt;serve --helpno longer lists--server.🤖 Generated with Claude Code