@greatstore/cli 0.0.20 → 0.0.22

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cli.js +42 -14
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
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.22 — 2026-06-02
7
+
8
+ ### Added
9
+ - `gs list` now shows a link to each component's page in the dashboard,
10
+ so you can jump straight to a component to preview or publish it. The
11
+ link is also included in `gs list --json`.
12
+
13
+ ## 0.0.21 — 2026-05-31
14
+
15
+ ### Changed
16
+ - The `gs init` component scaffold now shows how to write **async**
17
+ components that load data before they render — including validating
18
+ inputs up front and signalling a failure by throwing. The scaffolded
19
+ component no longer includes an `onError` prop; throw from an async
20
+ component to report a failure instead.
21
+
6
22
  ## 0.0.20 — 2026-05-29
7
23
 
8
24
  ### Added
package/dist/cli.js CHANGED
@@ -542,18 +542,20 @@ async function listCommand(args) {
542
542
  name: c.name,
543
543
  draft: c.draft ? `v${c.draft.version}` : "\u2014",
544
544
  live: c.live ? `v${c.live.version}` : "\u2014",
545
- updated: c.live?.updatedAt ?? c.draft?.updatedAt ?? ""
545
+ updated: c.live?.updatedAt ?? c.draft?.updatedAt ?? "",
546
+ permalink: c.permalink ?? ""
546
547
  }));
547
548
  const widths = {
548
549
  name: Math.max(4, ...rows.map((r) => r.name.length)),
549
550
  draft: Math.max(5, ...rows.map((r) => r.draft.length)),
550
- live: Math.max(4, ...rows.map((r) => r.live.length))
551
+ live: Math.max(4, ...rows.map((r) => r.live.length)),
552
+ updated: Math.max(7, ...rows.map((r) => r.updated.length))
551
553
  };
552
- const header = `${pad("NAME", widths.name)} ${pad("DRAFT", widths.draft)} ${pad("LIVE", widths.live)} UPDATED`;
554
+ const header = `${pad("NAME", widths.name)} ${pad("DRAFT", widths.draft)} ${pad("LIVE", widths.live)} ${pad("UPDATED", widths.updated)} LINK`;
553
555
  process.stdout.write(header + "\n");
554
556
  for (const r of rows) {
555
557
  process.stdout.write(
556
- `${pad(r.name, widths.name)} ${pad(r.draft, widths.draft)} ${pad(r.live, widths.live)} ${r.updated}
558
+ `${pad(r.name, widths.name)} ${pad(r.draft, widths.draft)} ${pad(r.live, widths.live)} ${pad(r.updated, widths.updated)} ${r.permalink}
557
559
  `
558
560
  );
559
561
  }
@@ -1260,14 +1262,6 @@ interface Props {
1260
1262
  // Dismiss the host slot (over-input clears the overlay, fullscreen
1261
1263
  // reverts the pane, inline is a no-op).
1262
1264
  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
1265
  }
1272
1266
 
1273
1267
  export default function ${pascal(name)}(_props: Props): React.ReactElement {
@@ -1277,6 +1271,40 @@ export default function ${pascal(name)}(_props: Props): React.ReactElement {
1277
1271
  </div>
1278
1272
  );
1279
1273
  }
1274
+
1275
+ // ---- Async components (backend-backed, render-blocking data) ----
1276
+ // If this component must load data from a backend/API before it can
1277
+ // render correctly, make it async \u2014 don't render an empty shell and
1278
+ // fetch in a useEffect. Set "async": true in manifest.json and export
1279
+ // an async default. GreatStore waits for your promise (showing a normal
1280
+ // loading state, so you don't render your own placeholder), then renders
1281
+ // what it resolves to.
1282
+ //
1283
+ // A thrown error is a RETRY SIGNAL: the in-store AI sees it and usually
1284
+ // re-calls the tool. So only throw when a *different* call could help.
1285
+ // 1. await the backend call, then return the finished JSX.
1286
+ // 2. Validate the AI-passed props first and throw on bad input \u2014 the
1287
+ // AI can fix the args and retry. (Don't validate the API's output
1288
+ // and throw: the AI can't fix the backend, it'll just loop.)
1289
+ // 3. Broadcast a backend failure ONLY when retrying differently could
1290
+ // succeed, and say what to change (e.g. empty search \u2192 "try a
1291
+ // broader keyword"). For idempotent failures (500, timeout, missing
1292
+ // record) re-running the same call changes nothing \u2014 render a
1293
+ // graceful fallback instead of throwing.
1294
+ //
1295
+ // export default async function ${pascal(name)}(props: Props) {
1296
+ // if (!props.query?.trim()) throw new Error("missing required prop: query");
1297
+ // const res = await fetch(\`/api/search?q=\${encodeURIComponent(props.query)}\`);
1298
+ // if (res.ok) {
1299
+ // const { results } = await res.json();
1300
+ // if (results.length === 0)
1301
+ // throw new Error(\`no results for "\${props.query}" \u2014 try a broader keyword\`);
1302
+ // return <ul>{/* render results */}</ul>;
1303
+ // }
1304
+ // return <p>Couldn't load results right now.</p>; // idempotent: don't throw
1305
+ // }
1306
+ //
1307
+ // Components that render purely from their props stay synchronous.
1280
1308
  `;
1281
1309
  }
1282
1310
  function viteEditorConfig() {
@@ -1675,8 +1703,8 @@ function parseVer(v) {
1675
1703
  }
1676
1704
 
1677
1705
  // src/index.ts
1678
- var VERSION = true ? "0.0.20" : "0.0.0-dev";
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' : "";
1706
+ var VERSION = true ? "0.0.22" : "0.0.0-dev";
1707
+ 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.22 \u2014 2026-06-02\n\n### Added\n- `gs list` now shows a link to each component\'s page in the dashboard,\n so you can jump straight to a component to preview or publish it. The\n link is also included in `gs list --json`.\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
1708
  var HELP = `gs \u2014 GreatStore CLI (v${VERSION})
1681
1709
 
1682
1710
  Usage:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatstore/cli",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "CLI for authoring and shipping GreatStore custom components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",