← Back to PRs

#22462: CLI: add config path subcommand to print active config file path

by cyb1278588254 open 2026-02-21 06:13 View on GitHub →
cli size: XS
## Summary - **Problem:** Users and scripts need to know where the active config file lives (e.g. for backup or tooling). - **What changed:** Added `openclaw config path` subcommand. By default it prints the path with home shortened (`~/.openclaw/openclaw.json`); use `--absolute` for the full path (e.g. for scripts). - **What did NOT change:** No change to config loading, get/set/unset, or setup wizard. ## Change Type - [x] Feature ## Scope - [x] API / contracts (CLI) ## User-visible / Behavior Changes - New command: `openclaw config path` and `openclaw config path --absolute`. ## Security Impact - New permissions/capabilities? **No** - Secrets/tokens handling changed? **No** - New/changed network calls? **No** - Command/tool execution surface changed? **No** (new read-only CLI subcommand) - Data access scope changed? **No** ## Verification - `pnpm test src/cli/config-cli.test.ts` passes. - Manually: `openclaw config path` and `openclaw config path --absolute` print the expected path. <!-- greptile_comment --> <h3>Greptile Summary</h3> Added `openclaw config path` subcommand to display the active config file location. The command prints the path with home directory shortened by default (`~/.openclaw/openclaw.json`) or as an absolute path when `--absolute` flag is used. Implementation is straightforward and well-tested. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with no identified risks - The implementation is minimal and focused, adding only a read-only utility command. The code follows existing patterns in the codebase (using `resolveConfigPath()` and `shortenHomePath()`), includes comprehensive tests, and introduces no behavioral changes to existing functionality. - No files require special attention <sub>Last reviewed commit: 2eb4340</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs