Skip to content

Commit 299da2f

Browse files
committed
chore: bump version to 0.1.2 and remove unused imports
This commit updates the package version and removes unused imports across multiple files to improve code cleanliness and reduce compiler warnings.
1 parent efbf4fd commit 299da2f

21 files changed

Lines changed: 77 additions & 59 deletions

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "nuts"
3-
version = "0.1.0"
3+
version = "0.1.2"
44
edition = "2021"
55
authors = ["PimoussTO <pimouss@wellcode.ai>"]
66
description = "Nuts CLI tool"

src/commands/ask.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::config::Config;
66
use crate::commands::call::CallCommand;
77
use crate::commands::generate::GenerateCommand;
88
use serde_json::Value;
9-
use std::collections::HashMap;
109

1110
pub struct AskCommand {
1211
config: Config,

src/commands/call.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ impl CallCommand {
411411
Ok(options)
412412
}
413413

414+
#[allow(dead_code)]
414415
async fn print_response(&self, response: reqwest::Response) -> CommandResult {
415416
println!("📡 Status: {}", style(response.status()).yellow());
416417

@@ -648,12 +649,10 @@ impl CallCommand {
648649
}
649650

650651
// CORS recommendations
651-
if headers.contains_key("access-control-allow-origin") {
652-
if headers.get("access-control-allow-origin")
652+
if headers.get("access-control-allow-origin")
653653
.and_then(|v| v.to_str().ok())
654654
.map_or(false, |v| v == "*") {
655-
recommendations.push("Consider restricting CORS Access-Control-Allow-Origin".to_string());
656-
}
655+
recommendations.push("Consider restricting CORS Access-Control-Allow-Origin".to_string());
657656
}
658657

659658
recommendations

src/commands/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl ConfigCommand {
1212
}
1313

1414
pub async fn execute(&self, args: &[&str]) -> CommandResult {
15-
match args.get(1).map(|s| *s) {
15+
match args.get(1).copied() {
1616
Some("api-key") => {
1717
println!("Enter your Anthropic API key:");
1818
let key = dialoguer::Input::<String>::new()

src/commands/discover.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
use std::collections::{HashMap, HashSet};
21
use anthropic::{
32
client::ClientBuilder,
43
types::{Message, ContentBlock, MessagesRequestBuilder, Role},
54
};
65
use reqwest;
7-
use serde_json::{json, Value};
6+
use serde_json::Value;
87
use crate::config::Config;
9-
use crate::commands::call::CallCommand;
108

119
pub struct DiscoverCommand {
1210
config: Config,
@@ -26,6 +24,7 @@ pub struct ApiMap {
2624
pub base_url: String,
2725
pub endpoints: Vec<ApiEndpoint>,
2826
pub authentication: Option<String>,
27+
#[allow(dead_code)]
2928
pub rate_limits: Option<String>,
3029
pub documentation: Option<String>,
3130
}
@@ -128,7 +127,7 @@ impl DiscoverCommand {
128127
}
129128

130129
// Extract authentication info
131-
if let Some(security) = spec.get("security") {
130+
if let Some(_security) = spec.get("security") {
132131
api_map.authentication = Some("Found security schemes".to_string());
133132
}
134133

src/commands/explain.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl ExplainCommand {
6060
}
6161

6262
/// Explain API errors with helpful solutions
63+
#[allow(dead_code)]
6364
pub async fn explain_error(&self, error: &str, endpoint: &str) -> Result<(), Box<dyn std::error::Error>> {
6465
println!("🚨 AI analyzing error...");
6566

@@ -104,6 +105,7 @@ impl ExplainCommand {
104105
}
105106

106107
/// Explain HTTP status codes with context
108+
#[allow(dead_code)]
107109
pub async fn explain_status_code(&self, status_code: u16, context: &str) -> Result<(), Box<dyn std::error::Error>> {
108110
println!("📊 AI explaining status code {}...", status_code);
109111

src/commands/fix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use anthropic::{
44
};
55
use crate::config::Config;
66
use crate::commands::call::CallCommand;
7-
use crate::commands::security::SecurityCommand;
87
use serde_json::Value;
98

109
pub struct FixCommand {
@@ -263,6 +262,7 @@ struct ApiDiagnosis {
263262
performance_issues: Vec<String>,
264263
security_issues: Vec<String>,
265264
response_issues: Vec<String>,
265+
#[allow(dead_code)]
266266
status_code: u16,
267267
response_time_ms: u128,
268268
}

src/commands/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use anthropic::{
44
};
55
use crate::config::Config;
66
use serde_json::Value;
7-
use rand::Rng;
87

98
pub struct GenerateCommand {
109
config: Config,
@@ -77,6 +76,7 @@ impl GenerateCommand {
7776
}
7877

7978
/// Generate data for specific API endpoint testing
79+
#[allow(dead_code)]
8080
pub async fn generate_for_endpoint(&self, endpoint: &str, method: &str) -> Result<Value, Box<dyn std::error::Error>> {
8181
let api_key = self.config.anthropic_api_key.as_ref()
8282
.ok_or("API key not configured. Use 'config api-key' to set it")?;

src/commands/mock.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
use crate::flows::{OpenAPISpec, Operation};
2-
use std::error::Error;
32
use std::net::SocketAddr;
43
use axum::{
54
Router,
6-
routing::{get, post, put, delete, patch},
5+
routing::{get, post},
76
Json,
87
http::StatusCode,
9-
response::IntoResponse,
108
};
119
use serde_json::{Value, json};
12-
use tokio::net::TcpListener;
13-
use tracing::{info, warn, error};
14-
use url;
15-
use tokio::signal;
16-
use tower_http::trace::TraceLayer;
17-
use std::time::Duration;
18-
use axum::response::Response;
19-
use axum::http::Request;
20-
use tracing_subscriber::{self, fmt::format::FmtSpan};
2110
use std::collections::HashMap;
2211
use std::sync::Arc;
23-
use rand::Rng;
2412
use axum::extract::Path;
2513
use axum_server::Server;
26-
use std::future::Future;
2714
use tokio::signal::ctrl_c;
2815
use std::sync::atomic::{AtomicBool, Ordering};
2916

17+
#[allow(dead_code)]
3018
pub struct MockServer {
3119
spec: OpenAPISpec,
3220
port: u16,
3321
running: Arc<AtomicBool>,
3422
}
3523

24+
#[allow(dead_code)]
3625
impl MockServer {
3726
pub fn new(spec: OpenAPISpec, port: u16) -> Self {
3827
Self {

src/commands/mod.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,27 @@ pub type CommandResult = Result<(), Box<dyn std::error::Error>>;
1919

2020
// Add shared command context
2121
#[derive(Clone)]
22+
#[allow(dead_code)]
2223
pub struct CommandContext {
2324
pub flows: Arc<crate::flows::CollectionManager>,
2425
}
2526

2627
// Add shared command traits
28+
#[allow(dead_code)]
2729
pub trait Command {
2830
fn name(&self) -> &'static str;
2931
fn description(&self) -> &'static str;
3032

3133
fn execute(&self, ctx: &CommandContext, args: &[String]) -> CommandResult;
3234
}
3335

34-
// Re-export
35-
pub use config::ConfigCommand;
36-
pub use test::TestCommand;
37-
pub use discover::DiscoverCommand;
38-
pub use predict::PredictCommand;
39-
pub use ask::AskCommand;
40-
pub use generate::GenerateCommand;
41-
pub use monitor::MonitorCommand;
42-
pub use explain::ExplainCommand;
43-
pub use fix::FixCommand;
36+
// Re-export (commented out unused imports)
37+
// pub use config::ConfigCommand;
38+
// pub use test::TestCommand;
39+
// pub use discover::DiscoverCommand;
40+
// pub use predict::PredictCommand;
41+
// pub use ask::AskCommand;
42+
// pub use generate::GenerateCommand;
43+
// pub use monitor::MonitorCommand;
44+
// pub use explain::ExplainCommand;
45+
// pub use fix::FixCommand;

0 commit comments

Comments
 (0)