@camox/cli 0.24.1 → 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.
- package/dist/index.mjs +13 -7
- 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
|
|
327
|
-
* `node_modules/.camox/runtime.json` sidecar
|
|
328
|
-
*
|
|
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
|
-
|
|
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,
|
|
@@ -1047,8 +1052,8 @@ async function handler(args) {
|
|
|
1047
1052
|
}
|
|
1048
1053
|
throw err;
|
|
1049
1054
|
}
|
|
1050
|
-
const environmentName = args.production ? "production" : runtime.environmentName;
|
|
1051
1055
|
const token = readAuthTokenForUrl(runtime.authenticationUrl);
|
|
1056
|
+
const environmentName = args.production ? "production" : token?.email ? `dev:${token.email}` : null;
|
|
1052
1057
|
const status = {
|
|
1053
1058
|
projectSlug: runtime.projectSlug,
|
|
1054
1059
|
environmentName,
|
|
@@ -1066,7 +1071,7 @@ async function handler(args) {
|
|
|
1066
1071
|
}
|
|
1067
1072
|
const lines = [
|
|
1068
1073
|
`project: ${status.projectSlug}`,
|
|
1069
|
-
`environment: ${status.environmentName}`,
|
|
1074
|
+
`environment: ${status.environmentName ?? "(unknown — run `camox login`)"}`,
|
|
1070
1075
|
`api: ${status.apiUrl}`,
|
|
1071
1076
|
`auth: ${status.authenticationUrl}`,
|
|
1072
1077
|
status.user ? `signed in: ${status.user.name} <${status.user.email}>` : `signed in: (no token for ${status.authenticationUrl} — run \`camox login\`)`
|
|
@@ -1106,6 +1111,7 @@ switch (result.command) {
|
|
|
1106
1111
|
break;
|
|
1107
1112
|
case "blocks.types":
|
|
1108
1113
|
case "blocks.describe":
|
|
1114
|
+
case "blocks.get":
|
|
1109
1115
|
case "blocks.create":
|
|
1110
1116
|
case "blocks.edit":
|
|
1111
1117
|
case "blocks.move":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camox/cli",
|
|
3
|
-
"version": "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.
|
|
29
|
+
"@camox/api-contract": "0.25.0"
|
|
30
30
|
},
|
|
31
31
|
"nx": {
|
|
32
32
|
"tags": [
|