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.
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.
/** One word of a parsed command, as the parser read it. */
export type Word =
| LiteralWord
| PathWord
| GlobWord
| FlagWord
| SingleQuotedWord
| DoubleQuotedWord
| VariableWord
| InterpolatedVariableWord(source)
ScriptName
export type ScriptName = LiteralWord | PathWord(source)
LiteralWord
export type LiteralWord = {
tag: "literal";
text: string
}(source)
PathWord
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.
/** 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
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
export type SingleQuotedWord = {
tag: "singleQuoted";
text: string
}(source)
DoubleQuotedWord
export type DoubleQuotedWord = {
tag: "doubleQuoted";
parts: Word[]
}(source)
VariableWord
export type VariableWord = {
tag: "variable";
name: string
}(source)
InterpolatedVariableWord
Adjacent word parts, such as $HOME.txt or "a"b, that form one Bash argument.
/** 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.
/** `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.
/** 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
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
export type Command = SimpleCommand | Pipeline | And | Or | Parens(source)
PipelineStage
What may sit between pipes: a simple command or a parenthesized group.
/** 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 &&/||.
/** `a | b | c`: flat, two or more stages, binding tighter than `&&`/`||`. */
export type Pipeline = {
tag: "pipeline";
stages: PipelineStage[]
}(source)
And
export type And = {
tag: "and";
left: Command;
right: Command
}(source)
Or
export type Or = {
tag: "or";
left: Command;
right: Command
}(source)
Parens
export type Parens = {
tag: "parens";
command: Command
}(source)
BashNode
export type BashNode =
| Command
| SimpleCommand
| Assignment
| Redirect
| Word
| ScriptName(source)
BashAST
export type BashAST = Command[](source)
Effect
A required approval, with a payload checked for its effect.
/** 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
export type WritePayload = {
dir: string;
filename: string;
content: string;
mode: WriteMode
}(source)
GrepPayload
The fields the grep tool's own std::grep interrupt carries.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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
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.
/** The payload of a git effect that names only the repository. */
export type GitRepoPayload = {
cwd: string
}(source)
GitLogPayload
export type GitLogPayload = {
cwd: string;
ref: string;
path: string
}(source)
GitShowPayload
export type GitShowPayload = {
cwd: string;
ref: string
}(source)
GitBlamePayload
export type GitBlamePayload = {
cwd: string;
path: string
}(source)
GitAddPayload
export type GitAddPayload = {
cwd: string;
paths: string[];
all: boolean
}(source)
GitCommitPayload
export type GitCommitPayload = {
cwd: string;
message: string
}(source)
GitCheckoutPayload
export type GitCheckoutPayload = {
cwd: string;
target: string;
force: boolean
}(source)
GitSwitchPayload
export type GitSwitchPayload = {
cwd: string;
branch: string;
create: boolean
}(source)
GitBranchCreatePayload
export type GitBranchCreatePayload = {
cwd: string;
branch: string
}(source)
GitBranchDeletePayload
export type GitBranchDeletePayload = {
cwd: string;
branch: string;
force: boolean
}(source)
GitStashPushPayload
export type GitStashPushPayload = {
cwd: string;
message: string
}(source)
GitRestorePayload
export type GitRestorePayload = {
cwd: string;
paths: string[];
staged: boolean
}(source)
GhRepo
The repository a gh command acts on.
/** The repository a `gh` command acts on. */
export type GhRepo = {
owner: string;
repo: string
}(source)
GhNumberPayload
export type GhNumberPayload = {
owner: string;
repo: string;
number: number
}(source)
GhPagedPayload
perPage 0 means every page gh fetches for one pull request or issue.
/** `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
export type GhPrListPayload = {
owner: string;
repo: string;
state: string;
base: string;
perPage: number;
page: number
}(source)
GhIssueListPayload
export type GhIssueListPayload = {
owner: string;
repo: string;
state: string;
labels: string[];
perPage: number;
page: number
}(source)
GhSearchPayload
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.
/** What happens if every effect in the plan is approved. */
export type Execution = BashExec | AgencyExec | RefuseExec | StepsExec(source)
BashExec
export type BashExec = {
kind: "bash";
command: string
}(source)
EchoExec
export type EchoExec = {
kind: "echo";
content: string
}(source)
AgencyExec
An agency <subcommand> <file> line, run through std::agency's cli().
/** An `agency <subcommand> <file>` line, run through std::agency's cli(). */
export type AgencyExec = {
kind: "agency";
args: string[]
}(source)
WriteExec
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".
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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.
/** 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).
/** 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.
/** 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.
/** 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
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.
/** 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.
/** 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.
/** 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
writeEffect(write: WritePayload): EffectBuild a write approval descriptor without raising it.
Build the write approval from the same payload used by writeExecution.
Parameters:
| Name | Type | Default |
|---|---|---|
| write | WritePayload |
Returns: Effect
(source)
writeExecution
writeExecution(write: WritePayload): WriteExecBuild a file-write execution plan without running it.
Parameters:
| Name | Type | Default |
|---|---|---|
| write | WritePayload |
Returns: WriteExec
(source)
grepEffect
grepEffect(payload: GrepPayload): EffectBuild a grep approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GrepPayload |
Returns: Effect
(source)
readEffect
readEffect(payload: ReadPayload): EffectBuild a file-read approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | ReadPayload |
Returns: Effect
(source)
removeEffect
removeEffect(payload: RemovePayload): EffectBuild a delete approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | RemovePayload |
Returns: Effect
(source)
mkdirEffect
mkdirEffect(payload: MkdirPayload): EffectBuild a make-folder approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | MkdirPayload |
Returns: Effect
(source)
envEffect
envEffect(name: string): EffectBuild an approval descriptor for reading an environment variable, without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| name | string |
Returns: Effect
(source)
lsEffect
lsEffect(payload: LsPayload): EffectBuild a directory-listing approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | LsPayload |
Returns: Effect
(source)
globEffect
globEffect(payload: GlobPayload): EffectBuild a file-search approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GlobPayload |
Returns: Effect
(source)
execEffect
execEffect(payload: ExecPayload): EffectBuild a command-execution approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | ExecPayload |
Returns: Effect
(source)
gitStatusEffect
gitStatusEffect(payload: GitRepoPayload): EffectBuild a std::git::status approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitRepoPayload |
Returns: Effect
(source)
gitLogEffect
gitLogEffect(payload: GitLogPayload): EffectBuild a std::git::log approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitLogPayload |
Returns: Effect
(source)
gitDiffEffect
gitDiffEffect(payload: GitDiffPayload): EffectBuild a std::git::diff approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitDiffPayload |
Returns: Effect
(source)
gitShowEffect
gitShowEffect(payload: GitShowPayload): EffectBuild a std::git::show approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitShowPayload |
Returns: Effect
(source)
gitBlameEffect
gitBlameEffect(payload: GitBlamePayload): EffectBuild a std::git::blame approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitBlamePayload |
Returns: Effect
(source)
gitBranchListEffect
gitBranchListEffect(payload: GitRepoPayload): EffectBuild a std::git::branchList approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitRepoPayload |
Returns: Effect
(source)
gitRemoteListEffect
gitRemoteListEffect(payload: GitRepoPayload): EffectBuild a std::git::remoteList approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitRepoPayload |
Returns: Effect
(source)
gitStashListEffect
gitStashListEffect(payload: GitRepoPayload): EffectBuild a std::git::stashList approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitRepoPayload |
Returns: Effect
(source)
gitAddEffect
gitAddEffect(payload: GitAddPayload): EffectBuild a std::git::add approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitAddPayload |
Returns: Effect
(source)
gitCommitEffect
gitCommitEffect(payload: GitCommitPayload): EffectBuild a std::git::commit approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitCommitPayload |
Returns: Effect
(source)
gitCheckoutEffect
gitCheckoutEffect(payload: GitCheckoutPayload): EffectBuild a std::git::checkout approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitCheckoutPayload |
Returns: Effect
(source)
gitSwitchEffect
gitSwitchEffect(payload: GitSwitchPayload): EffectBuild a std::git::switch approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitSwitchPayload |
Returns: Effect
(source)
gitBranchCreateEffect
gitBranchCreateEffect(payload: GitBranchCreatePayload): EffectBuild a std::git::branchCreate approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitBranchCreatePayload |
Returns: Effect
(source)
gitBranchDeleteEffect
gitBranchDeleteEffect(payload: GitBranchDeletePayload): EffectBuild a std::git::branchDelete approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitBranchDeletePayload |
Returns: Effect
(source)
gitStashPushEffect
gitStashPushEffect(payload: GitStashPushPayload): EffectBuild a std::git::stashPush approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitStashPushPayload |
Returns: Effect
(source)
gitStashPopEffect
gitStashPopEffect(payload: GitRepoPayload): EffectBuild a std::git::stashPop approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitRepoPayload |
Returns: Effect
(source)
gitRestoreEffect
gitRestoreEffect(payload: GitRestorePayload): EffectBuild a std::git::restore approval descriptor without raising it.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GitRestorePayload |
Returns: Effect
(source)
pendingLookups
pendingLookups(effects: Effect[]): string[]The distinct folders whose origin remote these effects still need, in the order first seen.
Parameters:
| Name | Type | Default |
|---|---|---|
| effects | Effect[] |
Returns: string[]
(source)
grepExecution
grepExecution(
payload: GrepPayload,
render: GrepRender,
saved: string | null = null,
): GrepExecBuild a grep execution plan without running the search.
Build the search execution from the same payload used by grepEffect.
Parameters:
| Name | Type | Default |
|---|---|---|
| payload | GrepPayload | |
| render | GrepRender | |
| saved | string | null | null |
Returns: GrepExec
(source)
readPayloadOf
readPayloadOf(source: ReadSource): ReadPayloadReturn the read approval payload that names this source.
The std::read payload for a source: the file, or the copy's path.
Parameters:
| Name | Type | Default |
|---|---|---|
| source | ReadSource |
Returns: ReadPayload
(source)
readExecution
readExecution(sources: ReadSource[], view: ReadView): ReadExecBuild a file-read execution plan without reading files.
Build file reads from the sources whose payloads readEffect asks about.
Parameters:
| Name | Type | Default |
|---|---|---|
| sources | ReadSource[] | |
| view | ReadView |
Returns: ReadExec
(source)
accessesOf
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:
| Name | Type | Default |
|---|---|---|
| effects | Effect[] |
Returns: FileAccess[]
(source)