CLI, MCP, LSP, and VS Code extension for kustomize manifest drift detection
Project description
kdrift
CLI, MCP, LSP, and VS Code extension for kustomize manifest drift detection. Discovers which overlays are affected by your changes, renders baselines and candidates, and diffs per-resource.
Install
uv tool install kdrift
# or: pip install kdrift
Requires Python 3.13+ and kustomize on PATH.
For unreleased changes on main:
uv tool install git+https://github.com/mikedougherty/kdrift
Usage
kdrift diff # diff all affected overlays vs HEAD
kdrift diff k8s/base/deployment.yaml # diff overlays affected by this file
kdrift diff --overlay k8s/dev # diff only this overlay
kdrift diff --ref main~3 # diff against a specific ref
kdrift diff --ref main~5..main~2 # compare two commits
kdrift diff -C /path/to/repo # target a different repository
kdrift diff --format json # structured JSON output
kdrift diff --check # exit non-zero if drift exists (CI/pre-commit)
kdrift diff --watch # continuous mode: re-diff on file save
How It Works
git diff --name-only HEADfinds changed files- Dependency graph maps changes to affected leaf overlays (parses all
kustomization.yamlreference types) kustomize buildrenders baseline (via git worktree, cached) and candidate (working tree)- Two-phase per-resource diff: exact GVK+namespace+name match, then generator-aware matching for hash-suffixed ConfigMap/Secret names
- Output as unified diff or structured JSON
Configuration
Create .kdrift.yaml anywhere in your directory tree (searched upward from CWD):
kustomize_args:
- "--enable-helm"
- "--load-restrictor"
- "LoadRestrictionsNone"
Development
make deps # Install dependencies
make validate # Run all checks (lint + typecheck + test)
make test # Tests only
make typecheck # mypy strict mode
See docs/development.md for detailed setup.
Quick Start: MCP Server for Claude Code
Give your AI agent kustomize drift detection in two steps:
1. Install kdrift:
uv tool install kdrift
2. Add to your Claude Code MCP config (.claude.json or project .mcp.json):
{
"mcpServers": {
"kdrift": {
"command": "kdrift",
"args": ["mcp"]
}
}
}
That's it. Your agent now has four tools: kdrift_diff, kdrift_discover, kdrift_affected, kdrift_render. Ask it to "check what my kustomize changes affect" and it will use them.
3. (Optional) Add agent instructions for deeper context on how to use kdrift:
@path/to/kdrift/docs/agents/AGENTS.md
Or copy docs/agents/ into your project's agent instructions directory. The files are self-contained and agent-agnostic.
Agent Integration
kdrift ships with agent-readable instructions in docs/agents/. These work with any AI coding assistant that supports AGENTS.md or similar instruction files.
VS Code Extension
The vscode-kdrift/ directory contains a VS Code extension that shows drift diffs in a side panel, modeled after the built-in Markdown Preview. See vscode-kdrift/README.md for setup and development.
LSP Server (IDE integration)
kdrift lsp # stdio transport, configure in your LSP client
kdrift lsp --debug # enable file logging to ~/.cache/kdrift/kdrift.log
Provides diagnostics on save, CodeLens annotations, and hover info.
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kdrift-0.1.2.tar.gz.
File metadata
- Download URL: kdrift-0.1.2.tar.gz
- Upload date:
- Size: 971.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69802899cd6b1c92fdd3acb8d95baae6237eaf255acdc6b8474eeef48a038c8a
|
|
| MD5 |
a7791df6463e50655b2a7feb2282d266
|
|
| BLAKE2b-256 |
1ea67d8f64a2f577cdc3f16cd7c76db5d9a40d9e15e8a009babc1f40737bd520
|
Provenance
The following attestation bundles were made for kdrift-0.1.2.tar.gz:
Publisher:
publish.yaml on mikedougherty/kdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kdrift-0.1.2.tar.gz -
Subject digest:
69802899cd6b1c92fdd3acb8d95baae6237eaf255acdc6b8474eeef48a038c8a - Sigstore transparency entry: 1723718725
- Sigstore integration time:
-
Permalink:
mikedougherty/kdrift@f61fcedf0be7c14f7ebfa34b8c5132021b6a4080 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/mikedougherty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@f61fcedf0be7c14f7ebfa34b8c5132021b6a4080 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kdrift-0.1.2-py3-none-any.whl.
File metadata
- Download URL: kdrift-0.1.2-py3-none-any.whl
- Upload date:
- Size: 29.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6edc9b4970b1296dfcaac83e68bbafdc46ac507e49bbf9bd197ba201ea9f9d5b
|
|
| MD5 |
37ef4afac2dd01ec66d3eae54b4f7499
|
|
| BLAKE2b-256 |
1e3ad30c916d9f1a166ecf718e79750a4c231063e1e1273f07465e2d0d56f6b6
|
Provenance
The following attestation bundles were made for kdrift-0.1.2-py3-none-any.whl:
Publisher:
publish.yaml on mikedougherty/kdrift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kdrift-0.1.2-py3-none-any.whl -
Subject digest:
6edc9b4970b1296dfcaac83e68bbafdc46ac507e49bbf9bd197ba201ea9f9d5b - Sigstore transparency entry: 1723718895
- Sigstore integration time:
-
Permalink:
mikedougherty/kdrift@f61fcedf0be7c14f7ebfa34b8c5132021b6a4080 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/mikedougherty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@f61fcedf0be7c14f7ebfa34b8c5132021b6a4080 -
Trigger Event:
release
-
Statement type: