Skip to content

Commit 1ff3b2a

Browse files
committed
refactor(cli): rename --no-set-active to --no-activate
Match `ant`'s existing `profile activate` verb and the `--no-<verb>` flag pattern used elsewhere in this CLI (e.g. `--no-browser`). The previous name leaked the internal `active_config` filename into the public flag surface; the operation users already think in is "activate". No behavior change. Renames the flag, the corresponding stderr message, and TestAuthLoginNoActivate.
1 parent 5f7715f commit 1ff3b2a

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

pkg/cmd/cmd_auth.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func init() {
134134
Usage: "Print the token exchange status and Request-Id to stderr",
135135
},
136136
&cli.BoolFlag{
137-
Name: "no-set-active",
137+
Name: "no-activate",
138138
Usage: "Do not update active_config after login; pass --profile or ANTHROPIC_PROFILE on later commands.",
139139
},
140140
},
@@ -480,7 +480,7 @@ func authLogin(ctx context.Context, c *cli.Command) error {
480480
}
481481

482482
// Decide whether this login should also become the active profile:
483-
// - --no-set-active → never activate (opt-out for external-tool bootstrap;
483+
// - --no-activate → never activate (opt-out for external-tool bootstrap;
484484
// active_config is shared with Claude Code / the Claude Agent SDK).
485485
// - --profile/ANTHROPIC_PROFILE explicitly given → always activate
486486
// (the user named a target; make subsequent commands use it).
@@ -490,7 +490,7 @@ func authLogin(ctx context.Context, c *cli.Command) error {
490490
if data, err := os.ReadFile(config.ActiveConfigPath(dir)); err == nil {
491491
prevActive = strings.TrimSpace(string(data))
492492
}
493-
wantActivate := !c.Bool("no-set-active") && (c.IsSet("profile") || prevActive == "")
493+
wantActivate := !c.Bool("no-activate") && (c.IsSet("profile") || prevActive == "")
494494
activated := false
495495
if wantActivate && prevActive != profile {
496496
if err := config.SetActiveProfile(dir, profile); err != nil {
@@ -514,8 +514,8 @@ func authLogin(ctx context.Context, c *cli.Command) error {
514514
fmt.Fprintf(os.Stderr, " → set as active profile (was %q)\n", prevActive)
515515
}
516516
}
517-
if !activated && c.Bool("no-set-active") && prevActive != "" && prevActive != profile {
518-
fmt.Fprintf(os.Stderr, " → active profile unchanged (still %q; --no-set-active in effect)\n", prevActive)
517+
if !activated && c.Bool("no-activate") && prevActive != "" && prevActive != profile {
518+
fmt.Fprintf(os.Stderr, " → active profile unchanged (still %q; --no-activate in effect)\n", prevActive)
519519
}
520520
fmt.Fprintf(os.Stderr, " config: %s\n credentials: %s\n",
521521
config.ProfilePath(dir, profile), credsPath)

pkg/cmd/cmd_auth_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ func loginCmdDef() *cli.Command {
658658
&cli.StringFlag{Name: "scope"},
659659
&cli.StringFlag{Name: "workspace-id"},
660660
&cli.BoolFlag{Name: "debug"},
661-
&cli.BoolFlag{Name: "no-set-active"},
661+
&cli.BoolFlag{Name: "no-activate"},
662662
},
663663
}},
664664
}
@@ -1016,27 +1016,27 @@ func TestAuthLoginActivatesExplicitProfile(t *testing.T) {
10161016
assert.Equal(t, "b", strings.TrimSpace(string(mustRead(t, config.ActiveConfigPath(dir)))))
10171017
}
10181018

1019-
// TestAuthLoginNoSetActive guards the --no-set-active opt-out: credentials
1019+
// TestAuthLoginNoActivate guards the --no-activate opt-out: credentials
10201020
// must still be written, but active_config must not be created or
10211021
// retargeted regardless of whether --profile is given via flag or
10221022
// ANTHROPIC_PROFILE env source.
1023-
func TestAuthLoginNoSetActive(t *testing.T) {
1023+
func TestAuthLoginNoActivate(t *testing.T) {
10241024
t.Run("retarget skipped, prior active preserved", func(t *testing.T) {
10251025
dir := t.TempDir()
10261026
t.Setenv("ANTHROPIC_CONFIG_DIR", dir)
10271027
clearEnv(t, "ANTHROPIC_PROFILE")
10281028
require.NoError(t, config.SetActiveProfile(dir, "a"))
10291029

10301030
srv := newTokenServer(t, tokenResponse{AccessToken: "tok", RefreshToken: "rt", ExpiresIn: 600})
1031-
_, stderr, err := driveLoginErr(t, srv.URL, "--profile", "b", "--no-set-active")
1031+
_, stderr, err := driveLoginErr(t, srv.URL, "--profile", "b", "--no-activate")
10321032
require.NoError(t, err)
10331033

10341034
assert.Equal(t, "a", strings.TrimSpace(string(mustRead(t, config.ActiveConfigPath(dir)))),
1035-
"--no-set-active must not retarget active_config")
1035+
"--no-activate must not retarget active_config")
10361036
assert.FileExists(t, config.ProfileCredentialsPath(dir, "b"),
10371037
"credentials/<profile>.json must still be written")
10381038
assert.Contains(t, stderr,
1039-
`→ active profile unchanged (still "a"; --no-set-active in effect)`,
1039+
`→ active profile unchanged (still "a"; --no-activate in effect)`,
10401040
"stderr must announce the opt-out skip with the prior active value")
10411041
})
10421042

@@ -1046,27 +1046,27 @@ func TestAuthLoginNoSetActive(t *testing.T) {
10461046
clearEnv(t, "ANTHROPIC_PROFILE")
10471047

10481048
srv := newTokenServer(t, tokenResponse{AccessToken: "tok", RefreshToken: "rt", ExpiresIn: 600})
1049-
_, stderr, err := driveLoginErr(t, srv.URL, "--profile", "c", "--no-set-active")
1049+
_, stderr, err := driveLoginErr(t, srv.URL, "--profile", "c", "--no-activate")
10501050
require.NoError(t, err)
10511051

10521052
assert.NoFileExists(t, config.ActiveConfigPath(dir),
1053-
"--no-set-active must not create active_config when absent")
1053+
"--no-activate must not create active_config when absent")
10541054
assert.NotContains(t, stderr, "active profile unchanged",
10551055
"no opt-out skip message when there was no prior active")
10561056
})
10571057

1058-
t.Run("env-source profile honors --no-set-active", func(t *testing.T) {
1058+
t.Run("env-source profile honors --no-activate", func(t *testing.T) {
10591059
dir := t.TempDir()
10601060
t.Setenv("ANTHROPIC_CONFIG_DIR", dir)
10611061
require.NoError(t, config.SetActiveProfile(dir, "x"))
10621062
t.Setenv("ANTHROPIC_PROFILE", "y")
10631063

10641064
srv := newTokenServer(t, tokenResponse{AccessToken: "tok", RefreshToken: "rt", ExpiresIn: 600})
1065-
_, _, err := driveLoginErr(t, srv.URL, "--no-set-active")
1065+
_, _, err := driveLoginErr(t, srv.URL, "--no-activate")
10661066
require.NoError(t, err)
10671067

10681068
assert.Equal(t, "x", strings.TrimSpace(string(mustRead(t, config.ActiveConfigPath(dir)))),
1069-
"--no-set-active honored when profile resolves via ANTHROPIC_PROFILE")
1069+
"--no-activate honored when profile resolves via ANTHROPIC_PROFILE")
10701070
assert.FileExists(t, config.ProfileCredentialsPath(dir, "y"))
10711071
})
10721072
}

0 commit comments

Comments
 (0)