refactor(cli,auth): consolidate auth/profile model (BREAKING)

Auth now acts on the active profile instead of per-command --host/--name:
register a target with `profile add <name> --host <url> --use`, then
`auth login`. `auth login --with-token` reads an API key from stdin
(non-interactive, agent default); password login is interactive-only.

`auth token` prints the raw credential by default (clean $(...) capture);
--format json emits the {token,mode,profile} envelope, --jq implies json.
Login mode label corrected (api-key vs bearer). profile use and the auth/
profile read commands gain --dry-run / agent-help where they were missing.
This commit is contained in:
nullkey
2026-05-29 20:06:19 +08:00
committed by lyingbug
parent 6a1d0834c4
commit a68cc59310
17 changed files with 493 additions and 156 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ func runRemove(opts *RemoveOptions, fopts *cmdutil.FormatOptions, name string, s
// Confirmation only fires for removing the current profile - non-current
// remove uses the same low-friction policy as `auth logout`.
if wasCurrent {
if err := cmdutil.ConfirmDestructive(p, opts.Yes, jsonOut, "current profile", name, "profile.remove", fmt.Sprintf("weknora profile remove %s -y", name)); err != nil {
if err := cmdutil.ConfirmDestructive(p, opts.Yes, jsonOut, "remove", "current profile", name, "profile.remove", fmt.Sprintf("weknora profile remove %s -y", name)); err != nil {
return err
}
}