Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
import { describe, it } from "node:test";
import { ok, equal } from "node:assert/strict";
describe("Approval gate integration (#8461)", () => {
it("classifyCommand types are exported", async () => {
const mod = await import("@/lib/copilot/commandClassification");
equal(typeof mod.classifyCommand, "function");
});
it("classification module has the expected categories", async () => {
const mod = await import("@/lib/copilot/commandClassification");
const r = mod.classifyCommand(["status"]);
ok(r !== null, "should classify status");
ok(["read-only", "mutating", "destructive", "secret-affecting"].includes(r.category));
});
it("read-only command returns category and rule", async () => {
const { classifyCommand } = await import(
"@/lib/copilot/commandClassification"
);
const r = classifyCommand(["help"]);
equal(r?.category, "read-only");
ok(r?.rule.reason.length > 0, "rule should have a reason");
});
it("mutating command returns warning reason", async () => {
const { classifyCommand } = await import(
"@/lib/copilot/commandClassification"
);
const r = classifyCommand(["create", "something"]);
equal(r?.category, "mutating");
ok(r?.rule.reason.includes("changes"), "reason should explain the risk");
});
it("destructive command returns a stronger reason", async () => {
const { classifyCommand } = await import(
"@/lib/copilot/commandClassification"
);
const r = classifyCommand(["delete", "provider"]);
equal(r?.category, "destructive");
ok(r?.rule.reason.includes("permanently"), "reason should warn about permanence");
});
it("secret-affecting command warns about credentials", async () => {
const { classifyCommand } = await import(
"@/lib/copilot/commandClassification"
);
const r = classifyCommand(["keys", "show"]);
equal(r?.category, "secret-affecting");
ok(r?.rule.reason.includes("secrets"), "reason should mention secrets");
});
});