Skip to content

Add typed JSON output to app build - #8801

Merged
isaacroldan merged 13 commits into
mainfrom
qlaw/json-i23668-app-build
Oct 9, 2026
Merged

isaacroldan merged 13 commits into
mainfrom
qlaw/json-i23668-app-build

Conversation

@isaacroldan

@isaacroldan isaacroldan commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Let scripts read the result of app build. Related to #23668.

WHAT is this pull request doing?

Add --json with a validated {"status":"success"} result after the build completes. Keep the text success message and native artifacts. Send compiler output through the shared diagnostic streams, and use the shared fatal error document on failure. --json and --no-input stay independent.

Text: Example app built!.
JSON: {"status":"success"}.

How to manually test your changes?

Use a disposable local app with its dependencies installed.

  1. Run pnpm shopify app build --path <app> --skip-dependencies-installation. Check the success message and build artifacts.
  2. Repeat with --json --no-input > build.json 2> build.events.jsonl. Check one success object on stdout and JSON events on stderr. Include a JavaScript Function extension to check its compiler output.
  3. Add a syntax error to a UI extension, such as export const broken = ;, and repeat the JSON command. Expect one error object, a nonzero exit, and valid JSONL on stderr. Run pnpm shopify app build --json-schema to inspect the contract.

Validation

72 focused tests passed, with scoped lint, app/CLI build and type checks, Knip, and the command snapshot check. Command and documentation files were regenerated. Real CLI checks covered text and JSON success, plus an invalid UI extension. Both compiler regressions were detected when the old stream behavior was restored.

Other operating systems and real Javy download/optimization were not run locally.

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 the required minor changeset

@isaacroldan

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions github-actions Bot added shopify.dev preview Area: @shopify/cli @shopify/cli package issues labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

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

Built from 7c77f0c33b7e0df7d4d90af3c504b92150650120. 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-20261006150026

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.

@isaacroldan isaacroldan changed the title [Feature] Add typed JSON output to app build Add typed JSON output to app build Oct 6, 2026
@isaacroldan
isaacroldan changed the base branch from main to codex/json-ui-routing October 6, 2026 16:32
@isaacroldan
isaacroldan added this pull request to stack #8805 October 6, 2026 16:32
@isaacroldan isaacroldan changed the title Add typed JSON output to app build Add JSON status output to app build Oct 6, 2026
@isaacroldan
isaacroldan force-pushed the qlaw/json-i23668-app-build branch from a7c4bcd to 6d7e9ec Compare October 7, 2026 11:12
@isaacroldan
isaacroldan removed this pull request from stack #8805 October 7, 2026 11:12
@isaacroldan
isaacroldan added this pull request to stack #8813 October 7, 2026 11:13
@isaacroldan
isaacroldan marked this pull request as ready for review October 7, 2026 11:16
@isaacroldan
isaacroldan requested review from a team as code owners October 7, 2026 11:16
@isaacroldan

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

Built from 6d7e9ec9cc6088caf3d49a57ce9372ab3bcb7d97. 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-20261007111740

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.

Comment thread packages/app/src/cli/commands/app/build.ts
Comment thread packages/app/src/cli/commands/app/build.ts
Comment thread packages/app/src/cli/services/app/config/use.ts Outdated
Comment thread packages/app/src/cli/commands/app/build.ts
Comment thread packages/eslint-plugin-cli/rules/json-output-command-exceptions.js
@github-actions

github-actions Bot commented Oct 7, 2026

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/system.d.ts
@@ -104,9 +104,9 @@ export declare function sleep(seconds: number): Promise<void>;
  */
 export declare function terminalSupportsHyperlinks(): boolean;
 /**
- * Check if the standard input and output streams support prompting.
+ * Check if standard input and standard error are terminals that support prompting.
  *
- * @returns True if the standard input and output streams support prompting.
+ * @returns True if standard input and standard error support prompting.
  */
 export declare function terminalSupportsPrompting(): boolean;
 /**
packages/cli-kit/dist/public/node/ui.d.ts
@@ -21,6 +21,7 @@ interface UIDebugOptions {
     skipTTYCheck?: boolean;
 }
 export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {
+    /** Ink options for terminal UI. Finite JSON output uses the command event channel on stderr instead. */
     renderOptions?: RenderOptions;
 }
 /**
packages/cli-kit/dist/private/node/ui/components/ConcurrentOutput.d.ts
@@ -1,4 +1,4 @@
-import { OutputProcess } from '../../../../public/node/output.js';
+import { type OutputProcess } from '../../../../public/node/output.js';
 import { AbortSignal } from '../../../../public/node/abort.js';
 import { FunctionComponent } from 'react';
 export interface ConcurrentOutputProps {
@@ -6,14 +6,21 @@ export interface ConcurrentOutputProps {
     prefixColumnSize?: number;
     abortSignal: AbortSignal;
     showTimestamps?: boolean;
+    /**
+     * Keeps terminal UI running after all processes finish. Defaults to false.
+     * In JSON mode, false uses finite progress/diagnostic events; true retains streaming terminal UI.
+     */
     keepRunningAfterProcessesResolve?: boolean;
     useAlternativeColorPalette?: boolean;
 }
 interface ConcurrentOutputContext {
     outputPrefix?: string;
+    /** Controls ANSI stripping for terminal output. JSON diagnostics are always unstyled. */
     stripAnsi?: boolean;
 }
 declare function useConcurrentOutputContext<T>(context: ConcurrentOutputContext, callback: () => T): T;
+/** Runs finite processes concurrently and routes their output through the shared diagnostic context. */
+export declare function runConcurrentProcessesForJson({ processes, abortSignal, }: Pick<ConcurrentOutputProps, 'processes' | 'abortSignal'>): Promise<void>;
 /**
  * Renders output from concurrent processes to the terminal.
  * Output will be divided in a three column layout

Base automatically changed from codex/json-ui-routing to main October 7, 2026 16:14
@isaacroldan
isaacroldan force-pushed the qlaw/json-i23668-app-build branch from 86c02af to e6126ef Compare October 7, 2026 16:15
@isaacroldan
isaacroldan force-pushed the qlaw/json-i23668-app-build branch from e6126ef to bfc346d Compare October 8, 2026 16:02
@isaacroldan isaacroldan changed the title Add JSON status output to app build Add typed JSON output to app build Oct 8, 2026
@isaacroldan
isaacroldan removed this pull request from stack #8813 October 8, 2026 16:13
@isaacroldan
isaacroldan added this pull request to stack #8837 October 8, 2026 16:13
@isaacroldan
isaacroldan removed this pull request from stack #8837 October 8, 2026 16:15
@isaacroldan
isaacroldan added this pull request to stack #8838 October 8, 2026 16:17
@isaacroldan
isaacroldan removed this pull request from stack #8838 October 9, 2026 08:16
@isaacroldan
isaacroldan added this pull request to stack #8846 October 9, 2026 08:17
@isaacroldan
isaacroldan removed this pull request from stack #8846 October 9, 2026 08:19
@isaacroldan
isaacroldan added this pull request to stack #8847 October 9, 2026 08:20
@isaacroldan

Copy link
Copy Markdown
Contributor Author

/snapit

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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

Built from bfc346d719e1df3302844da1f0044a5442b25f52. 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-20261009082731

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.

@isaacroldan
isaacroldan added this pull request to the merge queue Oct 9, 2026
Merged via the queue into main with commit e85b256 Oct 9, 2026
31 checks passed
@isaacroldan
isaacroldan deleted the qlaw/json-i23668-app-build branch October 9, 2026 08:50
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.

2 participants