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
34 changes: 17 additions & 17 deletions test/unit/mcp-cli-doctor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("runs doctor against a local health/session fixture", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const secretRoot = join(tempDir, "secret-gittensor");
const secretConfigDir = join(tempDir, "secret-config");
Expand Down Expand Up @@ -104,7 +104,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("uses doctor as a first-run auth checklist when no local session is configured", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const payload = JSON.parse(
await runAsync(["doctor", "--cwd", tempDir, "--repo", "JSONbored/gittensory", "--json"], {
Expand Down Expand Up @@ -133,7 +133,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("reports a stale global install with an exact upgrade command and npx fallback", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ latestVersion: "9.9.9" });
const payload = JSON.parse(
await runAsync(["status", "--json"], {
Expand All @@ -154,7 +154,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("reports a current install without upgrade guidance", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ latestVersion: mcpPackageJson.version, minMcpVersion: "0.5.0" });
const payload = JSON.parse(
await runAsync(["status", "--json"], {
Expand All @@ -181,7 +181,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("orders prerelease npm versions correctly (release outranks prerelease of the same core)", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
// Local 0.5.0 (release) vs latest 0.5.0-rc.1 (prerelease) -> local is ahead, not stale.
const aheadUrl = await startFixtureServer({ latestVersion: "0.5.0-rc.1" });
const ahead = JSON.parse(
Expand Down Expand Up @@ -209,7 +209,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("treats an unavailable npm registry as a warning, not a hard failure", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ npmStatus: 500, compatibilityStatus: 404 });
const status = JSON.parse(
await runAsync(["status", "--json"], {
Expand All @@ -235,7 +235,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("flags a stale install in doctor with upgrade remediation", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ latestVersion: oneMinorAboveLocal });
const payload = JSON.parse(
await runAsync(["doctor", "--cwd", tempDir, "--repo", "JSONbored/gittensory", "--json"], {
Expand All @@ -252,7 +252,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("reports API compatibility as unavailable when the API does not advertise a minimum version", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ compatibilityStatus: 404 });
const payload = JSON.parse(
await runAsync(["status", "--json"], {
Expand All @@ -276,7 +276,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("falls back to legacy health compatibility when the endpoint is unavailable", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ compatibilityStatus: 503, minMcpVersion: "0.4.0" });
const payload = JSON.parse(
await runAsync(["status", "--json"], {
Expand All @@ -290,7 +290,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("uses API recommended package metadata when the npm registry is unavailable", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ npmStatus: 500, latestRecommendedMcpVersion: oneMinorAboveLocal });
const payload = JSON.parse(
await runAsync(["status", "--json"], {
Expand All @@ -309,7 +309,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("flags API compatibility mismatches with upgrade guidance", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ minMcpVersion: "9.0.0" });
const env = {
LOOPOVER_API_URL: url,
Expand Down Expand Up @@ -346,7 +346,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("keeps source upload unsupported and fail-closed in the doctor checklist", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const payload = JSON.parse(
await runAsync(["doctor", "--cwd", tempDir, "--repo", "JSONbored/gittensory", "--json"], {
Expand All @@ -373,7 +373,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("points missing local repo readiness at an explicit repo-aware doctor command", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const payload = JSON.parse(
await runAsync(["doctor", "--cwd", tempDir, "--json"], {
Expand All @@ -398,7 +398,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("does not print configured tokens or local absolute paths in status or doctor output", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer({ latestVersion: "9.9.9", minMcpVersion: "9.0.0" });
const env = {
LOOPOVER_API_URL: url,
Expand All @@ -421,7 +421,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("keeps doctor exit code 0 by default even when a check fails", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
// No token configured -> the auth check fails -> status "needs_attention".
const payload = JSON.parse(
Expand All @@ -436,7 +436,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("exits non-zero from doctor --exit-code when a check fails", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
let exitCode = 0;
let stdout = "";
Expand All @@ -463,7 +463,7 @@ describe("loopover-mcp CLI — doctor", () => {
});

it("keeps doctor --exit-code at 0 when checks pass", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
// runAsync resolves only on a zero exit code, so reaching the assertion proves exit 0.
const payload = JSON.parse(
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-issue-slop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("loopover-mcp CLI — issue-slop", () => {
});

async function env() {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
return { LOOPOVER_API_URL: url, LOOPOVER_TOKEN: "session-token", LOOPOVER_CONFIG_DIR: tempDir, LOOPOVER_API_TIMEOUT_MS: "1000" };
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-lint-pr-text.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("loopover-mcp CLI — lint-pr-text", () => {
});

async function env() {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
return { LOOPOVER_API_URL: url, LOOPOVER_TOKEN: "session-token", LOOPOVER_CONFIG_DIR: tempDir, LOOPOVER_API_TIMEOUT_MS: "1000" };
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-maintain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("loopover-mcp CLI — maintain (#784)", () => {
});

async function env() {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
return { LOOPOVER_API_URL: url, LOOPOVER_TOKEN: "session-token", LOOPOVER_CONFIG_DIR: tempDir, LOOPOVER_API_TIMEOUT_MS: "1000" };
}
Expand Down
26 changes: 13 additions & 13 deletions test/unit/mcp-cli-packets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("caches last-good decision packs and returns explicitly stale local fallback when the API is unavailable", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const env = {
LOOPOVER_API_URL: url,
Expand Down Expand Up @@ -74,7 +74,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("ignores incompatible decision-pack cache entries and clears cache entries on request", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const env = {
LOOPOVER_API_URL: url,
Expand All @@ -99,7 +99,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("lists cached decision packs with safe metadata only", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const env = {
LOOPOVER_API_URL: url,
Expand Down Expand Up @@ -132,7 +132,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("cache list --format ndjson streams one JSON object per cached entry", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const env = {
LOOPOVER_API_URL: url,
Expand All @@ -156,7 +156,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("does not use stale decision-pack cache created by a different local token", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const fixtureOptions: { decisionPackStatus?: number } = {};
const url = await startFixtureServer(fixtureOptions);
const env = {
Expand All @@ -177,7 +177,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("does not use stale decision-pack cache for authorization failures", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const fixtureOptions: { decisionPackStatus?: number } = {};
const url = await startFixtureServer(fixtureOptions);
const env = {
Expand All @@ -193,7 +193,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("does not use stale decision-pack cache for non-JSON authorization failures", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const fixtureOptions: {
decisionPackStatus?: number;
decisionPackErrorBody?: string;
Expand Down Expand Up @@ -222,7 +222,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("does not use stale decision-pack cache when local credentials are missing", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const env = {
LOOPOVER_API_URL: url,
Expand All @@ -245,7 +245,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("runs base-agent CLI commands against API fixtures", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
const env = {
LOOPOVER_API_URL: url,
Expand Down Expand Up @@ -274,7 +274,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("prints copy-paste public-safe markdown for agent packet output", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
git(tempDir, "init");
git(tempDir, "config", "user.email", "test@example.com");
git(tempDir, "config", "user.name", "LoopOver Test");
Expand Down Expand Up @@ -303,7 +303,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("rejects unsafe server-provided packet markdown before non-json output", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
git(tempDir, "init");
git(tempDir, "config", "user.email", "test@example.com");
git(tempDir, "config", "user.name", "LoopOver Test");
Expand Down Expand Up @@ -343,7 +343,7 @@ describe("loopover-mcp CLI — packets", () => {
}, 45000);

it("sends bounded structured validation summaries without local logs", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
git(tempDir, "init");
git(tempDir, "config", "user.email", "test@example.com");
git(tempDir, "config", "user.name", "LoopOver Test");
Expand Down Expand Up @@ -437,7 +437,7 @@ describe("loopover-mcp CLI — packets", () => {
});

it("classifies nonzero validation status phrases as failed", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
git(tempDir, "init");
git(tempDir, "config", "user.email", "test@example.com");
git(tempDir, "config", "user.name", "LoopOver Test");
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-review-pr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ describe("loopover-mcp CLI — review-pr", () => {
});

it("requires --login", async () => {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
await expect(runAsync(["review-pr", "--cwd", tempDir], {})).rejects.toThrow(
/Pass --login/,
);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-slop-risk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("loopover-mcp CLI — slop-risk", () => {
});

async function env() {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer();
return { LOOPOVER_API_URL: url, LOOPOVER_TOKEN: "session-token", LOOPOVER_CONFIG_DIR: tempDir, LOOPOVER_API_TIMEOUT_MS: "1000" };
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("loopover-mcp CLI — tools", () => {
});

it("lists every registered stdio tool with a non-empty description", async () => {
configDir = mkdtempSync(join(tmpdir(), "gittensory-cli-tools-"));
configDir = mkdtempSync(join(tmpdir(), "loopover-cli-tools-"));
const apiUrl = await startFixtureServer();
transport = new StdioClientTransport({
command: "node",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/mcp-cli-validate-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("loopover-mcp CLI — validate-config", () => {
});

async function env(options: Parameters<typeof startFixtureServer>[0] = {}) {
tempDir = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
tempDir = mkdtempSync(join(tmpdir(), "loopover-cli-"));
const url = await startFixtureServer(options);
return { LOOPOVER_API_URL: url, LOOPOVER_TOKEN: "session-token", LOOPOVER_CONFIG_DIR: tempDir, LOOPOVER_API_TIMEOUT_MS: "1000" };
}
Expand Down
6 changes: 3 additions & 3 deletions test/unit/support/mcp-cli-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function run(args: string[], env: Record<string, string> = {}) {
env: {
...process.env,
LOOPOVER_API_TIMEOUT_MS: "1000",
LOOPOVER_CONFIG_DIR: mkdtempSync(join(tmpdir(), "gittensory-cli-config-")),
LOOPOVER_CONFIG_DIR: mkdtempSync(join(tmpdir(), "loopover-cli-config-")),
...env,
},
stdio: ["ignore", "pipe", "pipe"],
Expand All @@ -36,7 +36,7 @@ export function runAsync(args: string[], env: Record<string, string> = {}) {
env: {
...process.env,
LOOPOVER_API_TIMEOUT_MS: "1000",
LOOPOVER_CONFIG_DIR: mkdtempSync(join(tmpdir(), "gittensory-cli-config-")),
LOOPOVER_CONFIG_DIR: mkdtempSync(join(tmpdir(), "loopover-cli-config-")),
...env,
},
},
Expand All @@ -56,7 +56,7 @@ export function git(cwd: string, ...args: string[]) {
}

export function createPacketRepo() {
const cwd = mkdtempSync(join(tmpdir(), "gittensory-cli-"));
const cwd = mkdtempSync(join(tmpdir(), "loopover-cli-"));
git(cwd, "init");
git(cwd, "config", "user.email", "test@example.com");
git(cwd, "config", "user.name", "LoopOver Test");
Expand Down