Title: feat: add cz dump-config command to output effective configuration by bearomorphism · Pull Request #1986 · commitizen-tools/commitizen · GitHub
Open Graph Title: feat: add cz dump-config command to output effective configuration by bearomorphism · Pull Request #1986 · commitizen-tools/commitizen
X Title: feat: add cz dump-config command to output effective configuration by bearomorphism · Pull Request #1986 · commitizen-tools/commitizen
Description: Description Adds a new cz dump-config command that prints the effective Commitizen configuration (defaults merged with any project overrides) in TOML, YAML, or JSON format. Users can paste the output directly into a configuration file as a starting template and tweak from there — which is exactly the use-case raised in #1331. Why Users working with monorepos or custom commit conventions (like the reporter in #1331) struggle because overriding a single setting (e.g. customize.questions) replaces the entire default. There was no way to see the full effective config without reading source code. cz dump-config solves this by exposing the merged settings. What changed Area Change commitizen/commands/dump_config.py New DumpConfig command class commitizen/commands/__init__.py Export DumpConfig commitizen/cli.py Register dump-config subparser with --format argument tests/commands/test_dump_config_command.py New tests for all three formats tests/commands/test_common_command.py Add dump-config to help-snapshot parametrize list tests/commands/test_common_command/ Help snapshot files for py 3.10–3.14 docs/commands/dump_config.md Command documentation mkdocs.yml Add dump-config to nav How it works DumpConfig.__call__() reads config.settings (a Settings TypedDict containing defaults merged with user config). For TOML (default): None values are filtered out (TOML cannot represent null), then the dict is wrapped in a [tool.commitizen] section and serialised with tomlkit.dumps(). For YAML: the dict (with None values preserved as null) is wrapped in tool.commitizen and serialised with yaml.safe_dump(). For JSON: same wrapping, serialised with json.dumps(indent=2). All three formats mirror the input structure so the output can be pasted directly into pyproject.toml, .cz.yaml, or .cz.json. Backward compatibility Purely additive — new subcommand only. No existing commands, APIs, or config keys changed. Checklist I have read the contributing guidelines Was generative AI tooling used to co-author this PR? Yes (please specify the tool below) Generated-by: GitHub Copilot CLI following the guidelines Code Changes Add test cases to all the changes you introduce Run uv run poe all locally to ensure this change passes linter check and tests Manually test the changes: Verify the feature/bug fix works as expected in real-world scenarios Test edge cases and error conditions Ensure backward compatibility is maintained Document any manual testing steps performed Update the documentation for the changes Documentation Changes Added docs/commands/dump_config.md Updated mkdocs.yml nav Expected Behavior Command Expected output cz dump-config TOML block under [tool.commitizen] with effective settings (no null values) cz dump-config --format yaml YAML block under tool.commitizen with effective settings cz dump-config --format json JSON object {"tool": {"commitizen": {...}}} Steps to Test This Pull Request # 1. Install the branch git checkout feat/1331-dump-config-command # 2. Dump default config as TOML cz dump-config # Expected: [tool.commitizen] block with name = "cz_conventional_commits" etc. # 3. Dump as YAML cz dump-config --format yaml # Expected: tool:\n commitizen:\n name: cz_conventional_commits ... # 4. Dump as JSON cz dump-config --format json # Expected: {"tool": {"commitizen": {"name": "cz_conventional_commits", ...}}} # 5. Verify no null values in TOML output cz dump-config | grep -i null # Expected: no output (null values are filtered) # 6. Round-trip test: dump → paste → compare cz dump-config > /tmp/dumped.toml # Verify the file is valid TOML: python -c "import tomlkit; tomlkit.loads(open('/tmp/dumped.toml').read())" Additional Context Closes #1331. The maintainer suggested this could be layered on top of cz init (#1331 comment), but a standalone cz dump-config is cleaner and more composable (pipe to a file, diff against a known config, etc.).
Open Graph Description: Description Adds a new cz dump-config command that prints the effective Commitizen configuration (defaults merged with any project overrides) in TOML, YAML, or JSON format. Users can paste the outp...
X Description: Description Adds a new cz dump-config command that prints the effective Commitizen configuration (defaults merged with any project overrides) in TOML, YAML, or JSON format. Users can paste the outp...
Opengraph URL: https://github.com/commitizen-tools/commitizen/pull/1986
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:d17ca4f8-2214-9227-0769-a0bdc22e2894 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A75E:7FD8A:7725DD:A2BBCB:6A4DD603 |
| html-safe-nonce | 290de956093077c62938499356d1e7e7eeb634cff5150afeb3b883e55a7894b3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzVFOjdGRDhBOjc3MjVERDpBMkJCQ0I6NkE0REQ2MDMiLCJ2aXNpdG9yX2lkIjoiMzI2MjQ1MjA4NzQ2ODcwOTM3OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4fad3ef35021b87d7b9b177328c3d0288ff639a54ccbdeb71e8ebb74e83fc3f8 |
| hovercard-subject-tag | pull_request:3655060645 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/commitizen-tools/commitizen/pull/1986/files |
| twitter:image | https://avatars.githubusercontent.com/u/26526132?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/26526132?s=400&v=4 |
| og:image:alt | Description Adds a new cz dump-config command that prints the effective Commitizen configuration (defaults merged with any project overrides) in TOML, YAML, or JSON format. Users can paste the outp... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width