Skip to main content

Crate rootle_provider

Crate rootle_provider 

Source
Expand description

Provider seam (plans/0005): the TUI talks to source-control backends through this trait — never to a concrete API. github is the in-tree reference implementation; external providers are child processes speaking NDJSON-RPC over stdio (stdio.rs), so any internal system can be wrapped with a small script.

Contract rules that matter:

  • Repos are opaque “group/project” strings; the UI never parses them.
  • sha is an opaque content id: it MUST change when content changes (the cache design is content-keyed and immutable).
  • URL building (yank) and cloning use provider-supplied fields — no GitHub URL grammar outside the GitHub impl.

Re-exports§

pub use id::Generation;
pub use id::GitRef;
pub use id::OwnerId;
pub use id::RepoId;
pub use id::RepoPath;
pub use id::Sha;

Modules§

id
Typed identity for the provider seam (plans/0025): the three nouns that cross every boundary — which repo, which content, which revision — as opaque newtypes instead of naked Strings. The bug classes this kills: a sha where a ref was meant, a ref where a repo id was meant, a repo id formatted differently at two sites.
paths
XDG base dirs on every platform, macOS included.

Structs§

BlameRange
repo/blame range — 1-based inclusive lines, coalesced by sha.
Capabilities
What a provider supports; the UI degrades on false. file_search (v1.3) covers path-only search (the path: grammar); absent on the wire it inherits code_search — a forge with filename search but no global content index (Bitbucket Cloud, GitLab without Advanced Search) says code_search: false, file_search: true.
CodeMatch
One code-search hit. matches are the matched substrings — an empty vec is a legal path-only hit (“this file matched”). When matches is non-empty the UI locates them in the blob for real line numbers; line, when the provider knows it, is the anchor used as-is (the first occurrence of a substring is often not the occurrence that matched).
CommitDetail
CommitFile
CommitStatistics
LogEntry
repo/log item — newest first on the wire.
ProviderError
Structured provider error (plans/0008 §2): the protocol v1.1 data.kind taxonomy carried from the wire to the UI instead of a bare string. Unknown or absent kinds degrade to Other, which renders exactly like the old unstructured toast.
RefInfo
One ref (branch or tag) — repo/refs item.
RepoInfo
One repo in an org listing (protocol v1.4): the name plus whatever metadata the backend reports. Everything past name is optional — a provider with only names sends the string form on the wire and every field here stays default.
RepoRefs
repo/refs reply.
SearchCodeResult
Code-search outcome metadata: the provider’s own truncation signal (plans/0008 §4) and, for indexed backends, when the index was built (located: false covers the per-hit case; this is the index-wide one — a lagging index is worth a badge next to the results).
TreeNode
UI-facing tree node (path relative to repo root).
TreeResult
A repo’s recursive tree plus routing metadata.

Enums§

ErrorKind
The v1.1 data.kind open enum. Wire-unknown kinds map to Other.
FileStatus
SearchItem
Repo/org search result for the launch popup.

Constants§

RENDER_BUDGET
The client’s search render budget (protocol v1.4 advisory, doc/provider-protocol.md): sent as limit on every search/code so the provider stops scanning at ~N and sets truncated: true instead of computing hits the view would clip. The view’s render cap is this same number.

Traits§

Provider
The backend contract. Blocking; calls run on worker threads.

Type Aliases§

ProviderResult