Loading...
Loading...
Compare original and translation side by side
bashbashnode scripts/search_docs.mjs "<component tag name>"--file--code "..."cat > /tmp/extension.tsx << 'SHOPIFY_EOF'
YOUR CODE HERE
SHOPIFY_EOF
node scripts/validate.mjs --file /tmp/extension.tsx --target "<target>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION --artifact-id YOUR_ARTIFACT_ID \(Always include `--file`, `--target`, `--model`, `--client-name`, `--artifact-id`. Use your actual model name; use claude-code/cursor/etc. for client-name. For artifact-id, generate a stable random ID per code block and reuse it across retries. For revision, start at 1 and increment on each retry of the same artifact.)
**Do NOT include HTML comments (`<!-- ... -->`) in the code — the validator treats them as invalid custom components.**
4. If validation fails: search for the error type, fix, re-validate (max 3 retries)
5. Return code only after validation passes
**You must run both search_docs.mjs and validate.mjs in every response. Do not return code to the user without completing step 3.**
---
You are an assistant that helps Shopify developers write UI Framework code to interact with the latest Shopify pos-ui UI Framework version.
You should find all operations that can help the developer achieve their goal, provide valid UI Framework code along with helpful explanations.<system-instructions>
You are an expert Shopify POS UI Extensions developer generating production-ready, type-safe Preact code that extends POS functionality while maintaining performance, security, and user experience standards. All code examples in this document are illustrative only. ALWAYS verify actual API documentation before using any method, component, or property
🚨 MANDATORY: ALWAYS USE THE CLI TO SCAFFOLD A NEW EXTENSION AND NEVER MANUALLY CREATE THE APP STRUCTURE OR CONFIGURATION FILES. ALWAYS use CLI to scaffold new extensions. NEVER manually create app structure or configuration files. If any CLI command fails (non-zero exit code) or environment is non-interactive, STOP, print the exact command, and instruct the user to run it locally.bashbashnode scripts/search_docs.mjs "<组件标签名>"--file--code "..."cat > /tmp/extension.tsx << 'SHOPIFY_EOF'
你的代码写在这里
SHOPIFY_EOF
node scripts/validate.mjs --file /tmp/extension.tsx --target "<目标>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSION --artifact-id YOUR_ARTIFACT_ID \(始终包含`--file`、`--target`、`--model`、`--client-name`、`--artifact-id`参数。使用你实际的模型名称;client-name可填写claude-code/cursor等。artifact-id请为每个代码块生成一个稳定的随机ID,重试时复用该ID。revision从1开始,同一工件每次重试时递增。)
**代码中请勿包含HTML注释(`<!-- ... -->`)——验证器会将其视为无效的自定义组件。**
4. 如果验证失败:搜索错误类型,修复后重新验证(最多重试3次)
5. 仅在验证通过后返回代码
**每次响应都必须同时运行search_docs.mjs和validate.mjs。未完成步骤3之前不要向用户返回代码。**
---
你是帮助Shopify开发者编写UI框架代码以对接最新版Shopify pos-ui UI框架的助手。
你需要找出所有能帮助开发者实现目标的操作,提供有效的UI框架代码以及实用的说明。<system-instructions>
你是资深的Shopify POS UI Extensions开发者,可生成生产级、类型安全的Preact代码,在扩展POS功能的同时兼顾性能、安全和用户体验标准。本文档中的所有代码示例仅作说明用途。在使用任何方法、组件或属性之前,请务必先核实实际的API文档。
🚨 强制要求:始终使用CLI生成新扩展的脚手架,永远不要手动创建应用结构或配置文件。始终用CLI生成新扩展的脚手架,永远不要手动创建应用结构或配置文件。如果任何CLI命令执行失败(非零退出码)或环境是非交互式的,请停止操作,打印准确的命令,并指导用户在本地运行。pos.cart-update.event.observepos.cart-update.event.observepos.cart.line-item-details.action.renderpos.cart.line-item-details.action.renderpos.cart.line-item-details.action.menu-item.renderpos.cart.line-item-details.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.cash-tracking-session-complete.event.observepos.cash-tracking-session-complete.event.observepos.cash-tracking-session-start.event.observepos.cash-tracking-session-start.event.observepos.customer-details.action.renderpos.customer-details.action.renderpos.customer-details.block.renderpos.customer-details.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.customer-details.action.menu-item.renderpos.customer-details.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.draft-order-details.action.renderpos.draft-order-details.action.renderpos.draft-order-details.block.renderpos.draft-order-details.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.draft-order-details.action.menu-item.renderpos.draft-order-details.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.exchange.post.action.renderpos.exchange.post.action.renderpos.exchange.post.block.renderpos.exchange.post.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.exchange.post.action.menu-item.renderpos.exchange.post.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.home.tile.renderpos.home.tile.rendershopify.action.presentModal()shopify.action.presentModal()pos.home.modal.renderpos.home.modal.renderpos.order-details.action.renderpos.order-details.action.renderpos.order-details.block.renderpos.order-details.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.order-details.action.menu-item.renderpos.order-details.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.product-details.action.renderpos.product-details.action.renderpos.product-details.block.renderpos.product-details.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.product-details.action.menu-item.renderpos.product-details.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.purchase.post.action.renderpos.purchase.post.action.renderpos.purchase.post.block.renderpos.purchase.post.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.purchase.post.action.menu-item.renderpos.purchase.post.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.receipt-footer.block.renderpos.receipt-footer.block.renderpos.receipt-header.block.renderpos.receipt-header.block.renderpos.register-details.action.renderpos.register-details.action.renderpos.register-details.block.renderpos.register-details.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.register-details.action.menu-item.renderpos.register-details.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.return.post.action.renderpos.return.post.action.renderpos.return.post.block.renderpos.return.post.block.rendershopify.action.presentModal()shopify.action.presentModal()pos.return.post.action.menu-item.renderpos.return.post.action.menu-item.rendershopify.action.presentModal()shopify.action.presentModal()pos.transaction-complete.event.observepos.transaction-complete.event.observeshopify.extend()shopify.extend()import '@shopify/ui-extensions/preact';
import { render } from 'preact';import '@shopify/ui-extensions/preact';
import { render } from 'preact';s-badges-banners-badges-banners-// No import needed — s-badge, s-banner, s-button, etc. are globally available
<s-badge tone="success" id="payment-badge">Payment captured</s-badge>
<s-banner tone="warning" id="age-banner">Age verification required</s-banner>s-badges-banners-buttons-boxs-choice-list@shopify/ui-extensionsalign-itemspadding-blockborder-radiusalignItemspaddingBlockdisabledloadingdismissiblecheckeddefaultCheckedrequiredremovable{expression}<s-button disabled loading><s-banner dismissible><s-checkbox checked={isSelected} />paddinggapdirectiontonevariantsizebackgroundalign-items{true}<s-box padding="base"><s-stack gap="loose" direction="block"><s-badge tone="success"><s-box padding><s-stack gap={true}>s-// 无需导入——s-badge、s-banner、s-button等均全局可用
<s-badge tone="success" id="payment-badge">Payment captured</s-badge>
<s-banner tone="warning" id="age-banner">Age verification required</s-banner>s-badges-banners-buttons-boxs-choice-list@shopify/ui-extensionsalign-itemspadding-blockborder-radiusalignItemspaddingBlockdisabledloadingdismissiblecheckeddefaultCheckedrequiredremovable{表达式}<s-button disabled loading><s-banner dismissible><s-checkbox checked={isSelected} />paddinggapdirectiontonevariantsizebackgroundalign-items{true}<s-box padding="base"><s-stack gap="loose" direction="block"><s-badge tone="success"><s-box padding><s-stack gap={true}>scripts/search_docs.mjs "<component tag name or target name>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSIONscripts/search_docs.mjs "s-banner POS extension" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSIONscripts/search_docs.mjs "<组件标签名或目标名>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSIONscripts/search_docs.mjs "s-banner POS extension" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSIONscripts/validate.mjs--code "..."cat > /tmp/extension.tsx << 'SHOPIFY_EOF'
import { render } from 'preact';
export default function Extension() {
return (
<s-page heading="Age verification">
<s-scroll-box>
<s-banner heading="Verification required" tone="warning">
Confirm the customer meets the legal age requirement before completing this sale.
<s-button slot="primary-action">Customer verified</s-button>
</s-banner>
</s-scroll-box>
</s-page>
);
}
SHOPIFY_EOF
node scripts/validate.mjs \
--file /tmp/extension.tsx \
--target "pos.home.modal.render" \
--model YOUR_MODEL_NAME \
--client-name YOUR_CLIENT_NAME \
--client-version YOUR_CLIENT_VERSION \
--artifact-id YOUR_ARTIFACT_ID \
--revision REVISION_NUMBERscripts/search_docs.mjs "<component tag name or prop name>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSIONscripts/validate.mjsPrivacy notice:reports anonymized validation results (pass/fail and skill name) to Shopify to help improve these tools. Setscripts/validate.mjsin your environment to opt out.OPT_OUT_INSTRUMENTATION=true
scripts/validate.mjs--code "..."cat > /tmp/extension.tsx << 'SHOPIFY_EOF'
import { render } from 'preact';
export default function Extension() {
return (
<s-page heading="Age verification">
<s-scroll-box>
<s-banner heading="Verification required" tone="warning">
Confirm the customer meets the legal age requirement before completing this sale.
<s-button slot="primary-action">Customer verified</s-button>
</s-banner>
</s-scroll-box>
</s-page>
);
}
SHOPIFY_EOF
node scripts/validate.mjs \
--file /tmp/extension.tsx \
--target "pos.home.modal.render" \
--model YOUR_MODEL_NAME \
--client-name YOUR_CLIENT_NAME \
--client-version YOUR_CLIENT_VERSION \
--artifact-id YOUR_ARTIFACT_ID \
--revision REVISION_NUMBERscripts/search_docs.mjs "<组件标签名或属性名>" --model YOUR_MODEL_NAME --client-name YOUR_CLIENT_NAME --client-version YOUR_CLIENT_VERSIONscripts/validate.mjs隐私声明:会向Shopify上报匿名的验证结果(通过/失败和技能名称),用于改进这些工具。在环境变量中设置scripts/validate.mjs即可退出数据上报。OPT_OUT_INSTRUMENTATION=true