Syntax-less Ruby type inference: analyze method bodies with Prism, accumulate send capabilities, and solve to fixed-point types without requiring source annotations.
gem install autotypeOr from source:
bundle exec rake native:compile
bundle exec rspecautotype app/**/*.rb --json
autotype lib/**/*.rb --html typedoc.htmlEnable the native C solver priming pass:
AUTOTYPE_NATIVE=1 autotype app/**/*.rb --jsonNo config file is required. Autotype discovers actor port wiring, emit patterns, entity factories, and type file locations from your Ruby source.
When heuristics get something wrong, add autotype.yml (see autotype.example.yml):
skip:
- vendor/**
types:
members:
query: MyApp::Entities::Query # only when name conventions failSet AUTOTYPE_CONFIG or pass --config PATH to point at a non-default location.
| Concern | How |
|---|---|
| Actor DSL | input / output / option calls at class level |
| Port handler | Instance method with from: (or source:) keyword — prefers process |
| Output emit | emit(x, to: :port)-style sends on actor classes |
| Options hash | Classes declaring option and reading options |
| Entity factories | Entity.define, *::Entity.define, Data.define, Struct.new |
| Entity file paths | Glob {snake}.rb under project root; match constant definition |
| Member / option types | Common field names (name, step, base_url, …) |
| Lifecycle methods | on_* methods on actor classes → nil return |
| Structured prefixes | Namespaces seen in port type: constants (e.g. MyApp::Entities::) |
Everything in the old verbose config (dsl, wiring, pipeline, structured, locators, self_types) is inferred unless you override it.
require "autotype"
Autotype.run(["app/models/user.rb", "--json"])The optional C extension accelerates the builtin fixed-point solver. It compiles automatically on gem install via ext/autotype/extconf.rb, sharing sources with native/autotype/.
cd native/autotype && make testThe Cursor / VS Code extension lives in editor/. It runs autotype --json and renders inline signatures.
cd editor
npm installConfigure workspace settings to point at the autotype executable on your PATH, or rely on the bundled exe/autotype via bundle exec.
MIT