fix(cli): acceptance-findings bugs — template resource flags, --json, exit codes, --env, doctor - #94
Merged
Conversation
… exit codes, --env, doctor Addresses the paying-customer acceptance findings: 1. templates create: add --cpu/--memory/--disk/--size and forward them as cpu_count / memory_mb / disk_size_mb / size. Memory and disk accept unit suffixes (4gb, 4096, 4096mib) parsed to MiB integers. When no resource flags are given the fields are omitted so the server picks its default, instead of pinning an unusable hardcoded shape. 2. templates create --json: suppress the spinner and all human/status prints in JSON mode so stdout carries exactly one machine-parseable payload; error paths (unreadable Dockerfile, bad flags) also emit a single JSON object. 3. sandbox exec/run: propagate a nonzero remote exit_code to process.exitCode (even in --json mode) so CI and && chains detect failure. Applies to the normal exec path and to --follow. 4. sandbox exec --env: verified env is sent as an object under the body key `env` (the field the backend honors) on the direct, --shell-cmd, --follow, --background and --detached paths; locked with a regression test. 5. doctor --json: reconcile ok / firstFailure / summary via a single doctorVerdict() so they never contradict. Optional findings (MCP server, action-catalog drift, missing .claude/mcp.json) move to a separate warnings field and no longer flip ok to false or leave firstFailure null. Adds regression tests for all five. tsc clean; 430 tests pass.
This was referenced Aug 29, 2026
Merged
robertohluna
added a commit
that referenced
this pull request
Aug 29, 2026
Follow-up to #94. The backend only accepts PUBLISHED vCPU/memory pairs (xs 1/2048, small 2/4096, medium 4/8192, large 8/16384, xl 16/32768); disk is a free-form floor. `templates create` previously forwarded any --cpu/--memory combination, so an off-tier pair like --cpu 4 --memory 4gb (4 vCPU / 4 GB) was sent and rejected by the platform with a shape-mismatch 500 after the Dockerfile upload. Now `templates create` resolves resources locally: a --cpu/--memory pair must match a published shape. An off-tier pair fails fast before any API call with an actionable message naming the nearest size (e.g. "cpu/memory 4/4096 isn't a supported pair; nearest is medium (4 vCPU / 8192 MiB); pass --size medium"). A pair that conflicts with an explicit --size is also rejected. --disk stays free-form and --size <name> is always safe. When no cpu/memory pins are given, resources are still omitted so the server picks its default. No version bump. tsc clean; 431 tests pass, incl. a new off-tier rejection test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the five acceptance findings reported by a paying customer against
@miosa/cli.Fixes
templates createresource flags (src/commands/templates.ts)Adds
--cpu <n>,--memory <val>,--disk <val>,--size <name>(xs/small/medium/large/xl).--memory/--diskaccept4gb/4096/4096miband are parsed to MiB integers. They are forwarded ascpu_count/memory_mb/disk_size_mb/size. When no resource flags are given, the fields are omitted so the server picks its default — no more hardcoded, unusable shape.templates create --jsonemits clean JSON (src/commands/templates.ts)In JSON mode the spinner is disabled and every human/status print is suppressed; stdout carries exactly one machine-parseable payload. The error paths (unreadable Dockerfile, invalid flags) also emit a single JSON object.
Nonzero remote
sandbox execfails the CLI (src/commands/sandbox.ts)A nonzero remote
exit_codenow setsprocess.exitCode(even in--jsonmode) so CI and&&chains detect the failure. Covers the normal exec/run path and--follow.sandbox exec --envreaches the guest (src/commands/sandbox.ts)Verified
--envvalues are sent as an object under the body keyenv— the field the backend honors and applies to the guest viash -c— on the direct,--shell-cmd,--follow,--backgroundand--detachedpaths. Locked with a regression test.doctor --jsonis internally consistent (src/commands/doctor.ts)A single
doctorVerdict()reconcilesok/firstFailure/summaryso they never contradict.okis true iff all required transport/auth/config/Node checks pass. Optional findings (MCP server, action-catalog drift, missing.claude/mcp.json) move to a separatewarningsfield and no longer flipokto false or leavefirstFailurenull. This eliminates the reportedok:false+firstFailure:null+ "All layers healthy" contradiction.Verification
npm run build(tsc): clean.npm test: 430 tests pass (67 files), including new regression tests for all five fixes.doctor --jsonconfirmed internally consistent against the API.No version bump, no publish, no
.npmrcchanges.