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