Skip to content

Add typed JSON output to app config use - #8605

Draft
gonzaloriestra wants to merge 4 commits into
gonzalo/json-app-config-pullfrom
gonzalo/json-app-config-use
Draft

gonzaloriestra wants to merge 4 commits into
gonzalo/json-app-config-pullfrom
gonzalo/json-app-config-use

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Related to https://github.com/shop/issues-develop/issues/23665

Selecting or clearing an app configuration needs a machine-readable result.

WHAT is this pull request doing?

Add JSON output with status, changed, the absolute preferred path, and clientId. Reset returns null for path and clientId; changed distinguishes successful no-ops. Preserve shared selection callers and text presentation.

How to manually test your changes?

pnpm shopify app config use staging --path /path/to/app --json
pnpm shopify app config use --reset --path /path/to/app --json
pnpm shopify app config use --json-schema

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • Added a minor changeset for the public JSON contract.

@gonzaloriestra
gonzaloriestra added this pull request to stack #8606 September 21, 2026 08:08
@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 21, 2026
@gonzaloriestra

Copy link
Copy Markdown
Contributor Author

/snapit

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-config-use branch from 314bffc to 00a224f Compare September 21, 2026 08:11
@gonzaloriestra

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

Copy link
Copy Markdown
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/context/local.d.ts
@@ -11,6 +11,12 @@ export declare function isTerminalInteractive(): boolean;
  * @returns The path to the user's home directory.
  */
 export declare function homeDirectory(): string;
+/**
+ * Clears the memoized result of isUnitTest so the environment variable is re-read.
+ *
+ * Only intended for test helpers that temporarily toggle unit-test detection.
+ */
+export declare function resetMemoizedIsUnitTest(): void;
 /**
  * Returns true if the CLI is running in debug mode.
  *
packages/cli-kit/dist/public/node/testing/output.d.ts
@@ -8,6 +8,36 @@ interface OutputMock {
     error: () => string;
     clear: () => void;
 }
+interface StandardStreamsMock {
+    stdout: () => string;
+    stderr: () => string;
+    restore: () => void;
+}
+export interface CapturedStandardStreams {
+    stdout: () => string;
+    stderr: () => string;
+}
+/**
+ * Runs a callback with process stdout/stderr captured and unit-test output suppression disabled,
+ * so tests can assert on what a command actually writes to the standard streams.
+ *
+ * The callback receives accessors instead of the function returning captured output so that
+ * assertions remain possible when the callback throws (for example commands that abort).
+ * Streams, console.warn and unit-test detection are restored afterwards.
+ * Not safe for concurrent tests.
+ *
+ * @param run - Callback receiving accessors for the captured stdout and stderr.
+ * @returns The value returned by the callback.
+ */
+export declare function withCapturedStandardStreams<T>(run: (streams: CapturedStandardStreams) => T | Promise<T>): Promise<T>;
+/**
+ * Captures writes to stdout and stderr, including console warnings intercepted by Vitest.
+ * Call restore in a finally block. This replaces process globals and must not be used in concurrent tests.
+ * Prefer withCapturedStandardStreams, which also disables unit-test output suppression while it runs.
+ *
+ * @returns Captured output and a function to restore the original writers.
+ */
+export declare function mockAndCaptureStandardStreams(): StandardStreamsMock;
 /**
  * Returns a set of functions to get the outputs ocurred during a test run.
  *

@gonzaloriestra

Copy link
Copy Markdown
Contributor Author

/snapit

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-config-use branch from 8f75366 to a563510 Compare September 29, 2026 14:43
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-config-use branch from a563510 to 24893dd Compare October 6, 2026 12:21
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-config-use branch from 24893dd to 9c76db9 Compare October 6, 2026 13:46
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-config-use branch from 9c76db9 to df255ee Compare October 6, 2026 13:53
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-config-use branch from df255ee to 6046f0a Compare October 6, 2026 13:56
@gonzaloriestra

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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

Built from 6046f0a37f251f8ec8b1963afc51f3c3151da2af. Workflow run.

Test the snapshot by installing your package globally:

pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20261008125208

Caution

After installing, validate the version by running shopify version 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 force-pushed the gonzalo/json-app-config-use branch from 6046f0a to 17c1408 Compare October 9, 2026 10:58
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Potential Breaking Changes Detected

This PR contains changes that may break the existing contract.

@shopify/dev_experience — this PR contains breaking changes that require coordination for the next major release.

📦 Major Version Changesets

The following changesets request a major version bump:

Changeset Package
typed-app-config-validate.md '@shopify/cli': major

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant