Skip to main content

Job

Struct Job 

Source
pub struct Job {
    pub name: String,
    pub description: String,
    pub args: Vec<Arg>,
    pub requires: Vec<Requirement>,
    pub agent_allow: bool,
    /* private fields */
}
Expand description

One job: a named script with its metadata. The script, its interpreter language, its Opts: flags, and its extra environment are internal mechanics; a consumer deals in the name, description, declared args, dependencies, and the agent gate, and runs the job through run, run_captured, or run_agent.

Fields§

§name: String

The heading text (the job name).

§description: String

Prose in the job body that is not a recognized Key: value line.

§args: Vec<Arg>

Args: declares positional arguments in just’s syntax. A bare name is required, name='default' is optional, and a trailing *name is variadic (it collects the rest, space-joined). Each one is substituted as {{ name }} in the script and also exported as $name. Note that {{ name }} is raw text substitution, spliced in before the interpreter parses the script, so {{ name }} is NOT injection-safe for untrusted values in any language. The safe form is to read the value from the environment, never to template it: "$name" in a shell, os.environ["name"] in Python, process.env.name in Node, and so on. Reserve {{ }} for developer-authored templates. An agent-run job that raw-templates an arg is refused by run_agent.

§requires: Vec<Requirement>

Requires: names the jobs this one depends on. The run* entry points resolve the transitive order (deps first, cycle and typo detected) and run each in turn, stopping on the first non-success step.

§agent_allow: bool

Agent: allow opts a job in to being listed and run by an MCP or agent surface. The flag alone enforces nothing: run_agent is the gate that checks it (and agent_jobs the listing that filters on it), so a plain run or run_captured ignores it. It stays public as advisory data an embedder can read.

Implementations§

Source§

impl Job

Source

pub fn script(&self) -> &str

The script body, verbatim: the contents of the first fenced block under the heading, before any argument substitution.

Public so a consumer can show a task before running it. Knowing what a task will do should not require running it, and for a tool whose job is executing shell that is the difference between a considered decision and a leap of faith.

Source

pub fn lang(&self) -> &str

The fenced block’s info string, which selects the interpreter. Empty means an unlabeled fence, which runs as sh.

Source

pub fn opts(&self) -> &[String]

The task’s Opts: flags, in the order declared.

Source

pub fn env(&self) -> &[(String, String)]

The task’s own Env: pairs. Does not include the file-level Env: hoisted to every task, which belongs to the file, not the job.

Trait Implementations§

Source§

impl Clone for Job

Source§

fn clone(&self) -> Job

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Job

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Job

Source§

fn default() -> Job

Returns the “default value” for a type. Read more
Source§

impl Eq for Job

Source§

impl PartialEq for Job

Source§

fn eq(&self, other: &Job) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Job

Auto Trait Implementations§

§

impl Freeze for Job

§

impl RefUnwindSafe for Job

§

impl Send for Job

§

impl Sync for Job

§

impl Unpin for Job

§

impl UnsafeUnpin for Job

§

impl UnwindSafe for Job

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.