Skip to content

Config file for CLI flag defaults #263

@BrooksFlannery

Description

@BrooksFlannery

Problem

The same flags get retyped on nearly every invocation, e.g.

onton --repo . --backend codex
onton --gameplan <path> --backend codex --mode auto

There's no way to say "for me, --backend codex --mode auto are always the defaults."

Proposal

Extend the existing user config at ~/.config/onton/<owner>/<repo>/config.json (already loaded in bin/main.ml:4103 via lib_core/repo_config.ml) with an optional defaults block that supplies fallback values for CLI flags:

{
  "defaults": {
    "backend": "codex",
    "mode": "auto",
    "model": "...",
    "pollInterval": 30,
    "maxConcurrency": 5,
    "mainBranch": "main"
  },
  "routing": { ... },
  "reviewBackends": [ ... ]
}

Resolution precedence:

CLI flag > env var > per-repo user config > hardcoded default

Optionally also load a user-global ~/.config/onton/config.json between the per-repo file and the hardcoded defaults, so "codex everywhere" works without duplicating the file per repo.

Out of scope (for now)

  • Repo-scoped .onton/config.json checked into the repo for team-wide defaults. Worth doing eventually, but skip for v1 — start with user-scoped.
  • --gameplan — per-invocation, would invite stale defaults.
  • --token — already env-driven via GITHUB_TOKEN; don't tempt people to commit secrets.

Implementation sketch

  1. Add a defaults record to lib_core/repo_config.ml (all fields optional).
  2. In bin/main.ml flag resolution, change each Arg.value (... ~default:hardcoded) to consult the loaded config first.
  3. Tests: a property that CLI flags still win over config; that missing config keys fall back to the existing hardcoded defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions