{"_id":"@darioajr/yaml-doctor","name":"@darioajr/yaml-doctor","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@darioajr/yaml-doctor","version":"1.0.0","description":"Practical YAML linting and validation (K8s/Compose/GitHub Actions) with score, badge and web report.","main":"dist/index.js","types":"dist/index.d.ts","bin":{"yaml-doctor":"dist/cli.js"},"scripts":{"build":"tsc","dev":"tsc --watch","prepublishOnly":"npm run validate && npm run build","test":"jest","lint":"eslint dist --ext .js","typecheck":"tsc --noEmit","validate":"npm run typecheck && npm run build && npm run lint","format":"prettier --write src/**/*.ts","check-yaml":"node dist/cli.js --path test-files","yaml-ci":"node dist/cli.js --path . --json","yaml-report":"node dist/cli.js --path . && echo 'Reports generated in current directory'"},"keywords":["yaml","linting","validation","kubernetes","docker-compose","github-actions","devops","ci-cd"],"author":{"name":"Dario Alves Junior"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/darioajr/yaml-doctor-npm.git"},"bugs":{"url":"https://github.com/darioajr/yaml-doctor-npm/issues"},"homepage":"https://github.com/darioajr/yaml-doctor-npm#readme","dependencies":{"globby":"^14.0.1","yaml":"^2.5.0"},"devDependencies":{"@types/node":"^20.0.0","eslint":"^8.0.0","jest":"^29.0.0","prettier":"^3.0.0","typescript":"^5.0.0"},"engines":{"node":">=18.0.0"},"_id":"@darioajr/yaml-doctor@1.0.0","gitHead":"73ce07d2be3772f9f996c82a5f919b7fa09d3a0e","_nodeVersion":"20.19.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-jKubX8+pTyHuP1WZ6Uo9hAPF7I++/AQJW545natexWx5dRqfX+34pyAyfrk3Q31aAWoVBd+RYv8Rg0kjkMDCWQ==","shasum":"faa0a52b48fb671b93a93eb30f4f7a32d355a29f","tarball":"https://registry.npmjs.org/@darioajr/yaml-doctor/-/yaml-doctor-1.0.0.tgz","fileCount":31,"unpackedSize":79025,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF81BfE457+ReD7AYU8prwSDt6yoWtz6MDaqWXWxAvaAAiEAvGIRn7PkI8lfurQv0fW6TBvDuUps+1PDrbwlPC2VNO8="}]},"_npmUser":{"name":"darioajr","email":"darioajr@gmail.com"},"directories":{},"maintainers":[{"name":"darioajr","email":"darioajr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/yaml-doctor_1.0.0_1755905303586_0.04817214057985986"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-22T23:28:23.466Z","1.0.0":"2025-08-22T23:28:23.783Z","modified":"2025-08-22T23:28:24.075Z"},"maintainers":[{"name":"darioajr","email":"darioajr@gmail.com"}],"description":"Practical YAML linting and validation (K8s/Compose/GitHub Actions) with score, badge and web report.","homepage":"https://github.com/darioajr/yaml-doctor-npm#readme","keywords":["yaml","linting","validation","kubernetes","docker-compose","github-actions","devops","ci-cd"],"repository":{"type":"git","url":"git+https://github.com/darioajr/yaml-doctor-npm.git"},"author":{"name":"Dario Alves Junior"},"bugs":{"url":"https://github.com/darioajr/yaml-doctor-npm/issues"},"license":"Apache-2.0","readme":"# yaml-doctor\n\n**A practical YAML linting and validation library** for Kubernetes, Docker Compose, and GitHub Actions with scoring, badge generation, and beautiful web reports.\n\n## Installation\n\n```bash\nnpm install @darioajr/yaml-doctor\n```\n\nOr install globally for CLI usage:\n\n```bash\nnpm install -g @darioajr/yaml-doctor\n```\n\n## CLI Usage\n\n### Basic scanning\n```bash\n# Scan current directory\nyaml-doctor\n\n# Scan specific directory\nyaml-doctor --path ./src\n\n# Output JSON only\nyaml-doctor --json\n```\n\n### Practical Examples\n\n#### 1. Validate Kubernetes manifests\n```bash\n# Scan all YAML files in kubernetes directory\nyaml-doctor --path ./k8s\n\n# Example output:\n# [yaml-doctor] Scanning /project/k8s ...\n# [yaml-doctor] Score: 85/100 | errors=0 warnings=2 info=3\n# [yaml-doctor] Generated:\n#   - /project/k8s/yaml-doctor-report.json\n#   - /project/k8s/yaml-doctor-report.html\n#   - /project/k8s/yaml-doctor-badge.svg\n```\n\n#### 2. Validate Docker Compose files\n```bash\n# Scan Docker Compose files\nyaml-doctor --path ./docker\n\n# Get JSON output for CI/CD integration\nyaml-doctor --path ./docker --json > docker-validation.json\n```\n\n#### 3. Validate GitHub Actions workflows\n```bash\n# Scan GitHub Actions workflows\nyaml-doctor --path ./.github/workflows\n\n# Example issues detected:\n# WARNING: Action \"actions/checkout\" without version pin\n# INFO: Missing \"runs-on\" in job definition\n```\n\n#### 4. CI/CD Integration\n```bash\n# In your CI/CD pipeline\nyaml-doctor --path . --json | jq '.score'\n# Returns: 92\n\n# Fail build if score is below threshold\nscore=$(yaml-doctor --path . --json | jq '.score')\nif [ $score -lt 80 ]; then\n  echo \"YAML quality score too low: $score/100\"\n  exit 1\nfi\n```\n\n#### 5. Generate badge for README\n```bash\n# Generate badge and reports\nyaml-doctor --path .\n\n# Add badge to your README.md:\n# ![YAML Doctor](./yaml-doctor-badge.svg)\n```\n\n### CLI Options\n- `--path <path>` - Path to scan (default: current directory)\n- `--json` - Output only JSON to stdout\n- `--help, -h` - Show help message\n- `--version, -v` - Show version number\n\n## Quick Start: Add to Your Project\n\n1. **Install in your project:**\n   ```bash\n   npm install --save-dev @darioajr/yaml-doctor\n   ```\n\n2. **Add to your package.json scripts:**\n   ```json\n   {\n     \"scripts\": {\n       \"check-yaml\": \"yaml-doctor --path .\",\n       \"validate-k8s\": \"yaml-doctor --path ./k8s\",\n       \"validate-docker\": \"yaml-doctor --path ./docker\",\n       \"pre-deploy\": \"yaml-doctor --path . && npm test\"\n     }\n   }\n   ```\n\n3. **Run validation:**\n   ```bash\n   npm run check-yaml\n   npm run validate-k8s\n   npm run pre-deploy\n   ```\n\n## Custom NPM Scripts\n\nYou can create custom scripts in your project's `package.json` to integrate yaml-doctor into your workflow:\n\n### Basic Scripts\n```json\n{\n  \"scripts\": {\n    \"check-yaml\": \"yaml-doctor --path .\",\n    \"check-k8s\": \"yaml-doctor --path ./k8s\",\n    \"check-docker\": \"yaml-doctor --path ./docker\",\n    \"check-workflows\": \"yaml-doctor --path ./.github/workflows\",\n    \"yaml-ci\": \"yaml-doctor --path . --json\",\n    \"yaml-report\": \"yaml-doctor --path . && echo 'Reports generated in current directory'\",\n    \"precommit\": \"yaml-doctor --path . && npm test\"\n  }\n}\n```\n\n### Usage in Your Project\n```bash\n# Install yaml-doctor in your project\nnpm install --save-dev @darioajr/yaml-doctor\n\n# Add scripts to your package.json (see examples above)\n\n# Run validation\nnpm run check-yaml\n\n# Validate specific directories\nnpm run check-k8s\nnpm run check-docker\n\n# CI/CD integration (JSON output)\nnpm run yaml-ci\n\n# Pre-commit hook\nnpm run precommit\n```\n\n### Advanced Scripts with Quality Gates\n```json\n{\n  \"scripts\": {\n    \"yaml-validate\": \"yaml-doctor --path .\",\n    \"yaml-strict\": \"yaml-doctor --path . --json | node scripts/check-score.js 90\",\n    \"yaml-ci-gate\": \"yaml-doctor --path . --json | jq '.totals.error == 0 and .score >= 80'\",\n    \"deploy-ready\": \"npm run yaml-validate && npm run test && echo 'Ready for deployment!'\",\n    \"quality-check\": \"yaml-doctor --path . && npm run lint && npm run test\"\n  }\n}\n```\n\n### Real-World Integration Examples\n\n#### Example 1: Microservice Project\n```json\n{\n  \"name\": \"my-microservice\",\n  \"scripts\": {\n    \"validate-k8s\": \"yaml-doctor --path ./k8s\",\n    \"validate-docker\": \"yaml-doctor --path ./docker\",\n    \"validate-ci\": \"yaml-doctor --path ./.github\",\n    \"pre-deploy\": \"npm run validate-k8s && npm run validate-docker && npm run test\",\n    \"ci-check\": \"yaml-doctor --path . --json | jq '.score >= 85' || exit 1\"\n  },\n  \"devDependencies\": {\n    \"@darioajr/yaml-doctor\": \"^1.0.0\"\n  }\n}\n```\n\n#### Example 2: Multi-Environment Project\n```json\n{\n  \"name\": \"multi-env-app\",\n  \"scripts\": {\n    \"yaml:dev\": \"yaml-doctor --path ./environments/dev\",\n    \"yaml:staging\": \"yaml-doctor --path ./environments/staging\", \n    \"yaml:prod\": \"yaml-doctor --path ./environments/prod\",\n    \"yaml:all\": \"npm run yaml:dev && npm run yaml:staging && npm run yaml:prod\",\n    \"deploy:dev\": \"npm run yaml:dev && kubectl apply -f environments/dev/\",\n    \"deploy:prod\": \"npm run yaml:prod && npm run test && kubectl apply -f environments/prod/\"\n  }\n}\n```\n\n#### Example 3: Full DevOps Pipeline\n```json\n{\n  \"name\": \"devops-project\",\n  \"scripts\": {\n    \"validate\": \"yaml-doctor --path .\",\n    \"security-check\": \"yaml-doctor --path . && npm run audit\",\n    \"quality-gate\": \"yaml-doctor --path . --json | node scripts/quality-gate.js\",\n    \"pre-commit\": \"npm run validate && npm run lint && npm run test\",\n    \"pre-push\": \"npm run quality-gate && npm run integration-test\",\n    \"deploy-check\": \"npm run validate && npm run security-check && echo 'Ready for deployment'\"\n  }\n}\n```\n\n### Creating a Quality Gate Script\n\nCreate `scripts/yaml-quality-gate.js` in your project:\n```javascript\n#!/usr/bin/env node\nconst { execSync } = require('child_process');\n\ntry {\n  // Run yaml-doctor and get JSON output\n  const output = execSync('yaml-doctor --path . --json', { encoding: 'utf8' });\n  const result = JSON.parse(output);\n  \n  console.log(`📊 YAML Quality Report:`);\n  console.log(`   Score: ${result.score}/100`);\n  console.log(`   Files: ${result.files.length}`);\n  console.log(`   Errors: ${result.totals.error}`);\n  console.log(`   Warnings: ${result.totals.warn}`);\n  \n  // Define your quality thresholds\n  const minScore = 80;\n  const maxErrors = 0;\n  \n  if (result.score >= minScore && result.totals.error <= maxErrors) {\n    console.log('✅ YAML Quality Gate: PASSED');\n    process.exit(0);\n  } else {\n    console.log('❌ YAML Quality Gate: FAILED');\n    process.exit(1);\n  }\n  \n} catch (error) {\n  console.error('❌ Failed to run YAML validation:', error.message);\n  process.exit(1);\n}\n```\n\nThen use it in your package.json:\n```json\n{\n  \"scripts\": {\n    \"yaml-gate\": \"node scripts/yaml-quality-gate.js\",\n    \"pre-deploy\": \"npm run yaml-gate && npm run test\"\n  }\n}\n```\n\n### One-liner Quality Checks\n\nFor simple quality gates without external scripts:\n\n```json\n{\n  \"scripts\": {\n    \"yaml-check-errors\": \"yaml-doctor --path . --json | jq -e '.totals.error == 0'\",\n    \"yaml-check-score\": \"yaml-doctor --path . --json | jq -e '.score >= 80'\",\n    \"yaml-check-strict\": \"yaml-doctor --path . --json | jq -e '.totals.error == 0 and .score >= 90'\",\n    \"yaml-summary\": \"yaml-doctor --path . --json | jq '{score: .score, errors: .totals.error, warnings: .totals.warn}'\"\n  }\n}\n```\n\n### Integration with Popular Tools\n\n#### With Husky (Git Hooks)\n```json\n{\n  \"scripts\": {\n    \"yaml-validate\": \"yaml-doctor --path .\"\n  },\n  \"husky\": {\n    \"hooks\": {\n      \"pre-commit\": \"npm run yaml-validate && lint-staged\",\n      \"pre-push\": \"yaml-doctor --path . --json | jq -e '.score >= 85'\"\n    }\n  }\n}\n```\n\n#### With lint-staged\n```json\n{\n  \"scripts\": {\n    \"yaml-check\": \"yaml-doctor --path .\"\n  },\n  \"lint-staged\": {\n    \"*.{yml,yaml}\": [\"yaml-doctor --path .\"]\n  }\n}\n```\n\n#### With Docker Compose\n```json\n{\n  \"scripts\": {\n    \"docker:validate\": \"yaml-doctor --path ./docker\",\n    \"docker:up\": \"npm run docker:validate && docker-compose up -d\",\n    \"docker:deploy\": \"npm run docker:validate && docker-compose -f docker-compose.prod.yml up -d\"\n  }\n}\n```\n\n### Package.json Template for New Projects\n\nCopy this template for new projects that need YAML validation:\n\n```json\n{\n  \"name\": \"your-project-name\",\n  \"scripts\": {\n    \"start\": \"node index.js\",\n    \"test\": \"jest\",\n    \"lint\": \"eslint .\",\n    \n    \"yaml:validate\": \"yaml-doctor --path .\",\n    \"yaml:k8s\": \"yaml-doctor --path ./k8s\",\n    \"yaml:docker\": \"yaml-doctor --path ./docker\", \n    \"yaml:ci\": \"yaml-doctor --path ./.github/workflows\",\n    \"yaml:report\": \"yaml-doctor --path . && echo '📋 YAML reports generated'\",\n    \n    \"quality:yaml\": \"yaml-doctor --path . --json | jq -e '.score >= 80'\",\n    \"quality:all\": \"npm run lint && npm run test && npm run quality:yaml\",\n    \n    \"pre-commit\": \"npm run yaml:validate && npm run lint\",\n    \"pre-deploy\": \"npm run quality:all\",\n    \"deploy\": \"npm run pre-deploy && echo 'Deploying...' && your-deploy-command\"\n  },\n  \"devDependencies\": {\n    \"@darioajr/yaml-doctor\": \"^1.0.0\",\n    \"jq\": \"^1.6.0\"\n  }\n}\n```\n\n### Environment-Specific Validation\n\n```json\n{\n  \"scripts\": {\n    \"yaml:dev\": \"yaml-doctor --path ./environments/development\",\n    \"yaml:staging\": \"yaml-doctor --path ./environments/staging\",\n    \"yaml:production\": \"yaml-doctor --path ./environments/production\",\n    \n    \"deploy:dev\": \"npm run yaml:dev && kubectl apply -f environments/development/\",\n    \"deploy:staging\": \"npm run yaml:staging && npm run test && kubectl apply -f environments/staging/\",\n    \"deploy:prod\": \"npm run yaml:production && npm run test && npm run security-audit && kubectl apply -f environments/production/\"\n  }\n}\n```\n\n## Programmatic Usage\n\n### Basic scanning\n```typescript\nimport { YamlDoctorCore } from '@darioajr/yaml-doctor';\n\nconst doctor = new YamlDoctorCore();\nconst result = await doctor.scan('./src');\n\nconsole.log(`Score: ${result.score}/100`);\nconsole.log(`Files: ${result.files.length}`);\nconsole.log(`Errors: ${result.totals.error}`);\nconsole.log(`Warnings: ${result.totals.warn}`);\n```\n\n### Generate reports\n```typescript\nimport { YamlDoctorCore } from '@darioajr/yaml-doctor';\n\nconst doctor = new YamlDoctorCore({\n  ignorePatterns: ['**/node_modules/**', '**/.git/**']\n});\n\nconst { result, outputs } = await doctor.scanAndReport('./src', {\n  generateJson: true,\n  generateHtml: true,\n  generateBadge: true,\n  outputDir: './reports'\n});\n\nconsole.log('Generated reports:', outputs);\n```\n\n### Practical Programming Examples\n\n#### 1. Custom validation in Node.js scripts\n```typescript\nimport { YamlDoctorCore } from '@darioajr/yaml-doctor';\n\nasync function validateProjectYamls() {\n  const doctor = new YamlDoctorCore();\n  \n  // Scan multiple directories\n  const directories = ['./k8s', './docker', './.github/workflows'];\n  \n  for (const dir of directories) {\n    console.log(`\\n🔍 Validating ${dir}...`);\n    const result = await doctor.scan(dir);\n    \n    console.log(`📊 Score: ${result.score}/100`);\n    console.log(`📁 Files: ${result.files.length}`);\n    \n    if (result.totals.error > 0) {\n      console.log(`❌ Errors: ${result.totals.error}`);\n      process.exit(1); // Fail on errors\n    }\n    \n    if (result.totals.warn > 0) {\n      console.log(`⚠️  Warnings: ${result.totals.warn}`);\n    }\n  }\n}\n\nvalidateProjectYamls().catch(console.error);\n```\n\n#### 2. Quality gate integration\n```typescript\nimport { YamlDoctorCore } from '@darioajr/yaml-doctor';\n\nasync function qualityGate() {\n  const doctor = new YamlDoctorCore();\n  const result = await doctor.scan('.');\n  \n  // Define quality thresholds\n  const minScore = 80;\n  const maxErrors = 0;\n  const maxWarnings = 5;\n  \n  let passed = true;\n  \n  if (result.score < minScore) {\n    console.error(`❌ Score too low: ${result.score}/${minScore}`);\n    passed = false;\n  }\n  \n  if (result.totals.error > maxErrors) {\n    console.error(`❌ Too many errors: ${result.totals.error}/${maxErrors}`);\n    passed = false;\n  }\n  \n  if (result.totals.warn > maxWarnings) {\n    console.error(`❌ Too many warnings: ${result.totals.warn}/${maxWarnings}`);\n    passed = false;\n  }\n  \n  if (passed) {\n    console.log('✅ Quality gate passed!');\n  } else {\n    process.exit(1);\n  }\n}\n```\n\n#### 3. Custom reporting\n```typescript\nimport { YamlDoctorCore } from '@darioajr/yaml-doctor';\nimport * as fs from 'fs';\n\nasync function generateCustomReport() {\n  const doctor = new YamlDoctorCore();\n  const result = await doctor.scan('.');\n  \n  // Group issues by severity\n  const issuesBySeverity = {\n    error: [],\n    warn: [],\n    info: []\n  };\n  \n  result.files.forEach(file => {\n    file.issues.forEach(issue => {\n      issuesBySeverity[issue.severity].push({\n        file: file.path,\n        type: file.type,\n        ...issue\n      });\n    });\n  });\n  \n  // Generate custom report\n  const report = {\n    summary: {\n      score: result.score,\n      filesScanned: result.files.length,\n      totalIssues: result.totals.error + result.totals.warn + result.totals.info\n    },\n    details: issuesBySeverity\n  };\n  \n  fs.writeFileSync('custom-yaml-report.json', JSON.stringify(report, null, 2));\n  console.log('📋 Custom report generated: custom-yaml-report.json');\n}\n```\n\n## What does it check?\n\n### Common Issues\n- **Tabs**: Detects tab characters (recommends spaces)\n- **Trailing spaces**: Finds trailing whitespace\n- **Long lines**: Flags lines over 160 characters\n- **Parse errors**: Invalid YAML syntax\n\n### Docker Compose\n- **Services**: Validates presence of `services` field\n- **Images**: Ensures containers have `image` or `build`\n- **Latest tags**: Warns against `:latest` tag usage\n- **Restart policies**: Suggests restart policies\n\n### GitHub Actions\n- **Jobs**: Validates `jobs` structure\n- **Steps**: Ensures steps have `uses` or `run`\n- **Version pinning**: Suggests pinning action versions\n- **Triggers**: Checks for `on` field\n\n### Kubernetes\n- **Required fields**: `apiVersion`, `kind`, `metadata.name`\n- **Container images**: Validates image specifications\n- **Resource limits**: Suggests resource limits\n- **Health probes**: Recommends liveness/startup probes\n- **Latest tags**: Warns against `:latest` in production\n\n## DevOps Integration Examples\n\n### 1. Pre-commit Hook\nAdd to your `.pre-commit-config.yaml`:\n```yaml\nrepos:\n  - repo: local\n    hooks:\n      - id: yaml-doctor\n        name: YAML Doctor\n        entry: yaml-doctor\n        args: ['--path', '.']\n        language: node\n        pass_filenames: false\n        always_run: true\n```\n\n### 2. Makefile Integration\n```makefile\n.PHONY: validate-yaml\nvalidate-yaml:\n\t@echo \"🔍 Validating YAML files...\"\n\t@npx yaml-doctor --path .\n\t@echo \"✅ YAML validation completed\"\n\n.PHONY: yaml-quality-gate\nyaml-quality-gate:\n\t@echo \"🚦 Running YAML quality gate...\"\n\t@score=$$(npx yaml-doctor --json | jq '.score'); \\\n\tif [ $$score -lt 80 ]; then \\\n\t\techo \"❌ YAML quality gate failed: $$score/100\"; \\\n\t\texit 1; \\\n\telse \\\n\t\techo \"✅ YAML quality gate passed: $$score/100\"; \\\n\tfi\n```\n\n### 3. Docker Integration\n```dockerfile\n# Multi-stage build with YAML validation\nFROM node:18-alpine AS validator\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci\nCOPY . .\nRUN npx yaml-doctor --path .\n\nFROM nginx:alpine AS runtime\nCOPY --from=validator /app/dist /usr/share/nginx/html\n```\n\n### 4. GitHub Actions Workflow\n```yaml\nname: YAML Validation\non: [push, pull_request]\n\njobs:\n  yaml-quality:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: '18'\n      \n      - name: Install yaml-doctor\n        run: npm install -g @darioajr/yaml-doctor\n        \n      - name: Validate YAML files\n        run: yaml-doctor --path .\n        \n      - name: Check quality gate\n        run: |\n          score=$(yaml-doctor --json | jq '.score')\n          if [ $score -lt 85 ]; then\n            echo \"Quality gate failed: $score/100\"\n            exit 1\n          fi\n```\n\n### 5. Jenkins Pipeline\n```groovy\npipeline {\n    agent any\n    stages {\n        stage('YAML Validation') {\n            steps {\n                sh 'npm install -g @darioajr/yaml-doctor'\n                sh 'yaml-doctor --path .'\n                \n                script {\n                    def score = sh(\n                        script: 'yaml-doctor --json | jq .score',\n                        returnStdout: true\n                    ).trim() as Integer\n                    \n                    if (score < 80) {\n                        error(\"YAML quality gate failed: ${score}/100\")\n                    }\n                    \n                    echo \"YAML quality gate passed: ${score}/100\"\n                }\n            }\n        }\n    }\n    post {\n        always {\n            archiveArtifacts artifacts: 'yaml-doctor-report.*', fingerprint: true\n        }\n    }\n}\n```\n\n## API Reference\n\n### YamlDoctorCore\n\n```typescript\nclass YamlDoctorCore {\n  constructor(options?: ScanOptions)\n  scan(rootPath: string): Promise<ScanResult>\n  scanAndReport(rootPath: string, outputOptions?: OutputOptions): Promise<{\n    result: ScanResult;\n    outputs: { jsonPath?: string; htmlPath?: string; badgePath?: string; };\n  }>\n}\n```\n\n### Types\n\n```typescript\ninterface ScanResult {\n  root: string;\n  files: FileResult[];\n  totals: { error: number; warn: number; info: number; };\n  score: number;\n}\n\ninterface FileResult {\n  path: string;\n  type: 'docker-compose' | 'github-actions' | 'kubernetes' | 'generic';\n  issues: Issue[];\n}\n\ninterface Issue {\n  severity: 'error' | 'warn' | 'info';\n  code: string;\n  message: string;\n  line?: number;\n}\n\ninterface ScanOptions {\n  path?: string;\n  ignorePatterns?: string[];\n  maxScore?: number;\n}\n\ninterface OutputOptions {\n  generateJson?: boolean;\n  generateHtml?: boolean;\n  generateBadge?: boolean;\n  outputDir?: string;\n}\n```\n\n## Generated Files\n\nyaml-doctor generates three types of output files:\n\n1. **JSON Report** (`yaml-doctor-report.json`) - Complete scan results in JSON format\n2. **HTML Report** (`yaml-doctor-report.html`) - Beautiful web report with styling\n3. **Badge SVG** (`yaml-doctor-badge.svg`) - Score badge for README files\n\n## Example Output\n\n```json\n{\n  \"root\": \"/path/to/project\",\n  \"files\": [\n    {\n      \"path\": \"docker-compose.yml\",\n      \"type\": \"docker-compose\",\n      \"issues\": [\n        {\n          \"severity\": \"warn\",\n          \"code\": \"compose.latestTag\",\n          \"message\": \"Service \\\"web\\\" uses \\\"latest\\\" tag (non-deterministic)\",\n          \"line\": 8\n        }\n      ]\n    }\n  ],\n  \"totals\": { \"error\": 0, \"warn\": 1, \"info\": 0 },\n  \"score\": 96\n}\n```\n\n## Scoring System\n\n- **Errors**: -12 points each\n- **Warnings**: -4 points each  \n- **Info**: -1 point each\n- **Maximum**: 100 points\n- **Minimum**: 0 points\n\n## Badge Colors\n\n- **Green** (90-100): Excellent\n- **Yellow** (75-89): Good  \n- **Red** (0-74): Needs improvement\n\n## 🚀 Automation with GitHub Actions\n\nThis project can be published automatically to npm with a `v*` tag push. The repository includes two workflows:\n\n1. **Build and Release** (`.github/workflows/build.yml`) - Runs on every push/PR to validate the code\n2. **Publish to npm** (`.github/workflows/publish.yml`) - Publishes to npm when a version tag is pushed\n\n### Setting up automatic publishing:\n\n1. **NPM Token**: Generate an access token in your NPM account settings\n2. **GitHub Secret**: Add `NPM_TOKEN` to your repository secrets\n3. **Create version tag**:\n   ```bash\n   npm version patch  # or minor, major\n   git push origin --tags\n   ```\n\n## License\n\nApache-2.0\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","readmeFilename":"README.md","_rev":"1-3f9a2b090775fbe6557c5eeea6eeddcd"}