Skip to content

Conversation

@sigmachirality
Copy link
Member

Before:
Screenshot 2025-11-03 at 2 38 49 PM

After:
Screenshot 2025-11-03 at 2 40 52 PM

@semanticdiff-com
Copy link

semanticdiff-com bot commented Nov 3, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/tokens.ts  17% smaller
  src/helpers/command.ts  0% smaller
  src/helpers/errors.ts  0% smaller

@sigmachirality sigmachirality self-assigned this Nov 3, 2025
@sigmachirality sigmachirality merged commit 13ba694 into main Nov 3, 2025
1 check passed
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Fixed column width mismatch in sf tokens ls table output that caused display formatting issues.

Key changes:

  • Fixed table column widths from [40, 15, 25, 25] to [40, 15, 25] to match the 3 actual columns (Token ID, Name, Expires)
  • Refactored to use centralized formatDate helper from src/helpers/format-date.ts instead of local inline function
  • Removed unused getCommandBase() helper and src/helpers/command.ts file, hardcoding "sf" command throughout
  • Changed Token ID display color from gray to cyan for better visual distinction
  • Cleaned up @ts-ignore comment that's no longer needed

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward bug fixes and refactoring: (1) corrects a clear table formatting bug where column widths didn't match column count, (2) consolidates date formatting logic using existing helper, (3) removes unused code. All changes align with existing patterns in the codebase. The date conversion from formatDate(token.expires_at) to formatDate(new Date(token.expires_at)) is consistent with how formatDate is used elsewhere in the codebase.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/helpers/command.ts 5/5 File deleted - getCommandBase function removed as it's no longer needed
src/helpers/errors.ts 5/5 Simplified by removing getCommandBase dependency and hardcoding "sf" command
src/lib/tokens.ts 5/5 Fixed table column width mismatch (3 columns but 4 widths specified), improved formatting, consolidated date formatting

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as CLI (tokens.ts)
    participant API as SF Compute API
    participant Helper as formatDate Helper

    User->>CLI: sf tokens list
    CLI->>CLI: Check if logged in
    alt Not logged in
        CLI->>User: logLoginMessageAndQuit()
    end
    
    CLI->>CLI: Show loading spinner
    CLI->>API: GET /tokens (with Bearer token)
    
    alt Unauthorized (401)
        API-->>CLI: 401 Error
        CLI->>User: logSessionTokenExpiredAndQuit()
    end
    
    alt Success
        API-->>CLI: Token list data
        CLI->>CLI: Stop spinner
        
        alt No tokens
            CLI->>User: Display empty table
            CLI->>User: Show "sf tokens create" hint
        else Has tokens
            loop For each token
                CLI->>Helper: formatDate(new Date(expires_at))
                Helper-->>CLI: Formatted date string
                CLI->>CLI: Build table row [ID, Name, Expires]
            end
            CLI->>User: Display table (3 columns, widths: [40, 15, 25])
        end
    end
Loading

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants