Configuration file support
Why it matters
Without a config file, users must pass --api-key, --format, --output-dir, and --region on every single invocation. That friction drives them toward shell aliases that are fragile, .env files that aren't portable, and wrapper scripts that become undocumented infrastructure. ISO 25010:2011 usability.operability scores CLIs on whether persistent preferences can be set once and forgotten. A CLI that requires 6 flags per invocation is not operationally usable in real workflows — teams will script around it rather than into it, breaking the tool's intended composability.
Severity rationale
Medium because the absence of config file support imposes per-invocation repetition that degrades usability in team workflows without causing data loss or security failures.
Remediation
Add config file discovery using cosmiconfig (Node.js) or a standard ~/.config location (Python/Go). CLI flags must always override config file values:
import { cosmiconfig } from 'cosmiconfig'
const explorer = cosmiconfig('mytool')
const result = await explorer.search() // finds .mytoolrc, mytool.config.js, etc.
const fileConfig = result?.config ?? {}
// CLI flags override config — spread order matters
const config = { ...fileConfig, ...cliFlags }
import tomllib
from pathlib import Path
def load_config() -> dict:
for loc in [Path('mytool.toml'), Path.home() / '.config' / 'mytool' / 'config.toml']:
if loc.exists():
with open(loc, 'rb') as f:
return tomllib.load(f)
return {} # no config file is not an error
Document which config file locations are checked in --help output or a mytool config --locations subcommand.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the CLI Quality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · usability.operability — Usability — Operability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from cli-quality·automated