{
  "schema": "kb.plugin/3",
  "id": "@kb-labs/qa",
  "version": "0.1.0",
  "configSection": "qa",
  "display": {
    "name": "QA Plugin",
    "description": "Smart wrapper around kb-devkit — history, trends, baseline diffing, and health UI",
    "tags": [
      "qa",
      "quality",
      "baseline",
      "regression",
      "devkit"
    ]
  },
  "platform": {
    "requires": [],
    "optional": [
      "cache",
      "analytics",
      "logger"
    ]
  },
  "cli": {
    "groupMeta": [
      {
        "path": "qa",
        "describe": "Quality assurance powered by kb-devkit"
      },
      {
        "path": "qa baseline",
        "describe": "Baseline management"
      },
      {
        "path": "qa ci",
        "describe": "CI evidence and reliability analysis"
      },
      {
        "path": "qa ci evidence",
        "describe": "Immutable CI evidence capture"
      }
    ],
    "commands": [
      {
        "path": "qa run",
        "category": "Run",
        "describe": "Run devkit tasks and record results",
        "operationType": "execute",
        "handler": "./cli/commands/qa-run.js#default",
        "flags": [
          {
            "name": "tasks",
            "type": "string",
            "description": "Comma-separated tasks to run (default: build,lint,type-check,test)"
          },
          {
            "name": "save",
            "type": "boolean",
            "default": true,
            "description": "Save snapshot to history"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa check",
        "category": "Run",
        "describe": "Run devkit structural checks",
        "operationType": "analyze",
        "handler": "./cli/commands/qa-check.js#default",
        "flags": [
          {
            "name": "save",
            "type": "boolean",
            "default": true,
            "description": "Save snapshot to history"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa stats",
        "category": "Run",
        "describe": "Show devkit health score and category breakdown",
        "operationType": "read",
        "handler": "./cli/commands/qa-stats.js#default",
        "flags": [
          {
            "name": "save",
            "type": "boolean",
            "default": true,
            "description": "Save snapshot to history"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa gate",
        "category": "Run",
        "describe": "Run pre-commit gate check (exits 1 if violations found)",
        "operationType": "analyze",
        "handler": "./cli/commands/qa-gate.js#default",
        "flags": [
          {
            "name": "save",
            "type": "boolean",
            "default": false,
            "description": "Save snapshot to history"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa history",
        "category": "History",
        "describe": "Show QA run history",
        "operationType": "read",
        "handler": "./cli/commands/qa-history.js#default",
        "flags": [
          {
            "name": "limit",
            "type": "number",
            "default": 20,
            "description": "Max entries to show"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa trends",
        "category": "History",
        "describe": "Show QA quality trends over time",
        "operationType": "read",
        "handler": "./cli/commands/qa-trends.js#default",
        "flags": [
          {
            "name": "window",
            "type": "number",
            "default": 10,
            "description": "Number of history entries to analyze"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa e2e flaky",
        "category": "History",
        "describe": "Track flaky e2e cases across CI runs (agent-first overview + drill-down)",
        "operationType": "read",
        "handler": "./cli/commands/qa-e2e-flaky.js#default",
        "flags": [
          {
            "name": "agent",
            "type": "boolean",
            "default": false,
            "description": "Emit compact machine-readable agent JSON (alias for --json)"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          },
          {
            "name": "case",
            "type": "string",
            "description": "Drill down into one case: \"<suite>/<spec>#<testId>\" (from the overview's \"top\" list)"
          },
          {
            "name": "window",
            "type": "number",
            "default": 10,
            "description": "Number of e2e-flaky history entries (runs) to analyze"
          },
          {
            "name": "sync",
            "type": "boolean",
            "default": false,
            "description": "Fetch the latest flaky history from the \"ci-data\" branch before analyzing"
          },
          {
            "name": "ingest",
            "type": "string",
            "description": "CI-only: directory of per-shard flaky-report.json files to merge and save as a new snapshot"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa ci evidence capture",
        "category": "CI",
        "describe": "Capture a GitHub Actions run dossier (CI producer command)",
        "operationType": "execute",
        "handler": "./cli/commands/qa-ci-evidence-capture.js#default",
        "flags": [
          {
            "name": "runId",
            "type": "string",
            "description": "GitHub Actions run ID (defaults to GITHUB_RUN_ID)"
          },
          {
            "name": "repository",
            "type": "string",
            "description": "GitHub repository in owner/name form (defaults to GITHUB_REPOSITORY)"
          },
          {
            "name": "output",
            "type": "string",
            "default": ".kb/qa/ci/dossier.json",
            "description": "Path for the immutable dossier JSON"
          },
          {
            "name": "excludeJob",
            "type": "string",
            "description": "Comma-separated job names to exclude from evidence (for example, the collector job itself)"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output the captured dossier as JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa ci evidence sync",
        "category": "CI",
        "describe": "Download new CI evidence artifacts into a local cache",
        "operationType": "execute",
        "handler": "./cli/commands/qa-ci-evidence-sync.js#default",
        "flags": [
          {
            "name": "repository",
            "type": "string",
            "description": "GitHub repository in owner/name form (defaults to config or GITHUB_REPOSITORY)"
          },
          {
            "name": "workflow",
            "type": "string",
            "default": "e2e-platform.yml",
            "description": "GitHub Actions workflow file or name"
          },
          {
            "name": "limit",
            "type": "number",
            "default": 50,
            "description": "Recent workflow runs to inspect for evidence artifacts"
          },
          {
            "name": "output",
            "type": "string",
            "default": ".kb/qa/ci/evidence",
            "description": "Local evidence cache directory"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output sync details as JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa ci overview",
        "category": "CI",
        "describe": "Show a compact CI reliability overview",
        "operationType": "read",
        "handler": "./cli/commands/qa-ci-overview.js#default",
        "flags": [
          {
            "name": "input",
            "type": "string",
            "default": ".kb/qa/ci",
            "description": "Dossier JSON file or directory containing dossier.json files"
          },
          {
            "name": "output",
            "type": "string",
            "description": "Optional file to receive the compact agent-ready JSON overview"
          },
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output the agent-ready reliability overview as JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa regressions",
        "category": "History",
        "describe": "Detect regressions since last run",
        "operationType": "read",
        "handler": "./cli/commands/qa-regressions.js#default",
        "flags": [
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa baseline update",
        "category": "Baseline",
        "describe": "Run check + stats and save as new baseline",
        "operationType": "mutate",
        "handler": "./cli/commands/baseline-update.js#default",
        "flags": [
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa baseline status",
        "category": "Baseline",
        "describe": "Show current baseline",
        "operationType": "read",
        "handler": "./cli/commands/baseline-status.js#default",
        "flags": [
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      },
      {
        "path": "qa baseline diff",
        "category": "Baseline",
        "describe": "Diff current state against baseline",
        "operationType": "read",
        "handler": "./cli/commands/baseline-diff.js#default",
        "flags": [
          {
            "name": "json",
            "type": "boolean",
            "default": false,
            "description": "Output JSON"
          }
        ],
        "permissions": {
          "fs": {
            "read": [
              ".kb/**",
              "**"
            ],
            "write": [
              ".kb/**",
              "**"
            ]
          },
          "env": {
            "read": [
              "HOME",
              "USER",
              "PATH",
              "TMPDIR",
              "NODE_ENV",
              "KB_*"
            ]
          },
          "shell": {
            "allow": [
              "kb-devkit",
              "git",
              "gh"
            ]
          },
          "platform": {
            "analytics": true
          },
          "quotas": {
            "timeoutMs": 600000,
            "memoryMb": 512
          }
        }
      }
    ]
  },
  "rest": {
    "basePath": "/v1/plugins/qa",
    "routes": [
      {
        "method": "GET",
        "path": "/summary",
        "handler": "./rest/handlers/summary-handler.js#default"
      },
      {
        "method": "POST",
        "path": "/run",
        "handler": "./rest/handlers/run-handler.js#default"
      },
      {
        "method": "POST",
        "path": "/check",
        "handler": "./rest/handlers/check-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/stats",
        "handler": "./rest/handlers/stats-handler.js#default"
      },
      {
        "method": "POST",
        "path": "/gate",
        "handler": "./rest/handlers/gate-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/history",
        "handler": "./rest/handlers/history-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/trends",
        "handler": "./rest/handlers/trends-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/regressions",
        "handler": "./rest/handlers/regressions-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/baseline",
        "handler": "./rest/handlers/baseline-handler.js#default"
      },
      {
        "method": "POST",
        "path": "/baseline/update",
        "handler": "./rest/handlers/baseline-update-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/baseline/diff",
        "handler": "./rest/handlers/baseline-diff-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/packages/:name/timeline",
        "handler": "./rest/handlers/package-timeline-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/tasks",
        "handler": "./rest/handlers/tasks-handler.js#default"
      },
      {
        "method": "GET",
        "path": "/ci/overview",
        "handler": "./rest/handlers/ci-overview-handler.js#default"
      }
    ]
  },
  "studio": {
    "version": 2,
    "remoteName": "qaPlugin",
    "pages": [
      {
        "id": "qa.overview",
        "title": "QA",
        "icon": "ExperimentOutlined",
        "route": "/p/qa",
        "entry": "./QADashboard",
        "order": 1
      }
    ],
    "menus": [
      {
        "id": "qa",
        "label": "QA",
        "icon": "ExperimentOutlined",
        "target": "qa.overview",
        "order": 50
      }
    ]
  },
  "permissions": {
    "fs": {
      "read": [
        ".kb/**",
        "**"
      ],
      "write": [
        ".kb/**",
        "**"
      ]
    },
    "env": {
      "read": [
        "HOME",
        "USER",
        "PATH",
        "TMPDIR",
        "NODE_ENV",
        "KB_*"
      ]
    },
    "shell": {
      "allow": [
        "kb-devkit",
        "git",
        "gh"
      ]
    },
    "platform": {
      "analytics": true
    },
    "quotas": {
      "timeoutMs": 600000,
      "memoryMb": 512
    }
  }
}
