Repository navigation
feat(cli): arara mode live/test — switch sem copy-paste de chave - #3
Merged
Merged
Conversation
Novo subcomando que troca o profile entre LIVE e TEST usando a sessao OAuth ja autenticada. A chave nunca aparece na tela nem no shell history — vai direto pro keyring do SO. arara mode mostra o modo atual arara mode live cria/persiste chave LIVE, atualiza profile.Mode=live arara mode test remove chave LIVE do keyring, sugere reauth OAuth Antes, pra ir de TEST pra LIVE o usuario tinha que: 1. arara keys create --mode LIVE (chave aparece na tela) 2. echo "ara_live_xxx" | arara login (copia/cola manual) Agora e um comando. Trocar de volta pra TEST exige `arara login` pra restaurar a sessao OAuth — sem isso o cliente fica sem credencial. ## Mudancas auxiliares - `Client.CreateAPIKey(mode)` -> `CreateAPIKey(mode, name)`: backend passou a exigir name no body (400 sem isso). Adiciona flag --name no `arara keys create` (default: `cli-<hostname>`) e atualiza chamadas internas no REPL e nos tests. - Atualiza tests em internal/api/wrappers_test.go e internal/cmd/keys_test.go pra nova assinatura. ## Test plan local - go build ./... OK - go test -race ./... 13/13 packages OK - golangci-lint run 0 issues - govulncheck ./... 0 vulnerabilities
2 tasks
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
Novo subcomando
arara modeque permite alternar entre LIVE e TEST sem precisar copiar/colar API key. A chave fica no keyring do SO, nunca aparece na tela.Por quê
O REPL decide o badge LIVE/TEST pelo prefixo do que está armazenado no keyring (
ara_live_*→ LIVE). Quem loga via OAuth Device Flow tem oaccess_tokenJWT salvo no slot — que não tem o prefixoara_live_→ sempre aparece como TEST, mesmo com conta ACTIVE.Workaround antigo era 2 passos com chave visível:
arara keys create --mode LIVE(chave aparece em stdout + shell history)echo "ara_live_xxx" | arara loginAgora é 1 comando, chave nunca leak.
Mudanças auxiliares
Client.CreateAPIKey(mode)→CreateAPIKey(mode, name): backend exigenameno body doPOST /v1/api-keys(retorna 400 sem).arara keys createganha flag--name(default:cli-<hostname>). Tests atualizados.Test plan
go build ./...BUILD OKgo test -race ./...13/13 packages OKgolangci-lint run0 issuesgovulncheck ./...0 vulnerabilitiesValidação end-to-end (manual, pós-merge)
🤖 Generated with Claude Code