Skip to content

Commit eedd2dc

Browse files
Merge remote-tracking branch 'origin/main' into packaging
2 parents 164a8e4 + 00583c3 commit eedd2dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+6655
-555
lines changed

.github/workflows/onRelease.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Add CLI Installers to GitHub Release
22

3+
env:
4+
# Increase heap to keep Nitro/Vite SSR builds (editor) from OOMing while treeshaking.
5+
NODE_OPTIONS: --max-old-space-size=4096
6+
37
on:
48
release:
59
types: [released]

.github/workflows/test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Unit Tests
22

3+
env:
4+
# Increase heap to keep Nitro/Vite SSR builds (editor) from OOMing while treeshaking.
5+
NODE_OPTIONS: --max-old-space-size=4096
6+
37
on:
48
push:
59
branches-ignore: [main]
@@ -23,4 +27,5 @@ jobs:
2327
- name: Check formatting
2428
run: pnpm exec prettier --check .
2529
- run: pnpm run build
26-
- run: pnpm run test
30+
- name: Run tests
31+
run: pnpm run test

.husky/pre-commit

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ fi
88
git diff --cached --name-only -z --diff-filter=ACMR \
99
| xargs -0 pnpm prettier --write --ignore-unknown
1010

11-
if git diff --cached --name-only --diff-filter=ACMR -- '*.js' '*.cjs' '*.mjs' '*.ts' '*.tsx' | grep -q .; then
12-
git diff --cached --name-only -z --diff-filter=ACMR -- '*.js' '*.cjs' '*.mjs' '*.ts' '*.tsx' \
13-
| xargs -0 pnpm eslint --fix
14-
fi
11+
pnpm lint:fix
1512

1613
git diff --cached --name-only -z --diff-filter=ACMR \
1714
| xargs -0 git add --

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
pnpm-lock.yaml
22
**/pnpm-lock.yaml
33
**/*.json
4+
.output
5+
editor-dist
6+
routeTree.gen.ts

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.watcherExclude": {
3+
"**/routeTree.gen.ts": true
4+
},
5+
"search.exclude": {
6+
"**/routeTree.gen.ts": true
7+
},
8+
"files.readonlyInclude": {
9+
"**/routeTree.gen.ts": true
10+
}
11+
}

README.md

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Monorepo for the PowerSync CLI and related tooling. Built with [pnpm](https://pnpm.io) workspaces and [OCLIF](https://oclif.io).
44

5+
- Architecture, scripts, and troubleshooting tips live in [packages/editor/README.md](./packages/editor/README.md).
6+
57
## Requirements
68

79
- **Node**: LTS v24+ (see [.nvmrc](./.nvmrc); use `nvm use` to switch)
@@ -11,19 +13,23 @@ Monorepo for the PowerSync CLI and related tooling. Built with [pnpm](https://pn
1113

1214
The workspace is split into the main CLI, shared **packages**, and optional **plugins**:
1315

14-
| Package | Path | Description |
15-
| ---------------------------------------------------- | -------------------- | ---------------------------------------------------------------------------------- |
16-
| [**@powersync/cli**](./cli) | `cli/` | Main CLI — manage instances, config, sync config, cloud and self-hosted |
17-
| [**@powersync/cli-core**](./packages/cli-core) | `packages/cli-core/` | Core types and base commands shared by the CLI and plugins |
18-
| [**@powersync/cli-schemas**](./packages/schemas) | `packages/schemas/` | Shared config schemas (cli.yaml, service.yaml, etc.) |
19-
| [**@powersync/cli-plugin-docker**](./plugins/docker) | `plugins/docker/` | Docker plugin — self-hosted PowerSync with Compose (configure, reset, start, stop) |
16+
| Package | Path | Description |
17+
| -------------------------------------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------- |
18+
| [**@powersync/cli**](./cli) | `cli/` | Main CLI — manage instances, config, sync config, cloud and self-hosted |
19+
| [**PowerSync CLI Config Studio**](./packages/editor) | `packages/editor/` | Monaco-based UI that edits `service.yaml`/`sync-config.yaml` and ships with the config-edit plugin |
20+
| [**@powersync/cli-core**](./packages/cli-core) | `packages/cli-core/` | Core types and base commands shared by the CLI and plugins |
21+
| [**@powersync/cli-schemas**](./packages/schemas) | `packages/schemas/` | Shared config schemas (cli.yaml, service.yaml, etc.) |
22+
| [**@powersync/cli-plugin-config-edit**](./plugins/config-edit) | `plugins/config-edit/` | CLI plugin that sets `POWERSYNC_PROJECT_CONTEXT` and serves the Config Studio with the Nitro server |
23+
| [**@powersync/cli-plugin-docker**](./plugins/docker) | `plugins/docker/` | Docker plugin — self-hosted PowerSync with Compose (configure, reset, start, stop) |
2024

2125
```
2226
├── cli/ # @powersync/cli — main CLI (commands, cloud/self-hosted, templates)
2327
├── packages/
2428
│ ├── cli-core/ # @powersync/cli-core — base commands & YAML utils (used by CLI + plugins)
29+
│ ├── editor/ # CLI Config Studio — Monaco web app that edits service.yaml/sync-config.yaml
2530
│ └── schemas/ # @powersync/cli-schemas — config validation (LinkConfig, CLIConfig)
2631
├── plugins/
32+
│ ├── config-edit/ # @powersync/cli-plugin-config-edit — serves the Config Studio preview
2733
│ └── docker/ # @powersync/cli-plugin-docker — docker configure, reset, start, stop
2834
├── examples/ # Sample projects initialized with the CLI (see examples/README.md)
2935
│ ├── cloud/
@@ -33,17 +39,19 @@ The workspace is split into the main CLI, shared **packages**, and optional **pl
3339
└── usage-docker.md # Docker plugin (configure, reset, start, stop, templates)
3440
```
3541

36-
- **cli** depends on **cli-core**, **cli-schemas**, and **@powersync/cli-plugin-docker**. It loads the docker plugin and re-exports base command types from cli-core.
37-
- **plugin-docker** (in **plugins/docker**) depends on **cli-core** and **cli-schemas**. No dependency on the CLI package.
42+
- **cli** depends on **cli-core**, **cli-schemas**, **@powersync/cli-plugin-config-edit**, and **@powersync/cli-plugin-docker**. It loads the bundled plugins and re-exports base command types from cli-core.
3843
- **cli-core** depends on **schemas**. It provides `SelfHostedInstanceCommand`, YAML helpers (`!env`), and shared types for plugins.
44+
- **packages/editor** builds the Config Studio assets consumed by the config-edit plugin and embeds schemas from `@powersync/cli-schemas`.
45+
- **@powersync/cli-plugin-config-edit** depends on **cli-core** and serves the built editor from `plugins/config-edit/editor-dist` using the Nitro server.
46+
- **@powersync/cli-plugin-docker** depends on **cli-core** and **cli-schemas**. No dependency on the CLI package.
3947

4048
Workspace roots are listed in [pnpm-workspace.yaml](./pnpm-workspace.yaml): `cli`, `packages/*`, `plugins/*`.
4149

4250
## OCLIF plugins
4351

44-
We rely on standard [OCLIF plugin loading](https://oclif.io/docs/plugins/) so plugins can register new commands or hook into command execution. The main CLI ships with a Docker plugin under [plugins/docker](./plugins/docker), and any other OCLIF-compatible plugin can be installed the same way.
52+
We rely on standard [OCLIF plugin loading](https://oclif.io/docs/plugins/) so plugins can register new commands or hook into command execution. The main CLI ships with Docker and Config Studio plugins under [plugins/docker](./plugins/docker) and [plugins/config-edit](./plugins/config-edit), and any other OCLIF-compatible plugin can be installed the same way.
4553

46-
For PowerSync-specific plugins, the optional [@powersync/cli-core](./packages/cli-core) package exposes base command helpers and shared types. The Docker plugin consumes these helpers and adds Docker-focused commands as a reference implementation.
54+
For PowerSync-specific plugins, the optional [@powersync/cli-core](./packages/cli-core) package exposes base command helpers and shared types. The bundled plugins consume these helpers and serve as reference implementations.
4755

4856
Users can manage their own installed plugins dynamically at runtime. Run `powersync plugins --help` for install, uninstall, and inspection options.
4957

@@ -72,6 +80,21 @@ powersync docker start
7280

7381
See [plugins/docker](./plugins/docker/README.md) and [docs/usage-docker.md](./docs/usage-docker.md) for details.
7482

83+
### Configuration editor
84+
85+
Open the Monaco-based Config Studio that edits `service.yaml`/`sync-config.yaml` directly inside your project:
86+
87+
```bash
88+
pnpm build # ensures packages/editor copies its dist to plugins/config-edit/editor-dist
89+
powersync edit config --directory ./powersync --port 3000
90+
```
91+
92+
- The command above is provided by **@powersync/cli-plugin-config-edit** and automatically sets `POWERSYNC_PROJECT_CONTEXT` (based on the linked project) before serving the built editor through the Nitro server.
93+
- Features include YAML schema validation, Monaco-powered completions, unsaved-change tracking, reset/save controls, and an error panel for schema violations.
94+
- For local UI work (without running the CLI command) export `POWERSYNC_PROJECT_CONTEXT` JSON that points at your project (the CLI sets this for you) and start the dev server: `POWERSYNC_PROJECT_CONTEXT='{"linkedProject":{"projectDirectory":"/path/to/project","linked":{"type":"self-hosted"}}}' pnpm --filter editor dev`.
95+
- Prefer the default host (127.0.0.1); only pass `--host 0.0.0.0` when you explicitly intend to expose the editor on your network.
96+
- Architecture, scripts, and troubleshooting tips live in [packages/editor/README.md](./packages/editor/README.md).
97+
7598
## Examples
7699

77100
The [**examples/**](./examples) folder contains basic projects initialized with the CLI. See [examples/README.md](./examples/README.md) for the full list and links to each example's README.

cli/README.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ See [docs/usage.md](../docs/usage.md) for full usage and resolution order (flags
264264
- [`powersync docker reset`](#powersync-docker-reset)
265265
- [`powersync docker start`](#powersync-docker-start)
266266
- [`powersync docker stop`](#powersync-docker-stop)
267+
- [`powersync edit config`](#powersync-edit-config)
267268
- [`powersync fetch config`](#powersync-fetch-config)
268269
- [`powersync fetch instances`](#powersync-fetch-instances)
269270
- [`powersync fetch status`](#powersync-fetch-status)
@@ -640,6 +641,46 @@ EXAMPLES
640641
641642
_See code: [@powersync/cli-plugin-docker](https://github.com/powersync-ja/cli/blob/v0.8.0/src/commands/docker/stop.ts)_
642643
644+
## `powersync edit config`
645+
646+
Open the PowerSync configuration editor (Nitro server).
647+
648+
```
649+
USAGE
650+
$ powersync edit config [--api-url <value> | --instance-id <value> | --org-id <value> | --project-id <value>]
651+
[--directory <value>] [--host <value>] [--port <value>]
652+
653+
FLAGS
654+
--host=<value> [default: 127.0.0.1] Host to bind the editor preview server. Pass 0.0.0.0 to expose on all interfaces.
655+
--port=<value> [default: 3000] Port for the editor preview server.
656+
657+
SELF_HOSTED_PROJECT FLAGS
658+
--api-url=<value> [Self-hosted] PowerSync API URL. When set, context is treated as self-hosted (exclusive with
659+
--instance-id). Resolved: flag → cli.yaml → API_URL.
660+
661+
PROJECT FLAGS
662+
--directory=<value> [default: powersync] Directory containing PowerSync config. Defaults to "powersync". This is
663+
required if multiple powersync config files are present in subdirectories of the current working
664+
directory.
665+
666+
CLOUD_PROJECT FLAGS
667+
--instance-id=<value> [Cloud] PowerSync Cloud instance ID (BSON ObjectID). When set, context is treated as cloud
668+
(exclusive with --api-url). Resolved: flag → cli.yaml → INSTANCE_ID.
669+
--org-id=<value> [Cloud] Organization ID (optional). Defaults to the token’s single org when only one is
670+
available; pass explicitly if the token has multiple orgs. Resolved: flag → cli.yaml → ORG_ID.
671+
--project-id=<value> [Cloud] Project ID. Resolved: flag → cli.yaml → PROJECT_ID.
672+
673+
DESCRIPTION
674+
Open the PowerSync configuration editor (Nitro server).
675+
676+
Loads the linked project context and runs the editor Nitro server to edit config files.
677+
678+
EXAMPLES
679+
$ powersync edit config
680+
681+
$ powersync edit config --directory ./powersync
682+
```
683+
643684
## `powersync fetch config`
644685
645686
[Cloud only] Print linked Cloud instance config (YAML or JSON).
@@ -756,13 +797,12 @@ Generate client schema file from instance schema and sync config.
756797
757798
```
758799
USAGE
759-
$ powersync generate schema --output dart|dotNet|flutterFlow|js|jsLegacy|kotlin|swift|ts --output-path <value>
760-
[--api-url <value> | --instance-id <value> | --org-id <value> | --project-id <value>] [--directory <value>]
800+
$ powersync generate schema --output dart|dotNet|js|jsLegacy|kotlin|swift|ts --output-path <value> [--api-url
801+
<value> | --instance-id <value> | --org-id <value> | --project-id <value>] [--directory <value>]
761802

762803
FLAGS
763-
--output=<option> (required) [default: type] Output type: dart, dotNet, flutterFlow, js, jsLegacy, kotlin, swift,
764-
ts
765-
<options: dart|dotNet|flutterFlow|js|jsLegacy|kotlin|swift|ts>
804+
--output=<option> (required) [default: type] Output type: dart, dotNet, js, jsLegacy, kotlin, swift, ts
805+
<options: dart|dotNet|js|jsLegacy|kotlin|swift|ts>
766806
--output-path=<value> (required) Path to output the schema file.
767807

768808
SELF_HOSTED_PROJECT FLAGS

cli/eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import rootConfig from '../eslint.config.mjs';
2+
3+
export default [...rootConfig];

cli/package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@
1515
"@oclif/plugin-commands": "^4.1.40",
1616
"@oclif/plugin-help": "^6",
1717
"@oclif/plugin-plugins": "^5",
18-
"@powersync-community/sync-config-rewriter": "^0.1.1",
18+
"@powersync-community/sync-config-rewriter": "^0.1.2",
1919
"@powersync/cli-core": "workspace:*",
20+
"@powersync/cli-plugin-config-edit": "workspace:*",
2021
"@powersync/cli-plugin-docker": "workspace:*",
2122
"@powersync/cli-schemas": "workspace:*",
22-
"@powersync/management-client": "0.0.1",
23-
"@powersync/management-types": "0.0.1",
24-
"@powersync/service-sync-rules": "^0.30.0",
25-
"@powersync/service-types": "0.0.0-dev-20260225093637",
23+
"@powersync/management-client": "^0.0.4",
24+
"@powersync/management-types": "^0.0.3",
25+
"@powersync/service-sync-rules": "^0.32.0",
26+
"@powersync/service-types": "^0.15.0",
27+
"bson": "^7.2.0",
2628
"fastify": "^5.0.0",
2729
"jose": "^6.1.3",
2830
"lodash": "^4.17.23",
@@ -77,6 +79,7 @@
7779
"@oclif/plugin-help",
7880
"@oclif/plugin-plugins",
7981
"@powersync/cli-plugin-docker",
82+
"@powersync/cli-plugin-config-edit",
8083
"@oclif/plugin-autocomplete",
8184
"@oclif/plugin-commands"
8285
],

0 commit comments

Comments
 (0)