Skip to content

Add typed JSON output to app env pull - #8608

Merged
gonzaloriestra merged 6 commits into
gonzalo/json-app-env-showfrom
gonzalo/json-app-env-pull
Oct 14, 2026
Merged

gonzaloriestra merged 6 commits into
gonzalo/json-app-env-showfrom
gonzalo/json-app-env-pull

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/23667

Scripts cannot inspect the result of updating an app dotenv file.

WHAT is this pull request doing?

Return the absolute dotenv path, success status, changed flag, variables array and native file content. Preserve comments and local variables, and keep the existing text diff.

How to manually test your changes?

pnpm shopify app env pull --path /path/to/app
pnpm shopify app env pull --path /path/to/app --json --no-input
pnpm shopify app env pull --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 single minor changeset for typed JSON output in app env commands

@github-actions github-actions Bot added the Area: @shopify/cli @shopify/cli package issues label Sep 21, 2026
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch from f2ff2ea to b98a439 Compare September 21, 2026 08:15
@gonzaloriestra

Copy link
Copy Markdown
Contributor Author

/snapit

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch from b98a439 to 33107c9 Compare September 22, 2026 11:22
@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
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch 2 times, most recently from 16e0f18 to 3fbe817 Compare October 6, 2026 13:47
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch from 9c942a1 to c3be51e Compare October 6, 2026 13:54
@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 c3be51e07282c0d3aca976cf1b4fdfe3c0e38aed. 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-20261008125329

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-env-pull branch from c3be51e to 7b19678 Compare October 9, 2026 10:58
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch from d8d4197 to 22d5ee9 Compare October 13, 2026 15:03
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch from 22d5ee9 to a4e46dc Compare October 14, 2026 12:28
@gonzaloriestra

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

Copy link
Copy Markdown
Contributor

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

Built from a4e46dc6ff0eee06f130d62132878e493e3bce01. 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-20261014123050

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 marked this pull request as ready for review October 14, 2026 13:00
@gonzaloriestra
gonzaloriestra requested review from a team as code owners October 14, 2026 13:00
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/json-app-env-pull branch from a4e46dc to 3b41ebd Compare October 14, 2026 13:00
@gonzaloriestra
gonzaloriestra marked this pull request as draft October 14, 2026 13:00
@gonzaloriestra
gonzaloriestra marked this pull request as ready for review October 14, 2026 13:01
@isaacroldan

Copy link
Copy Markdown
Contributor

/snapit

@github-actions

Copy link
Copy Markdown
Contributor

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

Built from 3b41ebd803956e1918da202662794b3231bea4f2. 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-20261014134214

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-env-pull branch from 3b41ebd to 93c66f3 Compare October 14, 2026 14:01
@gonzaloriestra
gonzaloriestra added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit ac38670 Oct 14, 2026
33 of 59 checks passed
@gonzaloriestra
gonzaloriestra deleted the gonzalo/json-app-env-pull branch October 14, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/cli @shopify/cli package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants