Allow non-interactive `app init`
WHY are these changes introduced?
The app init command has interactive prompts that are impossible to bypass. This prevents scripting and some agentic use.
(Agentic use may still be difficult as the agent needs to obtain the organization ID, but this puts us a step closer.)
WHAT is this pull request doing?
- Add
organization-idflag to suppress organization selection - Ensure
nameflag suppresses interactive linking and name prompts - Adds unit tests for
initcommand - Moves
SHOPIFY_FLAG_CLIENT_IDenvironment definition in our GitHub actions to the acceptance test job specifically (where it's needed), since it was breaking the newapp inittests
How to test your changes?
The following commands should all be successful:
shopify app init --organization-id <org-id> --name test --template remix --flavor javascript | cat
shopify app init --organization-id <org-id> --name test --template none | cat
# no org id needed with a partners token
export SHOPIFY_CLI_PARTNERS_TOKEN=<your cli token>
shopify app init --name test --template none | cat
The following should fail:
# with device login / no partner token
shopify app init --organization-id <NOT-your-org-id> --name test --template remix --flavor javascript | cat
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
- [x] Existing analytics will cater for this addition
- [ ] PR includes analytics changes to measure impact
Checklist
- [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [x] I've considered possible documentation changes
We detected some changes at packages/*/src and there are no updates in the .changeset.
If the changes are user-facing, run pnpm changeset add to track your changes and include them in the next release CHANGELOG.
[!CAUTION] DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.
Will need to figure out why unit tests are failing. Works on my machine β’οΈ.
/snapit
π«°β¨ 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
shopifyin your terminal. If the versions don't match, you might have multiple global instances installed. Usewhich shopifyto find out which one you are running and uninstall it.
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 79.46% (+0.23% πΌ) |
13699/17240 |
| π‘ | Branches | 73.3% (+0.19% πΌ) |
6678/9110 |
| π‘ | Functions | 79.57% (+0.2% πΌ) |
3529/4435 |
| π‘ | Lines | 79.81% (+0.23% πΌ) |
12938/16210 |
Show new covered files π£
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / bulk-operation-run-mutation.ts |
100% | 100% | 100% | 100% |
| π’ | ... / bulk-operation-run-query.ts |
100% | 100% | 100% | 100% |
| π’ | ... / staged-uploads-create.ts |
100% | 100% | 100% | 100% |
| π’ | ... / execute-bulk-operation.ts |
95.24% | 85.71% | 100% | 95% |
| π’ | ... / run-mutation.ts |
100% | 100% | 100% | 100% |
| π’ | ... / run-query.ts |
100% | 100% | 100% | 100% |
| π‘ | ... / stage-file.ts |
74.29% | 53.33% | 85.71% | 73.53% |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / developer-platform-client.ts |
84.62% (-1.5% π») |
73.68% (+3.1% πΌ) |
81.82% (+1.82% πΌ) |
90.63% (-2.71% π») |
| π’ | ... / ConcurrentOutput.tsx |
98.36% (-1.64% π») |
92% (-4% π») |
100% | 98.33% (-1.67% π») |
| π΄ | ... / ui.tsx |
50.82% (-0.79% π») |
42.86% (-5.53% π») |
54.55% (+1.42% πΌ) |
50% (-0.82% π») |
| π‘ | ... / theme-environment.ts |
69.57% (-1.86% π») |
50% | 55.56% (-3.27% π») |
69.57% (-1.86% π») |
Test suite run success
3372 tests passing in 1382 suites.
Report generated by π§ͺjest coverage report action from 37f0070c945ccec89adb8357cf18962eba48526d
- #6640
π (View in Graphite) - #6645

main
This stack of pull requests is managed by Graphite. Learn more about stacking.
Converted PR to Draft to avoid merging before required server-side changes.
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
mainyou might see odd diffs, rebasemaininto this branch.
New type declarations
We found no new type declarations in this PR
Existing type declarations
packages/cli-kit/dist/public/node/environment.d.ts
@@ -53,7 +53,7 @@ export declare function jsonOutputEnabled(environment?: NodeJS.ProcessEnv): bool
/**
* If true, the CLI should not use the Partners API.
*
- * @returns True if the SHOPIFY_CLI_NEVER_USE_PARTNERS_API environment variable is set.
+ * @returns True when SHOPIFY_CLI_NEVER_USE_PARTNERS_API is set or SHOPIFY_CLI_1P_DEV is not set.
*/
export declare function blockPartnersAccess(): boolean;
/**