Skip to content

Commit 26a311a

Browse files
fix: improve sf nodes ssh documentation and specification (#240)
Co-authored-by: danieltaox <danieltaox@gmail.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent edbe3bc commit 26a311a

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

src/lib/nodes/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ $ sf nodes set my-node-name --max-price 12.50
7171
$ sf nodes extend my-node-name --duration 3600 --max-price 12.50
7272
7373
\x1b[2m# SSH into a node's current VM\x1b[0m
74-
$ sf nodes ssh my-node-name
74+
$ sf nodes ssh root@my-node-name
7575
7676
\x1b[2m# View logs from a node's current VM\x1b[0m
7777
$ sf nodes logs my-node-name
7878
7979
\x1b[2m# SSH into a specific VM\x1b[0m
80-
$ sf nodes ssh user@vm_xxxxxxxxxxxxxxxxxxxxx
80+
$ sf nodes ssh root@vm_xxxxxxxxxxxxxxxxxxxxx
8181
8282
\x1b[2m# View logs from a specific VM\x1b[0m
8383
$ sf nodes logs -i vm_xxxxxxxxxxxxxxxxxxxxx

src/lib/nodes/ssh.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ import { getApiUrl } from "../../helpers/urls.ts";
1616
import { getAuthToken } from "../../helpers/config.ts";
1717

1818
const ssh = new Command("ssh")
19-
.description("SSH into a VM on a node")
19+
.description(`SSH into a VM on a node.
20+
21+
Runs \`ssh\` with host keys from the API, forgoing the need to manually accept keys on first connect.
22+
Keys are fetched asynchronously from the VM's SSH server and may take a moment to populate.
23+
24+
Standard \`ssh\` behavior applies (e.g. defaults to your current username).`)
2025
.showHelpAfterError()
2126
.option("-q, --quiet", "Quiet mode", false)
2227
.option(
@@ -27,25 +32,23 @@ const ssh = new Command("ssh")
2732
.addOption(jsonOption)
2833
.argument(
2934
"<destination>",
30-
"USERNAME@HOST The (optional) username, and node name/ID or VM ID to SSH into",
35+
"Node name, Node ID, or VM ID to SSH into.\nFollows \`ssh\` behavior (i.e. root@node or jenson@node).",
3136
)
37+
.usage("[options] [user@]<destination>")
3238
.allowExcessArguments(false)
3339
.addHelpText(
3440
"after",
3541
`
3642
Examples:
3743
3844
\x1b[2m# SSH into a node's current VM\x1b[0m
39-
$ sf nodes ssh my-node
45+
$ sf nodes ssh root@my-node
4046
4147
\x1b[2m# SSH with a specific username\x1b[0m
4248
$ sf nodes ssh jenson@my-node
43-
49+
4450
\x1b[2m# SSH directly to a VM ID\x1b[0m
45-
$ sf nodes ssh vm_xxxxxxxxxxxxxxxxxxxxx
46-
47-
\x1b[2m# SSH with username to a VM ID\x1b[0m
48-
$ sf nodes ssh huang@vm_xxxxxxxxxxxxxxxxxxxxx
51+
$ sf nodes ssh root@vm_xxxxxxxxxxxxxxxxxxxxx
4952
`,
5053
)
5154
.action(async (destination, options) => {

src/lib/vm/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ You can use ${
144144
console.log(table.toString());
145145
console.log(`\n${gray("Use VM IDs to access and replace VMs.")}\n`);
146146
console.log(gray("Examples:"));
147-
console.log(` sf vm ssh ${cyan(`USERNAME@${exampleId}`)}`);
147+
console.log(` sf vm ssh ${cyan(`root@${exampleId}`)}`);
148148
console.log(` sf vm logs -i ${cyan(exampleId)} -f`);
149149
console.log(` sf vm replace -i ${cyan(exampleId)}`);
150150
});

src/lib/vm/ssh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function registerSsh(program: Command) {
2121
)
2222
.argument(
2323
"<destination>",
24-
"USERNAME@VM_ID The (optional) username, and VM id to SSH into.",
24+
"[user@]vm_id - The (optional) username, and VM id to SSH into.",
2525
)
2626
.allowExcessArguments(false)
2727
.action(async (destination, options) => {

0 commit comments

Comments
 (0)