Skip to content

feat: require --name on all provisioning commands#2

Merged
mastermanas805 merged 1 commit into
masterfrom
feat/mandatory-resource-naming
May 15, 2026
Merged

feat: require --name on all provisioning commands#2
mastermanas805 merged 1 commit into
masterfrom
feat/mandatory-resource-naming

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

Makes the resource name field strictly required on every CLI provisioning command, matching the new server-side contract where name is mandatory on all provisioning API endpoints (omitting it returns HTTP 400).

  • db new, cache new, nosql new, queue new now use a required --name flag (cobra MarkFlagRequired) instead of an optional positional [name] arg — the CLI errors clearly before making any API call.
  • Added validateResourceName mirroring the server contract: 1–64 chars, ^[A-Za-z0-9][A-Za-z0-9 _-]*$, for a descriptive local error.
  • Updated root help text, per-command usage/examples, and README to show --name.
  • instant up already enforced a required name via manifest validation — no change needed.

Commands updated

db new, cache new, nosql new, queue new. (CLI has no storage/webhook/deploy/stacks subcommand; those endpoints are reached via instant up manifests, which already require name.)

Test plan

  • go build ./... passes
  • go test ./... passes
  • New cmd/monitor_test.go: name-validation table, missing---name rejection (all four commands), invalid---name rejection (asserts no API call), valid---name sends name in request body
  • Manual: instant db new -> Error: required flag(s) "name" not set

🤖 Generated with Claude Code

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>
@mastermanas805 mastermanas805 merged commit a4590ba into master May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant