 Tomas DvorakandDevin
|
18f78f00a3
|
feat(api): error codes, idempotency keys, cursor pagination
- Stable machine-readable error codes alongside the error message
(UNAUTHENTICATED, INVALID_TOKEN, ADMIN_REQUIRED, SCOPE_INSUFFICIENT,
IDEMPOTENCY_IN_PROGRESS); CLI renders "CODE: message".
- Idempotency middleware on authed/admin groups: POST requests with an
Idempotency-Key header replay the first response for 24h (Redis-backed,
caller-scoped); concurrent duplicates get 409. X-Idempotent-Replay
header marks replays.
- Shared pagination helpers: ?cursor= (opaque, preferred) alongside
legacy ?page= on projects and deployments lists; pagination meta
includes next_cursor; invalid cursors fail soft to page 1.
- CLI --idempotency-key flag for safe scripted retries.
- OpenAPI updated: error envelope, cursor params, idempotency contract.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
2026-10-08 15:38:36 +02:00 |
|
Tomas Dvorak
|
e51b20b2d4
|
feat(cli): v2 — full API coverage, profiles, --json/--yes, containr up
Rewrite the CLI as a thin client over the authenticated API so agents
and scripts reach every resource the UI does (ROADMAP2 phase A2).
- shared Client with bearer auth, error-envelope decoding, and stable
exit codes: 0 ok / 1 error / 2 auth / 3 not-found / 4 validation /
5 unreachable
- named profiles in ~/.containr.yaml (current_profile + profiles.*);
resolution order --flag > env > profile > localhost default;
CONTAINR_TOKEN / CONTAINR_API_URL / CONTAINR_PROFILE env support
- --json prints raw API responses; --yes skips confirmations;
destructive commands refuse non-interactively without it
- auth login verifies the token against /user/profile before saving,
interactive prompt via term.ReadPassword
- commands for every resource: tokens, projects, services, deploy,
deployments (logs/rollback), logs --follow (SSE), exec, variables
(set/unset merge with secret masking preserved), databases
(backup/restore/download), cron, templates, nodes + agent tokens,
scaling, ha, security, gateway, admin, notifications
- containr up: git remote + branch → create-or-reuse service → deploy
Verified live: login/status/tokens/projects/services, up creating a
service + deployment, non-TTY confirmation refusal, scope-capped admin
rejection (exit 2), revoke.
Authored By: TDvorak <[email protected]>
|
2026-10-08 15:19:31 +02:00 |
|