@clickzetta/cz-cli 0.3.0
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.
- package/bin/postinstall.js +57 -0
- package/bin/run.js +27 -0
- package/package.json +25 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
|
|
8
|
+
const home = os.homedir();
|
|
9
|
+
const platform = os.platform();
|
|
10
|
+
const arch = os.arch() === "x64" ? "x64" : "arm64";
|
|
11
|
+
const pkgName = `@clickzetta/cz-cli-${platform}-${arch}`;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const pkgDir = path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
15
|
+
const skillsSrc = path.join(pkgDir, "bin", "skills");
|
|
16
|
+
if (!fs.existsSync(skillsSrc)) process.exit(0);
|
|
17
|
+
|
|
18
|
+
const skills = fs.readdirSync(skillsSrc).filter((name) =>
|
|
19
|
+
fs.statSync(path.join(skillsSrc, name)).isDirectory()
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
// 1. cz-cli skill → external agent directories (subagent registration)
|
|
23
|
+
const agentDirs = [
|
|
24
|
+
path.join(home, ".claude", "skills"),
|
|
25
|
+
path.join(home, ".kiro", "skills"),
|
|
26
|
+
path.join(home, ".cursor", "skills"),
|
|
27
|
+
path.join(home, ".codex", "skills"),
|
|
28
|
+
path.join(home, ".openclaw", "workspace", "skills"),
|
|
29
|
+
path.join(home, ".singclaw", "workspace", "skills"),
|
|
30
|
+
];
|
|
31
|
+
if (skills.includes("cz-cli")) {
|
|
32
|
+
const src = path.join(skillsSrc, "cz-cli");
|
|
33
|
+
for (const dir of agentDirs) {
|
|
34
|
+
const dest = path.join(dir, "cz-cli");
|
|
35
|
+
try {
|
|
36
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
37
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
38
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
39
|
+
} catch (e) {}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 2. All other skills → ~/.clickzetta/skills/ (cz-cli internal use)
|
|
44
|
+
const internalDest = path.join(home, ".clickzetta", "skills");
|
|
45
|
+
fs.mkdirSync(internalDest, { recursive: true });
|
|
46
|
+
for (const name of skills) {
|
|
47
|
+
if (name === "cz-cli") continue;
|
|
48
|
+
const src = path.join(skillsSrc, name);
|
|
49
|
+
const dest = path.join(internalDest, name);
|
|
50
|
+
try {
|
|
51
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
52
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
53
|
+
} catch (e) {}
|
|
54
|
+
}
|
|
55
|
+
} catch (e) {
|
|
56
|
+
// Non-fatal: don't block npm install
|
|
57
|
+
}
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const os = require("os");
|
|
7
|
+
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const arch = os.arch() === "x64" ? "x64" : "arm64";
|
|
10
|
+
const pkgName = `@clickzetta/cz-cli-${platform}-${arch}`;
|
|
11
|
+
const binName = platform === "win32" ? "czcli.exe" : "czcli";
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const pkgDir = path.dirname(require.resolve(`${pkgName}/package.json`));
|
|
15
|
+
const binPath = path.join(pkgDir, "bin", binName);
|
|
16
|
+
const result = execFileSync(binPath, process.argv.slice(2), {
|
|
17
|
+
stdio: "inherit",
|
|
18
|
+
env: process.env,
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
if (e.status !== undefined) {
|
|
22
|
+
process.exit(e.status);
|
|
23
|
+
}
|
|
24
|
+
console.error(`Error: Platform ${platform}-${arch} is not supported by @clickzetta/cz-cli.`);
|
|
25
|
+
console.error(`Try installing directly: curl -fsSL https://github.com/clickzetta/cz-cli/releases/latest/download/install.sh | sh`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@clickzetta/cz-cli",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "AI-Agent-friendly CLI for ClickZetta Lakehouse",
|
|
5
|
+
"bin": {
|
|
6
|
+
"cz-cli": "bin/run.js",
|
|
7
|
+
"czcli": "bin/run.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node bin/postinstall.js"
|
|
11
|
+
},
|
|
12
|
+
"files": ["bin/"],
|
|
13
|
+
"optionalDependencies": {
|
|
14
|
+
"@clickzetta/cz-cli-darwin-arm64": "0.3.0",
|
|
15
|
+
"@clickzetta/cz-cli-linux-arm64": "0.3.0",
|
|
16
|
+
"@clickzetta/cz-cli-linux-x64": "0.3.0",
|
|
17
|
+
"@clickzetta/cz-cli-win32-x64": "0.3.0"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/clickzetta/cz-cli.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": ["clickzetta", "lakehouse", "cli", "ai-agent"]
|
|
25
|
+
}
|