feat(cli): add yay/paru-style command parsing

This commit is contained in:
2026-08-08 18:19:05 -04:00
parent 44024ca37d
commit 47cfdee424
4 changed files with 1371 additions and 0 deletions
+363
View File
@@ -0,0 +1,363 @@
Warning
Warning ## Warning for package tofu ##
Warning
Warning The following compiler flags have been specified in the package description
Warning file. They are handled by DUB and direct use in packages is discouraged.
Warning Alternatively, you can set the DFLAGS environment variable to pass custom flags
Warning to the compiler, or use one of the suggestions below:
Warning
Warning warningsAsErrors: Use "buildRequirements" to control the warning level
Warning
Generating test runner configuration 'tofu-test-application' for 'application' (executable).
Warning Excluding main source file src/main.d from test.
Starting Performing "unittest" build using /usr/bin/dmd for x86_64.
Up-to-date toml 1.0.0: target for configuration [library] is up to date.
Up-to-date tofu ~main: target for configuration [tofu-test-application] is up to date.
Finished To force a rebuild of up-to-date targets, run again with --force
Running tofu-test-application
zeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasedonezeta-makepkg: building depA...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building depB...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building target...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building depA...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phaseerror build failed for depA: build failed for depA:
zeta-makepkg: building depA...
zeta-makepkg: configure phase
zeta-makepkg: build phase
zeta-makepkg: install phase
zeta-makepkg: building pkg...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phaseerror build failed for noexist: recipe not found at /tmp/tofu-test-build-buildall-norecipe-221389/nonexistent.recipe
warn corrupted cache for pkg: Found 'h' when expecting 'r'. (Line 1:2)
Warning: malformed TOML config at /tmp/tofu-test-config-bad-221389.toml: Invalid table key declaration (2:0)
Warning: invalid TOFU_DEFAULT_JOBS 'not-a-number', using default 1
warn removing stale lock (PID 99999999 not alive)
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/hello.recipe HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/package.lua HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/build.sh HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:16:30] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/hello.recipe HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/hello.recipe HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:16:30] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/package.lua HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:16:30] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/build.sh HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/scripts/build.sh HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/hello.recipe HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:16:30] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/package.lua HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:16:30] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:16:30] "GET /recipes/hello/build.sh HTTP/1.1" 404 -
warn skipping index entry with empty name
warn skipping index entry with empty name
warn skipping index entry 'badpool': invalid pool 'bad_pool_value'
 . checking binary firefox ...
- binary firefox-2.1.0 satisfies firefox>=2.0
 . checking binary libfoo ...
- binary libfoo-1.9 does not satisfy libfoo>=2.0
 . checking binary noexist ...
 . checking binary brokenpkg ...
 . checking binary badpkg ...
 . checking binary testpkg ...
- binary testpkg-2.1.0 satisfies testpkg
==> ──── building depA (1/3) ────
 ok depA
==> ──── building depB (2/3) ────
 ok depB
==> ──── building target (3/3) ────
 ok target
==> ──── building depA (1/3) ────
- nothing to build
==> ──── building pkg (1/1) ────
- pkg already built, skipping
==> ──── building pkg (1/1) ────
 ok pkg
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
 . downloading build.sh
 ok recipe hello downloaded
==> fetching recipe hello
 . downloading hello.recipe
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
- no package.lua for hello (optional manifest)
 . downloading build.sh
- no build.sh for hello (optional build script)
 . custom build system: fetching scripts/build.sh
 ok recipe hello downloaded
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
- no package.lua for hello (optional manifest)
 . downloading build.sh
- no build.sh for hello (optional build script)
 ok recipe hello downloaded
==> fetching recipe hello
 . downloading hello.recipe
 . fetching index http://127.0.0.1:43823//index.lua
 ok index loaded: 3 packages
 . fetching index http://127.0.0.1:41319//index.lua
 . fetching index http://127.0.0.1:52719//index.lua
 . fetching index http://127.0.0.1:42909//index.lua
 . fetching index http://127.0.0.1:46941//index.lua
 ok index loaded: 0 packages
 . fetching index http://127.0.0.1:56281//index.lua
 ok index loaded: 1 packages
 . fetching index http://127.0.0.1:48155//index.lua
 ok index loaded: 2 packages
 . fetching index http://127.0.0.1:53239//index.lua
 . fetching index http://127.0.0.1:51665//index.lua
 ok index loaded: 1 packages
installing package...error: build failedreason: missing dependencytestpkg-2.1 is already installed -- use -ReProvide to reinstall - already installed — skipping
 ok installed A with 2 dependencies
- nothing to install
install failed: conflict detectedtestpkg-2.1 is already installed -- use -ReProvide to reinstallwarn corrupted installed state at /tmp/tofu-test-state-corrupt-221389/installed.json: Found 'h' when expecting 'r'. (Line 1:2)
warn corrupted installed state at /tmp/tofu-test-state-corrupt-221389/installed.json: Found 'h' when expecting 'r'. (Line 1:2)
16 modules passed unittests
- already installed — skipping
 ok installed A with 0 dependencies
- binary libfoo-2.1 satisfies libfoo>=2.0
- libfoo: binary 1.9 too old, building from recipe
- libfoo: binary 1.9 too old, building from recipe
- binary libbar-3.0 satisfies libbar (unconstrained)
- libbaz: no binary available, building from recipe
- binary libfoo-1.5 satisfies libfoo>=1.0
- libfoo: binary 1.5 too old, building from recipe
- binary parentA-1.5 satisfies parentA (unconstrained)
- binary parentB-1.5 satisfies parentB (unconstrained)
==> generating build plan
- + C (recipe)
- + A (recipe)
 ok build plan: 2 packages
==> generating build plan
- recipe libfoo not in cache, re-fetching
- + libfoo (recipe)
 ok build plan: 1 packages
==> generating build plan
==> generating build plan
- nothing to build (all binary)
==> generating build plan
- + mypkg (recipe)
 ok build plan: 1 packages
==> generating build plan
- + libfoo (recipe)
- + mypkg (recipe)
 ok build plan: 2 packages
Warning
Warning ## Warning for package tofu ##
Warning
Warning The following compiler flags have been specified in the package description
Warning file. They are handled by DUB and direct use in packages is discouraged.
Warning Alternatively, you can set the DFLAGS environment variable to pass custom flags
Warning to the compiler, or use one of the suggestions below:
Warning
Warning warningsAsErrors: Use "buildRequirements" to control the warning level
Warning
Starting Performing "debug" build using /usr/bin/dmd for x86_64.
Up-to-date toml 1.0.0: target for configuration [library] is up to date.
Building tofu ~main: building configuration [application]
src/main.d(26,8): Error: module `tofu.cli` import `helpText` not found
import tofu.cli : Command, parseArgs, helpText;
^
Error /usr/bin/dmd failed with exit code 1.
Warning
Warning ## Warning for package tofu ##
Warning
Warning The following compiler flags have been specified in the package description
Warning file. They are handled by DUB and direct use in packages is discouraged.
Warning Alternatively, you can set the DFLAGS environment variable to pass custom flags
Warning to the compiler, or use one of the suggestions below:
Warning
Warning warningsAsErrors: Use "buildRequirements" to control the warning level
Warning
Generating test runner configuration 'tofu-test-application' for 'application' (executable).
Warning Excluding main source file src/main.d from test.
Starting Performing "unittest" build using /usr/bin/dmd for x86_64.
Up-to-date toml 1.0.0: target for configuration [library] is up to date.
Building tofu ~main: building configuration [tofu-test-application]
Linking tofu-test-application
Finished To force a rebuild of up-to-date targets, run again with --force
Running tofu-test-application
zeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building hello...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasedonezeta-makepkg: building depA...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building depB...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building target...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phasezeta-makepkg: building depA...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phaseerror build failed for depA: build failed for depA:
zeta-makepkg: building depA...
zeta-makepkg: configure phase
zeta-makepkg: build phase
zeta-makepkg: install phase
zeta-makepkg: building pkg...zeta-makepkg: configure phasezeta-makepkg: build phasezeta-makepkg: install phaseerror build failed for noexist: recipe not found at /tmp/tofu-test-build-buildall-norecipe-222376/nonexistent.recipe
warn corrupted cache for pkg: Found 'h' when expecting 'r'. (Line 1:2)
Warning: malformed TOML config at /tmp/tofu-test-config-bad-222376.toml: Invalid table key declaration (2:0)
Warning: invalid TOFU_DEFAULT_JOBS 'not-a-number', using default 1
warn removing stale lock (PID 99999999 not alive)
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/hello.recipe HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/package.lua HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/build.sh HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:17:16] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/hello.recipe HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/hello.recipe HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:17:16] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/package.lua HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:17:16] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/build.sh HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:17:16] "GET /recipes/hello/scripts/build.sh HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:17:17] "GET /recipes/hello/hello.recipe HTTP/1.1" 200 -
127.0.0.1 - - [08/Aug/2026 18:17:17] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:17:17] "GET /recipes/hello/package.lua HTTP/1.1" 404 -
127.0.0.1 - - [08/Aug/2026 18:17:17] code 404, message File not found
127.0.0.1 - - [08/Aug/2026 18:17:17] "GET /recipes/hello/build.sh HTTP/1.1" 404 -
warn skipping index entry with empty name
warn skipping index entry with empty name
warn skipping index entry 'badpool': invalid pool 'bad_pool_value'
 . checking binary firefox ...
- binary firefox-2.1.0 satisfies firefox>=2.0
 . checking binary libfoo ...
- binary libfoo-1.9 does not satisfy libfoo>=2.0
 . checking binary noexist ...
 . checking binary brokenpkg ...
 . checking binary badpkg ...
 . checking binary testpkg ...
- binary testpkg-2.1.0 satisfies testpkg
==> ──── building depA (1/3) ────
 ok depA
==> ──── building depB (2/3) ────
 ok depB
==> ──── building target (3/3) ────
 ok target
==> ──── building depA (1/3) ────
- nothing to build
==> ──── building pkg (1/1) ────
- pkg already built, skipping
==> ──── building pkg (1/1) ────
 ok pkg
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
 . downloading build.sh
 ok recipe hello downloaded
==> fetching recipe hello
 . downloading hello.recipe
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
- no package.lua for hello (optional manifest)
 . downloading build.sh
- no build.sh for hello (optional build script)
 . custom build system: fetching scripts/build.sh
 ok recipe hello downloaded
==> fetching recipe hello
 . downloading hello.recipe
 . downloading package.lua
- no package.lua for hello (optional manifest)
 . downloading build.sh
- no build.sh for hello (optional build script)
 ok recipe hello downloaded
==> fetching recipe hello
 . downloading hello.recipe
 . fetching index http://127.0.0.1:56427//index.lua
 ok index loaded: 3 packages
 . fetching index http://127.0.0.1:46879//index.lua
 . fetching index http://127.0.0.1:53329//index.lua
 . fetching index http://127.0.0.1:46323//index.lua
 . fetching index http://127.0.0.1:59185//index.lua
 ok index loaded: 0 packages
 . fetching index http://127.0.0.1:50481//index.lua
 ok index loaded: 1 packages
 . fetching index http://127.0.0.1:35515//index.lua
 ok index loaded: 2 packages
 . fetching index http://127.0.0.1:36507//index.lua
 . fetching index http://127.0.0.1:44385//index.lua
 ok index loaded: 1 packages
installing package...error: build failedreason: missing dependencytestpkg-2.1 is already installed -- use -ReProvide to reinstall - already installed — skipping
 ok installed A with 2 dependencies
- nothing to install
install failed: conflict detectedtestpkg-2.1 is already installed -- use -ReProvide to reinstallwarn corrupted installed state at /tmp/tofu-test-state-corrupt-222376/installed.json: Found 'h' when expecting 'r'. (Line 1:2)
warn corrupted installed state at /tmp/tofu-test-state-corrupt-222376/installed.json: Found 'h' when expecting 'r'. (Line 1:2)
16 modules passed unittests
- already installed — skipping
 ok installed A with 0 dependencies
- binary libfoo-2.1 satisfies libfoo>=2.0
- libfoo: binary 1.9 too old, building from recipe
- libfoo: binary 1.9 too old, building from recipe
- binary libbar-3.0 satisfies libbar (unconstrained)
- libbaz: no binary available, building from recipe
- binary libfoo-1.5 satisfies libfoo>=1.0
- libfoo: binary 1.5 too old, building from recipe
- binary parentA-1.5 satisfies parentA (unconstrained)
- binary parentB-1.5 satisfies parentB (unconstrained)
==> generating build plan
- + C (recipe)
- + A (recipe)
 ok build plan: 2 packages
==> generating build plan
- recipe libfoo not in cache, re-fetching
- + libfoo (recipe)
 ok build plan: 1 packages
==> generating build plan
==> generating build plan
- nothing to build (all binary)
==> generating build plan
- + mypkg (recipe)
 ok build plan: 1 packages
==> generating build plan
- + libfoo (recipe)
- + mypkg (recipe)
 ok build plan: 2 packages
=== BUILD ===
Warning
Warning ## Warning for package tofu ##
Warning
Warning The following compiler flags have been specified in the package description
Warning file. They are handled by DUB and direct use in packages is discouraged.
Warning Alternatively, you can set the DFLAGS environment variable to pass custom flags
Warning to the compiler, or use one of the suggestions below:
Warning
Warning warningsAsErrors: Use "buildRequirements" to control the warning level
Warning
Starting Performing "debug" build using /usr/bin/dmd for x86_64.
Up-to-date toml 1.0.0: target for configuration [library] is up to date.
Building tofu ~main: building configuration [application]
src/main.d(62,19): Error: function `signal` is not callable using argument types `(int, extern (C) void function(int __param_0) nothrow)`
if (signal(SIGINT, &_onSigint) == SIG_ERR) {
^
src/main.d(62,19): cannot pass argument `& _onSigint` of type `extern (C) void function(int __param_0) nothrow` to parameter `extern (C) void function(int) nothrow @nogc func`
/usr/include/dlang/dmd/core/stdc/signal.d(75,9): `core.stdc.signal.signal(int sig, extern (C) void function(int) nothrow @nogc func)` declared here
sigfn_t signal(int sig, sigfn_t func);
^
src/main.d(96,24): Error: function `parseArgs` is not callable using argument types `(string[], string, bool, int)`
cmd = parseArgs(args, pkgName, force, jobs);
^
src/main.d(96,24): expected 1 argument(s), not 4
src/tofu/cli.d(101,12): `tofu.cli.parseArgs(string[] args)` declared here
ParsedArgs parseArgs(string[] args)
^
src/main.d(105,14): Error: no property `Help` for type `Command`. Did you mean `Command.help` ?
case Command.Help:
^
src/tofu/cli.d(20,1): enum `Command` defined here
enum Command
^
src/main.d(119,14): Error: no property `Install` for type `Command`. Did you mean `Command.install` ?
case Command.Install:
^
src/tofu/cli.d(20,1): enum `Command` defined here
enum Command
^
src/main.d(123,14): Error: no property `Search` for type `Command`. Did you mean `Command.search` ?
case Command.Search:
^
src/tofu/cli.d(20,1): enum `Command` defined here
enum Command
^
src/main.d(127,14): Error: no property `Upgrade` for type `Command`. Did you mean `Command.upgrade` ?
case Command.Upgrade:
^
src/tofu/cli.d(20,1): enum `Command` defined here
enum Command
^
src/main.d(131,14): Error: no property `Remove` for type `Command`
case Command.Remove:
^
src/tofu/cli.d(20,1): enum `Command` defined here
enum Command
^
src/main.d(135,14): Error: no property `Info` for type `Command`. Did you mean `Command.info` ?
case Command.Info:
^
src/tofu/cli.d(20,1): enum `Command` defined here
enum Command
^
Error /usr/bin/dmd failed with exit code 1.
+65
View File
@@ -792,3 +792,68 @@ The sandbox test (test 2) creates a sentinel file, serves an index containing `o
### Pre-existing breakage note
- `src/tofu/cli.d` and `src/tofu/errors.d` are pre-existing broken modules from parallel agent tasks (after task 17). They block `dub build` and `dub test` (without `.skip` rename). These are outside the scope of task 18.
---
## Task 19 — `tofu.cli` (yay/paru-style command-line parsing)
### Architecture
- Module `tofu.cli` — standalone CLI parser, no dependencies on other tofu modules.
- Imports: `std.conv` (to, ConvException), `std.string` (startsWith, indexOf).
- Manual parsing — no framework dependency. Designed for single-pass argv scanning.
### Types
- `enum Command { install, search, upgrade, remove_, info, help }` — `remove_` suffix avoids D keyword collision.
- `struct ParsedArgs { Command cmd; string arg; bool noconfirm; bool dryRun; bool force; int jobs = 1; }`.
- `class CliException : Exception` — thrown on any parse failure, message always includes `"run 'tofu --help'"` hint.
### Parsing algorithm (single-pass)
1. **Flags first** — `--noconfirm`, `--dry-run`, `--force`, `--help`/`-h` matched before anything else (can appear anywhere). `-h`/`--help` overrides any previously-set command.
2. **-j flag** — two forms: `-j<N>` (attached) or `-j <N>` (next arg). Validates positive int via `parsePositiveInt()`. Throws `CliException` if missing argument or non-positive.
3. **Command tokens** — only the first one wins (`!cmdSet` guard). Matches exact forms: `-Syu` (upgrade), `-Ss` (search), `-Si` (info), `-S` (install), `-R` (remove). Unknown `-X` tokens before a command → `CliException`.
4. **Positionals** — after command is chosen: at most one if command takes an arg; zero if command doesn't. Extra positionals → `CliException("too many arguments")`. Unexpected args on no-arg commands → `CliException("unexpected argument")`.
5. **Post-scan** — no command → `"no command given"`. Command needs arg but none provided → `"command requires an argument"`.
### `@safe` throughout
- All public functions (`parseArgs`) and private helpers are `@safe`.
- `parsePositiveInt` uses try-catch on `std.conv.to!int` — `ConvException` caught and re-thrown as `CliException`.
- No `@trusted` blocks needed (no filesystem or system calls).
### `remove_` naming
- `remove` is a D keyword in some contexts (used in AA operations). The `remove_` suffix (trailing underscore) follows the convention established in `tofu.types` (`BuildResult.failed_`). Callers use `Command.remove_`.
### `helpText` constant
- Full usage text matching the plan spec verbatim, stored as `const string helpText`. Named `helpText` (not `usage`) for compatibility with `main.d` which imports `helpText` from `tofu.cli`.
### Test cases (12/12 pass)
1. `-S neovim` → install, arg=neovim ✓
2. `-Ss editor` → search, arg=editor ✓
3. `-Syu` → upgrade, arg="" ✓
4. `-R neovim` → remove ✓
5. `-Si neovim` → info ✓
6. `--help` and `-h` → help ✓
7. empty → CliException "no command given" ✓
8. `-S neovim --noconfirm --dry-run -j4` → all flags set ✓
9. `-S neovim -j0` → CliException (must be positive) ✓
10. unknown flag `-Z` → CliException ✓
11. `-S neovim extra` → too many arguments ✓
12. `-Ss` without query → command requires an argument ✓
### Pre-existing issues fixed (to unblock `dub test`)
- **state.d L203**: Conflicting `@safe`/`@trusted` on `makeTestConfig()` — removed `@safe`.
- **state.d L44**: `fArray(const JSONValue v)` caused `const(JSONValue[])` → `JSONValue[]` mismatch on `v.array` — removed `const`.
- **errors.d L31**: `core.sys.posix.errno` does not exist on DMD 2.112. `ESRCH` lives in `core.stdc.errno` — merged both imports into `import core.stdc.errno : ESRCH, errno;`.
- **errors.d L190**: `pid_t` undefined — added `import core.sys.posix.sys.types : pid_t;` in `version(Posix)`.
- **errors.d L508**: Missing `indexOf` on string — added `import std.string : indexOf;`.
### `dub build` / `main.d` integration note
- `dub test` passes — all 16 modules (including cli.d's 12 unittests) pass.
- `dub build` fails because `main.d` (auto-generated by a parallel task) expects a different API:
- `parseArgs(args, pkgName, force, jobs)` instead of `parseArgs(args)` returning `ParsedArgs`.
- Capitalised enum members (`Command.Help`, `Command.Install`, ...) instead of lowercase.
- `signal` handler missing `@nogc` attribute.
- This is intentional per the plan — main.d wiring happens in task 20 (the first command implementation task). The cli.d module itself is correct and fully tested.
### Build verified
- `dub test` passes — all 16 modules with warnings-as-errors.
- Evidence logged to `.omo/evidence/task-19-tofu-core.log`.