Skip to content

meaningfulPrefixTokens

meaningfulPrefixTokens(argv): string[]

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

Look up the arity (number of leading meaningful tokens) for an argv, using the longest-matching-prefix rule against ARITY. Flag tokens (starting with -) are dropped when forming the candidate prefixes so boolean flags like git --no-pager checkout still resolve git checkout. Unknown binaries default to arity 0 → just the binary.

LIMITATION (intentional, fail-closed): we do NOT maintain a per-flag arity table, so an arg-taking flag leaves its operand in the non-flag stream (e.g. git -C . checkoutgit .). That simply fails to match an approved git checkout and re-prompts — safe, by design — rather than risking a mis-classification that mis-approves.

Returns the list of meaningful tokens (binary + subcommands), flag tokens excluded.

string[]

string[]