diff --git a/Cargo.lock b/Cargo.lock index cac3ea11..e4fcfdd1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,6 +76,59 @@ dependencies = [ "generic-array", ] +[[package]] +name = "bough-cli" +version = "0.0.0" +dependencies = [ + "bough-core", + "bough-session", + "clap", + "clap_complete", + "glob", + "serde", + "serde_json", + "similar", + "terminal_size", +] + +[[package]] +name = "bough-core" +version = "0.0.0" +dependencies = [ + "clap", + "serde", + "serde_json", + "sha2", + "tree-sitter", + "tree-sitter-javascript", + "tree-sitter-typescript", +] + +[[package]] +name = "bough-lib" +version = "0.0.0" + +[[package]] +name = "bough-session" +version = "0.0.0" +dependencies = [ + "bough-core", + "bough-session-derive", + "clap", + "serde", + "serde_json", + "toml", +] + +[[package]] +name = "bough-session-derive" +version = "0.0.0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "cc" version = "1.2.56" @@ -272,59 +325,6 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" -[[package]] -name = "pollard-cli" -version = "0.0.0" -dependencies = [ - "clap", - "clap_complete", - "glob", - "pollard-core", - "pollard-session", - "serde", - "serde_json", - "similar", - "terminal_size", -] - -[[package]] -name = "pollard-core" -version = "0.0.0" -dependencies = [ - "clap", - "serde", - "serde_json", - "sha2", - "tree-sitter", - "tree-sitter-javascript", - "tree-sitter-typescript", -] - -[[package]] -name = "pollard-lib" -version = "0.0.0" - -[[package]] -name = "pollard-session" -version = "0.0.0" -dependencies = [ - "clap", - "pollard-core", - "pollard-session-derive", - "serde", - "serde_json", - "toml", -] - -[[package]] -name = "pollard-session-derive" -version = "0.0.0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "proc-macro2" version = "1.0.106" diff --git a/README.md b/README.md index b331b1ec..e1b244db 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# Pollard +# Bough Cross-language mutation testing. ## Config -Create `pollard.toml` in your project root: +Create `bough.toml` in your project root: ```toml language = "js" vcs = "jj" -working_dir = "/tmp/pollard-work" +working_dir = "/tmp/bough-work" parallelism = 2 -report_dir = "/tmp/pollard-report" +report_dir = "/tmp/bough-report" ordering = "random" files = "src/**/*.js" sub_dir = "." @@ -25,7 +25,7 @@ install = "npm install" test = "npx vitest run" ``` -Also supported: `pollard.json`, `.pollard.toml`, `.config/pollard.toml`, etc. Use `--config ` to specify explicitly. +Also supported: `bough.json`, `.bough.toml`, `.config/bough.toml`, etc. Use `--config ` to specify explicitly. All config values can be overridden via CLI flags (e.g. `--parallelism 4`). @@ -36,7 +36,7 @@ All config values can be overridden via CLI flags (e.g. `--parallelism 4`). Generate all possible mutations: ``` -pollard step plan +bough step plan ``` Writes a `$HASH.mutants.plan.json` to `working_dir`. @@ -44,7 +44,7 @@ Writes a `$HASH.mutants.plan.json` to `working_dir`. ### 2. Create workspaces ``` -pollard step create +bough step create ``` Creates one jj workspace per `parallelism` setting. Writes a `$HASH.workspaces.json` manifest. @@ -52,7 +52,7 @@ Creates one jj workspace per `parallelism` setting. Writes a `$HASH.workspaces.j ### 3. Install dependencies ``` -pollard step install -w +bough step install -w ``` Runs `commands.install` in the workspace's `sub_dir`. @@ -60,7 +60,7 @@ Runs `commands.install` in the workspace's `sub_dir`. ### 4. Apply a mutation ``` -pollard step apply -w --hash +bough step apply -w --hash ``` Applies a specific mutation from the plan to a file in the workspace. @@ -68,7 +68,7 @@ Applies a specific mutation from the plan to a file in the workspace. ### 5. Test ``` -pollard step test -w +bough step test -w ``` Runs `commands.test`. Exit code 0 = mutant survived, non-zero = mutant killed. @@ -76,7 +76,7 @@ Runs `commands.test`. Exit code 0 = mutant survived, non-zero = mutant killed. ### 6. Reset ``` -pollard step reset -w -r +bough step reset -w -r ``` Resets the workspace back to a clean revision via `jj edit`. Use this between mutation test runs. @@ -84,7 +84,7 @@ Resets the workspace back to a clean revision via `jj edit`. Use this between mu ### 7. Cleanup ``` -pollard step cleanup +bough step cleanup ``` Forgets all jj workspaces and removes working directories. @@ -92,34 +92,34 @@ Forgets all jj workspaces and removes working directories. ### Full example ```sh -pollard step plan -pollard step create -pollard step install -w pollard-abc12345-0 +bough step plan +bough step create +bough step install -w bough-abc12345-0 # test a mutation -pollard step apply -w pollard-abc12345-0 --hash e463d93771037e15 -pollard step test -w pollard-abc12345-0 +bough step apply -w bough-abc12345-0 --hash e463d93771037e15 +bough step test -w bough-abc12345-0 # reset and try another -pollard step reset -w pollard-abc12345-0 -r trunk() -pollard step apply -w pollard-abc12345-0 --hash 3b5d343b076d654a -pollard step test -w pollard-abc12345-0 +bough step reset -w bough-abc12345-0 -r trunk() +bough step apply -w bough-abc12345-0 --hash 3b5d343b076d654a +bough step test -w bough-abc12345-0 # done -pollard step cleanup +bough step cleanup ``` ## Low-level mutation commands ```sh # list all mutations for a file -pollard mutate generate -f src/foo.js +bough mutate generate -f src/foo.js # view a mutation diff -pollard mutate view -f src/foo.js --hash +bough mutate view -f src/foo.js --hash # apply a mutation in place (requires --force-on-dirty-repo if repo is dirty) -pollard mutate apply -f src/foo.js --hash +bough mutate apply -f src/foo.js --hash ``` ## Flags diff --git a/crates/pollard-cli/.gitignore b/crates/bough-cli/.gitignore similarity index 100% rename from crates/pollard-cli/.gitignore rename to crates/bough-cli/.gitignore diff --git a/crates/pollard-session/Cargo.toml b/crates/bough-cli/Cargo.toml similarity index 55% rename from crates/pollard-session/Cargo.toml rename to crates/bough-cli/Cargo.toml index 8d279796..279cabbf 100644 --- a/crates/pollard-session/Cargo.toml +++ b/crates/bough-cli/Cargo.toml @@ -1,13 +1,16 @@ [package] -name = "pollard-session" +name = "bough-cli" version.workspace = true edition.workspace = true license.workspace = true [dependencies] clap = { version = "4", features = ["derive", "env"] } -pollard-core = { path = "../pollard-core" } -pollard-session-derive = { path = "../pollard-session-derive" } +clap_complete = "4" +glob = "0.3.3" +bough-core = { path = "../bough-core" } +bough-session = { path = "../bough-session" } serde = { version = "1", features = ["derive"] } serde_json = "1" -toml = "1.0.3" +similar = "2" +terminal_size = "0.4" diff --git a/crates/pollard-cli/src/io.rs b/crates/bough-cli/src/io.rs similarity index 97% rename from crates/pollard-cli/src/io.rs rename to crates/bough-cli/src/io.rs index 34424bef..6dafa71a 100644 --- a/crates/pollard-cli/src/io.rs +++ b/crates/bough-cli/src/io.rs @@ -1,8 +1,8 @@ use serde::Serialize; use std::path::PathBuf; -pub use pollard_core::io::{DiffStyle, Render, color, hashed_path}; -pub use pollard_session::{Report, Session}; +pub use bough_core::io::{DiffStyle, Render, color, hashed_path}; +pub use bough_session::{Report, Session}; #[derive(Debug, Clone, Serialize)] pub enum Action { diff --git a/crates/pollard-cli/src/main.rs b/crates/bough-cli/src/main.rs similarity index 97% rename from crates/pollard-cli/src/main.rs rename to crates/bough-cli/src/main.rs index 8274f261..73d0fbf2 100644 --- a/crates/pollard-cli/src/main.rs +++ b/crates/bough-cli/src/main.rs @@ -5,13 +5,13 @@ mod steps; use clap::{CommandFactory, Parser, Subcommand}; use clap_complete::Shell; use io::{Action, Render, Report}; -use pollard_core::Hash; -use pollard_session::{PartialSession, Session, SessionSkipped, discover_config, read_config}; +use bough_core::Hash; +use bough_session::{PartialSession, Session, SessionSkipped, discover_config, read_config}; use std::io::IsTerminal; use std::path::PathBuf; #[derive(Debug, Parser)] -#[command(name = "pollard", about = "Cross-language mutation testing")] +#[command(name = "bough", about = "Cross-language mutation testing")] struct Cli { #[arg(long, global = true)] config: Option, @@ -160,7 +160,7 @@ fn main() { clap_complete::generate( *shell, &mut Cli::command(), - "pollard", + "bough", &mut std::io::stdout(), ); return; diff --git a/crates/pollard-cli/src/mutate/apply.rs b/crates/bough-cli/src/mutate/apply.rs similarity index 87% rename from crates/pollard-cli/src/mutate/apply.rs rename to crates/bough-cli/src/mutate/apply.rs index 44908e44..5818d2a9 100644 --- a/crates/pollard-cli/src/mutate/apply.rs +++ b/crates/bough-cli/src/mutate/apply.rs @@ -1,7 +1,7 @@ use crate::io::{Action, Render, Report, color, hashed_path}; use crate::mutate::find_mutated; -use pollard_core::config::LanguageId; -use pollard_core::{Hash, SourceFile}; +use bough_core::config::LanguageId; +use bough_core::{Hash, SourceFile}; use serde::Serialize; use std::path::{Path, PathBuf}; @@ -53,11 +53,11 @@ impl Render for ApplyReport { } impl Report for ApplyReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("mutate").join("apply") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "applied") } diff --git a/crates/pollard-cli/src/mutate/describe.rs b/crates/bough-cli/src/mutate/describe.rs similarity index 92% rename from crates/pollard-cli/src/mutate/describe.rs rename to crates/bough-cli/src/mutate/describe.rs index d4392453..3a020caa 100644 --- a/crates/pollard-cli/src/mutate/describe.rs +++ b/crates/bough-cli/src/mutate/describe.rs @@ -1,7 +1,7 @@ use crate::io::{Action, Render, Report, color, hashed_path}; use crate::mutate::find_description; -use pollard_core::config::LanguageId; -use pollard_core::{Hash, MutationKind, SourceFile}; +use bough_core::config::LanguageId; +use bough_core::{Hash, MutationKind, SourceFile}; use serde::Serialize; use std::path::{Path, PathBuf}; @@ -88,11 +88,11 @@ impl Render for DescribeReport { } impl Report for DescribeReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("mutate").join("describe") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "describe") } diff --git a/crates/pollard-cli/src/mutate/generate.rs b/crates/bough-cli/src/mutate/generate.rs similarity index 91% rename from crates/pollard-cli/src/mutate/generate.rs rename to crates/bough-cli/src/mutate/generate.rs index f9f20bdd..da283e28 100644 --- a/crates/pollard-cli/src/mutate/generate.rs +++ b/crates/bough-cli/src/mutate/generate.rs @@ -1,9 +1,9 @@ use crate::io::{Action, Render, Report, color, hashed_path}; use crate::steps::expand_glob; -use pollard_core::config::LanguageId; -use pollard_core::languages::javascript::JavaScript; -use pollard_core::languages::typescript::TypeScript; -use pollard_core::{ +use bough_core::config::LanguageId; +use bough_core::languages::javascript::JavaScript; +use bough_core::languages::typescript::TypeScript; +use bough_core::{ Hash, Language, MutationKind, SourceFile, find_mutation_points, generate_mutation_substitutions, }; @@ -95,11 +95,11 @@ impl Render for GenerateReport { } impl Report for GenerateReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("mutate").join("generate") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "mutations") } diff --git a/crates/pollard-cli/src/mutate/mod.rs b/crates/bough-cli/src/mutate/mod.rs similarity index 94% rename from crates/pollard-cli/src/mutate/mod.rs rename to crates/bough-cli/src/mutate/mod.rs index 31ea8c4d..f11c03cb 100644 --- a/crates/pollard-cli/src/mutate/mod.rs +++ b/crates/bough-cli/src/mutate/mod.rs @@ -3,10 +3,10 @@ pub mod describe; pub mod generate; pub mod view; -use pollard_core::config::LanguageId; -use pollard_core::languages::javascript::JavaScript; -use pollard_core::languages::typescript::TypeScript; -use pollard_core::{ +use bough_core::config::LanguageId; +use bough_core::languages::javascript::JavaScript; +use bough_core::languages::typescript::TypeScript; +use bough_core::{ Hash, Language, MutatedFile, MutationKind, SourceFile, find_mutation_points, generate_mutation_substitutions, }; diff --git a/crates/pollard-cli/src/mutate/view.rs b/crates/bough-cli/src/mutate/view.rs similarity index 94% rename from crates/pollard-cli/src/mutate/view.rs rename to crates/bough-cli/src/mutate/view.rs index 62d582b9..e2879856 100644 --- a/crates/pollard-cli/src/mutate/view.rs +++ b/crates/bough-cli/src/mutate/view.rs @@ -1,8 +1,8 @@ use crate::io::{Action, DiffStyle, Render, Report, hashed_path}; use crate::mutate::find_mutated; -use pollard_core::config::LanguageId; -use pollard_core::io::color; -use pollard_core::{Hash, SourceFile}; +use bough_core::config::LanguageId; +use bough_core::io::color; +use bough_core::{Hash, SourceFile}; use similar::{ChangeTag, TextDiff}; use std::fmt::Write; use std::path::{Path, PathBuf}; @@ -56,11 +56,11 @@ impl Render for ViewReport { } impl Report for ViewReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("mutate").join("view") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = format!("{}:{}:{}", self.path, self.old, self.new); hashed_path(&self.get_dir(session), &content, "diff") } diff --git a/crates/pollard-cli/src/steps/apply_mutant_to_workspace.rs b/crates/bough-cli/src/steps/apply_mutant_to_workspace.rs similarity index 91% rename from crates/pollard-cli/src/steps/apply_mutant_to_workspace.rs rename to crates/bough-cli/src/steps/apply_mutant_to_workspace.rs index ed2c429e..53a34627 100644 --- a/crates/pollard-cli/src/steps/apply_mutant_to_workspace.rs +++ b/crates/bough-cli/src/steps/apply_mutant_to_workspace.rs @@ -1,7 +1,7 @@ use crate::io::{Action, Render, Report, color, hashed_path}; -use pollard_session::Session; +use bough_session::Session; use crate::steps::{find_workspace, read_plan, read_workspace_manifest}; -use pollard_core::Hash; +use bough_core::Hash; use serde::Serialize; use std::path::PathBuf; @@ -29,7 +29,7 @@ pub fn run( std::process::exit(1); }); - let source_hash = pollard_core::Hash::of(&source_content); + let source_hash = bough_core::Hash::of(&source_content); if source_hash != entry.source_hash { eprintln!( "source hash mismatch for {}: expected {}, got {}", @@ -85,14 +85,14 @@ impl Render for ApplyMutantToWorkspaceReport { } impl Report for ApplyMutantToWorkspaceReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session .directories.report .join("step") .join("apply-mutant-to-workspace") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "applied") } diff --git a/crates/pollard-cli/src/steps/cleanup.rs b/crates/bough-cli/src/steps/cleanup.rs similarity index 89% rename from crates/pollard-cli/src/steps/cleanup.rs rename to crates/bough-cli/src/steps/cleanup.rs index 7a6e73e2..d9581d77 100644 --- a/crates/pollard-cli/src/steps/cleanup.rs +++ b/crates/bough-cli/src/steps/cleanup.rs @@ -1,5 +1,5 @@ use crate::io::{Action, Render, Report, color, hashed_path}; -use pollard_session::Session; +use bough_session::Session; use crate::steps::expand_glob; use serde::Serialize; use std::path::PathBuf; @@ -16,7 +16,7 @@ pub fn run(session: &Session) -> (Vec, CleanupReport) { eprintln!("failed to read {}: {e}", manifest_path.display()); std::process::exit(1); }); - let manifest: pollard_core::plan::WorkspaceManifest = serde_json::from_str(&content) + let manifest: bough_core::plan::WorkspaceManifest = serde_json::from_str(&content) .unwrap_or_else(|e| { eprintln!("failed to parse {}: {e}", manifest_path.display()); std::process::exit(1); @@ -70,11 +70,11 @@ impl Render for CleanupReport { } impl Report for CleanupReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("step").join("cleanup") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "cleanup") } diff --git a/crates/pollard-cli/src/steps/create_workspaces.rs b/crates/bough-cli/src/steps/create_workspaces.rs similarity index 84% rename from crates/pollard-cli/src/steps/create_workspaces.rs rename to crates/bough-cli/src/steps/create_workspaces.rs index 0b61c2b9..4c2addae 100644 --- a/crates/pollard-cli/src/steps/create_workspaces.rs +++ b/crates/bough-cli/src/steps/create_workspaces.rs @@ -1,7 +1,7 @@ use crate::io::{Action, Render, Report, color, hashed_path}; -use pollard_session::Session; +use bough_session::Session; use crate::steps::content_id; -use pollard_core::config::Vcs; +use bough_core::config::Vcs; use serde::Serialize; use std::path::PathBuf; @@ -20,15 +20,15 @@ pub fn run(session: &Session) -> (Vec, CreateWorkspacesReport) { .as_nanos(); let batch_id = &content_id(&nanos.to_string())[..8]; - let workspaces: Vec = (0..session.parallelism) + let workspaces: Vec = (0..session.parallelism) .map(|i| { - let name = format!("pollard-{batch_id}-{i}"); + let name = format!("bough-{batch_id}-{i}"); let path = session.directories.working.join(&name); - pollard_core::plan::Workspace { name, path } + bough_core::plan::Workspace { name, path } }) .collect(); - let manifest = pollard_core::plan::WorkspaceManifest { + let manifest = bough_core::plan::WorkspaceManifest { workspaces: workspaces.clone(), }; let manifest_content = @@ -86,11 +86,11 @@ impl Render for CreateWorkspacesReport { } impl Report for CreateWorkspacesReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("step").join("create-workspaces") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "workspaces") } diff --git a/crates/pollard-cli/src/steps/derive_mutants.rs b/crates/bough-cli/src/steps/derive_mutants.rs similarity index 89% rename from crates/pollard-cli/src/steps/derive_mutants.rs rename to crates/bough-cli/src/steps/derive_mutants.rs index f898b561..205654ae 100644 --- a/crates/pollard-cli/src/steps/derive_mutants.rs +++ b/crates/bough-cli/src/steps/derive_mutants.rs @@ -1,11 +1,11 @@ use crate::io::{Action, Render, Report, color, hashed_path}; -use pollard_session::Session; +use bough_session::Session; use crate::steps::content_id; -use pollard_core::config::LanguageId; -use pollard_core::languages::javascript::JavaScript; -use pollard_core::languages::typescript::TypeScript; -use pollard_core::plan::{Plan, PlanEntry}; -use pollard_core::{ +use bough_core::config::LanguageId; +use bough_core::languages::javascript::JavaScript; +use bough_core::languages::typescript::TypeScript; +use bough_core::plan::{Plan, PlanEntry}; +use bough_core::{ Language, MutationKind, SourceFile, find_mutation_points, generate_mutation_substitutions, }; use serde::Serialize; @@ -96,11 +96,11 @@ impl Render for DeriveMutantsReport { } impl Report for DeriveMutantsReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("step").join("derive-mutants") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "plan") } diff --git a/crates/pollard-cli/src/steps/find_files.rs b/crates/bough-cli/src/steps/find_files.rs similarity index 88% rename from crates/pollard-cli/src/steps/find_files.rs rename to crates/bough-cli/src/steps/find_files.rs index 040c292c..30a31de7 100644 --- a/crates/pollard-cli/src/steps/find_files.rs +++ b/crates/bough-cli/src/steps/find_files.rs @@ -1,5 +1,5 @@ use crate::io::{Action, Render, Report, color, hashed_path}; -use pollard_session::Session; +use bough_session::Session; use crate::steps::expand_glob; use serde::Serialize; use std::path::PathBuf; @@ -44,11 +44,11 @@ impl Render for FindFilesReport { } impl Report for FindFilesReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("step").join("find-files") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "files") } diff --git a/crates/pollard-cli/src/steps/mod.rs b/crates/bough-cli/src/steps/mod.rs similarity index 93% rename from crates/pollard-cli/src/steps/mod.rs rename to crates/bough-cli/src/steps/mod.rs index 949e318a..3015c63e 100644 --- a/crates/pollard-cli/src/steps/mod.rs +++ b/crates/bough-cli/src/steps/mod.rs @@ -8,8 +8,8 @@ pub mod setup_workspace; pub mod test_workspace; use crate::io::{Render, Report, hashed_path}; -use pollard_core::plan::{Plan, WorkspaceManifest}; -use pollard_session::Session; +use bough_core::plan::{Plan, WorkspaceManifest}; +use bough_session::Session; use serde::Serialize; use std::path::PathBuf; @@ -31,7 +31,7 @@ pub fn expand_glob(pattern: &str) -> Vec { } pub fn content_id(content: &str) -> String { - pollard_core::Hash::of(content).to_string() + bough_core::Hash::of(content).to_string() } pub fn read_plan(session: &Session) -> Plan { @@ -77,7 +77,7 @@ pub fn read_workspace_manifest(session: &Session) -> WorkspaceManifest { fn find_workspace<'a>( manifest: &'a WorkspaceManifest, name: &str, -) -> &'a pollard_core::plan::Workspace { +) -> &'a bough_core::plan::Workspace { manifest .workspaces .iter() @@ -163,11 +163,11 @@ impl Render for CommandReport { } impl Report for CommandReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("step").join(&self.step) } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "command") } diff --git a/crates/pollard-cli/src/steps/reset_workspace.rs b/crates/bough-cli/src/steps/reset_workspace.rs similarity index 90% rename from crates/pollard-cli/src/steps/reset_workspace.rs rename to crates/bough-cli/src/steps/reset_workspace.rs index 8581858b..cb2b6971 100644 --- a/crates/pollard-cli/src/steps/reset_workspace.rs +++ b/crates/bough-cli/src/steps/reset_workspace.rs @@ -1,7 +1,7 @@ use crate::io::{Action, Render, Report, color, hashed_path}; -use pollard_session::Session; +use bough_session::Session; use crate::steps::{find_workspace, read_workspace_manifest}; -use pollard_core::config::Vcs; +use bough_core::config::Vcs; use serde::Serialize; use std::path::PathBuf; @@ -69,11 +69,11 @@ impl Render for ResetWorkspaceReport { } impl Report for ResetWorkspaceReport { - fn get_dir(&self, session: &pollard_session::Session) -> PathBuf { + fn get_dir(&self, session: &bough_session::Session) -> PathBuf { session.directories.report.join("step").join("reset-workspace") } - fn make_path(&self, session: &pollard_session::Session) -> PathBuf { + fn make_path(&self, session: &bough_session::Session) -> PathBuf { let content = serde_json::to_string(self).expect("failed to serialize"); hashed_path(&self.get_dir(session), &content, "reset") } diff --git a/crates/pollard-cli/src/steps/test_workspace.rs b/crates/bough-cli/src/steps/setup_workspace.rs similarity index 52% rename from crates/pollard-cli/src/steps/test_workspace.rs rename to crates/bough-cli/src/steps/setup_workspace.rs index bdcdc8e9..ef05bbf4 100644 --- a/crates/pollard-cli/src/steps/test_workspace.rs +++ b/crates/bough-cli/src/steps/setup_workspace.rs @@ -1,13 +1,8 @@ use crate::io::Action; -use pollard_session::Session; +use bough_session::Session; use crate::steps::{run_in_workspace, CommandReport}; pub fn run(session: &Session, workspace: &str) -> (Vec, Option) { - let report = run_in_workspace( - session, - workspace, - &Some(session.commands.test.clone()), - "test", - ); + let report = run_in_workspace(session, workspace, &session.commands.install, "setup"); (vec![], report) } diff --git a/crates/pollard-cli/src/steps/setup_workspace.rs b/crates/bough-cli/src/steps/test_workspace.rs similarity index 52% rename from crates/pollard-cli/src/steps/setup_workspace.rs rename to crates/bough-cli/src/steps/test_workspace.rs index 7d599eca..81ed6922 100644 --- a/crates/pollard-cli/src/steps/setup_workspace.rs +++ b/crates/bough-cli/src/steps/test_workspace.rs @@ -1,8 +1,13 @@ use crate::io::Action; -use pollard_session::Session; +use bough_session::Session; use crate::steps::{run_in_workspace, CommandReport}; pub fn run(session: &Session, workspace: &str) -> (Vec, Option) { - let report = run_in_workspace(session, workspace, &session.commands.install, "setup"); + let report = run_in_workspace( + session, + workspace, + &Some(session.commands.test.clone()), + "test", + ); (vec![], report) } diff --git a/crates/pollard-core/.gitignore b/crates/bough-core/.gitignore similarity index 100% rename from crates/pollard-core/.gitignore rename to crates/bough-core/.gitignore diff --git a/crates/pollard-core/Cargo.toml b/crates/bough-core/Cargo.toml similarity index 93% rename from crates/pollard-core/Cargo.toml rename to crates/bough-core/Cargo.toml index de72fb55..0cafed1e 100644 --- a/crates/pollard-core/Cargo.toml +++ b/crates/bough-core/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pollard-core" +name = "bough-core" version.workspace = true edition.workspace = true license.workspace = true diff --git a/crates/pollard-core/src/config.rs b/crates/bough-core/src/config.rs similarity index 100% rename from crates/pollard-core/src/config.rs rename to crates/bough-core/src/config.rs diff --git a/crates/pollard-core/src/io.rs b/crates/bough-core/src/io.rs similarity index 100% rename from crates/pollard-core/src/io.rs rename to crates/bough-core/src/io.rs diff --git a/crates/pollard-core/src/languages/javascript.rs b/crates/bough-core/src/languages/javascript.rs similarity index 100% rename from crates/pollard-core/src/languages/javascript.rs rename to crates/bough-core/src/languages/javascript.rs diff --git a/crates/pollard-core/src/languages/mod.rs b/crates/bough-core/src/languages/mod.rs similarity index 100% rename from crates/pollard-core/src/languages/mod.rs rename to crates/bough-core/src/languages/mod.rs diff --git a/crates/pollard-core/src/languages/typescript.rs b/crates/bough-core/src/languages/typescript.rs similarity index 100% rename from crates/pollard-core/src/languages/typescript.rs rename to crates/bough-core/src/languages/typescript.rs diff --git a/crates/pollard-core/src/lib.rs b/crates/bough-core/src/lib.rs similarity index 100% rename from crates/pollard-core/src/lib.rs rename to crates/bough-core/src/lib.rs diff --git a/crates/pollard-core/src/plan.rs b/crates/bough-core/src/plan.rs similarity index 100% rename from crates/pollard-core/src/plan.rs rename to crates/bough-core/src/plan.rs diff --git a/crates/pollard-lib/.gitignore b/crates/bough-lib/.gitignore similarity index 100% rename from crates/pollard-lib/.gitignore rename to crates/bough-lib/.gitignore diff --git a/crates/pollard-lib/Cargo.toml b/crates/bough-lib/Cargo.toml similarity index 86% rename from crates/pollard-lib/Cargo.toml rename to crates/bough-lib/Cargo.toml index 3fb92bba..a38bb597 100644 --- a/crates/pollard-lib/Cargo.toml +++ b/crates/bough-lib/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pollard-lib" +name = "bough-lib" version.workspace = true edition.workspace = true license.workspace = true diff --git a/crates/pollard-lib/src/lib.rs b/crates/bough-lib/src/lib.rs similarity index 100% rename from crates/pollard-lib/src/lib.rs rename to crates/bough-lib/src/lib.rs diff --git a/crates/pollard-session-derive/Cargo.toml b/crates/bough-session-derive/Cargo.toml similarity index 87% rename from crates/pollard-session-derive/Cargo.toml rename to crates/bough-session-derive/Cargo.toml index d1747136..be7b746e 100644 --- a/crates/pollard-session-derive/Cargo.toml +++ b/crates/bough-session-derive/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pollard-session-derive" +name = "bough-session-derive" version.workspace = true edition.workspace = true license.workspace = true diff --git a/crates/pollard-session-derive/src/lib.rs b/crates/bough-session-derive/src/lib.rs similarity index 100% rename from crates/pollard-session-derive/src/lib.rs rename to crates/bough-session-derive/src/lib.rs diff --git a/crates/pollard-session-derive/src/settings.rs b/crates/bough-session-derive/src/settings.rs similarity index 100% rename from crates/pollard-session-derive/src/settings.rs rename to crates/bough-session-derive/src/settings.rs diff --git a/crates/pollard-cli/Cargo.toml b/crates/bough-session/Cargo.toml similarity index 54% rename from crates/pollard-cli/Cargo.toml rename to crates/bough-session/Cargo.toml index a7597f9d..7fe072fa 100644 --- a/crates/pollard-cli/Cargo.toml +++ b/crates/bough-session/Cargo.toml @@ -1,16 +1,13 @@ [package] -name = "pollard-cli" +name = "bough-session" version.workspace = true edition.workspace = true license.workspace = true [dependencies] clap = { version = "4", features = ["derive", "env"] } -clap_complete = "4" -glob = "0.3.3" -pollard-core = { path = "../pollard-core" } -pollard-session = { path = "../pollard-session" } +bough-core = { path = "../bough-core" } +bough-session-derive = { path = "../bough-session-derive" } serde = { version = "1", features = ["derive"] } serde_json = "1" -similar = "2" -terminal_size = "0.4" +toml = "1.0.3" diff --git a/crates/pollard-session/src/config.rs b/crates/bough-session/src/config.rs similarity index 83% rename from crates/pollard-session/src/config.rs rename to crates/bough-session/src/config.rs index 00535482..cf1a572e 100644 --- a/crates/pollard-session/src/config.rs +++ b/crates/bough-session/src/config.rs @@ -23,18 +23,18 @@ impl std::fmt::Display for ConfigError { impl std::error::Error for ConfigError {} pub const SEARCH_PATHS: &[&str] = &[ - ".config/pollard.config.json", - ".config/pollard.config.toml", - ".config/pollard.json", - ".config/pollard.toml", - ".pollard.config.json", - ".pollard.config.toml", - ".pollard.json", - ".pollard.toml", - "pollard.config.json", - "pollard.config.toml", - "pollard.json", - "pollard.toml", + ".config/bough.config.json", + ".config/bough.config.toml", + ".config/bough.json", + ".config/bough.toml", + ".bough.config.json", + ".bough.config.toml", + ".bough.json", + ".bough.toml", + "bough.config.json", + "bough.config.toml", + "bough.json", + "bough.toml", ]; pub fn read_config(path: &Path) -> Result { diff --git a/crates/pollard-session/src/lib.rs b/crates/bough-session/src/lib.rs similarity index 93% rename from crates/pollard-session/src/lib.rs rename to crates/bough-session/src/lib.rs index 393f2350..c2036020 100644 --- a/crates/pollard-session/src/lib.rs +++ b/crates/bough-session/src/lib.rs @@ -1,10 +1,10 @@ mod config; pub use config::{ConfigError, SEARCH_PATHS, discover_config, read_config}; -pub use pollard_core::io::{DiffStyle, Render, Style, color, hashed_path}; +pub use bough_core::io::{DiffStyle, Render, Style, color, hashed_path}; -use pollard_core::config::{LanguageId, Ordering, Vcs, VcsKind}; -use pollard_session_derive::Settings; +use bough_core::config::{LanguageId, Ordering, Vcs, VcsKind}; +use bough_session_derive::Settings; use serde::Serialize; use std::path::{Path, PathBuf}; @@ -30,7 +30,7 @@ fn default_run_id() -> String { .expect("time went backwards") .as_nanos(), ); - pollard_core::Hash::of(&seed).to_string() + bough_core::Hash::of(&seed).to_string() } fn absolutize(path: &Path) -> PathBuf { diff --git a/crates/pollard-session/tests/smoke.rs b/crates/bough-session/tests/smoke.rs similarity index 86% rename from crates/pollard-session/tests/smoke.rs rename to crates/bough-session/tests/smoke.rs index 74d7adf7..5e2cf526 100644 --- a/crates/pollard-session/tests/smoke.rs +++ b/crates/bough-session/tests/smoke.rs @@ -1,10 +1,10 @@ -use pollard_session::*; +use bough_session::*; use std::path::PathBuf; #[test] fn merge_cli_overrides_config() { let config = PartialSession { - language: Some(pollard_core::config::LanguageId::Javascript), + language: Some(bough_core::config::LanguageId::Javascript), parallelism: Some(4), ..Default::default() }; @@ -14,7 +14,7 @@ fn merge_cli_overrides_config() { }; let merged = cli.merge(config); assert_eq!(merged.parallelism, Some(8)); - assert_eq!(merged.language, Some(pollard_core::config::LanguageId::Javascript)); + assert_eq!(merged.language, Some(bough_core::config::LanguageId::Javascript)); } #[test] @@ -32,15 +32,15 @@ fn resolve_collects_missing() { #[test] fn resolve_succeeds_with_all_fields() { let partial = PartialSession { - language: Some(pollard_core::config::LanguageId::Javascript), - vcs_kind: Some(pollard_core::config::VcsKind::Jj), + language: Some(bough_core::config::LanguageId::Javascript), + vcs_kind: Some(bough_core::config::VcsKind::Jj), directories: PartialDirectories { working: Some(PathBuf::from("/tmp")), report: Some(PathBuf::from("/tmp/reports")), ..Default::default() }, parallelism: Some(1), - ordering: Some(pollard_core::config::Ordering::Random), + ordering: Some(bough_core::config::Ordering::Random), files: Some("src/**/*.js".to_string()), timeout: PartialTimeout { absolute: Some(30), @@ -85,7 +85,7 @@ relative = 1.5 test = "npm test" "#; let partial: PartialSession = toml::from_str(toml_str).unwrap(); - assert_eq!(partial.language, Some(pollard_core::config::LanguageId::Javascript)); + assert_eq!(partial.language, Some(bough_core::config::LanguageId::Javascript)); assert_eq!(partial.parallelism, Some(2)); assert_eq!(partial.timeout.absolute, Some(30)); assert_eq!(partial.commands.test, Some("npm test".to_string())); diff --git a/examples/vitest/package-lock.json b/examples/vitest/package-lock.json index 9708717a..839b0d91 100644 --- a/examples/vitest/package-lock.json +++ b/examples/vitest/package-lock.json @@ -1,10 +1,10 @@ { - "name": "pollard-example-vitest", + "name": "bough-example-vitest", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "pollard-example-vitest", + "name": "bough-example-vitest", "devDependencies": { "vitest": "^3.0.0" } diff --git a/examples/vitest/package.json b/examples/vitest/package.json index ecd0ede8..edf9d5b5 100644 --- a/examples/vitest/package.json +++ b/examples/vitest/package.json @@ -1,5 +1,5 @@ { - "name": "pollard-example-vitest", + "name": "bough-example-vitest", "private": true, "type": "module", "scripts": { diff --git a/examples/vitest/pollard.toml b/examples/vitest/pollard.toml index 442cb2b2..d3cf6963 100644 --- a/examples/vitest/pollard.toml +++ b/examples/vitest/pollard.toml @@ -5,8 +5,8 @@ ordering = "random" files = "examples/vitest/src/**/*.js" [directories] -working_dir = "/tmp/pollard-work" -report_dir = "/tmp/pollard-report" +working_dir = "/tmp/bough-work" +report_dir = "/tmp/bough-report" sub_dir = "examples/vitest" [timeout] diff --git a/ideal.config.toml b/ideal.config.toml index 85559518..ee839a48 100644 --- a/ideal.config.toml +++ b/ideal.config.toml @@ -3,9 +3,9 @@ parallelism = 1 ordering = "random" [dirs] -working = "/tmp/pollard/work" -reports = "/tmp/pollard/report" -logs = "/tmp/pollard/logs" +working = "/tmp/bough/work" +reports = "/tmp/bough/report" +logs = "/tmp/bough/logs" [vitest] diff --git a/northstart b/northstart index f6e28c70..514df093 100644 --- a/northstart +++ b/northstart @@ -1,4 +1,4 @@ -$ pollard run +$ bough run found _ test ids found _ mutants skipping _ mutants that were caught by tests that still exist @@ -7,7 +7,7 @@ running _ mutants that were previously missed !ctrl-c recieved stop signal... removing workspaces -$ pollard run # continues where the previous run left off, as all data was stored hashed to disk +$ bough run # continues where the previous run left off, as all data was stored hashed to disk found _ test ids found _ mutants skipping _ mutants that were caught by tests that still exist @@ -16,15 +16,15 @@ running _ mutants that were previously missed run all mutants, cleaning up and exiting # Can run through the above step by step, to debug and understand -$ pollard step find-src-files -$ pollard step find-mutants -$ pollard step find-test-ids -$ pollard step make-workspaces -$ pollard step init-workspace -$ pollard step reset-workspace -$ pollard step apply-mutant-to-workspace -$ pollard step test-workspace -$ pollard step cleanup +$ bough step find-src-files +$ bough step find-mutants +$ bough step find-test-ids +$ bough step make-workspaces +$ bough step init-workspace +$ bough step reset-workspace +$ bough step apply-mutant-to-workspace +$ bough step test-workspace +$ bough step cleanup -$ pollard find-mutants best # locates mutants that it would be best to fix next -$ pollard find-mutants highest-impact # Other sorting functions +$ bough find-mutants best # locates mutants that it would be best to fix next +$ bough find-mutants highest-impact # Other sorting functions diff --git a/temp.toml b/temp.toml index fc0b8f7b..025d4a94 100644 --- a/temp.toml +++ b/temp.toml @@ -3,9 +3,9 @@ parallelism = 1 ordering = "random" [dirs] -working = "/tmp/pollard/work" -reports = "/tmp/pollard/report" -logs = "/tmp/pollard/logs" +working = "/tmp/bough/work" +reports = "/tmp/bough/report" +logs = "/tmp/bough/logs" [vitest] [vitest.init]