Upgrading
Run refs sync after updating. Two things are worth expecting on that first run.
Packages may be reported as missing that are still on disk. Negated workspace patterns are
applied now, so a package a repository excludes (!examples/vue/2*) is no longer a workspace
member — and an entry registered for one before this release no longer verifies. Nothing is removed
automatically; the finding names the entry and leaves the decision alone.
Packages that arrived upstream since the last sync are reported. Only those: a package the
configuration never had and that did not arrive in the fetched range stays unmentioned, however
long it has been there.
Added
-
refs syncnow reports a package that arrived upstream, andrefs edit --createregisters
it. The drift probe checked the packages the configuration already had, so a package added
upstream afterrefs addstayed invisible — and there was no command to register one either:
refs addrefuses an already-tracked ref, and everyrefs editmode needs an entry to edit. The
only instruction anyone could give was "hand-editconfig.toml".refs syncanswers "did upstream gain a package?" from the range it just fetched, not by
comparing a scan against the configuration. That distinction is the whole design: a scan cannot
tell a package that just arrived from one the ref's owner deliberately never tracked, because
there is no inventory of what was there before — the fetch range is that inventory. A ref whose
owner tracks 3 packages out of 140 hears about the other 137 exactly never.refs doctorlists
every unregistered member instead, because it was asked to.The question it asks of that range is about package NAMES, not manifest paths. A package
renamed in place modifies its manifest rather than adding one, and a package merely moved to
another directory adds one without being new — so a path-based reading is wrong in both
directions. Only the manifests the range actually changed have to be read out of history: an
untouched manifest is byte-identical at both ends, so the name it carries now is the name it
carried before.The repair is a command now rather than a config fragment, with the ref key filled in so it
runs as printed:refs edit 'github.com/acme/alpha' --package '@acme/new' --create --path 'packages/new' \ --description "<what it is>"It is a distinct mode, not an upsert — an ordinary field edit naming an unregistered package
still fails withnot_found, so a typo in--packagecan never become a new entry. The
finding carriesnameandpath, both verified against the checkout and both shell-quoted
(being verified makes a value true, not shell-safe:zPackagePathpermits$()and a manifest
nameis checked only for being non-empty), and deliberately no description: a manifest description is untrusted third-party content, and copying it moves it
into a file refs later reads as its own configuration. The skill instructs agents to propose the
registration and wait for the user to agree, rather than run it on their own initiative.
Fixed
-
Workspace patterns are matched by
minimatch, the matcher npm itself uses. Hand-written
matching disagreed with the real resolvers in five distinct ways, each found only after the last
was fixed: extglob (@(a|b)) read as a literal directory name, trailing slashes treated
symmetrically whereminimatchis asymmetric, repeated separators silently matching nothing, and
two more. Delegating removes that class of defect rather than the current instance of it.Measured before choosing:
picomatchdisagrees withminimatchon ten of 154 comparisons over
the shapes this scanner supports, exactly on trailing slashes and repeated separators — so it is
not a drop-in. pnpm matches throughpicomatchbut normalizes first, and was measured to agree
withminimatchon every one of those shapes, so one matcher covers both ecosystems.Walking stays here: containment guards, the diagnostics that say why a scan came up short, and
the deliberate one-level depth policy are unchanged.minimatchanswers only whether a path
matches a pattern. Nothing new is installed byrefsusers — the CLI publishes a bundle with no
dependencies — and that bundle grows by 24 KB.One behaviour improves as a consequence: a negation in a shape this scanner cannot WALK
(!packages/{a,b}) is now applied, because applying an exclusion needs matching and never
walking. It used to be reported as unsupported and silently ignored. -
Negated workspace patterns are applied instead of ignored.
!packages/fixtureswas dropped
as an unsupported shape (a v1 simplification), sorefs addregistered packages the repository
had explicitly excluded, and every finding about a repository declaring one was silenced —
TanStack Query declares two, and all hundred of its packages came backunverifiable. Negations
are now expanded exactly like inclusive patterns and subtracted from the result, which makes the
scan an accurate statement of membership rather than an approximation of one.A wildcard inside the last segment (
examples/vue/2*) is supported too, since that is the shape
real repositories exclude by, and a negation nobody can expand costs every finding about the
repository rather than just the paths it names. Glob syntax that is still unimplemented —
{a,b},?,[…]— now reportsunsupported_patternrather than reading as a literal
directory name and silently matching nothing. -
A monorepo can now be resolved by the name in its own root manifest. Workspace detection
expands the globs a repository declares, and a workspace root is not one of its own targets — so a
root that names itself was registered nowhere, andrefs resolve @acme/toolkitcame back empty
for a repository that was tracked all along.refs addnow registers a named root atpath: "."
alongside the workspace members.Both pnpm and Yarn address a workspace root by that name (
pnpm --filter <root-name>,
yarn workspace <root-name>); npm and Turborepo use a positional handle instead. Of eighteen
well-known monorepos surveyed, eight carry a name someone would plausibly use for the repository
and ten carry a throwaway likerootormonorepo-root— which is what settles it: registering
the name costs nothing where it is a throwaway, since nobody resolves"root", and answers the
question where it is not.Two things this deliberately does not do. A repository that declares no workspaces is untouched:
refs add's npm fallback owns that shape, and probing the root there would displace a locator it
did not choose — as it also would where a workspace declaration selects nothing, so the package
named in annpm:<pkg>source survives there too. And where a workspace member already claims the
root's name —@remix-run/react-routeris a real example, in a repository that also publishes
react-router— the member wins and the root is simply not registered, which costs that
repository nothing it had before. That rule lives in detection itself rather than inrefs add,
so relocation agrees with registration: a member that moves is still found uniquely, instead of
becoming ambiguous against a same-named root and leavingresolvewith no path for a package
that is plainly there. And a root is never reported as a package's new location: its name is an
alias for the repository, so a member that upstream deletes is reported as gone rather than as
having moved to the repository root — which would have sent a caller to the wrong directory and
described a move that never happened.Refs tracked before this change keep the package map they were given, and no command adds one
entry to an existing ref —refs addrefuses a tracked ref,refs edit --packageneeds an entry
to edit. Sorefs syncandrefs doctor'sconfig-driftcheck now report a root the
configuration does not register, with the entry to add — including the path registration would
actually use, which is the member's rather than the root's where a workspace member declares the
same name. That costs one manifest read per ref, and a workspace scan only where there is
something to report; it is asked only of refs that already register packages, since a plain
reference repository registers none on purpose and is left alone.The root package takes the ref's own description when its manifest carries none, which is the
ordinary case for a private workspace root. That is not the per-package fallbackrefs add
otherwise refuses: the root is not a package beside the repository, it is that repository. -
A failed lookup no longer reads as an absent repository.
refs resolveexits4when a query
matches nothing, and the message ended "run refs list, or add it:refs add <url>". That second
half is a guess: a query can miss every route while the repository is tracked perfectly well under
another identifier — a monorepo root whose own package name was never registered, for instance.
An agent read the suggestion as confirmation and told someone a repository they had tracked was
not tracked, then stopped.The message now states what was searched and points at evidence rather than prescribing a fix, and
--jsoncarries areasononresolve's routing misses:unmatched_query(nothing matched, by
any route),package_not_registered(the ref is tracked and registers no such package), or
ref_not_registered(a canonical git url named an absent ref — the one case where adding it is
the right answer, since only a canonical url establishes which ref was meant). There is deliberately no reason meaning "this repository does not exist", because nothing
refs can observe establishes that; andreasonis absent on every othernot_found, where its
absence means no narrowing is available rather than being a fourth value.The skill's instruction changed with it. It used to say exit
4means the ref is not tracked; it
now says exit4means the query matched no route, and requires a second lookup before any
conclusion.refs resolve --ref <ref>'s own miss also stopped suggesting a barerefs show,
which reports a package count and no names — it now suggests--packages, which actually shows
the map the reader was sent to inspect. -
A stale-lock reclaim could delete a lock another process was using. refs reclaims a lock left
behind by a crashed process. The check that decided a lock was abandoned and the removal that
acted on it were two separate steps, and in the gap between them the lock could legitimately
become somebody else's: the original holder releases, a waiting process takes the same path, and
the reclaim then deletes a lock that is actively in use. Both processes go on toreset --hard
the same checkout.Three changes close it for processes running this version:
- Only a process the operating system reports as gone is reclaimed from automatically. A lock
whose lease has run out but whose process still answers is now reported rather than taken — a
live process can release at any instant, and that release is what opened the gap. Same for a
lock whose metadata never finished being written, or carries no usable identity. - The acquisition is re-identified after the death check. Proving the recorded process gone is
not enough on its own: the metadata is read first and the process probed after, so the path can
change hands in between and the probe then answers about the departed owner. Re-reading the
identity immediately before the removal is what ties the two together. - The marker that stops two reclaims colliding no longer expires. It used to be taken over
after two seconds, so it only excluded a reclaim fast enough to finish inside that window; a
suspended one lost its marker mid-work and a second reclaim started on the same lock. Age is
not evidence of abandonment.
The protocol's own markers also moved into
locks/.claims/andlocks/.tombstones/, which no
lock name can reach — lock names must start with a letter or digit. That removes a collision
where a repository literally namedfoo.steal-claimproduced the marker path of the lock for
foo, and with it the name-shape guessingrefs doctorneeded to tell the two apart.What this costs. Three situations no longer recover on their own and need one explicit
command, whichrefs doctorprints along with the condition for running it safely — stop every
refs process on that home first, suspended ones included: a crash after the operating system has
reused the process id, a crash before the lock finished writing its metadata, and a crash while a
reclaim was starting.The messages changed to match.
refs doctor'slockscheck separates a lock refs will reclaim
by itself from one it will not, and the failure message when a lock cannot be acquired no longer
says "already reclaimable — retry" for a lock nothing will ever reclaim. It also stopped
describing the window as the thing that frees a lock: waiting does not, and only a recorded
process the operating system reports as gone does.What it does not fix. A refs process running an older version follows none of this and
reclaims on its own terms. And no lock protocol can help when refs is hard-killed while itsgit
child survives: the successor's lock is honest about the lock, not about the directory. - Only a process the operating system reports as gone is reclaimed from automatically. A lock
-
Two unrelated refs could share one lock. The per-ref lock name replaced
/with_, and_
is legal inside a ref key — sogithub.com/acme_tools/widgetandgithub.com/acme/tools_widget
both derivedref.github.com_acme_tools_widget. The two then serialized against each other:
syncfans out four refs at a time and the loser failed on a lock conflict after the timeout,
resolve's verification could block on a sync of a ref it has nothing to do with, anddoctor's
config-driftcheck reported the wrong ref as busy.The name is now injective. A key containing no
_encodes exactly as before, so it keeps the
lock name refs has always written for it; a key containing one moves into an escaped form under
ref._, where_becomes_uand/becomes_s. The two forms cannot collide, because a ref
key always starts with[a-z0-9]and so a plain name never beginsref._.A lock name is one directory entry, so a key long enough to overflow one now falls back to a
digest underref.__rather than failingmkdirwithENAMETOOLONG. The budget reserves room
for the sibling entries the steal protocol derives from a lock name — a name that could be
created but not renamed to its tombstone would strand an abandoned lock that nothing could then
reclaim, leaving the ref blocked until someone deleted the directory by hand. Both were already
true before this change, for keys past roughly 200 characters; reaching it needs a self-hosted
url, since no forge allows a path that long.One caveat if you run refs concurrently across an upgrade. The lock name changes for a ref
whose key contains_, and for one long enough to reach the digest form — roughly 200
characters, either way. For such a ref, a process from any earlier release (the old scheme dates
to 0.1.1) derives a different name from a new one, so for the length of that overlap the two
would not exclude each other. The window is a mid-upgrade concurrent run on the same refs home;
if that is a situation you can be in, let running operations finish before upgrading. Every other
ref keeps its name and is unaffected.