Project

autotype

0.0
The project is in a healthy, maintained state
Infers Ruby method signatures from Prism AST analysis and fixed-point constraint solving.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.0
~> 3.13

Runtime

~> 2.0
~> 2.0
~> 1.0
 Project Readme

Autotype

Syntax-less Ruby type inference: analyze method bodies with Prism, accumulate send capabilities, and solve to fixed-point types without requiring source annotations.

Install

gem install autotype

Or from source:

bundle exec rake native:compile
bundle exec rspec

CLI

autotype app/**/*.rb --json
autotype lib/**/*.rb --html typedoc.html

Enable the native C solver priming pass:

AUTOTYPE_NATIVE=1 autotype app/**/*.rb --json

No config file is required. Autotype discovers actor port wiring, emit patterns, entity factories, and type file locations from your Ruby source.

Optional overrides

When heuristics get something wrong, add autotype.yml (see autotype.example.yml):

skip:
  - vendor/**

types:
  members:
    query: MyApp::Entities::Query   # only when name conventions fail

Set AUTOTYPE_CONFIG or pass --config PATH to point at a non-default location.

What is discovered automatically

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.

Ruby API

require "autotype"

Autotype.run(["app/models/user.rb", "--json"])

Native extension

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 test

Editor extension

The Cursor / VS Code extension lives in editor/. It runs autotype --json and renders inline signatures.

cd editor
npm install

Configure workspace settings to point at the autotype executable on your PATH, or rely on the bundled exe/autotype via bundle exec.

License

MIT