Skip to main content

rustauth_cli/
lib.rs

1pub mod app;
2pub(crate) mod commands;
3pub mod config;
4pub mod db;
5pub mod diagnostics;
6pub(crate) mod env;
7pub(crate) mod output;
8pub(crate) mod paths;
9pub mod plugins;
10pub(crate) mod prompt;
11pub mod schema;
12pub mod secret;
13#[cfg(feature = "telemetry")]
14pub(crate) mod telemetry;
15#[cfg(not(feature = "telemetry"))]
16pub(crate) mod telemetry {
17    use crate::config::CliConfig;
18    use serde_json::Map;
19
20    pub(crate) async fn publish_generate(_: &CliConfig, _: &'static str) {}
21
22    pub(crate) async fn publish_generate_with_extra(
23        _: &CliConfig,
24        _: &'static str,
25        _: Map<String, serde_json::Value>,
26    ) {
27    }
28
29    pub(crate) async fn publish_migrate(_: &CliConfig, _: &'static str) {}
30
31    #[allow(dead_code)]
32    pub(crate) async fn publish_migrate_with_extra(
33        _: &CliConfig,
34        _: &'static str,
35        _: Map<String, serde_json::Value>,
36    ) {
37    }
38
39    pub(crate) async fn publish_cli_event_for_command(
40        _: &CliConfig,
41        _: &'static str,
42        _: &'static str,
43        _: Map<String, serde_json::Value>,
44    ) {
45    }
46}
47pub mod workspace;
48
49#[cfg(test)]
50#[allow(clippy::expect_used)]
51mod manifest_tests {
52    use cargo_metadata::MetadataCommand;
53
54    /// OPE-144: `cargo run -p rustauth-cli` must resolve the canonical binary without `--bin`.
55    #[test]
56    fn default_run_is_rustauth() {
57        let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
58        let metadata = MetadataCommand::new()
59            .manifest_path(&manifest_path)
60            .no_deps()
61            .exec()
62            .expect("read crate manifest");
63        let package = metadata
64            .packages
65            .into_iter()
66            .find(|pkg| pkg.name == "rustauth-cli")
67            .expect("rustauth-cli package in manifest");
68
69        assert_eq!(
70            package.default_run.as_deref(),
71            Some("rustauth"),
72            "set default-run = \"rustauth\" so contributors can run `cargo run -p rustauth-cli`"
73        );
74    }
75}