feat: add sf migrate command and Rust CLI migration banner#266
feat: add sf migrate command and Rust CLI migration banner#266sigmachirality wants to merge 4 commits into
sf migrate command and Rust CLI migration banner#266Conversation
Show a cyan migration banner when the upgrade banner isn't being shown to nudge users toward the new Rust-based sf CLI, and add a `sf migrate` command that runs the new install script. Generated with [Indent](https://indent.com) Co-Authored-By: Indent <noreply@indent.com>
|
|
Capy auto-review is paused for this organization because the monthly auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews. |
- Skip migrate banner when running `sf upgrade` (was showing above upgrade output because checkVersion returns false early for it) - Add SF_CLI_DISABLE_MIGRATE_BANNER opt-out, surfaced in the banner - Use process.argv[2] === "migrate" for tighter scoping, matching the existing pattern in checkVersion.ts - Handle spawn errors in handleMigrate so ENOENT/EACCES on bash surface as a clean failure instead of crashing the CLI Generated with [Indent](https://indent.com) Co-Authored-By: Indent <noreply@indent.com>
Lead with the Rust rewrite and new commands, then surface the reselling story (the most important reason to migrate, per the April 7 changelog) before the action and fallback text. Generated with [Indent](https://indent.com) Co-Authored-By: Indent <noreply@indent.com>
Per DTao. Generated with [Indent](https://indent.com) Co-Authored-By: Indent <noreply@indent.com>
joshi4
left a comment
There was a problem hiding this comment.
LGTM.
you can consider the alternative banner copy I suggested or ship as is, I leave that up to you.
| "https://docs.sfcompute.com/preview/guides/migrating-from-nodes"; | ||
|
|
||
| export function showMigrateBanner() { | ||
| const message = `We've rewritten sf in Rust — faster, with new commands |
There was a problem hiding this comment.
If this is the first time some one is seeing this:
- sf capacities etc doesn't mean anything to them.
- rewritten in rust also doesn't entice them to migrate.
Suggested copy below. Tried to highlight better compute utilization/planning and reselling. If that piques their curiosity then can look at our docs.
A new sf is here.
Intuitive tools to plan, buy, and utilize compute.
Resell unused compute back on our orderbook and earn credits.
Opt in to get early access.
Run 'sf migrate'...
Docs: <link to preview docs>
Alternative Resell line:
Save upto 20% by reselling compute back on our orderbook and earn credits. Source: https://sfcompute.slack.com/archives/C09UJ3K6T4P/p1779323745810779
Summary
When no upgrade banner is shown on startup, the legacy CLI now nudges users to migrate to the new Rust-based
sf(blueprint/preview docs). Adds asf migratesubcommand that runs the new install script fromhttps://cli.sfcompute.com.Motivation
sf-cli(the Rust replacement living insfcompute/sfcompute) is the path forward. We want every invocation of the legacy CLI to surface that path — but only when we're not already asking the user to upgrade the current binary, to avoid double-stacking banners.The new install script at
cli.sfcompute.comalready moves the existingsfbinary tosf-old, so users keep access to the legacy CLI during the transition. The banner andsf migrateoutput both call that out.Changes
src/checkVersion.ts—checkVersion()now returnsbooleanindicating whether an upgrade banner was shown (or an auto-upgrade kicked off). All early-return paths returnfalse.src/index.ts— whencheckVersion()returnsfalse(and the user isn't already runningsf migrate), show the new migration banner. Still skipped under--json.src/lib/migrate.ts— new module exporting:showMigrateBanner()— cyan boxen banner copy matching the existing upgrade-banner shape (short status, blank line, action, docs link).handleMigrate()/registerMigrate()—sf migratefetcheshttps://cli.sfcompute.comand pipes it tobash, mirroringhandleUpgrade()'s pattern but with stdio inherited so users see the install progress live.Banner copy
Sticks to the legacy banner's shape (lead with the news, blank line, action, link). Cyan rather than yellow to distinguish from urgency warnings — yellow is reserved for "please upgrade" / app-warning banners. Mentions the three headline commands from the preview quick-start and the
sf-oldfallback behavior baked into the new install script.Testing
bun run check— passesbun run lint— passes (no new warnings; pre-existing warnings unchanged)bun run test— 9 passedbun run dev --helpand confirmed the banner renders correctlyTag
@indentto continue the conversation here.