Skip to content

Commit 57bb728

Browse files
committed
Merge branch 'master' of github.com:fbosch/dotfiles
2 parents be04ad3 + 7581576 commit 57bb728

File tree

4 files changed

+93
-5
lines changed

4 files changed

+93
-5
lines changed

.config/fish/functions/ai_commit.fish

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,20 @@ Branch: $branch_name" >$temp_prompt
5151
if test -n "$ticket_number"
5252
echo "Ticket: $ticket_number" >>$temp_prompt
5353
end
54-
set skill_file "$HOME/.config/opencode/skills/ai-commit/SKILL.md"
54+
set -l skill_dir "$HOME/.config/opencode/skills/ai-commit"
55+
set -l skill_file "$skill_dir/SKILL.md"
5556
if not test -f "$skill_file"
56-
gum style --foreground 1 " Skill not found: $skill_file"
57+
set skill_file "$skill_dir/skill.md"
58+
end
59+
if not test -f "$skill_file"
60+
gum style --foreground 1 " Skill not found: $skill_dir/SKILL.md"
5761
rm -f $temp_prompt $temp_diff
5862
return 1
5963
end
60-
set skill_body (sed '1,/^---$/d' "$skill_file" | sed '1,/^---$/d')
64+
set -l skill_body (sed '1,/^---$/d' "$skill_file" | sed '1,/^---$/d')
65+
if test -z "$skill_body"
66+
set skill_body (cat "$skill_file")
67+
end
6168
echo "
6269
$skill_body
6370

.config/fish/functions/ai_pr.fish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Diff below. Describe ONLY visible substantive changes. Skip trivial changes enti
116116
if test -n "$branch_hint"
117117
set prompt "$prompt\nBranch type: $branch_hint"
118118
end
119-
set prompt "$prompt\n\nOutput: First line = PR title in format: $commitizen_type(#$ticket_number): description (max 72 chars total). Blank line. Then markdown PR description in $language_name. All text in $language_name. No explanations."
119+
set prompt "$prompt\n\nCRITICAL: Your entire response must be ONLY the PR content. The first character you output must be the first character of the PR title. Do not output any thoughts, explanations, or analysis.\n\nFormat:\nLine 1: $commitizen_type(#$ticket_number): description (max 72 chars)\nLine 2: blank\nLine 3+: Markdown PR body in $language_name"
120120
set temp_prompt (mktemp -t opencode_prompt.XXXXXX)
121121
set temp_output (mktemp -t opencode_output.XXXXXX)
122122
echo "$prompt" >$temp_prompt
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
function killport --description 'Kill the process listening on a specific port'
2+
set -l options h/help f/force
3+
argparse -n killport $options -- $argv
4+
or return
5+
6+
if set -q _flag_help
7+
echo "Usage: killport [OPTIONS] PORT"
8+
echo "Kill the process listening on the specified port"
9+
echo ""
10+
echo "Options:"
11+
echo " -h, --help Show this help message"
12+
echo " -f, --force Skip confirmation prompt"
13+
return 0
14+
end
15+
16+
if test (count $argv) -ne 1
17+
echo "killport: exactly one port number required" >&2
18+
echo "Usage: killport [OPTIONS] PORT" >&2
19+
return 1
20+
end
21+
22+
set -l port $argv[1]
23+
24+
# Validate port number
25+
if not string match -qr '^\d+$' -- $port
26+
echo "killport: invalid port number '$port'" >&2
27+
return 1
28+
end
29+
30+
if test $port -lt 1 -o $port -gt 65535
31+
echo "killport: port must be between 1 and 65535" >&2
32+
return 1
33+
end
34+
35+
# Find process using the port
36+
set -l pid (lsof -ti :$port 2>/dev/null)
37+
38+
if test -z "$pid"
39+
echo "killport: no process found listening on port $port" >&2
40+
return 1
41+
end
42+
43+
# Get process details
44+
set -l process_info (ps -p $pid -o comm= 2>/dev/null)
45+
46+
if test -z "$process_info"
47+
set process_info "Unknown"
48+
end
49+
50+
# Confirm before killing (unless --force is set)
51+
if not set -q _flag_force
52+
if command -v gum >/dev/null
53+
if not gum confirm "Kill process: $process_info [PID: $pid] on port $port?"
54+
echo "Cancelled"
55+
return 0
56+
end
57+
else
58+
# Fallback to read if gum is not available
59+
read -P "Kill process: $process_info [PID: $pid] on port $port? [y/N] " -l response
60+
if not string match -qir '^y(es)?$' -- $response
61+
echo "Cancelled"
62+
return 0
63+
end
64+
end
65+
end
66+
67+
# Kill the process
68+
if kill $pid 2>/dev/null
69+
echo "Killed: $process_info [PID: $pid] on port $port"
70+
else
71+
# Try with force if regular kill failed
72+
if kill -9 $pid 2>/dev/null
73+
echo "Force killed: $process_info [PID: $pid] on port $port"
74+
else
75+
echo "killport: failed to kill PID $pid" >&2
76+
return 1
77+
end
78+
end
79+
end

.config/opencode/skills/ai-pr/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ description: Generate concise PR descriptions from git diffs and commit context.
2525
- Breaking Changes section: include only when diff obviously breaks behavior.
2626

2727
## Output
28+
**CRITICAL: Your response must contain ONLY the PR content below. Do not include ANY explanatory text, thoughts, analysis, or meta-commentary before or after the PR content.**
29+
2830
- First line is the PR title only.
2931
- Blank line after title.
3032
- Then markdown PR description using the provided section headings.
31-
- Output only the final content, no explanations.
33+
- Do not output anything else.

0 commit comments

Comments
 (0)