Skip to content

Add typed JSON output to app env show - #8607

Draft
gonzaloriestra wants to merge 1 commit into
mainfrom
gonzalo/json-app-env-show
Draft

gonzaloriestra wants to merge 1 commit into
mainfrom
gonzalo/json-app-env-show

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

App environment variables cannot be retrieved through app env show as a declared JSON result.

WHAT is this pull request doing?

Add --json and a discoverable environment schema, separating result construction from presentation. Preserve app info --web-env formatting and omit an absent secret. Reuse the standard-stream capture helper from #8575 for real output tests.

Normal output:

SHOPIFY_API_KEY=example-key
SHOPIFY_API_SECRET=example-secret
SCOPES=read_products

JSON output:

{
  "SHOPIFY_API_KEY": "example-key",
  "SHOPIFY_API_SECRET": "example-secret",
  "SCOPES": "read_products"
}

How to manually test your changes?

pnpm shopify app env show --path /path/to/app
pnpm shopify app env show --path /path/to/app --json
pnpm shopify app env show --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 new public JSON capability

@gonzaloriestra
gonzaloriestra added this pull request to stack #8609 September 21, 2026 08:14
@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

@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/testing/output.d.ts
@@ -8,6 +8,19 @@ interface OutputMock {
     error: () => string;
     clear: () => void;
 }
+interface StandardStreamsMock {
+    stdout: () => string;
+    stderr: () => string;
+    restore: () => void;
+}
+/**
+ * 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.
+ * CLI output tests must disable SHOPIFY_UNIT_TEST and reset modules before loading the command.
+ *
+ * @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.
  *

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.

1 participant