Crates.io | senior |
lib.rs | senior |
version | 0.1.1 |
source | src |
created_at | 2023-08-05 21:54:34.12316 |
updated_at | 2023-08-06 10:36:39.069161 |
description | A cli that summons an llm suggest improvements to given code |
homepage | |
repository | https://github.com/brurucy/senior |
max_upload_size | |
id | 936808 |
size | 1,813,617 |
Instead of bothering a senior engineer for suggestions on how to improve your code, ask senior instead!
Requires:
cargo install senior
or (not yet)
brew install senior
Senior uses LLMs(at the moment only openAI ones however) and an advance source code parsing library, tree-sitter
, to,
from the comfort of your terminal, suggest improvements to your code.
As an argument to the cli, you can give:
In return, you will be prompted with an improved version. If you accept it, by pressing y, then the original file will be overwritten with the suggestion.
The only requirement is that you must have an environment variable named OPENAI_API_KEY
with your very own token.
Language | Whole File | Function | Method | Limitations |
---|---|---|---|---|
Rust | X | X | X | |
Go | X | X | X | Untested with Generics. Most likely works. |
Javascript | X | X | X | Does not work with functions inside object literals nor anonymous functions declared inside classes (you shouldn't do that anyways) |
Typescript | X | X | X | Does not work with functions inside object literals nor anonymous functions declared inside classes (you shouldn't do that anyways) |
In case you would like to either improve support for a language, or add one altogether, do not worry, as I've written
senior
in such a way that it should be pretty easy to do so. First, fork it, then, add a new language
under supported_languages
and follow what has been done for the other languages.
tree-sitter
's capabilities to create a code context
. For instance, if method A of class X is to be
optimised, and there are other function or method calls inside A, then provide class X, and all constituent functions
inside A as a context.