powersync 0.8.0 → 0.9.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 (135) hide show
  1. package/LICENSE +67 -0
  2. package/README.md +1376 -173
  3. package/bin/dev.cmd +3 -3
  4. package/bin/dev.js +20 -7
  5. package/bin/run.cmd +3 -3
  6. package/bin/run.js +9 -5
  7. package/dist/api/cloud/create-cloud-instance.d.ts +15 -0
  8. package/dist/api/cloud/create-cloud-instance.js +19 -0
  9. package/dist/api/cloud/fetch-cloud-config.d.ts +12 -0
  10. package/dist/api/cloud/fetch-cloud-config.js +18 -0
  11. package/dist/api/cloud/fetch-cloud-sync-rules-content.d.ts +7 -0
  12. package/dist/api/cloud/fetch-cloud-sync-rules-content.js +26 -0
  13. package/dist/api/cloud/test-connection.d.ts +16 -0
  14. package/dist/api/cloud/test-connection.js +36 -0
  15. package/dist/api/cloud/validate-cloud-link-config.d.ts +17 -0
  16. package/dist/api/cloud/validate-cloud-link-config.js +47 -0
  17. package/dist/api/cloud/wait-for-operation.d.ts +16 -0
  18. package/dist/api/cloud/wait-for-operation.js +33 -0
  19. package/dist/api/cloud/write-cloud-link.d.ts +10 -0
  20. package/dist/api/cloud/write-cloud-link.js +21 -0
  21. package/dist/api/display-status.d.ts +4 -0
  22. package/dist/api/display-status.js +80 -0
  23. package/dist/api/ide/configure-vscode-ide.d.ts +14 -0
  24. package/dist/api/ide/configure-vscode-ide.js +62 -0
  25. package/dist/api/login-server.d.ts +26 -0
  26. package/dist/api/login-server.js +137 -0
  27. package/dist/api/run-validation-tests.d.ts +63 -0
  28. package/dist/api/run-validation-tests.js +202 -0
  29. package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.d.ts +7 -0
  30. package/dist/api/self-hosted/fetch-self-hosted-sync-rules-content.js +26 -0
  31. package/dist/commands/configure/ide.d.ts +8 -0
  32. package/dist/commands/configure/ide.js +58 -0
  33. package/dist/commands/configure/index.d.ts +8 -0
  34. package/dist/commands/configure/index.js +11 -0
  35. package/dist/commands/deploy/index.d.ts +48 -0
  36. package/dist/commands/deploy/index.js +333 -0
  37. package/dist/commands/deploy/service-config.d.ts +14 -0
  38. package/dist/commands/deploy/service-config.js +30 -0
  39. package/dist/commands/deploy/sync-config.d.ts +24 -0
  40. package/dist/commands/deploy/sync-config.js +103 -0
  41. package/dist/commands/destroy.d.ts +14 -0
  42. package/dist/commands/destroy.js +62 -0
  43. package/dist/commands/fetch/config.d.ts +14 -0
  44. package/dist/commands/fetch/config.js +33 -0
  45. package/dist/commands/fetch/index.d.ts +13 -0
  46. package/dist/commands/fetch/index.js +16 -0
  47. package/dist/commands/fetch/instances.d.ts +47 -0
  48. package/dist/commands/fetch/instances.js +177 -0
  49. package/dist/commands/fetch/status.d.ts +18 -0
  50. package/dist/commands/fetch/status.js +60 -0
  51. package/dist/commands/{instance/schema.d.ts → generate/index.d.ts} +3 -1
  52. package/dist/commands/generate/index.js +11 -0
  53. package/dist/commands/generate/schema.d.ts +19 -0
  54. package/dist/commands/generate/schema.js +72 -0
  55. package/dist/commands/generate/token.d.ts +25 -0
  56. package/dist/commands/generate/token.js +124 -0
  57. package/dist/commands/init/cloud.d.ts +11 -0
  58. package/dist/commands/init/cloud.js +64 -0
  59. package/dist/commands/{init.d.ts → init/index.d.ts} +2 -1
  60. package/dist/commands/init/index.js +11 -0
  61. package/dist/commands/init/self-hosted.d.ts +11 -0
  62. package/dist/commands/init/self-hosted.js +60 -0
  63. package/dist/commands/link/cloud.d.ts +15 -0
  64. package/dist/commands/link/cloud.js +111 -0
  65. package/dist/commands/{instance/config.d.ts → link/index.d.ts} +3 -1
  66. package/dist/commands/link/index.js +11 -0
  67. package/dist/commands/link/self-hosted.d.ts +12 -0
  68. package/dist/commands/link/self-hosted.js +54 -0
  69. package/dist/commands/login.d.ts +8 -0
  70. package/dist/commands/login.js +107 -0
  71. package/dist/commands/logout.d.ts +8 -0
  72. package/dist/commands/logout.js +19 -0
  73. package/dist/commands/migrate/index.d.ts +7 -0
  74. package/dist/commands/migrate/index.js +10 -0
  75. package/dist/commands/migrate/sync-rules.d.ts +15 -0
  76. package/dist/commands/migrate/sync-rules.js +51 -0
  77. package/dist/commands/{instances.d.ts → pull/index.d.ts} +3 -1
  78. package/dist/commands/pull/index.js +11 -0
  79. package/dist/commands/pull/instance.d.ts +14 -0
  80. package/dist/commands/pull/instance.js +108 -0
  81. package/dist/commands/status.d.ts +1 -0
  82. package/dist/commands/status.js +2 -0
  83. package/dist/commands/stop.d.ts +14 -0
  84. package/dist/commands/stop.js +62 -0
  85. package/dist/commands/validate.d.ts +16 -0
  86. package/dist/commands/validate.js +165 -0
  87. package/dist/help.d.ts +31 -0
  88. package/dist/help.js +123 -0
  89. package/oclif.manifest.json +1259 -330
  90. package/package.json +104 -75
  91. package/templates/cloud/powersync/cli.yaml +3 -0
  92. package/templates/cloud/powersync/service.yaml +174 -0
  93. package/templates/cloud/powersync/sync-config.yaml +22 -0
  94. package/templates/self-hosted/base/powersync/cli.yaml +3 -0
  95. package/templates/self-hosted/base/powersync/service.yaml +243 -0
  96. package/templates/self-hosted/base/powersync/sync-config.yaml +22 -0
  97. package/templates/vscode/settings.json +3 -0
  98. package/dist/commands/init.js +0 -66
  99. package/dist/commands/instance/config.js +0 -23
  100. package/dist/commands/instance/create.d.ts +0 -36
  101. package/dist/commands/instance/create.js +0 -137
  102. package/dist/commands/instance/deploy.d.ts +0 -21
  103. package/dist/commands/instance/deploy.js +0 -91
  104. package/dist/commands/instance/destroy.d.ts +0 -9
  105. package/dist/commands/instance/destroy.js +0 -46
  106. package/dist/commands/instance/generate-dev-token.d.ts +0 -10
  107. package/dist/commands/instance/generate-dev-token.js +0 -54
  108. package/dist/commands/instance/schema.js +0 -20
  109. package/dist/commands/instance/set.d.ts +0 -9
  110. package/dist/commands/instance/set.js +0 -31
  111. package/dist/commands/instance/status.d.ts +0 -12
  112. package/dist/commands/instance/status.js +0 -50
  113. package/dist/commands/instance/stop.d.ts +0 -9
  114. package/dist/commands/instance/stop.js +0 -42
  115. package/dist/commands/instance/sync-rules/deploy.d.ts +0 -10
  116. package/dist/commands/instance/sync-rules/deploy.js +0 -49
  117. package/dist/commands/instance/sync-rules/generate-schema.d.ts +0 -10
  118. package/dist/commands/instance/sync-rules/generate-schema.js +0 -56
  119. package/dist/commands/instance/sync-rules/validate.d.ts +0 -9
  120. package/dist/commands/instance/sync-rules/validate.js +0 -29
  121. package/dist/commands/instances.js +0 -29
  122. package/dist/commands.utils.d.ts +0 -2
  123. package/dist/commands.utils.js +0 -131
  124. package/dist/connection.utils.d.ts +0 -56
  125. package/dist/connection.utils.js +0 -76
  126. package/dist/constants.d.ts +0 -8
  127. package/dist/constants.js +0 -10
  128. package/dist/instance-command-flags.d.ts +0 -13
  129. package/dist/instance-command-flags.js +0 -22
  130. package/dist/service/accounts.client.js +0 -11307
  131. package/dist/service/powersync.client.js +0 -75510
  132. package/dist/service/types.js +0 -1
  133. package/dist/service/utils.js +0 -153
  134. package/dist/utils.d.ts +0 -14
  135. package/dist/utils.js +0 -68
package/README.md CHANGED
@@ -1,58 +1,926 @@
1
- # PowerSync CLI
1
+ # powersync
2
2
 
3
- Programmatically manage your [PowerSync](https://www.powersync.com/) environment.
3
+ Programmatically manage your PowerSync environment.
4
4
 
5
- For an overview, see the docs [here](https://docs.powersync.com/usage/tools/cli-beta).
5
+ For an overview, see the docs [here](https://docs.powersync.com/tools/cli).
6
+
7
+ ## Note: Beta Release
8
+
9
+ This package is currently in a [beta release](https://docs.powersync.com/resources/feature-status).
10
+
11
+ ## Upgrading from 0.8.0
12
+
13
+ Version 0.9.0 and above are **not backwards compatible** with 0.8.0. If you are using the previous CLI commands and are not ready to migrate, you can continue using the old version:
14
+
15
+ ```bash
16
+ npm install -g @powersync/cli@0.8.0
17
+ ```
18
+
19
+ Otherwise, refer to the [docs](https://docs.powersync.com/tools/cli) for guidance on migrating to the new version.
20
+
21
+ [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
22
+ [![Version](https://img.shields.io/npm/v/@powersync/cli.svg)](https://npmjs.org/package/@powersync/cli)
23
+ [![Downloads/week](https://img.shields.io/npm/dw/@powersync/cli.svg)](https://npmjs.org/package/@powersync/cli)
6
24
 
7
25
  <!-- toc -->
8
- ### Table of contents:
9
- * [Usage](#usage)
10
- * [Commands](#commands)
26
+
27
+ - [powersync](#powersync)
28
+ - [Getting Started](#getting-started)
29
+ - [Overview](#overview)
30
+ - [Cloud](#cloud)
31
+ - [Self-hosted](#self-hosted)
32
+ - [powersync/service.yaml (self-hosted instance config)](#powersyncserviceyaml-self-hosted-instance-config)
33
+ - [powersync/cli.yaml (self-hosted)](#powersynccliyaml-self-hosted)
34
+ - [Known Limitations](#known-limitations)
35
+ - [OCLIF plugins](#oclif-plugins)
36
+ - [list installed plugins](#list-installed-plugins)
37
+ - [install a published plugin](#install-a-published-plugin)
38
+ - [link a local plugin during development](#link-a-local-plugin-during-development)
39
+ - [inspect a plugin](#inspect-a-plugin)
40
+ - [Usage](#usage)
41
+ - [Commands](#commands)
11
42
  <!-- tocstop -->
12
43
 
44
+ # Getting Started
45
+
46
+ Install globally or run via `npx`:
47
+
48
+ ```bash
49
+ npm install -g powersync
50
+ ```
51
+
52
+ ```bash
53
+ npx powersync --version
54
+ ```
55
+
56
+ # Overview
57
+
58
+ The PowerSync CLI lets you manage PowerSync instances and run commands (generate schemas, tokens, validate config, fetch status, and more). Support is split into two modes:
59
+
60
+ - **Cloud** – Full support for [PowerSync Cloud](https://powersync.com). You can create new instances, deploy and pull config from the Dashboard, and run all Cloud commands. Authenticate with **`powersync login`** (or the `PS_ADMIN_TOKEN` env var), then use **`powersync init cloud`** / **`powersync link cloud`** or **`powersync pull instance`** to work with projects.
61
+ - **Self-hosted** – Limited support for your own PowerSync Service. You link to an existing running instance and can run a subset of commands (e.g. **`powersync status`**, **`powersync generate schema`**, **`powersync validate`**). The CLI does not create, deploy to, or pull config from self-hosted instances; you manage the server and its config yourself. We also expose a [PowerSync Docker topic](../plugins/docker/README.md) for local self-hosted development.
62
+
63
+ The sections below go into detail for [Cloud](#cloud) and [Self-hosted](#self-hosted).
64
+
65
+ # Cloud
66
+
67
+ The CLI supports **PowerSync Cloud** for creating instances, deploying config, pulling config, and running commands. Cloud workflows use a **config directory** (default `powersync/`) containing **`service.yaml`**, **`sync-config.yaml`**, and optionally **`cli.yaml`** (the link file written by **powersync link cloud**). All PowerSync YAML files support the **`!env`** custom tag (e.g. `!env MY_VAR` or `!env MY_VAR::number`) for secrets and environment-specific values.
68
+
69
+ ## Login
70
+
71
+ Cloud commands require a PowerSync **personal access token (PAT)**. You can authenticate in two ways:
72
+
73
+ **1. Interactive login (recommended for local use)**
74
+ Run **`powersync login`**. You can either open a browser to create a token in the [PowerSync Dashboard](https://dashboard.powersync.com/account/access-tokens/create) or paste an existing token.
75
+
76
+ - If secure storage is available, the token is saved there (for example, macOS Keychain).
77
+ - If secure storage is unavailable, the CLI asks for confirmation before storing the token in plaintext at **`$XDG_CONFIG_HOME/powersync/config.yaml`** (or **`~/.config/powersync/config.yaml`** when `XDG_CONFIG_HOME` is unset).
78
+ - If you decline, login exits without storing a token.
79
+
80
+ **2. Environment variable (CI, scripts, or non-persistent use)**
81
+ Set **`PS_ADMIN_TOKEN`** to your PAT. The CLI uses **`PS_ADMIN_TOKEN`** when set; otherwise it uses the token from **`powersync login`**. Example:
82
+
83
+ ```sh
84
+ export PS_ADMIN_TOKEN=your-personal-access-token
85
+ powersync fetch instances
86
+ ```
87
+
88
+ To stop using stored credentials, run **`powersync logout`**. This clears the stored token from the active backend (secure storage or config-file fallback).
89
+
90
+ ## Creating a new instance
91
+
92
+ Run **`powersync init cloud`** to scaffold the config directory. Configure **`service.yaml`** (name, region, replication, optional client auth) and sync config; use **`!env`** for all secrets. Then run **`powersync link cloud --create`** with `--project-id` to create the instance and write **`cli.yaml`**. (Add `--org-id` only if your token has access to multiple organizations.) After that you can run **`powersync deploy`** and manage config from the project (or switch to managing it externally if you prefer).
93
+
94
+ ```sh
95
+ powersync init cloud
96
+ # then edit powersync/service.yaml and sync config
97
+ powersync login
98
+ powersync link cloud --create --project-id=<project-id> # add --org-id if token has multiple orgs
99
+ powersync deploy
100
+ ```
101
+
102
+ Use `--directory` for a different config folder. The **powersync init cloud** command has a `--vscode` flag to configure your workspace for YAML custom tag support.
103
+
104
+ ## Cloud secrets format (`service.yaml`)
105
+
106
+ For Cloud config, secret-backed fields use an object shape. For example, the replication connection password is configured as `replication.connections[].password`.
107
+
108
+ Use `secret: !env ...` when you want to provide the value from an environment variable during deploy:
109
+
110
+ ```yaml
111
+ replication:
112
+ connections:
113
+ - type: postgresql
114
+ password:
115
+ secret: !env POWERSYNC_DATABASE_PASSWORD
116
+ ```
117
+
118
+ After an initial deploy, you can keep using the same stored value by switching to `secret_ref` and referencing the default password secret:
119
+
120
+ ```yaml
121
+ replication:
122
+ connections:
123
+ - type: postgresql
124
+ password:
125
+ secret_ref: default_password
126
+ ```
127
+
128
+ This avoids re-supplying the raw password in subsequent deploys while reusing the previously stored secret.
129
+
130
+ ## Using an existing instance (pull)
131
+
132
+ Run **`powersync pull instance`** with the instance identifiers (from the PowerSync Dashboard URL or **`powersync fetch instances`**). This creates the config directory, writes **`cli.yaml`**, and downloads **`service.yaml`** and **`sync-config.yaml`**. Edit as needed, then run **`powersync deploy`**.
133
+
134
+ ```sh
135
+ powersync login
136
+ powersync pull instance --project-id=<project-id> --instance-id=<instance-id> # add --org-id if multiple orgs
137
+ # then edit powersync/service.yaml and sync-config.yaml as needed
138
+ powersync deploy
139
+ ```
140
+
141
+ To refresh local config after external edits from the cloud when already linked, run **`powersync pull instance`** again.
142
+
143
+ ## Running commands against externally managed instances
144
+
145
+ You can run CLI commands (e.g. **`powersync generate schema`**, **`powersync generate token`**, **`powersync status`**) against a Cloud instance whose configuration is managed elsewhere—for example in the PowerSync Dashboard. No local config directory or link file is required.
146
+
147
+ Specify the instance using **environment variables** or **CLI flags** (flags take precedence): `--instance-id` and `--project-id` (or `INSTANCE_ID`, `PROJECT_ID`). **`--org-id` is optional**: when omitted, the CLI uses the token’s single organization if the token has access to exactly one; if the token has multiple orgs, you must pass **`--org-id`** (or set `ORG_ID`).
148
+
149
+ ```sh
150
+ powersync login
151
+ powersync generate schema --instance-id=<id> --project-id=<project-id> --output-path=schema.ts --output=ts # add --org-id if multiple orgs
152
+ # or with env vars (set ORG_ID only if your token has multiple orgs):
153
+ export PROJECT_ID=<project-id>
154
+ export INSTANCE_ID=<instance-id>
155
+ powersync generate schema --output-path=schema.ts --output=ts
156
+ ```
157
+
158
+ **Tip:** To avoid passing instance params on every command, run **`powersync link cloud`** (e.g. `powersync link cloud --instance-id=<id> --project-id=<project-id>`) once. The CLI writes `cli.yaml` in the current directory, and subsequent commands use that instance without flags or env vars.
159
+
160
+ # Self-hosted
161
+
162
+ The CLI can run a subset of commands against **self-hosted** PowerSync instances (your own API). Self-hosted support is more limited than Cloud: you link to an existing running API and use the same config directory concept, but only certain commands apply (e.g. **`powersync status`**, **`powersync generate schema`**, **`powersync generate token`**, **`powersync validate`**). There is no **deploy** or **pull instance** for self-hosted; you manage config on the server yourself.
163
+
164
+ ## Authentication
165
+
166
+ For any self-hosted instance (local or remote), you must link the running API to the CLI and configure an API key. On the **server** (your PowerSync instance config), define the tokens that are valid in **`service.yaml`**:
167
+
168
+ ```yaml
169
+ # powersync/service.yaml (self-hosted instance config)
170
+ api:
171
+ tokens:
172
+ - dev-token-do-not-use-in-production # or use !env MY_API_TOKEN for secrets
173
+ ```
174
+
175
+ Then tell the CLI which token to use when running commands. Run **`powersync link self-hosted --api-url <url>`** to write **`cli.yaml`** with the API URL, and either set the **`PS_ADMIN_TOKEN`** environment variable or set **`api_key`** in **`cli.yaml`**:
176
+
177
+ ```yaml
178
+ # powersync/cli.yaml (self-hosted)
179
+ type: self-hosted
180
+ api_url: https://powersync.example.com
181
+ api_key: !env PS_ADMIN_TOKEN # or a literal value matching one of the tokens in service.yaml
182
+ ```
183
+
184
+ The CLI resolves **`!env PS_ADMIN_TOKEN`** from the `PS_ADMIN_TOKEN` environment variable at runtime. If both are set, the environment variable takes precedence.
185
+
186
+ ## Creating a self-hosted project and limitations
187
+
188
+ Run **`powersync init self-hosted`** to scaffold a config directory. Edit **`service.yaml`** with your instance details and use **`!env`** for secrets. This gives you a **partial** project: the CLI does not create or provision a self-hosted instance. You must already have a running PowerSync API. The CLI cannot deploy config to or pull config from a self-hosted instance; you manage **`service.yaml`** and **`sync-config.yaml`** on the server yourself. Use the CLI to link (**`powersync link self-hosted --api-url <url>`**), then run the supported commands (e.g. **`powersync status`**, **`powersync generate schema`**) against that API.
189
+
190
+ ```sh
191
+ powersync init self-hosted
192
+ # then edit powersync/service.yaml
193
+ powersync link self-hosted --api-url https://powersync.example.com
194
+ powersync status
195
+ ```
196
+
197
+ Use `--directory` for a different config folder.
198
+
199
+ ## PowerSync Docker topic for local development
200
+
201
+ We expose a [PowerSync Docker topic](../plugins/docker/README.md) for running a self-hosted stack locally. Use **`powersync docker configure`** then **`powersync docker start`** to run the stack. Use **`powersync docker reset`** only when you need to start from a clean state (stop and remove, then start).
202
+
203
+ ## Command support
204
+
205
+ Only some CLI commands work with self-hosted instances. Supported commands include **`powersync status`**, **`powersync generate schema`**, **`powersync generate token`**, **`powersync validate`**, and **`powersync link self-hosted`**. Cloud-only commands such as **`powersync deploy`**, **`powersync destroy`**, **`powersync pull instance`**, **`powersync fetch config`**, and **`powersync fetch instances`** do not apply to self-hosted.
206
+
207
+ # Known Limitations
208
+
209
+ - **Plaintext fallback storage**: When secure storage is unavailable, login can store the token in plaintext config (`$XDG_CONFIG_HOME/powersync/config.yaml` or `~/.config/powersync/config.yaml`) only after explicit confirmation.
210
+
211
+ # OCLIF plugins
212
+
213
+ The CLI honors standard [OCLIF plugin behavior](https://oclif.io/docs/plugins/), so plugins can register commands or hook into command lifecycles. The bundled PowerSync Docker topic (`@powersync/cli-plugin-docker`) is implemented this way and serves as a reference.
214
+
215
+ For PowerSync-specific plugins, the optional `@powersync/cli-core` package exposes base command helpers and shared types; the PowerSync Docker topic consumes these helpers to add its Docker-focused commands.
216
+
217
+ You can manage plugins dynamically at runtime:
218
+
219
+ ```sh
220
+ # list installed plugins
221
+ powersync plugins
222
+
223
+ # install a published plugin
224
+ powersync plugins install @example/powersync-plugin-foo
225
+
226
+ # link a local plugin during development
227
+ powersync plugins link ../my-plugin
228
+
229
+ # inspect a plugin
230
+ powersync plugins:inspect @example/powersync-plugin-foo
231
+ ```
232
+
13
233
  # Usage
234
+
14
235
  <!-- usage -->
236
+
15
237
  ```sh-session
16
- $ npx powersync
17
- $ npx powersync COMMAND
238
+ $ npm install -g powersync
239
+ $ powersync COMMAND
18
240
  running command...
19
- $ npx powersync --help [COMMAND]
241
+ $ powersync (--version)
242
+ powersync/0.9.0 darwin-arm64 node-v24.13.0
243
+ $ powersync --help [COMMAND]
20
244
  USAGE
21
- $ npx powersync COMMAND
245
+ $ powersync COMMAND
22
246
  ...
23
247
  ```
248
+
24
249
  <!-- usagestop -->
25
- ## Inject ENV variables
26
250
 
27
- The following environment variables can be injected:
251
+ ## Environment variables
252
+
253
+ You can supply instance and auth context via environment variables (useful for CI or scripts):
28
254
 
29
- * `AUTH_TOKEN` - The access token used to authenticate with the PowerSync service. [Learn more](https://docs.powersync.com/usage/tools/cli#personal-access-token).
30
- * `ORG_ID` - The PowerSync organization ID. This is the first UUID in your project's dashboard URL. `123` in this example: `https://powersync.journeyapps.com/org/123/app/456`.
31
- * `PROJECT_ID` - The PowerSync project ID. This is the second UUID in your project's dashboard URL. `456` in this example: `https://powersync.journeyapps.com/org/123/app/456`.
32
- * `INSTANCE_ID` - The PowerSync instance ID. Get this by running `npx powersync instances`.
255
+ - **`PS_ADMIN_TOKEN`** — PowerSync personal access token for Cloud commands. [Learn more](https://docs.powersync.com/usage/tools/cli#personal-access-token).
256
+ - **`ORG_ID`** — Organization ID (optional for Cloud). Omit when your token has a single organization; required when it has multiple.
257
+ - **`PROJECT_ID`** — Project ID (Cloud).
258
+ - **`INSTANCE_ID`** — Instance ID (Cloud). Get IDs from the [PowerSync Dashboard](https://dashboard.powersync.com) or **`powersync fetch instances`**.
259
+ - **`API_URL`** — Self-hosted PowerSync API base URL (e.g. `https://powersync.example.com`).
33
260
 
34
- Example:
261
+ Example (Cloud):
35
262
 
36
- `ORG_ID=123 PROJECT_ID=456 INSTANCE_ID=789 npx powersync instance status`
263
+ ```sh
264
+ PS_ADMIN_TOKEN=your-token PROJECT_ID=456 INSTANCE_ID=789 powersync status
265
+ ```
266
+
267
+ See [docs/usage.md](../docs/usage.md) for full usage and resolution order (flags, env, cli.yaml).
37
268
 
38
269
  # Commands
39
270
 
40
271
  <!-- commands -->
41
- * [`powersync help [COMMAND]`](#powersync-help-command)
42
- * [`powersync init`](#powersync-init)
43
- * [`powersync instance config`](#powersync-instance-config)
44
- * [`powersync instance create`](#powersync-instance-create)
45
- * [`powersync instance deploy`](#powersync-instance-deploy)
46
- * [`powersync instance destroy`](#powersync-instance-destroy)
47
- * [`powersync instance generate-dev-token`](#powersync-instance-generate-dev-token)
48
- * [`powersync instance schema`](#powersync-instance-schema)
49
- * [`powersync instance set`](#powersync-instance-set)
50
- * [`powersync instance status`](#powersync-instance-status)
51
- * [`powersync instance stop`](#powersync-instance-stop)
52
- * [`powersync instance sync-rules deploy`](#powersync-instance-sync-rules-deploy)
53
- * [`powersync instance sync-rules generate-schema`](#powersync-instance-sync-rules-generate-schema)
54
- * [`powersync instance sync-rules validate`](#powersync-instance-sync-rules-validate)
55
- * [`powersync instances`](#powersync-instances)
272
+
273
+ - [`powersync autocomplete [SHELL]`](#powersync-autocomplete-shell)
274
+ - [`powersync commands`](#powersync-commands)
275
+ - [`powersync configure ide`](#powersync-configure-ide)
276
+ - [`powersync deploy`](#powersync-deploy)
277
+ - [`powersync deploy service-config`](#powersync-deploy-service-config)
278
+ - [`powersync deploy sync-config`](#powersync-deploy-sync-config)
279
+ - [`powersync destroy`](#powersync-destroy)
280
+ - [`powersync docker configure`](#powersync-docker-configure)
281
+ - [`powersync docker reset`](#powersync-docker-reset)
282
+ - [`powersync docker start`](#powersync-docker-start)
283
+ - [`powersync docker stop`](#powersync-docker-stop)
284
+ - [`powersync edit config`](#powersync-edit-config)
285
+ - [`powersync fetch config`](#powersync-fetch-config)
286
+ - [`powersync fetch instances`](#powersync-fetch-instances)
287
+ - [`powersync fetch status`](#powersync-fetch-status)
288
+ - [`powersync generate schema`](#powersync-generate-schema)
289
+ - [`powersync generate token`](#powersync-generate-token)
290
+ - [`powersync help [COMMAND]`](#powersync-help-command)
291
+ - [`powersync init cloud`](#powersync-init-cloud)
292
+ - [`powersync init self-hosted`](#powersync-init-self-hosted)
293
+ - [`powersync link cloud`](#powersync-link-cloud)
294
+ - [`powersync link self-hosted`](#powersync-link-self-hosted)
295
+ - [`powersync login`](#powersync-login)
296
+ - [`powersync logout`](#powersync-logout)
297
+ - [`powersync migrate sync-rules`](#powersync-migrate-sync-rules)
298
+ - [`powersync plugins`](#powersync-plugins)
299
+ - [`powersync plugins add PLUGIN`](#powersync-plugins-add-plugin)
300
+ - [`powersync plugins:inspect PLUGIN...`](#powersync-pluginsinspect-plugin)
301
+ - [`powersync plugins install PLUGIN`](#powersync-plugins-install-plugin)
302
+ - [`powersync plugins link PATH`](#powersync-plugins-link-path)
303
+ - [`powersync plugins remove [PLUGIN]`](#powersync-plugins-remove-plugin)
304
+ - [`powersync plugins reset`](#powersync-plugins-reset)
305
+ - [`powersync plugins uninstall [PLUGIN]`](#powersync-plugins-uninstall-plugin)
306
+ - [`powersync plugins unlink [PLUGIN]`](#powersync-plugins-unlink-plugin)
307
+ - [`powersync plugins update`](#powersync-plugins-update)
308
+ - [`powersync pull instance`](#powersync-pull-instance)
309
+ - [`powersync status`](#powersync-status)
310
+ - [`powersync stop`](#powersync-stop)
311
+ - [`powersync validate`](#powersync-validate)
312
+
313
+ ## `powersync autocomplete [SHELL]`
314
+
315
+ Display autocomplete installation instructions.
316
+
317
+ ```
318
+ USAGE
319
+ $ powersync autocomplete [SHELL] [-r]
320
+
321
+ ARGUMENTS
322
+ [SHELL] (zsh|bash|powershell) Shell type
323
+
324
+ FLAGS
325
+ -r, --refresh-cache Refresh cache (ignores displaying instructions)
326
+
327
+ DESCRIPTION
328
+ Display autocomplete installation instructions.
329
+
330
+ EXAMPLES
331
+ $ powersync autocomplete
332
+
333
+ $ powersync autocomplete bash
334
+
335
+ $ powersync autocomplete zsh
336
+
337
+ $ powersync autocomplete powershell
338
+
339
+ $ powersync autocomplete --refresh-cache
340
+ ```
341
+
342
+ _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v3.2.40/src/commands/autocomplete/index.ts)_
343
+
344
+ ## `powersync commands`
345
+
346
+ List all powersync commands.
347
+
348
+ ```
349
+ USAGE
350
+ $ powersync commands [--json] [-c id|plugin|summary|type... | --tree] [--deprecated] [-x | ] [--hidden]
351
+ [--no-truncate | ] [--sort id|plugin|summary|type | ]
352
+
353
+ FLAGS
354
+ -c, --columns=<option>... Only show provided columns (comma-separated).
355
+ <options: id|plugin|summary|type>
356
+ -x, --extended Show extra columns.
357
+ --deprecated Show deprecated commands.
358
+ --hidden Show hidden commands.
359
+ --no-truncate Do not truncate output.
360
+ --sort=<option> [default: id] Property to sort by.
361
+ <options: id|plugin|summary|type>
362
+ --tree Show tree of commands.
363
+
364
+ GLOBAL FLAGS
365
+ --json Format output as json.
366
+
367
+ DESCRIPTION
368
+ List all powersync commands.
369
+ ```
370
+
371
+ _See code: [@oclif/plugin-commands](https://github.com/oclif/plugin-commands/blob/v4.1.40/src/commands/commands.ts)_
372
+
373
+ ## `powersync configure ide`
374
+
375
+ Configure your IDE for the best PowerSync CLI developer experience.
376
+
377
+ ```
378
+ USAGE
379
+ $ powersync configure ide
380
+
381
+ DESCRIPTION
382
+ Configure your IDE for the best PowerSync CLI developer experience.
383
+
384
+ Configure or guide your IDE setup for the best PowerSync CLI developer experience. Enables YAML schema validation and
385
+ autocompletion, sets up !env custom tag support, and patches existing config files with language server directives.
386
+
387
+ EXAMPLES
388
+ $ powersync configure ide
389
+ ```
390
+
391
+ _See code: [src/commands/configure/ide.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/configure/ide.ts)_
392
+
393
+ ## `powersync deploy`
394
+
395
+ [Cloud only] Deploy local config to the linked Cloud instance (connections + auth + sync config).
396
+
397
+ ```
398
+ USAGE
399
+ $ powersync deploy [--deploy-timeout <value>] [--directory <value>] [--instance-id <value> --project-id
400
+ <value>] [--org-id <value>]
401
+
402
+ FLAGS
403
+ --deploy-timeout=<value> [default: 300] Seconds to wait after scheduling a deploy before timing out while polling
404
+ status (default 300 seconds).
405
+
406
+ PROJECT FLAGS
407
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
408
+ required if multiple powersync config files are present in subdirectories of the current working
409
+ directory.
410
+
411
+ CLOUD_PROJECT FLAGS
412
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
413
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
414
+ explicitly if the token has multiple orgs.
415
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
416
+
417
+ DESCRIPTION
418
+ [Cloud only] Deploy local config to the linked Cloud instance (connections + auth + sync config).
419
+
420
+ Deploy local config (service.yaml, sync config) to the linked PowerSync Cloud instance.
421
+ Validates connections and sync config before deploying.
422
+ See also powersync deploy sync-config to deploy only sync config changes.
423
+ See also powersync deploy service-config to deploy only service config changes.
424
+
425
+ EXAMPLES
426
+ $ powersync deploy
427
+
428
+ $ powersync deploy --instance-id=<id> --project-id=<id>
429
+ ```
430
+
431
+ _See code: [src/commands/deploy/index.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/deploy/index.ts)_
432
+
433
+ ## `powersync deploy service-config`
434
+
435
+ [Cloud only] Deploy only local service config to the linked Cloud instance.
436
+
437
+ ```
438
+ USAGE
439
+ $ powersync deploy service-config [--deploy-timeout <value>] [--directory <value>] [--instance-id <value> --project-id
440
+ <value>] [--org-id <value>]
441
+
442
+ FLAGS
443
+ --deploy-timeout=<value> [default: 300] Seconds to wait after scheduling a deploy before timing out while polling
444
+ status (default 300 seconds).
445
+
446
+ PROJECT FLAGS
447
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
448
+ required if multiple powersync config files are present in subdirectories of the current working
449
+ directory.
450
+
451
+ CLOUD_PROJECT FLAGS
452
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
453
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
454
+ explicitly if the token has multiple orgs.
455
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
456
+
457
+ DESCRIPTION
458
+ [Cloud only] Deploy only local service config to the linked Cloud instance.
459
+
460
+ Deploy only service config changes (without sync config updates).
461
+
462
+ EXAMPLES
463
+ $ powersync deploy service-config
464
+
465
+ $ powersync deploy service-config --instance-id=<id> --project-id=<id>
466
+ ```
467
+
468
+ _See code: [src/commands/deploy/service-config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/deploy/service-config.ts)_
469
+
470
+ ## `powersync deploy sync-config`
471
+
472
+ [Cloud only] Deploy only local sync config to the linked Cloud instance.
473
+
474
+ ```
475
+ USAGE
476
+ $ powersync deploy sync-config [--deploy-timeout <value>] [--directory <value>] [--instance-id <value> --project-id
477
+ <value>] [--org-id <value>] [--sync-config-file-path <value>]
478
+
479
+ FLAGS
480
+ --deploy-timeout=<value> [default: 300] Seconds to wait after scheduling a deploy before timing out while
481
+ polling status (default 300 seconds).
482
+ --sync-config-file-path=<value> Path to a sync config file. If provided, this file will be validated and deployed
483
+ instead of the default sync-config.yaml.
484
+
485
+ PROJECT FLAGS
486
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
487
+ required if multiple powersync config files are present in subdirectories of the current working
488
+ directory.
489
+
490
+ CLOUD_PROJECT FLAGS
491
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
492
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
493
+ explicitly if the token has multiple orgs.
494
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
495
+
496
+ DESCRIPTION
497
+ [Cloud only] Deploy only local sync config to the linked Cloud instance.
498
+
499
+ Deploy only sync config changes.
500
+
501
+ EXAMPLES
502
+ $ powersync deploy sync-config
503
+
504
+ $ powersync deploy sync-config --instance-id=<id> --project-id=<id>
505
+ ```
506
+
507
+ _See code: [src/commands/deploy/sync-config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/deploy/sync-config.ts)_
508
+
509
+ ## `powersync destroy`
510
+
511
+ [Cloud only] Permanently destroy the linked Cloud instance.
512
+
513
+ ```
514
+ USAGE
515
+ $ powersync destroy [--confirm yes] [--directory <value>] [--instance-id <value> --project-id <value>]
516
+ [--org-id <value>]
517
+
518
+ FLAGS
519
+ --confirm=<option> Set to "yes" to confirm destruction of the instance.
520
+ <options: yes>
521
+
522
+ PROJECT FLAGS
523
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
524
+ required if multiple powersync config files are present in subdirectories of the current working
525
+ directory.
526
+
527
+ CLOUD_PROJECT FLAGS
528
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
529
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
530
+ explicitly if the token has multiple orgs.
531
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
532
+
533
+ DESCRIPTION
534
+ [Cloud only] Permanently destroy the linked Cloud instance.
535
+
536
+ Permanently delete the linked PowerSync Cloud instance and its data. Requires --confirm=yes.
537
+
538
+ EXAMPLES
539
+ $ powersync destroy
540
+
541
+ $ powersync destroy --confirm=yes
542
+ ```
543
+
544
+ _See code: [src/commands/destroy.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/destroy.ts)_
545
+
546
+ ## `powersync docker configure`
547
+
548
+ Configures a self hosted project with Docker Compose services.
549
+
550
+ ```
551
+ USAGE
552
+ $ powersync docker configure [--directory <value>] [--api-url <value>] [--database postgres|external|none]
553
+ [--storage postgres|external|none]
554
+
555
+ FLAGS
556
+ --database=<option> Database module for replication source. Omit to be prompted.
557
+ <options: postgres|external|none>
558
+ --storage=<option> Storage module for PowerSync bucket metadata. Omit to be prompted.
559
+ <options: postgres|external|none>
560
+
561
+ SELF_HOSTED_PROJECT FLAGS
562
+ --api-url=<value> PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.
563
+
564
+ PROJECT FLAGS
565
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
566
+ required if multiple powersync config files are present in subdirectories of the current working
567
+ directory.
568
+
569
+ DESCRIPTION
570
+ Configures a self hosted project with Docker Compose services.
571
+
572
+ Configures a self hosted project with Docker Compose services.
573
+ Docker configuration is located in ./powersync/docker/.
574
+ Configured projects can be started with "powersync docker start".
575
+
576
+ EXAMPLES
577
+ $ powersync docker configure
578
+
579
+ $ powersync docker configure --database=postgres --storage=postgres
580
+ ```
581
+
582
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/docker/configure.ts)_
583
+
584
+ ## `powersync docker reset`
585
+
586
+ Reset the self-hosted PowerSync stack (stop and remove, then start).
587
+
588
+ ```
589
+ USAGE
590
+ $ powersync docker reset [--directory <value>] [--api-url <value>]
591
+
592
+ SELF_HOSTED_PROJECT FLAGS
593
+ --api-url=<value> PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.
594
+
595
+ PROJECT FLAGS
596
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
597
+ required if multiple powersync config files are present in subdirectories of the current working
598
+ directory.
599
+
600
+ DESCRIPTION
601
+ Reset the self-hosted PowerSync stack (stop and remove, then start).
602
+
603
+ Run `docker compose down` then `docker compose up -d --wait`: stops and removes containers, then starts the stack and
604
+ waits for services (including PowerSync) to be healthy. Use when you want a clean bring-up (e.g. after config
605
+ changes). Use `powersync status` to debug running instances.
606
+
607
+ EXAMPLES
608
+ $ powersync docker reset
609
+ ```
610
+
611
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/docker/reset.ts)_
612
+
613
+ ## `powersync docker start`
614
+
615
+ Start the self-hosted PowerSync stack via Docker Compose.
616
+
617
+ ```
618
+ USAGE
619
+ $ powersync docker start [--directory <value>] [--api-url <value>]
620
+
621
+ SELF_HOSTED_PROJECT FLAGS
622
+ --api-url=<value> PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.
623
+
624
+ PROJECT FLAGS
625
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
626
+ required if multiple powersync config files are present in subdirectories of the current working
627
+ directory.
628
+
629
+ DESCRIPTION
630
+ Start the self-hosted PowerSync stack via Docker Compose.
631
+
632
+ Runs `docker compose up -d --wait` for the project docker/ compose file; waits for services (including PowerSync) to
633
+ be healthy. Use `powersync status` to debug running instances.
634
+
635
+ EXAMPLES
636
+ $ powersync docker start
637
+ ```
638
+
639
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/docker/start.ts)_
640
+
641
+ ## `powersync docker stop`
642
+
643
+ Stop a PowerSync Docker Compose project by name.
644
+
645
+ ```
646
+ USAGE
647
+ $ powersync docker stop [--directory <value>] [--api-url <value>] [--project-name <value>] [--remove]
648
+ [--remove-volumes]
649
+
650
+ FLAGS
651
+ --project-name=<value> Docker Compose project name to stop (e.g. powersync_myapp). If omitted and run from a project
652
+ directory, uses plugins.docker.project_name from cli.yaml. Pass this to stop from any
653
+ directory without loading the project.
654
+ --remove Remove containers after stopping (docker compose down). By default only stop (docker compose
655
+ stop).
656
+ --remove-volumes Remove named volumes (docker compose down -v). Use to reset database/storage so init scripts
657
+ run again on next reset. Implies --remove.
658
+
659
+ SELF_HOSTED_PROJECT FLAGS
660
+ --api-url=<value> PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.
661
+
662
+ PROJECT FLAGS
663
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
664
+ required if multiple powersync config files are present in subdirectories of the current working
665
+ directory.
666
+
667
+ DESCRIPTION
668
+ Stop a PowerSync Docker Compose project by name.
669
+
670
+ Run `docker compose -p <project-name> stop` (containers are not removed by default). Does not require the project
671
+ directory or a compose file, so you can run it from anywhere (e.g. after a reset conflict). Use --project-name or run
672
+ from a project with cli.yaml to choose which project to stop. Use --remove to also remove the containers. Use
673
+ --remove-volumes to also remove volumes (e.g. to re-run DB init scripts on next reset).
674
+
675
+ EXAMPLES
676
+ $ powersync docker stop
677
+
678
+ $ powersync docker stop --project-name=powersync_myapp --remove
679
+ ```
680
+
681
+ _See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/docker/stop.ts)_
682
+
683
+ ## `powersync edit config`
684
+
685
+ Open the PowerSync configuration editor (Nitro server).
686
+
687
+ ```
688
+ USAGE
689
+ $ powersync edit config [--api-url <value> | --instance-id <value> | --org-id <value> | --project-id <value>]
690
+ [--directory <value>] [--host <value>] [--port <value>]
691
+
692
+ FLAGS
693
+ --host=<value> [default: 127.0.0.1] Host to bind the editor preview server. Pass 0.0.0.0 to expose on all interfaces.
694
+ --port=<value> [default: 3000] Port for the editor preview server.
695
+
696
+ SELF_HOSTED_PROJECT FLAGS
697
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
698
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
699
+
700
+ PROJECT FLAGS
701
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
702
+ required if multiple powersync config files are present in subdirectories of the current working
703
+ directory.
704
+
705
+ CLOUD_PROJECT FLAGS
706
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
707
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
708
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
709
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
710
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
711
+
712
+ DESCRIPTION
713
+ Open the PowerSync configuration editor (Nitro server).
714
+
715
+ Loads the linked project context and runs the editor Nitro server to edit config files.
716
+
717
+ EXAMPLES
718
+ $ powersync edit config
719
+
720
+ $ powersync edit config --directory ./powersync
721
+ ```
722
+
723
+ _See code: [@powersync/cli-plugin-config-edit](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/edit/config.ts)_
724
+
725
+ ## `powersync fetch config`
726
+
727
+ [Cloud only] Print linked Cloud instance config (YAML or JSON).
728
+
729
+ ```
730
+ USAGE
731
+ $ powersync fetch config [--output json|yaml] [--directory <value>] [--instance-id <value> --project-id <value>]
732
+ [--org-id <value>]
733
+
734
+ FLAGS
735
+ --output=<option> [default: yaml] Output format: yaml or json.
736
+ <options: json|yaml>
737
+
738
+ PROJECT FLAGS
739
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
740
+ required if multiple powersync config files are present in subdirectories of the current working
741
+ directory.
742
+
743
+ CLOUD_PROJECT FLAGS
744
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
745
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
746
+ explicitly if the token has multiple orgs.
747
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
748
+
749
+ DESCRIPTION
750
+ [Cloud only] Print linked Cloud instance config (YAML or JSON).
751
+
752
+ Retrieve the current instance config from PowerSync Cloud and print as YAML or JSON.
753
+
754
+ EXAMPLES
755
+ $ powersync fetch config
756
+
757
+ $ powersync fetch config --output=json
758
+ ```
759
+
760
+ _See code: [src/commands/fetch/config.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/fetch/config.ts)_
761
+
762
+ ## `powersync fetch instances`
763
+
764
+ List Cloud and linked instances.
765
+
766
+ ```
767
+ USAGE
768
+ $ powersync fetch instances [--org-id <value>] [--output human|json] [--output-file <value>] [--project-id <value>]
769
+
770
+ FLAGS
771
+ --org-id=<value> Optional Organization ID. Defaults to all organizations.
772
+ --output=<option> [default: human] Output format: human or json.
773
+ <options: human|json>
774
+ --output-file=<value> Optionally write instance information to a file.
775
+ --project-id=<value> Optional Project ID. Defaults to all projects in the org.
776
+
777
+ DESCRIPTION
778
+ List Cloud and linked instances.
779
+
780
+ List PowerSync Cloud and linked instances, Cloud instances are grouped by organization and project.
781
+
782
+ EXAMPLES
783
+ $ powersync fetch instances
784
+
785
+ $ powersync fetch instances --project-id=<id> --output=json
786
+ ```
787
+
788
+ _See code: [src/commands/fetch/instances.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/fetch/instances.ts)_
789
+
790
+ ## `powersync fetch status`
791
+
792
+ Show instance diagnostics (connections, sync config, replication).
793
+
794
+ ```
795
+ USAGE
796
+ $ powersync fetch status [--output human|json|yaml] [--api-url <value> | --instance-id <value> | --org-id
797
+ <value> | --project-id <value>] [--directory <value>]
798
+
799
+ FLAGS
800
+ --output=<option> [default: human] Output format: human-readable, json, or yaml.
801
+ <options: human|json|yaml>
802
+
803
+ SELF_HOSTED_PROJECT FLAGS
804
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
805
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
806
+
807
+ PROJECT FLAGS
808
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
809
+ required if multiple powersync config files are present in subdirectories of the current working
810
+ directory.
811
+
812
+ CLOUD_PROJECT FLAGS
813
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
814
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
815
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
816
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
817
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
818
+
819
+ DESCRIPTION
820
+ Show instance diagnostics (connections, sync config, replication).
821
+
822
+ Fetch instance diagnostics: connection status, active and deploying sync config, replication state. Output as
823
+ human-readable, JSON, or YAML. Cloud and self-hosted.
824
+
825
+ EXAMPLES
826
+ $ powersync fetch status
827
+
828
+ $ powersync fetch status --output=json
829
+
830
+ $ powersync fetch status --instance-id=<id> --project-id=<id>
831
+ ```
832
+
833
+ _See code: [src/commands/fetch/status.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/fetch/status.ts)_
834
+
835
+ ## `powersync generate schema`
836
+
837
+ Generate client schema file from instance schema and sync config.
838
+
839
+ ```
840
+ USAGE
841
+ $ powersync generate schema --output dart|dotNet|js|jsLegacy|kotlin|swift|ts --output-path <value> [--api-url
842
+ <value> | --instance-id <value> | --org-id <value> | --project-id <value>] [--directory <value>]
843
+
844
+ FLAGS
845
+ --output=<option> (required) [default: type] Output type: dart, dotNet, js, jsLegacy, kotlin, swift, ts
846
+ <options: dart|dotNet|js|jsLegacy|kotlin|swift|ts>
847
+ --output-path=<value> (required) Path to output the schema file.
848
+
849
+ SELF_HOSTED_PROJECT FLAGS
850
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
851
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
852
+
853
+ PROJECT FLAGS
854
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
855
+ required if multiple powersync config files are present in subdirectories of the current working
856
+ directory.
857
+
858
+ CLOUD_PROJECT FLAGS
859
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
860
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
861
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
862
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
863
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
864
+
865
+ DESCRIPTION
866
+ Generate client schema file from instance schema and sync config.
867
+
868
+ Generate a client-side schema file from the instance database schema and sync config. Supports multiple output types
869
+ (e.g. type, dart). Requires a linked instance. Cloud and self-hosted.
870
+
871
+ EXAMPLES
872
+ $ powersync generate schema --output=ts --output-path=schema.ts
873
+
874
+ $ powersync generate schema --output=dart --output-path=lib/schema.dart --instance-id=<id> --project-id=<id>
875
+ ```
876
+
877
+ _See code: [src/commands/generate/schema.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/generate/schema.ts)_
878
+
879
+ ## `powersync generate token`
880
+
881
+ Generate a development JWT for client connections.
882
+
883
+ ```
884
+ USAGE
885
+ $ powersync generate token --subject <value> [--expires-in-seconds <value>] [--kid <value>] [--api-url <value> |
886
+ --instance-id <value> | --org-id <value> | --project-id <value>] [--directory <value>]
887
+
888
+ FLAGS
889
+ --expires-in-seconds=<value> [default: 43200] Expiration time in seconds. Default is 43,200 (12 hours).
890
+ --kid=<value> [Self-hosted only] Key ID of the key to use for signing the token. If not provided, the
891
+ first key will be used.
892
+ --subject=<value> (required) Subject of the token.
893
+
894
+ SELF_HOSTED_PROJECT FLAGS
895
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
896
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
897
+
898
+ PROJECT FLAGS
899
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
900
+ required if multiple powersync config files are present in subdirectories of the current working
901
+ directory.
902
+
903
+ CLOUD_PROJECT FLAGS
904
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
905
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
906
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
907
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
908
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
909
+
910
+ DESCRIPTION
911
+ Generate a development JWT for client connections.
912
+
913
+ Generate a JWT for development clients to connect to PowerSync. Cloud: uses instance dev-token API
914
+ (allow_temporary_tokens must be enabled). Self-hosted: signs with shared secret from config. Requires --subject;
915
+ optional --expires-in-seconds.
916
+
917
+ EXAMPLES
918
+ $ powersync generate token --subject=user-123
919
+
920
+ $ powersync generate token --subject=user-123 --expires-in-seconds=3600
921
+ ```
922
+
923
+ _See code: [src/commands/generate/token.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/generate/token.ts)_
56
924
 
57
925
  ## `powersync help [COMMAND]`
58
926
 
@@ -60,10 +928,10 @@ Display help for powersync.
60
928
 
61
929
  ```
62
930
  USAGE
63
- $ npx powersync help [COMMAND...] [-n]
931
+ $ powersync help [COMMAND...] [-n]
64
932
 
65
933
  ARGUMENTS
66
- COMMAND... Command to show help for.
934
+ [COMMAND...] Command to show help for.
67
935
 
68
936
  FLAGS
69
937
  -n, --nested-commands Include all nested commands in the output.
@@ -72,322 +940,657 @@ DESCRIPTION
72
940
  Display help for powersync.
73
941
  ```
74
942
 
75
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.8/src/commands/help.ts)_
943
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.37/src/commands/help.ts)_
76
944
 
77
- ## `powersync init`
945
+ ## `powersync init cloud`
78
946
 
79
- Initialize the CLI.
80
- Requires an access token. Learn how to generate these [here](https://docs.powersync.com/usage/tools/cli-beta#personal-access-token).
947
+ Scaffold a PowerSync Cloud config directory from a template.
81
948
 
82
949
  ```
83
950
  USAGE
84
- $ npx powersync init
951
+ $ powersync init cloud [--directory <value>]
952
+
953
+ PROJECT FLAGS
954
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
955
+ required if multiple powersync config files are present in subdirectories of the current working
956
+ directory.
85
957
 
86
958
  DESCRIPTION
87
- Initialize the CLI.
959
+ Scaffold a PowerSync Cloud config directory from a template.
960
+
961
+ Copy a Cloud template into a config directory (default powersync/). Edit service.yaml then run link cloud and deploy.
88
962
 
89
963
  EXAMPLES
90
- $ npx powersync init
964
+ $ powersync init cloud
965
+
966
+ $ powersync init cloud --directory=powersync
91
967
  ```
92
968
 
93
- _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/init.ts)_
969
+ _See code: [src/commands/init/cloud.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/init/cloud.ts)_
94
970
 
95
- ## `powersync instance config`
971
+ ## `powersync init self-hosted`
96
972
 
97
- Display the instance config.
973
+ Scaffold a PowerSync self-hosted config directory from a template.
98
974
 
99
975
  ```
100
976
  USAGE
101
- $ npx powersync instance config
977
+ $ powersync init self-hosted [--directory <value>]
978
+
979
+ PROJECT FLAGS
980
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
981
+ required if multiple powersync config files are present in subdirectories of the current working
982
+ directory.
102
983
 
103
984
  DESCRIPTION
104
- Display the instance config.
985
+ Scaffold a PowerSync self-hosted config directory from a template.
986
+
987
+ Copy a self-hosted template into a config directory (default powersync/). Configure service.yaml with your self-hosted
988
+ instance details.
105
989
 
106
990
  EXAMPLES
107
- $ npx powersync instance config
991
+ $ powersync init self-hosted
992
+
993
+ $ powersync init self-hosted --directory=powersync
108
994
  ```
109
995
 
110
- _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/config.ts)_
996
+ _See code: [src/commands/init/self-hosted.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/init/self-hosted.ts)_
111
997
 
112
- ## `powersync instance create`
998
+ ## `powersync link cloud`
113
999
 
114
- Create a new instance.
1000
+ [Cloud only] Link to a PowerSync Cloud instance (or create one with --create).
115
1001
 
116
1002
  ```
117
1003
  USAGE
118
- $ npx powersync instance create [-i <value>] [--protocol <value>] [-r <value>] [-t postgresql|mongodb] [-n <value>] [-h
119
- <value>] [-w <value>] [-a <value>] [-o <value>] [-s] [-j <value>] [-b]
1004
+ $ powersync link cloud --project-id <value> [--create] [--instance-id <value>] [--org-id <value>] [--directory
1005
+ <value>]
120
1006
 
121
1007
  FLAGS
122
- -a, --jwtAudiences=<value> JWT audiences (comma separated).
123
- -b, --[no-]useSupabaseAuth Use Supabase auth.
124
- -h, --hostname=<value> Hostname to connect to database.
125
- -i, --name=<value> Name of the instance.
126
- -j, --supabaseJWTSecret=<value> Supabase JWT secret
127
- -n, --databaseName=<value> Name of the database.
128
- -o, --port=<value> Port number to connect to database.
129
- -r, --region=<value> Region to deploy instance to.
130
- -s, --skipInteraction Skip interactivity.
131
- -t, --connectionType=<option> Type of database connection.
132
- <options: postgresql|mongodb>
133
- -w, --jwksUri=<value> JWKS URI (must include https://).
134
- --protocol=<value> Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).
1008
+ --create Create a new Cloud instance in the given org and project, then link. Do not supply
1009
+ --instance-id when using --create.
1010
+ --instance-id=<value> PowerSync Cloud instance ID. Omit when using --create. Resolved: flag → INSTANCE_ID → cli.yaml.
1011
+ --org-id=<value> Organization ID. Optional when the token has a single org; required when the token has multiple
1012
+ orgs. Resolved: flag → ORG_ID → cli.yaml.
1013
+ --project-id=<value> (required) Project ID. Resolved: flag → PROJECT_ID → cli.yaml.
1014
+
1015
+ PROJECT FLAGS
1016
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1017
+ required if multiple powersync config files are present in subdirectories of the current working
1018
+ directory.
135
1019
 
136
1020
  DESCRIPTION
137
- Create a new instance.
1021
+ [Cloud only] Link to a PowerSync Cloud instance (or create one with --create).
1022
+
1023
+ Write or update cli.yaml with a Cloud instance (instance-id, org-id, project-id). Use --create to create a new
1024
+ instance from service.yaml name/region and link it; omit --instance-id when using --create. Org ID is optional when
1025
+ the token has a single organization.
138
1026
 
139
1027
  EXAMPLES
140
- $ npx powersync instance create
1028
+ $ powersync link cloud --project-id=<project-id>
1029
+
1030
+ $ powersync link cloud --create --project-id=<project-id>
1031
+
1032
+ $ powersync link cloud --instance-id=<id> --project-id=<project-id> --org-id=<org-id>
141
1033
  ```
142
1034
 
143
- _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/create.ts)_
1035
+ _See code: [src/commands/link/cloud.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/link/cloud.ts)_
144
1036
 
145
- ## `powersync instance deploy`
1037
+ ## `powersync link self-hosted`
146
1038
 
147
- Deploy changes to an existing instance.
1039
+ Link to a self-hosted PowerSync instance by API URL.
148
1040
 
149
1041
  ```
150
1042
  USAGE
151
- $ npx powersync instance deploy [--protocol <value>] [-r <value>] [-t postgresql|mongodb] [-n <value>] [-h <value>] [-w
152
- <value>] [-a <value>] [-o <value>] [-s] [-j <value>] [-b]
1043
+ $ powersync link self-hosted --api-url <value> [--directory <value>]
153
1044
 
154
1045
  FLAGS
155
- -a, --jwtAudiences=<value> JWT audiences (comma separated).
156
- -b, --[no-]useSupabaseAuth Use Supabase auth.
157
- -h, --hostname=<value> Hostname to connect to database.
158
- -j, --supabaseJWTSecret=<value> Supabase JWT secret
159
- -n, --databaseName=<value> Name of the database.
160
- -o, --port=<value> Port number to connect to database.
161
- -r, --region=<value> Region to deploy instance to.
162
- -s, --skipInteraction Skip interactivity.
163
- -t, --connectionType=<option> Type of database connection.
164
- <options: postgresql|mongodb>
165
- -w, --jwksUri=<value> JWKS URI (must include https://).
166
- --protocol=<value> Database protocol to use (e.g., for MongoDB: mongodb+srv or mongodb).
1046
+ --api-url=<value> (required) Self-hosted PowerSync API base URL (e.g. https://powersync.example.com).
1047
+
1048
+ PROJECT FLAGS
1049
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1050
+ required if multiple powersync config files are present in subdirectories of the current working
1051
+ directory.
167
1052
 
168
1053
  DESCRIPTION
169
- Deploy changes to an existing instance.
1054
+ Link to a self-hosted PowerSync instance by API URL.
1055
+
1056
+ Links a self hosted PowerSync instance by API URL.
1057
+ API Keys can be specified via input or specified in the PS_ADMIN_TOKEN environment variable.
170
1058
 
171
1059
  EXAMPLES
172
- $ npx powersync instance deploy
1060
+ $ powersync link self-hosted --api-url=https://powersync.example.com
173
1061
  ```
174
1062
 
175
- _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/deploy.ts)_
1063
+ _See code: [src/commands/link/self-hosted.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/link/self-hosted.ts)_
176
1064
 
177
- ## `powersync instance destroy`
1065
+ ## `powersync login`
178
1066
 
179
- Destroy the current instance - THIS CANNOT BE UNDONE.
1067
+ Store auth token for Cloud commands.
180
1068
 
181
1069
  ```
182
1070
  USAGE
183
- $ npx powersync instance destroy [-s]
1071
+ $ powersync login
184
1072
 
185
- FLAGS
186
- -s, --skipConfirmation Ignore confirmation question.
1073
+ DESCRIPTION
1074
+ Store auth token for Cloud commands.
1075
+
1076
+ Store a PowerSync auth token (PAT) in secure storage so later Cloud commands run without passing a token. If secure
1077
+ storage is unavailable, login can optionally store it in a local config file. Use PS_ADMIN_TOKEN env var for CI or
1078
+ scripts instead.
1079
+
1080
+ EXAMPLES
1081
+ $ powersync login
1082
+ ```
1083
+
1084
+ _See code: [src/commands/login.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/login.ts)_
1085
+
1086
+ ## `powersync logout`
1087
+
1088
+ Remove stored auth token.
1089
+
1090
+ ```
1091
+ USAGE
1092
+ $ powersync logout
187
1093
 
188
1094
  DESCRIPTION
189
- Destroy the current instance - THIS CANNOT BE UNDONE.
1095
+ Remove stored auth token.
1096
+
1097
+ Remove the stored PowerSync auth token from secure storage or local fallback config storage. Cloud commands will no
1098
+ longer use stored credentials until you run login again.
190
1099
 
191
1100
  EXAMPLES
192
- $ npx powersync instance destroy
1101
+ $ powersync logout
193
1102
  ```
194
1103
 
195
- _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/destroy.ts)_
1104
+ _See code: [src/commands/logout.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/logout.ts)_
196
1105
 
197
- ## `powersync instance generate-dev-token`
1106
+ ## `powersync migrate sync-rules`
198
1107
 
199
- Generate a developer token using the Token subject/ User ID.
1108
+ Migrates Sync Rules to Sync Streams
200
1109
 
201
1110
  ```
202
1111
  USAGE
203
- $ npx powersync instance generate-dev-token [-e <value>] [-u <value>]
1112
+ $ powersync migrate sync-rules [--input-file <value>] [--output-file <value>] [--api-url <value> | --instance-id
1113
+ <value> | --org-id <value> | --project-id <value>] [--directory <value>]
204
1114
 
205
1115
  FLAGS
206
- -e, --expiresInSeconds=<value> The token expiry in seconds.
207
- -u, --userId=<value> The Token subject/User ID for the developer token
1116
+ --input-file=<value> Path to the input sync rules file. Defaults to the project sync-config.yaml file.
1117
+ --output-file=<value> Path to the output sync streams file. Defaults to overwrite the input file.
1118
+
1119
+ SELF_HOSTED_PROJECT FLAGS
1120
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
1121
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
1122
+
1123
+ PROJECT FLAGS
1124
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1125
+ required if multiple powersync config files are present in subdirectories of the current working
1126
+ directory.
1127
+
1128
+ CLOUD_PROJECT FLAGS
1129
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
1130
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
1131
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
1132
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
1133
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
208
1134
 
209
1135
  DESCRIPTION
210
- Generate a developer token using the Token subject/ User ID.
1136
+ Migrates Sync Rules to Sync Streams
211
1137
 
212
- EXAMPLES
213
- $ npx powersync instance generate-dev-token
1138
+ Migrates Sync Rules to Sync Streams
214
1139
  ```
215
1140
 
216
- _See code: [src/commands/instance/generate-dev-token.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/generate-dev-token.ts)_
1141
+ _See code: [src/commands/migrate/sync-rules.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/migrate/sync-rules.ts)_
217
1142
 
218
- ## `powersync instance schema`
1143
+ ## `powersync plugins`
219
1144
 
220
- View the schema of the current instance.
1145
+ List installed plugins.
221
1146
 
222
1147
  ```
223
1148
  USAGE
224
- $ npx powersync instance schema
1149
+ $ powersync plugins [--json] [--core]
1150
+
1151
+ FLAGS
1152
+ --core Show core plugins.
1153
+
1154
+ GLOBAL FLAGS
1155
+ --json Format output as json.
225
1156
 
226
1157
  DESCRIPTION
227
- View the schema of the current instance.
1158
+ List installed plugins.
228
1159
 
229
1160
  EXAMPLES
230
- $ npx powersync instance schema
1161
+ $ powersync plugins
231
1162
  ```
232
1163
 
233
- _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/schema.ts)_
1164
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/index.ts)_
234
1165
 
235
- ## `powersync instance set`
1166
+ ## `powersync plugins add PLUGIN`
236
1167
 
237
- Set the current instance.
1168
+ Installs a plugin into powersync.
238
1169
 
239
1170
  ```
240
1171
  USAGE
241
- $ npx powersync instance set [-i <value>]
1172
+ $ powersync plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
1173
+
1174
+ ARGUMENTS
1175
+ PLUGIN... Plugin to install.
242
1176
 
243
1177
  FLAGS
244
- -i, --instanceId=<value> Instance ID to change to.
1178
+ -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
1179
+ -h, --help Show CLI help.
1180
+ -s, --silent Silences npm output.
1181
+ -v, --verbose Show verbose npm output.
1182
+
1183
+ GLOBAL FLAGS
1184
+ --json Format output as json.
245
1185
 
246
1186
  DESCRIPTION
247
- Set the current instance.
1187
+ Installs a plugin into powersync.
1188
+
1189
+ Uses npm to install plugins.
1190
+
1191
+ Installation of a user-installed plugin will override a core plugin.
1192
+
1193
+ Use the POWERSYNC_NPM_LOG_LEVEL environment variable to set the npm loglevel.
1194
+ Use the POWERSYNC_NPM_REGISTRY environment variable to set the npm registry.
1195
+
1196
+ ALIASES
1197
+ $ powersync plugins add
248
1198
 
249
1199
  EXAMPLES
250
- $ npx powersync instance set
1200
+ Install a plugin from npm registry.
1201
+
1202
+ $ powersync plugins add myplugin
1203
+
1204
+ Install a plugin from a github url.
1205
+
1206
+ $ powersync plugins add https://github.com/someuser/someplugin
1207
+
1208
+ Install a plugin from a github slug.
1209
+
1210
+ $ powersync plugins add someuser/someplugin
1211
+ ```
251
1212
 
252
- $ npx powersync instance set --instanceId=1234
1213
+ ## `powersync plugins:inspect PLUGIN...`
1214
+
1215
+ Displays installation properties of a plugin.
1216
+
1217
+ ```
1218
+ USAGE
1219
+ $ powersync plugins inspect PLUGIN...
1220
+
1221
+ ARGUMENTS
1222
+ PLUGIN... [default: .] Plugin to inspect.
1223
+
1224
+ FLAGS
1225
+ -h, --help Show CLI help.
1226
+ -v, --verbose
1227
+
1228
+ GLOBAL FLAGS
1229
+ --json Format output as json.
1230
+
1231
+ DESCRIPTION
1232
+ Displays installation properties of a plugin.
1233
+
1234
+ EXAMPLES
1235
+ $ powersync plugins inspect myplugin
253
1236
  ```
254
1237
 
255
- _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/set.ts)_
1238
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/inspect.ts)_
256
1239
 
257
- ## `powersync instance status`
1240
+ ## `powersync plugins install PLUGIN`
258
1241
 
259
- View the status of the current instance. View the status of a different instance by using flags.
1242
+ Installs a plugin into powersync.
260
1243
 
261
1244
  ```
262
1245
  USAGE
263
- $ npx powersync instance status [-t <value>] [-i <value>] [-o <value>] [-p <value>]
1246
+ $ powersync plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
1247
+
1248
+ ARGUMENTS
1249
+ PLUGIN... Plugin to install.
264
1250
 
265
1251
  FLAGS
266
- -i, --instanceId=<value> Override current instance by providing the ID of a different instance.
267
- -o, --orgId=<value> Override current organization by providing the ID of a different organization.
268
- -p, --projectId=<value> Override current project by providing the ID of a different project.
269
- -t, --authToken=<value> Override current auth token.
1252
+ -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
1253
+ -h, --help Show CLI help.
1254
+ -s, --silent Silences npm output.
1255
+ -v, --verbose Show verbose npm output.
1256
+
1257
+ GLOBAL FLAGS
1258
+ --json Format output as json.
270
1259
 
271
1260
  DESCRIPTION
272
- View the status of the current instance. View the status of a different instance by using flags.
1261
+ Installs a plugin into powersync.
1262
+
1263
+ Uses npm to install plugins.
1264
+
1265
+ Installation of a user-installed plugin will override a core plugin.
1266
+
1267
+ Use the POWERSYNC_NPM_LOG_LEVEL environment variable to set the npm loglevel.
1268
+ Use the POWERSYNC_NPM_REGISTRY environment variable to set the npm registry.
1269
+
1270
+ ALIASES
1271
+ $ powersync plugins add
273
1272
 
274
1273
  EXAMPLES
275
- $ npx powersync instance status
1274
+ Install a plugin from npm registry.
1275
+
1276
+ $ powersync plugins install myplugin
1277
+
1278
+ Install a plugin from a github url.
1279
+
1280
+ $ powersync plugins install https://github.com/someuser/someplugin
1281
+
1282
+ Install a plugin from a github slug.
276
1283
 
277
- $ npx powersync instance status --orgId=1234 --projectId=1234 --instanceId=1234 --authToken=1234
1284
+ $ powersync plugins install someuser/someplugin
278
1285
  ```
279
1286
 
280
- _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/status.ts)_
1287
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/install.ts)_
281
1288
 
282
- ## `powersync instance stop`
1289
+ ## `powersync plugins link PATH`
283
1290
 
284
- Stop the current instance.
1291
+ Links a plugin into the CLI for development.
285
1292
 
286
1293
  ```
287
1294
  USAGE
288
- $ npx powersync instance stop [-s]
1295
+ $ powersync plugins link PATH [-h] [--install] [-v]
1296
+
1297
+ ARGUMENTS
1298
+ PATH [default: .] path to plugin
289
1299
 
290
1300
  FLAGS
291
- -s, --skipConfirmation Ignore confirmation question.
1301
+ -h, --help Show CLI help.
1302
+ -v, --verbose
1303
+ --[no-]install Install dependencies after linking the plugin.
292
1304
 
293
1305
  DESCRIPTION
294
- Stop the current instance.
1306
+ Links a plugin into the CLI for development.
1307
+
1308
+ Installation of a linked plugin will override a user-installed or core plugin.
1309
+
1310
+ e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
1311
+ command will override the user-installed or core plugin implementation. This is useful for development work.
1312
+
295
1313
 
296
1314
  EXAMPLES
297
- $ npx powersync instance stop
1315
+ $ powersync plugins link myplugin
298
1316
  ```
299
1317
 
300
- _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/stop.ts)_
1318
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/link.ts)_
301
1319
 
302
- ## `powersync instance sync-rules deploy`
1320
+ ## `powersync plugins remove [PLUGIN]`
303
1321
 
304
- Deploy sync rules from a local sync rules config file to the current instance.
1322
+ Removes a plugin from the CLI.
305
1323
 
306
1324
  ```
307
1325
  USAGE
308
- $ npx powersync instance sync-rules deploy -f <value> [-s]
1326
+ $ powersync plugins remove [PLUGIN...] [-h] [-v]
1327
+
1328
+ ARGUMENTS
1329
+ [PLUGIN...] plugin to uninstall
309
1330
 
310
1331
  FLAGS
311
- -f, --filePath=<value> (required) Path to the sync rules config file.
312
- -s, --skipConfirmation Ignore confirmation question.
1332
+ -h, --help Show CLI help.
1333
+ -v, --verbose
313
1334
 
314
1335
  DESCRIPTION
315
- Deploy sync rules from a local sync rules config file to the current instance.
1336
+ Removes a plugin from the CLI.
1337
+
1338
+ ALIASES
1339
+ $ powersync plugins unlink
1340
+ $ powersync plugins remove
316
1341
 
317
1342
  EXAMPLES
318
- $ npx powersync instance sync-rules deploy
1343
+ $ powersync plugins remove myplugin
1344
+ ```
1345
+
1346
+ ## `powersync plugins reset`
319
1347
 
320
- $ npx powersync instance sync-rules deploy --filePath path/to/file
1348
+ Remove all user-installed and linked plugins.
1349
+
1350
+ ```
1351
+ USAGE
1352
+ $ powersync plugins reset [--hard] [--reinstall]
321
1353
 
322
- $ npx powersync instance sync-rules deploy -f path/to/file
1354
+ FLAGS
1355
+ --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
1356
+ --reinstall Reinstall all plugins after uninstalling.
323
1357
  ```
324
1358
 
325
- _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/sync-rules/deploy.ts)_
1359
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/reset.ts)_
326
1360
 
327
- ## `powersync instance sync-rules generate-schema`
1361
+ ## `powersync plugins uninstall [PLUGIN]`
328
1362
 
329
- Generate schema in your language from your sync rules config file.
1363
+ Removes a plugin from the CLI.
330
1364
 
331
1365
  ```
332
1366
  USAGE
333
- $ npx powersync instance sync-rules generate-schema -f <value> [-l js|dart]
1367
+ $ powersync plugins uninstall [PLUGIN...] [-h] [-v]
1368
+
1369
+ ARGUMENTS
1370
+ [PLUGIN...] plugin to uninstall
334
1371
 
335
1372
  FLAGS
336
- -f, --filePath=<value> (required) Path to the sync rules config file.
337
- -l, --language=<option> Choose language for output.
338
- <options: js|dart>
1373
+ -h, --help Show CLI help.
1374
+ -v, --verbose
339
1375
 
340
1376
  DESCRIPTION
341
- Generate schema in your language from your sync rules config file.
1377
+ Removes a plugin from the CLI.
1378
+
1379
+ ALIASES
1380
+ $ powersync plugins unlink
1381
+ $ powersync plugins remove
342
1382
 
343
1383
  EXAMPLES
344
- $ npx powersync instance sync-rules generate-schema
1384
+ $ powersync plugins uninstall myplugin
1385
+ ```
1386
+
1387
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/uninstall.ts)_
1388
+
1389
+ ## `powersync plugins unlink [PLUGIN]`
345
1390
 
346
- $ npx powersync instance sync-rules generate-schema --filePath path/to/file
1391
+ Removes a plugin from the CLI.
347
1392
 
348
- $ npx powersync instance sync-rules generate-schema -f path/to/file
349
1393
  ```
1394
+ USAGE
1395
+ $ powersync plugins unlink [PLUGIN...] [-h] [-v]
350
1396
 
351
- _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/sync-rules/generate-schema.ts)_
1397
+ ARGUMENTS
1398
+ [PLUGIN...] plugin to uninstall
352
1399
 
353
- ## `powersync instance sync-rules validate`
1400
+ FLAGS
1401
+ -h, --help Show CLI help.
1402
+ -v, --verbose
354
1403
 
355
- Validate sync rules from a local sync rules config file.
1404
+ DESCRIPTION
1405
+ Removes a plugin from the CLI.
1406
+
1407
+ ALIASES
1408
+ $ powersync plugins unlink
1409
+ $ powersync plugins remove
1410
+
1411
+ EXAMPLES
1412
+ $ powersync plugins unlink myplugin
1413
+ ```
1414
+
1415
+ ## `powersync plugins update`
1416
+
1417
+ Update installed plugins.
356
1418
 
357
1419
  ```
358
1420
  USAGE
359
- $ npx powersync instance sync-rules validate -f <value>
1421
+ $ powersync plugins update [-h] [-v]
360
1422
 
361
1423
  FLAGS
362
- -f, --filePath=<value> (required) Path to the sync rules config file.
1424
+ -h, --help Show CLI help.
1425
+ -v, --verbose
1426
+
1427
+ DESCRIPTION
1428
+ Update installed plugins.
1429
+ ```
1430
+
1431
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.55/src/commands/plugins/update.ts)_
1432
+
1433
+ ## `powersync pull instance`
1434
+
1435
+ [Cloud only] Pull an existing Cloud instance: link and download config into local service.yaml and sync-config.yaml.
1436
+
1437
+ ```
1438
+ USAGE
1439
+ $ powersync pull instance [--directory <value>] [--instance-id <value> --project-id <value>] [--org-id <value>]
1440
+
1441
+ PROJECT FLAGS
1442
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1443
+ required if multiple powersync config files are present in subdirectories of the current working
1444
+ directory.
1445
+
1446
+ CLOUD_PROJECT FLAGS
1447
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
1448
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
1449
+ explicitly if the token has multiple orgs.
1450
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
363
1451
 
364
1452
  DESCRIPTION
365
- Validate sync rules from a local sync rules config file.
1453
+ [Cloud only] Pull an existing Cloud instance: link and download config into local service.yaml and sync-config.yaml.
1454
+
1455
+ Fetch an existing Cloud instance by ID: create the config directory if needed, write cli.yaml, and download
1456
+ service.yaml and sync-config.yaml. Pass --instance-id and --project-id when the directory is not yet linked; --org-id
1457
+ is optional when the token has a single organization. Cloud only.
366
1458
 
367
1459
  EXAMPLES
368
- $ npx powersync instance sync-rules validate
1460
+ $ powersync pull instance
369
1461
 
370
- $ npx powersync instance sync-rules validate --filePath path/to/file
1462
+ $ powersync pull instance --instance-id=<id> --project-id=<id>
371
1463
 
372
- $ npx powersync instance sync-rules validate -f path/to/file
1464
+ $ powersync pull instance --instance-id=<id> --project-id=<id> --org-id=<org-id>
373
1465
  ```
374
1466
 
375
- _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instance/sync-rules/validate.ts)_
1467
+ _See code: [src/commands/pull/instance.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/pull/instance.ts)_
376
1468
 
377
- ## `powersync instances`
1469
+ ## `powersync status`
378
1470
 
379
- View list of instances.
1471
+ Show instance diagnostics (connections, sync config, replication).
380
1472
 
381
1473
  ```
382
1474
  USAGE
383
- $ npx powersync instances
1475
+ $ powersync status [--output human|json|yaml] [--api-url <value> | --instance-id <value> | --org-id
1476
+ <value> | --project-id <value>] [--directory <value>]
1477
+
1478
+ FLAGS
1479
+ --output=<option> [default: human] Output format: human-readable, json, or yaml.
1480
+ <options: human|json|yaml>
1481
+
1482
+ SELF_HOSTED_PROJECT FLAGS
1483
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
1484
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
1485
+
1486
+ PROJECT FLAGS
1487
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1488
+ required if multiple powersync config files are present in subdirectories of the current working
1489
+ directory.
1490
+
1491
+ CLOUD_PROJECT FLAGS
1492
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
1493
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
1494
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
1495
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
1496
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
384
1497
 
385
1498
  DESCRIPTION
386
- View list of instances.
1499
+ Show instance diagnostics (connections, sync config, replication).
1500
+
1501
+ Fetch instance diagnostics: connection status, active and deploying sync config, replication state. Output as
1502
+ human-readable, JSON, or YAML. Cloud and self-hosted.
387
1503
 
388
1504
  EXAMPLES
389
- $ npx powersync instances
1505
+ $ powersync status
1506
+
1507
+ $ powersync status --output=json
1508
+
1509
+ $ powersync status --instance-id=<id> --project-id=<id>
1510
+ ```
1511
+
1512
+ _See code: [src/commands/status.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/status.ts)_
1513
+
1514
+ ## `powersync stop`
1515
+
1516
+ [Cloud only] Stop the linked Cloud instance (restart with deploy).
1517
+
390
1518
  ```
1519
+ USAGE
1520
+ $ powersync stop [--confirm yes] [--directory <value>] [--instance-id <value> --project-id <value>]
1521
+ [--org-id <value>]
1522
+
1523
+ FLAGS
1524
+ --confirm=<option> Set to "yes" to confirm stopping the instance.
1525
+ <options: yes>
1526
+
1527
+ PROJECT FLAGS
1528
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1529
+ required if multiple powersync config files are present in subdirectories of the current working
1530
+ directory.
1531
+
1532
+ CLOUD_PROJECT FLAGS
1533
+ --instance-id=<value> PowerSync Cloud instance ID. Manually passed if the current context has not been linked.
1534
+ --org-id=<value> Organization ID (optional). Defaults to the token’s single org when only one is available; pass
1535
+ explicitly if the token has multiple orgs.
1536
+ --project-id=<value> Project ID. Manually passed if the current context has not been linked.
1537
+
1538
+ DESCRIPTION
1539
+ [Cloud only] Stop the linked Cloud instance (restart with deploy).
1540
+
1541
+ Deactivate the linked PowerSync Cloud instance. Requires --confirm=yes. Restart later with powersync deploy.
1542
+
1543
+ EXAMPLES
1544
+ $ powersync stop
1545
+
1546
+ $ powersync stop --confirm=yes
1547
+ ```
1548
+
1549
+ _See code: [src/commands/stop.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/stop.ts)_
1550
+
1551
+ ## `powersync validate`
1552
+
1553
+ Validate config schema, connections, and sync config before deploy.
1554
+
1555
+ ```
1556
+ USAGE
1557
+ $ powersync validate [--output human|json|yaml] [--api-url <value> | --instance-id <value> | --org-id
1558
+ <value> | --project-id <value>] [--directory <value>]
1559
+
1560
+ FLAGS
1561
+ --output=<option> [default: human] Output format: human-readable, json, or yaml.
1562
+ <options: human|json|yaml>
1563
+
1564
+ SELF_HOSTED_PROJECT FLAGS
1565
+ --api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
1566
+ --instance-id). Resolved: flag → cli.yaml → API_URL.
1567
+
1568
+ PROJECT FLAGS
1569
+ --directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
1570
+ required if multiple powersync config files are present in subdirectories of the current working
1571
+ directory.
1572
+
1573
+ CLOUD_PROJECT FLAGS
1574
+ --instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
1575
+ (exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
1576
+ --org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
1577
+ available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
1578
+ --project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
1579
+
1580
+ DESCRIPTION
1581
+ Validate config schema, connections, and sync config before deploy.
1582
+
1583
+ Run validation checks on local config: config schema, database connections, and sync config. Requires a linked
1584
+ instance. Works with Cloud and self-hosted.
1585
+
1586
+ EXAMPLES
1587
+ $ powersync validate
1588
+
1589
+ $ powersync validate --output=json
1590
+
1591
+ $ powersync validate --api-url=https://powersync.example.com
1592
+ ```
1593
+
1594
+ _See code: [src/commands/validate.ts](https://github.com/powersync-ja/powersync-cli/blob/v0.9.0/src/commands/validate.ts)_
391
1595
 
392
- _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/instances.ts)_
393
1596
  <!-- commandsstop -->