@@ -1284,11 +1284,25 @@ export class CodeQLCliServer implements Disposable {
12841284 ) ;
12851285 }
12861286
1287- async packInstall ( dir : string , forceUpdate = false ) {
1287+ async packInstall (
1288+ dir : string ,
1289+ { forceUpdate = false , workspaceFolders = [ ] as string [ ] } = { } ,
1290+ ) {
12881291 const args = [ dir ] ;
12891292 if ( forceUpdate ) {
12901293 args . push ( "--mode" , "update" ) ;
12911294 }
1295+ if ( workspaceFolders ?. length > 0 ) {
1296+ if ( await this . cliConstraints . supportsAdditionalPacksInstall ( ) ) {
1297+ args . push (
1298+ // Allow prerelease packs from the ql submodule.
1299+ "--allow-prerelease" ,
1300+ // Allow the use of --additional-packs argument without issueing a warning
1301+ "--no-strict-mode" ,
1302+ ...this . getAdditionalPacksArg ( workspaceFolders ) ,
1303+ ) ;
1304+ }
1305+ }
12921306 return this . runJsonCodeQlCliCommandWithAuthentication (
12931307 [ "pack" , "install" ] ,
12941308 args ,
@@ -1692,6 +1706,13 @@ export class CliVersionConstraint {
16921706 */
16931707 public static CLI_VERSION_WITH_QLPACKS_KIND = new SemVer ( "2.12.3" ) ;
16941708
1709+ /**
1710+ * CLI version that supports the `--additional-packs` option for the `pack install` command.
1711+ */
1712+ public static CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL = new SemVer (
1713+ "2.12.4" ,
1714+ ) ;
1715+
16951716 constructor ( private readonly cli : CodeQLCliServer ) {
16961717 /**/
16971718 }
@@ -1755,4 +1776,10 @@ export class CliVersionConstraint {
17551776 CliVersionConstraint . CLI_VERSION_WITH_QLPACKS_KIND ,
17561777 ) ;
17571778 }
1779+
1780+ async supportsAdditionalPacksInstall ( ) {
1781+ return this . isVersionAtLeast (
1782+ CliVersionConstraint . CLI_VERSION_WITH_ADDITIONAL_PACKS_INSTALL ,
1783+ ) ;
1784+ }
17581785}
0 commit comments