Skip to main content

pitboard_core/
lib.rs

1//! The engine behind pitboard: parking and restoring a person's own Claude Code and Codex
2//! logins, and reading what each has left. It serves pitboard's own front ends, the command
3//! line and the native apps, which reach it through [`service::Pitboard`] with an explicit
4//! [`context::Context`].
5//!
6//! # What is supported
7//!
8//! This crate is published because the `pitboard` binary depends on it, not because it was
9//! designed for other programs to build on. The supported interface is [`service::Pitboard`],
10//! [`context::Context`], and the types those two return. Everything else is reachable so the
11//! front ends in this repository can reach it, and may change in any release.
12//!
13//! What a version promises, for the part that is supported: a code is a name, and names are
14//! kept. Adding an error, warning or check code is not a breaking change, which is why every
15//! enum a caller reads codes out of is `#[non_exhaustive]` and every such caller needs a
16//! fallback arm. Renaming or removing a code is a breaking change: a new minor version
17//! while pitboard is at 0.x, as Cargo reads one, and a new major version after 1.0.
18//! A report a caller reads, such as what `uninstall` returns, may likewise say more in a
19//! later release, so those structs are `#[non_exhaustive]` too.
20//!
21//! What is deliberately not reachable: nothing outside this crate may write pitboard's index.
22//! Every change goes through [`switch`], which records what it is about to do first and
23//! finishes an interrupted one before starting another.
24
25#[cfg(not(unix))]
26compile_error!(
27    "pitboard supports macOS and Linux. Claude Code stores its login differently on \
28     Windows, and pitboard has not been written for it."
29);
30
31pub mod api;
32pub mod assumptions;
33pub mod audit;
34pub mod budget;
35pub mod context;
36pub mod doctor;
37pub mod error;
38pub mod label;
39pub mod provider;
40pub mod redact;
41pub mod schedule;
42pub mod service;
43pub mod settings;
44pub mod state;
45pub mod status;
46pub mod statusline;
47pub mod switch;
48pub mod time;
49pub mod usage;
50
51pub(crate) mod atomic;
52pub(crate) mod fault;
53pub mod history;
54pub(crate) mod home;
55pub(crate) mod lock;
56pub(crate) mod park;
57pub(crate) mod pending;
58pub(crate) mod process;
59pub(crate) mod readings;
60pub(crate) mod sessions;
61pub(crate) mod store;
62
63/// What the integration tests reach into: they plant and inspect parked logins in the real
64/// store, and must never touch the credential slot this machine's Claude Code reads.
65#[cfg(feature = "test-support")]
66#[doc(hidden)]
67pub mod testing {
68    pub use crate::api::scripted::{Answer, Asked, ScriptedApi, Trouble};
69    pub use crate::provider::claude::paths::live_service;
70    pub use crate::provider::claude::slot::{LIVE_SERVICE, dir_hash, service_for_dir};
71    pub use crate::store::memory::{Fault, MemoryHost, MemoryStore};
72    pub use crate::store::{vault_delete, vault_read, vault_write};
73    pub use crate::time::{Clock, FixedClock};
74}