@powersync/cli-plugin-docker 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 (36) hide show
  1. package/LICENSE +67 -0
  2. package/README.md +75 -0
  3. package/dist/DockerCommand.d.ts +7 -0
  4. package/dist/DockerCommand.js +7 -0
  5. package/dist/api/docker.d.ts +47 -0
  6. package/dist/api/docker.js +109 -0
  7. package/dist/commands/docker/configure.d.ts +13 -0
  8. package/dist/commands/docker/configure.js +182 -0
  9. package/dist/commands/docker/index.d.ts +12 -0
  10. package/dist/commands/docker/index.js +13 -0
  11. package/dist/commands/docker/reset.d.ts +11 -0
  12. package/dist/commands/docker/reset.js +37 -0
  13. package/dist/commands/docker/start.d.ts +11 -0
  14. package/dist/commands/docker/start.js +26 -0
  15. package/dist/commands/docker/stop.d.ts +14 -0
  16. package/dist/commands/docker/stop.js +44 -0
  17. package/dist/constants.d.ts +4 -0
  18. package/dist/constants.js +4 -0
  19. package/dist/docker.d.ts +1 -0
  20. package/dist/docker.js +1 -0
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +1 -0
  23. package/dist/templates/bucket-storage/external/ExternalBucketStorageModule.d.ts +3 -0
  24. package/dist/templates/bucket-storage/external/ExternalBucketStorageModule.js +24 -0
  25. package/dist/templates/bucket-storage/postgres/PostgresBucketStorageModule.d.ts +3 -0
  26. package/dist/templates/bucket-storage/postgres/PostgresBucketStorageModule.js +58 -0
  27. package/dist/templates/source-database/external/ExternalSourceDatabaseModule.d.ts +3 -0
  28. package/dist/templates/source-database/external/ExternalSourceDatabaseModule.js +30 -0
  29. package/dist/templates/source-database/postgres/PostgresSourceDatabaseModule.d.ts +3 -0
  30. package/dist/templates/source-database/postgres/PostgresSourceDatabaseModule.js +73 -0
  31. package/dist/templates/templates-index.d.ts +2 -0
  32. package/dist/templates/templates-index.js +10 -0
  33. package/dist/types.d.ts +26 -0
  34. package/dist/types.js +6 -0
  35. package/oclif.manifest.json +278 -0
  36. package/package.json +55 -0
@@ -0,0 +1,44 @@
1
+ import { Flags, ux } from '@oclif/core';
2
+ import { getDockerProjectName, runDockerComposeDown, runDockerComposeStop } from '../../docker.js';
3
+ import { DockerCommand } from '../../DockerCommand.js';
4
+ export default class DockerStop extends DockerCommand {
5
+ static description = 'Run `docker compose -p <project-name> stop` (containers are not removed by default). Does not require the project directory or a compose file, so you can run it from anywhere (e.g. after a reset conflict). Use --project-name or run from a project with cli.yaml to choose which project to stop. Use --remove to also remove the containers. Use --remove-volumes to also remove volumes (e.g. to re-run DB init scripts on next reset).';
6
+ static examples = [
7
+ '<%= config.bin %> <%= command.id %>',
8
+ '<%= config.bin %> <%= command.id %> --project-name=powersync_myapp --remove'
9
+ ];
10
+ static flags = {
11
+ ...DockerCommand.flags,
12
+ 'project-name': Flags.string({
13
+ description: 'Docker Compose project name to stop (e.g. powersync_myapp). If omitted and run from a project directory, uses plugins.docker.project_name from cli.yaml. Pass this to stop from any directory without loading the project.'
14
+ }),
15
+ remove: Flags.boolean({
16
+ default: false,
17
+ description: 'Remove containers after stopping (docker compose down). By default only stop (docker compose stop).'
18
+ }),
19
+ 'remove-volumes': Flags.boolean({
20
+ default: false,
21
+ description: 'Remove named volumes (docker compose down -v). Use to reset database/storage so init scripts run again on next reset. Implies --remove.'
22
+ })
23
+ };
24
+ static summary = 'Stop a PowerSync Docker Compose project by name.';
25
+ async run() {
26
+ const { flags } = await this.parse(DockerStop);
27
+ let projectName = flags['project-name'];
28
+ if (projectName == null || projectName === '') {
29
+ const { projectDirectory } = this.loadProject(flags, {
30
+ configFileRequired: true
31
+ });
32
+ projectName = getDockerProjectName(projectDirectory) ?? undefined;
33
+ }
34
+ if (projectName == null || projectName === '') {
35
+ this.error(ux.colorize('red', 'Project name required. Pass --project-name=<name> or run from a project directory that has cli.yaml with plugins.docker.project_name.'), { exit: 1 });
36
+ }
37
+ if (flags['remove-volumes'] || flags.remove) {
38
+ runDockerComposeDown(projectName, { removeVolumes: flags['remove-volumes'] });
39
+ }
40
+ else {
41
+ runDockerComposeStop(projectName);
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Default API token for local Docker development. Stored in cli.yaml (api_key) and service.yaml (api.tokens).
3
+ */
4
+ export declare const DEV_TOKEN = "dev-token-do-not-use-in-production";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Default API token for local Docker development. Stored in cli.yaml (api_key) and service.yaml (api.tokens).
3
+ */
4
+ export const DEV_TOKEN = 'dev-token-do-not-use-in-production';
@@ -0,0 +1 @@
1
+ export { type DockerComposeOptions, getDockerProjectName, listPowersyncProjectNames, logPowersyncProjectsStopHelp, resolveComposePath, runDockerCompose, runDockerComposeDown, runDockerComposeStop } from './api/docker.js';
package/dist/docker.js ADDED
@@ -0,0 +1 @@
1
+ export { getDockerProjectName, listPowersyncProjectNames, logPowersyncProjectsStopHelp, resolveComposePath, runDockerCompose, runDockerComposeDown, runDockerComposeStop } from './api/docker.js';
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { run } from '@oclif/core';
@@ -0,0 +1,3 @@
1
+ import { DockerModule } from '../../../types.js';
2
+ declare const ExternalBucketStorageModule: DockerModule;
3
+ export default ExternalBucketStorageModule;
@@ -0,0 +1,24 @@
1
+ import { Scalar } from 'yaml';
2
+ import { DockerModuleType } from '../../../types.js';
3
+ const ExternalBucketStorageModule = {
4
+ async apply(context) {
5
+ const { serviceConfig } = context;
6
+ context.command.log('Using external bucket storage. Set PS_STORAGE_SOURCE_URI in docker/.env to your PostgreSQL connection string before deploying.');
7
+ const uri = new Scalar('PS_STORAGE_SOURCE_URI');
8
+ uri.type = 'PLAIN';
9
+ uri.tag = '!env';
10
+ const storageConfig = {
11
+ sslmode: 'disable',
12
+ type: 'postgresql',
13
+ uri
14
+ };
15
+ serviceConfig.set('storage', storageConfig);
16
+ const additionalEnvironment = {
17
+ PS_STORAGE_SOURCE_URI: '<set-your-external-postgres-connection-string-in-env>'
18
+ };
19
+ return { additionalEnvironment };
20
+ },
21
+ name: 'external',
22
+ type: DockerModuleType.STORAGE
23
+ };
24
+ export default ExternalBucketStorageModule;
@@ -0,0 +1,3 @@
1
+ import { DockerModule } from '../../../types.js';
2
+ declare const PostgresBucketStorageModule: DockerModule;
3
+ export default PostgresBucketStorageModule;
@@ -0,0 +1,58 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { isMap, Scalar } from 'yaml';
5
+ import { DockerModuleType } from '../../../types.js';
6
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
+ const RESOURCES_DIR = path.join(__dirname, 'resources');
8
+ const PostgresBucketStorageModule = {
9
+ async apply(context) {
10
+ const { mainComposeDocument, modulesOutputDirectory, serviceConfig } = context;
11
+ const moduleOutputDirectory = path.join(modulesOutputDirectory, 'storage-postgres');
12
+ fs.mkdirSync(moduleOutputDirectory, { recursive: true });
13
+ const storageComposeFilePath = path.join(moduleOutputDirectory, 'postgres.storage.compose.yaml');
14
+ fs.copyFileSync(path.join(RESOURCES_DIR, 'postgres.storage.compose.yaml'), storageComposeFilePath);
15
+ const initScriptsSrc = path.join(RESOURCES_DIR, 'init-scripts');
16
+ const initScriptsDest = path.join(moduleOutputDirectory, 'init-scripts');
17
+ fs.mkdirSync(initScriptsDest, { recursive: true });
18
+ if (fs.existsSync(initScriptsSrc)) {
19
+ fs.cpSync(initScriptsSrc, initScriptsDest, { recursive: true });
20
+ }
21
+ const includePath = path.relative(context.composeOutputDirectory, storageComposeFilePath);
22
+ mainComposeDocument.get('include').add(includePath);
23
+ const servicesNode = mainComposeDocument.get('services');
24
+ if (isMap(servicesNode)) {
25
+ const powersyncServiceNode = servicesNode.get('powersync');
26
+ if (isMap(powersyncServiceNode)) {
27
+ const dependsOnNode = powersyncServiceNode.get('depends_on');
28
+ if (isMap(dependsOnNode)) {
29
+ dependsOnNode.set('pg-storage', { condition: 'service_healthy' });
30
+ }
31
+ }
32
+ }
33
+ const uri = new Scalar('PS_STORAGE_SOURCE_URI');
34
+ uri.type = 'PLAIN';
35
+ uri.tag = '!env';
36
+ const storageConfig = {
37
+ sslmode: 'disable',
38
+ type: 'postgresql',
39
+ uri
40
+ };
41
+ serviceConfig.set('storage', storageConfig);
42
+ /* eslint-disable perfectionist/sort-objects */
43
+ const additionalEnvironment = {
44
+ PS_STORAGE_DATABASE: 'powersync_storage',
45
+ PS_STORAGE_PASSWORD: 'changeme',
46
+ PS_STORAGE_PORT: '5433',
47
+ PS_STORAGE_USER: 'postgres',
48
+ PS_STORAGE_SOURCE_URI:
49
+ // eslint-disable-next-line no-template-curly-in-string
50
+ 'postgresql://${PS_STORAGE_USER}:${PS_STORAGE_PASSWORD}@pg-storage:${PS_STORAGE_PORT}/${PS_STORAGE_DATABASE}'
51
+ };
52
+ /* eslint-enable perfectionist/sort-objects */
53
+ return { additionalEnvironment };
54
+ },
55
+ name: 'postgres',
56
+ type: DockerModuleType.STORAGE
57
+ };
58
+ export default PostgresBucketStorageModule;
@@ -0,0 +1,3 @@
1
+ import { DockerModule } from '../../../types.js';
2
+ declare const ExternalSourceDatabaseModule: DockerModule;
3
+ export default ExternalSourceDatabaseModule;
@@ -0,0 +1,30 @@
1
+ import { ux } from '@oclif/core';
2
+ import path from 'node:path';
3
+ import { Scalar } from 'yaml';
4
+ import { DockerModuleType } from '../../../types.js';
5
+ const ExternalSourceDatabaseModule = {
6
+ async apply(context) {
7
+ const { projectDirectory, serviceConfig } = context;
8
+ context.command.log(ux.colorize('yellow', `Using external replication database. Set PS_DATA_SOURCE_URI in ${path.join(projectDirectory, 'docker', '.env')} to your PostgreSQL connection string before deploying.`));
9
+ const uri = new Scalar('PS_DATA_SOURCE_URI');
10
+ uri.type = 'PLAIN';
11
+ uri.tag = '!env';
12
+ const replicationConfig = {
13
+ connections: [
14
+ {
15
+ sslmode: 'disable',
16
+ type: 'postgresql',
17
+ uri
18
+ }
19
+ ]
20
+ };
21
+ serviceConfig.set('replication', replicationConfig);
22
+ const additionalEnvironment = {
23
+ PS_DATA_SOURCE_URI: '<set-your-external-postgres-connection-string-in-env>'
24
+ };
25
+ return { additionalEnvironment };
26
+ },
27
+ name: 'external',
28
+ type: DockerModuleType.SOURCE_DATABASE
29
+ };
30
+ export default ExternalSourceDatabaseModule;
@@ -0,0 +1,3 @@
1
+ import { DockerModule } from '../../../types.js';
2
+ declare const PostgresSourceDatabaseModule: DockerModule;
3
+ export default PostgresSourceDatabaseModule;
@@ -0,0 +1,73 @@
1
+ import { ux } from '@oclif/core';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { isMap, Scalar } from 'yaml';
6
+ import { DockerModuleType } from '../../../types.js';
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const RESOURCES_DIR = path.join(__dirname, 'resources');
9
+ const PostgresSourceDatabaseModule = {
10
+ async apply(context) {
11
+ const { mainComposeDocument, modulesOutputDirectory, serviceConfig } = context;
12
+ context.command.log([
13
+ `${ux.colorize('yellow', 'Note')}: the Postgres database template is incomplete.`,
14
+ 'Update docker/modules/database-postgres/init-scripts/ with your schema (tables and publication) before deploying.',
15
+ 'Init scripts run only when the DB volume is empty. If you see "Publication powersync does not exist", run: ' +
16
+ ux.colorize('blue', 'powersync docker stop --remove --remove-volumes') +
17
+ ' then ' +
18
+ ux.colorize('blue', 'powersync docker reset') +
19
+ ' again.'
20
+ ].join('\n'));
21
+ context.command.log('');
22
+ const moduleOutputDirectory = path.join(modulesOutputDirectory, 'database-postgres');
23
+ fs.mkdirSync(moduleOutputDirectory, { recursive: true });
24
+ const databaseComposeFilePath = path.join(moduleOutputDirectory, 'postgres.database.compose.yaml');
25
+ fs.copyFileSync(path.join(RESOURCES_DIR, 'postgres.database.compose.yaml'), databaseComposeFilePath);
26
+ const initScriptsSrc = path.join(RESOURCES_DIR, 'init-scripts');
27
+ const initScriptsDest = path.join(moduleOutputDirectory, 'init-scripts');
28
+ fs.mkdirSync(initScriptsDest, { recursive: true });
29
+ if (fs.existsSync(initScriptsSrc)) {
30
+ fs.cpSync(initScriptsSrc, initScriptsDest, { recursive: true });
31
+ }
32
+ const includePath = path.relative(context.composeOutputDirectory, databaseComposeFilePath);
33
+ mainComposeDocument.get('include').add(includePath);
34
+ const servicesNode = mainComposeDocument.get('services');
35
+ if (isMap(servicesNode)) {
36
+ const powersyncServiceNode = servicesNode.get('powersync');
37
+ if (isMap(powersyncServiceNode)) {
38
+ const dependsOnNode = powersyncServiceNode.get('depends_on');
39
+ if (isMap(dependsOnNode)) {
40
+ dependsOnNode.set('pg-db', { condition: 'service_healthy' });
41
+ }
42
+ }
43
+ }
44
+ const uri = new Scalar('PS_DATA_SOURCE_URI');
45
+ uri.type = 'PLAIN';
46
+ uri.tag = '!env';
47
+ const replicationConfig = {
48
+ connections: [
49
+ {
50
+ sslmode: 'disable',
51
+ type: 'postgresql',
52
+ uri
53
+ }
54
+ ]
55
+ };
56
+ serviceConfig.set('replication', replicationConfig);
57
+ /* eslint-disable perfectionist/sort-objects */
58
+ const additionalEnvironment = {
59
+ PS_DATABASE_NAME: 'postgres',
60
+ PS_DATABASE_PASSWORD: 'changeme',
61
+ PS_DATABASE_PORT: '5432',
62
+ PS_DATABASE_USER: 'postgres',
63
+ PS_DATA_SOURCE_URI:
64
+ // eslint-disable-next-line no-template-curly-in-string
65
+ 'postgresql://${PS_DATABASE_USER}:${PS_DATABASE_PASSWORD}@pg-db:${PS_DATABASE_PORT}/${PS_DATABASE_NAME}'
66
+ };
67
+ /* eslint-enable perfectionist/sort-objects */
68
+ return { additionalEnvironment };
69
+ },
70
+ name: 'postgres',
71
+ type: DockerModuleType.SOURCE_DATABASE
72
+ };
73
+ export default PostgresSourceDatabaseModule;
@@ -0,0 +1,2 @@
1
+ import { DockerModule, DockerModuleType } from '../types.js';
2
+ export declare const TEMPLATES: Record<DockerModuleType, DockerModule[]>;
@@ -0,0 +1,10 @@
1
+ import { DockerModuleType } from '../types.js';
2
+ import ExternalBucketStorageModule from './bucket-storage/external/ExternalBucketStorageModule.js';
3
+ import PostgresBucketStorageModule from './bucket-storage/postgres/PostgresBucketStorageModule.js';
4
+ import ExternalSourceDatabaseModule from './source-database/external/ExternalSourceDatabaseModule.js';
5
+ import PostgresSourceDatabaseModule from './source-database/postgres/PostgresSourceDatabaseModule.js';
6
+ export const TEMPLATES = {
7
+ [DockerModuleType.BACKEND]: [],
8
+ [DockerModuleType.SOURCE_DATABASE]: [PostgresSourceDatabaseModule, ExternalSourceDatabaseModule],
9
+ [DockerModuleType.STORAGE]: [PostgresBucketStorageModule, ExternalBucketStorageModule]
10
+ };
@@ -0,0 +1,26 @@
1
+ import type { Command } from '@oclif/core';
2
+ import type { Document } from 'yaml';
3
+ export declare enum DockerModuleType {
4
+ BACKEND = "backend",
5
+ SOURCE_DATABASE = "source_database",
6
+ STORAGE = "storage"
7
+ }
8
+ export type DockerModuleContext = {
9
+ /** Invoking command, for logging and output. */
10
+ command: Command;
11
+ /** Directory containing docker-compose.yaml (powersync/docker/). Used for relative include paths. */
12
+ composeOutputDirectory: string;
13
+ /** Main docker-compose document (docker/). Modules may add to include and services.powersync.depends_on. */
14
+ mainComposeDocument: Document;
15
+ modulesOutputDirectory: string;
16
+ projectDirectory: string;
17
+ serviceConfig: Document;
18
+ };
19
+ export type DockerModuleConfigResponse = {
20
+ additionalEnvironment?: Record<string, string>;
21
+ };
22
+ export type DockerModule = {
23
+ apply: (context: DockerModuleContext) => Promise<DockerModuleConfigResponse>;
24
+ name: string;
25
+ type: DockerModuleType;
26
+ };
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ export var DockerModuleType;
2
+ (function (DockerModuleType) {
3
+ DockerModuleType["BACKEND"] = "backend";
4
+ DockerModuleType["SOURCE_DATABASE"] = "source_database";
5
+ DockerModuleType["STORAGE"] = "storage";
6
+ })(DockerModuleType || (DockerModuleType = {}));
@@ -0,0 +1,278 @@
1
+ {
2
+ "commands": {
3
+ "docker:configure": {
4
+ "aliases": [],
5
+ "args": {},
6
+ "description": "Configures a self hosted project with Docker Compose services.\nDocker configuration is located in ./powersync/docker/.\nConfigured projects can be started with \"powersync docker start\".",
7
+ "examples": [
8
+ "<%= config.bin %> <%= command.id %>",
9
+ "<%= config.bin %> <%= command.id %> --database=postgres --storage=postgres"
10
+ ],
11
+ "flags": {
12
+ "directory": {
13
+ "description": "Directory containing PowerSync config. Defaults to \"powersync\". This is required if multiple powersync config files are present in subdirectories of the current working directory.",
14
+ "helpGroup": "PROJECT",
15
+ "name": "directory",
16
+ "default": "powersync",
17
+ "hasDynamicHelp": false,
18
+ "multiple": false,
19
+ "type": "option"
20
+ },
21
+ "api-url": {
22
+ "description": "PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.",
23
+ "helpGroup": "SELF_HOSTED_PROJECT",
24
+ "name": "api-url",
25
+ "required": false,
26
+ "hasDynamicHelp": false,
27
+ "multiple": false,
28
+ "type": "option"
29
+ },
30
+ "database": {
31
+ "description": "Database module for replication source. Omit to be prompted.",
32
+ "name": "database",
33
+ "required": false,
34
+ "hasDynamicHelp": false,
35
+ "multiple": false,
36
+ "options": [
37
+ "postgres",
38
+ "external",
39
+ "none"
40
+ ],
41
+ "type": "option"
42
+ },
43
+ "storage": {
44
+ "description": "Storage module for PowerSync bucket metadata. Omit to be prompted.",
45
+ "name": "storage",
46
+ "required": false,
47
+ "hasDynamicHelp": false,
48
+ "multiple": false,
49
+ "options": [
50
+ "postgres",
51
+ "external",
52
+ "none"
53
+ ],
54
+ "type": "option"
55
+ }
56
+ },
57
+ "hasDynamicHelp": false,
58
+ "hiddenAliases": [],
59
+ "id": "docker:configure",
60
+ "pluginAlias": "@powersync/cli-plugin-docker",
61
+ "pluginName": "@powersync/cli-plugin-docker",
62
+ "pluginType": "core",
63
+ "strict": true,
64
+ "summary": "Configures a self hosted project with Docker Compose services.",
65
+ "enableJsonFlag": false,
66
+ "commandHelpGroup": "LOCAL DEVELOPMENT",
67
+ "isESM": true,
68
+ "relativePath": [
69
+ "dist",
70
+ "commands",
71
+ "docker",
72
+ "configure.js"
73
+ ]
74
+ },
75
+ "docker": {
76
+ "aliases": [],
77
+ "args": {},
78
+ "description": "Scaffold and run a self-hosted PowerSync stack via Docker. Use `docker configure` to create powersync/docker/, then `docker reset` (stop+remove then start) or `docker start` / `docker stop`.",
79
+ "examples": [
80
+ "<%= config.bin %> <%= command.id %>"
81
+ ],
82
+ "flags": {
83
+ "directory": {
84
+ "description": "Directory containing PowerSync config. Defaults to \"powersync\". This is required if multiple powersync config files are present in subdirectories of the current working directory.",
85
+ "helpGroup": "PROJECT",
86
+ "name": "directory",
87
+ "default": "powersync",
88
+ "hasDynamicHelp": false,
89
+ "multiple": false,
90
+ "type": "option"
91
+ },
92
+ "api-url": {
93
+ "description": "PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.",
94
+ "helpGroup": "SELF_HOSTED_PROJECT",
95
+ "name": "api-url",
96
+ "required": false,
97
+ "hasDynamicHelp": false,
98
+ "multiple": false,
99
+ "type": "option"
100
+ }
101
+ },
102
+ "hasDynamicHelp": false,
103
+ "hidden": true,
104
+ "hiddenAliases": [],
105
+ "id": "docker",
106
+ "pluginAlias": "@powersync/cli-plugin-docker",
107
+ "pluginName": "@powersync/cli-plugin-docker",
108
+ "pluginType": "core",
109
+ "strict": true,
110
+ "summary": "[Self-hosted only] Manage self-hosted PowerSync with Docker Compose (configure, reset, start, stop).",
111
+ "enableJsonFlag": false,
112
+ "commandHelpGroup": "LOCAL DEVELOPMENT",
113
+ "isESM": true,
114
+ "relativePath": [
115
+ "dist",
116
+ "commands",
117
+ "docker",
118
+ "index.js"
119
+ ]
120
+ },
121
+ "docker:reset": {
122
+ "aliases": [],
123
+ "args": {},
124
+ "description": "Run `docker compose down` then `docker compose up -d --wait`: stops and removes containers, then starts the stack and waits for services (including PowerSync) to be healthy. Use when you want a clean bring-up (e.g. after config changes). Use `powersync status` to debug running instances.",
125
+ "examples": [
126
+ "<%= config.bin %> <%= command.id %>"
127
+ ],
128
+ "flags": {
129
+ "directory": {
130
+ "description": "Directory containing PowerSync config. Defaults to \"powersync\". This is required if multiple powersync config files are present in subdirectories of the current working directory.",
131
+ "helpGroup": "PROJECT",
132
+ "name": "directory",
133
+ "default": "powersync",
134
+ "hasDynamicHelp": false,
135
+ "multiple": false,
136
+ "type": "option"
137
+ },
138
+ "api-url": {
139
+ "description": "PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.",
140
+ "helpGroup": "SELF_HOSTED_PROJECT",
141
+ "name": "api-url",
142
+ "required": false,
143
+ "hasDynamicHelp": false,
144
+ "multiple": false,
145
+ "type": "option"
146
+ }
147
+ },
148
+ "hasDynamicHelp": false,
149
+ "hiddenAliases": [],
150
+ "id": "docker:reset",
151
+ "pluginAlias": "@powersync/cli-plugin-docker",
152
+ "pluginName": "@powersync/cli-plugin-docker",
153
+ "pluginType": "core",
154
+ "strict": true,
155
+ "summary": "Reset the self-hosted PowerSync stack (stop and remove, then start).",
156
+ "enableJsonFlag": false,
157
+ "commandHelpGroup": "LOCAL DEVELOPMENT",
158
+ "isESM": true,
159
+ "relativePath": [
160
+ "dist",
161
+ "commands",
162
+ "docker",
163
+ "reset.js"
164
+ ]
165
+ },
166
+ "docker:start": {
167
+ "aliases": [],
168
+ "args": {},
169
+ "description": "Runs `docker compose up -d --wait` for the project docker/ compose file; waits for services (including PowerSync) to be healthy. Use `powersync status` to debug running instances.",
170
+ "examples": [
171
+ "<%= config.bin %> <%= command.id %>"
172
+ ],
173
+ "flags": {
174
+ "directory": {
175
+ "description": "Directory containing PowerSync config. Defaults to \"powersync\". This is required if multiple powersync config files are present in subdirectories of the current working directory.",
176
+ "helpGroup": "PROJECT",
177
+ "name": "directory",
178
+ "default": "powersync",
179
+ "hasDynamicHelp": false,
180
+ "multiple": false,
181
+ "type": "option"
182
+ },
183
+ "api-url": {
184
+ "description": "PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.",
185
+ "helpGroup": "SELF_HOSTED_PROJECT",
186
+ "name": "api-url",
187
+ "required": false,
188
+ "hasDynamicHelp": false,
189
+ "multiple": false,
190
+ "type": "option"
191
+ }
192
+ },
193
+ "hasDynamicHelp": false,
194
+ "hiddenAliases": [],
195
+ "id": "docker:start",
196
+ "pluginAlias": "@powersync/cli-plugin-docker",
197
+ "pluginName": "@powersync/cli-plugin-docker",
198
+ "pluginType": "core",
199
+ "strict": true,
200
+ "summary": "Start the self-hosted PowerSync stack via Docker Compose.",
201
+ "enableJsonFlag": false,
202
+ "commandHelpGroup": "LOCAL DEVELOPMENT",
203
+ "isESM": true,
204
+ "relativePath": [
205
+ "dist",
206
+ "commands",
207
+ "docker",
208
+ "start.js"
209
+ ]
210
+ },
211
+ "docker:stop": {
212
+ "aliases": [],
213
+ "args": {},
214
+ "description": "Run `docker compose -p <project-name> stop` (containers are not removed by default). Does not require the project directory or a compose file, so you can run it from anywhere (e.g. after a reset conflict). Use --project-name or run from a project with cli.yaml to choose which project to stop. Use --remove to also remove the containers. Use --remove-volumes to also remove volumes (e.g. to re-run DB init scripts on next reset).",
215
+ "examples": [
216
+ "<%= config.bin %> <%= command.id %>",
217
+ "<%= config.bin %> <%= command.id %> --project-name=powersync_myapp --remove"
218
+ ],
219
+ "flags": {
220
+ "directory": {
221
+ "description": "Directory containing PowerSync config. Defaults to \"powersync\". This is required if multiple powersync config files are present in subdirectories of the current working directory.",
222
+ "helpGroup": "PROJECT",
223
+ "name": "directory",
224
+ "default": "powersync",
225
+ "hasDynamicHelp": false,
226
+ "multiple": false,
227
+ "type": "option"
228
+ },
229
+ "api-url": {
230
+ "description": "PowerSync API URL. Resolved: flag → cli.yaml → API_URL environment variable.",
231
+ "helpGroup": "SELF_HOSTED_PROJECT",
232
+ "name": "api-url",
233
+ "required": false,
234
+ "hasDynamicHelp": false,
235
+ "multiple": false,
236
+ "type": "option"
237
+ },
238
+ "project-name": {
239
+ "description": "Docker Compose project name to stop (e.g. powersync_myapp). If omitted and run from a project directory, uses plugins.docker.project_name from cli.yaml. Pass this to stop from any directory without loading the project.",
240
+ "name": "project-name",
241
+ "hasDynamicHelp": false,
242
+ "multiple": false,
243
+ "type": "option"
244
+ },
245
+ "remove": {
246
+ "description": "Remove containers after stopping (docker compose down). By default only stop (docker compose stop).",
247
+ "name": "remove",
248
+ "allowNo": false,
249
+ "type": "boolean"
250
+ },
251
+ "remove-volumes": {
252
+ "description": "Remove named volumes (docker compose down -v). Use to reset database/storage so init scripts run again on next reset. Implies --remove.",
253
+ "name": "remove-volumes",
254
+ "allowNo": false,
255
+ "type": "boolean"
256
+ }
257
+ },
258
+ "hasDynamicHelp": false,
259
+ "hiddenAliases": [],
260
+ "id": "docker:stop",
261
+ "pluginAlias": "@powersync/cli-plugin-docker",
262
+ "pluginName": "@powersync/cli-plugin-docker",
263
+ "pluginType": "core",
264
+ "strict": true,
265
+ "summary": "Stop a PowerSync Docker Compose project by name.",
266
+ "enableJsonFlag": false,
267
+ "commandHelpGroup": "LOCAL DEVELOPMENT",
268
+ "isESM": true,
269
+ "relativePath": [
270
+ "dist",
271
+ "commands",
272
+ "docker",
273
+ "stop.js"
274
+ ]
275
+ }
276
+ },
277
+ "version": "0.9.0"
278
+ }