-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtoolsconfigFromCodevActions
More file actions
executable file
·62 lines (57 loc) · 1.5 KB
/
toolsconfigFromCodevActions
File metadata and controls
executable file
·62 lines (57 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
if [ "$#" -eq 0 ] || [ "$1" = "--help" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ]; then
cat <<EOF
Usage: $(basename $0) <tools>
Prints a configuration file useable with chatgpt -tf for the tools given on the command line.
Options:
--help Show this help message and exit
Description:
This prints a configuration file useable with chatgpt -tf for the tools given on the command line.
It assumes that these follow the conventions for actions for the
Co-Developer GPT Engine https://codevelopergptengine.stoerr.net/
that is, it contains a comment with "Plugin Action:" and a description of the action.
EOF
exit 0
fi
first=1
echo "["
for fil in "$@"; do
description=$(egrep -o "Plugin Action: .*" "$fil" | sed -e 's/Plugin Action: //')
# name is the filename without .sh extension and everything except [a-zA-Z0-9_-] replaced by _
name=$(basename $fil | sed -e 's/\.sh$//' -e 's/[^a-zA-Z0-9_-]/_/g')
if [ "$first" -eq 0 ]; then
echo ","
fi
first=0
cat <<EOF
{
"function": {
"name": "$name",
"description": "$description",
"parameters": {
"type": "object",
"properties": {
"args": {
"type": "string"
},
"stdin": {
"type": "string"
}
},
"required": [
"args",
"stdin"
],
"additionalProperties": false
},
"strict": true
},
"commandline": [
"$fil",
"\$args"
],
"stdin": ""
}
EOF
done
echo "]"