rubyllm-observ 0.6.0 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0585d05a3b7dcf8789fafd4e6b2fb9a7a938b80427caf2051f1de0b4b312e6e2'
4
- data.tar.gz: f11909cce646368528328c3db82a469983c02e1b157c100cdb633ec54ffb97ce
3
+ metadata.gz: 726aef68722c3080dd618465ad2b3aa764c1b8c8c990ee03b6bd6609e61aa764
4
+ data.tar.gz: 4c3afc1370f209a5a5449a0781d2e575782eb2b48c6d0a1b27d348de28113c73
5
5
  SHA512:
6
- metadata.gz: ac12fb93b47733c0e63adcf4959a050758a9131e71dfa54c1043e84e344c2ba392d9f6f4dd28a1eebff690eb1c51b3ff6707c5f303b43c7618e7477ebbba63eb
7
- data.tar.gz: c2d9d34e3f2e72e2382d3ca9f29f28e871a0897f3149e35b6531b43de21b46756b60dcd0d1a831660528c856613f2bbbe16aa5e0891b602167a1ebb2b14c7050
6
+ metadata.gz: fdb88952b685d2da5852c1a31ea484582af600d918eb76a806a6a8e5570137cd4fad2481a9bdae421b7c87e66039f7df580d72ec0aefab3d0ec9f462ce23406f
7
+ data.tar.gz: 570c0d1c410645f9018421d3e1ddaac667a52f0725992f58f1d3b9b1442bf43f69e03d2105c884648770ebb481fe5d24246bb12468cdc5debef8b52945d9c983
data/README.md CHANGED
@@ -76,9 +76,9 @@ rails db:migrate
76
76
  rails ruby_llm:load_models
77
77
 
78
78
  # Then install Observ
79
- rails observ:install:migrations
80
79
  rails generate observ:install # Core features
81
- rails generate observ:install:chat # Chat feature
80
+ rails generate observ:install_chat # Chat feature
81
+ rails observ:install:migrations
82
82
  rails db:migrate
83
83
  ```
84
84
 
@@ -9,7 +9,7 @@
9
9
  <%# Load Vite assets in environments where the helper is available (e.g., demo app) %>
10
10
  <% if respond_to?(:vite_client_tag) %>
11
11
  <%= vite_client_tag %>
12
- <%= vite_javascript_tag 'application' %>
12
+ <%= vite_javascript_tag 'observ' %>
13
13
  <% end %>
14
14
  </head>
15
15
 
@@ -14,6 +14,7 @@ module Observ
14
14
  # rails generate observ:install --skip-index
15
15
  # rails generate observ:install --skip-routes # Don't auto-mount engine
16
16
  # rails generate observ:install --force # Skip confirmation prompt
17
+ # rails generate observ:install --skip-vite-entrypoint # Don't generate Vite entry point
17
18
  class InstallGenerator < Rails::Generators::Base
18
19
  source_root File.expand_path("templates", __dir__)
19
20
 
@@ -29,8 +30,8 @@ module Observ
29
30
 
30
31
  class_option :skip_index,
31
32
  type: :boolean,
32
- desc: "Skip generation of index files",
33
- default: false
33
+ desc: "Skip generation of index files (default: true, index.js no longer needed)",
34
+ default: true
34
35
 
35
36
  class_option :force,
36
37
  type: :boolean,
@@ -42,6 +43,16 @@ module Observ
42
43
  desc: "Skip automatic route mounting",
43
44
  default: false
44
45
 
46
+ class_option :skip_vite_entrypoint,
47
+ type: :boolean,
48
+ desc: "Skip generation of Vite entry point",
49
+ default: false
50
+
51
+ class_option :vite_entrypoint_dest,
52
+ type: :string,
53
+ desc: "Destination path for Vite entry point (default: app/javascript/entrypoints)",
54
+ default: "app/javascript/entrypoints"
55
+
45
56
  def confirm_installation
46
57
  return if options[:force]
47
58
 
@@ -59,10 +70,12 @@ module Observ
59
70
  js_files_to_copy = collect_files_to_copy("javascripts", "*.js", js_dest)
60
71
  index_will_be_generated = !options[:skip_index] && will_generate_index?(js_dest)
61
72
  route_will_be_added = !options[:skip_routes] && !route_already_exists?
73
+ vite_entrypoint_will_be_created = !options[:skip_vite_entrypoint] && will_create_vite_entrypoint?
62
74
 
63
75
  # Check if there are any changes to make
64
76
  total_changes = stylesheets_to_copy.count + js_files_to_copy.count +
65
- (index_will_be_generated ? 1 : 0) + (route_will_be_added ? 1 : 0)
77
+ (index_will_be_generated ? 1 : 0) + (route_will_be_added ? 1 : 0) +
78
+ (vite_entrypoint_will_be_created ? 1 : 0)
66
79
 
67
80
  if total_changes == 0
68
81
  say "No changes needed - all files are up to date!", :green
@@ -92,9 +105,13 @@ module Observ
92
105
  end
93
106
 
94
107
  # Show generated files
95
- if index_will_be_generated
108
+ generated_files = []
109
+ generated_files << "#{js_dest}/index.js (controller index)" if index_will_be_generated
110
+ generated_files << "#{options[:vite_entrypoint_dest]}/observ.js (Vite entry point)" if vite_entrypoint_will_be_created
111
+
112
+ if generated_files.any?
96
113
  say "Generated Files:", :yellow
97
- say " • #{js_dest}/index.js (controller index)", :white
114
+ generated_files.each { |file| say " • #{file}", :white }
98
115
  say "\n"
99
116
  end
100
117
 
@@ -145,6 +162,26 @@ module Observ
145
162
  )
146
163
  end
147
164
 
165
+ def install_vite_entrypoint
166
+ return if options[:skip_vite_entrypoint]
167
+
168
+ dest_dir = Rails.root.join(options[:vite_entrypoint_dest])
169
+ dest_file = dest_dir.join("observ.js")
170
+
171
+ if dest_file.exist?
172
+ say " Vite entry point already exists: #{dest_file}", :yellow
173
+ return
174
+ end
175
+
176
+ say "Creating Vite entry point...", :cyan
177
+ say "-" * 80, :cyan
178
+
179
+ FileUtils.mkdir_p(dest_dir)
180
+ copy_file "observ.js", dest_file
181
+ say " Created #{dest_file}", :green
182
+ say "\n"
183
+ end
184
+
148
185
  def show_post_install_message
149
186
  say "\n"
150
187
  say "=" * 80, :green
@@ -161,10 +198,18 @@ module Observ
161
198
  end
162
199
 
163
200
  say "Next steps:", :cyan
164
- say " 1. Import stylesheets in your application", :cyan
165
- say " Add to app/javascript/application.js:", :cyan
166
- say " import 'observ'", :cyan
167
- say "\n"
201
+
202
+ if options[:skip_vite_entrypoint]
203
+ say " 1. Import Observ in your application", :cyan
204
+ say " Add to app/javascript/application.js:", :cyan
205
+ say " import 'observ'", :cyan
206
+ say "\n"
207
+ else
208
+ say " 1. Add 'observ' to your Vite entrypoints (if not auto-detected)", :cyan
209
+ say " The entry point was created at: #{options[:vite_entrypoint_dest]}/observ.js", :cyan
210
+ say "\n"
211
+ end
212
+
168
213
  say " 2. Restart your development server", :cyan
169
214
  say " bin/dev or rails server", :cyan
170
215
  say "\n"
@@ -238,6 +283,13 @@ module Observ
238
283
  !index_file.exist?
239
284
  end
240
285
 
286
+ # Check if Vite entry point will be created
287
+ # @return [Boolean] true if observ.js will be created
288
+ def will_create_vite_entrypoint?
289
+ dest_file = Rails.root.join(options[:vite_entrypoint_dest], "observ.js")
290
+ !dest_file.exist?
291
+ end
292
+
241
293
  # Logger adapter for Rails generator
242
294
  class GeneratorLogger
243
295
  def initialize(generator)
@@ -0,0 +1,19 @@
1
+ // Observ Vite entry point
2
+ // This file is loaded via vite_javascript_tag 'observ' in the Observ layout
3
+
4
+ // Import Turbo and Stimulus
5
+ import '@hotwired/turbo-rails'
6
+ import { Application } from '@hotwired/stimulus'
7
+ import { registerControllers } from 'stimulus-vite-helpers'
8
+
9
+ // Import Observ stylesheets
10
+ import '../stylesheets/observ/application.scss'
11
+
12
+ // Start Stimulus application
13
+ const application = Application.start()
14
+ application.debug = false
15
+ window.Stimulus = application
16
+
17
+ // Auto-register all Observ Stimulus controllers
18
+ const controllers = import.meta.glob('../controllers/observ/*_controller.js', { eager: true })
19
+ registerControllers(application, controllers)
@@ -1,3 +1,3 @@
1
1
  module Observ
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyllm-observ
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franck D'agostini
@@ -230,7 +230,6 @@ files:
230
230
  - app/assets/javascripts/observ/controllers/drawer_controller.js
231
231
  - app/assets/javascripts/observ/controllers/expandable_controller.js
232
232
  - app/assets/javascripts/observ/controllers/filter_controller.js
233
- - app/assets/javascripts/observ/controllers/index.js
234
233
  - app/assets/javascripts/observ/controllers/json_viewer_controller.js
235
234
  - app/assets/javascripts/observ/controllers/message_form_controller.js
236
235
  - app/assets/javascripts/observ/controllers/prompt_variables_controller.js
@@ -436,6 +435,7 @@ files:
436
435
  - lib/generators/observ/add_phase_tracking/templates/migration.rb.tt
437
436
  - lib/generators/observ/install/USAGE
438
437
  - lib/generators/observ/install/install_generator.rb
438
+ - lib/generators/observ/install/templates/observ.js
439
439
  - lib/generators/observ/install_chat/install_chat_generator.rb
440
440
  - lib/generators/observ/install_chat/templates/agents/base_agent.rb.tt
441
441
  - lib/generators/observ/install_chat/templates/agents/simple_agent.rb.tt
@@ -1,52 +0,0 @@
1
- // Auto-generated index file for Observ Stimulus controllers
2
- // Register all Observ controllers with the observ-- prefix
3
- //
4
- // This file is designed to be imported by the host application's Stimulus setup.
5
- // The host app should import this file in their controllers/index.js:
6
- // import "./observ"
7
-
8
- import AutoscrollController from "./autoscroll_controller.js"
9
- import ChatFormController from "./chat_form_controller.js"
10
- import CopyController from "./copy_controller.js"
11
- import DashboardController from "./dashboard_controller.js"
12
- import DrawerController from "./drawer_controller.js"
13
- import ExpandableController from "./expandable_controller.js"
14
- import FilterController from "./filter_controller.js"
15
- import JsonViewerController from "./json_viewer_controller.js"
16
- import MessageFormController from "./message_form_controller.js"
17
- import PromptVariablesController from "./prompt_variables_controller.js"
18
- import TextSelectController from "./text_select_controller.js"
19
-
20
- // Export controllers for manual registration if needed
21
- export {
22
- AutoscrollController,
23
- ChatFormController,
24
- CopyController,
25
- DashboardController,
26
- DrawerController,
27
- ExpandableController,
28
- FilterController,
29
- JsonViewerController,
30
- MessageFormController,
31
- PromptVariablesController,
32
- TextSelectController
33
- }
34
-
35
- // Auto-register if Stimulus application is available globally
36
- if (typeof window.Stimulus !== "undefined") {
37
- const application = window.Stimulus
38
-
39
- application.register("observ--autoscroll", AutoscrollController)
40
- application.register("observ--chat-form", ChatFormController)
41
- application.register("observ--copy", CopyController)
42
- application.register("observ--dashboard", DashboardController)
43
- application.register("observ--drawer", DrawerController)
44
- application.register("observ--expandable", ExpandableController)
45
- application.register("observ--filter", FilterController)
46
- application.register("observ--json-viewer", JsonViewerController)
47
- application.register("observ--message-form", MessageFormController)
48
- application.register("observ--prompt-variables", PromptVariablesController)
49
- application.register("observ--text-select", TextSelectController)
50
-
51
- console.log("Observ Stimulus controllers registered")
52
- }