cli: run command setup before fallback prompts
Los mantenedores suelen responder en 1 día
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
withFallbackPromptand its newcanPrompthandling. - Printing the introduction before
Command.run: it would then also appear for--help,--versionand 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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Effect-TS/effect
-
[email protected]: crypto declarations require a global CryptoKey type, breaking Node-only type-checks with @types/node 22 and 24Posiblemente ocupada @effect-bot la tomó hoy. Abiertobug
Effect-TS/effect#10196 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
OpenApi.fromApi (4.1.0) emits duplicate component schemas with a _1 suffix when the encoded side differsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
cluster: a runner that lost its shard lock can still write replies and messages for that shardAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 47/100
Los mantenedores suelen responder en 1 día
-
`fromJsonSchemaDocument`: import open `patternProperties`Posiblemente ocupada @effect-bot la tomó hace 2 días. Abierto
Effect-TS/effect#10048 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de Effect-TS/effect
Issues similares
-
area:cli bug P4
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug from-studio
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
esengine/DeepSeek-Reasonix#14868 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
linxiv-dev/linXiv#384 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
vercel/ai#24302 · 1 comentario ·
Los mantenedores suelen responder en 1 día