Faster startup: Inline app-init and hydrogen-init hooks#7053
Merged
Conversation
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 19, 2026
gonzaloriestra
force-pushed
the
faster-startup-2
branch
from
March 19, 2026 15:57
b573cb7 to
e520d26
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
2 times, most recently
from
March 19, 2026 16:13
35d5a30 to
ea5104e
Compare
gonzaloriestra
force-pushed
the
faster-startup-2
branch
from
March 19, 2026 16:13
e520d26 to
d67ea57
Compare
gonzaloriestra
force-pushed
the
faster-startup-2
branch
2 times, most recently
from
March 30, 2026 08:06
2cc5f58 to
72fb003
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
March 30, 2026 08:06
ea5104e to
7682630
Compare
Contributor
Coverage report
Test suite run success4000 tests passing in 1531 suites. Report generated by 🧪jest coverage report action from 40f806b |
gonzaloriestra
force-pushed
the
faster-startup-2
branch
from
March 30, 2026 08:17
72fb003 to
5aeb8af
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
2 times, most recently
from
March 30, 2026 13:38
1c3373e to
efa9dd4
Compare
gonzaloriestra
force-pushed
the
faster-startup-2
branch
from
March 30, 2026 13:38
5aeb8af to
34fddbf
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
March 30, 2026 14:07
efa9dd4 to
40f806b
Compare
gonzaloriestra
force-pushed
the
faster-startup-2
branch
from
March 30, 2026 14:07
34fddbf to
4bad0ca
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 6, 2026 10:01
40f806b to
df491cd
Compare
gonzaloriestra
force-pushed
the
faster-startup-2
branch
from
April 6, 2026 10:01
4bad0ca to
3c3848b
Compare
gonzaloriestra
changed the base branch from
faster-startup-2
to
graphite-base/7053
April 7, 2026 11:18
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 7, 2026 11:18
df491cd to
c8a2bca
Compare
gonzaloriestra
force-pushed
the
graphite-base/7053
branch
from
April 7, 2026 11:18
3c3848b to
3395925
Compare
gonzaloriestra
changed the base branch from
graphite-base/7053
to
faster-startup
April 7, 2026 11:18
This was referenced Apr 7, 2026
Closed
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 7, 2026 11:32
c8a2bca to
e1532d8
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 7, 2026 11:32
3395925 to
b3d46bf
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 7, 2026 12:13
e1532d8 to
13679d3
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 7, 2026 12:13
b3d46bf to
02edbf0
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 8, 2026 10:10
0b56eb2 to
8dfbb9c
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
2 times, most recently
from
April 9, 2026 10:15
4dff85c to
7590cda
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
2 times, most recently
from
April 9, 2026 10:24
14a02dd to
3d49ec6
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
2 times, most recently
from
April 13, 2026 12:32
5ede813 to
db63872
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 13, 2026 12:32
3d49ec6 to
f2a02c6
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 13, 2026 12:43
db63872 to
854d8a8
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 13, 2026 12:43
f2a02c6 to
5a19697
Compare
gonzaloriestra
marked this pull request as ready for review
April 14, 2026 09:04
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 14, 2026 09:21
854d8a8 to
9cbb0c4
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
2 times, most recently
from
April 14, 2026 09:26
4bffb74 to
a4c95cc
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 14, 2026 09:26
9cbb0c4 to
2dd9370
Compare
byrichardpowell
approved these changes
Apr 23, 2026
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 27, 2026 10:42
a4c95cc to
208c408
Compare
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 27, 2026 10:42
2dd9370 to
3e0b5bd
Compare
Replace re-exports from @shopify/app and @shopify/cli-hydrogen with inlined versions. app-init now lazily imports LocalStorage instead of pulling the entire @shopify/app chain (~1s). hydrogen-init skips loading @shopify/cli-hydrogen entirely for non-hydrogen commands (~300ms). Startup time: 710ms → 530ms (-25%) Made-with: Cursor
gonzaloriestra
force-pushed
the
faster-startup
branch
from
April 27, 2026 11:07
3e0b5bd to
a2ef183
Compare
gonzaloriestra
force-pushed
the
faster-startup-3
branch
from
April 27, 2026 11:07
208c408 to
597efaf
Compare
Contributor
Differences in type declarationsWe 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:
New type declarationspackages/cli-kit/dist/public/node/custom-oclif-loader.d.tsimport { Command, Config } from '@oclif/core';
/**
* Optional lazy command loader function.
* If set, ShopifyConfig will use it to load individual commands on demand
* instead of importing the entire COMMANDS module (which triggers loading all packages).
*/
export type LazyCommandLoader = (id: string) => Promise<typeof Command | undefined>;
/**
* Subclass of oclif's Config that loads command classes on demand for faster CLI startup.
*/
export declare class ShopifyConfig extends Config {
private lazyCommandLoader?;
/**
* Set a lazy command loader that will be used to load individual command classes on demand,
* bypassing the default oclif behavior of importing the entire COMMANDS module.
*
* @param loader - The lazy command loader function.
*/
setLazyCommandLoader(loader: LazyCommandLoader): void;
/**
* Override runCommand to use lazy loading when available.
* Instead of calling cmd.load() which triggers loading ALL commands via index.js,
* we directly import only the needed command module.
*
* @param id - The command ID to run.
* @param argv - The arguments to pass to the command.
* @param cachedCommand - An optional cached command loadable.
* @returns The command result.
*/
runCommand<T = unknown>(id: string, argv?: string[], cachedCommand?: Command.Loadable | null): Promise<T>;
}
Existing type declarationspackages/cli-kit/dist/public/node/cli-launcher.d.ts@@ -1,6 +1,8 @@
+import type { LazyCommandLoader } from './custom-oclif-loader.js';
interface Options {
moduleURL: string;
argv?: string[];
+ lazyCommandLoader?: LazyCommandLoader;
}
/**
* Launches the CLI.
packages/cli-kit/dist/public/node/cli.d.ts@@ -1,3 +1,4 @@
+import type { LazyCommandLoader } from './custom-oclif-loader.js';
/**
* IMPORTANT NOTE: Imports in this module are dynamic to ensure that "setupEnvironmentVariables" can dynamically
* set the DEBUG environment variable before the 'debug' package sets up its configuration when modules
@@ -7,6 +8,8 @@ interface RunCLIOptions {
/** The value of import.meta.url of the CLI executable module */
moduleURL: string;
development: boolean;
+ /** Optional lazy command loader for on-demand command loading */
+ lazyCommandLoader?: LazyCommandLoader;
}
/**
* A function that abstracts away setting up the environment and running
@@ -17,6 +20,7 @@ export declare function runCLI(options: RunCLIOptions & {
runInCreateMode?: boolean;
}, launchCLI?: (options: {
moduleURL: string;
+ lazyCommandLoader?: LazyCommandLoader;
}) => Promise<void>, argv?: string[], env?: NodeJS.ProcessEnv, versions?: NodeJS.ProcessVersions): Promise<void>;
/**
* A function for create-x CLIs that automatically runs the "init" command.
@@ -38,5 +42,5 @@ export declare const jsonFlag: {
/**
* Clear the CLI cache, used to store some API responses and handle notifications status
*/
-export declare function clearCache(): void;
+export declare function clearCache(): Promise<void>;
export {};
\ No newline at end of file
|
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
The CLI requires too much time to start working, it feels slow
WHAT is this pull request doing?
Replaces the re-export hook stubs from PR 1 with inlined implementations that avoid loading heavy package dependency chains.
app-init.ts: lazily importsLocalStorageinstead of pulling in the entire@shopify/appchain (~1s of imports). Uses Node's nativecrypto.randomUUID()instead of importing from cli-kithydrogen-init.ts: skips loading@shopify/cli-hydrogenentirely for non-hydrogen commands (~300ms+ saved). Only loads the module whenoptions.idstarts withhydrogen:How to test your changes?
shopify app devstill initializes correctly (LocalStorage cleared, run ID set)shopify hydrogen devstill runs hydrogen init hookMeasuring impact
Checklist