@@ -42,6 +42,10 @@ async function main() {
4242 process . env . SF_CLI_DISABLE_AUTO_UPGRADE = "1" ;
4343 }
4444
45+ // Load config early so the migration banner can honor the persisted
46+ // `migrated_to_rust_cli` flag written by a successful `sf migrate`.
47+ const config = await loadConfig ( ) ;
48+
4549 if ( ! process . argv . includes ( "--json" ) ) {
4650 const [ shownUpgradeBanner ] = await Promise . all ( [
4751 checkVersion ( ) ,
@@ -51,14 +55,16 @@ async function main() {
5155 // them toward the new Rust CLI instead of showing nothing. We avoid
5256 // double-stacking with the upgrade banner since users on outdated builds
5357 // need to upgrade before migrating, and skip the banner for the
54- // `upgrade` / `migrate` commands themselves (where it'd just be noise)
55- // and for users who've opted out via SF_CLI_DISABLE_MIGRATE_BANNER.
58+ // `upgrade` / `migrate` commands themselves (where it'd just be noise),
59+ // for users who've opted out via SF_CLI_DISABLE_MIGRATE_BANNER, and for
60+ // users who've already migrated (the flag is set by `sf migrate`).
5661 const subcommand = process . argv [ 2 ] ;
5762 if (
5863 ! shownUpgradeBanner &&
5964 subcommand !== "migrate" &&
6065 subcommand !== "upgrade" &&
61- ! process . env . SF_CLI_DISABLE_MIGRATE_BANNER
66+ ! process . env . SF_CLI_DISABLE_MIGRATE_BANNER &&
67+ ! config . migrated_to_rust_cli
6268 ) {
6369 showMigrateBanner ( ) ;
6470 }
@@ -73,7 +79,6 @@ async function main() {
7379 // surfaces (e.g. `--enable-infiniband` on `sf nodes create`) resolve
7480 // correctly on the very first CLI invocation after login, rather than only
7581 // appearing after the cache has been seeded by a previous run.
76- const config = await loadConfig ( ) ;
7782 let exchangeAccountId = config . account_id ;
7883 if ( ! exchangeAccountId ) {
7984 const client = await apiClient ( config . auth_token ) ;
0 commit comments