diff --git a/packages/loopover-mcp/bin/loopover-mcp.js b/packages/loopover-mcp/bin/loopover-mcp.js index aca8c4d67a..f31c4e40ca 100755 --- a/packages/loopover-mcp/bin/loopover-mcp.js +++ b/packages/loopover-mcp/bin/loopover-mcp.js @@ -1957,6 +1957,8 @@ async function runCli(args) { const suggestion = suggestCommand(command); throw new Error(`Unknown command: ${command}.${suggestion ? ` Did you mean \`${suggestion}\`?` : ""} Run \`loopover-mcp --help\` to list commands.`); } + // Match every other subcommand: honor --help before requiring --login / hitting git+network (#6256). + if (options.help === true) return printHelp(); const contributorLogin = options.login ?? process.env.LOOPOVER_LOGIN ?? process.env.GITHUB_LOGIN; if (!contributorLogin) throw new Error("Pass --login or set LOOPOVER_LOGIN."); const result = await analyzeCurrentBranch({ diff --git a/test/unit/mcp-cli-analyze-branch.test.ts b/test/unit/mcp-cli-analyze-branch.test.ts index 9b124abee5..bc83f9f88b 100644 --- a/test/unit/mcp-cli-analyze-branch.test.ts +++ b/test/unit/mcp-cli-analyze-branch.test.ts @@ -1,6 +1,20 @@ import { rmSync } from "node:fs"; import { afterEach, describe, expect, it } from "vitest"; -import { closeFixtureServer, createPacketRepo, localBranchAnalysisFixture, runAsync, startFixtureServer } from "./support/mcp-cli-harness"; +import { closeFixtureServer, createPacketRepo, localBranchAnalysisFixture, run, runAsync, startFixtureServer } from "./support/mcp-cli-harness"; + +describe("loopover-mcp CLI — analyze-branch / preflight --help (#6256)", () => { + it("prints usage for analyze-branch --help without requiring --login or hitting git/network", () => { + const help = run(["analyze-branch", "--help"]); + expect(help).toMatch(/loopover-mcp analyze-branch/); + expect(help).toMatch(/--login /); + }); + + it("prints usage for preflight --help without requiring --login or hitting git/network", () => { + const help = run(["preflight", "--help"]); + expect(help).toMatch(/loopover-mcp preflight/); + expect(help).toMatch(/--login /); + }); +}); describe("loopover-mcp CLI — analyze-branch --format table", () => { let tempDir: string | null = null;