Skip to main content

pitboard_core/
lib.rs

1//! The engine behind pitboard: parking and restoring a person's own Claude Code logins, and
2//! reading what each has left. It serves pitboard's own front ends, the command line and the
3//! 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 and gets a major version.
17//!
18//! What is deliberately not reachable: nothing outside this crate may write pitboard's index.
19//! Every change goes through [`switch`], which records what it is about to do first and
20//! finishes an interrupted one before starting another.
21
22#[cfg(not(unix))]
23compile_error!(
24    "pitboard supports macOS and Linux. Claude Code stores its login differently on \
25     Windows, and pitboard has not been written for it."
26);
27
28pub mod api;
29pub mod assumptions;
30pub mod audit;
31pub mod budget;
32pub mod context;
33pub mod doctor;
34pub mod error;
35pub mod label;
36pub mod provider;
37pub mod redact;
38pub mod schedule;
39pub mod service;
40pub mod settings;
41pub mod state;
42pub mod status;
43pub mod statusline;
44pub mod switch;
45pub mod time;
46pub mod usage;
47
48pub(crate) mod atomic;
49pub(crate) mod fault;
50pub mod history;
51pub(crate) mod home;
52pub(crate) mod lock;
53pub(crate) mod park;
54pub(crate) mod pending;
55pub(crate) mod process;
56pub(crate) mod readings;
57pub(crate) mod store;
58
59/// What the integration tests reach into: they plant and inspect parked logins in the real
60/// store, and must never touch the credential slot this machine's Claude Code reads.
61#[cfg(feature = "test-support")]
62#[doc(hidden)]
63pub mod testing {
64    pub use crate::api::scripted::{Answer, Asked, ScriptedApi, Trouble};
65    pub use crate::provider::claude::paths::live_service;
66    pub use crate::provider::claude::slot::{LIVE_SERVICE, dir_hash, service_for_dir};
67    pub use crate::store::memory::{Fault, MemoryHost, MemoryStore};
68    pub use crate::store::{vault_delete, vault_read, vault_write};
69    pub use crate::time::{Clock, FixedClock};
70}