@aicraftalchemy/aca 0.0.9 → 0.0.11

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/cli-wrapper.cjs +32 -5
  2. package/package.json +1 -1
package/cli-wrapper.cjs CHANGED
@@ -53,14 +53,41 @@ function applyStagedUpdate() {
53
53
  }
54
54
  }
55
55
 
56
+ /**
57
+ * Self-heal a missing binary. The compiled binary is downloaded by the
58
+ * postinstall script (install.cjs), but some npm setups block install scripts
59
+ * (allowScripts policy, `--ignore-scripts`, or an aborted download), leaving the
60
+ * launcher with no binary to run. Rather than dead-ending the user, we run the
61
+ * SAME installer on demand — first launch only, since afterwards the binary
62
+ * exists. install.cjs's stdout is routed to stderr so it never pollutes the
63
+ * CLI's own output (e.g. `aca --version` in a script).
64
+ */
65
+ function selfHealBinary() {
66
+ const installer = path.join(__dirname, 'install.cjs')
67
+ if (!fs.existsSync(installer)) {
68
+ console.error(
69
+ 'ACA binary not found and the installer is missing.\n' +
70
+ 'Reinstall with: npm install -g @aicraftalchemy/aca',
71
+ )
72
+ process.exit(1)
73
+ }
74
+ console.error('ACA: binary not found (install scripts may be disabled) — downloading it now, one moment…')
75
+ const r = spawnSync(process.execPath, [installer], { stdio: ['ignore', 2, 2] })
76
+ if (r.error || r.status !== 0 || !fs.existsSync(bin)) {
77
+ console.error(
78
+ 'ACA: automatic download failed.' +
79
+ (r.error ? ` (${r.error.message})` : '') +
80
+ '\nRetry with: npm install -g @aicraftalchemy/aca' +
81
+ '\nor allow its scripts: npm approve-scripts @aicraftalchemy/aca',
82
+ )
83
+ process.exit(1)
84
+ }
85
+ }
86
+
56
87
  applyStagedUpdate()
57
88
 
58
89
  if (!fs.existsSync(bin)) {
59
- console.error(
60
- 'ACA binary not found. The post-install download may have failed.\n' +
61
- 'Reinstall with: npm install -g @aicraftalchemy/aca',
62
- )
63
- process.exit(1)
90
+ selfHealBinary()
64
91
  }
65
92
 
66
93
  const result = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicraftalchemy/aca",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "ACA — agentic coding CLI. Any model, any provider (Claude, Gemini, OpenAI, NVIDIA, Groq, Cerebras, OpenRouter, Hugging Face). Developed by Aicraftalchemy.",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {