Skip to content

Commit 6803a2e

Browse files
committed
Fix directory existence checks and model names for v0.1.3
- Only create agents for existing directories - Use claude-swarm compatible model names (opus/haiku/sonnet) - Show which agents will be created during analysis - Default to opus model for better capabilities
1 parent 7080458 commit 6803a2e

File tree

5 files changed

+81
-32
lines changed

5 files changed

+81
-32
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.1.3] - 2025-01-26
9+
10+
### Fixed
11+
- Only create swarm agents for directories that actually exist
12+
- Changed model from full model name to claude-swarm compatible names (opus/haiku/sonnet)
13+
- Fixed controllers connections to only include services if directory exists
14+
15+
### Changed
16+
- Default model is now "opus" for all agents
17+
- Generator now shows which agents will be created during analysis
18+
19+
### Improved
20+
- Swarm configuration template now checks for directory existence before creating agents
21+
- Better handling of optional directories like app/services, app/jobs, etc.
22+
823
## [0.1.2] - 2025-01-26
924

1025
### Fixed

lib/claude_on_rails/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Configuration
33
attr_accessor :default_model, :vibe_mode, :session_directory, :log_directory
44

55
def initialize
6-
@default_model = "claude-3-5-haiku-20250110"
6+
@default_model = "opus"
77
@vibe_mode = true
88
@session_directory = ".claude-on-rails/sessions"
99
@log_directory = ".claude-on-rails/logs"

lib/claude_on_rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module ClaudeOnRails
2-
VERSION = "0.1.2"
2+
VERSION = "0.1.3"
33
end

lib/generators/claude_on_rails/swarm/swarm_generator.rb

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ def analyze_project
3232
say "Project type: #{@api_only ? 'API-only' : 'Full-stack Rails'}", :cyan
3333
say "Test framework: #{@test_framework}", :cyan if @test_framework
3434
say "GraphQL detected: #{@has_graphql ? 'Yes' : 'No'}", :cyan
35+
36+
# Show which agents will be created
37+
say "\nAgents to be created:", :yellow
38+
agents.each do |agent|
39+
say " - #{agent}", :cyan
40+
end
3541
end
3642

3743
def create_swarm_config
@@ -73,16 +79,24 @@ def agents
7379

7480
def build_agent_list
7581
list = ["architect"]
76-
list << "models"
77-
list << "controllers"
78-
list << "views" unless @api_only
79-
list << "api" if @api_only
80-
list << "graphql" if @has_graphql
81-
list << "stimulus" if @has_turbo
82-
list << "services"
83-
list << "jobs"
84-
list << "tests" unless @skip_tests
85-
list << "devops"
82+
list << "models" if File.directory?(Rails.root.join("app/models"))
83+
list << "controllers" if File.directory?(Rails.root.join("app/controllers"))
84+
list << "views" if !@api_only && File.directory?(Rails.root.join("app/views"))
85+
list << "api" if @api_only && File.directory?(Rails.root.join("app/controllers/api"))
86+
list << "graphql" if @has_graphql && File.directory?(Rails.root.join("app/graphql"))
87+
list << "stimulus" if @has_turbo && File.directory?(Rails.root.join("app/javascript"))
88+
list << "services" if File.directory?(Rails.root.join("app/services"))
89+
list << "jobs" if File.directory?(Rails.root.join("app/jobs"))
90+
91+
if !@skip_tests
92+
if @test_framework == 'RSpec' && File.directory?(Rails.root.join("spec"))
93+
list << "tests"
94+
elsif @test_framework == 'Minitest' && File.directory?(Rails.root.join("test"))
95+
list << "tests"
96+
end
97+
end
98+
99+
list << "devops" if File.directory?(Rails.root.join("config"))
86100
list
87101
end
88102
end

lib/generators/claude_on_rails/swarm/templates/swarm.yml.erb

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,89 +6,109 @@ swarm:
66
architect:
77
description: "Rails architect coordinating <%= @api_only ? 'API' : 'full-stack' %> development for <%= Rails.application.class.module_parent_name %>"
88
directory: .
9-
model: claude-3-5-haiku-20250110
9+
model: opus
1010
connections: [<%= agents.reject { |a| a == 'architect' }.join(', ') %>]
1111
prompt_file: .claude-on-rails/prompts/architect.md
1212
vibe: true
13+
<% if File.directory?(Rails.root.join("app/models")) %>
1314

1415
models:
1516
description: "ActiveRecord models, migrations, and database optimization specialist"
1617
directory: ./app/models
17-
model: claude-3-5-haiku-20250110
18+
model: opus
1819
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
1920
prompt_file: .claude-on-rails/prompts/models.md
21+
<% end %>
22+
<% if File.directory?(Rails.root.join("app/controllers")) %>
2023

2124
controllers:
2225
description: "Rails controllers, routing, and request handling specialist"
2326
directory: ./app/controllers
24-
model: claude-3-5-haiku-20250110
25-
connections: [services<%= ', api' if @api_only %>]
27+
model: opus
28+
<% connections = [] %>
29+
<% connections << 'services' if File.directory?(Rails.root.join("app/services")) %>
30+
<% connections << 'api' if @api_only && File.directory?(Rails.root.join("app/controllers/api")) %>
31+
<% if connections.any? %>
32+
connections: [<%= connections.join(', ') %>]
33+
<% end %>
2634
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
2735
prompt_file: .claude-on-rails/prompts/controllers.md
28-
<% unless @api_only %>
36+
<% end %>
37+
<% if !@api_only && File.directory?(Rails.root.join("app/views")) %>
2938

3039
views:
3140
description: "Rails views, layouts, partials, and asset pipeline specialist"
3241
directory: ./app/views
33-
model: claude-3-5-haiku-20250110
34-
connections: [<%= 'stimulus' if @has_turbo %>]
42+
model: opus
43+
<% if @has_turbo && File.directory?(Rails.root.join("app/javascript")) %>
44+
connections: [stimulus]
45+
<% end %>
3546
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
3647
prompt_file: .claude-on-rails/prompts/views.md
3748
<% end %>
38-
<% if @api_only %>
49+
<% if @api_only && File.directory?(Rails.root.join("app/controllers/api")) %>
3950

4051
api:
4152
description: "RESTful API design, serialization, and versioning specialist"
4253
directory: ./app/controllers/api
43-
model: claude-3-5-haiku-20250110
54+
model: opus
4455
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
4556
prompt_file: .claude-on-rails/prompts/api.md
4657
<% end %>
47-
<% if @has_graphql %>
58+
<% if @has_graphql && File.directory?(Rails.root.join("app/graphql")) %>
4859

4960
graphql:
5061
description: "GraphQL schema, resolvers, and mutations specialist"
5162
directory: ./app/graphql
52-
model: claude-3-5-haiku-20250110
63+
model: opus
5364
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
5465
prompt_file: .claude-on-rails/prompts/graphql.md
5566
<% end %>
56-
<% if @has_turbo %>
67+
<% if @has_turbo && File.directory?(Rails.root.join("app/javascript")) %>
5768

5869
stimulus:
5970
description: "Stimulus.js controllers and Turbo integration specialist"
6071
directory: ./app/javascript
61-
model: claude-3-5-haiku-20250110
72+
model: opus
6273
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
6374
prompt_file: .claude-on-rails/prompts/stimulus.md
6475
<% end %>
76+
<% if File.directory?(Rails.root.join("app/services")) %>
6577

6678
services:
6779
description: "Service objects, business logic, and design patterns specialist"
6880
directory: ./app/services
69-
model: claude-3-5-haiku-20250110
81+
model: opus
7082
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
7183
prompt_file: .claude-on-rails/prompts/services.md
84+
<% end %>
85+
<% if File.directory?(Rails.root.join("app/jobs")) %>
7286

7387
jobs:
7488
description: "Background jobs, ActiveJob, and async processing specialist"
7589
directory: ./app/jobs
76-
model: claude-3-5-haiku-20250110
90+
model: opus
7791
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
7892
prompt_file: .claude-on-rails/prompts/jobs.md
79-
<% unless @skip_tests %>
93+
<% end %>
94+
<% if !@skip_tests %>
95+
<% test_dir = @test_framework == 'RSpec' ? 'spec' : 'test' %>
96+
<% if File.directory?(Rails.root.join(test_dir)) %>
8097

8198
tests:
8299
description: "<%= @test_framework %> testing, factories, and test coverage specialist"
83-
directory: ./<%= @test_framework == 'RSpec' ? 'spec' : 'test' %>
84-
model: claude-3-5-haiku-20250110
100+
directory: ./<%= test_dir %>
101+
model: opus
85102
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
86103
prompt_file: .claude-on-rails/prompts/tests.md
87104
<% end %>
105+
<% end %>
106+
<% if File.directory?(Rails.root.join("config")) %>
88107

89108
devops:
90109
description: "Deployment, Docker, CI/CD, and production configuration specialist"
91110
directory: ./config
92-
model: claude-3-5-haiku-20250110
111+
model: opus
93112
allowed_tools: [Read, Edit, Write, Bash, Grep, Glob, LS]
94-
prompt_file: .claude-on-rails/prompts/devops.md
113+
prompt_file: .claude-on-rails/prompts/devops.md
114+
<% end %>

0 commit comments

Comments
 (0)