greatstore 0.3.1 → 0.5.0
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 +27 -0
- package/README.md +15 -0
- package/dist/cli.js +178 -127
- package/dist/gs-skill/SKILL.md +2 -2
- package/dist/gs-skill/references/apps.md +45 -1
- package/dist/gs-skill/references/embed-api/generate-structured-content.md +1 -1
- package/dist/gs-skill/references/knowledge-and-instructions.md +61 -17
- package/package.json +1 -1
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 (npx greatstore configure, npx greatstore connectors — origin allowlists, CSP hosts, MCP connectors), making the store's assistant smarter (npx greatstore knowledge — knowledge base documents, agent instructions, separating instructions from knowledge, fixing an assistant that ignores an instruction, auditing and reorganising a knowledge base, testing it with ask), setting up web push re-engagement, or connecting AI agents to a store's MCP endpoints. Covers setup, schema design, caching behavior, app authoring, and store administration.
|
|
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), making the store's assistant smarter (npx greatstore knowledge — knowledge base documents, agent instructions, separating instructions from knowledge, fixing an assistant that ignores an instruction, auditing and reorganising a knowledge base, testing it with ask; npx greatstore analyze — reading real shopper questions, searches, unanswered gaps and chats), setting up web push re-engagement, or connecting AI agents to a store's MCP endpoints. Covers setup, schema design, caching behavior, app authoring, and store administration.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Building with GreatStore
|
|
@@ -34,7 +34,7 @@ constraints) that the references spell out.
|
|
|
34
34
|
| **Re-engage shoppers** with browser notifications | merchant-hosted `gs.js` + `enableNotifications()` | [references/push-notifications.md](references/push-notifications.md) |
|
|
35
35
|
| 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) |
|
|
36
36
|
| **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) |
|
|
37
|
-
| **Make the assistant smarter** — knowledge base documents, agent instructions, what goes where, fixing an assistant that ignores an instruction, auditing and reorganising the knowledge base, testing it | `npx greatstore knowledge` | [references/knowledge-and-instructions.md](references/knowledge-and-instructions.md) |
|
|
37
|
+
| **Make the assistant smarter** — knowledge base documents, agent instructions, what goes where, fixing an assistant that ignores an instruction, auditing and reorganising the knowledge base, testing it, reading what shoppers really ask and where it fell short | `npx greatstore knowledge`, `npx greatstore analyze` | [references/knowledge-and-instructions.md](references/knowledge-and-instructions.md) |
|
|
38
38
|
|
|
39
39
|
## Three things to know before any of it
|
|
40
40
|
|
|
@@ -235,11 +235,55 @@ the whole art of making an app embeddable:
|
|
|
235
235
|
assistant picks your app in chat, and it now also briefs the generation.
|
|
236
236
|
The same "when to reach for this, and what comes back" sentence serves both.
|
|
237
237
|
|
|
238
|
+
**When the page already knows what the app is about, name the lookups on the
|
|
239
|
+
container.** A `prefetch` attribute takes the same `{ name, args }` list as
|
|
240
|
+
[`generateStructuredContent`](embed-api/generate-structured-content.md#prefetching-what-the-page-knows),
|
|
241
|
+
as JSON, and the props come back noticeably sooner. Fill the values with the
|
|
242
|
+
storefront's own templating, so one container works on every page of its kind:
|
|
243
|
+
|
|
244
|
+
```html
|
|
245
|
+
<greatstore-app name="show_size_guide"
|
|
246
|
+
prefetch='[{"name":"get_product_details","args":{"product_id":"{{ product.id }}"}}]'>
|
|
247
|
+
</greatstore-app>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
- The tool names and arguments are this store's — look them up with
|
|
251
|
+
`npx greatstore connectors tools <connector> --store <slug>`. That is why
|
|
252
|
+
they go on the container, not in the manifest: the same app runs on stores
|
|
253
|
+
with different connectors.
|
|
254
|
+
- They are the **whole** lookup, as with `generateStructuredContent`: name
|
|
255
|
+
everything the props need.
|
|
256
|
+
- A `prefetch` that isn't valid JSON, or names a tool the store can't run as a
|
|
257
|
+
read-only lookup, is ignored with a console warning; the app still appears,
|
|
258
|
+
just without the head start. Check the console after placing one.
|
|
259
|
+
|
|
260
|
+
**When the page already knows the props themselves, put them on the
|
|
261
|
+
container.** A `props` attribute takes a JSON object of props, filled by the
|
|
262
|
+
storefront's templating. If it covers every prop your `inputSchema` lists as
|
|
263
|
+
`required`, nothing is generated: the app renders as soon as it loads, with
|
|
264
|
+
exactly those props. If it covers only some, the rest are generated as usual
|
|
265
|
+
and the ones you supplied override them.
|
|
266
|
+
|
|
267
|
+
```html
|
|
268
|
+
<greatstore-app name="show_size_guide"
|
|
269
|
+
props='{"product_id":"{{ product.id }}","title":{{ product.title | json }}}'>
|
|
270
|
+
</greatstore-app>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
- Escape values for JSON inside a single-quoted attribute (Liquid's `| json`
|
|
274
|
+
filter does it); a `props` that isn't a JSON object is ignored with a
|
|
275
|
+
console warning.
|
|
276
|
+
- Nothing checks supplied props against your schema — they reach the app as
|
|
277
|
+
written.
|
|
278
|
+
- Make a prop `required` only if the app can't render without it: that list
|
|
279
|
+
is what decides whether a placement skips generation.
|
|
280
|
+
|
|
238
281
|
What to expect:
|
|
239
282
|
|
|
240
283
|
- Props are generated once, when the container mounts, and are specific to
|
|
241
284
|
the shopper looking at it. Nothing regenerates if your page later changes
|
|
242
|
-
what it shows without reloading
|
|
285
|
+
what it shows without reloading — unless it changes the container's `name`,
|
|
286
|
+
`prefetch` or `props`, which starts the app again.
|
|
243
287
|
- `displayMode` is a chat concept. On the page every app renders in flow,
|
|
244
288
|
whatever its mode says.
|
|
245
289
|
- While the app is being prepared, whatever markup you put **inside** the
|
|
@@ -47,7 +47,7 @@ Each is unpacked in the sections below; this is the checklist.
|
|
|
47
47
|
`npx greatstore connectors` (and `npx greatstore connectors health`,
|
|
48
48
|
[store-admin.md](../store-admin.md)) first; if there's no connector for
|
|
49
49
|
it, don't ask for it.
|
|
50
|
-
6. **Responses are cached** for up to ~
|
|
50
|
+
6. **Responses are cached** for up to ~a week per page + prompt + schema. Keep
|
|
51
51
|
prompts deterministic per page — no timestamps, random values, or
|
|
52
52
|
per-visitor data.
|
|
53
53
|
7. **Progressive enhancement, always.** Generate after the page renders into
|
|
@@ -15,10 +15,10 @@ when a question happens to bring that source up, so it gets followed some of
|
|
|
15
15
|
the time. A pile of facts saved as instructions crowds out the rules that
|
|
16
16
|
matter. Keep each in its place and both work better.
|
|
17
17
|
|
|
18
|
-
Everything here uses `npx greatstore knowledge` (alias `kb`)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
for every flag.
|
|
18
|
+
Everything here uses `npx greatstore knowledge` (alias `kb`), and
|
|
19
|
+
`npx greatstore analyze` to read what shoppers actually asked. Both take
|
|
20
|
+
`--store <slug>` or read the nearest `.gsrc`, like the other admin commands
|
|
21
|
+
(see [store-admin.md](store-admin.md)). Run `--help` on either for every flag.
|
|
22
22
|
|
|
23
23
|
## Instructions or knowledge?
|
|
24
24
|
|
|
@@ -149,13 +149,49 @@ of it is used and how much is left. When it runs out, `ask` is refused until
|
|
|
149
149
|
older tests fall out of the 6 hours. Plan your test questions to fit, and tell
|
|
150
150
|
the user if you can't finish testing.
|
|
151
151
|
|
|
152
|
+
## Reading shopper traffic with `analyze`
|
|
153
|
+
|
|
154
|
+
`analyze` prints the store's real shopper traffic as JSON. It only reads, and
|
|
155
|
+
it never includes test chats (yours, or the dashboard's).
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
npx greatstore analyze gaps # messages the assistant couldn't answer, with why
|
|
159
|
+
npx greatstore analyze questions --from 2026-10-01 --to 2026-10-31
|
|
160
|
+
npx greatstore analyze searches --page 2
|
|
161
|
+
npx greatstore analyze chats # conversations by day of last activity
|
|
162
|
+
npx greatstore analyze chat <id> # one conversation in full
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Lists cover the last 7 days unless you pass `--from` / `--to` (UTC days, at
|
|
166
|
+
most 90), grouped by day, newest first, 50 items a page. Read `pages` and fetch
|
|
167
|
+
more with `--page` when you need them. Each gap, question and search names its
|
|
168
|
+
`conversationId` and `seq`. Open it with `analyze chat <id>` and find the
|
|
169
|
+
message with that `seq` to see what led up to it and what the assistant did.
|
|
170
|
+
|
|
171
|
+
A gap's `reason` says what was missing:
|
|
172
|
+
|
|
173
|
+
| `reason` | What it means | Where the fix goes |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| `missing_info` | The store's content doesn't cover it | A knowledge source |
|
|
176
|
+
| `missing_product_info` | A product's own details don't cover it | The product catalog, which the merchant edits in their store platform, not the knowledge base |
|
|
177
|
+
| `cant_act` | The shopper asked for something the assistant can't do | A tool or app, or an instruction saying where to send them |
|
|
178
|
+
| `cant_show` | The assistant had no way to show what was asked for | An app |
|
|
179
|
+
| `not_carried` | The store doesn't sell it | Usually nothing |
|
|
180
|
+
| `deflected` | The assistant could have answered but didn't | The instructions |
|
|
181
|
+
|
|
182
|
+
Conversations are shown verbatim. Quote them to the merchant as needed, but
|
|
183
|
+
never copy a shopper's words or details into a knowledge source or the
|
|
184
|
+
instructions.
|
|
185
|
+
|
|
152
186
|
## Auditing and reorganising the knowledge base
|
|
153
187
|
|
|
154
188
|
When the user asks you to review the knowledge base, or the assistant's answers
|
|
155
189
|
are generally weak, audit it end to end before changing anything:
|
|
156
190
|
|
|
157
191
|
1. **Take inventory.** Run `knowledge list --json` and `knowledge instructions`.
|
|
158
|
-
Note any failed sources and why they failed.
|
|
192
|
+
Note any failed sources and why they failed. Then read the traffic:
|
|
193
|
+
`analyze questions` and `analyze gaps` (widen `--from` to 30 days or more
|
|
194
|
+
on a quiet store).
|
|
159
195
|
2. **Read every source** with `show`. A source that can't be shown as text is
|
|
160
196
|
an uploaded document kept in its original format. Note it, and judge it by
|
|
161
197
|
its name and by what `ask` gets out of it.
|
|
@@ -169,15 +205,21 @@ are generally weak, audit it end to end before changing anything:
|
|
|
169
205
|
- sources mixing several topics
|
|
170
206
|
- names that don't say what's inside
|
|
171
207
|
- failed sources
|
|
172
|
-
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
208
|
+
- gaps shoppers actually hit: group `analyze gaps` by what was asked, and
|
|
209
|
+
rank them by how often they recur
|
|
210
|
+
5. **Write a baseline.** Take 5–10 real questions from `analyze questions` and
|
|
211
|
+
`analyze gaps`, favouring the ones that recur, plus one or two that touch an
|
|
212
|
+
instruction. Use the shopper's own wording. Run each with `ask` and keep the
|
|
213
|
+
replies. Only make up a question when the traffic has too few.
|
|
176
214
|
6. **Propose a plan to the merchant.** Show the target layout (one topic per
|
|
177
215
|
source, with names) and each change as before and after: which sources to
|
|
178
216
|
split, merge, edit, rename or remove, and what moves into or out of the
|
|
179
|
-
instructions.
|
|
180
|
-
|
|
217
|
+
instructions. Turn each recurring `missing_info` gap into a proposed source
|
|
218
|
+
with its name and what it should cover, and mark the ones that need facts
|
|
219
|
+
only the merchant has (a policy, a price, a date). List the
|
|
220
|
+
`missing_product_info` gaps separately, as details to add to those products
|
|
221
|
+
in the catalog rather than to the knowledge base. Make no changes until they
|
|
222
|
+
agree.
|
|
181
223
|
7. **Make the changes in small steps.** Add the new sources first (with
|
|
182
224
|
`--wait`), then edit, and remove the old ones last, so nothing is missing
|
|
183
225
|
in between. Check `status` when you're done.
|
|
@@ -192,10 +234,12 @@ Every run uses the store's credits and counts against the test-chat allowance
|
|
|
192
234
|
|
|
193
235
|
Work through these in order, and stop when it's fixed:
|
|
194
236
|
|
|
195
|
-
1. **Reproduce it.**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
237
|
+
1. **Reproduce it.** Look for real chats showing the problem first: scan
|
|
238
|
+
`analyze chats` for likely conversations, and read them with
|
|
239
|
+
`analyze chat <id>`. Then reproduce it with `ask`, using the shopper's
|
|
240
|
+
messages from that chat. If the rule applies mid-conversation, set the
|
|
241
|
+
conversation up first with `--conversation`. Without a reproduction you
|
|
242
|
+
can't tell whether a change helped.
|
|
199
243
|
2. **Find where the rule lives.** Read the instructions
|
|
200
244
|
(`knowledge instructions`) and search the sources (`knowledge list`, then
|
|
201
245
|
`show` the likely ones). A rule that only exists inside a knowledge source
|
|
@@ -221,8 +265,8 @@ exchange to the merchant rather than piling on more rules.
|
|
|
221
265
|
|
|
222
266
|
## What you may change without asking
|
|
223
267
|
|
|
224
|
-
- **Freely:** every read (`list`, `status`, `show`, `instructions
|
|
225
|
-
to test (a few turns; it uses credits).
|
|
268
|
+
- **Freely:** every read (`list`, `status`, `show`, `instructions`, and all of
|
|
269
|
+
`analyze`), and `ask` to test (a few turns; it uses credits).
|
|
226
270
|
- **When the task calls for it:** adding web pages (`add --url`) and notes you
|
|
227
271
|
wrote from what the user told you (`add --text`). Report what you added.
|
|
228
272
|
- **Only for a file the user named:** uploading a local file (`add <file>`,
|