Expand description
Local repository discovery for the plan surface’s repository picker.
magi plan and the browser interview both start against one repository -
whatever --repo or magi web --repo named at startup - and until now
that was also the only repository either surface could ever reach. This
module is what lets an operator name a different checkout without
typing its full path: scan walks the roots named in [repos] roots
for a ghq-layout checkout (<root>/<host>/<owner>/<repo>), and resolve
turns a short name like yukimemi/rvpm into the one path it names.
§Read-only, and cheap enough to repeat
Nothing here creates, deletes or writes anything, and no root is ever
reached over the network - the whole point is that this is a filesystem
fact about the operator’s own machine. Cache exists only because a scan
still means walking however many roots the operator configured on every
request, and a phone re-opening the “start a conversation” panel should
not repeat that walk every time. It is trusted for [repos] scan_ttl
seconds and can always be forced with an explicit refresh.
§One implementation, two callers
scan and resolve are the whole surface, and both magi repos /
magi plan --repo (see crate::plan) and GET /api/repos (see
crate::web) call them rather than each walking the filesystem in its
own way. Cache wraps scan for the web server, which asks on every
request; the CLI, invoked once per command, has no cache to keep.