Skip to main content

hopper_manager/
lib.rs

1//! # Hopper Manager
2//!
3//! Schema-driven inspector library for Hopper programs.
4//!
5//! The manager is an **inspector, not an engine**. It consumes the canonical
6//! runtime/layout/schema truth published by Hopper programs and returns
7//! human-readable reports. It never invents its own semantics, every byte,
8//! offset, and label comes from `hopper_schema::ProgramManifest` or the raw
9//! account bytes themselves.
10//!
11//! ## Design
12//!
13//! This crate exposes **pure functions** that take a `ProgramManifest` plus
14//! some input and return a `String` or a structured report. They do no I/O,
15//! no argv parsing, no RPC calls, and no `process::exit`. Those concerns
16//! belong to the caller (typically `hopper-cli` or a custom tool).
17//!
18//! ## Modules
19//!
20//! - [`inspect`], identify accounts, decode headers and fields
21//! - [`summary`], render layouts, policies, events, fingerprint tables
22//! - [`analyze`], compatibility verdicts, semantic diffs, migration plans
23//!
24//! ## Example
25//!
26//! ```ignore
27//! use hopper_manager as mgr;
28//!
29//! let report = mgr::inspect::identify(&manifest, &raw_bytes)?;
30//! println!("{}", report);
31//! ```
32
33pub mod analyze;
34pub mod inspect;
35pub mod summary;
36
37pub use analyze::{compatibility_report, field_diff_report};
38pub use inspect::{decode_account, header_report, identify_account, segment_map_report};
39pub use summary::{
40    events_report, fingerprints_report, instruction_report, layouts_report, policies_report,
41    program_summary,
42};
43
44/// One-stop human-readable overview of a program manifest.
45///
46/// Equivalent to the CLI's `hopper manager summary`, the default
47/// `Display` impl on `ProgramManifest`. Exposed here so downstream tools
48/// can get the same formatting without reaching into schema internals.
49#[inline]
50pub fn overview(manifest: &hopper_schema::ProgramManifest) -> String {
51    program_summary(manifest)
52}