SwarmOps

Page kind: Reference

Coming from git#

Describes stable at baaeb9b8, ; latest release v0.11.0what changedLast changed View as Markdown

Where a SwarmOps operation does what a git command does, so <git verb> runs it, with git's flags where they mean the same. Where the meaning differs the command keeps its own name (land is not merge), and the git verb is refused, exit 2, with one line first in error.hint that names what to type. Nothing looks like git and does something else: so is not a drop-in for the git binary, and a line that ran before git's verbs were read runs as it did.

A git verb that runs is read as the command it stands for (so status is so ws status): the envelope, its op, the help (so status --help) and a usage error are that command's, as the CLI reference gives them. A store has no working tree: status, restore and the bare forms of diff, commit and rebase need a workspace. Their paths are read from the workspace's root, not from the working directory as git's are; below the root a line that names paths is refused. The hints here are written with so; a hint names the program as it was run.

Text output#

Every command prints one JSON envelope unless text is asked for. --human prints text, in git's shape for status, log, diff and commit, and git's own shape flags ask for it too (so status -s, so log --oneline, so diff --stat). For text from every command:

Shell
export SWARMOPS_FORMAT=human

Classes#

ClassMeaning
SThe same verb does the same.
AThe same verb, read as the SwarmOps command of the same meaning.
DDifferent on purpose: the verb is refused, and the hint names what to type.
NNo such concept: the verb is refused, and the hint says what to do.
LA candidate for later: the notes say what would be built.

A row can carry two: one form of the verb runs, the others are refused with the hint. op is the operation the example's envelope names; a row without one is refused, and its example prints the hint.

Tier 1: everyday commands#

gitClassWhat to typeopExampleHint when refused
git initSso init DIR · so ws create NAMErepo_initso init store2—
git cloneA, Lso clone URL DIR · so ws create NAMEclone_reposo clone https://remote.invalid/x.git copy—
git statusAso statusws_statusso status—
git addNso commit -m MSG [PATH]...—so add a.txtgit add: there is no staging area; so commit -m MSG [PATH]... in a workspace takes every change, or the named paths
git rmNso commit -m MSG—so rm a.txtgit rm: delete the file in the workspace; so commit -m MSG records it
git mvNso commit -m MSG—so mv a.txt b.txtgit mv: move the file in the workspace; so commit -m MSG records it
git commitAso commit -m MSG [PATH]...ws_commitso commit -m x—
git diffS, Aso diff FROM TO · so diffws_diffso diff—
git logS, Aso log [REV] -n N --path Plogso log -1—
git showSso show REV · so cat REV:PATHshowso show main—
git branchD, Lso ref list · so ref set NAME REV --create · so ref delete NAME --expect ID—so branchgit branch: so ref list lists refs; so ref set NAME REV --create makes one; so ref delete NAME --expect ID removes one
git switchN, Lso ws create NAME --base REV—so switch maingit switch: a workspace does not switch; so ws create NAME --base REV makes another
git checkoutNso ws create NAME --base REV · so restore PATH...—so checkout maingit checkout: so ws create NAME --base REV for another tree; so restore PATH... to drop edits
git restoreAso restore PATH... · so ws discardws_discardso restore a.txtgit restore: name the paths, so restore PATH...; so ws discard drops every edit
git mergeDso ws land · so land HEAD—so merge maingit merge: SwarmOps lands; so ws land from a workspace, or so land HEAD
git rebaseS, Aso rebase HEAD --onto REF · so rebasews_rebaseso rebase—
git fetchS, Aso fetch REMOTE · so fetchfetchso fetch—
git pullDso sync REMOTE --no-push · so rebase—so pullgit pull: so sync REMOTE --no-push brings the remote into main; so rebase in a workspace follows it
git pushS, Aso push REMOTE [REF[:BRANCH]] · so pushpushso push—
git remoteS, Aso remote add NAME URL · so remote remove NAME · so remote list · so remoteremote_listso remote -v—
git tagA, Dso tag · so ref set tags/NAME REV --create · so ref delete tags/NAME --expect IDref_listso taggit tag: so tag lists; so ref set tags/NAME REV --create makes one; so ref delete tags/NAME --expect ID removes one
git stashD, Lso ws snapshot—so stashgit stash: so ws snapshot records the edits and leaves the files; nothing pops
git resetDso ws discard [PATH]... · so op undo OP—so resetgit reset: so ws discard [PATH]... drops edits; so op undo OP takes an operation back; so ref set moves a ref
git revertSso revert REV --reason TEXTrevertso revert main --reason x—
git cherry-pickN, Lso land HEAD --base BASE—so cherry-pick maingit cherry-pick: not built; so land HEAD --base BASE lands one change's range
git blameLso history REV:PATH—so blame a.txtgit blame: not built yet (M7); so history REV:PATH lists the changesets that touched a path
git grepNso cat REV:PATH—so grep xgit grep: search the files of a workspace; so cat REV:PATH reads one at a revision
git configNso whoami · so remote—so config user.namegit config: identity is --as or SWARMOPS_AGENT (so whoami); the store is --repo or SWARMOPS_REPO; remotes are so remote
git reflogAso reflog NAME · so op logref_logso reflog maingit reflog: so reflog NAME lists a ref's moves; so op log every operation; nothing expires

Notes on tier 1#

  • git init: Makes a store, no working tree; DIR is required. Then so ws create NAME. -b, --bare are not taken.
  • git clone: A: positional DIR (= --into). A store and no files, as git clone --bare; then so ws create NAME. Later: --ws NAME, a new flag: a working tree in the same step.
  • git status: -s, -b, -sb, --short, --branch ask for the text listing. Paths from the workspace's root.
  • git add: No staging area: a commit takes every change, or the named paths.
  • git rm: Delete the file in the workspace; the next commit records it.
  • git mv: Move the file in the workspace; the next commit records a delete and an add.
  • git commit: so commit --changes FILE keeps its meaning (the JSON change list). Takes every change, new files included unless an ignore file names them (git's -a leaves new files out); -a is accepted. Paths from the workspace's root. No --amend (D: so op undo, then commit again), no editor.
  • git diff: Lists the changed paths by default; -p for the patch. --stat, --name-status, -U<n>. Paths by --path P, not -- P, from the workspace's root. No A..B, no --staged.
  • git log: First parents, from main unless REV is given, also inside a workspace: its own commits are so log ID with the head so ws info gives. A: --oneline, -<n>. No --graph, --author, --since, ranges.
  • git show: The changeset and its changed paths, no patch. git show REV:PATH is so cat REV:PATH.
  • git branch: A ref list also holds tags/ and remote/; there is no current branch. Later: a branch verb once FORMAT 2 branches map to git refs (with M11).
  • git switch: A workspace never switches; make another. Later: unscheduled.
  • git checkout: Not offered under this name (git itself split it).
  • git restore: At least one path, as in git. A file never committed is deleted (git leaves an untracked file). Paths from the workspace's root; below the root the line is refused. . is no path (exit 2). No --staged, --source. Every edit: so ws discard.
  • git merge: One squashed changeset onto the target by compare-and-swap; no merge commit.
  • git rebase: Store form: one squashed changeset, no ref moves. Workspace form: the workspace follows its target; --continue, --abort, --onto there. No -i.
  • git fetch: main never moves on a fetch. No --all, --prune.
  • git pull: sync lands onto the remote's head and moves main; a workspace follows by its own rebase.
  • git push: Sends main unless REF is named; main and release/* only. Compare-and-swap, fast-forward only; no --force, -u, --tags.
  • git remote: so remote, so remote -v list; so remote rm removes. No rename, set-url.
  • git tag: FORMAT 2 stores. Lightweight only; a tag never moves.
  • git stash: Records the edits as a changeset and leaves the files; nothing pops. Later: unscheduled.
  • git reset: main moves forward only. A ref: so ref set NAME REV --expect ID.
  • git revert: Lands the inverse; --since for a range. The reason is required.
  • git cherry-pick: One change's range lands as one changeset. Later: M24 (rewriting with lineage).
  • git blame: The changesets that touched a path. Later: M7.
  • git grep: rg or grep in a workspace.
  • git config: There is no configuration command.
  • git reflog: A name is required (no store-level HEAD). Every operation: so op log. expire, delete, exists are refused with the hint: nothing expires.

Tier 2: commands scripts and CI use#

gitClassWhat to typeopExampleHint when refused
git rev-parseDso resolve REV · so ws info—so rev-parse maingit rev-parse: so resolve REV gives the full id; so ws info a workspace's head and path
git rev-listDso log REV -n N · so ancestry FROM TO—so rev-list maingit rev-list: so log REV -n N; so ancestry FROM TO
git ls-filesDso ls REV[:PATH]—so ls-filesgit ls-files: so ls REV[:PATH]
git ls-treeDso ls REV[:PATH] --depth N—so ls-tree maingit ls-tree: so ls REV[:PATH] --depth N
git cat-fileDso cat REV:PATH · so blob get ID · so blob has ID—so cat-file -p maingit cat-file: so cat REV:PATH; so blob get ID; so blob has ID
git hash-objectDso blob put FILE—so hash-object a.txtgit hash-object: so blob put FILE
git describeNso tag—so describegit describe: not built; so tag lists the tags
git for-each-refDso ref list [--prefix P]—so for-each-refgit for-each-ref: so ref list [--prefix P]
git show-refDso ref list—so show-refgit show-ref: so ref list
git symbolic-refNso ws info—so symbolic-ref HEADgit symbolic-ref: there are no symbolic refs; so ws info gives a workspace's head and target
git update-refDso ref set NAME REV --expect ID—so update-ref main maingit update-ref: so ref set NAME REV --expect ID, or --create; so ref delete; so ref txn
git merge-baseSso merge-base REV ONTO · so ancestry FROM TOmerge_baseso merge-base main main—
git name-revNso ref list—so name-rev maingit name-rev: not built; so ref list gives each ref's changeset
git ls-remoteDso fetch REMOTE · so ref list --prefix remote/REMOTE/ · so sync status REMOTE—so ls-remotegit ls-remote: so fetch REMOTE, then so ref list --prefix remote/REMOTE/; so sync status REMOTE
git diff-treeDso diff FROM TO --format names · so show REV—so diff-tree maingit diff-tree: so diff FROM TO --format names; so show REV
git worktreeA, Dso worktree list · so ws create NAME [--path DIR] [--base REV] · so ws list · so ws delete NAMEws_listso worktree listgit worktree: so ws create NAME [--path DIR] [--base REV]; so ws list; so ws delete NAME
git cleanNso ws discard PATH...—so clean -fgit clean: so ws discard PATH... drops the named paths' edits, new files included; without a path, every edit
git archiveN, Lso git export PATH—so archive maingit archive: git init --bare PATH, so git export PATH, then git archive there
git bisectN, L——so bisect startgit bisect: not built
git shortlogNso log—so shortloggit shortlog: so log, counted by author_agent

Notes on tier 2#

  • git ls-files: A workspace's files are plain files.
  • git ls-tree: JSON entries, not <mode> <type> <id>\t<path>.
  • git describe: Unscheduled.
  • git symbolic-ref: No symbolic refs; no store-level HEAD.
  • git merge-base: Along first parents, with what REV changed. --is-ancestor: so ancestry FROM TO.
  • git worktree: git names a path, SwarmOps a workspace name.
  • git archive: Later: M25 (archives).
  • git bisect: Later: unscheduled.

What is not done#

Not doneWhyWhat to do
A drop-in for the git binary (alias git=so, --porcelain, -z, git's exit codes, GIT_DIR)The JSON envelope is the machine contract; two contracts would have to be kept alike for ever.Scripts read the envelope. Stock git works against a store through swarmops serve, and so git export PATH writes a real git repository.
An index: add, rm --cached, restore --staged, diff --staged, commit -pAgents commit whole changes; a second state between the files and the store is one more thing to lose in a crash.so commit -m MSG PATH... commits the named paths only.
Interactive rebase, an editor for messagesNo terminal is assumed; a land squashes to one changeset anyway.so rebase in a workspace; -m everywhere; so op undo OP to take a step back.
checkoutTwo meanings in one verb.so ws create NAME --base REV; so restore PATH....
merge with a merge commit, --force on push, moving main backThe trunk moves forward only, by compare-and-swap.so land HEAD, so revert REV --reason TEXT.
git's revision words HEAD, ^, A..B, A...B, @{upstream}No store-level HEAD; first-parent history.main, a ref name, an id prefix, ~N, NAME@{N}; so ancestry FROM TO for a range.
stash pop, cherry-pick, blame, bisect, describe, archive, grepNot built.The hint of each, in the tables above.
git verbs as MCP toolsThe tools are the operations; an alias adds nothing an agent can call.The existing tools (ws_status, ws_commit, …).
Text by defaultOne rule for people and agents: an agent under a pseudo-terminal is never surprised.--human, SWARMOPS_FORMAT=human, or a shape flag (-s, --oneline, --stat).

On this page