-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassistant_ai_gitea.sublime-settings
169 lines (162 loc) · 4.99 KB
/
assistant_ai_gitea.sublime-settings
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
// Place your settings in the file "Packages/User/assistant_ai_gitea.sublime-settings",
// which overrides the settings in here. When opening this by Sublime Settings AssitantAI menu,
// your custom settings are in the right pane.
//
// In your custom settings, you must provide at least the 'credentials'. But you can also define
// custom 'prompts' and 'servers'.
//
// What you should not overwrite are 'default_prompts' nor 'default_servers' unless you really know
// the implications.
//
// This file specifies the 'Create Issue' endpoint for Gitea API. It's intended to quickly create issues
// in Gitea, with the selected code being reproduced in the issue body.
{
// credentials
"credentials": {
// Each server (default or custom) must have a unique 'id'.
// For each server id, you must specify the required credentials.
"gitea": {
// Create your Gitea API key from:
// https://GITEA_SERVER_URL/user/settings/applications
// "token": "..."
},
// For the example below of a custom server, then:
// "gitea_personal": {
// "api_key": "sk-XXX..."
// }
},
// add your custom prompts here
"prompts": [],
// add your custom servers here
"servers": [
// You can also define your own Gitea servers by importing the provided in 'default_servers' key below.
// Here is an example of a personal instance of a Gitea server that includes all definitions of the default one.
// See the 'import' key, that makes a copy of the default (identified by its 'id') and overwrites the defined keys.
//
// {
// "id": "gitea_personal", // choose a unique id for your custom server
// "import": "gitea", // import from the already defined server
// "name": "Gitea Personal", // overwrite the imported name
// "url": "https://YOUR_GITEA_SERVER:443", // overwrite the url with your personal Gitea instance
// },
],
// Default prompts and servers ---------------------------------------------
// WARNING
// You don't need to edit/overwrite the following specifications.
// Instead, you can use their id's to import those in your settings and effortlessly create new ones.
// This plugin may provide updates to these definitions and if you overwrite them, you may miss new features.
// prompts provided by this package
"default_prompts": [
{
"id": "gitea_get_repo",
"name": "Get data from a repo",
"visible": false,
"description": "Get data from a repo filtering by a search query.",
"required_inputs": ["search_repo"],
"required_endpoints": ["gitea/repos_search"],
"command": "append",
},
{
"id": "gitea_post_issue",
"name": "New issue from selected ${syntax} code",
"icon": "𐍁",
"description": "Creates a new Gitea issue referencing the selected code.",
"inputs": {
"repo": {
"type": "list_from_prompt",
"prompt_id": "gitea_get_repo",
"prompt_args": {
"search_repo": " ", // blank space returns full list, no ask user
}
}
},
"vars": {
"repo": "${repo}",
"title": "${title}",
"body": [
"${body}",
"",
"Code from: [${file_name}#${region_lines}](src/${file_relpath}#${region_lines}):",
"",
"```${syntax}",
"${text}",
"```",
"",
"> This issue was created from [Sublime Text](https://www.sublimetext.com/), using it's [AssistantAI](https://github.com/kanutron/AssistantAI) plugin.",
]
},
"required_inputs": ["repo", "text", "title", "body"],
"required_endpoints": ["gitea/issue_post"],
"command": {
"cmd": "prepend",
},
},
],
// servers provided by this package
"default_servers": [
{
"id": "gitea",
"name": "Gitea",
"url": "http://localhost:3000",
"timeout": 60,
"required_credentials": ["token"],
"headers": {
"Authorization": "token ${token}",
"Content-Type": "application/json",
},
"endpoints": {
"repos_search": {
"name": "Repos Search",
"icon": "𐍁",
"method": "GET",
"resource": "/api/v1/repos/search",
"required_vars": ["search_repo"],
"query": {
"q": "${search_repo}",
"archived": "non-archived",
"sort": "updated",
"order": "desc",
},
"response": {
"output": "${full_name}\n${description}",
"paths": {
"error": "message",
"text": "data/0/full_name",
"list": "data/*",
"vars": "data/0",
},
"templates": {
"list_item": [
"${full_name}",
"${description}"
]
},
},
},
"issue_post": {
"name": "Post Issue",
"icon": "𐍁",
"method": "POST",
"resource": "/api/v1/repos/${repo}/issues",
"required_vars": ["repo", "title", "body"],
"valid_params": {
"title": "string",
"body": "string",
},
"request": {
"title": "${title}",
"body": "${body}",
},
"response": {
"output": "# ISSUE #${number}: ${title} (${html_url})",
"paths": {
"error": "message",
"text": "html_url",
"vars": ".",
},
},
},
}
},
],
}