@itpay/cli 0.1.6 → 0.1.7

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/bin/itp +9 -1
  2. package/package.json +1 -1
package/bin/itp CHANGED
@@ -8,7 +8,6 @@ import { execFileSync } from "node:child_process";
8
8
  import { fileURLToPath } from "node:url";
9
9
  import QRCode from "qrcode";
10
10
 
11
- const VERSION = "0.1.5";
12
11
  const DEFAULT_API_BASE = process.env.ITPAY_API_BASE || process.env.ITPAY_CORE_API_BASE || process.env.ITPAY_CORE_BASE_URL || "https://dev.api.itpay.ai";
13
12
  const CONFIG_DIR = path.join(os.homedir(), ".itp");
14
13
  const CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
@@ -19,6 +18,7 @@ const LOCK_PATH = path.join(CONFIG_DIR, "state.lock");
19
18
  const CLI_FILE = fileURLToPath(import.meta.url);
20
19
  const CLI_DIR = path.dirname(CLI_FILE);
21
20
  const PACKAGE_ROOT = path.dirname(CLI_DIR);
21
+ const VERSION = packageVersion();
22
22
 
23
23
  main().catch((error) => {
24
24
  outputError(error);
@@ -3869,6 +3869,14 @@ function readConfig() {
3869
3869
  return readJSON(CONFIG_PATH, {});
3870
3870
  }
3871
3871
 
3872
+ function packageVersion() {
3873
+ try {
3874
+ return JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, "package.json"), "utf8")).version || "0.0.0";
3875
+ } catch {
3876
+ return "0.0.0";
3877
+ }
3878
+ }
3879
+
3872
3880
  function writeConfig(value) {
3873
3881
  writeJSON0600(CONFIG_PATH, value);
3874
3882
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itpay/cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "ItPay CLI, buyer skill, and agent-readable docs for agent-native commerce.",
5
5
  "type": "module",
6
6
  "bin": {