@host0/cli 0.0.0-stage → 0.1.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 (3) hide show
  1. package/README.md +72 -2
  2. package/dist/host0.mjs +1751 -0
  3. package/package.json +35 -4
package/README.md CHANGED
@@ -1,3 +1,73 @@
1
- # Temporary Holding Version
1
+ # @host0/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Deploy and manage [host0](https://host0.ai) apps from the terminal. host0 is
4
+ hosting for whatever your agent creates: HTML, sites, apps with a shared
5
+ database, Markdown, PDFs — at a link you can share.
6
+
7
+ ```sh
8
+ npx @host0/cli deploy ./site # or: npm i -g @host0/cli && host0 deploy ./site
9
+ ```
10
+
11
+ Node 18.18 or newer, no dependencies. With no API key, `deploy` starts a device
12
+ login: it prints a link and a code and exits 3 — approve it in your browser,
13
+ then run the same command again.
14
+
15
+ ## Commands
16
+
17
+ | Command | Does |
18
+ |---|---|
19
+ | `host0 deploy <dir\|file>` (`publish`, or just `host0 <path>`) | Publish a folder or one file; prints the live URL. `--name --slug --app-id --visibility private\|link\|public --message --no-login --timeout <s>` |
20
+ | `host0 login [--wait] [--timeout <s>]` | Start (or re-show) a device login, exit 3; `--wait` waits for the approval and saves the key |
21
+ | `host0 logout` | Revoke the stored key and delete `~/.host0/credentials` |
22
+ | `host0 whoami` | Account email and plan |
23
+ | `host0 ls` | Your apps |
24
+ | `host0 inspect <app>` | URL, access, live version, shares |
25
+ | `host0 pull <app> [dir]` | Download the live files into a new folder; deploying it publishes the next version |
26
+ | `host0 versions <app>` | Versions, the live one marked |
27
+ | `host0 rollback <app> <version>` (`restore`) | Put an earlier version live again, as a new version |
28
+ | `host0 visibility <app> <private\|link\|public>` | Change who can open it |
29
+ | `host0 rename <app> [--slug s] [--name n]` | Rename the URL and/or display name |
30
+ | `host0 share <app> <email…>` / `host0 unshare <app> <email>` | Invite / remove people |
31
+ | `host0 rm <app> --yes` | Delete an app |
32
+ | `host0 analytics <app> [--period 24h\|7d\|30d\|90d\|365d]` | Visitors and page views |
33
+ | `host0 records <app> [collection] [--export]` | Shared data: collections, records, or the full JSON export |
34
+ | `host0 api <path> [-X METHOD] [-d json]` | Authenticated request to `/api/v1/…` on the base URL |
35
+
36
+ `<app>` is a slug or an app id. Global flags: `--json` (the API's JSON body,
37
+ unchanged, for the control commands), `--api-key`, `--base-url`,
38
+ `--allow-nonhost0-base-url`, `--client`, `--help`, `--version`.
39
+
40
+ ## Output contract
41
+
42
+ - **stdout** carries only the result: `deploy` prints the live URL, `pull` the
43
+ folder, control commands their answer (or the raw JSON with `--json`).
44
+ - **stderr** carries progress, warnings and `key=value` lines for agents:
45
+ `publish_result.*` (deploy), `pull_result.*` (pull), `login_result.*`
46
+ (device login). On an API error: ` - <problem>` lines,
47
+ `publish_result.error=<code>`, `publish_result.upgrade_url=…` when a plan
48
+ limit applies, then `error: <context>: <message>`.
49
+ - **Exit codes:** `0` ok · `1` error · `3` waiting for the user to approve a
50
+ sign-in · `130`/`143` interrupted (an app this run created but never put
51
+ live is deleted first).
52
+
53
+ ## Compatible with publish.sh
54
+
55
+ The CLI is the Node counterpart of the host0 skill's `publish.sh`, and an
56
+ agent can switch between them mid-project: same credentials file
57
+ (`~/.host0/credentials`, `$HOST0_API_KEY`, `--api-key`), same pending device
58
+ login (`~/.host0/device.json`), same per-folder `.host0/state.json`, same file
59
+ walk and content types, same stdout/stderr lines and exit codes. It sends
60
+ `x-host0-client: <agent>/cli-<version>` (publish.sh sends
61
+ `<agent>/<script version>`), only to the platform API — never to signed upload
62
+ or download URLs.
63
+
64
+ `HOST0_HOME` replaces `~/.host0` (tests use it so the real credentials are
65
+ never touched).
66
+
67
+ ## Develop
68
+
69
+ ```sh
70
+ npm install
71
+ npm run typecheck
72
+ npm test # builds dist/host0.mjs, then node --test
73
+ ```