You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+170-2
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,12 @@ A CLI tool to aggregate your codebase into a single Markdown file for use with C
8
8
- Ignores common build artifacts and configuration files
9
9
- Outputs a single Markdown file containing the whole codebase
10
10
- Provides options for whitespace removal and custom ignore patterns
11
+
- Can be used programmatically as a library in Node.js projects
11
12
12
13
## How to Use
13
14
15
+
### CLI Usage
16
+
14
17
Start by running the CLI tool in your project directory:
15
18
16
19
```bash
@@ -22,17 +25,181 @@ This will generate a `codebase.md` file with your codebase.
22
25
Once you've generated the Markdown file containing your codebase, you can use it with AI models like ChatGPT and Claude for code analysis and assistance.
23
26
24
27
### With ChatGPT:
28
+
25
29
1. Create a Custom GPT
26
30
2. Upload the generated Markdown file to the GPT's knowledge base
27
31
28
32
### With Claude:
33
+
29
34
1. Create a new Project
30
35
2. Add the Markdown file to the Project's knowledge
31
36
32
37
For best results, re-upload the Markdown file before starting a new chat session to ensure the AI has the most up-to-date version of your codebase.
33
38
39
+
### Library Usage
40
+
41
+
You can also use ai-digest programmatically in your Node.js applications:
42
+
43
+
```javascript
44
+
// ESM
45
+
importaiDigestfrom"ai-digest";
46
+
47
+
// CommonJS
48
+
constaiDigest=require("ai-digest").default;
49
+
50
+
// Generate digest and save to file
51
+
awaitaiDigest.generateDigest({
52
+
inputDir:"./my-project",
53
+
outputFile:"my-digest.md",
54
+
removeWhitespaceFlag:true,
55
+
});
56
+
57
+
// Generate digest and get content as string
58
+
constcontent=awaitaiDigest.generateDigest({
59
+
inputDir:"./my-project",
60
+
outputFile:null, // Return content as string instead of writing to file
61
+
silent:true, // Suppress console output
62
+
});
63
+
```
64
+
65
+
For more advanced use cases, you can access the lower-level functions:
@@ -43,6 +210,8 @@ For best results, re-upload the Markdown file before starting a new chat session
43
210
44
211
## Examples
45
212
213
+
### CLI Examples
214
+
46
215
1. Basic usage:
47
216
48
217
```bash
@@ -79,7 +248,6 @@ ai-digest supports custom ignore patterns using a `.aidigestignore` file in the
79
248
80
249
Use the `--show-output-files` flag to see which files are being included, making it easier to identify candidates for exclusion.
81
250
82
-
83
251
## Whitespace Removal
84
252
85
253
When using the `--whitespace-removal` flag, ai-digest removes excess whitespace from files to reduce the token count when used with AI models. This feature is disabled for whitespace-dependent languages like Python and YAML.
@@ -108,4 +276,4 @@ Contributions are welcome! Please feel free to submit a Pull Request.
0 commit comments