PowerShellDialect class

PowerShell (pwsh/powershell). The shell reads commands from a redirected stdin, writing its prompt before each line it reads and then echoing the line (both editions; see EchoFilter). The session's init line (sessionInitLine) makes that prompt a per-session sentinel the client strips exactly, with the echo after it (echoesInput). The marker computes git status counts and the admin flag in PowerShell and writes one line directly to the console out.

Inheritance

Constructors

PowerShellDialect()
const

Properties

echoesInput → bool
PowerShell reading a redirected stdin writes its prompt before every line it reads, then echoes the line.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
initLine → String?
A single command sent once when the session opens (e.g. installing a Ctrl-C trap or suppressing the shell's prompt), or null if none.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

agentLine(String line) → String
Clears $LASTEXITCODE just before the agent's line, after saving it, so the agent marker can tell a native program's code (set again) from a failed cmdlet (left unset), rather than reading an earlier program's stale code. The marker puts the saved value back when the line set none.
override
agentMarker(CwdMarker marker) → String
A marker that also reports the preceding command's exit code (used when the AI agent runs a command in the interactive session). POSIX and PowerShell carry the exit code; cmd falls back to fullMarker, so its exit code is unknown.
override
completionCommand(String word, {required bool isCommand}) → String
A command, in this dialect, that prints TAB-completion candidates for word — one per line, each a full replacement for the typed word (so it includes whatever was typed), with directories suffixed / so the editor can avoid appending a trailing space.
override
expandShortcut(String line) → String
Expands the client-side l shortcut: a line whose first word is l becomes listCommand with the rest of the line as its arguments. Any other line is returned unchanged.
inherited
fullMarker(CwdMarker marker) → String
The full marker command: reports cwd plus git branch/status and privilege.
override
listCommand(String args) → String
A command, in this dialect, that lists a directory including hidden entries and with human-readable sizes (the ls -alh equivalent). args is the raw text typed after the shortcut (paths, extra flags), appended verbatim; empty lists the current directory.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pingMarker(CwdMarker marker) → String
The lightweight ping marker: signals completion only (no git queries).
override
sessionInitLine(CwdMarker marker) → String
initLine with the prompt made CwdMarker.promptSentinel — written as two concatenated halves, so the echo of this very line does not contain it. The client then strips the prompt, and the echoed line after it, by that exact string.
override
toString() → String
A string representation of this object.
inherited
wrapCommand(String line, {required bool interactive, required String tail}) → String
Wraps a user-typed line so it runs and is followed by tail (a marker) as one logical unit. interactive enables terminal-echo handling where the dialect needs it (POSIX only: no tty echo to toggle over a pipe; PowerShell's own prompt and echo of the line are filtered instead, see echoesInput).
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited