Last active
June 12, 2026 13:53
-
-
Save atuttle/fcc51c4959eeb5e943d6ff9270e13688 to your computer and use it in GitHub Desktop.
CFStack Raycast script command - filter CFML stack traces down to just the CFML files (ignore all of the java crap)
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
| #!/usr/bin/env node | |
| // Required parameters: | |
| // @raycast.schemaVersion 1 | |
| // @raycast.title CFML Stack Trace Filter | |
| // @raycast.mode silent | |
| // Optional parameters: | |
| // @raycast.icon 🤖 | |
| // @raycast.packageName cfstack | |
| // Documentation: | |
| // @raycast.description Filter CFML stack traces to just the lines you want to feed to an LLM -- only the ones that mention CFML files. | |
| // @raycast.author atcodes | |
| // @raycast.authorURL https://raycast.com/atcodes | |
| //TO INSTALL: copy cfstack.js to your Raycast script commands dir. Default is ~/Documents/raycast script commands/ | |
| //I have Hyper+S mapped to cfstack, so my workflow is: Copy stack trace, Hyper+S, Paste into LLM | |
| const { execFileSync } = require('child_process'); | |
| function filterStackTrace(input) { | |
| const lines = input.replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/ at /g, '\n at ').split('\n'); | |
| if (lines.length > 0 && lines[lines.length - 1] === '') { | |
| lines.pop(); | |
| } | |
| return lines | |
| .filter((line, index) => { | |
| if (index === 0) return true; | |
| return line.toLowerCase().includes('.cfc:') || line.toLowerCase().includes('.cfm:'); | |
| }) | |
| .map((line, index) => { | |
| const normalized = line.replace(/\t/g, ' '); | |
| if (index === 0) return normalized; | |
| const wrappedPath = normalized.match(/\(([^()]*\.(?:cfc|cfm):\d+)\)\s*$/i); | |
| if (wrappedPath) return `at ${wrappedPath[1]}`; | |
| const barePath = normalized.match(/^\s*at\s+([^()]*\.(?:cfc|cfm):\d+)\s*$/i); | |
| if (barePath) return `at ${barePath[1]}`; | |
| return normalized; | |
| }) | |
| .join('\n'); | |
| } | |
| const input = execFileSync('pbpaste', { encoding: 'utf8' }); | |
| const output = filterStackTrace(input); | |
| execFileSync('pbcopy', { input: output }); | |
| console.log('Stack trace cleaned. Happy debugging!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment