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
28 changes: 28 additions & 0 deletions packages/loopover-mcp/bin/loopover-mcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,21 @@ async function issueSlopCli(args) {
for (const finding of payload.findings ?? []) process.stdout.write(`- ${finding.title}: ${finding.detail}\n`);
}

function printDecisionPackHelp() {
process.stdout.write(
[
"Usage: loopover-mcp decision-pack --login <github-login> [--json]",
"",
"Fetch the cached (or freshly built) contributor decision pack for a GitHub login.",
"Mirrors the loopover_get_decision_pack MCP tool and GET /v1/contributors/{login}/decision-pack. No source upload.",
"",
"Pass --json for machine-readable output.",
].join("\n") + "\n",
);
}

async function decisionPackCli(options) {
if (options.help === true) return printDecisionPackHelp();
const login = options.login ?? process.env.LOOPOVER_LOGIN ?? process.env.GITHUB_LOGIN;
if (!login) throw new Error("Pass --login <github-login> or set LOOPOVER_LOGIN.");
const payload = await getDecisionPackWithCache(login);
Expand All @@ -2173,7 +2187,21 @@ async function decisionPackCli(options) {
if (payload.cache?.rerunGuidance) process.stdout.write(`Rerun when: ${payload.cache.rerunGuidance}\n`);
}

function printRepoDecisionHelp() {
process.stdout.write(
[
"Usage: loopover-mcp repo-decision --login <github-login> --repo owner/repo [--json]",
"",
"Fetch the cached (or freshly built) repo decision for a GitHub login and repo.",
"Mirrors the loopover_explain_repo_decision MCP tool. No source upload.",
"",
"Pass --json for machine-readable output.",
].join("\n") + "\n",
);
}

async function repoDecisionCli(options) {
if (options.help === true) return printRepoDecisionHelp();
const login = options.login ?? process.env.LOOPOVER_LOGIN ?? process.env.GITHUB_LOGIN;
if (!login) throw new Error("Pass --login <github-login> or set LOOPOVER_LOGIN.");
const repoFullName = options.repo;
Expand Down
14 changes: 14 additions & 0 deletions test/unit/mcp-cli-packets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ describe("loopover-mcp CLI — packets", () => {
});
});

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

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("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