Git
Git repository operations for swamp workflows. Wraps the git CLI and returns structured data (file lists, commit objects, status entries) instead of raw text, making git operations composable in swamp workflows.
Designed for CI automation: change detection via diff, dirty-tree checks via status, push/sync verification via upstream_state, bot commits, branch management, re-runnable checkouts via ensure_checkout, and per-work-item worktrees via ensure_worktree and verify_worktree.
Methods
| Method | What it does |
|---|---|
clone |
Clone a repository with configurable depth, branch, and auth. |
ensure_checkout |
Idempotent clone-or-update: clone when absent, fetch and optionally force-reset a checkout of the same repository, refuse anything else. |
diff |
Show changes between refs — name-only file lists, stat summaries, or full diffs. |
worktree_diff |
Read-only working-tree diff — staged, unstaged, and untracked changes vs a base ref. |
status |
Working tree status with structured entries and clean/dirty flag. |
remote_ref |
Look up the SHA of a named ref on a remote via git ls-remote (read-only). |
upstream_state |
Tracking-branch state: configured upstream, tracking-ref availability, ahead/behind counts, pushed/synced flags. |
is_ancestor |
Check if one commit is an ancestor of another (read-only, via git merge-base --is-ancestor). |
log |
Commit history with structured entries (SHA, author, date, message). |
commit |
Stage files and create a commit, optionally at a chosen author/committer date. |
amend |
Amend the most recent commit — rewrite message, staged content, and/or dates. Records old and new SHA. |
push |
Push commits to a remote (with optional force, force-with-lease, and set-upstream). |
pull |
Pull changes from a remote (with optional rebase and ff-only). |
fetch |
Fetch refs from a remote with optional tag and prune support. |
cherry_pick |
Cherry-pick commits or abort an in-progress cherry-pick. |
branch |
Create, switch, or list branches (supports orphan branch creation; force makes create re-runnable). |
config |
Get or set git configuration values. |
ensure_worktree |
Idempotently prepare one worktree and branch per work item: fetch an exact base, create or safely reuse a verified worktree, refuse unrelated or overlapping paths, keep in-progress rework. |
verify_worktree |
Read-only, fail-closed check of a worktree against branch, base lineage, root, and remote. |
remove_worktree |
Safely remove a registered clean secondary worktree — refuses the primary checkout and dirty worktrees. |
Usage
swamp extension pull @swamp/git
swamp model create @swamp/git repo
swamp model edit repo
swamp model method run repo diff \
--input base=HEAD~1 \
--input nameOnly=true \
--input 'paths:json=["*/manifest.yaml"]' \
--jsonResources
Modified 1 behaviors
Modified 1 behaviors
Modified 1 behaviors
Modified 1 behaviors
Modified 1 behaviors
Modified 1 behaviors
Modified 1 behaviors
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Docs keep secrets in a vault0/1missing
- files/README.md--Line 244 sets the secret `--input token` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
- files/README.md--Line 261 sets the secret `--input token` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
Fix or accept each secret-unsafe-docs warning: the README, the manifest description and describe strings should store secrets with `swamp vault put <vault> <key>` (it prompts for the value) and pass them as `${{ vault.get(<vault>, <key>) }}`.
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned