Repository: scala-steward-org/scala-steward (scala)

Issue:
scala-cli updates not getting picked up
I have a scala-cli repo that I noticed isn't getting PRs sent in. I'm running the steward action on it and you can see [here](https://github.com/ckipp01/chris-kipp.io/actions/runs/6244185904/job/16950746242#step:5:345) that it finds no updates for skan. (ignore the failure in the other repos, it's a mill issue). However there are updates for this repo. For example upickle is outdated and when you run it with scala-cli you can see this.

Pull request:
I have made a list of dependency aliases from https://github.com/VirtusLab/scala-cli/blob/9e22d4a91ba8699ac2727d2ac3042d64abe951e1/modules/directives/src/main/scala/scala/build/preprocessing/directives/Dependency.scala#L33-L48

as far as I know these are not exposed programatically, but I guess they could be scraped using a source generator

fixes #3174

Patch:
diff --git a/README.md b/README.md
index d665462f93..4b262914ec 100644
--- a/README.md
+++ b/README.md
@@ -111,6 +111,7 @@ Thanks goes to these wonderful people for contributing to Scala Steward:
 * [Ikenna Darlington Ogbajie](https://github.com/idarlington)
 * [Ingar Abrahamsen](https://github.com/ingarabr)
 * [Jakub Kozłowski](https://github.com/kubukoz)
+* [Jamie Thompson](https://github.com/bishabosha)
 * [Javier Arrieta](https://github.com/javierarrieta)
 * [JCollier](https://github.com/Slakah)
 * [Jeff Martin](https://github.com/custommonkey)
@@ -125,7 +126,7 @@ Thanks goes to these wonderful people for contributing to Scala Steward:
 * [Leonhard Riedißer](https://github.com/L7R7)
 * [Maksym Ochenashko](https://github.com/iRevive)
 * [Manuel Cueto](https://github.com/manuelcueto)
-* [Marco Zühlke](https://github.com/mzuehlke) 
+* [Marco Zühlke](https://github.com/mzuehlke)
 * [Mark Canlas](https://github.com/mcanlas)
 * [Mark van der Tol](https://github.com/markvandertol)
 * [MaT1g3R](https://github.com/MaT1g3R)
diff --git a/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala b/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala
index ca572170f5..6e2e52b51f 100644
--- a/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala
+++ b/modules/core/src/main/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlg.scala
@@ -28,6 +28,27 @@ import org.scalasteward.core.io.{FileAlg, ProcessAlg, WorkspaceAlg}
 import org.scalasteward.core.util.Nel
 import org.typelevel.log4cats.Logger
 
+object ScalaCliAlg {
+  val directives =
+    // sourced from https://github.com/VirtusLab/scala-cli/blob/9e22d4a91ba8699ac2727d2ac3042d64abe951e1/modules/directives/src/main/scala/scala/build/preprocessing/directives/Dependency.scala#L33-L48
+    List(
+      "lib",
+      "libs",
+      "dep",
+      "deps",
+      "dependencies",
+      "test.dependency",
+      "test.dep",
+      "test.deps",
+      "test.dependencies",
+      "compileOnly.lib",
+      "compileOnly.libs",
+      "compileOnly.dep",
+      "compileOnly.deps",
+      "compileOnly.dependencies"
+    ).map(alias => s"//> using $alias ")
+}
+
 final class ScalaCliAlg[F[_]](implicit
     fileAlg: FileAlg[F],
     gitAlg: GitAlg[F],
@@ -42,8 +63,8 @@ final class ScalaCliAlg[F[_]](implicit
   override def containsBuild(buildRoot: BuildRoot): F[Boolean] = {
     val buildRootPath = buildRoot.relativePath.dropWhile(Set('.', '/'))
     val extensions = Set(".sc", ".scala")
-    gitAlg
-      .findFilesContaining(buildRoot.repo, "//> using lib ")
+    ScalaCliAlg.directives
+      .flatTraverse(gitAlg.findFilesContaining(buildRoot.repo, _))
       .map(_.exists(path => path.startsWith(buildRootPath) && extensions.exists(path.endsWith)))
   }
 


Test patch:
diff --git a/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala b/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala
index 897d852dc2..2a691ecc81 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/buildtool/BuildToolDispatcherTest.scala
@@ -10,6 +10,7 @@ import org.scalasteward.core.mock.MockState.TraceEntry.{Cmd, Log}
 import org.scalasteward.core.repoconfig.{BuildRootConfig, RepoConfig}
 import org.scalasteward.core.scalafmt
 import org.scalasteward.core.scalafmt.scalafmtConfName
+import org.scalasteward.core.buildtool.scalacli.ScalaCliAlg
 
 class BuildToolDispatcherTest extends FunSuite {
   test("getDependencies") {
@@ -28,37 +29,33 @@ class BuildToolDispatcherTest extends FunSuite {
     val (state, deps) =
       buildToolDispatcher.getDependencies(repo, repoConfig).runSA(initial).unsafeRunSync()
 
+    val allGreps = ScalaCliAlg.directives.map { search =>
+      Cmd.git(
+        repoDir,
+        "grep",
+        "-I",
+        "--fixed-strings",
+        "--files-with-matches",
+        search
+      )
+    }
+
     val expectedState = initial.copy(trace =
-      Vector(
-        Cmd("test", "-f", s"$repoDir/pom.xml"),
-        Cmd("test", "-f", s"$repoDir/build.sc"),
-        Cmd("test", "-f", s"$repoDir/build.sbt"),
-        Cmd.git(
-          repoDir,
-          "grep",
-          "-I",
-          "--fixed-strings",
-          "--files-with-matches",
-          "//> using lib "
-        ),
-        Cmd("test", "-f", s"$repoDir/mvn-build/pom.xml"),
-        Cmd("test", "-f", s"$repoDir/mvn-build/build.sc"),
-        Cmd("test", "-f", s"$repoDir/mvn-build/build.sbt"),
-        Cmd.git(
-          repoDir,
-          "grep",
-          "-I",
-          "--fixed-strings",
-          "--files-with-matches",
-          "//> using lib "
-        ),
-        Log("Get dependencies in . from sbt"),
-        Cmd("read", s"$repoDir/project/build.properties"),
-        Cmd("test", "-d", s"$repoDir/project"),
-        Cmd("test", "-d", s"$repoDir/project/project"),
-        Cmd("read", "classpath:StewardPlugin_1_0_0.scala"),
-        Cmd("write", s"$repoDir/project/scala-steward-StewardPlugin_1_0_0.scala"),
-        Cmd("write", s"$repoDir/project/project/scala-steward-StewardPlugin_1_0_0.scala"),
+      Cmd("test", "-f", s"$repoDir/pom.xml") +:
+        Cmd("test", "-f", s"$repoDir/build.sc") +:
+        Cmd("test", "-f", s"$repoDir/build.sbt") +:
+        allGreps ++:
+        Cmd("test", "-f", s"$repoDir/mvn-build/pom.xml") +:
+        Cmd("test", "-f", s"$repoDir/mvn-build/build.sc") +:
+        Cmd("test", "-f", s"$repoDir/mvn-build/build.sbt") +:
+        allGreps ++:
+        Log("Get dependencies in . from sbt") +:
+        Cmd("read", s"$repoDir/project/build.properties") +:
+        Cmd("test", "-d", s"$repoDir/project") +:
+        Cmd("test", "-d", s"$repoDir/project/project") +:
+        Cmd("read", "classpath:StewardPlugin_1_0_0.scala") +:
+        Cmd("write", s"$repoDir/project/scala-steward-StewardPlugin_1_0_0.scala") +:
+        Cmd("write", s"$repoDir/project/project/scala-steward-StewardPlugin_1_0_0.scala") +:
         Cmd.execSandboxed(
           repoDir,
           "sbt",
@@ -67,26 +64,26 @@ class BuildToolDispatcherTest extends FunSuite {
           "-Dsbt.supershell=false",
           "-Dsbt.server.forcestart=true",
           s";$crossStewardDependencies;$reloadPlugins;$stewardDependencies"
-        ),
-        Cmd("rm", "-rf", s"$repoDir/project/project/scala-steward-StewardPlugin_1_0_0.scala"),
-        Cmd("rm", "-rf", s"$repoDir/project/scala-steward-StewardPlugin_1_0_0.scala"),
-        Cmd("read", s"$repoDir/$scalafmtConfName"),
-        Log("Get dependencies in mvn-build from Maven"),
+        ) +:
+        Cmd("rm", "-rf", s"$repoDir/project/project/scala-steward-StewardPlugin_1_0_0.scala") +:
+        Cmd("rm", "-rf", s"$repoDir/project/scala-steward-StewardPlugin_1_0_0.scala") +:
+        Cmd("read", s"$repoDir/$scalafmtConfName") +:
+        Log("Get dependencies in mvn-build from Maven") +:
         Cmd.execSandboxed(
           repoDir / "mvn-build",
           "mvn",
           maven.args.batchMode,
           maven.command.listDependencies,
           maven.args.excludeTransitive
-        ),
+        ) +:
         Cmd.execSandboxed(
           repoDir / "mvn-build",
           "mvn",
           maven.args.batchMode,
           maven.command.listRepositories
-        ),
-        Cmd("read", s"$repoDir/mvn-build/$scalafmtConfName")
-      )
+        ) +:
+        Cmd("read", s"$repoDir/mvn-build/$scalafmtConfName") +:
+        Vector.empty[MockState.TraceEntry]
     )
 
     assertEquals(state, expectedState)
diff --git a/modules/core/src/test/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlgTest.scala b/modules/core/src/test/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlgTest.scala
index 4841481f71..e70768ca99 100644
--- a/modules/core/src/test/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlgTest.scala
+++ b/modules/core/src/test/scala/org/scalasteward/core/buildtool/scalacli/ScalaCliAlgTest.scala
@@ -10,6 +10,8 @@ import org.scalasteward.core.mock.MockState
 import org.scalasteward.core.mock.MockState.TraceEntry.{Cmd, Log}
 import org.scalasteward.core.util.Nel
 
+import cats.syntax.parallel._
+
 class ScalaCliAlgTest extends CatsEffectSuite {
   test("containsBuild: directive in non-source file") {
     val repo = Repo("user", "repo")
@@ -24,6 +26,25 @@ class ScalaCliAlgTest extends CatsEffectSuite {
     assertIO(obtained, false)
   }
 
+  test("containsBuild: directive with test.dep, dep, and lib") {
+    val repo = Repo("user", "repo")
+    val buildRoot = BuildRoot(repo, ".")
+    val repoDir = workspaceAlg.repoDir(repo).unsafeRunSync()
+    val fileWithUsingDirective = "project.scala"
+
+    ScalaCliAlg.directives
+      .map { search =>
+        val grepCmd =
+          Cmd.git(repoDir, "grep", "-I", "--fixed-strings", "--files-with-matches", search)
+        val initial =
+          MockState.empty.copy(commandOutputs = Map(grepCmd -> Right(List(fileWithUsingDirective))))
+        val obtained = scalaCliAlg.containsBuild(buildRoot).runA(initial)
+        assertIO(obtained, true)
+      }
+      .parSequence
+      .void
+  }
+
   test("getDependencies") {
     val repo = Repo("user", "repo")
     val buildRoot = BuildRoot(repo, ".")