@fro.bot/systematic 2.33.3 → 3.0.1
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.
- package/ATTRIBUTIONS.md +1 -1
- package/agents/design/design-iterator.md +1 -0
- package/agents/research/best-practices-researcher.md +6 -8
- package/agents/review/pattern-recognition-specialist.md +1 -1
- package/agents/workflow/systematic-implementer.md +1 -0
- package/dist/cli.js +348 -53
- package/dist/{index-vyzhzvap.js → index-yskzf7vh.js} +587 -386
- package/dist/index.js +100 -155
- package/dist/lib/agent-overlays.d.ts +0 -1
- package/dist/lib/agent-resolver.d.ts +28 -0
- package/dist/lib/bootstrap.d.ts +8 -1
- package/dist/lib/bundled-names.d.ts +3 -3
- package/dist/lib/pi-delegate-session.d.ts +31 -0
- package/dist/lib/pi-delegate-tool.d.ts +42 -0
- package/dist/lib/removed-names.d.ts +3 -3
- package/dist/lib/setup.d.ts +36 -0
- package/dist/lib/skill-loader.d.ts +1 -2
- package/dist/lib/skill-resolver.d.ts +39 -0
- package/dist/lib/skill-tool.d.ts +2 -11
- package/dist/lib/skills.d.ts +1 -9
- package/dist/lib/source-model-defaults.d.ts +1 -1
- package/dist/pi.d.ts +7 -0
- package/dist/pi.js +3641 -0
- package/dist/schemas/systematic-config.schema.json +47 -242
- package/package.json +29 -6
- package/skills/ce-brainstorm/references/handoff.md +5 -26
- package/skills/ce-brainstorm/references/universal-brainstorming.md +0 -1
- package/skills/ce-compound/SKILL.md +8 -12
- package/skills/ce-ideate/references/post-ideation-workflow.md +21 -85
- package/skills/ce-plan/SKILL.md +6 -6
- package/skills/ce-plan/references/deepening-workflow.md +6 -7
- package/skills/ce-plan/references/plan-handoff.md +1 -17
- package/skills/ce-plan/references/universal-planning.md +0 -4
- package/skills/ce-review/SKILL.md +10 -19
- package/skills/ce-review/references/persona-catalog.md +2 -7
- package/skills/ce-review/references/review-output-template.md +0 -1
- package/skills/ce-work/SKILL.md +1 -1
- package/skills/deepen-plan/SKILL.md +6 -7
- package/skills/document-review/SKILL.md +2 -2
- package/skills/git-commit-push-pr/SKILL.md +1 -2
- package/skills/lfg/SKILL.md +1 -1
- package/skills/onboarding/SKILL.md +1 -12
- package/skills/orchestrating-subagents/SKILL.md +2 -2
- package/skills/slfg/SKILL.md +2 -3
- package/skills/test-browser/SKILL.md +2 -2
- package/skills/todos/SKILL.md +239 -0
- package/skills/writing-skills/SKILL.md +102 -1
- package/skills/{writing-systematic-skills → writing-skills}/references/foundation-conventions.md +5 -5
- package/agents/design/design-implementation-reviewer.md +0 -95
- package/agents/design/figma-design-sync.md +0 -173
- package/agents/docs/ankane-readme-writer.md +0 -51
- package/agents/review/cli-agent-readiness-reviewer.md +0 -418
- package/agents/review/data-integrity-guardian.md +0 -72
- package/agents/review/data-migration-expert.md +0 -99
- package/agents/review/dhh-rails-reviewer.md +0 -46
- package/agents/review/julik-frontend-races-reviewer.md +0 -49
- package/agents/review/kieran-python-reviewer.md +0 -47
- package/agents/review/kieran-rails-reviewer.md +0 -47
- package/agents/review/performance-oracle.md +0 -112
- package/agents/review/schema-drift-detector.md +0 -143
- package/agents/review/security-sentinel.md +0 -95
- package/agents/workflow/lint.md +0 -17
- package/dist/lib/converter.d.ts +0 -14
- package/skills/andrew-kane-gem-writer/SKILL.md +0 -184
- package/skills/andrew-kane-gem-writer/references/database-adapters.md +0 -231
- package/skills/andrew-kane-gem-writer/references/module-organization.md +0 -121
- package/skills/andrew-kane-gem-writer/references/rails-integration.md +0 -183
- package/skills/andrew-kane-gem-writer/references/resources.md +0 -119
- package/skills/andrew-kane-gem-writer/references/testing-patterns.md +0 -261
- package/skills/changelog/SKILL.md +0 -139
- package/skills/claude-permissions-optimizer/SKILL.md +0 -166
- package/skills/claude-permissions-optimizer/scripts/extract-commands.mjs +0 -655
- package/skills/claude-permissions-optimizer/scripts/normalize.mjs +0 -151
- package/skills/dhh-rails-style/SKILL.md +0 -186
- package/skills/dhh-rails-style/references/architecture.md +0 -653
- package/skills/dhh-rails-style/references/controllers.md +0 -303
- package/skills/dhh-rails-style/references/frontend.md +0 -510
- package/skills/dhh-rails-style/references/gems.md +0 -266
- package/skills/dhh-rails-style/references/models.md +0 -359
- package/skills/dhh-rails-style/references/testing.md +0 -338
- package/skills/dspy-ruby/SKILL.md +0 -737
- package/skills/dspy-ruby/assets/config-template.rb +0 -187
- package/skills/dspy-ruby/assets/module-template.rb +0 -300
- package/skills/dspy-ruby/assets/signature-template.rb +0 -221
- package/skills/dspy-ruby/references/core-concepts.md +0 -674
- package/skills/dspy-ruby/references/observability.md +0 -366
- package/skills/dspy-ruby/references/optimization.md +0 -603
- package/skills/dspy-ruby/references/providers.md +0 -418
- package/skills/dspy-ruby/references/toolsets.md +0 -502
- package/skills/every-style-editor/SKILL.md +0 -135
- package/skills/every-style-editor/references/EVERY_WRITE_STYLE.md +0 -529
- package/skills/feature-video/SKILL.md +0 -383
- package/skills/gemini-imagegen/SKILL.md +0 -237
- package/skills/gemini-imagegen/requirements.txt +0 -2
- package/skills/gemini-imagegen/scripts/compose_images.py +0 -157
- package/skills/gemini-imagegen/scripts/edit_image.py +0 -144
- package/skills/gemini-imagegen/scripts/gemini_images.py +0 -263
- package/skills/gemini-imagegen/scripts/generate_image.py +0 -133
- package/skills/gemini-imagegen/scripts/multi_turn_chat.py +0 -216
- package/skills/generate_command/SKILL.md +0 -164
- package/skills/orchestrating-swarms/SKILL.md +0 -1723
- package/skills/proof/SKILL.md +0 -291
- package/skills/proof/references/hitl-review.md +0 -368
- package/skills/rclone/SKILL.md +0 -150
- package/skills/rclone/scripts/check_setup.sh +0 -60
- package/skills/setup/SKILL.md +0 -22
- package/skills/test-xcode/SKILL.md +0 -214
- package/skills/todo-create/SKILL.md +0 -109
- package/skills/todo-resolve/SKILL.md +0 -68
- package/skills/todo-triage/SKILL.md +0 -70
- package/skills/writing-systematic-skills/SKILL.md +0 -119
- /package/skills/{todo-create → todos}/assets/todo-template.md +0 -0
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
# Rails Integration Patterns
|
|
2
|
-
|
|
3
|
-
## The Golden Rule
|
|
4
|
-
|
|
5
|
-
**Never require Rails gems directly.** This causes loading order issues.
|
|
6
|
-
|
|
7
|
-
```ruby
|
|
8
|
-
# WRONG - causes premature loading
|
|
9
|
-
require "active_record"
|
|
10
|
-
ActiveRecord::Base.include(MyGem::Model)
|
|
11
|
-
|
|
12
|
-
# CORRECT - lazy loading
|
|
13
|
-
ActiveSupport.on_load(:active_record) do
|
|
14
|
-
extend MyGem::Model
|
|
15
|
-
end
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## ActiveSupport.on_load Hooks
|
|
19
|
-
|
|
20
|
-
Common hooks and their uses:
|
|
21
|
-
|
|
22
|
-
```ruby
|
|
23
|
-
# Models
|
|
24
|
-
ActiveSupport.on_load(:active_record) do
|
|
25
|
-
extend GemName::Model # Add class methods (searchkick, has_encrypted)
|
|
26
|
-
include GemName::Callbacks # Add instance methods
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Controllers
|
|
30
|
-
ActiveSupport.on_load(:action_controller) do
|
|
31
|
-
include Ahoy::Controller
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Jobs
|
|
35
|
-
ActiveSupport.on_load(:active_job) do
|
|
36
|
-
include GemName::JobExtensions
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Mailers
|
|
40
|
-
ActiveSupport.on_load(:action_mailer) do
|
|
41
|
-
include GemName::MailerExtensions
|
|
42
|
-
end
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Prepend for Behavior Modification
|
|
46
|
-
|
|
47
|
-
When overriding existing Rails methods:
|
|
48
|
-
|
|
49
|
-
```ruby
|
|
50
|
-
ActiveSupport.on_load(:active_record) do
|
|
51
|
-
ActiveRecord::Migration.prepend(StrongMigrations::Migration)
|
|
52
|
-
ActiveRecord::Migrator.prepend(StrongMigrations::Migrator)
|
|
53
|
-
end
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Railtie Pattern
|
|
57
|
-
|
|
58
|
-
Minimal Railtie for non-mountable gems:
|
|
59
|
-
|
|
60
|
-
```ruby
|
|
61
|
-
# lib/gemname/railtie.rb
|
|
62
|
-
module GemName
|
|
63
|
-
class Railtie < Rails::Railtie
|
|
64
|
-
initializer "gemname.configure" do
|
|
65
|
-
ActiveSupport.on_load(:active_record) do
|
|
66
|
-
extend GemName::Model
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Optional: Add to controller runtime logging
|
|
71
|
-
initializer "gemname.log_runtime" do
|
|
72
|
-
require_relative "controller_runtime"
|
|
73
|
-
ActiveSupport.on_load(:action_controller) do
|
|
74
|
-
include GemName::ControllerRuntime
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
# Optional: Rake tasks
|
|
79
|
-
rake_tasks do
|
|
80
|
-
load "tasks/gemname.rake"
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Engine Pattern (Mountable Gems)
|
|
87
|
-
|
|
88
|
-
For gems with web interfaces (PgHero, Blazer, Ahoy):
|
|
89
|
-
|
|
90
|
-
```ruby
|
|
91
|
-
# lib/pghero/engine.rb
|
|
92
|
-
module PgHero
|
|
93
|
-
class Engine < ::Rails::Engine
|
|
94
|
-
isolate_namespace PgHero
|
|
95
|
-
|
|
96
|
-
initializer "pghero.assets", group: :all do |app|
|
|
97
|
-
if app.config.respond_to?(:assets) && defined?(Sprockets)
|
|
98
|
-
app.config.assets.precompile << "pghero/application.js"
|
|
99
|
-
app.config.assets.precompile << "pghero/application.css"
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
initializer "pghero.config" do
|
|
104
|
-
PgHero.config = Rails.application.config_for(:pghero) rescue {}
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Routes for Engines
|
|
111
|
-
|
|
112
|
-
```ruby
|
|
113
|
-
# config/routes.rb (in engine)
|
|
114
|
-
PgHero::Engine.routes.draw do
|
|
115
|
-
root to: "home#index"
|
|
116
|
-
resources :databases, only: [:show]
|
|
117
|
-
end
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Mount in app:
|
|
121
|
-
|
|
122
|
-
```ruby
|
|
123
|
-
# config/routes.rb (in app)
|
|
124
|
-
mount PgHero::Engine, at: "pghero"
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## YAML Configuration with ERB
|
|
128
|
-
|
|
129
|
-
For complex gems needing config files:
|
|
130
|
-
|
|
131
|
-
```ruby
|
|
132
|
-
def self.settings
|
|
133
|
-
@settings ||= begin
|
|
134
|
-
path = Rails.root.join("config", "blazer.yml")
|
|
135
|
-
if path.exist?
|
|
136
|
-
YAML.safe_load(ERB.new(File.read(path)).result, aliases: true)
|
|
137
|
-
else
|
|
138
|
-
{}
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Generator Pattern
|
|
145
|
-
|
|
146
|
-
```ruby
|
|
147
|
-
# lib/generators/gemname/install_generator.rb
|
|
148
|
-
module GemName
|
|
149
|
-
module Generators
|
|
150
|
-
class InstallGenerator < Rails::Generators::Base
|
|
151
|
-
source_root File.expand_path("templates", __dir__)
|
|
152
|
-
|
|
153
|
-
def copy_initializer
|
|
154
|
-
template "initializer.rb", "config/initializers/gemname.rb"
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def copy_migration
|
|
158
|
-
migration_template "migration.rb", "db/migrate/create_gemname_tables.rb"
|
|
159
|
-
end
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Conditional Feature Detection
|
|
166
|
-
|
|
167
|
-
```ruby
|
|
168
|
-
# Check for specific Rails versions
|
|
169
|
-
if ActiveRecord.version >= Gem::Version.new("7.0")
|
|
170
|
-
# Rails 7+ specific code
|
|
171
|
-
end
|
|
172
|
-
|
|
173
|
-
# Check for optional dependencies
|
|
174
|
-
def self.client
|
|
175
|
-
@client ||= if defined?(OpenSearch::Client)
|
|
176
|
-
OpenSearch::Client.new
|
|
177
|
-
elsif defined?(Elasticsearch::Client)
|
|
178
|
-
Elasticsearch::Client.new
|
|
179
|
-
else
|
|
180
|
-
raise Error, "Install elasticsearch or opensearch-ruby"
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
```
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# Andrew Kane Resources
|
|
2
|
-
|
|
3
|
-
## Primary Documentation
|
|
4
|
-
|
|
5
|
-
- **Gem Patterns Article**: https://ankane.org/gem-patterns
|
|
6
|
-
- Kane's own documentation of patterns used across his gems
|
|
7
|
-
- Covers configuration, Rails integration, error handling
|
|
8
|
-
|
|
9
|
-
## Top Ruby Gems by Stars
|
|
10
|
-
|
|
11
|
-
### Search & Data
|
|
12
|
-
|
|
13
|
-
| Gem | Stars | Description | Source |
|
|
14
|
-
|-----|-------|-------------|--------|
|
|
15
|
-
| **Searchkick** | 6.6k+ | Intelligent search for Rails | https://github.com/ankane/searchkick |
|
|
16
|
-
| **Chartkick** | 6.4k+ | Beautiful charts in Ruby | https://github.com/ankane/chartkick |
|
|
17
|
-
| **Groupdate** | 3.8k+ | Group by day, week, month | https://github.com/ankane/groupdate |
|
|
18
|
-
| **Blazer** | 4.6k+ | SQL dashboard for Rails | https://github.com/ankane/blazer |
|
|
19
|
-
|
|
20
|
-
### Database & Migrations
|
|
21
|
-
|
|
22
|
-
| Gem | Stars | Description | Source |
|
|
23
|
-
|-----|-------|-------------|--------|
|
|
24
|
-
| **PgHero** | 8.2k+ | PostgreSQL insights | https://github.com/ankane/pghero |
|
|
25
|
-
| **Strong Migrations** | 4.1k+ | Safe migration checks | https://github.com/ankane/strong_migrations |
|
|
26
|
-
| **Dexter** | 1.8k+ | Auto index advisor | https://github.com/ankane/dexter |
|
|
27
|
-
| **PgSync** | 1.5k+ | Sync Postgres data | https://github.com/ankane/pgsync |
|
|
28
|
-
|
|
29
|
-
### Security & Encryption
|
|
30
|
-
|
|
31
|
-
| Gem | Stars | Description | Source |
|
|
32
|
-
|-----|-------|-------------|--------|
|
|
33
|
-
| **Lockbox** | 1.5k+ | Application-level encryption | https://github.com/ankane/lockbox |
|
|
34
|
-
| **Blind Index** | 1.0k+ | Encrypted search | https://github.com/ankane/blind_index |
|
|
35
|
-
| **Secure Headers** | — | Contributed patterns | Referenced in gems |
|
|
36
|
-
|
|
37
|
-
### Analytics & ML
|
|
38
|
-
|
|
39
|
-
| Gem | Stars | Description | Source |
|
|
40
|
-
|-----|-------|-------------|--------|
|
|
41
|
-
| **Ahoy** | 4.2k+ | Analytics for Rails | https://github.com/ankane/ahoy |
|
|
42
|
-
| **Neighbor** | 1.1k+ | Vector search for Rails | https://github.com/ankane/neighbor |
|
|
43
|
-
| **Rover** | 700+ | DataFrames for Ruby | https://github.com/ankane/rover |
|
|
44
|
-
| **Tomoto** | 200+ | Topic modeling | https://github.com/ankane/tomoto-ruby |
|
|
45
|
-
|
|
46
|
-
### Utilities
|
|
47
|
-
|
|
48
|
-
| Gem | Stars | Description | Source |
|
|
49
|
-
|-----|-------|-------------|--------|
|
|
50
|
-
| **Pretender** | 2.0k+ | Login as another user | https://github.com/ankane/pretender |
|
|
51
|
-
| **Authtrail** | 900+ | Login activity tracking | https://github.com/ankane/authtrail |
|
|
52
|
-
| **Notable** | 200+ | Track notable requests | https://github.com/ankane/notable |
|
|
53
|
-
| **Logstop** | 200+ | Filter sensitive logs | https://github.com/ankane/logstop |
|
|
54
|
-
|
|
55
|
-
## Key Source Files to Study
|
|
56
|
-
|
|
57
|
-
### Entry Point Patterns
|
|
58
|
-
- https://github.com/ankane/searchkick/blob/master/lib/searchkick.rb
|
|
59
|
-
- https://github.com/ankane/pghero/blob/master/lib/pghero.rb
|
|
60
|
-
- https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations.rb
|
|
61
|
-
- https://github.com/ankane/lockbox/blob/master/lib/lockbox.rb
|
|
62
|
-
|
|
63
|
-
### Class Macro Implementations
|
|
64
|
-
- https://github.com/ankane/searchkick/blob/master/lib/searchkick/model.rb
|
|
65
|
-
- https://github.com/ankane/lockbox/blob/master/lib/lockbox/model.rb
|
|
66
|
-
- https://github.com/ankane/neighbor/blob/master/lib/neighbor/model.rb
|
|
67
|
-
- https://github.com/ankane/blind_index/blob/master/lib/blind_index/model.rb
|
|
68
|
-
|
|
69
|
-
### Rails Integration (Railtie/Engine)
|
|
70
|
-
- https://github.com/ankane/pghero/blob/master/lib/pghero/engine.rb
|
|
71
|
-
- https://github.com/ankane/searchkick/blob/master/lib/searchkick/railtie.rb
|
|
72
|
-
- https://github.com/ankane/ahoy/blob/master/lib/ahoy/engine.rb
|
|
73
|
-
- https://github.com/ankane/blazer/blob/master/lib/blazer/engine.rb
|
|
74
|
-
|
|
75
|
-
### Database Adapters
|
|
76
|
-
- https://github.com/ankane/strong_migrations/tree/master/lib/strong_migrations/adapters
|
|
77
|
-
- https://github.com/ankane/groupdate/tree/master/lib/groupdate/adapters
|
|
78
|
-
- https://github.com/ankane/neighbor/tree/master/lib/neighbor
|
|
79
|
-
|
|
80
|
-
### Error Messages (Template Pattern)
|
|
81
|
-
- https://github.com/ankane/strong_migrations/blob/master/lib/strong_migrations/error_messages.rb
|
|
82
|
-
|
|
83
|
-
### Gemspec Examples
|
|
84
|
-
- https://github.com/ankane/searchkick/blob/master/searchkick.gemspec
|
|
85
|
-
- https://github.com/ankane/neighbor/blob/master/neighbor.gemspec
|
|
86
|
-
- https://github.com/ankane/ahoy/blob/master/ahoy_matey.gemspec
|
|
87
|
-
|
|
88
|
-
### Test Setups
|
|
89
|
-
- https://github.com/ankane/searchkick/tree/master/test
|
|
90
|
-
- https://github.com/ankane/lockbox/tree/master/test
|
|
91
|
-
- https://github.com/ankane/strong_migrations/tree/master/test
|
|
92
|
-
|
|
93
|
-
## GitHub Profile
|
|
94
|
-
|
|
95
|
-
- **Profile**: https://github.com/ankane
|
|
96
|
-
- **All Ruby Repos**: https://github.com/ankane?tab=repositories&q=&type=&language=ruby&sort=stargazers
|
|
97
|
-
- **RubyGems Profile**: https://rubygems.org/profiles/ankane
|
|
98
|
-
|
|
99
|
-
## Blog Posts & Articles
|
|
100
|
-
|
|
101
|
-
- **ankane.org**: https://ankane.org/
|
|
102
|
-
- **Gem Patterns**: https://ankane.org/gem-patterns (essential reading)
|
|
103
|
-
- **Postgres Performance**: https://ankane.org/introducing-pghero
|
|
104
|
-
- **Search Tips**: https://ankane.org/search-rails
|
|
105
|
-
|
|
106
|
-
## Design Philosophy Summary
|
|
107
|
-
|
|
108
|
-
From studying 100+ gems, Kane's consistent principles:
|
|
109
|
-
|
|
110
|
-
1. **Zero dependencies when possible** - Each dep is a maintenance burden
|
|
111
|
-
2. **ActiveSupport.on_load always** - Never require Rails gems directly
|
|
112
|
-
3. **Class macro DSLs** - Single method configures everything
|
|
113
|
-
4. **Explicit over magic** - No method_missing, define methods directly
|
|
114
|
-
5. **Minitest only** - Simple, sufficient, no RSpec
|
|
115
|
-
6. **Multi-version testing** - Support broad Rails/Ruby versions
|
|
116
|
-
7. **Helpful errors** - Template-based messages with fix suggestions
|
|
117
|
-
8. **Abstract adapters** - Clean multi-database support
|
|
118
|
-
9. **Engine isolation** - isolate_namespace for mountable gems
|
|
119
|
-
10. **Minimal documentation** - Code is self-documenting, README is examples
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
# Testing Patterns
|
|
2
|
-
|
|
3
|
-
## Minitest Setup
|
|
4
|
-
|
|
5
|
-
Kane exclusively uses Minitest—never RSpec.
|
|
6
|
-
|
|
7
|
-
```ruby
|
|
8
|
-
# test/test_helper.rb
|
|
9
|
-
require "bundler/setup"
|
|
10
|
-
Bundler.require(:default)
|
|
11
|
-
require "minitest/autorun"
|
|
12
|
-
require "minitest/pride"
|
|
13
|
-
|
|
14
|
-
# Load the gem
|
|
15
|
-
require "gemname"
|
|
16
|
-
|
|
17
|
-
# Test database setup (if needed)
|
|
18
|
-
ActiveRecord::Base.establish_connection(
|
|
19
|
-
adapter: "postgresql",
|
|
20
|
-
database: "gemname_test"
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
# Base test class
|
|
24
|
-
class Minitest::Test
|
|
25
|
-
def setup
|
|
26
|
-
# Reset state before each test
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Test File Structure
|
|
32
|
-
|
|
33
|
-
```ruby
|
|
34
|
-
# test/model_test.rb
|
|
35
|
-
require_relative "test_helper"
|
|
36
|
-
|
|
37
|
-
class ModelTest < Minitest::Test
|
|
38
|
-
def setup
|
|
39
|
-
User.delete_all
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_basic_functionality
|
|
43
|
-
user = User.create!(email: "test@example.org")
|
|
44
|
-
assert_equal "test@example.org", user.email
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def test_with_invalid_input
|
|
48
|
-
error = assert_raises(ArgumentError) do
|
|
49
|
-
User.create!(email: nil)
|
|
50
|
-
end
|
|
51
|
-
assert_match /email/, error.message
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def test_class_method
|
|
55
|
-
result = User.search("test")
|
|
56
|
-
assert_kind_of Array, result
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Multi-Version Testing
|
|
62
|
-
|
|
63
|
-
Test against multiple Rails/Ruby versions using gemfiles:
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
test/
|
|
67
|
-
├── test_helper.rb
|
|
68
|
-
└── gemfiles/
|
|
69
|
-
├── activerecord70.gemfile
|
|
70
|
-
├── activerecord71.gemfile
|
|
71
|
-
└── activerecord72.gemfile
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
```ruby
|
|
75
|
-
# test/gemfiles/activerecord70.gemfile
|
|
76
|
-
source "https://rubygems.org"
|
|
77
|
-
gemspec path: "../../"
|
|
78
|
-
|
|
79
|
-
gem "activerecord", "~> 7.0.0"
|
|
80
|
-
gem "sqlite3"
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```ruby
|
|
84
|
-
# test/gemfiles/activerecord72.gemfile
|
|
85
|
-
source "https://rubygems.org"
|
|
86
|
-
gemspec path: "../../"
|
|
87
|
-
|
|
88
|
-
gem "activerecord", "~> 7.2.0"
|
|
89
|
-
gem "sqlite3"
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Run with specific gemfile:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
BUNDLE_GEMFILE=test/gemfiles/activerecord70.gemfile bundle install
|
|
96
|
-
BUNDLE_GEMFILE=test/gemfiles/activerecord70.gemfile bundle exec rake test
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Rakefile
|
|
100
|
-
|
|
101
|
-
```ruby
|
|
102
|
-
# Rakefile
|
|
103
|
-
require "bundler/gem_tasks"
|
|
104
|
-
require "rake/testtask"
|
|
105
|
-
|
|
106
|
-
Rake::TestTask.new(:test) do |t|
|
|
107
|
-
t.libs << "test"
|
|
108
|
-
t.pattern = "test/**/*_test.rb"
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
task default: :test
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## GitHub Actions CI
|
|
115
|
-
|
|
116
|
-
```yaml
|
|
117
|
-
# .github/workflows/build.yml
|
|
118
|
-
name: build
|
|
119
|
-
|
|
120
|
-
on: [push, pull_request]
|
|
121
|
-
|
|
122
|
-
jobs:
|
|
123
|
-
build:
|
|
124
|
-
runs-on: ubuntu-latest
|
|
125
|
-
|
|
126
|
-
strategy:
|
|
127
|
-
fail-fast: false
|
|
128
|
-
matrix:
|
|
129
|
-
include:
|
|
130
|
-
- ruby: "3.2"
|
|
131
|
-
gemfile: activerecord70
|
|
132
|
-
- ruby: "3.3"
|
|
133
|
-
gemfile: activerecord71
|
|
134
|
-
- ruby: "3.3"
|
|
135
|
-
gemfile: activerecord72
|
|
136
|
-
|
|
137
|
-
env:
|
|
138
|
-
BUNDLE_GEMFILE: test/gemfiles/${{ matrix.gemfile }}.gemfile
|
|
139
|
-
|
|
140
|
-
steps:
|
|
141
|
-
- uses: actions/checkout@v4
|
|
142
|
-
|
|
143
|
-
- uses: ruby/setup-ruby@v1
|
|
144
|
-
with:
|
|
145
|
-
ruby-version: ${{ matrix.ruby }}
|
|
146
|
-
bundler-cache: true
|
|
147
|
-
|
|
148
|
-
- run: bundle exec rake test
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Database-Specific Testing
|
|
152
|
-
|
|
153
|
-
```yaml
|
|
154
|
-
# .github/workflows/build.yml (with services)
|
|
155
|
-
services:
|
|
156
|
-
postgres:
|
|
157
|
-
image: postgres:15
|
|
158
|
-
env:
|
|
159
|
-
POSTGRES_USER: postgres
|
|
160
|
-
POSTGRES_PASSWORD: postgres
|
|
161
|
-
ports:
|
|
162
|
-
- 5432:5432
|
|
163
|
-
options: >-
|
|
164
|
-
--health-cmd pg_isready
|
|
165
|
-
--health-interval 10s
|
|
166
|
-
--health-timeout 5s
|
|
167
|
-
--health-retries 5
|
|
168
|
-
|
|
169
|
-
env:
|
|
170
|
-
DATABASE_URL: postgres://postgres:postgres@localhost/gemname_test
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Test Database Setup
|
|
174
|
-
|
|
175
|
-
```ruby
|
|
176
|
-
# test/test_helper.rb
|
|
177
|
-
require "active_record"
|
|
178
|
-
|
|
179
|
-
# Connect to database
|
|
180
|
-
ActiveRecord::Base.establish_connection(
|
|
181
|
-
ENV["DATABASE_URL"] || {
|
|
182
|
-
adapter: "postgresql",
|
|
183
|
-
database: "gemname_test"
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
# Create tables
|
|
188
|
-
ActiveRecord::Schema.define do
|
|
189
|
-
create_table :users, force: true do |t|
|
|
190
|
-
t.string :email
|
|
191
|
-
t.text :encrypted_data
|
|
192
|
-
t.timestamps
|
|
193
|
-
end
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
# Define models
|
|
197
|
-
class User < ActiveRecord::Base
|
|
198
|
-
gemname_feature :email
|
|
199
|
-
end
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Assertion Patterns
|
|
203
|
-
|
|
204
|
-
```ruby
|
|
205
|
-
# Basic assertions
|
|
206
|
-
assert result
|
|
207
|
-
assert_equal expected, actual
|
|
208
|
-
assert_nil value
|
|
209
|
-
assert_empty array
|
|
210
|
-
|
|
211
|
-
# Exception testing
|
|
212
|
-
assert_raises(ArgumentError) { bad_code }
|
|
213
|
-
|
|
214
|
-
error = assert_raises(GemName::Error) do
|
|
215
|
-
risky_operation
|
|
216
|
-
end
|
|
217
|
-
assert_match /expected message/, error.message
|
|
218
|
-
|
|
219
|
-
# Refutations
|
|
220
|
-
refute condition
|
|
221
|
-
refute_equal unexpected, actual
|
|
222
|
-
refute_nil value
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
## Test Helpers
|
|
226
|
-
|
|
227
|
-
```ruby
|
|
228
|
-
# test/test_helper.rb
|
|
229
|
-
class Minitest::Test
|
|
230
|
-
def with_options(options)
|
|
231
|
-
original = GemName.options.dup
|
|
232
|
-
GemName.options.merge!(options)
|
|
233
|
-
yield
|
|
234
|
-
ensure
|
|
235
|
-
GemName.options = original
|
|
236
|
-
end
|
|
237
|
-
|
|
238
|
-
def assert_queries(expected_count)
|
|
239
|
-
queries = []
|
|
240
|
-
callback = ->(*, payload) { queries << payload[:sql] }
|
|
241
|
-
ActiveSupport::Notifications.subscribe("sql.active_record", callback)
|
|
242
|
-
yield
|
|
243
|
-
assert_equal expected_count, queries.size, "Expected #{expected_count} queries, got #{queries.size}"
|
|
244
|
-
ensure
|
|
245
|
-
ActiveSupport::Notifications.unsubscribe(callback)
|
|
246
|
-
end
|
|
247
|
-
end
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## Skipping Tests
|
|
251
|
-
|
|
252
|
-
```ruby
|
|
253
|
-
def test_postgresql_specific
|
|
254
|
-
skip "PostgreSQL only" unless postgresql?
|
|
255
|
-
# test code
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
def postgresql?
|
|
259
|
-
ActiveRecord::Base.connection.adapter_name =~ /postg/i
|
|
260
|
-
end
|
|
261
|
-
```
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: changelog
|
|
3
|
-
description: Create engaging changelogs for recent merges to main branch
|
|
4
|
-
argument-hint: '[optional: daily|weekly, or time period in days]'
|
|
5
|
-
disable-model-invocation: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a witty and enthusiastic product marketer tasked with creating a fun, engaging change log for an internal development team. Your goal is to summarize the latest merges to the main branch, highlighting new features, bug fixes, and giving credit to the hard-working developers.
|
|
9
|
-
|
|
10
|
-
## Time Period
|
|
11
|
-
|
|
12
|
-
- For daily changelogs: Look at PRs merged in the last 24 hours
|
|
13
|
-
- For weekly summaries: Look at PRs merged in the last 7 days
|
|
14
|
-
- Always specify the time period in the title (e.g., "Daily" vs "Weekly")
|
|
15
|
-
- Default: Get the latest changes from the last day from the main branch of the repository
|
|
16
|
-
|
|
17
|
-
## PR Analysis
|
|
18
|
-
|
|
19
|
-
Analyze the provided GitHub changes and related issues. Look for:
|
|
20
|
-
|
|
21
|
-
1. New features that have been added
|
|
22
|
-
2. Bug fixes that have been implemented
|
|
23
|
-
3. Any other significant changes or improvements
|
|
24
|
-
4. References to specific issues and their details
|
|
25
|
-
5. Names of contributors who made the changes
|
|
26
|
-
6. Use gh cli to lookup the PRs as well and the description of the PRs
|
|
27
|
-
7. Check PR labels to identify feature type (feature, bug, chore, etc.)
|
|
28
|
-
8. Look for breaking changes and highlight them prominently
|
|
29
|
-
9. Include PR numbers for traceability
|
|
30
|
-
10. Check if PRs are linked to issues and include issue context
|
|
31
|
-
|
|
32
|
-
## Content Priorities
|
|
33
|
-
|
|
34
|
-
1. Breaking changes (if any) - MUST be at the top
|
|
35
|
-
2. User-facing features
|
|
36
|
-
3. Critical bug fixes
|
|
37
|
-
4. Performance improvements
|
|
38
|
-
5. Developer experience improvements
|
|
39
|
-
6. Documentation updates
|
|
40
|
-
|
|
41
|
-
## Formatting Guidelines
|
|
42
|
-
|
|
43
|
-
Now, create a change log summary with the following guidelines:
|
|
44
|
-
|
|
45
|
-
1. Keep it concise and to the point
|
|
46
|
-
2. Highlight the most important changes first
|
|
47
|
-
3. Group similar changes together (e.g., all new features, all bug fixes)
|
|
48
|
-
4. Include issue references where applicable
|
|
49
|
-
5. Mention the names of contributors, giving them credit for their work
|
|
50
|
-
6. Add a touch of humor or playfulness to make it engaging
|
|
51
|
-
7. Use emojis sparingly to add visual interest
|
|
52
|
-
8. Keep total message under 2000 characters for Discord
|
|
53
|
-
9. Use consistent emoji for each section
|
|
54
|
-
10. Format code/technical terms in backticks
|
|
55
|
-
11. Include PR numbers in parentheses (e.g., "Fixed login bug (#123)")
|
|
56
|
-
|
|
57
|
-
## Deployment Notes
|
|
58
|
-
|
|
59
|
-
When relevant, include:
|
|
60
|
-
|
|
61
|
-
- Database migrations required
|
|
62
|
-
- Environment variable updates needed
|
|
63
|
-
- Manual intervention steps post-deploy
|
|
64
|
-
- Dependencies that need updating
|
|
65
|
-
|
|
66
|
-
Your final output should be formatted as follows:
|
|
67
|
-
|
|
68
|
-
<change_log>
|
|
69
|
-
|
|
70
|
-
# 🚀 [Daily/Weekly] Change Log: [Current Date]
|
|
71
|
-
|
|
72
|
-
## 🚨 Breaking Changes (if any)
|
|
73
|
-
|
|
74
|
-
[List any breaking changes that require immediate attention]
|
|
75
|
-
|
|
76
|
-
## 🌟 New Features
|
|
77
|
-
|
|
78
|
-
[List new features here with PR numbers]
|
|
79
|
-
|
|
80
|
-
## 🐛 Bug Fixes
|
|
81
|
-
|
|
82
|
-
[List bug fixes here with PR numbers]
|
|
83
|
-
|
|
84
|
-
## 🛠️ Other Improvements
|
|
85
|
-
|
|
86
|
-
[List other significant changes or improvements]
|
|
87
|
-
|
|
88
|
-
## 🙌 Shoutouts
|
|
89
|
-
|
|
90
|
-
[Mention contributors and their contributions]
|
|
91
|
-
|
|
92
|
-
## 🎉 Fun Fact of the Day
|
|
93
|
-
|
|
94
|
-
[Include a brief, work-related fun fact or joke]
|
|
95
|
-
|
|
96
|
-
</change_log>
|
|
97
|
-
|
|
98
|
-
## Style Guide Review
|
|
99
|
-
|
|
100
|
-
Now review the changelog using the EVERY_WRITE_STYLE.md file and go one by one to make sure you are following the style guide. Use multiple agents, run in parallel to make it faster.
|
|
101
|
-
|
|
102
|
-
Remember, your final output should only include the content within the <change_log> tags. Do not include any of your thought process or the original data in the output.
|
|
103
|
-
|
|
104
|
-
## Discord Posting (Optional)
|
|
105
|
-
|
|
106
|
-
You can post changelogs to Discord by adding your own webhook URL:
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
# Set your Discord webhook URL
|
|
110
|
-
DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
|
|
111
|
-
|
|
112
|
-
# Post using curl
|
|
113
|
-
curl -H "Content-Type: application/json" \
|
|
114
|
-
-d "{\"content\": \"{{CHANGELOG}}\"}" \
|
|
115
|
-
$DISCORD_WEBHOOK_URL
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
To get a webhook URL, go to your Discord server → Server Settings → Integrations → Webhooks → New Webhook.
|
|
119
|
-
|
|
120
|
-
## Error Handling
|
|
121
|
-
|
|
122
|
-
- If no changes in the time period, post a "quiet day" message: "🌤️ Quiet day! No new changes merged."
|
|
123
|
-
- If unable to fetch PR details, list the PR numbers for manual review
|
|
124
|
-
- Always validate message length before posting to Discord (max 2000 chars)
|
|
125
|
-
|
|
126
|
-
## Schedule Recommendations
|
|
127
|
-
|
|
128
|
-
- Run daily at 6 AM NY time for previous day's changes
|
|
129
|
-
- Run weekly summary on Mondays for the previous week
|
|
130
|
-
- Special runs after major releases or deployments
|
|
131
|
-
|
|
132
|
-
## Audience Considerations
|
|
133
|
-
|
|
134
|
-
Adjust the tone and detail level based on the channel:
|
|
135
|
-
|
|
136
|
-
- **Dev team channels**: Include technical details, performance metrics, code snippets
|
|
137
|
-
- **Product team channels**: Focus on user-facing changes and business impact
|
|
138
|
-
- **Leadership channels**: Highlight progress on key initiatives and blockers
|
|
139
|
-
|