Last active 1 week ago

Cross-platform Zsh setup scripts and managed dotfiles with Oh My Zsh framework, Starship prompt, aliases, functions, and path configuration.

weehong revised this gist 1 month ago. Go to revision

1 file changed, 2 insertions, 2 deletions

func

@@ -139,7 +139,7 @@ claude() {
139 139 }
140 140
141 141 # -----------------------------------------------------------------------------
142 - # Function: plan-build (Claude Code multi-agent workflow orchestrator)
142 + # Function: plan_build (Claude Code multi-agent workflow orchestrator)
143 143 # -----------------------------------------------------------------------------
144 144 plan_build() {
145 145 local claude_args=()
@@ -151,7 +151,7 @@ plan_build() {
151 151
152 152 if [ $# -gt 0 ]; then
153 153 echo "Error: Unknown argument(s): $*"
154 - echo "Usage: plan-build [--yolo]"
154 + echo "Usage: plan_build [--yolo]"
155 155 return 1
156 156 fi
157 157

weehong revised this gist 1 month ago. Go to revision

1 file changed, 1 insertion, 1 deletion

func

@@ -141,7 +141,7 @@ claude() {
141 141 # -----------------------------------------------------------------------------
142 142 # Function: plan-build (Claude Code multi-agent workflow orchestrator)
143 143 # -----------------------------------------------------------------------------
144 - plan-build() {
144 + plan_build() {
145 145 local claude_args=()
146 146
147 147 if [[ "${1:-}" == "--yolo" ]]; then

Vernon Wee Hong KOH revised this gist 1 month ago. Go to revision

1 file changed, 14 insertions, 1 deletion

func

@@ -142,6 +142,19 @@ claude() {
142 142 # Function: plan-build (Claude Code multi-agent workflow orchestrator)
143 143 # -----------------------------------------------------------------------------
144 144 plan-build() {
145 + local claude_args=()
146 +
147 + if [[ "${1:-}" == "--yolo" ]]; then
148 + claude_args=(--yolo)
149 + shift
150 + fi
151 +
152 + if [ $# -gt 0 ]; then
153 + echo "Error: Unknown argument(s): $*"
154 + echo "Usage: plan-build [--yolo]"
155 + return 1
156 + fi
157 +
145 158 require_cli claude "Claude Code CLI" || return 1
146 159 require_cli codex "Codex CLI" || return 1
147 160 require_cli coderabbit "CodeRabbit CLI" || return 1
@@ -168,7 +181,7 @@ plan-build() {
168 181
169 182 echo "🚀 Launching Claude Code with your multi-agent workflow..."
170 183
171 - claude "Please read \`skills.md\` and strictly follow the 6-step multi-agent workflow to implement the following task:
184 + claude "${claude_args[@]}" "Please read \`skills.md\` and strictly follow the 6-step multi-agent workflow to implement the following task:
172 185
173 186 $payload"
174 187 }

Vernon Wee Hong KOH revised this gist 1 month ago. Go to revision

1 file changed, 25 insertions, 9 deletions

func

@@ -139,22 +139,38 @@ claude() {
139 139 }
140 140
141 141 # -----------------------------------------------------------------------------
142 - # Function: plan-build (Claude Code multi-agent workflow shortcut)
142 + # Function: plan-build (Claude Code multi-agent workflow orchestrator)
143 143 # -----------------------------------------------------------------------------
144 144 plan-build() {
145 - local task="$*"
145 + require_cli claude "Claude Code CLI" || return 1
146 + require_cli codex "Codex CLI" || return 1
147 + require_cli coderabbit "CodeRabbit CLI" || return 1
148 +
149 + echo "📥 Reading payload... Type 'EOF' on a new line and press Enter when finished."
146 150
147 - if [ -z "$task" ]; then
148 - echo "Error: Please provide a task description."
149 - echo "Usage: plan-build 'your task here'"
151 + local payload
152 + local line
153 + payload=""
154 +
155 + while IFS= read -r line; do
156 + [ "$line" = "EOF" ] && break
157 + if [ -z "$payload" ]; then
158 + payload="$line"
159 + else
160 + payload="${payload}"$'\n'"${line}"
161 + fi
162 + done
163 +
164 + if [ -z "$payload" ]; then
165 + echo "❌ Error: Payload was empty."
150 166 return 1
151 167 fi
152 168
153 - require_cli claude "Claude Code CLI" || return 1
154 - require_cli codex "Codex CLI" || return 1
155 - require_cli coderabbit "CodeRabbit CLI" || return 1
169 + echo "🚀 Launching Claude Code with your multi-agent workflow..."
170 +
171 + claude "Please read \`skills.md\` and strictly follow the 6-step multi-agent workflow to implement the following task:
156 172
157 - claude "Please read \`skills.md\` and strictly follow the 6-step multi-agent workflow to implement: $task"
173 + $payload"
158 174 }
159 175
160 176 # -----------------------------------------------------------------------------

Vernon Wee Hong KOH revised this gist 1 month ago. Go to revision

1 file changed, 43 insertions, 4 deletions

func

@@ -92,6 +92,29 @@ clear_history() {
92 92 esac
93 93 }
94 94
95 + # -----------------------------------------------------------------------------
96 + # Function: require_cli (Check external CLI availability)
97 + # -----------------------------------------------------------------------------
98 + require_cli() {
99 + local binary="$1"
100 + local label="$2"
101 + local resolved
102 +
103 + if command -v whence >/dev/null 2>&1; then
104 + if whence -p "$binary" >/dev/null 2>&1; then
105 + return 0
106 + fi
107 + else
108 + resolved="$(command -v "$binary" 2>/dev/null)" || resolved=""
109 + if [ -n "$resolved" ] && [ -x "$resolved" ]; then
110 + return 0
111 + fi
112 + fi
113 +
114 + printf "Error: %s ('%s') is not installed or not in your PATH.\n" "$label" "$binary" >&2
115 + return 1
116 + }
117 +
95 118 # -----------------------------------------------------------------------------
96 119 # Function: claude (Includes --yolo and clear shortcuts)
97 120 # -----------------------------------------------------------------------------
@@ -103,10 +126,7 @@ claude() {
103 126 fi
104 127
105 128 # Check if binary exists
106 - if ! whence -p claude >/dev/null 2>&1; then
107 - printf "Error: 'claude' CLI is not installed or not in your PATH.\n" >&2
108 - return 1
109 - fi
129 + require_cli claude "Claude Code CLI" || return 1
110 130
111 131 # Handle --yolo mode
112 132 if [[ "$1" == "--yolo" ]]; then
@@ -118,6 +138,25 @@ claude() {
118 138 command claude "$@"
119 139 }
120 140
141 + # -----------------------------------------------------------------------------
142 + # Function: plan-build (Claude Code multi-agent workflow shortcut)
143 + # -----------------------------------------------------------------------------
144 + plan-build() {
145 + local task="$*"
146 +
147 + if [ -z "$task" ]; then
148 + echo "Error: Please provide a task description."
149 + echo "Usage: plan-build 'your task here'"
150 + return 1
151 + fi
152 +
153 + require_cli claude "Claude Code CLI" || return 1
154 + require_cli codex "Codex CLI" || return 1
155 + require_cli coderabbit "CodeRabbit CLI" || return 1
156 +
157 + claude "Please read \`skills.md\` and strictly follow the 6-step multi-agent workflow to implement: $task"
158 + }
159 +
121 160 # -----------------------------------------------------------------------------
122 161 # Function: aicommit (Automated Conventional Commit Engine Wrapper)
123 162 # -----------------------------------------------------------------------------

weehong revised this gist 1 month ago. Go to revision

1 file changed, 6 insertions, 6 deletions

func

@@ -123,7 +123,9 @@ claude() {
123 123 # -----------------------------------------------------------------------------
124 124 aicommit() {
125 125 local diff engine prompt
126 - diff=$(git diff --cached)
126 +
127 + # 1. Get diff safely: exclude lock files/minified files and cap at ~100k characters to prevent CLI crashes
128 + diff=$(git diff --cached -- . ":(exclude)*.lock" ":(exclude)*-lock.json" ":(exclude)*.min.js" | head -c 100000)
127 129
128 130 if [ -z "$diff" ]; then
129 131 printf "❌ Error: Nothing staged to commit.\n" >&2
@@ -155,10 +157,8 @@ $diff" -s --no-ask-user --allow-tool='shell(git:*)'
155 157
156 158 opencode)
157 159 echo "🤖 OpenCode is analyzing staged changes..."
158 - opencode run "$prompt
159 -
160 - Here is the git diff:
161 - $diff"
160 + # 2. Fixed: Piping standard input to opencode bypasses OS argument length limits
161 + cat "$HOME/.config/ai-commit-prompt.txt" <(echo -e "\n\nHere is the git diff:\n$diff") | opencode run
162 162 ;;
163 163
164 164 *)
@@ -272,4 +272,4 @@ add_path_to_config() {
272 272
273 273 printf "✅ Success: Added to %s\n" "$config_file"
274 274 append_path "$new_path" && export PATH
275 - }
275 + }

weehong revised this gist 1 month ago. Go to revision

1 file changed, 51 insertions, 3 deletions

func

@@ -65,9 +65,6 @@ open_file() {
65 65 }
66 66 alias open='open_file'
67 67
68 - # -----------------------------------------------------------------------------
69 - # Function: clear_history (Supports shell and Claude)
70 - # -----------------------------------------------------------------------------
71 68 # -----------------------------------------------------------------------------
72 69 # Function: clear_history (Supports shell and Claude)
73 70 # -----------------------------------------------------------------------------
@@ -121,6 +118,57 @@ claude() {
121 118 command claude "$@"
122 119 }
123 120
121 + # -----------------------------------------------------------------------------
122 + # Function: aicommit (Automated Conventional Commit Engine Wrapper)
123 + # -----------------------------------------------------------------------------
124 + aicommit() {
125 + local diff engine prompt
126 + diff=$(git diff --cached)
127 +
128 + if [ -z "$diff" ]; then
129 + printf "❌ Error: Nothing staged to commit.\n" >&2
130 + return 1
131 + fi
132 +
133 + if [ ! -f "$HOME/.config/ai-commit-prompt.txt" ]; then
134 + printf "❌ Error: Configuration file not found at ~/.config/ai-commit-prompt.txt\n" >&2
135 + printf "Please create it and paste your system prompt inside.\n" >&2
136 + return 1
137 + fi
138 +
139 + engine=${1:-claude}
140 + prompt=$(cat "$HOME/.config/ai-commit-prompt.txt")
141 +
142 + case "$engine" in
143 + claude)
144 + echo "🤖 Claude is analyzing staged changes..."
145 + cat "$HOME/.config/ai-commit-prompt.txt" <(echo -e "\n\nHere is the git diff:\n$diff") | command claude -p "Read the provided instructions and diff, then generate and execute the commit."
146 + ;;
147 +
148 + copilot)
149 + echo "🤖 Copilot is analyzing staged changes..."
150 + copilot -p "$prompt
151 +
152 + Here is the git diff:
153 + $diff" -s --no-ask-user --allow-tool='shell(git:*)'
154 + ;;
155 +
156 + opencode)
157 + echo "🤖 OpenCode is analyzing staged changes..."
158 + opencode run "$prompt
159 +
160 + Here is the git diff:
161 + $diff"
162 + ;;
163 +
164 + *)
165 + printf "❌ Error: Invalid engine '%s'\n" "$engine" >&2
166 + printf "Usage: aicommit [claude | copilot | opencode]\n" >&2
167 + return 1
168 + ;;
169 + esac
170 + }
171 +
124 172 # -----------------------------------------------------------------------------
125 173 # Function: create (Efficiently create file + parent dirs)
126 174 # -----------------------------------------------------------------------------

weehong revised this gist 1 month ago. Go to revision

1 file changed, 4 insertions, 4 deletions

README.md

@@ -4,20 +4,20 @@ The "Bash Script Installer" simplifies the setup of Zsh.
4 4 ## Zsh
5 5 ### Ubuntu
6 6 ```zsh
7 - bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_ubuntu.sh)"
7 + bash -c "$(curl -fsSL https://tinyurl.com/y6fhb594)"
8 8 ```
9 9 ### WSL
10 10 ```zsh
11 - bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_wsl.sh)"
11 + bash -c "$(curl -fsSL https://tinyurl.com/ycyct6wp)"
12 12 ```
13 13 ### MacOS
14 14 ```zsh
15 - bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_macos.sh)"
15 + bash -c "$(curl -fsSL https://tinyurl.com/yptybtpa)"
16 16 ```
17 17
18 18 ### Configuration
19 19 ```zsh
20 - bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/config.sh)"
20 + bash -c "$(curl -fsSL https://tinyurl.com/y8vf753j)"
21 21 ```
22 22
23 23 ### Shell framework and prompt

Vernon revised this gist 1 month ago. Go to revision

4 files changed, 6 insertions, 6 deletions

README.md

@@ -4,11 +4,11 @@ The "Bash Script Installer" simplifies the setup of Zsh.
4 4 ## Zsh
5 5 ### Ubuntu
6 6 ```zsh
7 - bash -c "$(curl -fsSL https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_ubuntu.sh)"
7 + bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_ubuntu.sh)"
8 8 ```
9 9 ### WSL
10 10 ```zsh
11 - bash -c "$(curl -fsSL https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_wsl.sh)"
11 + bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_wsl.sh)"
12 12 ```
13 13 ### MacOS
14 14 ```zsh
@@ -17,7 +17,7 @@ bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b79
17 17
18 18 ### Configuration
19 19 ```zsh
20 - bash -c "$(curl -fsSL https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/config.sh)"
20 + bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/config.sh)"
21 21 ```
22 22
23 23 ### Shell framework and prompt

config.sh

@@ -2,7 +2,7 @@
2 2 set -euo pipefail
3 3
4 4 # Configuration
5 - GIST_RAW_BASE="https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
5 + GIST_RAW_BASE="https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
6 6 CONFIG_FILES=(
7 7 ".alias"
8 8 ".func"

zsh_ubuntu.sh

@@ -22,7 +22,7 @@ SKIP_PACKAGES=false
22 22 SKIP_SHELL_CHANGE=false
23 23 INSTALL_HOMEBREW=false
24 24
25 - GIST_RAW_BASE="https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
25 + GIST_RAW_BASE="https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
26 26 CONFIG_FILES=(
27 27 ".alias"
28 28 ".func"

zsh_wsl.sh

@@ -22,7 +22,7 @@ SKIP_PACKAGES=false
22 22 SKIP_SHELL_CHANGE=false
23 23 INSTALL_HOMEBREW=false
24 24
25 - GIST_RAW_BASE="https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
25 + GIST_RAW_BASE="https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
26 26 CONFIG_FILES=(
27 27 ".alias"
28 28 ".func"

weehong revised this gist 1 month ago. Go to revision

2 files changed, 2 insertions, 2 deletions

README.md

@@ -12,7 +12,7 @@ bash -c "$(curl -fsSL https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996
12 12 ```
13 13 ### MacOS
14 14 ```zsh
15 - bash -c "$(curl -fsSL https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_macos.sh)"
15 + bash -c "$(curl -fsSL https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD/zsh_macos.sh)"
16 16 ```
17 17
18 18 ### Configuration

zsh_macos.sh

@@ -18,7 +18,7 @@ err() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
18 18 # =============================
19 19 # CONFIG
20 20 # =============================
21 - GIST_RAW_BASE="https://opengist.rmrf.online/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
21 + GIST_RAW_BASE="https://opengist.resetrix.work/weehong/f0d940c3c1214bf5b7996195199fdc09/raw/HEAD"
22 22
23 23 CONFIG_FILES=(
24 24 ".alias"