pockethost 3.0.0 → 4.0.0

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 (5) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +54 -13
  3. package/dist/cli.js +2712 -6800
  4. package/package.json +11 -10
  5. package/LICENSE.md +0 -16
package/CHANGELOG.md CHANGED
@@ -2,6 +2,41 @@
2
2
 
3
3
  Formerly published as `phio`. Versions below 3.0.0 are phio's history.
4
4
 
5
+ ## 4.0.0
6
+
7
+ ### Major Changes
8
+
9
+ - The CLI signs in with a personal access token only. Email/password login is gone: `pockethost login` opens
10
+ Account → API Tokens and saves the token you paste (`pockethost login <token>` works too), and
11
+ `POCKETHOST_USERNAME`/`POCKETHOST_PASSWORD` are ignored with a message pointing to `POCKETHOST_TOKEN`. A login saved
12
+ by 3.x no longer works; run `pockethost login` once.
13
+ - `list`, `link` and `logs` work with a token and show only the instances the token can reach. `logs` streams over
14
+ the instance's HTTPS endpoint, so it works from CI.
15
+ - `sftp`, `deploy --sftp` and `dev --sftp` no longer register an SSH key for you, because tokens can't add SSH keys.
16
+ Add the CLI's public key under Account → Keys once; the CLI prints it when it's missing. Keys registered by earlier
17
+ versions keep working.
18
+ - `info` shows the token, linked instance and whether the SFTP key is on your account.
19
+ - Dropped the `pocketbase` dependency.
20
+
21
+ ## 3.1.0
22
+
23
+ ### Minor Changes
24
+
25
+ - `deploy` and `dev` now upload over HTTPS instead of SFTP. The CLI sends a list of file hashes, uploads only the
26
+ files PocketHost doesn't have yet (compressed), and PocketHost swaps the new set in all at once, restarting the
27
+ instance when anything outside `pb_public` changed. Files in the deployed folders that aren't in your project are
28
+ removed. Dotfiles (for example `pb_public/.well-known/`) are now deployed; `.git*` and `node_modules` stay excluded.
29
+ - Personal access tokens: set `POCKETHOST_TOKEN`, or run `pockethost token set` / `pockethost login --token`. Deploys
30
+ need no password or SSH key, so CI works on fresh runners (previously a new runner generated a new deploy key that
31
+ didn't match the registered `PocketHost CLI` key).
32
+ - New `pockethost token [set|clear|status]`. `info` shows the token in use. `logout` also removes a saved token.
33
+ - `deploy --commit <sha>` and `-m/--message <note>` are recorded with each deploy (`$GITHUB_SHA` is used
34
+ automatically).
35
+ - `--sftp` on `deploy` and `dev` keeps the previous SFTP sync.
36
+ - PocketHost no longer runs `bun install` when `package.json`, `bun.lock(b)` or `patches/` change (over SFTP or the
37
+ deploy API). Those files are copied as-is, and an existing `node_modules` on the instance is left alone. Bundle npm
38
+ code your hooks need into `pb_hooks`.
39
+
5
40
  ## 3.0.0
6
41
 
7
42
  ### Major Changes
package/README.md CHANGED
@@ -16,14 +16,15 @@ npm install -g pockethost
16
16
  npm rm -g phio && npm i -g pockethost
17
17
  ```
18
18
 
19
- Everything carries over on first run: your login and deploy key are copied from phio's config folder (`~/.config/phio-nodejs` on Linux), `.phioconfig` is
19
+ Your deploy key is copied from phio's config folder (`~/.config/phio-nodejs` on Linux), `.phioconfig` is
20
20
  renamed to `.pockethostconfig` (commit it), and the `PHIO_*` environment variables keep working with a warning until
21
21
  you rename them to `POCKETHOST_*`.
22
22
 
23
23
  ## Commands
24
24
 
25
25
  ```bash
26
- pockethost login
26
+ pockethost login [token] # save a personal access token
27
+ pockethost token [set|clear|status]
27
28
  pockethost logout
28
29
  pockethost info # alias: pockethost whoami
29
30
  pockethost list # alias: pockethost ls
@@ -34,12 +35,15 @@ pockethost sftp [instance]
34
35
  pockethost logs [instance]
35
36
  ```
36
37
 
37
- - **`pockethost dev`**: watch local changes and sync over SFTP
38
- - **`pockethost deploy`**: one-shot SFTP sync
38
+ - **`pockethost dev`**: watch local changes and deploy them
39
+ - **`pockethost deploy`**: deploy once
40
+ - **`pockethost login`**: open Account → API Tokens and save the token you paste
41
+ - **`pockethost token`**: save, clear, or check the token
39
42
  - **`pockethost sftp`**: interactive SFTP session (uses system `sftp` when available)
40
43
  - **`pockethost logs`**: tail instance logs
41
44
 
42
- `dev` and `deploy` accept `-v/--verbose`, `-i/--include`, and `-e/--exclude`.
45
+ `dev` and `deploy` accept `-v/--verbose`, `-i/--include`, `-e/--exclude`, and `--sftp` (sync over SFTP instead of
46
+ HTTPS). `deploy` also takes `--commit <sha>` and `-m/--message <note>`.
43
47
 
44
48
  Default includes: `pb_*`, `package.json`, `bun.lock`, `bun.lockb`, `patches/**`.
45
49
 
@@ -64,12 +68,50 @@ This writes `.pockethostconfig`:
64
68
  Older project files (`.phioconfig`, `package.json` → `pockethost.instanceName`, `pockethost.json`) are migrated to
65
69
  `.pockethostconfig` automatically on first use.
66
70
 
67
- ## Deploy key
71
+ ## How deploys work
68
72
 
69
- `pockethost dev` and `pockethost deploy` sync over **SFTP** (`ftp.pockethost.io:2222`) using an Ed25519 deploy key
70
- stored under `POCKETHOST_HOME` (default `~/.config/pockethost/`). The CLI auto-registers a **`PocketHost CLI`** key
71
- under Account → Keys on first use (an existing **`Phio`** key from phio is reused). Run `pockethost info` to inspect
72
- key status.
73
+ `deploy` and `dev` talk to the instance over HTTPS (`https://<instance>.pockethost.io/_ph/deploy/v1`):
74
+
75
+ 1. Send a manifest of `{ path: sha256 }` for the matched files.
76
+ 2. Upload only the files the server is missing, as one gzip bundle per ~32 MB.
77
+ 3. Commit: the server swaps the file set in atomically (stopping the instance when anything outside `pb_public`
78
+ changes) and starts the instance again.
79
+
80
+ PocketHost doesn't install npm packages. `package.json`, `bun.lock(b)` and `patches/` are copied as plain files. Bundle
81
+ any npm code your hooks need into `pb_hooks`.
82
+
83
+ Only `pb_*` folders (never `pb_data`), `package.json`, `bun.lock(b)` and `patches/` are deployed. Files in those folders
84
+ on the instance that aren't in your project are removed. `node_modules` and `.git*` are never touched.
85
+
86
+ ## Authentication
87
+
88
+ The CLI signs in with a personal access token (`ph_pat_…`) only. Every command uses, in order:
89
+
90
+ 1. `POCKETHOST_TOKEN`
91
+ 2. the token saved by `pockethost login` (or `pockethost token set`)
92
+
93
+ Create tokens under [Account → API Tokens](https://app.pockethost.io/account/tokens). A token sees only the instances
94
+ you give it; `list`, `link` and `logs` need read access, `deploy` and `dev` need write access. Email/password login
95
+ was removed in 4.0.
96
+
97
+ Deploy from GitHub Actions:
98
+
99
+ ```yaml
100
+ - run: npx pockethost@latest deploy myapp-${{ github.ref_name }}
101
+ env:
102
+ POCKETHOST_TOKEN: ${{ secrets.POCKETHOST_TOKEN }}
103
+ ```
104
+
105
+ Docs: https://pockethost.io/docs/deploy-from-ci
106
+
107
+ ## SSH key (`--sftp` and `pockethost sftp`)
108
+
109
+ `pockethost dev --sftp`, `pockethost deploy --sftp` and `pockethost sftp` use **SFTP** (`ftp.pockethost.io:2222`)
110
+ with an Ed25519 key stored under `POCKETHOST_HOME` (default `~/.config/pockethost/`), created on first use. Tokens
111
+ can't add SSH keys, so add the public key (`pockethost_deploy_ed25519.pub`) under
112
+ [Account → Keys](https://app.pockethost.io/account/keys) once; the CLI prints it if it's missing. Keys you registered
113
+ with an earlier version (`PocketHost CLI` or `Phio`) keep working. `pockethost info` shows whether the key is on your
114
+ account.
73
115
 
74
116
  Customer docs: https://pockethost.io/docs/cli
75
117
 
@@ -77,15 +119,14 @@ Customer docs: https://pockethost.io/docs/cli
77
119
 
78
120
  | Variable | Purpose |
79
121
  | -------- | ------- |
80
- | `POCKETHOST_USERNAME` | Override saved email (non-interactive login) |
81
- | `POCKETHOST_PASSWORD` | Override saved password |
122
+ | `POCKETHOST_TOKEN` | Personal access token (CI); overrides the saved one |
82
123
  | `POCKETHOST_INSTANCE_NAME` | Override linked instance name |
83
124
  | `POCKETHOST_MOTHERSHIP_URL` | Override mothership API URL |
84
125
  | `POCKETHOST_HOME` | Override config directory |
85
126
  | `POCKETHOST_PROJECT_DIR` | Override project root detection |
86
127
 
87
128
  Environment variables take precedence over `.pockethostconfig`. The old `PHIO_*` names still work (with a deprecation
88
- warning) and will be removed in the next major version.
129
+ warning) and will be removed in a future major version.
89
130
 
90
131
  ## Development (monorepo)
91
132