-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
179 lines (179 loc) · 5.62 KB
/
index.html
File metadata and controls
179 lines (179 loc) · 5.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>codemancer: Code with GPT-4 from your command line</title>
<link
href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap"
rel="stylesheet"
/>
<style>
body {
font-family: "Roboto", sans-serif;
background-color: #2c2c2c;
color: #ffffff;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 2rem;
}
h1 {
font-size: 2.5rem;
color: #bc71c9;
margin-bottom: 1rem;
}
h2 {
font-size: 1.5rem;
color: #bc71c9;
margin-bottom: 1rem;
}
p {
font-size: 1rem;
line-height: 1.5;
margin-bottom: 1rem;
}
a {
color: #bc71c9;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
pre {
background-color: #424242;
padding: 1rem;
overflow-x: auto;
white-space: pre-wrap;
word-wrap: break-word;
}
img {
max-width: 100%;
height: auto;
}
.logo {
font-size: 3rem;
margin-bottom: 1rem;
display: inline-block;
margin-right: 1.5rem;
}
.github-star {
display: inline-block;
vertical-align: text-bottom;
}
.footer {
text-align: center;
margin-top: 2rem;
}
.alert {
padding: 1rem;
background: rgba(255, 255, 0, 0.1);
}
</style>
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<body>
<div class="container">
<div class="logo">🧙♂️ codemancer</div>
<div class="github-star">
<a
class="github-button"
href="https://github.com/0xmmo/codemancer"
data-size="large"
data-show-count="true"
aria-label="Star 0xmmo/codemancer on GitHub"
>Star</a
>
</div>
<h1>Code with GPT-4 from your command line</h1>
<p>
<code>codemancer</code> is a command line tool that uses the OpenAI API
to generate code based on a given prompt and input file. It can change
code in-place or create brand new files.
</p>
<p>
You can use it as a versatile and efficient AI-powered programming
assistant that simplifies code generation, streamlines development
tasks, and boosts productivity.
</p>
<p class="alert">
💫 You can now try <code>codemancer</code> with our own (free but
rate-limited) OpenAI proxy, with GPT-4 enabled.
</p>
<video width="100%" autoplay controls>
<source
src="https://user-images.githubusercontent.com/1714782/227892213-8cfdcbdb-3dae-4043-b155-9164e1104bc1.mp4"
type="video/mp4"
/>
<img
src="https://user-images.githubusercontent.com/1714782/227892213-8cfdcbdb-3dae-4043-b155-9164e1104bc1.mp4"
alt="codemancer demo"
title="Your browser does not support HTML video."
/>
</video>
<h2>Installation</h2>
<pre>npm install -g codemancer</pre>
<h2>Usage</h2>
<p>
To use <code>codemancer</code> with
<a href="https://platform.openai.com/account/api-keys"
>your own OpenAI API key</a
>, you need to set the <code>OPENAI_API_KEY</code> environment variable.
</p>
<pre>export OPENAI_API_KEY=your_api_key_here</pre>
<p>
<code>codemancer</code> works best using GPT-4, and will use it by
default. If you do not have access and receive a 404, you can use the
GPT-3.5 model instead via <code>-m "gpt-3.5-turbo"</code>, but code
generations will be much less reliable.
</p>
<h3>Reading and writing to the same file</h3>
<pre>
codemancer -i input_file_path -p "break the /recipe/<id> route into /recipe/<id>/info and /recipe/<id>/image"</pre
>
<h3>Reading and writing to a different file</h3>
<pre>
codemancer -i input_file_path -o output_file_path -p "extract inlined types into interfaces in a separate file"</pre
>
<h3>Writing from prompt to file</h3>
<pre>
codemancer -o output_file_path -p "I need an AppleScript to wipe Safari history on restart"</pre
>
<h3>Simple prompting</h3>
<pre>
codemancer -p "what's a bulletproof regex for validating emails"</pre
>
<h3>Customizing model and temperature</h3>
<pre>
codemancer -i input_file_path -m gpt-3.5-turbo -t 0.5 -p "change all variable names to obscure animals"</pre
>
<h2>Limitations</h2>
<ul>
<li>
If there are multiple code blocks returned in the completion,
codemancer will present a confirmation message for each and write only
the accepted one. If the verbosity argument is set to 0, it will
auto-confirm and write the first code block it encounters to the
output file.
</li>
<li>
The file content + prompt are currently limited to 8K tokens for
GPT-4. If your file is too large/dense and you exceed this limit you
will get a 400 error.
</li>
</ul>
<h2>License</h2>
<p>
GPL License - This code was largely written by AI with some human
guidance.
</p>
<hr />
<div class="footer">
<p>Made with 🧙♂️ by <a href="https://github.com/0xmmo/">@0xmmo</a></p>
</div>
</div>
</body>
</html>