Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Ruled 2026-09-04. A layer has exactly one registration, so re-pointing it is the obvious intent behind
registering it again, and a verb that refuses and sends the user to remove first protects a state nobody
wants. The vocabulary for a keyed registration is the one config already uses: set and unset, not
add and remove.
writ repo set <layer> <working-tree-root>|<repository-url> [<working-tree-root>]registers or replaces.
A replacement narrates what changed —personal: was ~/Workspace/Personal, now ~/env— and, when the old
registration was a clone writ made in its own home, removes that clone (writ repo remove leaves the clone it made in the writ-owned home #792: a writ-owned clone is writ’s
to remove; a working tree the user registered by path is never touched).writ repo unset <layer>removes the registration.writ repo liststays.add,remove,rmandlsgo, not aliased: there is no legacy to keep.--dry-runshows a replacement like any other change.
The design’s §3 records the rule: a keyed registration is set and unset, on every program.
Ruled 2026-09-18
unsetis idempotent. Unsetting a layer that is not registered succeeds and emitsstate: "unregistered". A command that is safe to run twice is a command a script can use.setto the target a layer already has narratesunchangedand emits its record. Not an error, and not
silent.--branchstays, on the repository-url form only, as it is today.- The record below is what reaches stdout. Narration is stderr (§5), so
--output jsonnever sees "was X,
now Y"; whatever a script needs has to be in the result.
The record
{
"layer": "personal",
"state": "registered",
"source": "[email protected]:me/personal.git",
"root": "/Users/me/.local/share/devlore/writ/repos/personal",
"owner": "writ",
"branch": "devlore-cli/writ-layer",
"previous": {
"source": "[email protected]:me/personal.git",
"root": "/Users/me/Workspace/Personal",
"owner": "user"
}
}| Field | Meaning |
|---|---|
layer |
the layer name |
state |
registered, unregistered, broken, unreadable — unchanged from today |
source |
the URL writ would fetch from: the checked-out branch’s upstream, else origin, else empty |
root |
where the working tree is, which is what writ reads |
owner |
writ or user: who cloned the tree, and so who may delete it |
branch |
present when --branch was given; absent otherwise |
previous |
the displaced registration, in this same shape; absent when nothing was displaced |
Three things the shape settles:
sourceandrootare different questions. Today’s singleroot(repo_cmd.go:114) collapses them, so
repo list --output jsoncannot say which repository a layer is, nor whether its tree is writ’s or the
user’s.repo listgainssourceandowneron every row.ownermakes writ repo remove leaves the clone it made in the writ-owned home #792’s ruling machine-readable. A writ-owned clone is writ’s to remove; a user’s tree is
never touched.- There is no
removedfield. Writ clones only into<data home>/devlore/writ/repos/<name>, so a removed
clone is alwaysprevious.rootwithprevious.owner == "writ". Two fields would always carry one path.
source is empty when a tree has no remote — a repository made by git init and never pushed. That is not a
corner case: writ’s own refusal text tells the user to run git init when a path is not a working tree.
Acceptance
-
writ repo setregisters a new layer and replaces an existing one, narrating the change and removing a writ-owned clone it displaces -
writ repo setto the target a layer already has narratesunchangedand emits the record -
writ repo unsetremoves a registration; unsetting an unregistered layer succeeds and emitsunregistered -
add,removeand their aliases are unknown commands - the record carries
source,root,owner,branchandpreviousas above, andrepo listcarriessourceandowner -
--branchstill applies to the repository-url form, and is refused on the path form - the guide
docs/guides/writ/repositories.mdand the design §3 say set and unset
Plan and design documents
| Kind | Document |
|---|---|
| Plan | docs/plans/feature/791-repo-set-and-unset.md |
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
David-Noble-at-work commentedon Sep 4, 2026
Also here (2026-09-04):
repo add,repo removeandrepo listwrite hand-shaped text withfmt.Fprintf(cmd.OutOrStdout(), ...), which the #776 walk did not catch (the walk gap is its own bug). Whenthe verbs become
set,unsetandlist, each emits a result throughcli.Emit:lista row per layer withlayer,repositoryandpath, so the default json serves a script and-o tablereads the way theclone-naming fix describes;
setandunsetthe registration they changed. Narration, "was X, now Y" andthe removed clone, goes to stderr.
test(writ): the layer-journey scenario -- self install, repo set, dep…
David-Noble-at-work commentedon Sep 8, 2026
The layer-journey scenario (#855,
cmd/writ/scenario_layer_journey_test.go, landed in #859) is this issue's acceptance test: Part 1 (steps 1.1–1.5, and the old verbs refused) runs the ruled interface and skips by this issue's number until the binary has it, on all six legs of thescenariojob. When this lands, that skip turns into a pass without the scenario changing — and if it does not, the failure message names the step.A URL clones under the name git gives it, and two layers cannot share…