auditor-lambda 0.6.3 → 0.6.4
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/package.json +1 -1
- package/scripts/postinstall.mjs +45 -2
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -99,8 +99,8 @@ function renderGlobalMcpLauncher(installedPkgRoot) {
|
|
|
99
99
|
"import { join } from 'node:path';",
|
|
100
100
|
"import { homedir } from 'node:os';",
|
|
101
101
|
'',
|
|
102
|
-
|
|
103
|
-
"const artifactsDir = join(repoRoot, '.audit-artifacts');",
|
|
102
|
+
"const repoRoot = process.env.AUDIT_CODE_REPO_ROOT || process.cwd();",
|
|
103
|
+
"const artifactsDir = process.env.AUDIT_CODE_ARTIFACTS_DIR || join(repoRoot, '.audit-artifacts');",
|
|
104
104
|
`const globalPackageRoot = ${JSON.stringify(installedPkgRoot)};`,
|
|
105
105
|
"const logPath = join(homedir(), '.audit-code', 'mcp-server.log');",
|
|
106
106
|
'',
|
|
@@ -330,6 +330,33 @@ function mergeOpenCodeGlobalConfig(existing) {
|
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
function claudeDesktopConfigPath() {
|
|
334
|
+
if (process.platform === 'win32') {
|
|
335
|
+
return join(process.env.APPDATA || join(homedir(), 'AppData', 'Roaming'), 'Claude', 'claude_desktop_config.json');
|
|
336
|
+
}
|
|
337
|
+
if (process.platform === 'darwin') {
|
|
338
|
+
return join(homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
339
|
+
}
|
|
340
|
+
return join(homedir(), '.config', 'Claude', 'claude_desktop_config.json');
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
function mergeClaudeDesktopConfig(existing, globalMcpLauncherPath) {
|
|
344
|
+
const parsed = existing ? JSON.parse(existing) : {};
|
|
345
|
+
const mcpServers = parsed.mcpServers && typeof parsed.mcpServers === 'object' && !Array.isArray(parsed.mcpServers)
|
|
346
|
+
? parsed.mcpServers
|
|
347
|
+
: {};
|
|
348
|
+
return {
|
|
349
|
+
...parsed,
|
|
350
|
+
mcpServers: {
|
|
351
|
+
...mcpServers,
|
|
352
|
+
auditor: {
|
|
353
|
+
command: 'node',
|
|
354
|
+
args: [replaceBackslashes(globalMcpLauncherPath)],
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
333
360
|
function installMergedJson(path, buildMerged) {
|
|
334
361
|
const existing = existsSync(path) ? readFileSync(path, 'utf8') : null;
|
|
335
362
|
const merged = buildMerged(existing);
|
|
@@ -431,3 +458,19 @@ try {
|
|
|
431
458
|
} catch (err) {
|
|
432
459
|
console.warn(`audit-code: could not install Antigravity plugin (${err.message})`);
|
|
433
460
|
}
|
|
461
|
+
|
|
462
|
+
// Register auditor MCP server with Claude Desktop so /audit-code appears in its slash-command menu
|
|
463
|
+
const claudeDesktopConfig = claudeDesktopConfigPath();
|
|
464
|
+
try {
|
|
465
|
+
const action = installMergedJson(claudeDesktopConfig, (existing) =>
|
|
466
|
+
mergeClaudeDesktopConfig(existing, globalMcpLauncherPath),
|
|
467
|
+
);
|
|
468
|
+
console.log(`audit-code: ${action} Claude Desktop MCP server entry in ${claudeDesktopConfig}`);
|
|
469
|
+
console.log(`audit-code: restart Claude Desktop for /audit-code to appear`);
|
|
470
|
+
console.log(`audit-code: to target a specific repo, set AUDIT_CODE_REPO_ROOT in Claude Desktop's MCP env settings`);
|
|
471
|
+
} catch (err) {
|
|
472
|
+
console.warn(`audit-code: could not update Claude Desktop config (${err.message})`);
|
|
473
|
+
console.warn(` To register manually, add "mcpServers.auditor" to:`);
|
|
474
|
+
console.warn(` ${claudeDesktopConfig}`);
|
|
475
|
+
console.warn(` with command "node" and args ["${replaceBackslashes(globalMcpLauncherPath)}"]`);
|
|
476
|
+
}
|