influxdb3_plugin_cli/lib.rs
1//! Public embedding surface for the InfluxDB 3 plugin CLI.
2//!
3//! [`PluginConfig`] is a clap-derived, semver-stable type intended to be
4//! mounted as a subcommand variant by a host binary (e.g. `influxdb_pro`).
5//!
6//! Schema-type re-exports route through this crate so embedding consumers
7//! depend only on `influxdb3-plugin-cli`, preventing parser drift from a
8//! parallel direct dependency on `influxdb3-plugin-schemas`.
9
10// `tokio` is a bin-only dep (main.rs's `#[tokio::main]`); the lib surface
11// itself awaits without spawning. `unused_crate_dependencies` fires on the
12// lib target unless we acknowledge the dep here.
13use tokio as _;
14
15// Integration-test helpers used only in external `tests/*.rs` files; the
16// lib's own test target sees them as declared dev-deps but never names them.
17#[cfg(test)]
18use assert_cmd as _;
19#[cfg(test)]
20use flate2 as _;
21#[cfg(test)]
22use insta as _;
23#[cfg(test)]
24use pep508_rs as _;
25#[cfg(test)]
26use predicates as _;
27#[cfg(test)]
28use tar as _;
29#[cfg(test)]
30use tempfile as _;
31#[cfg(test)]
32use toml as _;
33#[cfg(test)]
34use url as _;
35
36pub use config::PluginConfig;
37
38// Re-export schema types so embedders import them from `cli` rather than
39// taking a parallel direct dependency on `schemas`. Includes the multi-error
40// parsing types (`SchemaErrors`, `ReportedError`, `FieldPath`) returned by
41// `Manifest::parse_toml` / `Index::parse_json`.
42pub use influxdb3_plugin_schemas::{
43 ArtifactHash, ArtifactsUrl, Dependencies, Description, FieldPath, Index, IndexEntry,
44 IndexSchemaVersion, Manifest, ManifestSchemaVersion, PluginId, PluginMetadata, PluginName,
45 PythonRequirement, ReportedError, SchemaError, SchemaErrors, TriggerType,
46};
47
48/// Crate-internal types exposed for the bin target (`main.rs`) only.
49///
50/// `#[doc(hidden)]` signals to downstream consumers that nothing here is
51/// part of the semver-stable embedding surface. `main.rs` reaches in
52/// to name [`crate::cli_error::CliErrorKind`] so it can classify errors for exit-code routing;
53/// keeping this pathway out of the public surface preserves the
54/// freedom to evolve `CliError`'s internals.
55#[doc(hidden)]
56pub mod __private {
57 pub use crate::cli_error::{CliError, CliErrorKind};
58 pub use crate::diag_render::render_human_error;
59 pub use crate::output::error_mapping::json_error_from_clap;
60 pub use crate::output::json::{JsonError, write_envelope_error};
61 pub use crate::style::{Palette, stderr_error_palette};
62}
63
64mod cli_error;
65mod color;
66mod commands;
67mod config;
68mod diag_render;
69mod exit;
70mod output;
71mod path_display;
72mod style;