Skip to content

fix: improve sf nodes ssh documentation and specification#240

Merged
sigmachirality merged 8 commits intomainfrom
cursor/ssh-command-user-prefix-3c4c
Jan 21, 2026
Merged

fix: improve sf nodes ssh documentation and specification#240
sigmachirality merged 8 commits intomainfrom
cursor/ssh-command-user-prefix-3c4c

Conversation

@sigmachirality
Copy link
Member

@sigmachirality sigmachirality commented Jan 20, 2026

Update SSH command examples to consistently include a user prefix and remove redundant examples.

Previously, some SSH examples omitted the username prefix, which could lead to confusion about the default user or encourage behavior inconsistent with best practices. This change ensures all examples explicitly show root@ (or <account>@) for clarity and consistency with documentation.


Open in Cursor Open in Web

- Remove redundant examples without user prefix from ssh.ts help text
- Add root@ prefix to all remaining SSH examples in ssh.ts and index.ts
- Ensures consistency with documentation and reduces user confusion

Co-authored-by: danieltaox <danieltaox@gmail.com>
@cursor
Copy link

cursor bot commented Jan 20, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@semanticdiff-com
Copy link

semanticdiff-com bot commented Jan 20, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/nodes/ssh.ts  34% smaller
  src/lib/nodes/index.ts  0% smaller
  src/lib/vm/list.ts  0% smaller
  src/lib/vm/ssh.ts  0% smaller

@sigmachirality sigmachirality changed the title SSH command user prefix fix: add user prefix to all SSH examples Jan 20, 2026
@sigmachirality sigmachirality marked this pull request as ready for review January 20, 2026 22:51
@sigmachirality sigmachirality self-assigned this Jan 20, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 20, 2026

Greptile Summary

This PR updates SSH command examples to consistently include username prefixes (root@ or jenson@) across help text and documentation. The intent is to improve clarity on how to properly use SSH commands.

However, the changes introduce a documentation-code mismatch: while all examples now show a username as required, the actual implementation still supports optional usernames (lines 54-56 in ssh.ts allow single-part destinations without a username). This misleads users into thinking the username prefix is mandatory when it's actually optional.

Confidence Score: 2/5

  • This PR has logic issues that create misleading documentation and potential user confusion.
  • The PR addresses a valid goal (consistency in examples) but creates a documentation-code mismatch. The examples now suggest usernames are required, while the code explicitly handles the case where no username is provided (see lines 54-56). This gap between documentation and implementation can confuse users and goes against best practices of keeping examples aligned with actual supported behavior. The code won't break, but users may unnecessarily struggle or believe features aren't available.
  • Both src/lib/nodes/ssh.ts and src/lib/nodes/index.ts need attention to ensure examples accurately reflect all supported usage patterns, particularly that usernames are optional.

Important Files Changed

Filename Overview
src/lib/nodes/ssh.ts Updated SSH examples to always include username prefix (root@ or jenson@). However, this creates a misleading documentation where examples show the username as required, while the code logic at lines 54-56 still allows SSH calls without a username prefix. Users following only the examples won't know that sf nodes ssh my-node is still valid.
src/lib/nodes/index.ts Updated help text examples to include root@ prefix for consistency with ssh.ts. Same issue as ssh.ts: examples now suggest username is required when the code still supports optional usernames (lines 74, 80).

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as sf nodes ssh
    participant Parser as Destination Parser
    participant API as Node/VM API
    participant SSH as SSH Client

    User->>CLI: sf nodes ssh [root@]my-node
    CLI->>Parser: Split destination by '@'
    
    alt Username provided
        Parser->>Parser: username = first part
        Parser->>Parser: nodeOrVmId = second part
    else No username provided
        Parser->>Parser: username = undefined
        Parser->>Parser: nodeOrVmId = full destination
    end
    
    Parser->>API: Fetch VM details (nodeOrVmId)
    API-->>Parser: SSH hostname, port, host keys
    
    Parser->>Parser: Build SSH destination
    alt If username defined
        Parser->>Parser: sshDestination = username@hostname:port
    else No username
        Parser->>Parser: sshDestination = hostname:port
    end
    
    Parser->>SSH: Execute ssh command
    SSH-->>User: SSH session established

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.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

cursoragent and others added 5 commits January 20, 2026 23:21
- Update argument descriptions to use root@HOST and root@VM_ID
- Update vm list example output to show root@VM_ID
- Ensures consistency across all SSH command documentation

Co-authored-by: danieltaox <danieltaox@gmail.com>
- Change argument descriptions to use [user@]hostname format following SSH man page conventions
- Keep root@ in actual examples (specific usage)
- Aligns with standard SSH documentation patterns

Co-authored-by: danieltaox <danieltaox@gmail.com>
@sigmachirality sigmachirality changed the title fix: add user prefix to all SSH examples fix: improve sf nodes ssh documentation and specification Jan 21, 2026
@sigmachirality sigmachirality merged commit 26a311a into main Jan 21, 2026
1 check passed
@sigmachirality sigmachirality deleted the cursor/ssh-command-user-prefix-3c4c branch January 21, 2026 00:34
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