arcana-ai 0.2.3 → 0.2.4
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/arcana.js +18 -16
- package/package.json +28 -28
package/bin/arcana.js
CHANGED
|
@@ -10,7 +10,7 @@ const crypto = require("crypto")
|
|
|
10
10
|
const os = require("os")
|
|
11
11
|
|
|
12
12
|
const REPO = "Lento47/arcana"
|
|
13
|
-
const VERSION = "v0.2.
|
|
13
|
+
const VERSION = "v0.2.4"
|
|
14
14
|
|
|
15
15
|
const PLATFORM_MAP = {
|
|
16
16
|
"win32-x64": { asset: "arcana-windows-x64.zip", binary: "arcana.exe" },
|
|
@@ -32,16 +32,14 @@ if (!entry) {
|
|
|
32
32
|
|
|
33
33
|
const CACHE_DIR = process.env.ARCANA_CACHE || path.join(os.homedir(), ".arcana", "bin")
|
|
34
34
|
const CACHED_BINARY = path.join(CACHE_DIR, entry.binary)
|
|
35
|
+
const VERSION_FILE = path.join(CACHE_DIR, ".version")
|
|
35
36
|
|
|
36
37
|
async function downloadAndExtract() {
|
|
37
|
-
const ext = entry.asset.endsWith(".tar.gz") ? ".tar.gz" : ".zip"
|
|
38
|
-
const zipName = `arcana-${platform}${ext}`
|
|
39
|
-
|
|
40
38
|
// Clean up any stale temp file from previous failed attempts
|
|
41
|
-
try { unlinkSync(path.join(CACHE_DIR,
|
|
39
|
+
try { unlinkSync(path.join(CACHE_DIR, entry.asset)) } catch {}
|
|
42
40
|
|
|
43
41
|
const url = `https://github.com/${REPO}/releases/download/${VERSION}/${entry.asset}`
|
|
44
|
-
console.error(`arcana: downloading ${
|
|
42
|
+
console.error(`arcana: ${VERSION} — downloading ${entry.asset}...`)
|
|
45
43
|
|
|
46
44
|
mkdirSync(CACHE_DIR, { recursive: true })
|
|
47
45
|
|
|
@@ -51,12 +49,12 @@ async function downloadAndExtract() {
|
|
|
51
49
|
process.exit(1)
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
const tmp = path.join(CACHE_DIR,
|
|
52
|
+
const tmp = path.join(CACHE_DIR, entry.asset)
|
|
55
53
|
const buf = Buffer.from(await res.arrayBuffer())
|
|
56
54
|
writeFileSync(tmp, buf)
|
|
57
|
-
console.error(`arcana: ${(buf.length / 1e6).toFixed(1)}MB, verifying
|
|
55
|
+
console.error(`arcana: ${(buf.length / 1e6).toFixed(1)}MB, verifying...`)
|
|
58
56
|
|
|
59
|
-
// Verify binary integrity — checksum is mandatory
|
|
57
|
+
// Verify binary integrity — checksum is mandatory
|
|
60
58
|
const shaUrl = url + ".sha256"
|
|
61
59
|
const shaRes = await fetch(shaUrl)
|
|
62
60
|
if (!shaRes.ok) {
|
|
@@ -69,24 +67,22 @@ async function downloadAndExtract() {
|
|
|
69
67
|
const expectedHash = shaText.split(/\s+/)[0]
|
|
70
68
|
const actualHash = crypto.createHash("sha256").update(buf).digest("hex")
|
|
71
69
|
if (expectedHash !== actualHash) {
|
|
72
|
-
console.error(`arcana: CHECKSUM MISMATCH
|
|
70
|
+
console.error(`arcana: CHECKSUM MISMATCH`)
|
|
73
71
|
console.error(` expected: ${expectedHash}`)
|
|
74
72
|
console.error(` actual: ${actualHash}`)
|
|
75
73
|
console.error(`arcana: binary may be corrupted or tampered — deleting`)
|
|
76
74
|
try { unlinkSync(tmp) } catch {}
|
|
77
75
|
process.exit(1)
|
|
78
76
|
}
|
|
79
|
-
console.error(`arcana: checksum OK
|
|
77
|
+
console.error(`arcana: checksum OK`)
|
|
80
78
|
|
|
81
79
|
console.error(`arcana: extracting...`)
|
|
82
|
-
|
|
83
80
|
try {
|
|
84
81
|
if (entry.asset.endsWith(".tar.gz")) {
|
|
85
82
|
execSync(`tar xzf "${tmp}" -C "${CACHE_DIR}"`, { stdio: "pipe" })
|
|
86
83
|
unlinkSync(tmp)
|
|
87
84
|
} else if (entry.asset.endsWith(".zip")) {
|
|
88
85
|
if (os.platform() === "win32") {
|
|
89
|
-
// .NET ZipFile — built into .NET, no PowerShell module needed
|
|
90
86
|
const safeTmp = tmp.replace(/'/g, "''")
|
|
91
87
|
const safeDir = CACHE_DIR.replace(/'/g, "''")
|
|
92
88
|
execSync(
|
|
@@ -107,16 +103,22 @@ async function downloadAndExtract() {
|
|
|
107
103
|
try { chmodSync(CACHED_BINARY, 0o755) } catch {}
|
|
108
104
|
}
|
|
109
105
|
|
|
110
|
-
|
|
106
|
+
// Write version file so we can detect staleness on next run
|
|
107
|
+
try { writeFileSync(VERSION_FILE, VERSION, "utf8") } catch {}
|
|
108
|
+
console.error(`arcana: ready`)
|
|
111
109
|
}
|
|
112
110
|
|
|
113
111
|
async function main() {
|
|
114
|
-
if (
|
|
112
|
+
// Check if cached binary is stale (wrong version)
|
|
113
|
+
let cachedVersion = ""
|
|
114
|
+
try { cachedVersion = require("fs").readFileSync(VERSION_FILE, "utf8").trim() } catch {}
|
|
115
|
+
|
|
116
|
+
if (!existsSync(CACHED_BINARY) || cachedVersion !== VERSION) {
|
|
115
117
|
await downloadAndExtract()
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
if (!existsSync(CACHED_BINARY)) {
|
|
119
|
-
console.error(`arcana: binary not found
|
|
121
|
+
console.error(`arcana: binary not found after download`)
|
|
120
122
|
process.exit(1)
|
|
121
123
|
}
|
|
122
124
|
|
package/package.json
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "arcana-ai",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Self-improving AI agent CLI — opencode TUI + skills. Installs the arcana binary.",
|
|
5
|
-
"bin": {
|
|
6
|
-
"arcana": "./bin/arcana.js"
|
|
7
|
-
},
|
|
8
|
-
"files": [
|
|
9
|
-
"bin/arcana.js",
|
|
10
|
-
"README.md"
|
|
11
|
-
],
|
|
12
|
-
"repository": "github:Lento47/arcana",
|
|
13
|
-
"homepage": "https://github.com/Lento47/arcana",
|
|
14
|
-
"keywords": [
|
|
15
|
-
"ai",
|
|
16
|
-
"agent",
|
|
17
|
-
"cli",
|
|
18
|
-
"tui",
|
|
19
|
-
"opencode",
|
|
20
|
-
"arcana",
|
|
21
|
-
"llm",
|
|
22
|
-
"coding-assistant"
|
|
23
|
-
],
|
|
24
|
-
"license": "MIT",
|
|
25
|
-
"engines": {
|
|
26
|
-
"node": ">=18"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "arcana-ai",
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "Self-improving AI agent CLI — opencode TUI + skills. Installs the arcana binary.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"arcana": "./bin/arcana.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/arcana.js",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"repository": "github:Lento47/arcana",
|
|
13
|
+
"homepage": "https://github.com/Lento47/arcana",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai",
|
|
16
|
+
"agent",
|
|
17
|
+
"cli",
|
|
18
|
+
"tui",
|
|
19
|
+
"opencode",
|
|
20
|
+
"arcana",
|
|
21
|
+
"llm",
|
|
22
|
+
"coding-assistant"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=18"
|
|
27
|
+
}
|
|
28
|
+
}
|