forked from mathew-fleisch/bashbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample-config.json
245 lines (245 loc) · 6.97 KB
/
sample-config.json
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
{
"admins": [
{
"trigger": "bashbat",
"appName": "BashBot",
"userIds": ["ADMIN-USER-ID"],
"privateChannelId": "PRIVATE-CHANNEL-ID",
"logChannelId": "LOG-CHANNEL-ID"
}
],
"messages": [
{
"active": true,
"name": "processing_command",
"text": ":robot_face: Processing command..."
},
{
"active": true,
"name": "processing_raw_command",
"text": ":smiling_imp: Processing raw command..."
},
{
"active": true,
"name": "command_not_found",
"text": ":thinking_face: Command not found..."
},
{
"active": true,
"name": "incorrect_parameters",
"text": ":face_with_monocle: Incorrect number of parameters"
},
{
"active": true,
"name": "invalid_parameter",
"text": ":face_with_monocle: Invalid parameter value: %s"
},
{
"active": true,
"name": "ephemeral",
"text": ":shushing_face: Message only shown to user who triggered it."
},
{
"active": true,
"name": "unauthorized",
"text": ":skull_and_crossbones: You are not authorized to use this command in this channel.\nAllowed in: [%s]"
},
{
"active": true,
"name": "missingenvvar",
"text": ":skull_and_crossbones: This command requires this environment variable to be set: [%s]"
},
{
"active": true,
"name": "missingdependency",
"text": ":skull_and_crossbones: This command requires: [%s]"
}
],
"tools": [
{
"name": "BashBot Help",
"description": "Show this message",
"envvars": ["BASHBOT_CONFIG_FILEPATH"],
"dependencies": ["jq"],
"help": "bashbot help",
"trigger": "help",
"location": "./",
"command": [
"echo \"BashBot is a tool for infrastructure/devops teams to automate tasks triggered by slash-command-like declarative configuration\"",
"echo \"\\`\\`\\`\"",
"&& jq -r -c '.tools[] | \"\\(.help) - \\(.description)\"' ${BASHBOT_CONFIG_FILEPATH}",
"&& echo \"\\`\\`\\`\""
],
"parameters": [],
"log": false,
"ephemeral": false,
"response": "text",
"permissions": [
"all"
]
},
{
"name": "Get User/Channel Info",
"description": "Get information about the user and channel command is being run from",
"envvars": [],
"dependencies": [],
"help": "bashbot info",
"trigger": "info",
"location": "./example/info",
"command": ["./get-info.sh"],
"parameters": [],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
},
{
"name": "List Installed Bashbot Commands",
"description": "List all configured bashbot commands",
"envvars": ["BASHBOT_CONFIG_FILEPATH"],
"dependencies": ["jq"],
"help": "bashbot list",
"trigger": "list",
"location": "./",
"command": ["jq -r '.tools[] | .trigger + \" - \" + .name' ${BASHBOT_CONFIG_FILEPATH}"],
"parameters": [],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
},
{
"name": "Describe Bashbot [command]",
"description": "Show the json object for a specific command",
"envvars": ["BASHBOT_CONFIG_FILEPATH"],
"dependencies": ["jq"],
"help": "bashbot describe [command]",
"trigger": "describe",
"location": "./",
"command": ["jq '.tools[] | select(.trigger==\"${command}\")' ${BASHBOT_CONFIG_FILEPATH}"],
"parameters": [
{
"name": "command",
"allowed": [],
"description": "a command to describe ('bashbot list')",
"source": ["jq -r '.tools[] | .trigger' ${BASHBOT_CONFIG_FILEPATH}"]
}
],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
},
{
"name": "TEST Command",
"description": "Show the json object for a specific command",
"envvars": ["TRIGGERED_USER_NAME", "TRIGGERED_USER_ID", "TRIGGERED_CHANNEL_NAME", "TRIGGERED_CHANNEL_ID"],
"dependencies": [],
"help": "bashbot test [command]",
"trigger": "test",
"location": "./",
"command": [
"echo \"Username[id]: ${TRIGGERED_USER_NAME}[${TRIGGERED_USER_ID}]\"",
"&& echo \" Channel[id]: ${TRIGGERED_CHANNEL_NAME}[${TRIGGERED_CHANNEL_ID}]\""
],
"parameters": [],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
},
{
"name": "List Example Commands",
"description": "List commands from bashbot example commands",
"envvars": [],
"dependencies": [],
"help": "bashbot list-examples",
"trigger": "list-examples",
"location": "./examples",
"command": [
"find . -name \"*.json\"",
"| xargs -I {} bash -c",
"'export example=$(basename {} .json)",
"&& printf \"%21s - %s\" \"$example\" \"https://github.com/mathew-fleisch/bashbot/tree/main/examples/$example\"",
"&& echo'",
"| sort -k 2"
],
"parameters": [],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
},
{
"name": "Add Example Command",
"description": "Add command from bashbot example commands",
"envvars": [],
"dependencies": ["jq"],
"help": "bashbot add-example",
"trigger": "add-example",
"location": "./examples",
"command": [
"./add-example/add-command.sh $(find . -name \"${add_command}.json\")"
],
"parameters": [
{
"name": "add_command",
"allowed": [],
"description": "a command to add to bashbot config ('bashbot list-examples')",
"source": ["find . -name \"*.json\" | xargs -I {} basename {} .json"]
}
],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
},
{
"name": "Remove Example Command",
"description": "Remove command from bashbot example commands",
"envvars": [],
"dependencies": [],
"help": "bashbot remove-example",
"trigger": "remove-example",
"location": "./examples",
"command": [
"./remove-example/remove-command.sh ${remove_command}"
],
"parameters": [
{
"name": "remove_command",
"allowed": [],
"description": "a command to remove to bashbot config ('bashbot list-examples')",
"source": ["find . -name \"*.json\" | xargs -I {} basename {} .json"]
}
],
"log": false,
"ephemeral": false,
"response": "code",
"permissions": [
"all"
]
}
],
"dependencies": [
{
"name": "BashBot scripts Scripts",
"install": [
"rm -rf bashbot-scripts || true",
"&& git clone https://github.com/mathew-fleisch/bashbot-scripts.git"
]
}
]
}