Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

cli: run command setup before fallback prompts

Chiusa
#10,043 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@effect-bot ci sta già lavorando.

Dal 28/10/2026.

  • #10074 di @effect-bot — integrata

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.
Lingua principale
TypeScript
Stelle
16.7k
Fork
808
Merge medio
10h 17m
PR unite (30g)
850

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Effect-TS/effect

Tutte le issue di Effect-TS/effect

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.