chore: trim unused exported helpers (#5321)

Verified dead-code removal: merged result passes typecheck:core + 194 affected unit tests + ESLint clean. Integrated into release/v3.8.41. Thanks @JxnLexn for the cleanup!
This commit is contained in:
Jan Leon
2026-06-29 15:06:33 +02:00
committed by GitHub
parent 264f8a2aec
commit e0bfd509cf
6 changed files with 20 additions and 52 deletions

View File

@@ -815,31 +815,3 @@ export function listCliTools(): CliToolEntry[] {
export function getCliTool(id: string): CliToolEntry | undefined {
return CLI_TOOLS[id];
}
// ─── Provider model mapping helper ───────────────────────────────────────────
// Get all provider models for mapping dropdown
export const getProviderModelsForMapping = (
providers: Array<{
id: string;
isActive: boolean;
testStatus: string;
provider: string;
name: string;
models?: string[];
}>
) => {
const result: Array<{ connectionId: string; provider: string; name: string; models: string[] }> =
[];
providers.forEach((conn) => {
if (conn.isActive && (conn.testStatus === "active" || conn.testStatus === "success")) {
result.push({
connectionId: conn.id,
provider: conn.provider,
name: conn.name,
models: conn.models || [],
});
}
});
return result;
};

View File

@@ -122,26 +122,6 @@ export function getContrastRatio(fgHex, bgHex) {
return (lighter + 0.05) / (darker + 0.05);
}
/**
* Check WCAG AA contrast compliance between foreground and background colors.
*
* @param {string} fgHex - Foreground color (#RRGGBB)
* @param {string} bgHex - Background color (#RRGGBB)
* @param {{ largeText?: boolean }} [options={}] - Options
* @returns {{ ratio: number, aa: boolean, aaa: boolean }}
*/
export function checkContrast(fgHex, bgHex, options: any = {}) {
const ratio = getContrastRatio(fgHex, bgHex);
const minAA = options.largeText ? 3 : 4.5;
const minAAA = options.largeText ? 4.5 : 7;
return {
ratio: Math.round(ratio * 100) / 100,
aa: ratio >= minAA,
aaa: ratio >= minAAA,
};
}
/**
* Generate a summary report from a list of violations.
*

View File

@@ -1,9 +1,5 @@
import { z } from "zod";
export const loginSchema = z.object({
password: z.string().min(1, "Password is required").max(200),
});
type ValidationErrorDetail = {
field: string;
message: string;

View File

@@ -271,6 +271,14 @@ describe("a11yAudit", () => {
assert.equal(report.total, 0);
});
it("should not export the removed contrast compliance wrapper", async () => {
const audit = await import("../../src/shared/utils/a11yAudit.ts");
assert.equal("checkContrast" in audit, false);
assert.equal(typeof audit.getContrastRatio, "function");
assert.equal(typeof audit.auditHTML, "function");
assert.equal(typeof audit.generateReport, "function");
});
it("should export WCAG rules", () => {
assert.ok(WCAG_RULES.ARIA_LABEL);
assert.ok(WCAG_RULES.COLOR_CONTRAST);

View File

@@ -77,3 +77,8 @@ test("getCliTool returns correct tool by id", async () => {
const missing = getCliTool("nonexistent");
assert.equal(missing, undefined);
});
test("CLI tools registry does not export provider model mapping helper", async () => {
const registry = await import("../../src/shared/constants/cliTools.ts");
assert.equal("getProviderModelsForMapping" in registry, false);
});

View File

@@ -33,3 +33,10 @@ test("modular schemas: loginSchema validates correctly", () => {
});
assert.equal(invalid.success, false);
});
test("validation helpers only export request-body helper APIs", async () => {
const helpers = await import("../../src/shared/validation/helpers.ts");
assert.equal("loginSchema" in helpers, false);
assert.equal(typeof helpers.validateBody, "function");
assert.equal(typeof helpers.isValidationFailure, "function");
});