@reporting-bi/cli 0.0.18 → 0.0.20

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 +17 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9814,9 +9814,9 @@ function findLocalConfig(startDir) {
9814
9814
  dir = parent;
9815
9815
  }
9816
9816
  }
9817
- function getActiveConnection() {
9817
+ function getActiveConnection(cwd) {
9818
9818
  const creds = loadCredentials();
9819
- const local = findLocalConfig();
9819
+ const local = findLocalConfig(cwd);
9820
9820
  const domain2 = local?.domain ?? creds.active;
9821
9821
  if (!domain2 || !creds.connections[domain2]) return null;
9822
9822
  const tokens = { ...creds.connections[domain2] };
@@ -9878,7 +9878,8 @@ async function ensureValidToken(conn) {
9878
9878
  }
9879
9879
  }
9880
9880
  async function createService(name, options) {
9881
- const conn = getActiveConnection();
9881
+ const cwd = typeof options === "object" ? options.cwd : void 0;
9882
+ const conn = getActiveConnection(cwd);
9882
9883
  if (!conn) {
9883
9884
  console.error('Not logged in. Run "rpbi login" first.');
9884
9885
  process.exit(1);
@@ -10574,13 +10575,13 @@ function stripFields(obj, excludeFields) {
10574
10575
  }
10575
10576
  async function pull(flags) {
10576
10577
  const dir = path3.resolve(flags.dir || ".");
10577
- const conn = getActiveConnection();
10578
+ const conn = getActiveConnection(dir);
10578
10579
  if (!conn) {
10579
10580
  console.error('Not logged in. Run "rpbi login" first.');
10580
10581
  process.exit(1);
10581
10582
  }
10582
- const etlService = await createService("etl");
10583
- const defService = await createService("definition");
10583
+ const etlService = await createService("etl", { cwd: dir });
10584
+ const defService = await createService("definition", { cwd: dir });
10584
10585
  console.log(`Pulling ETL threads to ${dir}...`);
10585
10586
  const threads = await etlService.get("threads", {
10586
10587
  fields: ["id_thread", "description", "type", "enabled", "ord_num", "module"],
@@ -10662,7 +10663,7 @@ async function push(flags, files) {
10662
10663
  }
10663
10664
  const index = readIndex(root);
10664
10665
  const indexMap = new Map(index.map((e) => [e.path, e]));
10665
- const etlService = await createService("etl");
10666
+ const etlService = await createService("etl", { cwd: root });
10666
10667
  const force = flags.force === "true";
10667
10668
  let filesToPush;
10668
10669
  if (files.length > 0) {
@@ -10766,8 +10767,8 @@ async function pullContext(dir, etlService, defService) {
10766
10767
  }
10767
10768
  async function context(flags) {
10768
10769
  const dir = path3.resolve(flags.dir || ".");
10769
- const etlService = await createService("etl");
10770
- const defService = await createService("definition");
10770
+ const etlService = await createService("etl", { cwd: dir });
10771
+ const defService = await createService("definition", { cwd: dir });
10771
10772
  await pullContext(dir, etlService, defService);
10772
10773
  console.log("Context pull complete.");
10773
10774
  }
@@ -34446,7 +34447,7 @@ function text(data) {
34446
34447
  async function mcp() {
34447
34448
  const server = new McpServer({
34448
34449
  name: "reporting-bi",
34449
- version: "0.0.18"
34450
+ version: "0.0.20"
34450
34451
  });
34451
34452
  server.tool(
34452
34453
  "status",
@@ -34990,8 +34991,8 @@ async function checkForUpdate() {
34990
34991
  saveUpdateCheck({ lastCheck: now });
34991
34992
  const latest = await fetchLatestVersion();
34992
34993
  if (!latest) return;
34993
- if (!isNewer(latest, "0.0.18")) return;
34994
- console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.18"} \u2192 ${latest}...\x1B[0m`);
34994
+ if (!isNewer(latest, "0.0.20")) return;
34995
+ console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.20"} \u2192 ${latest}...\x1B[0m`);
34995
34996
  (0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
34996
34997
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
34997
34998
  } catch {
@@ -35003,11 +35004,11 @@ async function forceUpdate() {
35003
35004
  console.error("Could not fetch latest version from npm.");
35004
35005
  process.exit(1);
35005
35006
  }
35006
- if (!isNewer(latest, "0.0.18")) {
35007
- console.log(`Already up to date (${"0.0.18"}).`);
35007
+ if (!isNewer(latest, "0.0.20")) {
35008
+ console.log(`Already up to date (${"0.0.20"}).`);
35008
35009
  return;
35009
35010
  }
35010
- console.log(`Updating ${PACKAGE_NAME} ${"0.0.18"} \u2192 ${latest}...`);
35011
+ console.log(`Updating ${PACKAGE_NAME} ${"0.0.20"} \u2192 ${latest}...`);
35011
35012
  (0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
35012
35013
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
35013
35014
  saveUpdateCheck({ lastCheck: Date.now() });
@@ -35145,7 +35146,7 @@ Examples:
35145
35146
  (async () => {
35146
35147
  const [command, ...args] = process.argv.slice(2);
35147
35148
  if (command === "--version" || command === "-v") {
35148
- console.log("0.0.18");
35149
+ console.log("0.0.20");
35149
35150
  return;
35150
35151
  }
35151
35152
  await checkForUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporting-bi/cli",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Reporting.bi CLI — command-line interface for the Reporting.bi platform",
6
6
  "main": "./dist/index.js",