@customyai/cli 0.7.1 → 0.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @customyai/cli
2
2
 
3
+ ## 0.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Los comandos de Experiments (`flags`, `segments`, `experiments`) se niegan, antes de enviar el Bearer, a un origen que no sea `https://` (`http://` solo hacia `localhost`, `127.0.0.1` o `[::1]`) (P-B8).
8
+ `customy audit export --out` escribe el archivo con permisos 0600 (solo el dueño), también si ya existía con otros permisos (P-B9): la auditoría nombra personas y acciones.
9
+
3
10
  ## 0.7.1
4
11
 
5
12
  ### Patch Changes
package/dist/bin.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- var chunk6KGKN5HN_cjs = require('./chunk-6KGKN5HN.cjs');
4
+ var chunkTSPERSQL_cjs = require('./chunk-TSPERSQL.cjs');
5
5
  var promises = require('readline/promises');
6
6
 
7
7
  async function prompt(question) {
@@ -12,7 +12,7 @@ async function prompt(question) {
12
12
  rl.close();
13
13
  }
14
14
  }
15
- chunk6KGKN5HN_cjs.runCli(process.argv.slice(2), {
15
+ chunkTSPERSQL_cjs.runCli(process.argv.slice(2), {
16
16
  cwd: process.cwd(),
17
17
  env: process.env,
18
18
  out: (line) => console.log(line),
package/dist/bin.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-KDUW3KTG.mjs';
2
+ import { runCli } from './chunk-762M6SBX.mjs';
3
3
  import { createInterface } from 'readline/promises';
4
4
 
5
5
  async function prompt(question) {
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { mkdir, writeFile, readFile } from 'fs/promises';
2
+ import { mkdir, writeFile, chmod, readFile } from 'fs/promises';
3
3
  import path3 from 'path';
4
4
  import { CustomyProvisioningError, CustomyScopeError, CustomyEnvironmentMismatchError, CustomyConflictError, CustomyRateLimitError, CustomyAuthError, createProvisioning } from '@customyai/provisioning';
5
5
 
@@ -731,7 +731,9 @@ async function audit(args, io) {
731
731
  const text = await liveClient(ctx).audit.export({ format, ...pick(flags) });
732
732
  const out = str(flags, "out");
733
733
  if (out) {
734
- await writeFile(path3.resolve(io.cwd, out), text);
734
+ const target = path3.resolve(io.cwd, out);
735
+ await writeFile(target, text, { mode: 384 });
736
+ await chmod(target, 384).catch(() => void 0);
735
737
  emit(ctx, { out, bytes: text.length, format }, [`wrote ${text.length} characters of ${format} to ${out}`]);
736
738
  } else io.out(text.replace(/\n$/, ""));
737
739
  return EXIT.ok;
@@ -970,6 +972,9 @@ async function runExperimentsCli(group, args, io) {
970
972
  const call = await plan(group, args, io);
971
973
  const base = (typeof flags["base-url"] === "string" ? flags["base-url"] : io.env.CUSTOMY_EXPERIMENTS_URL)?.replace(/\/$/, "");
972
974
  if (!base) throw new UsageError2("falta el origen: --base-url o CUSTOMY_EXPERIMENTS_URL");
975
+ if (!/^https:\/\//i.test(base) && !/^http:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d+)?(\/|$)/i.test(base)) {
976
+ throw new UsageError2("el origen de Experiments debe ser https:// (http:// solo hacia localhost): el token viajar\xEDa en claro");
977
+ }
973
978
  const query = call.query && Object.keys(call.query).length ? `?${new URLSearchParams(call.query)}` : "";
974
979
  const url = `${base}/v1/experiments${call.path}${query}`;
975
980
  if (call.write && flags["dry-run"]) {
@@ -737,7 +737,9 @@ async function audit(args, io) {
737
737
  const text = await liveClient(ctx).audit.export({ format, ...pick(flags) });
738
738
  const out = str(flags, "out");
739
739
  if (out) {
740
- await promises.writeFile(path3__default.default.resolve(io.cwd, out), text);
740
+ const target = path3__default.default.resolve(io.cwd, out);
741
+ await promises.writeFile(target, text, { mode: 384 });
742
+ await promises.chmod(target, 384).catch(() => void 0);
741
743
  emit(ctx, { out, bytes: text.length, format }, [`wrote ${text.length} characters of ${format} to ${out}`]);
742
744
  } else io.out(text.replace(/\n$/, ""));
743
745
  return EXIT.ok;
@@ -976,6 +978,9 @@ async function runExperimentsCli(group, args, io) {
976
978
  const call = await plan(group, args, io);
977
979
  const base = (typeof flags["base-url"] === "string" ? flags["base-url"] : io.env.CUSTOMY_EXPERIMENTS_URL)?.replace(/\/$/, "");
978
980
  if (!base) throw new UsageError2("falta el origen: --base-url o CUSTOMY_EXPERIMENTS_URL");
981
+ if (!/^https:\/\//i.test(base) && !/^http:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d+)?(\/|$)/i.test(base)) {
982
+ throw new UsageError2("el origen de Experiments debe ser https:// (http:// solo hacia localhost): el token viajar\xEDa en claro");
983
+ }
979
984
  const query = call.query && Object.keys(call.query).length ? `?${new URLSearchParams(call.query)}` : "";
980
985
  const url = `${base}/v1/experiments${call.path}${query}`;
981
986
  if (call.write && flags["dry-run"]) {
package/dist/index.cjs CHANGED
@@ -1,46 +1,46 @@
1
1
  'use strict';
2
2
 
3
- var chunk6KGKN5HN_cjs = require('./chunk-6KGKN5HN.cjs');
3
+ var chunkTSPERSQL_cjs = require('./chunk-TSPERSQL.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "EXPERIMENTS_EXIT_CODES", {
8
8
  enumerable: true,
9
- get: function () { return chunk6KGKN5HN_cjs.EXPERIMENTS_EXIT; }
9
+ get: function () { return chunkTSPERSQL_cjs.EXPERIMENTS_EXIT; }
10
10
  });
11
11
  Object.defineProperty(exports, "PROVISIONING_EXIT_CODES", {
12
12
  enumerable: true,
13
- get: function () { return chunk6KGKN5HN_cjs.EXIT; }
13
+ get: function () { return chunkTSPERSQL_cjs.EXIT; }
14
14
  });
15
15
  Object.defineProperty(exports, "SyncError", {
16
16
  enumerable: true,
17
- get: function () { return chunk6KGKN5HN_cjs.SyncError; }
17
+ get: function () { return chunkTSPERSQL_cjs.SyncError; }
18
18
  });
19
19
  Object.defineProperty(exports, "generateAppTypes", {
20
20
  enumerable: true,
21
- get: function () { return chunk6KGKN5HN_cjs.generateAppTypes; }
21
+ get: function () { return chunkTSPERSQL_cjs.generateAppTypes; }
22
22
  });
23
23
  Object.defineProperty(exports, "runCli", {
24
24
  enumerable: true,
25
- get: function () { return chunk6KGKN5HN_cjs.runCli; }
25
+ get: function () { return chunkTSPERSQL_cjs.runCli; }
26
26
  });
27
27
  Object.defineProperty(exports, "runExperimentsCli", {
28
28
  enumerable: true,
29
- get: function () { return chunk6KGKN5HN_cjs.runExperimentsCli; }
29
+ get: function () { return chunkTSPERSQL_cjs.runExperimentsCli; }
30
30
  });
31
31
  Object.defineProperty(exports, "runProvisioningCli", {
32
32
  enumerable: true,
33
- get: function () { return chunk6KGKN5HN_cjs.runProvisioningCli; }
33
+ get: function () { return chunkTSPERSQL_cjs.runProvisioningCli; }
34
34
  });
35
35
  Object.defineProperty(exports, "schemaToType", {
36
36
  enumerable: true,
37
- get: function () { return chunk6KGKN5HN_cjs.schemaToType; }
37
+ get: function () { return chunkTSPERSQL_cjs.schemaToType; }
38
38
  });
39
39
  Object.defineProperty(exports, "syncApp", {
40
40
  enumerable: true,
41
- get: function () { return chunk6KGKN5HN_cjs.syncApp; }
41
+ get: function () { return chunkTSPERSQL_cjs.syncApp; }
42
42
  });
43
43
  Object.defineProperty(exports, "validateManifest", {
44
44
  enumerable: true,
45
- get: function () { return chunk6KGKN5HN_cjs.validateManifest; }
45
+ get: function () { return chunkTSPERSQL_cjs.validateManifest; }
46
46
  });
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { EXPERIMENTS_EXIT as EXPERIMENTS_EXIT_CODES, EXIT as PROVISIONING_EXIT_CODES, SyncError, generateAppTypes, runCli, runExperimentsCli, runProvisioningCli, schemaToType, syncApp, validateManifest } from './chunk-KDUW3KTG.mjs';
1
+ export { EXPERIMENTS_EXIT as EXPERIMENTS_EXIT_CODES, EXIT as PROVISIONING_EXIT_CODES, SyncError, generateAppTypes, runCli, runExperimentsCli, runProvisioningCli, schemaToType, syncApp, validateManifest } from './chunk-762M6SBX.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@customyai/cli",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Customy CLI: validate, type and sync customy.app.json (customy apps ...) and provision TEST users (customy users | audit | policy | whoami). Also usable as a library.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Customy <hello@customy.ai>",