@@ -190,6 +190,10 @@ export interface CodeQL {
190190 ) : Promise < void > ;
191191 /** Get the location of an extractor for the specified language. */
192192 resolveExtractor ( language : Language ) : Promise < string > ;
193+ /**
194+ * Run 'codeql resolve queries --format=startingpacks'.
195+ */
196+ resolveQueriesStartingPacks ( queries : string [ ] ) : Promise < string [ ] > ;
193197 /**
194198 * Run 'codeql github merge-results'.
195199 */
@@ -448,6 +452,10 @@ export function setCodeQL(partialCodeql: Partial<CodeQL>): CodeQL {
448452 ) ,
449453 diagnosticsExport : resolveFunction ( partialCodeql , "diagnosticsExport" ) ,
450454 resolveExtractor : resolveFunction ( partialCodeql , "resolveExtractor" ) ,
455+ resolveQueriesStartingPacks : resolveFunction (
456+ partialCodeql ,
457+ "resolveQueriesStartingPacks" ,
458+ ) ,
451459 mergeResults : resolveFunction ( partialCodeql , "mergeResults" ) ,
452460 } ;
453461 return cachedCodeQL ;
@@ -944,6 +952,24 @@ export async function getCodeQLForCmd(
944952 ) . exec ( ) ;
945953 return JSON . parse ( extractorPath ) as string ;
946954 } ,
955+ async resolveQueriesStartingPacks ( queries : string [ ] ) : Promise < string [ ] > {
956+ const codeqlArgs = [
957+ "resolve" ,
958+ "queries" ,
959+ "--format=startingpacks" ,
960+ ...getExtraOptionsFromEnv ( [ "resolve" , "queries" ] ) ,
961+ ...queries ,
962+ ] ;
963+ const output = await runCli ( cmd , codeqlArgs , { noStreamStdout : true } ) ;
964+
965+ try {
966+ return JSON . parse ( output ) as string [ ] ;
967+ } catch ( e ) {
968+ throw new Error (
969+ `Unexpected output from codeql resolve queries --format=startingpacks: ${ e } ` ,
970+ ) ;
971+ }
972+ } ,
947973 async mergeResults (
948974 sarifFiles : string [ ] ,
949975 outputFile : string ,
0 commit comments