@aicraftalchemy/aca 0.0.4 → 0.0.6

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 (3) hide show
  1. package/README.md +1 -1
  2. package/install.cjs +29 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,4 +22,4 @@ Homepage: https://aca.aicraftalchemy.com
22
22
 
23
23
  ---
24
24
 
25
- Inspired by Claude Code · Built by Aicraftalchemy.
25
+ Built by Aicraftalchemy.
package/install.cjs CHANGED
@@ -32,6 +32,33 @@ function platformKey() {
32
32
  throw new Error(`Unsupported platform: ${p}/${a}`)
33
33
  }
34
34
 
35
+ /**
36
+ * Write a file, moving any existing (possibly running) file aside first.
37
+ * Windows locks a running executable against deletion/overwrite but allows
38
+ * renaming it, so parking the old file as `<name>.old` lets an in-session
39
+ * auto-update (`npm install -g` triggered while ACA is running) succeed.
40
+ * Stale `.old` files are cleaned up on the next install.
41
+ */
42
+ function writeReplacing(dest, buf) {
43
+ const old = `${dest}.old`
44
+ try {
45
+ fs.rmSync(old, { force: true })
46
+ } catch {
47
+ // still locked by a previous session — harmless, retried next install
48
+ }
49
+ try {
50
+ if (fs.existsSync(dest)) fs.renameSync(dest, old)
51
+ } catch {
52
+ // rename failed (rare); fall through and let writeFileSync report it
53
+ }
54
+ fs.writeFileSync(dest, buf)
55
+ try {
56
+ fs.rmSync(old, { force: true })
57
+ } catch {
58
+ // the parked file is the currently running binary — cleaned up next time
59
+ }
60
+ }
61
+
35
62
  /** GET a URL following redirects; resolves to a Buffer. */
36
63
  function get(url, redirects = 0) {
37
64
  return new Promise((resolve, reject) => {
@@ -70,7 +97,7 @@ async function main() {
70
97
  const binDir = path.join(__dirname, 'bin')
71
98
  fs.mkdirSync(binDir, { recursive: true })
72
99
  const dest = path.join(binDir, process.platform === 'win32' ? 'aca.exe' : 'aca')
73
- fs.writeFileSync(dest, bin)
100
+ writeReplacing(dest, bin)
74
101
  if (process.platform !== 'win32') fs.chmodSync(dest, 0o755)
75
102
 
76
103
  // Also fetch the sibling ripgrep binary. `bun build --compile` does not embed
@@ -85,7 +112,7 @@ async function main() {
85
112
  throw new Error(`expected ${info.rg.sha256}, got ${rgSha}`)
86
113
  }
87
114
  const rgDest = path.join(binDir, process.platform === 'win32' ? 'rg.exe' : 'rg')
88
- fs.writeFileSync(rgDest, rgBuf)
115
+ writeReplacing(rgDest, rgBuf)
89
116
  if (process.platform !== 'win32') fs.chmodSync(rgDest, 0o755)
90
117
  } catch (e) {
91
118
  console.warn(`ACA: bundled ripgrep unavailable (${e.message}); search features may be limited.`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aicraftalchemy/aca",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
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": {