pockethost 1.7.0 → 3.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 (52) hide show
  1. package/CHANGELOG.md +119 -86
  2. package/README.md +96 -0
  3. package/dist/cli.js +21542 -0
  4. package/package.json +55 -55
  5. package/changesetx.ts +0 -110
  6. package/common.ts +0 -1
  7. package/core.ts +0 -1
  8. package/readme.md +0 -129
  9. package/src/cli/commands/ConfigCommand/index.ts +0 -28
  10. package/src/cli/commands/PluginCommand/index.ts +0 -113
  11. package/src/cli/commands/PluginCommand/plugin-template/package.json +0 -38
  12. package/src/cli/commands/PluginCommand/plugin-template/readme.md +0 -33
  13. package/src/cli/commands/PluginCommand/plugin-template/src/constants.ts +0 -22
  14. package/src/cli/commands/PluginCommand/plugin-template/src/db.ts +0 -30
  15. package/src/cli/commands/PluginCommand/plugin-template/src/index.ts +0 -3
  16. package/src/cli/commands/PluginCommand/plugin-template/src/log.ts +0 -5
  17. package/src/cli/commands/PluginCommand/plugin-template/src/plugin.ts +0 -58
  18. package/src/cli/commands/PluginCommand/util.ts +0 -140
  19. package/src/cli/commands/ServeCommand/index.ts +0 -36
  20. package/src/cli/index.ts +0 -70
  21. package/src/common/CleanupManager.ts +0 -65
  22. package/src/common/Logger.ts +0 -174
  23. package/src/common/ResourceAllocator.ts +0 -49
  24. package/src/common/TimerManager.ts +0 -64
  25. package/src/common/assert.ts +0 -26
  26. package/src/common/debug.ts +0 -8
  27. package/src/common/error.ts +0 -16
  28. package/src/common/events.ts +0 -53
  29. package/src/common/index.ts +0 -12
  30. package/src/common/mergeConfig.ts +0 -27
  31. package/src/common/mkSingleton.ts +0 -28
  32. package/src/common/plugin/action.ts +0 -164
  33. package/src/common/plugin/filter.ts +0 -197
  34. package/src/common/plugin/index.ts +0 -21
  35. package/src/common/promiseSerializer.ts +0 -22
  36. package/src/common/schema/BaseFields.ts +0 -10
  37. package/src/common/schema/Instance.ts +0 -46
  38. package/src/common/schema/InstanceLog.ts +0 -12
  39. package/src/common/schema/index.ts +0 -3
  40. package/src/common/schema/util.ts +0 -7
  41. package/src/constants.ts +0 -70
  42. package/src/core/Settings.ts +0 -119
  43. package/src/core/asyncExecutionGuard.ts +0 -49
  44. package/src/core/config.ts +0 -108
  45. package/src/core/exit.ts +0 -11
  46. package/src/core/index.ts +0 -8
  47. package/src/core/internal.ts +0 -3
  48. package/src/core/smartFetch.ts +0 -32
  49. package/src/core/tryFetch.ts +0 -69
  50. package/src/plugin.ts +0 -54
  51. package/src/server.ts +0 -129
  52. /package/{src/cli/commands/PluginCommand/plugin-template/LICENSE.md → LICENSE.md} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,134 +1,167 @@
1
- # pockethost
1
+ # pockethost (CLI)
2
2
 
3
- ## 1.7.0
3
+ Formerly published as `phio`. Versions below 3.0.0 are phio's history.
4
+
5
+ ## 3.0.0
6
+
7
+ ### Major Changes
8
+
9
+ - Renamed from `phio` to `pockethost`. Install with `npm i -g pockethost`; the command is `pockethost`. The `phio`
10
+ npm package is deprecated.
11
+ - Installs and runs on plain Node (>=20): the CLI ships as a single bundled `dist/cli.js` and no longer needs `tsx`
12
+ on your PATH (a clean `npm i -g phio@0.4.0` failed with `/usr/bin/env: 'tsx': No such file or directory`).
13
+ - New names, migrated automatically on first run:
14
+ - project file `.phioconfig` → `.pockethostconfig`
15
+ - config folder `~/.config/phio-nodejs` → `~/.config/pockethost` (Linux; macOS/Windows equivalents) (login and deploy key are copied over)
16
+ - environment variables `PHIO_*` → `POCKETHOST_*` (old names still work, with a warning)
17
+ - new deploy keys are labeled `PocketHost CLI`; existing `Phio` keys are reused
18
+ - Removed the undocumented library entry point (`main`/`types`); the package is CLI-only.
19
+ - `list` help text now says "List your instances".
20
+
21
+ ## 1.0.0 (never published; shipped as 3.0.0)
22
+
23
+ ### Major Changes
24
+
25
+ - SFTP-only deploy vendor: dropped legacy FTPS/FTP codepath and `basic-ftp` dependency
26
+ - Node `>=18` (hosting stack still requires Node 24)
27
+ - Dropped `fs-extra` and `email-validator`; leaner install
28
+
29
+ ## 0.4.0
4
30
 
5
31
  ### Minor Changes
6
32
 
7
- - 3c7e9bf: Added plugin template command and updated docs
33
+ - SFTP deploy and dev sync (`ftp.pockethost.io:2222`, Ed25519 key auth)
34
+ - `phio sftp` — interactive SFTP via system client (`--print` for the command line)
35
+ - Auto-provision deploy key labeled `Phio` under Account → Keys
36
+ - Project instance linking via `.phioconfig` (migrates legacy `package.json` / `pockethost.json`)
37
+ - Walk up to project root from subdirectories before sync
8
38
 
9
- ## 1.6.1
39
+ ## 0.3.5
10
40
 
11
41
  ### Patch Changes
12
42
 
13
- - dc8f70b: Updated docs
43
+ - Fix: add support for bun.lock
14
44
 
15
- ## 1.6.0
45
+ ## 0.3.4
16
46
 
17
- ### Minor Changes
47
+ ### Patch Changes
18
48
 
19
- - 40bbb3c: Improve tryFetch by accepting node-fetch params
20
- - 12f029a: Add changeset maker
21
- - b7277cf: Add public instance URL calculators and refactor HTTP protocol detection
22
- - 45a8f45: Add internal app (remote control) support
23
- - 55b43a1: Remove unneeded params from GetOrProvisionInstanceUrl filter
24
- - 5be2c9e: Initial commit
25
- - a236f3e: Added several more filters
26
- - 35edc77: Enhancement: actions execute sequentially
27
- - 879845a: Enhancement: unsubscribe from filters
28
- - c473ed9: Added support for priorities in actions
29
- - 795fcd7: New action: KillInstance
30
- - c32b845: Added support for Settings filter whereby all settings are collected and displayed in DEBUG() mode
31
- - cce72b3: New action: AfterPluginsLoaded
32
- - 82dde2d: Enhancement: filters now have extensible data types
33
-
34
- ### Patch Changes
35
-
36
- - b55c585: Clean up dead code
37
- - 0e4bf43: Updated commit parser deps
38
- - f79b067: Added serve command details
39
- - dd3ceaa: Added filter debugging
40
- - 7931204: Fixed a bug where adding plugins was not saved correctly
41
- - 6e14f57: Updated plugin authoring guide
42
- - 7604930: Minor fix to GetOrProvisionInstanceUrl filter
43
- - 52b70cb: Fixed bug where --extra-plugins was not defaulting to '' correctly
44
- - Updated dependencies [c32b845]
45
- - @pockethost/plugin-launcher-spawn@1.0.0
46
- - @pockethost/plugin-auto-admin@1.0.0
47
- - @pockethost/plugin-console-logger@1.0.0
48
-
49
- ## 1.5.0
49
+ - 24988ee: Feat: logout command
50
+ - de7168b: Fix: various auth fixes
51
+ - 6262058: Fix: use correct token for log watching
52
+ - 5d28256: Enhance logs command with improved streaming and error handling
50
53
 
51
- ### Minor Changes
54
+ ## 0.3.3
55
+
56
+ ### Patch Changes
57
+
58
+ - 4bf6d1e: Fix: use client auth token instead of stored token
59
+
60
+ ## 0.3.2
61
+
62
+ ### Patch Changes
63
+
64
+ - b85e156: Fix: nodev22 compat
52
65
 
53
- - 5e9ed51: Added `--extra-plugins` global switch to temporarily load extra plugins from CLI
54
- - 2376b0d: Add InstanceConfig filter, fix instance logger namespace, add core instance app lib
55
- - 737b4b8: logSettings now exported from core
56
- - 114b1d2: Add namespace() export to core Logger service
66
+ ## 0.3.1
57
67
 
58
68
  ### Patch Changes
59
69
 
60
- - 211fba6: Plugin authoring docs update
61
- - 675e634: Added docs and updated maildev with plugin hook guards
62
- - 3daf7f5: Fix: [INFO] logging prefixes
63
- - 139468f: Updated documentation
64
- - 1e5321b: Fix: improve plugin loading order
65
- - Updated dependencies [517f602]
66
- - @pockethost/plugin-launcher-spawn@0.3.0
67
- - @pockethost/plugin-console-logger@0.2.1
68
- - @pockethost/plugin-auto-admin@0.1.1
70
+ - fd128bc: Node v22 compat
69
71
 
70
- ## 1.4.0
72
+ ## 0.3.0
71
73
 
72
74
  ### Minor Changes
73
75
 
74
- - b7e4323: Added ability for plugins to respond to `pockethost serve`
76
+ - 82b4c6b: Add support for PHIO_USERNAME, PHIO_PASSWORD, and PHIO_INSTANCE_NAME env vars
77
+ - 82b4c6b: Migrate to instance names only (no IDs)
78
+ - 82b4c6b: Remove support for global instance name - local package.json or pockethost.json required now
75
79
 
76
- ## 1.3.2
80
+ ### Patch Changes
81
+
82
+ - 1b46e08: Alphabetize instance lists
83
+ - 82b4c6b: Improved error message reporting
84
+
85
+ ## 0.2.5
77
86
 
78
87
  ### Patch Changes
79
88
 
80
- - b0a78d8: Updated plugin authoring guide
81
- - ac63ea7: Updated plugin documentation
82
- - Updated dependencies [eb0d011]
83
- - Updated dependencies [38d2c93]
84
- - @pockethost/plugin-launcher-spawn@0.2.0
85
- - @pockethost/plugin-console-logger@0.2.0
86
- - @pockethost/plugin-auto-admin@0.1.0
89
+ - 283da4e: Add 'info' command
90
+ - b17fca2: Add error handling when 'link' returns no instances
91
+ - 8aaa611: Add 'ls' alias
87
92
 
88
- ## 1.3.1
93
+ ## 0.2.4
89
94
 
90
95
  ### Patch Changes
91
96
 
92
- - 8288197: Added plugin authoring guide
97
+ - Fix: --include and --exclude now parse comma separated values correctly
93
98
 
94
- ## 1.3.0
99
+ ## 0.2.3
95
100
 
96
- ### Minor Changes
101
+ ### Patch Changes
97
102
 
98
- - 96f355a: Now auto-creates first admin account by default
99
- - 2fc2eeb: Added before/after instance start/stop events
100
- - 3f99ea0: Added subdomain to request action and filter context
101
- - 1384a86: BREAKING: refactored actions/filters
103
+ - Fix: bad include path
104
+
105
+ ## 0.2.2
106
+
107
+ ### Patch Changes
108
+
109
+ - 467c4ba: Enh: Validate auth before tailing instance logs
110
+ - 4e8ddb5: Fix: auth token now stored correctly after refresh
111
+
112
+ ## 0.2.1
102
113
 
103
114
  ### Patch Changes
104
115
 
105
- - 6812784: Added improved error parsing support
106
- - da82667: Fix: properly determine hostname when running on nonstandard port
107
- - cc4aa02: Moved mothership-related code into mothership plugin
108
- - Updated dependencies [9d626ec]
109
- - @pockethost/plugin-launcher-spawn@0.1.0
110
- - @pockethost/plugin-console-logger@0.1.0
116
+ - Fix: Link now uses package.json
111
117
 
112
- ## 1.2.0
118
+ ## 0.2.0
113
119
 
114
120
  ### Minor Changes
115
121
 
116
- - 72a6c6d: --version now displays version number
117
- - ac10d1f: Display notification when new pockethost update is available.
118
- - f9aea10: Debugging info removed from `plugin ls`
122
+ - Introduced deploy command
119
123
 
120
124
  ### Patch Changes
121
125
 
122
- - 76d57f6: CHANGELOG.md is now published with package.
123
- - 3783447: plugin-console-logger and plugin-launcher-spawn are now automatically installed.
126
+ - Command refactoring
127
+
128
+ ## 0.1.2
124
129
 
125
- ## 1.1.0
130
+ ### Patch Changes
131
+
132
+ - Enh: add --verbose flag to dev mode
133
+
134
+ ## 0.1.1
135
+
136
+ ### Patch Changes
137
+
138
+ - Fix: include and exclude defaults
139
+
140
+ ## 0.1.0
126
141
 
127
142
  ### Minor Changes
128
143
 
129
- - 1695b59: New feature: list plugins (pockethost plugin ls)
144
+ - afc6e91: Added `link` command to link to a specific instance
145
+ - fff79df: pockethost.io now runs `bun install` when uploading a `bun.lockb`
146
+ - 9fc57d6: Added whoami command
147
+ - 9fc57d6: Added list command
148
+ - afc6e91: Added --include and --exclude options to dev watch mode
149
+
150
+ ### Patch Changes
151
+
152
+ - afc6e91: Fix: log tailer will now restart on disconnect
153
+ - fff79df: Enh: watcher now looks for package.json and bun.lockb
154
+ - fff79df: Fix: watcher was incorrectly applying --include and --exclude
155
+ - fff79df: Enh: watcher now queues successive deployments that happen in rapid succession
156
+
157
+ ## 0.0.2
158
+
159
+ ### Patch Changes
160
+
161
+ - Forgot tsx dep
162
+
163
+ ## 0.0.1
130
164
 
131
165
  ### Patch Changes
132
166
 
133
- - 2514c09: Fix: make sure PH_PLUGINS contains only unique values.
134
- - 1228840: Fixed extra newline when listing configs
167
+ - a5bf2f3: Initial version
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # pockethost: the PocketHost CLI
2
+
3
+ Deploy, sync, and tail logs for your [PocketHost](https://pockethost.io) instances.
4
+
5
+ Install globally (Node.js 20+):
6
+
7
+ ```bash
8
+ npm install -g pockethost
9
+ ```
10
+
11
+ ### Upgrading from `phio`
12
+
13
+ `phio` is now `pockethost`. Swap the package:
14
+
15
+ ```bash
16
+ npm rm -g phio && npm i -g pockethost
17
+ ```
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
20
+ renamed to `.pockethostconfig` (commit it), and the `PHIO_*` environment variables keep working with a warning until
21
+ you rename them to `POCKETHOST_*`.
22
+
23
+ ## Commands
24
+
25
+ ```bash
26
+ pockethost login
27
+ pockethost logout
28
+ pockethost info # alias: pockethost whoami
29
+ pockethost list # alias: pockethost ls
30
+ pockethost link [instance]
31
+ pockethost dev [instance]
32
+ pockethost deploy [instance]
33
+ pockethost sftp [instance]
34
+ pockethost logs [instance]
35
+ ```
36
+
37
+ - **`pockethost dev`**: watch local changes and sync over SFTP
38
+ - **`pockethost deploy`**: one-shot SFTP sync
39
+ - **`pockethost sftp`**: interactive SFTP session (uses system `sftp` when available)
40
+ - **`pockethost logs`**: tail instance logs
41
+
42
+ `dev` and `deploy` accept `-v/--verbose`, `-i/--include`, and `-e/--exclude`.
43
+
44
+ Default includes: `pb_*`, `package.json`, `bun.lock`, `bun.lockb`, `patches/**`.
45
+
46
+ Default excludes: `pb_data/**`.
47
+
48
+ ## Configuration
49
+
50
+ Link a project directory to an instance:
51
+
52
+ ```bash
53
+ pockethost link my-instance
54
+ ```
55
+
56
+ This writes `.pockethostconfig`:
57
+
58
+ ```json
59
+ {
60
+ "instanceName": "my-instance"
61
+ }
62
+ ```
63
+
64
+ Older project files (`.phioconfig`, `package.json` → `pockethost.instanceName`, `pockethost.json`) are migrated to
65
+ `.pockethostconfig` automatically on first use.
66
+
67
+ ## Deploy key
68
+
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
+
74
+ Customer docs: https://pockethost.io/docs/cli
75
+
76
+ ## Environment variables
77
+
78
+ | Variable | Purpose |
79
+ | -------- | ------- |
80
+ | `POCKETHOST_USERNAME` | Override saved email (non-interactive login) |
81
+ | `POCKETHOST_PASSWORD` | Override saved password |
82
+ | `POCKETHOST_INSTANCE_NAME` | Override linked instance name |
83
+ | `POCKETHOST_MOTHERSHIP_URL` | Override mothership API URL |
84
+ | `POCKETHOST_HOME` | Override config directory |
85
+ | `POCKETHOST_PROJECT_DIR` | Override project root detection |
86
+
87
+ 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.
89
+
90
+ ## Development (monorepo)
91
+
92
+ ```bash
93
+ pnpm dev:cli-client -- --help # from the repo root, runs src/ with tsx
94
+ pnpm --filter pockethost build # bundle to dist/cli.js
95
+ pnpm --filter pockethost test
96
+ ```