auditor-lambda 0.6.0 → 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.
@@ -187,9 +187,12 @@ export async function prepareDispatchArtifacts(params) {
187
187
  }
188
188
  const bundle = await loadArtifactBundle(artifactsDir);
189
189
  const tasksPath = join(runDir, "pending-audit-tasks.json");
190
- const tasks = await readJsonFile(tasksPath).catch((error) => {
191
- if (isFileMissingError(error))
192
- return buildPendingAuditTasks(bundle);
190
+ const tasks = await readJsonFile(tasksPath).catch(async (error) => {
191
+ if (isFileMissingError(error)) {
192
+ const generated = buildPendingAuditTasks(bundle);
193
+ await writeJsonFile(tasksPath, generated);
194
+ return generated;
195
+ }
193
196
  throw error;
194
197
  });
195
198
  const sessionConfig = params.sessionConfig ?? (await loadSessionConfig(artifactsDir).catch(() => ({})));
@@ -353,7 +356,7 @@ export async function prepareDispatchArtifacts(params) {
353
356
  "",
354
357
  ];
355
358
  });
356
- const submitCommand = `"${process.execPath}" "${join(params.packageRoot, "audit-code.mjs")}" submit-packet ` +
359
+ const submitCommand = `node packages/audit-code/audit-code.mjs submit-packet ` +
357
360
  `--run-id-b64 ${toBase64Url(runId)} ` +
358
361
  `--packet-id-b64 ${toBase64Url(packet.packet_id)} ` +
359
362
  `--artifacts-dir-b64 ${toBase64Url(artifactsDir)}`;
@@ -395,7 +398,7 @@ export async function prepareDispatchArtifacts(params) {
395
398
  " unit_id copy from the task metadata",
396
399
  " pass_id copy from the task metadata",
397
400
  " lens copy from the task metadata",
398
- " file_coverage [{path, total_lines}] - copy the exact template from each task section above",
401
+ " file_coverage [{path, total_lines}] - copy the exact template from each task section above. You MUST include total_lines. Do not omit or zero it out, as this will cause fatal validation errors.",
399
402
  " findings [] or array of finding objects",
400
403
  "",
401
404
  "Lens verification tasks:",
@@ -425,6 +428,7 @@ export async function prepareDispatchArtifacts(params) {
425
428
  "## Submit",
426
429
  "Pipe the JSON array on stdin to this command:",
427
430
  ` ${submitCommand}`,
431
+ " (If using Windows PowerShell, you MUST use `Get-Content <file> | & <command>` instead of the `<` operator.)",
428
432
  "",
429
433
  "The command validates and writes the packet-owned result files. Exit 0 means accepted.",
430
434
  "Non-zero: read the errors, fix the JSON, and run the same submit command again. Retry up to 3 times.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auditor-lambda",
3
- "version": "0.6.0",
3
+ "version": "0.6.4",
4
4
  "private": false,
5
5
  "description": "Portable hybrid code-auditing framework for arbitrary repositories.",
6
6
  "type": "module",
@@ -99,8 +99,8 @@ function renderGlobalMcpLauncher(installedPkgRoot) {
99
99
  "import { join } from 'node:path';",
100
100
  "import { homedir } from 'node:os';",
101
101
  '',
102
- 'const repoRoot = process.cwd();',
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
+ }