Skip to main content
Try the Git workspace provider without touching a repository you care about: the file makes its own temporary repository, forks a child worktree from it, checks the child, and deletes both at the end. Use it to see the whole cycle once before you wire the provider into a run. The API and its limits are on the workspace contract.

Run it

Set the project up as Installation describes and run the file. It needs Git and nothing else:
Terminal
Output
revision is the HEAD read from the child worktree, anchor the digest of the captured anchor the lease covered, and branch the Git ref of the child branch.

The file

examples/workspace.ts
The file checks five things, and throws at the first that fails:
  1. Repository. It creates a Git repository with a committed README.md.
  2. Anchor. It captures the repository and verifies the anchor before use.
  3. Lease and fork. It acquires one writer lease and creates a child worktree from the captured revision.
  4. Child state. It reads the child HEAD and README.md, and throws if the revision or the file contents differ from the captured repository.
  5. Cleanup. A finally block removes the temporary root, which holds both the repository and its sibling worktree directory.

Next steps

  • Workspace contract: scoped capture, leases, the fork failure kinds and where child worktrees live.
  • Workspace: isolated(), the step wrapper that runs this cycle and lands the work back on pass.