Skip to content

fix(prompts): replace removed inquirer "list" prompt type with "select"#406

Merged
rhuanbarreto merged 2 commits into
mainfrom
fix/inquirer-v14-select-prompt-type
Jun 11, 2026
Merged

fix(prompts): replace removed inquirer "list" prompt type with "select"#406
rhuanbarreto merged 2 commits into
mainfrom
fix/inquirer-v14-select-prompt-type

Conversation

@rhuanbarreto

@rhuanbarreto rhuanbarreto commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

archgate login signup (and four other interactive flows) crashed at runtime with:

error: Prompt type "list" is not registered. Available prompt types: checkbox, confirm, editor, expand, input, number, password, rawlist, search, select

inquirer v14 (the @inquirer/prompts rewrite) removed the legacy "list" prompt type — it was renamed "select" in v10. Five call sites still used it after the dependency bump.

Fix

  • Replace type: "list" with type: "select" in login-flow.ts, editor-detect.ts, init.ts, adr/create.ts, adr/sync.ts.

Why nothing caught it

  • tsc cannot: inquirer's legacy prompt() types accept any type: string via the CustomQuestion escape hatch that exists for registerPrompt(). Verified empirically — type: "bogus-nonsense" compiles clean under strict mode.
  • Tests cannot: interactive prompts need a TTY, so every test mocks the inquirer module entirely (mock.module); the runtime prompt registry is never exercised.

Regression guard

New custom oxlint JS plugin .archgate/lint/oxlint.ts with rule archgate/valid-inquirer-prompt-type:

  • AST-based: validates type: string literals in inquirer.prompt() question objects (both prompt({...}) and prompt([{...}]) forms).
  • Self-updating: the registered set is read from the installed inquirer at plugin load (Object.keys(inquirer.prompt.prompts)) — no hardcoded allowlist. If a future inquirer version renames or removes a type again, stale call sites fail bun run lint directly in the dependency-bump PR.
  • Loud-fail guard: if the registry API shape ever changes, the plugin throws and fails the lint run instead of silently disabling itself.

Test plan

  • Red test: reintroducing type: "list" fails bun run lint with a span-precise diagnostic at login-flow.ts:135
  • bun run validate fully green (lint 0/0, typecheck, format, 1262 tests, archgate check 39/39, knip, build)

Summary by CodeRabbit

  • New Features

    • Enhanced interactive selection prompts across ADR creation, synchronization, initialization, editor detection, and login workflows with an improved user interface.
  • Chores

    • Added runtime validation for interactive prompt configurations to ensure configuration integrity across the application.

inquirer v14 (the @inquirer/prompts rewrite) removed the legacy "list"
prompt type (renamed "select" in v10). Five call sites still used it,
crashing interactive flows at runtime with 'Prompt type "list" is not
registered' — notably the signup prompt during `archgate login`.

Nothing in the pipeline could catch this class of bug:
- tsc cannot: inquirer's legacy prompt() types accept any `type: string`
  via the CustomQuestion escape hatch that exists for registerPrompt()
  (verified: `type: "bogus-nonsense"` compiles clean under strict mode)
- tests cannot: interactive prompts need a TTY, so every test mocks the
  inquirer module entirely and the runtime prompt registry never runs

Add a custom oxlint JS plugin (.archgate/lint/oxlint.ts) with rule
archgate/valid-inquirer-prompt-type that validates `type:` literals in
inquirer.prompt() question objects. The registered set is read from the
installed inquirer at plugin load (Object.keys(inquirer.prompt.prompts)),
so the rule self-updates on dependency bumps: a future rename/removal
makes stale call sites fail `bun run lint` in the bump PR itself.

Signed-off-by: Rhuan Barreto <rhuan@barreto.work>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a custom oxlint rule to validate inquirer prompt types against the installed registry at lint time, updates five interactive prompts across commands and helpers to use the "select" type instead of "list", configures the new rule in oxlintrc, and documents the enforcement strategy for static invariants.

Changes

Inquirer Prompt Type Validation

Layer / File(s) Summary
Custom oxlint rule for inquirer prompt type validation
.archgate/lint/oxlint.ts, .oxlintrc.json
Implements a custom oxlint plugin that dynamically imports inquirer at plugin load, builds a REGISTERED_PROMPT_TYPES set from the installed registry, and reports lint errors when prompt() calls use unregistered type literals. Rule is registered in oxlintrc and enabled at error severity.
Migrate prompts from 'list' to 'select' type
src/commands/adr/create.ts, src/commands/adr/sync.ts, src/commands/init.ts, src/helpers/editor-detect.ts, src/helpers/login-flow.ts
Five interactive prompt configurations update their inquirer type from "list" to "select", validating against the newly registered oxlint rule. Changes affect ADR domain selection, sync actions, greenfield pack options, single editor selection, and signup editor selection.
Enforcement approach guidance and documentation
.claude/agent-memory/archgate-developer/MEMORY.md, .claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md
Documents the framework for routing invariants to tests (executable behavior), custom oxlint rules (static syntactic invariants), or ADR .rules.ts (governance checks). Includes guidance on using oxlint jsPlugins with dynamic module resolution and runtime allowlist generation, with examples from the inquirer prompt-type validator.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A fluffy guide through prompts so grand,
From list to select, across the land,
A lint rule watches, keen and true,
That prompts won't crash with type askew!
Now five fine flows tap select with glee, 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: replacing the removed inquirer 'list' prompt type with 'select' across multiple call sites.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/inquirer-v14-select-prompt-type

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploying archgate-cli with  Cloudflare Pages  Cloudflare Pages

Latest commit: 62f5136
Status: ✅  Deploy successful!
Preview URL: https://f803e123.archgate-cli.pages.dev
Branch Preview URL: https://fix-inquirer-v14-select-prom.archgate-cli.pages.dev

View logs

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Metric Value
Lines 90.2% (6793 / 7528)
Threshold 90% minimum — met
Platforms Linux + Windows

Full HTML report available in workflow artifacts.

Per-directory breakdown
Directory Coverage Lines
src/commands/ 88.1% 2078 / 2359
src/engine/ 93.1% 1379 / 1481
src/formats/ 100.0% 141 / 141
src/helpers/ 90.1% 3195 / 3547

@rhuanbarreto rhuanbarreto enabled auto-merge (squash) June 11, 2026 12:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
@.claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md:
- Around line 8-18: Add a top-level markdown heading after the document
frontmatter to satisfy the static linter: insert a single-line heading beginning
with "#" (e.g., "# Archgate guidance: prefer tests over ADR rules") immediately
following the YAML/frontmatter block so the file starts with a top-level heading
while preserving the existing content; ensure the heading is the first
non-frontmatter line so the linter no longer flags the missing top-level
heading.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 689944f4-f1e2-495b-ac86-959e132150e2

📥 Commits

Reviewing files that changed from the base of the PR and between 8a13261 and 61028bc.

📒 Files selected for processing (9)
  • .archgate/lint/oxlint.ts
  • .claude/agent-memory/archgate-developer/MEMORY.md
  • .claude/agent-memory/archgate-developer/feedback_prefer_tests_over_adr_rules.md
  • .oxlintrc.json
  • src/commands/adr/create.ts
  • src/commands/adr/sync.ts
  • src/commands/init.ts
  • src/helpers/editor-detect.ts
  • src/helpers/login-flow.ts

@rhuanbarreto

Copy link
Copy Markdown
Contributor Author

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

@rhuanbarreto rhuanbarreto merged commit 34b72d7 into main Jun 11, 2026
19 checks passed
@rhuanbarreto rhuanbarreto deleted the fix/inquirer-v14-select-prompt-type branch June 11, 2026 13:00
@archgatebot archgatebot Bot mentioned this pull request Jun 11, 2026
rhuanbarreto pushed a commit that referenced this pull request Jun 11, 2026
# archgate

## [0.45.2](v0.45.1...v0.45.2)
(2026-06-11)

### Bug Fixes

* **prompts:** replace removed inquirer "list" prompt type with "select"
([#406](#406))
([34b72d7](34b72d7))

---
This PR was generated with
[simple-release](https://github.com/TrigenSoftware/simple-release).

<details>
<summary>📄 Cheatsheet</summary>
<br>



You can configure the bot's behavior through a pull request comment
using the `!simple-release/set-options` command.

### Command Format

````md
!simple-release/set-options

```json
{
  "bump": {},
  "publish": {}
}
```
````

### Useful Parameters

#### Bump

| Parameter | Type | Description |
|-----------|------|-------------|
| `version` | `string` | Force set specific version |
| `as` | `'major' \| 'minor' \| 'patch' \| 'prerelease'` | Release type
|
| `prerelease` | `string` | Pre-release identifier (e.g., "alpha",
"beta") |
| `firstRelease` | `boolean` | Whether this is the first release |
| `skip` | `boolean` | Skip version bump |
| `byProject` | `Record<string, object>` | Per-project bump options for
monorepos |

#### Publish

| Parameter | Type | Description |
|-----------|------|-------------|
| `skip` | `boolean` | Skip publishing |
| `access` | `'public' \| 'restricted'` | Package access level |
| `tag` | `string` | Tag for npm publication |

### Usage Examples

#### Force specific version

````md
!simple-release/set-options

```json
{
  "bump": {
    "version": "2.0.0"
  }
}
```
````

#### Force major bump

````md
!simple-release/set-options

```json
{
  "bump": {
    "as": "major"
  }
}
```
````

#### Create alpha pre-release

````md
!simple-release/set-options

```json
{
  "bump": {
    "prerelease": "alpha"
  }
}
```
````

#### Publish with specific access and tag

````md
!simple-release/set-options

```json
{
  "bump": {
    "prerelease": "beta"
  },
  "publish": {
    "access": "public",
    "tag": "beta"
  }
}
```
````

### Access Restrictions

The command can only be used by users with permissions:
- repository owner
- organization member
- collaborator

### Notes

- The last comment with `!simple-release/set-options` command takes
priority
- JSON must be valid, otherwise the command will be ignored
- Parameters apply only to the current release execution
- The command can be updated by editing the comment or adding a new one


</details>

<!--
  Please do not edit this comment.
  simple-release-pull-request: true
  simple-release-branch-from: release
  simple-release-branch-to: main
-->

Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant