Skip to content

Commit 904f6e2

Browse files
committed
bump version, docs, prompts
1 parent f5097f0 commit 904f6e2

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Codegpt
22

3-
## 0.2.0
3+
## 0.2.10
44

55
A tool for using GPT just a little quicker. A nearly truly automated footgun. Learn how to revert with git before trying please.
66

@@ -27,7 +27,7 @@ Usage
2727
To try Codegpt, you can run the following command:
2828

2929
```bash
30-
codegpt do <filenames>
30+
codegpt do <instructions (quoted)> <filenames>
3131
```
3232

3333
It will prompt you for directions to follow, and it'll do whatever you want. Write new docs, add comments to code, just make sure to ask it to "edit" or "comment" or whatever so it knows to change files or not.
@@ -73,9 +73,3 @@ codegpt quick ugh <filenames>
7373
Keep in mind that using GPT-3 for code generation is paid, with a cost of 2 cents per 1,000 tokens.
7474

7575
Just like with a Jr Dev, it's best to break up your tasks into smaller pieces to improve the results.
76-
77-
Propose endpoints as issues, I've got a few ideas:
78-
79-
- Write tests for file
80-
- Generate SQL query from table spec files
81-
- Generate new file

codegpt/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def edit_file(
2828
False, "--backup", "-b", help="Whether to create a backup of the original file(s).",
2929
),
3030
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation.",),
31-
raw_code: str = typer.Option(None, "--raw-code", "-c", help="Raw code to edit. Overrides filenames")
31+
raw_code: str = typer.Option(None, "--raw-code", "-c", help="Raw code to edit. Overrides filenames"),
32+
json_out: bool = typer.Option(False, "--json-out", "-j", help="Output to raw json."),
3233
):
3334
"""
3435
Do something given some code for context. Asking for documents, queries, etc. should work okay. Edits are iffy, but work a lot of the time.
@@ -43,6 +44,10 @@ def edit_file(
4344
raise typer.BadParameter("Either FILENAMES or --raw-code (-c) must be provided.")
4445
code = {"code": raw_code} if raw_code else files.load_text(filenames)
4546
result = gpt.send_iffy_edit(instruction, code, yes=yes, clipboard=bool(raw_code))
47+
48+
if json_out:
49+
return json.dumps(result, sort_keys=True, indent=4)
50+
4651
files.write_text(result, backup)
4752
typer.secho("Done!", color=typer.colors.BRIGHT_BLUE)
4853

@@ -56,7 +61,7 @@ def quick_edit_file(
5661
),
5762
yes: bool = typer.Option(False, "--yes", "-y", help="Don't ask for confirmation.",),
5863
raw_code: str = typer.Option(None, "--raw-code", "-c", help="Raw code to edit. Overrides filenames"),
59-
json: bool = typer.Option(False, "--json", "-j", help="Output in JSON format"),
64+
json_out: bool = typer.Option(False, "--json", "-j", help="Output in JSON format"),
6065
):
6166
"""
6267
Edit a file using codegpt's built in prompts.
@@ -78,7 +83,7 @@ def quick_edit_file(
7883
code = {"code": raw_code} if raw_code else files.load_text(filenames)
7984
result = gpt.send_iffy_edit(prompts.prompts[option], code, yes=yes, clipboard=bool(raw_code))
8085

81-
if json:
86+
if json_out:
8287
return json.dumps(result, sort_keys=True, indent=4)
8388

8489
files.write_text(result, backup)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "codegpt"
3-
version = "0.2.8"
3+
version = "0.2.10"
44
license = "GPL-3.0-or-later"
55
description = "A CLI tool for refactoring code using OpenAI's models"
66
authors = ["John Partee"]

0 commit comments

Comments
 (0)