← Back to context Comment by cedws 2 days ago Can it be made to be directly executable with a shebang line? 6 comments cedws Reply chr15m 6 hours ago I added this and you can now make .prompt files with a runprompt shebang.#/usr/bin/env runprompt leobuskin 1 day ago /usr/local/bin/promptrun #!/bin/bash file="$1" model=$(sed -n '2p' "$file" | sed 's/^# \*//') prompt=$(tail -n +3 "$file") curl -s https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "content-type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d "{ \"model\": \"$model\", \"max_tokens\": 1024, \"messages\": [{\"role\": \"user\", \"content\": $(echo "$prompt" | jq -Rs .)}] }" | jq -r '.content[0].text' hello.prompt #!/usr/local/bin/promptrun # claude-sonnet-4-20250514 Write a haiku about terminal commands. _joel 2 days ago it already has one - https://github.com/chr15m/runprompt/blob/main/runprompt#L1If you curl/wget a script, you still need to chmod +x it. Git doesn't have this issue as it retains the file metadata. vidarh 2 days ago I'm assuming the intent was to as if the *.prompt files could have a shebang line. #!/bin/env runprompt --- .frontmatter... --- The prompt. Would be a lot nicer, as then you can just +x the prompt file itself. chr15m 2 days ago That's on my TODO list for tomorrow, thanks!
chr15m 6 hours ago I added this and you can now make .prompt files with a runprompt shebang.#/usr/bin/env runprompt
leobuskin 1 day ago /usr/local/bin/promptrun #!/bin/bash file="$1" model=$(sed -n '2p' "$file" | sed 's/^# \*//') prompt=$(tail -n +3 "$file") curl -s https://api.anthropic.com/v1/messages \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "content-type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d "{ \"model\": \"$model\", \"max_tokens\": 1024, \"messages\": [{\"role\": \"user\", \"content\": $(echo "$prompt" | jq -Rs .)}] }" | jq -r '.content[0].text' hello.prompt #!/usr/local/bin/promptrun # claude-sonnet-4-20250514 Write a haiku about terminal commands.
_joel 2 days ago it already has one - https://github.com/chr15m/runprompt/blob/main/runprompt#L1If you curl/wget a script, you still need to chmod +x it. Git doesn't have this issue as it retains the file metadata. vidarh 2 days ago I'm assuming the intent was to as if the *.prompt files could have a shebang line. #!/bin/env runprompt --- .frontmatter... --- The prompt. Would be a lot nicer, as then you can just +x the prompt file itself.
vidarh 2 days ago I'm assuming the intent was to as if the *.prompt files could have a shebang line. #!/bin/env runprompt --- .frontmatter... --- The prompt. Would be a lot nicer, as then you can just +x the prompt file itself.
I added this and you can now make .prompt files with a runprompt shebang.
#/usr/bin/env runprompt
/usr/local/bin/promptrun
hello.prompt
it already has one - https://github.com/chr15m/runprompt/blob/main/runprompt#L1
If you curl/wget a script, you still need to chmod +x it. Git doesn't have this issue as it retains the file metadata.
I'm assuming the intent was to as if the *.prompt files could have a shebang line.
Would be a lot nicer, as then you can just +x the prompt file itself.
That's on my TODO list for tomorrow, thanks!