mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-27 23:06:54 +05:00
Major internal refactoring to eliminate hardcoded values and improve maintainability. Guardian now fully passes its own quality checks! Changes: - Extract all RepositoryViolation messages to domain constants - Extract all framework leak template strings to centralized constants - Extract all layer paths to infrastructure constants - Extract all regex patterns to IMPORT_PATTERNS constant - Add 30+ new constants for better maintainability New files: - src/infrastructure/constants/paths.ts (layer paths, patterns) - src/domain/constants/Messages.ts (25+ repository messages) - src/domain/constants/FrameworkCategories.ts (framework categories) - src/shared/constants/layers.ts (layer names) Impact: - Reduced hardcoded values from 37 to 1 (97% improvement) - Guardian passes its own src/ directory checks with 0 violations - All 292 tests still passing (100% pass rate) - No breaking changes - fully backwards compatible Test results: - 292 tests passing (100% pass rate) - 96.77% statement coverage - 83.82% branch coverage
18 lines
475 B
TypeScript
18 lines
475 B
TypeScript
export const LAYER_PATHS = {
|
|
DOMAIN: "/domain/",
|
|
APPLICATION: "/application/",
|
|
INFRASTRUCTURE: "/infrastructure/",
|
|
SHARED: "/shared/",
|
|
} as const
|
|
|
|
export const CLI_PATHS = {
|
|
DIST_CLI_INDEX: "../dist/cli/index.js",
|
|
} as const
|
|
|
|
export const IMPORT_PATTERNS = {
|
|
ES_IMPORT:
|
|
/import\s+(?:{[^}]*}|[\w*]+(?:\s+as\s+\w+)?|\*\s+as\s+\w+)\s+from\s+['"]([^'"]+)['"]/g,
|
|
REQUIRE: /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g,
|
|
QUOTE: /['"]/g,
|
|
} as const
|