1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Bug-reporting pipeline for the trusty-mpm daemon.
//!
//! Why: trusty-* daemons encounter runtime errors that developers need in order
//! to fix bugs, but those errors may contain sensitive data (paths, tokens,
//! usernames) that must never leave the user's machine without explicit
//! consent. This module implements the Phase 2 + Phase 3 + Phase 4 pipeline:
//! aggregate → scrub → preview → consent gate → rate-limit → file.
//!
//! What: six sub-modules, each with a single responsibility:
//! - [`types`] — shared data types (`AggregatedError`, `FilingResult`, …).
//! - [`multi_store`] — reads JSONL stores from all known daemons, merges by
//! fingerprint, and returns a ranked `Vec<AggregatedError>`.
//! - [`scrubber`] — strips paths, tokens, JWTs, AWS/Google/Slack keys, PEM
//! blocks, connection strings, and env secrets; returns a [`ScrubResult`]
//! with a human-readable redaction summary.
//! - [`preview`] — builds the scrubbed Markdown body + labels for a preview
//! or filing (the preview body IS the filed body).
//! - [`token`] — token resolution: PAT env/file → GitHub App (Phase 4).
//! Resolution order documented in [`token`]. Providers implement
//! [`token::TokenProvider`].
//! - [`github`] — GitHub REST API client (trait + real reqwest impl + mock).
//! Dedup search + create-vs-comment logic.
//! - [`ratelimit`] — per-fingerprint stamp (24h re-file window) + per-hour
//! cap (default 10 issues/hour); both persisted to config dir JSON files.
//!
//! Public re-exports for the MCP backend and HTTP handlers:
//! - [`aggregate_errors`] — merge errors from all daemon stores.
//! - [`build_preview`] — build the scrubbed issue preview.
//! - [`file_issue`] — file (or increment) a GitHub issue; gated on token.
//! - [`token::EnvFileTokenProvider`] — the default PAT/file token provider.
//! - [`token::GithubAppTokenProvider`] — the GitHub App installation-token provider.
//! - [`token::resolve_token`] — top-level resolution following documented order.
//! - [`GithubFilingError`] — typed error for the filing path.
//! - [`FilingResult`], [`ReportBugRequest`], [`ReportBugResponse`] — HTTP/MCP types.
//! - [`ScrubResult`] — structured output of the scrubber with summary.
//! - [`ratelimit::RateLimitGuard`] — composite rate-limit guard.
//!
//! Test: each sub-module carries its own `#[cfg(test)]` suite. Run with
//! `cargo test -p trusty-mpm`.
// ── Convenience re-exports ─────────────────────────────────────────────────────
pub use ;
// Re-export token providers from the token module (Phase 4).
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;