@tjcoder/cli 0.9.164 → 0.9.166

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 CHANGED
@@ -92,7 +92,7 @@ coder --timeout 30m
92
92
 
93
93
  ```bash
94
94
  # install a specific coder version regardless of the @tjcoder/cli wrapper version
95
- CODER_CLI_VERSION=v0.9.164 npm install -g @tjcoder/cli
95
+ CODER_CLI_VERSION=v0.9.166 npm install -g @tjcoder/cli
96
96
  ```
97
97
 
98
98
  ## Troubleshooting
@@ -16,7 +16,7 @@ const { URL } = require("node:url");
16
16
  const pkg = require("../package.json");
17
17
  const REPO = process.env.CODER_CLI_REPO || "tjcoder-labs/cli";
18
18
  // Allow pinning a version (matches the @tjcoder/cli package version by
19
- // default so that `npm i @tjcoder/cli@0.9.164` installs coder v0.9.164).
19
+ // default so that `npm i @tjcoder/cli@0.9.166` installs coder v0.9.166).
20
20
  const VERSION = process.env.CODER_CLI_VERSION || `v${pkg.version}`;
21
21
 
22
22
  // --- platform detection ----------------------------------------------------
@@ -136,14 +136,14 @@ async function checksum(filePath) {
136
136
  // Optional SHA256 verification against a sibling .sha256 file. We try, but
137
137
  // never fail the install if the file is missing — that keeps dev installs
138
138
  // working before the first signed release.
139
- const fs = require("node:fs/promises");
139
+ const fsp = require("node:fs/promises");
140
140
  const crypto = require("node:crypto");
141
141
  const shaPath = `${filePath}.sha256`;
142
142
  if (!fs.existsSync(shaPath)) return;
143
- const expected = (await fs.readFile(shaPath, "utf8")).trim().split(/\s+/)[0];
143
+ const expected = (await fsp.readFile(shaPath, "utf8")).trim().split(/\s+/)[0];
144
144
  const actual = crypto
145
145
  .createHash("sha256")
146
- .update(await fs.readFile(filePath))
146
+ .update(await fsp.readFile(filePath))
147
147
  .digest("hex");
148
148
  if (expected.toLowerCase() !== actual.toLowerCase()) {
149
149
  throw new Error(
@@ -152,7 +152,20 @@ async function checksum(filePath) {
152
152
  }
153
153
  }
154
154
 
155
- // --- main ------------------------------------------------------------------
155
+ // moveFile moves src to dest atomically where possible, and falls back to a
156
+ // copy+unlink when the two paths live on different filesystems (rename()
157
+ // returns EXDEV). This matters for system-wide installs where /tmp and the
158
+ // npm prefix (e.g. /usr/lib) are separate mounts.
159
+ function moveFile(src, dest) {
160
+ try {
161
+ fs.renameSync(src, dest);
162
+ return;
163
+ } catch (err) {
164
+ if (err.code !== "EXDEV") throw err;
165
+ fs.copyFileSync(src, dest);
166
+ fs.unlinkSync(src);
167
+ }
168
+ }
156
169
 
157
170
  async function main() {
158
171
  const info = detect();
@@ -178,7 +191,10 @@ async function main() {
178
191
  fs.chmodSync(extracted, 0o755);
179
192
  }
180
193
  await checksum(extracted);
181
- fs.renameSync(extracted, binPath);
194
+ moveFile(extracted, binPath);
195
+ if (info.os !== "windows") {
196
+ fs.chmodSync(binPath, 0o755);
197
+ }
182
198
  process.stdout.write(`coder: installed ${binPath}\n`);
183
199
  } catch (err) {
184
200
  process.stderr.write(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tjcoder/cli",
3
- "version": "0.9.164",
3
+ "version": "0.9.166",
4
4
  "description": "Terminal-first AI coding assistant by TJ Coder / AI Labs. A keyboard-driven TUI with a live cognition pane, 7 specialized agents, and 31 tools, running on local Ollama models by default.",
5
5
  "license": "MIT",
6
6
  "private": false,