@vecanova/zana 3.0.5 → 3.1.1
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/zana.js +33 -20
- package/package.json +1 -1
- package/postinstall.js +38 -20
package/bin/zana.js
CHANGED
|
@@ -19,18 +19,18 @@ function findZanaBinary() {
|
|
|
19
19
|
// 1. Check if already in PATH
|
|
20
20
|
const which = process.platform === "win32" ? "where" : "which";
|
|
21
21
|
try {
|
|
22
|
-
const found = execFileSync(which, ["zana
|
|
23
|
-
if
|
|
22
|
+
const found = execFileSync(which, ["zana"], { encoding: "utf8" }).trim().split("\n")[0];
|
|
23
|
+
// Avoid infinite recursion if 'zana' points to this script
|
|
24
|
+
if (found && !found.includes("node") && !found.includes("zana-npm")) return found;
|
|
24
25
|
} catch (_) {}
|
|
25
26
|
|
|
26
|
-
// 2. Check common
|
|
27
|
+
// 2. Check common pipx/uv tool install locations
|
|
27
28
|
const candidates = [
|
|
28
29
|
path.join(os.homedir(), ".local", "bin", "zana"),
|
|
29
30
|
path.join(os.homedir(), ".cargo", "bin", "zana"),
|
|
31
|
+
path.join(os.homedir(), ".local", "pipx", "venvs", "vecanova-zana", "bin", "zana"),
|
|
30
32
|
"/usr/local/bin/zana",
|
|
31
33
|
"/usr/bin/zana",
|
|
32
|
-
// Windows pip
|
|
33
|
-
path.join(os.homedir(), "AppData", "Local", "Programs", "Python", "Python312", "Scripts", "zana.exe"),
|
|
34
34
|
];
|
|
35
35
|
|
|
36
36
|
for (const c of candidates) {
|
|
@@ -66,17 +66,31 @@ function bootstrap() {
|
|
|
66
66
|
process.exit(1);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
console.log("⚙️ Installing ZANA
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
console.log("⚙️ Installing ZANA (isolated environment)...");
|
|
70
|
+
|
|
71
|
+
let success = false;
|
|
72
|
+
// Try uv tool install first (fastest)
|
|
73
|
+
try {
|
|
74
|
+
spawnSync("uv", ["tool", "install", "vecanova-zana", "--force"], { stdio: "inherit" });
|
|
75
|
+
success = true;
|
|
76
|
+
} catch (_) {
|
|
77
|
+
try {
|
|
78
|
+
// Fallback to pipx
|
|
79
|
+
spawnSync("pipx", ["install", "vecanova-zana", "--force"], { stdio: "inherit" });
|
|
80
|
+
success = true;
|
|
81
|
+
} catch (__) {
|
|
82
|
+
try {
|
|
83
|
+
// Last resort: pip --user
|
|
84
|
+
spawnSync(python, ["-m", "pip", "install", "--user", "vecanova-zana"], { stdio: "inherit" });
|
|
85
|
+
success = true;
|
|
86
|
+
} catch (___) {}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
75
89
|
|
|
76
|
-
if (
|
|
90
|
+
if (!success) {
|
|
77
91
|
console.error(
|
|
78
|
-
"\n❌ Failed to install ZANA
|
|
79
|
-
" Try manually:
|
|
92
|
+
"\n❌ Failed to install ZANA.\n" +
|
|
93
|
+
" Try manually: pipx install vecanova-zana\n" +
|
|
80
94
|
" Or run the installer: bash <(curl -LsSf https://zana.vecanova.com/install.sh)\n"
|
|
81
95
|
);
|
|
82
96
|
process.exit(1);
|
|
@@ -94,23 +108,22 @@ if (!zanaBin) {
|
|
|
94
108
|
zanaBin = findZanaBinary();
|
|
95
109
|
}
|
|
96
110
|
|
|
111
|
+
const args = process.argv.slice(2);
|
|
112
|
+
|
|
97
113
|
if (!zanaBin) {
|
|
98
|
-
// Last resort: run via python -m
|
|
114
|
+
// Last resort: run via python -m zana.main
|
|
99
115
|
const python = findPython();
|
|
100
116
|
if (!python) {
|
|
101
|
-
console.error("❌ Could not locate ZANA. Run:
|
|
117
|
+
console.error("❌ Could not locate ZANA. Run: pipx install vecanova-zana");
|
|
102
118
|
process.exit(1);
|
|
103
119
|
}
|
|
104
|
-
|
|
105
|
-
const args = process.argv.slice(2);
|
|
106
|
-
const result = spawnSync(python, ["-m", "cli.main", ...args], {
|
|
120
|
+
const result = spawnSync(python, ["-m", "zana.main", ...args], {
|
|
107
121
|
stdio: "inherit",
|
|
108
122
|
env: process.env,
|
|
109
123
|
});
|
|
110
124
|
process.exit(result.status ?? 1);
|
|
111
125
|
}
|
|
112
126
|
|
|
113
|
-
const args = process.argv.slice(2);
|
|
114
127
|
const result = spawnSync(zanaBin, args, {
|
|
115
128
|
stdio: "inherit",
|
|
116
129
|
env: process.env,
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -32,21 +32,25 @@ function findPython() {
|
|
|
32
32
|
|
|
33
33
|
function isZanaInstalled(python) {
|
|
34
34
|
try {
|
|
35
|
-
execFileSync(python, ["-c", "import
|
|
36
|
-
encoding: "utf8",
|
|
37
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
38
|
-
timeout: 5000,
|
|
39
|
-
});
|
|
40
|
-
return true;
|
|
41
|
-
} catch (_) {}
|
|
42
|
-
try {
|
|
43
|
-
execFileSync(python, ["-m", "pip", "show", "zana"], {
|
|
35
|
+
execFileSync(python, ["-c", "import zana.main"], {
|
|
44
36
|
encoding: "utf8",
|
|
45
37
|
stdio: ["pipe", "pipe", "pipe"],
|
|
46
38
|
timeout: 5000,
|
|
47
39
|
});
|
|
48
40
|
return true;
|
|
49
41
|
} catch (_) {}
|
|
42
|
+
for (const bin of ["zana", "uv", "pipx"]) {
|
|
43
|
+
try {
|
|
44
|
+
const tool = bin === "zana" ? "uv" : bin;
|
|
45
|
+
const cmd = bin === "zana" ? ["tool", "list"] : ["list"];
|
|
46
|
+
const out = execFileSync(tool, cmd, {
|
|
47
|
+
encoding: "utf8",
|
|
48
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
49
|
+
timeout: 5000,
|
|
50
|
+
});
|
|
51
|
+
if (out.includes("vecanova-zana")) return true;
|
|
52
|
+
} catch (_) {}
|
|
53
|
+
}
|
|
50
54
|
return false;
|
|
51
55
|
}
|
|
52
56
|
|
|
@@ -68,22 +72,37 @@ if (!python) {
|
|
|
68
72
|
console.log(`✓ Python found: ${python}`);
|
|
69
73
|
|
|
70
74
|
if (isZanaInstalled(python)) {
|
|
71
|
-
console.log("✓ ZANA
|
|
75
|
+
console.log("✓ ZANA is already installed and isolated.\n");
|
|
72
76
|
console.log(" Run: zana init — to create your Aeon");
|
|
73
77
|
console.log(" Run: zana --help — to explore commands\n");
|
|
74
78
|
process.exit(0);
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
console.log("⚙️ Installing ZANA
|
|
78
|
-
console.log(" This
|
|
81
|
+
console.log("⚙️ Installing ZANA CLI (isolated environment)...");
|
|
82
|
+
console.log(" This ensures ZANA won't interfere with your system Python.\n");
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
// Strategy: 1. uv tool (fastest), 2. pipx (isolated), 3. pip --user (last resort)
|
|
85
|
+
let installed = false;
|
|
86
|
+
|
|
87
|
+
for (const method of ["uv", "pipx", "pip"]) {
|
|
88
|
+
try {
|
|
89
|
+
if (method === "uv") {
|
|
90
|
+
spawnSync("uv", ["tool", "install", "vecanova-zana", "--force"], { stdio: "inherit" });
|
|
91
|
+
installed = true;
|
|
92
|
+
break;
|
|
93
|
+
} else if (method === "pipx") {
|
|
94
|
+
spawnSync("pipx", ["install", "vecanova-zana", "--force"], { stdio: "inherit" });
|
|
95
|
+
installed = true;
|
|
96
|
+
break;
|
|
97
|
+
} else {
|
|
98
|
+
spawnSync(python, ["-m", "pip", "install", "--user", "--upgrade", "vecanova-zana"], { stdio: "inherit" });
|
|
99
|
+
installed = true;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
} catch (_) {}
|
|
103
|
+
}
|
|
85
104
|
|
|
86
|
-
if (
|
|
105
|
+
if (installed) {
|
|
87
106
|
console.log("\n✅ ZANA installed successfully!\n");
|
|
88
107
|
console.log("╔══════════════════════════════════════════════════╗");
|
|
89
108
|
console.log("║ Quick start: ║");
|
|
@@ -97,9 +116,8 @@ if (result.status === 0) {
|
|
|
97
116
|
} else {
|
|
98
117
|
console.warn(
|
|
99
118
|
"\n⚠️ Could not auto-install ZANA Python package.\n" +
|
|
100
|
-
" Run manually:
|
|
119
|
+
" Run manually: pipx install vecanova-zana\n" +
|
|
101
120
|
" Or: bash <(curl -LsSf https://zana.vecanova.com/install.sh)\n"
|
|
102
121
|
);
|
|
103
|
-
// non-fatal exit
|
|
104
122
|
process.exit(0);
|
|
105
123
|
}
|