agentaudit 3.9.2 → 3.9.3
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/cli.mjs +11 -0
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -1491,6 +1491,17 @@ async function checkPackage(name) {
|
|
|
1491
1491
|
async function main() {
|
|
1492
1492
|
const rawArgs = process.argv.slice(2);
|
|
1493
1493
|
|
|
1494
|
+
// If stdin is not a TTY and no args → we're being launched as MCP server by an editor
|
|
1495
|
+
// Delegate to the MCP server (index.mjs) instead of running the CLI
|
|
1496
|
+
if (!process.stdin.isTTY && rawArgs.length === 0) {
|
|
1497
|
+
const { fileURLToPath: fu } = await import('url');
|
|
1498
|
+
const mcpPath = path.join(path.dirname(fu(import.meta.url)), 'index.mjs');
|
|
1499
|
+
const { fork } = await import('child_process');
|
|
1500
|
+
const child = fork(mcpPath, [], { stdio: 'inherit' });
|
|
1501
|
+
child.on('exit', (code) => { process.exitCode = code || 0; });
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1494
1505
|
// Parse global flags early
|
|
1495
1506
|
jsonMode = rawArgs.includes('--json');
|
|
1496
1507
|
quietMode = rawArgs.includes('--quiet') || rawArgs.includes('-q');
|