Skip to content

Conversation

@gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Feb 11, 2026

HackDays project: https://vault.shopify.io/hackdays/153/projects/22255

WHY are these changes introduced?

We want our devs to always use the latest CLI version and avoid fragmentation

WHAT is this pull request doing?

Checks once per day if there is a new CLI version available and automatically upgrades unless:

  • CI
  • SHOPIFY_CLI_NO_AUTO_UPGRADE=1
  • Major version change

How to test your changes?

TBD

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@gonzaloriestra
Copy link
Contributor Author

/snapit

@github-actions
Copy link
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/[email protected]

Caution

After installing, validate the version by running just shopify in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@gonzaloriestra gonzaloriestra changed the title HackDays tests Auto-upgrade Feb 11, 2026
@Shopify Shopify deleted a comment from github-actions bot Feb 11, 2026
@Shopify Shopify deleted a comment from github-actions bot Feb 11, 2026
@Shopify Shopify deleted a comment from github-actions bot Feb 11, 2026
@Shopify Shopify deleted a comment from github-actions bot Feb 11, 2026
@Shopify Shopify deleted a comment from alfonso-noriega Feb 11, 2026
@Shopify Shopify deleted a comment from alfonso-noriega Feb 11, 2026
@Shopify Shopify deleted a comment from github-actions bot Feb 11, 2026
@gonzaloriestra gonzaloriestra force-pushed the auto-upgrade branch 2 times, most recently from a51cd38 to 085b95c Compare February 12, 2026 08:44
@github-actions
Copy link
Contributor

github-actions bot commented Feb 12, 2026

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.9% 14588/18489
🟡 Branches 73.21% 7240/9890
🟡 Functions 79.07% 3707/4688
🟡 Lines 79.25% 13791/17402

Test suite run success

3788 tests passing in 1455 suites.

Report generated by 🧪jest coverage report action from 312b035

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Co-Authored-By: Alfonso Noriega <[email protected]>
@github-actions
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/constants.d.ts
@@ -32,6 +32,7 @@ export declare const environmentVariables: {
     neverUsePartnersApi: string;
     skipNetworkLevelRetry: string;
     maxRequestTimeForNetworkCalls: string;
+    noAutoUpgrade: string;
 };
 export declare const defaultThemeKitAccessDomain = "theme-kit-access.shopifyapps.com";
 export declare const systemEnvironmentVariables: {
packages/cli-kit/dist/public/node/fs.d.ts
@@ -1,6 +1,6 @@
 import { RandomNameFamily } from '../common/string.js';
 import { OverloadParameters } from '../../private/common/ts/overloaded-parameters.js';
-import { findUp as internalFindUp } from 'find-up';
+import { findUp as internalFindUp, findUpSync as internalFindUpSync } from 'find-up';
 import { ReadStream, WriteStream } from 'fs';
 import type { Pattern, Options as GlobOptions } from 'fast-glob';
 /**
@@ -335,6 +335,14 @@ export declare function defaultEOL(): EOL;
  * @returns The first path found that matches or  if none could be found.
  */
 export declare function findPathUp(matcher: OverloadParameters<typeof internalFindUp>[0], options: OverloadParameters<typeof internalFindUp>[1]): ReturnType<typeof internalFindUp>;
+/**
+ * Find a file by walking parent directories.
+ *
+ * @param matcher - A pattern or an array of patterns to match a file name.
+ * @param options - Options for the search.
+ * @returns The first path found that matches or  if none could be found.
+ */
+export declare function findPathUpSync(matcher: OverloadParameters<typeof internalFindUp>[0], options: OverloadParameters<typeof internalFindUp>[1]): ReturnType<typeof internalFindUpSync>;
 export interface MatchGlobOptions {
     matchBase: boolean;
     noglobstar: boolean;
packages/cli-kit/dist/public/node/is-global.d.ts
@@ -26,6 +26,7 @@ export declare function installGlobalCLIPrompt(): Promise<InstallGlobalCLIPrompt
  * Infers the package manager used by the global CLI.
  *
  * @param argv - The arguments passed to the process.
+ * @param env - The environment variables of the process.
  * @returns The package manager used by the global CLI.
  */
-export declare function inferPackageManagerForGlobalCLI(argv?: string[]): PackageManager;
\ No newline at end of file
+export declare function inferPackageManagerForGlobalCLI(argv?: string[], env?: NodeJS.ProcessEnv): PackageManager;
\ No newline at end of file
packages/cli-kit/dist/public/node/node-package-manager.d.ts
@@ -27,7 +27,7 @@ export type DependencyType = 'dev' | 'prod' | 'peer';
 /**
  * A union that represents the package managers available.
  */
-export declare const packageManager: readonly ["yarn", "npm", "pnpm", "bun", "unknown"];
+export declare const packageManager: readonly ["yarn", "npm", "pnpm", "bun", "homebrew", "unknown"];
 export type PackageManager = (typeof packageManager)[number];
 /**
  * Returns an abort error that's thrown when the package manager can't be determined.
packages/cli-kit/dist/public/node/upgrade.d.ts
@@ -4,7 +4,22 @@
  *
  * @returns A string with the command to run.
  */
-export declare function cliInstallCommand(): string;
+export declare function cliInstallCommand(): string | undefined;
+/**
+ * Runs the CLI upgrade using the appropriate package manager.
+ * Determines the install command and executes it.
+ *
+ * @throws AbortError if the package manager or command cannot be determined.
+ */
+export declare function runCLIUpgrade(): Promise<void>;
+/**
+ * Determines whether the CLI should auto-upgrade. Returns false for CI, when SHOPIFY_CLI_NO_AUTO_UPGRADE=1, or major version changes.
+ *
+ * @param currentVersion - The current CLI version.
+ * @param newerVersion - The newer available version.
+ * @returns True if auto-upgrade should proceed, false otherwise.
+ */
+export declare function shouldAutoUpgrade(currentVersion: string, newerVersion: string): boolean;
 /**
  * Generates a message to remind the user to update the CLI.
  *
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -173,4 +173,11 @@ export declare function getThemeKitAccessDomain(env?: NodeJS.ProcessEnv): string
  * @returns The domain to send OTEL metrics to.
  */
 export declare function opentelemetryDomain(env?: NodeJS.ProcessEnv): string;
+/**
+ * Returns true if the CLIshould not automatically upgrade.
+ *
+ * @param env - The environment variables from the environment of the current process.
+ * @returns True if the CLI should not automatically upgrade.
+ */
+export declare function noAutoUpgrade(env?: NodeJS.ProcessEnv): boolean;
 export type CIMetadata = Metadata;
\ No newline at end of file

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.

1 participant