/** * Parses strikes whose target the text does not name * * Answers one question about a command: would it stop something the caller * cannot name? `docker stop web-1` names its target and passes; `docker stop * $(docker ps -q --filter …)` names a way to find one, and what the way finds * is unknown until the server runs it. * * The same rule already governs removal (`destructive-command.ts`) and disk * writes: a target the server expands cannot be judged from the text. Here it * governs the verbs that stop what is running. * * This module only parses the string. Turning a strike into a list of real * containers and processes is the job of the layer that may talk to the server. */ /** What the strike would stop */ export type StrikeSubject = 'container' | 'process' | 'unit'; /** * Why the text cannot name the target. * * `expansion` — a substitution or a variable stands in the target's place. * `pattern` — the target is a search: every process whose command line * contains a fragment, every name matching an expression. */ export type StrikeKind = 'expansion' | 'pattern'; /** A strike whose target the command does not name */ export interface BlindStrike { /** The verb as a person would say it: `docker kill`, `pkill`, `systemctl stop` */ verb: string; subject: StrikeSubject; kind: StrikeKind; /** The segment as written, with substitutions put back in place */ written: string; /** * A command that names what would be hit without hitting it, or null when * the text gives nothing to ask the server with — an empty variable, a glob * no listing understands. */ probe: string | null; /** * The search matches the command that carries it. * * A pattern for the whole command line is written inside the very command * being run, so the shell running it matches too — and dies first, before * the intended target. Measured on both containers: the reply breaks off * mid-stream, and the target survives. */ selfMatching: boolean; /** The search pattern, when the strike searches rather than names */ pattern: string | null; } /** * Find strikes whose target the command does not name. * * An empty list means every strike in the command named what it hits — not * that the command is harmless. */ export declare function findBlindStrikes(command: string): BlindStrike[];