Delta is a universal code transformation language.
Write readable, composable transforms that work across
TypeScript, Python, Go, Rust, Java, and more.
npm install -g @delta-lang/cli
Write the transform once. Delta handles the rest — finding, validating, and applying changes across every matching file.
// Upgrade null checks across all TypeScript files
fix strictNull {
pattern: { $X == null }
replace: { $X === null }
scope: "**/*.ts"
severity: bug
note: "Use strict equality"
}
apply fix strictNull to project preview
// Surgically replace one function in one file
patch "src/auth/hash.ts" in TypeScript {
find fn hashPassword() {}
replace with {
return await bcrypt.hash(password, 12);
}
why: "upgrade to async bcrypt"
}
hashPassword in src/auth/hash.ts:14// Migrate lodash to native array methods
migrate "lodash to native" in TypeScript {
rename: _.map -> Array.prototype.map
rename: _.filter -> Array.prototype.filter
rename: _.find -> Array.prototype.find
remove: deprecated _.each
scope: "src/**/*.ts"
}
apply migrate "lodash to native" to project
// Assert invariants before transforms run
guard "no raw SQL" {
scope: "src/**"
assert: no file contains raw SQL interpolation
on_fail: block_apply, show_diff
}
guard "api contract" {
scope: "src/**"
assert: fn verifyToken() exists
assert: fn hashPassword() exists
on_fail: block_apply
}
verifyToken found at src/auth/jwt.ts:8hashPassword found at src/auth/hash.ts:14// Track where user input flows through the codebase
trace userInput in "src/" {
language: TypeScript
origin: req.body.email
follow: assignments, function_calls, returns
report: full_chain
flag: "any path reaching db.query without sanitize"
flag: "any path reaching console.log"
}
req.body.email through 23 filesEvery transformation maps to one of six composable keywords. Learn them once, use them everywhere.
patch
→
Replace a specific function or block in a specific file. AST-accurate — never matches the wrong thing.
fix
→
Define a pattern → replacement rule with $VAR captures. Apply it across your entire codebase in one line.
intent
→
Add logging, tracing, or metrics to every function entry or exit — without touching each file manually.
migrate
→
Rename symbols, move files, remove deprecated calls. Write the migration once, apply it project-wide.
guard
→
Assert that functions exist, imports are clean, and code is safe before any transform runs. Block on failure.
trace
→
Follow user input through your codebase. Flag any path that reaches an unparameterised query or unsanitised output.
Stable languages use the TypeScript Compiler API or tree-sitter for AST-accurate transforms. Beta languages use the generic tree-sitter adapter.
The community fix library has ready-to-run transforms for the most common patterns — null checks, async modernisation, security fixes, API migrations, and more.
npm install -g @delta-lang/cli
delta init
Scaffolds a transform.delta in your project root.
delta run transform.delta --preview
delta run transform.delta