ai_summary 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97bfb3890682e94993a167e56d5ffa52bf0cdb2347044aba91efea2cfa0d1d15
4
- data.tar.gz: 445b4005da4c7ebcabd1da0061fb98d6afad91984e4b563e0bc22b7795559982
3
+ metadata.gz: b9e5afadae25c6eec8f7868c465c3c7406c2c435b7b0079f3027c9e3de93239a
4
+ data.tar.gz: 5df38f04842ad2099a6bbb816948e4296437e4a4b3c747df687c9d8c7eb88f08
5
5
  SHA512:
6
- metadata.gz: 2e0f73fed38f2ac74d0ca1767422919ebba0c6c79912758a70018a47389beea3200bc397e364419aa56761a3997dd427012bab7692c7670e2872702e10e8510b
7
- data.tar.gz: acc257e654a4c93f327bbbf2266734f5675e5fa1226d1150161508849ef20d2417d80971b1490e64e5e43aecdae4c425f91a45ec6d0031c6040cafd3f721583e
6
+ metadata.gz: 32443309a2d81e9daba6e13b51a6682a5e4c03d98cc73058c7794cac8594b1bb4039b8bed7145f36c06677685f9b7828e83e0a4c0ff2a93272f7b73c307cff2f
7
+ data.tar.gz: 65f99737a7dfdada670013b6795ce1e0a0078fc4072830cc39ec471808d8fdff395db07654a5416f97b09ddd19d4033e2f150b4c61b2c6daaf83c430d2c51e5c
@@ -0,0 +1,37 @@
1
+ name: Publish to RubyGems
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ # Allows use to run it manually
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ release:
11
+ name: Push gem to RubyGems
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: 3.2
22
+ bundler-cache: true
23
+
24
+ - name: Install dependencies
25
+ run: bundle install
26
+
27
+ - name: Build gem
28
+ run: gem build ai_summary.gemspec
29
+
30
+ - name: Publish to RubyGems
31
+ env:
32
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
33
+ run: |
34
+ mkdir -p ~/.gem
35
+ echo -e "---\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
36
+ chmod 0600 ~/.gem/credentials
37
+ gem push ai_summary-*.gem
data/.idea/workspace.xml CHANGED
@@ -4,19 +4,48 @@
4
4
  <option name="autoReloadType" value="SELECTIVE" />
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
- <list default="true" id="34d5e5cf-2804-4d8f-a534-bf8fd82f58ab" name="Changes" comment="" />
7
+ <list default="true" id="34d5e5cf-2804-4d8f-a534-bf8fd82f58ab" name="Changes" comment="Test Github Action v3">
8
+ <change afterPath="$PROJECT_DIR$/lib/ai_summary/summary_generator.rb" afterDir="false" />
9
+ <change afterPath="$PROJECT_DIR$/lib/tasks/ai_summary.rake" afterDir="false" />
10
+ <change afterPath="$PROJECT_DIR$/spec/rails_helper.rb" afterDir="false" />
11
+ <change afterPath="$PROJECT_DIR$/spec/tasks/ai_summary_spec.rb" afterDir="false" />
12
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
13
+ <change beforePath="$PROJECT_DIR$/Gemfile" beforeDir="false" afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
14
+ <change beforePath="$PROJECT_DIR$/ai_summary.gemspec" beforeDir="false" afterPath="$PROJECT_DIR$/ai_summary.gemspec" afterDir="false" />
15
+ <change beforePath="$PROJECT_DIR$/lib/ai_summary.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/ai_summary.rb" afterDir="false" />
16
+ <change beforePath="$PROJECT_DIR$/spec/ai_summary_spec.rb" beforeDir="false" afterPath="$PROJECT_DIR$/spec/ai_summary_spec.rb" afterDir="false" />
17
+ <change beforePath="$PROJECT_DIR$/spec/spec_helper.rb" beforeDir="false" afterPath="$PROJECT_DIR$/spec/spec_helper.rb" afterDir="false" />
18
+ </list>
8
19
  <option name="SHOW_DIALOG" value="false" />
9
20
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
21
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
22
  <option name="LAST_RESOLUTION" value="IGNORE" />
12
23
  </component>
24
+ <component name="Git.Settings">
25
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
26
+ </component>
27
+ <component name="GitHubPullRequestSearchHistory"><![CDATA[{
28
+ "lastFilter": {
29
+ "state": "OPEN",
30
+ "assignee": "andersmarkc"
31
+ }
32
+ }]]></component>
33
+ <component name="GithubPullRequestsUISettings"><![CDATA[{
34
+ "selectedUrlAndAccountId": {
35
+ "url": "git@github.com:andersmarkc/ai_summary.git",
36
+ "accountId": "0bbf21cb-80eb-4c6d-aa6e-7f5156d440f3"
37
+ }
38
+ }]]></component>
13
39
  <component name="ProblemsViewState">
14
40
  <option name="selectedTabId" value="CurrentFile" />
15
41
  </component>
16
- <component name="ProjectColorInfo"><![CDATA[{
17
- "associatedIndex": 3
18
- }]]></component>
42
+ <component name="ProjectColorInfo">{
43
+ &quot;associatedIndex&quot;: 3
44
+ }</component>
19
45
  <component name="ProjectId" id="30HOYw0CzPfd6UVL8dI2mGUJ0fS" />
46
+ <component name="ProjectLevelVcsManager">
47
+ <ConfirmationsSetting value="2" id="Add" />
48
+ </component>
20
49
  <component name="ProjectViewState">
21
50
  <option name="hideEmptyMiddlePackages" value="true" />
22
51
  <option name="showLibraryContents" value="true" />
@@ -25,7 +54,10 @@
25
54
  "keyToString": {
26
55
  "ModuleVcsDetector.initialDetectionPerformed": "true",
27
56
  "RunOnceActivity.ShowReadmeOnStart": "true",
28
- "com.intellij.lang.ruby.rbs.tools.collection.workspace.sync.RbsCollectionUpdateProjectActivity#LAST_UPDATE_TIMESTAMP": "1753281142507",
57
+ "RunOnceActivity.git.unshallow": "true",
58
+ "com.intellij.lang.ruby.rbs.tools.collection.workspace.sync.RbsCollectionUpdateProjectActivity#LAST_UPDATE_TIMESTAMP": "1753281912802",
59
+ "git-widget-placeholder": "main",
60
+ "last_opened_file_path": "/Users/aj/RubymineProjects/ai_summary/spec",
29
61
  "node.js.detected.package.eslint": "true",
30
62
  "node.js.detected.package.tslint": "true",
31
63
  "node.js.selected.package.eslint": "(autodetect)",
@@ -35,6 +67,12 @@
35
67
  "vue.rearranger.settings.migration": "true"
36
68
  }
37
69
  }]]></component>
70
+ <component name="RecentsManager">
71
+ <key name="CopyFile.RECENT_KEYS">
72
+ <recent name="$PROJECT_DIR$/spec" />
73
+ <recent name="$PROJECT_DIR$" />
74
+ </key>
75
+ </component>
38
76
  <component name="SharedIndexes">
39
77
  <attachedChunks>
40
78
  <set>
@@ -51,10 +89,79 @@
51
89
  <option name="presentableId" value="Default" />
52
90
  <updated>1753281082472</updated>
53
91
  <workItem from="1753281097573" duration="753000" />
92
+ <workItem from="1753281853845" duration="3150000" />
54
93
  </task>
94
+ <task id="LOCAL-00001" summary="Add README and Gemspec">
95
+ <option name="closed" value="true" />
96
+ <created>1753281896707</created>
97
+ <option name="number" value="00001" />
98
+ <option name="presentableId" value="LOCAL-00001" />
99
+ <option name="project" value="LOCAL" />
100
+ <updated>1753281896707</updated>
101
+ </task>
102
+ <task id="LOCAL-00002" summary="Update Readme">
103
+ <option name="closed" value="true" />
104
+ <created>1753281955589</created>
105
+ <option name="number" value="00002" />
106
+ <option name="presentableId" value="LOCAL-00002" />
107
+ <option name="project" value="LOCAL" />
108
+ <updated>1753281955589</updated>
109
+ </task>
110
+ <task id="LOCAL-00003" summary="Test Github Action">
111
+ <option name="closed" value="true" />
112
+ <created>1753282623109</created>
113
+ <option name="number" value="00003" />
114
+ <option name="presentableId" value="LOCAL-00003" />
115
+ <option name="project" value="LOCAL" />
116
+ <updated>1753282623109</updated>
117
+ </task>
118
+ <task id="LOCAL-00004" summary="Test Github Action">
119
+ <option name="closed" value="true" />
120
+ <created>1753282692552</created>
121
+ <option name="number" value="00004" />
122
+ <option name="presentableId" value="LOCAL-00004" />
123
+ <option name="project" value="LOCAL" />
124
+ <updated>1753282692552</updated>
125
+ </task>
126
+ <task id="LOCAL-00005" summary="Test Github Action v2">
127
+ <option name="closed" value="true" />
128
+ <created>1753282869396</created>
129
+ <option name="number" value="00005" />
130
+ <option name="presentableId" value="LOCAL-00005" />
131
+ <option name="project" value="LOCAL" />
132
+ <updated>1753282869396</updated>
133
+ </task>
134
+ <task id="LOCAL-00006" summary="Test Github Action v3">
135
+ <option name="closed" value="true" />
136
+ <created>1753283147557</created>
137
+ <option name="number" value="00006" />
138
+ <option name="presentableId" value="LOCAL-00006" />
139
+ <option name="project" value="LOCAL" />
140
+ <updated>1753283147557</updated>
141
+ </task>
142
+ <option name="localTasksCounter" value="7" />
55
143
  <servers />
56
144
  </component>
57
145
  <component name="TypeScriptGeneratedFilesManager">
58
146
  <option name="version" value="3" />
59
147
  </component>
148
+ <component name="Vcs.Log.Tabs.Properties">
149
+ <option name="TAB_STATES">
150
+ <map>
151
+ <entry key="MAIN">
152
+ <value>
153
+ <State />
154
+ </value>
155
+ </entry>
156
+ </map>
157
+ </option>
158
+ </component>
159
+ <component name="VcsManagerConfiguration">
160
+ <MESSAGE value="Add README and Gemspec" />
161
+ <MESSAGE value="Update Readme" />
162
+ <MESSAGE value="Test Github Action" />
163
+ <MESSAGE value="Test Github Action v2" />
164
+ <MESSAGE value="Test Github Action v3" />
165
+ <option name="LAST_COMMIT_MESSAGE" value="Test Github Action v3" />
166
+ </component>
60
167
  </project>
@@ -0,0 +1,94 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require "yaml"
5
+
6
+ module AiSummary
7
+ class SummaryGenerator
8
+ def self.generate(format: "txt")
9
+ # Ensure models are loaded
10
+ Dir[Rails.root.join("app/models/**/*.rb")].sort.each { |file| require_dependency file }
11
+
12
+ data = {
13
+ models: extract_models,
14
+ routes: extract_routes,
15
+ controllers: extract_controllers
16
+ }
17
+
18
+ case format.downcase
19
+ when "json"
20
+ File.write("rails_summary.json", JSON.pretty_generate(data))
21
+ puts "✅ AI Summary generated in rails_summary.json"
22
+ when "yaml", "yml"
23
+ File.write("rails_summary.yaml", data.to_yaml)
24
+ puts "✅ AI Summary generated in rails_summary.yaml"
25
+ else
26
+ File.write("rails_summary.txt", format_txt(data))
27
+ puts "✅ AI Summary generated in rails_summary.txt"
28
+ end
29
+ end
30
+
31
+ def self.extract_models
32
+ ActiveRecord::Base.descendants.reject { |m| m.abstract_class? || !m.table_exists? }.map do |model|
33
+ {
34
+ name: model.name,
35
+ table: model.table_name,
36
+ columns: model.columns.map { |col| { name: col.name, type: col.type } },
37
+ associations: model.reflect_on_all_associations.map { |assoc| { type: assoc.macro, name: assoc.name } }
38
+ }
39
+ end
40
+ end
41
+
42
+ def self.extract_routes
43
+ Rails.application.routes.routes.map do |r|
44
+ verb = r.verb&.gsub(/\W/, "")
45
+ next unless r.defaults[:controller] && r.defaults[:action]
46
+
47
+ {
48
+ verb: verb,
49
+ path: r.path.spec.to_s,
50
+ controller: r.defaults[:controller],
51
+ action: r.defaults[:action]
52
+ }
53
+ end.compact
54
+ end
55
+
56
+ def self.extract_controllers
57
+ Dir.glob(Rails.root.join("app/controllers/**/*_controller.rb")).map do |file|
58
+ class_name = File.basename(file, ".rb").camelize
59
+ klass = class_name.safe_constantize
60
+ next unless klass.is_a?(Class)
61
+ {
62
+ name: klass.name,
63
+ actions: klass.public_instance_methods(false).map(&:to_s)
64
+ }
65
+ end.compact
66
+ end
67
+
68
+ def self.format_txt(data)
69
+ lines = []
70
+
71
+ lines << "# MODELS"
72
+ data[:models].each do |model|
73
+ lines << "#{model[:name]} (table: #{model[:table]})"
74
+ model[:columns].each { |col| lines << " - #{col[:name]}: #{col[:type]}" }
75
+ model[:associations].each { |assoc| lines << " - #{assoc[:type]} :#{assoc[:name]}" }
76
+ lines << ""
77
+ end
78
+
79
+ lines << "# ROUTES"
80
+ data[:routes].each do |route|
81
+ lines << "#{route[:verb].to_s.ljust(6)} #{route[:path]} => #{route[:controller]}##{route[:action]}"
82
+ end
83
+
84
+ lines << "# CONTROLLERS"
85
+ data[:controllers].each do |ctrl|
86
+ lines << ctrl[:name]
87
+ ctrl[:actions].each { |action| lines << " - #{action}" }
88
+ lines << ""
89
+ end
90
+
91
+ lines.join("\n")
92
+ end
93
+ end
94
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AiSummary
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
data/lib/ai_summary.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "ai_summary/version"
4
+ require_relative "ai_summary/summary_generator"
5
+
6
+ # Auto-load Rake tasks
7
+ task_file = File.expand_path("../tasks/ai_summary.rake", __FILE__)
8
+ load task_file if defined?(Rake)
4
9
 
5
10
  module AiSummary
6
11
  class Error < StandardError; end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :ai_summary do
4
+ desc "Generate AI Summary of your Rails app. Optionally specify FORMAT=json or FORMAT=yaml"
5
+ task :generate, [:format] => :environment do |t, args|
6
+ format = args[:format]&.downcase || "txt"
7
+ AiSummary::SummaryGenerator.generate(format: format)
8
+ end
9
+ end
data/rails_summary.txt ADDED
@@ -0,0 +1,13 @@
1
+ # MODELS
2
+ User (table: users)
3
+ - id: integer
4
+ - email: string
5
+ - created_at: datetime
6
+ - updated_at: datetime
7
+
8
+ # ROUTES
9
+ GET /up(.:format) => rails/health#show
10
+ GET /service-worker(.:format) => rails/pwa#service_worker
11
+ GET /manifest(.:format) => rails/pwa#manifest
12
+ # CONTROLLERS
13
+ ApplicationController
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ai_summary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - Anders Mark Jonassen
7
+ - Anders Jonassen
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-07-23 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rails
@@ -15,42 +16,42 @@ dependencies:
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
- version: '6.1'
19
+ version: '7.1'
19
20
  type: :runtime
20
21
  prerelease: false
21
22
  version_requirements: !ruby/object:Gem::Requirement
22
23
  requirements:
23
24
  - - "~>"
24
25
  - !ruby/object:Gem::Version
25
- version: '6.1'
26
+ version: '7.1'
26
27
  - !ruby/object:Gem::Dependency
27
28
  name: activerecord
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - "~>"
31
32
  - !ruby/object:Gem::Version
32
- version: '6.1'
33
+ version: '7.1'
33
34
  type: :runtime
34
35
  prerelease: false
35
36
  version_requirements: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - "~>"
38
39
  - !ruby/object:Gem::Version
39
- version: '6.1'
40
+ version: '7.1'
40
41
  - !ruby/object:Gem::Dependency
41
42
  name: activesupport
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
- version: '6.1'
47
+ version: '7.1'
47
48
  type: :runtime
48
49
  prerelease: false
49
50
  version_requirements: !ruby/object:Gem::Requirement
50
51
  requirements:
51
52
  - - "~>"
52
53
  - !ruby/object:Gem::Version
53
- version: '6.1'
54
+ version: '7.1'
54
55
  - !ruby/object:Gem::Dependency
55
56
  name: rspec
56
57
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +104,7 @@ executables: []
103
104
  extensions: []
104
105
  extra_rdoc_files: []
105
106
  files:
107
+ - ".github/workflows/rubygems.yml"
106
108
  - ".idea/workspace.xml"
107
109
  - CHANGELOG.md
108
110
  - CODE_OF_CONDUCT.md
@@ -110,7 +112,10 @@ files:
110
112
  - README.md
111
113
  - Rakefile
112
114
  - lib/ai_summary.rb
115
+ - lib/ai_summary/summary_generator.rb
113
116
  - lib/ai_summary/version.rb
117
+ - lib/tasks/ai_summary.rake
118
+ - rails_summary.txt
114
119
  - sig/ai_summary.rbs
115
120
  homepage: https://github.com/andersmarkc/ai_summary
116
121
  licenses:
@@ -120,6 +125,7 @@ metadata:
120
125
  homepage_uri: https://github.com/andersmarkc/ai_summary
121
126
  source_code_uri: https://github.com/andersmarkc/ai_summary
122
127
  changelog_uri: https://github.com/andersmarkc/ai_summary/blob/main/CHANGELOG.md
128
+ post_install_message:
123
129
  rdoc_options: []
124
130
  require_paths:
125
131
  - lib
@@ -134,7 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
140
  - !ruby/object:Gem::Version
135
141
  version: '0'
136
142
  requirements: []
137
- rubygems_version: 3.6.7
143
+ rubygems_version: 3.4.19
144
+ signing_key:
138
145
  specification_version: 4
139
146
  summary: Generate a structured summary of your Rails codebase for AI-assisted workflows.
140
147
  test_files: []