- Add KUGETSU_BASE_BRANCH env var (default: origin/main)
- Update check_task_completion() to use configurable base branch
- Update create_worktree() to use configurable base branch
Closes#165
The queue daemon crashes with 'set_debug_mode: command not found'
because cmd_continue() calls set_debug_mode(), but that function
was only defined in the main kugetsu script.
Instead of duplicating the function, move it to kugetsu-config.sh
which is always sourced before kugetsu-session.sh in all contexts.
Fixes#207
1. daemon: use $WORKTREES_DIR instead of $HOME/.kugetsu-worktrees
- Worktrees are created in ~/.kugetsu/worktrees but daemon was checking ~/.kugetsu-worktrees
- This caused cmd_start to be called when cmd_continue should have been
2. load_agent_env: add fallback to pm-agent.env
- When dev.env and default.env don't exist, fallback to pm-agent.env
- Ensures GITEA_TOKEN is available
3. Remove '&& disown' pattern that causes 'no such job' errors
- nohup already makes process immune to SIGHUP
- disown was causing errors because job context was lost
Split the monolithic kugetsu script into modular components:
Modules created:
- kugetsu-config.sh - Config/env loading and global variables
- kugetsu-index.sh - Index.json read/write via JSON
- kugetsu-worktree.sh - Git worktree operations
- kugetsu-log.sh - Structured logging and notifications
- kugetsu-session.sh - Session create/fork/destroy logic
- kugetsu-queue-daemon.sh - Queue daemon subprocess
Main script (kugetsu) is now a thin dispatcher that sources all modules.
Acceptance Criteria:
- All existing commands work exactly as before
- Main script sources modules
- Each module is independently testable
Fixes#116