@@ -198,6 +198,10 @@ export interface CodeQL {
198
198
) : Promise < void > ;
199
199
/** Get the location of an extractor for the specified language. */
200
200
resolveExtractor ( language : Language ) : Promise < string > ;
201
+ /**
202
+ * Run 'codeql resolve queries --format=startingpacks'.
203
+ */
204
+ resolveQueriesStartingPacks ( queries : string [ ] ) : Promise < string [ ] > ;
201
205
/**
202
206
* Run 'codeql github merge-results'.
203
207
*/
@@ -479,6 +483,10 @@ export function createStubCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
479
483
) ,
480
484
diagnosticsExport : resolveFunction ( partialCodeql , "diagnosticsExport" ) ,
481
485
resolveExtractor : resolveFunction ( partialCodeql , "resolveExtractor" ) ,
486
+ resolveQueriesStartingPacks : resolveFunction (
487
+ partialCodeql ,
488
+ "resolveQueriesStartingPacks" ,
489
+ ) ,
482
490
mergeResults : resolveFunction ( partialCodeql , "mergeResults" ) ,
483
491
} ;
484
492
}
@@ -974,6 +982,24 @@ export async function getCodeQLForCmd(
974
982
) . exec ( ) ;
975
983
return JSON . parse ( extractorPath ) as string ;
976
984
} ,
985
+ async resolveQueriesStartingPacks ( queries : string [ ] ) : Promise < string [ ] > {
986
+ const codeqlArgs = [
987
+ "resolve" ,
988
+ "queries" ,
989
+ "--format=startingpacks" ,
990
+ ...getExtraOptionsFromEnv ( [ "resolve" , "queries" ] ) ,
991
+ ...queries ,
992
+ ] ;
993
+ const output = await runCli ( cmd , codeqlArgs , { noStreamStdout : true } ) ;
994
+
995
+ try {
996
+ return JSON . parse ( output ) as string [ ] ;
997
+ } catch ( e ) {
998
+ throw new Error (
999
+ `Unexpected output from codeql resolve queries --format=startingpacks: ${ e } ` ,
1000
+ ) ;
1001
+ }
1002
+ } ,
977
1003
async mergeResults (
978
1004
sarifFiles : string [ ] ,
979
1005
outputFile : string ,
0 commit comments