Fill
Fill writes the Ruby methods you mark, checks each against your tests, and keeps only the ones that pass.
Mark a method
Section titled “Mark a method”class Cart # TODO: implement total
# TODO: implement apply: never take the total below zeroendA marker is # TODO: implement <name>. Text after a colon is a hint for that
method. Markers work in .rb and .rake files.
Fill it
Section titled “Fill it”If no model is running, Gerald starts one and stops it after 15 minutes idle.
gerald fill app/models/cart.rbFill prints one line per file:
cart.rb: wrote 2 of 2; all tests pass. Nothing to review.cart.rb: wrote 1 of 2; the methods written pass their tests; left as TODO: apply. Write those; Gerald kept only methods that pass.A method Gerald cannot make pass keeps its marker. The file is replaced only if it has not changed since Gerald read it.
Fill runs the tests that name each method:
- RSpec (
rspec <spec file>) or Minitest (ruby -Itest -Ilib <test file>). - Through
bundle execwhen the project has aGemfile. - Test files are found by Ruby’s naming conventions.
With no test to run, Fill writes nothing.
| You want | Option |
|---|---|
| Your own check | --check <command>, run as <command> <path> <method>; exit 0 passes |
| Your own test lookup | --tests-from <command>, which prints the test files for one method |
| No test runs | --no-run-tests. Without --check, Fill then writes nothing |
| A time limit | --budget <seconds> per file; methods not passing by then stay TODO |
| Only some paths | --only 'app/**/*.rb', repeatable |
All options are in the fill reference.
Writing good markers
Section titled “Writing good markers”Gerald sees about 6 KB of the file around the method, the method’s callers, and same-named methods elsewhere in the project. A hint helps most when it states what the surrounding code does not:
- Each condition:
if the coupon is nil, return subtotal. - The helpers to use, by name.
- What comes back for nil or empty input.
With a coding agent
Section titled “With a coding agent”Agents use the same engine through a tool and a prompt hook. See Coding agents.