claude-on-rails 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,104 +1,125 @@
1
- require "rails/generators/base"
2
- require "claude_on_rails"
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/base'
4
+ require 'claude_on_rails'
3
5
 
4
6
  module ClaudeOnRails
5
7
  module Generators
6
8
  class SwarmGenerator < Rails::Generators::Base
7
- source_root File.expand_path("templates", __dir__)
8
-
9
+ source_root File.expand_path('templates', __dir__)
10
+
9
11
  class_option :api_only, type: :boolean, default: false,
10
- desc: "Generate swarm for API-only Rails application"
11
-
12
+ desc: 'Generate swarm for API-only Rails application'
13
+
12
14
  class_option :skip_tests, type: :boolean, default: false,
13
- desc: "Skip test agent in swarm configuration"
14
-
15
+ desc: 'Skip test agent in swarm configuration'
16
+
15
17
  class_option :graphql, type: :boolean, default: false,
16
- desc: "Include GraphQL specialist agent"
17
-
18
+ desc: 'Include GraphQL specialist agent'
19
+
18
20
  class_option :turbo, type: :boolean, default: true,
19
- desc: "Include Turbo/Stimulus specialist agents"
20
-
21
+ desc: 'Include Turbo/Stimulus specialist agents'
22
+
21
23
  def analyze_project
22
- say "Analyzing Rails project structure...", :green
24
+ say 'Analyzing Rails project structure...', :green
23
25
  @project_analysis = ClaudeOnRails.analyze_project(Rails.root)
24
-
26
+
25
27
  # Auto-detect features
26
28
  @api_only = options[:api_only] || @project_analysis[:api_only]
27
29
  @has_graphql = options[:graphql] || @project_analysis[:has_graphql]
28
30
  @has_turbo = options[:turbo] && !@api_only
29
31
  @skip_tests = options[:skip_tests]
30
32
  @test_framework = @project_analysis[:test_framework]
31
-
33
+
32
34
  say "Project type: #{@api_only ? 'API-only' : 'Full-stack Rails'}", :cyan
33
35
  say "Test framework: #{@test_framework}", :cyan if @test_framework
34
36
  say "GraphQL detected: #{@has_graphql ? 'Yes' : 'No'}", :cyan
35
-
37
+
36
38
  # Show which agents will be created
37
39
  say "\nAgents to be created:", :yellow
38
40
  agents.each do |agent|
39
41
  say " - #{agent}", :cyan
40
42
  end
41
43
  end
42
-
44
+
43
45
  def create_swarm_config
44
- say "Generating swarm configuration...", :green
45
- template "swarm.yml.erb", "claude-swarm.yml"
46
+ say 'Generating swarm configuration...', :green
47
+ template 'swarm.yml.erb', 'claude-swarm.yml'
46
48
  end
47
-
49
+
48
50
  def create_claude_md
49
- say "Creating CLAUDE.md configuration...", :green
50
- template "CLAUDE.md.erb", "CLAUDE.md"
51
+ # Always create the ClaudeOnRails context file
52
+ template 'claude_on_rails_context.md', '.claude-on-rails/context.md'
53
+
54
+ if File.exist?('CLAUDE.md')
55
+ say 'CLAUDE.md already exists - adding ClaudeOnRails file reference...', :yellow
56
+
57
+ existing_content = File.read('CLAUDE.md')
58
+
59
+ # Check if file reference already exists
60
+ if existing_content.include?('.claude-on-rails/context.md')
61
+ say '✓ CLAUDE.md already references ClaudeOnRails context', :green
62
+ else
63
+ file_reference = "\n/file:.claude-on-rails/context.md\n"
64
+ append_to_file 'CLAUDE.md', file_reference
65
+ say '✓ Added ClaudeOnRails context reference to existing CLAUDE.md', :green
66
+ end
67
+ else
68
+ say 'Creating CLAUDE.md configuration...', :green
69
+ template 'CLAUDE.md.erb', 'CLAUDE.md'
70
+ end
51
71
  end
52
-
72
+
53
73
  def create_agent_prompts
54
- say "Setting up agent-specific prompts...", :green
55
- directory "prompts", ".claude-on-rails/prompts"
74
+ say 'Setting up agent-specific prompts...', :green
75
+ directory 'prompts', '.claude-on-rails/prompts'
56
76
  end
57
-
77
+
58
78
  def update_gitignore
59
- say "Updating .gitignore...", :green
60
- append_to_file ".gitignore", "\n# ClaudeOnRails\n.claude-on-rails/sessions/\nswarm.log\n"
79
+ say 'Updating .gitignore...', :green
80
+ append_to_file '.gitignore', "\n# ClaudeOnRails\n.claude-on-rails/sessions/\n.claude-swarm/\nclaude-swarm.log\n"
61
81
  end
62
-
82
+
63
83
  def display_next_steps
64
84
  say "\n✅ ClaudeOnRails swarm configuration created!", :green
65
85
  say "\nNext steps:", :yellow
66
- say "1. Review and customize claude-swarm.yml for your project"
67
- say "2. Start your Rails development swarm:"
68
- say " claude-swarm", :cyan
86
+ say '1. Review and customize claude-swarm.yml for your project'
87
+ say '2. Start your Rails development swarm:'
88
+ say ' claude-swarm', :cyan
69
89
  say "\nOnce the swarm is running, just describe what you want to build:"
70
90
  say ' > Add user authentication with social login', :cyan
71
91
  say "\nThe swarm will automatically coordinate the implementation across all layers!"
72
92
  end
73
-
93
+
74
94
  private
75
-
95
+
76
96
  def agents
77
97
  @agents ||= build_agent_list
78
98
  end
79
-
99
+
80
100
  def build_agent_list
81
- list = ["architect"]
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"
101
+ list = ['architect']
102
+ list << 'models' if File.directory?(Rails.root.join('app/models'))
103
+ list << 'controllers' if File.directory?(Rails.root.join('app/controllers'))
104
+ list << 'views' if !@api_only && File.directory?(Rails.root.join('app/views'))
105
+ list << 'api' if @api_only && File.directory?(Rails.root.join('app/controllers/api'))
106
+ list << 'graphql' if @has_graphql && File.directory?(Rails.root.join('app/graphql'))
107
+ list << 'stimulus' if @has_turbo && File.directory?(Rails.root.join('app/javascript'))
108
+ list << 'services' if File.directory?(Rails.root.join('app/services'))
109
+ list << 'jobs' if File.directory?(Rails.root.join('app/jobs'))
110
+
111
+ unless @skip_tests
112
+ case @test_framework
113
+ when 'RSpec'
114
+ list << 'tests' if File.directory?(Rails.root.join('spec'))
115
+ when 'Minitest'
116
+ list << 'tests' if File.directory?(Rails.root.join('test'))
96
117
  end
97
118
  end
98
-
99
- list << "devops" if File.directory?(Rails.root.join("config"))
119
+
120
+ list << 'devops' if File.directory?(Rails.root.join('config'))
100
121
  list
101
122
  end
102
123
  end
103
124
  end
104
- end
125
+ end
@@ -1,101 +1,3 @@
1
- # <%= Rails.application.class.module_parent_name %> Rails Development with ClaudeOnRails
1
+ ## ClaudeOnRails Configuration
2
2
 
3
- This project uses ClaudeOnRails to create an intelligent swarm of AI agents specialized in different aspects of Rails development.
4
-
5
- ## Project Overview
6
-
7
- - **Application**: <%= Rails.application.class.module_parent_name %>
8
- - **Rails Version**: <%= Rails.version %>
9
- - **Ruby Version**: <%= RUBY_VERSION %>
10
- - **Type**: <%= @api_only ? 'API-only' : 'Full-stack Rails application' %>
11
- - **Test Framework**: <%= @test_framework || 'Not detected' %>
12
- <% if @has_graphql -%>
13
- - **GraphQL**: Enabled
14
- <% end -%>
15
-
16
- ## How to Use
17
-
18
- Simply describe what you want to build or fix, and the swarm will automatically coordinate the implementation:
19
-
20
- ```bash
21
- # Start the swarm
22
- claude-swarm orchestrate
23
-
24
- # Then just describe your task
25
- claude "Add user authentication with email confirmation"
26
- claude "Optimize the dashboard queries that are running slowly"
27
- claude "Create an API endpoint for mobile app integration"
28
- ```
29
-
30
- ## Swarm Architecture
31
-
32
- The following specialized agents work together to implement your requests:
33
-
34
- - **Architect**: Coordinates all development and makes high-level decisions
35
- - **Models**: Handles ActiveRecord models, migrations, and database design
36
- - **Controllers**: Manages request handling, routing, and controller logic
37
- <% unless @api_only -%>
38
- - **Views**: Creates and maintains views, layouts, and partials
39
- <% end -%>
40
- <% if @api_only -%>
41
- - **API**: Designs RESTful endpoints and handles serialization
42
- <% end -%>
43
- <% if @has_graphql -%>
44
- - **GraphQL**: Manages GraphQL schemas, types, and resolvers
45
- <% end -%>
46
- <% if @has_turbo -%>
47
- - **Stimulus**: Implements interactive features with Stimulus controllers
48
- <% end -%>
49
- - **Services**: Extracts business logic into service objects
50
- - **Jobs**: Handles background processing and async tasks
51
- <% unless @skip_tests -%>
52
- - **Tests**: Ensures comprehensive test coverage with <%= @test_framework %>
53
- <% end -%>
54
- - **DevOps**: Manages deployment and production configurations
55
-
56
- ## Project Conventions
57
-
58
- ### Code Style
59
- - Follow Rails conventions and best practices
60
- - Use RuboCop for Ruby style enforcement
61
- - Prefer clarity over cleverness
62
- - Write self-documenting code
63
-
64
- ### Testing
65
- <% if @test_framework == 'RSpec' -%>
66
- - RSpec for all tests
67
- - Factory Bot for test data
68
- - Request specs for API endpoints
69
- - System specs for user interactions
70
- <% else -%>
71
- - Minitest for all tests
72
- - Fixtures or factories for test data
73
- - Integration tests for user flows
74
- - Unit tests for models and services
75
- <% end -%>
76
-
77
- ### Git Workflow
78
- - Feature branches for new work
79
- - Descriptive commit messages
80
- - PR reviews before merging
81
- - Keep main branch deployable
82
-
83
- ## Custom Patterns
84
-
85
- Add your project-specific patterns and conventions here:
86
-
87
- ```yaml
88
- # Example: Custom service object pattern
89
- Services:
90
- Pattern: Command pattern with Result objects
91
- Location: app/services/
92
- Naming: VerbNoun (e.g., CreateOrder, SendEmail)
93
- Testing: Unit tests with mocked dependencies
94
- ```
95
-
96
- ## Notes
97
-
98
- - This configuration was generated by ClaudeOnRails
99
- - Customize agent prompts in `.claude-on-rails/prompts/`
100
- - Update this file with project-specific conventions
101
- - The swarm learns from your codebase patterns
3
+ You are working on <%= Rails.application.class.module_parent_name %>, a <%= @api_only ? 'Rails API' : 'Rails' %> application. Review the ClaudeOnRails context file at @.claude-on-rails/context.md
@@ -0,0 +1,32 @@
1
+ # ClaudeOnRails Context
2
+
3
+ This project uses ClaudeOnRails with a swarm of specialized agents for Rails development.
4
+
5
+ ## Project Information
6
+ - **Rails Version**: <%= Rails.version %>
7
+ - **Ruby Version**: <%= RUBY_VERSION %>
8
+ - **Project Type**: <%= @api_only ? 'API-only' : 'Full-stack Rails' %>
9
+ - **Test Framework**: <%= @test_framework || 'Not detected' %>
10
+ <% if @has_graphql -%>
11
+ - **GraphQL**: Enabled
12
+ <% end -%>
13
+ <% if @has_turbo && !@api_only -%>
14
+ - **Turbo/Stimulus**: Enabled
15
+ <% end -%>
16
+
17
+ ## Swarm Configuration
18
+
19
+ The claude-swarm.yml file defines specialized agents for different aspects of Rails development:
20
+ - Each agent has specific expertise and works in designated directories
21
+ - Agents collaborate to implement features across all layers
22
+ - The architect agent coordinates the team
23
+
24
+ ## Development Guidelines
25
+
26
+ When working on this project:
27
+ - Follow Rails conventions and best practices
28
+ - Write tests for all new functionality
29
+ - Use strong parameters in controllers
30
+ - Keep models focused with single responsibilities
31
+ - Extract complex business logic to service objects
32
+ - Ensure proper database indexing for foreign keys and queries
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Obie Fernandez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-06-26 00:00:00.000000000 Z
11
+ date: 2025-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '6.0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '6.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: claude_swarm
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,103 +25,19 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '0.1'
41
27
  - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '2.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '2.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '13.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '13.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rspec-rails
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '5.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '5.0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rails
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '2.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '2.0'
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-rspec
28
+ name: rails
127
29
  requirement: !ruby/object:Gem::Requirement
128
30
  requirements:
129
- - - "~>"
31
+ - - ">="
130
32
  - !ruby/object:Gem::Version
131
- version: '2.0'
132
- type: :development
33
+ version: '6.0'
34
+ type: :runtime
133
35
  prerelease: false
134
36
  version_requirements: !ruby/object:Gem::Requirement
135
37
  requirements:
136
- - - "~>"
38
+ - - ">="
137
39
  - !ruby/object:Gem::Version
138
- version: '2.0'
40
+ version: '6.0'
139
41
  description: ClaudeOnRails leverages claude-swarm to create an intelligent team of
140
42
  AI agents specialized in different aspects of Rails development. Simply describe
141
43
  what you want to build, and the swarm handles the rest.
@@ -146,13 +48,14 @@ extensions: []
146
48
  extra_rdoc_files: []
147
49
  files:
148
50
  - ".rspec"
51
+ - ".rubocop.yml"
149
52
  - CHANGELOG.md
150
53
  - CONTRIBUTING.md
151
54
  - Gemfile
55
+ - Gemfile.lock
152
56
  - LICENSE
153
57
  - README.md
154
58
  - Rakefile
155
- - claude-on-rails.gemspec
156
59
  - examples/README.md
157
60
  - lib/claude_on_rails.rb
158
61
  - lib/claude_on_rails/configuration.rb
@@ -161,6 +64,7 @@ files:
161
64
  - lib/claude_on_rails/version.rb
162
65
  - lib/generators/claude_on_rails/swarm/swarm_generator.rb
163
66
  - lib/generators/claude_on_rails/swarm/templates/CLAUDE.md.erb
67
+ - lib/generators/claude_on_rails/swarm/templates/claude_on_rails_context.md
164
68
  - lib/generators/claude_on_rails/swarm/templates/prompts/api.md
165
69
  - lib/generators/claude_on_rails/swarm/templates/prompts/architect.md
166
70
  - lib/generators/claude_on_rails/swarm/templates/prompts/controllers.md
@@ -188,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
92
  requirements:
189
93
  - - ">="
190
94
  - !ruby/object:Gem::Version
191
- version: 2.7.0
95
+ version: 3.3.0
192
96
  required_rubygems_version: !ruby/object:Gem::Requirement
193
97
  requirements:
194
98
  - - ">="
@@ -1,45 +0,0 @@
1
- require_relative "lib/claude_on_rails/version"
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "claude-on-rails"
5
- spec.version = ClaudeOnRails::VERSION
6
- spec.authors = ["Obie Fernandez"]
7
- spec.email = ["obiefernandez@gmail.com"]
8
-
9
- spec.summary = "Rails development framework powered by Claude swarm intelligence"
10
- spec.description = "ClaudeOnRails leverages claude-swarm to create an intelligent team of AI agents specialized in different aspects of Rails development. Simply describe what you want to build, and the swarm handles the rest."
11
- spec.homepage = "https://github.com/obie/claude-on-rails"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = ">= 2.7.0"
14
-
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = spec.homepage
17
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- spec.files = Dir.chdir(__dir__) do
21
- `git ls-files -z`.split("\x0").reject do |f|
22
- (File.expand_path(f) == __FILE__) ||
23
- f.start_with?(*%w[bin/ test/ spec/ features/ .git .circleci appveyor .github])
24
- end
25
- end
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
-
30
- # Runtime dependencies
31
- spec.add_dependency "rails", ">= 6.0"
32
- spec.add_dependency "claude_swarm", "~> 0.1"
33
-
34
- # Development dependencies
35
- spec.add_development_dependency "bundler", "~> 2.0"
36
- spec.add_development_dependency "rake", "~> 13.0"
37
- spec.add_development_dependency "rspec", "~> 3.0"
38
- spec.add_development_dependency "rspec-rails", "~> 5.0"
39
- spec.add_development_dependency "rubocop", "~> 1.0"
40
- spec.add_development_dependency "rubocop-rails", "~> 2.0"
41
- spec.add_development_dependency "rubocop-rspec", "~> 2.0"
42
-
43
- # For more information and examples about making a new gem, check out our
44
- # guide at: https://bundler.io/guides/creating_gem.html
45
- end