Summary
@commitlint/cz-commitlint currently constrains inquirer to ^9 || ^10 || ^11 || ^12, which blocks downstream repos from upgrading their workspace inquirer reference to v13+ while using this adapter.
This issue documents:
- what was verified,
- why downstream installs are blocked,
- and the planned migration path from legacy
inquirer APIs to @inquirer/prompts for @commitlint/cz-commitlint.
Verified Findings
1) Current peer dependency cap in @commitlint/cz-commitlint
In @commitlint/cz-commitlint/package.json, peer deps currently include:
inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
This is the direct compatibility cap for consumers using newer inquirer majors.
2) inquirerIns in prompter() is not truly “unused” today
Code comment says:
@param inquirerIns instance passed by commitizen, unused
But code currently passes it through and calls .prompt(...):
src/index.ts passes inquirerIns to process(...)
src/Process.ts does await inquirer.prompt(questions)
So this comment is stale/misleading. More accurate wording: only the prompt function shape is used, not the full inquirer API surface.
Why migrate to @inquirer/prompts
The legacy monolithic inquirer package is still maintained but is not the actively developed API surface. @inquirer/prompts is the modern prompt API and supports progressive adoption patterns.
Migrating @commitlint/cz-commitlint to @inquirer/prompts would remove the tight coupling to old inquirer question typings (DistinctQuestion, Answers, etc.) and avoid the peer cap mismatch for consumers.
Proposed Migration Plan (PR scope)
Goal
Migrate only @commitlint/cz-commitlint prompt execution path from inquirer.prompt(questions[]) to @inquirer/prompts while preserving current UX and output behavior.
Key implementation strategy
- Introduce a package-local prompt model
- Replace direct
inquirer runtime/type coupling in src/Question.ts, src/Process.ts, section builders, and tests.
- Keep existing validation/filter/transformation semantics.
- Replace prompt engine
- Map old prompt types to modern prompts:
input -> input
list -> select
checkbox -> checkbox
confirm -> confirm
- Preserve conditional
when behavior and sequential flow currently provided by array-based .prompt(...).
- Preserve separator/choice UX
- Current code uses
new inquirer.Separator() in enum flows.
@inquirer/prompts supports Separator in select / checkbox; adopt equivalent usage.
- Keep Commitizen adapter contract stable
- Exported
prompter(...) API should remain compatible for users invoking through commitizen.
- Internally, parameter can be ignored or kept for signature compatibility during transition.
- Update dependencies/docs
- Remove old inquirer peer constraint from
@commitlint/cz-commitlint once no longer needed.
- Add/update deps for
@inquirer/prompts.
- Update adapter README install guidance that currently recommends legacy
inquirer explicitly.
File areas expected to change
@commitlint/cz-commitlint/package.json
@commitlint/cz-commitlint/src/index.ts
@commitlint/cz-commitlint/src/Process.ts
@commitlint/cz-commitlint/src/Question.ts
@commitlint/cz-commitlint/src/SectionHeader.ts
@commitlint/cz-commitlint/src/SectionBody.ts
@commitlint/cz-commitlint/src/SectionFooter.ts
@commitlint/cz-commitlint/src/*.test.ts
@commitlint/cz-commitlint/README.md
Testing Plan
- Unit parity
- Ensure existing tests around:
- required/optional fields,
- max/min validations,
- case/full-stop filters,
- conditional footer/body prompts,
- combined commit message output
continue to pass or are updated with equivalent expectations.
- Integration smoke
- run commitizen flow against adapter in this repo and validate resulting commit messages remain unchanged for canonical cases.
- Downstream verification (optional but useful)
- locally test a consumer workspace with
inquirer v13+ and @commitlint/cz-commitlint from branch/release candidate.
Risk Areas
- Small UX differences between old and new prompt renderers (especially transformer rendering and list behavior).
- Test harness changes required because current tests mock inquirer question object execution.
- Potential need to keep backward-compatible adapter entry signature while decoupling runtime from inquirer.
Non-goals
- Full migration of other commitlint packages (
@commitlint/prompt, @commitlint/prompt-cli, etc.) in the same change.
- Broad prompt feature redesign.
Expected Outcome
After this migration, downstream repositories should no longer be blocked by @commitlint/cz-commitlint’s legacy peer range when upgrading their inquirer-related toolchain.
If maintainers are open to this direction, I can follow up with a PR scoped exactly to @commitlint/cz-commitlint and keep the change narrowly focused on parity + compatibility.
Summary
@commitlint/cz-commitlintcurrently constrainsinquirerto^9 || ^10 || ^11 || ^12, which blocks downstream repos from upgrading their workspaceinquirerreference to v13+ while using this adapter.This issue documents:
inquirerAPIs to@inquirer/promptsfor@commitlint/cz-commitlint.Verified Findings
1) Current peer dependency cap in
@commitlint/cz-commitlintIn
@commitlint/cz-commitlint/package.json, peer deps currently include:inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"This is the direct compatibility cap for consumers using newer
inquirermajors.2)
inquirerInsinprompter()is not truly “unused” todayCode comment says:
But code currently passes it through and calls
.prompt(...):src/index.tspassesinquirerInstoprocess(...)src/Process.tsdoesawait inquirer.prompt(questions)So this comment is stale/misleading. More accurate wording: only the prompt function shape is used, not the full inquirer API surface.
Why migrate to
@inquirer/promptsThe legacy monolithic
inquirerpackage is still maintained but is not the actively developed API surface.@inquirer/promptsis the modern prompt API and supports progressive adoption patterns.Migrating
@commitlint/cz-commitlintto@inquirer/promptswould remove the tight coupling to oldinquirerquestion typings (DistinctQuestion,Answers, etc.) and avoid the peer cap mismatch for consumers.Proposed Migration Plan (PR scope)
Goal
Migrate only
@commitlint/cz-commitlintprompt execution path frominquirer.prompt(questions[])to@inquirer/promptswhile preserving current UX and output behavior.Key implementation strategy
inquirerruntime/type coupling insrc/Question.ts,src/Process.ts, section builders, and tests.input->inputlist->selectcheckbox->checkboxconfirm->confirmwhenbehavior and sequential flow currently provided by array-based.prompt(...).new inquirer.Separator()in enum flows.@inquirer/promptssupportsSeparatorinselect/checkbox; adopt equivalent usage.prompter(...)API should remain compatible for users invoking through commitizen.@commitlint/cz-commitlintonce no longer needed.@inquirer/prompts.inquirerexplicitly.File areas expected to change
@commitlint/cz-commitlint/package.json@commitlint/cz-commitlint/src/index.ts@commitlint/cz-commitlint/src/Process.ts@commitlint/cz-commitlint/src/Question.ts@commitlint/cz-commitlint/src/SectionHeader.ts@commitlint/cz-commitlint/src/SectionBody.ts@commitlint/cz-commitlint/src/SectionFooter.ts@commitlint/cz-commitlint/src/*.test.ts@commitlint/cz-commitlint/README.mdTesting Plan
continue to pass or are updated with equivalent expectations.
inquirerv13+ and@commitlint/cz-commitlintfrom branch/release candidate.Risk Areas
Non-goals
@commitlint/prompt,@commitlint/prompt-cli, etc.) in the same change.Expected Outcome
After this migration, downstream repositories should no longer be blocked by
@commitlint/cz-commitlint’s legacy peer range when upgrading their inquirer-related toolchain.If maintainers are open to this direction, I can follow up with a PR scoped exactly to
@commitlint/cz-commitlintand keep the change narrowly focused on parity + compatibility.