rails_ai 0.1.0

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.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec_status +96 -0
  3. data/AGENT_GUIDE.md +513 -0
  4. data/Appraisals +49 -0
  5. data/COMMERCIAL_LICENSE_TEMPLATE.md +92 -0
  6. data/FEATURES.md +204 -0
  7. data/LEGAL_PROTECTION_GUIDE.md +222 -0
  8. data/LICENSE +62 -0
  9. data/LICENSE_SUMMARY.md +74 -0
  10. data/MIT-LICENSE +62 -0
  11. data/PERFORMANCE.md +300 -0
  12. data/PROVIDERS.md +495 -0
  13. data/README.md +454 -0
  14. data/Rakefile +11 -0
  15. data/SPEED_OPTIMIZATIONS.md +217 -0
  16. data/STRUCTURE.md +139 -0
  17. data/USAGE_GUIDE.md +288 -0
  18. data/app/channels/ai_stream_channel.rb +33 -0
  19. data/app/components/ai/prompt_component.rb +25 -0
  20. data/app/controllers/concerns/ai/context_aware.rb +77 -0
  21. data/app/controllers/concerns/ai/streaming.rb +41 -0
  22. data/app/helpers/ai_helper.rb +164 -0
  23. data/app/jobs/ai/generate_embedding_job.rb +25 -0
  24. data/app/jobs/ai/generate_summary_job.rb +25 -0
  25. data/app/models/concerns/ai/embeddable.rb +38 -0
  26. data/app/views/rails_ai/dashboard/index.html.erb +51 -0
  27. data/config/routes.rb +19 -0
  28. data/lib/generators/rails_ai/install/install_generator.rb +38 -0
  29. data/lib/rails_ai/agents/agent_manager.rb +258 -0
  30. data/lib/rails_ai/agents/agent_team.rb +243 -0
  31. data/lib/rails_ai/agents/base_agent.rb +331 -0
  32. data/lib/rails_ai/agents/collaboration.rb +238 -0
  33. data/lib/rails_ai/agents/memory.rb +116 -0
  34. data/lib/rails_ai/agents/message_bus.rb +95 -0
  35. data/lib/rails_ai/agents/specialized_agents.rb +391 -0
  36. data/lib/rails_ai/agents/task_queue.rb +111 -0
  37. data/lib/rails_ai/cache.rb +14 -0
  38. data/lib/rails_ai/config.rb +40 -0
  39. data/lib/rails_ai/context.rb +7 -0
  40. data/lib/rails_ai/context_analyzer.rb +86 -0
  41. data/lib/rails_ai/engine.rb +48 -0
  42. data/lib/rails_ai/events.rb +9 -0
  43. data/lib/rails_ai/image_context.rb +110 -0
  44. data/lib/rails_ai/performance.rb +231 -0
  45. data/lib/rails_ai/provider.rb +8 -0
  46. data/lib/rails_ai/providers/anthropic_adapter.rb +256 -0
  47. data/lib/rails_ai/providers/base.rb +60 -0
  48. data/lib/rails_ai/providers/dummy_adapter.rb +29 -0
  49. data/lib/rails_ai/providers/gemini_adapter.rb +509 -0
  50. data/lib/rails_ai/providers/openai_adapter.rb +535 -0
  51. data/lib/rails_ai/providers/secure_anthropic_adapter.rb +206 -0
  52. data/lib/rails_ai/providers/secure_openai_adapter.rb +284 -0
  53. data/lib/rails_ai/railtie.rb +48 -0
  54. data/lib/rails_ai/redactor.rb +12 -0
  55. data/lib/rails_ai/security/api_key_manager.rb +82 -0
  56. data/lib/rails_ai/security/audit_logger.rb +46 -0
  57. data/lib/rails_ai/security/error_handler.rb +62 -0
  58. data/lib/rails_ai/security/input_validator.rb +176 -0
  59. data/lib/rails_ai/security/secure_file_handler.rb +45 -0
  60. data/lib/rails_ai/security/secure_http_client.rb +177 -0
  61. data/lib/rails_ai/security.rb +0 -0
  62. data/lib/rails_ai/version.rb +5 -0
  63. data/lib/rails_ai/window_context.rb +103 -0
  64. data/lib/rails_ai.rb +502 -0
  65. data/monitoring/ci_setup_guide.md +214 -0
  66. data/monitoring/enhanced_monitoring_script.rb +237 -0
  67. data/monitoring/google_alerts_setup.md +42 -0
  68. data/monitoring_log_20250921.txt +0 -0
  69. data/monitoring_script.rb +161 -0
  70. data/rails_ai.gemspec +54 -0
  71. data/scripts/security_scanner.rb +353 -0
  72. data/setup_monitoring.sh +163 -0
  73. data/wiki/API-Documentation.md +734 -0
  74. data/wiki/Architecture-Overview.md +672 -0
  75. data/wiki/Contributing-Guide.md +407 -0
  76. data/wiki/Development-Setup.md +532 -0
  77. data/wiki/Home.md +278 -0
  78. data/wiki/Installation-Guide.md +527 -0
  79. data/wiki/Quick-Start.md +186 -0
  80. data/wiki/README.md +135 -0
  81. data/wiki/Release-Process.md +467 -0
  82. metadata +385 -0
data/wiki/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # Rails AI Wiki
2
+
3
+ Welcome to the Rails AI documentation wiki! This comprehensive guide will help you understand, use, and contribute to Rails AI.
4
+
5
+ ## 📚 Complete Wiki Pages
6
+
7
+ ### **Getting Started**
8
+ - [Home](Home.md) - Welcome and overview
9
+ - [Installation Guide](Installation-Guide.md) - Complete installation instructions
10
+ - [Quick Start](Quick-Start.md) - Get up and running in 5 minutes
11
+
12
+ ### **Development**
13
+ - [Contributing Guide](Contributing-Guide.md) - How to contribute to the project
14
+ - [Development Setup](Development-Setup.md) - Set up your development environment
15
+ - [Code Style](Code-Style.md) - Coding standards and conventions
16
+ - [Release Process](Release-Process.md) - How we release new versions
17
+
18
+ ### **Architecture & API**
19
+ - [Architecture Overview](Architecture-Overview.md) - System architecture and design
20
+ - [API Documentation](API-Documentation.md) - Complete API reference
21
+
22
+ ## 🚀 Quick Links
23
+
24
+ - **GitHub Repository**: [rails_ai](https://github.com/yourusername/rails_ai)
25
+ - **Issue Tracker**: [GitHub Issues](https://github.com/yourusername/rails_ai/issues)
26
+ - **Discussions**: [GitHub Discussions](https://github.com/yourusername/rails_ai/discussions)
27
+ - **Main README**: [../README.md](../README.md)
28
+ - **Performance Guide**: [../PERFORMANCE.md](../PERFORMANCE.md)
29
+ - **Speed Optimizations**: [../SPEED_OPTIMIZATIONS.md](../SPEED_OPTIMIZATIONS.md)
30
+
31
+ ## 📖 What's in the Wiki
32
+
33
+ ### **For Users**
34
+ - Complete installation and setup guides
35
+ - Quick start tutorials
36
+ - API documentation with examples
37
+ - Configuration options
38
+ - Troubleshooting guides
39
+
40
+ ### **For Developers**
41
+ - Contributing guidelines
42
+ - Development environment setup
43
+ - Code style standards
44
+ - Architecture documentation
45
+ - Release process
46
+
47
+ ### **For Maintainers**
48
+ - Release management
49
+ - Security procedures
50
+ - Performance monitoring
51
+ - Community guidelines
52
+
53
+ ## 🎯 Wiki Structure
54
+
55
+ ```
56
+ wiki/
57
+ ├── Home.md # Main landing page
58
+ ├── Installation-Guide.md # Complete installation
59
+ ├── Quick-Start.md # 5-minute setup
60
+ ├── Contributing-Guide.md # How to contribute
61
+ ├── Development-Setup.md # Dev environment
62
+ ├── Code-Style.md # Coding standards
63
+ ├── Architecture-Overview.md # System architecture
64
+ ├── API-Documentation.md # Complete API reference
65
+ └── Release-Process.md # Release management
66
+ ```
67
+
68
+ ## 🤝 Contributing to the Wiki
69
+
70
+ ### Adding New Pages
71
+
72
+ 1. Create new `.md` file in `wiki/` directory
73
+ 2. Follow existing naming conventions
74
+ 3. Add to this README's table of contents
75
+ 4. Update `Home.md` if needed
76
+ 5. Submit pull request
77
+
78
+ ### Updating Existing Pages
79
+
80
+ 1. Edit the relevant `.md` file
81
+ 2. Follow the established format
82
+ 3. Update any cross-references
83
+ 4. Submit pull request
84
+
85
+ ### Wiki Standards
86
+
87
+ - Use clear, descriptive titles
88
+ - Include table of contents for long pages
89
+ - Use consistent formatting
90
+ - Include code examples
91
+ - Add cross-references to related pages
92
+
93
+ ## 📝 Wiki Maintenance
94
+
95
+ ### Regular Updates
96
+
97
+ - Update installation guides for new Rails versions
98
+ - Add new API methods to documentation
99
+ - Update contributing guidelines as needed
100
+ - Keep release process current
101
+
102
+ ### Quality Checks
103
+
104
+ - Verify all code examples work
105
+ - Check all links are valid
106
+ - Ensure consistent formatting
107
+ - Review for clarity and completeness
108
+
109
+ ## 🔍 Finding Information
110
+
111
+ ### By Topic
112
+ - **Installation**: [Installation Guide](Installation-Guide.md)
113
+ - **Quick Start**: [Quick Start](Quick-Start.md)
114
+ - **API Reference**: [API Documentation](API-Documentation.md)
115
+ - **Contributing**: [Contributing Guide](Contributing-Guide.md)
116
+ - **Architecture**: [Architecture Overview](Architecture-Overview.md)
117
+
118
+ ### By Audience
119
+ - **New Users**: Start with [Quick Start](Quick-Start.md)
120
+ - **Developers**: See [Development Setup](Development-Setup.md)
121
+ - **Contributors**: Read [Contributing Guide](Contributing-Guide.md)
122
+ - **Maintainers**: Check [Release Process](Release-Process.md)
123
+
124
+ ## 📞 Getting Help
125
+
126
+ - **Documentation Issues**: Open a GitHub issue
127
+ - **Missing Information**: Request in discussions
128
+ - **Wiki Improvements**: Submit a pull request
129
+ - **General Questions**: Use GitHub discussions
130
+
131
+ ---
132
+
133
+ **The Rails AI Wiki is your comprehensive guide to everything Rails AI!** 🚀
134
+
135
+ *Last updated: September 2024*
@@ -0,0 +1,467 @@
1
+ # Release Process
2
+
3
+ This document outlines the process for releasing new versions of Rails AI.
4
+
5
+ ## 🏷️ Version Numbering
6
+
7
+ We follow [Semantic Versioning](https://semver.org/):
8
+
9
+ - **MAJOR** (1.0.0): Breaking changes, major features
10
+ - **MINOR** (0.2.0): New features, backward compatible
11
+ - **PATCH** (0.1.1): Bug fixes, minor improvements
12
+
13
+ ### Version Examples
14
+
15
+ ```
16
+ 0.1.0 - Initial release
17
+ 0.1.1 - Bug fixes
18
+ 0.1.2 - Security patches
19
+ 0.2.0 - New features (backward compatible)
20
+ 0.2.1 - Bug fixes for 0.2.0
21
+ 1.0.0 - Major release with breaking changes
22
+ 1.0.1 - Bug fixes for 1.0.0
23
+ ```
24
+
25
+ ## 🚀 Release Checklist
26
+
27
+ ### Pre-Release
28
+
29
+ - [ ] All tests pass
30
+ - [ ] Code follows style guidelines
31
+ - [ ] Documentation is updated
32
+ - [ ] CHANGELOG.md is updated
33
+ - [ ] Version is bumped
34
+ - [ ] Breaking changes are documented
35
+ - [ ] Migration guide is created (if needed)
36
+
37
+ ### Release
38
+
39
+ - [ ] Tag is created
40
+ - [ ] Gem is built
41
+ - [ ] Gem is pushed to RubyGems
42
+ - [ ] GitHub release is created
43
+ - [ ] Announcement is posted
44
+
45
+ ### Post-Release
46
+
47
+ - [ ] Monitor for issues
48
+ - [ ] Update documentation
49
+ - [ ] Respond to feedback
50
+ - [ ] Plan next release
51
+
52
+ ## 📝 Release Steps
53
+
54
+ ### 1. Update Version
55
+
56
+ ```ruby
57
+ # lib/rails_ai/version.rb
58
+ module RailsAi
59
+ VERSION = "0.1.1"
60
+ end
61
+ ```
62
+
63
+ ### 2. Update CHANGELOG
64
+
65
+ ```markdown
66
+ # CHANGELOG.md
67
+
68
+ ## [0.1.1] - 2024-01-15
69
+
70
+ ### Added
71
+ - New feature X
72
+ - New feature Y
73
+
74
+ ### Changed
75
+ - Improved performance of Z
76
+ - Updated documentation
77
+
78
+ ### Fixed
79
+ - Bug fix A
80
+ - Bug fix B
81
+
82
+ ### Security
83
+ - Security fix C
84
+ ```
85
+
86
+ ### 3. Run Tests
87
+
88
+ ```bash
89
+ # Run all tests
90
+ bundle exec rspec
91
+
92
+ # Run against all Rails versions
93
+ bundle exec appraisal rspec
94
+
95
+ # Run linter
96
+ bundle exec standardrb
97
+
98
+ # Run security audit
99
+ bundle audit
100
+ ```
101
+
102
+ ### 4. Build Gem
103
+
104
+ ```bash
105
+ # Build the gem
106
+ gem build rails_ai.gemspec
107
+
108
+ # Verify gem contents
109
+ gem contents rails_ai-0.1.1.gem
110
+ ```
111
+
112
+ ### 5. Test Gem
113
+
114
+ ```bash
115
+ # Install gem locally
116
+ gem install rails_ai-0.1.1.gem
117
+
118
+ # Test in new Rails app
119
+ rails new test_app
120
+ cd test_app
121
+ echo 'gem "rails_ai"' >> Gemfile
122
+ bundle install
123
+ rails generate rails_ai:install
124
+ ```
125
+
126
+ ### 6. Create Tag
127
+
128
+ ```bash
129
+ # Create and push tag
130
+ git tag -a v0.1.1 -m "Release version 0.1.1"
131
+ git push origin v0.1.1
132
+ ```
133
+
134
+ ### 7. Push to RubyGems
135
+
136
+ ```bash
137
+ # Push to RubyGems
138
+ gem push rails_ai-0.1.1.gem
139
+ ```
140
+
141
+ ### 8. Create GitHub Release
142
+
143
+ 1. Go to [GitHub Releases](https://github.com/yourusername/rails_ai/releases)
144
+ 2. Click "Create a new release"
145
+ 3. Select tag `v0.1.1`
146
+ 4. Add release title: "Rails AI 0.1.1"
147
+ 5. Add release notes from CHANGELOG
148
+ 6. Click "Publish release"
149
+
150
+ ## 🔄 Automated Release
151
+
152
+ ### GitHub Actions Workflow
153
+
154
+ ```yaml
155
+ # .github/workflows/release.yml
156
+ name: Release
157
+
158
+ on:
159
+ push:
160
+ tags:
161
+ - 'v*'
162
+
163
+ jobs:
164
+ release:
165
+ runs-on: ubuntu-latest
166
+
167
+ steps:
168
+ - uses: actions/checkout@v3
169
+
170
+ - name: Set up Ruby
171
+ uses: ruby/setup-ruby@v1
172
+ with:
173
+ ruby-version: 3.2
174
+
175
+ - name: Install dependencies
176
+ run: bundle install
177
+
178
+ - name: Run tests
179
+ run: bundle exec rspec
180
+
181
+ - name: Run linter
182
+ run: bundle exec standardrb
183
+
184
+ - name: Build gem
185
+ run: gem build rails_ai.gemspec
186
+
187
+ - name: Push to RubyGems
188
+ run: gem push rails_ai-*.gem
189
+ env:
190
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
191
+ ```
192
+
193
+ ### Release Script
194
+
195
+ ```bash
196
+ #!/bin/bash
197
+ # scripts/release.sh
198
+
199
+ set -e
200
+
201
+ VERSION=$1
202
+
203
+ if [ -z "$VERSION" ]; then
204
+ echo "Usage: $0 <version>"
205
+ echo "Example: $0 0.1.1"
206
+ exit 1
207
+ fi
208
+
209
+ echo "Releasing version $VERSION..."
210
+
211
+ # Update version
212
+ echo "Updating version to $VERSION..."
213
+ sed -i "s/VERSION = \".*\"/VERSION = \"$VERSION\"/" lib/rails_ai/version.rb
214
+
215
+ # Run tests
216
+ echo "Running tests..."
217
+ bundle exec rspec
218
+
219
+ # Run linter
220
+ echo "Running linter..."
221
+ bundle exec standardrb
222
+
223
+ # Build gem
224
+ echo "Building gem..."
225
+ gem build rails_ai.gemspec
226
+
227
+ # Create tag
228
+ echo "Creating tag v$VERSION..."
229
+ git add lib/rails_ai/version.rb
230
+ git commit -m "Bump version to $VERSION"
231
+ git tag -a "v$VERSION" -m "Release version $VERSION"
232
+
233
+ # Push changes
234
+ echo "Pushing changes..."
235
+ git push origin main
236
+ git push origin "v$VERSION"
237
+
238
+ # Push to RubyGems
239
+ echo "Pushing to RubyGems..."
240
+ gem push "rails_ai-$VERSION.gem"
241
+
242
+ echo "Release $VERSION completed!"
243
+ ```
244
+
245
+ ## 📋 Release Types
246
+
247
+ ### Patch Release (0.1.1)
248
+
249
+ **When to release:**
250
+ - Bug fixes
251
+ - Security patches
252
+ - Documentation updates
253
+ - Minor improvements
254
+
255
+ **Process:**
256
+ 1. Create bug fix branch
257
+ 2. Fix the issue
258
+ 3. Add test coverage
259
+ 4. Update CHANGELOG
260
+ 5. Bump patch version
261
+ 6. Create pull request
262
+ 7. Merge and release
263
+
264
+ ### Minor Release (0.2.0)
265
+
266
+ **When to release:**
267
+ - New features
268
+ - New providers
269
+ - Performance improvements
270
+ - New Rails version support
271
+
272
+ **Process:**
273
+ 1. Create feature branch
274
+ 2. Implement feature
275
+ 3. Add comprehensive tests
276
+ 4. Update documentation
277
+ 5. Update CHANGELOG
278
+ 6. Bump minor version
279
+ 7. Create pull request
280
+ 8. Merge and release
281
+
282
+ ### Major Release (1.0.0)
283
+
284
+ **When to release:**
285
+ - Breaking changes
286
+ - Major architecture changes
287
+ - API redesign
288
+ - Dropping support for old Rails versions
289
+
290
+ **Process:**
291
+ 1. Create major release branch
292
+ 2. Implement breaking changes
293
+ 3. Create migration guide
294
+ 4. Update all documentation
295
+ 5. Update CHANGELOG with breaking changes
296
+ 6. Bump major version
297
+ 7. Create pull request
298
+ 8. Merge and release
299
+ 9. Announce breaking changes
300
+
301
+ ## 🔒 Security Releases
302
+
303
+ ### Security Patch Process
304
+
305
+ 1. **Immediate Response**
306
+ - Create security branch
307
+ - Fix the vulnerability
308
+ - Add security tests
309
+ - Create patch release
310
+
311
+ 2. **Communication**
312
+ - Update security advisory
313
+ - Notify users via GitHub
314
+ - Post security notice
315
+
316
+ 3. **Follow-up**
317
+ - Monitor for issues
318
+ - Provide additional patches if needed
319
+ - Update security documentation
320
+
321
+ ### Security Release Example
322
+
323
+ ```markdown
324
+ # Security Release: 0.1.2
325
+
326
+ ## Security Fixes
327
+
328
+ - Fixed XSS vulnerability in image analysis
329
+ - Patched SQL injection in context handling
330
+ - Updated dependencies with security fixes
331
+
332
+ ## Impact
333
+
334
+ - All users should upgrade immediately
335
+ - No breaking changes
336
+ - Backward compatible
337
+
338
+ ## Upgrade
339
+
340
+ ```bash
341
+ bundle update rails_ai
342
+ ```
343
+ ```
344
+
345
+ ## 📊 Release Metrics
346
+
347
+ ### Tracking Metrics
348
+
349
+ - **Downloads**: Track gem downloads
350
+ - **Issues**: Monitor issue reports
351
+ - **Performance**: Track performance metrics
352
+ - **Adoption**: Monitor adoption rate
353
+
354
+ ### Release Success Criteria
355
+
356
+ - [ ] All tests pass
357
+ - [ ] No critical issues reported
358
+ - [ ] Performance maintained or improved
359
+ - [ ] Documentation is complete
360
+ - [ ] Community feedback is positive
361
+
362
+ ## 🚨 Rollback Process
363
+
364
+ ### When to Rollback
365
+
366
+ - Critical bugs discovered
367
+ - Performance regression
368
+ - Security issues
369
+ - Breaking changes not documented
370
+
371
+ ### Rollback Steps
372
+
373
+ 1. **Immediate Action**
374
+ - Revert to previous version
375
+ - Update RubyGems
376
+ - Notify users
377
+
378
+ 2. **Investigation**
379
+ - Identify root cause
380
+ - Fix the issue
381
+ - Test thoroughly
382
+
383
+ 3. **Re-release**
384
+ - Create new patch version
385
+ - Include fix
386
+ - Communicate with users
387
+
388
+ ### Rollback Example
389
+
390
+ ```bash
391
+ # Revert to previous version
392
+ git revert <commit-hash>
393
+
394
+ # Create new patch
395
+ git tag -a v0.1.3 -m "Rollback and fix for 0.1.2"
396
+ git push origin v0.1.3
397
+
398
+ # Push to RubyGems
399
+ gem push rails_ai-0.1.3.gem
400
+ ```
401
+
402
+ ## 📚 Release Documentation
403
+
404
+ ### Release Notes Template
405
+
406
+ ```markdown
407
+ # Rails AI 0.1.1 Release Notes
408
+
409
+ ## What's New
410
+
411
+ ### Features
412
+ - New feature X
413
+ - New feature Y
414
+
415
+ ### Improvements
416
+ - Improved performance of Z
417
+ - Better error handling
418
+
419
+ ### Fixes
420
+ - Fixed bug A
421
+ - Fixed bug B
422
+
423
+ ## Breaking Changes
424
+
425
+ None in this release.
426
+
427
+ ## Migration Guide
428
+
429
+ No migration needed for this release.
430
+
431
+ ## Upgrade Instructions
432
+
433
+ ```bash
434
+ bundle update rails_ai
435
+ ```
436
+
437
+ ## Full Changelog
438
+
439
+ See [CHANGELOG.md](CHANGELOG.md) for complete details.
440
+ ```
441
+
442
+ ## 🎯 Release Best Practices
443
+
444
+ ### Before Release
445
+
446
+ - Test thoroughly
447
+ - Document everything
448
+ - Get code review
449
+ - Plan communication
450
+
451
+ ### During Release
452
+
453
+ - Follow process strictly
454
+ - Test each step
455
+ - Monitor for issues
456
+ - Communicate clearly
457
+
458
+ ### After Release
459
+
460
+ - Monitor metrics
461
+ - Respond to issues
462
+ - Gather feedback
463
+ - Plan next release
464
+
465
+ ---
466
+
467
+ Following this release process ensures reliable, high-quality releases for Rails AI. 🚀