import com.github.sormuras.bach.Bach;
import com.github.sormuras.bach.ToolCall;
import com.github.sormuras.bach.ToolFinder;

class format {
  public static void main(String... args) throws Exception {
    var bach = Bach.ofDefaults().with(ToolFinder.ofJavaTools(".bach/external-tools"));
    if (bach.configuration().finder().find("format@1.15.0").isEmpty()) {
      bach.run(
          """
          load-and-verify
            .bach/external-tools/format@1.15.0/google-java-format-1.15.0-all-deps.jar
            https://github.com/google/google-java-format/releases/download/v1.15.0/google-java-format-1.15.0-all-deps.jar\
          #SIZE=3519780\
          &SHA-256=a356bb0236b29c57a3ab678f17a7b027aad603b0960c183a18f1fe322e4f38ea
          """);
    }
    var format = ToolCall.of("format@1.15.0").with("--replace").withFindFiles("**/*.java");
    bach.run("banner", "Format %d .java files".formatted(format.arguments().size() - 1));
    bach.run(format);
  }
}

@@ -76,52 +76,8 @@
 all;
-%0Aimport com.github.sormuras.bach.ToolFinder;
 %0A%0Acl
@@ -186,61 +186,8 @@
 ts()
-.with(ToolFinder.ofJavaTools(%22.bach/external-tools%22))
 ;%0A  

Use default Bach factory with its external tool finder