@invisiblecities/sidequest-cqo
Version:
Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection
67 lines • 2.08 kB
JavaScript
/**
* Shared TypeScript types for Code Quality Orchestrator
* Provides type safety for color schemes, configurations, and interfaces
*/
// ============================================================================
// Error Types
// ============================================================================
export class DisplayError extends Error {
code;
context;
constructor(message, code, // eslint-disable-line no-unused-vars
context) {
super(message);
this.code = code;
this.context = context;
this.name = "DisplayError";
}
}
export class TerminalDetectionError extends Error {
method;
originalError;
constructor(message, method, // eslint-disable-line no-unused-vars
originalError) {
super(message);
this.method = method;
this.originalError = originalError;
this.name = "TerminalDetectionError";
}
}
// ============================================================================
// Type Guards
// ============================================================================
export function isColorScheme(object) {
if (typeof object !== "object" || object === null) {
return false;
}
const scheme = object;
const requiredKeys = [
"reset",
"bold",
"dim",
"primary",
"secondary",
"success",
"warning",
"error",
"info",
"muted",
"accent",
];
return requiredKeys.every((key) => typeof scheme[key] === "string");
}
export function isTerminalMode(value) {
return value === "light" || value === "dark";
}
export function isViolationSummary(object) {
if (typeof object !== "object" || object === null) {
return false;
}
const summary = object;
return (typeof summary["total"] === "number" &&
typeof summary["bySource"] === "object" &&
typeof summary["byCategory"] === "object" &&
summary["bySource"] !== undefined &&
summary["byCategory"] !== undefined);
}
//# sourceMappingURL=types.js.map