Skip to content

Commit e3d04fc

Browse files
chore: update example docs commands
1 parent 0753b18 commit e3d04fc

File tree

4 files changed

+24
-40
lines changed

4 files changed

+24
-40
lines changed

src/lib/nodes/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ export async function addCreate(program: Command) {
466466
create.addOption(
467467
new Option(
468468
"-i, --image <image-id>",
469-
"ID of the VM image to boot on the nodes. View available images with `sf vms images list`.",
469+
"ID of the VM image to boot on the nodes. View available images with `sf node images list`.",
470470
),
471471
);
472472
}

src/lib/nodes/image/upload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ const upload = new Command("upload")
375375

376376
const object = completeResponse.data;
377377
console.log(gray("\nNext steps:"));
378-
console.log(` sf vm images show ${cyan(object.image_id)}`);
378+
console.log(` sf nodes images show ${cyan(object.image_id)}`);
379379
} catch (err) {
380380
// Clean up spinner timer
381381
if (spinnerTimer) {

src/lib/nodes/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ import get from "./get.tsx";
1111
import { addRedeploy } from "./redeploy.ts";
1212
import ssh from "./ssh.ts";
1313
import logs from "./logs.ts";
14-
import { isFeatureEnabled } from "../posthog.ts";
14+
import { addImage } from "./image/index.ts";
1515

1616
export async function registerNodes(program: Command) {
17-
const isEnabled = await isFeatureEnabled("vm-provider");
18-
if (!isEnabled) return;
19-
2017
const nodes = program
2118
.command("nodes")
2219
.alias("node")
@@ -80,6 +77,9 @@ $ sf nodes ssh user@vm_xxxxxxxxxxxxxxxxxxxxx
8077
8178
\x1b[2m# View logs from a specific VM\x1b[0m
8279
$ sf nodes logs -i vm_xxxxxxxxxxxxxxxxxxxxx
80+
81+
\x1b[2m# Manage custom VM images\x1b[0m
82+
$ sf nodes images --help
8383
`,
8484
)
8585
// Add action to display help if no subcommand is provided
@@ -103,6 +103,7 @@ $ sf nodes --help
103103
`);
104104
});
105105

106+
await addImage(nodes);
106107
await addCreate(nodes);
107108
await addRedeploy(nodes);
108109
}

src/lib/nodes/list.tsx

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function getActionsForNode(node: SFCNodes.Node) {
108108
if (lastVm?.image_id) {
109109
nodeActions.push({
110110
label: "Image",
111-
command: `sf vms image show ${brightBlack(lastVm.image_id)}`,
111+
command: `sf nodes image show ${brightBlack(lastVm.image_id)}`,
112112
});
113113
}
114114

@@ -118,12 +118,12 @@ function getActionsForNode(node: SFCNodes.Node) {
118118
if (lastVm?.id) {
119119
nodeActions.push({
120120
label: "SSH",
121-
command: `sf vms ssh root@${brightBlack(String(lastVm.id))}`,
121+
command: `sf nodes ssh root@${brightBlack(node.name)}`,
122122
});
123123
nodeActions.push(
124124
{
125125
label: "Logs",
126-
command: `sf vms logs -i ${brightBlack(String(lastVm.id))}`,
126+
command: `sf nodes logs ${brightBlack(node.name)}`,
127127
},
128128
);
129129
}
@@ -145,11 +145,11 @@ function getActionsForNode(node: SFCNodes.Node) {
145145
nodeActions.push(
146146
{
147147
label: "SSH",
148-
command: `sf vms ssh root@${brightBlack(lastVm.id)}`,
148+
command: `sf nodes ssh root@${brightBlack(node.name)}`,
149149
},
150150
{
151151
label: "Logs",
152-
command: `sf vms logs -i ${brightBlack(lastVm.id)}`,
152+
command: `sf nodes logs ${brightBlack(node.name)}`,
153153
},
154154
);
155155
}
@@ -204,7 +204,7 @@ function getActionsForNode(node: SFCNodes.Node) {
204204
nodeActions.push(
205205
{
206206
label: "Logs",
207-
command: `sf vms logs -i ${brightBlack(lastVm.id)}`,
207+
command: `sf nodes logs ${brightBlack(node.name)}`,
208208
},
209209
);
210210
}
@@ -244,11 +244,11 @@ function getActionsForNode(node: SFCNodes.Node) {
244244
nodeActions.push(
245245
{
246246
label: "SSH",
247-
command: `sf vms ssh root@${brightBlack(lastVm.id)}`,
247+
command: `sf nodes ssh root@${brightBlack(node.name)}`,
248248
},
249249
{
250250
label: "Logs",
251-
command: `sf vms logs -i ${brightBlack(lastVm.id)}`,
251+
command: `sf nodes logs ${brightBlack(node.name)}`,
252252
},
253253
);
254254
}
@@ -480,9 +480,8 @@ async function listNodesAction(options: ReturnType<typeof list.opts>) {
480480
);
481481

482482
// Get actions from all nodes, deduplicated with newest nodes taking precedence
483-
const nodesCommands: string[] = [];
484-
const vmsCommands: string[] = [];
485-
const seenNodesLabels = new Set<string>();
483+
const allCommands: string[] = [];
484+
const seenLabels = new Set<string>();
486485

487486
// Sort nodes by created_at (newest first), fallback to index for consistent ordering
488487
const sortedNodes = [...nodes].sort((a, b) => {
@@ -492,38 +491,22 @@ async function listNodesAction(options: ReturnType<typeof list.opts>) {
492491
});
493492

494493
// Collect actions from each node, with newer nodes taking precedence
495-
// Limit to 3 nodes commands and 1 vms command
494+
// Limit to 5 commands total, deduplicated by label
496495
for (const node of sortedNodes) {
497496
const nodeActions = getActionsForNode(node);
498497
for (const action of nodeActions) {
499-
const isVmsCommand = action.command.includes("sf vms");
500-
501-
if (isVmsCommand) {
502-
// Only add the first vms command we encounter (from newest node)
503-
if (vmsCommands.length === 0) {
504-
vmsCommands.push(action.command);
505-
}
506-
} else {
507-
// For nodes commands, limit to 3 and deduplicate by label
508-
if (
509-
nodesCommands.length < 3 && !seenNodesLabels.has(action.label)
510-
) {
511-
nodesCommands.push(action.command);
512-
seenNodesLabels.add(action.label);
513-
}
498+
// Add command if we haven't seen this label and haven't reached the limit
499+
if (allCommands.length < 5 && !seenLabels.has(action.label)) {
500+
allCommands.push(action.command);
501+
seenLabels.add(action.label);
514502
}
515503
}
516504
}
517505

518506
// Print Next Steps section
519-
if (nodesCommands.length > 0 || vmsCommands.length > 0) {
507+
if (allCommands.length > 0) {
520508
console.log(gray("\nNext steps:"));
521-
// Print nodes commands first
522-
for (const command of nodesCommands) {
523-
console.log(` ${command}`);
524-
}
525-
// Then print vms commands
526-
for (const command of vmsCommands) {
509+
for (const command of allCommands) {
527510
console.log(` ${command}`);
528511
}
529512
}

0 commit comments

Comments
 (0)