fn ensure(project: string, localPath?: string, protocol?: enum, ref?: string)
Clone the repo if it doesn't exist locally, or fetch + pull if it does.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path (e.g. myorg/my-repo, team/infra-dns). |
| localPath? | string | no | Override the computed local path. |
| protocol? | enum | no | Override the global clone protocol for this project. |
| ref? | string | no | Checkout this branch/tag after clone or fetch instead of the default branch. |
fn branch(project: string, branch: string, localPath?: string)
Switch to a branch. If it exists on the remote, tracks it.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| branch | string | yes | Branch name to switch to or create (e.g. feat/add-txt-record). |
| localPath? | string | no | Override the computed local path. |
fn read_file(project: string, path: string, localPath?: string)
Read a file from the workspace. Run ensure first to clone.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| path | string | yes | File path relative to repo root. |
| localPath? | string | no | Override the computed local workspace path. |
fn list_files(project: string, pattern?: string, localPath?: string)
List tracked files matching a pattern (via git ls-files).
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| pattern? | string | no | Glob pattern or directory (e.g. 'terraform/**/*.tf'). Default: all tracked files. |
| localPath? | string | no | Override the computed local workspace path. |
fn commit(project: string, message: string, files?: array, amend?: boolean, localPath?: string)
Stage files and commit. Message should follow commitFormat if set.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| message | string | yes | Commit message. |
| files? | array | no | Files to stage (relative to repo root). Omit to stage all changes. |
| amend? | boolean | no | Amend the last commit instead of creating a new one. Default: false. |
| localPath? | string | no | Override the computed local workspace path. |
fn push(project: string, force?: boolean, localPath?: string)
Push the current branch to origin with -u tracking.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| force? | boolean | no | Force push (--force-with-lease). Default: false. |
| localPath? | string | no | Override the computed local workspace path. |
fn rm(project: string, files: array, localPath?: string)
Stage file deletions via git rm. Files are removed from the working
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| files | array | yes | Files to remove (relative to repo root). |
| localPath? | string | no | Override the computed local workspace path. |
fn status(project: string, localPath?: string)
Show workspace status: current branch, clean/dirty, modified files, ahead/behind remote.
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| localPath? | string | no | Override the computed local workspace path. |
fn diff(project: string, ref?: string, nameOnly?: boolean, localPath?: string)
Show diff output. Defaults to working tree diff; provide a ref to diff against (e.g. origin/main, HEAD~3).
| Argument | Type | Required | Description |
|---|
| project | string | yes | Project path. |
| ref? | string | no | Ref to diff against (e.g. origin/main, HEAD~1). Default: working tree diff. |
| nameOnly? | boolean | no | Only list changed file names, no patch content. Default: false. |
| localPath? | string | no | Override the computed local workspace path. |
Resources
workspace(1h)— State of a cloned/updated workspace
branch(1h)— Created branch metadata
file(30m)— Contents of a file read from the workspace
files(30m)— File listing from the workspace
commit(infinite)— Result of a git commit
push(infinite)— Result of a git push
rm(30m)— Result of staged file removals
status(5m)— Current workspace status (branch, clean/dirty, ahead/behind)
diff(10m)— Diff output between refs or working tree