@reporting-bi/cli 0.0.15 → 0.0.16

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 +31 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10194,14 +10194,21 @@ async function logout(domain2) {
10194
10194
  // src/commands/status.ts
10195
10195
  function status() {
10196
10196
  const creds = loadCredentials();
10197
+ const local = findLocalConfig();
10197
10198
  const domains = Object.keys(creds.connections);
10199
+ if (local) {
10200
+ console.log(`Local config (.rpbi/manifest.json):`);
10201
+ console.log(` domain: ${local.domain}`);
10202
+ console.log(` accounting: ${local.accounting ?? "not set"}`);
10203
+ console.log();
10204
+ }
10198
10205
  if (domains.length === 0) {
10199
10206
  console.log("Not logged in.");
10200
10207
  return;
10201
10208
  }
10202
10209
  for (const domain2 of domains) {
10203
10210
  const tokens = creds.connections[domain2];
10204
- const isActive = creds.active === domain2;
10211
+ const isActive = local ? local.domain === domain2 : creds.active === domain2;
10205
10212
  const now = Math.floor(Date.now() / 1e3);
10206
10213
  const expiresIn = tokens.expires_at - now;
10207
10214
  let expiry;
@@ -34388,7 +34395,7 @@ function text(data) {
34388
34395
  async function mcp() {
34389
34396
  const server = new McpServer({
34390
34397
  name: "reporting-bi",
34391
- version: "0.0.15"
34398
+ version: "0.0.16"
34392
34399
  });
34393
34400
  server.tool(
34394
34401
  "status",
@@ -34861,6 +34868,20 @@ var CONFIG_DIR2 = path4.join(os2.homedir(), ".config", "reporting-bi");
34861
34868
  var UPDATE_CHECK_FILE = path4.join(CONFIG_DIR2, "update-check.json");
34862
34869
  var CHECK_INTERVAL = 60 * 60 * 1e3;
34863
34870
  var PACKAGE_NAME = "@reporting-bi/cli";
34871
+ var INSTALL_PREFIX = detectPrefix();
34872
+ function detectPrefix() {
34873
+ const binDir = path4.dirname(process.argv[1]);
34874
+ const libIndex = binDir.indexOf(path4.join("lib", "node_modules"));
34875
+ if (libIndex > 0) {
34876
+ const prefix = binDir.slice(0, libIndex - 1);
34877
+ if (prefix !== "/usr" && prefix !== "/usr/local") return prefix;
34878
+ }
34879
+ return null;
34880
+ }
34881
+ function npmInstallCmd(version2) {
34882
+ const prefix = INSTALL_PREFIX ? ` --prefix "${INSTALL_PREFIX}"` : "";
34883
+ return `npm install -g${prefix} ${PACKAGE_NAME}@${version2}`;
34884
+ }
34864
34885
  function loadUpdateCheck() {
34865
34886
  try {
34866
34887
  return JSON.parse(fs6.readFileSync(UPDATE_CHECK_FILE, "utf-8"));
@@ -34916,9 +34937,9 @@ async function checkForUpdate() {
34916
34937
  saveUpdateCheck({ lastCheck: now });
34917
34938
  const latest = await fetchLatestVersion();
34918
34939
  if (!latest) return;
34919
- if (!isNewer(latest, "0.0.15")) return;
34920
- console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.15"} \u2192 ${latest}...\x1B[0m`);
34921
- (0, import_node_child_process2.execSync)(`npm install -g ${PACKAGE_NAME}@${latest}`, { stdio: "inherit" });
34940
+ if (!isNewer(latest, "0.0.16")) return;
34941
+ console.log(`\x1B[33mUpdating ${PACKAGE_NAME} ${"0.0.16"} \u2192 ${latest}...\x1B[0m`);
34942
+ (0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
34922
34943
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
34923
34944
  } catch {
34924
34945
  }
@@ -34929,12 +34950,12 @@ async function forceUpdate() {
34929
34950
  console.error("Could not fetch latest version from npm.");
34930
34951
  process.exit(1);
34931
34952
  }
34932
- if (!isNewer(latest, "0.0.15")) {
34933
- console.log(`Already up to date (${"0.0.15"}).`);
34953
+ if (!isNewer(latest, "0.0.16")) {
34954
+ console.log(`Already up to date (${"0.0.16"}).`);
34934
34955
  return;
34935
34956
  }
34936
- console.log(`Updating ${PACKAGE_NAME} ${"0.0.15"} \u2192 ${latest}...`);
34937
- (0, import_node_child_process2.execSync)(`npm install -g ${PACKAGE_NAME}@${latest}`, { stdio: "inherit" });
34957
+ console.log(`Updating ${PACKAGE_NAME} ${"0.0.16"} \u2192 ${latest}...`);
34958
+ (0, import_node_child_process2.execSync)(npmInstallCmd(latest), { stdio: "inherit" });
34938
34959
  console.log(`\x1B[32mUpdated to ${latest}.\x1B[0m`);
34939
34960
  saveUpdateCheck({ lastCheck: Date.now() });
34940
34961
  }
@@ -35063,7 +35084,7 @@ Examples:
35063
35084
  (async () => {
35064
35085
  const [command, ...args] = process.argv.slice(2);
35065
35086
  if (command === "--version" || command === "-v") {
35066
- console.log("0.0.15");
35087
+ console.log("0.0.16");
35067
35088
  return;
35068
35089
  }
35069
35090
  await checkForUpdate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reporting-bi/cli",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Reporting.bi CLI — command-line interface for the Reporting.bi platform",
6
6
  "main": "./dist/index.js",