memtrace 0.6.17 → 0.6.18

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/install.js +28 -5
  2. package/package.json +7 -7
package/install.js CHANGED
@@ -113,6 +113,26 @@ function platformPackageName(key) {
113
113
  return PLATFORM_MAP[key];
114
114
  }
115
115
 
116
+ // npm only restores the executable bit for files declared in the platform
117
+ // package's `bin` map (`memtrace`). `memcore-server` is shipped alongside it
118
+ // WITHOUT a bin entry, so if the published tarball carries mode 644 (the
119
+ // v0.6.16/v0.6.17 releases did — GitHub's artifact transfer strips modes),
120
+ // `memtrace start` fails to spawn the sidecar with EACCES. Re-assert the bit
121
+ // on every resolution so broken installs self-repair on the next run.
122
+ function ensureExecutableBits(binaryPath) {
123
+ if (os.platform() === "win32") return;
124
+ const dir = path.dirname(binaryPath);
125
+ for (const name of ["memtrace", "memcore-server"]) {
126
+ const candidate = path.join(dir, name);
127
+ try {
128
+ if (fs.existsSync(candidate)) fs.chmodSync(candidate, 0o755);
129
+ } catch (_) {
130
+ // Best-effort: a read-only install prefix will surface a clearer
131
+ // error at spawn time.
132
+ }
133
+ }
134
+ }
135
+
116
136
  function getBinaryPath() {
117
137
  const key = getPlatformKey();
118
138
  const pkg = platformPackageName(key);
@@ -125,12 +145,16 @@ function getBinaryPath() {
125
145
  const ext = os.platform() === "win32" ? ".exe" : "";
126
146
  const binaryName = `memtrace${ext}`;
127
147
  try {
128
- return require.resolve(`${pkg}/bin/${binaryName}`);
148
+ const resolved = require.resolve(`${pkg}/bin/${binaryName}`);
149
+ ensureExecutableBits(resolved);
150
+ return resolved;
129
151
  } catch {
130
152
  selfHealPlatformPackage();
131
153
  }
132
154
  try {
133
- return require.resolve(`${pkg}/bin/${binaryName}`);
155
+ const resolved = require.resolve(`${pkg}/bin/${binaryName}`);
156
+ ensureExecutableBits(resolved);
157
+ return resolved;
134
158
  } catch {
135
159
  throw new Error(
136
160
  `Could not find memtrace binary for ${key} (package ${pkg}).\n` +
@@ -225,9 +249,7 @@ if (require.main === module) {
225
249
  if (!fs.existsSync(binaryPath)) {
226
250
  throw new Error(`Binary not found at: ${binaryPath}`);
227
251
  }
228
- if (os.platform() !== "win32") {
229
- fs.chmodSync(binaryPath, 0o755);
230
- }
252
+ ensureExecutableBits(binaryPath);
231
253
  console.log(`memtrace: binary installed at ${binaryPath}`);
232
254
  } catch (e) {
233
255
  console.warn(`memtrace: ${e.message}`);
@@ -298,6 +320,7 @@ if (require.main === module) {
298
320
 
299
321
  module.exports = {
300
322
  getBinaryPath,
323
+ ensureExecutableBits,
301
324
  selfHealPlatformPackage,
302
325
  buildSelfHealEnv,
303
326
  buildSelfHealInstallArgs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memtrace",
3
- "version": "0.6.17",
3
+ "version": "0.6.18",
4
4
  "description": "Code intelligence graph — MCP server + AI agent skills + visualization UI",
5
5
  "keywords": [
6
6
  "mcp",
@@ -39,12 +39,12 @@
39
39
  "fs-extra": "^11.0.0"
40
40
  },
41
41
  "optionalDependencies": {
42
- "@memtrace/darwin-arm64": "0.6.17",
43
- "@memtrace/linux-x64": "0.6.17",
44
- "@memtrace/linux-arm64": "0.6.17",
45
- "@memtrace/win32-x64": "0.6.17",
46
- "@memtrace/linux-x64-noavx2": "0.6.17",
47
- "@memtrace/win32-x64-noavx2": "0.6.17"
42
+ "@memtrace/darwin-arm64": "0.6.18",
43
+ "@memtrace/linux-x64": "0.6.18",
44
+ "@memtrace/linux-arm64": "0.6.18",
45
+ "@memtrace/win32-x64": "0.6.18",
46
+ "@memtrace/linux-x64-noavx2": "0.6.18",
47
+ "@memtrace/win32-x64-noavx2": "0.6.18"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=18"