Skip to content

Conversation

@nickwesselman
Copy link
Contributor

@nickwesselman nickwesselman commented Nov 19, 2025

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-id flag to suppress organization selection
  • Ensure name flag suppresses interactive linking and name prompts
  • Adds unit tests for init command
  • Moves SHOPIFY_FLAG_CLIENT_ID environment definition in our GitHub actions to the acceptance test job specifically (where it's needed), since it was breaking the new app init tests

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
  • 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

@nickwesselman nickwesselman requested review from a team as code owners November 19, 2025 21:36
@github-actions

This comment has been minimized.

@nickwesselman nickwesselman changed the title Allow noninteractive app init Allow non-interactive app init Nov 19, 2025
@nickwesselman
Copy link
Contributor Author

Will need to figure out why unit tests are failing. Works on my machine ™️.

@gonzaloriestra
Copy link
Contributor

/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/cli@0.0.0-snapshot-20251120104339

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.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

Coverage report

St.
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.
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.
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 37f0070

@nickwesselman nickwesselman changed the base branch from main to graphite-base/6640 November 21, 2025 13:18
@nickwesselman nickwesselman force-pushed the allow_noninteractive_app_init branch from 250ba03 to 94b8275 Compare November 21, 2025 13:18
@nickwesselman nickwesselman changed the base branch from graphite-base/6640 to block-partners-for-3p November 21, 2025 13:18
Copy link
Contributor Author

nickwesselman commented Nov 21, 2025

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

@nickwesselman nickwesselman marked this pull request as draft November 21, 2025 13:20
Copy link
Contributor Author

Converted PR to Draft to avoid merging before required server-side changes.

@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/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;
 /**

Base automatically changed from block-partners-for-3p to main November 21, 2025 14:09
@nickwesselman nickwesselman force-pushed the allow_noninteractive_app_init branch from 94b8275 to 37f0070 Compare November 21, 2025 14:15
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.

2 participants