Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/loopover-mcp/bin/loopover-mcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,15 @@ function parseOptions(args) {
options.json = true;
continue;
}
if (!arg?.startsWith("--")) continue;
if (!arg?.startsWith("--")) {
// A bare `help` positional means the same thing as `--help` (#6257): the option-consuming commands
// (decision-pack/repo-decision/review-pr) only check `options.help === true`, so without this a
// dashless `loopover-mcp decision-pack help` fell through to a confusing "Pass --login…" error instead
// of printing usage — while the raw-args commands (lint-pr-text etc.) already special-cased it. A `help`
// consumed as a `--key value` value is skipped via `index += 1` below, so only a STANDALONE `help` here.
if (arg === "help") options.help = true;
continue;
}
// Support the inline `--key=value` form (e.g. `--format=table`) alongside the space-separated
// `--key value` form; splitting here keeps every existing space-separated option unchanged (#2231).
const equals = arg.indexOf("=");
Expand Down
12 changes: 12 additions & 0 deletions test/unit/mcp-cli-packets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,25 @@ describe("loopover-mcp CLI — packets", () => {
expect(help).toMatch(/contributor decision pack/);
});

it("prints decision-pack help for a bare `help` positional too, not a --login error (#6257)", () => {
const help = run(["decision-pack", "help"]);
expect(help).toMatch(/Usage: loopover-mcp decision-pack/);
expect(help).not.toMatch(/Pass --login/);
});

it("prints repo-decision help without requiring --login/--repo or making a network call", () => {
const help = run(["repo-decision", "--help"]);
expect(help).toMatch(/Usage: loopover-mcp repo-decision/);
expect(help).toMatch(/loopover_explain_repo_decision/);
expect(help).toMatch(/repo decision/);
});

it("prints repo-decision help for a bare `help` positional too, not a --login error (#6257)", () => {
const help = run(["repo-decision", "help"]);
expect(help).toMatch(/Usage: loopover-mcp repo-decision/);
expect(help).not.toMatch(/Pass --login/);
});

it("ignores incompatible decision-pack cache entries and clears cache entries on request", async () => {
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
Expand Down
6 changes: 6 additions & 0 deletions test/unit/mcp-cli-review-pr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,12 @@ describe("loopover-mcp CLI — review-pr", () => {
expect(help).toMatch(/preflight \+ slop-risk \+ PR-text-lint/);
});

it("prints help for a bare `help` positional too, not a --login error (#6257)", () => {
const help = run(["review-pr", "help"]);
expect(help).toMatch(/Usage: loopover-mcp review-pr/);
expect(help).not.toMatch(/Pass --login/);
});

it("suggests review-pr for close typos", () => {
expect(() => run(["review-pr-x"])).toThrow(/Did you mean `review-pr`\?/);
});
Expand Down