Skip to content

Add theme dev reconciliation strategy flag#7634

Open
gonzaloriestra wants to merge 3 commits into
cli-interactivity/app-dev-flagsfrom
cli-interactivity/theme-dev-reconciliation
Open

Add theme dev reconciliation strategy flag#7634
gonzaloriestra wants to merge 3 commits into
cli-interactivity/app-dev-flagsfrom
cli-interactivity/theme-dev-reconciliation

Conversation

@gonzaloriestra

@gonzaloriestra gonzaloriestra commented May 25, 2026

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Fixes https://github.com/shop/issues-develop/issues/22873

The interactivity audit found that theme dev with --theme-editor-sync could still prompt when JSON files needed reconciliation.

WHAT is this pull request doing?

  • Adds --reconciliation-strategy with keep-local, keep-remote, and abort options.
  • Threads the strategy through theme editor sync reconciliation and refreshes generated command docs.

How to test your changes?

Make a change in a theme file (like templates/404.json) locally and remotely and run:

  • shopify theme dev --theme-editor-sync
  • shopify theme dev --theme-editor-sync --reconciliation-strategy keep-local
  • shopify theme dev --theme-editor-sync --reconciliation-strategy keep-remote
  • shopify theme dev --theme-editor-sync --reconciliation-strategy abort

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
  • The change is user-facing, so I've added a changelog entry with pnpm changeset add

gonzaloriestra commented May 25, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label May 25, 2026
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch 2 times, most recently from bc8df22 to c635c86 Compare May 26, 2026 14:53
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-profile-token branch 2 times, most recently from b73773b to 8f6ca1c Compare May 26, 2026 15:22
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch 2 times, most recently from 17976d9 to a727f50 Compare May 26, 2026 15:31
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-profile-token branch from 8f6ca1c to fee06e6 Compare June 1, 2026 11:43
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch 2 times, most recently from cf17902 to f1bd642 Compare June 1, 2026 11:58
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-profile-token branch from fee06e6 to ad55535 Compare June 1, 2026 11:58
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from f1bd642 to e4069c5 Compare June 1, 2026 12:20
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-profile-token branch from ad55535 to 8d70823 Compare June 1, 2026 12:20
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from e4069c5 to c5d2d3f Compare June 1, 2026 12:45
@gonzaloriestra gonzaloriestra changed the base branch from cli-interactivity/theme-profile-token to graphite-base/7634 June 15, 2026 10:53
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from c5d2d3f to 2b45cf7 Compare June 15, 2026 10:53
@gonzaloriestra gonzaloriestra changed the base branch from graphite-base/7634 to cli-interactivity/app-dev-flags June 15, 2026 10:53
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 2b45cf7 to 3fcd3c1 Compare June 15, 2026 11:40
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from c22f504 to 155a4b3 Compare June 15, 2026 11:40
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 3fcd3c1 to e4ccca0 Compare June 15, 2026 11:46
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from 155a4b3 to bc9aaca Compare June 16, 2026 08:58
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from e4ccca0 to 469f7c2 Compare June 16, 2026 08:58
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from bc9aaca to b1b95a3 Compare June 16, 2026 11:26

@karreiro karreiro 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.

Thank you for this PR, @gonzaloriestra!

What if we repurpose the --theme-editor-sync flag, since we're defining the sync strategy? We could have something like this:

shopify theme dev --theme-editor-sync ask [default]
shopify theme dev --theme-editor-sync keep-local
shopify theme dev --theme-editor-sync keep-remote
shopify theme dev --theme-editor-sync abort

This would be a backward-compatible change, since ask would be the default value. It also reduces the blast radius of the change and keeps the dev command simpler.

Thanks again for the PR!

Comment thread .changeset/theme-dev-reconciliation-strategy.md Outdated

Copy link
Copy Markdown
Contributor Author

@karreiro I like the idea, but Oclif doesn't support default values like that. A default value can be used when the flag is omitted, but if you just add --theme-editor-sync, it would fail because it expects an additional string (it's not a boolean).

Maybe there's a hacky way to do it, but I think I prefer to just add an additional flag. Wdyt?

@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from 278d226 to b016c6e Compare July 7, 2026 11:02
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 1e98f09 to 167ff71 Compare July 7, 2026 11:02
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from b016c6e to f3e0e23 Compare July 7, 2026 11:19
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch 3 times, most recently from 37116bd to 6c7775b Compare July 9, 2026 09:54
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from f3e0e23 to 6a3739f Compare July 9, 2026 09:54
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 6c7775b to d840f99 Compare July 9, 2026 10:01
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from 65d4a29 to c8f3233 Compare July 9, 2026 10:12
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch 2 times, most recently from 21264f3 to 0141b85 Compare July 9, 2026 11:30
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from c8f3233 to 21d20b2 Compare July 9, 2026 11:30
@github-actions

github-actions Bot commented Jul 9, 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/private/node/constants.d.ts
@@ -6,6 +6,7 @@ export declare const environmentVariables: {
     doctor: string;
     enableCliRedirect: string;
     env: string;
+    firstPartyDev: string;
     noAnalytics: string;
     optOutInstrumentation: string;
     appAutomationToken: string;
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -63,6 +63,13 @@ export declare function alwaysLogAnalytics(env?: NodeJS.ProcessEnv): boolean;
  * @returns True if SHOPIFY_CLI_ALWAYS_LOG_METRICS is truthy.
  */
 export declare function alwaysLogMetrics(env?: NodeJS.ProcessEnv): boolean;
+/**
+ * Returns true if the CLI User is 1P.
+ *
+ * @param env - The environment variables from the environment of the current process.
+ * @returns True if SHOPIFY_CLI_1P is truthy.
+ */
+export declare function firstPartyDev(env?: NodeJS.ProcessEnv): boolean;
 /**
  * Returns true if the CLI can run the "doctor-release" command.
  *

@karreiro karreiro 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.

Thank you for this PR, @gonzaloriestra!

I looked into it, and the alternatives for implementing the single-flag approach are indeed hacky. It also reveals that having union types (boolean | string) in CLI flags might not be the ideal pattern. So, from my side, +1 for proceeding with this approach.

Thanks again for this PR!

@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from 21d20b2 to 722bab8 Compare July 13, 2026 11:22
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 0a8a2d3 to 42c3570 Compare July 13, 2026 11:22
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from 722bab8 to ea966f3 Compare July 13, 2026 11:31
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 42c3570 to 8d0d5a2 Compare July 13, 2026 11:31
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from ea966f3 to eb2c7e6 Compare July 13, 2026 12:07
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 8d0d5a2 to 4f7a225 Compare July 13, 2026 12:07
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/app-dev-flags branch from eb2c7e6 to 84b78ef Compare July 14, 2026 08:02
@gonzaloriestra gonzaloriestra force-pushed the cli-interactivity/theme-dev-reconciliation branch from 4f7a225 to 6de9f11 Compare July 14, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/theme @shopify/theme package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants