@yooz-labs/remi 0.4.9-dev.1 → 0.4.10-dev.1
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/bin/remi +41 -9
- package/package.json +5 -5
package/bin/remi
CHANGED
|
@@ -23,19 +23,35 @@ if (!pkg) {
|
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Detect which package manager owns the current installation by checking
|
|
28
|
+
* if the resolved platform package lives under bun's or npm's global prefix.
|
|
29
|
+
*/
|
|
30
|
+
function detectPackageManager(resolvedPkgDir) {
|
|
31
|
+
const bunGlobal = path.join(os.homedir(), ".bun");
|
|
32
|
+
if (resolvedPkgDir.startsWith(bunGlobal)) return "bun";
|
|
33
|
+
return "npm";
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
/**
|
|
27
37
|
* Auto-upgrade the platform binary when the wrapper version doesn't match.
|
|
28
38
|
* This handles package managers (e.g. bun --force) that upgrade the main
|
|
29
39
|
* package but skip optionalDependencies.
|
|
40
|
+
*
|
|
41
|
+
* Tries the detected installer first, then falls back to the other manager,
|
|
42
|
+
* since npm and bun use different global directories.
|
|
30
43
|
*/
|
|
31
|
-
function autoUpgradePlatformBinary(wrapperVersion) {
|
|
44
|
+
function autoUpgradePlatformBinary(wrapperVersion, installedVia) {
|
|
32
45
|
console.error(`[remi] Binary outdated, upgrading ${pkg} to ${wrapperVersion}...`);
|
|
33
46
|
|
|
34
|
-
// Try
|
|
35
|
-
const
|
|
36
|
-
{ cmd: "npm", args: ["install", "-g", `${pkg}@${wrapperVersion}`] },
|
|
47
|
+
// Try the detected installer first so the upgrade lands in the same directory
|
|
48
|
+
const allManagers = [
|
|
37
49
|
{ cmd: "bun", args: ["install", "-g", `${pkg}@${wrapperVersion}`] },
|
|
50
|
+
{ cmd: "npm", args: ["install", "-g", `${pkg}@${wrapperVersion}`] },
|
|
38
51
|
];
|
|
52
|
+
const managers = installedVia === "npm"
|
|
53
|
+
? allManagers.reverse()
|
|
54
|
+
: allManagers;
|
|
39
55
|
|
|
40
56
|
for (const { cmd, args } of managers) {
|
|
41
57
|
try {
|
|
@@ -86,12 +102,28 @@ try {
|
|
|
86
102
|
const wrapperPkg = require(path.resolve(__dirname, "..", "package.json"));
|
|
87
103
|
const platPkg = require(path.join(platPkgDir, "package.json"));
|
|
88
104
|
if (wrapperPkg.version && platPkg.version && wrapperPkg.version !== platPkg.version) {
|
|
89
|
-
|
|
90
|
-
|
|
105
|
+
const installedVia = detectPackageManager(platPkgDir);
|
|
106
|
+
if (autoUpgradePlatformBinary(wrapperPkg.version, installedVia)) {
|
|
107
|
+
// Re-resolve after upgrade to use the new binary.
|
|
108
|
+
// Clear require cache so we get the freshly installed package.
|
|
109
|
+
try {
|
|
110
|
+
const cacheKey = require.resolve(`${pkg}/package.json`);
|
|
111
|
+
delete require.cache[cacheKey];
|
|
112
|
+
} catch (cacheErr) {
|
|
113
|
+
console.error(`[remi] Cache clear failed: ${cacheErr.message}`);
|
|
114
|
+
}
|
|
91
115
|
try {
|
|
92
|
-
delete require.cache[require.resolve(`${pkg}/package.json`)];
|
|
93
116
|
platPkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
94
117
|
binPath = path.join(platPkgDir, "bin", "remi");
|
|
118
|
+
// Verify the upgrade actually took effect at this path
|
|
119
|
+
const newPlatPkg = JSON.parse(fs.readFileSync(path.join(platPkgDir, "package.json"), "utf8"));
|
|
120
|
+
if (newPlatPkg.version !== wrapperPkg.version) {
|
|
121
|
+
console.error(
|
|
122
|
+
`[remi] Upgrade ran but binary is still ${newPlatPkg.version} (expected ${wrapperPkg.version})`
|
|
123
|
+
);
|
|
124
|
+
console.error(`[remi] Fix: bun install -g ${pkg}@${wrapperPkg.version}`);
|
|
125
|
+
console.error(`[remi] Continuing with outdated binary...`);
|
|
126
|
+
}
|
|
95
127
|
} catch (resolveErr) {
|
|
96
128
|
console.error(
|
|
97
129
|
`[remi] Upgrade succeeded but failed to resolve new binary: ${resolveErr.message}`
|
|
@@ -103,11 +135,11 @@ try {
|
|
|
103
135
|
`[remi] Version mismatch: wrapper is ${wrapperPkg.version} but binary is ${platPkg.version}.`
|
|
104
136
|
);
|
|
105
137
|
console.error(`[remi] Auto-upgrade failed. Fix manually:`);
|
|
106
|
-
console.error(`[remi]
|
|
138
|
+
console.error(`[remi] bun install -g ${pkg}@${wrapperPkg.version}`);
|
|
107
139
|
}
|
|
108
140
|
}
|
|
109
141
|
} catch (err) {
|
|
110
|
-
console.error(`[remi] Version check
|
|
142
|
+
console.error(`[remi] Version check/upgrade failed: ${err.message}`);
|
|
111
143
|
}
|
|
112
144
|
|
|
113
145
|
const result = spawnSync(binPath, process.argv.slice(2), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yooz-labs/remi",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10-dev.1",
|
|
4
4
|
"description": "Remote monitor for Claude Code CLI sessions",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"remi": "bin/remi"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@yooz-labs/remi-darwin-arm64": "0.4.
|
|
24
|
-
"@yooz-labs/remi-darwin-x64": "0.4.
|
|
25
|
-
"@yooz-labs/remi-linux-arm64": "0.4.
|
|
26
|
-
"@yooz-labs/remi-linux-x64": "0.4.
|
|
23
|
+
"@yooz-labs/remi-darwin-arm64": "0.4.10-dev.1",
|
|
24
|
+
"@yooz-labs/remi-darwin-x64": "0.4.10-dev.1",
|
|
25
|
+
"@yooz-labs/remi-linux-arm64": "0.4.10-dev.1",
|
|
26
|
+
"@yooz-labs/remi-linux-x64": "0.4.10-dev.1"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=16"
|