Skip to content

SIDDARTHA577/envguard-node / .agents/skills/envguard-load-test

envguard-load-test

Verified

Guides capacity planning, workload profile design, local performance benchmarking, and threshold validation without fabricating production metrics or executing unauthorized traffic.

FileKindSize
SKILL.mdskill md7.7 KB
scripts/readiness-auditor.mjsscript27.1 KB
scripts/readiness/adapters/android-adapter.mjsscript30.0 KB
scripts/readiness/adapters/base-adapter.mjsscript4.6 KB
scripts/readiness/adapters/flutter-adapter.mjsscript28.9 KB
scripts/readiness/adapters/generic-adapter.mjsscript15.9 KB
scripts/readiness/adapters/index.mjsscript661 B
scripts/readiness/adapters/ios-adapter.mjsscript21.0 KB
scripts/readiness/adapters/java-spring-adapter.mjsscript39.9 KB
scripts/readiness/adapters/nextjs-react-adapter.mjsscript30.5 KB
scripts/readiness/adapters/node-typescript-adapter.mjsscript115.8 KB
scripts/readiness/adapters/python-adapter.mjsscript44.0 KB
scripts/readiness/adapters/react-native-adapter.mjsscript34.6 KB
scripts/readiness/adapters/registry.mjsscript3.7 KB
scripts/readiness/architecture/applicability.mjsscript21.8 KB
scripts/readiness/architecture/architecture-inventory.mjsscript16.9 KB
scripts/readiness/architecture/architecture-reporter.mjsscript9.4 KB
scripts/readiness/architecture/capacity-model.mjsscript16.9 KB
scripts/readiness/architecture/design-decisions.mjsscript42.0 KB
scripts/readiness/architecture/failure-modes.mjsscript13.3 KB
scripts/readiness/architecture/index.mjsscript895 B
scripts/readiness/architecture/requirements.mjsscript22.0 KB
scripts/readiness/architecture/tradeoffs.mjsscript4.5 KB
scripts/readiness/capacity/benchmark-runner.mjsscript13.4 KB
scripts/readiness/constants.mjsscript6.0 KB
scripts/readiness/deployment/cicd-gate-validator.mjsscript6.1 KB
scripts/readiness/deployment/container-validator.mjsscript10.1 KB
scripts/readiness/deployment/deployment-gate.mjsscript4.8 KB
scripts/readiness/deployment/index.mjsscript411 B
scripts/readiness/deployment/k8s-validator.mjsscript8.8 KB
scripts/readiness/deployment/reliability-validator.mjsscript9.4 KB
scripts/readiness/engine/discovery.mjsscript15.4 KB
scripts/readiness/engine/index.mjsscript341 B
scripts/readiness/engine/orchestrator.mjsscript21.0 KB
scripts/readiness/engine/planner.mjsscript4.2 KB
scripts/readiness/engine/sarif.mjsscript12.7 KB
scripts/readiness/engine/skills-selector.mjsscript10.0 KB
scripts/readiness/execution/git.mjsscript2.3 KB
scripts/readiness/execution/runner.mjsscript11.9 KB
scripts/readiness/index.mjsscript516 B
scripts/readiness/orchestration/engineering-workflow.mjsscript18.5 KB
scripts/readiness/orchestration/index.mjsscript170 B
scripts/readiness/policies/index.mjsscript189 B
scripts/readiness/policies/release-policy.mjsscript9.5 KB
scripts/readiness/remediation/checkpoint-manager.mjsscript34.0 KB
scripts/readiness/remediation/diff-viewer.mjsscript2.5 KB
scripts/readiness/remediation/index.mjsscript778 B
scripts/readiness/remediation/patch-generator.mjsscript17.5 KB
scripts/readiness/remediation/remediation-runner.mjsscript9.9 KB
scripts/readiness/reporters/comparator.mjsscript20.7 KB
scripts/readiness/reporters/index.mjsscript293 B
scripts/readiness/reporters/json-reporter.mjsscript193 B
scripts/readiness/reporters/markdown-reporter.mjsscript18.8 KB
scripts/readiness/validation/evidence-matrix.mjsscript21.5 KB
scripts/readiness/validation/independent-app-runner.mjsscript26.2 KB
scripts/readiness/validation/index.mjsscript328 B

scripts/readiness/adapters/generic-adapter.mjs

View on GitHub
import fs from 'node:fs';
import path from 'node:path';
import { BaseAdapter } from './base-adapter.mjs';
import { TOOL_VERSION } from '../constants.mjs';
import { checkGitTracking, parseGitignoreRules, isPathIgnoredByRules } from '../execution/git.mjs';

/**
 * Universal Language-Agnostic Repository Hygiene Adapter.
 * Applies to all repository structures regardless of language or framework.
 */
export class GenericAdapter extends BaseAdapter {
  constructor() {
    super({
      id: 'generic',
      name: 'Generic Repository Hygiene Adapter',
      version: TOOL_VERSION,
      description: 'Assesses language-agnostic repository hygiene, Git safety, secret leak defenses, and CI automation.',
      supportedLanguages: ['*'],
      supportedFrameworks: ['*'],
      requiredTools: ['git'],
    });
  }

  detect(target, _context) {
    // Generic adapter applies to all repositories and root/workspace targets
    return {
      matched: true,
      confidence: 1.0,
      reason: 'Universal language-agnostic repository hygiene adapter.',
      metadata: { isRoot: target.isRoot ?? true },
    };
  }

  getCapabilities() {
    return [
      'repo_hygiene',
      'secret_leak_defense',
      'gitignore_validation',
      'dependency_automation',
      'container_configuration',
      'ci_workflow',
    ];
  }

  getApplicableChecks(_target, _context) {
    return [
      { id: 'ENV-002', name: 'Secret Files Excluded in .gitignore', category: 'env', required: true },
      { id: 'ENV-004', name: 'Committed Secret Detection', category: 'env', required: true },
      { id: 'SEC-001', name: 'Automated Dependency Security Tooling', category: 'security', required: true },
      { id: 'DEP-001', name: 'Container Configuration Present', category: 'deployment', required: false },
      { id: 'DEP-004', name: 'Continuous Integration Workflow Configured', category: 'deployment', required: true },
    ];
  }

  runStaticChecks(target, context) {
    const findings = [];
    const projectDir = context.projectDir;
    const targetDir = target.absPath || projectDir;
    const files = context.files || [];

    // --- Check 1: ENV-002 (.gitignore Exclusions) ---
    const rootGitignorePath = path.join(projectDir, '.gitignore');
    const targetGitignorePath = path.join(targetDir, '.gitignore');
    const gitignoreCandidates =
      path.resolve(targetDir) !== path.resolve(projectDir)
        ? [targetGitignorePath, rootGitignorePath]
        : [rootGitignorePath];
    const existingGitignorePaths = gitignoreCandidates.filter((p) => fs.existsSync(p));
    let gitignoreRules = [];

    if (existingGitignorePaths.length > 0) {
      let matchedEnvGitignoreRel = null;
      let firstExistingRel = '.gitignore';
      let readError = null;
      let readErrorFile = '.gitignore';

      for (const candidatePath of existingGitignorePaths) {
        const relFile = path.relative(projectDir, candidatePath).replace(/\\/g, '/') || '.gitignore';
        if (firstExistingRel === '.gitignore') {
          firstExistingRel = relFile;
        }
        try {
          const content = fs.readFileSync(candidatePath, 'utf8');
          const parsedRules = parseGitignoreRules(content);
          gitignoreRules = gitignoreRules.concat(parsedRules);
          const hasEnvIgnored =
            content.includes('.env') || parsedRules.some((r) => r.pattern.includes('.env'));
          if (hasEnvIgnored && !matchedEnvGitignoreRel) {
            matchedEnvGitignoreRel = relFile;
          }
        } catch (err) {
          readError = err;
          readErrorFile = relFile;
          break;
        }
      }

      if (readError) {
        findings.push(
          this.createFinding({
            id: 'ENV-002',
            category: 'env',
            status: 'ERROR',
            severity: 'critical',
            title: 'Error Reading .gitignore',
            explanation: `Failed to inspect ${readErrorFile}: ${readError.message}`,
            evidence: { file: '.gitignore', ...(readErrorFile !== '.gitignore' ? { resolvedFile: readErrorFile } : {}) },
            checkMethod: 'static_analysis',
            recommendation: 'Verify file permissions for .gitignore.',
            manualVerificationRequired: false,
            confidence: 'verified_fact',
            targetPath: target.path,
          })
        );
      } else if (matchedEnvGitignoreRel) {
        findings.push(
          this.createFinding({
            id: 'ENV-002',
            category: 'env',
            status: 'PASS',
            severity: 'info',
            title: 'Secret Environment Files Excluded in .gitignore',
            explanation: `${matchedEnvGitignoreRel} contains exclusion rules for .env files.`,
            evidence: {
              file: '.gitignore',
              ...(matchedEnvGitignoreRel !== '.gitignore' ? { resolvedFile: matchedEnvGitignoreRel } : {}),
            },
            checkMethod: 'static_analysis',
            recommendation: 'Ensure all local secret files (.env, .env.local, *.key) remain gitignored.',
            manualVerificationRequired: false,
            confidence: 'verified_fact',
            targetPath: target.path,
          })
        );
      } else {
        findings.push(
          this.createFinding({
            id: 'ENV-002',
            category: 'env',
            status: 'FAIL',
            severity: 'critical',
            title: 'Secret Files Not Excluded in .gitignore',
            explanation: `${firstExistingRel} does not contain explicit rules to exclude ".env" or ".env.*" files.`,
            evidence: {
              file: '.gitignore',
              ...(firstExistingRel !== '.gitignore' ? { resolvedFile: firstExistingRel } : {}),
            },
            checkMethod: 'static_analysis',
            recommendation:
              'Add ".env", ".env.*", "!.env.example", and "*.key" to .gitignore to prevent accidental credential commits. Note: updating .gitignore does not remove already-tracked secrets from Git history.',
            manualVerificationRequired: false,
            confidence: 'verified_fact',
            targetPath: target.path,
          })
        );
      }
    } else {
      findings.push(
        this.createFinding({
          id: 'ENV-002',
          category: 'env',
          status: 'FAIL',
          severity: 'critical',
          title: 'Missing .gitignore File',
          explanation: 'No .gitignore file found in repository or workspace root. High risk of accidental secret commits.',
          evidence: { file: '.gitignore' },
          checkMethod: 'static_analysis',
          recommendation: 'Create a .gitignore file and exclude .env, .env.local, node_modules, and sensitive files.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    }

    // --- Check 2: ENV-004 (Committed Secret Detection) ---
    const localEnvFiles = files.filter(
      (f) =>
        (f === '.env' || f === '.env.local' || f === '.env.production') &&
        !f.includes('example') &&
        !f.includes('template') &&
        !f.includes('sample')
    );

    if (localEnvFiles.length === 0) {
      findings.push(
        this.createFinding({
          id: 'ENV-004',
          category: 'env',
          status: 'PASS',
          severity: 'info',
          title: 'No Committed Secret Environment Files Detected',
          explanation: 'No tracked .env or secret environment credential files were found in Git tracking index.',
          evidence: { file: '.gitignore' },
          checkMethod: 'static_analysis',
          recommendation: 'Ensure pre-commit hooks verify no secret files are staged for commit.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    } else {
      for (const envFile of localEnvFiles) {
        const gitStatus = checkGitTracking(projectDir, envFile);

        if (gitStatus.isGitRepo && gitStatus.isTracked) {
          findings.push(
            this.createFinding({
              id: 'ENV-004',
              category: 'env',
              status: 'FAIL',
              severity: 'critical',
              title: 'Sensitive .env File Tracked in Git Repository',
              explanation: `Found live environment file "${envFile}" tracked in Git repository index.`,
              evidence: { file: envFile },
              checkMethod: 'static_analysis',
              recommendation:
                'Remove live .env file from Git tracking immediately (git rm --cached) and rotate any exposed secrets. Note: adding .gitignore rules alone does not remove tracked secrets from Git commit history.',
              manualVerificationRequired: false,
              confidence: 'verified_fact',
              targetPath: target.path,
            })
          );
        } else {
          // File exists in working tree but is NOT tracked by Git
          const isIgnored = isPathIgnoredByRules(gitignoreRules, envFile);
          if (isIgnored) {
            findings.push(
              this.createFinding({
                id: 'ENV-004',
                category: 'env',
                status: 'PASS',
                severity: 'info',
                title: 'Local .env File Exists in Working Tree (Safely Ignored by Git)',
                explanation: `Local file "${envFile}" exists in working tree but is safely excluded by .gitignore and not tracked by Git.`,
                evidence: { file: envFile },
                checkMethod: 'static_analysis',
                recommendation: 'Keep working-tree secret files strictly out of version control.',
                manualVerificationRequired: false,
                confidence: 'verified_fact',
                targetPath: target.path,
              })
            );
          } else {
            findings.push(
              this.createFinding({
                id: 'ENV-004',
                category: 'env',
                status: 'FAIL',
                severity: 'high',
                title: 'Untracked .env File in Working Tree Not Excluded by .gitignore',
                explanation: `Local file "${envFile}" is not ignored by .gitignore rules. High risk of accidental commit.`,
                evidence: { file: envFile },
                checkMethod: 'static_analysis',
                recommendation: 'Add rule to .gitignore to exclude this file before committing.',
                manualVerificationRequired: false,
                confidence: 'verified_fact',
                targetPath: target.path,
              })
            );
          }
        }
      }
    }

    // --- Check 3: SEC-001 (Automated Dependency Security Tooling) ---
    const hasDependabot =
      fs.existsSync(path.join(projectDir, '.github', 'dependabot.yml')) ||
      fs.existsSync(path.join(projectDir, '.github', 'dependabot.yaml'));
    const hasRenovate =
      fs.existsSync(path.join(projectDir, 'renovate.json')) ||
      fs.existsSync(path.join(projectDir, '.github', 'renovate.json'));

    if (hasDependabot || hasRenovate) {
      findings.push(
        this.createFinding({
          id: 'SEC-001',
          category: 'security',
          status: 'PASS',
          severity: 'info',
          title: 'Automated Dependency Security Tooling Configured',
          explanation: `Detected automated dependency management configuration: ${hasDependabot ? 'Dependabot' : 'Renovate'}.`,
          evidence: { file: hasDependabot ? '.github/dependabot.yml' : 'renovate.json' },
          checkMethod: 'static_analysis',
          recommendation: 'Regularly triage and merge automated security updates.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    } else {
      findings.push(
        this.createFinding({
          id: 'SEC-001',
          category: 'security',
          status: 'WARNING',
          severity: 'medium',
          title: 'Missing Automated Dependency Security Scanning Config',
          explanation: 'No Dependabot (.github/dependabot.yml) or Renovate configuration detected.',
          evidence: { file: '.github/' },
          checkMethod: 'static_analysis',
          recommendation: 'Configure Dependabot or Renovate to automatically detect and patch vulnerable dependencies.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    }

    // --- Check 4: DEP-001 (Container Configuration) ---
    const dockerFiles = ['Dockerfile', 'docker-compose.yml', 'docker-compose.yaml', 'Containerfile'].filter(
      (f) => fs.existsSync(path.join(targetDir, f)) || fs.existsSync(path.join(projectDir, f))
    );

    if (dockerFiles.length > 0) {
      findings.push(
        this.createFinding({
          id: 'DEP-001',
          category: 'deployment',
          status: 'PASS',
          severity: 'info',
          title: 'Container Configuration Present (Dockerfile / Compose)',
          explanation: `Found containerization configuration: ${dockerFiles.join(', ')}.`,
          evidence: { file: dockerFiles[0] },
          checkMethod: 'static_analysis',
          recommendation: 'Verify non-root user execution and multi-stage build caching.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    } else {
      findings.push(
        this.createFinding({
          id: 'DEP-001',
          category: 'deployment',
          status: 'WARNING',
          severity: 'low',
          title: 'No Dockerfile or Container Configuration Found',
          explanation: 'No Dockerfile or docker-compose.yml detected in repository or target directory.',
          evidence: { file: target.path },
          checkMethod: 'static_analysis',
          recommendation: 'Add a multi-stage Dockerfile to standardize production builds and container deployment.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    }

    // --- Check 5: DEP-004 (Continuous Integration Workflow) ---
    const ghWorkflows = path.join(projectDir, '.github', 'workflows');
    const hasGhWorkflows = fs.existsSync(ghWorkflows) && fs.readdirSync(ghWorkflows).some((f) => f.endsWith('.yml') || f.endsWith('.yaml'));
    const hasGitlabCi = fs.existsSync(path.join(projectDir, '.gitlab-ci.yml'));

    if (hasGhWorkflows || hasGitlabCi) {
      findings.push(
        this.createFinding({
          id: 'DEP-004',
          category: 'deployment',
          status: 'PASS',
          severity: 'info',
          title: 'Continuous Integration Workflow Configured',
          explanation: `Detected automated CI workflow: ${hasGhWorkflows ? '.github/workflows' : '.gitlab-ci.yml'}.`,
          evidence: { file: hasGhWorkflows ? '.github/workflows' : '.gitlab-ci.yml' },
          checkMethod: 'static_analysis',
          recommendation: 'Ensure CI runs lint, typecheck, test, and security audit on every pull request.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    } else {
      findings.push(
        this.createFinding({
          id: 'DEP-004',
          category: 'deployment',
          status: 'WARNING',
          severity: 'high',
          title: 'Missing CI/CD Workflow Automation',
          explanation: 'No GitHub Actions workflows or GitLab CI configurations detected.',
          evidence: { file: '.github/' },
          checkMethod: 'static_analysis',
          recommendation: 'Configure CI to automatically test and validate builds before deployment (envguard-ci).',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
          targetPath: target.path,
        })
      );
    }

    return findings;
  }

  getLimitations() {
    return [
      'Static analysis scans top-level and Git-tracked paths; untracked binaries or archives are not decompiled.',
      'Containerfile quality checks do not verify live Docker daemon build steps or registry image signatures.',
    ];
  }
}
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 321kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 321kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 321kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall