@vite-hub/cli 0.3.0 → 0.4.1
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 +23 -14
- package/dist/{commands-DPg3kL8m.js → commands-BQucvYlq.js} +560 -1232
- package/dist/{console-auth-xl7kLQNt.js → console-auth-B0HxFFiX.js} +2 -2
- package/dist/{console-env-C5YeAm2-.js → console-env-DSAuhgRZ.js} +3 -3
- package/dist/deploy-C0RdI5OK.js +1153 -0
- package/dist/{env-DzoVtVJO.js → env-B1Gg-WnA.js} +110 -40
- package/dist/{envelope-Cf56AJLa.js → envelope-B4mPbSbj.js} +1 -1
- package/dist/index.js +32 -13
- package/dist/{provision-D8OvBBzi.js → provision-DXl97xG0.js} +235 -174
- package/dist/setup/index.d.ts +55 -10
- package/dist/setup/index.js +11 -8
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @vite-hub/cli
|
|
2
2
|
|
|
3
|
-
[](https://npmx.dev/package/@vite-hub/cli)
|
|
4
|
+
[](https://npmx.dev/package/@vite-hub/cli)
|
|
5
|
+
[](https://github.com/vite-hub/vitehub/blob/main/LICENSE)
|
|
6
|
+
[](https://vitehub.dev/docs)
|
|
7
7
|
|
|
8
|
-
`@vite-hub/cli` runs the development commands contributed by a ViteHub project's active Vite plugins. It loads the local Vite or Nuxt config, combines their command namespaces, and adds the built-in `inspect` and `provision` namespaces.
|
|
8
|
+
`@vite-hub/cli` runs the development commands contributed by a ViteHub project's active Vite plugins. It loads the local Vite or Nuxt config, combines their command namespaces, and adds the built-in `inspect` and `provision` namespaces. User docs: [CLI](https://vitehub.dev/docs/cli).
|
|
9
9
|
|
|
10
10
|
## Choose the package
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ pnpm vitehub --help
|
|
|
18
18
|
|
|
19
19
|
`@vite-hub/cli` has no binary of its own. A custom entry calls `runViteHubCliEntrypoint()`, as the `vitehub` binary of `vite-hub` does. It requires Vite, and Nuxt when the project has a Nuxt config but no Vite config.
|
|
20
20
|
|
|
21
|
-
`@vite-hub/cli`
|
|
21
|
+
`@vite-hub/cli` and `vite-hub` require Node.js 24.15 or newer.
|
|
22
22
|
|
|
23
23
|
Print the installed CLI version without loading project config:
|
|
24
24
|
|
|
@@ -51,7 +51,7 @@ Available namespaces:
|
|
|
51
51
|
|
|
52
52
|
## Inspect the project
|
|
53
53
|
|
|
54
|
-
`inspect definitions` lists the Definitions that each active package discovered. The Console reads the same package-owned summaries. `inspect output` lists generated Provider Output files and shows which exist. `inspect resources` lists the D1, KV, R2, Queue, and Vercel Blob resources that Definitions map to, with each id and its source: config, env, Provision State, generated provider output, or bound by name. It never calls a provider API. `inspect routes` lists the server routes and middleware that ViteHub and other Vite plugins add to the build, with each method, path, owner, and handler file. Routes in `server/routes` and `server/api` are not listed. These three commands resolve Vite configuration for build with production mode and load Nuxt with development disabled, so production-only contributors are included. Other commands use development configuration.
|
|
54
|
+
`inspect definitions` lists the Definitions that each active package discovered. The Console reads the same package-owned summaries. `inspect output` lists generated Provider Output files and shows which exist. `inspect resources` lists the D1, KV, R2, Queue, and Vercel Blob resources that Definitions map to, with each id and its source: config, env, Provision State, generated provider output, or bound by name. It never calls a provider API. `inspect routes` lists the server routes and middleware that ViteHub and other Vite plugins add to the build, with each method, path, owner, and handler file. Routes in `server/routes` and `server/api` are not listed. These three commands resolve Vite configuration for build with production mode and load Nuxt with development disabled, so production-only contributors are included. `provision run` and `provision status` load the config of a build for their `--host` the same way as `vitehub deploy --host`: with `VITEHUB_HOST=<host>` and `VITEHUB_HOST_SOURCE=cli`, so a config that picks its stores with `detectHost()` plans the resources of that host. Other commands use development configuration.
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
57
|
pnpm vitehub inspect definitions --kind queue
|
|
@@ -72,7 +72,16 @@ pnpm vitehub agent invocations --help
|
|
|
72
72
|
|
|
73
73
|
The Agent integration contributes `info`, `dev`, and `invocations`, plus `channels history` and `channels sync`. It adds `eval` only when the project contains an Agent Eval file. Database contributes `generate` and `migrate`, and Workspace contributes `dev`. The Agent and Database integrations can disable their commands through their integration options.
|
|
74
74
|
|
|
75
|
-
See the [complete command index](https://vitehub.dev/docs/
|
|
75
|
+
See the [complete command index](https://vitehub.dev/docs/cli#commands) for command availability and the task each command performs.
|
|
76
|
+
|
|
77
|
+
## Update ViteHub packages
|
|
78
|
+
|
|
79
|
+
`vitehub update` moves `vite-hub` and every `@vite-hub/*` package to one version: the latest npm release, or the pkg.pr.new build of a commit with `--preview <commit>`. It edits the dependencies of every workspace package, npm, Yarn, Bun, and pnpm overrides, and catalogs, then installs. With pnpm it adds `vite-hub` and `@vite-hub/*` to `minimumReleaseAgeExclude` for a release, and sets `blockExoticSubdeps: false` for a preview.
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
pnpm vitehub update
|
|
83
|
+
pnpm vitehub update --preview 01898b8 --dry-run
|
|
84
|
+
```
|
|
76
85
|
|
|
77
86
|
## Link and deploy several hosts
|
|
78
87
|
|
|
@@ -85,9 +94,9 @@ pnpm vitehub deploy # the default target, cloudflare
|
|
|
85
94
|
pnpm vitehub deploy --host vercel
|
|
86
95
|
```
|
|
87
96
|
|
|
88
|
-
The first linked host is the default. `vitehub link --host <host> --default` changes it. `vitehub deploy --host <host>` builds with `VITEHUB_HOST=<host>`, and that host wins over `host` in `vitehub()`. With several targets and no default, deploy needs `--host`. Resources such as D1, KV, R2, and libSQL are separate on each host. See [Link a project to its host](https://vitehub.dev/docs/
|
|
97
|
+
The first linked host is the default. `vitehub link --host <host> --default` changes it. `vitehub deploy --host <host>` builds with `VITEHUB_HOST=<host>`, and that host wins over `host` in `vitehub()`. With several targets and no default, deploy needs `--host`. Resources such as D1, KV, R2, and libSQL are separate on each host. See [Link a project to its host](https://vitehub.dev/docs/cli/project#link-a-project-to-its-host).
|
|
89
98
|
|
|
90
|
-
On Cloudflare and Vercel, `vitehub deploy` first runs the provision plan of the host with the same credentials, including a `wrangler login`. It lists the resources it creates, asks first unless you pass `--yes`, and records their ids in `.vitehub/provision.json` before the build, so a second deploy creates nothing. `--no-provision` skips it. See [Create the host resources](https://vitehub.dev/docs/
|
|
99
|
+
On Cloudflare and Vercel, `vitehub deploy` first runs the provision plan of the host with the same credentials, including a `wrangler login`. It lists the resources it creates, asks first unless you pass `--yes`, and records their ids in `.vitehub/provision.json` before the build, so a second deploy creates nothing. `--no-provision` skips it. See [Create the host resources](https://vitehub.dev/docs/cli/project#create-the-host-resources).
|
|
91
100
|
|
|
92
101
|
## Check and push host env
|
|
93
102
|
|
|
@@ -99,11 +108,11 @@ pnpm vitehub env push --yes # values from the shell, then .env.pro
|
|
|
99
108
|
pnpm vitehub env diff --host vercel --stage preview
|
|
100
109
|
```
|
|
101
110
|
|
|
102
|
-
`env diff` compares names only, because hosts do not return values. It exits with 1 when a required name is missing. `env push` reads each value from the shell, then from `.env`, `.env.local`, `.env.<stage>`, and `.env.<stage>.local`, as Vite does. It decrypts dotenvx `encrypted:` values with `DOTENV_PRIVATE_KEY_<STAGE>`. It reads the files in the build's Vite `envDir`, refuses a plaintext secret from a file that git tracks or does not ignore (also through `$NAME` expansion and symlinks), sends each value on stdin or in an API body, prints names only, and never deletes a host variable. See [Check and push host env](https://vitehub.dev/docs/
|
|
111
|
+
`env diff` compares names only, because hosts do not return values. It exits with 1 when a required name is missing. `env push` reads each value from the shell, then from `.env`, `.env.local`, `.env.<stage>`, and `.env.<stage>.local`, as Vite does. It decrypts dotenvx `encrypted:` values with `DOTENV_PRIVATE_KEY_<STAGE>`. It reads the files in the build's Vite `envDir`, refuses a plaintext secret from a file that git tracks or does not ignore (also through `$NAME` expansion and symlinks), sends each value on stdin or in an API body, prints names only, and never deletes a host variable. See [Check and push host env](https://vitehub.dev/docs/cli/primitives#check-and-push-host-env).
|
|
103
112
|
|
|
104
|
-
`vitehub deploy` runs the same check after provisioning and the build, before migrations, env writes, or publishing code. `vitehub deploy` reads stage `production`, and `vitehub deploy --preview` reads stage `preview`. A required name that is on neither the host nor a local value stops the deploy. Deploy sets the names that the host lacks from their local values, and `--push-env` also replaces the names that the host has. Cloudflare gets the values with the new version through `wrangler deploy --secrets-file`. With `--yes`, deploy generates a missing `VITEHUB_SECRET`. See [Check Env before a deploy](https://vitehub.dev/docs/
|
|
113
|
+
`vitehub deploy` runs the same check after provisioning and the build, before migrations, env writes, or publishing code. `vitehub deploy` reads stage `production`, and `vitehub deploy --preview` reads stage `preview`. A required name that is on neither the host nor a local value stops the deploy. Deploy sets the names that the host lacks from their local values, and `--push-env` also replaces the names that the host has. Cloudflare gets the values with the new version through `wrangler deploy --secrets-file`. With `--yes`, deploy generates a missing `VITEHUB_SECRET`. See [Check Env before a deploy](https://vitehub.dev/docs/cli/project#check-env-before-a-deploy).
|
|
105
114
|
|
|
106
|
-
After the upload, `vitehub deploy` requests the paths of `deploy.check` in `vitehub()`, and the health route with `health`, on the deployed URL. When one does not answer with a `2xx` status, it exits with `SETUP_DEPLOY_CHECK_FAILED` and prints the command that rolls production back to the deployment it replaced, such as `npx wrangler rollback <version-id> --name my-app --yes`. With `deploy: { indexNow: true }` and a string `publicUrl`, a production deploy that passed its checks sends the URLs of `/sitemap.xml` to IndexNow. `--no-check` and `--no-index-now` skip them. See [Check the deployed app](https://vitehub.dev/docs/
|
|
115
|
+
After the upload, `vitehub deploy` requests the paths of `deploy.check` in `vitehub()`, and the health route with `health`, on the deployed URL. When one does not answer with a `2xx` status, it exits with `SETUP_DEPLOY_CHECK_FAILED` and prints the command that rolls production back to the deployment it replaced, such as `npx wrangler rollback <version-id> --name my-app --yes`. With `deploy: { indexNow: true }` and a string `publicUrl`, a production deploy that passed its checks sends the URLs of `/sitemap.xml` to IndexNow. `--no-check` and `--no-index-now` skip them. See [Check the deployed app](https://vitehub.dev/docs/cli/project#check-the-deployed-app).
|
|
107
116
|
|
|
108
117
|
`--to github` writes the same names to the Actions secrets of a GitHub repository instead of the host, for a deploy that your own workflow runs. It does not set up CI deploy. The repository comes from `--repo owner/name` or the git remote `origin`, `--environment <name>` targets a GitHub deployment environment, and the token comes from `GITHUB_TOKEN`, `GH_TOKEN`, `gh auth token`, or the GitHub App of `@vite-hub/forge`. Each value is sealed with the repository public key before it leaves the CLI.
|
|
109
118
|
|
|
@@ -149,6 +158,6 @@ CLI-owned argument and execution defects use stable `CLI_R####` Nostics codes. C
|
|
|
149
158
|
|
|
150
159
|
Status also marks an R2 or Queue entry when its key is still declared but its recorded bucket name, jurisdiction, or Queue name differs from current config. After a rename, status defers deletion guidance if a current declaration's resource cannot be verified against config, including when the new key already has a stale id. Verify D1 and KV ids against provider resource names and bindings before deleting anything. `provision run` refreshes R2 and Queue identities for comparison with config. R2 resource identities include jurisdiction; older entries with only a bucket name require checking the jurisdiction manually and receive no deletion guidance while an R2 Store remains declared.
|
|
151
160
|
|
|
152
|
-
Read the [CLI guide](https://vitehub.dev/docs/
|
|
161
|
+
Read the [CLI guide](https://vitehub.dev/docs/cli) for every public command, examples, and troubleshooting.
|
|
153
162
|
|
|
154
163
|
Cloudflare deploys always re-supply the stage’s local values, including existing Worker secrets, to prevent inheritance from a preview upload. Every existing secret needs a local stage value; otherwise deploy stops with `SETUP_DEPLOY_ENV_STAGE_UNSAFE`. This includes a previously generated `VITEHUB_SECRET`; supply a locally managed value for subsequent deploys.
|