@or3/cloud 0.1.12 → 0.1.15

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 (2) hide show
  1. package/dist/cli.mjs +34 -6
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -23,7 +23,7 @@ import { promisify } from "node:util";
23
23
  import { dirname, basename, isAbsolute, join, resolve } from "node:path";
24
24
  import { fileURLToPath } from "node:url";
25
25
  var execFile = promisify(execFileCallback);
26
- var PACKAGE_VERSION = "0.1.12";
26
+ var PACKAGE_VERSION = "0.1.15";
27
27
  var IMAGE_REPOSITORY = "ghcr.io/saluana/or3-chat";
28
28
  var ASSET_ROOT = resolve(fileURLToPath(new URL("../assets/", import.meta.url)));
29
29
  var STATE_SCHEMA_VERSION = 1;
@@ -132,6 +132,23 @@ function parseFlags(argv) {
132
132
  }
133
133
  return { positionals, flags };
134
134
  }
135
+ var COMMAND_FLAGS = {
136
+ init: ["local", "public", "domain", "admin-email", "admin-password", "admin-password-file", "port"],
137
+ update: ["to"],
138
+ backup: [],
139
+ restore: ["yes"],
140
+ rollback: ["yes"],
141
+ doctor: [],
142
+ recover: [],
143
+ adopt: ["from"]
144
+ };
145
+ function assertCommandFlags(command, flags) {
146
+ const allowed = new Set(["help", ...COMMAND_FLAGS[command] ?? []]);
147
+ const unknown = Object.keys(flags).filter((flag) => !allowed.has(flag));
148
+ if (unknown.length > 0) {
149
+ throw new Error(`Unknown option${unknown.length === 1 ? "" : "s"} for ${command}: ${unknown.map((flag) => `--${flag}`).join(", ")}. Run npx @or3/cloud ${command} --help.`);
150
+ }
151
+ }
135
152
  function stringFlag(flags, key) {
136
153
  const value = flags[key];
137
154
  return typeof value === "string" ? value : undefined;
@@ -418,11 +435,18 @@ Diagnostics: ${diagnostics(directory, mode)}`);
418
435
  }
419
436
  }
420
437
  async function pullImage(image) {
421
- if (process.env.OR3_CLOUD_SKIP_PULL !== "true") {
438
+ const local = await run("docker", ["image", "inspect", image]);
439
+ if (!local.ok && process.env.OR3_CLOUD_SKIP_PULL !== "true") {
422
440
  const result = await run("docker", ["pull", image]);
423
- if (!result.ok)
424
- throw new Error(`${result.command}
425
- ${result.stderr}`);
441
+ if (!result.ok) {
442
+ const detail = result.stderr.trim();
443
+ if (/(not found|manifest unknown|pull access denied)/i.test(detail)) {
444
+ throw new Error(`The matching OR3 container image is not published yet: ${image}. This is a release issue, not a problem with your computer. Try again after the image release completes. ${detail}`);
445
+ }
446
+ throw new Error(`Could not download ${image}. Check your internet connection and Docker registry access, then retry. ${detail}`);
447
+ }
448
+ } else if (!local.ok) {
449
+ throw new Error(`${image} is not available locally and OR3_CLOUD_SKIP_PULL=true prevents downloading it.`);
426
450
  }
427
451
  return imageDigest(image);
428
452
  }
@@ -1121,7 +1145,7 @@ async function updateCommand(directory, flags) {
1121
1145
  await waitForDeepHealth(loaded.directory, state.mode, secretValues(env));
1122
1146
  const targetVersion = stringFlag(flags, "to")?.trim() ?? PACKAGE_VERSION;
1123
1147
  if (!isVersion(targetVersion))
1124
- throw new Error("--to must be a complete semantic version such as 0.1.12.");
1148
+ throw new Error("--to must be a complete semantic version such as 0.1.15.");
1125
1149
  if (targetVersion === state.appVersion)
1126
1150
  throw new Error(`The deployment is already on OR3 ${targetVersion}.`);
1127
1151
  const targetImage = imageFor(targetVersion);
@@ -1646,6 +1670,9 @@ async function main(argv = process.argv.slice(2)) {
1646
1670
  return console.log(PACKAGE_VERSION);
1647
1671
  const parsed = parseFlags(rest);
1648
1672
  try {
1673
+ if (parsed.flags.help)
1674
+ return help();
1675
+ assertCommandFlags(command, parsed.flags);
1649
1676
  if (command === "init")
1650
1677
  return await initCommand(parsed.positionals, parsed.flags);
1651
1678
  if (command === "update")
@@ -1684,6 +1711,7 @@ export {
1684
1711
  buildEnv,
1685
1712
  assertSupportedSourceCompose,
1686
1713
  assertSupportedSource,
1714
+ assertCommandFlags,
1687
1715
  assertBackupMatchesDeployment,
1688
1716
  PACKAGE_VERSION,
1689
1717
  IMAGE_REPOSITORY
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@or3/cloud",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
4
4
  "description": "Install and operate the OR3 Cloud container distribution",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0",
@@ -10,7 +10,7 @@
10
10
  "directory": "packages/or3-cloud"
11
11
  },
12
12
  "engines": {
13
- "node": ">=24"
13
+ "node": ">=20"
14
14
  },
15
15
  "bin": {
16
16
  "or3": "./dist/cli.mjs"