@feeef.dev/cli 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -1,94 +1,188 @@
1
- # @feeef.dev/cli
1
+ # `@feeef.dev/cli`
2
2
 
3
- Standalone TypeScript CLI for Feeef theme authors.
3
+ Official Feeef developer CLI for **template** authors. Install once, scaffold templates, preview drafts on your live store without touching what customers see, then publish when ready.
4
4
 
5
5
  ```bash
6
6
  npm install -g @feeef.dev/cli
7
7
  feeef --help
8
8
  ```
9
9
 
10
- Config: `~/.config/feeef/config.json` (directory `0700`, file `0600`)
10
+ | | |
11
+ |---|---|
12
+ | Package | [`@feeef.dev/cli`](https://www.npmjs.com/package/@feeef.dev/cli) |
13
+ | Binary | `feeef` |
14
+ | Config | `~/.config/feeef/config.json` (dir `0700`, file `0600`) |
15
+ | SDK | depends on [`feeef`](https://www.npmjs.com/package/feeef) `^0.12.1` |
16
+
17
+ You do **not** need the private Lithium Next.js storefront repo to build or preview templates.
18
+
19
+ ---
20
+
21
+ ## Quick start
22
+
23
+ ```bash
24
+ npm install -g @feeef.dev/cli
25
+ feeef signin # browser OAuth (no client secret)
26
+ feeef template init my-template --blank
27
+ cd my-template
28
+ feeef use # pick a store you own
29
+ npm run build
30
+ npm run dev # draft preview URL opens in browser
31
+ # …edit pages/… then refresh the preview tab…
32
+ npm run publish -- --apply # go live (explicit)
33
+ ```
34
+
35
+ ---
11
36
 
12
37
  ## Auth
13
38
 
14
- Default sign-in is **browser OAuth** (PKCE, public client — no client secret):
39
+ Default sign-in is **browser OAuth** with PKCE (public client — **no** `FEEEF_OAUTH_CLIENT_SECRET`).
15
40
 
16
- - Redirect URI: `http://localhost.feeef.org:7777/oauth/callback` (**http**, not https)
17
- - Callback binds **127.0.0.1** only (`localhost.feeef.org` must resolve to loopback)
18
- - Client id is built-in
41
+ | Detail | Value |
42
+ |---|---|
43
+ | Redirect | `http://localhost.feeef.org:7777/oauth/callback` (**http**) |
44
+ | Callback bind | `127.0.0.1` only |
45
+ | DNS | `localhost.feeef.org` must resolve to `127.0.0.1` |
46
+ | Scopes | `auth`, `store`, `store.settings`, `store_templates`, `store_templates.read` (not `*`) |
19
47
 
20
48
  ```bash
21
49
  feeef signin # opens browser → consent → token saved
22
- feeef signin --password-auth # email/password fallback (interactive prompt)
50
+ feeef signin --password-auth # email/password (interactive prompt; no -p on argv)
23
51
  feeef whoami
24
52
  feeef signout
25
53
  feeef config show
26
- feeef config set apiUrl http://127.0.0.1:3333/api/v1
54
+ feeef config set apiUrl https://api.feeef.org/v1
27
55
  ```
28
56
 
29
- ## Theme workflow
57
+ Optional env (see [`.env.example`](./.env.example)):
58
+
59
+ - `FEEEF_OAUTH_CLIENT_ID` — override built-in CLI client id
60
+ - `FEEEF_OAUTH_CLIENT_SECRET` — only for confidential apps / local overrides
61
+ - `FEEEF_ACCOUNTS_URL` / `FEEEF_API_BASE_URL`
62
+
63
+ ---
64
+
65
+ ## Template workflow
30
66
 
31
- Themes are **Node.js packages** (`package.json` + scripts). Scripts wrap the global `feeef` CLI.
67
+ Templates are **Node.js packages**. Scripts wrap the global `feeef` binary. All kit commands live under `feeef template …`.
32
68
 
33
69
  ```bash
34
- feeef template init my-theme
35
- cd my-theme
36
- feeef use # pick one of your stores
70
+ feeef template init my-template # blank scaffold (bundled) or marketplace / --git
71
+ cd my-template
72
+ feeef use <slug> # writes .feeefrc
37
73
 
38
74
  feeef template add page products
39
75
  feeef template add component products grid --title "Product grid"
40
76
 
41
- npm run build # or: feeef template build
77
+ npm run build # dist/data.json (+ schema, locales)
42
78
  npm run check
43
- npm run dev # remote draft preview on your store
44
- npm run publish -- --apply # go live (explicit)
79
+ npm run dev # remote draft preview
80
+ npm run publish -- --apply # catalog upload + install on store
45
81
  ```
46
82
 
47
- ### Preview (`feeef template dev`)
83
+ ### Source layout (blank kit)
48
84
 
49
- Pushes a **draft** theme to your bound store and opens the hosted storefront with a signed `?preview=` token.
85
+ ```
86
+ schema.ts # template-owned editor schema
87
+ pages/<page>/components/ # preferred → published sections.main
88
+ shared/ | library/ # reusable custom components
89
+ locales/*.json
90
+ feeef.template.json
91
+ dist/data.json # TemplateData (build output)
92
+ dist/schema.json # merged editor schema
93
+ ```
50
94
 
51
- - Live customers keep seeing `metadata.templateData` (unchanged)
52
- - You navigate the full shop in draft mode (cookie keeps the session)
53
- - Exit: banner **Exit preview**, or visit `/?preview=0`
54
- - Stopping the CLI clears the server draft
95
+ Authoring: flat `hero.tsx` with `export const meta` + `function App()`. See scaffold docs under `scaffolds/blank/docs/`.
55
96
 
56
- ```bash
57
- feeef signin
58
- feeef use my-store
59
- feeef template dev
97
+ ---
98
+
99
+ ## Preview (`feeef template dev`)
100
+
101
+ Default preview is **remote draft** — not a local Next.js clone.
102
+
103
+ ```mermaid
104
+ flowchart LR
105
+ Watch["CLI watch + build"]
106
+ Dist["dist/data.json"]
107
+ API["PUT /stores/:id/template-preview"]
108
+ Host["Hosted shop ?preview=token"]
109
+ Live["Customers → live templateData"]
110
+ Watch --> Dist --> API --> Host
111
+ Live -.-> Host
60
112
  ```
61
113
 
62
- Going live is only via `feeef template publish --apply` (or the merchant editor).
114
+ | | Draft preview | Live shop |
115
+ |---|---|---|
116
+ | Written by | `feeef template dev` | `publish --apply` / merchant editor |
117
+ | Storage | `metadata.templatePreview` | `metadata.templateData` |
118
+ | Who sees it | You (and anyone with the preview link/cookie) | Customers |
119
+
120
+ **Session UX**
121
+
122
+ 1. CLI builds → `PUT …/template-preview` → opens `https://{slug}.…/?preview={token}`
123
+ 2. Middleware sets httpOnly cookie `feeef_preview` so you can navigate home → PLP → PDP → checkout with the **draft template**
124
+ 3. Catalog (products, prices) is still the **real store**
125
+ 4. Thin banner: **Previewing draft template — Exit**
126
+ 5. Exit: banner, or `/?preview=0` / `/?preview=exit`, or stop the CLI (clears draft), or wait for token TTL (~24h)
127
+
128
+ **Hard rule:** `dev` never overwrites live `templateData`.
63
129
 
64
130
  ### Local Next (employees only)
65
131
 
66
132
  ```bash
67
133
  feeef template dev --local
68
- # or: feeef config set storefrontPath /path/to/storefront && feeef template dev --local
134
+ # implies storefront on disk: FEEEF_STOREFRONT_PATH or config storefrontPath
69
135
  ```
70
136
 
71
- Not required for public theme authors.
137
+ Not documented for public authors; not required for npm installs.
138
+
139
+ ---
140
+
141
+ ## Publish (go live)
72
142
 
73
- ## Publish uploads
143
+ ```bash
144
+ feeef template publish --apply
145
+ # or: npm run publish -- --apply
146
+ ```
74
147
 
75
148
  | Target | Source |
76
- |--------|--------|
77
- | `store_templates` | `dist/data.json` (i18n stripped) + schema |
149
+ |---|---|
150
+ | `store_templates` | `dist/data.json` (i18n stripped) + `dist/schema.json` |
78
151
  | `template_components` | `shared/` + `library/` |
79
152
  | `store_template_locales` | `dist/locales/*.json` |
153
+ | Install (`--apply`) | Links `store.templateId` + clones data → live `metadata.templateData` |
154
+
155
+ Without `--apply`, the marketplace row updates but the storefront customers see does not change until install/editor save.
156
+
157
+ ---
158
+
159
+ ## Commands cheat sheet
160
+
161
+ | Command | Purpose |
162
+ |---|---|
163
+ | `feeef signin` | OAuth (or `--password-auth`) |
164
+ | `feeef use [store]` | Bind template ↔ store (`.feeefrc`) |
165
+ | `feeef template init` | Scaffold blank / git / marketplace |
166
+ | `feeef template add\|remove page\|component` | Scaffold edits |
167
+ | `feeef template build\|check\|watch` | Compile / validate |
168
+ | `feeef template dev` | Remote draft preview |
169
+ | `feeef template publish [--apply]` | Upload (+ optional install) |
170
+ | `feeef config show\|set` | Global config |
171
+
172
+ ---
80
173
 
81
174
  ## License
82
175
 
83
176
  UNLICENSED — proprietary Feeef software. See [LICENSE](./LICENSE).
84
177
 
85
- ## Develop (monorepo)
178
+ ## Monorepo develop
86
179
 
87
180
  ```bash
88
181
  cd cli
89
182
  npm install
90
- npm run typecheck
91
183
  npm test
92
184
  npm run build
93
185
  npm run link:global
94
186
  ```
187
+
188
+ Release notes for maintainers: [RELEASE.md](./RELEASE.md).