feat(new): inline resource overrides — --cpu, --memory, --disk #59

Merged
dan-claude-bot merged 3 commits from feat/new-resource-flags into main 2026-07-15 00:22:57 +00:00
dan-claude-bot commented 2026-07-15 00:17:53 +00:00 (Migrated from github.com)

Closes #57.

What

box new --name lean --template claude --cpu 2 --memory 3GiB --disk 20GiB
  • Resolution, most-specific-first: flag > BOX_CPU/BOX_MEMORY/BOX_DISK env (kept — it's the scripting form and how the drill shrinks boxes on small hosts) > template box.env > defaults.
  • Verbatim to Incus (limits.cpu, limits.memory, root size=) — its units, its validation; box adds no parser of its own.
  • Resources only — there is still no flag for a network, profile, or security.* key, on purpose. The trust boundary stays out of the caller's reach.
  • Fresh mints only--from refuses the flags (exit 2, before touching anything): a clone carries its source's resources; changing them after is box incus's job.
  • An explicit --disk on a container mint prints a note instead of silently dropping (a container's root rides the pool).

Drill

The blank mint now carries --cpu 1 --memory 1GiB and asserts the limits landed — which doubles as the precedence proof, since the drill exports BOX_CPU/BOX_MEMORY on small hosts and the flag must win. Plus a negative check: --from + a resource flag is refused. (+2 checks.)

Verified live

On a real stack (container mint, cached image):

  • BOX_CPU=3 box new --name rflag --container --cpu 1 --memory 1GiB --disk 9GiBlimits.cpu=1, limits.memory=1GiB (flag beat env), container --disk note printed
  • box new --name x --from nowhere --cpu 2 → refused, exit 2
  • box help new documents the flags and the resolution order

🤖 Generated with Claude Code

Closes #57. ## What ```sh box new --name lean --template claude --cpu 2 --memory 3GiB --disk 20GiB ``` - **Resolution, most-specific-first:** flag > `BOX_CPU`/`BOX_MEMORY`/`BOX_DISK` env (kept — it's the scripting form and how the drill shrinks boxes on small hosts) > template `box.env` > defaults. - **Verbatim to Incus** (`limits.cpu`, `limits.memory`, root `size=`) — its units, its validation; box adds no parser of its own. - **Resources only** — there is still no flag for a network, profile, or `security.*` key, on purpose. The trust boundary stays out of the caller's reach. - **Fresh mints only** — `--from` refuses the flags (exit 2, before touching anything): a clone carries its source's resources; changing them after is `box incus`'s job. - An explicit `--disk` on a **container** mint prints a note instead of silently dropping (a container's root rides the pool). ## Drill The blank mint now carries `--cpu 1 --memory 1GiB` and asserts the limits landed — which doubles as the precedence proof, since the drill exports `BOX_CPU`/`BOX_MEMORY` on small hosts and the flag must win. Plus a negative check: `--from` + a resource flag is refused. (+2 checks.) ## Verified live On a real stack (container mint, cached image): - `BOX_CPU=3 box new --name rflag --container --cpu 1 --memory 1GiB --disk 9GiB` → `limits.cpu=1`, `limits.memory=1GiB` (flag beat env), container `--disk` note printed - `box new --name x --from nowhere --cpu 2` → refused, exit 2 - `box help new` documents the flags and the resolution order 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: heavy-duty/box#59
No description provided.