Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.refactron.dev/llms.txt

Use this file to discover all available pages before exploring further.

Refactron ships a hand-curated catalog of twenty transforms — eleven for Python, nine for TypeScript. Every transform has been hardened against precondition edge cases, runs through the three verification gates, and either commits atomically or skips itself. You select transforms via the --transforms flag (run --transforms=var_to_const_let,implicit_any) or the transforms array in .refactronrc.json. The default is ['all'].

Catalog

Transform IDLanguageWhat it does
callback_to_async_awaitPythonTrailing-callback function → async def returning the result
format_to_fstringPython%-format and .format() calls → f-strings
manual_typecheck_to_hintsPythonisinstance chain dispatching one parameter → Union[...] annotation
deprecated_api_requests_to_httpxPythonrequests imports / calls → httpx
class_to_dataclassPythonPure __init__-assignment classes → @dataclass
super_no_argsPythonsuper(Class, self).method()super().method()
lru_cache_to_cachePython@lru_cache(maxsize=None)@functools.cache (≥ 3.9)
pep585_genericsPythontyping.List/Dict/Tuple/... → built-in list/dict/tuple (≥ 3.9)
pep604_optional_unionPythonOptional[X]X | None; Union[A, B]A | B (≥ 3.10)
datetime_utc_aliasPythondatetime.timezone.utcdatetime.UTC (≥ 3.11)
yield_from_for_loopPythonfor x in y: yield xyield from y
var_to_const_letTypeScriptvarconst (or let if reassigned) per binding
promise_chains_to_asyncTypeScript.then(...).then(...) chains → async/await
implicit_anyTypeScriptAdd explicit parameter types when all call sites pass the same primitive
commonjs_to_esmTypeScriptrequire / module.exports → ES module import / export
promise_constructor_to_asyncTypeScriptnew Promise((resolve) => resolve(x))async returning x
indexof_to_includesTypeScriptarr.indexOf(x) !== -1arr.includes(x) (ES2016+)
object_assign_to_spreadTypeScriptObject.assign({}, a, b){ ...a, ...b } (ES2018+)
string_concat_to_template_literalTypeScript"a " + name + "!"`a ${name}!` (ES2015+)
vue_set_delete_to_assignmentTypeScriptVue.set / this.$set → direct assignment; Vue.deletedelete

Browse the catalog

callback_to_async_await

Python · trailing-callback → async def

format_to_fstring

Python · % and .format() → f-string

manual_typecheck_to_hints

Python · isinstance chain → Union[...]

deprecated_api_requests_to_httpx

Python · requestshttpx

class_to_dataclass

Python · plain class → @dataclass

super_no_args

Python · super(C, self)super()

lru_cache_to_cache

Python · @lru_cache(maxsize=None)@cache (≥ 3.9)

pep585_generics

Python · typing.List/Dictlist/dict (PEP 585)

pep604_optional_union

Python · Optional[X]X | None (PEP 604)

datetime_utc_alias

Python · datetime.timezone.utcdatetime.UTC (≥ 3.11)

yield_from_for_loop

Python · for x in y: yield xyield from y

var_to_const_let

TypeScript · varconst / let

promise_chains_to_async

TypeScript · .then().then()async/await

implicit_any

TypeScript · annotate inferred-primitive parameters

commonjs_to_esm

TypeScript · require / module.exports → ESM

promise_constructor_to_async

TypeScript · new Promise(...)async

indexof_to_includes

TypeScript · indexOf(x) !== -1includes(x) (ES2016+)

object_assign_to_spread

TypeScript · Object.assign({}, …) → spread literal (ES2018+)

string_concat_to_template_literal

TypeScript · "…" + x → template literal (ES2015+)

vue_set_delete_to_assignment

TypeScript · Vue.set / this.$set → direct assignment
Every transform’s “after” output passes Gate 1 (syntax) by construction — the refactorer rebuilds the source from a parsed CST/AST. Gates 2 and 3 (imports + tests) are what catch regressions the local rewrite couldn’t predict.