Skip to content

Conversation

@sigmachirality
Copy link
Member

@sigmachirality sigmachirality commented Jan 21, 2026

Redesign sf zones ls to be more info dense + show soonest/max node count

image

@semanticdiff-com
Copy link

semanticdiff-com bot commented Jan 21, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/zones.tsx  7% smaller
  README.md Unsupported file format
  src/lib/contracts/ContractDisplay.tsx  0% smaller
  src/lib/orders/OrderDisplay.tsx  0% smaller

@sigmachirality sigmachirality self-assigned this Jan 21, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 21, 2026

Greptile Summary

This PR redesigns the sf zones ls command to display expanded zone availability information across three time windows (now, soonest within 1 day, max within 1 week). The implementation replaces the previous cli-table3 table with a custom Ink-based UI component that provides a more information-dense display with color-coded regions and formatted availability data.

Key changes:

  • Implemented getZoneCapacityMetrics() to calculate availability across time windows by iterating through API capacity rectangles
  • Created AvailabilityDisplay component to show node counts with time distances (e.g., "5 in 2h")
  • Redesigned table layout with dynamic column widths and visual separators
  • Added --all flag to show zones without availability (hidden by default)
  • Updated empty state messaging and usage examples to reference sf nodes create instead of deprecated sf buy
  • Applied consistent region name formatting (lowercase) and deterministic color assignment

The command text updates in ContractDisplay.tsx and OrderDisplay.tsx align with the broader shift from sf buy to sf nodes create as the primary command for purchasing compute.

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations around capacity calculation logic
  • The implementation is well-structured with comprehensive availability tracking across time windows. The UI redesign improves user experience significantly. One area of potential concern is whether overlapping capacity windows should be summed or show maximum values (current behavior), but this appears to be an intentional design choice. The migration from cli-table3 to Ink components is clean and the command text updates are straightforward.
  • src/lib/zones.tsx should be reviewed to confirm the capacity calculation logic (overlapping windows) matches expected behavior

Important Files Changed

Filename Overview
src/lib/zones.tsx Major redesign of zones listing command to show expanded availability windows (now, 1 day, 1 week) with improved UI using Ink components; replaced cli-table3 with custom table component
src/lib/contracts/ContractDisplay.tsx Updated help text to use sf nodes create instead of deprecated sf buy command
src/lib/orders/OrderDisplay.tsx Updated help text to use sf nodes create instead of deprecated sf buy command

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as sf zones ls
    participant API as /v0/zones API
    participant Display as ZonesTableDisplay

    User->>CLI: Execute command
    CLI->>CLI: Check if user is logged in
    alt Not logged in
        CLI->>User: Show login message
    else Logged in
        CLI->>API: GET /v0/zones
        API-->>CLI: Return zone data with available_capacity
        
        alt JSON output requested
            CLI->>User: Output JSON
        else Table output
            CLI->>CLI: Filter zones by availability
            loop For each zone
                CLI->>CLI: Calculate capacity metrics<br/>(now, 1 day, 1 week)
            end
            
            alt No zones with availability
                CLI->>Display: Render EmptyZonesDisplay
                Display->>User: Show "no zones available" message
            else Zones available
                CLI->>CLI: Sort zones by availability
                CLI->>Display: Render ZonesTableDisplay
                Display->>User: Show table with availability columns
            end
        end
    end
Loading

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.

Additional Comments (1)

  1. src/lib/zones.tsx, line 16 (link)

    syntax: components type is not imported.

    Add the import at the top of the file:

    import { components } from "../schema.ts";

1 file reviewed, 4 comments

Edit Code Review Agent Settings | Greptile

@sigmachirality sigmachirality changed the title feat: show expanded zone availability feat: [PR-1483] show expanded zone availability Jan 22, 2026
@sigmachirality
Copy link
Member Author

@greptile review again

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.

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@sigmachirality sigmachirality merged commit 91169b1 into main Jan 22, 2026
1 check passed
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