Skip to content

tokenize

tokenize(command): string[] | null

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/shell/arity.ts:239

Tokenize a shell command into argv, honoring single and double quotes. Quotes group (and are stripped from) a token; backslash-escaping inside double quotes is collapsed by the prior normalize step, so this tokenizer treats a residual `` literally.

This is a deliberately small tokenizer used ONLY for prefix detection — never for execution. The original command string is what runs.

Returns null if quoting is unbalanced (an open quote with no close), which is itself a reason to refuse classification (ambiguous parse → fail-closed).

string

string[] | null