Construct a command line service for hg ai
command
Private
_bestPrivate
_clientPrivate
_echoPrivate
_frequencyPrivate
_iterationsPrivate
_languagePrivate
_logPrivate
_maxPrivate
_modelPrivate
_nPrivate
_presencePrivate
_stopPrivate
_suffixPrivate
_temperaturePrivate
_topPPrivate
_userPrivate
_parsePrivate
Private
_populateWrite changelog based on git diff output
OpenAI completion
Example 1: completion(['Say this is a test'])
will print out "\n\nThis is indeed a test"
Writes descriptions about code.
Example describe('./keys.ts')
will print out description about the code:
This TypeScript code is an exported function called "keys" that takes two
parameters, "value" and "isKey". The "value" parameter is of type "any"
and the "isKey" parameter is of type "TestCallbackNonStandard". The
function returns an array of type "T" which is a generic type that extends
the type "keyof any".
The function starts by checking if the "value" parameter is an array. If
it is, it uses the "map" function to create an array of indexes from the
"value" array. It then uses the "filter" function to filter out the
indexes that pass the "isKey" test. The filtered indexes are then
returned as an array of type "T".
If the "value" parameter is an object, the function uses the
"Reflect.ownKeys" function to get an array of all the keys of the object.
It then uses the "filter" function to filter out the keys that pass the
"isKey" test. The filtered keys are then returned as an array of type "T".
If the "value" parameter is neither an array nor an object, the function
returns an empty array of type "T".
Documents TypeScript code using JSDoc
OpenAI edit action
Example 1: edit(['Fix the spelling mistakes', 'What day of the wek is it?'])
will print out "What day of the week is it?"
.
Example 2: edit(['Write a function in python that calculates fibonacci'])
will print out Python implementation of fibonacci function.
Example 3: edit(['Rename the function to fib', 'def fibonacci(num): if num <= 1: return num else: return fib(num-1) + fib(num-2) print(fibonacci(10))'])
will print out:
def fib(num):
if num <= 1:
return num
else:
return fib(num-1) + fib(num-2)
print(fib(10))
The main command line handler.
It is intended to be called when user calls hg ai ...
with the remaining
arguments as args
option.
Example 1: main(['completion', ...])
will call completion([...])
Example 2: main(['comp', ...])
will call completion([...])
Example 3: main(['c', ...])
will call completion([...])
Example 4: main(['edit', ...])
will call edit([...])
Example 5: main(['e', ...])
will call edit([...])
Example 6: main(['test', ...])
will call test([...])
Example 7: main(['t', ...])
will call test([...])
Write test cases
Example writeTests('./FooService.ts')
will print out unit tests for the
FooService
written in TypeScript and Jest framework.
Tests should look like:
describe("Class", () => {
describe("Method", () => {
it('should ...', () => {
// ... here test implementation ...
});
});
});
Static
setGenerated using TypeDoc
TODO
Improve code
TODO
Rewrite code with correct style
TODO
Rewrite code with using idiomatic constructs
TODO
Simplify code
TODO
Explore alternatives
TODO
Write documentation