Skip to main content

fallow_types/
lib.rs

1//! Shared types for fallow codebase intelligence.
2//!
3//! This crate contains type definitions used across multiple fallow crates
4//! (core, CLI, LSP). It has no analysis logic, only data structures.
5
6#![warn(missing_docs)]
7#![cfg_attr(
8    test,
9    allow(
10        clippy::unwrap_used,
11        clippy::expect_used,
12        reason = "tests use unwrap and expect to keep fixture setup concise"
13    )
14)]
15
16/// Atomic cache-file replacement, shared by the extraction cache and the graph
17/// cache so concurrent fallow processes never interleave a write.
18pub mod atomic_file;
19/// Typed audit cache-key inputs.
20pub mod audit_cache;
21/// Why a persisted cache was refused, shared by the extraction cache, the
22/// graph cache, the perf table, and `fallow doctor`.
23pub mod cache_rejection;
24/// Classification of the source file of a package manager catalog finding.
25pub mod catalog_source;
26/// Shared churn output contracts.
27pub mod churn;
28/// Cross-surface strings for the cloud runtime-coverage path, shared by the
29/// CLI's cloud `coverage` commands and the MCP cloud tools.
30pub mod cloud;
31/// One row per analysis subcommand: its JSON kinds and the surfaces that must
32/// know about it. Drift tests across the workspace read this table.
33pub mod command_surfaces;
34/// Per-construct complexity increments behind the complexity scores.
35pub mod complexity_contribution;
36/// File discovery types: discovered files, file IDs, and entry points.
37pub mod discover;
38/// Shared duplicate-code output contracts.
39pub mod duplicates;
40/// JSON-output envelope and utility types: `SchemaVersion`, `ToolVersion`,
41/// `ElapsedMs`, `AuditIntroduced`, plus the shared `Meta`, `BaselineDeltas`,
42/// `BaselineMatch`, `RegressionResult`, `EntryPoints`, and `CheckSummary`
43/// shapes referenced by every per-command envelope. The structs are always
44/// compiled (the JSON emission layer constructs them at runtime); the
45/// `schemars::JsonSchema` derive is gated per-struct on the `schema` feature.
46pub mod envelope;
47/// Where a fact sits on each JSON envelope shape, shared by the surfaces that
48/// read a saved envelope back rather than holding the run's typed state.
49pub mod envelope_sites;
50/// Module extraction types: exports, imports, re-exports, and member info.
51pub mod extract;
52mod extract_namespace_member_uses;
53pub mod flag_retirement;
54/// Guard output contracts for pre-edit architecture-rule lookup.
55pub mod guard;
56/// Stable finding identity: the shared FNV-1a 64 hash and dead-code
57/// `finding_id` values.
58pub mod identity;
59/// Shared issue-type contract metadata used by CLI, LSP, MCP, and suppression
60/// helpers.
61pub mod issue_meta;
62/// Levenshtein distance and closest-match policy for typo suggestions.
63pub mod levenshtein;
64/// Machine-readable manifest of the fallow MCP server's tools, shared by
65/// `fallow schema` and the telemetry tool-name allowlist; kept in sync with
66/// the live tool router by a drift test in `crates/mcp`.
67pub mod mcp_manifest;
68/// JSON-output augmentation types: `IssueAction` enum + variants.
69/// Schema-side counterpart of the augmentations the JSON layer adds to each
70/// dead-code finding. The structs are always compiled (typed dead-code
71/// wrappers in [`output_dead_code`] consume them at runtime); the
72/// `schemars::JsonSchema` derive is gated per-struct on the `schema`
73/// feature.
74pub mod output;
75/// Typed envelope wrappers for the simple 1:1 dead-code findings
76/// (`UnusedFile`, `PrivateTypeLeak`, `UnresolvedImport`, `CircularDependency`,
77/// `BoundaryViolation`). Each wrapper flattens the bare finding via
78/// `#[serde(flatten)]` and carries a typed `actions` array populated at
79/// construction time, replacing the per-finding post-pass injection that
80/// previously grafted `actions[]` and `introduced` onto the schema. The
81/// `introduced` field is set by the audit pass via JSON map insertion and
82/// is `None` when serialized directly from Rust. The `schemars::JsonSchema`
83/// derive is gated per-struct on the `schema` feature.
84pub mod output_dead_code;
85/// Shared output-format selector used by CLI, config, output, and API layers.
86pub mod output_format;
87/// Per-action types attached to health findings, hotspots, refactoring
88/// targets, and coverage-gap entries. Separated from the generic
89/// `IssueAction` tree in the `output` module so the health-specific
90/// variants live in a dedicated module. The structs are always compiled
91/// (the JSON emission layer constructs them through typed wrappers such as
92/// [`output_health::UntestedFileAction`]); the `schemars::JsonSchema`
93/// derive is gated per-struct on the `schema` feature.
94pub mod output_health;
95/// Cross-platform path classification helpers.
96pub mod path_util;
97/// The `--performance` span tree and the process-level clock.
98pub mod pipeline_spans;
99/// Analysis result types: unused files, exports, dependencies, and members.
100pub mod results;
101/// Security sink names shared by the extractor and the sink catalogue.
102pub mod security_sinks;
103/// Shared TypeScript semantic identity, provenance, API surface, impact, and
104/// public-signature coupling contracts.
105pub mod semantic;
106/// Custom serde serializers for cross-platform path output.
107pub mod serde_path;
108/// Transient source-extraction contracts for provider-backed similar-code analysis.
109pub mod similar_code;
110/// Shared source-file freshness metadata used by cache invalidation.
111pub mod source_fingerprint;
112/// Inline suppression comment types and issue kind definitions.
113pub mod suppress;
114/// Agent task-to-command matrix rows shared by `fallow schema`, the
115/// `init --agents` template, the agent hook block, root `--help`, and the
116/// `fallow://task-matrix` MCP resource. Data only; the CLI owns rendering.
117pub mod task_matrix;
118/// Trace output contracts shared by core, engine, CLI, API, and MCP.
119pub mod trace;
120/// Symbol-level trace-chain output contracts.
121pub mod trace_chain;
122/// Stack-trace frame resolution output contracts (`fallow trace-error`).
123pub mod trace_error;
124/// Per-specifier dependency usage contracts (`fallow trace --dependency`).
125pub mod trace_usage;
126/// Workspace and source-discovery diagnostic data types
127/// (`WorkspaceDiagnostic`, `WorkspaceDiagnosticKind`). Re-exported by
128/// `fallow-config` for back-compat; embedded directly by `fallow-output` so
129/// `workspace_diagnostics[]` keeps its typed JSON schema. The
130/// `schemars::JsonSchema` derive is gated on the `schema` feature.
131pub mod workspace;
132
133/// The `tracing` target of a warning that repeats a fact the JSON envelope
134/// carries, or that describes the quality of the analysis inputs.
135///
136/// `--quiet`, `--ci` and `FALLOW_QUIET` hide this target on stderr. An explicit
137/// `RUST_LOG` shows it again. Config-load warnings, such as an unknown rule
138/// key, do not use this target, so they stay visible in a quiet run.
139pub const ANALYSIS_DIAGNOSTIC_LOG_TARGET: &str = "fallow::analysis_diagnostic";