arcana-ai 0.1.0 → 0.1.2
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/README.md +1 -1
- package/bin/arcana.js +23 -10
- package/package.json +1 -1
package/README.md
CHANGED
package/bin/arcana.js
CHANGED
|
@@ -44,23 +44,36 @@ async function downloadAndExtract() {
|
|
|
44
44
|
process.exit(1)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// Clean up stale temp files from previous failed attempts
|
|
48
|
+
try { unlinkSync(path.join(CACHE_DIR, entry.name)) } catch {}
|
|
49
|
+
|
|
47
50
|
// Write to temp file
|
|
48
51
|
const tmp = path.join(CACHE_DIR, entry.name)
|
|
49
52
|
const buf = Buffer.from(await res.arrayBuffer())
|
|
50
53
|
writeFileSync(tmp, buf)
|
|
54
|
+
console.error(`arcana: downloaded ${(buf.length / 1e6).toFixed(1)}MB`)
|
|
51
55
|
|
|
52
56
|
// Extract
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
try {
|
|
58
|
+
if (entry.name.endsWith(".tar.gz")) {
|
|
59
|
+
execSync(`tar xzf "${tmp}" -C "${CACHE_DIR}"`, { stdio: "pipe" })
|
|
60
|
+
unlinkSync(tmp)
|
|
61
|
+
} else if (entry.name.endsWith(".zip")) {
|
|
62
|
+
if (os.platform() === "win32") {
|
|
63
|
+
// Use .NET ZipFile (built into .NET, no PowerShell module needed)
|
|
64
|
+
execSync(
|
|
65
|
+
`powershell -Command "[System.Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | Out-Null; [System.IO.Compression.ZipFile]::ExtractToDirectory('${tmp.replace(/'/g, "''")}', '${CACHE_DIR.replace(/'/g, "''")}')"`,
|
|
66
|
+
{ stdio: "pipe" },
|
|
67
|
+
)
|
|
68
|
+
} else {
|
|
69
|
+
execSync(`unzip -o "${tmp}" -d "${CACHE_DIR}"`, { stdio: "pipe" })
|
|
70
|
+
}
|
|
71
|
+
unlinkSync(tmp)
|
|
62
72
|
}
|
|
63
|
-
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error(`arcana: extraction failed: ${e.message}`)
|
|
75
|
+
// Leave tmp file for manual debugging
|
|
76
|
+
process.exit(1)
|
|
64
77
|
}
|
|
65
78
|
|
|
66
79
|
// Ensure executable
|