@greatstore/cli 0.0.1 → 0.0.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.
Files changed (3) hide show
  1. package/README.md +9 -64
  2. package/dist/cli.js +2 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -11,85 +11,30 @@ gs push
11
11
  gs publish my-widget
12
12
  ```
13
13
 
14
- > **Status — MVP.** Authentication today targets a nav-side OAuth bounce
15
- > at `nav.maker.co/connect_oauth_done` and a short-lived JWT stored at
16
- > `~/.greatstore/credentials.json`. Bearer acceptance on the worker is a
17
- > separate planned change (see
18
- > `tasks/backburner/builder-cli-bearer-auth.md` in the main repo); until
19
- > that lands, push/publish/list etc. will 401 against the live API.
20
-
21
14
  ## Commands
22
15
 
23
16
  | Command | What it does |
24
17
  | --------------------------------------------- | ------------------------------------------------------------- |
25
- | `gs login [--store <slug>]` | Open the browser, capture a nav token, persist credentials. |
26
- | `gs logout` | Wipe `~/.greatstore/credentials.json`. |
27
- | `gs whoami` | Print the identity stored in your credentials file. |
18
+ | `gs login` | Sign in. |
19
+ | `gs logout` | Sign out. |
20
+ | `gs whoami` | Print the identity you're signed in as. |
28
21
  | `gs init <name> [--out <dir>] [--store <s>]` | Scaffold a working component project. |
29
- | `gs list [--json]` | List the components in the current store. |
22
+ | `gs list [--json]` | List components in the current store. |
30
23
  | `gs pull <name> [--draft\|--live\|--version N] [-o <dir>]` | Download manifest + bundle to disk. |
31
24
  | `gs push [<name>] [--manifest path] [--bundle path]` | Upload a new draft revision. |
32
- | `gs publish <name> [--version N]` | Promote a draft (or rollback to a historical version) to live.|
33
- | `gs unpublish <name>` | Clear the live pointer; the draft and history stay. |
34
- | `gs delete <name> [--yes]` | Soft-delete the component (R2 objects are retained). |
25
+ | `gs publish <name> [--version N]` | Promote a draft (or roll back to a historical version) to live.|
26
+ | `gs unpublish <name>` | Clear the live pointer; draft + history stay. |
27
+ | `gs delete <name> [--yes]` | Remove the component. |
35
28
 
36
29
  ## Store selection
37
30
 
38
31
  Every command except `login`, `logout`, and `whoami` needs a store. The
39
- CLI resolves it with this precedence:
32
+ CLI picks one in this order:
40
33
 
41
34
  1. `--store <slug>` flag.
42
35
  2. `.gsrc` in the current directory or any ancestor: `{"store":"demo"}`.
43
36
  3. `GS_STORE` environment variable.
44
37
  4. Error.
45
38
 
46
- `gs init` writes a `.gsrc` for you so commands inside a scaffolded
39
+ `gs init` writes a `.gsrc` for you, so commands inside a scaffolded
47
40
  project don't need a flag.
48
-
49
- ## Environment
50
-
51
- - `GS_API_BASE` — override the API base URL (default
52
- `https://<slug>.greatstore.ai`). Used for local dev:
53
- `GS_API_BASE=http://demo.localhost:8787`.
54
- - `GS_NAV_BASE` — override the nav OAuth base (default
55
- `https://nav.maker.co`). Used for testing against a non-prod Clerk
56
- tenant.
57
- - `GS_BROWSER_CMD` — override the command used to open the browser
58
- during `gs login`. Defaults to `open` on macOS, `xdg-open` on Linux,
59
- `start` on Windows.
60
-
61
- ## Credentials storage
62
-
63
- `~/.greatstore/credentials.json` is created with mode `0700` on its
64
- directory and `0600` on the file. The CLI verifies this on every read
65
- and refuses to use a file with broader permissions.
66
-
67
- The credentials file holds a single short-lived JWT plus its decoded
68
- identity claims. There is no refresh token; when the JWT expires, the
69
- next command prompts for re-auth and re-runs the browser flow.
70
-
71
- ## Development
72
-
73
- ```
74
- cd cli
75
- npm install
76
- npm run typecheck
77
- npm test
78
- npm run build
79
- node dist/cli.js --help
80
- ```
81
-
82
- To exercise against local `wrangler dev`, point at the tenant host:
83
-
84
- ```
85
- GS_API_BASE=http://demo.localhost:8787 \
86
- GS_NAV_BASE=https://nav.maker.co \
87
- node dist/cli.js list --store demo
88
- ```
89
-
90
- ## Release flow
91
-
92
- 1. Bump `cli/package.json` version.
93
- 2. Tag: `git tag cli-v0.0.2 && git push origin cli-v0.0.2`.
94
- 3. `cli-publish` GitHub Actions workflow runs typecheck + test + build,
95
- then `npm publish --access public` with `NPM_TOKEN`.
package/dist/cli.js CHANGED
@@ -122,7 +122,7 @@ function waitForCallback(server, expectedState, timeoutMs) {
122
122
  }
123
123
  const params = url.searchParams;
124
124
  const error = params.get("error");
125
- const token = params.get("token");
125
+ const token = params.get("code");
126
126
  const returnedState = params.get("state");
127
127
  if (returnedState !== expectedState) {
128
128
  res.writeHead(400, { "content-type": "text/html" });
@@ -142,7 +142,7 @@ function waitForCallback(server, expectedState, timeoutMs) {
142
142
  res.writeHead(400, { "content-type": "text/html" });
143
143
  res.end(FAILURE_HTML);
144
144
  clearTimeout(timer);
145
- settle(() => reject(new LoopbackError("Callback missing `token` query parameter.")));
145
+ settle(() => reject(new LoopbackError("Callback missing `code` query parameter.")));
146
146
  return;
147
147
  }
148
148
  res.writeHead(200, { "content-type": "text/html" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatstore/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "CLI for authoring and shipping GreatStore custom components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",