Skip to content

Commit 2208251

Browse files
authored
Update README.md
1 parent d34e4be commit 2208251

File tree

1 file changed

+46
-38
lines changed

1 file changed

+46
-38
lines changed

README.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
1-
<h1>Code2prompt</h1>
2-
3-
Convert your codebase into a single LLM prompt !
1+
<div align="center">
2+
<a href="https://code2prompt.dev">
3+
<img align="center" width="550px" src=".assets/logo_dark_v0.0.2.svg" alt="Code2prompt"/>
4+
</a>
5+
<p align="center">
6+
<b>Convert your codebase into a single LLM prompt !</b>
7+
</p>
8+
</div>
49

510
<h1 align="center">
6-
<a href="https://github.com/mufeedvh/code2prompt"><img src=".assets/code2prompt-screenshot.png" alt="code2prompt"></a>
11+
<a href="https://code2prompt.dev"><img src=".assets/CLI.png" alt="code2prompt"></a>
712
</h1>
813

914
<hr />
1015

16+
[![crates.io](https://img.shields.io/crates/v/code2prompt.svg)](https://crates.io/crates/code2prompt)
17+
[![LICENSE](https://img.shields.io/github/license/mufeedvh/code2prompt.svg#cache1)](https://github.com/mufeedvh/code2prompt/blob/master/LICENSE)
18+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/user/repo/pulls)
19+
[![Lines of Code](https://tokei.rs/b1/github/mufeedvh/code2prompt)](https://github.com/mufeedvh/code2prompt)
20+
[![Discord](https://img.shields.io/discord/1342336677905039451?logo=discord)](https://discord.com/invite/zxVMKtsFbK)
21+
22+
<hr />
23+
1124
<p align="center">
1225
Want to engage with us ? Join our <a href="https://discord.com/invite/zxVMKtsFbK">Discord</a> channel!<br>
1326
<i>Stay updated on new features</i> 📢<br>
@@ -16,15 +29,25 @@ Convert your codebase into a single LLM prompt !
1629
<i>Report Bug</i> 🐛<br>
1730
</p>
1831

19-
<hr />
2032

21-
[![crates.io](https://img.shields.io/crates/v/code2prompt.svg)](https://crates.io/crates/code2prompt)
22-
[![LICENSE](https://img.shields.io/github/license/mufeedvh/code2prompt.svg#cache1)](https://github.com/mufeedvh/code2prompt/blob/master/LICENSE)
23-
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/user/repo/pulls)
24-
[![Lines of Code](https://tokei.rs/b1/github/mufeedvh/code2prompt)](https://github.com/mufeedvh/code2prompt)
25-
[![Discord](https://img.shields.io/discord/1342336677905039451?logo=discord)](https://discord.com/invite/zxVMKtsFbK)
33+
## Quick Install
2634

27-
<hr />
35+
With cargo:
36+
37+
```bash
38+
cargo install code2prompt
39+
```
40+
<!--
41+
With python:
42+
43+
```bash
44+
pip install code2prompt-rs
45+
```
46+
!-->
47+
48+
## How is it useful?
49+
50+
`code2prompt` makes it easy to generate prompts for LLMs from your codebase. It traverses the directory, builds a tree structure, and collects information about each file. You can customize the prompt generation using Handlebars templates. The generated prompt is automatically copied to your clipboard and can also be saved to an output file. `code2prompt` helps streamline the process of creating LLM prompts for code analysis, generation, and other tasks.
2851

2952
## Documentation 📚
3053

@@ -111,7 +134,7 @@ nix-env -iA nixpkgs.code2prompt
111134
nix profile install nixpkgs#code2prompt
112135
```
113136

114-
## Usage
137+
## Usages
115138

116139
Generate a prompt from a codebase directory:
117140

@@ -122,7 +145,7 @@ code2prompt path/to/codebase
122145
Use a custom Handlebars template file:
123146

124147
```sh
125-
code2prompt path/to/codebase -t path/to/template.hbs
148+
code2prompt path/to/codebase --template path/to/template.hbs
126149
```
127150

128151
Filter files using glob patterns:
@@ -137,12 +160,6 @@ Exclude files using glob patterns:
137160
code2prompt path/to/codebase --exclude="*.txt,*.md"
138161
```
139162

140-
Exclude files/folders from the source tree based on exclude patterns:
141-
142-
```sh
143-
code2prompt path/to/codebase --exclude="*.npy,*.wav" --exclude-from-tree
144-
```
145-
146163
Display the token count of the generated prompt:
147164

148165
```sh
@@ -168,7 +185,7 @@ code2prompt path/to/codebase --output-file=output.txt
168185
Print output as JSON:
169186

170187
```sh
171-
code2prompt path/to/codebase --json
188+
code2prompt path/to/codebase -O json
172189
```
173190

174191
The JSON output will have the following structure:
@@ -186,13 +203,13 @@ The JSON output will have the following structure:
186203
Generate a Git commit message (for staged files):
187204

188205
```sh
189-
code2prompt path/to/codebase --diff -t templates/write-git-commit.hbs
206+
code2prompt path/to/codebase --diff --template templates/write-git-commit.hbs
190207
```
191208

192209
Generate a Pull Request with branch comparing (for staged files):
193210

194211
```sh
195-
code2prompt path/to/codebase --git-diff-branch 'main, development' --git-log-branch 'main, development' -t templates/write-github-pull-request.hbs
212+
code2prompt path/to/codebase --git-diff-branch 'main, development' --git-log-branch 'main, development' --template templates/write-github-pull-request.hbs
196213
```
197214

198215
Add line numbers to source code blocks:
@@ -219,13 +236,6 @@ Skip .gitignore rules:
219236
code2prompt path/to/codebase --no-ignore
220237
```
221238

222-
- Rewrite the code to another language.
223-
- Find bugs/security vulnerabilities.
224-
- Document the code.
225-
- Implement new features.
226-
227-
> I initially wrote this for personal use to utilize Claude 3.0's 200K context window and it has proven to be pretty useful so I decided to open-source it!
228-
229239
## Templates
230240

231241
`code2prompt` comes with a set of built-in templates for common use cases. You can find them in the [`templates`](templates) directory.
@@ -312,9 +322,14 @@ print(result["prompt"])
312322

313323
[![Star History Chart](https://api.star-history.com/svg?repos=mufeedvh/code2prompt&type=Date)](https://star-history.com/#mufeedvh/code2prompt&Date)
314324

315-
## How is it useful?
316325

317-
`code2prompt` makes it easy to generate prompts for LLMs from your codebase. It traverses the directory, builds a tree structure, and collects information about each file. You can customize the prompt generation using Handlebars templates. The generated prompt is automatically copied to your clipboard and can also be saved to an output file. `code2prompt` helps streamline the process of creating LLM prompts for code analysis, generation, and other tasks.
326+
## License
327+
328+
Licensed under the MIT License, see <a href="https://github.com/mufeedvh/code2prompt/blob/master/LICENSE">LICENSE</a> for more information.
329+
330+
## Liked the project?
331+
332+
If you liked the project and found it useful, please give it a :star: !
318333

319334
## Contribution
320335

@@ -326,10 +341,3 @@ Ways to contribute:
326341
- Help me document the code
327342
- Spread the word
328343

329-
## License
330-
331-
Licensed under the MIT License, see <a href="https://github.com/mufeedvh/code2prompt/blob/master/LICENSE">LICENSE</a> for more information.
332-
333-
## Liked the project?
334-
335-
If you liked the project and found it useful, please give it a :star: !

0 commit comments

Comments
 (0)