{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usemeridian-us/json-schema/usemeridian-us-worktree-create-schema.json",
  "title": "WorktreeCreate",
  "description": "Body for POST /projects/{id}/worktrees.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usemeridian-us-openapi.json#/components/schemas/WorktreeCreate",
  "properties": {
    "session_id": {
      "type": "string",
      "title": "Session Id",
      "description": "Session that owns this worktree."
    },
    "branch": {
      "type": "string",
      "minLength": 1,
      "title": "Branch",
      "description": "Git branch name, e.g. worktree/abc12345."
    },
    "path": {
      "type": "string",
      "minLength": 1,
      "title": "Path",
      "description": "Filesystem path of the worktree."
    },
    "item_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Item Id",
      "description": "Sprint item this worktree was created for."
    },
    "pid": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Pid",
      "description": "eb2e44f8 — OS PID of the process that created this worktree. Used by the cleanup guard to confirm no live process is still using the directory before it is removed from disk."
    },
    "base_sha": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Base Sha",
      "description": "eb2e44f8 — commit SHA the worktree was branched from. Supplying this together with base_branch persists an IMMUTABLE base manifest for the worktree, later checked before merge/completion is allowed to proceed. Omitting it skips manifest creation entirely (backward compatible)."
    },
    "base_branch": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Base Branch",
      "description": "eb2e44f8 — branch the worktree was branched from, e.g. 'dev'."
    },
    "repo_identity": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Repo Identity",
      "description": "eb2e44f8 — stable identity for the repo this worktree belongs to (e.g. a remote URL or repo name). Free-form; recorded on the base manifest for audit purposes only, never validated against disk. Defaults to project_id when omitted."
    }
  },
  "type": "object",
  "required": [
    "session_id",
    "branch",
    "path"
  ]
}