When a project declares multiple platforms or Scala versions via //> using platform jvm native or //> using scala 3.6.4 3.5.0, there's no way to discover the full declared matrix without parsing source directives manually.
Use case: Tools that wrap scala-cli (e.g. for reproducible Nix builds) need to know all declared platforms and Scala versions upfront to run export --json --platform <p> --scala-version <v> for each target. Currently the only workaround is to parse //> using platform[s] and //> using scala directives from source files — fragile and duplicating logic that scala-cli already handles internally.
Proposed change: A new subcommand or flag that outputs the full matrix of declared targets as JSON:
$ scala-cli list-targets .
[
{ "platform": "jvm", "scalaVersion": "3.6.4" },
{ "platform": "native", "scalaVersion": "3.6.4" }
]
This would let external tools enumerate targets and call export --json --platform <p> --scala-version <v> for each, without needing to parse directives themselves.
When a project declares multiple platforms or Scala versions via
//> using platform jvm nativeor//> using scala 3.6.4 3.5.0, there's no way to discover the full declared matrix without parsing source directives manually.Use case: Tools that wrap scala-cli (e.g. for reproducible Nix builds) need to know all declared platforms and Scala versions upfront to run
export --json --platform <p> --scala-version <v>for each target. Currently the only workaround is to parse//> using platform[s]and//> using scaladirectives from source files — fragile and duplicating logic that scala-cli already handles internally.Proposed change: A new subcommand or flag that outputs the full matrix of declared targets as JSON:
This would let external tools enumerate targets and call
export --json --platform <p> --scala-version <v>for each, without needing to parse directives themselves.