tmux-python / tmux-python/tmuxp
Support on_project_first_start lifecycle hook (tmuxinator parity)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 248
- Avg merge
- 2h 13m
- Merged PRs (30d)
- 1
Description
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: runsdb:create && db:migrate(first start) +echo starting(always) - Subsequent
tmuxinator start: runsdb:migrate(restart) +echo starting(always)
Current state
- The tmuxinator importer now passes
on_project_first_startthrough with a warning (commitda089cc6) - The builder does not yet implement this hook
- tmuxp has
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. 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 onlysrc/tmuxp/workspace/loader.py— add to hook expansion listsrc/tmuxp/workspace/importers.py— remove warning (already passes through)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/tmuxp/cli/load.py at the session-exists check around lines 716 and 744, then inspect hook expansion in src/tmuxp/workspace/loader.py. Update src/tmuxp/workspace/importers.py where the pass-through warning is handled. Done means the hook runs only for a new session, not an existing one, while the other lifecycle hooks retain their behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100