-
-
Notifications
You must be signed in to change notification settings - Fork 324
Expand file tree
/
Copy pathactions.json
More file actions
202 lines (202 loc) · 8.62 KB
/
actions.json
File metadata and controls
202 lines (202 loc) · 8.62 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
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
{
"complete_code": {
"type": "chat",
"opts": {
"template": "Complete the following {{filetype}} code by continuing it. Respond with the COMPLETE code (existing + new). No markdown fences, no explanations.\n\n{{input}}",
"strategy": "replace",
"params": {
"model": "gpt-5-mini"
}
}
},
"grammar_correction": {
"type": "chat",
"opts": {
"template": "Correct this to standard {{lang}}:\n\n{{input}}",
"strategy": "replace",
"params": {
"model": "gpt-5-mini"
}
},
"args": {
"lang": {
"type": "string",
"optional": "true",
"default": "english"
}
}
},
"translate": {
"type": "chat",
"opts": {
"template": "Translate this into {{lang}}:\n\n{{input}}",
"strategy": "replace",
"params": {
"model": "gpt-5-mini",
"temperature": 0.3
}
},
"args": {
"lang": {
"type": "string",
"optional": "true",
"default": "english"
}
}
},
"keywords": {
"type": "chat",
"opts": {
"template": "Extract the main keywords from the following text.\n\n{{input}}",
"strategy": "replace",
"params": {
"model": "gpt-5-mini"
}
}
},
"docstring": {
"type": "chat",
"opts": {
"template": "Add a high quality docstring to the following {{filetype}} code. Include parameter types, return types, and any errors that might be raised.\n\nCode:\n{{input}}\n\nRespond with ONLY the complete code including the docstring. No markdown fences, no explanations.",
"strategy": "edit",
"params": {
"model": "gpt-5-mini"
}
}
},
"add_tests": {
"type": "chat",
"opts": {
"template": "Implement tests for the following {{filetype}} code.\n\nCode:\n{{input}}\n\nRespond with ONLY the test code. No markdown fences, no explanations.",
"strategy": "append",
"params": {
"model": "gpt-5-mini"
}
}
},
"optimize_code": {
"type": "chat",
"opts": {
"template": "Optimize the following {{filetype}} code for better performance and readability.\n\nCode:\n{{input}}\n\nRespond with ONLY the optimized code. No markdown fences, no explanations.",
"strategy": "edit",
"params": {
"model": "gpt-5-mini"
}
}
},
"summarize": {
"type": "chat",
"opts": {
"template": "Summarize the following text.\n\nText:\n\"\"\"\n{{input}}\n\"\"\"\n\nSummary:",
"strategy": "edit",
"params": {
"model": "gpt-5-mini"
}
}
},
"fix_bugs": {
"type": "chat",
"opts": {
"template": "Fix bugs in the following {{filetype}} code.\n\nCode:\n{{input}}\n\nRespond with ONLY the fixed code. No markdown fences, no explanations.",
"strategy": "edit",
"params": {
"model": "gpt-5-mini"
}
}
},
"explain_code": {
"type": "chat",
"opts": {
"title": " Explain Code",
"template": "Explain the following {{filetype}} code. Use markdown format with clear sections.\n\nCode:\n{{input}}",
"strategy": "display",
"params": {
"model": "gpt-5-mini"
}
}
},
"roxygen_edit": {
"type": "chat",
"opts": {
"template": "Insert a roxygen skeleton to document this R function:\n\n```{{filetype}}\n[insert]\n\n{{input}}\n\n```",
"strategy": "prepend",
"params": {
"model": "gpt-5-mini",
"temperature": 0.5,
"max_tokens": 1024
}
}
},
"code_readability_analysis": {
"type": "chat",
"opts": {
"strategy": "quick_fix",
"template": "{{input}}",
"params": {
"model": "gpt-5-mini",
"max_tokens": 2048,
"messages": [
{
"role": "system",
"content": "\nYou must identify any readability issues in the code snippet.\nSome readability issues to consider:\n- Unclear naming\n- Unclear purpose\n- Redundant or obvious comments\n- Lack of comments\n- Long or complex one liners\n- Too much nesting\n- Long variable names\n- Inconsistent naming and code style.\n- Code repetition\nYou may identify additional problems. The user submits a small section of code from a larger file.\nOnly list lines with readability issues, in the format <line_num>|<issue and proposed solution>\nYour commentary must fit on a single line\nDo not use the range of lines but just single line number\nIf there's no issues with code respond with only: <OK>\n"
},
{
"role": "user",
"content": "\n0 public class Logic {\n1 public static void main(String[] args) {\n2 Scanner sc = new Scanner(System.in);\n3 int n = sc.nextInt();\n4 int[] arr = new int[n];\n5 for (int i = 0; i < n; i++) {\n6 arr[i] = sc.nextInt();\n7 }\n8 int[] dp = new int[n];\n9 dp[0] = arr[0];\n10 dp[1] = Math.max(arr[0], arr[1]);\n11 for (int i = 2; i < n; i++) {\n12 dp[i] = Math.max(dp[i - 1], dp[i - 2] + arr[i]);\n13 }\n14 System.out.println(dp[n - 1]);\n15 }\n16 }"
},
{
"role": "assistant",
"content": "\n0: The class name 'Logic' is too generic. A more meaningful name could be 'DynamicProgramming'\n2: The variable name 'sc' is unclear. A more meaningful name could be 'scanner'.\n3: The variable name 'n' is unclear. A more meaningful name could be 'arraySize' or 'numElements'.\n4: The variable name 'arr' unclear. A more descriptive name could be 'inputArray' or 'elementValues'.\n8: The variable name 'dp' is unclear. A more informative name could be 'maxSum' or 'optimalSolution'.\n9: There are no comments explaining the meaning of the 'dp' array values and how they relate to the problem statement.\n11: There are no comments explaining the logic and purpose of the for loop"
},
{
"role": "user",
"content": "\n0 for (let i: number = 0; i < l; i++) {\n1 let notAddr: boolean = false;\n2 // non standard input\n3 if (items[i].scriptSig && !items[i].addr) {\n4 items[i].addr = 'Unparsed address [' + u++ + ']';\n5 items[i].notAddr = true;\n6 notAddr = true;\n7 }\n8 \n9 // non standard output\n10 if (items[i].scriptPubKey && !items[i].scriptPubKey.addresses) {\n11 items[i].scriptPubKey.addresses = ['Unparsed address [' + u++ + ']'];"
},
{
"role": "assistant",
"content": "\n0: The variable name 'i' and 'l' are unclear and easily confused with other characters like '1'. More meaningful names could be 'index' and 'length' respectively.\n1: The variable name 'notAddr' is unclear and a double negative. An alternative could be 'hasUnparsedAddress'.\n3: The comment \"non standard input\" is not very informative. It could be more descriptive, e.g., \"Check for non standard input address\"\n9: The comment \"non standard output\" is not very informative. It could be more descriptive, e.g., \"Check for non standard output address\"\n10: The variable name 'items' might be more informative if changed to 'transactions' or 'txItems'.\n11: The array element 'Unparsed address [' + u++ + ']' could use a more descriptive comment, e.g., \"Assign a unique identifier to non standard output addresses\"\n11: The variable name 'u' is unclear. A more meaningful name could be 'unparsedAddressCount' or 'unparsedAddressId'."
},
{
"role": "user",
"content": "\n0 function BaseAction:init(opts)\n1 self.opts = opts\n2 end"
},
{
"role": "assistant",
"content": "<OK>"
}
]
}
}
},
"fix_diagnostic": {
"type": "chat",
"opts": {
"template": "Fix the following error in the {{filetype}} code.\n\nError:\n{{diagnostic}}\n\nCode:\n{{input}}\n\nRespond with ONLY the fixed code. No markdown fences, no explanations.",
"strategy": "edit",
"params": {
"model": "gpt-5-mini"
}
}
},
"explain_diagnostic": {
"type": "chat",
"opts": {
"title": " Explain Error",
"template": "Explain the following error and how to fix it. Use markdown format.\n\nError:\n{{diagnostic}}\n\nCode:\n{{input}}",
"strategy": "display",
"params": {
"model": "gpt-5-mini"
}
}
},
"fix_diagnostics": {
"type": "chat",
"opts": {
"template": "Fix all the following errors in the {{filetype}} code.\n\nErrors:\n{{diagnostics}}\n\nCode:\n{{input}}\n\nRespond with ONLY the fixed code. No markdown fences, no explanations.",
"strategy": "edit",
"params": {
"model": "gpt-5-mini"
}
}
}
}