Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/instructions/ql_dev_prompts.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For additional guidance on repository development workflows, refer to the langua

ALWAYS do the following when creating or editing any `languages/<language>/tools/dev/*.prompt.md` file:

- ALWAYS add YAML frontmatter with `mode: agent` at the top of the file, with `---` lines before and after the frontmatter
- ALWAYS add YAML frontmatter with a `description` field at the top of the file, with `---` lines before and after the frontmatter
- ALWAYS use valid markdown syntax, with the exception of the YAML frontmatter at the top of the `.prompt.md` file
- ALWAYS demonstrate CodeQL syntax usage with code blocks that start with three backticks followed by `ql` (i.e. "```ql")
- ALWAYS leave an empty line before and after each code block, as well as at the end of the file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For additional guidance on repository development workflows, refer to:

ALWAYS do the following when creating or editing any `resources/cli/**/*.prompt.md` file

- ALWAYS add YAML frontmatter with `mode: agent` at the top of the file, with `---` lines before and after the frontmatter
- ALWAYS add YAML frontmatter with a `description` field at the top of the file, with `---` lines before and after the frontmatter
- ALWAYS use valid markdown syntax, with the exception of the YAML frontmatter at the top of the `.prompt.md` file
- ALWAYS demonstrate the `bash` usage of the 'Primary use of <command>' section with a code block that starts with three backticks followed by `bash` (i.e. "```bash")
- ALWAYS leave an empty line before and after each code block, as well as at the end of the file
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/actions_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting GitHub Actions workflows
---

# Actions Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/cli_resources.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Summary and links to CLI tool resource prompts used in CodeQL development
---

# CLI Resources Reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Review CodeQL log output for performance issues and optimization opportunities
---

You are reviewing CodeQL log output for performance issues.
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/cpp_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting C++ code
---

# C++ Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/csharp_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting C# code
---

# C# Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/git_hooks.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Suggested git hooks for commit and push guidelines in this repository
---

# Suggested git hooks for this repository
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/go_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting Go code
---

# Go Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/java_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting Java code
---

# Java Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/javascript_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting JavaScript and TypeScript code
---

# JavaScript Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/python_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting Python code
---

# Python Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/ql_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting QL code
---

# QL Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Common guidance for developing CodeQL queries across all supported languages
---

# CodeQL Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/ruby_query_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guidance for developing CodeQL queries targeting Ruby code
---

# Ruby Query Development
Expand Down
3 changes: 2 additions & 1 deletion .github/prompts/test_driven_ql_development.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Test-driven development workflow for writing and testing CodeQL queries
---

# Test-Driven Development (TDD) of `ql` Code
Expand Down
3 changes: 2 additions & 1 deletion languages/actions/tools/dev/actions_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for GitHub Actions
---

## CodeQL's core AST classes for `actions` language
Expand Down
3 changes: 2 additions & 1 deletion languages/cpp/tools/dev/cpp_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for the C++ language
---

# CodeQL AST nodes for `cpp` language
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide for implementing C++ security queries in CodeQL with data flow analysis
---

# CodeQL C++ Security Query Implementation Guide
Expand Down
3 changes: 2 additions & 1 deletion languages/csharp/tools/dev/csharp_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for the C# language
---

# CodeQL AST nodes for `csharp` language
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide for implementing C# security queries in CodeQL
---

# CodeQL C# Security Query Implementation Guide
Expand Down
3 changes: 2 additions & 1 deletion languages/go/tools/dev/go_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST class reference for Go programs
---

# CodeQL AST Classes for Go Programs
Expand Down
3 changes: 2 additions & 1 deletion languages/go/tools/dev/go_basic_queries.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Basic CodeQL query examples and patterns for Go programs
---

# Basic CodeQL Query Examples for Go
Expand Down
3 changes: 2 additions & 1 deletion languages/go/tools/dev/go_dataflow.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide to data flow and taint tracking analysis for Go in CodeQL
---

# Analyzing Data Flow in Go
Expand Down
3 changes: 2 additions & 1 deletion languages/go/tools/dev/go_library_modeling.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide to customizing library models for Go using data extensions and model packs
---

# Customizing Library Models for Go
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide for customizing the PrintAST query for Go
---

# Go PrintAST Customization
Expand Down
3 changes: 2 additions & 1 deletion languages/go/tools/dev/go_security_query_guide.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide for developing security-focused CodeQL queries for Go
---

# Go Security Query Development Guide
Expand Down
3 changes: 2 additions & 1 deletion languages/java/tools/dev/java_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for the Java language
---

# CodeQL AST nodes for `java` language
Expand Down
3 changes: 2 additions & 1 deletion languages/javascript/tools/dev/javascript_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for JavaScript and TypeScript
---

# CodeQL AST nodes for `javascript` language
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide for implementing JavaScript security queries in CodeQL
---

# CodeQL JavaScript Security Query Implementation Guide
Expand Down
3 changes: 2 additions & 1 deletion languages/python/tools/dev/python_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for the Python language
---

# CodeQL AST nodes for `python` language
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Guide for implementing Python framework models and security queries in CodeQL
---

# CodeQL Python Framework and Query Implementation Guide
Expand Down
3 changes: 2 additions & 1 deletion languages/ql/tools/dev/ql_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for the QL language
---

# CodeQL AST nodes for `ql` language
Expand Down
3 changes: 2 additions & 1 deletion languages/ruby/tools/dev/ruby_ast.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
CodeQL AST node reference for the Ruby language
---

# CodeQL AST nodes for `ruby` language
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_bqrs_decode.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: 'agent'
description: >-
Reference for the codeql bqrs decode command
---

# Command Resource for `codeql bqrs decode`
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_bqrs_info.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: 'agent'
description: >-
Reference for the codeql bqrs info command
---

# Command Resource for `codeql bqrs info`
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_database_analyze.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: 'agent'
description: >-
Reference for the codeql database analyze command
---

# Command Resource for `codeql database analyze`
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_database_create.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: 'agent'
description: >-
Reference for the codeql database create command
---

# Command Resource for `codeql database create`
Expand Down
11 changes: 8 additions & 3 deletions resources/cli/codeql/codeql_execute_query-server2.prompt.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
````prompt
---
mode: agent
description: >-
Reference for the codeql execute query-server2 command
---

# Command Resource for `codeql execute query-server2`
Expand Down Expand Up @@ -47,6 +47,7 @@ Template variables are passed through the query-server2 JSON protocol, not via C
```

Example contextual query pattern:

```ql
/**
* @name Find References
Expand Down Expand Up @@ -95,18 +96,21 @@ codeql execute query-server2 --save-cache --max-disk-cache=4096
## Advanced configuration options

### Memory and threading

- `--threads=<num>`: Number of evaluation threads (0 = one per core)
- `--timeout=<seconds>`: Query evaluation timeout
- `--heap-ram=<MB>`: Java heap memory allocation
- `--off-heap-ram=<MB>`: Additional off-heap memory

### Caching and performance

- `--save-cache`: Aggressively cache intermediate results
- `--max-disk-cache=<MB>`: Maximum disk cache size
- `--keep-full-cache`: Don't clean up cache after evaluation
- `--tuple-counting`: Display tuple counts for performance analysis

### Debug and logging

- `--debug`: Include additional debugging information
- `--evaluator-log=<file>`: Output structured performance logs
- `--evaluator-log-minify`: Minimize JSON log size
Expand All @@ -124,12 +128,14 @@ The query-server2 uses a JSON-based protocol over stdin/stdout for communication
## When to use query-server2 vs query run

**Use `codeql execute query-server2` when:**

- Building IDE integrations or tools that execute many queries
- Need efficient handling of contextual queries with templates
- Require quick evaluation of query fragments via JSON protocol
- Want to minimize query execution latency in IDE environments

**Use `codeql query run` when:**

- Running single queries from command line
- Following TDD methodology for query development
- Scripting or automation scenarios
Expand Down Expand Up @@ -157,4 +163,3 @@ Run `codeql execute query-server2 --help --verbose` for much more information.

- [`codeql query run`](./codeql_query_run.prompt.md) - Execute single CodeQL queries (alternative for simple use cases)
- [`codeql query compile`](./codeql_query_compile.prompt.md) - Compile queries before execution
````
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Reference for the codeql generate log-summary command
---

# Command Resource for `codeql generate log-summary`
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_generate_query-help.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: 'agent'
description: >-
Reference for the codeql generate query-help command
---

# Command Resource for `codeql generate query-help`
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_pack_install.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: 'agent'
description: >-
Reference for the codeql pack install command
---

# Command Resource for `codeql pack install`
Expand Down
3 changes: 2 additions & 1 deletion resources/cli/codeql/codeql_pack_ls.prompt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
mode: agent
description: >-
Reference for the codeql pack ls command
---

# Command Resource for `codeql pack ls`
Expand Down
Loading
Loading