diff --git a/emacs/.config/doom/config.el b/emacs/.config/doom/config.el index 7f0b236..1c85e00 100644 --- a/emacs/.config/doom/config.el +++ b/emacs/.config/doom/config.el @@ -1,5 +1,9 @@ ;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- +(defun powellc/reload-config () + (interactive) + (load-file (expand-file-name "config.el" doom-private-dir))) + (setq user-full-name "Colin Powell" user-mail-address "colin@unbl.ink") @@ -105,7 +109,7 @@ :desc "Open curosr shell" "c" #'powellc/open-opencode-agent :desc "Open Hungryroot shell" "S" #'powellc/open-hr-term) (:prefix "g" - :desc "PR comments for branch" "c" #'powellc/gh-pr-comments-for-branch)) + :desc "PR comments for branch" "p" #'powellc/gh-pr-comments-for-branch)) (defun unfill-paragraph () "Takes a multi-line paragraph and makes it into a single line of text." @@ -450,9 +454,8 @@ Returns the ID string." (request endpoint :type "POST" - :headers '(("Content-Type" . "application/json")) :data (json-encode data) - :headers '(("Authorization" . "Token 58e898c0e88bd6333b1a9e8de82e81f36c4b64e") + :headers '(("Authorization" . "Token 58e898c0e88bd6333b1a9e8de82e81f36c4b64e4") ("Content-Type" . "application/json")) :parser 'json-read :success (cl-function @@ -460,7 +463,7 @@ Returns the ID string." (message "Sent TODO: %s" data))) :error (cl-function (lambda (&rest args &key error-thrown &allow-other-keys) - (message "Error sending TODO: %S" error-thrown)))))) + (message "Error sending TODO: %S with %S" error-thrown args)))))) (org-clock-on-state-change) ))) @@ -562,3 +565,58 @@ Always open the result in `eww`." (setq agent-shell-google-authentication (agent-shell-google-make-authentication :api-key (lambda () (+pass-line1 "work/hungryroot/apikeys/gemini"))))) + +(defun powellc/gh-pr-comments-for-branch () + "Select a branch via projectile and pull its PR comments into a new buffer." + (interactive) + (require 'projectile) + (let* ((project-root (projectile-project-root)) + (default-directory (or project-root default-directory))) + (unless project-root + (user-error "Not in a projectile project")) + (let* ((branch-output (shell-command-to-string "git for-each-ref --format='%(refname:short)' refs/heads/ 2>/dev/null")) + (branches (seq-filter (lambda (s) (and (not (string-empty-p s)) (not (string-prefix-p " " s)))) + (split-string branch-output "\n" t)))) + (unless branches + (user-error "No branches found")) + (let* ((branch (projectile-completing-read "Select branch:" branches)) + (pr-json (shell-command-to-string + (format "gh pr list --state all --json id,number,title,headRefName 2>/dev/null"))) + (pr-list (ignore-errors (mapcar #'json-parse-object (json-read-from-string pr-json)))) + (matching-pr (seq-find (lambda (pr) (string= (alist-get 'headRefName pr) branch)) pr-list))) + (if (or (null matching-pr) (not matching-pr)) + (user-error "No PR found for branch: %s" branch) + (let* ((pr matching-pr) + (pr-id (alist-get 'id pr)) + (pr-number (number-to-string (alist-get 'number pr))) + (pr-title (alist-get 'title pr)) + (comments-output (shell-command-to-string + (format "gh pr view %s --comments --json body,author,createdAt,path,line 2>/dev/null" + (shell-quote-argument pr-id)))) + (comments (ignore-errors (mapcar #'json-parse-object (json-read-from-string comments-output))))) + (if (or (null comments) (seq-empty-p comments)) + (user-error "No comments found for PR #%s" pr-number) + (let ((buf (get-buffer-create (format "*PR #%s Comments*" pr-number)))) + (with-current-buffer buf + (erase-buffer) + (insert (format "# PR #%s: %s\n" pr-number pr-title)) + (insert (format "Branch: %s\n\n" branch)) + (insert "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n")) + (dolist (comment comments) + (let ((author (alist-get 'author comment)) + (body (alist-get 'body comment)) + (created-at (alist-get 'createdAt comment)) + (path (alist-get 'path comment)) + (line (alist-get 'line comment))) + (with-current-buffer buf + (insert (format "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n")) + (insert (format "Author: %s\n" (if (stringp author) author (alist-get 'login author)))) + (insert (format "Date: %s\n" created-at)) + (when path + (insert (format "File: %s" path)) + (when line (insert (format ":%s" line))) + (insert "\n")) + (insert "\n") + (insert (or body "")) + (insert "\n\n"))) + (pop-to-buffer buf)))))))))) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index c91eb8f..a356eb0 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -11,9 +11,8 @@ bind -r K resize-pane -U 10 bind -r H resize-pane -L 10 bind -r L resize-pane -R 10 -set -g pane-border-fg white -set -g pane-active-border-fg cyan -set -g pane-active-border-bg cyan +set -g pane-border-style fg=white +set -g pane-active-border-style fg=cyan set -g status-left "session: #S | window: #I | pane: #P" set -g prefix C-a @@ -23,15 +22,14 @@ new-session -n $HOST # Colors {{{ -set -g pane-border-fg colour8 -set -g pane-active-border-fg colour7 +set -g pane-border-style fg=colour8 +set -g pane-active-border-style fg=colour7 set -g status-bg default set -g status-fg colour7 -set -g window-status-current-fg colour15 +set -g window-status-current-style fg=colour15 -set -g message-bg default -set -g message-fg colour15 +set -g message-style fg=colour15,bg=default # }}} # Statusline {{{ @@ -53,25 +51,21 @@ set -g window-status-current-format '#I:#W ' # default statusbar colors set-option -g status-bg colour235 #base02 set-option -g status-fg colour136 #yellow -set-option -g status-attr default +set-option -g status-style default # default window title colors -set-window-option -g window-status-fg colour244 #base0 -set-window-option -g window-status-bg default +set-window-option -g window-status-style fg=colour244,bg=default #set-window-option -g window-status-attr dim # active window title colors -set-window-option -g window-status-current-fg colour166 #orange -set-window-option -g window-status-current-bg default +set-window-option -g window-status-current-style fg=colour166,bg=default #set-window-option -g window-status-current-attr bright # pane border -set-option -g pane-border-fg colour235 #base02 -set-option -g pane-active-border-fg colour240 #base01 +set-option -g pane-border-style fg=colour235 +set-option -g pane-active-border-style fg=colour240 -# message text -set-option -g message-bg colour235 #base02 -set-option -g message-fg colour166 #orange +set-option -g message-style fg=colour166,bg=colour235 # pane number display set-option -g display-panes-active-colour colour33 #blue