Skip to content

Commit d100a8b

Browse files
GenerQAQclaude
andauthored
fix(cli): record API key history when creating project via CLI (#431)
Dashboard has onboarding flow so it doesn't need to record the initial API key, but CLI creates and sets the default project directly. This adds a best-effort RecordKeyRotation call (same as key rotation) so the initial key appears in project_secret_key_rotations history. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5bf2c13 commit d100a8b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/client/acontext-cli/cmd/dash_projects.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@ func init() {
220220
if project.SecretKey != "" {
221221
if err := auth.SetProjectKey(project.ProjectID, project.SecretKey); err == nil {
222222
_ = auth.SetDefaultProject(project.ProjectID)
223+
// Record initial API key in history (best-effort, same as key rotation)
224+
if dashAccessToken != "" && dashUserEmail != "" {
225+
if rotErr := auth.RecordKeyRotation(dashAccessToken, project.ProjectID, dashUserEmail, project.SecretKey); rotErr != nil {
226+
fmt.Printf("Warning: failed to record API key history: %v\n", rotErr)
227+
}
228+
}
223229
fmt.Printf("Default project set to: %s\n", project.ProjectID)
224230
printSetupComplete()
225231
}

0 commit comments

Comments
 (0)