@camox/cli 0.24.0 → 0.25.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 (2) hide show
  1. package/dist/index.mjs +26 -7
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -238,7 +238,6 @@ const runtimeSchema = z.object({
238
238
  projectSlug: z.string().min(1),
239
239
  apiUrl: z.string().url(),
240
240
  authenticationUrl: z.string().url(),
241
- environmentName: z.string().min(1),
242
241
  disableTelemetry: z.boolean().optional().default(false)
243
242
  });
244
243
  const SIDECAR = path.join("node_modules", ".camox", "runtime.json");
@@ -323,9 +322,11 @@ async function callRemote(params) {
323
322
  * and render the result. Exit codes: 0 on success, 1 on tool error, 2 on
324
323
  * auth/project resolution failure.
325
324
  *
326
- * Project, apiUrl, and authenticationUrl all come from the vite plugin's
327
- * `node_modules/.camox/runtime.json` sidecar that's the single source of
328
- * truth. `--project <slug>` and `CAMOX_PROJECT` may override the slug.
325
+ * Project, apiUrl, and authenticationUrl come from the vite plugin's
326
+ * `node_modules/.camox/runtime.json` sidecar. `--project <slug>` and
327
+ * `CAMOX_PROJECT` may override the slug. The environment is *not* read
328
+ * from the sidecar — it's derived from auth (`dev:<email>`) by default,
329
+ * with `--production` as the only opt-in for prod.
329
330
  */
330
331
  async function dispatch(opts) {
331
332
  let runtime;
@@ -344,7 +345,11 @@ async function dispatch(opts) {
344
345
  code: "NOT_AUTHENTICATED",
345
346
  message: `No stored credentials for ${runtime.authenticationUrl}. Run \`camox login\` against this backend first.`
346
347
  }, 2);
347
- const environmentName = opts.production ? "production" : runtime.environmentName;
348
+ if (!opts.production && !token.email) return fail({
349
+ code: "AUTH_INCOMPLETE",
350
+ message: "Auth token is missing an email. Run `camox login` to refresh credentials."
351
+ }, 2);
352
+ const environmentName = opts.production ? "production" : `dev:${token.email}`;
348
353
  const projectId = await resolveProjectId(token.token, slug, runtime.apiUrl);
349
354
  const response = await callRemote({
350
355
  token: token.token,
@@ -378,6 +383,12 @@ const parser$7 = command("blocks", or(command("types", object({
378
383
  project: projectFlag$3,
379
384
  production: productionFlag$2,
380
385
  json: jsonFlag$3
386
+ })), command("get", object({
387
+ command: constant("blocks.get"),
388
+ id: option("--id", integer({ metavar: "ID" })),
389
+ project: projectFlag$3,
390
+ production: productionFlag$2,
391
+ json: jsonFlag$3
381
392
  })), command("create", object({
382
393
  command: constant("blocks.create"),
383
394
  pageId: option("--page-id", integer({ metavar: "ID" })),
@@ -464,6 +475,13 @@ async function handler$7(args) {
464
475
  production,
465
476
  outputMode
466
477
  });
478
+ case "blocks.get": return dispatch({
479
+ toolName: "getBlock",
480
+ args: { id: args.id },
481
+ projectFlag,
482
+ production,
483
+ outputMode
484
+ });
467
485
  case "blocks.create": {
468
486
  const content = parseJsonFlag("--content", args.content);
469
487
  const settings = args.settings !== void 0 ? parseJsonFlag("--settings", args.settings) : void 0;
@@ -1034,8 +1052,8 @@ async function handler(args) {
1034
1052
  }
1035
1053
  throw err;
1036
1054
  }
1037
- const environmentName = args.production ? "production" : runtime.environmentName;
1038
1055
  const token = readAuthTokenForUrl(runtime.authenticationUrl);
1056
+ const environmentName = args.production ? "production" : token?.email ? `dev:${token.email}` : null;
1039
1057
  const status = {
1040
1058
  projectSlug: runtime.projectSlug,
1041
1059
  environmentName,
@@ -1053,7 +1071,7 @@ async function handler(args) {
1053
1071
  }
1054
1072
  const lines = [
1055
1073
  `project: ${status.projectSlug}`,
1056
- `environment: ${status.environmentName}`,
1074
+ `environment: ${status.environmentName ?? "(unknown — run `camox login`)"}`,
1057
1075
  `api: ${status.apiUrl}`,
1058
1076
  `auth: ${status.authenticationUrl}`,
1059
1077
  status.user ? `signed in: ${status.user.name} <${status.user.email}>` : `signed in: (no token for ${status.authenticationUrl} — run \`camox login\`)`
@@ -1093,6 +1111,7 @@ switch (result.command) {
1093
1111
  break;
1094
1112
  case "blocks.types":
1095
1113
  case "blocks.describe":
1114
+ case "blocks.get":
1096
1115
  case "blocks.create":
1097
1116
  case "blocks.edit":
1098
1117
  case "blocks.move":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camox/cli",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "bin": {
5
5
  "camox": "./dist/index.mjs"
6
6
  },
@@ -26,7 +26,7 @@
26
26
  "@types/node": "^24.12.2",
27
27
  "@typescript/native-preview": "7.0.0-dev.20260412.1",
28
28
  "vite-plus": "latest",
29
- "@camox/api-contract": "0.24.0"
29
+ "@camox/api-contract": "0.25.0"
30
30
  },
31
31
  "nx": {
32
32
  "tags": [