tinker-agent 1.0.0 → 1.0.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.
- package/package.json +1 -1
- package/run-tinker-agent.rb +12 -8
package/package.json
CHANGED
package/run-tinker-agent.rb
CHANGED
|
@@ -205,18 +205,22 @@ def attach_to_agent(agent_type, config)
|
|
|
205
205
|
puts "📎 Attaching to #{agent_type} agent..."
|
|
206
206
|
|
|
207
207
|
# Determine the user to attach as
|
|
208
|
-
#
|
|
209
|
-
|
|
210
|
-
uid = Process.uid
|
|
211
|
-
user = `docker exec #{container_name} getent passwd #{uid} | cut -d: -f1`.strip
|
|
208
|
+
# First try to detect the user the container is running as
|
|
209
|
+
user = `docker exec #{container_name} whoami 2>/dev/null`.strip
|
|
212
210
|
|
|
213
211
|
if user.empty?
|
|
214
|
-
# Fallback to
|
|
215
|
-
|
|
216
|
-
user =
|
|
212
|
+
# Fallback: try to match host UID
|
|
213
|
+
uid = Process.uid
|
|
214
|
+
user = `docker exec #{container_name} getent passwd #{uid} | cut -d: -f1`.strip
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
if user.empty?
|
|
218
|
+
# Fallback: default to rails (standard for this image)
|
|
219
|
+
user = "rails"
|
|
220
|
+
puts "⚠️ Could not detect agent user, defaulting to '#{user}'"
|
|
217
221
|
end
|
|
218
222
|
|
|
219
|
-
puts " User: #{user}
|
|
223
|
+
puts " User: #{user}"
|
|
220
224
|
|
|
221
225
|
# Attach to agent session which has the status bar
|
|
222
226
|
# Must run as agent user since tmux server runs under that user
|