@clickzetta/cz-cli 0.3.31 → 0.3.33
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 +45 -1
- package/package.json +6 -6
package/bin/postinstall.js
CHANGED
|
@@ -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
|
|
|
@@ -31,6 +42,14 @@ try {
|
|
|
31
42
|
path.join(home, ".singclaw", "workspace", "skills"),
|
|
32
43
|
];
|
|
33
44
|
|
|
45
|
+
for (const dir of agentDirs) {
|
|
46
|
+
for (const legacy of ["czagent", "czcli", "cz-cli-v2"]) {
|
|
47
|
+
try {
|
|
48
|
+
fs.rmSync(path.join(dir, legacy), { recursive: true, force: true });
|
|
49
|
+
} catch (e) {}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
34
53
|
// Cleanup: fix cz-cli-v2 → cz-cli in existing skill files (bug introduced in 57a49fcdc)
|
|
35
54
|
for (const dir of agentDirs) {
|
|
36
55
|
const skillFile = path.join(dir, "cz-cli", "SKILL.md");
|
|
@@ -81,11 +100,36 @@ try {
|
|
|
81
100
|
}
|
|
82
101
|
|
|
83
102
|
try {
|
|
84
|
-
execFileSync(
|
|
103
|
+
execFileSync(binPath, [], {
|
|
85
104
|
stdio: "ignore",
|
|
86
105
|
env: { ...process.env, CLICKZETTA_MIGRATE_PROFILES_ONLY: "1" },
|
|
87
106
|
});
|
|
88
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) {}
|
|
89
133
|
} catch (e) {
|
|
90
134
|
// Non-fatal: don't block npm install
|
|
91
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clickzetta/cz-cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.33",
|
|
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.
|
|
14
|
-
"@clickzetta/cz-cli-darwin-x64": "0.3.
|
|
15
|
-
"@clickzetta/cz-cli-linux-arm64": "0.3.
|
|
16
|
-
"@clickzetta/cz-cli-linux-x64": "0.3.
|
|
17
|
-
"@clickzetta/cz-cli-win32-x64": "0.3.
|
|
13
|
+
"@clickzetta/cz-cli-darwin-arm64": "0.3.33",
|
|
14
|
+
"@clickzetta/cz-cli-darwin-x64": "0.3.33",
|
|
15
|
+
"@clickzetta/cz-cli-linux-arm64": "0.3.33",
|
|
16
|
+
"@clickzetta/cz-cli-linux-x64": "0.3.33",
|
|
17
|
+
"@clickzetta/cz-cli-win32-x64": "0.3.33"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"repository": {
|