Skip to content

Support intents for ui extensions#7134

Open
vividviolet wants to merge 2 commits intomainfrom
03-31-support_intents_for_ui_extensions
Open

Support intents for ui extensions#7134
vividviolet wants to merge 2 commits intomainfrom
03-31-support_intents_for_ui_extensions

Conversation

@vividviolet
Copy link
Copy Markdown
Member

@vividviolet vividviolet commented Mar 31, 2026

WHY are these changes introduced?

This change modernizes the UI extension asset handling system by replacing the legacy build_manifest approach with a new manifest.json-based system that supports additional asset types including intents.

Related https://github.com/shop/issues-admin-extensibility/issues/2274

WHAT is this pull request doing?

  • Adds support for intents field in extension point schemas with type, action, schema, name, and description properties
  • Adds Intents to the AssetIdentifier enum for asset handling
  • Updates UI extension build pipeline to use include_assets step instead of copy_static_assets, with support for tools, instructions, and intent schemas
  • Refactors extension payload generation to read from manifest.json instead of build_manifest, enabling better asset tracking with source file timestamps
  • Implements specialized handling for intents assets that transforms them into extension point-level properties with schema asset references
  • Updates tests to use the new manifest.json approach and adds comprehensive test coverage for intents, tools, and instructions assets

How to test your changes?

Make sure you have the proper betas applied (see canvas)

  1. Create a conditional action extension shopify app generate --template conditional_admin_action
  2. Run pnpm shopify app dev and verify the the UI extension has assets (main.js, should_render.js, tools schema url and instructions.md) that are fetchable through the Dev Server. You should be able to preview it in Admin Web
  3. Make a change to the action extension's code a verify that live reload works in Admin Web
  4. Create an Admin Link intent extension shopify app generate --template admin_intent_link
  5. Run pnpm shopify app dev and verify the the Admin link extension has assets (main.js, tools schema url and instructions.md and intents schema URLs) fetchable through the Dev Server
  6. Make a change to one of the static files like the intent-schema.json or tools.json and verify that Admin Web receives an update even through the websocket

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

Copy link
Copy Markdown
Member Author

vividviolet commented Mar 31, 2026

@isaacroldan isaacroldan force-pushed the 03-31-support_intents_for_ui_extensions branch from c65984a to bf92dc4 Compare April 1, 2026 08:53
@isaacroldan isaacroldan force-pushed the add_manifest_to_include_files_step branch 2 times, most recently from 96d95ba to d8b0d4a Compare April 1, 2026 08:53
@isaacroldan isaacroldan force-pushed the 03-31-support_intents_for_ui_extensions branch 2 times, most recently from 6e09feb to 5c1ddf1 Compare April 1, 2026 09:06
@isaacroldan isaacroldan changed the base branch from add_manifest_to_include_files_step to graphite-base/7134 April 1, 2026 09:23
@isaacroldan isaacroldan force-pushed the 03-31-support_intents_for_ui_extensions branch from 5c1ddf1 to 06dee38 Compare April 1, 2026 09:26
@isaacroldan isaacroldan changed the base branch from graphite-base/7134 to add_manifest_to_include_files_step April 1, 2026 09:26
Base automatically changed from add_manifest_to_include_files_step to main April 1, 2026 10:00
@isaacroldan isaacroldan force-pushed the 03-31-support_intents_for_ui_extensions branch from 06dee38 to 40bf3e5 Compare April 1, 2026 10:11
@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch 4 times, most recently from 8cc6cc8 to cc438ef Compare April 8, 2026 02:06
@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch 2 times, most recently from 91e9fca to a6d5ab9 Compare April 10, 2026 05:56
@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch 6 times, most recently from 19ce420 to 5b58638 Compare April 15, 2026 03:03
})
// Try the extension's build output first (for compiled bundles), then fall back
// to the extension's source directory (for static assets like tools, instructions).
const buildPath = joinPath(extension.directory, extension.outputRelativePath)
Copy link
Copy Markdown
Member Author

@vividviolet vividviolet Apr 15, 2026

Choose a reason for hiding this comment

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

@isaacroldan this fixes the issue mentioned here. There was a regression where we were getting updates even when the assets fail to build because we were serving them from the .dev-bundle which gets freshly created even when the build fails but it should be using the local assets. When the build fails the old local assets should not be deleted and we should not get a new update event in the websocket

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope, never mind. I double checked and it still sends an update event, something else is going on

// destination instead, it would pick up files accumulated from previous builds
// that may no longer exist in the source, inflating the file count and producing
// stale entries in the manifest's pathMap.
const sourceFiles = await glob(['**/*'], {cwd: fullPath, absolute: false})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Previously this was looking at copied files which broke when including assets for the adminspecificaiton after I fixed the issue where files were getting a new name on every build in dev even when there was no collision.

Fixed this to match copy-by-pattern.ts by looking at the source files, not the files in the destination folder.

// destination instead, it would pick up files accumulated from previous builds
// that may no longer exist in the source, inflating the file count and producing
// stale entries in the manifest.
const sourceFiles = await glob(['**/*'], {cwd: sourcePath, absolute: false})
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Same here, fixed this to match copy-by-pattern.ts by looking at the source files, not the files in the destination folder.

@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch from 5b58638 to 8549387 Compare April 15, 2026 03:20
@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch 3 times, most recently from 17e3ff5 to c2c3f95 Compare April 15, 2026 04:42
@vividviolet vividviolet marked this pull request as ready for review April 15, 2026 04:43
@vividviolet vividviolet requested a review from a team as a code owner April 15, 2026 04:43
@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch 2 times, most recently from 34150b4 to 5c1736d Compare April 15, 2026 15:25
Include built assets in the manifest.json
Allow serving static assets from the extensions directory
@vividviolet vividviolet force-pushed the 03-31-support_intents_for_ui_extensions branch from 5c1736d to 8bfa970 Compare April 15, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants