rails-markup 1.4.6 → 1.5.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.
@@ -12,8 +12,8 @@ module RailsMarkup
12
12
 
13
13
  desc "Install Rails Markup: create migration, initializer, auth controller, toolbar, and mount engine routes."
14
14
 
15
- class_option :mount_path, type: :string, default: "/admin/annotations",
16
- desc: "Path to mount the Rails Markup engine"
15
+ class_option :mount_path, type: :string, default: nil,
16
+ desc: "Path to mount the Rails Markup engine (leave blank to be prompted)"
17
17
  class_option :base_controller, type: :string, default: "ApplicationController",
18
18
  desc: "Base controller class for authentication"
19
19
  class_option :layout, type: :string, default: "application",
@@ -59,7 +59,7 @@ module RailsMarkup
59
59
  end
60
60
 
61
61
  def mount_engine
62
- mount_path = options[:mount_path]
62
+ mount_path = resolved_mount_path
63
63
  route_line = %{mount RailsMarkup::Engine, at: "#{mount_path}" if defined?(RailsMarkup::Engine)}
64
64
  route route_line
65
65
  end
@@ -140,7 +140,7 @@ module RailsMarkup
140
140
  dev_url = detect_dev_url
141
141
  env_updates = {
142
142
  "RAILS_MARKUP_DEV_URL" => dev_url,
143
- "RAILS_MARKUP_MOUNT_PATH" => options[:mount_path]
143
+ "RAILS_MARKUP_MOUNT_PATH" => resolved_mount_path
144
144
  }
145
145
  config.update_env(env_updates)
146
146
  say_status :create, ".mcp.json (dev URL: #{dev_url})", :green
@@ -159,7 +159,7 @@ module RailsMarkup
159
159
  say ""
160
160
  say "Next steps:"
161
161
  say " 1. Run migrations: rails db:migrate"
162
- say " 2. Visit dashboard: #{options[:mount_path]}"
162
+ say " 2. Visit dashboard: #{resolved_mount_path}"
163
163
  say " 3. Configure auth in config/initializers/rails_markup.rb"
164
164
  say ""
165
165
  dev_url = detect_dev_url
@@ -180,6 +180,40 @@ module RailsMarkup
180
180
 
181
181
  private
182
182
 
183
+ def resolved_mount_path
184
+ @resolved_mount_path ||= begin
185
+ explicit = options[:mount_path]
186
+ return normalize_mount_path(explicit) if explicit && !explicit.strip.empty?
187
+
188
+ prompt_mount_path
189
+ end
190
+ end
191
+
192
+ def prompt_mount_path
193
+ return "/rails-markup" unless interactive_prompt_available?
194
+
195
+ if yes?("Choose a nested prefix before /rails-markup? (for example /admin/rails-markup or /dashboard/rails-markup)")
196
+ prefix = ask("Prefix segment (leave blank for admin)")
197
+ prefix = "admin" if prefix.to_s.strip.empty?
198
+ normalize_mount_path("#{prefix}/rails-markup")
199
+ else
200
+ "/rails-markup"
201
+ end
202
+ end
203
+
204
+ def interactive_prompt_available?
205
+ $stdin.tty? && $stdout.tty?
206
+ end
207
+
208
+ def normalize_mount_path(path)
209
+ value = path.to_s.strip
210
+ value = value.sub(%r{\A/+}, "")
211
+ value = value.sub(%r{/+\z}, "")
212
+ value = "/#{value}"
213
+ value = value.gsub(%r{/+}, "/")
214
+ value == "/" ? "/rails-markup" : value
215
+ end
216
+
183
217
  def migration_version
184
218
  "[#{ActiveRecord::Migration.current_version}]"
185
219
  end
@@ -110,7 +110,7 @@ module RailsMarkup
110
110
  method_option :prod_url, type: :string, desc: "Production URL (RAILS_MARKUP_PROD_URL)"
111
111
  method_option :prod_token, type: :string, desc: "Production API token (RAILS_MARKUP_PROD_TOKEN)"
112
112
  method_option :dev_url, type: :string, desc: "Dev URL (RAILS_MARKUP_DEV_URL)"
113
- method_option :mount_path, type: :string, desc: "Engine mount path (RAILS_MARKUP_MOUNT_PATH)"
113
+ method_option :mount_path, type: :string, desc: "Engine mount path (RAILS_MARKUP_MOUNT_PATH; e.g. /admin/rails-markup)"
114
114
  method_option :global, type: :boolean, default: false, desc: "Write to ~/.claude/settings.json"
115
115
  method_option :codex, type: :boolean, default: false, desc: "Write to ~/.codex/config.toml"
116
116
  def configure
@@ -209,7 +209,7 @@ module RailsMarkup
209
209
  method_option :production, type: :boolean, default: false, desc: "Watch production"
210
210
  method_option :url, type: :string, desc: "Override base URL"
211
211
  method_option :token, type: :string, desc: "Override API token"
212
- method_option :mount_path, type: :string, desc: "Engine mount path"
212
+ method_option :mount_path, type: :string, desc: "Engine mount path (e.g. /admin/rails-markup)"
213
213
  method_option :interval, type: :numeric, default: 5, desc: "Poll interval in seconds"
214
214
  def watch
215
215
  env = resolve_env(options[:production])
@@ -259,7 +259,7 @@ module RailsMarkup
259
259
  method_option :production, type: :boolean, default: false, desc: "Fetch from production"
260
260
  method_option :url, type: :string, desc: "Override base URL"
261
261
  method_option :token, type: :string, desc: "Override API token"
262
- method_option :mount_path, type: :string, desc: "Engine mount path"
262
+ method_option :mount_path, type: :string, desc: "Engine mount path (e.g. /admin/rails-markup)"
263
263
  def pending
264
264
  env = resolve_env(options[:production])
265
265
  return unless env
@@ -433,7 +433,7 @@ module RailsMarkup
433
433
  desc: "Environment to fetch from"
434
434
  method_option :url, type: :string, desc: "Override base URL"
435
435
  method_option :token, type: :string, desc: "Override API token"
436
- method_option :mount_path, type: :string, desc: "Engine mount path (default: /admin/annotations)"
436
+ method_option :mount_path, type: :string, desc: "Engine mount path (default: /admin/rails-markup; e.g. /admin/rails-markup)"
437
437
  def fetch(env_arg = nil)
438
438
  production = env_arg == "production" || options[:production] || options[:environment] == "production"
439
439
  env = resolve_env(production)
@@ -571,7 +571,7 @@ module RailsMarkup
571
571
  sections << " --prod-url URL Production URL"
572
572
  sections << " --prod-token TOKEN Production API token"
573
573
  sections << " --dev-url URL Development URL"
574
- sections << " --mount-path PATH Engine mount path"
574
+ sections << " --mount-path PATH Engine mount path (e.g. /admin/rails-markup)"
575
575
  sections << " --global Write to ~/.claude/settings.json"
576
576
  sections << " --codex Write to ~/.codex/config.toml"
577
577
  sections << " setup-production --url URL Generate token + configure production"
@@ -671,7 +671,7 @@ module RailsMarkup
671
671
  if production
672
672
  base_url = options[:url] || mcp_env["RAILS_MARKUP_PROD_URL"]
673
673
  token = options[:token] || mcp_env["RAILS_MARKUP_PROD_TOKEN"]
674
- mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/annotations"
674
+ mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/rails-markup"
675
675
 
676
676
  unless base_url
677
677
  say "No production URL. Set it via:", :red
@@ -695,7 +695,7 @@ module RailsMarkup
695
695
  else
696
696
  base_url = options[:url] || mcp_env["RAILS_MARKUP_DEV_URL"]
697
697
  token = options[:token] || mcp_env["RAILS_MARKUP_DEV_TOKEN"]
698
- mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/annotations"
698
+ mount = options[:mount_path] || mcp_env["RAILS_MARKUP_MOUNT_PATH"] || "/admin/rails-markup"
699
699
 
700
700
  unless base_url
701
701
  say "No dev URL. Set it via:", :red
@@ -33,10 +33,9 @@ module RailsMarkup
33
33
  # Default: true
34
34
  attr_accessor :toolbar_enabled
35
35
 
36
- # Show the floating action button (FAB) specifically.
37
- # When false, the FAB is hidden but the toolbar system stays active — pins
38
- # still render and the panel is reachable via its toggle. Use when the host
39
- # provides its own trigger or wants read-only pins. Requires toolbar_enabled.
36
+ # Show the floating toolbar (FAB and its expanded controls).
37
+ # When false, the whole dock is hidden; pins and synchronization stay active.
38
+ # Browser preferences can restore it from the engine dashboard. Requires toolbar_enabled.
40
39
  # Default: true
41
40
  attr_accessor :fab_visible
42
41
 
@@ -17,7 +17,7 @@ module RailsMarkup
17
17
  # RAILS_MARKUP_DEV_URL — local Rails server URL (auto-detected on install)
18
18
  # RAILS_MARKUP_PROD_URL — production URL
19
19
  # RAILS_MARKUP_PROD_TOKEN — production API token
20
- # RAILS_MARKUP_MOUNT_PATH — engine mount path (default: /admin/annotations)
20
+ # RAILS_MARKUP_MOUNT_PATH — engine mount path (default: /admin/rails-markup)
21
21
  class McpServer
22
22
  class ToolError < StandardError; end
23
23
  class TargetError < ToolError; end
@@ -184,7 +184,7 @@ module RailsMarkup
184
184
  end
185
185
 
186
186
  def mount_path
187
- config_value("RAILS_MARKUP_MOUNT_PATH") || "/admin/annotations"
187
+ config_value("RAILS_MARKUP_MOUNT_PATH") || "/admin/rails-markup"
188
188
  end
189
189
 
190
190
  def prod_url
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsMarkup
4
- VERSION = "1.4.6"
4
+ VERSION = "1.5.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - InventList
@@ -135,9 +135,12 @@ files:
135
135
  - app/views/rails_markup/dashboard/_annotation_card.html.erb
136
136
  - app/views/rails_markup/dashboard/_annotation_list.html.erb
137
137
  - app/views/rails_markup/dashboard/_annotation_page.html.erb
138
+ - app/views/rails_markup/dashboard/_feedback_modal.html.erb
138
139
  - app/views/rails_markup/dashboard/_filters.html.erb
140
+ - app/views/rails_markup/dashboard/_modal_navigation.html.erb
139
141
  - app/views/rails_markup/dashboard/_stats.html.erb
140
142
  - app/views/rails_markup/dashboard/_styles.html.erb
143
+ - app/views/rails_markup/dashboard/_toolbar_preferences.html.erb
141
144
  - app/views/rails_markup/dashboard/board.html.erb
142
145
  - app/views/rails_markup/dashboard/index.html.erb
143
146
  - app/views/rails_markup/dashboard/show.html.erb
@@ -184,7 +187,7 @@ post_install_message: |
184
187
  rails db:migrate
185
188
 
186
189
  Options:
187
- --mount-path=/admin/annotations (engine route)
190
+ --mount-path=/admin/rails-markup (engine route)
188
191
  --base-controller=AdminController (auth parent class)
189
192
  --layout=application (toolbar injection)
190
193
  rdoc_options: []