@clickzetta/cz-cli 0.3.32 → 0.3.35

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/postinstall.js +37 -1
  2. package/package.json +6 -6
@@ -11,9 +11,20 @@ const platform = os.platform();
11
11
  const arch = os.arch() === "x64" ? "x64" : "arm64";
12
12
  const pkgName = `@clickzetta/cz-cli-${platform}-${arch}`;
13
13
  const binName = platform === "win32" ? "cz-cli.exe" : "cz-cli";
14
+ const installFile = path.join(home, ".clickzetta", "install.json");
15
+
16
+ function detectPackageManager() {
17
+ const userAgent = process.env.npm_config_user_agent || "";
18
+ if (userAgent.startsWith("pnpm/")) return "pnpm";
19
+ if (userAgent.startsWith("yarn/")) return "yarn";
20
+ if (userAgent.startsWith("bun/")) return "bun";
21
+ if (userAgent.startsWith("npm/")) return "npm";
22
+ return "npm";
23
+ }
14
24
 
15
25
  try {
16
26
  const pkgDir = path.dirname(require.resolve(`${pkgName}/package.json`));
27
+ const binPath = path.join(pkgDir, "bin", binName);
17
28
  const skillsSrc = path.join(pkgDir, "bin", "skills");
18
29
  if (!fs.existsSync(skillsSrc)) process.exit(0);
19
30
 
@@ -89,11 +100,36 @@ try {
89
100
  }
90
101
 
91
102
  try {
92
- execFileSync(path.join(pkgDir, "bin", binName), [], {
103
+ execFileSync(binPath, [], {
93
104
  stdio: "ignore",
94
105
  env: { ...process.env, CLICKZETTA_MIGRATE_PROFILES_ONLY: "1" },
95
106
  });
96
107
  } catch (e) {}
108
+
109
+ try {
110
+ const version = execFileSync(binPath, ["--version"], {
111
+ stdio: ["ignore", "pipe", "ignore"],
112
+ encoding: "utf-8",
113
+ env: process.env,
114
+ }).trim();
115
+ fs.mkdirSync(path.dirname(installFile), { recursive: true });
116
+ fs.writeFileSync(
117
+ installFile,
118
+ JSON.stringify(
119
+ {
120
+ version: 1,
121
+ method: detectPackageManager(),
122
+ installed_path: binPath,
123
+ channel: "latest",
124
+ binary_version: version,
125
+ updated_at: new Date().toISOString(),
126
+ },
127
+ null,
128
+ 2
129
+ ) + "\n",
130
+ "utf-8"
131
+ );
132
+ } catch (e) {}
97
133
  } catch (e) {
98
134
  // Non-fatal: don't block npm install
99
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickzetta/cz-cli",
3
- "version": "0.3.32",
3
+ "version": "0.3.35",
4
4
  "description": "AI-Agent-friendly CLI for ClickZetta Lakehouse",
5
5
  "bin": {
6
6
  "cz-cli": "bin/run.js"
@@ -10,11 +10,11 @@
10
10
  },
11
11
  "files": ["bin/"],
12
12
  "optionalDependencies": {
13
- "@clickzetta/cz-cli-darwin-arm64": "0.3.32",
14
- "@clickzetta/cz-cli-darwin-x64": "0.3.32",
15
- "@clickzetta/cz-cli-linux-arm64": "0.3.32",
16
- "@clickzetta/cz-cli-linux-x64": "0.3.32",
17
- "@clickzetta/cz-cli-win32-x64": "0.3.32"
13
+ "@clickzetta/cz-cli-darwin-arm64": "0.3.35",
14
+ "@clickzetta/cz-cli-darwin-x64": "0.3.35",
15
+ "@clickzetta/cz-cli-linux-arm64": "0.3.35",
16
+ "@clickzetta/cz-cli-linux-x64": "0.3.35",
17
+ "@clickzetta/cz-cli-win32-x64": "0.3.35"
18
18
  },
19
19
  "license": "MIT",
20
20
  "repository": {