feat(guardian): add guardian package - code quality analyzer

Add @puaros/guardian package v0.1.0 - code quality guardian for vibe coders and enterprise teams.

Features:
- Hardcode detection (magic numbers, magic strings)
- Circular dependency detection
- Naming convention enforcement (Clean Architecture)
- Architecture violation detection
- CLI tool with comprehensive reporting
- 159 tests with 80%+ coverage
- Smart suggestions for fixes
- Built for AI-assisted development

Built with Clean Architecture and DDD principles.
Works with Claude, GPT, Copilot, Cursor, and any AI coding assistant.
This commit is contained in:
imfozilbek
2025-11-24 02:54:39 +05:00
parent 9f97509b06
commit 03705b5264
96 changed files with 9520 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
/**
* CLI Constants
*
* Following Clean Code principles:
* - No magic strings
* - Single source of truth
* - Easy to maintain and translate
*/
export const CLI_COMMANDS = {
NAME: "guardian",
CHECK: "check",
} as const
export const CLI_DESCRIPTIONS = {
MAIN: "🛡️ Code quality guardian - detect hardcoded values and architecture violations",
CHECK: "Analyze project for code quality issues",
PATH_ARG: "Path to analyze",
EXCLUDE_OPTION: "Directories to exclude",
VERBOSE_OPTION: "Verbose output",
NO_HARDCODE_OPTION: "Skip hardcode detection",
NO_ARCHITECTURE_OPTION: "Skip architecture checks",
} as const
export const CLI_OPTIONS = {
EXCLUDE: "-e, --exclude <dirs...>",
VERBOSE: "-v, --verbose",
NO_HARDCODE: "--no-hardcode",
NO_ARCHITECTURE: "--no-architecture",
} as const
export const CLI_ARGUMENTS = {
PATH: "<path>",
} as const
export const DEFAULT_EXCLUDES = ["node_modules", "dist", "build", "coverage"] as const
export const CLI_MESSAGES = {
ANALYZING: "\n🛡 Guardian - Analyzing your code...\n",
METRICS_HEADER: "📊 Project Metrics:",
LAYER_DISTRIBUTION_HEADER: "\n📦 Layer Distribution:",
VIOLATIONS_HEADER: "\n⚠ Found",
CIRCULAR_DEPS_HEADER: "\n🔄 Found",
NAMING_VIOLATIONS_HEADER: "\n📝 Found",
HARDCODE_VIOLATIONS_HEADER: "\n🔍 Found",
NO_ISSUES: "\n✅ No issues found! Your code looks great!",
ISSUES_TOTAL: "\n❌ Found",
TIP: "\n💡 Tip: Fix these issues to improve code quality and maintainability.\n",
HELP_FOOTER: "\nRun with --help for more options",
ERROR_PREFIX: "Error analyzing project:",
} as const
export const CLI_LABELS = {
FILES_ANALYZED: "Files analyzed:",
TOTAL_FUNCTIONS: "Total functions:",
TOTAL_IMPORTS: "Total imports:",
FILES: "files",
ARCHITECTURE_VIOLATIONS: "architecture violations:",
CIRCULAR_DEPENDENCIES: "circular dependencies:",
NAMING_VIOLATIONS: "naming convention violations:",
HARDCODE_VIOLATIONS: "hardcoded values:",
ISSUES_TOTAL: "issues total",
} as const