soka-rails 0.0.1.beta4

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: add1e499afcd752fc5052b095add7a9faa0f630e020cdea38a92336d6aac240e
4
+ data.tar.gz: 73bcb0fd1b70cc2ebc48c39293daa6ba641c8079046ed20846f3ba8ec8485846
5
+ SHA512:
6
+ metadata.gz: 0ba025e3ad0bf9176098284c2fa7d183c25d817108170f47b50e52edf2528b6c738c92d578ce736c984d8eae97fd405478ec0f96aabe736f507c1d40ec505df8
7
+ data.tar.gz: fc8003ea01c7aeb6a24f54543fdc04c77a34afd0d04c2c80941929440c235c1333672d702a9060df5218c8b2c5ef9d9f86ff57d80382d8bee69cfac25748212f
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,367 @@
1
+ # Omakase Ruby styling for Rails
2
+ # inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3
+
4
+ # Overwrite or add rules to create your own house style
5
+ #
6
+ # # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7
+ # Layout/SpaceInsideArrayLiteralBrackets:
8
+ # Enabled: false
9
+ plugins:
10
+ - rubocop-rspec
11
+
12
+ AllCops:
13
+ TargetRubyVersion: 3.4
14
+ SuggestExtensions: false
15
+ NewCops: enable
16
+
17
+ Exclude:
18
+ - 'examples/**/*'
19
+ - 'vendor/**/*'
20
+
21
+ Capybara/RSpec/PredicateMatcher:
22
+ Enabled: false
23
+
24
+ Gemspec/AddRuntimeDependency: # new in 1.65
25
+ Enabled: true
26
+ Gemspec/DeprecatedAttributeAssignment: # new in 1.30
27
+ Enabled: true
28
+ Gemspec/DevelopmentDependencies: # new in 1.44
29
+ Enabled: true
30
+ Gemspec/RequireMFA: # new in 1.23
31
+ Enabled: true
32
+ Layout/LineContinuationLeadingSpace: # new in 1.31
33
+ Enabled: true
34
+ Layout/LineContinuationSpacing: # new in 1.31
35
+ Enabled: true
36
+ Layout/LineEndStringConcatenationIndentation: # new in 1.18
37
+ Enabled: true
38
+ Layout/SpaceBeforeBrackets: # new in 1.7
39
+ Enabled: true
40
+ Lint/AmbiguousAssignment: # new in 1.7
41
+ Enabled: true
42
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
43
+ Enabled: true
44
+ Lint/AmbiguousRange: # new in 1.19
45
+ Enabled: true
46
+ Lint/ConstantOverwrittenInRescue: # new in 1.31
47
+ Enabled: true
48
+ Lint/DeprecatedConstants: # new in 1.8
49
+ Enabled: true
50
+ Lint/DuplicateBranch: # new in 1.3
51
+ Enabled: true
52
+ Lint/DuplicateMagicComment: # new in 1.37
53
+ Enabled: true
54
+ Lint/DuplicateMatchPattern: # new in 1.50
55
+ Enabled: true
56
+ Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
57
+ Enabled: true
58
+ Lint/EmptyBlock: # new in 1.1
59
+ Enabled: true
60
+ Lint/EmptyClass: # new in 1.3
61
+ Enabled: true
62
+ Lint/EmptyInPattern: # new in 1.16
63
+ Enabled: true
64
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
65
+ Enabled: true
66
+ Lint/ItWithoutArgumentsInBlock: # new in 1.59
67
+ Enabled: true
68
+ Lint/LambdaWithoutLiteralBlock: # new in 1.8
69
+ Enabled: true
70
+ Lint/LiteralAssignmentInCondition: # new in 1.58
71
+ Enabled: true
72
+ Lint/MixedCaseRange: # new in 1.53
73
+ Enabled: true
74
+ Lint/NoReturnInBeginEndBlocks: # new in 1.2
75
+ Enabled: true
76
+ Lint/NonAtomicFileOperation: # new in 1.31
77
+ Enabled: true
78
+ Lint/NumberedParameterAssignment: # new in 1.9
79
+ Enabled: true
80
+ Lint/OrAssignmentToConstant: # new in 1.9
81
+ Enabled: true
82
+ Lint/RedundantDirGlobSort: # new in 1.8
83
+ Enabled: true
84
+ Lint/RedundantRegexpQuantifiers: # new in 1.53
85
+ Enabled: true
86
+ Lint/RefinementImportMethods: # new in 1.27
87
+ Enabled: true
88
+ Lint/RequireRangeParentheses: # new in 1.32
89
+ Enabled: true
90
+ Lint/RequireRelativeSelfPath: # new in 1.22
91
+ Enabled: true
92
+ Lint/SymbolConversion: # new in 1.9
93
+ Enabled: true
94
+ Lint/ToEnumArguments: # new in 1.1
95
+ Enabled: true
96
+ Lint/TripleQuotes: # new in 1.9
97
+ Enabled: true
98
+ Lint/UnexpectedBlockArity: # new in 1.5
99
+ Enabled: true
100
+ Lint/UnmodifiedReduceAccumulator: # new in 1.1
101
+ Enabled: true
102
+ Lint/UselessNumericOperation: # new in 1.66
103
+ Enabled: true
104
+ Lint/UselessRescue: # new in 1.43
105
+ Enabled: true
106
+ Lint/UselessRuby2Keywords: # new in 1.23
107
+ Enabled: true
108
+ Metrics/CollectionLiteralLength: # new in 1.47
109
+ Enabled: true
110
+ Naming/BlockForwarding: # new in 1.24
111
+ Enabled: true
112
+ Security/CompoundHash: # new in 1.28
113
+ Enabled: true
114
+ Security/IoMethods: # new in 1.22
115
+ Enabled: true
116
+ Style/ArgumentsForwarding: # new in 1.1
117
+ Enabled: true
118
+ Style/ArrayIntersect: # new in 1.40
119
+ Enabled: true
120
+ Style/CollectionCompact: # new in 1.2
121
+ Enabled: true
122
+ Style/ComparableClamp: # new in 1.44
123
+ Enabled: true
124
+ Style/ConcatArrayLiterals: # new in 1.41
125
+ Enabled: true
126
+ Style/DataInheritance: # new in 1.49
127
+ Enabled: true
128
+ Style/DirEmpty: # new in 1.48
129
+ Enabled: true
130
+ Style/DocumentDynamicEvalDefinition: # new in 1.1
131
+ Enabled: true
132
+ Style/EmptyHeredoc: # new in 1.32
133
+ Enabled: true
134
+ Style/EndlessMethod: # new in 1.8
135
+ Enabled: true
136
+ Style/EnvHome: # new in 1.29
137
+ Enabled: true
138
+ Style/ExactRegexpMatch: # new in 1.51
139
+ Enabled: true
140
+ Style/FetchEnvVar: # new in 1.28
141
+ Enabled: true
142
+ Style/FileEmpty: # new in 1.48
143
+ Enabled: true
144
+ Style/FileRead: # new in 1.24
145
+ Enabled: true
146
+ Style/FileWrite: # new in 1.24
147
+ Enabled: true
148
+ Style/HashConversion: # new in 1.10
149
+ Enabled: true
150
+ Style/HashExcept: # new in 1.7
151
+ Enabled: true
152
+ Style/IfWithBooleanLiteralBranches: # new in 1.9
153
+ Enabled: true
154
+ Style/InPatternThen: # new in 1.16
155
+ Enabled: true
156
+ Style/MagicCommentFormat: # new in 1.35
157
+ Enabled: true
158
+ Style/MapCompactWithConditionalBlock: # new in 1.30
159
+ Enabled: true
160
+ Style/MapIntoArray: # new in 1.63
161
+ Enabled: true
162
+ Style/MapToHash: # new in 1.24
163
+ Enabled: true
164
+ Style/MapToSet: # new in 1.42
165
+ Enabled: true
166
+ Style/MinMaxComparison: # new in 1.42
167
+ Enabled: true
168
+ Style/MultilineInPatternThen: # new in 1.16
169
+ Enabled: true
170
+ Style/NegatedIfElseCondition: # new in 1.2
171
+ Enabled: true
172
+ Style/NestedFileDirname: # new in 1.26
173
+ Enabled: true
174
+ Style/NilLambda: # new in 1.3
175
+ Enabled: true
176
+ Style/NumberedParameters: # new in 1.22
177
+ Enabled: true
178
+ Style/NumberedParametersLimit: # new in 1.22
179
+ Enabled: true
180
+ Style/ObjectThen: # new in 1.28
181
+ Enabled: true
182
+ Style/OperatorMethodCall: # new in 1.37
183
+ Enabled: true
184
+ Style/QuotedSymbols: # new in 1.16
185
+ Enabled: true
186
+ Style/RedundantArgument: # new in 1.4
187
+ Enabled: true
188
+ Style/RedundantArrayConstructor: # new in 1.52
189
+ Enabled: true
190
+ Style/RedundantConstantBase: # new in 1.40
191
+ Enabled: true
192
+ Style/RedundantCurrentDirectoryInPath: # new in 1.53
193
+ Enabled: true
194
+ Style/RedundantDoubleSplatHashBraces: # new in 1.41
195
+ Enabled: true
196
+ Style/RedundantEach: # new in 1.38
197
+ Enabled: true
198
+ Style/RedundantFilterChain: # new in 1.52
199
+ Enabled: true
200
+ Style/RedundantHeredocDelimiterQuotes: # new in 1.45
201
+ Enabled: true
202
+ Style/RedundantInitialize: # new in 1.27
203
+ Enabled: true
204
+ Style/RedundantInterpolationUnfreeze: # new in 1.66
205
+ Enabled: true
206
+ Style/RedundantLineContinuation: # new in 1.49
207
+ Enabled: true
208
+ Style/RedundantRegexpArgument: # new in 1.53
209
+ Enabled: true
210
+ Style/RedundantRegexpConstructor: # new in 1.52
211
+ Enabled: true
212
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
213
+ Enabled: true
214
+ Style/RedundantStringEscape: # new in 1.37
215
+ Enabled: true
216
+ Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
217
+ Enabled: true
218
+ Style/SelectByRegexp: # new in 1.22
219
+ Enabled: true
220
+ Style/SendWithLiteralMethodName: # new in 1.64
221
+ Enabled: true
222
+ Style/SingleLineDoEndBlock: # new in 1.57
223
+ Enabled: true
224
+ Style/StringChars: # new in 1.12
225
+ Enabled: true
226
+ Style/SuperArguments: # new in 1.64
227
+ Enabled: true
228
+ Style/SuperWithArgsParentheses: # new in 1.58
229
+ Enabled: true
230
+ Style/SwapValues: # new in 1.1
231
+ Enabled: true
232
+ Style/YAMLFileRead: # new in 1.53
233
+ Enabled: true
234
+ Lint/DuplicateSetElement: # new in 1.67
235
+ Enabled: true
236
+ Lint/UnescapedBracketInRegexp: # new in 1.68
237
+ Enabled: true
238
+ Style/AmbiguousEndlessMethodDefinition: # new in 1.68
239
+ Enabled: true
240
+ Style/BitwisePredicate: # new in 1.68
241
+ Enabled: true
242
+ Style/CombinableDefined: # new in 1.68
243
+ Enabled: true
244
+ Style/KeywordArgumentsMerging: # new in 1.68
245
+ Enabled: true
246
+ Style/SafeNavigationChainLength: # new in 1.68
247
+ Enabled: true
248
+ Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
249
+ Enabled: true
250
+ Lint/NumericOperationWithConstantResult: # new in 1.69
251
+ Enabled: true
252
+ Lint/UselessDefined: # new in 1.69
253
+ Enabled: true
254
+ Style/DigChain: # new in 1.69
255
+ Enabled: true
256
+ Style/FileNull: # new in 1.69
257
+ Enabled: true
258
+ Style/FileTouch: # new in 1.69
259
+ Enabled: true
260
+ Lint/ConstantReassignment: # new in 1.70
261
+ Enabled: true
262
+ Lint/SharedMutableDefault: # new in 1.70
263
+ Enabled: true
264
+ Style/ItAssignment: # new in 1.70
265
+ Enabled: true
266
+ Lint/ArrayLiteralInRegexp: # new in 1.71
267
+ Enabled: true
268
+ Style/HashSlice: # new in 1.71
269
+ Enabled: true
270
+ Lint/CopDirectiveSyntax: # new in 1.72
271
+ Enabled: true
272
+ Lint/RedundantTypeConversion: # new in 1.72
273
+ Enabled: true
274
+ Lint/SuppressedExceptionInNumberConversion: # new in 1.72
275
+ Enabled: true
276
+ Lint/UselessConstantScoping: # new in 1.72
277
+ Enabled: true
278
+ Style/RedundantFormat: # new in 1.72
279
+ Enabled: true
280
+ Style/ComparableBetween: # new in 1.74
281
+ Enabled: true
282
+ Style/HashFetchChain: # new in 1.75
283
+ Enabled: true
284
+ Style/ItBlockParameter: # new in 1.75
285
+ Enabled: true
286
+ Lint/UselessDefaultValueArgument: # new in 1.76
287
+ Enabled: true
288
+ Lint/UselessOr: # new in 1.76
289
+ Enabled: true
290
+ Naming/PredicateMethod: # new in 1.76
291
+ Enabled: true
292
+ Style/EmptyStringInsideInterpolation: # new in 1.76
293
+ Enabled: true
294
+ Style/RedundantArrayFlatten: # new in 1.76
295
+ Enabled: true
296
+ Gemspec/AttributeAssignment: # new in 1.77
297
+ Enabled: true
298
+ Style/CollectionQuerying: # new in 1.77
299
+ Enabled: true
300
+ Layout/EmptyLinesAfterModuleInclusion: # new in 1.79
301
+ Enabled: true
302
+ Style/OpenStructUse: # new in 1.23
303
+ Enabled: true
304
+ # RSpecRails cops have been moved to a separate gem
305
+ # If you need Rails-specific RSpec cops, add rubocop-rspec_rails to your Gemfile
306
+ RSpec/BeEmpty: # new in 2.20
307
+ Enabled: true
308
+ RSpec/BeEq: # new in 2.9.0
309
+ Enabled: true
310
+ RSpec/BeNil: # new in 2.9.0
311
+ Enabled: true
312
+ RSpec/ChangeByZero: # new in 2.11
313
+ Enabled: true
314
+ RSpec/ContainExactly: # new in 2.19
315
+ Enabled: true
316
+ RSpec/DuplicatedMetadata: # new in 2.16
317
+ Enabled: true
318
+ RSpec/EmptyMetadata: # new in 2.24
319
+ Enabled: true
320
+ RSpec/EmptyOutput: # new in 2.29
321
+ Enabled: true
322
+ RSpec/Eq: # new in 2.24
323
+ Enabled: true
324
+ RSpec/ExcessiveDocstringSpacing: # new in 2.5
325
+ Enabled: true
326
+ RSpec/ExpectInLet: # new in 2.30
327
+ Enabled: true
328
+ RSpec/IdenticalEqualityAssertion: # new in 2.4
329
+ Enabled: true
330
+ RSpec/IndexedLet: # new in 2.20
331
+ Enabled: true
332
+ RSpec/IsExpectedSpecify: # new in 2.27
333
+ Enabled: true
334
+ RSpec/MatchArray: # new in 2.19
335
+ Enabled: true
336
+ RSpec/MetadataStyle: # new in 2.24
337
+ Enabled: true
338
+ RSpec/NoExpectationExample: # new in 2.13
339
+ Enabled: true
340
+ RSpec/PendingWithoutReason: # new in 2.16
341
+ Enabled: true
342
+ RSpec/ReceiveMessages: # new in 2.23
343
+ Enabled: true
344
+ RSpec/RedundantAround: # new in 2.19
345
+ Enabled: true
346
+ RSpec/RedundantPredicateMatcher: # new in 2.26
347
+ Enabled: true
348
+ RSpec/RemoveConst: # new in 2.26
349
+ Enabled: true
350
+ RSpec/RepeatedSubjectCall: # new in 2.27
351
+ Enabled: true
352
+ RSpec/SkipBlockInsideExample: # new in 2.19
353
+ Enabled: true
354
+ RSpec/SortMetadata: # new in 2.14
355
+ Enabled: true
356
+ RSpec/SpecFilePathFormat: # new in 2.24
357
+ Enabled: false
358
+ RSpec/SpecFilePathSuffix: # new in 2.24
359
+ Enabled: true
360
+ RSpec/SubjectDeclaration: # new in 2.5
361
+ Enabled: true
362
+ RSpec/UndescriptiveLiteralsDescription: # new in 2.29
363
+ Enabled: true
364
+ RSpec/VerifiedDoubleReference: # new in 2.10.0
365
+ Enabled: true
366
+ # Capybara and FactoryBot cops have been moved to separate gems
367
+ # If you need them, add rubocop-capybara and rubocop-factory_bot to your Gemfile
data/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.0.1.beta4] - 2025-08-01
9
+
10
+ ### Fixed
11
+ - Correct version constant namespace in release workflow
12
+
13
+ ## [0.0.1.beta3] - 2025-08-01
14
+
15
+ ### Fixed
16
+ - Corrected version file path in release workflow
17
+
18
+ ## [0.0.1.beta2] - 2025-08-01
19
+
20
+ ### Added
21
+ - GitHub Actions workflows for CI/CD
22
+
23
+ ### Changed
24
+ - Initial implementation improvements and refinements
25
+
26
+ ## [0.0.1.beta1] - 2025-07-29
27
+
28
+ ### Added
29
+ - Initial release of Soka Rails
30
+ - Rails integration with automatic loading of agents and tools from `app/soka`
31
+ - Configuration system with DSL support
32
+ - ApplicationAgent base class with Rails hooks integration
33
+ - ApplicationTool base class with helper methods
34
+ - RailsInfoTool for querying Rails application information
35
+ - Rails generators:
36
+ - `soka:install` - Initial setup generator
37
+ - `soka:agent` - Agent generator
38
+ - `soka:tool` - Tool generator
39
+ - RSpec test helpers and integration
40
+ - Comprehensive error handling
41
+ - Full documentation and examples
data/CLAUDE.md ADDED
@@ -0,0 +1,243 @@
1
+ # Soka Rails - Rails Integration for Soka AI Agent Framework
2
+
3
+ ## Project Overview
4
+
5
+ Soka Rails is a Ruby on Rails integration package for the Soka AI Agent Framework. It provides seamless integration between Soka's ReAct-based AI agents and Rails applications, following Rails conventions and best practices for easy adoption by Rails developers.
6
+
7
+ ## Core Architecture
8
+
9
+ ### Directory Structure
10
+ ```
11
+ soka-rails/
12
+ ├── app/
13
+ │ └── soka/
14
+ │ ├── agents/
15
+ │ │ └── application_agent.rb # Rails-specific base agent class
16
+ │ └── tools/
17
+ │ ├── application_tool.rb # Rails-specific base tool class
18
+ │ └── rails_info_tool.rb # Built-in Rails info tool
19
+ ├── lib/
20
+ │ ├── soka_rails.rb # Main entry point
21
+ │ ├── soka/
22
+ │ │ └── rails/
23
+ │ │ ├── configuration.rb # Rails-specific configuration
24
+ │ │ ├── errors.rb # Rails-specific error classes
25
+ │ │ ├── railtie.rb # Rails integration engine
26
+ │ │ ├── rspec.rb # RSpec test helpers
27
+ │ │ ├── test_helpers.rb # Testing utilities
28
+ │ │ └── version.rb # Version information
29
+ │ └── generators/
30
+ │ └── soka/
31
+ │ ├── install/ # Install generator
32
+ │ │ ├── install_generator.rb
33
+ │ │ └── templates/
34
+ │ │ ├── application_agent.rb
35
+ │ │ ├── application_tool.rb
36
+ │ │ ├── rails_info_tool.rb
37
+ │ │ └── soka.rb # Initializer template
38
+ │ ├── agent/ # Agent generator
39
+ │ │ ├── agent_generator.rb
40
+ │ │ └── templates/
41
+ │ │ ├── agent.rb.tt
42
+ │ │ └── agent_spec.rb.tt
43
+ │ └── tool/ # Tool generator
44
+ │ ├── tool_generator.rb
45
+ │ └── templates/
46
+ │ ├── tool.rb.tt
47
+ │ └── tool_spec.rb.tt
48
+ ├── spec/ # Test suite
49
+ └── soka-rails.gemspec # Gem specification
50
+ ```
51
+
52
+ ## Core Component Descriptions
53
+
54
+ ### 1. Rails Integration (`lib/soka/rails/railtie.rb`)
55
+ - Integrates with Rails autoloading system
56
+ - Adds `app/soka` to Rails autoload paths
57
+ - Configures Rails-specific logging and error handling
58
+ - Manages Rails lifecycle hooks
59
+
60
+ ### 2. ApplicationAgent (`app/soka/agents/application_agent.rb`)
61
+ - Inherits from `Soka::Agent`
62
+ - Provides Rails-specific defaults and configurations
63
+ - Integrates with Rails error tracking (Rollbar, Sentry, etc.)
64
+ - Supports Rails logging system
65
+ - Includes Rails-specific lifecycle hooks
66
+
67
+ ### 3. ApplicationTool (`app/soka/tools/application_tool.rb`)
68
+ - Inherits from `Soka::AgentTool`
69
+ - Provides Rails-specific helper methods
70
+ - Standardized error handling for Rails applications
71
+ - Integration with Rails I18n for messages
72
+
73
+ ### 4. RailsInfoTool (`app/soka/tools/rails_info_tool.rb`)
74
+ - Built-in tool for accessing Rails application information
75
+ - Supports querying:
76
+ - Routes information
77
+ - Rails and Ruby versions
78
+ - Environment details
79
+ - Safe configuration values
80
+ - Security-conscious implementation (no sensitive data exposure)
81
+
82
+ ### 5. Configuration System (`lib/soka/rails/configuration.rb`)
83
+ - Rails-style configuration using initializers
84
+ - Environment-specific configurations
85
+ - Supports `Rails.env` based settings
86
+ - ENV variable management with `ENV.fetch`
87
+
88
+ ### 6. Generators
89
+ - **Install Generator**: Sets up initial structure
90
+ - **Agent Generator**: Creates new agent classes with Rails conventions
91
+ - **Tool Generator**: Creates new tool classes with parameter definitions
92
+ - All generators follow Rails naming conventions and file structure
93
+
94
+ ## Design Decisions
95
+
96
+ ### 1. Following Rails Conventions
97
+ - Uses `app/soka` directory for application-specific code
98
+ - Follows Rails naming conventions (e.g., `CustomerSupportAgent`)
99
+ - Integrates with Rails autoloading via Zeitwerk
100
+ - Uses Rails generators for scaffolding
101
+
102
+ ### 2. Rails-Specific Features
103
+ - Session-based memory storage
104
+ - Integration with Rails authentication systems
105
+ - Support for ActionController::Live streaming
106
+ - Rails error tracking integration
107
+
108
+ ### 3. Configuration Philosophy
109
+ - Environment-based configuration (development, test, production)
110
+ - Uses Rails initializer pattern
111
+ - Supports Rails credentials for API keys
112
+ - Follows 12-factor app principles
113
+
114
+ ### 4. Testing Integration
115
+ - Full RSpec integration with custom matchers
116
+ - Test helpers for mocking AI responses
117
+ - Support for Rails test fixtures
118
+ - Integration with Rails testing conventions
119
+
120
+ ## Testing Strategy
121
+
122
+ ### RSpec Integration
123
+ - Custom RSpec configuration in `lib/soka/rails/rspec.rb`
124
+ - Test helpers for agent and tool testing
125
+ - Mock AI response capabilities
126
+ - Support for Rails-specific testing patterns
127
+
128
+ ### Test Coverage
129
+ - Unit tests for all components
130
+ - Integration tests with Rails applications
131
+ - Generator tests
132
+ - Performance tests for async operations
133
+
134
+ ## Development Guide
135
+
136
+ ### Adding New Agents
137
+ 1. Use generator: `rails generate soka:agent agent_name`
138
+ 2. Inherit from `ApplicationAgent`
139
+ 3. Register required tools
140
+ 4. Configure AI settings if needed
141
+ 5. Implement Rails-specific hooks
142
+
143
+ ### Adding New Tools
144
+ 1. Use generator: `rails generate soka:tool tool_name [param:type ...]`
145
+ - Example: `rails generate soka:tool weather_api location:string units:string`
146
+ 2. Inherit from `ApplicationTool`
147
+ 3. Define parameters using DSL (auto-generated if params provided)
148
+ 4. Implement `call` method
149
+ 5. Handle Rails-specific concerns (ActiveRecord, etc.)
150
+
151
+ ### Rails Integration Points
152
+ - **Controllers**: Direct agent usage in actions
153
+ - **Background Jobs**: Agent usage in ActiveJob
154
+ - **ActionCable**: Real-time agent interactions
155
+ - **ViewComponents**: Agent-powered components
156
+
157
+ ## Rails-Specific Considerations
158
+
159
+ ### Performance
160
+ - Non-blocking execution in controllers
161
+ - Background job integration for long-running tasks
162
+ - Connection pooling for AI providers
163
+ - Rails cache integration for responses
164
+
165
+ ### Security
166
+ - API keys in Rails credentials
167
+ - CSRF protection for agent endpoints
168
+ - Authentication integration
169
+ - Rate limiting support
170
+
171
+ ### Monitoring
172
+ - Rails logger integration
173
+ - Performance monitoring (NewRelic, DataDog)
174
+ - Error tracking (Rollbar, Sentry)
175
+ - Custom Rails instrumentation
176
+
177
+ ## Development Standards
178
+
179
+ ### Code Quality
180
+ - **Run RuboCop before committing code**
181
+ - **Follow Rails best practices and conventions**
182
+ - **Ensure all tests pass before merging**
183
+ - **Maintain high test coverage (>90%)**
184
+
185
+ ### Documentation
186
+ - **Use YARD format for method documentation**
187
+ - **Include usage examples in comments**
188
+ - **Document Rails-specific behaviors**
189
+ - **Keep README and guides updated**
190
+
191
+ ### Rails Compatibility
192
+ - Supports Rails 7.0+
193
+ - Ruby 3.4+ required
194
+ - Compatible with major Rails gems
195
+ - Follows Rails upgrade guides
196
+
197
+ ## Future Enhancements
198
+ - [ ] ActiveRecord integration for agent/tool persistence
199
+ - [ ] ActionMailer integration for AI-powered emails
200
+ - [ ] ViewComponent integration for AI-powered components
201
+ - [ ] Hotwire/Turbo integration for real-time updates
202
+ - [ ] Rails Admin interface for agent management
203
+ - [ ] GraphQL integration for agent APIs
204
+
205
+ ## Dependencies
206
+ - Rails >= 7.0
207
+ - Soka >= 0.0.1
208
+ - Ruby >= 3.4
209
+ - Zeitwerk for autoloading
210
+
211
+ ## Common Patterns
212
+
213
+ ### Controller Usage
214
+ ```ruby
215
+ class ConversationsController < ApplicationController
216
+ def create
217
+ agent = CustomerSupportAgent.new
218
+ result = agent.run(params[:message])
219
+ render json: { answer: result.final_answer }
220
+ end
221
+ end
222
+ ```
223
+
224
+ ### Background Job Usage
225
+ ```ruby
226
+ class AgentJob < ApplicationJob
227
+ def perform(message)
228
+ agent = ProcessingAgent.new
229
+ agent.run(message)
230
+ end
231
+ end
232
+ ```
233
+
234
+ ### Testing Pattern
235
+ ```ruby
236
+ RSpec.describe WeatherAgent, type: :agent do
237
+ it "responds to weather queries" do
238
+ mock_ai_response(final_answer: "Sunny, 25°C")
239
+ result = agent.run("What's the weather?")
240
+ expect(result).to be_successful
241
+ end
242
+ end
243
+ ```