@@ -29,7 +29,14 @@ You can either use the scripts directly from this folder or add them to your PAT
29
29
Generates contextual information from a codebase to send to an LLM.
30
30
31
31
``` bash
32
- ./context --files=" src/components/*.js" --exclude=" *.test.js" --max-size=300KB --depth=2 --include-git > context.txt
32
+ # Using file patterns
33
+ ./context --include=" src/*.js" --exclude=" *.test.js" > context.md
34
+
35
+ # Using direct patterns as arguments
36
+ ./context " src/*.js" " README.md" > context.md
37
+
38
+ # Including git information
39
+ ./context --include=" src/*.js" --git > context.md
33
40
```
34
41
35
42
[ See full documentation for context] ( ./docs/context.md )
@@ -49,7 +56,7 @@ cat llm_response.md | ./apply-md --dry-run --verbose
49
56
Generates git-related context to help LLMs create meaningful commit messages.
50
57
51
58
``` bash
52
- ./git-context --diff -- recent-commits=2 --prompt --conventional > commit_context.txt
59
+ ./git-context --recent-commits=5 --prompt=prompts/conventional_commit.txt > commit_context.txt
53
60
```
54
61
55
62
[ See full documentation for git-context] ( ./docs/git-context.md )
@@ -62,7 +69,7 @@ These tools are designed to work seamlessly in Unix pipelines, allowing you to c
62
69
63
70
``` bash
64
71
# Copy code context directly to clipboard (macOS)
65
- ./context --files =" src/api/*.js" | pbcopy
72
+ ./context --include =" src/api/*.js" | pbcopy
66
73
67
74
# Generate and apply code changes directly from clipboard (macOS)
68
75
pbpaste | ./apply-md
@@ -71,7 +78,7 @@ pbpaste | ./apply-md
71
78
git commit -am " $( ./git-context | llm -m openrouter/anthropic/claude-3.5-haiku) " -e
72
79
73
80
# Stream context to an LLM and apply changes in one command
74
- ./context --files =" src/components/Button.js" | llm " Refactor this component to use hooks" | ./apply-md
81
+ ./context --include =" src/components/Button.js" | llm " Refactor this component to use hooks" | ./apply-md
75
82
```
76
83
77
84
### Scenario: Bug Fix Workflow
@@ -81,7 +88,7 @@ Let's walk through a complete workflow for fixing a bug:
81
88
1 . Identify the files involved in the bug:
82
89
``` bash
83
90
# Generate context for the relevant files
84
- ./context --files =" src/utils/validation.js" --files =" src/components/Form.js" --depth=1 | pbcopy
91
+ ./context --include =" src/utils/validation.js" --include =" src/components/Form.js" | pbcopy
85
92
```
86
93
87
94
2 . Paste the context into your preferred AI assistant's web UI with your request:
@@ -96,7 +103,7 @@ Let's walk through a complete workflow for fixing a bug:
96
103
4 . Generate an appropriate commit message:
97
104
``` bash
98
105
# Auto-generate semantically meaningful commit message
99
- ./git-context --diff | llm " Generate a conventional commit message" | git commit -F -
106
+ ./git-context | llm " Generate a conventional commit message" | git commit -F -
100
107
101
108
# Or with manual editing
102
109
git commit -am " $( ./git-context | llm " Write a commit message" ) " -e
@@ -108,7 +115,7 @@ When working on larger refactoring tasks:
108
115
109
116
1 . Generate context with git history for better understanding:
110
117
``` bash
111
- ./context --files =" src/utils/parser.js" --depth=1 --include- git --git-depth=5 > parser_context.txt
118
+ ./context --include =" src/utils/parser.js" --git > parser_context.txt
112
119
```
113
120
114
121
2 . Send the context to an LLM with your request (e.g., "Refactor this parser to improve performance")
@@ -122,7 +129,7 @@ When working on larger refactoring tasks:
122
129
123
130
4 . Generate commit context and message in one step:
124
131
``` bash
125
- git commit -am " $( ./git-context --diff --conventional | llm " Generate a detailed commit message" ) " -e
132
+ git commit -am " $( ./git-context --prompt=prompts/conventional_commit.txt | llm " Generate a detailed commit message" ) " -e
126
133
```
127
134
128
135
## Customization
@@ -138,7 +145,7 @@ You can create your own prompt templates for different scenarios:
138
145
echo " Please review this code and identify potential bugs and security issues." > prompts/review_prompt.txt
139
146
140
147
# Use your custom prompt with the context generator
141
- ./context --files =" src/*.js" | cat - prompts/review_prompt.txt | llm
148
+ ./context --include =" src/*.js" | cat - prompts/review_prompt.txt | llm
142
149
```
143
150
144
151
### Integration with Other Tools
0 commit comments