@studiometa/forge-cli 0.4.6 → 0.4.7
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 +68 -6
- package/dist/cli.js +1180 -51
- package/dist/cli.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/deployments/command.d.ts.map +1 -1
- package/dist/commands/deployments/handlers.d.ts +2 -0
- package/dist/commands/deployments/handlers.d.ts.map +1 -1
- package/dist/commands/deployments/help.d.ts.map +1 -1
- package/dist/commands/env/env-diff.d.ts +29 -0
- package/dist/commands/env/env-diff.d.ts.map +1 -0
- package/dist/commands/env/handlers.d.ts.map +1 -1
- package/dist/commands/env/help.d.ts.map +1 -1
- package/dist/commands/nginx/handlers.d.ts.map +1 -1
- package/dist/commands/nginx/help.d.ts.map +1 -1
- package/dist/commands/php/command.d.ts +2 -0
- package/dist/commands/php/command.d.ts.map +1 -0
- package/dist/commands/php/handlers.d.ts +42 -0
- package/dist/commands/php/handlers.d.ts.map +1 -0
- package/dist/commands/php/help.d.ts +2 -0
- package/dist/commands/php/help.d.ts.map +1 -0
- package/dist/commands/php/index.d.ts +3 -0
- package/dist/commands/php/index.d.ts.map +1 -0
- package/dist/commands/services/handlers.d.ts.map +1 -1
- package/dist/commands/ssh-keys/command.d.ts.map +1 -1
- package/dist/commands/ssh-keys/help.d.ts.map +1 -1
- package/dist/commands/ssh-keys/sync-plan.d.ts +56 -0
- package/dist/commands/ssh-keys/sync-plan.d.ts.map +1 -0
- package/dist/commands/ssh-keys/sync.d.ts +6 -0
- package/dist/commands/ssh-keys/sync.d.ts.map +1 -0
- package/dist/{error-handler-BA357jIr.js → error-handler-Adi84RcF.js} +10 -5
- package/dist/{error-handler-BA357jIr.js.map → error-handler-Adi84RcF.js.map} +1 -1
- package/dist/error-handler.d.ts +5 -0
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/args.d.ts +6 -0
- package/dist/utils/args.d.ts.map +1 -1
- package/dist/utils/content-source.d.ts +24 -0
- package/dist/utils/content-source.d.ts.map +1 -0
- package/dist/utils/drift.d.ts +33 -0
- package/dist/utils/drift.d.ts.map +1 -0
- package/dist/utils/resolve.d.ts +8 -0
- package/dist/utils/resolve.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ forge <command> [subcommand] [options]
|
|
|
46
46
|
| `config` | | Manage CLI configuration (`set`, `get`, `delete`) |
|
|
47
47
|
| `servers` | `s` | List, get, reboot servers |
|
|
48
48
|
| `sites` | | List, get sites on a server |
|
|
49
|
-
| `deployments` | `d` | List deployments, trigger deploys
|
|
49
|
+
| `deployments` | `d` | List deployments, trigger deploys, deploy script |
|
|
50
50
|
| `databases` | `db` | List, get databases on a server |
|
|
51
51
|
| `database-users` | | List, get, create, delete database users on a server |
|
|
52
52
|
| `daemons` | | List, get, restart daemons on a server |
|
|
@@ -57,10 +57,11 @@ forge <command> [subcommand] [options]
|
|
|
57
57
|
| `env` | | Get, update environment variables for a site |
|
|
58
58
|
| `nginx` | | Get, update Nginx configuration for a site |
|
|
59
59
|
| `nginx-templates` | | List, get, create, update, delete Nginx templates |
|
|
60
|
+
| `php` | | PHP versions, config files, limits and OPcache |
|
|
60
61
|
| `certificates` | `certs` | List, get, activate SSL certificates for a site |
|
|
61
62
|
| `firewall-rules` | `fw` | List, get firewall rules on a server |
|
|
62
63
|
| `ssh` | | Open an SSH session to a server |
|
|
63
|
-
| `ssh-keys` | | List, get SSH keys on
|
|
64
|
+
| `ssh-keys` | | List, get, sync SSH keys on servers |
|
|
64
65
|
| `security-rules` | | List, get, create, delete security rules for a site |
|
|
65
66
|
| `redirect-rules` | | List, get, create, delete redirect rules for a site |
|
|
66
67
|
| `recipes` | | List, get, run recipes |
|
|
@@ -132,12 +133,37 @@ forge sites get <site_id> --server <id> # Get site details
|
|
|
132
133
|
### `deployments` (`d`) — Manage deployments
|
|
133
134
|
|
|
134
135
|
```bash
|
|
135
|
-
forge deployments list --server <id> --site <id>
|
|
136
|
-
forge deployments deploy --server <id> --site <id>
|
|
136
|
+
forge deployments list --server <id> --site <id> # List deployments
|
|
137
|
+
forge deployments deploy --server <id> --site <id> # Trigger a deployment
|
|
138
|
+
forge deployments deploy --server <id> --site <id> --script-file deploy.sh # Upload the script, then deploy
|
|
139
|
+
forge deployments logs [id] --server <id> --site <id> # Show deployment output (latest if no id)
|
|
140
|
+
forge deployments script --server <id> --site <id> # Print the deployment script
|
|
141
|
+
forge deployments update-script --server <id> --site <id> --file deploy.sh # Update the script from a file
|
|
142
|
+
forge deployments update-script --server <id> --site <id> --file - # Update the script from stdin
|
|
143
|
+
forge deployments update-script --server <id> --site <id> --content "..." # Update the script from a string
|
|
144
|
+
forge deployments update-script --server <id> --site <id> --file deploy.sh --check # Compare only, do not write
|
|
137
145
|
```
|
|
138
146
|
|
|
139
147
|
The `deploy` command waits for deployment to complete, showing live progress. On completion it prints the deployment log and elapsed time.
|
|
140
148
|
|
|
149
|
+
Keep the deployment script in your repository: `update-script` takes exactly one of `--file` or `--content` and rejects an empty script. With `deploy --script-file`, the script is uploaded first; if the upload fails, the deployment does not start and the command exits non-zero.
|
|
150
|
+
|
|
151
|
+
#### Detect drift in CI with `--check`
|
|
152
|
+
|
|
153
|
+
`--check` on `deployments update-script`, `env update`, `nginx update` and `php update-config` compares your local file with the content on Forge and does not write anything. Line endings (CRLF and LF) and a single trailing newline are ignored.
|
|
154
|
+
|
|
155
|
+
- In sync: prints "in sync" and exits `0`.
|
|
156
|
+
- Different: prints a unified line diff (`-` remote, `+` local) and exits `1`.
|
|
157
|
+
- With `--format json`: prints `{ "inSync": true }` or `{ "inSync": false, "diff": "..." }`.
|
|
158
|
+
|
|
159
|
+
Run it in a pipeline to fail the job when someone changed the deployment script in the Forge UI:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
forge deployments update-script --server 123 --site 456 --file deploy.sh --check
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For `env update --check`, the comparison uses variables, not text: comments, blank lines and order are ignored. The output gives only variable names (added, removed, changed) and never values, in human and json formats (`{ "inSync": false, "diff": { "added": [], "removed": [], "changed": [] } }`), because CI logs are often visible to the whole team.
|
|
166
|
+
|
|
141
167
|
### `databases` (`db`) — Manage databases
|
|
142
168
|
|
|
143
169
|
```bash
|
|
@@ -157,16 +183,46 @@ forge daemons restart <daemon_id> --server <id> # Restart a daemon
|
|
|
157
183
|
|
|
158
184
|
```bash
|
|
159
185
|
forge env get --server <id> --site <id> # Get .env content
|
|
160
|
-
forge env update --server <id> --site <id> --
|
|
186
|
+
forge env update --server <id> --site <id> --file .env # Update .env from a file
|
|
187
|
+
forge env update --server <id> --site <id> --file - # Update .env from stdin
|
|
188
|
+
forge env update --server <id> --site <id> --content "KEY=value" # Update .env from a string
|
|
189
|
+
forge env update --server <id> --site <id> --file .env --check # Compare variable names only, do not write
|
|
161
190
|
```
|
|
162
191
|
|
|
192
|
+
`update` takes exactly one of `--file` or `--content` and rejects empty content. Prefer `--file`: a value given with `--content` stays in your shell history.
|
|
193
|
+
|
|
163
194
|
### `nginx` — Manage Nginx configuration
|
|
164
195
|
|
|
165
196
|
```bash
|
|
166
197
|
forge nginx get --server <id> --site <id> # Get Nginx config
|
|
167
|
-
forge nginx update --server <id> --site <id> --
|
|
198
|
+
forge nginx update --server <id> --site <id> --file nginx.conf # Update Nginx config from a file
|
|
199
|
+
forge nginx update --server <id> --site <id> --file - # Update Nginx config from stdin
|
|
200
|
+
forge nginx update --server <id> --site <id> --content "server { ... }" # Update Nginx config from a string
|
|
201
|
+
forge nginx update --server <id> --site <id> --file nginx.conf --check # Compare only, do not write
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`update` takes exactly one of `--file` or `--content` and rejects empty content.
|
|
205
|
+
|
|
206
|
+
### `php` — Manage PHP
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
forge php list --server <id> # List installed PHP versions
|
|
210
|
+
forge php config --server <id> --version 8.3 --type fpm # Print the FPM php.ini
|
|
211
|
+
forge php config --server <id> --version 8.3 --type pool --user forge # Print the FPM pool config
|
|
212
|
+
forge php update-config --server <id> --version 8.3 --type cli --file php.ini # Replace the CLI php.ini from a file
|
|
213
|
+
forge php update-config --server <id> --version 8.3 --type fpm --file - # Replace the FPM php.ini from stdin
|
|
214
|
+
forge php update-config --server <id> --version 8.3 --type fpm --file php.ini --check # Compare only, do not write
|
|
215
|
+
forge php max-upload-size --server <id> # Print the max upload size (MB)
|
|
216
|
+
forge php set-max-upload-size 128 --server <id> # Set the max upload size (MB)
|
|
217
|
+
forge php max-execution-time --server <id> # Print the max execution time (seconds)
|
|
218
|
+
forge php set-max-execution-time 120 --server <id> # Set the max execution time (seconds)
|
|
219
|
+
forge php opcache --server <id> # Print the OPcache status
|
|
220
|
+
forge php enable-opcache --server <id> # Enable OPcache
|
|
221
|
+
forge php disable-opcache --server <id> # Disable OPcache
|
|
168
222
|
```
|
|
169
223
|
|
|
224
|
+
`--version` takes a PHP version ID from `forge php list`, or a version such as `8.3`, `php83` or `php8.3`. `--type` is `cli` (CLI php.ini), `fpm` (FPM php.ini) or `pool` (FPM pool); `--user` applies to `pool` only. `update-config` replaces the whole file, takes exactly one of `--file` or `--content`, rejects empty content and supports `--check` (see [Detect drift in CI with `--check`](#detect-drift-in-ci-with---check)).
|
|
225
|
+
|
|
170
226
|
### `certificates` (`certs`) — Manage SSL certificates
|
|
171
227
|
|
|
172
228
|
```bash
|
|
@@ -200,8 +256,14 @@ Requires your local SSH key to be authorized on the server; this command launche
|
|
|
200
256
|
```bash
|
|
201
257
|
forge ssh-keys list --server <id> # List SSH keys
|
|
202
258
|
forge ssh-keys get <key_id> --server <id> # Get SSH key details
|
|
259
|
+
forge ssh-keys sync --file keys --server <id> --dry-run # Show what sync would change
|
|
260
|
+
forge ssh-keys sync --file keys --server 1,2 --server web-3 # Add the missing keys
|
|
261
|
+
forge ssh-keys sync --file keys --all-servers --prune # Also remove keys not in the file
|
|
262
|
+
forge ssh-keys sync --file - --server <id> --user deploy # Read the keys from stdin, for user deploy
|
|
203
263
|
```
|
|
204
264
|
|
|
265
|
+
`sync` makes the SSH keys of a server user (`--user`, default `forge`) match a file in `authorized_keys` format: one `<type> <base64> [comment]` per line, blank lines and `#` comments ignored. A malformed line stops the command with its line number. Each key gets the name `<comment slug>-<first 8 hex chars of the SHA-256 of the key>`. The Forge API does not return public keys, so keys are matched by name, and a changed key gets a new name. The command prints the plan per server (`+` add, `-` remove, `=` unchanged), applies it, then prints the result. It only adds keys, unless you give `--prune`; `--dry-run` changes nothing. Servers run one after the other. When an operation fails, the other operations still run and the command exits non-zero. When an add fails on a server, the removals on that server are skipped, so nobody loses access. `--format json` prints one document, `{ dry_run, servers: [{ id, name, added, removed, unchanged, errors }] }`. With `--dry-run`, `dry_run` is `true` and `added` and `removed` hold the planned changes.
|
|
266
|
+
|
|
205
267
|
### `recipes` — Manage recipes
|
|
206
268
|
|
|
207
269
|
```bash
|