fix: add --all to cargo fmt in script/test and autoformat codebase

cargo fmt without --all fails with "Failed to find targets" in
workspace repos. This was blocking every story's gates. Also ran
cargo fmt --all to fix all existing formatting issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dave
2026-04-13 14:07:08 +00:00
parent ed2526ce41
commit 845b85e7a7
128 changed files with 3566 additions and 2395 deletions
+20 -26
View File
@@ -24,7 +24,10 @@ use std::path::Path;
/// Returns `None` for `Scaffold` since that step has no single output file — it
/// creates the full `.huskies/` directory structure and is handled by
/// `huskies init` before the server starts.
pub(crate) fn step_output_path(project_root: &Path, step: WizardStep) -> Option<std::path::PathBuf> {
pub(crate) fn step_output_path(
project_root: &Path,
step: WizardStep,
) -> Option<std::path::PathBuf> {
match step {
WizardStep::Context => Some(
project_root
@@ -58,7 +61,11 @@ pub(crate) fn is_script_step(step: WizardStep) -> bool {
/// Existing files (including `CLAUDE.md`) are never overwritten — the wizard
/// appends or skips per the acceptance criteria. For script steps the file is
/// also made executable after writing.
pub(crate) fn write_if_missing(path: &Path, content: &str, executable: bool) -> Result<bool, String> {
pub(crate) fn write_if_missing(
path: &Path,
content: &str,
executable: bool,
) -> Result<bool, String> {
if path.exists() {
return Ok(false); // already present — skip silently
}
@@ -66,8 +73,7 @@ pub(crate) fn write_if_missing(path: &Path, content: &str, executable: bool) ->
fs::create_dir_all(parent)
.map_err(|e| format!("Failed to create directory {}: {e}", parent.display()))?;
}
fs::write(path, content)
.map_err(|e| format!("Failed to write {}: {e}", path.display()))?;
fs::write(path, content).map_err(|e| format!("Failed to write {}: {e}", path.display()))?;
if executable {
#[cfg(unix)]
@@ -186,7 +192,8 @@ pub(crate) fn generation_hint(step: WizardStep, project_root: &Path) -> String {
- High-level goal of the project\n\
- Core features\n\
- Domain concepts and entities\n\
- Glossary of abbreviations and technical terms".to_string()
- Glossary of abbreviations and technical terms"
.to_string()
} else {
"Read the project source tree and generate a `.huskies/specs/00_CONTEXT.md` describing:\n\
- High-level goal of the project\n\
@@ -262,7 +269,9 @@ pub(crate) fn generation_hint(step: WizardStep, project_root: &Path) -> String {
"Generate a `script/test_coverage` shell script (#!/usr/bin/env bash, set -euo pipefail) that generates a test coverage report (e.g. `cargo llvm-cov nextest` or `npm run coverage`).".to_string()
}
}
WizardStep::Scaffold => "Scaffold step is handled automatically by `huskies init`.".to_string(),
WizardStep::Scaffold => {
"Scaffold step is handled automatically by `huskies init`.".to_string()
}
}
}
@@ -427,11 +436,8 @@ mod tests {
fn wizard_generate_with_content_stages_content() {
let dir = TempDir::new().unwrap();
let ctx = setup(&dir);
let result = tool_wizard_generate(
&serde_json::json!({"content": "# My Project"}),
&ctx,
)
.unwrap();
let result =
tool_wizard_generate(&serde_json::json!({"content": "# My Project"}), &ctx).unwrap();
assert!(result.contains("staged"));
let state = WizardState::load(dir.path()).unwrap();
assert_eq!(state.steps[1].status, StepStatus::AwaitingConfirmation);
@@ -443,11 +449,7 @@ mod tests {
let dir = TempDir::new().unwrap();
let ctx = setup(&dir);
// Stage content for Context step.
tool_wizard_generate(
&serde_json::json!({"content": "# Context content"}),
&ctx,
)
.unwrap();
tool_wizard_generate(&serde_json::json!({"content": "# Context content"}), &ctx).unwrap();
let result = tool_wizard_confirm(&ctx).unwrap();
assert!(result.contains("confirmed"));
// File should now exist.
@@ -478,11 +480,7 @@ mod tests {
std::fs::write(&context_path, "original content").unwrap();
// Stage and confirm — existing file should NOT be overwritten.
tool_wizard_generate(
&serde_json::json!({"content": "new content"}),
&ctx,
)
.unwrap();
tool_wizard_generate(&serde_json::json!({"content": "new content"}), &ctx).unwrap();
let result = tool_wizard_confirm(&ctx).unwrap();
assert!(result.contains("already exists"));
assert_eq!(
@@ -507,11 +505,7 @@ mod tests {
let dir = TempDir::new().unwrap();
let ctx = setup(&dir);
// Stage content first.
tool_wizard_generate(
&serde_json::json!({"content": "some content"}),
&ctx,
)
.unwrap();
tool_wizard_generate(&serde_json::json!({"content": "some content"}), &ctx).unwrap();
let result = tool_wizard_retry(&ctx).unwrap();
assert!(result.contains("reset"));
let state = WizardState::load(dir.path()).unwrap();