Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

cli: run command setup before fallback prompts

Cerrado
#10,043 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@effect-bot ya está trabajando en esto.

Desde el 28/10/2026.

  • #10074 de @effect-bot — fusionado

Evaluación

Este issue todavía no se ha evaluado.

Descripción

What is the problem this feature would solve?

Flag.withFallbackPrompt asks its question while flags are parsed, which happens before any Command.provide* hook runs. So a command cannot show anything before its first question: no introduction, no notice, no consent question that must come first. Reproduced on 4.0.7:

const ask = (name: string) =>
  Flag.String(name).pipe(Flag.withFallbackPrompt(Prompt.String({ message: `${name}?` })))

const demo = Command.make("demo", { name: ask("name"), dir: ask("dir") }, (input) =>
  Console.log(input)
).pipe(Command.provideEffectDiscard(Console.log("Welcome to demo")))

Run without flags, both questions appear before Welcome to demo, and if the second prompt is cancelled the welcome never prints. To keep an introduction first today, a command has to drop fallback prompts and ask inside its handler, re-implementing the flag-then-prompt-then-fail logic that withFallbackPrompt now covers, including the canPrompt check from #9876.

What is the feature you are proposing to solve the problem?

A hook that runs after parsing has succeeded and before any fallback prompt, for example:

Command.beforePrompts(Console.log("Welcome to demo"))

Parse errors would still be reported before it runs, so a mistyped flag never shows the introduction, and fallback prompts would follow it in declaration order. It would run once per invocation, and also when every value was given as a flag, so the introduction does not depend on whether anything is asked.

What alternatives have you considered?
  • Running the existing Command.provide* hooks before fallback prompts: simpler to describe, but it changes ordering for every command that uses them, for example opening a resource before the user has answered anything.
  • Prompting inside the handler: what we do today; it gives up withFallbackPrompt and its new canPrompt handling.
  • Printing the introduction before Command.run: it would then also appear for --help, --version and parse errors.
Lenguaje dominante
TypeScript
Estrellas
16.7k
Forks
808
Merge medio
10 h 17 min
PR fusionados (30 d)
850

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Effect-TS/effect

Todos los issues de Effect-TS/effect

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.