selfware 0.2.0

Your personal AI workshop — software you own, software that lasts
Documentation
# Selfware QA Configuration Schema
# Defines quality assurance profiles for agentic code generation

qa_profile:
  name: "standard"
  description: "Standard QA profile for agentic code generation across multiple languages"
  version: "1.0"
  
  # Stages define the pipeline steps for quality validation
  stages:
    - name: "syntax"
      description: "Syntax validation - ensure code compiles/parses"
      required: true
      fail_fast: true
      timeout_seconds: 60
      tools:
        rust: 
          - command: "cargo check"
            env:
              RUST_BACKTRACE: "1"
        python:
          - command: "python -m py_compile"
        nodejs:
          - command: "tsc --noEmit"
        typescript:
          - command: "tsc --noEmit"
    
    - name: "format"
      description: "Format validation - ensure consistent code style"
      required: true
      fail_fast: true
      timeout_seconds: 30
      tools:
        rust:
          - command: "cargo fmt -- --check"
        python:
          - command: "ruff format --check"
        nodejs:
          - command: "prettier --check"
        typescript:
          - command: "prettier --check"
    
    - name: "lint"
      description: "Code quality checks - static analysis"
      required: true
      fail_fast: false
      timeout_seconds: 120
      tools:
        rust:
          - command: "cargo clippy -- -D warnings"
            env:
              RUSTFLAGS: "-D warnings"
        python:
          - command: "ruff check"
        nodejs:
          - command: "eslint"
        typescript:
          - command: "eslint"
    
    - name: "typecheck"
      description: "Type checking - validate type correctness"
      required: true
      fail_fast: false
      timeout_seconds: 120
      tools:
        rust:
          - command: "cargo check --all-features"
        python:
          - command: "mypy"
        nodejs:
          - command: "tsc --noEmit"
        typescript:
          - command: "tsc --noEmit --strict"
    
    - name: "test"
      description: "Unit and integration tests"
      required: true
      fail_fast: false
      timeout_seconds: 300
      coverage_threshold: 80
      tools:
        rust:
          - command: "cargo test --all-features"
          - command: "cargo tarpaulin --out Xml --fail-under 80"
        python:
          - command: "pytest --cov=src --cov-report=xml --cov-fail-under=80"
        nodejs:
          - command: "vitest run --coverage"
        typescript:
          - command: "vitest run --coverage"
    
    - name: "security"
      description: "Security scanning - vulnerabilities and secrets"
      required: true
      fail_fast: false
      timeout_seconds: 180
      severity_threshold: "HIGH"
      tools:
        rust:
          - command: "cargo audit"
          - command: "cargo deny check"
        python:
          - command: "bandit -r src/"
          - command: "safety check"
        nodejs:
          - command: "npm audit --audit-level=moderate"
        typescript:
          - command: "npm audit --audit-level=moderate"
    
    - name: "performance"
      description: "Performance benchmarks"
      required: false
      fail_fast: false
      timeout_seconds: 600
      tools:
        rust:
          - command: "cargo bench"
        python:
          - command: "pytest --benchmark-only"
        nodejs:
          - command: "vitest bench"
        typescript:
          - command: "vitest bench"

  # Quality gates define pass/fail criteria
  quality_gates:
    - stage: "syntax"
      fail_on_error: true
      description: "Code must compile/parses successfully"
    
    - stage: "format"
      fail_on_error: true
      description: "Code must follow formatting standards"
    
    - stage: "lint"
      fail_on_error: true
      max_warnings: 0
      description: "No linting errors allowed"
    
    - stage: "typecheck"
      fail_on_error: true
      description: "All type checks must pass"
    
    - stage: "test"
      fail_on_error: true
      min_coverage: 80
      description: "All tests must pass with minimum 80% coverage"
    
    - stage: "security"
      fail_on_error: true
      severity_threshold: "HIGH"
      description: "No HIGH or CRITICAL security issues"

  # Coverage configuration
  coverage:
    min_overall: 80
    min_per_file: 70
    exclude_patterns:
      - "**/tests/**"
      - "**/test_*.py"
      - "**/*_test.rs"
      - "**/*.spec.ts"
      - "**/main.rs"
      - "**/main.py"
      - "**/index.js"
      - "**/cli.rs"
      - "**/cli.py"
    
  # Scoring weights for quality calculation
  scoring:
    weights:
      syntax: 0.10
      format: 0.05
      lint: 0.15
      typecheck: 0.10
      test: 0.30
      coverage: 0.20
      security: 0.10
    
    grade_thresholds:
      S: 95
      A: 90
      B: 80
      C: 70
      D: 60
      F: 0

  # Feedback loop configuration
  feedback_loops:
    auto_fix:
      enabled: true
      max_iterations: 3
      triggers:
        - lint_errors
        - format_issues
        - type_errors
      
    retry_with_context:
      enabled: true
      max_iterations: 2
      triggers:
        - test_failures
        - coverage_below_threshold
      context_injection:
        - error_messages
        - stack_traces
        - coverage_report
        - failed_test_output
    
    escalation:
      enabled: true
      triggers:
        - security_vulnerabilities
        - max_iterations_exceeded
        - quality_score_below: 70
      actions:
        - notify_human
        - create_issue
        - halt_pipeline

  # Language-specific overrides
  language_overrides:
    rust:
      coverage:
        min_overall: 80
        tool: "tarpaulin"
      additional_checks:
        - command: "cargo doc --no-deps"
          description: "Documentation generation"
    
    python:
      coverage:
        min_overall: 80
        tool: "pytest-cov"
      additional_checks:
        - command: "python -m doctest"
          description: "Doctest validation"
    
    nodejs:
      coverage:
        min_overall: 80
        tool: "v8"
    
    typescript:
      coverage:
        min_overall: 80
        tool: "v8"

---
# Alternative profiles for different use cases

qa_profile:
  name: "strict"
  description: "Strict QA profile for production-critical code"
  extends: "standard"
  
  quality_gates:
    - stage: "test"
      fail_on_error: true
      min_coverage: 90
    
    - stage: "security"
      fail_on_error: true
      severity_threshold: "MEDIUM"
  
  scoring:
    grade_thresholds:
      S: 98
      A: 95
      B: 90

---

qa_profile:
  name: "minimal"
  description: "Minimal QA profile for rapid prototyping"
  extends: "standard"
  
  stages:
    - name: "syntax"
      required: true
    - name: "test"
      required: true
      coverage_threshold: 50
    - name: "security"
      required: true
      severity_threshold: "CRITICAL"
  
  quality_gates:
    - stage: "test"
      min_coverage: 50
    
    - stage: "security"
      severity_threshold: "CRITICAL"