From 228ec9b2b88db430ba209d500c5540c4b5475f04 Mon Sep 17 00:00:00 2001 From: Sachin Sharma Date: Thu, 28 May 2026 08:12:27 -0700 Subject: [PATCH] fix: resolve engineering practice violations (Rules 6, 7, 8) Closes #1014 - Rule 6: formatProviderError must return, never throw - Changed throw to return in src/lib/providers/litellm.ts:556 Closes #1015 - Rule 8: No 'Types' suffix in type filenames - Renamed fileTypes.ts -> fileExtensions.ts - Renamed mimeTypes.ts -> mimeConstants.ts - Updated barrel imports in config/index.ts Closes #1016 - Rule 7: Zero interface, always use type - Converted 78 interface declarations to type aliases across: - docs-site/ (17 in 8 files) - scripts/ (34 in 16 files) - tools/ (11 in 4 files) - neurolink-demo/ (10 in 5 files) - landing/src/ (6 in 4 files) - test/ + vite.config.ts (3 in 2 files) - Used intersection types (&) instead of extends clauses All changes are non-breaking: type aliases are structurally equivalent to interfaces, filename renames preserve exports, and the throw->return fix corrects a bug per Rule 6. --- docs-site/scripts/build-llms-txt.ts | 12 +++++----- docs-site/scripts/create-version.ts | 4 ++-- docs-site/scripts/gitChangeDetector.ts | 4 ++-- docs-site/scripts/sync-docs.ts | 8 +++---- docs-site/scripts/validate-frontmatter.ts | 12 +++++----- docs-site/src/hooks/useAlgoliaSearch.ts | 12 +++++----- docs-site/src/hooks/useLocalSearch.ts | 8 +++---- docs-site/src/theme/hooks/useNewDocs.ts | 8 +++---- landing/src/lib/actions/reveal.ts | 4 ++-- landing/src/lib/lsystem.ts | 12 +++++----- landing/src/lib/stores/canvasState.ts | 4 ++-- landing/src/routes/api/og/templates.ts | 4 ++-- .../create-comprehensive-demo-videos.ts | 4 ++-- neurolink-demo/mcp-examples.ts | 4 ++-- neurolink-demo/mcp-helpers.ts | 16 ++++++------- neurolink-demo/mcp-workflow.ts | 8 +++---- neurolink-demo/server.ts | 8 +++---- scripts/benchmarkThreeProviders.ts | 20 ++++++++-------- scripts/comprehensiveTest.ts | 4 ++-- scripts/coreFunctionalityTest.ts | 4 ++-- scripts/correctedFunctionalityTest.ts | 4 ++-- scripts/correctedSdkTest.ts | 4 ++-- scripts/createCliOverviewVideo.ts | 4 ++-- scripts/criticalTest.ts | 4 ++-- scripts/env-validation.ts | 12 +++++----- scripts/examples/demo-without-keys.ts | 12 +++++----- scripts/modelServer.ts | 8 +++---- scripts/phase6ValidationCleanup.ts | 8 +++---- scripts/quality-metrics.ts | 24 +++++++++---------- scripts/quickVerification.ts | 4 ++-- scripts/sdkComprehensiveTest.ts | 4 ++-- scripts/security-check.ts | 12 +++++----- scripts/testing/executeAllTestsParallel.ts | 8 +++---- .../{fileTypes.ts => fileExtensions.ts} | 0 src/lib/processors/config/index.ts | 4 ++-- .../config/{mimeTypes.ts => mimeConstants.ts} | 0 src/lib/providers/litellm.ts | 2 +- tools/automation/projectOrganizer.ts | 12 +++++----- tools/content/videoCleanup.ts | 12 +++++----- tools/testing/adaptiveTestRunner.ts | 8 +++---- tools/testing/performanceMonitor.ts | 12 +++++----- vite.config.ts | 4 ++-- 42 files changed, 161 insertions(+), 161 deletions(-) rename src/lib/processors/config/{fileTypes.ts => fileExtensions.ts} (100%) rename src/lib/processors/config/{mimeTypes.ts => mimeConstants.ts} (100%) diff --git a/docs-site/scripts/build-llms-txt.ts b/docs-site/scripts/build-llms-txt.ts index ab92120a9..d7d446aa3 100644 --- a/docs-site/scripts/build-llms-txt.ts +++ b/docs-site/scripts/build-llms-txt.ts @@ -32,11 +32,11 @@ const SUMMARY_TRUNCATE_STEP_CHARS = 25; const EXCLUDED_DIRS = ["tracking", "phases", "analysis", "plans", "test-reports"]; // Priority definitions for summary file (lower number = higher priority) -interface PriorityRule { +type PriorityRule = { pattern: string | RegExp; priority: number; includeInSummary: boolean; -} +}; const PRIORITY_RULES: PriorityRule[] = [ { pattern: /^index\.md$/, priority: 1, includeInSummary: true }, @@ -82,7 +82,7 @@ const SECTION_ORDER = [ "visual-content", ]; -interface DocFile { +type DocFile = { relativePath: string; section: string; title: string; @@ -91,12 +91,12 @@ interface DocFile { priority: number; includeInSummary: boolean; order: number; -} +}; -interface ProviderInfo { +type ProviderInfo = { name: string; slug: string; -} +}; /** * Strip unnecessary formatting from content diff --git a/docs-site/scripts/create-version.ts b/docs-site/scripts/create-version.ts index 26d1ebd50..cfddad94d 100644 --- a/docs-site/scripts/create-version.ts +++ b/docs-site/scripts/create-version.ts @@ -20,10 +20,10 @@ const ROOT_PACKAGE_JSON = path.resolve(__dirname, "../../package.json"); const DOCS_SITE_DIR = path.resolve(__dirname, ".."); const VERSIONS_FILE = path.join(DOCS_SITE_DIR, "versions.json"); -interface PackageJson { +type PackageJson = { version: string; [key: string]: unknown; -} +}; /** * Parse a semver version string into its components diff --git a/docs-site/scripts/gitChangeDetector.ts b/docs-site/scripts/gitChangeDetector.ts index fba166349..77777a839 100644 --- a/docs-site/scripts/gitChangeDetector.ts +++ b/docs-site/scripts/gitChangeDetector.ts @@ -8,12 +8,12 @@ import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -export interface GitChangeInfo { +export type GitChangeInfo = { addedFiles: Set; modifiedFiles: Set; deletedFiles: Set; allChangedFiles: Set; -} +}; export class GitChangeDetector { /** @deprecated Use tag-based detection instead. Kept for backwards compatibility. */ diff --git a/docs-site/scripts/sync-docs.ts b/docs-site/scripts/sync-docs.ts index d4319a455..acee834f0 100644 --- a/docs-site/scripts/sync-docs.ts +++ b/docs-site/scripts/sync-docs.ts @@ -138,16 +138,16 @@ const FILE_MAPPINGS: Record = { "large-context-handling-design-doc.md": "development/large-context-design.md", }; -interface TransformResult { +type TransformResult = { content: string; frontmatter: Record; -} +}; -interface FileInfo { +type FileInfo = { sourcePath: string; relativePath: string; targetPath: string; -} +}; /** * Convert MkDocs admonitions to Docusaurus format diff --git a/docs-site/scripts/validate-frontmatter.ts b/docs-site/scripts/validate-frontmatter.ts index 3e5febeb8..e3b7a9c43 100644 --- a/docs-site/scripts/validate-frontmatter.ts +++ b/docs-site/scripts/validate-frontmatter.ts @@ -53,27 +53,27 @@ const VALID_TWITTER_CARDS = ["summary", "summary_large_image", "app", "player"]; // Validation issue types type IssueLevel = "error" | "warning" | "info"; -interface ValidationIssue { +type ValidationIssue = { level: IssueLevel; file: string; message: string; field?: string; -} +}; -interface ValidationResult { +type ValidationResult = { file: string; issues: ValidationIssue[]; frontmatter: Record; -} +}; -interface ValidationSummary { +type ValidationSummary = { totalFiles: number; filesWithErrors: number; filesWithWarnings: number; totalErrors: number; totalWarnings: number; totalInfo: number; -} +}; /** * Check if a path should be skipped diff --git a/docs-site/src/hooks/useAlgoliaSearch.ts b/docs-site/src/hooks/useAlgoliaSearch.ts index f6d710033..b829f1e1f 100644 --- a/docs-site/src/hooks/useAlgoliaSearch.ts +++ b/docs-site/src/hooks/useAlgoliaSearch.ts @@ -4,7 +4,7 @@ import { } from "algoliasearch/lite"; import { useCallback, useEffect, useRef, useState } from "react"; -export interface SearchResult { +export type SearchResult = { objectID: string; title: string; url: string; @@ -25,16 +25,16 @@ export interface SearchResult { lvl3?: { value: string }; }; }; -} +}; -interface UseAlgoliaSearchOptions { +type UseAlgoliaSearchOptions = { appId: string; searchApiKey: string; indexName: string; debounceMs?: number; -} +}; -export interface UseAlgoliaSearchReturn { +export type UseAlgoliaSearchReturn = { query: string; setQuery: (query: string) => void; results: SearchResult[]; @@ -45,7 +45,7 @@ export interface UseAlgoliaSearchReturn { selectedIndex: number; setSelectedIndex: (index: number) => void; totalResults: number; -} +}; // Simple LRU cache for recent searches class SearchCache { diff --git a/docs-site/src/hooks/useLocalSearch.ts b/docs-site/src/hooks/useLocalSearch.ts index 02c6e6a47..b54251a54 100644 --- a/docs-site/src/hooks/useLocalSearch.ts +++ b/docs-site/src/hooks/useLocalSearch.ts @@ -2,7 +2,7 @@ import MiniSearch from "minisearch"; import { useCallback, useEffect, useRef, useState } from "react"; import type { SearchResult, UseAlgoliaSearchReturn } from "./useAlgoliaSearch"; -interface SearchDocument { +type SearchDocument = { objectID: string; title: string; url: string; @@ -13,7 +13,7 @@ interface SearchDocument { lvl2?: string; lvl3?: string; }; -} +}; let indexPromise: Promise> | null = null; @@ -62,9 +62,9 @@ function loadIndex(): Promise> { return indexPromise; } -interface UseLocalSearchOptions { +type UseLocalSearchOptions = { debounceMs?: number; -} +}; export function useLocalSearch({ debounceMs = 200, diff --git a/docs-site/src/theme/hooks/useNewDocs.ts b/docs-site/src/theme/hooks/useNewDocs.ts index 472aa438b..a93d55f95 100644 --- a/docs-site/src/theme/hooks/useNewDocs.ts +++ b/docs-site/src/theme/hooks/useNewDocs.ts @@ -28,7 +28,7 @@ import { usePluginData } from "@docusaurus/useGlobalData"; export type DocStatus = "new" | "updated" | "recent"; -export interface DocMetadata { +export type DocMetadata = { docId: string; filePath: string; status: DocStatus; @@ -39,9 +39,9 @@ export interface DocMetadata { message: string; date: string; } | null; -} +}; -export interface NewDocsData { +export type NewDocsData = { newDocs: DocMetadata[]; updatedDocs: DocMetadata[]; recentDocs: DocMetadata[]; @@ -54,7 +54,7 @@ export interface NewDocsData { }; baseTag: string; generatedAt: string; -} +}; /** * Get all new docs data from the plugin diff --git a/landing/src/lib/actions/reveal.ts b/landing/src/lib/actions/reveal.ts index 29cf86fa2..a0596c409 100644 --- a/landing/src/lib/actions/reveal.ts +++ b/landing/src/lib/actions/reveal.ts @@ -1,4 +1,4 @@ -interface RevealOptions { +type RevealOptions = { y?: number; x?: number; scale?: number; @@ -8,7 +8,7 @@ interface RevealOptions { ease?: string; start?: string; stagger?: number; -} +}; export function reveal(node: HTMLElement, options: RevealOptions = {}) { if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) { diff --git a/landing/src/lib/lsystem.ts b/landing/src/lib/lsystem.ts index b7ca6cfc5..dff768f97 100644 --- a/landing/src/lib/lsystem.ts +++ b/landing/src/lib/lsystem.ts @@ -1,4 +1,4 @@ -export interface LBranch { +export type LBranch = { x1: number; y1: number; x2: number; @@ -7,9 +7,9 @@ export interface LBranch { depth: number; opacity: number; isAxon: boolean; -} +}; -export interface LSystemOptions { +export type LSystemOptions = { originX: number; originY: number; seed: number; @@ -18,7 +18,7 @@ export interface LSystemOptions { axiom?: string; rules?: Record; angle?: number; -} +}; export function mulberry32(seed: number): () => number { return function () { @@ -109,10 +109,10 @@ export function branchesToLines( return branches; } -export interface NeuronPath { +export type NeuronPath = { points: { x: number; y: number }[]; length: number; // precomputed arc length -} +}; export const cachedDendrites = new Map(); export const cachedPaths = new Map(); diff --git a/landing/src/lib/stores/canvasState.ts b/landing/src/lib/stores/canvasState.ts index 42a7bf922..1282147b4 100644 --- a/landing/src/lib/stores/canvasState.ts +++ b/landing/src/lib/stores/canvasState.ts @@ -15,7 +15,7 @@ export const scrollProgress = writable(0); // 0–1 export const scrollVelocity = writable(0); // pixels/frame, smoothed // Per-section canvas configuration -export interface SectionCanvasConfig { +export type SectionCanvasConfig = { intensity: number; particleSpeed: number; branchGrowth: number; @@ -23,7 +23,7 @@ export interface SectionCanvasConfig { dominantColor: string; glowNodes: boolean; spinalActivity: number; -} +}; const SECTION_CONFIGS: Record = { hero: { diff --git a/landing/src/routes/api/og/templates.ts b/landing/src/routes/api/og/templates.ts index 63720e060..a7a6b46a3 100644 --- a/landing/src/routes/api/og/templates.ts +++ b/landing/src/routes/api/og/templates.ts @@ -1,12 +1,12 @@ export type OGType = "home" | "docs" | "sdk" | "examples"; -interface OGParams { +type OGParams = { type: OGType; title?: string; subtitle?: string; section?: string; method?: string; -} +}; function escapeHtml(text: string): string { return text diff --git a/neurolink-demo/create-comprehensive-demo-videos.ts b/neurolink-demo/create-comprehensive-demo-videos.ts index 8f68f87cc..7e1de9923 100644 --- a/neurolink-demo/create-comprehensive-demo-videos.ts +++ b/neurolink-demo/create-comprehensive-demo-videos.ts @@ -9,10 +9,10 @@ import { chromium, type Page } from "playwright"; import fs from "fs"; import path from "path"; -interface DemoAction { +type DemoAction = { description: string; execute: (page: Page) => Promise; -} +}; const BASE_URL = "http://localhost:9876"; const VIDEOS_DIR = "./videos"; diff --git a/neurolink-demo/mcp-examples.ts b/neurolink-demo/mcp-examples.ts index 2cd59a34a..03fb91282 100644 --- a/neurolink-demo/mcp-examples.ts +++ b/neurolink-demo/mcp-examples.ts @@ -21,11 +21,11 @@ import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -interface CommandResult { +type CommandResult = { success: boolean; output?: string; error?: string; -} +}; /** * Execute NeuroLink MCP command and return result diff --git a/neurolink-demo/mcp-helpers.ts b/neurolink-demo/mcp-helpers.ts index 6596a97a6..824ff1ebf 100644 --- a/neurolink-demo/mcp-helpers.ts +++ b/neurolink-demo/mcp-helpers.ts @@ -9,7 +9,7 @@ import { execSync, spawn, type ExecSyncOptions } from "child_process"; import fs from "fs"; import path from "path"; -interface MCPServerConfig { +type MCPServerConfig = { command?: string; args?: string[]; transport?: string; @@ -17,23 +17,23 @@ interface MCPServerConfig { cwd?: string; url?: string; name?: string; -} +}; -interface MCPConfig { +type MCPConfig = { mcpServers: Record; -} +}; -interface CommandResult { +type CommandResult = { success: boolean; output?: string; error?: string; command?: string; -} +}; -interface ServerStatus { +type ServerStatus = { available: boolean; reason: string; -} +}; // MCP configuration file path const MCP_CONFIG_FILE = path.join(process.cwd(), ".mcp-config.json"); diff --git a/neurolink-demo/mcp-workflow.ts b/neurolink-demo/mcp-workflow.ts index 01a3ac83b..fd9b7dcd9 100644 --- a/neurolink-demo/mcp-workflow.ts +++ b/neurolink-demo/mcp-workflow.ts @@ -21,17 +21,17 @@ import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -interface CommandResult { +type CommandResult = { success: boolean; output?: string; error?: string; -} +}; -interface WorkflowResult { +type WorkflowResult = { success: boolean; error?: string; [key: string]: unknown; -} +}; /** * Execute NeuroLink MCP command safely diff --git a/neurolink-demo/server.ts b/neurolink-demo/server.ts index 5448934d5..8ed35de70 100644 --- a/neurolink-demo/server.ts +++ b/neurolink-demo/server.ts @@ -1951,15 +1951,15 @@ app.delete( // ================================ // In-memory session storage for context management -interface SessionMessage { +type SessionMessage = { id: string; role: "user" | "assistant" | "system"; content: string; timestamp: string; tokenCount: number; -} +}; -interface Session { +type Session = { id: string; messages: SessionMessage[]; summary?: string; @@ -1968,7 +1968,7 @@ interface Session { lastActivityAt: string; totalTokens: number; summarizationCount: number; -} +}; const sessions = new Map(); diff --git a/scripts/benchmarkThreeProviders.ts b/scripts/benchmarkThreeProviders.ts index 56174741c..9a14d9046 100644 --- a/scripts/benchmarkThreeProviders.ts +++ b/scripts/benchmarkThreeProviders.ts @@ -8,41 +8,41 @@ import { fileURLToPath } from "url"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -interface BenchmarkPrompt { +type BenchmarkPrompt = { name: string; prompt: string; maxTokens: number; -} +}; -interface PromptResult { +type PromptResult = { attempts: number; times: number[]; avgTime: number; success: boolean; error: string | null; -} +}; -interface ProviderResult { +type ProviderResult = { available: boolean; prompts: Record; totalTime: number; avgResponseTime: number; errors: string[]; -} +}; -interface BenchmarkSummary { +type BenchmarkSummary = { totalProviders: number; availableProviders: number; fastestProvider: string; slowestProvider: string; avgResponseTimeAcrossProviders: number; -} +}; -interface BenchmarkResults { +type BenchmarkResults = { timestamp: string; providers: Record; summary: Partial; -} +}; const BENCHMARK_PROMPTS: BenchmarkPrompt[] = [ { diff --git a/scripts/comprehensiveTest.ts b/scripts/comprehensiveTest.ts index 4f7fac74b..460b98a3e 100755 --- a/scripts/comprehensiveTest.ts +++ b/scripts/comprehensiveTest.ts @@ -14,11 +14,11 @@ import chalk from "chalk"; const TEST_OUTPUT_DIR = "./test-results"; const TIMESTAMP = new Date().toISOString().replace(/[:.]/g, "-"); -interface LogEntry { +type LogEntry = { timestamp: string; type: string; message: string; -} +}; class ComprehensiveTester { results: LogEntry[]; diff --git a/scripts/coreFunctionalityTest.ts b/scripts/coreFunctionalityTest.ts index 6fa9a4099..c3f92deb6 100755 --- a/scripts/coreFunctionalityTest.ts +++ b/scripts/coreFunctionalityTest.ts @@ -11,12 +11,12 @@ import chalk from "chalk"; const TIMESTAMP = new Date().toISOString().replace(/[:.]/g, "-"); -interface TestEntry { +type TestEntry = { timestamp: string; message: string; success: boolean; details: string; -} +}; const results: TestEntry[] = []; diff --git a/scripts/correctedFunctionalityTest.ts b/scripts/correctedFunctionalityTest.ts index ee2972089..8fe551cb2 100644 --- a/scripts/correctedFunctionalityTest.ts +++ b/scripts/correctedFunctionalityTest.ts @@ -8,12 +8,12 @@ import { execSync } from "child_process"; import { writeFileSync } from "fs"; -interface TestResult { +type TestResult = { test: string; status: string; output?: string; error?: string; -} +}; const results: TestResult[] = []; diff --git a/scripts/correctedSdkTest.ts b/scripts/correctedSdkTest.ts index 6aba58e80..de48e840a 100644 --- a/scripts/correctedSdkTest.ts +++ b/scripts/correctedSdkTest.ts @@ -7,13 +7,13 @@ import { writeFileSync } from "fs"; -interface SdkTestResult { +type SdkTestResult = { test: string; status: string; details: string; output: string; timestamp: string; -} +}; const results: SdkTestResult[] = []; diff --git a/scripts/createCliOverviewVideo.ts b/scripts/createCliOverviewVideo.ts index 0ccf9185c..3e5c973c6 100644 --- a/scripts/createCliOverviewVideo.ts +++ b/scripts/createCliOverviewVideo.ts @@ -21,11 +21,11 @@ const OUTPUT_DIR = path.join( const SCRIPT_DELAY = 2000; // 2 seconds between commands const VIDEO_DURATION = 30; // Target ~30 seconds -interface CLICommand { +type CLICommand = { command: string; description: string; duration: number; -} +}; const CLI_COMMANDS: CLICommand[] = [ { diff --git a/scripts/criticalTest.ts b/scripts/criticalTest.ts index 6640edad3..7806b4663 100644 --- a/scripts/criticalTest.ts +++ b/scripts/criticalTest.ts @@ -8,12 +8,12 @@ import { execSync } from "child_process"; import { writeFileSync } from "fs"; -interface TestResult { +type TestResult = { test: string; status: string; output?: string; error?: string; -} +}; const results: TestResult[] = []; diff --git a/scripts/env-validation.ts b/scripts/env-validation.ts index 95ba43e2d..1a17c85ba 100755 --- a/scripts/env-validation.ts +++ b/scripts/env-validation.ts @@ -26,24 +26,24 @@ const colors: Record = { cyan: "\x1b[36m", }; -interface Issue { +type Issue = { severity: string; category: string; message: string; suggestion: string | null; timestamp: string; -} +}; -interface PatternDef { +type PatternDef = { pattern: RegExp; example: string; -} +}; -interface ProviderConfig { +type ProviderConfig = { required: string[]; optional: string[]; check: () => boolean; -} +}; class EnvironmentValidator { issues: Issue[]; diff --git a/scripts/examples/demo-without-keys.ts b/scripts/examples/demo-without-keys.ts index 1e0476b03..02def5228 100644 --- a/scripts/examples/demo-without-keys.ts +++ b/scripts/examples/demo-without-keys.ts @@ -16,27 +16,27 @@ console.log('🚀 NEUROLINK DEMO - No API Keys Required'); console.log('=' .repeat(50)); console.log('This demo shows the expected structure without making real API calls\n'); -interface MockAnalytics { +type MockAnalytics = { provider: string; model: string; tokens: { input: number; output: number; total: number }; cost: number; responseTime: number; context: Record; -} +}; -interface MockEvaluation { +type MockEvaluation = { relevance: number; accuracy: number; completeness: number; overall: number; -} +}; -interface MockResult { +type MockResult = { text: string; analytics?: MockAnalytics; evaluation?: MockEvaluation; -} +}; // Mock demonstration of what analytics and evaluation would look like function mockAnalytics(): MockAnalytics { diff --git a/scripts/modelServer.ts b/scripts/modelServer.ts index 835ccf235..afd42aa61 100644 --- a/scripts/modelServer.ts +++ b/scripts/modelServer.ts @@ -14,19 +14,19 @@ import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -interface ModelData { +type ModelData = { capabilities: string[]; pricing: { input: number; output: number }; [key: string]: unknown; -} +}; -interface ModelConfig { +type ModelConfig = { models: Record>; defaults: Record; serverTime?: string; requestId?: string; [key: string]: unknown; -} +}; const app = express(); const PORT = process.env.MODEL_SERVER_PORT || 3001; diff --git a/scripts/phase6ValidationCleanup.ts b/scripts/phase6ValidationCleanup.ts index 3bda68135..e8a6ccb7c 100644 --- a/scripts/phase6ValidationCleanup.ts +++ b/scripts/phase6ValidationCleanup.ts @@ -17,20 +17,20 @@ const __dirname = dirname(__filename); /** * Phase 6 Validation and Cleanup class */ -interface Phase6Options { +type Phase6Options = { dryRun?: boolean; verbose?: boolean; archiveOldScripts?: boolean; validateAll?: boolean; test?: boolean; -} +}; -interface Phase6Results { +type Phase6Results = { validation: Record; cleanup: Record; documentation: Record; archival: Record; -} +}; class Phase6ValidationCleanup { dryRun: boolean; diff --git a/scripts/quality-metrics.ts b/scripts/quality-metrics.ts index 1d3f48490..b4417b38e 100644 --- a/scripts/quality-metrics.ts +++ b/scripts/quality-metrics.ts @@ -28,16 +28,16 @@ const colors: Record = { cyan: "\x1b[36m", }; -interface ESLintMetrics { +type ESLintMetrics = { totalFiles?: number; filesWithIssues?: number; errors?: number; warnings?: number; topViolations?: Array<{ rule: string; count: number }>; error?: string; -} +}; -interface TypeScriptMetrics { +type TypeScriptMetrics = { files?: number; linesOfCode?: number; identifiers?: number; @@ -45,9 +45,9 @@ interface TypeScriptMetrics { types?: number; compilationSuccessful?: boolean; error?: string; -} +}; -interface ComplexityMetrics { +type ComplexityMetrics = { totalFiles?: number; totalLines?: number; averageLinesPerFile?: number; @@ -55,33 +55,33 @@ interface ComplexityMetrics { complexFunctions?: number; largestFiles?: Array<{ file: string; lines: number }>; error?: string; -} +}; -interface SecurityMetrics { +type SecurityMetrics = { vulnerabilities?: number; warnings?: number; secretsFound?: number; securityScore?: number; error?: string; -} +}; -interface CoverageMetrics { +type CoverageMetrics = { available?: boolean; lines?: number; branches?: number; functions?: number; statements?: number; message?: string; -} +}; -interface Metrics { +type Metrics = { eslint: ESLintMetrics; typescript: TypeScriptMetrics; coverage: CoverageMetrics; security: SecurityMetrics; complexity: ComplexityMetrics; files: Record; -} +}; class QualityMetricsReporter { startTime: number; diff --git a/scripts/quickVerification.ts b/scripts/quickVerification.ts index f630a2765..cbe89cd66 100644 --- a/scripts/quickVerification.ts +++ b/scripts/quickVerification.ts @@ -11,11 +11,11 @@ import path from "path"; const TIMESTAMP = new Date().toISOString().replace(/[:.]/g, "-"); -interface VerifyEntry { +type VerifyEntry = { timestamp: string; message: string; success: boolean; -} +}; const results: VerifyEntry[] = []; diff --git a/scripts/sdkComprehensiveTest.ts b/scripts/sdkComprehensiveTest.ts index 07f5b36f8..c44aaa1d9 100644 --- a/scripts/sdkComprehensiveTest.ts +++ b/scripts/sdkComprehensiveTest.ts @@ -7,13 +7,13 @@ import { writeFileSync } from "fs"; -interface SdkTestResult { +type SdkTestResult = { test: string; status: string; details: string; output: string; timestamp: string; -} +}; const results: SdkTestResult[] = []; diff --git a/scripts/security-check.ts b/scripts/security-check.ts index 7f147cc3a..532882a57 100755 --- a/scripts/security-check.ts +++ b/scripts/security-check.ts @@ -46,27 +46,27 @@ const IGNORED_VULNERABLE_PACKAGES = [ "lodash-es", // TODO: track in #xxx — no patch available upstream for @semantic-release dev dep ]; -interface SecurityIssue { +type SecurityIssue = { level: string; category: string; message: string; details: Record | null; timestamp: string; -} +}; -interface GitleaksFinding { +type GitleaksFinding = { RuleID?: string; File?: string; StartLine?: number; Description?: string; -} +}; -interface SecurityResults { +type SecurityResults = { secrets: { status: string; details: GitleaksFinding[] }; dependencies: { status: string; details: unknown[] }; licenses: { status: string; details: unknown[] }; bestPractices: { status: string; details: unknown[] }; -} +}; class SecurityValidator { errors: SecurityIssue[]; diff --git a/scripts/testing/executeAllTestsParallel.ts b/scripts/testing/executeAllTestsParallel.ts index 362145ea8..1a9dd340c 100755 --- a/scripts/testing/executeAllTestsParallel.ts +++ b/scripts/testing/executeAllTestsParallel.ts @@ -22,7 +22,7 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const PROJECT_ROOT = path.join(__dirname, '..', '..'); -interface TestCase { +type TestCase = { id: string; type: 'CLI' | 'SDK' | 'ST'; subtype?: string; @@ -34,13 +34,13 @@ interface TestCase { executed: boolean; passed: boolean; stdin?: string; -} +}; -interface TestResult { +type TestResult = { success: boolean; output: unknown; error: string | null; -} +}; // Configuration const MAX_PARALLEL_TESTS = 10; // Reduced for stability diff --git a/src/lib/processors/config/fileTypes.ts b/src/lib/processors/config/fileExtensions.ts similarity index 100% rename from src/lib/processors/config/fileTypes.ts rename to src/lib/processors/config/fileExtensions.ts diff --git a/src/lib/processors/config/index.ts b/src/lib/processors/config/index.ts index 0a7b8b4d9..1381ae2d9 100644 --- a/src/lib/processors/config/index.ts +++ b/src/lib/processors/config/index.ts @@ -47,7 +47,7 @@ export { SOURCE_CODE_MIME_TYPES, TEXT_MIME_TYPES, VIDEO_MIME_TYPES, -} from "./mimeTypes.js"; +} from "./mimeConstants.js"; // ============================================================================= // FILE EXTENSIONS @@ -146,7 +146,7 @@ export { XML_EXTENSIONS, YAML_EXTENSIONS, ZIG_EXTENSIONS, -} from "./fileTypes.js"; +} from "./fileExtensions.js"; // ============================================================================= // LANGUAGE DETECTION diff --git a/src/lib/processors/config/mimeTypes.ts b/src/lib/processors/config/mimeConstants.ts similarity index 100% rename from src/lib/processors/config/mimeTypes.ts rename to src/lib/processors/config/mimeConstants.ts diff --git a/src/lib/providers/litellm.ts b/src/lib/providers/litellm.ts index 0f26d50c6..b39df06cb 100644 --- a/src/lib/providers/litellm.ts +++ b/src/lib/providers/litellm.ts @@ -981,7 +981,7 @@ export class LiteLLMProvider extends BaseProvider { error?: { message?: string }; }) : undefined; - throw this.formatProviderError( + return this.formatProviderError( new Error( parsed?.error?.message || `LiteLLM ${operation} failed with status ${res.status}`, diff --git a/tools/automation/projectOrganizer.ts b/tools/automation/projectOrganizer.ts index 0cd0d70e2..78342ca6f 100644 --- a/tools/automation/projectOrganizer.ts +++ b/tools/automation/projectOrganizer.ts @@ -9,12 +9,12 @@ import fs from "fs/promises"; import path from "path"; -interface CategoryConfig { +type CategoryConfig = { description: string; files: string[]; -} +}; -interface OrganizationReport { +type OrganizationReport = { summary: { totalFilesProcessed: number; filesMoved: number; @@ -24,9 +24,9 @@ interface OrganizationReport { }; categories: Record; recommendations: string[]; -} +}; -interface Categorization { +type Categorization = { automation: string[]; content: string[]; testing: string[]; @@ -34,7 +34,7 @@ interface Categorization { uncategorized: string[]; ignored: string[]; [key: string]: string[]; -} +}; class ProjectOrganizer { projectRoot: string; diff --git a/tools/content/videoCleanup.ts b/tools/content/videoCleanup.ts index 40ca63c7d..c88ebc72c 100644 --- a/tools/content/videoCleanup.ts +++ b/tools/content/videoCleanup.ts @@ -10,28 +10,28 @@ import fs from "fs/promises"; import path from "path"; import { glob } from "glob"; -interface VideoFileInfo { +type VideoFileInfo = { name: string; path: string; size: number; modified: Date; age: number; -} +}; -interface VideoAnalysis { +type VideoAnalysis = { hashNamed: VideoFileInfo[]; meaningful: VideoFileInfo[]; suspicious: VideoFileInfo[]; totalSize: number; -} +}; -interface CleanupResults { +type CleanupResults = { cleaned: number; backed: number; kept: number; sizeSaved: number; errors: Array<{ file: string; error: string }>; -} +}; class VideoCleanup { videoDir: string; diff --git a/tools/testing/adaptiveTestRunner.ts b/tools/testing/adaptiveTestRunner.ts index 6ed3b0174..9ff25aaad 100644 --- a/tools/testing/adaptiveTestRunner.ts +++ b/tools/testing/adaptiveTestRunner.ts @@ -148,13 +148,13 @@ function findFilesByExtension( return files; } -interface TestRunnerConfig { +type TestRunnerConfig = { testPatterns: string[]; sourcePatterns: string[]; criticalTests: string[]; -} +}; -interface TestRunnerResults { +type TestRunnerResults = { startTime: number; strategy: string; changedFiles: string[]; @@ -162,7 +162,7 @@ interface TestRunnerResults { skippedTests: string[]; performance: { testDuration?: number }; coverage: Record; -} +}; class AdaptiveTestRunner { changedFiles: Set; diff --git a/tools/testing/performanceMonitor.ts b/tools/testing/performanceMonitor.ts index 7dd5ec93f..8d5ee29ee 100644 --- a/tools/testing/performanceMonitor.ts +++ b/tools/testing/performanceMonitor.ts @@ -17,14 +17,14 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const ROOT_DIR = join(__dirname, "../.."); -interface Benchmark { +type Benchmark = { name: string; title: string; command: string; threshold: number; -} +}; -interface BenchmarkResult { +type BenchmarkResult = { name: string; title: string; command: string; @@ -33,9 +33,9 @@ interface BenchmarkResult { memory: { heapUsed?: number; rss?: number }; status: string; error: string | null; -} +}; -interface PerformanceResults { +type PerformanceResults = { timestamp: string; system: Record; benchmarks: Record; @@ -50,7 +50,7 @@ interface PerformanceResults { }>; recommendations: Array<{ type: string; priority: string; message: string }>; }; -} +}; class PerformanceMonitor { benchmarks: Benchmark[]; diff --git a/vite.config.ts b/vite.config.ts index ac870f223..0cf3e1bfa 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,7 +2,7 @@ import { sveltekit } from "@sveltejs/kit/vite"; import type { UserConfig } from "vite"; // Extend Vite config to support Vitest's test property -interface VitestConfig extends Omit { +type VitestConfig = Omit & { // Use 'unknown' to avoid Plugin type conflicts from multiple Vite versions in pnpm plugins?: unknown; test?: { @@ -20,7 +20,7 @@ interface VitestConfig extends Omit { outputFile?: string; onConsoleLog?: (log: string, type: "stdout" | "stderr") => void; }; -} +}; const config: VitestConfig = { plugins: [sveltekit()],