diff --git a/app/controllers/commands_controller.rb b/app/controllers/commands_controller.rb
index c1ca646ba..4575be7f7 100644
--- a/app/controllers/commands_controller.rb
+++ b/app/controllers/commands_controller.rb
@@ -1,4 +1,8 @@
class CommandsController < ApplicationController
+ def index
+ @commands = Current.user.commands.order(created_at: :desc).limit(20)
+ end
+
def create
command = parse_command(params[:command])
diff --git a/app/models/command.rb b/app/models/command.rb
index fb8cfbd2c..34d88ac27 100644
--- a/app/models/command.rb
+++ b/app/models/command.rb
@@ -3,6 +3,10 @@ class Command < ApplicationRecord
belongs_to :user
+ def title
+ model_name.human
+ end
+
def execute
end
diff --git a/app/models/command/go_to_user.rb b/app/models/command/go_to_user.rb
index e549b0f99..559845215 100644
--- a/app/models/command/go_to_user.rb
+++ b/app/models/command/go_to_user.rb
@@ -8,7 +8,7 @@ class Command::GoToUser < Command
end
def title
- "Open user '#{user.name}'"
+ "View profile of '#{user.name}'"
end
private
diff --git a/app/views/commands/_command.html.erb b/app/views/commands/_command.html.erb
new file mode 100644
index 000000000..8813211c0
--- /dev/null
+++ b/app/views/commands/_command.html.erb
@@ -0,0 +1,3 @@
+
+ <%= command.title %>
+
diff --git a/app/views/commands/_terminal.html.erb b/app/views/commands/_terminal.html.erb
index ae80a5402..3a78a4d8b 100644
--- a/app/views/commands/_terminal.html.erb
+++ b/app/views/commands/_terminal.html.erb
@@ -1,10 +1,7 @@
<%= tag.div class: "terminal full-width flex flex-column gap justify-end", data: {
controller: "toggle-class commands",
toggle_class_toggle_class: "terminal--open" } do %>
-
+ <%= turbo_frame_tag :recent_commands, src: commands_path %>
<%= form_tag commands_path,
class: "flex align-center gap-half",
diff --git a/app/views/commands/index.html.erb b/app/views/commands/index.html.erb
new file mode 100644
index 000000000..2283041a6
--- /dev/null
+++ b/app/views/commands/index.html.erb
@@ -0,0 +1,5 @@
+<%= turbo_frame_tag :recent_commands do %>
+
+ <%= render partial: "commands/command", collection: @commands %>
+
+<% end %>
diff --git a/db/migrate/20250505123008_create_commands.rb b/db/migrate/20250505123008_create_commands.rb
index 61b3868eb..6bc445391 100644
--- a/db/migrate/20250505123008_create_commands.rb
+++ b/db/migrate/20250505123008_create_commands.rb
@@ -2,6 +2,7 @@ class CreateCommands < ActiveRecord::Migration[8.1]
def change
create_table :commands do |t|
t.references :user, null: false, foreign_key: true, index: true
+ t.string :type
t.json :data, default: {}
t.timestamps
diff --git a/db/schema.rb b/db/schema.rb
index f64ff1720..41975d588 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -162,6 +162,7 @@ ActiveRecord::Schema[8.1].define(version: 2025_05_05_123008) do
create_table "commands", force: :cascade do |t|
t.datetime "created_at", null: false
t.json "data", default: {}
+ t.string "type"
t.datetime "updated_at", null: false
t.integer "user_id", null: false
t.index ["user_id"], name: "index_commands_on_user_id"
diff --git a/db/schema_cache.yml b/db/schema_cache.yml
index 86315984a..e8165593a 100644
--- a/db/schema_cache.yml
+++ b/db/schema_cache.yml
@@ -553,6 +553,16 @@ columns:
collation:
comment:
- *6
+ - !ruby/object:ActiveRecord::ConnectionAdapters::SQLite3::Column
+ auto_increment:
+ name: type
+ cast_type: *7
+ sql_type_metadata: *8
+ 'null': true
+ default:
+ default_function:
+ collation:
+ comment:
- *9
- *24
comments: