gennady 0.2.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -10
- package/cli/cmd/cat.js +26 -0
- package/cli/cmd/commit.js +83 -0
- package/cli/cmd/review.js +58 -0
- package/cli/gennady.js +19 -40
- package/index.js +2 -0
- package/package.json +5 -3
- package/src/ai/ai-core.js +187 -0
- package/src/cat-gen/cat-gen.js +53 -0
- package/src/commit-gen/commit-gen.js +38 -71
- package/src/git/git-core.js +69 -0
- package/src/git/git-diff.js +36 -13
- package/src/prompts/commit/commit-base-prompt.md +38 -0
- package/src/prompts/commit/commit-format-detailed-prompt.md +29 -0
- package/src/prompts/commit/commit-format-oneline-prompt.md +19 -0
- package/src/prompts/commit/commit-translate-prompt.md +15 -0
- package/src/prompts/index.js +10 -0
- package/src/prompts/review/review-base-prompt.md +46 -0
- package/src/review-gen/__fixture__/review-gen-fixture.md +110 -0
- package/src/review-gen/review-gen.js +119 -0
- package/src/review-gen/review-gen.test.js +79 -0
- package/src/review-gen/specs/js/Function.prototype.json +162 -0
- package/src/review-gen/specs/js/Global.json +219 -0
- package/src/review-gen/specs/js/JSON.json +85 -0
- package/src/review-gen/specs/js/Object.json +626 -0
- package/src/review-gen/specs/js/Object.prototype.json +337 -0
- package/src/review-gen/specs/js/Storage.json +97 -0
- package/src/utils/parse-args.js +7 -3
- package/src/utils/style.js +12 -3
- package/src/git/git-cmd.js +0 -32
- package/src/prompts/base-prompt.md +0 -27
- package/src/prompts/format-detailed-prompt.md +0 -16
- package/src/prompts/format-oneline-prompt.md +0 -11
- package/src/prompts/translate-prompt.md +0 -11
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Object.prototype": {
|
|
3
|
+
"description": "The prototype object for all objects created by `new Object()` or object literals. It provides common methods inherited by all objects.",
|
|
4
|
+
"properties": {
|
|
5
|
+
"constructor": {
|
|
6
|
+
"value": "Object",
|
|
7
|
+
"attributes": {
|
|
8
|
+
"writable": true,
|
|
9
|
+
"enumerable": false,
|
|
10
|
+
"configurable": true
|
|
11
|
+
},
|
|
12
|
+
"description": "Specifies the function that creates an object's prototype. The initial value is the Object constructor."
|
|
13
|
+
},
|
|
14
|
+
"__proto__": {
|
|
15
|
+
"description": "[Legacy, Optional] An accessor property that exposes the internal [[Prototype]] of an object.",
|
|
16
|
+
"legacy": true,
|
|
17
|
+
"optional": true,
|
|
18
|
+
"attributes": {
|
|
19
|
+
"enumerable": false,
|
|
20
|
+
"configurable": true
|
|
21
|
+
},
|
|
22
|
+
"get": {
|
|
23
|
+
"description": "Returns the prototype of the object.",
|
|
24
|
+
"arguments": [],
|
|
25
|
+
"returns": {
|
|
26
|
+
"type": "Object | null",
|
|
27
|
+
"description": "The prototype object or null."
|
|
28
|
+
},
|
|
29
|
+
"exceptions": [
|
|
30
|
+
{
|
|
31
|
+
"type": "TypeError",
|
|
32
|
+
"description": "If the `this value` is not coercible to an Object (null or undefined)."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"type": "TypeError",
|
|
36
|
+
"description": "If retrieving the prototype fails internally (e.g., on certain Proxy objects)."
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"set": {
|
|
41
|
+
"description": "Sets the prototype of the object.",
|
|
42
|
+
"arguments": [
|
|
43
|
+
{
|
|
44
|
+
"name": "proto",
|
|
45
|
+
"required": true,
|
|
46
|
+
"description": "The new prototype (an object or null)."
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"returns": {
|
|
50
|
+
"type": "undefined",
|
|
51
|
+
"description": "Always returns undefined."
|
|
52
|
+
},
|
|
53
|
+
"exceptions": [
|
|
54
|
+
{
|
|
55
|
+
"type": "TypeError",
|
|
56
|
+
"description": "If the `this value` is null or undefined."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"type": "TypeError",
|
|
60
|
+
"description": "If the operation fails (e.g. `this value` is non-extensible, `this value` is not an object, or a prototype chain cycle would be created)."
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"methods": {
|
|
67
|
+
"hasOwnProperty": {
|
|
68
|
+
"description": "Returns a boolean indicating whether the object has the specified property as its own property (as opposed to inheriting it).",
|
|
69
|
+
"arguments": [
|
|
70
|
+
{
|
|
71
|
+
"name": "V",
|
|
72
|
+
"required": true,
|
|
73
|
+
"description": "The property key (String or Symbol) to test."
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"returns": {
|
|
77
|
+
"type": "Boolean",
|
|
78
|
+
"description": "`true` if the object has the specified property as own property; `false` otherwise."
|
|
79
|
+
},
|
|
80
|
+
"exceptions": [
|
|
81
|
+
{
|
|
82
|
+
"type": "TypeError",
|
|
83
|
+
"description": "If the `V` argument cannot be converted to a property key."
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "TypeError",
|
|
87
|
+
"description": "If the `this value` is not coercible to an Object (null or undefined)."
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"isPrototypeOf": {
|
|
92
|
+
"description": "Checks if an object exists in another object's prototype chain.",
|
|
93
|
+
"arguments": [
|
|
94
|
+
{
|
|
95
|
+
"name": "V",
|
|
96
|
+
"required": true,
|
|
97
|
+
"description": "The object whose prototype chain will be searched."
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"returns": {
|
|
101
|
+
"type": "Boolean",
|
|
102
|
+
"description": "`true` if the calling object lies in the prototype chain of `V`; `false` otherwise."
|
|
103
|
+
},
|
|
104
|
+
"exceptions": [
|
|
105
|
+
{
|
|
106
|
+
"type": "TypeError",
|
|
107
|
+
"description": "If the `this value` is not coercible to an Object (null or undefined)."
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "TypeError",
|
|
111
|
+
"description": "If retrieving the prototype of `V` or any object in its chain fails internally (e.g., on certain Proxy objects)."
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"propertyIsEnumerable": {
|
|
116
|
+
"description": "Returns a Boolean indicating whether the specified property is the object's own enumerable property.",
|
|
117
|
+
"arguments": [
|
|
118
|
+
{
|
|
119
|
+
"name": "V",
|
|
120
|
+
"required": true,
|
|
121
|
+
"description": "The property key (String or Symbol) to test."
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"returns": {
|
|
125
|
+
"type": "Boolean",
|
|
126
|
+
"description": "`true` if the specified property is an own enumerable property; `false` otherwise."
|
|
127
|
+
},
|
|
128
|
+
"exceptions": [
|
|
129
|
+
{
|
|
130
|
+
"type": "TypeError",
|
|
131
|
+
"description": "If the `V` argument cannot be converted to a property key."
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "TypeError",
|
|
135
|
+
"description": "If the `this value` is not coercible to an Object (null or undefined)."
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"toLocaleString": {
|
|
140
|
+
"description": "Returns a string representing the object. This method is meant to be overridden by derived objects for locale-specific purposes.",
|
|
141
|
+
"arguments": [
|
|
142
|
+
{
|
|
143
|
+
"name": "reserved1",
|
|
144
|
+
"required": false,
|
|
145
|
+
"description": "Reserved for future use (intended for ECMA-402 Intl options)."
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "reserved2",
|
|
149
|
+
"required": false,
|
|
150
|
+
"description": "Reserved for future use (intended for ECMA-402 Intl options)."
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"returns": {
|
|
154
|
+
"type": "String",
|
|
155
|
+
"description": "A string representation of the object. By default, calls `this.toString()`."
|
|
156
|
+
},
|
|
157
|
+
"exceptions": [
|
|
158
|
+
{
|
|
159
|
+
"comment": "Inherits exceptions from the call to this.toString()",
|
|
160
|
+
"type": "TypeError",
|
|
161
|
+
"description": "If `this.toString` cannot be called or throws."
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"toString": {
|
|
166
|
+
"description": "Returns a string representing the object, typically in the format \"[object Type]\".",
|
|
167
|
+
"arguments": [],
|
|
168
|
+
"returns": {
|
|
169
|
+
"type": "String",
|
|
170
|
+
"description": "A string representation of the object."
|
|
171
|
+
},
|
|
172
|
+
"exceptions": [
|
|
173
|
+
{
|
|
174
|
+
"type": "TypeError",
|
|
175
|
+
"description": "If retrieving the value of `Symbol.toStringTag` throws an error (e.g., from a getter)."
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "TypeError",
|
|
179
|
+
"description": "If checking `IsArray` throws an error (e.g., on certain Proxy objects)."
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
"valueOf": {
|
|
184
|
+
"description": "Returns the primitive value of the specified object.",
|
|
185
|
+
"arguments": [],
|
|
186
|
+
"returns": {
|
|
187
|
+
"type": "Object",
|
|
188
|
+
"description": "The primitive value of the object (usually the object itself for plain objects)."
|
|
189
|
+
},
|
|
190
|
+
"exceptions": [
|
|
191
|
+
{
|
|
192
|
+
"type": "TypeError",
|
|
193
|
+
"description": "If the `this value` is not coercible to an Object (null or undefined)."
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
"__defineGetter__": {
|
|
198
|
+
"description": "[Legacy, Optional] Binds an object's property to a function to be called when that property is looked up.",
|
|
199
|
+
"legacy": true,
|
|
200
|
+
"optional": true,
|
|
201
|
+
"arguments": [
|
|
202
|
+
{
|
|
203
|
+
"name": "P",
|
|
204
|
+
"required": true,
|
|
205
|
+
"description": "The property key (String or Symbol) for which to bind the getter."
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "getter",
|
|
209
|
+
"required": true,
|
|
210
|
+
"description": "The function to use as the getter."
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"returns": {
|
|
214
|
+
"type": "undefined",
|
|
215
|
+
"description": "Always returns undefined."
|
|
216
|
+
},
|
|
217
|
+
"exceptions": [
|
|
218
|
+
{
|
|
219
|
+
"type": "TypeError",
|
|
220
|
+
"description": "If the `this value` is not coercible to an Object."
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"type": "TypeError",
|
|
224
|
+
"description": "If the `getter` argument is not callable."
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"type": "TypeError",
|
|
228
|
+
"description": "If the `P` argument cannot be converted to a property key."
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"type": "TypeError",
|
|
232
|
+
"description": "If defining the property fails (e.g., the property is non-configurable)."
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"__defineSetter__": {
|
|
237
|
+
"description": "[Legacy, Optional] Binds an object's property to a function to be called when an attempt is made to set that property.",
|
|
238
|
+
"legacy": true,
|
|
239
|
+
"optional": true,
|
|
240
|
+
"arguments": [
|
|
241
|
+
{
|
|
242
|
+
"name": "P",
|
|
243
|
+
"required": true,
|
|
244
|
+
"description": "The property key (String or Symbol) for which to bind the setter."
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "setter",
|
|
248
|
+
"required": true,
|
|
249
|
+
"description": "The function to use as the setter."
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"returns": {
|
|
253
|
+
"type": "undefined",
|
|
254
|
+
"description": "Always returns undefined."
|
|
255
|
+
},
|
|
256
|
+
"exceptions": [
|
|
257
|
+
{
|
|
258
|
+
"type": "TypeError",
|
|
259
|
+
"description": "If the `this value` is not coercible to an Object."
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"type": "TypeError",
|
|
263
|
+
"description": "If the `setter` argument is not callable."
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"type": "TypeError",
|
|
267
|
+
"description": "If the `P` argument cannot be converted to a property key."
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"type": "TypeError",
|
|
271
|
+
"description": "If defining the property fails (e.g., the property is non-configurable)."
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
"__lookupGetter__": {
|
|
276
|
+
"description": "[Legacy, Optional] Returns the function bound as a getter to the specified property, searching the prototype chain.",
|
|
277
|
+
"legacy": true,
|
|
278
|
+
"optional": true,
|
|
279
|
+
"arguments": [
|
|
280
|
+
{
|
|
281
|
+
"name": "P",
|
|
282
|
+
"required": true,
|
|
283
|
+
"description": "The property key (String or Symbol) whose getter should be looked up."
|
|
284
|
+
}
|
|
285
|
+
],
|
|
286
|
+
"returns": {
|
|
287
|
+
"type": "Function | undefined",
|
|
288
|
+
"description": "The getter function for the property, or `undefined` if none is found."
|
|
289
|
+
},
|
|
290
|
+
"exceptions": [
|
|
291
|
+
{
|
|
292
|
+
"type": "TypeError",
|
|
293
|
+
"description": "If the `this value` is not coercible to an Object."
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"type": "TypeError",
|
|
297
|
+
"description": "If the `P` argument cannot be converted to a property key."
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"type": "TypeError",
|
|
301
|
+
"description": "If retrieving the prototype or property descriptor fails internally during the chain walk."
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
"__lookupSetter__": {
|
|
306
|
+
"description": "[Legacy, Optional] Returns the function bound as a setter to the specified property, searching the prototype chain.",
|
|
307
|
+
"legacy": true,
|
|
308
|
+
"optional": true,
|
|
309
|
+
"arguments": [
|
|
310
|
+
{
|
|
311
|
+
"name": "P",
|
|
312
|
+
"required": true,
|
|
313
|
+
"description": "The property key (String or Symbol) whose setter should be looked up."
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
"returns": {
|
|
317
|
+
"type": "Function | undefined",
|
|
318
|
+
"description": "The setter function for the property, or `undefined` if none is found."
|
|
319
|
+
},
|
|
320
|
+
"exceptions": [
|
|
321
|
+
{
|
|
322
|
+
"type": "TypeError",
|
|
323
|
+
"description": "If the `this value` is not coercible to an Object."
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"type": "TypeError",
|
|
327
|
+
"description": "If the `P` argument cannot be converted to a property key."
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"type": "TypeError",
|
|
331
|
+
"description": "If retrieving the prototype or property descriptor fails internally during the chain walk."
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Storage": {
|
|
3
|
+
"description": "Provides access to a particular domain's session or local storage. Allows data to be stored persistently (localStorage) or for the duration of a session (sessionStorage). Keys and values are stored as UTF-16 strings.",
|
|
4
|
+
"properties": {
|
|
5
|
+
"length": {
|
|
6
|
+
"description": "Returns the number of key/value pairs currently stored in the Storage object.",
|
|
7
|
+
"readOnly": true,
|
|
8
|
+
"returns": {
|
|
9
|
+
"type": "Number",
|
|
10
|
+
"description": "An integer representing the number of data items stored."
|
|
11
|
+
},
|
|
12
|
+
"exceptions": []
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"methods": {
|
|
16
|
+
"key": {
|
|
17
|
+
"description": "Returns the name of the key at the specified numerical index. The order of keys is user-agent defined and not guaranteed.",
|
|
18
|
+
"arguments": [
|
|
19
|
+
{
|
|
20
|
+
"name": "index",
|
|
21
|
+
"required": true,
|
|
22
|
+
"description": "An integer representing the zero-based index of the key name to retrieve."
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"returns": {
|
|
26
|
+
"type": "String | null",
|
|
27
|
+
"description": "The name of the key at the given index, or `null` if the index is out of bounds."
|
|
28
|
+
},
|
|
29
|
+
"exceptions": []
|
|
30
|
+
},
|
|
31
|
+
"getItem": {
|
|
32
|
+
"description": "Retrieves the current value associated with the given key.",
|
|
33
|
+
"arguments": [
|
|
34
|
+
{
|
|
35
|
+
"name": "keyName",
|
|
36
|
+
"required": true,
|
|
37
|
+
"description": "A string containing the name of the key whose value you want to retrieve."
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"returns": {
|
|
41
|
+
"type": "String | null",
|
|
42
|
+
"description": "The string value associated with the key, or `null` if the key does not exist."
|
|
43
|
+
},
|
|
44
|
+
"exceptions": []
|
|
45
|
+
},
|
|
46
|
+
"setItem": {
|
|
47
|
+
"description": "Adds or updates a key/value pair in the Storage object.",
|
|
48
|
+
"arguments": [
|
|
49
|
+
{
|
|
50
|
+
"name": "keyName",
|
|
51
|
+
"required": true,
|
|
52
|
+
"description": "A string containing the name of the key to create/update."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "keyValue",
|
|
56
|
+
"required": true,
|
|
57
|
+
"description": "A string containing the value to store for the key."
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"returns": {
|
|
61
|
+
"type": "undefined",
|
|
62
|
+
"description": "This method does not return a value."
|
|
63
|
+
},
|
|
64
|
+
"exceptions": [
|
|
65
|
+
{
|
|
66
|
+
"type": "QuotaExceededError",
|
|
67
|
+
"description": "The storage limit has been exceeded, or the user denied permission for storage."
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
"removeItem": {
|
|
72
|
+
"description": "Removes the key/value pair with the specified key name, if it exists.",
|
|
73
|
+
"arguments": [
|
|
74
|
+
{
|
|
75
|
+
"name": "keyName",
|
|
76
|
+
"required": true,
|
|
77
|
+
"description": "A string containing the name of the key to remove."
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"returns": {
|
|
81
|
+
"type": "undefined",
|
|
82
|
+
"description": "This method does not return a value."
|
|
83
|
+
},
|
|
84
|
+
"exceptions": []
|
|
85
|
+
},
|
|
86
|
+
"clear": {
|
|
87
|
+
"description": "Removes all key/value pairs from the Storage object.",
|
|
88
|
+
"arguments": [],
|
|
89
|
+
"returns": {
|
|
90
|
+
"type": "undefined",
|
|
91
|
+
"description": "This method does not return a value."
|
|
92
|
+
},
|
|
93
|
+
"exceptions": []
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
package/src/utils/parse-args.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const parseArgs = (argv, schema) => {
|
|
2
|
-
const params = {};
|
|
1
|
+
export const parseArgs = (argv, schema = {}) => {
|
|
2
|
+
const params = { _: [] };
|
|
3
3
|
const argsList = argv.slice(2);
|
|
4
4
|
|
|
5
5
|
argsList.forEach(arg => {
|
|
@@ -9,10 +9,14 @@ export const parseArgs = (argv, schema) => {
|
|
|
9
9
|
|
|
10
10
|
for (const [optionKey, aliases] of Object.entries(schema)) {
|
|
11
11
|
if (aliases.includes(key)) {
|
|
12
|
-
params[optionKey] = value
|
|
12
|
+
params[optionKey] = value
|
|
13
|
+
? value.replace(/^"|"$/g, '')
|
|
14
|
+
: true;
|
|
13
15
|
break;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
18
|
+
} else {
|
|
19
|
+
params._.push(arg);
|
|
16
20
|
}
|
|
17
21
|
});
|
|
18
22
|
|
package/src/utils/style.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const NO_COLOR = (
|
|
2
|
+
process.argv.includes('--plain') ||
|
|
3
|
+
process.argv.includes('--no-color')
|
|
4
|
+
);
|
|
5
|
+
|
|
1
6
|
const ansiCodes = {
|
|
2
7
|
// Modifiers
|
|
3
8
|
reset: '\x1b[0m',
|
|
@@ -51,11 +56,13 @@ function createStyler(appliedStyles = []) {
|
|
|
51
56
|
return new Proxy(() => {}, {
|
|
52
57
|
get(_target, prop) {
|
|
53
58
|
if (prop === 'toString') {
|
|
54
|
-
return () =>
|
|
59
|
+
return () => NO_COLOR
|
|
60
|
+
? '%s'
|
|
61
|
+
: appliedStyles.join('') + '%s' + ansiCodes.reset;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
if (prop in ansiCodes) {
|
|
58
|
-
return createStyler([...appliedStyles, ansiCodes[prop]]);
|
|
65
|
+
return createStyler(NO_COLOR ? [] : [...appliedStyles, ansiCodes[prop]]);
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
return undefined;
|
|
@@ -63,7 +70,9 @@ function createStyler(appliedStyles = []) {
|
|
|
63
70
|
|
|
64
71
|
apply(_target, _thisArg, args) {
|
|
65
72
|
const text = args[0] || '';
|
|
66
|
-
return
|
|
73
|
+
return NO_COLOR
|
|
74
|
+
? text
|
|
75
|
+
: appliedStyles.join('') + text + ansiCodes.reset;
|
|
67
76
|
}
|
|
68
77
|
});
|
|
69
78
|
}
|
package/src/git/git-cmd.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { execSync as nodeExecSync } from 'node:child_process';
|
|
2
|
-
|
|
3
|
-
const execSync = (cmd) => {
|
|
4
|
-
try {
|
|
5
|
-
return nodeExecSync(cmd, { encoding: 'utf-8'});
|
|
6
|
-
} catch (e) {
|
|
7
|
-
return '';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const detectBaseBranch = () => {
|
|
12
|
-
const branchesOutput = execSync('git branch --list 2>/dev/null');
|
|
13
|
-
const match = branchesOutput?.match(/\s*\*?\s*(master|main)$/m);
|
|
14
|
-
return match?.[1] || 'master';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const getGitCommitCount = () => {
|
|
18
|
-
try {
|
|
19
|
-
const output = execSync(`git rev-list --count HEAD ^${detectBaseBranch()} 2>/dev/null`);
|
|
20
|
-
return parseInt(output, 10) || 0;
|
|
21
|
-
} catch {
|
|
22
|
-
return 0;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const getGitDiff = (targetBranch) => {
|
|
27
|
-
if (targetBranch) {
|
|
28
|
-
return execSync(`git diff ${targetBranch}`);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return execSync('git diff --cached');
|
|
32
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
You are {languages} expert tasked with writing a git commit subject and description based on code changes.
|
|
2
|
-
|
|
3
|
-
**Subject:**
|
|
4
|
-
- Clearly summarize the key changes in one concise yet informative sentence.
|
|
5
|
-
- Do not describe changes for each file.
|
|
6
|
-
- Do not mention stylistic changes or fixed typos.
|
|
7
|
-
- The subject must provide enough context to understand the commit at a glance.
|
|
8
|
-
- End with an emoji instead of a period.
|
|
9
|
-
|
|
10
|
-
**Description:**
|
|
11
|
-
- Expand on the changes by listing key modifications as an unordered list.
|
|
12
|
-
- Do not describe changes for each file.
|
|
13
|
-
- Do not mention stylistic changes or fixed typos.
|
|
14
|
-
- Group related changes into single points.
|
|
15
|
-
- Each list item **must** be less than 140 characters and should not end with a period.
|
|
16
|
-
|
|
17
|
-
**Output Format (any deviation from this format is incorrect):**
|
|
18
|
-
<message>subject emoji
|
|
19
|
-
- description item 1
|
|
20
|
-
- description item 2</message>
|
|
21
|
-
|
|
22
|
-
**Extremely important:**
|
|
23
|
-
- The output must contain only commit message inside `<message>` and `</message>`.
|
|
24
|
-
- Do not add unnecessary words and markup, strictly follow the output format.
|
|
25
|
-
|
|
26
|
-
**Input:**
|
|
27
|
-
{input}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
You are a {languages} expert tasked with writing a git commit subject and description based on code changes.
|
|
2
|
-
|
|
3
|
-
### **Correct Output Format (no deviations allowed):**
|
|
4
|
-
<message>
|
|
5
|
-
[Commit subject ending with an emoji]
|
|
6
|
-
- [Description item 1]
|
|
7
|
-
- [Description item 2]
|
|
8
|
-
- [Description item N]
|
|
9
|
-
</message>
|
|
10
|
-
|
|
11
|
-
### **Fix this incorrect commit message:**
|
|
12
|
-
{input}
|
|
13
|
-
|
|
14
|
-
**Extremely important:**
|
|
15
|
-
- The output must contain only commit message inside `<message>` and `</message>`.
|
|
16
|
-
- Do not add unnecessary words and markup, strictly follow the output format.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
You are a {languages} expert tasked with writing a git commit subject and description based on code changes.
|
|
2
|
-
|
|
3
|
-
### **Correct Output Format (no deviations allowed):**
|
|
4
|
-
<message>Oneline commit message without loss of meaning and important changes and ending with an emoji</message>
|
|
5
|
-
|
|
6
|
-
### **Fix this incorrect commit message:**
|
|
7
|
-
{input}
|
|
8
|
-
|
|
9
|
-
**Extremely important:**
|
|
10
|
-
- The output must contain only commit message inside `<message>` and `</message>`.
|
|
11
|
-
- Do not add unnecessary words and markup, strictly follow the output format.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
### Translate text inside <message> and </message> tags from English to **{lang}**:
|
|
2
|
-
|
|
3
|
-
### **Output:**
|
|
4
|
-
<message>Translation result</message>
|
|
5
|
-
|
|
6
|
-
### **Extremely important:**
|
|
7
|
-
- The translation must be wrapped inside <message> and </message> tags.
|
|
8
|
-
- Do not add unnecessary words and markup, strictly follow the output format.
|
|
9
|
-
|
|
10
|
-
### **Input:**
|
|
11
|
-
<message>{input}</message>
|