making linters happy
Some checks failed
CI / Rust Blocking Checks (push) Failing after 22s
CI / Web Blocking Checks (push) Failing after 26s
CI / Security Blocking Checks (push) Successful in 9s
CI / Web Advisory Checks (push) Successful in 32s
CI / Security Advisory Checks (push) Has been cancelled

This commit is contained in:
2026-03-04 23:44:45 -06:00
parent 6a5a3c2b78
commit 13749409cd
81 changed files with 468 additions and 599 deletions

View File

@@ -180,8 +180,8 @@ impl ApiClient {
let req = self.attach_body(self.build_request(method.clone(), path), body);
let response = req.send().await.context("Failed to send request to API")?;
if response.status() == StatusCode::UNAUTHORIZED && self.refresh_token.is_some() {
if self.refresh_auth_token().await? {
if response.status() == StatusCode::UNAUTHORIZED && self.refresh_token.is_some()
&& self.refresh_auth_token().await? {
// Retry with new token
let req = self.attach_body(self.build_request(method, path), body);
let response = req
@@ -190,7 +190,6 @@ impl ApiClient {
.context("Failed to send request to API (retry)")?;
return self.handle_response(response).await;
}
}
self.handle_response(response).await
}
@@ -205,8 +204,8 @@ impl ApiClient {
let req = self.attach_body(self.build_request(method.clone(), path), body);
let response = req.send().await.context("Failed to send request to API")?;
if response.status() == StatusCode::UNAUTHORIZED && self.refresh_token.is_some() {
if self.refresh_auth_token().await? {
if response.status() == StatusCode::UNAUTHORIZED && self.refresh_token.is_some()
&& self.refresh_auth_token().await? {
let req = self.attach_body(self.build_request(method, path), body);
let response = req
.send()
@@ -214,7 +213,6 @@ impl ApiClient {
.context("Failed to send request to API (retry)")?;
return self.handle_empty_response(response).await;
}
}
self.handle_empty_response(response).await
}
@@ -393,8 +391,8 @@ impl ApiClient {
.await
.context("Failed to send multipart request to API")?;
if response.status() == StatusCode::UNAUTHORIZED && self.refresh_token.is_some() {
if self.refresh_auth_token().await? {
if response.status() == StatusCode::UNAUTHORIZED && self.refresh_token.is_some()
&& self.refresh_auth_token().await? {
// Retry with new token
let req = build_multipart_request(self, &file_bytes)?;
let response = req
@@ -403,7 +401,6 @@ impl ApiClient {
.context("Failed to send multipart request to API (retry)")?;
return self.handle_response(response).await;
}
}
self.handle_response(response).await
}

View File

@@ -314,6 +314,7 @@ async fn handle_show(
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn handle_update(
action_ref: String,
label: Option<String>,
@@ -415,6 +416,7 @@ async fn handle_delete(
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn handle_execute(
action_ref: String,
params: Vec<String>,
@@ -454,11 +456,8 @@ async fn handle_execute(
parameters,
};
match output_format {
OutputFormat::Table => {
output::print_info(&format!("Executing action: {}", action_ref));
}
_ => {}
if output_format == OutputFormat::Table {
output::print_info(&format!("Executing action: {}", action_ref));
}
let path = "/executions/execute".to_string();
@@ -481,14 +480,11 @@ async fn handle_execute(
return Ok(());
}
match output_format {
OutputFormat::Table => {
output::print_info(&format!(
"Waiting for execution {} to complete...",
execution.id
));
}
_ => {}
if output_format == OutputFormat::Table {
output::print_info(&format!(
"Waiting for execution {} to complete...",
execution.id
));
}
let verbose = matches!(output_format, OutputFormat::Table);

View File

@@ -163,6 +163,7 @@ pub async fn handle_execution_command(
}
}
#[allow(clippy::too_many_arguments)]
async fn handle_list(
profile: &Option<String>,
pack: Option<String>,

View File

@@ -468,7 +468,7 @@ pub async fn handle_pack_command(
///
/// Splits on `_`, `-`, or `.` and title-cases each word.
fn label_from_ref(r: &str) -> String {
r.split(|c| c == '_' || c == '-' || c == '.')
r.split(['_', '-', '.'])
.filter(|s| !s.is_empty())
.map(|word| {
let mut chars = word.chars();
@@ -484,6 +484,7 @@ fn label_from_ref(r: &str) -> String {
.join(" ")
}
#[allow(clippy::too_many_arguments)]
async fn handle_create(
profile: &Option<String>,
ref_flag: Option<String>,
@@ -725,6 +726,7 @@ async fn handle_show(
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn handle_install(
profile: &Option<String>,
source: String,
@@ -742,18 +744,15 @@ async fn handle_install(
// Detect source type
let source_type = detect_source_type(&source, ref_spec.as_deref(), no_registry);
match output_format {
OutputFormat::Table => {
output::print_info(&format!(
"Installing pack from: {} ({})",
source, source_type
));
output::print_info("Starting installation...");
if skip_deps {
output::print_info("⚠ Dependency validation will be skipped");
}
if output_format == OutputFormat::Table {
output::print_info(&format!(
"Installing pack from: {} ({})",
source, source_type
));
output::print_info("Starting installation...");
if skip_deps {
output::print_info("⚠ Dependency validation will be skipped");
}
_ => {}
}
let request = InstallPackRequest {
@@ -880,12 +879,9 @@ async fn handle_upload(
.and_then(|v| v.as_str())
.unwrap_or("unknown");
match output_format {
OutputFormat::Table => {
output::print_info(&format!("Uploading pack '{}' from: {}", pack_ref, path));
output::print_info("Creating archive...");
}
_ => {}
if output_format == OutputFormat::Table {
output::print_info(&format!("Uploading pack '{}' from: {}", pack_ref, path));
output::print_info("Creating archive...");
}
// Build an in-memory tar.gz of the pack directory
@@ -908,14 +904,11 @@ async fn handle_upload(
let archive_size_kb = tar_gz_bytes.len() / 1024;
match output_format {
OutputFormat::Table => {
output::print_info(&format!(
"Archive ready ({} KB), uploading...",
archive_size_kb
));
}
_ => {}
if output_format == OutputFormat::Table {
output::print_info(&format!(
"Archive ready ({} KB), uploading...",
archive_size_kb
));
}
let config = CliConfig::load_with_profile(profile.as_deref())?;
@@ -1014,25 +1007,17 @@ async fn handle_register(
&& !path.starts_with("/app/")
&& !path.starts_with("/packs");
if looks_local {
match output_format {
OutputFormat::Table => {
output::print_info(&format!("Registering pack from: {}", path));
eprintln!(
"⚠ Warning: '{}' looks like a local path. If the API is running in \
Docker it may not be able to access this path.\n \
Use `attune pack upload {}` instead to upload the pack directly.",
path, path
);
}
_ => {}
}
} else {
match output_format {
OutputFormat::Table => {
output::print_info(&format!("Registering pack from: {}", path));
}
_ => {}
if output_format == OutputFormat::Table {
output::print_info(&format!("Registering pack from: {}", path));
eprintln!(
"⚠ Warning: '{}' looks like a local path. If the API is running in \
Docker it may not be able to access this path.\n \
Use `attune pack upload {}` instead to upload the pack directly.",
path, path
);
}
} else if output_format == OutputFormat::Table {
output::print_info(&format!("Registering pack from: {}", path));
}
let request = RegisterPackRequest {
@@ -1173,13 +1158,10 @@ async fn handle_test(
let executor = TestExecutor::new(pack_base_dir);
// Print test start message
match output_format {
OutputFormat::Table => {
println!();
output::print_section(&format!("🧪 Testing Pack: {} v{}", pack_ref, pack_version));
println!();
}
_ => {}
if output_format == OutputFormat::Table {
println!();
output::print_section(&format!("🧪 Testing Pack: {} v{}", pack_ref, pack_version));
println!();
}
// Execute tests
@@ -1688,7 +1670,7 @@ async fn handle_index_entry(
if let Some(ref git) = git_url {
let default_ref = format!("v{}", version);
let ref_value = git_ref.as_ref().map(|s| s.as_str()).unwrap_or(&default_ref);
let ref_value = git_ref.as_deref().unwrap_or(&default_ref);
let git_source = serde_json::json!({
"type": "git",
"url": git,
@@ -1790,6 +1772,7 @@ async fn handle_index_entry(
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn handle_update(
profile: &Option<String>,
pack_ref: String,

View File

@@ -76,10 +76,8 @@ pub async fn handle_index_update(
if output_format == OutputFormat::Table {
output::print_info(&format!("Updating existing entry for '{}'", pack_ref));
}
} else {
if output_format == OutputFormat::Table {
output::print_info(&format!("Adding new entry for '{}'", pack_ref));
}
} else if output_format == OutputFormat::Table {
output::print_info(&format!("Adding new entry for '{}'", pack_ref));
}
// Calculate checksum
@@ -93,7 +91,7 @@ pub async fn handle_index_update(
if let Some(ref git) = git_url {
let default_ref = format!("v{}", version);
let ref_value = git_ref.as_ref().map(|s| s.as_str()).unwrap_or(&default_ref);
let ref_value = git_ref.as_deref().unwrap_or(&default_ref);
install_sources.push(serde_json::json!({
"type": "git",
"url": git,
@@ -318,13 +316,11 @@ pub async fn handle_index_merge(
));
}
packs_map.insert(pack_ref.to_string(), pack.clone());
} else {
if output_format == OutputFormat::Table {
output::print_info(&format!(
" Keeping '{}' at {} (newer than {})",
pack_ref, existing_version, new_version
));
}
} else if output_format == OutputFormat::Table {
output::print_info(&format!(
" Keeping '{}' at {} (newer than {})",
pack_ref, existing_version, new_version
));
}
duplicates_resolved += 1;
} else {

View File

@@ -354,6 +354,7 @@ async fn handle_show(
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn handle_update(
profile: &Option<String>,
rule_ref: String,
@@ -477,6 +478,7 @@ async fn handle_toggle(
Ok(())
}
#[allow(clippy::too_many_arguments)]
async fn handle_create(
profile: &Option<String>,
name: String,

View File

@@ -472,7 +472,7 @@ fn resolve_ws_url(opts: &WaitOptions<'_>) -> Option<String> {
let api_url = opts.api_client.base_url();
// Transform http(s)://host:PORT/... → ws(s)://host:8081
let ws_url = derive_notifier_url(&api_url)?;
let ws_url = derive_notifier_url(api_url)?;
Some(ws_url)
}