Class: Xeno::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/xeno/install/install_generator.rb

Overview

Mounted-mode install: initializer, engine mount, migrations, and the agent/ scaffold.

Instance Method Summary collapse

Instance Method Details

#copy_initializerObject



11
12
13
# File 'lib/generators/xeno/install/install_generator.rb', line 11

def copy_initializer
  template "initializer.rb", "config/initializers/xeno.rb"
end

#install_migrationsObject



19
20
21
# File 'lib/generators/xeno/install/install_generator.rb', line 19

def install_migrations
  rake "xeno:install:migrations" unless options[:skip_migrations]
end

#mount_engineObject



15
16
17
# File 'lib/generators/xeno/install/install_generator.rb', line 15

def mount_engine
  route 'mount Xeno::Engine => "/agent"'
end

#scaffold_agentObject



23
24
25
26
27
# File 'lib/generators/xeno/install/install_generator.rb', line 23

def scaffold_agent
  template "agent.rb", "agent/agent.rb"
  template "instructions.md", "agent/instructions.md"
  create_file "agent/tools/.keep", ""
end

#show_next_stepsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/generators/xeno/install/install_generator.rb', line 29

def show_next_steps
  say <<~NEXT

    xeno is installed. Next steps:

      1. bin/rails db:migrate
      2. Edit agent/instructions.md (the agent's always-on system prompt)
      3. bin/rails g xeno:tool GetWeather   # your first tool
      4. Set the auth check in config/initializers/xeno.rb — the HTTP
         channel is fail-closed and returns 401 until you do.
      5. bin/rails xeno:info                # see the resolved agent

    If coding agents work in this repo, add to your AGENTS.md/CLAUDE.md:

      The agent/ directory uses the xeno gem. Before changing it, read
      the gem's docs: `bundle show xeno`, then README.md and
      docs/runtime.md there. Never unpin the ruby_llm git ref.

  NEXT
end