troxy-cli 1.4.10 → 1.4.12

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/troxy.js +19 -1
  2. package/package.json +1 -1
package/bin/troxy.js CHANGED
@@ -51,6 +51,14 @@ function _handleError(err) {
51
51
 
52
52
  async function _run() {
53
53
  switch (command) {
54
+ case '--version':
55
+ case '-v': {
56
+ const { createRequire } = await import('module');
57
+ const { version } = createRequire(import.meta.url)('../package.json');
58
+ console.log(version);
59
+ break;
60
+ }
61
+
54
62
  // ── Setup ─────────────────────────────────────────────────────
55
63
  case 'init':
56
64
  await runInit(flags);
@@ -342,7 +350,17 @@ switch (command) {
342
350
  console.log(`${current} → ${latest}`);
343
351
  process.stdout.write(' Installing... ');
344
352
  try {
345
- execSync('npm install -g troxy-cli@latest', { stdio: 'pipe' });
353
+ try {
354
+ execSync('npm install -g troxy-cli@latest', { stdio: 'pipe' });
355
+ } catch (err) {
356
+ const stderr = err.stderr?.toString() || '';
357
+ if (stderr.includes('ENOTEMPTY')) {
358
+ // npm bug on macOS: global package dir not empty during rename — uninstall first
359
+ execSync('npm uninstall -g troxy-cli && npm install -g troxy-cli@latest', { stdio: 'pipe', shell: true });
360
+ } else {
361
+ throw err;
362
+ }
363
+ }
346
364
  console.log(`✓\n\n Updated to ${latest}. Restart your terminal to use the new version.\n`);
347
365
  } catch (err) {
348
366
  const stderr = err.stderr?.toString() || err.message || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "troxy-cli",
3
- "version": "1.4.10",
3
+ "version": "1.4.12",
4
4
  "description": "AI payment control — protect your agent's payments with policies",
5
5
  "type": "module",
6
6
  "bin": {