feat(auth): add profile rename and make write verbs safe - #6
Merged
Conversation
Add `dscrd auth rename <old> <new> [--force]`. When the renamed profile is the active one, `active` follows it — otherwise every later command would resolve against a profile that no longer exists. Close two gaps the rename exposed: - The auth group ignored `--dry-run` while the `write` annotation advertised it in the generated skill, so a command run to preview it wrote for real. All four write verbs now preview via `dryRunLocal`. Local verbs have no API response, so they honor `--dry-run` only. - `set-token` silently overwrote an existing profile. A stored token cannot be read back, so a mistyped `--name` destroyed another bot's credential with no way to recover it. Overwriting now needs `--force`, and a fallback to the `default` label is called out in the output. Profile names are validated as [A-Za-z0-9_-]+ on write only, keeping them safe as bare TOML keys without invalidating existing configs. `auth status` now sorts its listing instead of leaking Go's map iteration order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Merged
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.
Why
Storing a second bot without
--namesilently lands it under thedefaultlabel, and there was no way to relabel it afterwards. Fixing that surfaced two
adjacent problems in the same command group.
What
dscrd auth rename <old> <new> [--force]— relabel a stored profile.When the renamed profile is the active one,
activefollows it; otherwiseevery later command would resolve against a profile that no longer exists.
--dry-runnow works across theauthgroup. All four write verbs carrythe
writeannotation, which makes the generated skill advertise--dry-run— but none of them checked the flag, so a command run to previewit wrote for real. They now preview through
dryRunLocal. Local verbs haveno API response, so they honor
--dry-runonly, not--raw.set-tokenno longer clobbers silently. A stored token cannot be readback, so a mistyped
--namedestroyed another bot's credential with no wayto recover it. Overwriting now requires
--force, and falling back to thedefaultlabel is called out in the output.Profile names are validated as
[A-Za-z0-9_-]+on write only, keepingthem safe as bare TOML keys without invalidating configs written earlier.
auth statussorts its listing instead of leaking Go's map iteration order.Verification
go test ./...green, includingTestZZAllCommandsCovered,TestSkillsTreeInSyncandTestNoForeignBranding.activealone,target-taken rejected then accepted with
--force, same-name andmissing-source rejected, invalid names rejected, and all four verbs leaving
the config byte-identical under
--dry-run.auth test --profile <new>resolvesagainst an
httptestserver after the rename.DSCRD_CONFIG, 12 scenarios.Notes
Updating an existing profile's
--default-guildnow also requires--forceand re-supplying the token. README documents this and recommends passing
--default-guildduring initial setup instead.VERSIONis intentionally untouched — release bumps are their own PR.🤖 Generated with Claude Code