sitemills-cli 1.0.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.
- package/README.md +539 -0
- package/dist/sitemills.js +3 -0
- package/dist/updater.js +1 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
# SiteMills CLI
|
|
2
|
+
|
|
3
|
+
SiteMills CLI Tool for project code management, continuous integration, database seeding, background jobs, sandboxed data operations, and deployment on the SiteMills platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Pick whichever fits your setup. All of them install the same `sitemills-cli` command.
|
|
8
|
+
|
|
9
|
+
### macOS / Linux: install script (recommended)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
curl -fsSL https://raw.githubusercontent.com/SiteMills/sitemills-cli/main/install.sh | sh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Installs to `/usr/local/bin` if it's writable without `sudo`, otherwise `~/.local/bin`. The download is verified against the release's `SHA256SUMS`. The binary keeps itself up to date.
|
|
16
|
+
|
|
17
|
+
### Windows: install script (recommended)
|
|
18
|
+
|
|
19
|
+
In PowerShell:
|
|
20
|
+
|
|
21
|
+
```powershell
|
|
22
|
+
irm https://raw.githubusercontent.com/SiteMills/sitemills-cli/main/install.ps1 | iex
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Installs to `%LOCALAPPDATA%\Programs\sitemills-cli` and adds it to your user `PATH`. No admin rights needed. The binary keeps itself up to date.
|
|
26
|
+
|
|
27
|
+
### Homebrew (macOS / Linux)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
brew install sitemills/tap/sitemills-cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Upgrade with `brew upgrade sitemills-cli`.
|
|
34
|
+
|
|
35
|
+
### Scoop (Windows)
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
scoop bucket add sitemills https://github.com/SiteMills/scoop-bucket
|
|
39
|
+
scoop install sitemills-cli
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Upgrade with `scoop update sitemills-cli`.
|
|
43
|
+
|
|
44
|
+
### npm (any OS with Node.js 18+)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g sitemills-cli
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Upgrade with `npm install -g sitemills-cli@latest`.
|
|
51
|
+
|
|
52
|
+
### Manual download
|
|
53
|
+
|
|
54
|
+
Download the binary for your platform from [Releases](https://github.com/SiteMills/sitemills-cli/releases/latest), rename it to `sitemills-cli` (`sitemills-cli.exe` on Windows), and put it on your `PATH`:
|
|
55
|
+
|
|
56
|
+
- **Linux (x64)**: `sitemills-linux`
|
|
57
|
+
- **macOS (Apple Silicon)**: `sitemills-macos-arm64`
|
|
58
|
+
- **macOS (Intel)**: `sitemills-macos`
|
|
59
|
+
- **Windows (x64)**: `sitemills-win.exe`
|
|
60
|
+
|
|
61
|
+
Verify it against `SHA256SUMS` from the same release.
|
|
62
|
+
|
|
63
|
+
> **Note:** This repository holds the CLI's documentation and installers, not an installable package. Cloning it does not install the CLI; use one of the options above.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Authentication & Session Management
|
|
68
|
+
|
|
69
|
+
SiteMills CLI uses OAuth 2.0 with local loopback callback verification for secure authentication.
|
|
70
|
+
|
|
71
|
+
### How to Log In
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
sitemills-cli login
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
1. **Automatic Browser Launch**: The CLI starts a local loopback server and attempts to open your default browser directly to the SiteMills authorization page.
|
|
78
|
+
2. **Headless / Remote / SSH Environments**:
|
|
79
|
+
- If running inside a container, remote server, SSH session, or IDE terminal without a graphical desktop, the CLI will output a clickable login URL:
|
|
80
|
+
```text
|
|
81
|
+
Opening browser to log in:
|
|
82
|
+
https://sitemills.com/oauth/login?returnUrl=http://localhost:54377/callback
|
|
83
|
+
```
|
|
84
|
+
- Copy and paste the link into any browser where you are logged into SiteMills.
|
|
85
|
+
- The CLI callback server automatically captures the authentication token and saves it securely to `~/.sitemills/token` with `0600` permissions.
|
|
86
|
+
3. **Dynamic Port Discovery**:
|
|
87
|
+
- The CLI starts by attempting port `54321` (or the custom port set via the `PORT` environment variable, e.g. `PORT=54377 sitemills-cli login`).
|
|
88
|
+
- If port `54321` is in use by another service (like PostgreSQL or Docker), the CLI automatically scans and binds to the next available free port without failing.
|
|
89
|
+
4. **Token Expiration (HTTP 401)**:
|
|
90
|
+
- If any CLI command fails with `ERROR: Authentication failed. Please log in again using "sitemills-cli login".`, your session token has expired. Simply rerun `sitemills-cli login` to obtain a fresh token.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Developer Guides & Architecture Specifications
|
|
95
|
+
|
|
96
|
+
SiteMills apps are built on declarative contracts, automatic RPC discovery, sandboxed V8 execution, and structured data operations. Review the comprehensive developer guides below:
|
|
97
|
+
|
|
98
|
+
| Guide | Description & Scope | Interactive CLI Topic |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| **[Contracts & Configuration Guide](docs/CONTRACTS_GUIDE.md)** | Specifications for `contracts/jobs.json` (5-field cron, retries, `JobContext` APIs) vs `server/jobs.ts` (`export const jobs = { ... }`), and `contracts/db.json` (declarative MongoDB collection indexes, unique constraints, compound indexes, TTL expiration). | `sitemills-cli help contracts`<br>`sitemills-cli help jobs`<br>`sitemills-cli help db` |
|
|
101
|
+
| **[Server Runtime & RPC Conventions](docs/SERVER_RUNTIME_RPC.md)** | Automatic RPC discovery in `server/handlers/` without central hub re-exports, handler route aliasing, auto-generated stubs (`public/stubs/api-client.ts`), and strict cloud TypeScript compilation constraints (e.g. TS7006 implicit `any` parameter typing). | `sitemills-cli help rpc`<br>`sitemills-cli help typescript` |
|
|
102
|
+
| **[Data Operations & Lua Runtime](docs/DATA_OPERATIONS_AND_LUA.md)** | Complete JSON schemas for `sitemills-cli data-op` (`query`, `count`, `seed`, `mutation_preview`, `mutation_apply`, `execute_lua`), sandboxed Lua runtime (`input.docs`, `input.metadata`, allowed/blocked globals, return table structure), and flag restrictions (`--mock-user` strictly rejected in PROD, `--max-write-ops` bounds). | `sitemills-cli help data-op`<br>`sitemills-cli help run-lua`<br>`sitemills-cli help flags` |
|
|
103
|
+
| **[Error Diagnostics & Troubleshooting](docs/ERROR_DIAGNOSTICS_AND_TROUBLESHOOTING.md)** | Intelligent CLI error hint engine, debugging MongoDB queries (e.g. `$regex has to be a string`, unknown operators), TypeScript compilation errors, RPC routing mismatches, and mutation count drift. | `sitemills-cli help errors` |
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Quickstart: Creating & Deploying a Project
|
|
108
|
+
|
|
109
|
+
### 1. Import a Local Directory to a New SiteMills Project
|
|
110
|
+
```bash
|
|
111
|
+
sitemills-cli import <projectName> <inputDir>
|
|
112
|
+
```
|
|
113
|
+
*Example:*
|
|
114
|
+
```bash
|
|
115
|
+
sitemills-cli import GradePrep scratch/grade1-superstars
|
|
116
|
+
```
|
|
117
|
+
*Output:*
|
|
118
|
+
```text
|
|
119
|
+
SUCCESS: Project imported successfully!
|
|
120
|
+
Project ID: gradeprep
|
|
121
|
+
Branch ID: e4d7df82-24b2-4e3b-97ce-5aa4ba5a79ec
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 2. View Branches & Status
|
|
125
|
+
```bash
|
|
126
|
+
sitemills-cli list-branches <projectId>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 3. Compile Project Code
|
|
130
|
+
Check local changes without saving or deploying anything:
|
|
131
|
+
```bash
|
|
132
|
+
sitemills-cli check <projectId> <branchId> <inputDir>
|
|
133
|
+
```
|
|
134
|
+
Recompile what is already on the branch:
|
|
135
|
+
```bash
|
|
136
|
+
sitemills-cli compile <projectId> --branch <branchId>
|
|
137
|
+
```
|
|
138
|
+
*Compiles frontend JSX/TSX components (esbuild + Tailwind CSS) and backend TypeScript handlers into the SiteMills V8 isolate runtime.*
|
|
139
|
+
|
|
140
|
+
### 4. Deploy Branch to an Environment
|
|
141
|
+
```bash
|
|
142
|
+
sitemills-cli deploy <projectId> <branchId> <DEV|STAGING|PROD>
|
|
143
|
+
```
|
|
144
|
+
*Example:*
|
|
145
|
+
```bash
|
|
146
|
+
sitemills-cli deploy gradeprep e4d7df82-24b2-4e3b-97ce-5aa4ba5a79ec DEV
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Project URLs & Deployment Hostnames
|
|
152
|
+
|
|
153
|
+
SiteMills clearly distinguishes between the **Platform Management Dashboard** and the **Live Deployed Client Applications**:
|
|
154
|
+
|
|
155
|
+
| Purpose | URL / Hostname Pattern | Example |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| **Production Live Application (`PROD`)** | `https://<projectId>.sitemills.com` | `https://gradeprep.sitemills.com` |
|
|
158
|
+
| **Staging Live Application (`STAGING`)** | `https://<projectId>-staging.sitemills.com` | `https://gradeprep-staging.sitemills.com` |
|
|
159
|
+
| **Development Live Application (`DEV`)** | `https://<projectId>-dev.dev.sitemills.com` | `https://gradeprep-dev.dev.sitemills.com` |
|
|
160
|
+
| **Branch Preview URL** | `https://<projectId>--<branchId>.sitemills.com/?preview_token=...` | `https://gradeprep--e4d7df82-24b2-4e3b-97ce-5aa4ba5a79ec.sitemills.com` |
|
|
161
|
+
| **Platform Project Console / IDE** | `https://sitemills.com/project/<projectId>` | `https://sitemills.com/project/gradeprep` |
|
|
162
|
+
| **Project Planning Board** | `https://sitemills.com/project/<projectId>/planning` | `https://sitemills.com/project/gradeprep/planning` |
|
|
163
|
+
| **Project Settings / Variables** | `https://sitemills.com/project/<projectId>/settings` | `https://sitemills.com/project/gradeprep/settings` |
|
|
164
|
+
|
|
165
|
+
> [!WARNING]
|
|
166
|
+
> **Important URL Distinction:**
|
|
167
|
+
> - **Live Deployed Websites**: Web applications deployed to SiteMills are hosted on subdomains: `https://<projectId>.sitemills.com` for Production, `https://<projectId>-staging.sitemills.com` for Staging, and `https://<projectId>-dev.dev.sitemills.com` for Dev.
|
|
168
|
+
> - **Platform Console Dashboard**: The web dashboard is located at `https://sitemills.com/project/<projectId>` (singular `/project/`, **not** plural `/projects/`). Never link to `https://sitemills.com/projects/<projectId>` as that is an internal API route prefix (`/api/v1/projects/...`) and will fail to load in the browser.
|
|
169
|
+
|
|
170
|
+
## Preview Access Tokens & Non-Production Environments
|
|
171
|
+
|
|
172
|
+
Non-production environments (**DEV**, **STAGING**, and **Branch Previews**) are private and developer-gated by default on SiteMills to protect work-in-progress code from unauthorized public access and search engines.
|
|
173
|
+
|
|
174
|
+
### How `preview_token` Works
|
|
175
|
+
|
|
176
|
+
1. **Unauthenticated / Guest Access**:
|
|
177
|
+
When you run `sitemills-cli info <projectId>`, `sitemills-cli deploy ...`, `sitemills-cli push ...`, or `sitemills-cli list-branches`, the CLI automatically attaches a cryptographically signed JWT parameter (`?preview_token=...`) to non-production URLs.
|
|
178
|
+
- Send this complete link to clients, QA testers, or open it in incognito/private windows.
|
|
179
|
+
- Upon first visit, SiteMills validates the token and sets a secure `preview_bypass_token` cookie for that session.
|
|
180
|
+
- The user can then navigate internal links, API requests, and pages without needing the parameter repeated.
|
|
181
|
+
|
|
182
|
+
2. **What Happens When the Token Expires?**:
|
|
183
|
+
- Preview tokens have an expiration lifetime.
|
|
184
|
+
- If an unauthenticated user opens an expired link or the cookie expires, they will receive:
|
|
185
|
+
```text
|
|
186
|
+
Authentication required. Please log in to SiteMills.
|
|
187
|
+
```
|
|
188
|
+
- To regain access, simply generate a fresh link using `sitemills-cli info <projectId>` or `sitemills-cli deploy ...`.
|
|
189
|
+
|
|
190
|
+
3. **Logged-in SiteMills Users**:
|
|
191
|
+
- If a reviewer or team member is logged into their SiteMills account, they **do not need a preview token**.
|
|
192
|
+
- Their active session cookie (`USER_AUTH_TOKEN`) authorizes access directly to all permitted project environments.
|
|
193
|
+
|
|
194
|
+
4. **Production Environments (`PROD`)**:
|
|
195
|
+
- Production URLs (`https://<projectId>.sitemills.com`) are always public and do not require authentication or preview tokens.
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Intelligent Error Diagnostics & Hints
|
|
200
|
+
|
|
201
|
+
The SiteMills CLI includes an embedded **Error Diagnostics and Hint Engine**. Whenever an operation fails (e.g. push compilation error, invalid MongoDB query in `data-op`, or Lua mutation runtime failure), the CLI parses the server response and outputs clear diagnostic hints and direct documentation links:
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
ERROR: Push failed (Status 400)
|
|
205
|
+
Message: TypeScript compilation failed
|
|
206
|
+
|
|
207
|
+
Structured Compilation Errors:
|
|
208
|
+
[compiler] server/handlers/orders.ts:14:32 -> Parameter 'ctx' implicitly has an 'any' type. [TS7006]
|
|
209
|
+
|
|
210
|
+
DIAGNOSTIC HINT:
|
|
211
|
+
💡 Cloud TypeScript compilation requires explicit type annotations on handler parameters. Add ": any" or dedicated interfaces, e.g. "export async function myHandler(ctx: any, params: any)".
|
|
212
|
+
|
|
213
|
+
DOCUMENTATION REFERENCE:
|
|
214
|
+
📖 See docs/SERVER_RUNTIME_RPC.md#32-common-compilation-errors--resolutions
|
|
215
|
+
💡 Run "sitemills-cli help typescript" for CLI reference.
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Complete Command Reference
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
sitemills-cli <command> [options]
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Topic & Help Commands
|
|
227
|
+
|
|
228
|
+
- **help [topic]**: Display general usage or in-depth architecture guides for a specific topic:
|
|
229
|
+
```bash
|
|
230
|
+
sitemills-cli help # Print general CLI usage and topic list
|
|
231
|
+
sitemills-cli help contracts # Specifications for contracts/jobs.json and contracts/db.json
|
|
232
|
+
sitemills-cli help jobs # Cron jobs schema, trigger rules, and server/jobs.ts binding
|
|
233
|
+
sitemills-cli help db # Database schemas, declarative indexes, and unique constraints
|
|
234
|
+
sitemills-cli help rpc # Server runtime, RPC discovery in server/handlers/, auto-stubs
|
|
235
|
+
sitemills-cli help typescript # Cloud TypeScript compilation constraints and typing rules
|
|
236
|
+
sitemills-cli help data-op # Data operation payload schemas (query, count, seed, mutation)
|
|
237
|
+
sitemills-cli help run-lua # Lua runtime sandbox, APIs, globals, and return format
|
|
238
|
+
sitemills-cli help flags # CLI options, syntax examples, and environment restrictions
|
|
239
|
+
sitemills-cli help errors # Error diagnostics and troubleshooting reference
|
|
240
|
+
```
|
|
241
|
+
*Note:* You can also pass `--help` or `-h` to any command (e.g. `sitemills-cli data-op --help` or `sitemills-cli run-lua --help`).
|
|
242
|
+
|
|
243
|
+
### Project Lifecycle & Deployment
|
|
244
|
+
|
|
245
|
+
- **login**: Authenticate with SiteMills via interactive OAuth callback.
|
|
246
|
+
```bash
|
|
247
|
+
sitemills-cli login
|
|
248
|
+
```
|
|
249
|
+
- **logout**: Clear local authentication tokens.
|
|
250
|
+
```bash
|
|
251
|
+
sitemills-cli logout
|
|
252
|
+
```
|
|
253
|
+
- **whoami**: Display current authenticated user account and email.
|
|
254
|
+
```bash
|
|
255
|
+
sitemills-cli whoami
|
|
256
|
+
```
|
|
257
|
+
- **list**: List all projects owned by or shared with your account.
|
|
258
|
+
```bash
|
|
259
|
+
sitemills-cli list
|
|
260
|
+
```
|
|
261
|
+
- **info**: Fetch comprehensive project information, metadata, deployment environment URLs, and branch preview links with `preview_token` bypass parameters.
|
|
262
|
+
```bash
|
|
263
|
+
sitemills-cli info <projectId>
|
|
264
|
+
```
|
|
265
|
+
- **import**: Import a local project directory into a new SiteMills project.
|
|
266
|
+
```bash
|
|
267
|
+
sitemills-cli import <projectName> <inputDir>
|
|
268
|
+
```
|
|
269
|
+
- **seed**: Seed a local folder from a SiteMills direct project template.
|
|
270
|
+
```bash
|
|
271
|
+
sitemills-cli seed <projectName> [outputDir]
|
|
272
|
+
```
|
|
273
|
+
- **export**: Export project code from a branch to a local directory.
|
|
274
|
+
```bash
|
|
275
|
+
sitemills-cli export <projectId> [branchId] <outputDir>
|
|
276
|
+
```
|
|
277
|
+
- **commit** (or **save-snapshot**): Quickly save a code snapshot to a branch without triggering cloud compilation or tests (~100ms). Only files that differ from the remote branch are uploaded, and remote files missing locally are deleted (pass `--no-prune` to keep them). Automatically saves metadata to `.sitemills/build.json` in the local directory and records the build in `~/.sitemills/builds.json`.
|
|
278
|
+
```bash
|
|
279
|
+
sitemills-cli commit <projectId> <branchId> <inputDir> [--message <message>] [--no-prune]
|
|
280
|
+
```
|
|
281
|
+
- **check**: Compile your local changes against a branch **without saving or deploying anything**. Runs the same frontend and backend compilation as `push`, but creates no snapshot or version, leaves the live branch untouched, and runs no sandbox tests. Exits with code 1 if compilation fails. Use it for a fast edit-compile loop, then `push` once it passes.
|
|
282
|
+
```bash
|
|
283
|
+
sitemills-cli check <projectId> <branchId> <inputDir> [--no-prune]
|
|
284
|
+
```
|
|
285
|
+
- **push**: Push local updates to a specific branch on SiteMills. Only files that differ from the remote branch are uploaded (compared by content hash), and remote files missing locally are deleted (pass `--no-prune` to keep them). If nothing changed, push exits without recompiling. Performs pre-flight validation on `contracts/jobs.json`, `contracts/db.json`, TypeScript parameter typing, cloud bundle compilation, and automated tests. Pass `--skip-tests` to bypass testing.
|
|
286
|
+
```bash
|
|
287
|
+
sitemills-cli push <projectId> <branchId> <inputDir> [--message <message>] [--skip-tests] [--no-prune]
|
|
288
|
+
```
|
|
289
|
+
- **compile**: Trigger manual project code compilation for a branch and inspect diagnostics. Pass `--skip-tests` to bypass testing.
|
|
290
|
+
```bash
|
|
291
|
+
sitemills-cli compile <projectId> [--branch <branchId>] [--skip-tests]
|
|
292
|
+
```
|
|
293
|
+
- **deploy**: Deploy a branch to an environment (`DEV`, `STAGING`, or `PROD`).
|
|
294
|
+
```bash
|
|
295
|
+
sitemills-cli deploy <projectId> <branchId> <environment>
|
|
296
|
+
```
|
|
297
|
+
- **list-branches**: List all development branches for a project, including active deployed environments.
|
|
298
|
+
```bash
|
|
299
|
+
sitemills-cli list-branches <projectId>
|
|
300
|
+
```
|
|
301
|
+
- **version-history**: View the timeline of code versions and checkpoints for a specific branch.
|
|
302
|
+
```bash
|
|
303
|
+
sitemills-cli version-history <projectId> [branchId] [--limit <limit>]
|
|
304
|
+
```
|
|
305
|
+
- **delete**: Delete a project on SiteMills.
|
|
306
|
+
```bash
|
|
307
|
+
sitemills-cli delete <projectId>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Background Jobs Management
|
|
311
|
+
|
|
312
|
+
Manage background and scheduled jobs defined in `contracts/jobs.json` and implemented in `server/jobs.ts`:
|
|
313
|
+
|
|
314
|
+
- **jobs list**: List all background jobs registered in an environment with status, schedules, and last run stats.
|
|
315
|
+
```bash
|
|
316
|
+
sitemills-cli jobs list <projectId> <environment> [--json]
|
|
317
|
+
```
|
|
318
|
+
- **jobs run**: Manually trigger an on-demand run of a job.
|
|
319
|
+
```bash
|
|
320
|
+
sitemills-cli jobs run <projectId> <environment> <jobName> [--params '{"dryRun":true}']
|
|
321
|
+
```
|
|
322
|
+
- **jobs runs**: View execution history and logs for a specific job.
|
|
323
|
+
```bash
|
|
324
|
+
sitemills-cli jobs runs <projectId> <environment> <jobName> [--json]
|
|
325
|
+
```
|
|
326
|
+
- **jobs pause**: Temporarily pause scheduled runs of a job.
|
|
327
|
+
```bash
|
|
328
|
+
sitemills-cli jobs pause <projectId> <environment> <jobName> [--reason "Maintenance"]
|
|
329
|
+
```
|
|
330
|
+
- **jobs resume**: Resume scheduled execution of a paused job.
|
|
331
|
+
```bash
|
|
332
|
+
sitemills-cli jobs resume <projectId> <environment> <jobName>
|
|
333
|
+
```
|
|
334
|
+
- **jobs metrics**: Query aggregated job runtime metrics, success rates, and token consumption.
|
|
335
|
+
```bash
|
|
336
|
+
sitemills-cli jobs metrics <projectId> <environment> [--json]
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### Database & Sandboxed Data Operations
|
|
340
|
+
|
|
341
|
+
- **seed-db**: Seed database records for a project/branch from a JSON file.
|
|
342
|
+
```bash
|
|
343
|
+
sitemills-cli seed-db <projectId> <branchId> <dataFile.json>
|
|
344
|
+
```
|
|
345
|
+
- **data-copy** (or **clone-scope**): Clone all database collections and records from a source environment/scope to a target scope (e.g. from PROD to STAGING).
|
|
346
|
+
```bash
|
|
347
|
+
sitemills-cli data-copy <projectId> <sourceScope> <targetScope>
|
|
348
|
+
sitemills-cli clone-scope <projectId> <sourceScope> <targetScope>
|
|
349
|
+
```
|
|
350
|
+
- **data-op**: Execute structured database operations (query, count, seed, mutation preview, mutation apply, or inline Lua execution).
|
|
351
|
+
```bash
|
|
352
|
+
sitemills-cli data-op <projectId> <payloadJsonOrFile> [--branch <branchId>] [--env <environment>] [--mock-user <email>]
|
|
353
|
+
```
|
|
354
|
+
*Inline Example:*
|
|
355
|
+
```bash
|
|
356
|
+
sitemills-cli data-op my-app '{"operation":"query","collection":"Users","filter":{"role":"admin"},"limit":10}' --env DEV
|
|
357
|
+
```
|
|
358
|
+
- **run-lua**: Execute a sandboxed Lua transformation script against collection documents.
|
|
359
|
+
```bash
|
|
360
|
+
sitemills-cli run-lua <projectId> <collection> <luaScriptFile> [options]
|
|
361
|
+
```
|
|
362
|
+
*Example:*
|
|
363
|
+
```bash
|
|
364
|
+
sitemills-cli run-lua my-app Orders scripts/recalculate_totals.lua --env DEV --filter '{"status":"pending"}' --dry-run
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Logs, Monitoring & Workflows
|
|
368
|
+
|
|
369
|
+
- **logs**: Fetch runtime logs with optional branch, environment, and level filtering.
|
|
370
|
+
```bash
|
|
371
|
+
sitemills-cli logs <projectId> [--branch <branchId>] [--env <environment>] [--level <INFO|WARN|ERROR>] [--limit <limit>]
|
|
372
|
+
```
|
|
373
|
+
- **workflows**: List recent AI/agentic workflows run on the project, including prompts, token consumption, and status.
|
|
374
|
+
```bash
|
|
375
|
+
sitemills-cli workflows <projectId> [--branch <branchId>] [--limit <limit>]
|
|
376
|
+
```
|
|
377
|
+
- **credits**: Query remaining credit and token usage balances for a project.
|
|
378
|
+
```bash
|
|
379
|
+
sitemills-cli credits <projectId>
|
|
380
|
+
```
|
|
381
|
+
- **storage**: Retrieve a detailed storage breakdown (database, media uploads, branches, versions).
|
|
382
|
+
```bash
|
|
383
|
+
sitemills-cli storage <projectId>
|
|
384
|
+
```
|
|
385
|
+
- **billing-history**: View transaction and order history.
|
|
386
|
+
```bash
|
|
387
|
+
sitemills-cli billing-history [projectId] [--limit <limit>]
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Collaboration, Media & Settings
|
|
391
|
+
|
|
392
|
+
- **members**: List project team members, roles, and pending invitation status.
|
|
393
|
+
```bash
|
|
394
|
+
sitemills-cli members <projectId>
|
|
395
|
+
```
|
|
396
|
+
- **invite**: Invite a collaborator with OWNER, DEVELOPER, or READER privileges.
|
|
397
|
+
```bash
|
|
398
|
+
sitemills-cli invite <projectId> <email> <role>
|
|
399
|
+
```
|
|
400
|
+
- **remove-member**: Remove a team member or revoke an invitation.
|
|
401
|
+
```bash
|
|
402
|
+
sitemills-cli remove-member <projectId> <emailOrId>
|
|
403
|
+
```
|
|
404
|
+
- **list-tasks**: List all planning and execution tasks on the project task board.
|
|
405
|
+
```bash
|
|
406
|
+
sitemills-cli list-tasks <projectId>
|
|
407
|
+
```
|
|
408
|
+
- **add-task**: Add a task to the project task board.
|
|
409
|
+
```bash
|
|
410
|
+
sitemills-cli add-task <projectId> <title> [description] [--priority <N>] [--assignee <email>]
|
|
411
|
+
```
|
|
412
|
+
- **update-task**: Update task details, assignee, priority, or status.
|
|
413
|
+
```bash
|
|
414
|
+
sitemills-cli update-task <projectId> <taskId> [--title <title>] [--description <desc>] [--priority <N>] [--assignee <email>] [--status <status>]
|
|
415
|
+
```
|
|
416
|
+
- **env-list**: List all resolved environment variables for a project environment.
|
|
417
|
+
```bash
|
|
418
|
+
sitemills-cli env-list <projectId> <environment>
|
|
419
|
+
```
|
|
420
|
+
- **env-set**: Create or update an environment variable or secret.
|
|
421
|
+
```bash
|
|
422
|
+
sitemills-cli env-set <projectId> <environment> <name> <value> [--description <desc>]
|
|
423
|
+
```
|
|
424
|
+
- **env-delete**: Remove an environment variable.
|
|
425
|
+
```bash
|
|
426
|
+
sitemills-cli env-delete <projectId> <environment> <name>
|
|
427
|
+
```
|
|
428
|
+
- **set-visibility**: Change project visibility to PRIVATE, UNLISTED, or PUBLIC, with optional SEO indexing enablement.
|
|
429
|
+
```bash
|
|
430
|
+
sitemills-cli set-visibility <projectId> <visibility> [--indexable | --no-indexable]
|
|
431
|
+
```
|
|
432
|
+
- **set-description**: Update the public display description of the project.
|
|
433
|
+
```bash
|
|
434
|
+
sitemills-cli set-description <projectId> <description>
|
|
435
|
+
```
|
|
436
|
+
- **set-tags**: Set or clear discovery tags for the project.
|
|
437
|
+
```bash
|
|
438
|
+
sitemills-cli set-tags <projectId> <tag1,tag2,...> [--clear]
|
|
439
|
+
```
|
|
440
|
+
- **upload-media**: Upload a local media asset to SiteMills storage.
|
|
441
|
+
```bash
|
|
442
|
+
sitemills-cli upload-media <projectId> <filePath> [--type <uploadType>]
|
|
443
|
+
```
|
|
444
|
+
- **set-branding**: Configure project branding assets (banner, gallery, video) using media IDs.
|
|
445
|
+
```bash
|
|
446
|
+
sitemills-cli set-branding <projectId> --banner <bannerMediaId> [--gallery <mediaId1,mediaId2>] [--video <showcaseVideoMediaId>]
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Stripe Payments & In-Person POS Terminal
|
|
450
|
+
|
|
451
|
+
- **payments-status**: Fetch Stripe Connect payouts and configuration status.
|
|
452
|
+
```bash
|
|
453
|
+
sitemills-cli payments-status <projectId> <siteEnvironment>
|
|
454
|
+
```
|
|
455
|
+
- **setup-payments**: Interactively guide Stripe Connect payouts onboarding for an environment/scope.
|
|
456
|
+
```bash
|
|
457
|
+
sitemills-cli setup-payments <projectId> <siteEnvironment> [--owner-name <ownerName>] [--country <country>]
|
|
458
|
+
```
|
|
459
|
+
- **terminal-readers**: List registered physical Stripe Terminal smart readers (WisePOS E, S700, T600) for a project.
|
|
460
|
+
```bash
|
|
461
|
+
sitemills-cli terminal-readers <projectId> <siteEnvironment> [--location <locationId>]
|
|
462
|
+
```
|
|
463
|
+
- **register-terminal-reader**: Register and configure a physical smart card reader using the 3-word pairing code displayed on the terminal screen.
|
|
464
|
+
```bash
|
|
465
|
+
sitemills-cli register-terminal-reader <projectId> <siteEnvironment> <registrationCode> [label] [--location <locationId>]
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### Security, Domains & Updates
|
|
469
|
+
|
|
470
|
+
- **encryption**: Manage project data encryption at rest (status check, secure key generation, configuring key, enabling encryption).
|
|
471
|
+
```bash
|
|
472
|
+
sitemills-cli encryption <projectId> [status | generate-key | set-key <key> | enable]
|
|
473
|
+
```
|
|
474
|
+
- **domain**: List custom domains and DNS status.
|
|
475
|
+
```bash
|
|
476
|
+
sitemills-cli domain <projectId>
|
|
477
|
+
```
|
|
478
|
+
- **domain-add**: Attach a custom domain to a project.
|
|
479
|
+
```bash
|
|
480
|
+
sitemills-cli domain-add <projectId> <domain>
|
|
481
|
+
```
|
|
482
|
+
- **domain-verify**: Trigger DNS verification and SSL certificate issuance.
|
|
483
|
+
```bash
|
|
484
|
+
sitemills-cli domain-verify <projectId>
|
|
485
|
+
```
|
|
486
|
+
- **version**: Print the current CLI version and check for newer releases.
|
|
487
|
+
```bash
|
|
488
|
+
sitemills-cli version
|
|
489
|
+
```
|
|
490
|
+
- **update**: Check for updates and force an in-place upgrade of the standalone binary.
|
|
491
|
+
```bash
|
|
492
|
+
sitemills-cli update [--force]
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Automatic Updates
|
|
498
|
+
|
|
499
|
+
How the CLI stays current depends on how you installed it:
|
|
500
|
+
|
|
501
|
+
| Installed with | How it updates |
|
|
502
|
+
|---|---|
|
|
503
|
+
| Install script or manual download | Updates itself automatically before running a command |
|
|
504
|
+
| Homebrew | Tells you when a new version is out; run `brew upgrade sitemills-cli` |
|
|
505
|
+
| Scoop | Tells you when a new version is out; run `scoop update sitemills-cli` |
|
|
506
|
+
| npm | Tells you when a new version is out; run `npm install -g sitemills-cli@latest` |
|
|
507
|
+
|
|
508
|
+
`sitemills-cli version` shows your version, how it was installed, and whether an update is available. `sitemills-cli update` upgrades a self-updating install immediately.
|
|
509
|
+
|
|
510
|
+
- **Non-blocking & fast:** checks use a 2.5-second timeout. If you're offline or GitHub is unreachable, the command runs normally.
|
|
511
|
+
- **Cached:** checks run at most once an hour.
|
|
512
|
+
- **Opt out:** pass `--no-update` or set `SITEMILLS_NO_UPDATE=1`. Checks are also skipped when the `CI` environment variable is set.
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## Options & Flags Reference
|
|
517
|
+
|
|
518
|
+
- `--message <msg>`: Commit message for push (default: `CLI push update`).
|
|
519
|
+
- `--skip-tests`: Bypass automated test suite execution during push and compilation.
|
|
520
|
+
- `--params <json>`: JSON payload parameters for on-demand job execution (`jobs run`).
|
|
521
|
+
- `--reason <reason>`: Reason message when pausing a background job (`jobs pause`).
|
|
522
|
+
- `--branch <branch>`: Target branch ID or branch data scope.
|
|
523
|
+
- `--env <environment>`: Target environment name (`DEV`, `STAGING`, or `PROD`).
|
|
524
|
+
- `--filter <filter>`: JSON query filter for `run-lua` (e.g. `'{"status":"pending"}'`).
|
|
525
|
+
- `--dry-run`: Execute Lua script as a dry run simulation without applying database writes.
|
|
526
|
+
- `--limit <limit>`: Max documents matched for `run-lua` (1 - 200, default: 200).
|
|
527
|
+
- `--max-write-ops <N>`: Max database write operations permitted for `run-lua` (integer 1 - 200, default: 200).
|
|
528
|
+
- `--mock-user <email>`: Simulate/impersonate a user for permission testing. **Allowed only in DEV/STAGING; strictly rejected in PROD for security.**
|
|
529
|
+
- `--type <type>`: Media upload type for `upload-media` (`APP_MEDIA`, `AGENT_ATTACHMENT`, `CODEBASE_FILE`, `USER_CONTENT`).
|
|
530
|
+
- `--owner-name <name>`: Owner's name to register during Stripe Connect onboarding.
|
|
531
|
+
- `--country <country>`: Business country code to register during Stripe Connect onboarding (default: `US`).
|
|
532
|
+
- `--description <desc>`: Brief description metadata for environment variables.
|
|
533
|
+
- `--banner <id>`: Media ID of the project banner image.
|
|
534
|
+
- `--gallery <ids>`: Comma-separated media IDs to add to the project gallery.
|
|
535
|
+
- `--video <id>`: Media ID of the project showcase video.
|
|
536
|
+
- `--indexable`: Enable search engine indexing for the project visibility settings.
|
|
537
|
+
- `--no-indexable`: Disable search engine indexing for the project visibility settings.
|
|
538
|
+
- `--no-update`: Disable automatic update checks for this command invocation.
|
|
539
|
+
- `--force`: Force check and apply updates, ignoring local cache TTL.
|