Feature Request
tmuxinator supports on_project_first_start — a lifecycle hook that fires only on first session creation, not on subsequent starts when the session already exists.
tmuxinator reference
From ~/study/ruby/tmuxinator/lib/tmuxinator/hooks/project.rb:17-20 and template.erb:16-22:
<%- if append? || !tmux_has_session?(name) -%>
# First start path — on_project_first_start fires here
<%= hook_on_project_first_start %>
# ... create session ...
<%- else -%>
# Restart path — on_project_restart fires here
<% end %>
The hook fires when !tmux_has_session?(name) — i.e., only when the session doesn't already exist.
Use case
on_project_first_start: rake db:create && rake db:migrate
on_project_restart: rake db:migrate
on_project_start: echo "starting"
- First
tmuxinator start: runs db:create && db:migrate (first start) + echo starting (always)
- Subsequent
tmuxinator start: runs db:migrate (restart) + echo starting (always)
Current state
- The tmuxinator importer now passes
on_project_first_start through with a warning (commit da089cc6)
- The builder does not yet implement this hook
- tmuxp has
on_project_start (fires always) and on_project_restart (fires when session exists)
Implementation
In src/tmuxp/cli/load.py, the session-exists check at line 716 already distinguishes new vs existing sessions. The on_project_first_start hook should fire in the "new session" path (line 744) but NOT in the "session exists" path (line 716).
Files
src/tmuxp/cli/load.py — fire hook in new-session path only
src/tmuxp/workspace/loader.py — add to hook expansion list
src/tmuxp/workspace/importers.py — remove warning (already passes through)
Feature Request
tmuxinator supports
on_project_first_start— a lifecycle hook that fires only on first session creation, not on subsequent starts when the session already exists.tmuxinator reference
From
~/study/ruby/tmuxinator/lib/tmuxinator/hooks/project.rb:17-20andtemplate.erb:16-22:The hook fires when
!tmux_has_session?(name)— i.e., only when the session doesn't already exist.Use case
tmuxinator start: runsdb:create && db:migrate(first start) +echo starting(always)tmuxinator start: runsdb:migrate(restart) +echo starting(always)Current state
on_project_first_startthrough with a warning (commitda089cc6)on_project_start(fires always) andon_project_restart(fires when session exists)Implementation
In
src/tmuxp/cli/load.py, the session-exists check at line 716 already distinguishes new vs existing sessions. Theon_project_first_starthook should fire in the "new session" path (line 744) but NOT in the "session exists" path (line 716).Files
src/tmuxp/cli/load.py— fire hook in new-session path onlysrc/tmuxp/workspace/loader.py— add to hook expansion listsrc/tmuxp/workspace/importers.py— remove warning (already passes through)