@trans-ai/trans-code 0.1.1 → 0.1.2

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/package.json +1 -1
  2. package/src/upgrade.ts +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trans-ai/trans-code",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "AI-powered multi-model coding CLI",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
package/src/upgrade.ts CHANGED
@@ -5,6 +5,11 @@ import { fileURLToPath } from 'node:url';
5
5
  import { VERSION } from './version.js';
6
6
 
7
7
  const PKG = '@trans-ai/trans-code';
8
+ // Upgrades must talk to the official registry: mirrors (npmmirror & co)
9
+ // sync metadata and tarballs independently, so a just-released version
10
+ // can be visible to `view` but not installable, silently "upgrading"
11
+ // to the stale version.
12
+ const OFFICIAL = 'https://registry.npmjs.org';
8
13
 
9
14
  function sh(cmd: string, args: string[]): Promise<{ code: number; stdout: string }> {
10
15
  return new Promise(resolve => {
@@ -38,7 +43,7 @@ async function npmRoot(): Promise<string> {
38
43
  }
39
44
 
40
45
  async function latestVersion(): Promise<string | null> {
41
- const r = await sh('npm', ['view', `${PKG}@latest`, 'version']);
46
+ const r = await sh('npm', ['view', `${PKG}@latest`, 'version', `--registry=${OFFICIAL}`]);
42
47
  if (r.code !== 0) return null;
43
48
  const v = r.stdout.trim();
44
49
  return v || null;
@@ -94,7 +99,7 @@ export async function runUpgrade(): Promise<void> {
94
99
  }
95
100
 
96
101
  process.stdout.write(`Upgrading ${VERSION} → ${latest}…\n`);
97
- const code = await shInherit('npm', ['i', '-g', `${PKG}@latest`]);
102
+ const code = await shInherit('npm', ['i', '-g', `${PKG}@latest`, `--registry=${OFFICIAL}`]);
98
103
  if (code !== 0) {
99
104
  process.stderr.write('[transcode] upgrade failed — see npm output above.\n');
100
105
  process.exitCode = 1;