memtrace 0.6.11 → 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.
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,
@@ -241,6 +241,16 @@ const DEFAULT_TRIGGERS = {
241
241
  "Triggered by 'most important', 'central to', 'critical functions', 'chokepoints', 'bridges', 'communities', 'modules', 'subsystems', 'hubs', 'depends on most', 'most depended on', 'architecture overview'.",
242
242
  paths: CODE_PATHS,
243
243
  },
244
+ "memtrace-preflight": {
245
+ whenToUse:
246
+ "Triggered by 'before editing', 'about to change', 'what depends on', 'blast radius', 'safe to modify', 'what breaks if', 'impact of changing', 'co-change', 'what else needs updating'.",
247
+ paths: CODE_PATHS,
248
+ },
249
+ "memtrace-daily": {
250
+ whenToUse:
251
+ "Triggered by 'what changed', 'recent changes', 'daily briefing', 'catch me up', 'since yesterday', 'session review', 'self-audit', 'did I make it worse', 'hotspots', 'refactor priorities', 'what should I clean up first'.",
252
+ paths: CODE_PATHS,
253
+ },
244
254
  "memtrace-quality": {
245
255
  whenToUse:
246
256
  "Triggered by 'dead code', 'unused functions', 'zero callers', 'complex functions', 'hotspots', 'cyclomatic complexity', 'cognitive complexity', 'code smells', 'refactoring candidates', 'tech debt'.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memtrace",
3
- "version": "0.6.11",
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,11 +39,12 @@
39
39
  "fs-extra": "^11.0.0"
40
40
  },
41
41
  "optionalDependencies": {
42
- "@memtrace/darwin-arm64": "0.6.11",
43
- "@memtrace/linux-x64": "0.6.11",
44
- "@memtrace/win32-x64": "0.6.11",
45
- "@memtrace/linux-x64-noavx2": "0.6.11",
46
- "@memtrace/win32-x64-noavx2": "0.6.11"
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"
47
48
  },
48
49
  "engines": {
49
50
  "node": ">=18"