@reporting-bi/cli 0.0.20 → 0.1.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.js +124 -62
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9557,12 +9557,12 @@ var require_dist2 = __commonJS({
9557
9557
  throw new Error(`Unknown format "${name}"`);
9558
9558
  return f;
9559
9559
  };
9560
- function addFormats(ajv, list7, fs7, exportName) {
9560
+ function addFormats(ajv, list7, fs8, exportName) {
9561
9561
  var _a2;
9562
9562
  var _b;
9563
9563
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
9564
9564
  for (const f of list7)
9565
- ajv.addFormat(f, fs7[f]);
9565
+ ajv.addFormat(f, fs8[f]);
9566
9566
  }
9567
9567
  module2.exports = exports2 = formatsPlugin;
9568
9568
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -9572,12 +9572,12 @@ var require_dist2 = __commonJS({
9572
9572
 
9573
9573
  // src/commands/login.ts
9574
9574
  var http = __toESM(require("node:http"));
9575
- var import_node_child_process = require("node:child_process");
9575
+ var import_node_child_process2 = require("node:child_process");
9576
9576
 
9577
9577
  // src/config.ts
9578
- var fs = __toESM(require("node:fs"));
9578
+ var fs2 = __toESM(require("node:fs"));
9579
9579
  var path = __toESM(require("node:path"));
9580
- var os = __toESM(require("node:os"));
9580
+ var os2 = __toESM(require("node:os"));
9581
9581
 
9582
9582
  // ../rp-auth-client-v2/dist/client.js
9583
9583
  var DEFAULT_OPTIONS = {
@@ -9784,28 +9784,87 @@ var ReportingAuthClient = class {
9784
9784
 
9785
9785
  // src/config.ts
9786
9786
  var import_rp_client = __toESM(require_dist());
9787
- var CONFIG_DIR = path.join(os.homedir(), ".config", "reporting-bi");
9787
+
9788
+ // src/crypto.ts
9789
+ var crypto = __toESM(require("node:crypto"));
9790
+ var fs = __toESM(require("node:fs"));
9791
+ var os = __toESM(require("node:os"));
9792
+ var import_node_child_process = require("node:child_process");
9793
+ var SALT = "reporting-bi-credentials";
9794
+ var ALGORITHM = "aes-256-gcm";
9795
+ function getMachineId() {
9796
+ try {
9797
+ switch (process.platform) {
9798
+ case "linux":
9799
+ return fs.readFileSync("/etc/machine-id", "utf-8").trim();
9800
+ case "darwin":
9801
+ return (0, import_node_child_process.execSync)("ioreg -rd1 -c IOPlatformExpertDevice", { encoding: "utf-8" }).match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/)?.[1] ?? os.hostname();
9802
+ case "win32":
9803
+ return (0, import_node_child_process.execSync)("reg query HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid", { encoding: "utf-8" }).match(/MachineGuid\s+REG_SZ\s+(.+)/)?.[1]?.trim() ?? os.hostname();
9804
+ default:
9805
+ return os.hostname();
9806
+ }
9807
+ } catch {
9808
+ return os.hostname();
9809
+ }
9810
+ }
9811
+ function deriveKey() {
9812
+ return crypto.scryptSync(getMachineId(), SALT, 32);
9813
+ }
9814
+ function encrypt(plaintext) {
9815
+ const key = deriveKey();
9816
+ const iv = crypto.randomBytes(12);
9817
+ const cipher = crypto.createCipheriv(ALGORITHM, key, iv);
9818
+ const encrypted = Buffer.concat([cipher.update(plaintext, "utf-8"), cipher.final()]);
9819
+ const tag = cipher.getAuthTag();
9820
+ return JSON.stringify({
9821
+ encrypted: true,
9822
+ iv: iv.toString("base64"),
9823
+ tag: tag.toString("base64"),
9824
+ data: encrypted.toString("base64")
9825
+ });
9826
+ }
9827
+ function decrypt(ciphertext) {
9828
+ const { iv, tag, data } = JSON.parse(ciphertext);
9829
+ const key = deriveKey();
9830
+ const decipher = crypto.createDecipheriv(ALGORITHM, key, Buffer.from(iv, "base64"));
9831
+ decipher.setAuthTag(Buffer.from(tag, "base64"));
9832
+ return Buffer.concat([decipher.update(Buffer.from(data, "base64")), decipher.final()]).toString("utf-8");
9833
+ }
9834
+ function isEncrypted(content2) {
9835
+ try {
9836
+ const parsed = JSON.parse(content2);
9837
+ return parsed.encrypted === true;
9838
+ } catch {
9839
+ return false;
9840
+ }
9841
+ }
9842
+
9843
+ // src/config.ts
9844
+ var CONFIG_DIR = path.join(os2.homedir(), ".config", "reporting-bi");
9788
9845
  var CREDENTIALS_FILE = path.join(CONFIG_DIR, "credentials.json");
9789
9846
  var CLIENT_ID = "0D6693D4-4358-4C08-BA80-A94A97B7F47C";
9790
9847
  var CLIENT_SECRET = "48481427819bb41798bd74fa109c90b184ca4d64d20e60dfbe8430299f06f73e";
9791
9848
  function loadCredentials() {
9792
9849
  try {
9793
- const data = fs.readFileSync(CREDENTIALS_FILE, "utf-8");
9850
+ const raw = fs2.readFileSync(CREDENTIALS_FILE, "utf-8");
9851
+ const data = isEncrypted(raw) ? decrypt(raw) : raw;
9794
9852
  return JSON.parse(data);
9795
9853
  } catch {
9796
9854
  return { active: null, connections: {} };
9797
9855
  }
9798
9856
  }
9799
9857
  function saveCredentials(data) {
9800
- fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
9801
- fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify(data, null, 2), { mode: 384 });
9858
+ fs2.mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
9859
+ const content2 = encrypt(JSON.stringify(data, null, 2));
9860
+ fs2.writeFileSync(CREDENTIALS_FILE, content2, { mode: 384 });
9802
9861
  }
9803
9862
  function findLocalConfig(startDir) {
9804
9863
  let dir = path.resolve(startDir || process.cwd());
9805
9864
  while (true) {
9806
9865
  const configPath = path.join(dir, ".rpbi", "config.json");
9807
9866
  try {
9808
- const data = JSON.parse(fs.readFileSync(configPath, "utf-8"));
9867
+ const data = JSON.parse(fs2.readFileSync(configPath, "utf-8"));
9809
9868
  if (data.domain) return { domain: data.domain, accounting: data.accounting };
9810
9869
  } catch {
9811
9870
  }
@@ -9934,16 +9993,19 @@ var FLAG_ALIASES = {
9934
9993
  s: "sort",
9935
9994
  f: "filter"
9936
9995
  };
9996
+ function isFlag(arg) {
9997
+ return arg.startsWith("-") && !/^-\d/.test(arg);
9998
+ }
9937
9999
  function parseArgs(args) {
9938
10000
  const positional = [];
9939
10001
  const flags = {};
9940
10002
  for (let i = 0; i < args.length; i++) {
9941
- if (args[i].startsWith("--") && (i + 1 >= args.length || args[i + 1].startsWith("-"))) {
10003
+ if (args[i].startsWith("--") && (i + 1 >= args.length || isFlag(args[i + 1]))) {
9942
10004
  flags[args[i].slice(2)] = "true";
9943
10005
  } else if (args[i].startsWith("--") && i + 1 < args.length) {
9944
10006
  flags[args[i].slice(2)] = args[i + 1];
9945
10007
  i++;
9946
- } else if (args[i].startsWith("-") && !args[i].startsWith("--") && i + 1 < args.length) {
10008
+ } else if (isFlag(args[i]) && !args[i].startsWith("--") && i + 1 < args.length) {
9947
10009
  const key = FLAG_ALIASES[args[i].slice(1)] || args[i].slice(1);
9948
10010
  flags[key] = args[i + 1];
9949
10011
  i++;
@@ -10090,7 +10152,7 @@ function renderCallback(status3, title, message) {
10090
10152
  function openBrowser(url2) {
10091
10153
  const platform = process.platform;
10092
10154
  const cmd = platform === "darwin" ? "open" : platform === "win32" ? 'start ""' : "xdg-open";
10093
- (0, import_node_child_process.exec)(`${cmd} ${JSON.stringify(url2)}`);
10155
+ (0, import_node_child_process2.exec)(`${cmd} ${JSON.stringify(url2)}`);
10094
10156
  }
10095
10157
  async function login(args) {
10096
10158
  const { positional, flags } = parseArgs(args);
@@ -10269,7 +10331,7 @@ async function use(args) {
10269
10331
  }
10270
10332
 
10271
10333
  // src/commands/wiki.ts
10272
- var fs2 = __toESM(require("node:fs"));
10334
+ var fs3 = __toESM(require("node:fs"));
10273
10335
  var DEFAULT_LANG = "cs";
10274
10336
  async function list2(flags) {
10275
10337
  const service = await createService("wiki");
@@ -10295,7 +10357,7 @@ async function search(query, flags) {
10295
10357
  }
10296
10358
  async function readContent(flags) {
10297
10359
  if (flags.file) {
10298
- return fs2.readFileSync(flags.file, "utf-8");
10360
+ return fs3.readFileSync(flags.file, "utf-8");
10299
10361
  }
10300
10362
  if (flags.content) {
10301
10363
  return flags.content;
@@ -10369,21 +10431,21 @@ async function wiki(args) {
10369
10431
  }
10370
10432
 
10371
10433
  // src/commands/etl.ts
10372
- var fs5 = __toESM(require("node:fs"));
10434
+ var fs6 = __toESM(require("node:fs"));
10373
10435
 
10374
10436
  // src/commands/etl-sync.ts
10375
- var fs4 = __toESM(require("node:fs"));
10437
+ var fs5 = __toESM(require("node:fs"));
10376
10438
  var path3 = __toESM(require("node:path"));
10377
10439
 
10378
10440
  // src/manifest.ts
10379
- var fs3 = __toESM(require("node:fs"));
10441
+ var fs4 = __toESM(require("node:fs"));
10380
10442
  var path2 = __toESM(require("node:path"));
10381
- var crypto = __toESM(require("node:crypto"));
10443
+ var crypto2 = __toESM(require("node:crypto"));
10382
10444
  var RPBI_DIR = ".rpbi";
10383
10445
  var CONFIG_FILE = "config.json";
10384
10446
  var INDEX_FILE = "index.json";
10385
10447
  function computeHash(content2) {
10386
- return crypto.createHash("sha256").update(content2, "utf-8").digest("hex");
10448
+ return crypto2.createHash("sha256").update(content2, "utf-8").digest("hex");
10387
10449
  }
10388
10450
  function getConfigPath(dir) {
10389
10451
  return path2.join(dir, RPBI_DIR, CONFIG_FILE);
@@ -10393,7 +10455,7 @@ function getIndexPath(dir) {
10393
10455
  }
10394
10456
  function readConfig(dir) {
10395
10457
  try {
10396
- const data = fs3.readFileSync(getConfigPath(dir), "utf-8");
10458
+ const data = fs4.readFileSync(getConfigPath(dir), "utf-8");
10397
10459
  return JSON.parse(data);
10398
10460
  } catch {
10399
10461
  return null;
@@ -10401,15 +10463,15 @@ function readConfig(dir) {
10401
10463
  }
10402
10464
  function writeConfig(dir, config2) {
10403
10465
  const rpbiDir = path2.join(dir, RPBI_DIR);
10404
- fs3.mkdirSync(rpbiDir, { recursive: true });
10405
- fs3.writeFileSync(
10466
+ fs4.mkdirSync(rpbiDir, { recursive: true });
10467
+ fs4.writeFileSync(
10406
10468
  path2.join(rpbiDir, CONFIG_FILE),
10407
10469
  JSON.stringify(config2, null, 2)
10408
10470
  );
10409
10471
  }
10410
10472
  function readIndex(dir) {
10411
10473
  try {
10412
- const data = fs3.readFileSync(getIndexPath(dir), "utf-8");
10474
+ const data = fs4.readFileSync(getIndexPath(dir), "utf-8");
10413
10475
  return JSON.parse(data);
10414
10476
  } catch {
10415
10477
  return [];
@@ -10417,8 +10479,8 @@ function readIndex(dir) {
10417
10479
  }
10418
10480
  function writeIndex(dir, index) {
10419
10481
  const rpbiDir = path2.join(dir, RPBI_DIR);
10420
- fs3.mkdirSync(rpbiDir, { recursive: true });
10421
- fs3.writeFileSync(
10482
+ fs4.mkdirSync(rpbiDir, { recursive: true });
10483
+ fs4.writeFileSync(
10422
10484
  path2.join(rpbiDir, INDEX_FILE),
10423
10485
  JSON.stringify(index, null, 2)
10424
10486
  );
@@ -10426,7 +10488,7 @@ function writeIndex(dir, index) {
10426
10488
  function findEtlRoot(startDir) {
10427
10489
  let dir = path2.resolve(startDir);
10428
10490
  while (true) {
10429
- if (fs3.existsSync(getConfigPath(dir))) return dir;
10491
+ if (fs4.existsSync(getConfigPath(dir))) return dir;
10430
10492
  const parent = path2.dirname(dir);
10431
10493
  if (parent === dir) return null;
10432
10494
  dir = parent;
@@ -10561,8 +10623,8 @@ function threadToMetaPath(thread) {
10561
10623
  return [".rpbi", "threads", typeToDirName(thread.type), ...segments].join("/");
10562
10624
  }
10563
10625
  function writeFileSync4(filePath, content2) {
10564
- fs4.mkdirSync(path3.dirname(filePath), { recursive: true });
10565
- fs4.writeFileSync(filePath, content2, "utf-8");
10626
+ fs5.mkdirSync(path3.dirname(filePath), { recursive: true });
10627
+ fs5.writeFileSync(filePath, content2, "utf-8");
10566
10628
  }
10567
10629
  function stripFields(obj, excludeFields) {
10568
10630
  const result = {};
@@ -10678,11 +10740,11 @@ async function push(flags, files) {
10678
10740
  console.log(`Pushing ${filesToPush.length} file(s)...`);
10679
10741
  for (const relPath of filesToPush) {
10680
10742
  const absPath = path3.join(root, relPath);
10681
- if (!fs4.existsSync(absPath)) {
10743
+ if (!fs5.existsSync(absPath)) {
10682
10744
  console.log(` Skipping ${relPath} (file not found)`);
10683
10745
  continue;
10684
10746
  }
10685
- const localContent = fs4.readFileSync(absPath, "utf-8");
10747
+ const localContent = fs5.readFileSync(absPath, "utf-8");
10686
10748
  const entry = indexMap.get(relPath);
10687
10749
  if (entry) {
10688
10750
  if (!force) {
@@ -10776,11 +10838,11 @@ function detectModifiedFiles(root, index) {
10776
10838
  const modified = [];
10777
10839
  for (const entry of index) {
10778
10840
  const absPath = path3.join(root, entry.path);
10779
- if (!fs4.existsSync(absPath)) {
10841
+ if (!fs5.existsSync(absPath)) {
10780
10842
  modified.push(entry.path);
10781
10843
  continue;
10782
10844
  }
10783
- const content2 = fs4.readFileSync(absPath, "utf-8");
10845
+ const content2 = fs5.readFileSync(absPath, "utf-8");
10784
10846
  if (computeHash(content2) !== entry.hash) {
10785
10847
  modified.push(entry.path);
10786
10848
  }
@@ -10790,7 +10852,7 @@ function detectModifiedFiles(root, index) {
10790
10852
  function detectNewFiles(root, index) {
10791
10853
  const newFiles = [];
10792
10854
  const knownPaths = new Set(index.map((e) => e.path));
10793
- const entries = fs4.readdirSync(root, { withFileTypes: true });
10855
+ const entries = fs5.readdirSync(root, { withFileTypes: true });
10794
10856
  for (const entry of entries) {
10795
10857
  if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
10796
10858
  walkDir(path3.join(root, entry.name), root, knownPaths, newFiles);
@@ -10798,7 +10860,7 @@ function detectNewFiles(root, index) {
10798
10860
  return newFiles;
10799
10861
  }
10800
10862
  function walkDir(dir, root, knownPaths, result) {
10801
- const entries = fs4.readdirSync(dir, { withFileTypes: true });
10863
+ const entries = fs5.readdirSync(dir, { withFileTypes: true });
10802
10864
  for (const entry of entries) {
10803
10865
  const full = path3.join(dir, entry.name);
10804
10866
  if (entry.isDirectory()) {
@@ -10826,8 +10888,8 @@ async function status2(flags) {
10826
10888
  console.log("");
10827
10889
  const modified = detectModifiedFiles(root, index);
10828
10890
  const newFiles = detectNewFiles(root, index);
10829
- const deleted = modified.filter((f) => !fs4.existsSync(path3.join(root, f)));
10830
- const changed = modified.filter((f) => fs4.existsSync(path3.join(root, f)));
10891
+ const deleted = modified.filter((f) => !fs5.existsSync(path3.join(root, f)));
10892
+ const changed = modified.filter((f) => fs5.existsSync(path3.join(root, f)));
10831
10893
  if (changed.length === 0 && newFiles.length === 0 && deleted.length === 0) {
10832
10894
  console.log("No changes.");
10833
10895
  return;
@@ -10864,10 +10926,10 @@ async function content(id, flags) {
10864
10926
  process.stdout.write(text2 || "");
10865
10927
  }
10866
10928
  async function exec2(id, flags) {
10867
- const service = await createService("etl");
10929
+ const service = await createService("etl", { cwd: flags.dir || "." });
10868
10930
  let body = void 0;
10869
10931
  if (flags.file) {
10870
- body = fs5.readFileSync(flags.file, "utf-8");
10932
+ body = fs6.readFileSync(flags.file, "utf-8");
10871
10933
  } else if (flags.sql) {
10872
10934
  body = flags.sql;
10873
10935
  }
@@ -10899,7 +10961,7 @@ async function etl(args) {
10899
10961
  return content(rest[0], flags);
10900
10962
  case "exec":
10901
10963
  if (!rest[0]) {
10902
- console.error('Usage: rpbi etl exec <id> [--sql "..."] [--file path]');
10964
+ console.error('Usage: rpbi etl exec <id> [--file path] [--sql "..."]');
10903
10965
  process.exit(1);
10904
10966
  }
10905
10967
  return exec2(rest[0], flags);
@@ -16418,7 +16480,7 @@ __export(regexes_exports, {
16418
16480
  extendedDuration: () => extendedDuration,
16419
16481
  guid: () => guid,
16420
16482
  hex: () => hex,
16421
- hostname: () => hostname,
16483
+ hostname: () => hostname2,
16422
16484
  html5Email: () => html5Email,
16423
16485
  idnEmail: () => idnEmail,
16424
16486
  integer: () => integer,
@@ -16495,7 +16557,7 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
16495
16557
  var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
16496
16558
  var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
16497
16559
  var base64url = /^[A-Za-z0-9_-]*$/;
16498
- var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
16560
+ var hostname2 = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
16499
16561
  var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/;
16500
16562
  var e164 = /^\+[1-9]\d{6,14}$/;
16501
16563
  var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
@@ -27082,7 +27144,7 @@ __export(external_exports3, {
27082
27144
  guid: () => guid2,
27083
27145
  hash: () => hash,
27084
27146
  hex: () => hex2,
27085
- hostname: () => hostname2,
27147
+ hostname: () => hostname3,
27086
27148
  httpUrl: () => httpUrl,
27087
27149
  includes: () => _includes,
27088
27150
  instanceof: () => _instanceof,
@@ -27294,7 +27356,7 @@ __export(schemas_exports3, {
27294
27356
  guid: () => guid2,
27295
27357
  hash: () => hash,
27296
27358
  hex: () => hex2,
27297
- hostname: () => hostname2,
27359
+ hostname: () => hostname3,
27298
27360
  httpUrl: () => httpUrl,
27299
27361
  instanceof: () => _instanceof,
27300
27362
  int: () => int,
@@ -27798,7 +27860,7 @@ var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat"
27798
27860
  function stringFormat(format, fnOrRegex, _params = {}) {
27799
27861
  return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
27800
27862
  }
27801
- function hostname2(_params) {
27863
+ function hostname3(_params) {
27802
27864
  return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
27803
27865
  }
27804
27866
  function hex2(_params) {
@@ -34447,7 +34509,7 @@ function text(data) {
34447
34509
  async function mcp() {
34448
34510
  const server = new McpServer({
34449
34511
  name: "reporting-bi",
34450
- version: "0.0.20"
34512
+ version: "0.0.21"
34451
34513
  });
34452
34514
  server.tool(
34453
34515
  "status",
@@ -34910,19 +34972,19 @@ function init(args) {
34910
34972
  }
34911
34973
 
34912
34974
  // src/autoupdate.ts
34913
- var fs6 = __toESM(require("node:fs"));
34975
+ var fs7 = __toESM(require("node:fs"));
34914
34976
  var path4 = __toESM(require("node:path"));
34915
- var os2 = __toESM(require("node:os"));
34977
+ var os3 = __toESM(require("node:os"));
34916
34978
  var https = __toESM(require("node:https"));
34917
- var import_node_child_process2 = require("node:child_process");
34918
- var CONFIG_DIR2 = path4.join(os2.homedir(), ".config", "reporting-bi");
34979
+ var import_node_child_process3 = require("node:child_process");
34980
+ var CONFIG_DIR2 = path4.join(os3.homedir(), ".config", "reporting-bi");
34919
34981
  var UPDATE_CHECK_FILE = path4.join(CONFIG_DIR2, "update-check.json");
34920
34982
  var CHECK_INTERVAL = 60 * 60 * 1e3;
34921
34983
  var PACKAGE_NAME = "@reporting-bi/cli";
34922
34984
  var INSTALL_PREFIX = detectPrefix();
34923
34985
  function detectPrefix() {
34924
34986
  try {
34925
- const realPath = fs6.realpathSync(process.argv[1]);
34987
+ const realPath = fs7.realpathSync(process.argv[1]);
34926
34988
  const libIndex = realPath.indexOf(path4.join("lib", "node_modules"));
34927
34989
  if (libIndex > 0) {
34928
34990
  const prefix = realPath.slice(0, libIndex - 1);
@@ -34938,14 +35000,14 @@ function npmInstallCmd(version2) {
34938
35000
  }
34939
35001
  function loadUpdateCheck() {
34940
35002
  try {
34941
- return JSON.parse(fs6.readFileSync(UPDATE_CHECK_FILE, "utf-8"));
35003
+ return JSON.parse(fs7.readFileSync(UPDATE_CHECK_FILE, "utf-8"));
34942
35004
  } catch {
34943
35005
  return { lastCheck: 0 };
34944
35006
  }
34945
35007
  }
34946
35008
  function saveUpdateCheck(data) {
34947
- fs6.mkdirSync(CONFIG_DIR2, { recursive: true });
34948
- fs6.writeFileSync(UPDATE_CHECK_FILE, JSON.stringify(data, null, 2));
35009
+ fs7.mkdirSync(CONFIG_DIR2, { recursive: true });
35010
+ fs7.writeFileSync(UPDATE_CHECK_FILE, JSON.stringify(data, null, 2));
34949
35011
  }
34950
35012
  function fetchLatestVersion() {
34951
35013
  return new Promise((resolve4) => {
@@ -34991,9 +35053,9 @@ async function checkForUpdate() {
34991
35053
  saveUpdateCheck({ lastCheck: now });
34992
35054
  const latest = await fetchLatestVersion();
34993
35055
  if (!latest) return;
34994
- if (!isNewer(latest, "0.0.20")) return;
34995
- console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.20"} \u2192 ${latest}...\x1B[0m`);
34996
- (0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
35056
+ if (!isNewer(latest, "0.0.21")) return;
35057
+ console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.21"} \u2192 ${latest}...\x1B[0m`);
35058
+ (0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
34997
35059
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
34998
35060
  } catch {
34999
35061
  }
@@ -35004,12 +35066,12 @@ async function forceUpdate() {
35004
35066
  console.error("Could not fetch latest version from npm.");
35005
35067
  process.exit(1);
35006
35068
  }
35007
- if (!isNewer(latest, "0.0.20")) {
35008
- console.log(`Already up to date (${"0.0.20"}).`);
35069
+ if (!isNewer(latest, "0.0.21")) {
35070
+ console.log(`Already up to date (${"0.0.21"}).`);
35009
35071
  return;
35010
35072
  }
35011
- console.log(`Updating ${PACKAGE_NAME} ${"0.0.20"} \u2192 ${latest}...`);
35012
- (0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
35073
+ console.log(`Updating ${PACKAGE_NAME} ${"0.0.21"} \u2192 ${latest}...`);
35074
+ (0, import_node_child_process3.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
35013
35075
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
35014
35076
  saveUpdateCheck({ lastCheck: Date.now() });
35015
35077
  }
@@ -35146,7 +35208,7 @@ Examples:
35146
35208
  (async () => {
35147
35209
  const [command, ...args] = process.argv.slice(2);
35148
35210
  if (command === "--version" || command === "-v") {
35149
- console.log("0.0.20");
35211
+ console.log("0.0.21");
35150
35212
  return;
35151
35213
  }
35152
35214
  await checkForUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporting-bi/cli",
3
- "version": "0.0.20",
3
+ "version": "0.1.0",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Reporting.bi CLI — command-line interface for the Reporting.bi platform",
6
6
  "main": "./dist/index.js",