memtrace-skills 1.1.7 → 1.1.9
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.
|
@@ -9,8 +9,19 @@ export interface DoctorReport {
|
|
|
9
9
|
binaryOk: boolean;
|
|
10
10
|
binaryPath?: string;
|
|
11
11
|
binaryVersion?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Windows only: whether the Microsoft Visual C++ 2015-2022 runtime the
|
|
14
|
+
* embedding runtime (onnxruntime.dll) links against is installed.
|
|
15
|
+
* `undefined` on other platforms. MEMBIZ-64: on a fresh Windows machine
|
|
16
|
+
* `LoadLibraryExW failed` with the DLL present means this runtime is
|
|
17
|
+
* missing, and nothing else in the install flow said so.
|
|
18
|
+
*/
|
|
19
|
+
vcRuntimeOk?: boolean;
|
|
20
|
+
vcRuntimeDir?: string;
|
|
12
21
|
agents: AgentReport[];
|
|
13
22
|
}
|
|
23
|
+
export declare const VC_REDIST_URL = "https://aka.ms/vs/17/release/vc_redist.x64.exe";
|
|
24
|
+
export declare function checkWindowsRuntime(platform?: NodeJS.Platform, systemRoot?: string | undefined): Pick<DoctorReport, 'vcRuntimeOk' | 'vcRuntimeDir'>;
|
|
14
25
|
export declare function runDoctorChecks(): Promise<DoctorReport>;
|
|
15
26
|
export declare function formatReport(r: DoctorReport): string;
|
|
16
27
|
export declare function runDoctor(): Promise<number>;
|
package/dist/commands/doctor.js
CHANGED
|
@@ -4,6 +4,16 @@ import path from 'path';
|
|
|
4
4
|
import { commandExists, execCommand } from '../utils.js';
|
|
5
5
|
import { safeReadJson } from '../fs-safe.js';
|
|
6
6
|
import { ALL_TRANSFORMERS } from '../transformers/index.js';
|
|
7
|
+
export const VC_REDIST_URL = 'https://aka.ms/vs/17/release/vc_redist.x64.exe';
|
|
8
|
+
/** The DLLs onnxruntime.dll needs from the VC++ 2015-2022 x64 runtime. */
|
|
9
|
+
const VC_RUNTIME_DLLS = ['vcruntime140.dll', 'vcruntime140_1.dll', 'msvcp140.dll'];
|
|
10
|
+
export function checkWindowsRuntime(platform = process.platform, systemRoot = process.env.SystemRoot) {
|
|
11
|
+
if (platform !== 'win32')
|
|
12
|
+
return {};
|
|
13
|
+
const vcRuntimeDir = path.join(systemRoot ?? 'C:\\Windows', 'System32');
|
|
14
|
+
const vcRuntimeOk = VC_RUNTIME_DLLS.every(dll => fs.existsSync(path.join(vcRuntimeDir, dll)));
|
|
15
|
+
return { vcRuntimeOk, vcRuntimeDir };
|
|
16
|
+
}
|
|
7
17
|
async function checkBinary() {
|
|
8
18
|
if (!(await commandExists('memtrace')))
|
|
9
19
|
return { binaryOk: false };
|
|
@@ -95,12 +105,19 @@ function vscodeUserMcpPath() {
|
|
|
95
105
|
function checkAgent(agent) {
|
|
96
106
|
if (agent === 'claude') {
|
|
97
107
|
const skillsDir = path.join(os.homedir(), '.claude', 'skills');
|
|
98
|
-
|
|
108
|
+
// MEMBIZ-66: Claude Code reads user-scope MCP servers from ~/.claude.json.
|
|
109
|
+
// An entry that exists only in ~/.claude/settings.json is ignored by the
|
|
110
|
+
// CLI, so reporting it as registered was a false positive — check the
|
|
111
|
+
// file the CLI reads first and only fall back to settings.json.
|
|
112
|
+
const userConfigPath = path.join(os.homedir(), '.claude.json');
|
|
113
|
+
const settingsPath = path.join(os.homedir(), '.claude', 'settings.json');
|
|
114
|
+
const inUserConfig = mcpHasMemtrace(userConfigPath);
|
|
115
|
+
const mcpConfigPath = inUserConfig ? userConfigPath : settingsPath;
|
|
99
116
|
return {
|
|
100
117
|
agent,
|
|
101
118
|
skillsFound: countMemtraceSkills(skillsDir),
|
|
102
119
|
skillsDir,
|
|
103
|
-
mcpRegistered:
|
|
120
|
+
mcpRegistered: inUserConfig,
|
|
104
121
|
mcpConfigPath,
|
|
105
122
|
};
|
|
106
123
|
}
|
|
@@ -206,6 +223,7 @@ export async function runDoctorChecks() {
|
|
|
206
223
|
const binary = await checkBinary();
|
|
207
224
|
return {
|
|
208
225
|
...binary,
|
|
226
|
+
...checkWindowsRuntime(),
|
|
209
227
|
agents: ALL_TRANSFORMERS.map(t => checkAgent(t.name)),
|
|
210
228
|
};
|
|
211
229
|
}
|
|
@@ -217,6 +235,13 @@ export function formatReport(r) {
|
|
|
217
235
|
lines.push(`${check(r.binaryOk)} memtrace binary${r.binaryPath ? ' ' + r.binaryPath : ''}`);
|
|
218
236
|
if (r.binaryVersion)
|
|
219
237
|
lines.push(` version: ${r.binaryVersion}`);
|
|
238
|
+
if (r.vcRuntimeOk !== undefined) {
|
|
239
|
+
lines.push(`${check(r.vcRuntimeOk)} Visual C++ 2015-2022 runtime ${r.vcRuntimeDir ?? ''}`);
|
|
240
|
+
if (!r.vcRuntimeOk) {
|
|
241
|
+
lines.push(` memtrace's embedding runtime (onnxruntime.dll) cannot load without it.`);
|
|
242
|
+
lines.push(` install: ${VC_REDIST_URL}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
220
245
|
for (const a of r.agents) {
|
|
221
246
|
lines.push(`${check(a.skillsFound > 0)} ${a.agent} skills installed ${a.skillsFound} in ${a.skillsDir}`);
|
|
222
247
|
const integrationLabel = a.agent === 'pi' ? 'Pi package registered' : 'MCP registered';
|
|
@@ -228,6 +253,7 @@ export async function runDoctor() {
|
|
|
228
253
|
const report = await runDoctorChecks();
|
|
229
254
|
console.log(formatReport(report));
|
|
230
255
|
const healthy = report.binaryOk
|
|
256
|
+
&& report.vcRuntimeOk !== false
|
|
231
257
|
&& report.agents.every(a => a.skillsFound > 0 && a.mcpRegistered);
|
|
232
258
|
return healthy ? 0 : 1;
|
|
233
259
|
}
|
|
@@ -75,6 +75,8 @@ export interface SettingsCleanupResult {
|
|
|
75
75
|
* installer versions and Claude marketplace schema changes.
|
|
76
76
|
*/
|
|
77
77
|
export declare function removeClaudeSettingsEntriesAt(settingsPath: string): SettingsCleanupResult;
|
|
78
|
+
/** `~/.claude.json` — where Claude Code stores user-scope `mcpServers`. */
|
|
79
|
+
export declare function claudeUserConfigFile(): string;
|
|
78
80
|
/**
|
|
79
81
|
* Full Claude Code plugin installation.
|
|
80
82
|
*
|
|
@@ -199,10 +199,15 @@ export function registerMcpInSettingsAt(settingsPath, memtraceBinary) {
|
|
|
199
199
|
? existing.env
|
|
200
200
|
: {};
|
|
201
201
|
const mergedEnv = { ...existingEnv, ...MEMTRACE_MCP_ENV };
|
|
202
|
+
// Hosts defer MCP tool definitions behind ToolSearch by default, so an
|
|
203
|
+
// unmarked server reaches the model as bare tool names while built-in
|
|
204
|
+
// Grep/Glob/Read arrive with full schemas — a routing bias no instruction
|
|
205
|
+
// text can overcome. alwaysLoad opts the memtrace tools back into turn one.
|
|
202
206
|
settings.mcpServers['memtrace'] = {
|
|
203
207
|
command: memtraceBinary,
|
|
204
208
|
args: ['mcp'],
|
|
205
209
|
env: mergedEnv,
|
|
210
|
+
alwaysLoad: true,
|
|
206
211
|
};
|
|
207
212
|
writeJsonAtomic(settingsPath, settings);
|
|
208
213
|
return { registered: true };
|
|
@@ -499,9 +504,22 @@ async function registerMcpServer(memtraceBinaryPath) {
|
|
|
499
504
|
const viaCli = await tryMcpAddJson(memtraceBinaryPath);
|
|
500
505
|
if (viaCli)
|
|
501
506
|
return;
|
|
502
|
-
// Strategy 2 (fallback): direct
|
|
507
|
+
// Strategy 2 (fallback): direct JSON merge (safe + atomic).
|
|
508
|
+
//
|
|
509
|
+
// MEMBIZ-66: Claude Code reads user-scope MCP servers from `~/.claude.json`,
|
|
510
|
+
// not from `~/.claude/settings.json`. When the `claude` CLI was missing or
|
|
511
|
+
// slow (a 5 s timeout on Windows is easy to hit), this fallback wrote only
|
|
512
|
+
// settings.json — skills loaded, every `mcp__memtrace__*` tool was absent,
|
|
513
|
+
// and `memtrace doctor` still reported the registration as healthy. Write
|
|
514
|
+
// the file the CLI actually reads, and keep settings.json for older
|
|
515
|
+
// tooling that still looks there.
|
|
516
|
+
registerMcpInSettingsAt(claudeUserConfigFile(), memtraceBinaryPath);
|
|
503
517
|
registerMcpInSettingsAt(settingsFile, memtraceBinaryPath);
|
|
504
518
|
}
|
|
519
|
+
/** `~/.claude.json` — where Claude Code stores user-scope `mcpServers`. */
|
|
520
|
+
export function claudeUserConfigFile() {
|
|
521
|
+
return path.join(os.homedir(), '.claude.json');
|
|
522
|
+
}
|
|
505
523
|
/**
|
|
506
524
|
* Full Claude Code plugin installation.
|
|
507
525
|
*
|
|
@@ -89,6 +89,14 @@ export function registerVsCodeMcpAt(filePath, binary) {
|
|
|
89
89
|
type: 'stdio',
|
|
90
90
|
command: binary,
|
|
91
91
|
args: ['mcp'],
|
|
92
|
+
// MEMBIZ-50 D2: `cwd` is the ONE anchor that drives both store
|
|
93
|
+
// resolution and repository discovery in `memtrace mcp`. Without it a
|
|
94
|
+
// user-scope entry spawns the server in the editor's own working
|
|
95
|
+
// directory (often the user profile), where it resolves a stale
|
|
96
|
+
// user-level `.memdb` instead of the project's — every project then
|
|
97
|
+
// shares one wrong, empty store. VS Code substitutes the variable per
|
|
98
|
+
// window, so one global entry serves every project correctly.
|
|
99
|
+
cwd: '${workspaceFolder}',
|
|
92
100
|
env: MEMTRACE_MCP_ENV,
|
|
93
101
|
};
|
|
94
102
|
writeJsonAtomic(filePath, cfg);
|