@principal-ai/quality-lens-registry 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/registry.ts","../src/helpers.ts"],"sourcesContent":["/**\n * @principal-ai/quality-lens-registry\n *\n * Centralized registry of quality lens metadata for the Principal AI quality toolchain.\n *\n * This package provides a single source of truth for:\n * - Lens metadata (what lenses exist, what they do)\n * - Category definitions (linting, formatting, types, etc.)\n * - Language support (which lenses work with which languages)\n * - Helper functions for lookups and validation\n *\n * When adding a new lens:\n * 1. Add it to LENS_REGISTRY in src/registry.ts\n * 2. Implement the lens in @principal-ai/codebase-quality-lenses\n * 3. The UI packages will automatically discover and support it\n *\n * @example\n * ```typescript\n * import {\n * getLensById,\n * getLensesByCategory,\n * getColorModeForCategory,\n * LENS_REGISTRY\n * } from '@principal-ai/quality-lens-registry';\n *\n * // Get metadata for a specific lens\n * const eslint = getLensById('eslint');\n *\n * // Get all linting tools\n * const linters = getLensesByCategory('linting');\n *\n * // Determine which color mode to use based on lenses that ran\n * const colorMode = getColorModeForCategory('linting', ['biome-lint', 'typescript']);\n * // Returns 'biome-lint'\n * ```\n */\n\n// Export types\nexport type {\n Language,\n LensCategory,\n ColorScheme,\n LensMetadata,\n CategoryConfig,\n LanguageConfig,\n} from './types.js';\n\n// Export registry data\nexport {\n LENS_REGISTRY,\n CATEGORY_CONFIGS,\n LANGUAGE_CONFIGS,\n} from './registry.js';\n\n// Export helper functions\nexport {\n // Lens lookups\n getLensById,\n getLensesByCategory,\n getLensesByLanguage,\n getLensesByCategoryAndLanguage,\n getCategoryForLens,\n getAlternatives,\n areLensesAlternatives,\n getLensesWithFileMetrics,\n getLensesWithAggregates,\n\n // Color mode helpers\n getColorModeForCategory,\n getLensDisplayName,\n getLensColorScheme,\n\n // Category helpers\n getCategoryConfig,\n getCategoryDisplayName,\n isCategoryInverted,\n\n // Language helpers\n getLanguageConfig,\n detectLanguageFromExtension,\n getLanguagesForCategory,\n\n // Validation helpers\n isValidLensId,\n findCategoryConflicts,\n validateLensOutputs,\n} from './helpers.js';\n","import type { LensMetadata, CategoryConfig, LanguageConfig } from './types.js';\n\n/**\n * Central registry of all quality lenses\n *\n * When adding a new lens:\n * 1. Add it to this registry with complete metadata\n * 2. Implement the lens in @principal-ai/codebase-quality-lenses\n * 3. The UI packages will automatically discover and support it\n */\nexport const LENS_REGISTRY: LensMetadata[] = [\n // ============================================================\n // LINTING - Code style and bug detection\n // ============================================================\n\n // TypeScript/JavaScript linting\n {\n id: 'eslint',\n name: 'ESLint',\n category: 'linting',\n languages: ['typescript', 'javascript'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Pluggable linting utility for JavaScript and TypeScript',\n command: 'eslint',\n },\n {\n id: 'biome-lint',\n name: 'Biome Lint',\n category: 'linting',\n languages: ['typescript', 'javascript'],\n alternativeTo: ['eslint'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Fast linter for JavaScript and TypeScript',\n command: 'biome lint',\n },\n {\n id: 'oxlint',\n name: 'OxLint',\n category: 'linting',\n languages: ['typescript', 'javascript'],\n alternativeTo: ['eslint', 'biome-lint'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Blazing fast JavaScript/TypeScript linter',\n command: 'oxlint',\n },\n\n // Python linting\n {\n id: 'ruff',\n name: 'Ruff',\n category: 'linting',\n languages: ['python'],\n alternativeTo: ['pylint', 'flake8'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Extremely fast Python linter',\n command: 'ruff check',\n },\n {\n id: 'pylint',\n name: 'Pylint',\n category: 'linting',\n languages: ['python'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Python static code analyzer',\n command: 'pylint',\n },\n\n // Go linting\n {\n id: 'golangci-lint',\n name: 'golangci-lint',\n category: 'linting',\n languages: ['go'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Fast linters runner for Go',\n command: 'golangci-lint run',\n },\n\n // Rust linting\n {\n id: 'clippy',\n name: 'Clippy',\n category: 'linting',\n languages: ['rust'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Rust linter',\n command: 'cargo clippy',\n },\n\n // ============================================================\n // FORMATTING - Code formatting\n // ============================================================\n\n // TypeScript/JavaScript formatting\n {\n id: 'prettier',\n name: 'Prettier',\n category: 'formatting',\n languages: ['typescript', 'javascript'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'Opinionated code formatter',\n command: 'prettier --check',\n },\n {\n id: 'biome-format',\n name: 'Biome Format',\n category: 'formatting',\n languages: ['typescript', 'javascript'],\n alternativeTo: ['prettier'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'Fast code formatter for JavaScript and TypeScript',\n command: 'biome format',\n },\n\n // Python formatting\n {\n id: 'black',\n name: 'Black',\n category: 'formatting',\n languages: ['python'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'The uncompromising Python code formatter',\n command: 'black --check',\n },\n {\n id: 'ruff-format',\n name: 'Ruff Format',\n category: 'formatting',\n languages: ['python'],\n alternativeTo: ['black'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'Fast Python formatter (Ruff)',\n command: 'ruff format --check',\n },\n\n // Go formatting\n {\n id: 'gofmt',\n name: 'gofmt',\n category: 'formatting',\n languages: ['go'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'Go code formatter',\n command: 'gofmt -l',\n },\n\n // Rust formatting\n {\n id: 'rustfmt',\n name: 'rustfmt',\n category: 'formatting',\n languages: ['rust'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'Rust code formatter',\n command: 'cargo fmt --check',\n },\n\n // ============================================================\n // TYPES - Type checking\n // ============================================================\n\n // TypeScript\n {\n id: 'typescript',\n name: 'TypeScript',\n category: 'types',\n languages: ['typescript'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'TypeScript type checker',\n command: 'tsc --noEmit',\n },\n\n // Python type checking\n {\n id: 'mypy',\n name: 'MyPy',\n category: 'types',\n languages: ['python'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Static type checker for Python',\n command: 'mypy',\n },\n {\n id: 'pyright',\n name: 'Pyright',\n category: 'types',\n languages: ['python'],\n alternativeTo: ['mypy'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Static type checker for Python',\n command: 'pyright',\n },\n\n // Go type checking (built into compiler)\n {\n id: 'go-vet',\n name: 'Go Vet',\n category: 'types',\n languages: ['go'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Go static analyzer',\n command: 'go vet',\n },\n\n // ============================================================\n // TESTS - Test coverage and results\n // ============================================================\n\n // JavaScript/TypeScript testing\n {\n id: 'jest',\n name: 'Jest',\n category: 'tests',\n languages: ['typescript', 'javascript'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'JavaScript testing framework',\n command: 'jest --coverage',\n },\n {\n id: 'vitest',\n name: 'Vitest',\n category: 'tests',\n languages: ['typescript', 'javascript'],\n alternativeTo: ['jest'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'Vite-native testing framework',\n command: 'vitest run --coverage',\n },\n {\n id: 'bun-test',\n name: 'Bun Test',\n category: 'tests',\n languages: ['typescript', 'javascript'],\n alternativeTo: ['jest', 'vitest'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'Bun native test runner',\n command: 'bun test',\n },\n\n // Python testing\n {\n id: 'pytest',\n name: 'Pytest',\n category: 'tests',\n languages: ['python'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'Python testing framework',\n command: 'pytest --cov',\n },\n\n // Go testing\n {\n id: 'go-test',\n name: 'Go Test',\n category: 'tests',\n languages: ['go'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'Go test runner',\n command: 'go test -cover',\n },\n\n // Rust testing\n {\n id: 'cargo-test',\n name: 'Cargo Test',\n category: 'tests',\n languages: ['rust'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'Rust test runner',\n command: 'cargo test',\n },\n\n // ============================================================\n // DEAD CODE - Unused code detection\n // ============================================================\n\n // TypeScript/JavaScript\n {\n id: 'knip',\n name: 'Knip',\n category: 'dead-code',\n languages: ['typescript', 'javascript'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Find unused files, dependencies and exports',\n command: 'knip',\n },\n\n // Python\n {\n id: 'vulture',\n name: 'Vulture',\n category: 'dead-code',\n languages: ['python'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Find dead Python code',\n command: 'vulture',\n },\n\n // ============================================================\n // DOCUMENTATION - Documentation coverage\n // ============================================================\n\n {\n id: 'alexandria',\n name: 'Alexandria',\n category: 'documentation',\n languages: ['typescript', 'javascript'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'binary',\n description: 'Documentation coverage checker',\n command: 'alexandria lint',\n },\n {\n id: 'typedoc',\n name: 'TypeDoc',\n category: 'documentation',\n languages: ['typescript'],\n outputsFileMetrics: false,\n outputsAggregate: true,\n colorScheme: 'coverage',\n description: 'TypeScript documentation generator',\n command: 'typedoc',\n },\n\n // ============================================================\n // SECURITY - Security scanning\n // ============================================================\n\n {\n id: 'npm-audit',\n name: 'npm audit',\n category: 'security',\n languages: ['typescript', 'javascript'],\n outputsFileMetrics: false,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Check for known vulnerabilities in dependencies',\n command: 'npm audit',\n },\n {\n id: 'bandit',\n name: 'Bandit',\n category: 'security',\n languages: ['python'],\n outputsFileMetrics: true,\n outputsAggregate: true,\n colorScheme: 'issues',\n description: 'Python security linter',\n command: 'bandit -r',\n },\n];\n\n/**\n * Category configurations for UI display\n */\nexport const CATEGORY_CONFIGS: CategoryConfig[] = [\n {\n id: 'linting',\n name: 'Linting',\n description: 'Code style and bug detection',\n icon: 'AlertCircle',\n },\n {\n id: 'formatting',\n name: 'Formatting',\n description: 'Code formatting consistency',\n icon: 'AlignLeft',\n },\n {\n id: 'types',\n name: 'Types',\n description: 'Type safety and checking',\n icon: 'FileType',\n },\n {\n id: 'tests',\n name: 'Tests',\n description: 'Test coverage and results',\n icon: 'TestTube',\n },\n {\n id: 'dead-code',\n name: 'Dead Code',\n description: 'Unused code detection',\n icon: 'Trash2',\n invertedScale: true,\n },\n {\n id: 'documentation',\n name: 'Documentation',\n description: 'Documentation coverage',\n icon: 'FileText',\n },\n {\n id: 'security',\n name: 'Security',\n description: 'Security vulnerability scanning',\n icon: 'Shield',\n },\n {\n id: 'complexity',\n name: 'Complexity',\n description: 'Code complexity metrics',\n icon: 'GitBranch',\n },\n];\n\n/**\n * Language configurations for UI display\n */\nexport const LANGUAGE_CONFIGS: LanguageConfig[] = [\n {\n id: 'typescript',\n name: 'TypeScript',\n extensions: ['.ts', '.tsx', '.mts', '.cts'],\n icon: 'TS',\n },\n {\n id: 'javascript',\n name: 'JavaScript',\n extensions: ['.js', '.jsx', '.mjs', '.cjs'],\n icon: 'JS',\n },\n {\n id: 'python',\n name: 'Python',\n extensions: ['.py', '.pyi'],\n icon: 'PY',\n },\n {\n id: 'go',\n name: 'Go',\n extensions: ['.go'],\n icon: 'GO',\n },\n {\n id: 'rust',\n name: 'Rust',\n extensions: ['.rs'],\n icon: 'RS',\n },\n {\n id: 'java',\n name: 'Java',\n extensions: ['.java'],\n icon: 'JV',\n },\n {\n id: 'csharp',\n name: 'C#',\n extensions: ['.cs'],\n icon: 'C#',\n },\n {\n id: 'ruby',\n name: 'Ruby',\n extensions: ['.rb'],\n icon: 'RB',\n },\n {\n id: 'php',\n name: 'PHP',\n extensions: ['.php'],\n icon: 'PHP',\n },\n];\n","import type { LensMetadata, LensCategory, Language, CategoryConfig, LanguageConfig } from './types.js';\nimport { LENS_REGISTRY, CATEGORY_CONFIGS, LANGUAGE_CONFIGS } from './registry.js';\n\n// ============================================================\n// Lens Lookups\n// ============================================================\n\n/**\n * Get lens metadata by ID\n */\nexport function getLensById(id: string): LensMetadata | undefined {\n return LENS_REGISTRY.find((lens) => lens.id === id);\n}\n\n/**\n * Get all lenses in a category\n */\nexport function getLensesByCategory(category: LensCategory): LensMetadata[] {\n return LENS_REGISTRY.filter((lens) => lens.category === category);\n}\n\n/**\n * Get all lenses that support a language\n */\nexport function getLensesByLanguage(language: Language): LensMetadata[] {\n return LENS_REGISTRY.filter((lens) => lens.languages.includes(language));\n}\n\n/**\n * Get lenses that support a category for a specific language\n */\nexport function getLensesByCategoryAndLanguage(\n category: LensCategory,\n language: Language\n): LensMetadata[] {\n return LENS_REGISTRY.filter(\n (lens) => lens.category === category && lens.languages.includes(language)\n );\n}\n\n/**\n * Get the category for a lens ID\n */\nexport function getCategoryForLens(lensId: string): LensCategory | undefined {\n return getLensById(lensId)?.category;\n}\n\n/**\n * Get alternative lenses for a given lens ID\n */\nexport function getAlternatives(lensId: string): LensMetadata[] {\n const lens = getLensById(lensId);\n if (!lens) return [];\n\n // Find lenses that list this one as an alternative\n const listedAsAlternative = LENS_REGISTRY.filter(\n (other) => other.alternativeTo?.includes(lensId)\n );\n\n // Find lenses that this one lists as alternatives\n const thisListsAsAlternative = lens.alternativeTo\n ? LENS_REGISTRY.filter((other) => lens.alternativeTo!.includes(other.id))\n : [];\n\n // Combine and dedupe\n const all = [...listedAsAlternative, ...thisListsAsAlternative];\n return Array.from(new Map(all.map((l) => [l.id, l])).values());\n}\n\n/**\n * Check if two lenses are alternatives to each other\n */\nexport function areLensesAlternatives(lensId1: string, lensId2: string): boolean {\n const lens1 = getLensById(lensId1);\n const lens2 = getLensById(lensId2);\n\n if (!lens1 || !lens2) return false;\n if (lens1.category !== lens2.category) return false;\n\n return (\n lens1.alternativeTo?.includes(lensId2) ||\n lens2.alternativeTo?.includes(lensId1) ||\n false\n );\n}\n\n/**\n * Get all lenses that output file metrics (for File City visualization)\n */\nexport function getLensesWithFileMetrics(): LensMetadata[] {\n return LENS_REGISTRY.filter((lens) => lens.outputsFileMetrics);\n}\n\n/**\n * Get all lenses that output aggregate scores (for Quality Hexagon)\n */\nexport function getLensesWithAggregates(): LensMetadata[] {\n return LENS_REGISTRY.filter((lens) => lens.outputsAggregate);\n}\n\n// ============================================================\n// Color Mode Helpers (for File City)\n// ============================================================\n\n/**\n * Get the appropriate color mode (lens ID) for a category based on which lenses ran\n * Returns the first lens that ran for the category, preferring alternatives in order\n */\nexport function getColorModeForCategory(\n category: LensCategory,\n lensesRan: string[]\n): string | null {\n const lensesInCategory = getLensesByCategory(category);\n\n // Find the first lens that ran\n for (const lensId of lensesRan) {\n if (lensesInCategory.some((lens) => lens.id === lensId)) {\n return lensId;\n }\n }\n\n return null;\n}\n\n/**\n * Get display name for a lens (for UI labels)\n */\nexport function getLensDisplayName(lensId: string): string {\n return getLensById(lensId)?.name ?? lensId;\n}\n\n/**\n * Get color scheme for a lens (for File City layer rendering)\n */\nexport function getLensColorScheme(lensId: string): 'issues' | 'coverage' | 'binary' {\n return getLensById(lensId)?.colorScheme ?? 'issues';\n}\n\n// ============================================================\n// Category Helpers\n// ============================================================\n\n/**\n * Get category configuration\n */\nexport function getCategoryConfig(category: LensCategory): CategoryConfig | undefined {\n return CATEGORY_CONFIGS.find((c) => c.id === category);\n}\n\n/**\n * Get category display name\n */\nexport function getCategoryDisplayName(category: LensCategory): string {\n return getCategoryConfig(category)?.name ?? category;\n}\n\n/**\n * Check if a category uses inverted scale (lower is better)\n */\nexport function isCategoryInverted(category: LensCategory): boolean {\n return getCategoryConfig(category)?.invertedScale ?? false;\n}\n\n// ============================================================\n// Language Helpers\n// ============================================================\n\n/**\n * Get language configuration\n */\nexport function getLanguageConfig(language: Language): LanguageConfig | undefined {\n return LANGUAGE_CONFIGS.find((l) => l.id === language);\n}\n\n/**\n * Detect language from file extension\n */\nexport function detectLanguageFromExtension(extension: string): Language | undefined {\n const normalizedExt = extension.startsWith('.') ? extension : `.${extension}`;\n const config = LANGUAGE_CONFIGS.find((l) =>\n l.extensions.includes(normalizedExt.toLowerCase())\n );\n return config?.id;\n}\n\n/**\n * Get all languages that have lenses in a category\n */\nexport function getLanguagesForCategory(category: LensCategory): Language[] {\n const lenses = getLensesByCategory(category);\n const languages = new Set<Language>();\n for (const lens of lenses) {\n for (const lang of lens.languages) {\n languages.add(lang);\n }\n }\n return Array.from(languages);\n}\n\n// ============================================================\n// Validation Helpers\n// ============================================================\n\n/**\n * Validate that a lens ID exists in the registry\n */\nexport function isValidLensId(lensId: string): boolean {\n return getLensById(lensId) !== undefined;\n}\n\n/**\n * Find lenses that ran for the same category (potential conflicts)\n */\nexport function findCategoryConflicts(\n lensesRan: string[]\n): Array<{ category: LensCategory; lenses: string[] }> {\n const byCategory = new Map<LensCategory, string[]>();\n\n for (const lensId of lensesRan) {\n const category = getCategoryForLens(lensId);\n if (category) {\n const existing = byCategory.get(category) || [];\n existing.push(lensId);\n byCategory.set(category, existing);\n }\n }\n\n const conflicts: Array<{ category: LensCategory; lenses: string[] }> = [];\n for (const [category, lenses] of byCategory) {\n if (lenses.length > 1) {\n conflicts.push({ category, lenses });\n }\n }\n\n return conflicts;\n}\n\n/**\n * Check if all required lenses produced expected outputs\n */\nexport function validateLensOutputs(\n lensesRan: string[],\n fileMetricsProduced: string[],\n aggregatesProduced: string[]\n): Array<{ lensId: string; missing: ('fileMetrics' | 'aggregate')[] }> {\n const issues: Array<{ lensId: string; missing: ('fileMetrics' | 'aggregate')[] }> = [];\n\n for (const lensId of lensesRan) {\n const lens = getLensById(lensId);\n if (!lens) continue;\n\n const missing: ('fileMetrics' | 'aggregate')[] = [];\n\n if (lens.outputsFileMetrics && !fileMetricsProduced.includes(lensId)) {\n missing.push('fileMetrics');\n }\n if (lens.outputsAggregate && !aggregatesProduced.includes(lensId)) {\n missing.push('aggregate');\n }\n\n if (missing.length > 0) {\n issues.push({ lensId, missing });\n }\n }\n\n return issues;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,IAAM,gBAAgC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM3C;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,WAAW,CAAC,cAAc,YAAY;AAAA,IACtC,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,WAAW,CAAC,cAAc,YAAY;AAAA,IACtC,eAAe,CAAC,QAAQ;AAAA,IACxB,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,WAAW,CAAC,cAAc,YAAY;AAAA,IACtC,eAAe,CAAC,UAAU,YAAY;AAAA,IACtC,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AAAA;AAAA,EAGA;AAAA,IACE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AKO,SAAS,sBACd,WACqD;AACrD,QAAM,aAAa,oBAAI,IAA4B;AAEnD,aAAW,UAAU,WAAW;AAC9B,UAAM,WAAW,mBAAmB,MAAM;AAC1C,QAAI,UAAU;AACZ,YAAM,WAAW,WAAW,IAAI,QAAQ,KAAK,CAAC;AAC9C,eAAS,KAAK,MAAM;AACpB,iBAAW,IAAI,UAAU,QAAQ;AAAA,IACnC;AAAA,EACF;AAEA,QAAM,YAAiE,CAAC;AACxE,aAAW,CAAC,UAAU,MAAM,KAAK,YAAY;AAC3C,QAAI,OAAO,SAAS,GAAG;AACrB,gBAAU,KAAK,EAAE,UAAU,OAAO,CAAC;AAAA,IACrC;AAAA,EACF;AAEA,SAAO;AACT;AAKO,SAAS,oBACd,WACA,qBACA,oBACqE;AACrE,QAAM,SAA8E,CAAC;AAErF,aAAW,UAAU,WAAW;AAC9B,UAAM,OAAO,YAAY,MAAM;AAC/B,QAAI,CAAC,KAAM;AAEX,UAAM,UAA2C,CAAC;AAElD,QAAI,KAAK,sBAAsB,CAAC,oBAAoB,SAAS,MAAM,GAAG;AACpE,cAAQ,KAAK,aAAa;AAAA,IAC5B;AACA,QAAI,KAAK,oBAAoB,CAAC,mBAAmB,SAAS,MAAM,GAAG;AACjE,cAAQ,KAAK,WAAW;AAAA,IAC1B;AAEA,QAAI,QAAQ,SAAS,GAAG;AACtB,aAAO,KAAK,EAAE,QAAQ,QAAQ,CAAC;AAAA,IACjC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Supported programming languages for quality lenses
3
+ */
4
+ type Language = 'typescript' | 'javascript' | 'python' | 'go' | 'rust' | 'java' | 'csharp' | 'ruby' | 'php';
5
+ /**
6
+ * Quality metric categories
7
+ * Each category represents a dimension of code quality
8
+ */
9
+ type LensCategory = 'linting' | 'formatting' | 'types' | 'tests' | 'dead-code' | 'documentation' | 'security' | 'complexity';
10
+ /**
11
+ * How the lens results should be visualized in File City
12
+ */
13
+ type ColorScheme = 'issues' | 'coverage' | 'binary';
14
+ /**
15
+ * Metadata for a quality lens
16
+ */
17
+ interface LensMetadata {
18
+ /** Unique identifier for the lens (e.g., 'biome-lint', 'eslint', 'ruff') */
19
+ id: string;
20
+ /** Human-readable display name (e.g., 'Biome Lint', 'ESLint', 'Ruff') */
21
+ name: string;
22
+ /** Quality category this lens belongs to */
23
+ category: LensCategory;
24
+ /** Programming languages this lens supports */
25
+ languages: Language[];
26
+ /**
27
+ * Other lens IDs that this lens is an alternative to
28
+ * Used to avoid running multiple lenses for the same purpose
29
+ * e.g., biome-lint is an alternative to eslint
30
+ */
31
+ alternativeTo?: string[];
32
+ /** Whether this lens outputs per-file metrics (for File City visualization) */
33
+ outputsFileMetrics: boolean;
34
+ /** Whether this lens outputs aggregate scores (for Quality Hexagon) */
35
+ outputsAggregate: boolean;
36
+ /** How to visualize the metrics in File City */
37
+ colorScheme: ColorScheme;
38
+ /** Optional description of what this lens checks */
39
+ description?: string;
40
+ /**
41
+ * The CLI command/binary used to run this lens
42
+ * Useful for documentation and debugging
43
+ */
44
+ command?: string;
45
+ }
46
+ /**
47
+ * Category display configuration for UI
48
+ */
49
+ interface CategoryConfig {
50
+ id: LensCategory;
51
+ name: string;
52
+ description: string;
53
+ /** Icon name (for lucide-react or similar) */
54
+ icon?: string;
55
+ /** Whether lower values are better (e.g., dead-code) */
56
+ invertedScale?: boolean;
57
+ }
58
+ /**
59
+ * Language display configuration for UI
60
+ */
61
+ interface LanguageConfig {
62
+ id: Language;
63
+ name: string;
64
+ /** File extensions associated with this language */
65
+ extensions: string[];
66
+ /** Icon or emoji for the language */
67
+ icon?: string;
68
+ }
69
+
70
+ /**
71
+ * Central registry of all quality lenses
72
+ *
73
+ * When adding a new lens:
74
+ * 1. Add it to this registry with complete metadata
75
+ * 2. Implement the lens in @principal-ai/codebase-quality-lenses
76
+ * 3. The UI packages will automatically discover and support it
77
+ */
78
+ declare const LENS_REGISTRY: LensMetadata[];
79
+ /**
80
+ * Category configurations for UI display
81
+ */
82
+ declare const CATEGORY_CONFIGS: CategoryConfig[];
83
+ /**
84
+ * Language configurations for UI display
85
+ */
86
+ declare const LANGUAGE_CONFIGS: LanguageConfig[];
87
+
88
+ /**
89
+ * Get lens metadata by ID
90
+ */
91
+ declare function getLensById(id: string): LensMetadata | undefined;
92
+ /**
93
+ * Get all lenses in a category
94
+ */
95
+ declare function getLensesByCategory(category: LensCategory): LensMetadata[];
96
+ /**
97
+ * Get all lenses that support a language
98
+ */
99
+ declare function getLensesByLanguage(language: Language): LensMetadata[];
100
+ /**
101
+ * Get lenses that support a category for a specific language
102
+ */
103
+ declare function getLensesByCategoryAndLanguage(category: LensCategory, language: Language): LensMetadata[];
104
+ /**
105
+ * Get the category for a lens ID
106
+ */
107
+ declare function getCategoryForLens(lensId: string): LensCategory | undefined;
108
+ /**
109
+ * Get alternative lenses for a given lens ID
110
+ */
111
+ declare function getAlternatives(lensId: string): LensMetadata[];
112
+ /**
113
+ * Check if two lenses are alternatives to each other
114
+ */
115
+ declare function areLensesAlternatives(lensId1: string, lensId2: string): boolean;
116
+ /**
117
+ * Get all lenses that output file metrics (for File City visualization)
118
+ */
119
+ declare function getLensesWithFileMetrics(): LensMetadata[];
120
+ /**
121
+ * Get all lenses that output aggregate scores (for Quality Hexagon)
122
+ */
123
+ declare function getLensesWithAggregates(): LensMetadata[];
124
+ /**
125
+ * Get the appropriate color mode (lens ID) for a category based on which lenses ran
126
+ * Returns the first lens that ran for the category, preferring alternatives in order
127
+ */
128
+ declare function getColorModeForCategory(category: LensCategory, lensesRan: string[]): string | null;
129
+ /**
130
+ * Get display name for a lens (for UI labels)
131
+ */
132
+ declare function getLensDisplayName(lensId: string): string;
133
+ /**
134
+ * Get color scheme for a lens (for File City layer rendering)
135
+ */
136
+ declare function getLensColorScheme(lensId: string): 'issues' | 'coverage' | 'binary';
137
+ /**
138
+ * Get category configuration
139
+ */
140
+ declare function getCategoryConfig(category: LensCategory): CategoryConfig | undefined;
141
+ /**
142
+ * Get category display name
143
+ */
144
+ declare function getCategoryDisplayName(category: LensCategory): string;
145
+ /**
146
+ * Check if a category uses inverted scale (lower is better)
147
+ */
148
+ declare function isCategoryInverted(category: LensCategory): boolean;
149
+ /**
150
+ * Get language configuration
151
+ */
152
+ declare function getLanguageConfig(language: Language): LanguageConfig | undefined;
153
+ /**
154
+ * Detect language from file extension
155
+ */
156
+ declare function detectLanguageFromExtension(extension: string): Language | undefined;
157
+ /**
158
+ * Get all languages that have lenses in a category
159
+ */
160
+ declare function getLanguagesForCategory(category: LensCategory): Language[];
161
+ /**
162
+ * Validate that a lens ID exists in the registry
163
+ */
164
+ declare function isValidLensId(lensId: string): boolean;
165
+ /**
166
+ * Find lenses that ran for the same category (potential conflicts)
167
+ */
168
+ declare function findCategoryConflicts(lensesRan: string[]): Array<{
169
+ category: LensCategory;
170
+ lenses: string[];
171
+ }>;
172
+ /**
173
+ * Check if all required lenses produced expected outputs
174
+ */
175
+ declare function validateLensOutputs(lensesRan: string[], fileMetricsProduced: string[], aggregatesProduced: string[]): Array<{
176
+ lensId: string;
177
+ missing: ('fileMetrics' | 'aggregate')[];
178
+ }>;
179
+
180
+ export { CATEGORY_CONFIGS, type CategoryConfig, type ColorScheme, LANGUAGE_CONFIGS, LENS_REGISTRY, type Language, type LanguageConfig, type LensCategory, type LensMetadata, areLensesAlternatives, detectLanguageFromExtension, findCategoryConflicts, getAlternatives, getCategoryConfig, getCategoryDisplayName, getCategoryForLens, getColorModeForCategory, getLanguageConfig, getLanguagesForCategory, getLensById, getLensColorScheme, getLensDisplayName, getLensesByCategory, getLensesByCategoryAndLanguage, getLensesByLanguage, getLensesWithAggregates, getLensesWithFileMetrics, isCategoryInverted, isValidLensId, validateLensOutputs };
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Supported programming languages for quality lenses
3
+ */
4
+ type Language = 'typescript' | 'javascript' | 'python' | 'go' | 'rust' | 'java' | 'csharp' | 'ruby' | 'php';
5
+ /**
6
+ * Quality metric categories
7
+ * Each category represents a dimension of code quality
8
+ */
9
+ type LensCategory = 'linting' | 'formatting' | 'types' | 'tests' | 'dead-code' | 'documentation' | 'security' | 'complexity';
10
+ /**
11
+ * How the lens results should be visualized in File City
12
+ */
13
+ type ColorScheme = 'issues' | 'coverage' | 'binary';
14
+ /**
15
+ * Metadata for a quality lens
16
+ */
17
+ interface LensMetadata {
18
+ /** Unique identifier for the lens (e.g., 'biome-lint', 'eslint', 'ruff') */
19
+ id: string;
20
+ /** Human-readable display name (e.g., 'Biome Lint', 'ESLint', 'Ruff') */
21
+ name: string;
22
+ /** Quality category this lens belongs to */
23
+ category: LensCategory;
24
+ /** Programming languages this lens supports */
25
+ languages: Language[];
26
+ /**
27
+ * Other lens IDs that this lens is an alternative to
28
+ * Used to avoid running multiple lenses for the same purpose
29
+ * e.g., biome-lint is an alternative to eslint
30
+ */
31
+ alternativeTo?: string[];
32
+ /** Whether this lens outputs per-file metrics (for File City visualization) */
33
+ outputsFileMetrics: boolean;
34
+ /** Whether this lens outputs aggregate scores (for Quality Hexagon) */
35
+ outputsAggregate: boolean;
36
+ /** How to visualize the metrics in File City */
37
+ colorScheme: ColorScheme;
38
+ /** Optional description of what this lens checks */
39
+ description?: string;
40
+ /**
41
+ * The CLI command/binary used to run this lens
42
+ * Useful for documentation and debugging
43
+ */
44
+ command?: string;
45
+ }
46
+ /**
47
+ * Category display configuration for UI
48
+ */
49
+ interface CategoryConfig {
50
+ id: LensCategory;
51
+ name: string;
52
+ description: string;
53
+ /** Icon name (for lucide-react or similar) */
54
+ icon?: string;
55
+ /** Whether lower values are better (e.g., dead-code) */
56
+ invertedScale?: boolean;
57
+ }
58
+ /**
59
+ * Language display configuration for UI
60
+ */
61
+ interface LanguageConfig {
62
+ id: Language;
63
+ name: string;
64
+ /** File extensions associated with this language */
65
+ extensions: string[];
66
+ /** Icon or emoji for the language */
67
+ icon?: string;
68
+ }
69
+
70
+ /**
71
+ * Central registry of all quality lenses
72
+ *
73
+ * When adding a new lens:
74
+ * 1. Add it to this registry with complete metadata
75
+ * 2. Implement the lens in @principal-ai/codebase-quality-lenses
76
+ * 3. The UI packages will automatically discover and support it
77
+ */
78
+ declare const LENS_REGISTRY: LensMetadata[];
79
+ /**
80
+ * Category configurations for UI display
81
+ */
82
+ declare const CATEGORY_CONFIGS: CategoryConfig[];
83
+ /**
84
+ * Language configurations for UI display
85
+ */
86
+ declare const LANGUAGE_CONFIGS: LanguageConfig[];
87
+
88
+ /**
89
+ * Get lens metadata by ID
90
+ */
91
+ declare function getLensById(id: string): LensMetadata | undefined;
92
+ /**
93
+ * Get all lenses in a category
94
+ */
95
+ declare function getLensesByCategory(category: LensCategory): LensMetadata[];
96
+ /**
97
+ * Get all lenses that support a language
98
+ */
99
+ declare function getLensesByLanguage(language: Language): LensMetadata[];
100
+ /**
101
+ * Get lenses that support a category for a specific language
102
+ */
103
+ declare function getLensesByCategoryAndLanguage(category: LensCategory, language: Language): LensMetadata[];
104
+ /**
105
+ * Get the category for a lens ID
106
+ */
107
+ declare function getCategoryForLens(lensId: string): LensCategory | undefined;
108
+ /**
109
+ * Get alternative lenses for a given lens ID
110
+ */
111
+ declare function getAlternatives(lensId: string): LensMetadata[];
112
+ /**
113
+ * Check if two lenses are alternatives to each other
114
+ */
115
+ declare function areLensesAlternatives(lensId1: string, lensId2: string): boolean;
116
+ /**
117
+ * Get all lenses that output file metrics (for File City visualization)
118
+ */
119
+ declare function getLensesWithFileMetrics(): LensMetadata[];
120
+ /**
121
+ * Get all lenses that output aggregate scores (for Quality Hexagon)
122
+ */
123
+ declare function getLensesWithAggregates(): LensMetadata[];
124
+ /**
125
+ * Get the appropriate color mode (lens ID) for a category based on which lenses ran
126
+ * Returns the first lens that ran for the category, preferring alternatives in order
127
+ */
128
+ declare function getColorModeForCategory(category: LensCategory, lensesRan: string[]): string | null;
129
+ /**
130
+ * Get display name for a lens (for UI labels)
131
+ */
132
+ declare function getLensDisplayName(lensId: string): string;
133
+ /**
134
+ * Get color scheme for a lens (for File City layer rendering)
135
+ */
136
+ declare function getLensColorScheme(lensId: string): 'issues' | 'coverage' | 'binary';
137
+ /**
138
+ * Get category configuration
139
+ */
140
+ declare function getCategoryConfig(category: LensCategory): CategoryConfig | undefined;
141
+ /**
142
+ * Get category display name
143
+ */
144
+ declare function getCategoryDisplayName(category: LensCategory): string;
145
+ /**
146
+ * Check if a category uses inverted scale (lower is better)
147
+ */
148
+ declare function isCategoryInverted(category: LensCategory): boolean;
149
+ /**
150
+ * Get language configuration
151
+ */
152
+ declare function getLanguageConfig(language: Language): LanguageConfig | undefined;
153
+ /**
154
+ * Detect language from file extension
155
+ */
156
+ declare function detectLanguageFromExtension(extension: string): Language | undefined;
157
+ /**
158
+ * Get all languages that have lenses in a category
159
+ */
160
+ declare function getLanguagesForCategory(category: LensCategory): Language[];
161
+ /**
162
+ * Validate that a lens ID exists in the registry
163
+ */
164
+ declare function isValidLensId(lensId: string): boolean;
165
+ /**
166
+ * Find lenses that ran for the same category (potential conflicts)
167
+ */
168
+ declare function findCategoryConflicts(lensesRan: string[]): Array<{
169
+ category: LensCategory;
170
+ lenses: string[];
171
+ }>;
172
+ /**
173
+ * Check if all required lenses produced expected outputs
174
+ */
175
+ declare function validateLensOutputs(lensesRan: string[], fileMetricsProduced: string[], aggregatesProduced: string[]): Array<{
176
+ lensId: string;
177
+ missing: ('fileMetrics' | 'aggregate')[];
178
+ }>;
179
+
180
+ export { CATEGORY_CONFIGS, type CategoryConfig, type ColorScheme, LANGUAGE_CONFIGS, LENS_REGISTRY, type Language, type LanguageConfig, type LensCategory, type LensMetadata, areLensesAlternatives, detectLanguageFromExtension, findCategoryConflicts, getAlternatives, getCategoryConfig, getCategoryDisplayName, getCategoryForLens, getColorModeForCategory, getLanguageConfig, getLanguagesForCategory, getLensById, getLensColorScheme, getLensDisplayName, getLensesByCategory, getLensesByCategoryAndLanguage, getLensesByLanguage, getLensesWithAggregates, getLensesWithFileMetrics, isCategoryInverted, isValidLensId, validateLensOutputs };