Files
opencode-rails/examples
Ajay Krishnan dfedf257c5 Add examples/rails_integration.rb — long-form canonical example
Tobi T6: the README quickstart is too thin to be the only example.
A real integration touches initializer wiring, the job orchestrator,
the ReplyObserver implementation, and the permission rules builder.

Single file, ~180 lines including comments, four labeled sections:

  1. config/initializers/opencode.rb     adapters for both gems
  2. app/jobs/generate_response_job.rb   the orchestrator job
  3. app/services/reply_stream.rb        ReplyObserver -> Turbo Stream
  4. permissions_for / build_system_context  per-product overrides

NOT loaded by the gem at runtime (the gemspec includes it via Dir.glob
but lib/opencode-rails.rb doesn't require it). Pure reference. Drop in,
adapt to your domain, ship.

Pattern extracted from a production multi-product Rails app
(ajent-rails) running Blackline / Raven / AIGL. Every line maps to
code that runs in production today.
2026-05-20 06:45:17 -07:00
..