voidzero-dev / voidzero-dev/vite-task

Proposal: first-class task arguments (schema/validation/help) + argument-based branching

Aperta
#274 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Rust
Stelle
466
Fork
42
Merge medio
1g 15h
PR unite (30g)
19

Descrizione

Problem

vp run supports passing extra args after the task name (they are forwarded to the task command), but Vite Tasks does not appear to provide a first-class mechanism to:

  • declare an argument schema (types/choices/default/help/env),
  • validate arguments,
  • generate --help for a task,
  • and/or expose argument values to the task definition in a structured way so tasks can branch predictably.

This makes common patterns (deploy targets, feature flags, region selection, dry-run, etc.) rely on ad-hoc shell parsing and reduces discoverability.

Evidence (primary)

  • Vite+ docs: extra args after the task name are passed to the task command.
    (see vp run docs)
  • Plan implementation: extra_args are appended only to the last &&-split command (pass-through model), not parsed/typed.
  • Task config schema appears command-centric and doesn’t show an args/usage-like field.

Use cases

  • deploy <env> where env is one of dev|staging|prod (typed choices)
  • --region, --dry-run, --verbose with defaults and validation
  • Better UX: vp run deploy --help to show a task-specific help screen
  • Avoid duplicating many similar tasks just to vary a parameter

Proposed behavior (Unspecified syntax; proposal is conceptual)

Allow task definitions to optionally declare an argument schema, e.g. (example only):

  • positional args with enum choices
  • flags and options with types, defaults, help text, and env fallbacks

Then, at runtime:

  • validate inputs before execution
  • expose parsed values to the task as env vars (MVP) or templating variables (future)
  • generate task-level help (vp run <task> --help), without breaking existing pass-through

Backward compatibility

  • If a task has no arg schema, behavior remains exactly the same (current pass-through).
  • If a schema exists, only then enable validation/help/env injection.
  • Preserve -- semantics (Unspecified; needs design) to avoid collisions between runner flags and task flags.

Minimal implementation suggestion (MVP)

  1. Add optional args/usage metadata to the task schema (no runtime behavior yet).
  2. Parse task args for tasks that opt in; inject values into env as VP_ARG_<name> (or similar).
  3. Implement --help generation from the schema for opt-in tasks.
  4. Later: allow templating/branching semantics based on parsed args.

Prior art

Guida per i contributori

Apri la guida per i contributori

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.

Direzione di ricerca

Inizia dalla documentazione di vp run, dal comportamento di pass-through di extra_args del piano e dallo schema di configurazione dei task. Per prima cosa definisci la sintassi degli argomenti, la validazione, l’help e la semantica di -- che non sono ancora specificati; il lavoro sarà completo quando esisterà un design concordato che preservi il comportamento di pass-through non configurato e definisca l’esperienza dei task opt-in.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
cli, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.