Tool file
exec tools
Runs a command.
Runs a command. stdout becomes the result; a non-zero exit, a timeout or unparseable JSON is a tool error. Exec tools run arbitrary code, by design. An input property with format: blob (or an array whose items have it) takes file refs, which reach the command as local paths. Files it writes go out through files: declare each by name, pass {{files.<name>.path}} in args, and the file comes back under the result's files with its name and a ref.
These fields go alongside the common fields, with kind: exec.
Fields
The executable.
Arguments, as templates over {{input.*}} and, for declared files, {{files.<name>.path}} and {{files.<name>.dir}}.
Extra environment variables. Each value is a string, or {value, description} to say what a secret is and where to get it. Values expand ${VAR} from Dive's environment or, when it's unset or empty there, from the OS credential store (the project's value first, then the global one). ${VAR:-default} falls back to the default when neither has a value; a ${VAR} with no default is a secret the tool needs. A tool from an installed pack also gets DIVE_PACK_DIR, the absolute path of the pack's installed directory, so it can run scripts and binaries the pack ships. The process gets Dive's own environment plus these variables, except in serve mode, where it gets only PATH and TMPDIR from Dive's environment, these variables, and the DIVE_ variables Dive sets.
Working directory for the process. Without one, the command runs in the project directory, except in a test run before the tool is saved, where a tool that isn't read_only runs in an empty scratch directory that's removed afterwards, with the project's path in DIVE_PROJECT_DIR.
Seconds before the process is killed.
json parses stdout as JSON; text returns it as {text}.
Available options: json, text
Files the command writes, by name. Each call gets an empty directory; pass {{files.<name>.path}}, or {{files.<name>.dir}} for a pattern, in args. After a successful run each file is listed under the result's files with its name, and a pattern's files come back as a list. A declared file the command didn't write is a tool error unless it's optional.
The file name with its extension, such as report.pdf, or a pattern with * or ?, such as page-*.png, for several files.
When true, a missing file, or a pattern with no match, isn't an error.
version: 3
name: open_prs
description: Open pull requests in the current repository, newest first.
kind: exec
command: gh
args:
- pr
- list
- --state
- open
- --json
- number,title,author
- --limit
- '{{input.limit}}'
read_only: true
input_schema:
type: object
required:
- limit
properties:
limit:
type: integer
description: Most pull requests to return