Terminal MUST parse an argument vector against options declared once as data (flags, negatable flags, single values, repeatable values, each decoded by a parser or a decoder of Core, with defaults or required), inferring the parsed value's type from the declaration and refusing at compile time a short letter declared twice, a dashed key and the key help; take --name VALUE, --name=VALUE, -x VALUE and bundled short flags, end options at --, and treat help as a result of its own that wins over every error; refuse, by a typed error that says one sentence with a suggestion for a near name, an undeclared option, a missing, unexpected or attached value, an invalid value, an option given twice, a required option missing and an undeclared argument; and write help text from the same declaration.
Enforced (check): .github: cd commons/terminal && bun test suite/ — args.test.ts: every grammar rule and error kind with its sentence and suggestion, the help text, type inference with negative controls, random declarations written into command lines and parsed back
Proved by: terminal/suite/args.test.ts
Written in: terminal/src/args.ts
Tests: passed: suite/args.test.ts -- ends the options and the words after it are kept apart; - and -5 are arguments; passed: suite/args.test.ts a malformed declaration does not compile (negative controls); passed: suite/args.test.ts a negatable flag: --name gives true, --no-name false, absent its default or undefined; passed: suite/args.test.ts a repeatable option keeps every value in order; values are parsed by a function or a decod; passed: suite/args.test.ts a required option not given is refused; given, its type has no undefined and 16 more
Cited by: args, Terminal