Table of Contents

Usage Guide

General Syntax

dtk [OPTIONS] <COMMAND>

Global Options

Option Description
-h, --help Print help information
-v, --version Print version information

Commands

dtk dotnet build

Run dotnet build with filtered output. All positional arguments and flags are forwarded:

dtk dotnet build
dtk dotnet build --configuration Release
dtk dotnet build src/MyProject/MyProject.csproj
dtk dotnet build --no-restore
dtk dotnet build -q                  # quiet: filtered content only, no DTK meta-output

On success, output is reduced to a single summary line. On failure, errors are grouped by file with workspace-relative paths and top error codes.

dtk dotnet test

Run dotnet test with filtered output:

dtk dotnet test
dtk dotnet test --filter "Category=Unit"
dtk dotnet test --configuration Release
dtk dotnet test src/MyProject.Tests/MyProject.Tests.csproj
dtk dotnet test -q                   # quiet mode

Passing tests are summarized with counts. Failing tests show the test name, duration, error message, and a clean stack trace with relative paths. xUnit/NUnit/MSTest adapter banners, license warnings, and framework internals are stripped.

dtk dotnet restore

Run dotnet restore with filtered output:

dtk dotnet restore
dtk dotnet restore src/MyProject/MyProject.csproj
dtk dotnet restore -q

Restore errors include the error code, message, and workspace-relative project path.

dtk dotnet clean

Run dotnet clean with filtered output:

dtk dotnet clean
dtk dotnet clean --configuration Release
dtk dotnet clean -q

dtk dotnet format

Run dotnet format with filtered output:

dtk dotnet format
dtk dotnet format MyApp.slnx
dtk dotnet format --verify-no-changes
dtk dotnet format -q

When nothing needs formatting, the raw command produces no output at all. dtk synthesises a ✓ dotnet format (nothing to format) confirmation so AI agents receive an explicit positive signal. When --verify-no-changes finds violations, the file paths and violation types are shown with workspace-relative paths.

dtk integrate

Install dtk integration artifacts for an AI assistant provider:

dtk integrate claude      # Claude Code skill + PreToolUse hook
dtk integrate copilot     # GitHub Copilot instructions section
dtk integrate gemini      # Gemini CLI hook + settings merge
dtk integrate cursor      # Cursor rules file
dtk integrate windsurf    # Windsurf rules file
dtk integrate aider       # Aider instructions + .aider.conf.yml section
dtk integrate jetbrains   # JetBrains AI guidelines section

All commands accept --force to overwrite existing files and --dir <path> to target a specific directory.

See AI Agent Setup for details on what each provider installs.

dtk gain

Display token savings analytics. See Token Analytics for details.

dtk gain                       # last 30 days
dtk gain --days 7              # last 7 days
dtk gain --project             # current project only
dtk gain --command build       # filter to a specific command
dtk gain --json                # machine-readable JSON output
dtk gain --export csv          # export raw records as CSV

dtk reset

Clear tracking data (and optionally all dtk state):

dtk reset              # prompts for confirmation
dtk reset --force      # skips confirmation
dtk reset --all        # also removes tee logs and config file
dtk reset --all --force  # full cleanup without confirmation

dtk config

View or modify configuration without editing the JSON file directly:

dtk config show                          # display all keys and current values
dtk config set <key> <value>             # update a single value and save

Examples:

dtk config set tracking.enabled false
dtk config set tracking.retentionDays 30
dtk config set display.width 100
dtk config set tee.mode Always
dtk config set tracking.tokenizer O200kBase

Returns exit code 1 with an error message if the key is unknown or the value is invalid. See Configuration for the full list of supported keys and valid values.

dtk doctor

Run self-diagnostic checks:

dtk doctor

Reports pass/fail for four checks: dotnet SDK availability, config file load, tracking database path access, and tee directory writability. Exits 0 if all pass, 1 if any fail.

dtk completion

Print a shell completion script for the given shell:

dtk completion bash
dtk completion zsh
dtk completion fish
dtk completion powershell   # also accepts: pwsh

bash — write to a dedicated file (preferred) or to the system-wide completions directory:

dtk completion bash > ~/.bash_completion
# or system-wide:
dtk completion bash > /etc/bash_completion.d/dtk

zsh — the script must be autoloaded from $fpath; do not source it inline in ~/.zshrc:

mkdir -p ~/.zfunc && dtk completion zsh > ~/.zfunc/_dtk

Then add these two lines to ~/.zshrc before any existing compinit call:

fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinit

fish — write to the completions directory:

dtk completion fish > ~/.config/fish/completions/dtk.fish

PowerShell — append to your profile:

dtk completion powershell >> $PROFILE

Quiet Mode

Add -q / --quiet to any dtk dotnet command to suppress DTK meta-output and forward only the filtered content. This is useful when piping output into other tools:

dtk dotnet build -q | grep "error"
dtk dotnet test -q > test-results.txt

In quiet mode, verbosity flags (-v, -v -v) and --show-log are ignored — only the filtered command output is written.

Passthrough Behavior

Any dotnet subcommand not in the supported list (build, test, restore, clean, format) is passed through to dotnet unchanged:

dtk dotnet publish    # runs: dotnet publish
dtk dotnet pack       # runs: dotnet pack
dtk dotnet run        # runs: dotnet run

Log Files

DTK can save the raw, unfiltered command output to disk. This is controlled by the tee.mode configuration setting (see Configuration). By default, only failed runs are saved.

To print the log path after a command:

dtk dotnet test --show-log