npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@liftping/repochief-quality-gates

v0.2.1754504250

Published

Quality verification gates for RepoChief AI agent outputs

Readme

RepoChief Quality Gates

Automated quality verification system for RepoChief - AI Agent Orchestration Engine

RepoChief Quality Gates provides a comprehensive verification pipeline to ensure AI-generated code meets quality standards before deployment.

Features

  • 🧪 Test Runner Integration: Jest, Mocha, Pytest, Go test
  • 🔍 Static Analysis: ESLint, Pylint, Golint
  • 🔒 Security Scanning: npm audit, Bandit, OWASP checks
  • 📊 Complexity Analysis: Cyclomatic complexity detection
  • 📈 Coverage Enforcement: Code coverage requirements
  • ⚡ Performance Gates: O(n²) pattern detection
  • 🎯 Custom Gates: Extensible gate framework

Installation

npm install @liftping/repochief-quality-gates

Quick Start

const { createQualityRunner, QualityGates } = require('@liftping/repochief-quality-gates');

// Create quality runner
const runner = createQualityRunner({
  parallel: true,
  stopOnFailure: false
});

// Run quality gates on generated code
const results = await runner.runAll(generatedCode, {
  language: 'javascript',
  projectPath: './project',
  requirements: {
    coverage: 80,
    complexity: 10
  }
});

console.log('Quality check results:', results);

Built-in Quality Gates

Test Runners

Jest Gate

const { JestGate } = require('@liftping/repochief-quality-gates');

const jestGate = new JestGate({
  configPath: './jest.config.js',
  coverageThreshold: 80
});

const result = await jestGate.execute(code, context);

Mocha Gate

const { MochaGate } = require('@liftping/repochief-quality-gates');

const mochaGate = new MochaGate({
  timeout: 10000,
  reporter: 'json'
});

Static Analysis

ESLint Gate

const { ESLintGate } = require('@liftping/repochief-quality-gates');

const eslintGate = new ESLintGate({
  configFile: '.eslintrc.js',
  fix: false
});

Security Gates

NPM Audit Gate

const { NpmAuditGate } = require('@liftping/repochief-quality-gates');

const auditGate = new NpmAuditGate({
  level: 'moderate', // low, moderate, high, critical
  production: true
});

Performance Gates

Complexity Gate

const { ComplexityGate } = require('@liftping/repochief-quality-gates');

const complexityGate = new ComplexityGate({
  maxComplexity: 10,
  detectPatterns: ['O(n²)', 'nested-loops']
});

Custom Quality Gates

Create your own quality gates by extending the base class:

const { QualityGate } = require('@liftping/repochief-quality-gates');

class CustomGate extends QualityGate {
  constructor(options = {}) {
    super('custom-gate', options);
  }

  async execute(code, context) {
    try {
      // Your validation logic here
      const issues = await this.validateCode(code);
      
      return {
        status: issues.length === 0 ? 'pass' : 'fail',
        details: {
          issues,
          metrics: {
            totalIssues: issues.length
          }
        }
      };
    } catch (error) {
      return {
        status: 'error',
        details: { error: error.message }
      };
    }
  }
  
  async validateCode(code) {
    // Implementation
    return [];
  }
}

// Register custom gate
runner.register('custom', new CustomGate());

Quality Gate Pipeline

Configure a complete verification pipeline:

const pipeline = createQualityRunner({
  gates: [
    { name: 'eslint', enabled: true },
    { name: 'jest', enabled: true },
    { name: 'complexity', enabled: true },
    { name: 'security', enabled: true }
  ],
  parallel: true,
  stopOnFailure: false,
  timeout: 60000
});

// Run pipeline
const results = await pipeline.runAll(code, {
  language: 'javascript',
  requirements: {
    coverage: 80,
    complexity: 10,
    security: 'moderate'
  }
});

// Check overall status
if (results.overallStatus === 'pass') {
  console.log('All quality gates passed!');
} else {
  console.log('Quality issues found:', results.failedGates);
}

Integration with RepoChief Core

Quality gates integrate seamlessly with the orchestrator:

const { createOrchestrator } = require('@liftping/repochief-core');
const { createQualityRunner } = require('@liftping/repochief-quality-gates');

const orchestrator = createOrchestrator({
  qualityGates: createQualityRunner({
    gates: ['eslint', 'jest', 'security']
  })
});

// Quality gates run automatically after code generation
orchestrator.on('taskCompleted', async ({ task, result }) => {
  if (result.qualityStatus === 'fail') {
    console.log('Quality issues:', result.qualityDetails);
  }
});

Configuration

Global Configuration

const runner = createQualityRunner({
  // Global options
  parallel: true,
  stopOnFailure: false,
  timeout: 60000,
  retries: 2,
  
  // Default gate configurations
  gateDefaults: {
    eslint: {
      fix: false,
      cache: true
    },
    jest: {
      coverage: true,
      verbose: false
    }
  }
});

Per-Gate Configuration

// Configure individual gates
runner.configure('jest', {
  testMatch: ['**/*.test.js'],
  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 80,
      statements: 80
    }
  }
});

Gate Results Schema

All gates return a standardized result format:

{
  gate: 'jest',
  status: 'pass' | 'fail' | 'error' | 'skipped',
  duration: 1234, // milliseconds
  timestamp: '2024-01-15T10:30:00Z',
  details: {
    // Gate-specific details
    coverage: {
      lines: 85.5,
      branches: 78.2,
      functions: 90.1,
      statements: 84.3
    },
    tests: {
      total: 45,
      passed: 43,
      failed: 2,
      skipped: 0
    }
  }
}

CLI Usage

Quality gates can be run from the command line:

# Run all gates
repochief-quality check ./generated-code

# Run specific gates
repochief-quality check ./generated-code --gates eslint,jest

# With custom config
repochief-quality check ./generated-code --config quality.config.js

Performance Considerations

  • Parallel Execution: Run independent gates concurrently
  • Caching: Cache results for unchanged code
  • Early Exit: Stop on first failure to save time
  • Selective Gates: Run only relevant gates based on code type
const runner = createQualityRunner({
  parallel: true,
  cache: {
    enabled: true,
    ttl: 3600 // 1 hour
  },
  stopOnFailure: true,
  gateSelector: (code, context) => {
    // Run only relevant gates
    if (context.language === 'python') {
      return ['pylint', 'pytest', 'bandit'];
    }
    return ['eslint', 'jest', 'npm-audit'];
  }
});

Error Handling

try {
  const results = await runner.runAll(code, context);
} catch (error) {
  if (error.code === 'GATE_TIMEOUT') {
    console.error('Quality gates timed out');
  } else if (error.code === 'GATE_NOT_FOUND') {
    console.error('Unknown gate:', error.gate);
  }
}

// Handle individual gate errors
runner.on('gateError', ({ gate, error }) => {
  console.error(`Gate ${gate} failed:`, error);
});

Events

The quality runner emits various events:

runner.on('gateStarted', ({ gate }) => {
  console.log(`Running ${gate}...`);
});

runner.on('gateCompleted', ({ gate, result }) => {
  console.log(`${gate}: ${result.status}`);
});

runner.on('pipelineCompleted', ({ results, duration }) => {
  console.log(`Pipeline completed in ${duration}ms`);
});

Best Practices

  1. Configure Appropriately: Set thresholds based on project maturity
  2. Use Caching: Enable caching for faster subsequent runs
  3. Parallelize: Run independent gates concurrently
  4. Custom Gates: Create project-specific validation gates
  5. Progressive Enhancement: Start with basic gates, add more over time

Troubleshooting

Gate Timeouts

// Increase timeout for slow gates
runner.configure('jest', {
  timeout: 120000 // 2 minutes
});

Missing Dependencies

# Install gate dependencies
npm install --save-dev jest eslint

Configuration Issues

// Validate configuration
const isValid = runner.validateConfig();
if (!isValid) {
  console.error('Invalid configuration:', runner.getConfigErrors());
}

Security

  • Never commit API keys to the repository
  • Use environment variables for sensitive configuration
  • Report security vulnerabilities to: [email protected]

Contributing

See the main RepoChief repository for contribution guidelines.

License

MIT