@byterings-dev/cli 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ByteRings
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ import { type ConfigDocument, type ConfigPlan } from '@byterings-dev/contracts';
2
+ import { type PlatformClient } from '@byterings-dev/sdk';
3
+ export declare const ENTITIES_DIR = "entities";
4
+ export declare class CliError extends Error {
5
+ }
6
+ /** Writes one JSON file per entity; removes files of entities that no longer exist. */
7
+ export declare function exportSchema(client: PlatformClient, dir: string): Promise<string[]>;
8
+ /** Reads and validates every entity file. */
9
+ export declare function loadSchema(dir: string): Promise<ConfigDocument>;
10
+ /** Human-readable plan. */
11
+ export declare function formatPlan(plan: ConfigPlan): string;
12
+ export declare function diffSchema(client: PlatformClient, dir: string, prune?: boolean): Promise<ConfigPlan>;
13
+ export interface PushOptions {
14
+ prune?: boolean;
15
+ /** Apply without asking (non-destructive plans only unless allowDestructive). */
16
+ yes?: boolean;
17
+ allowDestructive?: boolean;
18
+ confirm?: (question: string) => Promise<boolean>;
19
+ log?: (line: string) => void;
20
+ }
21
+ /** Shows the plan, asks for confirmation, then applies it atomically. */
22
+ export declare function pushSchema(client: PlatformClient, dir: string, opts?: PushOptions): Promise<ConfigPlan>;
23
+ /** Generates TypeScript interfaces for the tenant's entities. */
24
+ export declare function writeTypes(client: PlatformClient, out: string): Promise<void>;
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliError = exports.ENTITIES_DIR = void 0;
4
+ exports.exportSchema = exportSchema;
5
+ exports.loadSchema = loadSchema;
6
+ exports.formatPlan = formatPlan;
7
+ exports.diffSchema = diffSchema;
8
+ exports.pushSchema = pushSchema;
9
+ exports.writeTypes = writeTypes;
10
+ /**
11
+ * CLI command implementations, exported for programmatic use and tests.
12
+ * Schema files live in `<dir>/entities/<key>.json` (developmentPlan §11.2).
13
+ */
14
+ const promises_1 = require("node:fs/promises");
15
+ const node_path_1 = require("node:path");
16
+ const contracts_1 = require("@byterings-dev/contracts");
17
+ const sdk_1 = require("@byterings-dev/sdk");
18
+ exports.ENTITIES_DIR = 'entities';
19
+ class CliError extends Error {
20
+ }
21
+ exports.CliError = CliError;
22
+ /** Writes one JSON file per entity; removes files of entities that no longer exist. */
23
+ async function exportSchema(client, dir) {
24
+ const document = await client.config.export();
25
+ const target = (0, node_path_1.join)(dir, exports.ENTITIES_DIR);
26
+ await (0, promises_1.mkdir)(target, { recursive: true });
27
+ const written = new Set();
28
+ for (const entity of document.entities) {
29
+ const file = `${entity.key}.json`;
30
+ await (0, promises_1.writeFile)((0, node_path_1.join)(target, file), `${JSON.stringify(entity, null, 2)}\n`, 'utf8');
31
+ written.add(file);
32
+ }
33
+ for (const file of await (0, promises_1.readdir)(target)) {
34
+ if (file.endsWith('.json') && !written.has(file))
35
+ await (0, promises_1.rm)((0, node_path_1.join)(target, file));
36
+ }
37
+ return [...written].sort();
38
+ }
39
+ /** Reads and validates every entity file. */
40
+ async function loadSchema(dir) {
41
+ const source = (0, node_path_1.join)(dir, exports.ENTITIES_DIR);
42
+ let files;
43
+ try {
44
+ files = (await (0, promises_1.readdir)(source)).filter((f) => f.endsWith('.json')).sort();
45
+ }
46
+ catch {
47
+ throw new CliError(`No schema directory found at ${source}. Run "bytecontent export" first.`);
48
+ }
49
+ const entities = [];
50
+ for (const file of files) {
51
+ const path = (0, node_path_1.join)(source, file);
52
+ let json;
53
+ try {
54
+ json = JSON.parse(await (0, promises_1.readFile)(path, 'utf8'));
55
+ }
56
+ catch (error) {
57
+ throw new CliError(`${path}: invalid JSON (${error.message})`);
58
+ }
59
+ const parsed = contracts_1.configEntitySchema.safeParse(json);
60
+ if (!parsed.success) {
61
+ const issue = parsed.error.issues[0];
62
+ throw new CliError(`${path}: ${issue?.path.join('.') || '(root)'}: ${issue?.message}`);
63
+ }
64
+ if (`${parsed.data.key}.json` !== file) {
65
+ throw new CliError(`${path}: file name must match the entity key ("${parsed.data.key}.json")`);
66
+ }
67
+ entities.push(parsed.data);
68
+ }
69
+ return contracts_1.configDocumentSchema.parse({ version: 1, entities });
70
+ }
71
+ const SYMBOLS = {
72
+ createEntity: '+',
73
+ createField: '+',
74
+ updateEntity: '~',
75
+ updateField: '~',
76
+ deleteEntity: '-',
77
+ deleteField: '-',
78
+ };
79
+ /** Human-readable plan. */
80
+ function formatPlan(plan) {
81
+ const lines = [];
82
+ for (const change of plan.changes) {
83
+ const target = change.field ? `${change.entity}.${change.field}` : change.entity;
84
+ const detail = change.changes?.length ? ` (${change.changes.join(', ')})` : '';
85
+ const warning = change.destructive ? ' [destructive]' : '';
86
+ lines.push(` ${SYMBOLS[change.action] ?? '?'} ${change.action} ${target}${detail}${warning}`);
87
+ }
88
+ for (const conflict of plan.conflicts) {
89
+ const target = conflict.field ? `${conflict.entity}.${conflict.field}` : conflict.entity;
90
+ lines.push(` ! conflict ${target}: ${conflict.message}`);
91
+ }
92
+ if (lines.length === 0)
93
+ return 'No changes. The installation matches the schema files.';
94
+ const summary = `${plan.changes.length} change(s)${plan.destructive ? ', including destructive changes' : ''}${plan.conflicts.length ? `, ${plan.conflicts.length} conflict(s)` : ''}`;
95
+ return [`Plan: ${summary}`, ...lines].join('\n');
96
+ }
97
+ async function diffSchema(client, dir, prune = false) {
98
+ return client.config.diff(await loadSchema(dir), { prune });
99
+ }
100
+ /** Shows the plan, asks for confirmation, then applies it atomically. */
101
+ async function pushSchema(client, dir, opts = {}) {
102
+ const log = opts.log ?? (() => undefined);
103
+ const document = await loadSchema(dir);
104
+ const plan = await client.config.diff(document, { prune: opts.prune });
105
+ log(formatPlan(plan));
106
+ if (plan.conflicts.length)
107
+ throw new CliError('Resolve the conflicts above before pushing.');
108
+ if (plan.changes.length === 0)
109
+ return plan;
110
+ if (plan.destructive && !opts.allowDestructive) {
111
+ throw new CliError('The plan deletes entities or fields. Re-run with --allow-destructive to apply it.');
112
+ }
113
+ if (!opts.yes) {
114
+ const ok = opts.confirm ? await opts.confirm('Apply these changes?') : false;
115
+ if (!ok)
116
+ throw new CliError('Aborted. Nothing was changed.');
117
+ }
118
+ const applied = await client.config.apply(document, {
119
+ prune: opts.prune,
120
+ confirmDestructive: plan.destructive && opts.allowDestructive === true,
121
+ });
122
+ log(`Applied ${applied.changes.length} change(s).`);
123
+ return applied;
124
+ }
125
+ /** Generates TypeScript interfaces for the tenant's entities. */
126
+ async function writeTypes(client, out) {
127
+ const entities = await client.entities.list();
128
+ await (0, promises_1.mkdir)((0, node_path_1.dirname)(out), { recursive: true });
129
+ await (0, promises_1.writeFile)(out, (0, sdk_1.generateTypes)(entities), 'utf8');
130
+ }
131
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":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CAAC;AACjB,CAAC;AAED,iEAAiE;AAC1D,KAAK,UAAU,UAAU,CAAC,MAAsB,EAAE,GAAW;IAClE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC9C,MAAM,IAAA,gBAAK,EAAC,IAAA,mBAAO,EAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,IAAA,oBAAS,EAAC,GAAG,EAAE,IAAA,mBAAa,EAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,360 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ /**
5
+ * bytecontent - developer CLI for the platform.
6
+ *
7
+ * Connection: --url / BYTECONTENT_URL (default http://localhost:4000) and
8
+ * --api-key / BYTECONTENT_API_KEY (an API key with metadata scopes).
9
+ */
10
+ const node_fs_1 = require("node:fs");
11
+ const node_fs_2 = require("node:fs");
12
+ const promises_1 = require("node:fs/promises");
13
+ const node_path_1 = require("node:path");
14
+ const promises_2 = require("node:readline/promises");
15
+ const node_util_1 = require("node:util");
16
+ const commander_1 = require("commander");
17
+ const sdk_1 = require("@byterings-dev/sdk");
18
+ const commands_1 = require("./commands");
19
+ const marketplace_1 = require("./marketplace");
20
+ const marketplace_install_1 = require("./marketplace-install");
21
+ const updater_1 = require("./updater");
22
+ const plugins_1 = require("./plugins");
23
+ const lifecycle_1 = require("./lifecycle");
24
+ const install_1 = require("./install");
25
+ const cliPackage = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
26
+ const program = new commander_1.Command();
27
+ program
28
+ .name('bytecontent')
29
+ .description('Developer CLI for the metadata-driven application platform')
30
+ .option('--url <url>', 'API base URL', process.env.BYTECONTENT_URL ?? 'http://localhost:4000')
31
+ .option('--api-key <key>', 'API key (or set BYTECONTENT_API_KEY)', process.env.BYTECONTENT_API_KEY);
32
+ program
33
+ .command('version')
34
+ .description('Show CLI, platform release, and Node.js support versions')
35
+ .option('--json', 'Print machine-readable version information')
36
+ .action(async (opts) => {
37
+ const release = await (0, lifecycle_1.loadReleaseSupport)();
38
+ const info = {
39
+ cliVersion: cliPackage.version,
40
+ platformVersion: release.platformVersion,
41
+ nodeVersion: process.version,
42
+ supportedNodeMajors: release.support.node.supportedMajorVersions,
43
+ testedCombinations: release.compatibilityEvidence.results,
44
+ };
45
+ if (opts.json)
46
+ console.log(JSON.stringify(info, null, 2));
47
+ else {
48
+ console.log(`ByteContent CLI ${info.cliVersion}`);
49
+ console.log(`Platform release ${info.platformVersion}`);
50
+ console.log(`Node.js ${info.nodeVersion} (supported major versions: ${info.supportedNodeMajors.join(', ')})`);
51
+ console.log(`Published compatibility results: ${info.testedCombinations.length}`);
52
+ }
53
+ });
54
+ program
55
+ .command('doctor')
56
+ .description('Check runtime support, installation, Docker, and API readiness')
57
+ .option('--url <url>', 'API base URL')
58
+ .option('--env-file <file>', 'Environment file to inspect')
59
+ .option('--json', 'Print machine-readable checks')
60
+ .action(async (opts) => {
61
+ const deployment = await (0, lifecycle_1.detectDeployment)(process.cwd());
62
+ const envFile = opts.envFile ?? (0, install_1.defaultEnvFile)(deployment === 'docker-compose' ? 'docker' : 'source');
63
+ const envPath = (0, install_1.resolveEnvPath)(process.cwd(), envFile);
64
+ if ((0, node_fs_2.existsSync)(envPath))
65
+ process.loadEnvFile(envPath);
66
+ const url = opts.url ??
67
+ process.env.BYTECONTENT_URL ??
68
+ process.env.API_URL ??
69
+ (process.env.DOMAIN ? `https://${process.env.DOMAIN}` : undefined) ??
70
+ program.opts().url;
71
+ const checks = await (0, lifecycle_1.runDoctor)(process.cwd(), url);
72
+ const pinnedPlugins = await (0, plugins_1.verifyLockedPlugins)(process.cwd());
73
+ checks.push({
74
+ name: 'Plugin integrity',
75
+ status: pinnedPlugins.some((plugin) => !plugin.valid) ? 'fail' : 'pass',
76
+ detail: pinnedPlugins.length === 0
77
+ ? 'no pinned local plugins'
78
+ : `${pinnedPlugins.filter((plugin) => plugin.valid).length}/${pinnedPlugins.length} pinned plugin(s) match their lock file`,
79
+ });
80
+ if (opts.json)
81
+ console.log(JSON.stringify({ checks }, null, 2));
82
+ else {
83
+ for (const check of checks) {
84
+ const icon = check.status === 'pass' ? '✓' : check.status === 'warn' ? '!' : '✗';
85
+ console.log(`${icon} ${check.name}: ${check.detail}`);
86
+ }
87
+ }
88
+ if (checks.some((check) => check.status === 'fail'))
89
+ process.exitCode = 1;
90
+ });
91
+ program
92
+ .command('install')
93
+ .description('Configure a native source or Docker Compose installation')
94
+ .option('--mode <mode>', 'Installation mode: source or docker', 'source')
95
+ .action(async (opts) => {
96
+ if (opts.mode === 'source')
97
+ await (0, install_1.installSource)(process.cwd());
98
+ else if (opts.mode === 'docker')
99
+ await (0, install_1.installDocker)(process.cwd());
100
+ else
101
+ throw new commands_1.CliError('Installation mode must be source or docker.');
102
+ });
103
+ program
104
+ .command('migrate')
105
+ .description('Apply pending database migrations to a native installation')
106
+ .action(async () => (0, install_1.migrateSource)(process.cwd()));
107
+ program
108
+ .command('start')
109
+ .description('Start the native services or Docker Compose deployment')
110
+ .option('--mode <mode>', 'Installation mode: source or docker')
111
+ .action(async (opts) => {
112
+ const detected = await (0, lifecycle_1.detectDeployment)(process.cwd());
113
+ const mode = opts.mode ?? (detected === 'docker-compose' ? 'docker' : 'source');
114
+ if (mode !== 'source' && mode !== 'docker') {
115
+ throw new commands_1.CliError('Installation mode must be source or docker.');
116
+ }
117
+ await (0, install_1.startServices)(process.cwd(), mode);
118
+ });
119
+ program
120
+ .command('setup')
121
+ .description('Create the first tenant and administrator for this installation')
122
+ .option('--url <url>', 'API base URL', process.env.BYTECONTENT_URL ?? process.env.API_URL ?? 'http://localhost:4000')
123
+ .option('--env-file <file>', 'Environment file containing SETUP_TOKEN', '')
124
+ .action(async (opts) => {
125
+ const detected = await (0, lifecycle_1.detectDeployment)(process.cwd());
126
+ const envFile = opts.envFile || (0, install_1.defaultEnvFile)(detected === 'docker-compose' ? 'docker' : 'source');
127
+ process.loadEnvFile((0, install_1.resolveEnvPath)(process.cwd(), envFile));
128
+ const baseUrl = process.env.BYTECONTENT_URL ??
129
+ process.env.API_URL ??
130
+ (process.env.DOMAIN ? `https://${process.env.DOMAIN}` : opts.url);
131
+ // Keep the shared contract as the authoritative first-admin validation.
132
+ await (0, install_1.setupOwner)(baseUrl, process.env.ADMIN_URL ?? baseUrl);
133
+ });
134
+ program
135
+ .command('marketplace:search [query]')
136
+ .description('Search the bundled plugin directory and show tested release availability')
137
+ .action(async (query) => {
138
+ const { registry, source } = await (0, marketplace_1.loadPluginRegistry)();
139
+ const matches = (0, marketplace_1.searchPlugins)(registry, query);
140
+ if (matches.length === 0)
141
+ return console.log('No plugins match this search.');
142
+ for (const plugin of matches) {
143
+ console.log(`${plugin.id.padEnd(24)} ${plugin.name} (${plugin.releases.length} releases)`);
144
+ }
145
+ console.log(`Catalog updated ${registry.updatedAt} (${source}). Use marketplace:show <id> for details.`);
146
+ });
147
+ program
148
+ .command('marketplace:show <id>')
149
+ .description('Inspect publisher, capabilities, artifacts, and compatibility evidence')
150
+ .action(async (id) => {
151
+ const { registry, source } = await (0, marketplace_1.loadPluginRegistry)();
152
+ const plugin = registry.plugins.find((entry) => entry.id === id);
153
+ if (!plugin)
154
+ throw new commands_1.CliError(`Plugin ${id} is not listed in the bundled catalog.`);
155
+ console.log((0, marketplace_1.formatPlugin)(plugin));
156
+ console.log(`Catalog source: ${source}`);
157
+ });
158
+ for (const [command, updating] of [
159
+ ['marketplace:install', false],
160
+ ['marketplace:update', true],
161
+ ]) {
162
+ program
163
+ .command(`${command} <id> [version]`)
164
+ .description(`${updating ? 'Update' : 'Install'} a pinned, compatibility-tested marketplace plugin`)
165
+ .action(async (id, requestedVersion) => {
166
+ const deployment = await (0, lifecycle_1.detectDeployment)(process.cwd());
167
+ if (deployment !== 'native' && deployment !== 'docker-compose') {
168
+ throw new commands_1.CliError('Run this command inside a ByteContent installation directory.');
169
+ }
170
+ const { registry, source } = await (0, marketplace_1.loadPluginRegistry)();
171
+ const plugin = registry.plugins.find((entry) => entry.id === id);
172
+ if (!plugin)
173
+ throw new commands_1.CliError(`Plugin ${id} is not listed in the marketplace catalog.`);
174
+ const support = await (0, lifecycle_1.loadReleaseSupport)();
175
+ const installEnvFile = (0, install_1.defaultEnvFile)(deployment === 'docker-compose' ? 'docker' : 'source');
176
+ const installEnvPath = (0, install_1.resolveEnvPath)(process.cwd(), installEnvFile);
177
+ if ((0, node_fs_2.existsSync)(installEnvPath))
178
+ process.loadEnvFile(installEnvPath);
179
+ const installedVersion = deployment === 'docker-compose'
180
+ ? ((0, node_util_1.parseEnv)(await (0, promises_1.readFile)((0, install_1.resolveEnvPath)(process.cwd(), '.env.production'), 'utf8'))
181
+ .BYTECONTENT_VERSION ?? support.platformVersion)
182
+ : (JSON.parse(await (0, promises_1.readFile)((0, node_path_1.join)(process.cwd(), 'package.json'), 'utf8')).version ?? support.platformVersion);
183
+ const databaseUrl = process.env.DATABASE_URL;
184
+ if (deployment === 'native' && !databaseUrl) {
185
+ throw new commands_1.CliError(`DATABASE_URL is required to verify plugin compatibility.`);
186
+ }
187
+ const postgresMajor = await (0, marketplace_install_1.detectPostgresMajor)(process.cwd(), deployment, databaseUrl);
188
+ const target = (0, marketplace_install_1.installationTarget)(support, installedVersion, deployment, process.version, postgresMajor);
189
+ const release = (0, marketplace_1.selectCompatiblePluginRelease)(plugin, target, requestedVersion);
190
+ const lock = await (0, plugins_1.listLockedPlugins)(process.cwd());
191
+ const current = lock.plugins[id];
192
+ if (updating && !current) {
193
+ throw new commands_1.CliError(`${id} is not installed from the marketplace lock. Use marketplace:install.`);
194
+ }
195
+ if (!updating && current)
196
+ throw new commands_1.CliError(`${id} is already installed; use marketplace:update.`);
197
+ console.log(`Using ${source}; verifying release ${id}@${release.version} for the detected installation.`);
198
+ const changed = await (0, marketplace_install_1.installMarketplacePlugin)(process.cwd(), plugin, release, target, updating, confirm);
199
+ if (changed && deployment === 'docker-compose') {
200
+ await (0, install_1.restartDockerApi)(process.cwd());
201
+ console.log('The Docker API restarted and verified its plugin lock pins.');
202
+ }
203
+ else if (changed) {
204
+ console.log('Restart the native API service to load the plugin.');
205
+ }
206
+ });
207
+ }
208
+ program
209
+ .command('plugins:list')
210
+ .description('List locally pinned plugins and their content digests')
211
+ .action(async () => {
212
+ const lock = await (0, plugins_1.listLockedPlugins)(process.cwd());
213
+ const entries = Object.entries(lock.plugins);
214
+ if (entries.length === 0)
215
+ return console.log('No plugins are pinned in .bytecontent/plugins.lock.json.');
216
+ for (const [id, plugin] of entries) {
217
+ console.log(`${id}@${plugin.version} sha256:${plugin.sha256} installed ${plugin.installedAt}`);
218
+ }
219
+ });
220
+ program
221
+ .command('plugins:verify')
222
+ .description('Check installed local plugin files against their recorded SHA-256 digests')
223
+ .action(async () => {
224
+ const results = await (0, plugins_1.verifyLockedPlugins)(process.cwd());
225
+ if (results.length === 0)
226
+ return console.log('No locally pinned plugins to verify.');
227
+ for (const result of results) {
228
+ console.log(`${result.valid ? '✓' : '✗'} ${result.id}: ${result.valid ? 'matches lock' : 'digest/version mismatch or files missing'}`);
229
+ }
230
+ if (results.some((result) => !result.valid))
231
+ process.exitCode = 1;
232
+ });
233
+ for (const [command, updating] of [
234
+ ['plugin:install', false],
235
+ ['plugin:update', true],
236
+ ]) {
237
+ program
238
+ .command(`${command} <directory>`)
239
+ .description(`${updating ? 'Update' : 'Install'} a locally reviewed plugin into a native or Docker installation`)
240
+ .action(async (directory) => {
241
+ const deployment = await (0, lifecycle_1.detectDeployment)(process.cwd());
242
+ if (deployment !== 'native' && deployment !== 'docker-compose') {
243
+ throw new commands_1.CliError('Run this command inside a ByteContent source or Docker installation directory.');
244
+ }
245
+ const changed = await (0, plugins_1.installLocalPlugin)(process.cwd(), directory, updating, confirm);
246
+ if (changed && deployment === 'docker-compose') {
247
+ await (0, install_1.restartDockerApi)(process.cwd());
248
+ console.log('The Docker API restarted and verified its plugin lock pins.');
249
+ }
250
+ else if (changed) {
251
+ console.log('Restart the native API service to load the plugin.');
252
+ }
253
+ });
254
+ }
255
+ program
256
+ .command('update:guide')
257
+ .description('Show supported Node.js and CLI update instructions for this installation')
258
+ .action(async () => {
259
+ const release = await (0, lifecycle_1.loadReleaseSupport)();
260
+ const supported = release.support.node.supportedMajorVersions.join(', ');
261
+ const deployment = await (0, lifecycle_1.detectDeployment)(process.cwd());
262
+ console.log(`Supported Node.js major versions: ${supported}`);
263
+ console.log(`Current Node.js: ${process.version}`);
264
+ console.log(`Current CLI: ${cliPackage.version}`);
265
+ console.log('Update a globally installed CLI with: npm install --global @byterings-dev/cli@latest');
266
+ console.log('With nvm, update Node.js with: nvm install 24 && nvm use 24');
267
+ if (deployment === 'docker-compose') {
268
+ console.log('Update a Docker installation with: bytecontent update --mode docker --version <release>');
269
+ }
270
+ else if (deployment === 'native') {
271
+ console.log('For a source checkout, follow docs/operations/releases.md and back up before migrations.');
272
+ }
273
+ });
274
+ program
275
+ .command('update')
276
+ .description('Back up and update a Docker Compose installation to a tested release')
277
+ .requiredOption('--version <version>', 'Target ByteContent platform release')
278
+ .option('--mode <mode>', 'Installation mode: docker', 'docker')
279
+ .action(async (opts) => {
280
+ if (opts.mode !== 'docker') {
281
+ throw new commands_1.CliError('Automated updates currently support Docker Compose installations only. Use bytecontent update:guide for native source checkouts.');
282
+ }
283
+ await (0, updater_1.updateDocker)(process.cwd(), opts.version, confirm);
284
+ });
285
+ function client() {
286
+ const { url, apiKey } = program.opts();
287
+ if (!apiKey)
288
+ throw new commands_1.CliError('An API key is required: pass --api-key or set BYTECONTENT_API_KEY.');
289
+ return (0, sdk_1.createClient)({ baseUrl: url, apiKey });
290
+ }
291
+ async function confirm(question) {
292
+ const rl = (0, promises_2.createInterface)({ input: process.stdin, output: process.stdout });
293
+ try {
294
+ return /^y(es)?$/i.test((await rl.question(`${question} [y/N] `)).trim());
295
+ }
296
+ finally {
297
+ rl.close();
298
+ }
299
+ }
300
+ program
301
+ .command('entities:list')
302
+ .description('List entities of the tenant')
303
+ .action(async () => {
304
+ const entities = await client().entities.list();
305
+ if (entities.length === 0)
306
+ return console.log('No entities.');
307
+ for (const e of entities) {
308
+ console.log(`${e.key.padEnd(24)} ${e.name.padEnd(24)} ${String(e.fields.length).padStart(3)} fields v${e.version} ${e.status}`);
309
+ }
310
+ });
311
+ program
312
+ .command('export')
313
+ .description('Write the schema to <dir>/entities/*.json')
314
+ .option('-d, --dir <dir>', 'Project directory', '.')
315
+ .action(async (opts) => {
316
+ const files = await (0, commands_1.exportSchema)(client(), opts.dir);
317
+ console.log(`Exported ${files.length} entit${files.length === 1 ? 'y' : 'ies'} to ${opts.dir}/entities`);
318
+ });
319
+ program
320
+ .command('schema:diff')
321
+ .description('Show what schema:push would change (read-only)')
322
+ .option('-d, --dir <dir>', 'Project directory', '.')
323
+ .option('--prune', 'Include deletions of entities/fields missing from the files')
324
+ .action(async (opts) => {
325
+ console.log((0, commands_1.formatPlan)(await (0, commands_1.diffSchema)(client(), opts.dir, opts.prune)));
326
+ });
327
+ for (const name of ['schema:push', 'import']) {
328
+ program
329
+ .command(name)
330
+ .description('Apply the schema files to the installation (shows a plan first)')
331
+ .option('-d, --dir <dir>', 'Project directory', '.')
332
+ .option('--prune', 'Delete entities/fields missing from the files')
333
+ .option('-y, --yes', 'Do not ask for confirmation')
334
+ .option('--allow-destructive', 'Allow deleting entities, fields and their data')
335
+ .action(async (opts) => {
336
+ await (0, commands_1.pushSchema)(client(), opts.dir, {
337
+ ...opts,
338
+ confirm,
339
+ log: (line) => console.log(line),
340
+ });
341
+ });
342
+ }
343
+ program
344
+ .command('types')
345
+ .description('Generate TypeScript interfaces for entity records')
346
+ .option('-o, --out <file>', 'Output file', 'platform-types.ts')
347
+ .action(async (opts) => {
348
+ await (0, commands_1.writeTypes)(client(), opts.out);
349
+ console.log(`Wrote ${opts.out}`);
350
+ });
351
+ program.parseAsync(process.argv).catch((error) => {
352
+ if (error instanceof commands_1.CliError)
353
+ console.error(error.message);
354
+ else if (error instanceof sdk_1.PlatformError)
355
+ console.error(`API error ${error.status} ${error.code}: ${error.message}`);
356
+ else
357
+ console.error(error instanceof Error ? error.message : error);
358
+ process.exit(1);
359
+ });
360
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA;;;;;GAKG;AACH,qCAAuC;AACvC,qCAAqC;AACrC,+CAA4C;AAC5C,yCAAiC;AACjC,qDAAyD;AACzD,yCAAqC;AACrC,yCAAoC;AACpC,4CAAsF;AACtF,yCAAoG;AACpG,+CAKuB;AACvB,+DAI+B;AAC/B,uCAAyC;AACzC,uCAAuF;AACvF,2CAA8E;AAC9E,uCASmB;AAEnB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAExF,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,4DAA4D,CAAC;KACzE,MAAM,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,uBAAuB,CAAC;KAC7F,MAAM,CACL,iBAAiB,EACjB,sCAAsC,EACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAChC,CAAC;AAEJ,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,0DAA0D,CAAC;KACvE,MAAM,CAAC,QAAQ,EAAE,4CAA4C,CAAC;KAC9D,MAAM,CAAC,KAAK,EAAE,IAAwB,EAAE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KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;;QACxE,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ export type InstallMode = 'source' | 'docker';
2
+ export declare function makeSecret(): string;
3
+ export declare function slugify(value: string): string;
4
+ export declare function serializeEnvironment(values: Record<string, string>): string;
5
+ export declare function maskDatabaseUrl(value: string): string;
6
+ export declare function isValidDomain(value: string): boolean;
7
+ export declare function writePrivateConfig(path: string, contents: string): Promise<void>;
8
+ export declare function ask(question: string, defaultValue?: string): Promise<string>;
9
+ export declare function askSecret(question: string): Promise<string>;
10
+ export declare function confirm(question: string): Promise<boolean>;
11
+ export declare function run(command: string, args: string[], cwd: string, env?: NodeJS.ProcessEnv): Promise<void>;
12
+ export declare function installSource(rootPath: string): Promise<void>;
13
+ export declare function installDocker(rootPath: string): Promise<void>;
14
+ export declare function migrateSource(rootPath: string): Promise<void>;
15
+ export declare function startServices(rootPath: string, mode: InstallMode): Promise<void>;
16
+ export declare function restartDockerApi(rootPath: string): Promise<void>;
17
+ export declare function setupOwner(baseUrl: string, adminUrl?: string): Promise<void>;
18
+ export declare function defaultEnvFile(mode: InstallMode): string;
19
+ export declare function resolveEnvPath(cwd: string, file: string): string;