Skip to content

chore(cz-commitlint): allow inquirer v14 compatibility#4879

Open
taterhead247 wants to merge 1 commit into
conventional-changelog:masterfrom
taterhead247:chore/deps-inquirer-14
Open

chore(cz-commitlint): allow inquirer v14 compatibility#4879
taterhead247 wants to merge 1 commit into
conventional-changelog:masterfrom
taterhead247:chore/deps-inquirer-14

Conversation

@taterhead247

@taterhead247 taterhead247 commented Jul 8, 2026

Copy link
Copy Markdown

Description

Update @commitlint/cz-commitlint for inquirer 14 compatibility while preserving existing prompt behavior.

Motivation and Context

@commitlint/cz-commitlint had a peer range capped at inquirer 12, which caused downstream dependency-management friction for projects using newer inquirer versions.

This change addresses that by:

  • extending the inquirer peer range to include v14
  • switching single-select question type from list to select (required by modern inquirer)
  • replacing direct dependence on strict inquirer question typings with package-local prompt interfaces so existing adapter behavior remains intact

Fixes #4877.

Usage examples

// commitlint.config.js
module.exports = {
  extends: ['@commitlint/config-conventional'],
};
npm i -D @commitlint/cz-commitlint commitizen inquirer@14
npm run commit

How Has This Been Tested?

  • pnpm build
  • pnpm test
  • local interactive smoke test via commitizen prompt:
    • stage a file
    • run pnpm --filter @commitlint/cz-commitlint exec git-cz
    • verify prompt flow and message generation

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have verified that any documentation examples I added/changed actually work.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • For a feature/bug fix, my commits follow the test-driven flow: a failing-test commit, then the implementation.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

chore(cz-commitlint): widen peer dependency to support inquirer v14

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Widen @commitlint/cz-commitlint peer dependency range to include inquirer@^14.
• Replace strict inquirer question/answer typings with new package-local
 PromptQuestion/PromptAnswers interfaces to decouple from inquirer's type surface.
• Change single-select question type from deprecated "list" to "select" for inquirer v14
 compatibility.
• Update README install instructions and devDependencies/lockfile to use inquirer@14.
Diagram

graph TD
  A["index.ts prompter()"] --> B["Process.ts"] --> C["Question.ts"] --> D["types.ts PromptQuestion/PromptAnswers"]
  B --> E["SectionHeader/Footer/Body.ts"] --> D
  B --> F[(inquirer v14 runtime)]
  D -.type contract.-> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep using inquirer's own exported types with conditional/union imports per version
  • ➕ Stays perfectly aligned with inquirer's actual types
  • ➕ No duplication of type definitions
  • ➖ Inquirer's type exports changed significantly across v9-v14, making a single import incompatible across the whole peer range
  • ➖ Would require complex conditional typing or multiple type-only branches
2. Drop TypeScript strictness and use 'any' for inquirer question objects
  • ➕ Trivial to implement, no new types needed
  • ➖ Loses compile-time safety on question shape (name, when, validate, etc.)
  • ➖ Makes future refactors more error-prone

Recommendation: Defining package-local PromptQuestion/PromptAnswers types instead of pinning to inquirer's exported types is the right call here: it avoids being locked into a single major version's type surface and keeps the package usable across inquirer 9 through 14 without runtime behavior changes, since only the subset of the shape actually used is modeled.

Files changed (12) +381 / -58

Enhancement (2) +33 / -12
Question.tsSwitch single-select type to 'select' and decouple from inquirer types +16/-12

Switch single-select type to 'select' and decouple from inquirer types

• Changes the default enumList question type from deprecated "list" to "select", moves ChoiceCollection typing inline into QuestionConfig.enumList, and replaces inquirer Answers/DistinctQuestion types with local PromptAnswers/PromptQuestion throughout the class.

@commitlint/cz-commitlint/src/Question.ts

types.tsAdd local PromptAnswers/PromptQuestion type definitions +17/-0

Add local PromptAnswers/PromptQuestion type definitions

• Introduces new PromptAnswers and PromptQuestion types that mirror the subset of inquirer's question/answer shape used by this package, decoupling internal typings from inquirer's exported types across major versions.

@commitlint/cz-commitlint/src/types.ts

Refactor (5) +20 / -20
Process.tsUse local prompt types instead of inquirer types +2/-2

Use local prompt types instead of inquirer types

• Replaces inquirer's Answers/DistinctQuestion type imports with package-local PromptAnswers/PromptQuestion types in the prompter function signature.

@commitlint/cz-commitlint/src/Process.ts

SectionBody.tsUse local prompt types in body section builder +3/-3

Use local prompt types in body section builder

• Replaces inquirer Answers/DistinctQuestion imports with local PromptAnswers/PromptQuestion types for question generation and message combination functions.

@commitlint/cz-commitlint/src/SectionBody.ts

SectionFooter.tsUse local prompt types in footer section builder +8/-8

Use local prompt types in footer section builder

• Replaces inquirer Answers/DistinctQuestion imports with local PromptAnswers/PromptQuestion types across footer question generation, conditional 'when' handlers, and message combination.

@commitlint/cz-commitlint/src/SectionFooter.ts

SectionHeader.tsUse local prompt types in header section builder +5/-5

Use local prompt types in header section builder

• Replaces inquirer Answers/DistinctQuestion imports with local PromptAnswers/PromptQuestion types in header question generation and message combination.

@commitlint/cz-commitlint/src/SectionHeader.ts

index.tsUse local prompt types in prompter entrypoint +2/-2

Use local prompt types in prompter entrypoint

• Replaces inquirer Answers/DistinctQuestion type imports with local PromptAnswers/PromptQuestion in the exported prompter function signature.

@commitlint/cz-commitlint/src/index.ts

Tests (2) +22 / -15
Process.test.tsReplace inquirer types with local Prompt types in tests +4/-4

Replace inquirer types with local Prompt types in tests

• Swaps imported inquirer Answers/DistinctQuestion types for the new local PromptAnswers/PromptQuestion types in mocks and factory functions.

@commitlint/cz-commitlint/src/Process.test.ts

Question.test.tsUpdate tests for select type and local prompt types +18/-11

Update tests for select type and local prompt types

• Updates expected question type from "list" to "select", replaces inquirer Answers/InputQuestionOptions typings with local PromptAnswers and a local QuestionWithTransformer helper type.

@commitlint/cz-commitlint/src/Question.test.ts

Documentation (1) +2 / -2
README.mdUpdate install instructions to inquirer@14 +2/-2

Update install instructions to inquirer@14

• Updates npm/yarn install examples to reference inquirer@14 instead of inquirer@9.

@commitlint/cz-commitlint/README.md

Other (2) +304 / -9
package.jsonWiden inquirer peer dependency and bump devDependency +3/-3

Widen inquirer peer dependency and bump devDependency

• Removes @types/inquirer devDependency, adds inquirer@^14.0.2 as devDependency, and widens the inquirer peerDependency range to include ^14.0.0.

@commitlint/cz-commitlint/package.json

pnpm-lock.yamlUpdate lockfile for inquirer v14 and related @inquirer/* packages +301/-6

Update lockfile for inquirer v14 and related @inquirer/* packages

• Removes @types/inquirer entry, adds inquirer@14.0.2 and its updated @inquirer/* dependency tree (ansi, core, checkbox, confirm, editor, expand, input, number, password, prompts, rawlist, search, select, type) plus new transitive deps like mute-stream@3.0.0 and fast-wrap-ansi.

pnpm-lock.yaml

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

The changed prompt path can break projects that use older inquirer versions still accepted by the peer range.

  • Enum prompts now emit select, but inquirer 9-12 expect list for the same prompt shape.
  • The new inquirer dependency has a higher Node floor than this package advertises.
  • The local type replacement is mostly mechanical, with no separate runtime bug identified.

@commitlint/cz-commitlint/src/Question.ts and @commitlint/cz-commitlint/package.json

Important Files Changed

Filename Overview
@commitlint/cz-commitlint/src/Question.ts Changes enum-backed single-select prompts to emit select, which is not compatible with older peers still allowed by the package.
@commitlint/cz-commitlint/package.json Adds inquirer 14 as a dev dependency and peer option, creating both prompt-type and Node engine compatibility concerns.
@commitlint/cz-commitlint/src/types.ts Adds local prompt and answer interfaces to avoid relying on inquirer type exports.
@commitlint/cz-commitlint/README.md Updates install examples to recommend inquirer 14.
pnpm-lock.yaml Refreshes lockfile entries for inquirer 14 and its transitive packages.

Reviews (1): Last reviewed commit: "chore: update inquirer to allow v14 (#48..." | Re-trigger Greptile

if (enumList && Array.isArray(enumList)) {
this._question = {
type: multipleSelectDefaultDelimiter ? "checkbox" : "list",
type: multipleSelectDefaultDelimiter ? "checkbox" : "select",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Select Type Breaks Older Peers

When a project uses a still-supported inquirer 9-12 peer, enum-backed prompts now send type: "select" directly to inquirer.prompt(). Those versions use list for single-select prompts, so commitizen can fail to render the prompt or fall back to free text for type and scope selections.

"devDependencies": {
"@types/inquirer": "^9.0.7",
"commitizen": "^4.2.4"
"commitizen": "^4.2.4",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Dependency Engine Exceeds Package Floor

inquirer@14.0.2 requires Node ^22.13.0, ^20.17.0, or >=23.5.0, while this package still advertises node >=22.12.0. A valid Node 22.12.0 install can satisfy @commitlint/cz-commitlint but fail when engine checks reach the new inquirer dependency or its transitive packages.

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (4) 📜 Skill insights (0)

Context used

Grey Divider


Action required

1. Still uses inquirer.prompt() 📎 Requirement gap ⚙ Maintainability
Description
The runtime still depends on an injected inquirer/inquirerIns instance and executes questions
via inquirer.prompt(questions), rather than migrating to @inquirer/prompts for sequential
prompting. This keeps internals coupled to a legacy inquirer instance and blocks the required
compliance migration away from legacy prompt execution.
Code

@commitlint/cz-commitlint/src/Process.ts[R20-26]

	rules: QualifiedRules,
	prompts: UserPromptConfig,
	inquirer: {
-		prompt(questions: DistinctQuestion[]): Promise<Answers>;
+		prompt(questions: PromptQuestion[]): Promise<PromptAnswers>;
	},
): Promise<string> {
	setRules(rules);
Evidence
PR Compliance ID 1 requires that runtime no longer calls inquirer.prompt(questions[]) and instead
uses @inquirer/prompts, yet the code continues to type the dependency as an object exposing a
prompt(...) method and invokes inquirer.prompt(questions) during execution. PR Compliance ID 5
further requires that internals do not require the passed inquirer instance to function, but the
prompter signature still mandates an object with .prompt(...) and threads it into process(...),
demonstrating continued runtime reliance on the injected instance.

Migrate @commitlint/cz-commitlint prompt execution from inquirer.prompt to @inquirer/prompts with UX/output parity
@commitlint/cz-commitlint/src/Process.ts[19-34]
@commitlint/cz-commitlint/src/index.ts[13-21]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The adapter and processing flow still rely on a passed `inquirerIns`/`inquirer` instance (via a required `.prompt(...)` method) and execute prompts through `inquirer.prompt(questions)`, instead of using `@inquirer/prompts` for sequential prompting; this violates compliance requirements to remove legacy inquirer prompt execution while also decoupling internals from the injected inquirer instance.

## Issue Context
Compliance requires (1) eliminating runtime calls to `inquirer.prompt(questions[])` in favor of `@inquirer/prompts` while preserving the sequential flow/UX/output, and (2) keeping the external prompter contract stable (as expected by commitizen) while ensuring internals do not require the passed inquirer instance to function (it should be ignored or used only for signature compatibility).

## Fix Focus Areas
- @commitlint/cz-commitlint/src/Process.ts[19-34]
- @commitlint/cz-commitlint/src/index.ts[13-21]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Uses inquirer.Separator() 📎 Requirement gap ≡ Correctness
Description
Choice separators are still implemented via new inquirer.Separator() rather than adopting the
@inquirer/prompts Separator support required for select/checkbox prompts. This risks UX divergence
once prompt execution is migrated.
Code

@commitlint/cz-commitlint/src/Question.ts[R73-78]

		if (enumList && Array.isArray(enumList)) {
			this._question = {
-				type: multipleSelectDefaultDelimiter ? "checkbox" : "list",
+				type: multipleSelectDefaultDelimiter ? "checkbox" : "select",
				choices: skip
					? [
							...enumList,
Evidence
PR Compliance ID 4 requires separator behavior to be preserved using @inquirer/prompts Separator
support. The question builder still constructs separators with new inquirer.Separator() in the
select/checkbox choices list.

Preserve separator/choice UX by adopting @inquirer/prompts Separator support
@commitlint/cz-commitlint/src/Question.ts[73-86]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Separators are still created with `inquirer.Separator()` instead of the equivalent Separator supported by `@inquirer/prompts`.

## Issue Context
Compliance requires preserving separator/choice UX while moving to `@inquirer/prompts`.

## Fix Focus Areas
- @commitlint/cz-commitlint/src/Question.ts[73-86]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Docs still require inquirer 📎 Requirement gap ⚙ Maintainability
Description
Documentation continues to instruct users to install inquirer as the required peer dependency
rather than reflecting a @inquirer/prompts-based prompt engine. This conflicts with the
requirement to update docs away from legacy inquirer guidance.
Code

@commitlint/cz-commitlint/README.md[R16-19]

+npm install --save-dev @commitlint/cz-commitlint commitizen inquirer@14 # inquirer is required as peer dependency
# or yarn
-yarn add -D @commitlint/cz-commitlint commitizen inquirer@9             # inquirer is required as peer dependency
+yarn add -D @commitlint/cz-commitlint commitizen inquirer@14            # inquirer is required as peer dependency
</details>
Evidence
PR Compliance ID 6 requires updating README guidance to reflect the new prompt engine and to stop
explicitly recommending legacy inquirer. The README still instructs installing inquirer@14 and
states it is required as a peer dependency.

Remove legacy inquirer peer dependency cap and update dependencies/docs for @inquirer/prompts
@commitlint/cz-commitlint/README.md[15-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
README installation/usage guidance still explicitly requires `inquirer` as a peer dependency, instead of reflecting `@inquirer/prompts` after migration.

## Issue Context
Compliance requires updating dependencies/docs to reflect the new prompt engine and removing explicit legacy inquirer recommendations.

## Fix Focus Areas
- @commitlint/cz-commitlint/README.md[15-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
4. No @inquirer/prompts dependency 📎 Requirement gap ⚙ Maintainability
Description
The package still declares inquirer as a peer dependency and does not add a direct dependency on
@inquirer/prompts as required by the migration plan. This keeps consumers coupled to inquirer
rather than the intended prompt engine.
Code

@commitlint/cz-commitlint/package.json[R45-52]

  "devDependencies": {
-    "@types/inquirer": "^9.0.7",
-    "commitizen": "^4.2.4"
+    "commitizen": "^4.2.4",
+    "inquirer": "^14.0.2"
  },
  "peerDependencies": {
    "commitizen": "^4.0.3",
-    "inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
+    "inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^14.0.0"
  },
Evidence
PR Compliance ID 6 requires adding/updating @inquirer/prompts dependencies and removing
unnecessary inquirer peer constraints. The updated package.json still lists inquirer in
peerDependencies and devDependencies and contains no direct @inquirer/prompts dependency.

Remove legacy inquirer peer dependency cap and update dependencies/docs for @inquirer/prompts
@commitlint/cz-commitlint/package.json[45-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The package is still centered on `inquirer` (peer + dev dependency) and does not declare `@inquirer/prompts` as required.

## Issue Context
Compliance requires adding/updating `@inquirer/prompts` and removing the legacy peer dependency constraint once migration is complete.

## Fix Focus Areas
- @commitlint/cz-commitlint/package.json[45-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Select prompt peer mismatch 🐞 Bug ≡ Correctness
Description
Question now emits type: "select" for single-choice enum questions, but the package still
declares peer compatibility with inquirer ^9^12. Without a fallback/mapping, installs using
those still-allowed peer versions may fail at runtime due to an unsupported question type.
Code

@commitlint/cz-commitlint/src/Question.ts[75]

+				type: multipleSelectDefaultDelimiter ? "checkbox" : "select",
Evidence
The code constructs enum questions using select, while the package still advertises peer support
for inquirer 9–12, creating a contract/behavior mismatch.

@commitlint/cz-commitlint/src/Question.ts[73-86]
@commitlint/cz-commitlint/package.json[49-52]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`@commitlint/cz-commitlint` now generates enum questions with `type: "select"`, but the peer dependency range still includes inquirer majors that may not support that question type. This creates a runtime compatibility gap relative to the declared peer contract.

## Issue Context
The adapter constructs question objects in `Question` (no access to the passed-in `inquirerIns`), so any compatibility logic must either:
- avoid version-specific question type strings, or
- narrow the supported peer range to match the implementation, or
- restructure question building to allow using the runtime inquirer instance to select an appropriate type.

## Fix Focus Areas
- @commitlint/cz-commitlint/src/Question.ts[73-86]
- @commitlint/cz-commitlint/package.json[49-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

6. Node engine floor mismatch 🐞 Bug ☼ Reliability
Description
The package engine allows Node >=22.12.0, but the newly added devDependency inquirer@14.0.2
requires Node ^22.13.0 (or newer) per the lockfile. Installs/tests run on Node 22.12.x (allowed by
this package) can fail due to dependency engine constraints.
Code

@commitlint/cz-commitlint/package.json[R46-48]

+    "commitizen": "^4.2.4",
+    "inquirer": "^14.0.2"
  },
Evidence
The package explicitly permits Node 22.12.x, but the lockfile shows the newly introduced
inquirer@14.0.2 enforces Node ^22.13.0+, creating a real install-time mismatch.

@commitlint/cz-commitlint/package.json[45-61]
pnpm-lock.yaml[3680-3683]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`@commitlint/cz-commitlint` adds `inquirer@^14.0.2` as a devDependency, but `inquirer@14.0.2` requires Node `^22.13.0` while the package advertises `>=22.12.0`. This can break `pnpm install`/CI in environments on 22.12.x.

## Issue Context
The repository/package engines currently permit Node 22.12.x; adding a devDependency with a stricter engine effectively tightens the real supported Node range for contributors/CI.

## Fix Focus Areas
- @commitlint/cz-commitlint/package.json[45-61]
- pnpm-lock.yaml[3680-3683]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines 20 to 26
rules: QualifiedRules,
prompts: UserPromptConfig,
inquirer: {
prompt(questions: DistinctQuestion[]): Promise<Answers>;
prompt(questions: PromptQuestion[]): Promise<PromptAnswers>;
},
): Promise<string> {
setRules(rules);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Still uses inquirer.prompt() 📎 Requirement gap ⚙ Maintainability

The runtime still depends on an injected inquirer/inquirerIns instance and executes questions
via inquirer.prompt(questions), rather than migrating to @inquirer/prompts for sequential
prompting. This keeps internals coupled to a legacy inquirer instance and blocks the required
compliance migration away from legacy prompt execution.
Agent Prompt
## Issue description
The adapter and processing flow still rely on a passed `inquirerIns`/`inquirer` instance (via a required `.prompt(...)` method) and execute prompts through `inquirer.prompt(questions)`, instead of using `@inquirer/prompts` for sequential prompting; this violates compliance requirements to remove legacy inquirer prompt execution while also decoupling internals from the injected inquirer instance.

## Issue Context
Compliance requires (1) eliminating runtime calls to `inquirer.prompt(questions[])` in favor of `@inquirer/prompts` while preserving the sequential flow/UX/output, and (2) keeping the external prompter contract stable (as expected by commitizen) while ensuring internals do not require the passed inquirer instance to function (it should be ignored or used only for signature compatibility).

## Fix Focus Areas
- @commitlint/cz-commitlint/src/Process.ts[19-34]
- @commitlint/cz-commitlint/src/index.ts[13-21]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 73 to 78
if (enumList && Array.isArray(enumList)) {
this._question = {
type: multipleSelectDefaultDelimiter ? "checkbox" : "list",
type: multipleSelectDefaultDelimiter ? "checkbox" : "select",
choices: skip
? [
...enumList,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

2. Uses inquirer.separator() 📎 Requirement gap ≡ Correctness

Choice separators are still implemented via new inquirer.Separator() rather than adopting the
@inquirer/prompts Separator support required for select/checkbox prompts. This risks UX divergence
once prompt execution is migrated.
Agent Prompt
## Issue description
Separators are still created with `inquirer.Separator()` instead of the equivalent Separator supported by `@inquirer/prompts`.

## Issue Context
Compliance requires preserving separator/choice UX while moving to `@inquirer/prompts`.

## Fix Focus Areas
- @commitlint/cz-commitlint/src/Question.ts[73-86]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +16 to 19
npm install --save-dev @commitlint/cz-commitlint commitizen inquirer@14 # inquirer is required as peer dependency
# or yarn
yarn add -D @commitlint/cz-commitlint commitizen inquirer@9 # inquirer is required as peer dependency
yarn add -D @commitlint/cz-commitlint commitizen inquirer@14 # inquirer is required as peer dependency
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Docs still require inquirer 📎 Requirement gap ⚙ Maintainability

Documentation continues to instruct users to install inquirer as the required peer dependency
rather than reflecting a @inquirer/prompts-based prompt engine. This conflicts with the
requirement to update docs away from legacy inquirer guidance.
Agent Prompt
## Issue description
README installation/usage guidance still explicitly requires `inquirer` as a peer dependency, instead of reflecting `@inquirer/prompts` after migration.

## Issue Context
Compliance requires updating dependencies/docs to reflect the new prompt engine and removing explicit legacy inquirer recommendations.

## Fix Focus Areas
- @commitlint/cz-commitlint/README.md[15-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 45 to 52
"devDependencies": {
"@types/inquirer": "^9.0.7",
"commitizen": "^4.2.4"
"commitizen": "^4.2.4",
"inquirer": "^14.0.2"
},
"peerDependencies": {
"commitizen": "^4.0.3",
"inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
"inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^14.0.0"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

4. No @inquirer/prompts dependency 📎 Requirement gap ⚙ Maintainability

The package still declares inquirer as a peer dependency and does not add a direct dependency on
@inquirer/prompts as required by the migration plan. This keeps consumers coupled to inquirer
rather than the intended prompt engine.
Agent Prompt
## Issue description
The package is still centered on `inquirer` (peer + dev dependency) and does not declare `@inquirer/prompts` as required.

## Issue Context
Compliance requires adding/updating `@inquirer/prompts` and removing the legacy peer dependency constraint once migration is complete.

## Fix Focus Areas
- @commitlint/cz-commitlint/package.json[45-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

if (enumList && Array.isArray(enumList)) {
this._question = {
type: multipleSelectDefaultDelimiter ? "checkbox" : "list",
type: multipleSelectDefaultDelimiter ? "checkbox" : "select",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

5. Select prompt peer mismatch 🐞 Bug ≡ Correctness

Question now emits type: "select" for single-choice enum questions, but the package still
declares peer compatibility with inquirer ^9^12. Without a fallback/mapping, installs using
those still-allowed peer versions may fail at runtime due to an unsupported question type.
Agent Prompt
## Issue description
`@commitlint/cz-commitlint` now generates enum questions with `type: "select"`, but the peer dependency range still includes inquirer majors that may not support that question type. This creates a runtime compatibility gap relative to the declared peer contract.

## Issue Context
The adapter constructs question objects in `Question` (no access to the passed-in `inquirerIns`), so any compatibility logic must either:
- avoid version-specific question type strings, or
- narrow the supported peer range to match the implementation, or
- restructure question building to allow using the runtime inquirer instance to select an appropriate type.

## Fix Focus Areas
- @commitlint/cz-commitlint/src/Question.ts[73-86]
- @commitlint/cz-commitlint/package.json[49-52]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +46 to 48
"commitizen": "^4.2.4",
"inquirer": "^14.0.2"
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

6. Node engine floor mismatch 🐞 Bug ☼ Reliability

The package engine allows Node >=22.12.0, but the newly added devDependency inquirer@14.0.2
requires Node ^22.13.0 (or newer) per the lockfile. Installs/tests run on Node 22.12.x (allowed by
this package) can fail due to dependency engine constraints.
Agent Prompt
## Issue description
`@commitlint/cz-commitlint` adds `inquirer@^14.0.2` as a devDependency, but `inquirer@14.0.2` requires Node `^22.13.0` while the package advertises `>=22.12.0`. This can break `pnpm install`/CI in environments on 22.12.x.

## Issue Context
The repository/package engines currently permit Node 22.12.x; adding a devDependency with a stricter engine effectively tightens the real supported Node range for contributors/CI.

## Fix Focus Areas
- @commitlint/cz-commitlint/package.json[45-61]
- pnpm-lock.yaml[3680-3683]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates @commitlint/cz-commitlint to work with modern Inquirer (v14), aiming to preserve the existing Commitizen prompt flow while loosening the previously capped peer dependency range.

Changes:

  • Extend inquirer peer dependency range and add inquirer@14 to devDependencies for local testing.
  • Update single-select prompt type from list to select and decouple from strict Inquirer question typings via package-local prompt interfaces.
  • Update docs and tests to reflect the new prompt model and Inquirer version guidance.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-lock.yaml Locks inquirer@14.0.2 and related @inquirer/* packages.
@commitlint/cz-commitlint/src/types.ts Introduces package-local PromptQuestion / PromptAnswers types to avoid strict Inquirer typings.
@commitlint/cz-commitlint/src/SectionHeader.ts Switches section question typing from Inquirer types to package-local prompt types.
@commitlint/cz-commitlint/src/SectionBody.ts Switches section question typing from Inquirer types to package-local prompt types.
@commitlint/cz-commitlint/src/SectionFooter.ts Switches section question typing from Inquirer types to package-local prompt types.
@commitlint/cz-commitlint/src/Question.ts Changes single-select question type from list to select and updates typing imports.
@commitlint/cz-commitlint/src/Question.test.ts Updates tests to expect select and removes reliance on Inquirer TS types.
@commitlint/cz-commitlint/src/Process.ts Updates prompt/answers typing to the package-local model.
@commitlint/cz-commitlint/src/Process.test.ts Updates mocked prompt typing to the package-local model.
@commitlint/cz-commitlint/src/index.ts Updates prompt/answers typing for the Commitizen adapter entrypoint.
@commitlint/cz-commitlint/README.md Updates installation instructions to recommend inquirer@14.
@commitlint/cz-commitlint/package.json Adds inquirer@^14.0.2 devDependency and expands the inquirer peer range.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (1)

@commitlint/cz-commitlint/src/Question.ts:80

  • Question now emits { type: "select" } for single-choice enum prompts, but inquirer versions <=12 (still allowed by this package's peer range) don't support the select prompt type (they use list). This will cause runtime failures for consumers on inquirer 9–12. Either add a version/feature-detection fallback (list for legacy inquirer, select for modern), or narrow the supported peer range to inquirer >=13 so the runtime behavior matches the contract.
		if (enumList && Array.isArray(enumList)) {
			this._question = {
				type: multipleSelectDefaultDelimiter ? "checkbox" : "select",
				choices: skip
					? [
							...enumList,
							new inquirer.Separator(),
							{

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 49 to 52
"peerDependencies": {
"commitizen": "^4.0.3",
"inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0"
"inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^14.0.0"
},
Comment on lines 45 to 48
"devDependencies": {
"@types/inquirer": "^9.0.7",
"commitizen": "^4.2.4"
"commitizen": "^4.2.4",
"inquirer": "^14.0.2"
},
Comment on lines 13 to 16
export function prompter(
inquirerIns: {
prompt(questions: DistinctQuestion[]): Promise<Answers>;
prompt(questions: PromptQuestion[]): Promise<PromptAnswers>;
},
@escapedcat

Copy link
Copy Markdown
Member

Thanks!
Please have a look at the AI feedback. Check if it's valid and tackle it or comment why it's not valid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Migrate @commitlint/cz-commitlint to @inquirer/prompts to remove inquirer v12 peer cap

3 participants