arcana-ai 0.1.1 → 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.
Files changed (2) hide show
  1. package/bin/arcana.js +23 -10
  2. package/package.json +1 -1
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
- if (entry.name.endsWith(".tar.gz")) {
54
- execSync(`tar xzf "${tmp}" -C "${CACHE_DIR}"`, { stdio: "pipe" })
55
- unlinkSync(tmp)
56
- } else if (entry.name.endsWith(".zip")) {
57
- const isWin = os.platform() === "win32"
58
- if (isWin) {
59
- execSync(`powershell -Command "Expand-Archive -Path '${tmp}' -DestinationPath '${CACHE_DIR}' -Force"`, { stdio: "pipe" })
60
- } else {
61
- execSync(`unzip -o "${tmp}" -d "${CACHE_DIR}"`, { stdio: "pipe" })
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
- unlinkSync(tmp)
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcana-ai",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Self-improving AI agent CLI — opencode TUI + skills. Installs the arcana binary.",
5
5
  "bin": {
6
6
  "arcana": "./bin/arcana.js"