Elffuss BraidHub

utopia-ia/elffuss-braid public

Agents: a setup that stops where it must, and a way past every failed sync

The setup block, pasted as one script, ran past its identity check, and
the setup commit could go out signed with a name and an address git made
up from the machine. The import and `braid agents init` now wait on the
check in the same line, which says why it stops, and the commit runs git
with user.useConfigOnly. The check for a finished setup asks braid's copy
of the branch for the committed section and .braid/config for who signs,
and the setup's commit block ends with the same check.

- Setup: make .git/info before writing the exclude line; look for
  submodules and filters too; offer to copy what the hooks check into
  AGENTS.md; use the current branch where the setup runs, so that a
  project on master works as written; settings.local.json for the braid
  permission; say that the next sync takes the setup commit out.
- The section: what conflicts, remote_moved and rejected mean after a
  sync, what to do when git pull --ff-only refuses, which .braid/config
  to write, the checks to run before landing, and who signs a sync's
  merge. git sync's text says where the steps for a conflict are.
- The guide's merge of a sync conflict: merge origin/main, git add, and
  commit without the conflict comments, so the message names no address;
  sync with --agent.
- Wording: the remote only ever fast-forwards rather than "never
  force-pushes"; only the newest operation can be undone; a sync undone
  leaves the remote as it is; the site's Spanish, and the link to the
  coming automatic sync labelled as coming.
- CI checks every target on the minimum Rust version, as AGENTS.md says;
  the animated logo carries its licence header.
Changesetb27b4d239a54f72cc21859efc28f149d8089072a2590be07387cf027ed0d2223
AuthorKikoCis <KikoCis@users.noreply.github.com> · 2026-10-17 13:42 +02:00
CommitterKikoCis <KikoCis@users.noreply.github.com> · 2026-10-17 13:42 +02:00
Parents4b3dd661f2e5

Browse the files at this changeset

13 files changed

modified .github/workflows/ci.yml +1 −1
@@ -43,7 +43,7 @@
4343 - uses: actions/checkout@v5
4444 - uses: dtolnay/rust-toolchain@1.89
4545 - uses: Swatinem/rust-cache@v2
46- - run: cargo check --workspace --locked
46+ - run: cargo check --workspace --all-targets --locked
4747
4848 wasm:
4949 name: format and engine on WebAssembly
modified AGENTS.md +115 −78
@@ -47,78 +47,92 @@
4747
4848 ### Is it installed, and set up here?
4949
50+In the project root, on its main branch:
51+
5052 ```bash
5153 braid --version # "braid 0.0.2", or newer, once it is installed
52-braid refs # in the project root: its branches, once it is set up
54+braid cat-object "$(git branch --show-current):AGENTS.md" | grep -q '^<!-- braid:start -->' && grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config && echo "braid is set up here"
5355 ```
5456
5557 - Before braid is installed, `braid --version` fails with "command not
5658 found", as it does while cargo's bin directory is not on `PATH`. An older
5759 braid, or one that says `agents` is not a subcommand, needs the install
5860 command again.
59-- In a project where braid is not set up, `braid refs` fails with "not
60- inside a braid repository". Where it lists the project's branches and
61- `AGENTS.md` has a braid section (a `<!-- braid:start -->` line), braid is
62- set up: skip to "Every agent session, from then on". It lists braid's own
63- refs too: `braid/git-map`, the project's tags as `tags/<name>`, and once
64- a sync has run, `remote/<label>/<branch>`.
61+- The second line prints "braid is set up here" once the setup below is
62+ finished: braid's copy of the branch has the braid section of
63+ `AGENTS.md`, committed, and `.braid/config` names who signs. Then skip to
64+ "Every agent session, from then on". If it fails instead, set the
65+ project up as below, whether braid says "not inside a braid repository",
66+ where it was never set up, or an earlier setup stopped half way: every
67+ line of the setup is safe to run again.
6568
6669 ### Set up a project
6770
6871 First read the project's `AGENTS.md`, `CLAUDE.md` and the like for rules
6972 about git: branches, pull requests, how to commit. Look too for what braid
70-does not run: git hooks (in `.git/hooks`, or where
71-`git config core.hooksPath` says; the `*.sample` files git puts in
72-`.git/hooks` never run, and do not count), Git LFS (`filter=lfs` in
73-`.gitattributes`: braid sees the pointer files, not the content) and a main
74-branch that takes changes only through pull requests. Then list the
75-project's git remotes (`git remote -v`): what agents land reaches the
76-user's checkout through one, which the commands here call `origin`; if it
77-has another name, write that instead. Tell the user what you found, and
78-if any of it clashes with agents landing on the main branch, ask how to
79-go on before you set anything up. With no remote at all, what agents land
80-stays in braid: offer to make one (see "No remote?" below). And if the
81-project has no `CLAUDE.md`, ask whether to add one, since Claude Code
82-reads `CLAUDE.md` rather than `AGENTS.md`: with a yes, run
83-`touch CLAUDE.md` before the commands below, and `braid agents init` makes
84-it include `AGENTS.md`.
73+does not run, or does not check out as git does:
74+
75+- git hooks, in `.git/hooks` or where `git config core.hooksPath` says
76+ (the `*.sample` files git puts in `.git/hooks` never run, and do not
77+ count);
78+- submodules, which `.gitmodules` lists: each one is an empty directory in
79+ every workspace;
80+- filters, `filter=` in `.gitattributes`: a workspace holds the bytes git
81+ stores, so Git LFS's pointer files rather than their content, and what
82+ git-crypt encrypts stays encrypted;
83+- a main branch that takes changes only through pull requests.
84+
85+Tell the user what you found, and if any of it clashes with agents landing
86+on the main branch, ask how to go on before you set anything up. Where the
87+hooks run checks, such as tests or a linter, offer to write those commands
88+into `AGENTS.md`, outside the braid section, so that every session runs
89+them before it lands.
90+
91+Then list the project's git remotes (`git remote -v`): what agents land
92+reaches the user's checkout through one, which the commands here call
93+`origin`; if it has another name, write that instead. With no remote at
94+all, what agents land stays in braid: offer to make one (see "No remote?"
95+below). And if the project has no `CLAUDE.md`, ask whether to add one,
96+since Claude Code reads `CLAUDE.md` rather than `AGENTS.md`: with a yes,
97+run `touch CLAUDE.md` before the commands below, and `braid agents init`
98+makes it include `AGENTS.md`.
8599
86100 Then work in the root of the project's git checkout, on its main branch,
87101 with nothing to commit (`git status` shows no staged or modified files;
88102 untracked files do not matter) and nothing new to pull
89103 (`git pull --ff-only`; skip it when the branch has no upstream, which is
90104 when `git rev-parse --abbrev-ref '@{u}'` fails). In a shallow clone, run
91-`git fetch --unshallow` first: braid imports the whole history. The
92-commands say `main`; if the project's main branch has another name, such
93-as `master`, write that instead. Every line is safe to run again, so after
94-a failure, start again from the top.
105+`git fetch --unshallow` first: braid imports the whole history. Run the
106+lines of each block below one at a time, and stop at the first one that
107+fails. Every line is safe to run again, so once the cause is fixed, start
108+again from the first line of its block.
95109
96110 ```bash
97111 test -d .braid || braid init # .braid/: the store and the agents' workspaces
112+mkdir -p "$(git rev-parse --git-path info)"
98113 grep -qsxF .braid "$(git rev-parse --git-path info/exclude)" || echo .braid >> "$(git rev-parse --git-path info/exclude)"
99114 test -f .braid/config || printf 'name = %s\nemail = %s\n' "$(git config user.name)" "$(git config user.email)" > .braid/config
100-grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config # fails without a name and an email
101-braid git import . # the project's whole history: every local branch and tag
102-braid agents init # the rules for agents, in AGENTS.md
115+if grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config; then braid git import . && braid agents init; else echo 'braid: .braid/config has no name or no email: ask the user who signs' >&2; false; fi
103116 ```
104117
105-- The second line makes git ignore every `.braid` in this checkout, and
106- only in this one: braid's directory, and the `.braid` file that marks
107- each workspace, so that nothing of braid's is ever committed with git.
118+- The second and third lines make git ignore every `.braid` in this
119+ checkout, and only in this one: braid's directory, and the `.braid` file
120+ that marks each workspace, so that nothing of braid's is ever committed
121+ with git.
108122 - `.braid/config` names who signs the changesets agents make, here the
109- same person as git's commits. The line after it fails, with exit status
110- 1 and nothing printed, while the file lacks a name or an email, as it
111- does when git has no `user.name` or `user.email`: every commit and
112- landing would then fail with "no author", and the `git commit` below
113- would fail too, or sign with a name and an address that git guesses
114- from the machine. Ask the user for the name and the e-mail address to
115- use. With their answer, set them for this checkout, and let the setup
116- write the file anew:
123+ same person as git's commits. The last line imports the project's whole
124+ history, every local branch and tag, and then writes the rules for
125+ agents into `AGENTS.md`, but only once the file has a name and an email.
126+ Until then it stops and says so, as it does when git has no `user.name`
127+ or `user.email`: every commit and landing would fail with "no author",
128+ and the `git commit` below would fail too. Ask the user for the name and
129+ the e-mail address to use. With their answer, set them for this
130+ checkout, and let the setup write the file anew:
117131
118132 ```bash
119133 git config user.name "<name>"
120134 git config user.email "<email>"
121- rm .braid/config # then start again from the top
135+ rm .braid/config # then run the setup again from its first line
122136 ```
123137
124138 - Most harnesses read `AGENTS.md`. Claude Code reads `CLAUDE.md` instead,
@@ -126,7 +140,9 @@
126140 `@AGENTS.md` to each of them that exists, so that they read the section
127141 too. In Claude Code, each braid command asks for permission unless the
128142 project allows it: offer to add `"Bash(braid:*)"` to `permissions.allow`
129- in `.claude/settings.json`.
143+ in `.claude/settings.local.json`, the user's own settings for this
144+ checkout, which are never committed: braid is set up in this checkout
145+ only.
130146 - `braid agents init` writes a section into `AGENTS.md`, creating the file
131147 if there is none, between a `<!-- braid:start -->` line and a
132148 `<!-- braid:end -->` line. The section tells every agent session to work
@@ -148,14 +164,23 @@
148164 git add AGENTS.md
149165 if [ -f CLAUDE.md ]; then git add CLAUDE.md; fi
150166 if [ -f GEMINI.md ]; then git add GEMINI.md; fi
151-git diff --cached --quiet || git commit -m "Set up braid for agents"
152-braid git import . # braid's main takes the commit
153-braid log main -n 1 # and shows it
167+git diff --cached --quiet || git -c user.useConfigOnly=true commit -m "Set up braid for agents"
168+braid git import . # braid's copy of the branch takes the commit
169+braid cat-object "$(git branch --show-current):AGENTS.md" | grep -q '^<!-- braid:start -->' && grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config && echo "braid is set up here"
154170 ```
155171
156-If `AGENTS.md`, `CLAUDE.md` or `GEMINI.md` is a symbolic link,
157-`braid agents init` writes the file it points to, and names it: `git add`
158-that file as well.
172+The last line is the check from "Is it installed, and set up here?": it
173+prints "braid is set up here" once the commit is in braid. With
174+`user.useConfigOnly`, git refuses to commit rather than make up a name and
175+an address from the machine; where it says "Author identity unknown", set
176+them as above, then run this block again. If `AGENTS.md`, `CLAUDE.md` or
177+`GEMINI.md` is a symbolic link, `braid agents init` writes the file it
178+points to, and names it: `git add` that file as well.
179+
180+The commit stays in this checkout until it is pushed: the next
181+`braid git sync` takes it to the git remote, with what agents land, and
182+other clones get the rules from there (see "Keeping the git remote up to
183+date"). Tell the user so, and offer to sync now.
159184
160185 ### Every agent session, from then on
161186
@@ -224,20 +249,21 @@
224249 workspace's root. Only `.gitignore` and `.braidignore` apply in a
225250 workspace, not `.git/info/exclude` or a global excludes file: anything
226251 else that must stay local goes in `.braidignore` too. Braid runs no git
227- hooks, so run the project's checks yourself before you land. `land` puts
228- the workspace's changesets on `main`, as a fast-forward or rebased onto
229- whatever landed first.
252+ hooks, so before you land, run the checks that the project's `AGENTS.md`
253+ or `CLAUDE.md` gives. `land` puts the workspace's changesets on `main`,
254+ as a fast-forward or rebased onto whatever landed first.
230255 - **Before a new task**, `braid --agent agent-1 update` brings the
231256 workspace onto `main`. `status --json` says how far behind it is
232257 (`behind_by`).
233258 - **When the session finishes**, what it landed is on braid's `main` only.
234259 The user's checkout and the git remote get it with `braid git sync`, then
235260 `git pull --ff-only`, both from the project root (see "Keeping the git
236- remote up to date"). The session tells the user so, and offers to run
237- them: when to sync is the user's call. Where `git remote get-url origin`
238- fails, the project has no remote of that name: the session asks the
239- user which of those `git remote` lists to sync with, or, where it lists
240- none, says so and offers to make one first (see "No remote?").
261+ remote up to date", which also says what to do when either fails). The
262+ session tells the user so, and offers to run them: when to sync is the
263+ user's call. Where `git remote get-url origin` fails, the project has no
264+ remote of that name: the session asks the user which of those
265+ `git remote` lists to sync with, or, where it lists none, says so and
266+ offers to make one first (see "No remote?").
241267 - **Done**: once everything has landed, `braid workspace remove agent-1`
242268 from the project root. It refuses while the workspace holds work that
243269 has not landed.
@@ -249,8 +275,11 @@
249275 the `name` and `email` in `.braid/config`. With neither, `commit`,
250276 `land` and `update` fail with "no author", and `braid status` lists it
251277 first among what stops a commit: the session asks the user who signs,
252- and writes the answer into `.braid/config` as `name = <name>` and
253- `email = <email>` lines.
278+ and writes the answer into `.braid/config` in the project root (the one
279+ file there that a session may edit) as `name = <name>` and
280+ `email = <email>` lines. The merges that `braid git sync` makes are
281+ signed otherwise: by the `--agent` that ran the sync, with the email in
282+ `.braid/config`.
254283 - New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger
255284 than 1 MiB are held back until `braid track <path>`: `commit` refuses,
256285 naming them, and `--force` leaves them out. Never `braid track` a secret:
@@ -284,14 +313,15 @@
284313 together: it fetches the remote's branch and imports it, then fast-forwards
285314 braid's branch when only the remote moved, pushes braid's branch when only
286315 braid moved, and when both moved, merges them and pushes the merge. The
287-push is a fast-forward with a lease on what was just fetched, so the
288-remote's history is never rewritten; braid never force-pushes, and runs no
289-git hooks. It runs the `git` binary with your environment, so it needs the
290-network and the credentials `git push` uses. Run it from the project root,
291-when the remote should have what landed: who runs it, and when, is the
292-user's call. Braid pushes to the remote's address, so the shared
293-checkout's own record of the remote (`origin/main`) does not move:
294-`git pull --ff-only` brings the checkout up to date.
316+push is a fast-forward, with a lease on what was just fetched, so the
317+remote's history is never rewritten. Braid runs no git hooks. It runs the
318+`git` binary with your environment, so it needs the network and the
319+credentials `git push` uses. Run it from the project root, when the
320+remote should have what landed: who runs it, and when, is the user's
321+call. Braid pushes to the remote's address, so the shared checkout's own
322+record of the remote (`origin/main`) does not move: `git pull --ff-only`
323+brings the checkout up to date. The commands here say `main`: write the
324+branch that the section names.
295325
296326 ```bash
297327 braid --agent agent-1 git sync "$(git remote get-url origin)" --branch main --dry-run --json
@@ -320,9 +350,10 @@
320350 git fetch .braid/export.git main
321351 git merge --ff-only FETCH_HEAD # the shared checkout takes braid's main
322352 git fetch origin main
323- git merge FETCH_HEAD # the remote's: fix the conflicts, then git commit
324- git push
325- braid git sync "$(git remote get-url origin)" --branch main
353+ git merge --no-edit origin/main # the remote's: git stops at conflicts
354+ # if it stopped: fix those files and git add them, then git commit --no-edit --cleanup=strip
355+ git push origin main
356+ braid --agent agent-1 git sync "$(git remote get-url origin)" --branch main
326357 rm -rf .braid/export.git
327358 ```
328359
@@ -331,17 +362,21 @@
331362 braid's branch as the first parent: braid follows a branch's first
332363 parents to tell what a workspace has landed, so the workspaces carry on
333364 from the merge.
365+- If `git pull --ff-only` refuses, the shared checkout has commits of its
366+ own that the remote does not have, and what to do with them is the
367+ user's call. `git pull --rebase` puts them on top of what braid pushed;
368+ then `git push`, and a sync brings them into braid.
334369
335370 No remote? Any bare repository will do. With the user's yes, these lines,
336-run in the shared checkout, make one next to the project, named after it
337-(`../<project>.git`, by an absolute path, which braid reads the same from
338-any directory), and push the main branch to it. If something has that
339-name already, choose another.
371+run in the shared checkout on its main branch, make one next to the
372+project, named after it (`../<project>.git`, by an absolute path, which
373+braid reads the same from any directory), and push the main branch to it.
374+If something has that name already, choose another.
340375
341376 ```bash
342-git init --bare -b main "$PWD.git"
377+git init --bare -b "$(git branch --show-current)" "$PWD.git"
343378 git remote add origin "$PWD.git"
344-git push -u origin main
379+git push -u origin "$(git branch --show-current)"
345380 ```
346381
347382 ### Undoing
@@ -350,7 +385,8 @@
350385 first, with the agent that made it. `braid --agent agent-1 undo` reverts
351386 the newest one that is not undone yet, whoever made it, so read the log
352387 first. A landing undone leaves its changeset in the workspace that made
353- it, ready to land again.
388+ it, ready to land again. A sync undone moves braid's refs back, but not
389+ the git remote: what it pushed stays there.
354390 - A change that landed under other changes cannot be undone that way.
355391 There is no revert command yet: land a change that puts the files back.
356392 - To take braid out of a project: land what the workspaces hold, sync it
@@ -366,8 +402,9 @@
366402 ### What not to do
367403
368404 - Do not edit files, `git add`, `git commit`, `git push` or `git pull` in
369- the shared checkout while you work: only setting up, syncing and merging
370- a sync conflict touch it, as above.
405+ the shared checkout while you work: only setting up, syncing, merging a
406+ sync conflict and naming who signs in `.braid/config` touch it, as
407+ above.
371408 - Do not run git in a workspace, or get around the `.git` file that stops
372409 it there.
373410 - Do not share a workspace between sessions, or work in another session's
modified README.md +2 −1
@@ -155,7 +155,8 @@
155155 braid git export /tmp/mirror.git
156156 ```
157157
158-Every operation is in the op log, and any of them can be undone:
158+Every operation is in the op log, and the newest can be undone, one at a
159+time:
159160
160161 ```bash
161162 braid op log # who did what, newest first
modified crates/cli/src/agents.rs +18 −7
@@ -707,7 +707,8 @@
707707 `printf '%s\\n' .braidignore __pycache__/ >> .braidignore` in the
708708 workspace's root. Only `.gitignore` and `.braidignore` apply in a
709709 workspace, not `.git/info/exclude` or a global excludes file. Braid runs
710- no git hooks: run the project's checks yourself before you land.
710+ no git hooks: before you land, run the project's checks yourself, as
711+ this file or `CLAUDE.md` gives them.
711712 - **Conflicts:** `land` and `update` exit with status 2, the `outcome` in
712713 their JSON is `conflicts`, and `{branch}` does not move. After `land`, run
713714 `braid --agent agent-1 update`, which writes conflict markers into the
@@ -728,11 +729,19 @@
728729 git pull --ff-only
729730 ```
730731
731- Offer to run it: when to sync is the user's call. Where
732- `git remote get-url origin` fails, the project has no remote of that
733- name: if `git remote` lists others, ask the user which to sync with, and
734- write its name in place of `origin`; if it lists none, say so, and offer
735- to make one next to the project first, from the project root:
732+ Offer to run it: when to sync is the user's call. If the sync exits
733+ with 2 (`conflicts`), braid and the remote changed the same lines, and
734+ nothing moved: tell the user, since the merge is made with git, in their
735+ checkout, as <https://braid.elffuss.com/agents.md> shows under
736+ \"Keeping the git remote up to date\". With `remote_moved` (exit status
737+ 1), sync again; with `rejected`, ask the user. If `git pull --ff-only`
738+ refuses, their checkout has commits of its own, and what to do is their
739+ call: `git pull --rebase`, `git push` and a new sync bring them into
740+ braid. Where `git remote get-url origin` fails, the project has no
741+ remote of that name: if `git remote` lists others, ask the user which to
742+ sync with, and write its name in place of `origin`; if it lists none,
743+ say so, and offer to make one next to the project first, from the
744+ project root:
736745
737746 ```bash
738747 git init --bare -b {branch} \"$PWD.git\"
@@ -746,7 +755,9 @@
746755 `name` and `email` in `.braid/config`. With neither, `commit`, `land` and
747756 `update` fail with \"no author\", and `status` lists it first among what
748757 stops a commit: ask the user who signs, and write the answer into
749- `.braid/config` as `name = <name>` and `email = <email>` lines.
758+ `.braid/config` in the project root, the one file there you may edit, as
759+ `name = <name>` and `email = <email>` lines. The merges that `git sync`
760+ makes are signed by its `--agent`, with that email.
750761 - New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger
751762 than 1 MiB wait for `braid track <path>`. Never track a secret: move it
752763 out of the workspace.
modified crates/cli/src/main.rs +3 −3
@@ -310,9 +310,9 @@
310310 },
311311 /// Keep a braid branch and a branch of a git remote in step: fetch and
312312 /// import the remote branch, then fast-forward the braid branch, or push
313- /// it (merging first when both moved) as a fast-forward with a lease.
314- /// Never force-pushes. Exits with 2 on conflicts and 1 when the push is
315- /// refused.
313+ /// it (merging first when both moved) as a fast-forward with a lease, so
314+ /// the remote's history is never rewritten. Exits with 2 on conflicts and
315+ /// 1 when the push is refused.
316316 Sync {
317317 /// The git remote: a URL or a path.
318318 remote: String,
modified crates/cli/src/sync.rs +5 −0
@@ -15,6 +15,10 @@
1515 /// Exit status when the sync found conflicts.
1616 const CONFLICTS: u8 = 2;
1717
18+/// What the text report says to do about conflicts: the two sides meet in
19+/// git, and the guide for agents gives the steps.
20+const MERGE_IN_GIT: &str = "Merge them in git and push the merge, then sync again: https://braid.elffuss.com/agents.md shows how, under \"Keeping the git remote up to date\".";
21+
1822 pub(crate) fn git_sync(
1923 cli: &Cli,
2024 remote: &str,
@@ -212,6 +216,7 @@
212216 String::from_utf8_lossy(&conflict.path)
213217 );
214218 }
219+ println!("{MERGE_IN_GIT}");
215220 }
216221 SyncOutcome::RemoteMoved { found } => {
217222 eprintln!(
modified crates/cli/tests/git_sync.rs +7 −0
@@ -363,6 +363,13 @@
363363 let text = String::from_utf8(output.stdout).unwrap();
364364 assert!(text.contains("nothing moved"), "{text}");
365365 assert!(text.contains("CONTENT f"), "{text}");
366+ // And what to do: the two sides meet in git.
367+ assert!(
368+ text.ends_with(
369+ "Merge them in git and push the merge, then sync again: https://braid.elffuss.com/agents.md shows how, under \"Keeping the git remote up to date\".\n"
370+ ),
371+ "{text}"
372+ );
366373 world.assert_forward_only();
367374 }
368375
modified crates/cli/tests/guides.rs +394 −56
@@ -120,29 +120,87 @@
120120 .unwrap_or_else(|| panic!("no block with {first:?}"))
121121 }
122122
123+/// The text of `line` without its command substitutions, such as
124+/// `"$(git branch --show-current)"`, which leaves `""`.
125+fn without_substitutions(line: &str) -> String {
126+ let mut kept = String::new();
127+ let mut rest = line;
128+ while let Some(start) = rest.find("$(") {
129+ kept.push_str(&rest[..start]);
130+ // From the opening parenthesis to the one that closes it.
131+ let mut depth = 0;
132+ let mut end = rest.len();
133+ for (offset, c) in rest[start + 1..].char_indices() {
134+ match c {
135+ '(' => depth += 1,
136+ ')' => {
137+ depth -= 1;
138+ if depth == 0 {
139+ end = start + 1 + offset + 1;
140+ break;
141+ }
142+ }
143+ _ => {}
144+ }
145+ }
146+ rest = &rest[end..];
147+ }
148+ kept.push_str(rest);
149+ kept
150+}
151+
152+/// The braid commands a shell line runs, without its comment and its
153+/// command substitutions. A line may run braid after another command,
154+/// `test -d .braid || braid init`, pipe it into one,
155+/// `braid cat-object <base>:<path> | diff`, or run it inside an `if`,
156+/// `if ...; then braid git import . && braid agents init; else ...; fi`.
157+fn braid_commands(line: &str) -> Vec<String> {
158+ let line = without_substitutions(line.split(" #").next().unwrap());
159+ line.split(['|', '&', ';'])
160+ .map(|command| {
161+ let mut command = command.trim();
162+ for keyword in ["if ", "then ", "else ", "! "] {
163+ command = command.strip_prefix(keyword).unwrap_or(command).trim();
164+ }
165+ command
166+ })
167+ .filter(|command| command.starts_with("braid "))
168+ .map(str::to_owned)
169+ .collect()
170+}
171+
123172 /// Runs `line` in a new POSIX shell in `dir`, as a harness that keeps
124173 /// nothing between commands runs it: with this build's braid first on
125174 /// `PATH`, no braid variables, and git reading only `config` (no system
126-/// configuration).
175+/// configuration) and no identity from the environment.
127176 fn shell(dir: &Path, config: &Path, line: &str) -> Output {
128177 let bin = Path::new(env!("CARGO_BIN_EXE_braid")).parent().unwrap();
129178 let path = std::env::join_paths(std::iter::once(bin.to_path_buf()).chain(
130179 std::env::split_paths(&std::env::var_os("PATH").unwrap_or_default()),
131180 ))
132181 .unwrap();
133- Command::new("sh")
182+ let mut command = Command::new("sh");
183+ command
134184 .arg("-c")
135185 .arg(line)
136186 .current_dir(dir)
137187 .env("PATH", path)
138188 .env("GIT_CONFIG_GLOBAL", config)
139189 .env("GIT_CONFIG_NOSYSTEM", "1")
140- .env_remove("BRAID_AUTHOR")
141- .env_remove("BRAID_AGENT")
142190 // The shell sets it from the directory it starts in.
143- .env_remove("PWD")
144- .output()
145- .unwrap()
191+ .env_remove("PWD");
192+ for variable in [
193+ "BRAID_AUTHOR",
194+ "BRAID_AGENT",
195+ "EMAIL",
196+ "GIT_AUTHOR_NAME",
197+ "GIT_AUTHOR_EMAIL",
198+ "GIT_COMMITTER_NAME",
199+ "GIT_COMMITTER_EMAIL",
200+ ] {
201+ command.env_remove(variable);
202+ }
203+ command.output().unwrap()
146204 }
147205
148206 /// Runs `line` as [`shell`] does, expecting success.
@@ -157,10 +215,15 @@
157215 String::from_utf8(out.stdout).unwrap()
158216 }
159217
160-/// A git project in `dir`, on `main`, with one commit of `notes.txt`, and
218+/// A git project in `dir`, on `branch`, with one commit of `notes.txt`, and
161219 /// a git configuration of its own that gives `identity` as git's user, or
162220 /// none.
163-fn git_project(dir: &Path, identity: Option<(&str, &str)>) -> PathBuf {
221+fn git_project(dir: &Path, branch: &str, identity: Option<(&str, &str)>) -> PathBuf {
222+ git_project_from(dir, &format!("git init -q -b {branch}"), identity)
223+}
224+
225+/// A git project as [`git_project`] makes it, created by `init`.
226+fn git_project_from(dir: &Path, init: &str, identity: Option<(&str, &str)>) -> PathBuf {
164227 fs::create_dir_all(dir).unwrap();
165228 let config = dir.with_extension("gitconfig");
166229 let user = identity.map_or_else(String::new, |(name, email)| {
@@ -169,7 +232,7 @@
169232 fs::write(&config, user).unwrap();
170233 fs::write(dir.join("notes.txt"), "one\ntwo\n").unwrap();
171234 for line in [
172- "git init -q -b main",
235+ init,
173236 "git add notes.txt",
174237 "git -c user.name=Ada -c user.email=ada@example.org commit -q -m First",
175238 ] {
@@ -178,6 +241,22 @@
178241 config
179242 }
180243
244+/// The line of the guide that says whether braid is set up in a project:
245+/// the guide gives it to check before anything else, and ends the setup
246+/// with it.
247+fn set_up_check(guide: &str) -> String {
248+ let check = block_with(guide, "braid --version")
249+ .into_iter()
250+ .find(|line| line.starts_with("braid cat-object "))
251+ .expect("the guide checks whether braid is set up");
252+ let commit = block_with(guide, "git add AGENTS.md");
253+ assert_eq!(commit.last(), Some(&check), "the setup ends with the check");
254+ check
255+}
256+
257+/// What the check prints once braid is set up.
258+const SET_UP: &str = "braid is set up here\n";
259+
181260 /// The text of the file at `path` in `dir`.
182261 fn read(dir: &Path, path: &str) -> String {
183262 fs::read_to_string(dir.join(path)).unwrap_or_else(|err| panic!("{path}: {err}"))
@@ -281,25 +360,27 @@
281360 lines.extend(bash_lines(&text));
282361 lines.extend(code_spans(&text));
283362 }
284- // A line may run braid after another command, `test -d .braid || braid
285- // init`, or pipe it into one, `braid cat-object <base>:<path> | diff`.
286- let commands: Vec<String> = lines
287- .iter()
288- .flat_map(|line| line.split('|').flat_map(|part| part.split("&&")))
289- .map(str::trim)
290- .filter(|command| command.starts_with("braid "))
291- .map(str::to_owned)
292- .collect();
363+ let commands: Vec<String> = lines.iter().flat_map(|line| braid_commands(line)).collect();
293364 assert!(commands.len() >= 40, "{commands:?}");
365+ for (line, expected) in [
366+ (
367+ "test -d .braid || braid init # .braid/: the store",
368+ vec!["braid init"],
369+ ),
370+ (
371+ "if grep -q x f; then braid git import . && braid agents init; else echo no >&2; false; fi",
372+ vec!["braid git import .", "braid agents init"],
373+ ),
374+ (
375+ "braid cat-object \"$(git branch --show-current):AGENTS.md\" | grep -q x",
376+ vec!["braid cat-object \":AGENTS.md\""],
377+ ),
378+ ] {
379+ assert_eq!(braid_commands(line), expected);
380+ }
294381 let groups = ["agents", "change", "git", "op", "ref", "workspace"];
295382 for command in &commands {
296- let words: Vec<&str> = command
297- .split(" #")
298- .next()
299- .unwrap()
300- .split_whitespace()
301- .skip(1)
302- .collect();
383+ let words: Vec<&str> = command.split_whitespace().skip(1).collect();
303384 let mut rest = words.as_slice();
304385 while let [flag, _, tail @ ..] = rest {
305386 if matches!(*flag, "--agent" | "--workspace" | "--repo") {
@@ -339,39 +420,57 @@
339420
340421 #[test]
341422 fn the_setup_stops_at_its_check_until_braid_has_a_name_and_an_email() {
342- let setup = block_with(&part_one(), "test -d .braid || braid init");
343- let check = setup
344- .iter()
345- .position(|line| line.starts_with("grep -q '^name = .' .braid/config"))
346- .expect("the setup checks the name and the email it wrote");
423+ let guide = part_one();
424+ let setup = block_with(&guide, "test -d .braid || braid init");
425+ let commit = block_with(&guide, "git add AGENTS.md");
426+ let check = set_up_check(&guide);
427+ // The import and AGENTS.md wait on the name and the email, in the line
428+ // that checks them, so that the setup stops there however it is run.
429+ let gate = setup.len() - 1;
430+ assert!(
431+ setup[gate].starts_with("if grep -q '^name = .' .braid/config"),
432+ "{setup:?}"
433+ );
347434 for identity in [Some(("Ada Lovelace", "ada@example.org")), None] {
348435 let temp = tempfile::tempdir().unwrap();
349436 let dir = fs::canonicalize(temp.path()).unwrap().join("project");
350- let config = git_project(&dir, identity);
437+ let config = git_project(&dir, "main", identity);
438+ assert!(!shell(&dir, &config, &check).status.success());
351439 // Each line in a shell of its own, as written: only the check fails
352- // where git has no identity, and nothing says why but the guide.
440+ // where git has no identity.
353441 let run = || -> Vec<Option<i32>> {
354442 setup
355443 .iter()
356444 .map(|line| shell(&dir, &config, line).status.code())
357445 .collect()
358446 };
359- let failing = |index: usize| Some(i32::from(identity.is_none() && index == check));
447+ let failing = |index: usize| Some(i32::from(identity.is_none() && index == gate));
360448 assert_eq!(run(), (0..setup.len()).map(failing).collect::<Vec<_>>());
361- assert!(read(&dir, "AGENTS.md").contains(START));
362- let commit = block_with(&part_one(), "git add AGENTS.md");
363449 let written = read(&dir, ".braid/config");
364450 let Some((name, email)) = identity else {
365451 assert_eq!(written, "name = \nemail = \n");
366- // Every commit and landing would fail: a session's status says
367- // so first.
368- shell_ok(&dir, &config, "braid workspace add agent-1 --track main");
369- let workspace = dir.join(".braid/work/agent-1");
370- assert_eq!(status(&workspace)["blocking"][0]["reason"], "author");
371- // Fixed as the guide says, the setup runs again from the top
372- // without a failure, and git's commit is signed as braid's
373- // changesets are, not as git would guess.
374- for line in block_with(&part_one(), "git config user.name") {
452+ // The setup says why it stopped, and has imported nothing and
453+ // written no AGENTS.md, whether its lines run one at a time or
454+ // as one script, as a harness may run a block.
455+ let stopped = shell(&dir, &config, &setup[gate]);
456+ assert_eq!(stopped.status.code(), Some(1));
457+ let said = String::from_utf8_lossy(&stopped.stderr);
458+ assert!(said.contains("ask the user who signs"), "{said}");
459+ let script = shell(&dir, &config, &setup.join("\n"));
460+ assert_eq!(script.status.code(), Some(1));
461+ assert_eq!(shell_ok(&dir, &config, "braid refs"), "");
462+ assert!(!dir.join("AGENTS.md").exists());
463+ // The commit block, run all the same, commits nothing: git
464+ // refuses to make up who signs, and the check still fails.
465+ fs::write(dir.join("AGENTS.md"), "# Rules\n").unwrap();
466+ let script = shell(&dir, &config, &commit.join("\n"));
467+ assert_eq!(script.status.code(), Some(1));
468+ assert_eq!(shell_ok(&dir, &config, "git log --format=%s"), "First\n");
469+ shell_ok(&dir, &config, "git reset -q && rm AGENTS.md");
470+ // Fixed as the guide says, the setup runs again from its first
471+ // line without a failure, and git's commit is signed as braid's
472+ // changesets are.
473+ for line in block_with(&guide, "git config user.name") {
375474 let line = line
376475 .replace("<name>", "Grace Hopper")
377476 .replace("<email>", "grace@example.org");
@@ -382,7 +481,6 @@
382481 read(&dir, ".braid/config"),
383482 "name = Grace Hopper\nemail = grace@example.org\n"
384483 );
385- assert_eq!(status(&workspace)["blocking"], serde_json::json!([]));
386484 for line in &commit {
387485 shell_ok(&dir, &config, line);
388486 }
@@ -390,16 +488,124 @@
390488 shell_ok(&dir, &config, "git log -1 --format='%an <%ae>'"),
391489 "Grace Hopper <grace@example.org>\n"
392490 );
491+ assert_eq!(shell_ok(&dir, &config, &check), SET_UP);
393492 continue;
394493 };
395494 assert_eq!(written, format!("name = {name}\nemail = {email}\n"));
396- for line in &commit {
397- shell_ok(&dir, &config, line);
398- }
399- // Running it again changes nothing.
495+ assert!(read(&dir, "AGENTS.md").contains(START));
496+ // Written but not committed, the section is not on braid's branch
497+ // yet: braid is not set up.
498+ assert!(!shell(&dir, &config, &check).status.success());
499+ let said: Vec<String> = commit
500+ .iter()
501+ .map(|line| shell_ok(&dir, &config, line))
502+ .collect();
503+ assert_eq!(said.last().map(String::as_str), Some(SET_UP));
504+ // Running the setup again changes nothing.
400505 assert!(run().iter().all(|code| *code == Some(0)));
401506 assert_eq!(read(&dir, ".braid/config"), written);
507+ // Without anyone to sign, braid is not set up either, and the setup
508+ // run again puts that right.
509+ fs::remove_file(dir.join(".braid/config")).unwrap();
510+ assert!(!shell(&dir, &config, &check).status.success());
511+ assert!(run().iter().all(|code| *code == Some(0)));
512+ assert_eq!(shell_ok(&dir, &config, &check), SET_UP);
513+ }
514+}
515+
516+#[test]
517+fn a_session_names_who_signs_in_the_config_of_the_project_root() {
518+ let temp = tempfile::tempdir().unwrap();
519+ let dir = fs::canonicalize(temp.path()).unwrap().join("project");
520+ let config = git_project(&dir, "main", Some(("Ada Lovelace", "ada@example.org")));
521+ for line in block_with(&part_one(), "test -d .braid || braid init") {
522+ shell_ok(&dir, &config, &line);
523+ }
524+ // Nobody signs: the session's status says so first.
525+ fs::write(dir.join(".braid/config"), "name = \nemail = \n").unwrap();
526+ shell_ok(&dir, &config, "braid workspace add agent-1 --track main");
527+ let workspace = dir.join(".braid/work/agent-1");
528+ assert_eq!(status(&workspace)["blocking"][0]["reason"], "author");
529+ // In the workspace, `.braid` is a file: the config the section means
530+ // is the project root's, where the lines it gives, added after the
531+ // empty ones, name who signs.
532+ assert!(workspace.join(".braid").is_file());
533+ let section = section().split_whitespace().collect::<Vec<_>>().join(" ");
534+ assert!(
535+ section.contains(
536+ "write the answer into `.braid/config` in the project root, the one file there you may edit, as `name = <name>` and `email = <email>` lines"
537+ ),
538+ "{section}"
539+ );
540+ let mut file = fs::OpenOptions::new()
541+ .append(true)
542+ .open(dir.join(".braid/config"))
543+ .unwrap();
544+ std::io::Write::write_all(
545+ &mut file,
546+ b"name = Grace Hopper\nemail = grace@example.org\n",
547+ )
548+ .unwrap();
549+ assert_eq!(status(&workspace)["blocking"], serde_json::json!([]));
550+}
551+
552+#[test]
553+fn the_setup_runs_as_written_where_the_branch_is_master() {
554+ let temp = tempfile::tempdir().unwrap();
555+ let parent = fs::canonicalize(temp.path()).unwrap();
556+ let dir = parent.join("project");
557+ let config = git_project(&dir, "master", Some(("Ada Lovelace", "ada@example.org")));
558+ let guide = part_one();
559+ let check = set_up_check(&guide);
560+ // The setup, its commit, and a remote made where there is none, each
561+ // line as written.
562+ for first in [
563+ "test -d .braid || braid init",
564+ "git add AGENTS.md",
565+ "git init --bare -b",
566+ ] {
567+ for line in block_with(&guide, first) {
568+ shell_ok(&dir, &config, &line);
569+ }
570+ }
571+ assert_eq!(shell_ok(&dir, &config, &check), SET_UP);
572+ let rules = read(&dir, "AGENTS.md");
573+ assert!(rules.contains("--track master\n"), "{rules}");
574+ // The new remote's HEAD names the branch, so that a clone checks it
575+ // out, with the setup's commit.
576+ let bare = parent.join("project.git");
577+ assert_eq!(
578+ shell_ok(&bare, &config, "git symbolic-ref HEAD"),
579+ "refs/heads/master\n"
580+ );
581+ shell_ok(&parent, &config, "git clone -q project.git clone");
582+ assert_eq!(read(&parent.join("clone"), "AGENTS.md"), rules);
583+}
584+
585+#[test]
586+fn the_setup_keeps_braid_out_of_git_without_an_info_directory() {
587+ // A template that holds only hooks, as hook managers set one up, gives
588+ // repositories with no `.git/info`.
589+ let temp = tempfile::tempdir().unwrap();
590+ let root = fs::canonicalize(temp.path()).unwrap();
591+ let template = root.join("template");
592+ fs::create_dir_all(template.join("hooks")).unwrap();
593+ let dir = root.join("project");
594+ let init = format!("git init -q -b main --template='{}'", template.display());
595+ let config = git_project_from(&dir, &init, Some(("Ada Lovelace", "ada@example.org")));
596+ assert!(!dir.join(".git/info").exists());
597+ for line in block_with(&part_one(), "test -d .braid || braid init") {
598+ shell_ok(&dir, &config, &line);
402599 }
600+ assert_eq!(read(&dir, ".git/info/exclude"), ".braid\n");
601+ assert_eq!(
602+ shell_ok(
603+ &dir,
604+ &config,
605+ "git status --porcelain --untracked-files=all"
606+ ),
607+ "?? AGENTS.md\n"
608+ );
403609 }
404610
405611 /// The line the guides give to keep Python's build output out of a
@@ -411,18 +617,21 @@
411617 let temp = tempfile::tempdir().unwrap();
412618 let parent = fs::canonicalize(temp.path()).unwrap();
413619 let dir = parent.join("project");
414- let config = git_project(&dir, Some(("Ada Lovelace", "ada@example.org")));
620+ let config = git_project(&dir, "main", Some(("Ada Lovelace", "ada@example.org")));
415621 for line in block_with(&part_one(), "test -d .braid || braid init") {
416622 shell_ok(&dir, &config, &line);
417623 }
418624 let section = section();
419625 let sync = block_with(&section, "braid --agent agent-1 git sync");
420626 let recipe = block_with(&section, "git init --bare");
421- // The guide gives the same lines for a project with no remote.
422- let guide = bash_lines(&part_one());
423- for line in &recipe {
424- assert!(guide.contains(line), "the guide has no {line:?}");
425- }
627+ // The guide gives the same lines for a project with no remote, with the
628+ // branch the shared checkout is on, which the setup has be the main
629+ // one, where the section names its branch.
630+ let guide: Vec<String> = block_with(&part_one(), "git init --bare -b")
631+ .iter()
632+ .map(|line| line.replace("\"$(git branch --show-current)\"", "main"))
633+ .collect();
634+ assert_eq!(guide, recipe);
426635 for text in [part_one(), section.clone()] {
427636 assert!(code_spans(&text).iter().any(|span| span == BRAIDIGNORE));
428637 }
@@ -493,3 +702,132 @@
493702 assert!(!parent.join("clone").join(kept_out).exists(), "{kept_out}");
494703 }
495704 }
705+
706+/// The heading of the guide that says how to keep the git remote in step,
707+/// and what to do when a sync fails.
708+const SYNC_HEADING: &str = "Keeping the git remote up to date";
709+
710+#[test]
711+fn the_section_sends_a_failed_sync_to_the_guide() {
712+ assert!(part_one().contains(&format!("\n### {SYNC_HEADING}\n")));
713+ let section = section().split_whitespace().collect::<Vec<_>>().join(" ");
714+ for said in [
715+ "If the sync exits with 2 (`conflicts`)",
716+ &format!("as <https://braid.elffuss.com/agents.md> shows under \"{SYNC_HEADING}\""),
717+ "With `remote_moved` (exit status 1), sync again; with `rejected`, ask the user.",
718+ "If `git pull --ff-only` refuses,",
719+ ] {
720+ assert!(section.contains(said), "{said}: {section}");
721+ }
722+}
723+
724+#[test]
725+fn a_sync_conflict_is_merged_in_git_as_the_guide_says() {
726+ let temp = tempfile::tempdir().unwrap();
727+ let parent = fs::canonicalize(temp.path()).unwrap();
728+ let dir = parent.join("project");
729+ let config = git_project(&dir, "main", Some(("Ada Lovelace", "ada@example.org")));
730+ let guide = part_one();
731+ // A remote, the setup and its commit, each line as written, and a sync
732+ // that takes the commit to the remote.
733+ for first in [
734+ "git init --bare -b",
735+ "test -d .braid || braid init",
736+ "git add AGENTS.md",
737+ "braid --agent agent-1 git sync",
738+ ] {
739+ for line in block_with(&guide, first) {
740+ shell_ok(&dir, &config, &line);
741+ }
742+ }
743+ let sync = block_with(&guide, "braid --agent agent-1 git sync")
744+ .into_iter()
745+ .find(|line| !line.contains("--dry-run") && line.starts_with("braid "))
746+ .unwrap();
747+
748+ // A session lands an edit of a line that someone else edits and pushes.
749+ shell_ok(&dir, &config, "braid workspace add agent-1 --track main");
750+ let workspace = dir.join(".braid/work/agent-1");
751+ fs::write(workspace.join("notes.txt"), "one\ntwo, the agent's\n").unwrap();
752+ for line in [
753+ "braid --agent agent-1 commit -m 'The agent edits notes'",
754+ "braid --agent agent-1 land",
755+ ] {
756+ shell_ok(&workspace, &config, line);
757+ }
758+ shell_ok(&parent, &config, "git clone -q project.git person");
759+ let person = parent.join("person");
760+ fs::write(person.join("notes.txt"), "one\ntwo, the person's\n").unwrap();
761+ shell_ok(
762+ &person,
763+ &config,
764+ "git commit -q -am 'The person edits notes'",
765+ );
766+ shell_ok(&person, &config, "git push -q");
767+
768+ // The sync stops, and says where the steps are.
769+ let stopped = shell(&dir, &config, &sync);
770+ assert_eq!(stopped.status.code(), Some(2));
771+ let said = String::from_utf8_lossy(&stopped.stdout);
772+ assert!(said.contains("CONTENT notes.txt"), "{said}");
773+ assert!(
774+ said.contains(&format!(
775+ "https://braid.elffuss.com/agents.md shows how, under \"{SYNC_HEADING}\""
776+ )),
777+ "{said}"
778+ );
779+
780+ // The guide's steps, with the conflict fixed where git stops.
781+ let recipe = block_with(&guide, "git init --bare .braid/export.git");
782+ let merge = recipe
783+ .iter()
784+ .position(|line| line.starts_with("git merge --no-edit origin/main"))
785+ .expect("the remote's branch is merged into braid's");
786+ assert_eq!(
787+ recipe[merge + 1],
788+ "# if it stopped: fix those files and git add them, then git commit --no-edit --cleanup=strip"
789+ );
790+ for (index, line) in recipe.iter().enumerate() {
791+ let out = shell(&dir, &config, line);
792+ if index == merge {
793+ assert_eq!(out.status.code(), Some(1), "git stops at the conflict");
794+ fs::write(dir.join("notes.txt"), "one\ntwo, both\n").unwrap();
795+ shell_ok(&dir, &config, "git add notes.txt");
796+ shell_ok(&dir, &config, "git commit -q --no-edit --cleanup=strip");
797+ continue;
798+ }
799+ assert!(
800+ out.status.success(),
801+ "{line}: {}",
802+ String::from_utf8_lossy(&out.stderr)
803+ );
804+ }
805+ // The merge's message names the branch, not the remote's address, and
806+ // braid's branch is its first parent; braid's main and the remote's are
807+ // the merge.
808+ let merged = shell_ok(&dir, &config, "git log -1 --format=%B");
809+ assert_eq!(
810+ merged.trim_end(),
811+ "Merge remote-tracking branch 'origin/main'"
812+ );
813+ assert_eq!(
814+ shell_ok(&dir, &config, "git log -1 --format=%s HEAD^1"),
815+ "The agent edits notes\n"
816+ );
817+ let head = shell_ok(&dir, &config, "git rev-parse HEAD");
818+ assert_eq!(
819+ shell_ok(&parent.join("project.git"), &config, "git rev-parse main"),
820+ head
821+ );
822+ assert!(
823+ shell_ok(&dir, &config, "braid log main -n 1")
824+ .contains("Merge remote-tracking branch 'origin/main'")
825+ );
826+ // The session carries on from the merge, and the next sync has nothing
827+ // to do.
828+ shell_ok(&workspace, &config, "braid --agent agent-1 update");
829+ assert_eq!(status(&workspace)["behind_by"], 0);
830+ assert_eq!(read(&workspace, "notes.txt"), "one\ntwo, both\n");
831+ assert!(shell_ok(&dir, &config, &sync).contains("up to date"));
832+ assert!(!dir.join(".braid/export.git").exists());
833+}
modified crates/repo/src/sync.rs +5 −5
@@ -176,11 +176,11 @@
176176 /// Keeps the braid branch `branch` and a branch of the git remote
177177 /// `remote` in step: fetches and imports the remote branch, then
178178 /// fast-forwards the braid branch, or pushes it (merging first when both
179- /// moved) as a fast-forward with a lease. Braid never force-pushes.
180- /// Operations are recorded by `agent`, who is also the committer of a
181- /// merge, with the `email` of the repository's [`Config`](crate::Config)
182- /// or `<agent>@example.org`, and whom the merge's
183- /// [`AGENT`] field names.
179+ /// moved) as a fast-forward with a lease, so that the remote's history is
180+ /// never rewritten. Operations are recorded by `agent`, who is also the
181+ /// committer of a merge, with the `email` of the repository's
182+ /// [`Config`](crate::Config) or `<agent>@example.org`, and whom the
183+ /// merge's [`AGENT`] field names.
184184 ///
185185 /// # The mirror
186186 ///
modified docs/assets/braid-animated.svg +2 −0
@@ -1,3 +1,5 @@
1+<!-- SPDX-License-Identifier: Apache-2.0
2+ Copyright (c) 2026 UtopiaIA -->
13 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 96" width="320" height="96" role="img" aria-label="Three strands braided together">
24 <title>elffuss-braid</title>
35 <style>
modified docs/design.md +16 −4
@@ -391,7 +391,19 @@
391391 `git pull --ff-only`. The section has a session that finishes say so to
392392 the user, and offer to run them, rather than leave the user looking at
393393 files that did not change; where the project has no git remote, it says
394- so, and offers to make a bare one next to the project first.
394+ so, and offers to make a bare one next to the project first. When the
395+ sync stops on conflicts, the section says that the merge is made with
396+ git, in the user's checkout, and points to the guide's steps, as the
397+ text `git sync` prints does.
398+- **Nobody signs by guesswork.** The guide's setup writes `.braid/config`
399+ from git's `user.name` and `user.email`, and stops before it imports
400+ anything while either is missing, rather than let every commit and
401+ landing fail later with "no author". Its own commit runs git with
402+ `user.useConfigOnly`, so that git refuses rather than sign with a name
403+ and an address made up from the machine's user and host, which the
404+ first sync would publish. Its check for a finished setup asks braid's
405+ copy of the branch for the section, so that a setup that stopped half
406+ way is run again rather than taken for done.
395407
396408 ## Git bridge
397409
@@ -407,9 +419,9 @@
407419 `remote/<label>/<branch>` for where the branches of git remotes were last
408420 seen. A git branch named like one of them is imported under its full name,
409421 below `git/`.
410-- Sync fetches and imports first, then pushes with a lease, as a fast-forward.
411- Braid never force-pushes. The push itself runs the `git` binary as a
412- subprocess, since gitoxide does not push yet.
422+- Sync fetches and imports first, then pushes with a lease, as a fast-forward:
423+ the remote's history is never rewritten. The push itself runs the `git`
424+ binary as a subprocess, since gitoxide does not push yet.
413425
414426 ### Sync
415427
modified site/agents.md +115 −78
@@ -47,78 +47,92 @@
4747
4848 ## Is it installed, and set up here?
4949
50+In the project root, on its main branch:
51+
5052 ```bash
5153 braid --version # "braid 0.0.2", or newer, once it is installed
52-braid refs # in the project root: its branches, once it is set up
54+braid cat-object "$(git branch --show-current):AGENTS.md" | grep -q '^<!-- braid:start -->' && grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config && echo "braid is set up here"
5355 ```
5456
5557 - Before braid is installed, `braid --version` fails with "command not
5658 found", as it does while cargo's bin directory is not on `PATH`. An older
5759 braid, or one that says `agents` is not a subcommand, needs the install
5860 command again.
59-- In a project where braid is not set up, `braid refs` fails with "not
60- inside a braid repository". Where it lists the project's branches and
61- `AGENTS.md` has a braid section (a `<!-- braid:start -->` line), braid is
62- set up: skip to "Every agent session, from then on". It lists braid's own
63- refs too: `braid/git-map`, the project's tags as `tags/<name>`, and once
64- a sync has run, `remote/<label>/<branch>`.
61+- The second line prints "braid is set up here" once the setup below is
62+ finished: braid's copy of the branch has the braid section of
63+ `AGENTS.md`, committed, and `.braid/config` names who signs. Then skip to
64+ "Every agent session, from then on". If it fails instead, set the
65+ project up as below, whether braid says "not inside a braid repository",
66+ where it was never set up, or an earlier setup stopped half way: every
67+ line of the setup is safe to run again.
6568
6669 ## Set up a project
6770
6871 First read the project's `AGENTS.md`, `CLAUDE.md` and the like for rules
6972 about git: branches, pull requests, how to commit. Look too for what braid
70-does not run: git hooks (in `.git/hooks`, or where
71-`git config core.hooksPath` says; the `*.sample` files git puts in
72-`.git/hooks` never run, and do not count), Git LFS (`filter=lfs` in
73-`.gitattributes`: braid sees the pointer files, not the content) and a main
74-branch that takes changes only through pull requests. Then list the
75-project's git remotes (`git remote -v`): what agents land reaches the
76-user's checkout through one, which the commands here call `origin`; if it
77-has another name, write that instead. Tell the user what you found, and
78-if any of it clashes with agents landing on the main branch, ask how to
79-go on before you set anything up. With no remote at all, what agents land
80-stays in braid: offer to make one (see "No remote?" below). And if the
81-project has no `CLAUDE.md`, ask whether to add one, since Claude Code
82-reads `CLAUDE.md` rather than `AGENTS.md`: with a yes, run
83-`touch CLAUDE.md` before the commands below, and `braid agents init` makes
84-it include `AGENTS.md`.
73+does not run, or does not check out as git does:
74+
75+- git hooks, in `.git/hooks` or where `git config core.hooksPath` says
76+ (the `*.sample` files git puts in `.git/hooks` never run, and do not
77+ count);
78+- submodules, which `.gitmodules` lists: each one is an empty directory in
79+ every workspace;
80+- filters, `filter=` in `.gitattributes`: a workspace holds the bytes git
81+ stores, so Git LFS's pointer files rather than their content, and what
82+ git-crypt encrypts stays encrypted;
83+- a main branch that takes changes only through pull requests.
84+
85+Tell the user what you found, and if any of it clashes with agents landing
86+on the main branch, ask how to go on before you set anything up. Where the
87+hooks run checks, such as tests or a linter, offer to write those commands
88+into `AGENTS.md`, outside the braid section, so that every session runs
89+them before it lands.
90+
91+Then list the project's git remotes (`git remote -v`): what agents land
92+reaches the user's checkout through one, which the commands here call
93+`origin`; if it has another name, write that instead. With no remote at
94+all, what agents land stays in braid: offer to make one (see "No remote?"
95+below). And if the project has no `CLAUDE.md`, ask whether to add one,
96+since Claude Code reads `CLAUDE.md` rather than `AGENTS.md`: with a yes,
97+run `touch CLAUDE.md` before the commands below, and `braid agents init`
98+makes it include `AGENTS.md`.
8599
86100 Then work in the root of the project's git checkout, on its main branch,
87101 with nothing to commit (`git status` shows no staged or modified files;
88102 untracked files do not matter) and nothing new to pull
89103 (`git pull --ff-only`; skip it when the branch has no upstream, which is
90104 when `git rev-parse --abbrev-ref '@{u}'` fails). In a shallow clone, run
91-`git fetch --unshallow` first: braid imports the whole history. The
92-commands say `main`; if the project's main branch has another name, such
93-as `master`, write that instead. Every line is safe to run again, so after
94-a failure, start again from the top.
105+`git fetch --unshallow` first: braid imports the whole history. Run the
106+lines of each block below one at a time, and stop at the first one that
107+fails. Every line is safe to run again, so once the cause is fixed, start
108+again from the first line of its block.
95109
96110 ```bash
97111 test -d .braid || braid init # .braid/: the store and the agents' workspaces
112+mkdir -p "$(git rev-parse --git-path info)"
98113 grep -qsxF .braid "$(git rev-parse --git-path info/exclude)" || echo .braid >> "$(git rev-parse --git-path info/exclude)"
99114 test -f .braid/config || printf 'name = %s\nemail = %s\n' "$(git config user.name)" "$(git config user.email)" > .braid/config
100-grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config # fails without a name and an email
101-braid git import . # the project's whole history: every local branch and tag
102-braid agents init # the rules for agents, in AGENTS.md
115+if grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config; then braid git import . && braid agents init; else echo 'braid: .braid/config has no name or no email: ask the user who signs' >&2; false; fi
103116 ```
104117
105-- The second line makes git ignore every `.braid` in this checkout, and
106- only in this one: braid's directory, and the `.braid` file that marks
107- each workspace, so that nothing of braid's is ever committed with git.
118+- The second and third lines make git ignore every `.braid` in this
119+ checkout, and only in this one: braid's directory, and the `.braid` file
120+ that marks each workspace, so that nothing of braid's is ever committed
121+ with git.
108122 - `.braid/config` names who signs the changesets agents make, here the
109- same person as git's commits. The line after it fails, with exit status
110- 1 and nothing printed, while the file lacks a name or an email, as it
111- does when git has no `user.name` or `user.email`: every commit and
112- landing would then fail with "no author", and the `git commit` below
113- would fail too, or sign with a name and an address that git guesses
114- from the machine. Ask the user for the name and the e-mail address to
115- use. With their answer, set them for this checkout, and let the setup
116- write the file anew:
123+ same person as git's commits. The last line imports the project's whole
124+ history, every local branch and tag, and then writes the rules for
125+ agents into `AGENTS.md`, but only once the file has a name and an email.
126+ Until then it stops and says so, as it does when git has no `user.name`
127+ or `user.email`: every commit and landing would fail with "no author",
128+ and the `git commit` below would fail too. Ask the user for the name and
129+ the e-mail address to use. With their answer, set them for this
130+ checkout, and let the setup write the file anew:
117131
118132 ```bash
119133 git config user.name "<name>"
120134 git config user.email "<email>"
121- rm .braid/config # then start again from the top
135+ rm .braid/config # then run the setup again from its first line
122136 ```
123137
124138 - Most harnesses read `AGENTS.md`. Claude Code reads `CLAUDE.md` instead,
@@ -126,7 +140,9 @@
126140 `@AGENTS.md` to each of them that exists, so that they read the section
127141 too. In Claude Code, each braid command asks for permission unless the
128142 project allows it: offer to add `"Bash(braid:*)"` to `permissions.allow`
129- in `.claude/settings.json`.
143+ in `.claude/settings.local.json`, the user's own settings for this
144+ checkout, which are never committed: braid is set up in this checkout
145+ only.
130146 - `braid agents init` writes a section into `AGENTS.md`, creating the file
131147 if there is none, between a `<!-- braid:start -->` line and a
132148 `<!-- braid:end -->` line. The section tells every agent session to work
@@ -148,14 +164,23 @@
148164 git add AGENTS.md
149165 if [ -f CLAUDE.md ]; then git add CLAUDE.md; fi
150166 if [ -f GEMINI.md ]; then git add GEMINI.md; fi
151-git diff --cached --quiet || git commit -m "Set up braid for agents"
152-braid git import . # braid's main takes the commit
153-braid log main -n 1 # and shows it
167+git diff --cached --quiet || git -c user.useConfigOnly=true commit -m "Set up braid for agents"
168+braid git import . # braid's copy of the branch takes the commit
169+braid cat-object "$(git branch --show-current):AGENTS.md" | grep -q '^<!-- braid:start -->' && grep -q '^name = .' .braid/config && grep -q '^email = .' .braid/config && echo "braid is set up here"
154170 ```
155171
156-If `AGENTS.md`, `CLAUDE.md` or `GEMINI.md` is a symbolic link,
157-`braid agents init` writes the file it points to, and names it: `git add`
158-that file as well.
172+The last line is the check from "Is it installed, and set up here?": it
173+prints "braid is set up here" once the commit is in braid. With
174+`user.useConfigOnly`, git refuses to commit rather than make up a name and
175+an address from the machine; where it says "Author identity unknown", set
176+them as above, then run this block again. If `AGENTS.md`, `CLAUDE.md` or
177+`GEMINI.md` is a symbolic link, `braid agents init` writes the file it
178+points to, and names it: `git add` that file as well.
179+
180+The commit stays in this checkout until it is pushed: the next
181+`braid git sync` takes it to the git remote, with what agents land, and
182+other clones get the rules from there (see "Keeping the git remote up to
183+date"). Tell the user so, and offer to sync now.
159184
160185 ## Every agent session, from then on
161186
@@ -224,20 +249,21 @@
224249 workspace's root. Only `.gitignore` and `.braidignore` apply in a
225250 workspace, not `.git/info/exclude` or a global excludes file: anything
226251 else that must stay local goes in `.braidignore` too. Braid runs no git
227- hooks, so run the project's checks yourself before you land. `land` puts
228- the workspace's changesets on `main`, as a fast-forward or rebased onto
229- whatever landed first.
252+ hooks, so before you land, run the checks that the project's `AGENTS.md`
253+ or `CLAUDE.md` gives. `land` puts the workspace's changesets on `main`,
254+ as a fast-forward or rebased onto whatever landed first.
230255 - **Before a new task**, `braid --agent agent-1 update` brings the
231256 workspace onto `main`. `status --json` says how far behind it is
232257 (`behind_by`).
233258 - **When the session finishes**, what it landed is on braid's `main` only.
234259 The user's checkout and the git remote get it with `braid git sync`, then
235260 `git pull --ff-only`, both from the project root (see "Keeping the git
236- remote up to date"). The session tells the user so, and offers to run
237- them: when to sync is the user's call. Where `git remote get-url origin`
238- fails, the project has no remote of that name: the session asks the
239- user which of those `git remote` lists to sync with, or, where it lists
240- none, says so and offers to make one first (see "No remote?").
261+ remote up to date", which also says what to do when either fails). The
262+ session tells the user so, and offers to run them: when to sync is the
263+ user's call. Where `git remote get-url origin` fails, the project has no
264+ remote of that name: the session asks the user which of those
265+ `git remote` lists to sync with, or, where it lists none, says so and
266+ offers to make one first (see "No remote?").
241267 - **Done**: once everything has landed, `braid workspace remove agent-1`
242268 from the project root. It refuses while the workspace holds work that
243269 has not landed.
@@ -249,8 +275,11 @@
249275 the `name` and `email` in `.braid/config`. With neither, `commit`,
250276 `land` and `update` fail with "no author", and `braid status` lists it
251277 first among what stops a commit: the session asks the user who signs,
252- and writes the answer into `.braid/config` as `name = <name>` and
253- `email = <email>` lines.
278+ and writes the answer into `.braid/config` in the project root (the one
279+ file there that a session may edit) as `name = <name>` and
280+ `email = <email>` lines. The merges that `braid git sync` makes are
281+ signed otherwise: by the `--agent` that ran the sync, with the email in
282+ `.braid/config`.
254283 - New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger
255284 than 1 MiB are held back until `braid track <path>`: `commit` refuses,
256285 naming them, and `--force` leaves them out. Never `braid track` a secret:
@@ -284,14 +313,15 @@
284313 together: it fetches the remote's branch and imports it, then fast-forwards
285314 braid's branch when only the remote moved, pushes braid's branch when only
286315 braid moved, and when both moved, merges them and pushes the merge. The
287-push is a fast-forward with a lease on what was just fetched, so the
288-remote's history is never rewritten; braid never force-pushes, and runs no
289-git hooks. It runs the `git` binary with your environment, so it needs the
290-network and the credentials `git push` uses. Run it from the project root,
291-when the remote should have what landed: who runs it, and when, is the
292-user's call. Braid pushes to the remote's address, so the shared
293-checkout's own record of the remote (`origin/main`) does not move:
294-`git pull --ff-only` brings the checkout up to date.
316+push is a fast-forward, with a lease on what was just fetched, so the
317+remote's history is never rewritten. Braid runs no git hooks. It runs the
318+`git` binary with your environment, so it needs the network and the
319+credentials `git push` uses. Run it from the project root, when the
320+remote should have what landed: who runs it, and when, is the user's
321+call. Braid pushes to the remote's address, so the shared checkout's own
322+record of the remote (`origin/main`) does not move: `git pull --ff-only`
323+brings the checkout up to date. The commands here say `main`: write the
324+branch that the section names.
295325
296326 ```bash
297327 braid --agent agent-1 git sync "$(git remote get-url origin)" --branch main --dry-run --json
@@ -320,9 +350,10 @@
320350 git fetch .braid/export.git main
321351 git merge --ff-only FETCH_HEAD # the shared checkout takes braid's main
322352 git fetch origin main
323- git merge FETCH_HEAD # the remote's: fix the conflicts, then git commit
324- git push
325- braid git sync "$(git remote get-url origin)" --branch main
353+ git merge --no-edit origin/main # the remote's: git stops at conflicts
354+ # if it stopped: fix those files and git add them, then git commit --no-edit --cleanup=strip
355+ git push origin main
356+ braid --agent agent-1 git sync "$(git remote get-url origin)" --branch main
326357 rm -rf .braid/export.git
327358 ```
328359
@@ -331,17 +362,21 @@
331362 braid's branch as the first parent: braid follows a branch's first
332363 parents to tell what a workspace has landed, so the workspaces carry on
333364 from the merge.
365+- If `git pull --ff-only` refuses, the shared checkout has commits of its
366+ own that the remote does not have, and what to do with them is the
367+ user's call. `git pull --rebase` puts them on top of what braid pushed;
368+ then `git push`, and a sync brings them into braid.
334369
335370 No remote? Any bare repository will do. With the user's yes, these lines,
336-run in the shared checkout, make one next to the project, named after it
337-(`../<project>.git`, by an absolute path, which braid reads the same from
338-any directory), and push the main branch to it. If something has that
339-name already, choose another.
371+run in the shared checkout on its main branch, make one next to the
372+project, named after it (`../<project>.git`, by an absolute path, which
373+braid reads the same from any directory), and push the main branch to it.
374+If something has that name already, choose another.
340375
341376 ```bash
342-git init --bare -b main "$PWD.git"
377+git init --bare -b "$(git branch --show-current)" "$PWD.git"
343378 git remote add origin "$PWD.git"
344-git push -u origin main
379+git push -u origin "$(git branch --show-current)"
345380 ```
346381
347382 ## Undoing
@@ -350,7 +385,8 @@
350385 first, with the agent that made it. `braid --agent agent-1 undo` reverts
351386 the newest one that is not undone yet, whoever made it, so read the log
352387 first. A landing undone leaves its changeset in the workspace that made
353- it, ready to land again.
388+ it, ready to land again. A sync undone moves braid's refs back, but not
389+ the git remote: what it pushed stays there.
354390 - A change that landed under other changes cannot be undone that way.
355391 There is no revert command yet: land a change that puts the files back.
356392 - To take braid out of a project: land what the workspaces hold, sync it
@@ -366,8 +402,9 @@
366402 ## What not to do
367403
368404 - Do not edit files, `git add`, `git commit`, `git push` or `git pull` in
369- the shared checkout while you work: only setting up, syncing and merging
370- a sync conflict touch it, as above.
405+ the shared checkout while you work: only setting up, syncing, merging a
406+ sync conflict and naming who signs in `.braid/config` touch it, as
407+ above.
371408 - Do not run git in a workspace, or get around the `.git` file that stops
372409 it there.
373410 - Do not share a workspace between sessions, or work in another session's
modified site/index.html +4 −4
@@ -405,7 +405,7 @@
405405 <h2 id="ask-title"><span data-l="en" lang="en">Ask your agent</span><span data-l="es" lang="es">Pídeselo a tu agente</span></h2>
406406 </div>
407407 <p data-l="en" lang="en">Braid comes with instructions written for coding agents. In a project that is a git repository, ask yours, whatever harness runs it:</p>
408-<p data-l="es" lang="es">Braid trae instrucciones escritas para agentes de programación. En un proyecto que sea un repositorio de git, pídeselo al tuyo, use el arnés que use:</p>
408+<p data-l="es" lang="es">Braid trae instrucciones escritas para agentes de programación. En un proyecto que sea un repositorio de git, pídeselo al tuyo, sea cual sea la herramienta con la que lo uses:</p>
409409 <div class="code prompt" data-l="en" lang="en">
410410 <div class="code-bar"><span>prompt</span><button class="copy" type="button" aria-label="Copy the prompt" data-aria-en="Copy the prompt" data-aria-es="Copiar la petición" hidden><span class="c-idle" data-l="en" lang="en">Copy</span><span class="c-idle" data-l="es" lang="es">Copiar</span><span class="c-done" data-l="en" lang="en">Copied</span><span class="c-done" data-l="es" lang="es">Copiado</span></button></div>
411411 <pre tabindex="0" role="region" aria-label="The prompt for your agent" data-aria-en="The prompt for your agent" data-aria-es="La petición para tu agente"><code>Install braid in this project and set it up for agents, following https://braid.elffuss.com/agents.md (read it whole, with curl -fsSL)</code></pre>
@@ -416,8 +416,8 @@
416416 </div>
417417 <p data-l="en" lang="en">Your agent installs braid with cargo, tells you what in the project braid does not run, such as git hooks, offers to make a git remote if the project has none, imports the project's git history, and writes the rules for agents into its <code>AGENTS.md</code> with <code>braid agents init</code>. From then on, every agent session works in a braid workspace of its own, where git refuses to run, lands through braid, and tells you when what it landed is waiting for a sync to the git remote. Git stays the source of truth, and in a clone where braid is not set up, agents work with git as before.</p>
418418 <p data-l="es" lang="es">Tu agente instala braid con cargo, te avisa de lo que braid no ejecuta en el proyecto, como los hooks de git, se ofrece a crearle un remoto de git si no tiene ninguno, importa su historia de git y, con <code>braid agents init</code>, escribe en su <code>AGENTS.md</code> las reglas para los agentes. A partir de ahí, cada sesión trabaja en su propio espacio de trabajo, donde git se niega a funcionar, aterriza sus cambios con braid y te avisa cuando lo que ha aterrizado está pendiente de sincronizar con el remoto de git. Git sigue siendo la fuente de verdad, y en un clon donde braid no está configurado los agentes trabajan con git, como siempre.</p>
419-<p class="note" data-l="en" lang="en">The instructions are <a href="agents.md">agents.md</a>, part 1 of the repository's <a href="https://github.com/KikoCis/elffuss-braid/blob/main/AGENTS.md"><code>AGENTS.md</code></a>; there is an <a href="llms.txt">llms.txt</a> too. To do it by hand, follow the same steps in <a href="agents.md">agents.md</a>; the quick start below tries braid on its own repository.</p>
420-<p class="note" data-l="es" lang="es">Las instrucciones son <a href="agents.md">agents.md</a>, la primera parte del <a href="https://github.com/KikoCis/elffuss-braid/blob/main/AGENTS.md"><code>AGENTS.md</code></a> del repositorio, en inglés; también hay un <a href="llms.txt">llms.txt</a>. Para hacerlo a mano, sigue los mismos pasos de <a href="agents.md">agents.md</a>; los primeros pasos, justo debajo, prueban braid con su propio repositorio.</p>
419+<p class="note" data-l="en" lang="en">The instructions are <a href="agents.md">agents.md</a>, part 1 of the repository's <a href="https://github.com/KikoCis/elffuss-braid/blob/main/AGENTS.md"><code>AGENTS.md</code></a>; there is an <a href="llms.txt">llms.txt</a> too. To do it by hand, follow the same steps in <a href="agents.md">agents.md</a>; <a href="#start">Quick start</a>, just below, tries braid on its own repository.</p>
420+<p class="note" data-l="es" lang="es">Las instrucciones son <a href="agents.md">agents.md</a>, la primera parte del <a href="https://github.com/KikoCis/elffuss-braid/blob/main/AGENTS.md"><code>AGENTS.md</code></a> del repositorio, en inglés; también hay un <a href="llms.txt">llms.txt</a>. Para hacerlo a mano, sigue los mismos pasos de <a href="agents.md">agents.md</a>; <a href="#start">«Primeros pasos»</a>, justo debajo, prueba braid con su propio repositorio.</p>
421421 </div>
422422 </section>
423423
@@ -572,7 +572,7 @@
572572 </div>
573573 <p class="licence" data-l="en" lang="en">Braid contains no code from git (GPLv2). It reads and writes git data with gitoxide (MIT or <span class="nw">Apache-2.0</span>); <code>git sync</code> also runs the git binary as a subprocess, to set up its mirror, fetch and push.</p>
574574 <p class="licence" data-l="es" lang="es">Braid no contiene código de git (GPLv2). Lee y escribe datos de git con gitoxide (MIT o <span class="nw">Apache-2.0</span>); <code>git sync</code> además ejecuta el binario de git como subproceso, para preparar su espejo, hacer fetch y hacer push.</p>
575-<p class="next-link"><a href="#autosync"><span data-l="en" lang="en">Automatic sync with git</span><span data-l="es" lang="es">Sincronización automática con git</span></a></p>
575+<p class="next-link"><a href="#autosync"><span data-l="en" lang="en">Coming: automatic sync with git</span><span data-l="es" lang="es">Próximamente: sincronización automática con git</span></a></p>
576576 </div>
577577 </section>
578578