Skip to content

Commit 93bcd0b

Browse files
committed
Add context prompt options to script with new flags
- Introduce `--prompt` flag to specify custom context prompt file - Add `--no-prompt` flag to disable context prompt inclusion - Update help text to document new command-line options - Implement prompt file loading and error handling - Default prompt file is now `prompts/context_prompt.txt`
1 parent d04ce9e commit 93bcd0b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

context

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ MAX_SIZE="500KB"
1313
INCLUDE_GIT=false
1414
SHOW_FILE_SIZES=false
1515
SHOW_LS_FILES=true
16+
PROMPT_FILE="$SCRIPT_DIR/prompts/context_prompt.txt"
17+
INCLUDE_PROMPT=true
1618

1719
# Parse arguments
1820
while [[ "$#" -gt 0 ]]; do
@@ -23,6 +25,8 @@ while [[ "$#" -gt 0 ]]; do
2325
--git) INCLUDE_GIT=true; shift ;;
2426
--show-sizes) SHOW_FILE_SIZES=true; shift ;;
2527
--no-ls-files) SHOW_LS_FILES=false; shift ;;
28+
--prompt=*) PROMPT_FILE="${1#*=}"; shift ;;
29+
--no-prompt) INCLUDE_PROMPT=false; shift ;;
2630
--help|-h)
2731
echo "Usage: context [options] [include-pattern1 include-pattern2 ...]"
2832
echo ""
@@ -33,6 +37,8 @@ while [[ "$#" -gt 0 ]]; do
3337
echo " --git Include basic git information (recent commits, branch)"
3438
echo " --show-sizes Include file sizes in output"
3539
echo " --no-ls-files Don't include git ls-files output in repository map"
40+
echo " --prompt=<file> Use custom context prompt from file (default: prompts/context_prompt.txt)"
41+
echo " --no-prompt Don't include context prompt"
3642
echo " --help, -h Show this help message"
3743
echo ""
3844
echo "Pattern matching:"
@@ -175,4 +181,19 @@ for file in $ALL_FILES; do
175181
echo ""
176182
done
177183

184+
# Include context prompt if requested
185+
if [ "$INCLUDE_PROMPT" = true ]; then
186+
echo "## Context Prompt"
187+
echo ""
188+
189+
# Check if prompt file exists
190+
if [ -f "$PROMPT_FILE" ]; then
191+
cat "$PROMPT_FILE"
192+
else
193+
echo "Error: Prompt file not found: $PROMPT_FILE" >&2
194+
exit 1
195+
fi
196+
echo ""
197+
fi
198+
178199
exit 0

0 commit comments

Comments
 (0)