From c280892d7499e5d0a6f7d69414eef4d99760c3ee Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Mar 2026 04:04:34 +0000 Subject: [PATCH 1/2] fix(ci): tolerate already-published bashkit in Publish workflow Allow re-triggering the Publish workflow when bashkit is already on crates.io but bashkit-cli still needs publishing. https://claude.ai/code/session_01Jbg7Tuui72STWrJTfCLgWK --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 492d5ef..9ca0a43 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -52,7 +52,7 @@ jobs: cat "$TOML" - name: Publish bashkit to crates.io - run: cargo publish -p bashkit --allow-dirty + run: cargo publish -p bashkit --allow-dirty 2>&1 || echo "::warning::bashkit publish failed (may already exist)" env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} From e94b6343bebd3261c31558ce1525008132747fab Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 4 Mar 2026 04:18:07 +0000 Subject: [PATCH 2/2] fix(ci): gate python behind feature flag in bashkit-cli for crates.io publish Move python from a hardcoded dependency feature to a bashkit-cli feature flag (default = on). Code gated with #[cfg(feature = "python")] so bashkit-cli compiles when bashkit's python feature is unavailable (monty is git-only, stripped during crates.io publish). https://claude.ai/code/session_01Jbg7Tuui72STWrJTfCLgWK --- .github/workflows/publish.yml | 6 ++++-- crates/bashkit-cli/Cargo.toml | 6 +++++- crates/bashkit-cli/src/main.rs | 6 +++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9ca0a43..d89166b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -70,11 +70,13 @@ jobs: - name: Wait for crates.io index update run: sleep 30 - - name: Strip python feature from bashkit-cli dependency + - name: Strip python feature from bashkit-cli # python feature is stripped from bashkit during publish (monty is git-only) run: | TOML=crates/bashkit-cli/Cargo.toml - sed -i 's/features = \["http_client", "git", "python"\]/features = ["http_client", "git"]/' "$TOML" + # Remove python feature and default that references it + sed -i '/^python = \["bashkit\/python"\]/d' "$TOML" + sed -i 's/default = \["python"\]/default = []/' "$TOML" echo "--- bashkit-cli Cargo.toml after stripping ---" cat "$TOML" diff --git a/crates/bashkit-cli/Cargo.toml b/crates/bashkit-cli/Cargo.toml index 01fdb05..cf53de7 100644 --- a/crates/bashkit-cli/Cargo.toml +++ b/crates/bashkit-cli/Cargo.toml @@ -18,8 +18,12 @@ name = "bashkit" path = "src/main.rs" doc = false # Disable to avoid collision with bashkit library docs +[features] +default = ["python"] +python = ["bashkit/python"] + [dependencies] -bashkit = { path = "../bashkit", version = "0.1.9", features = ["http_client", "git", "python"] } +bashkit = { path = "../bashkit", version = "0.1.9", features = ["http_client", "git"] } tokio.workspace = true clap.workspace = true anyhow.workspace = true diff --git a/crates/bashkit-cli/src/main.rs b/crates/bashkit-cli/src/main.rs index 644fa50..a4bf348 100644 --- a/crates/bashkit-cli/src/main.rs +++ b/crates/bashkit-cli/src/main.rs @@ -41,7 +41,8 @@ struct Args { no_git: bool, /// Disable python builtin (monty backend) - #[arg(long)] + #[cfg_attr(not(feature = "python"), arg(long, hide = true))] + #[cfg_attr(feature = "python", arg(long))] no_python: bool, #[command(subcommand)] @@ -65,6 +66,7 @@ fn build_bash(args: &Args) -> bashkit::Bash { builder = builder.git(bashkit::GitConfig::new()); } + #[cfg(feature = "python")] if !args.no_python { builder = builder.python(); } @@ -143,6 +145,7 @@ mod tests { assert!(!args.no_python); } + #[cfg(feature = "python")] #[tokio::test] async fn python_enabled_by_default() { let args = Args::parse_from(["bashkit", "-c", "python --version"]); @@ -151,6 +154,7 @@ mod tests { assert_ne!(result.stderr, "python: command not found\n"); } + #[cfg(feature = "python")] #[tokio::test] async fn python_can_be_disabled() { let args = Args::parse_from(["bashkit", "--no-python", "-c", "python --version"]);