Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
- Install .NET 6.0 SDK for development and testing:
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh chmod +x dotnet-install.sh ./dotnet-install.sh --channel 6.0 export PATH="$HOME/.dotnet:$PATH"
- The project requires .NET 6.0 runtime for execution, but can be built with .NET 8.0.
- For production use, download pre-built releases from GitHub releases page (Linux x86_64 only).
- Restore dependencies:
dotnet restore-- takes 20 seconds. NEVER CANCEL. Set timeout to 60+ seconds. - Build the project:
dotnet build -c Release --no-restore-- takes 9 seconds. NEVER CANCEL. Set timeout to 30+ seconds. - Run tests:
dotnet test -c Release --no-build-- takes 3 seconds. Set timeout to 15+ seconds. - Note: Tests require .NET 6.0 runtime. Build will complete with warnings (nullable reference types) but no errors.
- During development:
dotnet run --project src/CodeQLToolkit.Core --configuration Release -- [command] - From published binary:
dotnet publish src/CodeQLToolkit.Core/CodeQLToolkit.Core.csproj -c Release -o publish-outthen use./publish-out/CodeQLToolkit.Core [command] - Self-contained build:
dotnet publish src/CodeQLToolkit.Core/CodeQLToolkit.Core.csproj -c Release -o publish-standalone --self-contained -r linux-x64-- takes 4 seconds. Creates standalone executable.
- Get help:
qlt --helpor add--helpto any command - Get version:
qlt version - Initialize query development:
qlt query init --automation-type actions - Set CodeQL version:
qlt codeql set version --automation-type actions(createsqlt.conf.json) - Initialize testing:
qlt test init --language [c|cpp|csharp|go|java|javascript|python|ruby] --automation-type actions- Creates
.github/workflows/run-codeql-unit-tests-[language].yml - Creates
.github/actions/install-qlt/action.yml - Example:
qlt test init --language cpp --automation-type actions
- Creates
- Build the project:
dotnet build -c Release - Run tests:
dotnet test -c Release - The build produces 151 warnings (nullable reference types) but no errors - this is expected.
After making changes, always test key functionality:
- Basic functionality: Run
qlt versionandqlt --helpto ensure the application starts correctly. - Repository initialization:
- Create a test directory:
mkdir /tmp/qlt-test && cd /tmp/qlt-test - Run:
qlt query init --automation-type actions - Verify
codeql-workspace.ymlis created - Run:
qlt codeql set version --automation-type actions - Verify
qlt.conf.jsonis created with expected structure - Run:
qlt test init --language cpp --automation-type actions - Verify GitHub Actions workflows are created in
.github/workflows/and.github/actions/
- Create a test directory:
- Help system: Test help for main commands:
qlt query --help,qlt test --help,qlt codeql --help - Commands requiring CodeQL: Note that validation commands like
qlt validation run check-queriesrequire CodeQL to be installed and will fail with "CodeQL not installed" if not available. This is expected behavior.
- The project uses GitHub Actions for CI/CD with workflows in
.github/workflows/ - Build artifacts are created as zip files for distribution
- No specific linting tools beyond standard .NET compiler warnings
QLT expects CodeQL repositories to follow this structure:
Repo Root
│ codeql-workspace.yml
│ qlt.conf.json
│
└───[language] (e.g., cpp, java, javascript)
├───[package-name]
│ ├───src
│ │ │ qlpack.yml
│ │ └───[QueryName]
│ │ QueryName.ql
│ └───test
│ │ qlpack.yml
│ └───[QueryName]
│ TestFile.cpp
│ TestFile.expected
│ TestFile.qlref
- Query Management: Create, scaffold, and manage CodeQL queries
- Unit Testing: Run and validate CodeQL unit tests in parallel
- CI/CD Integration: Generate GitHub Actions workflows for automated testing
- Validation: Check query metadata and structure
- Pack Management: Manage CodeQL packs and dependencies
- Bundle Creation: Create custom CodeQL bundles for distribution
- Create new query repository:
qlt query init && qlt codeql set version - Setup CI/CD for C++ queries:
qlt test init --language cpp --automation-type actions - Run unit tests locally:
qlt test run execute-unit-tests --num-threads 4 --language cpp --runner-os "Linux" --work-dir /tmp/test-results - Validate queries:
qlt validation run check-queries --language cpp --pretty-print
- The application is organized into Features with lifecycle and command components
- Source code is in
src/with three main projects: Core, Features, and Shared - Templates for code generation are in the
Templates/directory - The
example/directory contains sample CodeQL repository structures - Build produces warnings about nullable reference types - this is expected and should not be "fixed"
- Use
--baseparameter to specify working directory (defaults to current directory) - Always use
--automation-type actionsfor GitHub Actions integration
src/CodeQLToolkit.Core/- Main executable projectsrc/CodeQLToolkit.Features/- Core functionality and commandssrc/CodeQLToolkit.Shared/- Shared utilities and base classesCodeQLToolkit.sln- Visual Studio solution file.github/workflows/- CI/CD pipeline definitionsscripts/- Build and release automation scriptsexample/- Sample repository structures and configurations