Proposal: first-class task arguments (schema/validation/help) + argument-based branching
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Bắt đầu với tài liệu về vp run, hành vi pass-through của extra_args trong plan và schema cấu hình task. Trước tiên, hãy xác định cú pháp đối số, validation, help và ngữ nghĩa của -- hiện chưa được đặc tả; công việc được xem là hoàn tất khi có một thiết kế đã được thống nhất, bảo toàn hành vi pass-through khi chưa cấu hình và định nghĩa trải nghiệm task opt-in.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
--helpfor 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.
(seevp rundocs) - Plan implementation:
extra_argsare 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 ofdev|staging|prod(typed choices)--region,--dry-run,--verbosewith defaults and validation- Better UX:
vp run deploy --helpto 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)
- Add optional
args/usagemetadata to the task schema (no runtime behavior yet). - Parse task args for tasks that opt in; inject values into env as
VP_ARG_<name>(or similar). - Implement
--helpgeneration from the schema for opt-in tasks. - Later: allow templating/branching semantics based on parsed args.
Prior art
- mise task arguments +
usageschema + help + env injection + templated branching:
https://mise.jdx.dev/tasks/task-arguments.html - just recipe parameters (arguments as first-class):
https://just.systems/man/en/recipe-parameters.html
- Ngôn ngữ chính
- Rust
- Star
- 466
- Fork
- 42
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 21
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/vite-task
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
voidzero-dev/vite-task#738 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
voidzero-dev/vite-task#719 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
voidzero-dev/vite-task#717 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
voidzero-dev/vite-task#702 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
voidzero-dev/vite-task#700 · 2 bình luận ·
Tất cả issue của voidzero-dev/vite-task
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
state:needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
zed-industries/zed#64680 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
RustPython/RustPython#8802 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
TheLarkInn/aipm#2390 ·