@clickzetta/cz-cli 0.3.69 → 0.3.71

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/agent.js +51 -0
  2. package/package.json +8 -7
package/bin/agent.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const { DEFAULT_FALLBACK_ROOT, getPlatformSpec, resolveInstalledBinary, ensureInstalledBinary } = require("./platform");
8
+
9
+ const spec = getPlatformSpec();
10
+ const expectedVersion = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8")).version;
11
+
12
+ async function run() {
13
+ if (!spec) {
14
+ console.error("Error: Unsupported platform.");
15
+ process.exit(1);
16
+ }
17
+
18
+ let installed = resolveInstalledBinary({ spec, fallbackRoot: DEFAULT_FALLBACK_ROOT });
19
+
20
+ if (installed) {
21
+ try {
22
+ const binaryVersion = execFileSync(installed.binPath, ["--version"], {
23
+ stdio: ["ignore", "pipe", "ignore"],
24
+ encoding: "utf-8",
25
+ timeout: 5000,
26
+ }).trim();
27
+ if (expectedVersion !== "0.1.0" && binaryVersion && !binaryVersion.includes(expectedVersion)) {
28
+ installed = await ensureInstalledBinary({ spec, version: expectedVersion, fallbackRoot: DEFAULT_FALLBACK_ROOT, force: true });
29
+ }
30
+ } catch {
31
+ installed = await ensureInstalledBinary({ spec, version: expectedVersion, fallbackRoot: DEFAULT_FALLBACK_ROOT, force: true });
32
+ }
33
+ } else {
34
+ installed = await ensureInstalledBinary({ spec, version: expectedVersion, fallbackRoot: DEFAULT_FALLBACK_ROOT });
35
+ }
36
+
37
+ if (!installed) {
38
+ console.error(`Error: Platform binary not found (${spec.packageName}).`);
39
+ console.error("Fix: npm install -g @clickzetta/cz-cli@latest --ignore-scripts=false");
40
+ process.exit(1);
41
+ }
42
+
43
+ execFileSync(installed.binPath, ["agent", ...process.argv.slice(2)], { stdio: "inherit", env: process.env });
44
+ }
45
+
46
+ run().catch((e) => {
47
+ if (e && e.status !== undefined) process.exit(e.status);
48
+ console.error(`Error: ${e && e.message ? e.message : e}`);
49
+ console.error("Fix: npm install -g @clickzetta/cz-cli@latest --ignore-scripts=false");
50
+ process.exit(1);
51
+ });
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@clickzetta/cz-cli",
3
- "version": "0.3.69",
3
+ "version": "0.3.71",
4
4
  "description": "AI-Agent-friendly CLI for ClickZetta Lakehouse",
5
5
  "bin": {
6
- "cz-cli": "bin/run.js"
6
+ "cz-cli": "bin/run.js",
7
+ "cz-agent": "bin/agent.js"
7
8
  },
8
9
  "scripts": {
9
10
  "postinstall": "node bin/postinstall.js"
@@ -12,11 +13,11 @@
12
13
  "bin/"
13
14
  ],
14
15
  "optionalDependencies": {
15
- "@clickzetta/cz-cli-darwin-arm64": "0.3.69",
16
- "@clickzetta/cz-cli-darwin-x64": "0.3.69",
17
- "@clickzetta/cz-cli-linux-arm64": "0.3.69",
18
- "@clickzetta/cz-cli-linux-x64": "0.3.69",
19
- "@clickzetta/cz-cli-win32-x64": "0.3.69"
16
+ "@clickzetta/cz-cli-darwin-arm64": "0.3.71",
17
+ "@clickzetta/cz-cli-darwin-x64": "0.3.71",
18
+ "@clickzetta/cz-cli-linux-arm64": "0.3.71",
19
+ "@clickzetta/cz-cli-linux-x64": "0.3.71",
20
+ "@clickzetta/cz-cli-win32-x64": "0.3.71"
20
21
  },
21
22
  "license": "MIT",
22
23
  "repository": {