@greatstore/cli 0.0.23 → 0.0.24
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 +43 -27
- 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.24 — 2026-06-03
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- `gs init` in an existing project now fills in any scaffold files that
|
|
10
|
+
are missing (for example, the `AGENTS.md` design guide added in
|
|
11
|
+
0.0.23) and leaves your own files alone. Pass `--force` to refresh
|
|
12
|
+
every scaffold file to the latest version. Your pinned store
|
|
13
|
+
(`.gsrc`) is never rewritten either way.
|
|
14
|
+
|
|
6
15
|
## 0.0.23 — 2026-06-03
|
|
7
16
|
|
|
8
17
|
### Added
|
package/dist/cli.js
CHANGED
|
@@ -1166,20 +1166,28 @@ function initCommand(args) {
|
|
|
1166
1166
|
`--store <slug> is required when scaffolding a new project root. Run \`${example}\`.`
|
|
1167
1167
|
);
|
|
1168
1168
|
}
|
|
1169
|
-
ensureRoot(root, rootExisted, force, { store: storeFlag });
|
|
1169
|
+
const writtenRootFiles = ensureRoot(root, rootExisted, force, { store: storeFlag });
|
|
1170
1170
|
if (!name) {
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
"",
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1171
|
+
const lines = [];
|
|
1172
|
+
if (rootExisted) {
|
|
1173
|
+
lines.push(`Updated GreatStore project root in ${root}.`);
|
|
1174
|
+
if (writtenRootFiles.length > 0) {
|
|
1175
|
+
lines.push("", `Added: ${writtenRootFiles.join(", ")}`);
|
|
1176
|
+
} else {
|
|
1177
|
+
lines.push("", "Already up to date \u2014 nothing to add.");
|
|
1178
|
+
}
|
|
1179
|
+
} else {
|
|
1180
|
+
lines.push(`Scaffolded GreatStore project root in ${root}.`);
|
|
1181
|
+
}
|
|
1182
|
+
lines.push(
|
|
1183
|
+
"",
|
|
1184
|
+
"Next steps:",
|
|
1185
|
+
` cd ${path6.relative(process.cwd(), root) || "."}`,
|
|
1186
|
+
" npm install",
|
|
1187
|
+
" gs init <component_name> # add your first component",
|
|
1188
|
+
""
|
|
1182
1189
|
);
|
|
1190
|
+
process.stdout.write(lines.join("\n"));
|
|
1183
1191
|
return;
|
|
1184
1192
|
}
|
|
1185
1193
|
const componentDir = path6.join(root, "components", name);
|
|
@@ -1188,6 +1196,7 @@ function initCommand(args) {
|
|
|
1188
1196
|
process.stdout.write(
|
|
1189
1197
|
[
|
|
1190
1198
|
`Added component "${name}" at components/${name}/.`,
|
|
1199
|
+
...rootExisted && writtenRootFiles.length > 0 ? ["", `Also added to the project root: ${writtenRootFiles.join(", ")}`] : [],
|
|
1191
1200
|
"",
|
|
1192
1201
|
"Next steps:",
|
|
1193
1202
|
...rootExisted ? [] : [` cd ${projectLabel}`, " npm install"],
|
|
@@ -1203,11 +1212,7 @@ function hasRootScaffold(dir) {
|
|
|
1203
1212
|
}
|
|
1204
1213
|
function ensureRoot(root, rootExisted, force, opts) {
|
|
1205
1214
|
fs6.mkdirSync(root, { recursive: true });
|
|
1206
|
-
if (rootExisted) {
|
|
1207
|
-
fs6.mkdirSync(path6.join(root, "components"), { recursive: true });
|
|
1208
|
-
return;
|
|
1209
|
-
}
|
|
1210
|
-
if (!force) {
|
|
1215
|
+
if (!rootExisted && !force) {
|
|
1211
1216
|
const entries = fs6.readdirSync(root).filter((e) => e !== ".gsrc");
|
|
1212
1217
|
if (entries.length > 0) {
|
|
1213
1218
|
throw new Error(
|
|
@@ -1215,19 +1220,30 @@ function ensureRoot(root, rootExisted, force, opts) {
|
|
|
1215
1220
|
);
|
|
1216
1221
|
}
|
|
1217
1222
|
}
|
|
1218
|
-
|
|
1223
|
+
const files = rootExisted ? existingRootFiles() : rootFiles({ store: opts.store });
|
|
1224
|
+
const written = writeRootFiles(root, files, force);
|
|
1225
|
+
fs6.mkdirSync(path6.join(root, "components"), { recursive: true });
|
|
1226
|
+
return written;
|
|
1227
|
+
}
|
|
1228
|
+
function writeRootFiles(root, files, force) {
|
|
1229
|
+
const written = [];
|
|
1230
|
+
for (const [relPath, content] of files) {
|
|
1219
1231
|
const full = path6.join(root, relPath);
|
|
1220
1232
|
fs6.mkdirSync(path6.dirname(full), { recursive: true });
|
|
1221
1233
|
if (force || !fs6.existsSync(full)) {
|
|
1222
1234
|
fs6.writeFileSync(full, content);
|
|
1235
|
+
written.push(relPath);
|
|
1223
1236
|
}
|
|
1224
1237
|
}
|
|
1225
1238
|
for (const link of ["CLAUDE.md", "GEMINI.md"]) {
|
|
1226
1239
|
const linkPath = path6.join(root, link);
|
|
1227
1240
|
if (force && pathExists(linkPath)) fs6.rmSync(linkPath);
|
|
1228
|
-
if (!pathExists(linkPath))
|
|
1241
|
+
if (!pathExists(linkPath)) {
|
|
1242
|
+
fs6.symlinkSync("AGENTS.md", linkPath);
|
|
1243
|
+
written.push(link);
|
|
1244
|
+
}
|
|
1229
1245
|
}
|
|
1230
|
-
|
|
1246
|
+
return written;
|
|
1231
1247
|
}
|
|
1232
1248
|
function pathExists(p) {
|
|
1233
1249
|
try {
|
|
@@ -1251,12 +1267,9 @@ function ensureComponent(componentDir, name, force) {
|
|
|
1251
1267
|
fs6.writeFileSync(path6.join(componentDir, relPath), content);
|
|
1252
1268
|
}
|
|
1253
1269
|
}
|
|
1254
|
-
function templateFiles(prefix, vars) {
|
|
1270
|
+
function templateFiles(prefix, vars, exclude = /* @__PURE__ */ new Set()) {
|
|
1255
1271
|
const tree = loadTemplate();
|
|
1256
|
-
return Object.entries(tree).filter(([rel]) => rel.startsWith(prefix)).map(([rel, content]) => [
|
|
1257
|
-
rel.slice(prefix.length),
|
|
1258
|
-
applyTemplate(content, vars)
|
|
1259
|
-
]);
|
|
1272
|
+
return Object.entries(tree).filter(([rel]) => rel.startsWith(prefix)).map(([rel, content]) => [rel.slice(prefix.length), content]).filter(([dest]) => !exclude.has(dest)).map(([dest, content]) => [dest, applyTemplate(content, vars)]);
|
|
1260
1273
|
}
|
|
1261
1274
|
function rootFiles(opts) {
|
|
1262
1275
|
if (!opts.store) {
|
|
@@ -1264,6 +1277,9 @@ function rootFiles(opts) {
|
|
|
1264
1277
|
}
|
|
1265
1278
|
return templateFiles("root/", { store: opts.store });
|
|
1266
1279
|
}
|
|
1280
|
+
function existingRootFiles() {
|
|
1281
|
+
return templateFiles("root/", {}, /* @__PURE__ */ new Set([".gsrc"]));
|
|
1282
|
+
}
|
|
1267
1283
|
function componentFiles(name) {
|
|
1268
1284
|
return templateFiles("component/", {
|
|
1269
1285
|
name,
|
|
@@ -1578,8 +1594,8 @@ function parseVer(v) {
|
|
|
1578
1594
|
}
|
|
1579
1595
|
|
|
1580
1596
|
// src/index.ts
|
|
1581
|
-
var VERSION = true ? "0.0.
|
|
1582
|
-
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.23 \u2014 2026-06-03\n\n### Added\n- `gs init` now scaffolds an `AGENTS.md` (with `CLAUDE.md` and\n `GEMINI.md` symlinked to it) documenting the design rules every\n component should follow \u2014 use `em` rather than `rem` for sizing, and\n style from the provided brand CSS variables so components match the\n store's theme. It doubles as guidance for AI coding agents.\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" : "";
|
|
1597
|
+
var VERSION = true ? "0.0.24" : "0.0.0-dev";
|
|
1598
|
+
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.24 \u2014 2026-06-03\n\n### Changed\n- `gs init` in an existing project now fills in any scaffold files that\n are missing (for example, the `AGENTS.md` design guide added in\n 0.0.23) and leaves your own files alone. Pass `--force` to refresh\n every scaffold file to the latest version. Your pinned store\n (`.gsrc`) is never rewritten either way.\n\n## 0.0.23 \u2014 2026-06-03\n\n### Added\n- `gs init` now scaffolds an `AGENTS.md` (with `CLAUDE.md` and\n `GEMINI.md` symlinked to it) documenting the design rules every\n component should follow \u2014 use `em` rather than `rem` for sizing, and\n style from the provided brand CSS variables so components match the\n store's theme. It doubles as guidance for AI coding agents.\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" : "";
|
|
1583
1599
|
var HELP = `gs \u2014 GreatStore CLI (v${VERSION})
|
|
1584
1600
|
|
|
1585
1601
|
Usage:
|