Skip to content

Replace @inquirer/prompts with @optique/inquirer in @fedify/init #943

Description

@2chanhaeng

@fedify/init builds its CLI on Optique (@optique/core, @optique/run), but the interactive prompts in packages/init/src/ask/ still use @inquirer/prompts and inquirer-toggle directly. @optique/inquirer wraps an Optique parser so that an Inquirer.js prompt fires only when no CLI value is provided—exactly the options.x ?? await askX() fallback pattern every fill* function in src/ask/ implements by hand.

Motivation

  • The option-parsing layer already uses Optique extensively; moving prompts into the parser removes the hand-written CLI-value/prompt fallback logic in every fill* function.
  • inquirer-toggle has had no release since April 2024 (v1.0.1) and is effectively unmaintained; the confirm prompt type covers its use cases.
  • Optique and Fedify share a maintainer, so gaps found during migration can be addressed upstream quickly.
  • @optique/inquirer (v1.1.1) is published to both JSR and npm, matching the dual-registry dependency policy, and its prompter escape hatch enables TTY-free testing in mise test:init.

Known constraints

  • Package manager choices depend on the selected web framework, and KV store/message queue choices depend on the selected package manager. Expressing these declaratively needs an upstream feature (choices derived from other parsed values).
  • The re-prompt loops (package manager availability, KV/MQ compatibility) and the non-empty-directory trash confirmation flow in dir.ts run after parsing, so they remain application logic outside the parser.

Please add features for these, @dahlia! 🙏

Scope

Most of the modifications will be in packages/init/, especially packages/init/src/ask/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions