---
url: https://salimhamed.github.io/jigs/api/steps/workspaces.md
---
# steps/workspaces

Provision a repository worktree outside workflow code.

Wrap steps in a factory-owned `"use step"` file. Never call them directly from a workflow.

## Interfaces

### ProvisionWorktreeDependencies

Injectable registry and ownership operations used while provisioning a worktree.

#### Properties

| Property | Type |
| :------ | :------ |
|  `readOwner?` | (`runId`) => `Promise`<`OwnerState`> |
|  `sql?` | `RegistrySql` |
|  `withLock?` | <`T`>(`runId`, `action`) => `Promise`<`T`> |

***

### WorktreeRequest

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

#### Properties

| Property | Type |
| :------ | :------ |
|  `binding` | `string` |
|  `branch` | `string` |

## Functions

### provisionWorktree()

```ts
function provisionWorktree(
   request, 
   metadata, 
deps): Promise<Worktree>;
```

Create or reuse a worktree for this run and prepare its files and dependencies.

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `request` | [`WorktreeRequest`](#worktreerequest) |
| `metadata` | [`RunMetadata`](../steps.md#runmetadata) |
| `deps` | [`ProvisionWorktreeDependencies`](#provisionworktreedependencies) |

#### Returns

`Promise`<[`Worktree`](../jigs.md#worktree)>
