primo-cli 0.1.2 → 0.1.4

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 (39) hide show
  1. package/README.md +113 -41
  2. package/dist/commands/build.js +488 -272
  3. package/dist/commands/deploy.d.ts +1 -1
  4. package/dist/commands/deploy.js +293 -141
  5. package/dist/commands/dev.d.ts +2 -0
  6. package/dist/commands/dev.js +2007 -150
  7. package/dist/commands/init.d.ts +2 -2
  8. package/dist/commands/init.js +65 -43
  9. package/dist/commands/login.d.ts +1 -2
  10. package/dist/commands/login.js +24 -6
  11. package/dist/commands/new.js +161 -274
  12. package/dist/commands/pull-library.d.ts +7 -0
  13. package/dist/commands/pull-library.js +92 -0
  14. package/dist/commands/pull.d.ts +0 -1
  15. package/dist/commands/pull.js +160 -165
  16. package/dist/commands/push-library.d.ts +7 -0
  17. package/dist/commands/push-library.js +88 -0
  18. package/dist/commands/push.d.ts +2 -0
  19. package/dist/commands/push.js +358 -51
  20. package/dist/commands/validate.d.ts +1 -1
  21. package/dist/commands/validate.js +379 -161
  22. package/dist/index.js +110 -20
  23. package/dist/utils/binary.js +1 -1
  24. package/dist/utils/format.d.ts +12 -0
  25. package/dist/utils/format.js +98 -0
  26. package/dist/utils/head-svelte.d.ts +2 -0
  27. package/dist/utils/head-svelte.js +53 -0
  28. package/dist/utils/server-config.d.ts +19 -0
  29. package/dist/utils/server-config.js +49 -0
  30. package/dist/utils/site-config.d.ts +11 -0
  31. package/dist/utils/site-config.js +14 -0
  32. package/package.json +9 -5
  33. package/scripts/postinstall.js +1 -1
  34. package/dist/commands/export.d.ts +0 -8
  35. package/dist/commands/export.js +0 -163
  36. package/dist/commands/import.d.ts +0 -9
  37. package/dist/commands/import.js +0 -118
  38. package/dist/commands/publish.d.ts +0 -6
  39. package/dist/commands/publish.js +0 -239
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Primo CLI
2
2
 
3
- Local development CLI for [Primo](https://primocms.org) - build and edit sites with a visual CMS.
3
+ Local development CLI for [Primo](https://primo.page) - build and edit sites with a visual CMS.
4
4
 
5
5
  ## Installation
6
6
 
@@ -15,19 +15,30 @@ npm install -g primo-cli
15
15
  primo new my-site
16
16
 
17
17
  # This starts the local CMS automatically
18
- # Edit at: http://my-site.localhost:3000/admin/site
19
- # Preview at: http://my-site.localhost:3000/
18
+ # It scaffolds a workspace like:
19
+ # ./server.yaml
20
+ # ./library/
21
+ # ./sites/my-site/
20
22
  ```
21
23
 
22
24
  ## Commands
23
25
 
26
+ ### `primo init [name]`
27
+
28
+ Initialize a new Primo workspace (server) in a new folder or the current directory.
29
+
30
+ ```bash
31
+ primo init # Initialize in the current directory
32
+ primo init my-workspace # Create and initialize "my-workspace"
33
+ ```
34
+
24
35
  ### `primo new [name]`
25
36
 
26
37
  Create a new site with starter files.
27
38
 
28
39
  ```bash
29
40
  primo new # Interactive prompt for name
30
- primo new my-site # Create "my-site" directory
41
+ primo new my-site # Create "sites/my-site" in the current workspace
31
42
  primo new --skip-dev # Create files without starting CMS
32
43
  ```
33
44
 
@@ -38,37 +49,73 @@ Start the local CMS server. Watches for file changes and syncs edits from the CM
38
49
  ```bash
39
50
  primo dev # Start in current directory
40
51
  primo dev -p 8080 # Use custom port
52
+ primo dev --author files # Push file edits to the CMS; CMS UI is read-only (default)
53
+ primo dev --author cms # CMS edits write to files; file edits revert
54
+ primo dev --author both # Bidirectional sync (beta; CMS edits often lost on conflict)
41
55
  ```
42
56
 
43
57
  ### `primo push`
44
58
 
45
- Push local files to a hosted Primo instance.
59
+ Sync local changes to an existing hosted Primo server. Requires a server you've
60
+ already deployed (run `primo deploy` first) and authenticated against (`primo
61
+ login -s <server-url>`).
46
62
 
47
63
  ```bash
48
- primo push -s https://cms.example.com --site abc123
64
+ primo push https://cms.example.com --site abc123
65
+ primo push --only my-site # Push just one site folder (workspace root)
49
66
  primo push --preview # Preview changes without applying
67
+ primo push --dry-run # Show what would be sent without making requests
50
68
  ```
51
69
 
52
70
  Options:
53
71
  - `-s, --server <url>` - Server URL
54
72
  - `--site <id>` - Site ID
73
+ - `--only <slug>` - Push only the named site folder under `sites/` (skips library)
55
74
  - `-d, --dir <dir>` - Directory (default: `.`)
56
75
  - `-t, --token <token>` - Auth token
57
76
  - `--preview` - Preview only
77
+ - `--dry-run` - Show what would be pushed without sending requests
58
78
 
59
79
  ### `primo pull`
60
80
 
61
- Pull from a hosted Primo instance to local files.
81
+ Pull an entire hosted Primo server — all sites plus the shared library — to local files.
82
+
83
+ ```bash
84
+ primo pull https://cms.example.com
85
+ primo pull https://cms.example.com -o ./my-workspace
86
+ ```
87
+
88
+ Options:
89
+ - `-s, --server <url>` - Server URL (auto-detects local)
90
+ - `-o, --output <dir>` - Output directory (defaults to `./<server-hostname>`)
91
+ - `-t, --token <token>` - Auth token
92
+
93
+ ### `primo library pull`
94
+
95
+ Pull the shared block library into a workspace root.
62
96
 
63
97
  ```bash
64
- primo pull -s https://cms.example.com
65
- primo pull --site abc123 -o ./my-site
98
+ primo library pull https://cms.example.com
99
+ primo library pull -o ./my-workspace
66
100
  ```
67
101
 
68
102
  Options:
69
103
  - `-s, --server <url>` - Server URL (auto-detects local)
70
- - `--site <id>` - Site ID (interactive if not provided)
71
- - `-o, --output <dir>` - Output directory (default: `.`)
104
+ - `-o, --output <dir>` - Workspace output directory (default: `.`)
105
+ - `-t, --token <token>` - Auth token
106
+
107
+ ### `primo library push`
108
+
109
+ Push the local shared block library back to a hosted Primo instance.
110
+
111
+ ```bash
112
+ primo library push https://cms.example.com
113
+ primo library push https://cms.example.com -d ./my-workspace
114
+ ```
115
+
116
+ Options:
117
+ - `-s, --server <url>` - Server URL
118
+ - `-d, --dir <dir>` - Workspace directory containing `library/` (default: `.`)
72
119
  - `-t, --token <token>` - Auth token
73
120
 
74
121
  ### `primo login`
@@ -80,16 +127,30 @@ primo login https://cms.example.com
80
127
  primo login https://cms.example.com -e user@example.com
81
128
  ```
82
129
 
83
- ### `primo publish`
130
+ ### `primo deploy`
84
131
 
85
- Deploy your site with CMS to Railway or Fly.io.
132
+ Deploy the entire workspace all sites under `sites/`, plus `library/` and
133
+ `server.yaml` — as one editable-CMS unit, to Railway or Fly.io. Must be run
134
+ from the workspace root (the directory containing `server.yaml`).
86
135
 
87
136
  ```bash
88
- primo publish # Interactive provider selection
89
- primo publish -p railway # Deploy to Railway
90
- primo publish -p fly # Deploy to Fly.io
137
+ primo deploy # Interactive provider selection
138
+ primo deploy -p railway # Deploy to Railway
139
+ primo deploy -p fly # Deploy to Fly.io
140
+ primo deploy --dry-run # Show what would be deployed without doing anything
91
141
  ```
92
142
 
143
+ For other hosts (Netlify, Vercel, Cloudflare, GitHub Pages), use `primo build`
144
+ on a single site and deploy the output folder with that host's CLI.
145
+
146
+ #### Picking the right "going-live" command
147
+
148
+ | You want to… | Use |
149
+ | --------------------------------------------- | -------------- |
150
+ | Let collaborators edit content from a CMS UI | `primo deploy` |
151
+ | Ship a static site to any static host | `primo build` |
152
+ | Sync local edits to an existing hosted server | `primo push` |
153
+
93
154
  ### `primo validate`
94
155
 
95
156
  Check site structure for errors.
@@ -125,45 +186,56 @@ npx wrangler pages deploy dist
125
186
  ## Site Structure
126
187
 
127
188
  ```
128
- my-site/
129
- ├── primo.json # Site config (name, site_id, host)
130
- ├── blocks/ # Svelte components
131
- └── hero/
132
- │ ├── component.svelte
133
- ├── fields.json
134
- │ └── content.yaml
135
- ├── pages/ # Page content (YAML)
136
- │ └── index.yaml
137
- ├── page-types/ # Page templates
138
- │ └── default/
139
- │ └── config.json
140
- ├── site/ # Site-wide settings
141
- │ ├── fields.json
142
- │ ├── content.yaml
143
- │ └── head.svelte
144
- └── uploads/ # Media files
189
+ workspace/
190
+ ├── server.yaml
191
+ ├── library/
192
+ └── sites/
193
+ └── my-site/
194
+ ├── site.yaml
195
+ ├── blocks/
196
+ ├── pages/
197
+ ├── page-types/
198
+ └── site/
145
199
  ```
146
200
 
147
201
  ## Multiple Sites
148
202
 
149
- Run `primo dev` from a parent folder to work on multiple sites at once:
203
+ Run `primo dev` from a workspace folder to work on multiple sites at once:
150
204
 
151
205
  ```
152
206
  workspace/
153
- ├── server.json # Optional: { "port": 3000 }
154
- ├── site-one/
155
- │ └── primo.json
156
- └── site-two/
157
- └── primo.json
207
+ ├── server.yaml # Optional: port + site_groups
208
+ └── sites/
209
+ ├── site-one/
210
+ └── site.yaml # includes group: default
211
+ └── site-two/
212
+ └── site.yaml # includes group: default
158
213
  ```
159
214
 
160
215
  Each site gets its own subdomain: `site-one.localhost:3000`, `site-two.localhost:3000`
161
216
 
217
+ ## Shared Library Workspace
218
+
219
+ The shared block library can live at the workspace root alongside the `sites/` folder:
220
+
221
+ ```text
222
+ workspace/
223
+ ├── server.yaml
224
+ ├── library/
225
+ │ ├── marketing/
226
+ │ │ └── hero/
227
+ │ └── shared/
228
+ │ └── footer/
229
+ └── sites/
230
+ ├── site-one/
231
+ └── site-two/
232
+ ```
233
+
162
234
  ## Documentation
163
235
 
164
- Full documentation: [docs.primocms.org](https://docs.primocms.org)
236
+ Full documentation: [primo.page/docs](https://primo.page/docs)
165
237
 
166
238
  ## Requirements
167
239
 
168
240
  - Node.js 18+
169
- - For `primo publish`: Railway CLI or Fly.io CLI
241
+ - For `primo deploy`: Railway CLI or Fly.io CLI