feat: add persistent CLI config defaults#681
feat: add persistent CLI config defaults#681elliotllliu wants to merge 3 commits intovercel-labs:mainfrom
Conversation
Adds a `skills config` command to persist CLI flags like `-g`, `-y`, `--copy`, `--json`, and `--agent` across invocations. Config is stored in `~/.skills/config.json` and automatically merged as defaults for add, remove, list, check, and sync commands. Explicit CLI flags always override config defaults. Usage: skills config set global true # always install globally skills config set yes true # skip prompts by default skills config set agent claude-code cursor skills config set json true # default JSON output skills config unset global # remove a default skills config list # show current config skills config path # show config file location Closes vercel-labs#678
|
Thanks! Current impl stores config in ~/.skills/config.json which works, but a more idiomatic approach per platform would be:
Some libraries like env-paths handles all three platforms automatically and is already popular in the node ecosystem, might be worth the one-liner dependency to get this right without reinventing it. The skills install paths themselves are already a bit of a wild west ( ~/.skills/ , ~/.agents/ , per-agent dirs, etc.). But the CLI binary's own config is a clean slate, and it's worth getting the convention right from the start. |
Follow platform conventions for config file location: - Linux: $XDG_CONFIG_HOME/skills/config.json (fallback ~/.config/skills/) - macOS: ~/Library/Application Support/skills/config.json - Windows: %APPDATA%\skills\config.json Keeps $HOME clean per XDG base directory spec on Linux. Dependency-free using process.platform detection. Co-authored-by: DaVinci42
|
Good point! Updated in 504a0e3 to use platform-idiomatic paths:
Kept it dependency-free using Thanks for the suggestion! |
Summary
Closes #678 — adds a
skills configcommand to persist CLI flags across invocations.Problem
Users who frequently use flags like
-y,-g,--agent,--copy, and--jsonhave to re-enter them for every command, which is tedious and error-prone.Solution
A simple config system stored in
~/.skills/config.json:Config defaults are automatically merged into
add,remove,list,check, andsynccommands. Explicit CLI flags always take precedence over config defaults.Changes
src/config.ts: New module —loadConfig(),saveConfig(),runConfig()with validation for known keyssrc/cli.ts: Import config, addconfigcommand, merge defaults into each command's options before executionDesign Decisions
~/.skills/config.json— simple, human-readable, easy to edit manuallyglobal,yes,copy,json,agent)