File state checkpoint tool - has your code tarnished?
Project description
tarnished
File state checkpoint tool - has your code tarnished?
Installation
Using uv (recommended)
uv tool install tarnished
Using pip
pip install tarnished
From source
git clone https://github.com/RasmusGodske/tarnished.git
cd tarnished
uv tool install .
Quick Start
# Initialize .tarnished/ directory
tarnished init
# Save a checkpoint for a profile
tarnished save lint:php "app/**/*.php" "tests/**/*.php"
# Check if files have changed
tarnished check lint:php # Exit 0 = clean, Exit 1 = tarnished
# See status of all profiles
tarnished status
Usage
Commands
| Command | Description |
|---|---|
tarnished init |
Initialize .tarnished/ directory |
tarnished save <profile> [patterns...] |
Save checkpoint for profile |
tarnished check <profile> |
Check if profile is tarnished |
tarnished status |
Show JSON status of all profiles |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Clean (no changes) |
| 1 | Tarnished (changes detected) |
| 2 | Unknown profile |
How It Works
tarnished is a simple CLI tool that tracks file state via checksums. It helps you know when code has changed and needs re-checking (linting, testing, etc.).
Core Concepts
- Profile: A named set of glob patterns (e.g.,
lint:phptracksapp/**/*.php) - Checkpoint: A saved checksum representing file state at a specific moment
- Tarnished: A profile is "tarnished" if files have changed since the last checkpoint
Implementation
tarnished uses file metadata (path + size + mtime) to compute checksums. This is:
- Git-independent - works regardless of commit history
- Fast - no file content hashing required
- Simple - single JSON files for config and state
File Structure
.tarnished/
├── config.json # Profile patterns (commit this)
└── state.json # Current checksums (gitignored)
Integration Example
Add to your CI/test scripts:
# After successful test run, save checkpoint
./run-tests.sh && tarnished save tests
# Before committing, check if tests need re-running
if ! tarnished check tests; then
echo "Tests are tarnished - please run tests first"
exit 1
fi
Pre-commit Hook
#!/bin/bash
# .git/hooks/pre-commit
# Check if any profiles are tarnished
status=$(tarnished status)
if echo "$status" | grep -q '"status": "tarnished"'; then
echo "Some profiles are tarnished. Please run the relevant checks."
tarnished status
exit 1
fi
CI Pipeline Example
# In your CI workflow
- name: Check code state
run: |
tarnished check lint:php || echo "PHP files changed - running linter"
tarnished check tests || echo "Test files changed - running tests"
License
MIT
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 tarnished-0.2.1.tar.gz.
File metadata
- Download URL: tarnished-0.2.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b69b93e3943fb6391bcb398738257c77990596e4288c3582e93b9434a2229ce
|
|
| MD5 |
29c94ad0991462b2debe73f1294b8f63
|
|
| BLAKE2b-256 |
69f7ab036cb6dba61cc0deb1efcc5ee2ac587a0065f27dd6d7472e47692cd39c
|
Provenance
The following attestation bundles were made for tarnished-0.2.1.tar.gz:
Publisher:
publish.yml on RasmusGodske/tarnished
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tarnished-0.2.1.tar.gz -
Subject digest:
4b69b93e3943fb6391bcb398738257c77990596e4288c3582e93b9434a2229ce - Sigstore transparency entry: 855212529
- Sigstore integration time:
-
Permalink:
RasmusGodske/tarnished@3ef8966740ee748d03f1eff09422f462063a2363 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RasmusGodske
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ef8966740ee748d03f1eff09422f462063a2363 -
Trigger Event:
push
-
Statement type:
File details
Details for the file tarnished-0.2.1-py3-none-any.whl.
File metadata
- Download URL: tarnished-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3079e850d4ee90464173d9d9451faefccae2212670feb9b538a5d9b333bd420
|
|
| MD5 |
7906e4cf38fedc22cfd8f7e7125d1478
|
|
| BLAKE2b-256 |
a983dd9e33827055278b3fec0f83c3b01519646f2daf856c536b70f2eb2d929a
|
Provenance
The following attestation bundles were made for tarnished-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on RasmusGodske/tarnished
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tarnished-0.2.1-py3-none-any.whl -
Subject digest:
c3079e850d4ee90464173d9d9451faefccae2212670feb9b538a5d9b333bd420 - Sigstore transparency entry: 855212531
- Sigstore integration time:
-
Permalink:
RasmusGodske/tarnished@3ef8966740ee748d03f1eff09422f462063a2363 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/RasmusGodske
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3ef8966740ee748d03f1eff09422f462063a2363 -
Trigger Event:
push
-
Statement type: