Skip to content

actions ​

Use safeBash from std::safeBash to run commands. This module holds the types that describe a plan: the approvals it asks for and what runs after they are granted. The code that runs a plan lives in std::safeBash and is not exported, because it skips the approvals the plan already raised.

ts
import { outcomeOf, planFor } from "std::safeBash"

node main() {
  const plan = planFor("git status", "/project")
  print(outcomeOf(plan))
}

A plan pairs the required approvals with an execution. Inspect the plan to test classification without executing its commands.

Types ​

Word ​

One word of a parsed command, as the parser read it.

ts
/** One word of a parsed command, as the parser read it. */
export type Word =
  | LiteralWord
  | PathWord
  | GlobWord
  | FlagWord
  | SingleQuotedWord
  | DoubleQuotedWord
  | VariableWord
  | InterpolatedVariableWord

(source)

ScriptName ​

ts
export type ScriptName = LiteralWord | PathWord

(source)

LiteralWord ​

ts
export type LiteralWord = {
  tag: "literal";
  text: string
}

(source)

PathWord ​

ts
export type PathWord = {
  tag: "path";
  text: string
}

(source)

GlobWord ​

An unquoted word bash will expand (*.ts, src/*.md). Its own node so it is never mistaken for the quoted text '*.ts'; no rule here treats it as a literal.

ts
/** An unquoted word bash will expand (`*.ts`, `src/*.md`). Its own node
 so it is never mistaken for the quoted text `'*.ts'`; no rule here
 treats it as a literal. */
export type GlobWord = {
  tag: "glob";
  text: string
}

(source)

FlagWord ​

ts
export type FlagWord = {
  tag: "flag";
  flagName: string;
  flagValue?: string;
  /** Present and true when the value is an unquoted glob (`--include=*.ts`). */
  valueIsGlob?: boolean
}

(source)

SingleQuotedWord ​

ts
export type SingleQuotedWord = {
  tag: "singleQuoted";
  text: string
}

(source)

DoubleQuotedWord ​

ts
export type DoubleQuotedWord = {
  tag: "doubleQuoted";
  parts: Word[]
}

(source)

VariableWord ​

ts
export type VariableWord = {
  tag: "variable";
  name: string
}

(source)

InterpolatedVariableWord ​

Adjacent word parts, such as $HOME.txt or "a"b, that form one Bash argument.

ts
/** Adjacent word parts, such as `$HOME.txt` or `"a"b`, that form one Bash argument. */
export type InterpolatedVariableWord = {
  tag: "interpolatedVariable";
  parts: (
  | LiteralWord
  | VariableWord
  | SingleQuotedWord
  | DoubleQuotedWord)[]
}

(source)

Assignment ​

name=value (or name= with a null value) before a command.

ts
/** `name=value` (or `name=` with a null value) before a command. */
export type Assignment = {
  tag: "assignment";
  name: string;
  value?: Word
}

(source)

Redirect ​

A redirect like > out.txt, >> log, 2> err.txt, < in.txt, or the dup 2>&1 (op >&, target a one-digit literal). fd is the explicit file descriptor (2 in 2>), or undefined for the default. Heredocs and here-strings are rejected rather than parsed.

ts
/** A redirect like `> out.txt`, `>> log`, `2> err.txt`, `< in.txt`, or
 the dup `2>&1` (op `>&`, target a one-digit literal). `fd` is the
 explicit file descriptor (`2` in `2>`), or undefined for the default.
 Heredocs and here-strings are rejected rather than parsed. */
export type Redirect = {
  tag: "redirect";
  fd?: number;
  op: string;
  target: Word
}

(source)

SimpleCommand ​

ts
export type SimpleCommand = {
  tag: "simpleCommand";
  assignments: Assignment[];
  /* The command name, or null for an assignment-only line (`FOO=bar`).
    Bash requires at least one of a command name or an assignment. */
  command?: ScriptName;
  /** Every word after the command name, in source order. */
  args: Word[];
  redirects: Redirect[]
}

(source)

Command ​

ts
export type Command = SimpleCommand | Pipeline | And | Or | Parens

(source)

PipelineStage ​

What may sit between pipes: a simple command or a parenthesized group.

ts
/** What may sit between pipes: a simple command or a parenthesized group. */
export type PipelineStage = SimpleCommand | Parens

(source)

Pipeline ​

a | b | c: flat, two or more stages, binding tighter than &&/||.

ts
/** `a | b | c`: flat, two or more stages, binding tighter than `&&`/`||`. */
export type Pipeline = {
  tag: "pipeline";
  stages: PipelineStage[]
}

(source)

And ​

ts
export type And = {
  tag: "and";
  left: Command;
  right: Command
}

(source)

Or ​

ts
export type Or = {
  tag: "or";
  left: Command;
  right: Command
}

(source)

Parens ​

ts
export type Parens = {
  tag: "parens";
  command: Command
}

(source)

BashNode ​

ts
export type BashNode =
  | Command
  | SimpleCommand
  | Assignment
  | Redirect
  | Word
  | ScriptName

(source)

BashAST ​

ts
export type BashAST = Command[]

(source)

Effect ​

A required approval, with a payload checked for its effect.

ts
/** A required approval, with a payload checked for its effect. */
export type Effect =
  | { name: "std::bash" }
  | { name: "std::bash::readonly" }
  | { name: "std::write"; payload: WritePayload }
  | { name: "std::git::status"; payload: { cwd: string } }
  | { name: "std::git::log"; payload: { cwd: string; ref: string; path: string } }
  | { name: "std::git::diff"; payload: GitDiffPayload }
  | { name: "std::git::show"; payload: GitShowPayload }
  | { name: "std::git::blame"; payload: GitBlamePayload }
  | { name: "std::git::branchList"; payload: GitRepoPayload }
  | { name: "std::git::remoteList"; payload: GitRepoPayload }
  | { name: "std::git::stashList"; payload: GitRepoPayload }
  | { name: "std::git::add"; payload: GitAddPayload }
  | { name: "std::git::commit"; payload: GitCommitPayload }
  | { name: "std::git::checkout"; payload: GitCheckoutPayload }
  | { name: "std::git::switch"; payload: GitSwitchPayload }
  | { name: "std::git::branchCreate"; payload: GitBranchCreatePayload }
  | { name: "std::git::branchDelete"; payload: GitBranchDeletePayload }
  | { name: "std::git::stashPush"; payload: GitStashPushPayload }
  | { name: "std::git::stashPop"; payload: GitRepoPayload }
  | { name: "std::git::restore"; payload: GitRestorePayload }
  | { name: "std::grep"; payload: GrepPayload }
  | { name: "std::read"; payload: ReadPayload }
  | { name: "std::ls"; payload: LsPayload }
  | { name: "std::glob"; payload: GlobPayload }
  | { name: "std::exec"; payload: ExecPayload }
  | { name: "std::remove"; payload: RemovePayload }
  | { name: "std::mkdir"; payload: MkdirPayload }
  | { name: "std::env"; payload: { name: string } }
  | { name: "std::github::prGet"; payload: GhNumberPayload; lookup: string
  | null }
  | { name: "std::github::prDiff"; payload: GhNumberPayload; lookup: string
  | null }
  | { name: "std::github::issueGet"; payload: GhNumberPayload; lookup: string
  | null }
  | { name: "std::github::prFiles"; payload: GhPagedPayload; lookup: string
  | null }
  | { name: "std::github::prReviewList"; payload: GhPagedPayload; lookup: string
  | null }
  | { name: "std::github::prReviewCommentList"; payload: GhPagedPayload; lookup: string
  | null }
  | { name: "std::github::prChecks"; payload: GhPagedPayload; lookup: string
  | null }
  | { name: "std::github::issueCommentList"; payload: GhPagedPayload; lookup: string
  | null }
  | { name: "std::github::prList"; payload: GhPrListPayload; lookup: string
  | null }
  | { name: "std::github::issueList"; payload: GhIssueListPayload; lookup: string
  | null }
  | { name: "std::github::issueSearch"; payload: GhSearchPayload; lookup: string
  | null }

(source)

WritePayload ​

ts
export type WritePayload = {
  dir: string;
  filename: string;
  content: string;
  mode: WriteMode
}

(source)

GrepPayload ​

The fields the grep tool's own std::grep interrupt carries.

ts
/** The fields the grep tool's own std::grep interrupt carries. */
export type GrepPayload = {
  pattern: string;
  dir: string;
  file?: string;
  flags: string;
  maxResults: number;
  ignoreCase: boolean;
  wholeWord: boolean;
  filesOnly: boolean;
  invert: boolean
}

(source)

ReadPayload ​

The fields the read tool's own std::read interrupt is keyed on: the real parent of the file, and its name.

ts
/** The fields the read tool's own std::read interrupt is keyed on: the
 real parent of the file, and its name. */
export type ReadPayload = {
  dir: string;
  filename: string
}

(source)

RemovePayload ​

The field the remove tool's own std::remove interrupt is keyed on: the real whole path of what is deleted.

ts
/** The field the remove tool's own std::remove interrupt is keyed on: the
 real whole path of what is deleted. */
export type RemovePayload = {
  target: string
}

(source)

MkdirPayload ​

The field the mkdir tool's own std::mkdir interrupt carries: the real path of the folder, including steps that do not exist yet.

ts
/** The field the mkdir tool's own std::mkdir interrupt carries: the real
 path of the folder, including steps that do not exist yet. */
export type MkdirPayload = {
  dir: string
}

(source)

LsPayload ​

The fields the ls tool's own std::ls interrupt is keyed on. On the bash path maxResults is 0, meaning no cap: real ls, tree, and du list everything.

ts
/** The fields the ls tool's own std::ls interrupt is keyed on. On the
 bash path `maxResults` is 0, meaning no cap: real ls, tree, and du list
 everything. */
export type LsPayload = {
  dir: string;
  recursive: boolean;
  maxResults: number
}

(source)

GlobPayload ​

The fields the glob tool's own std::glob interrupt is keyed on. On the bash path maxResults is 0, meaning no cap: real find lists everything.

ts
/** The fields the glob tool's own std::glob interrupt is keyed on. On the
 bash path `maxResults` is 0, meaning no cap: real find lists
 everything. */
export type GlobPayload = {
  pattern: string;
  dir: string;
  maxResults: number
}

(source)

ExecPayload ​

The fields the exec tool's own std::exec interrupt carries. From safeBash, cwd is safeBash's resolved working directory, timeout is 0 in the plan and safeBash's own limit when raised, stdin is empty, which is how safeBash runs the line, and an argument may be an unexpanded glob or ~ that bash expands.

ts
/** The fields the exec tool's own std::exec interrupt carries. From
 safeBash, `cwd` is safeBash's resolved working directory, `timeout` is
 0 in the plan and safeBash's own limit when raised, `stdin` is empty,
 which is how safeBash runs the line, and an
 argument may be an unexpanded glob or `~` that bash expands. */
export type ExecPayload = {
  command: string;
  args: string[];
  cwd: string;
  timeout: number;
  stdin: string
}

(source)

GitDiffPayload ​

ts
export type GitDiffPayload = {
  cwd: string;
  ref: string;
  ref2: string;
  staged: boolean;
  path: string
}

(source)

GitRepoPayload ​

The payload of a git effect that names only the repository.

ts
/** The payload of a git effect that names only the repository. */
export type GitRepoPayload = {
  cwd: string
}

(source)

GitLogPayload ​

ts
export type GitLogPayload = {
  cwd: string;
  ref: string;
  path: string
}

(source)

GitShowPayload ​

ts
export type GitShowPayload = {
  cwd: string;
  ref: string
}

(source)

GitBlamePayload ​

ts
export type GitBlamePayload = {
  cwd: string;
  path: string
}

(source)

GitAddPayload ​

ts
export type GitAddPayload = {
  cwd: string;
  paths: string[];
  all: boolean
}

(source)

GitCommitPayload ​

ts
export type GitCommitPayload = {
  cwd: string;
  message: string
}

(source)

GitCheckoutPayload ​

ts
export type GitCheckoutPayload = {
  cwd: string;
  target: string;
  force: boolean
}

(source)

GitSwitchPayload ​

ts
export type GitSwitchPayload = {
  cwd: string;
  branch: string;
  create: boolean
}

(source)

GitBranchCreatePayload ​

ts
export type GitBranchCreatePayload = {
  cwd: string;
  branch: string
}

(source)

GitBranchDeletePayload ​

ts
export type GitBranchDeletePayload = {
  cwd: string;
  branch: string;
  force: boolean
}

(source)

GitStashPushPayload ​

ts
export type GitStashPushPayload = {
  cwd: string;
  message: string
}

(source)

GitRestorePayload ​

ts
export type GitRestorePayload = {
  cwd: string;
  paths: string[];
  staged: boolean
}

(source)

GhRepo ​

The repository a gh command acts on.

ts
/** The repository a `gh` command acts on. */
export type GhRepo = {
  owner: string;
  repo: string
}

(source)

GhNumberPayload ​

ts
export type GhNumberPayload = {
  owner: string;
  repo: string;
  number: number
}

(source)

GhPagedPayload ​

perPage 0 means every page gh fetches for one pull request or issue.

ts
/** `perPage` 0 means every page `gh` fetches for one pull request or issue. */
export type GhPagedPayload = {
  owner: string;
  repo: string;
  number: number;
  perPage: number;
  page: number
}

(source)

GhPrListPayload ​

ts
export type GhPrListPayload = {
  owner: string;
  repo: string;
  state: string;
  base: string;
  perPage: number;
  page: number
}

(source)

GhIssueListPayload ​

ts
export type GhIssueListPayload = {
  owner: string;
  repo: string;
  state: string;
  labels: string[];
  perPage: number;
  page: number
}

(source)

GhSearchPayload ​

ts
export type GhSearchPayload = {
  owner: string;
  repo: string;
  query: string;
  perPage: number;
  page: number
}

(source)

Execution ​

What happens if every effect in the plan is approved.

ts
/** What happens if every effect in the plan is approved. */
export type Execution = BashExec | AgencyExec | RefuseExec | StepsExec

(source)

BashExec ​

ts
export type BashExec = {
  kind: "bash";
  command: string
}

(source)

EchoExec ​

ts
export type EchoExec = {
  kind: "echo";
  content: string
}

(source)

AgencyExec ​

An agency <subcommand> <file> line, run through std::agency's cli().

ts
/** An `agency <subcommand> <file>` line, run through std::agency's cli(). */
export type AgencyExec = {
  kind: "agency";
  args: string[]
}

(source)

WriteExec ​

ts
export type WriteExec = {
  kind: "write";
  filename: string;
  dir: string;
  content: string;
  mode: WriteMode
}

(source)

GrepFileNames ​

Whether grep prints file names: -H gives "always", -h gives "never", neither gives "default".

ts
/** Whether grep prints file names: `-H` gives "always", `-h` gives
 "never", neither gives "default". */
export type GrepFileNames = "default" | "always" | "never"

(source)

GrepRender ​

What a grep command said about printing. The rules that turn this into grep's output live in _renderGrepOutput (lib/stdlib/grepDialect.ts), whose type of the same name must keep these fields.

ts
/** What a grep command said about printing. The rules that turn this
 into grep's output live in `_renderGrepOutput`
 (lib/stdlib/grepDialect.ts), whose type of the same name must keep
 these fields. */
export type GrepRender = {
  /** `-n` was given. */
  lineNumbers: boolean;
  fileNames: GrepFileNames;
  /** The path as bash hands it to grep, or "" when none was written. */
  argument: string;
  /** The path names one file, not a directory. */
  oneFile: boolean
}

(source)

GrepExec ​

A lone grep, run through the grep tool's own search with no shell. The search reads only what payload says, so the approval means what the grep tool's approval means.

ts
/** A lone grep, run through the grep tool's own search with no shell.
 The search reads only what `payload` says, so the approval means what
 the grep tool's approval means. */
export type GrepExec = {
  kind: "grep";
  payload: GrepPayload;
  render: GrepRender;
  /** The saved output searched, by name, when the path is one. The
    search then reads the store, never the disk. */
  saved?: string
}

(source)

SavedPath ​

A saved output named by path: the folder part as the command wrote it, with its trailing separator, and the saved name.

ts
/** A saved output named by path: the folder part as the command wrote it,
 with its trailing separator, and the saved name. */
export type SavedPath = {
  folder: string;
  name: string
}

(source)

ReadSource ​

Where a resolved read path's bytes are: a file on disk, or a saved output in the store. A saved source keeps the folder as written so a rule can name the copy's path in its effect, but it is read by name.

ts
/** Where a resolved read path's bytes are: a file on disk, or a saved
 output in the store. A saved source keeps the folder as written so a
 rule can name the copy's path in its effect, but it is read by name. */
export type ReadSource =
  | { kind: "disk"; dir: string; filename: string }
  | { kind: "saved"; folder: string; name: string }

(source)

ReadView ​

How the shell-free path prints a file: whole, numbered (cat -n), the first lines lines (head), or the last lines lines (tail). The rules live in _renderReadView (lib/stdlib/readDialect.ts), whose type of the same name must keep these fields.

ts
/** How the shell-free path prints a file: whole, numbered (cat -n), the
 first `lines` lines (head), or the last `lines` lines (tail). The rules
 live in `_renderReadView` (lib/stdlib/readDialect.ts), whose type of
 the same name must keep these fields. */
export type ReadView =
  | { kind: "whole" }
  | { kind: "numbered" }
  | { kind: "head"; lines: number }
  | { kind: "tail"; lines: number }

(source)

ReadExec ​

A lone cat of one or more files, or a head or tail of one, run through the read tool's own read with no shell. The read covers only what payloads names, so the approval means what the read tool's approval means.

ts
/** A lone cat of one or more files, or a head or tail of one, run
 through the read tool's own read with no shell. The read covers only
 what `payloads` names, so the approval means what the read tool's
 approval means. */
export type ReadExec = {
  kind: "read";
  sources: ReadSource[];
  view: ReadView
}

(source)

Join ​

How a step follows the one before it: ; always runs it, && only after a success, || only after a failure.

ts
/** How a step follows the one before it: `;` always runs it, `&&`
 only after a success, `||` only after a failure. */
export type Join = "seq" | "and" | "or"

(source)

TextFilter ​

What a later stage of a pipeline does to the text of the stage before it. view is a cat, head, or tail that names no file. match is a grep that names no file: the fields are the grep tool's query, and lineNumbers is -n.

ts
/** What a later stage of a pipeline does to the text of the stage before
 it. `view` is a `cat`, `head`, or `tail` that names no file. `match` is
 a `grep` that names no file: the fields are the grep tool's query, and
 `lineNumbers` is `-n`. */
export type TextFilter =
  | { kind: "view"; view: ReadView }
  | { kind: "match"; pattern: string; flags: string; ignoreCase: boolean; wholeWord: boolean; invert: boolean; lineNumbers: boolean }

(source)

PipeExec ​

A pipeline whose every stage safeBash runs itself. first produces the text and asks the pipeline's only questions; each filter takes the text of the stage before it.

ts
/** A pipeline whose every stage safeBash runs itself. `first` produces
 the text and asks the pipeline's only questions; each filter takes the
 text of the stage before it. */
export type PipeExec = {
  kind: "pipe";
  first: EchoExec | GrepExec | ReadExec;
  filters: TextFilter[]
}

(source)

StepExec ​

What a step safeBash runs itself can be. None of these starts a shell.

ts
/** What a step safeBash runs itself can be. None of these starts a
 shell. */
export type StepExec =
  | EchoExec
  | WriteExec
  | GrepExec
  | ReadExec
  | PipeExec

(source)

LineStep ​

One step of a line that runs a step at a time.

ts
/** One step of a line that runs a step at a time. */
export type LineStep = RunStep | CdStep | GroupStep

(source)

RunStep ​

One simple command or one pipeline, as the model wrote it.

ts
/** One simple command or one pipeline, as the model wrote it. */
export type RunStep = {
  kind: "run";
  join: Join;
  source: Command;
  /** The folder as the plan had it, which is what the payloads name. */
  cwd: string;
  /** `cwd` with every link followed, for the folder check. */
  realCwd: string;
  /** The text the up-front plan rebuilt for this step. */
  text: string;
  effects: Effect[];
  /** Whether a word of the command reads `$?`, the status of the step before. */
  readsStatus: boolean;
  /** Null when the step goes through bash. Otherwise the in-process
    execution. */
  inProcess?: StepExec
}

(source)

CdStep ​

A cd. cwd is the folder it was planned in, and dir is the real folder the plan resolved. guarded is true for a cd that is a whole command of the top-level list: after it, a step whose shell cannot start in dir ends the line (StepsState.missingFolderStops).

ts
/** A `cd`. `cwd` is the folder it was planned in, and `dir` is the real
  folder the plan resolved. `guarded` is true for a `cd` that is a whole
  command of the top-level list: after it, a step whose shell cannot
  start in `dir` ends the line (`StepsState.missingFolderStops`). */
export type CdStep = {
  kind: "cd";
  join: Join;
  source: SimpleCommand;
  cwd: string;
  dir: string;
  guarded: boolean
}

(source)

GroupStep ​

A parenthesized group. Its folder changes end at the closing parenthesis.

ts
/** A parenthesized group. Its folder changes end at the closing parenthesis. */
export type GroupStep = {
  kind: "group";
  join: Join;
  steps: LineStep[]
}

(source)

StepsExec ​

A line that runs a step at a time, with bash's rule for each join. Every step runs in process, or every step that is not a cd or a group runs through bash.

ts
/** A line that runs a step at a time, with bash's rule for each join.
 Every step runs in process, or every step that is not a `cd` or a group
 runs through bash. */
export type StepsExec = {
  kind: "steps";
  /** The whole rebuilt line, which the debug log records. */
  command: string;
  steps: LineStep[];
  /** The repository a `gh` step was planned with, for planning it again. */
  origin?: GhRepo
}

(source)

RefuseExec ​

ts
export type RefuseExec = {
  kind: "refuse";
  reason: string
}

(source)

BroadReason ​

Why a plan asks the broad std::bash question. detail is the parser message for unparseable, the first unrecognized command's message for unrecognized, the render failure for unrenderable, and "" for noEffects.

ts
/** Why a plan asks the broad std::bash question. `detail` is the parser
 message for `unparseable`, the first unrecognized command's message for
 `unrecognized`, the render failure for `unrenderable`, and "" for
 `noEffects`. */
export type BroadReason = {
  kind:
  | "unparseable"
  | "unrecognized"
  | "noEffects"
  | "unrenderable";
  detail: string
}

(source)

Plan ​

The whole decision about one call to safeBash, made before anything runs.

ts
/** The whole decision about one call to safeBash, made before anything runs. */
export type Plan = {
  effects: Effect[];
  execution: Execution;
  /** Why the plan asks the broad std::bash question, or null when it does not. */
  broadReason?: BroadReason;
  /** The command word of every simple command planFor decided over, in
    order; "" for an assignment-only command; [] when unparseable. */
  verbs: string[];
  /** Every saved output the line names. A shell line gets a fresh copy of
    each before it starts, and a read is left unasked only for these. */
  savedPaths: SavedPath[]
}

(source)

FileAccess ​

One file a plan reads, searches, lists, finds in, writes, or removes, read back out of the effect that asks about it. A find access names the folder searched, not the files found.

ts
/** One file a plan reads, searches, lists, finds in, writes, or removes,
 read back out of the effect that asks about it. A `find` access names the
 folder searched, not the files found. */
export type FileAccess = {
  mode:
  | "read"
  | "search"
  | "list"
  | "find"
  | "write"
  | "remove";
  path: string
}

(source)

Functions ​

writeEffect ​

ts
writeEffect(write: WritePayload): Effect

Build a write approval descriptor without raising it.

Build the write approval from the same payload used by writeExecution.

Parameters:

NameTypeDefault
writeWritePayload

Returns: Effect

(source)

writeExecution ​

ts
writeExecution(write: WritePayload): WriteExec

Build a file-write execution plan without running it.

Parameters:

NameTypeDefault
writeWritePayload

Returns: WriteExec

(source)

grepEffect ​

ts
grepEffect(payload: GrepPayload): Effect

Build a grep approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGrepPayload

Returns: Effect

(source)

readEffect ​

ts
readEffect(payload: ReadPayload): Effect

Build a file-read approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadReadPayload

Returns: Effect

(source)

removeEffect ​

ts
removeEffect(payload: RemovePayload): Effect

Build a delete approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadRemovePayload

Returns: Effect

(source)

mkdirEffect ​

ts
mkdirEffect(payload: MkdirPayload): Effect

Build a make-folder approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadMkdirPayload

Returns: Effect

(source)

envEffect ​

ts
envEffect(name: string): Effect

Build an approval descriptor for reading an environment variable, without raising it.

Parameters:

NameTypeDefault
namestring

Returns: Effect

(source)

lsEffect ​

ts
lsEffect(payload: LsPayload): Effect

Build a directory-listing approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadLsPayload

Returns: Effect

(source)

globEffect ​

ts
globEffect(payload: GlobPayload): Effect

Build a file-search approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGlobPayload

Returns: Effect

(source)

execEffect ​

ts
execEffect(payload: ExecPayload): Effect

Build a command-execution approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadExecPayload

Returns: Effect

(source)

gitStatusEffect ​

ts
gitStatusEffect(payload: GitRepoPayload): Effect

Build a std::git::status approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitRepoPayload

Returns: Effect

(source)

gitLogEffect ​

ts
gitLogEffect(payload: GitLogPayload): Effect

Build a std::git::log approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitLogPayload

Returns: Effect

(source)

gitDiffEffect ​

ts
gitDiffEffect(payload: GitDiffPayload): Effect

Build a std::git::diff approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitDiffPayload

Returns: Effect

(source)

gitShowEffect ​

ts
gitShowEffect(payload: GitShowPayload): Effect

Build a std::git::show approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitShowPayload

Returns: Effect

(source)

gitBlameEffect ​

ts
gitBlameEffect(payload: GitBlamePayload): Effect

Build a std::git::blame approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitBlamePayload

Returns: Effect

(source)

gitBranchListEffect ​

ts
gitBranchListEffect(payload: GitRepoPayload): Effect

Build a std::git::branchList approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitRepoPayload

Returns: Effect

(source)

gitRemoteListEffect ​

ts
gitRemoteListEffect(payload: GitRepoPayload): Effect

Build a std::git::remoteList approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitRepoPayload

Returns: Effect

(source)

gitStashListEffect ​

ts
gitStashListEffect(payload: GitRepoPayload): Effect

Build a std::git::stashList approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitRepoPayload

Returns: Effect

(source)

gitAddEffect ​

ts
gitAddEffect(payload: GitAddPayload): Effect

Build a std::git::add approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitAddPayload

Returns: Effect

(source)

gitCommitEffect ​

ts
gitCommitEffect(payload: GitCommitPayload): Effect

Build a std::git::commit approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitCommitPayload

Returns: Effect

(source)

gitCheckoutEffect ​

ts
gitCheckoutEffect(payload: GitCheckoutPayload): Effect

Build a std::git::checkout approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitCheckoutPayload

Returns: Effect

(source)

gitSwitchEffect ​

ts
gitSwitchEffect(payload: GitSwitchPayload): Effect

Build a std::git::switch approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitSwitchPayload

Returns: Effect

(source)

gitBranchCreateEffect ​

ts
gitBranchCreateEffect(payload: GitBranchCreatePayload): Effect

Build a std::git::branchCreate approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitBranchCreatePayload

Returns: Effect

(source)

gitBranchDeleteEffect ​

ts
gitBranchDeleteEffect(payload: GitBranchDeletePayload): Effect

Build a std::git::branchDelete approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitBranchDeletePayload

Returns: Effect

(source)

gitStashPushEffect ​

ts
gitStashPushEffect(payload: GitStashPushPayload): Effect

Build a std::git::stashPush approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitStashPushPayload

Returns: Effect

(source)

gitStashPopEffect ​

ts
gitStashPopEffect(payload: GitRepoPayload): Effect

Build a std::git::stashPop approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitRepoPayload

Returns: Effect

(source)

gitRestoreEffect ​

ts
gitRestoreEffect(payload: GitRestorePayload): Effect

Build a std::git::restore approval descriptor without raising it.

Parameters:

NameTypeDefault
payloadGitRestorePayload

Returns: Effect

(source)

pendingLookups ​

ts
pendingLookups(effects: Effect[]): string[]

The distinct folders whose origin remote these effects still need, in the order first seen.

Parameters:

NameTypeDefault
effectsEffect[]

Returns: string[]

(source)

grepExecution ​

ts
grepExecution(
  payload: GrepPayload,
  render: GrepRender,
  saved: string | null = null,
): GrepExec

Build a grep execution plan without running the search.

Build the search execution from the same payload used by grepEffect.

Parameters:

NameTypeDefault
payloadGrepPayload
renderGrepRender
savedstring | nullnull

Returns: GrepExec

(source)

readPayloadOf ​

ts
readPayloadOf(source: ReadSource): ReadPayload

Return the read approval payload that names this source.

The std::read payload for a source: the file, or the copy's path.

Parameters:

NameTypeDefault
sourceReadSource

Returns: ReadPayload

(source)

readExecution ​

ts
readExecution(sources: ReadSource[], view: ReadView): ReadExec

Build a file-read execution plan without reading files.

Build file reads from the sources whose payloads readEffect asks about.

Parameters:

NameTypeDefault
sourcesReadSource[]
viewReadView

Returns: ReadExec

(source)

accessesOf ​

ts
accessesOf(effects: Effect[]): FileAccess[]

Return the files the given plan effects read, search, list, find in, write, or remove, in order.

The file accesses among a plan's effects, in order. Only file effects are accesses: git checkout -- a.txt overwrites a file, but its effect is std::git::checkout. So the list is not everything a line does.

Parameters:

NameTypeDefault
effectsEffect[]

Returns: FileAccess[]

(source)