@@ -198,6 +198,10 @@ export interface CodeQL {
198198 ) : Promise < void > ;
199199 /** Get the location of an extractor for the specified language. */
200200 resolveExtractor ( language : Language ) : Promise < string > ;
201+ /**
202+ * Run 'codeql resolve queries --format=startingpacks'.
203+ */
204+ resolveQueriesStartingPacks ( queries : string [ ] ) : Promise < string [ ] > ;
201205 /**
202206 * Run 'codeql github merge-results'.
203207 */
@@ -479,6 +483,10 @@ export function createStubCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
479483 ) ,
480484 diagnosticsExport : resolveFunction ( partialCodeql , "diagnosticsExport" ) ,
481485 resolveExtractor : resolveFunction ( partialCodeql , "resolveExtractor" ) ,
486+ resolveQueriesStartingPacks : resolveFunction (
487+ partialCodeql ,
488+ "resolveQueriesStartingPacks" ,
489+ ) ,
482490 mergeResults : resolveFunction ( partialCodeql , "mergeResults" ) ,
483491 } ;
484492}
@@ -974,6 +982,24 @@ export async function getCodeQLForCmd(
974982 ) . exec ( ) ;
975983 return JSON . parse ( extractorPath ) as string ;
976984 } ,
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+ } ,
9771003 async mergeResults (
9781004 sarifFiles : string [ ] ,
9791005 outputFile : string ,
0 commit comments