Skip to content

Latest commit

 

History

History
78 lines (67 loc) · 21.5 KB

cli.md

File metadata and controls

78 lines (67 loc) · 21.5 KB

commands

The bercail CLI, the shell helpers, and the skills your agents call by name. bercail help prints a short version in your terminal, keys included.

install / CLI

Command What
bercail install Full install from the release mise or packslip unpacked
./install.sh Full install
./install.sh --yes (-y) Non-interactive
./install.sh --client <machine> (bercail install --client <machine>) Only the Herdr app half, for a laptop whose bercail runs on <machine> (its name in hc machine ls): the CLI, the layout, the mods, the keys and [herdr] backend. update, dry-run and doctor stay client-only after it; reconfigure refuses. From a clone, update deploys only a clean checkout of the latest release (BERCAIL_REF=<tag> names another, BERCAIL_REF=HEAD takes it as it sits). See install
./install.sh --help Installer help
bercail help This reference, preceded by bercail v<version> and Build: <commit> (or Build: dirty or Build: unknown)
bercail version The version and the build it runs (bercail <version> linux-x64). The first command ported to TypeScript (the compiled bercail): only the linux-x64, linux-arm64, darwin-arm64 and windows-x64 releases have it
bercail doctor Deps, Herdr layout, mod and keys, skills, the first pi an interactive $SHELL finds (a warning when it is older than lib/deps.json's minimum, with its version, its folder and, as a hint, the line of the shell's rc file that names that folder: new desks record that pi), each desk secret (present, 0600, service account, never the token), each todo target (whether its list answers, never the token), scratch folders that agent runs left behind, who holds or waits for a test slot, and each routine, with what is wrong with a bad one (with a routine declared, no flock or no routine loop running is a failure). On a client: the Herdr app, the layout, mods and keys, and that the backend answers with the same version and, when known, the same commit the client was deployed from
bercail scratch sweep Remove the scratch folders of agent runs that have ended (/var/tmp/bercail-<uid>/, see bstack). bercail doctor lists them with their size. scratch run -- CMD and scratch dir PID are what the role templates and the desk agent run
bercail bstack setup / status bstack: Pi on your own plans. No subcommand = status
bercail config get <section> <key> A config.toml value as bercail reads it: bercail config get layout review, bercail config get 'policy."~/Work/some-repo"' commit. An array prints as JSON. Prints nothing and exits 1 when the key is not set
bercail config set <section> <key> <value> / unset <section> <key> [--dry-run] Change one key bercail reads, and print the lines that changed as a diff. true, false and whole numbers go in bare, anything else as a string; a new key goes at the end of its table, a new table at the end of the file, and an unset drops a table it leaves empty. Every other line stays as it was, comments too; it refuses a multi-line value, a set of an array (a command routine's command), a table or key written twice, and a key bercail does not read. Agents may not run it; Shep's goes to a guard card that shows the diff and waits for you. A write needs your terminal or that card's --expect: with neither, as from an agent's shell, it prints the diff and writes nothing
bercail desk restore / --dry-run Bring back the desk agents a reboot or a core restart took, each on its session in its own space. See desks after a reboot. --dry-run lists each desk and what would happen to it
bercail desk restart DESK End an idle desk's Pi and start Pi again on its session in the same terminal, so it loads the bercail code an update installed; its space, labels and record stay. It refuses a desk that is working or blocked, has a follow-up or model switch waiting, or (on a desk extension from this release on) showed unsent text or queued messages when it last wrote them (each second), whose flags hold an API key, a background Shep, a desk hc does not keep, and a desk with no Pi it can start (which Pi). It succeeds only once the new Pi has opened the same session. bercail update names it for each desk on older code, and Shep runs it once the desk is idle (stale code)
bercail desk prompt DESK / desk answer DESK yes|no --prompt ID [--reason TEXT] [--dry-run] Read the confirm a desk's guard waits on, and answer it through a file the guard reads, never by typing into the desk; the answer goes on the desk's issue. See a desk's guard prompt
bercail update Re-sync configs, Herdr layout and mods, helper, skills, and bstack; restart the notify follower and the routine loop; then list each live Pi (Shep, desks, background Sheps, siblings) still running bercail extension code older than what is installed, and how to restart it; it restarts none, and names bercail desk restart for a desk (stale code). --force (-f) also replaces a changed layout and the worktrunk config, and writes the shell block despite conflicts
bercail review-pr <PR url-or-branch> / run / card / ui / state / select / checkout / rereview / open / dir / close Review a whole PR stack by intent and decisions: one visible review desk session, cards and a stack summary beside its worktree. bercail review-pr close <PR url> removes the stack's worktree, run dir and space when you are done. See review
bercail cleanup <worktree> Retire a finished worktree in one step: copy its ignored .bercail/ to ~/Work/worktree-archives/<repo>/<UTC stamp>-<checkout>/ (no other ignored file: copy any you need first), end its space's desk, the desk's siblings, every terminal they started, labelled or not (and, with no window here, the space's kept Shell), each parent before what it started so no child's end wakes one still to end, stop your own processes still running in the worktree (by their folder in /proc: a dev server a desk started detached, which no terminal holds; TERM, then KILL after 5 seconds; not a terminal still live just before, nor what it runs, whatever space it claims, though what the terminals left for the space's close run, such as the Herdr window's shells, is stopped), naming each by its pid and kernel name, never its arguments, remove the worktree, and close its space on this machine. The branch stays. The look before the stop says what to spare, and one that finds a terminal of the space at work stops the cleanup before the sweep signals anything; after the stop it looks again before the removal. A live terminal hc gives no whole pid stops it with exit 2. A process still in the worktree after that keeps it: one it could not stop, or one it had not listed, which it does not signal. One it had not listed gets up to 5 seconds to end first when its session held only processes it listed, as an rm a desk's last sweep or a trap starts on its way out does; one in any other session keeps it at once. Pi's bash tool starts each command in a session of its own; a desk's Pi, the desk wrapper's watcher, hc events and claude can share another, and cleanup waits for their leftovers when it listed every member. When git drops the worktree but a file written there meanwhile keeps its folder, cleanup keeps the folder and the space, and says how to finish with --gone. A commit counts as on trunk when trunk holds the same patch under another id (git cherry), or a replay of it: a commit with the same changed lines whose parent, with this commit merged onto it cleanly, gives that commit's tree, as when it was replayed onto a moved trunk that changed its context lines. Once the worktree is gone it adds a line to ~/.local/state/bercail/retired.jsonl, so dispatch can tell the job's desk went on purpose. It refuses, and changes nothing, when the worktree has uncommitted changes (staged, unstaged or new files), commits on neither trunk nor a remote branch, initialized submodules, or a lock, or is the main checkout, when a question Shep asked you still waits on the worktree, a folder in it, or a desk it would end (bercail shep questions --json; a land card whose chain runs does not, since its worker runs the cleanup), when a terminal it would end, or close with the space, is working or blocked, or when it runs from a terminal of that space. A terminal another space labels is never ended: one that would end with a terminal cleanup ends is a refusal, as are a terminal labelled for two spaces, two desks on the space, and an agent that reports no state. Before each terminal it ends, before it removes the worktree, and before it closes the space, it reads the space's terminals again, and stops when the worktree's space changed, or a terminal is working or blocked now, or stopped reporting its status, is not the process it checked (another pid or start time), has another parent, label or place in the tree, or joined the space since: it gives the reasons it found, the terminals it ended, and what stays. After each kill it waits up to 10 seconds for the terminals that die with it to finish, since hc clears their status a moment before they end. A terminal that ended with its parent is not ended again. When hc cannot list or end a terminal, it stops before it removes the worktree. With a window, it ends by printing the open and recent space counts the sidebar shows. The guard asks you first; Shep's goes to a guard card, which counts as an Allow if nobody answers it within the hour (it is local)
bercail cleanup --gone <path> Record that a checkout a handoff started was removed some other way (by hand, wt remove), so dispatch may start its job a new desk, as it does after bercail cleanup. Run it once you know nothing was lost there; dispatch names the path when it refuses. It refuses a path that is still there, one no handoff names, and one git still lists as a worktree (git worktree prune first). A folder a cleanup left partway, which holds no checkout: once git no longer lists it, stop what still writes there, move the folder aside, close its space by hand, then run --gone. It ends, closes and removes nothing. The guard asks you first in a desk; Shep's goes to a guard card, pinned to the path, its handoff's repo and branch (for a handoff from before records carried a repo, the main checkout whose <repo>.<branch> its path is, as worktrunk names it, once the job's issue in that repo's beads has the handoff comment naming the path and branch), or runs with no card where that repo's shep_may_run lists cleanup
bercail cleanup --check <worktree> Make every refusal bercail cleanup makes before it changes anything, change nothing, and say what it would do, processes it would stop included. It exits 1 on a refusal, and 2 when the Herdr app, hc, its helpers or Shep's question ledger did not answer (so does cleanup). It checks the archive folder could be made, but does not try the copy, so a file it cannot read still stops the cleanup itself. The guard lets it run; the cleanup routine reads it
bercail routine list [--json] / show <name> [--run <id>] / run <name> [--dry-run] / pause <name> / resume <name> / enable <name> [--at <when>] / disable <name> / ask <name> / tick / loop / start Your routines: see them (--json for the Routines panel), run one now under its locks (--dry-run prints what it would find and writes nothing), stop or restart one, declare a built-in or take it out of config.toml, send Shep your request about one (on stdin; the panel's Ask Shep), and the scheduler: start each one that is due, a tick a minute, and the hidden terminal that runs it
bercail reconfigure Re-read config.toml, refresh skills
bercail dry-run Show what install would do, without doing it
bercail uninstall Remove managed files and the shell marker
bercail notify run The follower that writes desk finishes and blocks to Shep's inbox; Shep and the desk mod keep it alive. It is the only notify command
bercail policy show [--json] [repo] / preview [repo] / trust [repo] / untrust [repo] A repo's git policy: each value and where it came from; what trust would trust (its sha256 and its diff against the version last trusted); trust the repo's .bercail/policy.toml so its looser values count, or forget it
bercail describe check [--json] / stamp / template / title / body / commit [--reviewed-by NAME] [dir] The change's description in .bercail/description.md: check it against the standard, the repo's PR template and the staged tree; record that tree and the desk's model; name the template; print the text for git commit -F - or --body-file - with its provenance line, refusing a stale or failing one. check also prints the change's size and stakes; commit refuses a change that waits for your review, in a repo that commits straight to main, until it gets --reviewed-by. See the change description
bercail land ask <worktree> Shep's one land card for a desk's change, where the repo's trusted policy says push = "main", integrate = "direct" and names required_ci: the person's pick on the panel starts a worker that commits, pushes a CI branch, waits for CI, pushes the trunk, cleans up the desk, syncs the main checkout and closes the job, then sends Shep one land event. It refuses, with the fix, what one pick cannot land
bercail land <worktree> [--reviewed-by NAME] [--ci-branch NAME] Shep's landing of a desk's branch: describe check, a refusal before any commit when the trunk moved past HEAD (and past a merge under way) and the policy says integrate = "direct" (a PR branch gets a warning), a commit with the described text (there, a desk's merge of the trunk's tip lands as one commit on that tip, never a merge commit), and a background wait for that commit's CI that ends in one land event in Shep's inbox: ready, failed, moved or timeout. Where the policy says integrate = "direct", the printed push targets a land-only ref, bercail-land/<branch>/<sha>, never the work branch, so a rebase needs no force push; in bercail's own GitHub repo ci.yml must pass there. --ci-branch names the branch of origin the commit goes to for CI when it is not the work branch. In an Entire repo it starts no wait: the trail's gates decide. It never pushes. Only Shep runs it (BERCAIL_ROLE=shep); the guard refuses it from every other role
bercail guard ask <id>, bercail guard check, bercail guard decide The guard's model-free worker for an ask it handed off from Shep's session, a guard card's live check ({op, facts} on stdin, {reasons} out), and the guard's decision on a command as Shep with the operation and facts it pins ({command, cwd} on stdin), which the land worker reads before each push and its cleanup. Only the guard starts the worker, on its own ticket: see guard asks
bercail job show trail:N [--repo DIR] [--json] / comment trail:N [--repo DIR] / list [--repo DIR] [--json] / merge trail:N [--change REPO/N] / supersede trail:N --with trail:M|COMMIT A trail job in an Entire repo: the trail's title, body and changes from Entire, with its comments on this machine; comment adds one (text on stdin), which is how a desk posts its report there; list is the repo's open trails, each ready or blocked by its Blocked by: line, with its local job record; id trail:N is the trail's Entire id and URL, project-wide, what a question binds to; merge is Shep's trail merge, which closes the trail once no change is open; supersede closes a trail whose work landed elsewhere, with a Superseded by: line in its body. Wherever a command below takes a beads id (ISSUE, --issue ID), it takes trail:N in an Entire repo
bercail shep status / run / bg --issue ID [--cwd DIR] Shep on Pi: its session folder, desk events, whether the routine loop runs, and live background Sheps. No subcommand = status; run is what the Shep view starts; bg starts a background Shep
bercail shep repos [--json] / board / brief ISSUE [--repo DIR] [--budget CHARS] What Shep knows: your known repos, one line per open job and what waits on you, and one issue's desk, state and latest report, cut short
bercail shep queue [--repo DIR] [--json] What waits on your review: staged desks and PRs, their size, stakes and state (review, LGTM, cleanup, superseded, stale, unknown), each repo against its review budget; --json for the Herdr app
bercail shep remember "RULE" [--scope SCOPE] / list / forget N Shep's standing rules, kept across sessions and compactions
bercail todo add "TITLE" [--notes TEXT] [--due YYYY-MM-DD] [--issue ID] [--repo DIR] [--target NAME] / list [--target NAME] [--json] / show ID / done ID / supersede ID [--by ID] [--reason TEXT] What only you can do, on one of your todo lists. add goes to --target, else the route of the job's repo (--repo, or the checkout of --issue), else the default, and prints the todo's link; --issue comments it on that beads issue, or on a trail's comments on this machine. supersede takes a todo the plan changed off your list, with a note, without marking it done. Shep adds them; the guard blocks the writes from desks
bercail todo target add NAME URL [--backend NAME] [--create "LIST"] [--json] / list [--json] / show NAME [--json] / rm NAME The lists todos go to, by name. add reads the list at URL first; a project's To-dos URL fails and lists its lists, or --create makes one there. rm drops its routes too
bercail todo route REPO TARGET / --default TARGET / --rm REPO / --rm --default Send a repo's todos (its main checkout, worktrees included) to a target, or set the default for the rest. Shep runs them; the guard blocks them from desks
bercail shep mistake KEY "WHAT" [--group ID] [--repo DIR] [--issue ID] / mistake group ID "NAME" --against process|tool|conduct [KEY...] / mistake list [--json] Shep's mistakes ledger, by group: the second time a group is recorded, it asks for a fix in the system

shell

worktrunk creates the tree; a Herdr space follows.

Command What
dev Open the Herdr app if needed, show the space for $PWD (made if missing), and start its desk agent if it has none
wtc [branch] Create (or switch to) the worktree for branch + its space. New branches start from HEAD. With no branch, the current one moves to a new worktree and this checkout goes back to the default branch
wts [branch] (or wt.) Switch worktree (fzf if omitted)
wtd [branch] Force-remove the worktree (default: the current branch) + close its space. worktrunk 0.82.0 and later first back up its uncommitted and untracked files to refs/wt-backup/<branch> and print the command that recovers them. Ignored files, submodule changes and separately staged versions are not saved, and a worktree whose status cannot be read is removed without a backup

skills

Call by name. Skills install to ~/.agents/skills, with a link to each in ~/.pi/agent/skills, where Pi looks.

Skill What
handoff Run a beads issue on a stage, headless or as a --branch desk (--base stacks it on a parent branch). See handoff
bstack Playbooks for rigorous work, routed by role. See bstack
how / why How code works now; why it is that way, from git, PRs, and beads. In an Entire repo they start from Graph, Brain and the checkpoints. Read-only
unslop Clean machine-writing tells out of prose and a diff
autopilot Drive an open PR to green: CI, review threads, conflicts. Pushes; never merges
desk-restore Put a desk with no record back on its session by hand, matched by folder and content
unit-testing F.I.R.S.T. rules for writing and reviewing tests: a temp HOME, fakes on PATH, a run that fails without the change
describe Write, check and ship a change's description (the PR body or the commit message) to one standard and the repo's template
statechart Model a stateful change in TLA+, check it with tla-ts, chart it for the owner, and replay it on the real code. Only with [bstack] statechart = true. See statecharts

autopilot's PR snapshot, pr-state.sh, is in Ship with autopilot.

Manual skill install: npx skills add simoncrypta/bercail --skill handoff -g