@greatstore/cli 0.2.0 → 0.2.3
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/CHANGELOG.md +15 -0
- package/README.md +5 -5
- package/dist/cli.js +108 -90
- package/dist/gs-skill/SKILL.md +2 -2
- package/dist/gs-skill/recipes/campaign-hero.md +8 -3
- package/dist/gs-skill/recipes/gift-finder-funnel.md +5 -14
- package/dist/gs-skill/recipes/page-action-suite.md +5 -8
- package/dist/gs-skill/references/apps.md +15 -11
- package/dist/gs-skill/references/embed-api.md +37 -51
- package/dist/gs-skill/references/store-admin.md +29 -30
- package/dist/gs-skill/references/structured-content.md +54 -22
- package/package.json +5 -2
package/dist/gs-skill/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: greatstore
|
|
3
|
-
description: Build AI-powered shopping experiences with GreatStore on a merchant's website and store. Use when installing the GreatStore chat widget on a site, generating AI content for custom UI with generateStructuredContent, adding chat entry points (sendMessage), letting the assistant act on the page via WebMCP page tools (document.modelContext.registerTool), authoring custom in-chat apps with the gs CLI, administering the store from the CLI (
|
|
3
|
+
description: Build AI-powered shopping experiences with GreatStore on a merchant's website and store. Use when installing the GreatStore chat widget on a site, generating AI content for custom UI with generateStructuredContent, adding chat entry points (sendMessage), letting the assistant act on the page via WebMCP page tools (document.modelContext.registerTool), authoring custom in-chat apps with the gs CLI, administering the store from the CLI (npx greatstore configure, npx greatstore connectors — origin allowlists, CSP hosts, MCP connectors), setting up web push re-engagement, or connecting AI agents to a store's MCP endpoints. Covers setup, schema design, caching behavior, app authoring, store administration, and ready-made recipes.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Building with GreatStore
|
|
@@ -32,7 +32,7 @@ constraints) that the references spell out.
|
|
|
32
32
|
| Expand an app's image in an **on-brand full-screen lightbox** | an app's `onShowLightbox({ src, originRect })` | [references/apps.md](references/apps.md) |
|
|
33
33
|
| **Re-engage shoppers** with browser notifications | merchant-hosted `gs.js` + `enableNotifications()` | [references/push-notifications.md](references/push-notifications.md) |
|
|
34
34
|
| Connect **AI agents** to the store (shopping tools over MCP, CLI docs for coding agents) | the store's MCP endpoints | [references/agents-and-mcp.md](references/agents-and-mcp.md) |
|
|
35
|
-
| **Administer the store** — read config/connectors to ground decisions; self-serve origin allowlists and CSP hosts | `
|
|
35
|
+
| **Administer the store** — read config/connectors to ground decisions; self-serve origin allowlists and CSP hosts | `npx greatstore configure`, `npx greatstore connectors` | [references/store-admin.md](references/store-admin.md) |
|
|
36
36
|
|
|
37
37
|
## Three things to know before any of it
|
|
38
38
|
|
|
@@ -24,14 +24,19 @@ const data = await window.GreatStore.generateStructuredContent(
|
|
|
24
24
|
headline: { type: "string", maxLength: 60 },
|
|
25
25
|
subline: { type: "string", maxLength: 120 },
|
|
26
26
|
featuredProductName: { type: "string", nullable: true },
|
|
27
|
-
ctaChatMessage: {
|
|
27
|
+
ctaChatMessage: {
|
|
28
|
+
type: "string",
|
|
29
|
+
maxLength: 120,
|
|
30
|
+
description:
|
|
31
|
+
"The first-person message a shopper would send to start shopping " +
|
|
32
|
+
"for the spotlighted product or category",
|
|
33
|
+
},
|
|
28
34
|
},
|
|
29
35
|
required: ["headline", "subline", "ctaChatMessage"],
|
|
30
36
|
},
|
|
31
37
|
`Variant ${week}. Write a homepage hero for this store: a headline and ` +
|
|
32
38
|
`subline spotlighting a real product or category that fits the current ` +
|
|
33
|
-
`season,
|
|
34
|
-
`would send to start shopping for it.`
|
|
39
|
+
`season, and a message for the shopper to start a chat with.`
|
|
35
40
|
);
|
|
36
41
|
|
|
37
42
|
heroHeadline.textContent = data.headline;
|
|
@@ -7,10 +7,7 @@
|
|
|
7
7
|
> as-is.
|
|
8
8
|
|
|
9
9
|
The flagship pattern: an AI-generated quiz card in your design, whose answers
|
|
10
|
-
drop the shopper into a chat that can act on the page.
|
|
11
|
-
`onGreatStoreReady` helper from the
|
|
12
|
-
[embed API reference](../references/embed-api.md#availability) — define
|
|
13
|
-
that once and it works for every use on the page.
|
|
10
|
+
drop the shopper into a chat that can act on the page.
|
|
14
11
|
|
|
15
12
|
```html
|
|
16
13
|
<section id="gift-finder" hidden>
|
|
@@ -19,15 +16,9 @@ that once and it works for every use on the page.
|
|
|
19
16
|
</section>
|
|
20
17
|
|
|
21
18
|
<script>
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
// synchronously and bailing if it's not there yet would silently skip
|
|
26
|
-
// the whole funnel in the first case, and a bare
|
|
27
|
-
// `addEventListener("greatstore:ready", ...)` would silently miss the
|
|
28
|
-
// (one-shot, already-fired) event in the second.
|
|
29
|
-
// onGreatStoreReady (see the embed API reference) handles both.
|
|
30
|
-
onGreatStoreReady(async (gs) => {
|
|
19
|
+
// Works whether this runs before or after the embed script: a listener
|
|
20
|
+
// attached once GreatStore is already ready still receives the event.
|
|
21
|
+
window.addEventListener("greatstore:ready", async ({ detail: gs }) => {
|
|
31
22
|
// Tools the resulting conversation can use — discovered on its next
|
|
32
23
|
// turn automatically.
|
|
33
24
|
document.modelContext.registerTool({
|
|
@@ -88,7 +79,7 @@ that once and it works for every use on the page.
|
|
|
88
79
|
}
|
|
89
80
|
document.getElementById("gift-finder").hidden = false;
|
|
90
81
|
} catch {}
|
|
91
|
-
});
|
|
82
|
+
}, { once: true });
|
|
92
83
|
</script>
|
|
93
84
|
```
|
|
94
85
|
|
|
@@ -7,15 +7,12 @@
|
|
|
7
7
|
> as-is.
|
|
8
8
|
|
|
9
9
|
Give every conversation on the site real capabilities. Register once in a
|
|
10
|
-
shared snippet,
|
|
11
|
-
`document.modelContext` exists)
|
|
12
|
-
|
|
13
|
-
handles both load orderings (embed script not run yet vs. already mounted)
|
|
14
|
-
that a plain `window.GreatStore?.ready.then()` or a bare
|
|
15
|
-
`addEventListener("greatstore:ready", ...)` each only cover one side of:
|
|
10
|
+
shared snippet, once GreatStore is ready (which guarantees
|
|
11
|
+
`document.modelContext` exists). The listener works whether the snippet runs
|
|
12
|
+
before or after the embed script:
|
|
16
13
|
|
|
17
14
|
```js
|
|
18
|
-
|
|
15
|
+
window.addEventListener("greatstore:ready", () => {
|
|
19
16
|
const text = (value) => ({
|
|
20
17
|
content: [{ type: "text", text: JSON.stringify(value) }],
|
|
21
18
|
});
|
|
@@ -72,7 +69,7 @@ onGreatStoreReady(() => {
|
|
|
72
69
|
});
|
|
73
70
|
},
|
|
74
71
|
});
|
|
75
|
-
});
|
|
72
|
+
}, { once: true });
|
|
76
73
|
```
|
|
77
74
|
|
|
78
75
|
Principles at work: throw on failure (the assistant explains and recovers),
|
|
@@ -9,7 +9,7 @@ Each app is an AI-callable tool: the manifest's `description` tells the
|
|
|
9
9
|
assistant *when* to reach for it, its `inputSchema` declares the props the
|
|
10
10
|
assistant fills in, and a `displayMode` picks where it appears.
|
|
11
11
|
|
|
12
|
-
Authoring requires store-owner access (`
|
|
12
|
+
Authoring requires store-owner access (`npx greatstore login` signs in with the store
|
|
13
13
|
owner's account).
|
|
14
14
|
|
|
15
15
|
## How an app actually runs
|
|
@@ -81,21 +81,20 @@ Four consequences worth designing around:
|
|
|
81
81
|
## Workflow
|
|
82
82
|
|
|
83
83
|
```
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
gs apps init --store my-store # scaffold a project root
|
|
84
|
+
npx greatstore login # browser sign-in
|
|
85
|
+
npx greatstore apps init --store my-store # scaffold a project root
|
|
87
86
|
cd <project> && npm install
|
|
88
|
-
|
|
87
|
+
npx greatstore apps init size_guide # scaffold components/size_guide/
|
|
89
88
|
# … edit components/size_guide/{component.tsx,manifest.json} …
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
npx greatstore apps build # bundle every app
|
|
90
|
+
npx greatstore apps push # upload changed apps as drafts
|
|
91
|
+
npx greatstore apps publish size_guide # promote to live
|
|
93
92
|
```
|
|
94
93
|
|
|
95
|
-
`
|
|
96
|
-
round-trips live apps back to disk. `
|
|
94
|
+
`npx greatstore apps list` shows what's deployed (with dashboard links); `npx greatstore apps pull`
|
|
95
|
+
round-trips live apps back to disk. `npx greatstore apps push` hashes apps and only
|
|
97
96
|
uploads what changed. (The subcommands also work at the top level —
|
|
98
|
-
`
|
|
97
|
+
`npx greatstore push` == `npx greatstore apps push`.) On disk each app is a folder under
|
|
99
98
|
`components/`, holding `manifest.json` and `component.tsx`.
|
|
100
99
|
|
|
101
100
|
The scaffold writes an `AGENTS.md` into the project (with `CLAUDE.md` /
|
|
@@ -182,6 +181,11 @@ name yours for the distinct thing it does (`show_catalog_inline` alongside
|
|
|
182
181
|
- `fullscreen` — takes over the full preview surface; persists until the
|
|
183
182
|
next widget-emitting tool call or an explicit close.
|
|
184
183
|
|
|
184
|
+
**Safe-zone for `fullscreen` apps.** The floating chat widget sits over the
|
|
185
|
+
bottom of a fullscreen app, covering whatever is rendered there. Leave
|
|
186
|
+
`6.25em` (100px at the default font size) of bottom padding on the app's
|
|
187
|
+
scrolling content so everything can be scrolled clear of it.
|
|
188
|
+
|
|
185
189
|
## The app contract
|
|
186
190
|
|
|
187
191
|
`component.tsx` default-exports a React component. Its props are the
|
|
@@ -81,12 +81,24 @@ characters) are silently ignored and fall back to the configured default.
|
|
|
81
81
|
| `slug` | `string` | The store identifier the script was loaded for. |
|
|
82
82
|
| `host` | `string` | `"greatstore.ai"`. |
|
|
83
83
|
| `embedHost` | `string` | Origin the embed assets load from, e.g. `https://<slug>.greatstore.ai`. |
|
|
84
|
-
| `ready` | `Promise<void>` | Resolves when the chat UI has mounted and `open()` would render instantly. Resolved promises replay, so `.then()` works no matter when it's attached. The readiness signal to gate on. |
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
## Readiness: the `greatstore:ready` event
|
|
86
|
+
|
|
87
|
+
A `greatstore:ready` `CustomEvent` (with the SDK object as `detail`) is
|
|
88
|
+
dispatched on `window` once the chat UI has mounted and `open()` would render
|
|
89
|
+
instantly. It is the signal to gate on, and it works no matter when the
|
|
90
|
+
listener is attached: a listener added after GreatStore is ready receives the
|
|
91
|
+
event once, straight away.
|
|
92
|
+
|
|
93
|
+
```js
|
|
94
|
+
window.addEventListener(
|
|
95
|
+
"greatstore:ready",
|
|
96
|
+
() => {
|
|
97
|
+
button.hidden = false;
|
|
98
|
+
},
|
|
99
|
+
{ once: true },
|
|
100
|
+
);
|
|
101
|
+
```
|
|
90
102
|
|
|
91
103
|
## Methods
|
|
92
104
|
|
|
@@ -204,21 +216,21 @@ navigating away from the only route that should show it.
|
|
|
204
216
|
No-ops (with a console warning) if nothing is mounted. The cached identity
|
|
205
217
|
and downloaded chat bundle are kept, so a later `load()` (or any call that
|
|
206
218
|
triggers a mount, like `open()`) mounts a fresh panel without a network
|
|
207
|
-
round-trip for either. `ready`
|
|
208
|
-
|
|
219
|
+
round-trip for either. `greatstore:ready` fires again once the next mount
|
|
220
|
+
completes:
|
|
209
221
|
|
|
210
222
|
```js
|
|
211
223
|
window.GreatStore.destroy();
|
|
212
224
|
// ...later, on the page/route where the embed should come back:
|
|
225
|
+
window.addEventListener("greatstore:ready", onRemounted, { once: true });
|
|
213
226
|
window.GreatStore.load();
|
|
214
|
-
await window.GreatStore.ready; // resolves once the fresh mount is done
|
|
215
227
|
```
|
|
216
228
|
|
|
217
229
|
## Page tools — WebMCP (`document.modelContext`)
|
|
218
230
|
|
|
219
231
|
The recommended way to expose page capabilities to the assistant is the
|
|
220
232
|
WebMCP standard. The GreatStore assistant uses every tool registered on
|
|
221
|
-
`document.modelContext` **once GreatStore is ready** (see
|
|
233
|
+
`document.modelContext` **once GreatStore is ready** (see [Availability](#availability)
|
|
222
234
|
below), re-reading the list on each conversational turn — so tools
|
|
223
235
|
registered mid-session appear on the next message without a reload. Tools
|
|
224
236
|
registered before GreatStore is ready are ignored.
|
|
@@ -234,45 +246,20 @@ position, which matters if the page also has another script (a nav widget,
|
|
|
234
246
|
an analytics tag) registering its own WebMCP tools: whichever executes
|
|
235
247
|
first wins that registration, and only a synchronous, unconditionally-first
|
|
236
248
|
script gives GreatStore's fallback shim a real chance of installing before
|
|
237
|
-
one of those calls happens.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
doesn't exist yet. `window.GreatStore?.ready` silently evaluates to
|
|
243
|
-
`undefined` here (optional chaining swallows it), so accessing `.then()`
|
|
244
|
-
on it throws or (written more defensively) just does nothing.
|
|
245
|
-
- **Your script runs after `embed.js` has already mounted** — the
|
|
246
|
-
`greatstore:ready` event already fired once, in the past.
|
|
247
|
-
`window.addEventListener("greatstore:ready", ...)` attached now will
|
|
248
|
-
never see it: the event isn't replayed for late listeners, unlike a
|
|
249
|
-
resolved Promise (`.then()` on an already-resolved Promise still fires).
|
|
250
|
-
|
|
251
|
-
Neither `.ready.then(...)` alone nor `addEventListener("greatstore:ready", ...)`
|
|
252
|
-
alone is safe against both orderings. Use both, picking whichever is valid
|
|
253
|
-
at the moment your code runs:
|
|
249
|
+
one of those calls happens. Your own code
|
|
250
|
+
can still run on either side of `embed.js` — before it has executed at all
|
|
251
|
+
(`window.GreatStore` doesn't exist yet), or long after it has mounted (a lazily rendered component, a
|
|
252
|
+
tag manager). Listening for `greatstore:ready` covers both: a listener
|
|
253
|
+
attached after GreatStore is already ready still receives the event, once.
|
|
254
254
|
|
|
255
255
|
```js
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// once it has. Safe to attach now: nothing can fire it between this
|
|
264
|
-
// check and the listener attaching, since JS execution isn't preemptible.
|
|
265
|
-
window.addEventListener(
|
|
266
|
-
"greatstore:ready",
|
|
267
|
-
(event) => callback(event.detail),
|
|
268
|
-
{ once: true },
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
onGreatStoreReady(() => {
|
|
274
|
-
document.modelContext.registerTool(/* … */);
|
|
275
|
-
});
|
|
256
|
+
window.addEventListener(
|
|
257
|
+
"greatstore:ready",
|
|
258
|
+
() => {
|
|
259
|
+
document.modelContext.registerTool(/* … */);
|
|
260
|
+
},
|
|
261
|
+
{ once: true },
|
|
262
|
+
);
|
|
276
263
|
```
|
|
277
264
|
|
|
278
265
|
(`navigator.modelContext` is a deprecated alias for the same object; use
|
|
@@ -308,11 +295,10 @@ document.modelContext.registerTool(
|
|
|
308
295
|
- **Treat `args` as untrusted input**: values are AI-generated. Validate
|
|
309
296
|
before passing to your own APIs, and never `eval` anything from them.
|
|
310
297
|
|
|
311
|
-
A complete tool, registered once GreatStore is ready
|
|
312
|
-
`onGreatStoreReady` helper defined above):
|
|
298
|
+
A complete tool, registered once GreatStore is ready:
|
|
313
299
|
|
|
314
300
|
```js
|
|
315
|
-
|
|
301
|
+
window.addEventListener("greatstore:ready", () => {
|
|
316
302
|
document.modelContext.registerTool({
|
|
317
303
|
name: "add_to_cart",
|
|
318
304
|
description:
|
|
@@ -337,7 +323,7 @@ onGreatStoreReady(() => {
|
|
|
337
323
|
return { content: [{ type: "text", text: JSON.stringify(cart) }] };
|
|
338
324
|
},
|
|
339
325
|
});
|
|
340
|
-
});
|
|
326
|
+
}, { once: true });
|
|
341
327
|
```
|
|
342
328
|
|
|
343
329
|
Returning the fresh cart state after the mutation lets the assistant confirm
|
|
@@ -380,4 +366,4 @@ in campaign links, emails, and post-login redirects.
|
|
|
380
366
|
| Console: `[GreatStore] Embed script must be loaded from <slug>.greatstore.ai/embed.js` | The script was copied/self-hosted instead of loaded from the store's embed URL. Always load it from `https://<slug>.greatstore.ai/embed.js`. |
|
|
381
367
|
| `generateStructuredContent` rejects with a rate-limit message | More than ~20 requests/minute from one visitor. Consolidate calls into fewer, richer schemas. |
|
|
382
368
|
| Chat won't auto-open after returning to the page | Intentional: the drawer never auto-opens on resume — it would cover the content the shopper is reading. The transcript is preserved; they'll see it when they tap the launcher. |
|
|
383
|
-
| Tools registered but the assistant doesn't use them | Check the `description` — it's the only signal for *when* to call. Also confirm the registration ran (
|
|
369
|
+
| Tools registered but the assistant doesn't use them | Check the `description` — it's the only signal for *when* to call. Also confirm the registration ran (it runs inside a `greatstore:ready` listener) on the same page the conversation is on. |
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Store administration from the CLI
|
|
2
2
|
|
|
3
3
|
The `gs` CLI is a full admin surface for a GreatStore store, mirroring the
|
|
4
|
-
merchant's admin dashboard one-to-one: `
|
|
5
|
-
`
|
|
4
|
+
merchant's admin dashboard one-to-one: `npx greatstore configure` ↔ the Configure panel,
|
|
5
|
+
`npx greatstore connectors` ↔ the Connectors panel, `npx greatstore apps` ↔ the Apps panel. Same
|
|
6
6
|
fields, same behaviour — anything you change is what the merchant sees in
|
|
7
7
|
their dashboard.
|
|
8
8
|
|
|
@@ -14,8 +14,7 @@ the user to go click through a dashboard.
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
|
|
18
|
-
gs login # one-time browser sign-in (needs a human)
|
|
17
|
+
npx greatstore login # one-time browser sign-in (needs a human)
|
|
19
18
|
```
|
|
20
19
|
|
|
21
20
|
Credentials persist across runs. Admin commands take `--store <slug>`
|
|
@@ -29,25 +28,25 @@ Reading store state is never destructive. Do it whenever it would improve a
|
|
|
29
28
|
decision:
|
|
30
29
|
|
|
31
30
|
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
npx greatstore configure --store my-store --json # brand config
|
|
32
|
+
npx greatstore connectors --store my-store --json # MCP connectors feeding the assistant
|
|
33
|
+
npx greatstore connectors health --store my-store # live-probe them (reports tool counts)
|
|
34
|
+
npx greatstore apps list --store my-store --json # deployed custom in-chat apps
|
|
36
35
|
```
|
|
37
36
|
|
|
38
37
|
What each read is good for:
|
|
39
38
|
|
|
40
|
-
- **`
|
|
39
|
+
- **`npx greatstore configure`** — the store's `extraOrigins` (is the site you're
|
|
41
40
|
integrating actually allowlisted? — see the embed troubleshooting note in
|
|
42
41
|
[embed-api.md](embed-api.md)), `theme` (match generated on-page UI to the
|
|
43
42
|
brand's colors/radius), `storeLink`, and CSP host lists.
|
|
44
|
-
- **`
|
|
43
|
+
- **`npx greatstore connectors`** — which MCP connectors the assistant has, and whether
|
|
45
44
|
the Maker MCP is on. This tells you what the assistant can actually *do*:
|
|
46
45
|
check it before building features that lean on catalog data (e.g.
|
|
47
46
|
[structured content](structured-content.md) grounding), and before
|
|
48
47
|
registering WebMCP page tools that would duplicate a capability a
|
|
49
48
|
server-side connector already provides.
|
|
50
|
-
- **`
|
|
49
|
+
- **`npx greatstore connectors health`** — a connector being listed doesn't mean it's
|
|
51
50
|
reachable; this probes each one live. Run it when assistant behaviour
|
|
52
51
|
suggests a tool isn't responding.
|
|
53
52
|
|
|
@@ -67,9 +66,9 @@ make: they're additive, easy to undo, and invisible to shoppers.
|
|
|
67
66
|
current value, append yours, write the union:
|
|
68
67
|
|
|
69
68
|
```
|
|
70
|
-
|
|
69
|
+
npx greatstore configure --store my-store --json
|
|
71
70
|
# extraOrigins is ["https://shop.example.com"] → write both, comma-separated:
|
|
72
|
-
|
|
71
|
+
npx greatstore configure set --store my-store \
|
|
73
72
|
--extraOrigins "https://shop.example.com,https://staging.example.com"
|
|
74
73
|
```
|
|
75
74
|
|
|
@@ -83,9 +82,9 @@ do for every shopper. Propose it, don't do it unprompted:
|
|
|
83
82
|
|
|
84
83
|
- **Brand-visible config** — `displayName`, `assistantName`, `storeLink`,
|
|
85
84
|
`theme`, and asset uploads
|
|
86
|
-
(`
|
|
87
|
-
- **Connector mutations** — `
|
|
88
|
-
`
|
|
85
|
+
(`npx greatstore configure upload|clear icon|logoLight|logoDark`).
|
|
86
|
+
- **Connector mutations** — `npx greatstore connectors add|remove|enable|disable` and
|
|
87
|
+
`npx greatstore connectors maker on|off`. (`add` probes the connector for tool
|
|
89
88
|
discovery before saving and refuses if it doesn't answer; `--force`
|
|
90
89
|
overrides. Still: adding capabilities to the merchant's assistant is the
|
|
91
90
|
merchant's call.)
|
|
@@ -99,32 +98,32 @@ and confirm the result with a read.
|
|
|
99
98
|
## Command reference
|
|
100
99
|
|
|
101
100
|
```
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
npx greatstore configure [--json] show configuration
|
|
102
|
+
npx greatstore configure set --<field> <value> displayName, assistantName,
|
|
104
103
|
storeLink, extraOrigins a,b,
|
|
105
104
|
cspScriptHosts a,b, cspConnectHosts a,b
|
|
106
105
|
("" clears a field)
|
|
107
|
-
|
|
106
|
+
npx greatstore configure set --theme.<field> <value> one theme field, merged into the rest:
|
|
108
107
|
mode auto|light|dark|custom,
|
|
109
108
|
radius sharp|default|rounded,
|
|
110
109
|
fontFamily, secondaryFontFamily,
|
|
111
110
|
mobileBottomBarOffset (px, 0-200), zIndex,
|
|
112
111
|
brandColor/surfaceColor/textColor and
|
|
113
112
|
the fine-grained color tokens
|
|
114
|
-
|
|
113
|
+
npx greatstore configure set --theme '<json>' merge a whole object (--themeFile <path>);
|
|
115
114
|
--replace overwrites instead of merging
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
npx greatstore configure set --help every field, its type and legal values
|
|
116
|
+
npx greatstore configure upload <kind> <file> icon | logoLight | logoDark (.png/.jpg/.webp)
|
|
117
|
+
npx greatstore configure clear <kind> remove an uploaded asset
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
npx greatstore connectors [--json] list Maker toggle + custom connectors
|
|
120
|
+
npx greatstore connectors add <name> --url <url> [--token <t>] [--profileUrl <u>]
|
|
122
121
|
[--disabled] [--force]
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
npx greatstore connectors remove <name|id>
|
|
123
|
+
npx greatstore connectors enable|disable <name|id>
|
|
124
|
+
npx greatstore connectors maker on|off
|
|
125
|
+
npx greatstore connectors health [<name|id>] [--json]
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
npx greatstore apps <init|build|list|pull|push|publish|unpublish|delete>
|
|
129
128
|
see apps.md for the workflow
|
|
130
129
|
```
|
|
@@ -23,9 +23,11 @@ Each is unpacked in the sections below; this is the checklist.
|
|
|
23
23
|
|
|
24
24
|
1. **Top level must be an object.** Want a list? Wrap it:
|
|
25
25
|
`{ type: "object", properties: { items: { type: "array", … } }, required: ["items"] }`.
|
|
26
|
-
2. **Steer with the prompt,
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
2. **Steer the whole output with the prompt, single fields with
|
|
27
|
+
`description`.** A property's `description` reaches the AI as guidance for
|
|
28
|
+
that field; it's optional, so use self-explanatory property names
|
|
29
|
+
(`benefitHeadline`, not `text1`) and describe only where the name isn't
|
|
30
|
+
enough.
|
|
29
31
|
3. **Only `require` what's guaranteed.** `required` is strictly enforced; if
|
|
30
32
|
the catalog can't ground a required field the whole call can fail. Require
|
|
31
33
|
structural fields, keep per-product details (image URLs, prices) optional,
|
|
@@ -41,8 +43,8 @@ Each is unpacked in the sections below; this is the checklist.
|
|
|
41
43
|
provide. Ask for something outside them — currency conversion, live
|
|
42
44
|
shipping rates, review data the store never wired up — and it has nothing
|
|
43
45
|
to ground on, so it will decline, omit… or hallucinate. Before writing a
|
|
44
|
-
prompt or schema that depends on a data capability, run `
|
|
45
|
-
(and `
|
|
46
|
+
prompt or schema that depends on a data capability, run `npx greatstore connectors`
|
|
47
|
+
(and `npx greatstore connectors health`, [store-admin.md](store-admin.md)) and confirm
|
|
46
48
|
a connector for it exists; if it doesn't, don't ask for it.
|
|
47
49
|
6. **Responses are cached** for up to ~24h per page + prompt + schema —
|
|
48
50
|
shared across anonymous visitors, per-shopper for identified ones. Keep
|
|
@@ -66,7 +68,7 @@ Each is unpacked in the sections below; this is the checklist.
|
|
|
66
68
|
page's DOM is never read. Research happens on GreatStore's side — your
|
|
67
69
|
prompt only needs to *point* it at the right SKU, product, or collection,
|
|
68
70
|
not carry the material. Its reach is exactly the store's MCP connectors:
|
|
69
|
-
validate with `
|
|
71
|
+
validate with `npx greatstore connectors` ([store-admin.md](store-admin.md)) that a
|
|
70
72
|
connector for the data you want actually exists before you build on it —
|
|
71
73
|
research can't exceed the wired-up connectors, and prompts that assume
|
|
72
74
|
otherwise invite hallucinated filler.
|
|
@@ -97,31 +99,60 @@ Supported keywords (anything else is tolerated but ignored):
|
|
|
97
99
|
- Choice: `enum`, `const`, `anyOf`, `nullable`
|
|
98
100
|
- Constraints: `minimum`, `maximum`, `minLength`, `maxLength`, `minItems`,
|
|
99
101
|
`maxItems`, `pattern`, `format`, `default`
|
|
102
|
+
- Guidance: `description`, `example`, `title` (on any property)
|
|
100
103
|
|
|
101
104
|
Validation of the output is real: `required` is enforced, `enum`/`const`
|
|
102
105
|
must match, numeric and length bounds are checked, and
|
|
103
106
|
`additionalProperties: false` rejects extra keys. Constraints are therefore a
|
|
104
|
-
*tool* — `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
*tool* — `enum` reliably restricts a field — but every constraint is also a
|
|
108
|
+
way for generation to fail, so apply them only where you'd rather have no
|
|
109
|
+
content than non-conforming content.
|
|
110
|
+
|
|
111
|
+
Item counts are the exception. `minItems` is honored as the content is
|
|
112
|
+
written, so a list comes back with at least that many entries, and a list
|
|
113
|
+
longer than `maxItems` is cut to its first `maxItems` entries rather than
|
|
114
|
+
failing. The same applies to an app's `inputSchema`.
|
|
107
115
|
|
|
108
116
|
Zod schemas (or anything with a `.toJSONSchema()` method) are accepted and
|
|
109
|
-
converted automatically
|
|
117
|
+
converted automatically — `.describe("…")` becomes the field's `description`.
|
|
118
|
+
|
|
119
|
+
### Field descriptions
|
|
110
120
|
|
|
111
|
-
|
|
121
|
+
A property's `description` is shown to the AI as guidance for that one
|
|
122
|
+
field, and an `example` shows the exact shape you want (`"4.5 out of 5"`,
|
|
123
|
+
`"SKU-1234"`). Both are optional: a field without them is filled from its
|
|
124
|
+
name, the prompt, and its constraints.
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
{
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
headline: { type: "string", maxLength: 60 },
|
|
131
|
+
priceJustification: {
|
|
132
|
+
type: "string",
|
|
133
|
+
description: "One sentence on why the price is fair, citing a real material or feature",
|
|
134
|
+
},
|
|
135
|
+
rating: { type: "string", example: "4.5 out of 5" },
|
|
136
|
+
},
|
|
137
|
+
required: ["headline"],
|
|
138
|
+
}
|
|
139
|
+
```
|
|
112
140
|
|
|
113
|
-
|
|
114
|
-
AI sees it (they're a prompt-injection surface, so they're filtered
|
|
115
|
-
server-side). Consequences:
|
|
141
|
+
Split the work between the two channels:
|
|
116
142
|
|
|
117
|
-
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
143
|
+
- **Prompt** — the situation, the task as a whole, grounding, and voice.
|
|
144
|
+
- **`description` / `example`** — what one specific field holds: its unit, length in
|
|
145
|
+
words, perspective ("first-person, as the shopper"), or how it relates to
|
|
146
|
+
a sibling. Instructions that apply to the whole output don't belong here.
|
|
147
|
+
- Property *names* still carry most of the intent — make them
|
|
148
|
+
self-documenting (`ctaLabel`, `warmthRating`, `priceJustification`) and
|
|
149
|
+
reach for a description when the name can't say it.
|
|
121
150
|
|
|
122
151
|
## Prompting guide
|
|
123
152
|
|
|
124
|
-
The prompt
|
|
153
|
+
The prompt carries the instructions for the output as a whole (per-field
|
|
154
|
+
guidance can sit in each field's `description` or `example`). A good prompt states, in
|
|
155
|
+
order:
|
|
125
156
|
|
|
126
157
|
1. **Context** — what page/situation the shopper is in, naming the entity so
|
|
127
158
|
research targets the right thing (the AI can't see your DOM, so identify
|
|
@@ -154,7 +185,7 @@ Anti-patterns:
|
|
|
154
185
|
- **Asking for data no connector provides** ("convert the price to EUR",
|
|
155
186
|
"estimate delivery to the shopper's city"): research can't exceed the
|
|
156
187
|
store's MCP connectors, and the AI may hallucinate plausible-looking
|
|
157
|
-
values rather than leave the field empty. Validate first — `
|
|
188
|
+
values rather than leave the field empty. Validate first — `npx greatstore connectors`
|
|
158
189
|
shows what's wired up ([store-admin.md](store-admin.md)); if there's no
|
|
159
190
|
connector for it, don't ask for it.
|
|
160
191
|
- **Asking it to read the page** ("summarize the reviews shown below") — it
|
|
@@ -165,7 +196,9 @@ Anti-patterns:
|
|
|
165
196
|
delivery countdowns). Even when a connector could answer, responses cache
|
|
166
197
|
for up to ~24h — display operational data from your own platform APIs and
|
|
167
198
|
use GreatStore for *editorial intelligence over the catalog*.
|
|
168
|
-
- **
|
|
199
|
+
- **Putting whole-output instructions in a field's `description`** (voice,
|
|
200
|
+
grounding, what the page is) — they belong in the prompt, where they apply
|
|
201
|
+
to every field.
|
|
169
202
|
|
|
170
203
|
## Caching: design for it
|
|
171
204
|
|
|
@@ -221,7 +254,6 @@ A decline is only ever one of these `error.reason` values — anything else
|
|
|
221
254
|
| `harmful` | asks for unsafe, hateful, sexual, or illegal content, or advice that could hurt someone |
|
|
222
255
|
| `deceptive` | asks for fake reviews, invented discounts or scarcity, claims the catalog contradicts, or impersonating/disparaging a named brand or person |
|
|
223
256
|
| `system_probe` | asks about or tries to override the assistant's own instructions or tools |
|
|
224
|
-
| `no_data` | depends on specific store facts and research found nothing to fill the required fields — check `gs connectors`, or make those fields optional |
|
|
225
257
|
|
|
226
258
|
The uniform shopper-facing strategy: render into a hidden-by-default
|
|
227
259
|
container, reveal on success, leave hidden (or show your static fallback) on
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@greatstore/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "CLI for administering GreatStore stores and authoring custom components.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,5 +27,8 @@
|
|
|
27
27
|
"tsup": "^8.3.0",
|
|
28
28
|
"typescript": "^5.8.2",
|
|
29
29
|
"vitest": "^2.1.0"
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
|
+
"publishAliases": [
|
|
32
|
+
"greatstore"
|
|
33
|
+
]
|
|
31
34
|
}
|