# @jigs-ai/jigs v0.110.4

Prepare a run-owned worktree for a configured GitHub binding.

`provisionWorktree` cuts the run's own branch and working copy from the
binding's clone; `provisionPullRequestWorktree` checks out a pull request's
head instead. Call their generated `#jigs/steps` wrappers from workflow code so a resumed
workflow receives the recorded workspace information. The low-level functions
here belong inside a factory-owned `"use step"` implementation.

## Worktrees

### PullRequestWorktreeRequest

The binding and pull request used to provision a worktree at the pull request's head.

#### Properties

##### binding

> **binding**: `string`

The binding whose repository the pull request is on.

##### number

> **number**: `number`

The pull request's number.

***

### WorktreeRequest

The binding and branch used to provision a run's worktree.

#### Properties

##### binding

> **binding**: `string`

##### branch

> **branch**: `string`

The branch name to start from; the run's own branch adds a suffix from its run ID.

***

### listBindings()

> **listBindings**(): `RepositoryRef` & `object`[]

Every binding in the factory's configuration, with the repository it points at.

#### Returns

`RepositoryRef` & `object`[]

***

### provisionPullRequestWorktree()

> **provisionPullRequestWorktree**(`request`, `metadata`): `Promise`\<`PullRequestWorktree`\>

Check out a pull request's current head in a worktree of its own, and prepare its files and
dependencies.

#### Parameters

##### request

[`PullRequestWorktreeRequest`](#pullrequestworktreerequest)

##### metadata

`RunMetadata`

#### Returns

`Promise`\<`PullRequestWorktree`\>

#### Remarks

Only a pull request from a branch of the binding's own repository is checked out, never one
from a fork, because the binding's setup runs the pull request's code. The worktree has no
branch, so nothing in it is pushed. Each head gets its own worktree, so a
run that provisions again after a push gets the new head beside the old one. Pass the returned
`headSha` to `mergePullRequest` to merge only the commit that was checked.

***

### provisionWorktree()

> **provisionWorktree**(`request`, `metadata`): `Promise`\<`Worktree`\>

Create this run's own branch and worktree from the default branch, and prepare its files and
dependencies.

#### Parameters

##### request

[`WorktreeRequest`](#worktreerequest)

##### metadata

`RunMetadata`

#### Returns

`Promise`\<`Worktree`\>

#### Remarks

Every run gets a new branch, so a run never picks up another run's work. The returned
`branch` is the one to push and open a pull request from.
