Last active
March 31, 2026 21:35
-
-
Save harsh183/a4aa0dba41773796a3517547cdd4ac49 to your computer and use it in GitHub Desktop.
When using Devin on Github PRs I keep forgetting to prefix my comments with "aside -" which causes accidental changes. Vibe coded some a quick user script after a lot of iterations to add it by default
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name GitHub Comment "aside -" Prefix | |
| // @namespace http://tampermonkey.net/ | |
| // @version 28.0 | |
| // @description Auto-prefixes GitHub PR comments with "aside -" for Devin | |
| // @match https://github.com/* | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| const PREFIX = 'aside - '; | |
| const DEBUG = true; | |
| const log = (...args) => DEBUG && console.log('[aside]', ...args); | |
| function insertPrefix(ta) { | |
| if (ta.value.startsWith(PREFIX)) return; | |
| ta.focus(); | |
| document.execCommand('insertText', false, PREFIX); | |
| log('inserted prefix into', ta.id || ta.className); | |
| } | |
| function prefixTextarea(ta) { | |
| if (ta.dataset.asidePrefixed) return; | |
| ta.dataset.asidePrefixed = 'true'; | |
| log('attaching to', ta.id || ta.className); | |
| ta.addEventListener('focus', () => insertPrefix(ta)); | |
| ta.addEventListener('input', () => { | |
| if (!ta.value.startsWith(PREFIX)) { | |
| const pos = ta.selectionStart; | |
| const cur = ta.value; | |
| ta.value = cur.length < PREFIX.length ? PREFIX : PREFIX + cur.replace(/^(aside - ?)?/, ''); | |
| ta.dispatchEvent(new Event('input', { bubbles: true })); | |
| ta.setSelectionRange(Math.max(PREFIX.length, pos), Math.max(PREFIX.length, pos)); | |
| } | |
| }); | |
| } | |
| const observer = new MutationObserver(() => | |
| document.querySelectorAll( | |
| 'textarea.js-comment-field, textarea[name="comment[body]"], textarea[name="pull_request_review[body]"], textarea.prc-Textarea-TextArea-snlco' | |
| ).forEach(prefixTextarea) | |
| ); | |
| observer.observe(document.body, { childList: true, subtree: true }); | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sometimes it doesn't work, but a page refresh seems to fix it. not sure what's up