@bestcheckout/dynamic-component-cli 0.1.7 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,7 @@ Create and develop custom React components for BestCheckout's Checkout, Upsell,
5
5
  This README is the public development guide for the CLI and dynamic components. The Editor links here from **Component source → Guide**.
6
6
 
7
7
  - [Requirements](#requirements)
8
+ - [AI skill for local development](#ai-skill-for-local-development)
8
9
  - [Quick start and Editor preview](#quick-start)
9
10
  - [Global installation](#optional-global-installation)
10
11
  - [Archive installation](#install-from-a-supplied-tgz)
@@ -27,9 +28,21 @@ This README is the public development guide for the CLI and dynamic components.
27
28
 
28
29
  - Node.js >=20.10 and npm. The package has been tested on macOS with Node 22.22.1 and 24.14.1; the minimum Node version, Windows and Linux have not yet been verified.
29
30
  - Internet access to install public npm dependencies.
30
- - Access to a BestCheckout theme editor with custom components and permission to save/publish your target template.
31
+ - For integrated page preview, Save and Publish: access to a BestCheckout theme editor with custom components and the corresponding template permissions. Local source editing and builds do not require an active Editor session or MCP connection.
31
32
  - Chromium for build validation, including builds requested by Editor Save. Install it as shown below. On macOS, an existing Google Chrome installation can also be detected automatically.
32
33
 
34
+ ## AI skill for local development
35
+
36
+ The package includes `skills/checkout-theme-dynamic-development/`, an optional skill for AI assistants editing local dynamic-component projects. It guides requirement analysis, public Runtime usage, local validation/builds and Editor integration. Neither BestCheckout MCP nor the shop-visual source repository is required. Manual CLI development works without a Skill.
37
+
38
+ Copy the complete directory from the installed `node_modules/@bestcheckout/dynamic-component-cli/skills/checkout-theme-dynamic-development/` into your AI client's supported skill location, or extract a supplied versioned Skill ZIP there. Keep `SKILL.md`, `references/` and `agents/` together. Package installation alone does not register the Skill. The client also needs local file/terminal capabilities to perform development; browser/image capabilities determine which visual checks it can run.
39
+
40
+ The Skill reads the project's installed CLI README, public types and generated component/behavior catalogs. These catalogs ship with the Skill and record the CLI version and public-type hash; prefer the installed project's copies to a separately downloaded Skill's copies. Do not use newer reference material to assume an older project or deployed Host supports a capability. Generated catalogs describe platform behavior and supported settings, not the store's current page configuration.
41
+
42
+ MCP-only users receive the shared development principles and MCP operations from the service and do not need to install this Skill or CLI. If MCP is also connected during local development, it can supply relevant page context without changing the local source, Save or Publish path. Missing Editor/Host access leaves integration unverified; local source implementation and available checks can still proceed.
43
+
44
+ Local edits, builds, Editor previews, saved page changes and publication are separate states. Use the Editor's existing Save/Publish flow; the Skill does not add authentication, remote persistence or publication capabilities to the CLI.
45
+
33
46
  ## Quick start
34
47
 
35
48
  The public package is available from npm. Run:
@@ -116,7 +129,7 @@ Restart `npm run dev` after adding a component or changing `dynamic.config.json`
116
129
  - Page types are exactly `checkout`, `upsell`, `downsell`, `thankYou` (case-sensitive).
117
130
  - Component IDs use 1–64 lowercase letters, numbers, underscores or hyphens and must be unique within the project.
118
131
  - `dynamic.config.json` registers local entry files. Keep its component ID and page type consistent with each exported `manifest`; mismatches fail validation.
119
- - Upsell/Downsell starters declare `capabilities.offerRecommendation`. Configure their recommendation rules in the Editor before saving/publishing the offer template.
132
+ - All starters are ordinary components without recommendation-rule capabilities. Add `capabilities.offerRecommendation: true` only when the component is intended to own the Upsell/Downsell page's recommendation rules; then configure those rules in the Editor.
120
133
 
121
134
  ## Component development
122
135
 
@@ -136,7 +149,7 @@ A component exports a default definition containing `manifest`, `schema`, `defau
136
149
  - `manifest.componentId` is 1–64 lowercase letters, numbers, `_` or `-`. It identifies shared code within a theme.
137
150
  - `manifest.name` is the non-empty display name shown in the Editor, up to 128 Unicode characters.
138
151
  - `manifest.supportedPageTypes` limits where the component can be selected. Omission means all four pages; an empty array means none. It does not grant runtime capabilities.
139
- - `manifest.capabilities.offerRecommendation` must be `true` for an Upsell/Downsell component that provides the page's product recommendation rule. The Editor uses the first rule provider in template order, including hidden sections.
152
+ - `manifest.capabilities.offerRecommendation` is opt-in: set it to `true` only for an Upsell/Downsell component that owns the page's product recommendation rule. Ordinary content or interaction components omit it. Being placed on an offer page or reading `runtime.offer` recommendations does not require this declaration. The Editor uses the first rule provider in template order, including hidden sections.
140
153
  - `schema` is an array of Editor fields. Use `[]` when there are no settings.
141
154
  - `defaultSettings` supplies values for new instances. It does not overwrite values already configured by a merchant.
142
155
  - `Component` receives `{ settings, runtime, context }`.
@@ -146,6 +159,16 @@ A component exports a default definition containing `manifest`, `schema`, `defau
146
159
 
147
160
  ### Editor schema and settings
148
161
 
162
+ Before writing code, inspect the current page and built-in settings. Prefer existing components, then configuration/layout changes, and use dynamic code for remaining requirements or an explicit custom-code choice. Clarify missing appearance, interaction or flow choices only when they affect the result; infer ordinary business behavior from the current contract instead of asking the merchant to enumerate it. “New” and “fully replace” describe outcomes, not a required replacement mechanism.
163
+
164
+ Every Section, including a built-in/core Section, supports deletion and hiding. Replacing an instance means removing the old instance once its replacement covers the requested behavior and configuration. Hiding retains the instance and is for an explicit hide/keep request, not the default substitute for replacement. Editing an existing instance in place needs no second instance. Keep page/global ownership and supported placement rules separate from deletion permission.
165
+
166
+ Check page tasks, business functions and component responsibilities together. A custom component can combine functions from several behavior profiles; dependencies may remain elsewhere on the page. For example, contact/address/shipping needs their applicable individual behaviors plus address-to-rates-to-totals/submission checks. Preserve the page's necessary flow, authoritative Host state, editable configuration and single transaction ownership. Component visibility or build success alone does not establish completeness.
167
+
168
+ The generated behavior catalog covers all registered Checkout-family components. Read every relevant profile when functions are combined, and use the existing Checkout example, page starters and Runtime examples as references. Custom controls need documented public Runtime capabilities and their own behavior checks. Reuse existing business APIs and configuration/resource save and publish operations. Build, structural validation, preview or publication success does not establish complete behavioral equivalence; report unverified behavior explicitly.
169
+
170
+ Before implementing, check the smallest proposed change against the user's intended difference, applicable behaviors and public capability limits below. Missing behavior guides in an older contract do not imply that there are no behaviors to preserve.
171
+
149
172
  Schema fields use the same field types as the Editor configuration panel:
150
173
 
151
174
  ```ts
@@ -260,6 +283,8 @@ The types shipped with your installed CLI are the reference for full parameter a
260
283
 
261
284
  Common actions return `{ ok: true }` or `{ ok: false, code, message? }`, with `code` of `unavailable / invalid_destination / blocked / failed`. Cart data is not order data; checkout add-ons use `checkout.upsell`. The platform may omit a capability because of page type or shop configuration. Do not create a private fallback client. There is no public `runtime.currency`; read currency from the page snapshot that owns the amount.
262
285
 
286
+ `runtime.account?.login` invokes the existing platform login flow when the actual page Host supplies it. It does not accept credentials or expose OTP verification, registration or session-management operations for a custom authentication form. An `ok` result only describes the action call; wait for the account snapshot to become `signed_in` before presenting an authenticated state. Handle cancellation, failure and missing capabilities without changing account state locally. Preview login is simulated and does not prove that a Live page has a working login integration.
287
+
263
288
  #### Checkout runtime
264
289
 
265
290
  `runtime.checkout.getSnapshot()` includes `contact`, read-only `lines`, optional `summary`, `currency`, `delivery`, `billing`, `shipping`, `coupon`, `payment` and `status`. `status.dataStatus` is `loading / ready / error / unknown`; `canSubmit` allows an attempt, while `blockedReasons` explains why it is blocked. The Host still revalidates on submission. Available actions:
@@ -411,6 +436,18 @@ For asynchronous writes, acquire a ref lock before the first `await`; a disabled
411
436
 
412
437
  For payment examples, validate ordinary Host reference changes, input/quote updates, method/kind switches, session remount, capability withdrawal, delayed resolution after cleanup, failed mounts and StrictMode. Assert both stable DOM/input and bounded mount/request counts. A successful build or Editor preview alone does not verify these properties or a real payment.
413
438
 
439
+ #### Current capability limits
440
+
441
+ Behavior profiles describe the built-in component's responsibilities, not a promise that each one can be reimplemented through the public Runtime. For every requested business function, check the current contract and actual Host for required authoritative data, operations/parameters, observable result/error/pending states, applicable page/configuration/access conditions, and ownership/persistence/dependencies. Check only affected functions; providers elsewhere on the page may fulfill dependencies.
442
+
443
+ Apply this to all domains, not just login or payment. Product selection is not catalog/inventory editing; applying a coupon is not creating promotion rules; selecting a shipping rate is not creating a shipping service; order/tracking reads are not refunds or cancellations. New points, subscription, notification, upload or other integration behavior needs its own supported capabilities. These are distinctions to verify, not a permanent denylist. Pure presentation and local UI state do not require a business API, but cannot substitute for a saved business result.
444
+
445
+ When an operation is confirmed unsupported, decline that part before creating dependent code: explain the unmet business result, the actual limitation, and a verified alternative if one exists. Preserve supported independent work and existing providers; do not claim full completion, silently deliver a mock, invent an enablement setting or bypass the boundary with private APIs. Distinguish missing support from unknown availability and temporary failure. A separate platform change requires its own scope; it is not implied by merchant customization.
446
+
447
+ - The public Checkout API has no input/mount entry for the platform's additional payment/order information. Some destinations require these fields during payment preparation. Keep the built-in Payment path when these fields apply or their applicability is unknown; a custom payment form cannot claim full coverage. An enabled built-in Payment also owns the native payment surface, so adding a second custom mount is not a supported workaround.
448
+ - Shipping insurance and VIP selections use their original Section identity and dedicated Host billing behavior. `checkout.upsell.setSelection` handles products under the dynamic instance's identity; it cannot substitute for those paid selections or adopt an existing section's selections. Retain the existing providers and configuration for those functions.
449
+ - Required data or actions that are absent from the public API remain unsupported, not inapplicable. Explain the specific unmet requirement and use a supported configuration/layout. Do not invent a private API, charge locally, or expand platform infrastructure as part of a merchant customization.
450
+
414
451
  #### Upsell and Downsell runtime
415
452
 
416
453
  `runtime.offer.getSnapshot()` provides recommendations, currency, order confirmation and optional transaction/continuation state. The primary methods are:
@@ -436,7 +473,9 @@ Reprice returns `unitPrice / amount / currency` and the matching selection. Paym
436
473
 
437
474
  Use the latest matching quote and server-returned amount. Do not call `accept` again while a transaction is processing or unknown; query the existing payment status instead. Disable repeated actions while repricing, accepting or reconciling.
438
475
 
439
- Offer pages require a recommendation rule. The CLI's Upsell and Downsell starters declare `manifest.capabilities.offerRecommendation: true`; configure the rule in the Editor's Product recommendation section. A dynamic component can provide the rule through this manifest capability. The first provider in template order applies to the page, including hidden sections. Do not duplicate the platform recommendation fields in your custom schema.
476
+ Offer pages require a recommendation rule for the offer flow, but each component does not need to own one. All CLI starters omit `manifest.capabilities.offerRecommendation`. Ordinary components, including consumers of existing recommendations through `runtime.offer`, leave it omitted. Declare it as `true` only when intentionally providing the page's rules; the Editor then supplies the Product recommendation section. Do not duplicate the platform recommendation fields in your custom schema.
477
+
478
+ When replacing the current rule provider, copy its existing recommendation settings into the replacement instance's `props`, unless the user requested a rule change, and remove the old instance after the replacement is ready. The first provider in template order applies to the page, including hidden sections: hiding the old Offer can leave its rules active and is not a completed replacement. Read back the final page and verify which provider owns the rules. An ordinary component can replace other presentation content without becoming a rule provider. If removing the last provider leaves a required flow unconfigured, explain that specific missing configuration and arrange its intended replacement; do not prohibit deletion because the component is built-in.
440
479
 
441
480
  #### Thank You runtime
442
481
 
@@ -446,7 +485,7 @@ Offer pages require a recommendation rule. The CLI's Upsell and Downsell starter
446
485
  - `refresh?({ target?: "main" | "addOn" | "all" })` refreshes order data without modifying the order.
447
486
  - `continueShopping?()` and `viewOrder?()` navigate through host-provided destinations.
448
487
 
449
- The snapshot may include order number, status, customer, address, payment summary, lines, totals and currency. Missing data should be omitted or shown as unavailable until loaded. `getSnapshot()` can be `undefined`. `reads.main` and `reads.addOn` independently describe read state:
488
+ The snapshot may include order number, status, customer, address, payment summary, lines, totals, currency and `additionalInformation` (read-only `{ title, value }` entries). Display supplied additional information with non-empty titles and values alongside order details; do not invent missing values or expose checkout editing controls. Missing data should be omitted or shown as unavailable until loaded. `getSnapshot()` can be `undefined`. `reads.main` and `reads.addOn` independently describe read state:
450
489
 
451
490
  | Field | Meaning |
452
491
  | --- | --- |
@@ -500,6 +539,8 @@ For settings-only changes such as a title or color, use Save/Publish without upl
500
539
 
501
540
  ### Validation checklist
502
541
 
542
+ Scale checks to the change. Existing text/color/configuration edits need result and readback checks. For custom code, review the stable final source against the requested behavior and public Runtime, and inspect desktop/mobile rendering. Changed transaction or cross-function behavior warrants a focused independent adversarial review when available; otherwise explicitly self-review and report that limitation. Compare visual work to the reference or agreed theme, including usable controls and relevant error/loading states. Run code review alongside browser checks when practical and repeat only affected checks after fixes; do not add approval stages or fixed review rounds. Unavailable browser/business checks remain unverified.
543
+
503
544
  Before publishing, verify:
504
545
 
505
546
  - `npm run build` passes and the artifact is the current source.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bestcheckout/dynamic-component-cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.10",
4
4
  "description": "CLI and starter project generator for BestCheckout dynamic components",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,6 +11,7 @@
11
11
  "src",
12
12
  "types",
13
13
  "templates",
14
+ "skills",
14
15
  "README.md",
15
16
  "LICENSE"
16
17
  ],
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: checkout-theme-dynamic-development
3
+ description: "Develop or edit local BestCheckout dynamic React components with the dynamic-component CLI for Checkout, Upsell, Downsell and Thank You. Use for local source implementation, validation and Editor preview while preserving business-function completeness. Not needed for MCP-only page customization or platform repository maintenance."
4
+ ---
5
+
6
+ # Local Checkout component development
7
+
8
+ Help a developer work in a local dynamic-component project. BestCheckout MCP and the shop-visual source repository are not prerequisites. The CLI provides the development server, validation and builds; Editor integration provides page preview, Save and Publish.
9
+
10
+ Read the [shared development principles](references/workflow.md) and [local development steps](references/cli-development.md). Use the installed project's CLI version and public documentation for implementation. Read relevant profiles from the generated [behavior catalog](references/behaviors.json) and [component catalog](references/component-catalog.json) as directed by the local steps, checking version compatibility. Do not load every profile for a small change.
11
+
12
+ If MCP is also connected, it may supply relevant page context within the user's scope. Its presence does not change the local source or save path: do not submit the same work through MCP resource writes, accept changes or publish as a side effect of local development. A requested switch of development path requires reconciling the latest source, component identity and saved state before continuing. For MCP-only customization, use its own execution guide; this Skill need not be installed or invoked.
13
+
14
+ Missing page configuration, Editor access or a real Host leaves the corresponding checks unverified. Continue local implementation and checks that do not depend on those facts; ask only for decisions that materially change the result. Do not claim page-wide completeness or invent a business result from a sample preview.
@@ -0,0 +1,3 @@
1
+ interface:
2
+ display_name: "Local Checkout Component Development"
3
+ short_description: "Build local dynamic components with the CLI and Editor"