ai_summary 0.1.1 → 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 +4 -4
- data/.idea/workspace.xml +39 -6
- data/lib/ai_summary/summary_generator.rb +94 -0
- data/lib/ai_summary/version.rb +1 -1
- data/lib/ai_summary.rb +5 -0
- data/lib/tasks/ai_summary.rake +9 -0
- data/rails_summary.txt +13 -0
- metadata +10 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9e5afadae25c6eec8f7868c465c3c7406c2c435b7b0079f3027c9e3de93239a
|
|
4
|
+
data.tar.gz: 5df38f04842ad2099a6bbb816948e4296437e4a4b3c747df687c9d8c7eb88f08
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32443309a2d81e9daba6e13b51a6682a5e4c03d98cc73058c7794cac8594b1bb4039b8bed7145f36c06677685f9b7828e83e0a4c0ff2a93272f7b73c307cff2f
|
|
7
|
+
data.tar.gz: 65f99737a7dfdada670013b6795ce1e0a0078fc4072830cc39ec471808d8fdff395db07654a5416f97b09ddd19d4033e2f150b4c61b2c6daaf83c430d2c51e5c
|
data/.idea/workspace.xml
CHANGED
|
@@ -4,8 +4,17 @@
|
|
|
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="Test Github Action
|
|
8
|
-
<change
|
|
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" />
|
|
9
18
|
</list>
|
|
10
19
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
20
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -34,6 +43,9 @@
|
|
|
34
43
|
"associatedIndex": 3
|
|
35
44
|
}</component>
|
|
36
45
|
<component name="ProjectId" id="30HOYw0CzPfd6UVL8dI2mGUJ0fS" />
|
|
46
|
+
<component name="ProjectLevelVcsManager">
|
|
47
|
+
<ConfirmationsSetting value="2" id="Add" />
|
|
48
|
+
</component>
|
|
37
49
|
<component name="ProjectViewState">
|
|
38
50
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
39
51
|
<option name="showLibraryContents" value="true" />
|
|
@@ -45,7 +57,7 @@
|
|
|
45
57
|
"RunOnceActivity.git.unshallow": "true",
|
|
46
58
|
"com.intellij.lang.ruby.rbs.tools.collection.workspace.sync.RbsCollectionUpdateProjectActivity#LAST_UPDATE_TIMESTAMP": "1753281912802",
|
|
47
59
|
"git-widget-placeholder": "main",
|
|
48
|
-
"last_opened_file_path": "/Users/aj/RubymineProjects/ai_summary",
|
|
60
|
+
"last_opened_file_path": "/Users/aj/RubymineProjects/ai_summary/spec",
|
|
49
61
|
"node.js.detected.package.eslint": "true",
|
|
50
62
|
"node.js.detected.package.tslint": "true",
|
|
51
63
|
"node.js.selected.package.eslint": "(autodetect)",
|
|
@@ -57,6 +69,7 @@
|
|
|
57
69
|
}]]></component>
|
|
58
70
|
<component name="RecentsManager">
|
|
59
71
|
<key name="CopyFile.RECENT_KEYS">
|
|
72
|
+
<recent name="$PROJECT_DIR$/spec" />
|
|
60
73
|
<recent name="$PROJECT_DIR$" />
|
|
61
74
|
</key>
|
|
62
75
|
</component>
|
|
@@ -76,7 +89,7 @@
|
|
|
76
89
|
<option name="presentableId" value="Default" />
|
|
77
90
|
<updated>1753281082472</updated>
|
|
78
91
|
<workItem from="1753281097573" duration="753000" />
|
|
79
|
-
<workItem from="1753281853845" duration="
|
|
92
|
+
<workItem from="1753281853845" duration="3150000" />
|
|
80
93
|
</task>
|
|
81
94
|
<task id="LOCAL-00001" summary="Add README and Gemspec">
|
|
82
95
|
<option name="closed" value="true" />
|
|
@@ -118,17 +131,37 @@
|
|
|
118
131
|
<option name="project" value="LOCAL" />
|
|
119
132
|
<updated>1753282869396</updated>
|
|
120
133
|
</task>
|
|
121
|
-
<
|
|
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" />
|
|
122
143
|
<servers />
|
|
123
144
|
</component>
|
|
124
145
|
<component name="TypeScriptGeneratedFilesManager">
|
|
125
146
|
<option name="version" value="3" />
|
|
126
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>
|
|
127
159
|
<component name="VcsManagerConfiguration">
|
|
128
160
|
<MESSAGE value="Add README and Gemspec" />
|
|
129
161
|
<MESSAGE value="Update Readme" />
|
|
130
162
|
<MESSAGE value="Test Github Action" />
|
|
131
163
|
<MESSAGE value="Test Github Action v2" />
|
|
132
|
-
<
|
|
164
|
+
<MESSAGE value="Test Github Action v3" />
|
|
165
|
+
<option name="LAST_COMMIT_MESSAGE" value="Test Github Action v3" />
|
|
133
166
|
</component>
|
|
134
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
|
data/lib/ai_summary/version.rb
CHANGED
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,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ai_summary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Anders Jonassen
|
|
@@ -16,42 +16,42 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '7.1'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '7.1'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: activerecord
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
33
|
+
version: '7.1'
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
40
|
+
version: '7.1'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: activesupport
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '7.1'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '7.1'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rspec
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -112,7 +112,10 @@ files:
|
|
|
112
112
|
- README.md
|
|
113
113
|
- Rakefile
|
|
114
114
|
- lib/ai_summary.rb
|
|
115
|
+
- lib/ai_summary/summary_generator.rb
|
|
115
116
|
- lib/ai_summary/version.rb
|
|
117
|
+
- lib/tasks/ai_summary.rake
|
|
118
|
+
- rails_summary.txt
|
|
116
119
|
- sig/ai_summary.rbs
|
|
117
120
|
homepage: https://github.com/andersmarkc/ai_summary
|
|
118
121
|
licenses:
|