@greatstore/cli 0.0.20 → 0.0.21
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 +9 -0
- package/dist/cli.js +36 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to `@greatstore/cli` are recorded here. The format
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/).
|
|
5
5
|
|
|
6
|
+
## 0.0.21 — 2026-05-31
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- The `gs init` component scaffold now shows how to write **async**
|
|
10
|
+
components that load data before they render — including validating
|
|
11
|
+
inputs up front and signalling a failure by throwing. The scaffolded
|
|
12
|
+
component no longer includes an `onError` prop; throw from an async
|
|
13
|
+
component to report a failure instead.
|
|
14
|
+
|
|
6
15
|
## 0.0.20 — 2026-05-29
|
|
7
16
|
|
|
8
17
|
### Added
|
package/dist/cli.js
CHANGED
|
@@ -1260,14 +1260,6 @@ interface Props {
|
|
|
1260
1260
|
// Dismiss the host slot (over-input clears the overlay, fullscreen
|
|
1261
1261
|
// reverts the pane, inline is a no-op).
|
|
1262
1262
|
onClose: () => void;
|
|
1263
|
-
// Tell the in-store AI something went wrong so it can apologize or
|
|
1264
|
-
// self-correct on its next turn. Use for *expected* failures inside
|
|
1265
|
-
// async handlers (failed fetch, host-page action rejected, invalid
|
|
1266
|
-
// host state). Render-time crashes are caught and reported for you
|
|
1267
|
-
// \u2014 you don't need a try/catch just to forward exceptions. The
|
|
1268
|
-
// message is read by the AI, not the shopper, so write it like a
|
|
1269
|
-
// short engineering note.
|
|
1270
|
-
onError: (message: string) => void;
|
|
1271
1263
|
}
|
|
1272
1264
|
|
|
1273
1265
|
export default function ${pascal(name)}(_props: Props): React.ReactElement {
|
|
@@ -1277,6 +1269,40 @@ export default function ${pascal(name)}(_props: Props): React.ReactElement {
|
|
|
1277
1269
|
</div>
|
|
1278
1270
|
);
|
|
1279
1271
|
}
|
|
1272
|
+
|
|
1273
|
+
// ---- Async components (backend-backed, render-blocking data) ----
|
|
1274
|
+
// If this component must load data from a backend/API before it can
|
|
1275
|
+
// render correctly, make it async \u2014 don't render an empty shell and
|
|
1276
|
+
// fetch in a useEffect. Set "async": true in manifest.json and export
|
|
1277
|
+
// an async default. GreatStore waits for your promise (showing a normal
|
|
1278
|
+
// loading state, so you don't render your own placeholder), then renders
|
|
1279
|
+
// what it resolves to.
|
|
1280
|
+
//
|
|
1281
|
+
// A thrown error is a RETRY SIGNAL: the in-store AI sees it and usually
|
|
1282
|
+
// re-calls the tool. So only throw when a *different* call could help.
|
|
1283
|
+
// 1. await the backend call, then return the finished JSX.
|
|
1284
|
+
// 2. Validate the AI-passed props first and throw on bad input \u2014 the
|
|
1285
|
+
// AI can fix the args and retry. (Don't validate the API's output
|
|
1286
|
+
// and throw: the AI can't fix the backend, it'll just loop.)
|
|
1287
|
+
// 3. Broadcast a backend failure ONLY when retrying differently could
|
|
1288
|
+
// succeed, and say what to change (e.g. empty search \u2192 "try a
|
|
1289
|
+
// broader keyword"). For idempotent failures (500, timeout, missing
|
|
1290
|
+
// record) re-running the same call changes nothing \u2014 render a
|
|
1291
|
+
// graceful fallback instead of throwing.
|
|
1292
|
+
//
|
|
1293
|
+
// export default async function ${pascal(name)}(props: Props) {
|
|
1294
|
+
// if (!props.query?.trim()) throw new Error("missing required prop: query");
|
|
1295
|
+
// const res = await fetch(\`/api/search?q=\${encodeURIComponent(props.query)}\`);
|
|
1296
|
+
// if (res.ok) {
|
|
1297
|
+
// const { results } = await res.json();
|
|
1298
|
+
// if (results.length === 0)
|
|
1299
|
+
// throw new Error(\`no results for "\${props.query}" \u2014 try a broader keyword\`);
|
|
1300
|
+
// return <ul>{/* render results */}</ul>;
|
|
1301
|
+
// }
|
|
1302
|
+
// return <p>Couldn't load results right now.</p>; // idempotent: don't throw
|
|
1303
|
+
// }
|
|
1304
|
+
//
|
|
1305
|
+
// Components that render purely from their props stay synchronous.
|
|
1280
1306
|
`;
|
|
1281
1307
|
}
|
|
1282
1308
|
function viteEditorConfig() {
|
|
@@ -1675,8 +1701,8 @@ function parseVer(v) {
|
|
|
1675
1701
|
}
|
|
1676
1702
|
|
|
1677
1703
|
// src/index.ts
|
|
1678
|
-
var VERSION = true ? "0.0.
|
|
1679
|
-
var CHANGELOG = true ? '# Changelog\n\nAll notable changes to `@greatstore/cli` are recorded here. The format\nfollows [Keep a Changelog](https://keepachangelog.com/).\n\n## 0.0.20 \u2014 2026-05-29\n\n### Added\n- `gs pull`, `gs push`, and `gs publish` now accept several component\n names at once (e.g. `gs publish header footer cart`). Each component\n is reported on its own line and one failure no longer stops the rest.\n\n## 0.0.19 \u2014 2026-05-28\n\n### Fixed\n- `gs login` on Windows no longer opens a sign-in URL with parameters\n stripped, which surfaced as a "Missing redirect_uri or state\n parameter" page in the browser.\n\n## 0.0.18 \u2014 2026-05-28\n\n### Changed\n- Push and publish errors now name the specific reason \u2014 including\n every failing field in `manifest.json` \u2014 instead of the previous\n generic message.\n\n## 0.0.17 \u2014 2026-05-28\n\n### Added\n- Each command now prints a one-line upgrade notice when a newer\n `@greatstore/cli` is available on npm.\n\n## 0.0.16 \u2014 2026-05-28\n\n### Changed\n- Simplified error messages.\n\n## 0.0.15 \u2014 2026-05-24\n\n### Added\n- Scaffolded `component.tsx` now declares the four injected lifecycle\n props (`onSendMessage`, `onCallTool`, `onClose`, `onError`) on\n `Props`. Use `onError(message)` to report expected failures (failed\n fetch, host action rejected, invalid host state) so the AI can\n recover on its next turn. Render-time crashes are reported for you.\n\n## 0.0.14 \u2014 2026-05-24\n\n### Changed\n- `gs build` output is now whitespace-minified \u2014 typically ~50% smaller.\n\n## 0.0.13 \u2014 2026-05-24\n\n### Changed\n- `gs build` prints the next-step hint (`gs push`, then `gs publish`).\n\n## 0.0.12 \u2014 2026-05-24\n\n### Fixed\n- `gs build` failing to load Vite in some setups.\n\n## 0.0.11 \u2014 2026-05-24\n\n### Added\n- Multi-component projects. `gs init` (no args) scaffolds the project\n root; `gs init <name>` adds a component under `components/<name>/`.\n- `gs build [<name>]` \u2014 compiles every `components/<name>/bundle.js`.\n- `gs push` (no args) uploads only the components that changed.\n- `gs pull` (no args, or `*`) downloads every component. Locally\n edited components are skipped; pass `--force` to overwrite.\n- Public `CHANGELOG.md`; `gs --version` prints recent entries.\n\n### Changed\n- A project folder ships to exactly one store. Only `gs init` accepts\n `--store`; every other command reads the slug from `.gsrc`. The old\n single-component layout is rejected with a migration hint.\n- `gs init` requires `--store <slug>` for a fresh root, and rejects\n `--store` on an existing root.\n- `gs init` no longer writes `build.mjs` \u2014 scripts call `gs build`.\n\n## 0.0.10 \u2014 2026-05-23\n\n### Changed\n- The sign-in browser tab auto-closes once `gs login` finishes.\n\n## 0.0.9 \u2014 2026-05-23\n\n### Changed\n- Scaffolded manifests include a `displayName` so the admin UI has a\n friendlier label.\n\n## 0.0.8 \u2014 2026-05-23\n\n### Changed\n- `gs push` and `gs publish` print a link to view the component.\n\n## 0.0.6 \u2014 2026-05-23\n\n### Changed\n- `gs --version` reads from the published package version.\n\n## 0.0.4 \u2014 2026-05-23\n\n### Changed\n- Scaffolded projects produce browser-ready bundles out of the box.\n\n## 0.0.3 \u2014 2026-05-23\n\n### Changed\n- Trimmed public README to the essentials.\n\n## 0.0.2 \u2014 2026-05-23\n\n### Fixed\n- Sign-in callback parameter handling.\n' : "";
|
|
1704
|
+
var VERSION = true ? "0.0.21" : "0.0.0-dev";
|
|
1705
|
+
var CHANGELOG = true ? '# Changelog\n\nAll notable changes to `@greatstore/cli` are recorded here. The format\nfollows [Keep a Changelog](https://keepachangelog.com/).\n\n## 0.0.21 \u2014 2026-05-31\n\n### Changed\n- The `gs init` component scaffold now shows how to write **async**\n components that load data before they render \u2014 including validating\n inputs up front and signalling a failure by throwing. The scaffolded\n component no longer includes an `onError` prop; throw from an async\n component to report a failure instead.\n\n## 0.0.20 \u2014 2026-05-29\n\n### Added\n- `gs pull`, `gs push`, and `gs publish` now accept several component\n names at once (e.g. `gs publish header footer cart`). Each component\n is reported on its own line and one failure no longer stops the rest.\n\n## 0.0.19 \u2014 2026-05-28\n\n### Fixed\n- `gs login` on Windows no longer opens a sign-in URL with parameters\n stripped, which surfaced as a "Missing redirect_uri or state\n parameter" page in the browser.\n\n## 0.0.18 \u2014 2026-05-28\n\n### Changed\n- Push and publish errors now name the specific reason \u2014 including\n every failing field in `manifest.json` \u2014 instead of the previous\n generic message.\n\n## 0.0.17 \u2014 2026-05-28\n\n### Added\n- Each command now prints a one-line upgrade notice when a newer\n `@greatstore/cli` is available on npm.\n\n## 0.0.16 \u2014 2026-05-28\n\n### Changed\n- Simplified error messages.\n\n## 0.0.15 \u2014 2026-05-24\n\n### Added\n- Scaffolded `component.tsx` now declares the four injected lifecycle\n props (`onSendMessage`, `onCallTool`, `onClose`, `onError`) on\n `Props`. Use `onError(message)` to report expected failures (failed\n fetch, host action rejected, invalid host state) so the AI can\n recover on its next turn. Render-time crashes are reported for you.\n\n## 0.0.14 \u2014 2026-05-24\n\n### Changed\n- `gs build` output is now whitespace-minified \u2014 typically ~50% smaller.\n\n## 0.0.13 \u2014 2026-05-24\n\n### Changed\n- `gs build` prints the next-step hint (`gs push`, then `gs publish`).\n\n## 0.0.12 \u2014 2026-05-24\n\n### Fixed\n- `gs build` failing to load Vite in some setups.\n\n## 0.0.11 \u2014 2026-05-24\n\n### Added\n- Multi-component projects. `gs init` (no args) scaffolds the project\n root; `gs init <name>` adds a component under `components/<name>/`.\n- `gs build [<name>]` \u2014 compiles every `components/<name>/bundle.js`.\n- `gs push` (no args) uploads only the components that changed.\n- `gs pull` (no args, or `*`) downloads every component. Locally\n edited components are skipped; pass `--force` to overwrite.\n- Public `CHANGELOG.md`; `gs --version` prints recent entries.\n\n### Changed\n- A project folder ships to exactly one store. Only `gs init` accepts\n `--store`; every other command reads the slug from `.gsrc`. The old\n single-component layout is rejected with a migration hint.\n- `gs init` requires `--store <slug>` for a fresh root, and rejects\n `--store` on an existing root.\n- `gs init` no longer writes `build.mjs` \u2014 scripts call `gs build`.\n\n## 0.0.10 \u2014 2026-05-23\n\n### Changed\n- The sign-in browser tab auto-closes once `gs login` finishes.\n\n## 0.0.9 \u2014 2026-05-23\n\n### Changed\n- Scaffolded manifests include a `displayName` so the admin UI has a\n friendlier label.\n\n## 0.0.8 \u2014 2026-05-23\n\n### Changed\n- `gs push` and `gs publish` print a link to view the component.\n\n## 0.0.6 \u2014 2026-05-23\n\n### Changed\n- `gs --version` reads from the published package version.\n\n## 0.0.4 \u2014 2026-05-23\n\n### Changed\n- Scaffolded projects produce browser-ready bundles out of the box.\n\n## 0.0.3 \u2014 2026-05-23\n\n### Changed\n- Trimmed public README to the essentials.\n\n## 0.0.2 \u2014 2026-05-23\n\n### Fixed\n- Sign-in callback parameter handling.\n' : "";
|
|
1680
1706
|
var HELP = `gs \u2014 GreatStore CLI (v${VERSION})
|
|
1681
1707
|
|
|
1682
1708
|
Usage:
|