{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.connectsoft.ai/reference/schemas/change-set.schema.json",
  "title": "ChangeSet and PullRequestProposal (change-set-v1, pull-request-proposal-v1)",
  "description": "Outputs of engineering agents: a change set produced in a sandboxed worktree (never pushed without approval) and the proposal to open a pull request, which is a shared-write action bound to the change-set hash.",
  "$defs": {
    "ChangeSet": {
      "type": "object", "required": ["changeSetId", "repository", "baseRevision", "files", "hash", "build", "tests"], "additionalProperties": false,
      "properties": {
        "changeSetId": { "type": "string", "format": "uuid" },
        "repository": { "type": "string" }, "baseRevision": { "type": "string" }, "branch": { "type": "string", "description": "Draft branch in the sandbox worktree." },
        "files": { "type": "array", "items": { "type": "object", "required": ["path", "change"], "properties": { "path": { "type": "string" }, "change": { "enum": ["added", "modified", "deleted", "renamed"] }, "linesAdded": { "type": "integer" }, "linesRemoved": { "type": "integer" } } } },
        "diffRef": { "type": "string", "description": "Artifact reference of the unified diff." },
        "hash": { "type": "string" },
        "build": { "type": "object", "required": ["status"], "properties": { "status": { "enum": ["passed", "failed", "skipped"] }, "logRef": { "type": "string" } } },
        "tests": { "type": "object", "required": ["status"], "properties": { "status": { "enum": ["passed", "failed", "skipped"] }, "passed": { "type": "integer" }, "failed": { "type": "integer" }, "resultsRef": { "type": "string" } } },
        "summary": { "type": "string" },
        "riskNotes": { "type": "array", "items": { "type": "string" } }
      }
    },
    "PullRequestProposal": {
      "type": "object", "required": ["changeSetId", "changeSetHash", "targetBranch", "title", "body"], "additionalProperties": false,
      "properties": {
        "changeSetId": { "type": "string", "format": "uuid" }, "changeSetHash": { "type": "string" },
        "targetBranch": { "type": "string" }, "title": { "type": "string", "maxLength": 200 }, "body": { "type": "string" },
        "reviewers": { "type": "array", "items": { "type": "string" } }, "labels": { "type": "array", "items": { "type": "string" } },
        "linkedWorkItems": { "type": "array", "items": { "type": "string" } }
      }
    }
  },
  "oneOf": [{ "$ref": "#/$defs/ChangeSet" }, { "$ref": "#/$defs/PullRequestProposal" }]
}
