feat: require --name on all provisioning commands#2
Merged
Conversation
The resource `name` field is now strictly required on every InstaNode provisioning API endpoint (db, cache, nosql, queue, etc.). Omitting it returns HTTP 400. - `db new`, `cache new`, `nosql new`, `queue new` now take a required `--name` flag instead of an optional positional [name] arg, so the CLI fails fast with a clear "required flag(s) name not set" error before any API round trip. - Added validateResourceName mirroring the server contract (1–64 chars, ^[A-Za-z0-9][A-Za-z0-9 _-]*$) for an early, descriptive local error. - Updated root help, command usage/examples, and README to show --name. - Added monitor_test.go: validation table, missing-name rejection, invalid-name rejection (no API call), and valid-name body check. `instant up` already enforced a required name via manifest validation; no change needed there. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Makes the resource
namefield strictly required on every CLI provisioning command, matching the new server-side contract wherenameis mandatory on all provisioning API endpoints (omitting it returns HTTP 400).db new,cache new,nosql new,queue newnow use a required--nameflag (cobraMarkFlagRequired) instead of an optional positional[name]arg — the CLI errors clearly before making any API call.validateResourceNamemirroring the server contract: 1–64 chars,^[A-Za-z0-9][A-Za-z0-9 _-]*$, for a descriptive local error.--name.instant upalready enforced a required name via manifest validation — no change needed.Commands updated
db new,cache new,nosql new,queue new. (CLI has nostorage/webhook/deploy/stackssubcommand; those endpoints are reached viainstant upmanifests, which already requirename.)Test plan
go build ./...passesgo test ./...passescmd/monitor_test.go: name-validation table, missing---namerejection (all four commands), invalid---namerejection (asserts no API call), valid---namesends name in request bodyinstant db new->Error: required flag(s) "name" not set🤖 Generated with Claude Code