You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: persist DIL output to a .dil file for codeql_query_compile
After successful compilation with --dump-dil, extract the DIL content
from stdout and save it to a dedicated .dil file in a log directory.
The file path is appended to the tool response.
- Add logDir parameter to codeql_query_compile tool
- Create log directory and write .dil file post-execution
- Add server unit tests for DIL file persistence
- Update integration test assertions to verify DIL file output
Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/7ba868e5-1215-4130-bc06-10dfb15ebf14
Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
if (hasFallback || !isQuotedString || HEX_ESCAPE_REGEXP.test(name)) {
38414
38414
params["filename*"] = name;
@@ -190955,7 +190955,7 @@ function cacheDatabaseAnalyzeResults(params, logger2) {
190955
190955
// src/lib/cli-tool-registry.ts
190956
190956
init_package_paths();
190957
190957
import { existsSync as existsSync6, mkdirSync as mkdirSync8, realpathSync, rmSync, writeFileSync as writeFileSync4 } from "fs";
190958
-
import { delimiter as delimiter5, dirname as dirname5, isAbsolute as isAbsolute4, join as join10, resolve as resolve4 } from "path";
190958
+
import { delimiter as delimiter5, dirname as dirname5, basename as basename5, isAbsolute as isAbsolute4, join as join10, resolve as resolve4 } from "path";
190959
190959
190960
190960
// ../node_modules/js-yaml/dist/js-yaml.mjs
190961
190961
function isNothing(subject) {
@@ -193921,6 +193921,11 @@ function registerCLITool(server, definition) {
193921
193921
mkdirSync8(outputDir, { recursive: true });
193922
193922
}
193923
193923
}
193924
+
let compileLogDir;
193925
+
if (name === "codeql_query_compile" && options["dump-dil"] !== false) {
@@ -196036,7 +196058,7 @@ function registerProfileCodeQLQueryTool(server) {
196036
196058
...outputFiles.map((f) => ` - ${f}`),
196037
196059
"",
196038
196060
"Profile Summary:",
196039
-
` - Query: ${basename7(profile.queryName)}`,
196061
+
` - Query: ${basename8(profile.queryName)}`,
196040
196062
` - Total Duration: ${profile.totalDuration.toFixed(2)} ms`,
196041
196063
` - Total Pipelines: ${profile.pipelines.length}`,
196042
196064
` - Total Events: ${profile.totalEvents}`,
@@ -196073,14 +196095,15 @@ function registerProfileCodeQLQueryTool(server) {
196073
196095
// src/tools/codeql/query-compile.ts
196074
196096
var codeqlQueryCompileTool = {
196075
196097
name: "codeql_query_compile",
196076
-
description: "Compile and validate CodeQL queries",
196098
+
description: "Compile and validate CodeQL queries. By default, produces a .dil file containing the optimized DIL intermediate representation alongside the compilation output.",
196077
196099
command: "codeql",
196078
196100
subcommand: "query compile",
196079
196101
inputSchema: {
196080
196102
query: external_exports.string().describe("Path to the CodeQL query file (.ql)"),
196081
196103
database: external_exports.string().optional().describe("Path to the CodeQL database"),
196082
196104
"dump-dil": external_exports.boolean().optional().describe("Print the optimized DIL intermediate representation to standard output while compiling. Enabled by default; pass false or --no-dump-dil to disable."),
196083
196105
library: external_exports.string().optional().describe("Path to query library"),
196106
+
logDir: external_exports.string().optional().describe("Directory to write the .dil file. If not provided, a unique log directory is created automatically."),
@@ -196737,7 +196760,7 @@ var codeqlResolveTestsTool = {
196737
196760
196738
196761
// src/tools/codeql/search-ql-code.ts
196739
196762
import { closeSync as closeSync2, createReadStream as createReadStream3, fstatSync as fstatSync2, lstatSync, openSync as openSync2, readdirSync as readdirSync8, readFileSync as readFileSync12, realpathSync as realpathSync2 } from "fs";
196740
-
import { basename as basename8, extname as extname2, join as join19, resolve as resolve9 } from "path";
196763
+
import { basename as basename9, extname as extname2, join as join19, resolve as resolve9 } from "path";
196741
196764
import { createInterface as createInterface3 } from "readline";
196742
196765
init_logger();
196743
196766
var MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
@@ -196763,7 +196786,7 @@ function collectFiles(paths, extensions, fileCount) {
196763
196786
}
196764
196787
fileCount.value++;
196765
196788
} else if (stat.isDirectory()) {
196766
-
if (SKIP_DIRS2.has(basename8(p))) return;
196789
+
if (SKIP_DIRS2.has(basename9(p))) return;
196767
196790
let realPath;
196768
196791
try {
196769
196792
realPath = realpathSync2(p);
@@ -198164,7 +198187,7 @@ function registerLanguageResources(server) {
198164
198187
198165
198188
// src/prompts/workflow-prompts.ts
198166
198189
import { access as access2 } from "fs/promises";
198167
-
import { basename as basename9, isAbsolute as isAbsolute7, normalize, relative as relative2, resolve as resolve13, sep as sep3 } from "path";
198190
+
import { basename as basename10, isAbsolute as isAbsolute7, normalize, relative as relative2, resolve as resolve13, sep as sep3 } from "path";
198168
198191
import { fileURLToPath as fileURLToPath3 } from "url";
description: 'Compile and validate CodeQL queries',
10
+
description: 'Compile and validate CodeQL queries. By default, produces a .dil file containing the optimized DIL intermediate representation alongside the compilation output.',
.describe('Print the optimized DIL intermediate representation to standard output while compiling. Enabled by default; pass false or --no-dump-dil to disable.'),
18
18
library: z.string().optional().describe('Path to query library'),
19
+
logDir: z.string().optional()
20
+
.describe('Directory to write the .dil file. If not provided, a unique log directory is created automatically.'),
0 commit comments