botserver/add-req.sh

90 lines
1.9 KiB
Bash
Raw Normal View History

2025-10-11 12:29:03 -03:00
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2025-10-13 17:43:03 -03:00
PROJECT_ROOT="$SCRIPT_DIR"
2025-10-18 12:01:39 -03:00
OUTPUT_FILE="/tmp/prompt.out"
2025-10-11 12:29:03 -03:00
echo "Consolidated LLM Context" > "$OUTPUT_FILE"
prompts=(
2025-10-18 19:08:00 -03:00
"./prompts/dev/platform/shared.md"
"./prompts/dev/platform/cli.md"
"./prompts/dev/platform/ide.md"
2025-10-13 17:43:03 -03:00
"./Cargo.toml"
2025-10-11 12:29:03 -03:00
)
for file in "${prompts[@]}"; do
if [ -f "$file" ]; then
cat "$file" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
fi
2025-10-11 12:29:03 -03:00
done
dirs=(
"auth"
2025-11-20 13:28:35 -03:00
#"automation"
#"basic"
#"bootstrap"
"bot"
#"channels"
2025-11-20 13:28:35 -03:00
#"config"
#"context"
2025-11-20 13:28:35 -03:00
#"drive_monitor"
"email"
"file"
#"kb"
"llm"
#"llm_models"
2025-11-20 13:28:35 -03:00
"meet"
#"org"
#"package_manager"
#"riot_compiler"
"session"
"shared"
#"tests"
#"tools"
#"ui"
2025-11-20 13:28:35 -03:00
#"ui_tree"
#"web_server"
#"web_automation"
)
2025-10-11 12:29:03 -03:00
for dir in "${dirs[@]}"; do
find "$PROJECT_ROOT/src/$dir" -name "*.rs" | while read -r file; do
echo "$file" >> "$OUTPUT_FILE"
2025-11-20 13:28:35 -03:00
cat "$file" >> "$OUTPUT_FILE"
2025-10-11 12:29:03 -03:00
done
done
# Additional specific files
files=(
"$PROJECT_ROOT/src/main.rs"
2025-10-18 19:08:00 -03:00
#"$PROJECT_ROOT/src/basic/keywords/mod.rs"
)
for file in "${files[@]}"; do
echo "$file" >> "$OUTPUT_FILE"
cat "$file" >> "$OUTPUT_FILE"
done
2025-10-12 11:44:35 -03:00
# Remove all blank lines and reduce whitespace greater than 1 space
sed -i 's/[[:space:]]*$//' "$OUTPUT_FILE"
sed -i '/^$/d' "$OUTPUT_FILE"
sed -i 's/ \+/ /g' "$OUTPUT_FILE"
# Calculate and display token count (approximation: words * 1.3)
WORD_COUNT=$(wc -w < "$OUTPUT_FILE")
TOKEN_COUNT=$(echo "$WORD_COUNT * 1.3 / 1" | bc)
FILE_SIZE=$(wc -c < "$OUTPUT_FILE")
2025-10-11 12:29:03 -03:00
echo "" >> "$OUTPUT_FILE"
echo "Approximate token count: $TOKEN_COUNT"
echo "Context size: $FILE_SIZE bytes"
cat "$OUTPUT_FILE" | xclip -selection clipboard
echo "Content copied to clipboard (xclip)"
2025-10-18 12:01:39 -03:00
rm -f "$OUTPUT_FILE"