Skip to content

Commit 5bbfc67

Browse files
remove auth refresh subcommand and add CLAUDE.md (#30)
The auth refresh command leaked token bytes to stdout and did not force a real refresh. Removed it entirely; export subcommands refresh automatically. Updated statusCmd docs and error message to drop all references to auth refresh. Added CLAUDE.md instructing Claude to always open a PR after changes. Closes #19. Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Darrell <[email protected]>
1 parent c6e3763 commit 5bbfc67

2 files changed

Lines changed: 8 additions & 17 deletions

File tree

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Claude Guidelines
2+
3+
## Pull Requests
4+
5+
Always create a pull request after implementing any fix or change. Use `gh pr create` to open the PR automatically — do not just provide a "Create PR" link and leave it to the human.

cmd/auth.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,15 @@ var logoutCmd = &cobra.Command{
7878
},
7979
}
8080

81-
var refreshCmd = &cobra.Command{
82-
Use: "refresh",
83-
Short: "Force a token refresh and report status",
84-
RunE: func(cmd *cobra.Command, args []string) error {
85-
token, err := auth.GetToken()
86-
if err != nil {
87-
return err
88-
}
89-
fmt.Printf("Token valid: %s...\n", token[:min(20, len(token))])
90-
return nil
91-
},
92-
}
93-
9481
var statusCmd = &cobra.Command{
9582
Use: "status",
9683
Short: "Print one-line auth readiness state and exit 0 if usable",
9784
Long: `Print a one-line summary of whether the CLI has a usable token. Exit 0
9885
if a saved token is present and not yet expired, 1 otherwise.
9986
10087
This is a local check — no network call and no refresh is attempted, even
101-
when the saved token is expired. Use 'auth refresh' (or any export
102-
subcommand) to actually refresh.
88+
when the saved token is expired. Any export subcommand will refresh
89+
automatically when needed.
10390
10491
Per the quantcli shared contract:
10592
https://github.com/quantcli/common/blob/main/CONTRACT.md#5-auth`,
@@ -110,7 +97,7 @@ https://github.com/quantcli/common/blob/main/CONTRACT.md#5-auth`,
11097
}
11198
exp := store.ExpiresAt.Local().Format(time.RFC3339)
11299
if time.Now().After(store.ExpiresAt) {
113-
return fmt.Errorf("token expired %s — run: withings-export auth refresh", exp)
100+
return fmt.Errorf("token expired %s — run: withings-export auth login", exp)
114101
}
115102
fmt.Fprintf(cmd.OutOrStdout(), "logged in as user %s (token expires %s)\n", store.UserID, exp)
116103
return nil
@@ -120,6 +107,5 @@ https://github.com/quantcli/common/blob/main/CONTRACT.md#5-auth`,
120107
func init() {
121108
authCmd.AddCommand(loginCmd)
122109
authCmd.AddCommand(logoutCmd)
123-
authCmd.AddCommand(refreshCmd)
124110
authCmd.AddCommand(statusCmd)
125111
}

0 commit comments

Comments
 (0)