pub struct Task {Show 23 fields
pub shell: Option<Shell>,
pub command: String,
pub script: Option<String>,
pub script_shell: Option<ScriptShell>,
pub shell_options: Option<ShellOptions>,
pub args: Vec<String>,
pub env: HashMap<String, Value>,
pub dagger: Option<DaggerTaskConfig>,
pub runtime: Option<Runtime>,
pub hermetic: bool,
pub depends_on: Vec<TaskDependency>,
pub inputs: Vec<Input>,
pub outputs: Vec<String>,
pub description: Option<String>,
pub params: Option<TaskParams>,
pub labels: Vec<String>,
pub timeout: Option<String>,
pub retry: Option<RetryConfig>,
pub continue_on_error: bool,
pub task_ref: Option<String>,
pub project_root: Option<PathBuf>,
pub source: Option<SourceLocation>,
pub directory: Option<String>,
}Expand description
A single executable task
Note: Custom deserialization is used to ensure that a Task can only be
deserialized when it has a command or script field. This is necessary
because TaskNode uses untagged enum, and we need to distinguish
between Task, TaskGroup, and TaskList during deserialization.
Fields§
§shell: Option<Shell>Shell configuration for command execution (legacy, for backwards compatibility)
command: StringCommand to execute. Required unless ‘script’ is provided.
script: Option<String>Inline script to execute (alternative to command). When script is provided, shell defaults to bash if not specified.
script_shell: Option<ScriptShell>Shell interpreter for script-based tasks (e.g., bash, python, node)
Only used when script is provided.
shell_options: Option<ShellOptions>Shell options for bash-like shells (errexit, nounset, pipefail, xtrace)
Only used when script is provided with a POSIX-compatible shell.
args: Vec<String>Arguments for the command
env: HashMap<String, Value>Environment variables for this task
dagger: Option<DaggerTaskConfig>Dagger-specific configuration for running this task in a container DEPRECATED: Use runtime field with Dagger variant instead
runtime: Option<Runtime>Runtime override for this task (inherits from project if not set)
hermetic: boolWhen true (default), task runs in isolated hermetic directory. When false, task runs directly in workspace/project root.
depends_on: Vec<TaskDependency>Task dependencies - embedded task references with _name field
In CUE, users write dependsOn: [build, test] with direct references.
The Go bridge injects _name into each embedded task for identification.
inputs: Vec<Input>Input files/resources
outputs: Vec<String>Output files/resources
description: Option<String>Description of the task
params: Option<TaskParams>Task parameter definitions for CLI arguments
labels: Vec<String>Labels for task discovery via TaskMatcher Example: labels: [“projen”, “codegen”]
timeout: Option<String>Execution timeout (e.g., “30m”, “1h”)
retry: Option<RetryConfig>Retry configuration for failed tasks
continue_on_error: boolContinue execution even if this task fails (default: false)
task_ref: Option<String>If set, this task is a reference to another project’s task that should be resolved at runtime using TaskDiscovery. Format: “#project-name:task-name”
project_root: Option<PathBuf>If set, specifies the project root where this task should execute. Used for TaskRef resolution to run tasks in their original project.
source: Option<SourceLocation>Source file location where this task was defined (from CUE metadata). Used to determine default execution directory and for task listing grouping.
directory: Option<String>Working directory override (relative to cue.mod root). Defaults to the directory of the source file if not set.
Implementations§
Source§impl Task
impl Task
Sourcepub fn from_task_ref(ref_str: &str) -> Self
pub fn from_task_ref(ref_str: &str) -> Self
Creates a new TaskRef placeholder task. This task will be resolved at runtime using TaskDiscovery.
Sourcepub fn is_task_ref(&self) -> bool
pub fn is_task_ref(&self) -> bool
Returns true if this task is a TaskRef placeholder that needs resolution.
Sourcepub fn dependency_names(&self) -> impl Iterator<Item = &str>
pub fn dependency_names(&self) -> impl Iterator<Item = &str>
Returns an iterator over dependency task names.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Returns the description, or a default if not set.
Sourcepub fn iter_path_inputs(&self) -> impl Iterator<Item = &String>
pub fn iter_path_inputs(&self) -> impl Iterator<Item = &String>
Returns an iterator over local path/glob inputs.
Sourcepub fn iter_project_refs(&self) -> impl Iterator<Item = &ProjectReference>
pub fn iter_project_refs(&self) -> impl Iterator<Item = &ProjectReference>
Returns an iterator over project references.
Sourcepub fn iter_task_outputs(&self) -> impl Iterator<Item = &TaskOutput>
pub fn iter_task_outputs(&self) -> impl Iterator<Item = &TaskOutput>
Returns an iterator over same-project task output references.
Sourcepub fn collect_path_inputs_with_prefix(
&self,
prefix: Option<&Path>,
) -> Vec<String>
pub fn collect_path_inputs_with_prefix( &self, prefix: Option<&Path>, ) -> Vec<String>
Collects path/glob inputs applying an optional prefix (for workspace roots).
Trait Implementations§
Source§impl AffectedBy for Task
impl AffectedBy for Task
Source§fn is_affected_by(&self, changed_files: &[PathBuf], project_root: &Path) -> bool
fn is_affected_by(&self, changed_files: &[PathBuf], project_root: &Path) -> bool
Returns true if this task is affected by the given file changes.
§Behavior
- Tasks with NO inputs are always considered affected (we can’t determine what affects them)
- Tasks with inputs are affected if any input pattern matches changed files
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl TaskNodeData for Task
impl TaskNodeData for Task
Source§fn dependency_names(&self) -> impl Iterator<Item = &str>
fn dependency_names(&self) -> impl Iterator<Item = &str>
Source§fn add_dependency(&mut self, dep: String)
fn add_dependency(&mut self, dep: String)
Source§fn has_dependency(&self, name: &str) -> bool
fn has_dependency(&self, name: &str) -> bool
Source§impl TaskResolver<Task> for Tasks
impl TaskResolver<Task> for Tasks
impl StructuralPartialEq for Task
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more