#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
#
# lanes — the lanes of the checkout you are in, or every lane, newest first.
#
#   lanes            INSIDE a lane checkout: that repository's lanes, and the
#                    next free position with the exact line that takes it.
#                    Outside one: every lane the register and the logs know.
#   lanes --all      every lane, whatever the cwd — it clears the narrowing
#   lanes --here     only this workstation's lanes
#   lanes --fetch    any of the above, after refreshing from origin
#   lanes --index    any of the above, out of the DERIVED INDEX (Amendment 14)
#   lanes --worktrees [<lane>|--all]
#                    every open worktree the #97 inventory records - owner,
#                    branch, lifecycle, dirty/unpushed, last seen, writer
#                    (opensoft/openRepoTools#161); with --index, out of the
#                    index's `worktrees` table, every workstation it holds
#
# THE DEFAULT IS EVERY LANE, AND THE NARROWING IS BY CHECKOUT (A11 Addendum 4
# ruling 6, ratified "a11 addendum 4 yes" with ruling 6 answered NO, over the
# settlement Brett Heap gave at 2026-09-13T20:38:11Z, verbatim "Narrow inside a
# checkout (Recommended)"). It used to be scoped to the ASKING WORKSTATION,
# which is in no clause: `window-lane` is scoped and the contract says so at
# length, and this read is not. "List the lanes" on a two-workstation estate
# means both. `--here` is the old default, kept as an option.
#
# Installed on PATH by `openRepoTools --install`. Brett Heap's direction of
# 2026-09-13T15:34:30Z, verbatim — "we need a good simple way to restart and
# list the lanes" — and RATIFIED as lane-collision-protocol Amendment 11
# decision 6 on 2026-09-13T18:05:29Z, verbatim "Yes, build `lanes` in A11".
#
# IT IS ITS OWN WORD, AND `pclaude` WITH NO ARGUMENTS IS UNTOUCHED. The other
# half of the same proposal had a bare `pclaude` print this listing, and that
# REPEALS A RATIFIED DECISION: `pclaude` with no arguments prints the PROFILE
# list today (`claude-profile:632`, `action="${1:-list}"`) and Amendment 11's
# ratified decision 1 keeps `list`, `login`, `status` and `run` meaning what
# they mean. `R-A11-9` took the other way out — one new word on PATH, nothing
# repealed, and a listing readable from a bare shell that has never heard of a
# profile.
#
# IT CHANGES NOTHING. Every read is Amendment 7's: out of `origin/<branch>`,
# never the working tree, and it writes nothing, commits nothing and launches
# nothing. It asks nothing either — a listing is output, not a picker
# (ratified decision 3; decision 7 point 5 says why the two are different).
#
# `--index` READS THE DERIVED INDEX, AND ONLY WHEN TYPED (lane-collision-protocol
# Amendment 14(b), ratified "ratify 48"). It is passed to the helper, whose
# published reads of the register and the logs then answer out of
# `lanes-index`'s copy; the rows, the footer and the exit are the source
# read's, and stderr says which was read — `read: index (<store>) at
# register@<sha12>; <k> commits behind`, or `read: sources (index <why>)` where
# the index could not answer and the sources did. Never from the environment
# or a configuration: a listing a person did not ask to read from a copy is
# read from the record.
#
# LOCAL BY DEFAULT, `--fetch` TO REFRESH. Every read in this family sits in
# front of a launch and a person typing one word wants an answer now, so the
# default passes `LANES_NO_FETCH=1` and the listing says how old the checkout's
# answer is. A stale answer a reader can see is worth more than a fresh one
# they waited on.
#
# A LIVE FORK IS SHOWN AS A DEFECT TO RETIRE (ratified decision 8(e), from
# Evidence 6). On 2026-09-13 an abandoned launch of a lane left behind a
# `--fork-session` daemon of its transcript — a new session id, `kind: bg`, no
# tmux, cwd `/workspace` — that went on orchestrating the same plan, relaunched
# writers on the same three branches, wrote `RESUMED` and `PAUSED` lines into
# the lane's log and messaged the interactive session claiming to be the holder
# while citing a dead pid. It is never a holder and it must never write the
# register; this listing names it, and the ONE act it prints is clause (k) rule
# (e)'s — `lane-end <lane> --retire <pid|uuid>`, which PROVES the pid or uuid is
# this lane's live fork and prints Amendment 6(d) filled in for it. IT WRITES
# NOTHING (#26, the review of `29d3417`): a `RETIRED` carrying a payload would
# be a seventh edit to in-force text and Amendment 7(b) gives that verb none, so
# the read goes on naming the fork until the person takes 6(d) — which is what
# the footer this command prints has said all along, and what this comment did
# not. It kills nothing either; ending somebody's process is not a tool's act
# (Amendment 8(f)).
#
# EXIT CODES, AND THEY ARE THE CONTRACT'S RATHER THAN THIS COMMAND'S (SPEC §15,
# and clause (h)'s row for the read behind it): `0` rows · `8` none · `64` usage
# · `2` A HELPER PREDATING AMENDMENT 11 · `1` a read failed.
#
# `64` AND `2` WERE THE WRONG WAY ROUND until this round (F-X4). A typo exited 2
# where the contract gives 64, and a workstation whose `lanes-edit.sh` predates
# this amendment — which is EVERY workstation until adoption act 3's install
# reaches it — exited 1, the code reserved for a read that broke, where the
# contract gives 2. The helper's own `lanes)` arm had them right all along; only
# the command in front of it did not. `1` is this command's own and is not in the
# contract's four: it is the residue, a read that answered nothing recognisable.
#
#   $LANES_EDIT   the register's reader (default: lanes-edit.sh beside this file)
#
# `lane <name>` BINDS one of these — the launcher for a parked one, the attach
# for one live here — and a bare `lane` is that listing as a NUMBERED PICK with
# one question under it (Amendment 18 Addendum 1). This command asks nothing and
# binds nothing: it is the read, and it shows the rows a pick hides — the closed
# lanes, the dormant ones, and every column.

set -euo pipefail

prog="${0##*/}"
SELF="${BASH_SOURCE[0]:-$0}"
selfdir="$(cd -- "$(dirname -- "$SELF")" && pwd)"

say() { printf '%s\n' "$*"; }
die() { printf '\n%s: REFUSED: %s\n' "$prog" "$1" >&2; exit "${2:-64}"; }

usage() {
	cat <<'USAGE'
lanes [--fetch] [--index] [--all] [--here] [--closed] [--repo <owner/repo>]
      [--dir <path>] [--prefix <repo>] [--ws <workstation>]
      [--rename <old> <new>]
lanes --worktrees [<lane> | --all] [--index] [--fetch]

Inside a lane checkout: THAT REPOSITORY's lanes, ending with the next free
position and the exact `lane-start <repo> <n>` that takes it. Outside one: every
lane the register and the lane logs know. Newest activity first: name, state,
workstation, profile, tmux window, last transcript uuid, directory, held objects
and age — and the ONE act for it: for a PAUSED lane the exact command that binds
it, and for a LIVE one the exact `tmux` that attaches to it, because a lane that
is running is never started a second time.

  --fetch          refresh from origin first. Without it the read is LOCAL and
                   the foot of the listing says how old this checkout's answer
                   is: a person typing one word wants an answer now.
  --index          read the DERIVED INDEX instead of the published register
                   and logs (Amendment 14): the same rows, the same exit, and
                   one line on stderr saying which was read — `read: index
                   (<store>) at register@<sha12>; <k> commits behind`, or
                   `read: sources (index <why>)` where the index cannot
                   answer and the sources do. Only when typed: never from the
                   environment or a configuration.
  --all            every lane, whatever the cwd: it clears the checkout
                   narrowing as well as any --repo/--dir/--ws given with it.
  --prefix <repo>  the lanes NAMED for that repository, and the next free
                   position for it. `lane-start <repo>` with no position asks
                   for exactly this rather than rendering a listing of its own.
  --here           only this workstation's lanes. This was the default before
                   Amendment 11 Addendum 4 ruling 6 and is an option now.
  --closed         add the CLOSED and the DORMANT lanes, which this listing
                   leaves out by default (Amendment 19(b)). CLOSED is a lane
                   whose object log's last lane-kind line is ENDED or RETIRED;
                   DORMANT is a row with NO object log and no live session here
                   — a lane from before Amendment 7, or one whose log was never
                   created. Each gets a second line saying which it is, when it
                   started, what its state cell still says, and whether that
                   cell says the work was unpushed, lost or owed. It combines
                   with --all, --here and the narrowing flags; the NEXT FREE
                   POSITION below always counts them, listed or not.
  --repo <o/r>     only lanes whose register home is that repository.
  --dir <path>     only lanes whose recorded directory is that path.
                   --repo and --dir together are an OR, not an AND: a lane's
                   home repository and the checkout it sits in are not the same
                   fact.
  --ws <name>      another workstation's lanes.
  --worktrees [<lane> | --all]
                   every open worktree of one lane, or of every lane: the #97
                   inventory each lane's handoff recorded beside it — owner,
                   branch, lifecycle, dirty and unpushed counts, when it was
                   last seen and whether the lane's writer is live
                   (opensoft/openRepoTools#161). Every field is that LAST
                   OBSERVATION and nothing is recomputed: the current truth of a
                   lane is `lanes-edit.sh lane-reconcile <lane>`, which reads the
                   disk. Without --index it reads this workstation's sidecars;
                   WITH it, the derived index's `worktrees` table — every
                   workstation syncing into that store, so Raven sees Eagle's
                   leftovers — and stderr says which, as for the listing. It
                   takes none of the listing's narrowing flags. A lane whose
                   inventory could not be read is a NOT READ line, and a lane
                   listing that could not be read whole a NOT WHOLE line
                   (opensoft/openRepoTools#173): neither is a lane with no
                   worktrees.
  --rename <old> <new>
                   REFUSED, and it names the word that does it:
                   `lane-rename <old> <new>`. This command writes nothing
                   (Amendment 11(j)) and a rename is four files in one commit,
                   so the act is a word of its own (Amendment 16(h)) — the
                   option is here because that is the spelling a person reaches
                   for, and an option that is silently unknown answers them
                   with a usage line instead of the act.
  -h, --help       this.

Exit: 0 rows · 8 none · 64 usage · 2 a helper predating Amendment 11 · 1 a read failed.

It writes nothing, launches nothing and asks nothing. `lane <name>` is what
BINDS one — the launcher for a parked lane, the attach for one live here — and a
bare `lane` is this listing as a numbered pick with one question under it.
RENAMING one is `lane-rename <old> <new>`, a word of its own for the same reason
(Amendment 16(h)); `lanes --rename` is refused and names it.
USAGE
}

LANES_EDIT="${LANES_EDIT:-}"
if [ -z "$LANES_EDIT" ]; then
	if [ -x "$selfdir/lanes-edit.sh" ]; then LANES_EDIT="$selfdir/lanes-edit.sh"
	else LANES_EDIT="$(command -v lanes-edit.sh 2>/dev/null || printf '')"
	fi
fi
[ -n "$LANES_EDIT" ] && [ -x "$LANES_EDIT" ] || die "no register reader at ${LANES_EDIT:-lanes-edit.sh} — it is installed beside this
    command by \`openRepoTools --install\`. Run that, or set \$LANES_EDIT." 1

do_fetch=0
# `--index` IS PASSED THROUGH AND NEVER MIMICKED HERE: the helper owns the
# store and the fallback, exactly as it owns the network for `--fetch`.
idx_args=()
closed=0            # 1 once `--closed` has been seen
narrowed=0          # 1 once anything has narrowed the listing
all_given=0         # 1 once `--all` has been seen, wherever in the line it was
# THE REPOSITORY THIS LISTING IS ABOUT, where it is about one. Set from the
# checkout around the cwd, or named by `--prefix <repo>` — which is how
# `lane-start <repo>` with no position asks for this listing rather than
# rendering a second one of its own (A11 Addendum 4 ruling 6's third delta,
# tracked as `opensoft/openRepoTools#28`). Its presence is what turns on the
# NEXT FREE POSITION footer.
here_repo=""
args=()
# `--worktrees` (opensoft/openRepoTools#161) TAKES ONE POSITIONAL, THE LANE, and
# the listing takes none — so whether this line asks for worktrees is known
# before the loop below meets a positional, wherever the flag stands in it.
wt_mode=0
wt_lane=""
# `${1+"$@"}` AND NOT A BARE `"$@"`: bash 3.2 under `set -u` calls the empty
# `"$@"` of a bare `lanes` an unbound variable and exits (tests/run.sh says why).
for wt_a in ${1+"$@"}; do
	case "$wt_a" in --worktrees) wt_mode=1 ;; esac
done
while [ $# -gt 0 ]; do
	case "$1" in
	-h | --help) usage; exit 0 ;;
	--fetch) do_fetch=1; shift ;;
	--index) idx_args=(--index); shift ;;
	--worktrees) shift ;;
	# `--all` CLEARS THE LABEL AS WELL AS THE FILTERS. The helper's `--all` drops
	# `--repo`, `--dir` and `--prefix`, so the ROWS were right — but `here_repo`
	# is this wrapper's own, and `lanes --all --prefix repoA11` (either order)
	# listed every lane in the estate under a footer that said "of repoA11" and
	# offered a next free position computed from one repository's rows. A count
	# that names a repository it did not narrow to is worse than no count.
	--all) args+=(--all); narrowed=0; here_repo=""; all_given=1; shift ;;
	--here) args+=(--here); narrowed=1; shift ;;
	# `--closed` IS NOT A NARROWING AND MUST NOT LOOK LIKE ONE. It widens the
	# listing, so it neither sets `narrowed` nor joins `args` here: the array
	# being empty is what the checkout narrowing below is gated on, and a flag
	# sitting in it would stop `lanes --closed` inside a checkout meaning "this
	# repository's lanes, the closed ones included". It is appended after that
	# block instead.
	--closed) closed=1; shift ;;
	--repo | --dir | --ws | --prefix)
		[ -n "${2-}" ] || die "$1 needs a value — see $prog --help" 64
		[ "$1" = --prefix ] && here_repo="$2"
		args+=("$1" "$2"); narrowed=1; shift 2 ;;
	--repo=* | --dir=* | --ws=* | --prefix=*)
		flag="${1%%=*}"; val="${1#*=}"
		[ -n "$val" ] || die "$flag needs a value — see $prog --help" 64
		[ "$flag" = --prefix ] && here_repo="$val"
		args+=("$flag" "$val"); narrowed=1; shift ;;
	# AMENDMENT 16(h) — `lanes` STAYS READ-ONLY, AND THE REFUSAL NAMES THE WORD.
	# Brett Heap's request of 2026-09-14 spelled the act on this command —
	# verbatim *"maybe lanes --rename <current lane name> <new lane name>"* —
	# and the ratified spelling is a word of its own, because Amendment 11(j)'s
	# *"it writes nothing"* is what makes this listing safe to run in front of
	# every launch, and one writing option would make that sentence untrue of
	# the command rather than of the option. So the flag is answered rather
	# than silently unknown: a person who reaches for it gets the act, not a
	# usage line.
	--rename | --rename=*)
		rn_a="${2-}"; rn_b="${3-}"
		[ "${1%%=*}" = "$1" ] || { rn_a="${1#--rename=}"; rn_b="${2-}"; }
		die "\`lanes\` writes nothing, launches nothing and asks nothing (Amendment 11(j)), and a
    rename is four files in one commit. The word is its own:

        lane-rename ${rn_a:-<old>} ${rn_b:-<new>}

    It moves the row, the object log, the handoff and lanes/aliases.tsv in ONE
    commit, comments on every object the lane holds, renames the window and types
    the \`/rename\` — and the old name resolves for ever afterwards, here included
    (lane-collision-protocol Amendment 16)." 64 ;;
	--) shift ;;
	-*) die "unknown option '$1' — see $prog --help" 64 ;;
	*)
		if [ "$wt_mode" = 1 ] && [ -z "$wt_lane" ]; then
			wt_lane="$1"; shift
		elif [ "$wt_mode" = 1 ]; then
			die "--worktrees takes ONE lane, or --all — see $prog --help" 64
		else
			die "lanes takes no positional arguments; did you mean \`lane $1\`? — see $prog --help" 64
		fi ;;
	esac
done

# ------------------------------------------------ `--worktrees` (#161)
#
# EVERY OPEN WORKTREE, rendered from `lanes-edit.sh worktrees`' rows — the #97
# inventory as each lane's handoff last recorded it, read from this
# workstation's sidecars, or with `--index` from the derived index's
# `worktrees` table, which holds every workstation that syncs into it. Where
# the index is current, this workstation's rows are the same bytes either way,
# and a store no other workstation syncs into prints exactly the source read;
# stderr says which was read. It recomputes nothing and it decides nothing: the act
# that reads the disk is `lanes-edit.sh lane-reconcile <lane>`, and the footer
# says so.
US="$(printf '\037')"
if [ "$wt_mode" = 1 ]; then
	for wt_a in ${args[@]+"${args[@]}"}; do
		[ "$wt_a" = --all ] && continue
		die "--worktrees takes ONE lane or --all, and none of the listing's narrowing flags ('$wt_a' was given) — see $prog --help" 64
	done
	[ "$closed" = 0 ] || die "--worktrees takes ONE lane or --all, not --closed: a closed lane's worktrees are listed with every other's — see $prog --help" 64
	[ "$all_given" = 0 ] || [ -z "$wt_lane" ] || die "--worktrees takes ONE lane OR --all, not both — see $prog --help" 64
	wt_args=()
	if [ -n "$wt_lane" ]; then wt_args+=("$wt_lane"); else wt_args+=(--all); fi
	[ "$do_fetch" = 1 ] && wt_args+=(--fetch)
	rc=0
	wt_err=""
	wt_err_file="$(mktemp "${TMPDIR:-/tmp}/lanes-worktrees.XXXXXX" 2>/dev/null || printf '')"
	if [ -n "$wt_err_file" ]; then
		out="$("$LANES_EDIT" worktrees ${idx_args[@]+"${idx_args[@]}"} "${wt_args[@]}" 2>"$wt_err_file")" || rc=$?
		wt_err="$(cat -- "$wt_err_file" 2>/dev/null || printf '')"
		# `-e` AND NO `--` AFTER THE PATTERN: BSD's `grep` stops at its first
		# operand, so a `--` there is a FILE it cannot open on macOS. A BARE
		# `grep`, NOT `command grep` (opensoft/openRepoTools#292): this one exits
		# 1 whenever the helper said nothing else, and macOS's bash 3.2 ends a
		# `set -e` script where a utility run through `command` fails, `|| :`
		# or not, which left `lanes --worktrees` at exit 1 with no output.
		grep -v -e 'not fetching; reading origin/' "$wt_err_file" >&2 || :
		rm -f -- "$wt_err_file"
	else
		out="$("$LANES_EDIT" worktrees ${idx_args[@]+"${idx_args[@]}"} "${wt_args[@]}")" || rc=$?
	fi
	case "$rc" in
	0) : ;;
	8)
		say "no worktree is inventoried${wt_lane:+ for lane $wt_lane}."
		say "  each handoff records its lane's trees (lanes-edit.sh set-lane-tree); the disk itself is read by"
		say "  lanes-edit.sh lane-reconcile <lane>"
		exit 8 ;;
	64) die "bad arguments for the worktrees read — see $prog --help" 64 ;;
	2)
		case "$wt_err" in
		*"unknown subcommand 'worktrees'"*)
			die "the \`lanes-edit.sh\` on this workstation has no \`worktrees\` read, so it
    predates opensoft/openRepoTools#161. Nothing is wrong with the inventory —
    take the install:  openRepoTools --install" 2 ;;
		esac
		exit 2 ;;
	*) die "$LANES_EDIT worktrees failed (exit $rc). That is NOT 'no worktree is inventoried', and
    this command will not print an empty listing on an answer it did not get
    (Amendment 7(d)). Run it by hand to see what it says." 1 ;;
	esac
	printf '%-11s %-26s %-16s %-13s %-7s %-34s %5s %8s  %-20s  %s\n' \
		WORKSTATION LANE OWNER LIFECYCLE WRITER BRANCH DIRTY UNPUSHED "LAST SEEN" PATH
	n=0; nl=0; nw=0; wt_unread=0; wt_partial=0; wt_lanes=" "; wt_wss=" "
	while IFS="$US" read -r w_kind w_ws w_lane w_owner w_path w_branch w_base w_life w_gen w_op w_live w_seen w_last w_dirty w_unp w_prov; do
		case "${w_kind:-}" in
		PARTIAL)
			# `PARTIAL <ws> <why>` (#173 item c1): the LANE LISTING these rows
			# were read through was not whole, and the second field — read
			# into `w_lane` — says which read failed.
			printf '%-11s %-26s lane listing NOT WHOLE: %s\n' "$w_ws" "(every lane)" "$w_lane"
			wt_partial=$((wt_partial + 1)) ;;
		TREE)
			case "${w_live:-}" in 1) w_wr=live ;; 0) w_wr=none ;; *) w_wr=unknown ;; esac
			printf '%-11s %-26s %-16s %-13s %-7s %-34s %5s %8s  %-20s  %s\n' \
				"$w_ws" "$w_lane" "${w_owner:-unknown}" "${w_life:-INDETERMINATE}" "$w_wr" \
				"${w_branch:-unknown}" "${w_dirty:-?}" "${w_unp:-?}" "${w_seen:-never}" "$w_path"
			n=$((n + 1))
			case "$wt_lanes" in *" $w_ws/$w_lane "*) : ;; *) wt_lanes="$wt_lanes$w_ws/$w_lane "; nl=$((nl + 1)) ;; esac
			case "$wt_wss" in *" $w_ws "*) : ;; *) wt_wss="$wt_wss$w_ws "; nw=$((nw + 1)) ;; esac ;;
		UNREAD)
			# `UNREAD <ws> <lane> <why>`: the third field is the reason.
			printf '%-11s %-26s inventory NOT READ: %s\n' "$w_ws" "$w_lane" "$w_owner"
			wt_unread=$((wt_unread + 1)) ;;
		esac
	done <<EOF
$out
EOF
	say ""
	say "$n worktree(s) in $nl lane(s) on $nw workstation(s), each as its lane's inventory last recorded it (LAST SEEN); nothing here is recomputed."
	if [ "$wt_unread" != 0 ]; then
		say "$wt_unread lane(s) above have an inventory that is there and could not be read: that is NOT a lane with no worktrees."
	fi
	if [ "$wt_partial" != 0 ]; then
		say "the lane listing above is NOT WHOLE: a lane it could not name is missing from it, and that is NOT a lane with no worktrees."
	fi
	# THE ACT IS NAMED WITH WHERE IT RUNS (opensoft/openRepoTools#173, Copilot's
	# fourth review of #171). An `--index` listing holds every workstation that
	# syncs into the store, so Raven lists Eagle's rows, and `lane-reconcile`
	# reads only the sidecars and the disk of the workstation it is run on. The
	# line is the same on both reads, so the two stay the same bytes.
	say "  the current truth of one lane:  lanes-edit.sh lane-reconcile <lane>, run ON THE WORKSTATION its rows name   (it reads that workstation's own sidecars and disk; this listing decides nothing)"
	exit 0
fi

# `--all` WINS WHEREVER IT APPEARS IN THE LINE, so the label is cleared after the
# loop and not inside the arm: `lanes --all --prefix repoA11` and
# `lanes --prefix repoA11 --all` are the same command and must print the same
# footer. The helper drops the FILTERS on `--all`; `here_repo` is this wrapper's
# own and is what the footer, the count and the next-free-position are computed
# from.
if [ "$all_given" = 1 ]; then here_repo=""; fi

# THE BARE WORD INSIDE A LANE CHECKOUT NARROWS TO THAT REPOSITORY (Brett Heap's
# settlement of 2026-09-13T20:38:11Z, verbatim "Narrow inside a checkout
# (Recommended)"; A11 Addendum 4 ruling 6; SPEC rev 6 §15).
#
# THE NARROWING IS THE READ'S OWN, not a second filter: `--dir` is clause (i)'s
# and defaults here to the checkout around the cwd, `--repo` is that checkout's
# `origin`, and the two are an OR — a lane's home repository and the checkout it
# sits in are not the same fact. `--prefix` is the third term and is the LABEL
# fallback, used by the read only where a lane has neither a home nor a `dir`:
# a row with no log at all cannot be filed by either, and its name is the only
# thing left. A lane whose home DISAGREES with its prefix is filed by its home.
#
# ANY EXPLICIT NARROWING SUPPRESSES THIS. `--repo`, `--dir`, `--ws` and `--here`
# are the caller saying which lanes they mean, and `--all` says every one.
origin_nwo() {
	url="$(git -C "${1:-.}" remote get-url origin 2>/dev/null || :)"
	[ -n "$url" ] || return 1
	nwo="$(printf '%s\n' "$url" | sed -E 's#\.git$##; s#^git@[^:]+:##; s#^ssh://[^/]+/##; s#^https?://[^/]+/##')"
	printf '%s\n' "$nwo" | grep -qE '^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$' || return 1
	printf '%s\n' "$nwo"
}
# THE REPOSITORY IS THE ONE `origin` NAMES, AND THE DIRECTORY'S NAME IS THE
# FALLBACK — not the other way round. `basename $(git rev-parse --show-toplevel)`
# is the name of the DIRECTORY this shell is standing in, and inside a WORKTREE
# that is the worktree's own name: run in a worktree of `openRepoTools` called
# `ort-a11` it narrowed to a repository called `ort-a11`, found none, and offered
# `lane-start ort-a11 1` — a lane whose `$PROJECTS_ROOT/<repo>` cannot exist.
# Every lane on this estate is named for the repository, which is what `origin`
# says and what `repos.tsv` aliases, so the origin's own repository name is the
# prefix wherever there is an origin. A checkout with no origin keeps the
# directory name, because there is nothing else to have.
here_root=""; here_nwo=""
if [ "$narrowed" = 0 ] && [ ${#args[@]} -eq 0 ]; then
	here_root="$(git rev-parse --show-toplevel 2>/dev/null || :)"
	if [ -n "$here_root" ]; then
		here_nwo="$(origin_nwo "$here_root" 2>/dev/null || :)"
		if [ -n "$here_nwo" ]; then here_repo="${here_nwo#*/}"; else here_repo="$(basename -- "$here_root")"; fi
		args+=(--dir "$here_root" --prefix "$here_repo")
		[ -n "$here_nwo" ] && args+=(--repo "$here_nwo")
	fi
fi

if [ "$closed" = 1 ]; then args+=(--closed); fi

ws_pair="$("$LANES_EDIT" workstation 2>/dev/null || :)"
ws_name="$(printf '%s' "$ws_pair" | cut -f1)"
ws_src="$(printf '%s' "$ws_pair" | cut -f2)"

# THE CONTAINER NOTICE, ON THE TOKEN THE HELPER ACTUALLY EMITS AND IN THE
# HELPER'S OWN WORDS (`R-A11-14`, ratified verbatim "a11 addendum 3 yes").
#
# Two defects were in the three lines this replaces. The branch was
# `hostname-in-container`, which `lanes_workstation_pair` has never emitted —
# its three sources are `seam`, `hostname` and `container-unset`
# (`lanes-edit.sh:371-383`) — so the notice could not print at all. And what it
# printed was the act this toolset REJECTS BY NAME: `lanes-edit.sh:337-339`,
# *"the rejected alternative — a `workstation:` key in `workspace.yaml` — is a
# SECOND PLACE FOR THE TRUTH TO BE WRONG beside the variable the launcher
# already sets."*
#
# THE SENTENCE IS ASKED FOR RATHER THAN RESTATED. `lanes_workstation_why` is the
# one wording three writers already share, and this command carries no copy of
# the workstation seam — the four that exist are byte-identical and held together
# by `test_repo_hygiene.py`, and a fifth here would be the drift that test exists
# to catch. `lanes-edit.sh workstation` prints that sentence on stderr and still
# answers on stdout, because a read in front of a launch may not refuse; the read
# above discarded that stderr, so this asks for it again. One extra 0.04 s fork,
# and only on the path that is already printing a paragraph.
#
# IT IS A FUNCTION BECAUSE THE EMPTY LISTING NEEDS IT MOST. In a container with
# no `LANES_WORKSTATION` the workstation column is the CONTAINER'S id, so no row
# matches and the read exits 8 — and that is exactly the reader who has to be
# told why their lanes vanished. Printed at the foot on the rows path and inside
# the 8 arm on the other, from one definition.
ws_notice() {
	case "$ws_src" in
	container-unset)
		say ""
		"$LANES_EDIT" workstation 2>&1 >/dev/null || : ;;
	esac
}

# LOCAL IS THE HELPER'S OWN DEFAULT for this one read (SPEC rev 4 §15), so
# `--fetch` is passed through rather than simulated here: one implementation of
# "does this read touch the network", in the file that owns the network.
#
# AND A FETCH THAT DID NOT HAPPEN IS NOT A FETCH (#26, the fail-closed family,
# `lanes:236`, taken on Brett Heap's word "Take it first, then land"). A read
# that fetches MAY NOT REFUSE — it sits in front of a launch — so `log_sync`
# falls back to the local refs and says so on stderr, *"fetch failed — reading
# the logs as they stand locally"*, and answers 0. This command threw that
# sentence away with `2>/dev/null` and then printed *"as of a fetch just now"*
# over the top of it: the one line in the output a person reads to decide
# whether the answer is CURRENT, asserting something the run had already been
# told was false. The stderr of the fetch path is kept and rendered; the stderr
# of the local path still is not, because there the notice is `LANES_NO_FETCH=1`
# saying what the caller asked for.
#
# AND THE FALLBACK THAT MADE NO CAPTURE FILE THREW THEM AWAY AGAIN (#26, the
# review of `c3ebcfe`, `lanes:280`). Where `mktemp` cannot make a file — a
# `$TMPDIR` that is gone, full or not writable — this read ran with
# `2>/dev/null`, so the helper's fallback sentence went to the same place it
# went before this was fixed at all and the footer printed "as of a fetch just
# now" over it. The temporary file is a CONVENIENCE for reading the notice back;
# without one the notice still belongs to the person, so it is PASSED THROUGH to
# the terminal and the footer stops asserting a freshness this run cannot check.
rc=0
fetch_err=""
fetch_unchecked=0
if [ "$do_fetch" = 1 ]; then
	fetch_err_file="$(mktemp "${TMPDIR:-/tmp}/lanes-fetch.XXXXXX" 2>/dev/null || printf '')"
	if [ -n "$fetch_err_file" ]; then
		out="$("$LANES_EDIT" lanes --fetch ${idx_args[@]+"${idx_args[@]}"} ${args[@]+"${args[@]}"} 2>"$fetch_err_file")" || rc=$?
		fetch_err="$(cat "$fetch_err_file" 2>/dev/null || printf '')"
		rm -f -- "$fetch_err_file"
		# THE ONE LINE THAT SAYS WHICH WAS READ reaches the person on this path
		# too: the rest of this stream is rendered below only where the fetch
		# fell back, and `read: …` is not about the fetch.
		printf '%s\n' "$fetch_err" | command grep '^read: ' >&2 || :
		# …AND ONLY THERE (Copilot round 3 on #164): the notes are rendered
		# again, on STDOUT, under a fetch that fell back, where a `read:` line
		# would be said twice and would make `--index` change the listing.
		fetch_err="$(printf '%s\n' "$fetch_err" | command grep -v '^read: ' || :)"
	else
		out="$("$LANES_EDIT" lanes --fetch ${idx_args[@]+"${idx_args[@]}"} ${args[@]+"${args[@]}"})" || rc=$?
		fetch_unchecked=1
	fi
else
	# AND THE LOCAL PATH'S STDERR IS NOT ONE KNOWN SENTENCE ANY MORE (#26, the
	# review of `37632b1`, `lanes:293`). `2>/dev/null` was written when the only
	# thing on that stream was the helper saying `LANES_NO_FETCH=1` — the notice
	# this command asks for, on every local read, which is why it was silenced.
	# The helper now also says there that this workstation's SESSION RECORDS could
	# not be read, which is the line telling a person that the STATE column is the
	# log's verb alone and that a lane showing IDLE may be live. So the stream is
	# KEPT and the one expected sentence is dropped out of it, rather than the
	# stream being dropped for the sake of that sentence.
	local_err_file="$(mktemp "${TMPDIR:-/tmp}/lanes-local.XXXXXX" 2>/dev/null || printf '')"
	if [ -n "$local_err_file" ]; then
		out="$("$LANES_EDIT" lanes ${idx_args[@]+"${idx_args[@]}"} ${args[@]+"${args[@]}"} 2>"$local_err_file")" || rc=$?
		# `-e` BEFORE THE `--` (#54, the shape #53 fixed at `skills/restart/SKILL.md`):
		# with the pattern as a bare operand a getopt that does not permute —
		# BSD's, so every macOS shell, and GNU's under `POSIXLY_CORRECT` — takes
		# the pattern for the first operand and reads `--` as a second, a FILE it
		# cannot open. `-e` makes the pattern an option's argument, so `--` ends
		# the options where it says it does.
		grep -v -e 'not fetching; reading origin/' -- "$local_err_file" >&2 || :
		rm -f -- "$local_err_file"
	else
		# No capture file, so nothing is filtered and everything reaches the
		# person — the same answer the fetch path gives one branch up.
		out="$("$LANES_EDIT" lanes ${idx_args[@]+"${idx_args[@]}"} ${args[@]+"${args[@]}"})" || rc=$?
	fi
fi

# THE ONE PHRASE, AND IT IS THE HELPER'S OWN (`lanes-edit.sh:2902`): both the
# failure and the timeout end *"reading the logs as they stand locally"*, so one
# test covers both and neither is restated here.
fetch_fell_back=0
case "$fetch_err" in
*"reading the logs as they stand locally"*) fetch_fell_back=1 ;;
esac
case "$rc" in
0) : ;;
8)
	if [ -n "$here_repo" ]; then
		# AN EMPTY REPOSITORY STILL GETS THE ANSWER A PERSON CAME FOR: the next
		# free position, and the line that takes it, printed filled in.
		#
		# AND AN EMPTY LISTING IS NO LONGER AN EMPTY REGISTER (Copilot round 2 on
		# #93). Since Amendment 19(b) a repository whose every row is CLOSED or
		# DORMANT lists NOTHING — and its positions are all taken. Printing
		# "next free position: 1" there would hand out a number a retired lane
		# holds, which is the one thing 19(b) exists to prevent. So the position
		# is ASKED FOR rather than assumed: `next-free` reads the register and
		# the archive itself, so it answers over an empty listing.
		e_next=""; e_rc=0
		e_next="$(printf '' | "$LANES_EDIT" next-free "$here_repo" 2>/dev/null)" || e_rc=$?
		if [ "$e_rc" != 0 ]; then e_next=""; fi
		case "${e_next:-}" in '' | *[!0-9]*) e_next="" ;; esac
		# WHETHER THERE ARE HIDDEN ROWS IS ASKED, NOT INFERRED FROM THE NUMBER
		# (Copilot round 3 on #93). `next-free != 1` was a proxy, and it is wrong
		# for the register that holds ONE hidden row at position 2 or later:
		# there the lowest free position really is 1, and the listing would have
		# said "no lane is recorded" about a repository that has one. The
		# `--closed` read answers it directly, and it is made HERE — on the path
		# that has already found nothing to show — and nowhere else.
		e_hidden=0
		e_hrc=0
		# THE WHOLE STREAM IS READ, AND THE STATUS DECIDES BEFORE THE TEXT DOES
		# (#138 item 15, Copilot round 20 on #93, and the gap beside it). `grep
		# -q .` exits on the first line, and past a pipe buffer's worth of rows
		# the producer then takes SIGPIPE: under `pipefail` the pipeline answered
		# 141, `e_hidden` stayed 0, and the listing said none was recorded about
		# a repository with hidden rows. Reading the output into a variable
		# closes nothing on the producer. And a read that FAILED, with rows or
		# without, answered the same "none is recorded": the status is kept. `0`
		# and `8` are answers, and rows it printed are rows (an `8` that printed
		# some is a contradiction and fails towards showing them); anything
		# else is a read that did not answer (Amendment 7(d)).
		e_rows="$("$LANES_EDIT" lanes --closed ${idx_args[@]+"${idx_args[@]}"} ${args[@]+"${args[@]}"} 2>/dev/null)" || e_hrc=$?
		case "$e_hrc" in
		0 | 8) case "$e_rows" in *[![:space:]]*) e_hidden=1 ;; esac ;;
		*) e_hidden=unread ;;
		esac
		if [ "$e_hidden" = 1 ]; then
			say "no lane of $here_repo is LISTED — and that is not the same as none being recorded: closed and dormant lanes are left out (Amendment 19(b))."
			say ""
			say "  see them:            $prog --closed --prefix $here_repo"
		elif [ "$e_hidden" = unread ]; then
			say "no lane of $here_repo is LISTED — and whether closed or dormant lanes are recorded could not be read (\`lanes-edit.sh lanes --closed\` exited $e_hrc), so this listing does not say that none is (Amendment 7(d))."
			say ""
			say "  try it by hand:      $prog --closed --prefix $here_repo"
		else
			say "no lane of $here_repo is recorded."
			say ""
		fi
		# A helper without `next-free` (exit 2) cannot know whether a hidden or
		# archived row owns position 1. Every failed or malformed answer refuses
		# to offer a number, including this mixed-version workstation.
		if [ "$e_rc" = 0 ] && [ -n "$e_next" ]; then
			say "  next free position:  $e_next"
			say "  take it:             lane-start $here_repo $e_next"
		else
			say "  the next free position could not be read as a valid number"
			say "  (\`lanes-edit.sh next-free\` exited $e_rc). This listing will not offer a position"
			say "  over a read that did not"
			say "  answer (Amendment 7(d)) — a row it missed is a position it would hand out"
			say "  twice. Run it by hand to see what it says:"
			say "    printf '' | $LANES_EDIT next-free $here_repo"
		fi
		say "  every lane:          $prog --all"
	else
		say "no lane is recorded${ws_name:+ that $ws_name can see}."
		say "  open one:            lane-start <repo> <n>"
		say "  this workstation:    $prog --here"
	fi
	# AN EMPTY LISTING AFTER A FETCH THAT FELL BACK IS THE CASE THAT MATTERS
	# MOST: "no lane is recorded" read off a stale checkout is the answer a
	# person is likeliest to act on, and the likeliest to be wrong.
	if [ "$fetch_fell_back" = 1 ]; then
		say ""
		say "  and the fetch did not answer, so that is this checkout's own copy:"
		printf '%s\n' "$fetch_err" | sed -n 's/^/  /p'
	elif [ "$fetch_unchecked" = 1 ]; then
		say ""
		say "  and whether the fetch answered is UNKNOWN — no temporary file could be made"
		say "  to read the helper's own notes back, so they went to the terminal above"
		say "  rather than into this line. That may be this checkout's own copy."
	fi
	ws_notice
	exit 8 ;;
64) die "bad arguments for the listing read — see $prog --help" 64 ;;
# A HELPER PREDATING AMENDMENT 11, AND IT IS EXPECTED RATHER THAN BROKEN. `2` is
# what a `lanes-edit.sh` with no `lanes` subcommand exits, exactly as a
# pre-Amendment-8 one did for `swapped` (`lanes-edit.sh:4818-4826`), and until
# act 3's install reaches a workstation that is what every one of them answers.
# The contract gives it its own code so a caller can tell it from a read that
# broke, and the message names the act rather than the rule.
2) die "the \`lanes-edit.sh\` on this workstation has no \`lanes\` subcommand, so it
    predates lane-collision-protocol Amendment 11. That is not a failure and
    nothing is wrong with the register — this workstation has not taken adoption
    act 3's install yet. Take it:  openRepoTools --install" 2 ;;
*) die "$LANES_EDIT lanes failed (exit $rc). That is NOT 'there are no lanes', and this
    command will not print an empty listing on an answer it did not get
    (Amendment 7(d)). Run it by hand to see what it says." 1 ;;
esac

printf '%-26s %-8s %-10s %-12s %-22s %-38s %-9s %s\n' \
	LANE STATE WHERE PROFILE WINDOW "LAST TRANSCRIPT" AGE DIRECTORY
n=0
defects=0
# THE LAST NAME TAKES EVERY REMAINING FIELD, so `r_loc` — Amendment 18(b)'s
# column 13 — is named here even though this listing does not render it: without
# it column 13 arrives glued to the fork COUNT, and `0<TAB>here` is not a count.
# COLUMNS 14 TO 17 ARE AMENDMENT 19'S — the row's CLASS (`closed`, `dormant`
# or `none`), its `started` cell, its state cell's head and the flag words in
# that cell — and they are named for the same reason: every field of this row
# is read by its own index, and the read prints no column empty, because an
# empty one between two tabs is no field at all to this `read`.
while IFS="$(printf '\t')" read -r r_lane r_state r_ws r_pf r_win r_sid r_dir r_obj r_age r_restart r_home r_fk r_loc r_class r_start r_was r_flags; do
	[ -n "${r_lane:-}" ] || continue
	printf '%-26s %-8s %-10s %-12s %-22s %-38s %-9s %s\n' \
		"$r_lane" "$r_state" "$r_ws" "$r_pf" "$r_win" "$r_sid" "$r_age" "$r_dir"
	case "$r_obj" in
	none | 'none open' | '') : ;;
	*) printf '%-26s holds: %s\n' "" "$r_obj" ;;
	esac
	# THE EXACT COMMAND THAT BINDS IT, FILLED IN, FOR A **PAUSED** LANE — clause
	# (j) column 10, AND IT COMES OUT OF THE READ (A11 Addendum 4 ruling 7). This
	# command used to compute it and `restart` computed a different one: two
	# implementations of one column, which is how two surfaces come to disagree
	# about which lane may be restarted. The rule — a PAUSED lane only, and the
	# `pclaude --lane <lane> <profile>` form where the record carries no profile
	# yet — is stated once, in `lanes_rows`, and rendered here. The word it
	# prints is `lane <name>` since Amendment 18 Addendum 2 retired `restart`.
	case "${r_restart:-none}" in
	none | '') : ;;
	lane\ *) printf '%-26s bind it: %s\n' "" "$r_restart" ;;
	# A LIVE LANE'S ONE ACT IS THE ATTACH AND NEVER A SECOND PROCESS (Amendment
	# 18 clause (i), on the question of 2026-09-14T13:47Z). The read chose
	# between `switch-client` and `attach` — it knows whether this process is
	# inside tmux — and filled the target in; this renderer says which kind of
	# act it is, because "bind it" over a `tmux attach` would describe a binding
	# that is not being made: the session is already running and this only puts
	# a terminal in front of it.
	tmux\ *) printf '%-26s attach: %s   (it is LIVE — never a second lane-start on a running lane)\n' "" "$r_restart" ;;
	*) printf '%-26s bind it: %s   (no profile recorded yet; it is written at this lane next start or swap)\n' "" "$r_restart" ;;
	esac
	# THE SECOND LINE A CLOSED OR DORMANT ROW GETS (Amendment 19(b)), and one
	# is here only under `--closed`. A CLOSED lane is shown with the closing
	# line's verb (the STATE column) and its time (the AGE column); a DORMANT
	# row as `NO LOG` with its START DATE and its STATE CELL'S HEAD — the row's
	# own last words, which are the only thing it has left to say for itself and
	# exactly what the sweep carries into the log it creates for it. The FLAGS
	# are that sweep's: a cell saying the work was unpushed, lost, a loss or
	# owed, or still saying LIVE.
	case "${r_class:-none}" in
	closed)
		printf '%-26s closed: its object log ends with %s; started %s\n' \
			"" "$r_state" "${r_start:-unknown}" ;;
	dormant)
		r_tail="${r_was:-none}"
		if [ "${#r_tail}" -gt 140 ]; then r_tail="${r_tail:0:140} …"; fi
		r_fl=""
		case "${r_flags:-none}" in
		none | '') : ;;
		*) r_fl="; FLAGS $r_flags" ;;
		esac
		printf '%-26s DORMANT: no object log and no live session here; started %s%s\n' \
			"" "${r_start:-unknown}" "$r_fl"
		printf '%-26s was: %s\n' "" "$r_tail" ;;
	esac
	case "${r_fk:-0}" in
	0 | '') : ;;
	*) printf '%-26s DEFECT: %s live fork(s) of this lane transcript — never a holder, and they must not write the register. Name them: %s forks %s; retire each: lane-end %s --retire <pid>\n' \
		"" "$r_fk" "$LANES_EDIT" "$r_lane" "$r_lane"
		defects=$((defects + 1)) ;;
	esac
	n=$((n + 1))
done <<EOF
$out
EOF

# THE NEXT FREE POSITION AND THE EXACT LINE THAT TAKES IT — the half of the
# settlement that is not a filter. A listing tells a person what is there; this
# tells them what to type next, filled in, so nobody has to translate a
# placeholder at the one moment they are trying to start work.
#
# IT IS THE HELPER'S ANSWER AND NO LONGER THIS COMMAND'S (Amendment 18 Addendum
# 1). `lane`'s `f` answer opens a lane at the same position, and two surfaces
# computing one number is how they come to offer two — the defect A11 Addendum 4
# ruling 7 removed from column 10. `next-free` takes THESE ROWS on stdin, so it
# costs one process and not a second read, and the rule it states — the LOWEST
# free position, digits with an optional trailing letter, `5a` and `5` one
# position taken twice — is stated there once.
#
# AND A HELPER THAT CANNOT ANSWER IT IS NOT A POSITION OF 1 (Amendment 7(d)): a
# `lanes-edit.sh` predating the read exits 2 and prints nothing, and a listing
# that then offered `lane-start <repo> 1` would be offering a position this
# estate may well have taken. The footer says so instead.
# AND THE CODE SAYS WHICH IT WAS. `|| :` made every status of that read the same
# status, and the footer below then told a person to take the install for a read
# that had FAILED — the fail-closed family's own defect, one rung down (Copilot
# round 1 on #45, `lanes:432`). `2` is the un-upgraded workstation and says so;
# anything else is a read that did not answer and is named as one. A `0` that
# comes back with nothing a position could be made of is in that second class:
# the read answered, and what it answered is not a number.
next=""; next_rc=0
if [ -n "$here_repo" ]; then
	next="$(printf '%s\n' "$out" | "$LANES_EDIT" next-free "$here_repo" 2>/dev/null)" || next_rc=$?
	# THE STATUS DECIDES BEFORE THE TEXT DOES (Copilot round 5 on #45,
	# `lanes:441`). Digits printed by a read that THEN FAILED pass the shape test
	# below on their own output, and this footer would hand out a position out of
	# a read that did not answer — the same hole `lane` had one file over, and the
	# same rule closes it.
	[ "$next_rc" = 0 ] || next=""
	case "${next:-}" in '' | *[!0-9]*) next="" ;; esac
fi

say ""
if [ "$do_fetch" = 1 ] && [ "$fetch_fell_back" = 1 ]; then
	# THE PHRASE THE FOOTER MUST NOT CARRY IS NOT QUOTED HERE EITHER: the suite
	# asserts that a fallen-back fetch never prints the fresh-fetch sentence, and
	# a message that QUOTED it to disown it failed that assertion on its own
	# words. What the helper said is printed under this line instead.
	say "$n lane(s)${here_repo:+ of $here_repo}, read LOCALLY: the fetch did not answer, so this is the checkout's own copy as of $("$LANES_EDIT" fetch-age 2>/dev/null || printf 'unknown'). What the helper said:"
	printf '%s\n' "$fetch_err" | sed -n 's/^/  /p'
elif [ "$do_fetch" = 1 ] && [ "$fetch_unchecked" = 1 ]; then
	# NO CAPTURE FILE, SO NO CLAIM. The helper's notes went straight to the
	# terminal above and this line does not know whether one of them was the
	# fallback sentence — which is exactly why it does not say "just now".
	say "$n lane(s)${here_repo:+ of $here_repo}, and whether the fetch answered is UNKNOWN: no temporary file could be made to read the helper's own notes back, so they are above rather than in this line. This checkout last heard from origin $("$LANES_EDIT" fetch-age 2>/dev/null || printf 'unknown')."
elif [ "$do_fetch" = 1 ]; then
	say "$n lane(s)${here_repo:+ of $here_repo}, as of a fetch just now."
else
	say "$n lane(s)${here_repo:+ of $here_repo}, read locally — no fetch; this checkout last heard from origin $("$LANES_EDIT" fetch-age 2>/dev/null || printf 'unknown'). \`$prog --fetch\` refreshes first."
fi
# CLOSED AND DORMANT LANES ARE NOT IN THE COUNT ABOVE, and a listing that did
# not say so would read as a register with nothing finished in it. The hint is
# printed whenever they were left out, which is every run without `--closed`.
if [ "$closed" = 0 ]; then
	say "  closed and dormant lanes are not listed (Amendment 19(b)):  $prog --closed"
fi
if [ -n "$here_repo" ] && [ -n "$next" ]; then
	say ""
	say "  next free position:  $next"
	say "  take it:             lane-start $here_repo $next"
	say "  pick one:            lane"
	say "  every lane:          $prog --all"
elif [ -n "$here_repo" ] && [ "$next_rc" = 2 ]; then
	say ""
	say "  the next free position could not be read: this workstation's \`lanes-edit.sh\`"
	say "  has no \`next-free\`, so it predates lane-collision-protocol Amendment 18"
	say "  Addendum 1. Take the install and it comes back:  openRepoTools --install"
	say "  every lane:          $prog --all"
elif [ -n "$here_repo" ]; then
	say ""
	# THE CODE STAYS ON THE WORD IT BELONGS TO. A line break between `exited` and
	# the number is a refusal that no longer says which code it got to anything
	# reading a line at a time — and the reflow that split `PROVED that binding
	# dead` across two lines was CI's one red case on `9581ac9`.
	say "  the next free position could not be read: \`lanes-edit.sh next-free\`"
	say "  exited $next_rc and gave no position. That is NOT a position of 1 and this"
	say "  listing will not offer one it did not get (Amendment 7(d)) — a 0 with"
	say "  nothing a position can be made of is in that class too. Run it by hand:"
	say "    $LANES_EDIT lanes --prefix $here_repo | $LANES_EDIT next-free $here_repo"
	say "  every lane:          $prog --all"
fi
[ "$defects" = 0 ] || say "$defects lane(s) have a live fork of their transcript running. A fork is never the holder (ratified decision 8(c)); the one act is \`lane-end <lane> --retire <pid|uuid>\`, which proves the fork and prints Amendment 6(d) for it filled in — it writes nothing and it never kills the process, and taking it stays yours (clause (k) rule (e))."
ws_notice
exit 0
