Skip to content

Prepare Hydrogen commands for typed JSON output - #4095

Open
gonzaloriestra wants to merge 8 commits into
mainfrom
gonzalo/hydrogen-json-support
Open

gonzaloriestra wants to merge 8 commits into
mainfrom
gonzalo/hydrogen-json-support

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Finite Hydrogen commands need shared schema and error support before exposing reliable JSON results.

WHAT is this pull request doing?

Pin Shopify CLI and CLI Kit to the matching stable release (4.9.0), add shared contracts and real-stream capture, and validate project and disabled-command rules in the command lifecycle so CLI Kit emits standard fatal errors. Expose --no-input through shared flags so prompt and browser-authentication policy remains independent from --json. Use CLI Kit UI helpers directly, keep VM startup in the init hook, and keep JSON diagnostics on stderr.

HOW to test your changes?

pnpm --filter @shopify/cli-hydrogen build
pnpm --filter @shopify/cli-hydrogen typecheck
pnpm --filter @shopify/cli-hydrogen test

Verified CLI 4.9.0 loads the Cloudflare tunnel_provider and tunnel_start hooks from its root plugin. Hydrogen must not register the separate plugin again, which would duplicate tunnels. CPU startup profiling was checked against a built storefront and repeated runs with isolated globals. Built-in imports are restricted to an explicit allowlist without filesystem, network or process access. Like the Vite build that precedes it, this Node profiler runs trusted project code; its fresh VM context is not a security sandbox.

Verified timer behavior with MiniOxygen's actual workerd runtime and Oxygen compatibility date 2025-04-01: both setTimeout and setInterval at module scope fail with "Disallowed operation called within global scope". The profiler intentionally preserves that startup restriction; timers remain valid inside request handlers. Regression tests cover this and denied static/dynamic imports of host I/O built-ins.

Checklist

  • I have read the contributing guidelines
  • I have considered cross-platform impacts
  • I have added a changeset for user-facing changes
  • I have added tests
  • I have updated the documentation

@shopify

shopify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Oxygen deployed a preview of your gonzalo/hydrogen-json-support branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment October 9, 2026 2:03 PM

Learn more about Hydrogen's GitHub integration.

@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch 2 times, most recently from 60a805a to 806fac6 Compare September 29, 2026 14:53

@fredericoo fredericoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice groundwork for the stack - the init hook tests covering --, --path=, help/schema and the env flag are really thorough, and good to see the task adapter gone now the nightly has cli#8672. One small comment on how alerts get flattened in JSON mode, nothing blocking.

Comment thread packages/cli/src/lib/ui.ts Outdated

@fredericoo fredericoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of follow-up questions I forgot to include earlier, neither blocking the approval

Comment thread pnpm-workspace.yaml
Comment thread package.json Outdated
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch from 806fac6 to ee17b8b Compare October 6, 2026 12:02
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch from 6c889de to abd25ea Compare October 6, 2026 13:55
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch 3 times, most recently from c1cf522 to 6084f4e Compare October 9, 2026 10:52
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch from 6084f4e to 7eebc52 Compare October 9, 2026 12:25
@gonzaloriestra
gonzaloriestra marked this pull request as ready for review October 9, 2026 12:28
@gonzaloriestra
gonzaloriestra requested a review from a team as a code owner October 9, 2026 12:28
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch 2 times, most recently from 53540a3 to bccc3e7 Compare October 9, 2026 13:29
@gonzaloriestra
gonzaloriestra force-pushed the gonzalo/hydrogen-json-support branch from bccc3e7 to 29a0fc8 Compare October 9, 2026 14:01
@lucyxiang lucyxiang added the 2026-04 Hydrogen 2 PR opened against main before the 2026-04 cut. Retarget to 2026-04. label Oct 9, 2026

@kdaviduik kdaviduik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hydrogen 2 is now on the 2026-04 branch, please change the base branch for this stack to merge into 2026-04 instead :)

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

2026-04 Hydrogen 2 PR opened against main before the 2026-04 cut. Retarget to 2026-04.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants