You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
│ │ │ └── list.ts # List deployments for an Edge Script
289
+
│ │ ├── hostnames/
290
+
│ │ │ └── index.ts # Mounts core/hostnames factory: script pull-zone resolver + --id/--pull-zone, visible as "domains" with hidden "hostnames" alias
283
291
│ │ └── env/
284
292
│ │ ├── index.ts # defineNamespace("env", ...)
285
293
│ │ ├── list.ts # List environment variables for a script
@@ -304,10 +312,16 @@ bunny-cli/
304
312
-**Namespaces are directories** with an `index.ts` that calls `defineNamespace()`.
305
313
-**Leaf commands** are individual `.ts` files that call `defineCommand()`.
306
314
-**Top-level commands** (`login`, `logout`, `whoami`) are registered directly in `cli.ts` without a namespace.
307
-
-**Shared internal code lives in `packages/cli/src/core/`** — command factories, errors, logger, format utilities, UI helpers, and shared types. Keep this flat (no nested subdirectories).
315
+
-**Shared internal code lives in `packages/cli/src/core/`** — command factories, errors, logger, format utilities, UI helpers, and shared types. Keep this mostly flat; a cohesive, reusable feature spanning several files may use a subdirectory (e.g. `core/hostnames/` — the pull-zone hostname helpers + the `createHostnamesCommands` factory mounted by both `scripts` and, in future, `apps`).
308
316
-**Config logic lives in `packages/cli/src/config/`** — schema, file resolution, and profile management.
309
317
-**Error classes are split.**`UserError` and `ApiError` live in `@bunny.net/openapi-client` (the SDK needs them). `ConfigError` lives in the CLI and extends `UserError`. The CLI's `errors.ts` re-exports `UserError` and `ApiError` from `@bunny.net/openapi-client`.
310
318
-**Import API clients from `@bunny.net/openapi-client`**, not relative paths. Import generated types from `@bunny.net/openapi-client/generated/<spec>.d.ts`.
319
+
-**Pull-zone settings are exposed via "Hybrid D" across surfaces.** Scripts and apps are backed by a pull zone, which has a large settings surface (hostnames, caching, edge rules, origin, security, purge, CORS, optimizer, logging, …). To keep each owner's help legible:
320
+
-**Flatten only first-class groups** directly into the owner — picked by user mental model, kept to one or two. `scripts domains` is the flattened group (a custom domain is "my site's address," not a CDN setting).
321
+
-**Group the long tail** under a `pullzone` sub-namespace within the owner (e.g. `scripts pullzone <setting>`), so the owner's top-level help gains one line, not ten. Curate per owner — don't expose settings that don't apply (a script _is_ its pull zone's origin, so no origin-URL command under `scripts`).
322
+
-**A standalone `bunny pullzone` command** (planned) is the canonical full surface for pull zones not backing a script/app, targeted by `--id`.
323
+
- Each setting-area is a **mountable factory** like `createHostnamesCommands` (`core/hostnames/`): one `{ commandPath, target, resolve(args) => { pullZoneId, coreClient }, hiddenAliases }` mounted into the root `pullzone` (resolve from `--id`), `scripts` (resolve from the linked manifest), and `apps` (resolve from the CDN endpoint). The resolver is the only per-surface difference.
324
+
- Canonical term is `pullzone` (matches the bunny.net dashboard/API); `pz` is a hidden alias (`defineNamespace(alias, false, …)`), the same pattern as `domains`'s hidden `hostnames` alias.
311
325
312
326
---
313
327
@@ -830,9 +844,18 @@ bunny
830
844
│ │ Create a remote Edge Script (use after init when --deploy was skipped)
831
845
│ ├── deploy <file> [id] [--skip-publish]
832
846
│ │ Deploy code to an Edge Script (publishes by default)
847
+
│ ├── delete [id] [--force] Delete an Edge Script (double confirmation or --force)
833
848
│ ├── deployments
834
849
│ │ └── list [id] (alias: ls) List deployments for an Edge Script
835
850
│ ├── docs Open Edge Script documentation in browser
|`--skip-publish`| Upload code without publishing |
479
487
488
+
After publishing, the live URL and any custom domains are printed.
489
+
480
490
> **Note:**`bunny scripts deploy` works regardless of how the script was created or whether GitHub Actions is configured. The last deployment always wins — whether triggered by a GitHub Action or a manual CLI deploy.
481
491
482
492
#### `bunny scripts link`
@@ -503,13 +513,156 @@ bunny scripts list --output json
503
513
504
514
#### `bunny scripts show`
505
515
506
-
Show details for an Edge Script. Uses the linked script from `.bunny/script.json` if no ID is provided.
516
+
Show details for an Edge Script. Uses the linked script from `.bunny/script.json` if no ID is provided. Output includes the script's hostnames (system and custom) with their SSL status.
507
517
508
518
```bash
509
519
bunny scripts show <script-id>
510
520
bunny scripts show
511
521
```
512
522
523
+
#### `bunny scripts delete`
524
+
525
+
Delete an Edge Script. Uses the linked script if no ID is provided. Requires double confirmation (or `--force` to skip).
526
+
527
+
```bash
528
+
bunny scripts delete <script-id>
529
+
bunny scripts delete
530
+
bunny scripts delete <script-id> --force
531
+
```
532
+
533
+
| Flag | Description |
534
+
| --------- | ------------------------- |
535
+
|`--force`| Skip confirmation prompts |
536
+
537
+
#### `bunny scripts deployments`
538
+
539
+
Manage Edge Script deployments.
540
+
541
+
##### `bunny scripts deployments list`
542
+
543
+
List deployments for an Edge Script. Uses the linked script if no ID is provided.
544
+
545
+
```bash
546
+
bunny scripts deployments list
547
+
bunny scripts deployments ls
548
+
bunny scripts deployments list <script-id>
549
+
bunny scripts deployments list --output json
550
+
```
551
+
552
+
#### `bunny scripts env`
553
+
554
+
Manage environment variables and secrets for an Edge Script. All subcommands default to the linked script; pass `--id <script-id>` to target another.
555
+
556
+
##### `bunny scripts env list`
557
+
558
+
List environment variables and secrets.
559
+
560
+
```bash
561
+
bunny scripts env list
562
+
bunny scripts env ls
563
+
bunny scripts env list --output json
564
+
```
565
+
566
+
##### `bunny scripts env set`
567
+
568
+
Set an environment variable or secret. Runs interactively when arguments are omitted. The variable name is uppercased.
569
+
570
+
```bash
571
+
bunny scripts env set MY_VAR value
572
+
bunny scripts env set# interactive
573
+
bunny scripts env set API_KEY secret-value --secret
|`--force`| Overwrite an existing `.env` without prompting |
603
+
604
+
#### `bunny scripts domains`
605
+
606
+
Manage custom domains for an Edge Script. A script's domains live on its linked pull zone, so these commands operate on that pull zone. All subcommands default to the linked script; pass `--id <script-id>` to target another, and `--pull-zone <id>` when a script has more than one linked pull zone. (`bunny scripts hostnames` is kept as a hidden alias.)
607
+
608
+
##### `bunny scripts domains add`
609
+
610
+
Add a custom domain. SSL is **not** requested by default — a free certificate can only be issued once your DNS points at bunny.net, so the command prints the `CNAME` record to create and the follow-up command to enable HTTPS. Pass `--ssl` to issue a certificate immediately; HTTP is redirected to HTTPS by default (opt out with `--no-force-ssl`).
611
+
612
+
```bash
613
+
# Add a domain and get DNS instructions
614
+
bunny scripts domains add shop.example.com
615
+
616
+
# Add and request SSL now (DNS must already be pointed at bunny.net) — HTTPS forced
|`--ssl`| Issue a free SSL certificate now and force HTTPS (requires DNS pointed) |
626
+
|`--no-force-ssl`| When issuing SSL, keep serving HTTP instead of redirecting to HTTPS |
627
+
|`--id`| Edge Script ID (uses linked script if omitted) |
628
+
|`--pull-zone`| Pull zone ID (required if the script has multiple linked zones) |
629
+
630
+
##### `bunny scripts domains ssl`
631
+
632
+
Request a free SSL certificate for a custom domain. Run this after the domain's DNS points at bunny.net (see the `CNAME` printed by `domains add`). HTTP is redirected to HTTPS by default; pass `--no-force-ssl` to keep plain HTTP.
Open the Edge Scripts documentation in your browser.
661
+
662
+
```bash
663
+
bunny scripts docs
664
+
```
665
+
513
666
### `bunny api`
514
667
515
668
Make a raw authenticated HTTP request to any bunny.net API endpoint. Auth is handled automatically via your configured API key.
@@ -543,6 +696,14 @@ bunny api GET /pullzone --verbose
543
696
544
697
The method is case-insensitive (`get` and `GET` both work). Paths are relative to `https://api.bunny.net` — use `/database/...` for the Database API and `/mc/...` for Magic Containers.
545
698
699
+
### `bunny completion`
700
+
701
+
Generate a shell completion script. Add the output to your shell profile to enable tab completion.
0 commit comments