batipanel 0.3.0

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/bin/start.sh ADDED
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env bash
2
+ # batipanel - main entry point
3
+ # alias b='bash ~/.batipanel/bin/start.sh'
4
+
5
+ set -euo pipefail
6
+
7
+ BATIPANEL_HOME="${BATIPANEL_HOME:-$HOME/.batipanel}"
8
+ source "$BATIPANEL_HOME/lib/common.sh"
9
+
10
+ show_help() {
11
+ local ver
12
+ ver=$(cat "$BATIPANEL_HOME/VERSION" 2>/dev/null || echo "unknown")
13
+ echo ""
14
+ echo " batipanel v${ver} - AI workspace manager"
15
+ echo ""
16
+ echo " b <project> Start or resume"
17
+ echo " b <project> --layout <name> Start with specific layout"
18
+ echo " b new <name> [path] Register a new project"
19
+ echo " b reload <project> [--layout <name>] Restart with new layout"
20
+ echo " b stop <project> Stop a session (confirm)"
21
+ echo " b stop <project> -f Stop without confirmation"
22
+ echo " b ls List sessions & projects"
23
+ echo " b layouts Show available layouts"
24
+ echo " b config layout [name] Set default layout"
25
+ echo " b theme [name] Change color theme"
26
+ echo " b doctor Check system health"
27
+ echo " b server [init|start|stop|status] AI server (Telegram bot)"
28
+ echo " b help Show this help"
29
+ echo ""
30
+ echo "Options:"
31
+ echo " --layout, -l <name> Use a specific layout"
32
+ echo " --version, -v Show version"
33
+ echo " --debug Enable debug logging"
34
+ echo " --no-color Disable colored output"
35
+ echo ""
36
+ echo "Examples:"
37
+ echo " b myproject"
38
+ echo " b myproject --layout 6panel"
39
+ echo " b new myproject ~/project/myproject"
40
+ echo " b stop myproject"
41
+ echo ""
42
+ tmux_list
43
+ }
44
+
45
+ # parse arguments
46
+ LAYOUT_ARG=""
47
+ FORCE_FLAG=""
48
+ ARGS=()
49
+ while [[ $# -gt 0 ]]; do
50
+ case "$1" in
51
+ --layout|-l)
52
+ if [[ $# -lt 2 ]]; then
53
+ echo -e "${RED}--layout requires a layout name${NC}"; exit 1
54
+ fi
55
+ LAYOUT_ARG="$2"
56
+ shift 2
57
+ ;;
58
+ --version|-v)
59
+ echo "batipanel $(cat "$BATIPANEL_HOME/VERSION" 2>/dev/null || echo 'unknown')"
60
+ exit 0
61
+ ;;
62
+ --debug)
63
+ export BATIPANEL_DEBUG=1
64
+ shift
65
+ ;;
66
+ --no-color)
67
+ export BATIPANEL_NO_COLOR=1
68
+ RED='' GREEN='' YELLOW='' BLUE='' NC=''
69
+ shift
70
+ ;;
71
+ -f)
72
+ FORCE_FLAG="-f"
73
+ shift
74
+ ;;
75
+ *)
76
+ ARGS+=("$1")
77
+ shift
78
+ ;;
79
+ esac
80
+ done
81
+
82
+ case "${ARGS[0]:-}" in
83
+ new)
84
+ tmux_new "${ARGS[1]:-}" "${ARGS[2]:-}"
85
+ ;;
86
+ reload)
87
+ tmux_stop "${ARGS[1]:-}" "-f"
88
+ sleep 0.3
89
+ tmux_start "${ARGS[1]:-}" "$LAYOUT_ARG"
90
+ ;;
91
+ stop)
92
+ tmux_stop "${ARGS[1]:-}" "$FORCE_FLAG"
93
+ ;;
94
+ ls|list)
95
+ tmux_list
96
+ ;;
97
+ layouts)
98
+ list_layouts
99
+ ;;
100
+ config)
101
+ tmux_config "${ARGS[1]:-}" "${ARGS[2]:-}"
102
+ ;;
103
+ theme)
104
+ tmux_theme "${ARGS[1]:-}"
105
+ ;;
106
+ doctor)
107
+ tmux_doctor
108
+ ;;
109
+ server)
110
+ server_cmd "${ARGS[1]:-}" "${ARGS[2]:-}" "${ARGS[3]:-}"
111
+ ;;
112
+ help)
113
+ show_help
114
+ ;;
115
+ "")
116
+ if is_first_run; then
117
+ run_wizard || show_help
118
+ else
119
+ show_help
120
+ fi
121
+ ;;
122
+ *)
123
+ if [ -f "$BATIPANEL_HOME/projects/${ARGS[0]}.sh" ]; then
124
+ tmux_start "${ARGS[0]}" "$LAYOUT_ARG"
125
+ else
126
+ echo -e "${RED}Unknown command: ${ARGS[0]}${NC}"
127
+ echo " Run 'b help' for usage"
128
+ exit 1
129
+ fi
130
+ ;;
131
+ esac
@@ -0,0 +1,88 @@
1
+ #compdef batipanel b
2
+
3
+ _batipanel_projects() {
4
+ local home="${BATIPANEL_HOME:-$HOME/.batipanel}"
5
+ local -a projects
6
+ if [[ -d "$home/projects" ]]; then
7
+ projects=(${(f)"$(find "$home/projects" -name '*.sh' -exec basename {} .sh \; 2>/dev/null)"})
8
+ fi
9
+ compadd -a projects
10
+ }
11
+
12
+ _batipanel_layouts() {
13
+ local home="${BATIPANEL_HOME:-$HOME/.batipanel}"
14
+ local -a layouts
15
+ if [[ -d "$home/layouts" ]]; then
16
+ layouts=(${(f)"$(find "$home/layouts" -name '*.sh' -exec basename {} .sh \; 2>/dev/null)"})
17
+ fi
18
+ compadd -a layouts
19
+ }
20
+
21
+ _batipanel() {
22
+ local -a commands=(
23
+ 'new:Register a new project'
24
+ 'reload:Restart with new layout'
25
+ 'stop:Stop a session'
26
+ 'ls:List sessions and projects'
27
+ 'list:List sessions and projects'
28
+ 'layouts:Show available layouts'
29
+ 'config:Change settings'
30
+ 'theme:Change color theme'
31
+ 'help:Show help'
32
+ 'doctor:Check system health'
33
+ )
34
+
35
+ _arguments -C \
36
+ '--layout[Use specific layout]: :_batipanel_layouts' \
37
+ '-l[Use specific layout]: :_batipanel_layouts' \
38
+ '--debug[Enable debug logging]' \
39
+ '--version[Show version]' \
40
+ '-v[Show version]' \
41
+ '-f[Force (skip confirmation)]' \
42
+ '1: :->first' \
43
+ '*: :->rest'
44
+
45
+ case $state in
46
+ first)
47
+ _describe 'command' commands
48
+ _batipanel_projects
49
+ ;;
50
+ rest)
51
+ case ${words[2]} in
52
+ new)
53
+ if (( CURRENT == 3 )); then
54
+ _message 'project name'
55
+ elif (( CURRENT == 4 )); then
56
+ _directories
57
+ fi
58
+ ;;
59
+ reload|stop)
60
+ _batipanel_projects
61
+ ;;
62
+ theme)
63
+ if (( CURRENT == 3 )); then
64
+ compadd default dracula nord gruvbox tokyo-night catppuccin rose-pine kanagawa catppuccin rose-pine kanagawa list
65
+ fi
66
+ ;;
67
+ config)
68
+ if (( CURRENT == 3 )); then
69
+ compadd layout theme iterm-cc
70
+ elif (( CURRENT == 4 )) && [[ ${words[3]} == layout ]]; then
71
+ _batipanel_layouts
72
+ elif (( CURRENT == 4 )) && [[ ${words[3]} == theme ]]; then
73
+ compadd default dracula nord gruvbox tokyo-night catppuccin rose-pine kanagawa
74
+ elif (( CURRENT == 4 )) && [[ ${words[3]} == iterm-cc ]]; then
75
+ compadd on off
76
+ fi
77
+ ;;
78
+ *)
79
+ _arguments \
80
+ '--layout[Use specific layout]: :_batipanel_layouts' \
81
+ '-l[Use specific layout]: :_batipanel_layouts'
82
+ ;;
83
+ esac
84
+ ;;
85
+ esac
86
+ }
87
+
88
+ _batipanel "$@"
@@ -0,0 +1,77 @@
1
+ # bash completion for batipanel (b)
2
+ _batipanel() {
3
+ local cur prev words cword
4
+ _init_completion || return
5
+
6
+ local home="${BATIPANEL_HOME:-$HOME/.batipanel}"
7
+
8
+ # subcommands
9
+ local commands="new reload stop ls list layouts config theme help doctor"
10
+
11
+ # first argument: subcommand or project name
12
+ if [[ $cword -eq 1 ]]; then
13
+ local projects=""
14
+ if [[ -d "$home/projects" ]]; then
15
+ projects=$(find "$home/projects" -name '*.sh' -exec basename {} .sh \; 2>/dev/null)
16
+ fi
17
+ mapfile -t COMPREPLY < <(compgen -W "$commands $projects" -- "$cur")
18
+ return
19
+ fi
20
+
21
+ case "${words[1]}" in
22
+ new)
23
+ # second arg: project name (no completion), third arg: directory
24
+ if [[ $cword -eq 3 ]]; then
25
+ _filedir -d
26
+ fi
27
+ ;;
28
+ reload|stop)
29
+ # complete project names
30
+ if [[ $cword -eq 2 ]]; then
31
+ local projects=""
32
+ if [[ -d "$home/projects" ]]; then
33
+ projects=$(find "$home/projects" -name '*.sh' -exec basename {} .sh \; 2>/dev/null)
34
+ fi
35
+ mapfile -t COMPREPLY < <(compgen -W "$projects" -- "$cur")
36
+ fi
37
+ ;;
38
+ theme)
39
+ if [[ $cword -eq 2 ]]; then
40
+ mapfile -t COMPREPLY < <(compgen -W "default dracula nord gruvbox tokyo-night catppuccin rose-pine kanagawa list" -- "$cur")
41
+ fi
42
+ ;;
43
+ config)
44
+ if [[ $cword -eq 2 ]]; then
45
+ mapfile -t COMPREPLY < <(compgen -W "layout theme iterm-cc" -- "$cur")
46
+ elif [[ $cword -eq 3 && "${words[2]}" == "theme" ]]; then
47
+ mapfile -t COMPREPLY < <(compgen -W "default dracula nord gruvbox tokyo-night catppuccin rose-pine kanagawa" -- "$cur")
48
+ elif [[ $cword -eq 3 && "${words[2]}" == "iterm-cc" ]]; then
49
+ mapfile -t COMPREPLY < <(compgen -W "on off" -- "$cur")
50
+ elif [[ $cword -eq 3 && "${words[2]}" == "layout" ]]; then
51
+ local layouts=""
52
+ if [[ -d "$home/layouts" ]]; then
53
+ layouts=$(find "$home/layouts" -name '*.sh' -exec basename {} .sh \; 2>/dev/null)
54
+ fi
55
+ mapfile -t COMPREPLY < <(compgen -W "$layouts" -- "$cur")
56
+ fi
57
+ ;;
58
+ *)
59
+ # project name given — complete flags
60
+ case "$prev" in
61
+ --layout|-l)
62
+ local layouts=""
63
+ if [[ -d "$home/layouts" ]]; then
64
+ layouts=$(find "$home/layouts" -name '*.sh' -exec basename {} .sh \; 2>/dev/null)
65
+ fi
66
+ mapfile -t COMPREPLY < <(compgen -W "$layouts" -- "$cur")
67
+ ;;
68
+ *)
69
+ mapfile -t COMPREPLY < <(compgen -W "--layout --debug --version -f" -- "$cur")
70
+ ;;
71
+ esac
72
+ ;;
73
+ esac
74
+ }
75
+
76
+ complete -F _batipanel batipanel
77
+ complete -F _batipanel b
@@ -0,0 +1,141 @@
1
+ # batipanel tmux configuration
2
+
3
+ # === terminal & color support ===
4
+ set -g default-terminal "tmux-256color"
5
+ set -as terminal-overrides ",xterm*:RGB"
6
+
7
+ # enable mouse (click, drag, scroll, resize)
8
+ set -g mouse on
9
+
10
+ # start index at 1 (easier keyboard access)
11
+ set -g base-index 1
12
+ setw -g pane-base-index 1
13
+
14
+ # === status bar - powerline style ===
15
+ set -g status-position bottom
16
+ set -g status-style "bg=colour234,fg=colour137"
17
+ set -g status-left '#[fg=colour232,bg=colour2,bold] #S #[fg=colour2,bg=colour234,nobold] '
18
+ set -g status-right '#[fg=colour240,bg=colour234]#[fg=colour249,bg=colour240] #{session_windows}W #{window_panes}P #[fg=colour2,bg=colour240]#[fg=colour232,bg=colour2,bold] %H:%M %m-%d '
19
+ set -g status-left-length 30
20
+ set -g status-right-length 50
21
+
22
+ # window status - powerline style
23
+ setw -g window-status-format '#[fg=colour234,bg=colour238]#[fg=colour249,bg=colour238] #I #W #[fg=colour238,bg=colour234]'
24
+ setw -g window-status-current-format '#[fg=colour234,bg=colour33]#[fg=colour255,bg=colour33,bold] #I #W #[fg=colour33,bg=colour234]'
25
+
26
+ # === pane borders ===
27
+ set -g pane-border-style "fg=colour240"
28
+ set -g pane-active-border-style "fg=colour2,bold"
29
+
30
+ # pane labels (show tool name in border)
31
+ set -g pane-border-status top
32
+ set -g pane-border-format "#[fg=colour240] #{pane_index}:#{pane_title} "
33
+
34
+ # === terminal title ===
35
+ set -g set-titles on
36
+ set -g set-titles-string "batipanel • #S:#W"
37
+
38
+ # === messages ===
39
+ set -g display-time 2000
40
+ set -g message-style "bg=colour33,fg=colour255,bold"
41
+ set -g message-command-style "bg=colour33,fg=colour255"
42
+
43
+ # === pane navigation ===
44
+ # Alt+hjkl or Alt+arrow: move between panes
45
+ bind -n M-Left select-pane -L
46
+ bind -n M-Right select-pane -R
47
+ bind -n M-Up select-pane -U
48
+ bind -n M-Down select-pane -D
49
+ bind -n M-h select-pane -L
50
+ bind -n M-l select-pane -R
51
+ bind -n M-k select-pane -U
52
+ bind -n M-j select-pane -D
53
+
54
+ # Alt+Space: toggle last pane
55
+ bind -n M-Space select-pane -l
56
+
57
+ # Alt+f: zoom/focus current pane (toggle)
58
+ bind -n M-f resize-pane -Z
59
+
60
+ # === pane swapping ===
61
+ # Alt+Shift+hjkl: swap pane in direction
62
+ bind -n M-H swap-pane -s '{left-of}'
63
+ bind -n M-L swap-pane -s '{right-of}'
64
+ bind -n M-K swap-pane -s '{up-of}'
65
+ bind -n M-J swap-pane -s '{down-of}'
66
+
67
+ # === pane resizing ===
68
+ # prefix+arrow: resize by 5 units
69
+ bind -r Left resize-pane -L 5
70
+ bind -r Right resize-pane -R 5
71
+ bind -r Up resize-pane -U 3
72
+ bind -r Down resize-pane -D 3
73
+
74
+ # Alt+Shift+arrow: fine resize (1 unit)
75
+ bind -n M-S-Left resize-pane -L 1
76
+ bind -n M-S-Right resize-pane -R 1
77
+ bind -n M-S-Up resize-pane -U 1
78
+ bind -n M-S-Down resize-pane -D 1
79
+
80
+ # prefix+=: equalize all pane sizes
81
+ bind = select-layout -E
82
+
83
+ # === quick splits ===
84
+ # Alt+\: vertical split, Alt+-: horizontal split (keep current path)
85
+ bind -n M-\\ split-window -h -c "#{pane_current_path}"
86
+ bind -n M-- split-window -v -c "#{pane_current_path}"
87
+
88
+ # === window management ===
89
+ # Alt+n: new window
90
+ bind -n M-n new-window -c "#{pane_current_path}"
91
+
92
+ # Alt+[/]: previous/next window
93
+ bind -n M-[ previous-window
94
+ bind -n M-] next-window
95
+
96
+ # Alt+1~9: direct window select
97
+ bind -n M-1 select-window -t 1
98
+ bind -n M-2 select-window -t 2
99
+ bind -n M-3 select-window -t 3
100
+ bind -n M-4 select-window -t 4
101
+ bind -n M-5 select-window -t 5
102
+ bind -n M-6 select-window -t 6
103
+ bind -n M-7 select-window -t 7
104
+ bind -n M-8 select-window -t 8
105
+ bind -n M-9 select-window -t 9
106
+
107
+ # Alt+x: kill pane (with confirm)
108
+ bind -n M-x confirm-before -p "Kill pane? (y/n)" kill-pane
109
+
110
+ # === copy mode (vi style) ===
111
+ setw -g mode-keys vi
112
+ bind -T copy-mode-vi v send-keys -X begin-selection
113
+ bind -T copy-mode-vi C-v send-keys -X rectangle-toggle
114
+ bind -T copy-mode-vi Escape send-keys -X cancel
115
+
116
+ # clipboard integration (copy-mode → system clipboard)
117
+ # macOS
118
+ if-shell "uname -s | grep -q Darwin" \
119
+ "bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'"
120
+ # WSL
121
+ if-shell "grep -qi microsoft /proc/version 2>/dev/null" \
122
+ "bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'clip.exe'"
123
+ # Linux (X11/Wayland)
124
+ if-shell "command -v xclip >/dev/null 2>&1" \
125
+ "bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -selection clipboard'"
126
+
127
+ # === session management ===
128
+ bind s choose-session -ZN
129
+ bind S new-session -c "#{pane_current_path}"
130
+
131
+ # Reload config
132
+ bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded"
133
+
134
+ # scroll history
135
+ set -g history-limit 10000
136
+
137
+ # Use the user's default shell
138
+ set -g default-shell "$SHELL"
139
+
140
+ # theme overlay (generated by 'b theme')
141
+ if-shell "test -f ~/.batipanel/config/theme.conf" "source-file ~/.batipanel/config/theme.conf"
@@ -0,0 +1,18 @@
1
+ # Example batipanel configuration
2
+ # Copy to ~/.batipanel/config.sh or set via: b config layout <name>
3
+ #
4
+ # Available layouts: 4panel, 5panel, 6panel, 7panel, 7panel_log,
5
+ # 8panel, dual-claude, devops
6
+
7
+ DEFAULT_LAYOUT="7panel"
8
+
9
+ # Enable eza --icons even in terminals without Nerd Font auto-detection
10
+ # BATIPANEL_ICONS="1"
11
+
12
+ # Color theme: default, dracula, nord, gruvbox, tokyo-night,
13
+ # catppuccin, rose-pine, kanagawa
14
+ # BATIPANEL_THEME="default"
15
+
16
+ # iTerm2 native integration (tmux -CC mode)
17
+ # Panes become native iTerm2 splits. Disables tmux status bar/themes.
18
+ # BATIPANEL_ITERM_CC="0"
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bash
2
+ # Example: Custom 3-panel layout
3
+ #
4
+ # Create your own layout by copying this file:
5
+ # cp examples/custom-layout.sh ~/.batipanel/layouts/custom.sh
6
+ # b myproject --layout custom
7
+ #
8
+ # ┌──────────────────────────┬──────────────────┐
9
+ # │ │ │
10
+ # │ claude (main) │ terminal │
11
+ # │ 65% width │ │
12
+ # │ │ │
13
+ # ├──────────────────────────┴──────────────────┤
14
+ # │ lazygit (full width, 30% height) │
15
+ # └─────────────────────────────────────────────┘
16
+
17
+ SESSION="$1"
18
+ PROJECT="${2:-$(pwd)}"
19
+
20
+ # Create session in the project directory
21
+ init_layout "$SESSION" "$PROJECT"
22
+
23
+ # Get the first pane (main workspace)
24
+ MAIN=$(tmux list-panes -t "$SESSION" -F '#{pane_id}' | head -1)
25
+
26
+ # Split: top 70% | bottom 30%
27
+ LAZYGIT=$(tmux split-window -v -t "$MAIN" -c "$PROJECT" -p 30 -PF '#{pane_id}')
28
+
29
+ # Split top pane: left 65% | right 35%
30
+ TERMINAL=$(tmux split-window -h -t "$MAIN" -c "$PROJECT" -p 35 -PF '#{pane_id}')
31
+
32
+ wait_for_panes
33
+
34
+ # Launch tools in each pane
35
+ run_claude "$MAIN"
36
+ tmux send-keys -t "$TERMINAL" "" ""
37
+ run_lazygit "$LAZYGIT"
38
+
39
+ # Focus on main pane
40
+ tmux select-pane -t "$MAIN"
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+ # Example: Register and manage multiple projects
3
+ #
4
+ # Run this script to set up several projects at once:
5
+ # bash examples/multi-project.sh
6
+
7
+ BATIPANEL_HOME="${BATIPANEL_HOME:-$HOME/.batipanel}"
8
+
9
+ # Check if batipanel is installed
10
+ if [ ! -f "$BATIPANEL_HOME/bin/start.sh" ]; then
11
+ echo "batipanel is not installed. Run install.sh first."
12
+ exit 1
13
+ fi
14
+
15
+ # Register projects (edit paths to match your setup)
16
+ bash "$BATIPANEL_HOME/bin/start.sh" new frontend ~/projects/frontend
17
+ bash "$BATIPANEL_HOME/bin/start.sh" new backend ~/projects/backend
18
+ bash "$BATIPANEL_HOME/bin/start.sh" new infra ~/projects/infrastructure
19
+
20
+ echo ""
21
+ echo "Projects registered! Start any with:"
22
+ echo " b frontend"
23
+ echo " b backend"
24
+ echo " b infra"
25
+ echo ""
26
+ echo "List all: b ls"
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+ # Example project configuration
3
+ # Copy this to ~/.batipanel/projects/ and customize:
4
+ # cp examples/project.sh ~/.batipanel/projects/myproject.sh
5
+ SESSION="${1:-example}"
6
+ PROJECT=~/project/example
7
+ BATIPANEL_HOME="${BATIPANEL_HOME:-$HOME/.batipanel}"
8
+ source "$BATIPANEL_HOME/lib/common.sh"
9
+ load_layout "$SESSION" "$PROJECT" "${LAYOUT:-}"