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-14 13:51:27 -03:00
|
|
|
|
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"
|
2025-11-04 10:20:48 -03:00
|
|
|
"./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
|
2025-10-14 13:51:27 -03:00
|
|
|
if [ -f "$file" ]; then
|
|
|
|
|
cat "$file" >> "$OUTPUT_FILE"
|
|
|
|
|
echo "" >> "$OUTPUT_FILE"
|
|
|
|
|
fi
|
2025-10-11 12:29:03 -03:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
dirs=(
|
2025-11-05 22:48:55 -03:00
|
|
|
"auth"
|
|
|
|
|
"automation"
|
2025-11-05 21:10:03 -03:00
|
|
|
"basic"
|
2025-11-05 22:48:55 -03:00
|
|
|
"bootstrap"
|
2025-11-04 23:11:33 -03:00
|
|
|
"bot"
|
2025-11-05 22:48:55 -03:00
|
|
|
"channels"
|
2025-11-05 21:10:03 -03:00
|
|
|
"config"
|
|
|
|
|
"context"
|
|
|
|
|
"drive_monitor"
|
2025-11-05 22:48:55 -03:00
|
|
|
"email"
|
|
|
|
|
"file"
|
2025-11-04 23:11:33 -03:00
|
|
|
# "kb"
|
2025-11-05 22:48:55 -03:00
|
|
|
"llm"
|
|
|
|
|
"llm_models"
|
|
|
|
|
"org"
|
|
|
|
|
"package"
|
|
|
|
|
"package_manager"
|
|
|
|
|
"riot_compiler"
|
2025-11-04 23:11:33 -03:00
|
|
|
"session"
|
|
|
|
|
"shared"
|
2025-11-05 22:48:55 -03:00
|
|
|
"tests"
|
|
|
|
|
"tools"
|
|
|
|
|
"ui"
|
|
|
|
|
"web_server"
|
|
|
|
|
"web_automation"
|
|
|
|
|
)
|
2025-10-14 13:51:27 -03:00
|
|
|
|
|
|
|
|
filter_rust_file() {
|
|
|
|
|
sed -E '/^\s*\/\//d' "$1" | \
|
|
|
|
|
sed -E '/info!\s*\(/d' | \
|
|
|
|
|
sed -E '/debug!\s*\(/d' | \
|
|
|
|
|
sed -E '/trace!\s*\(/d'
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-11 12:29:03 -03:00
|
|
|
for dir in "${dirs[@]}"; do
|
2025-10-14 13:51:27 -03:00
|
|
|
find "$PROJECT_ROOT/src/$dir" -name "*.rs" | while read -r file; do
|
|
|
|
|
echo "$file" >> "$OUTPUT_FILE"
|
|
|
|
|
filter_rust_file "$file" >> "$OUTPUT_FILE"
|
2025-10-11 12:29:03 -03:00
|
|
|
echo "" >> "$OUTPUT_FILE"
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
|
2025-10-14 13:51:27 -03:00
|
|
|
# Additional specific files
|
|
|
|
|
files=(
|
|
|
|
|
"$PROJECT_ROOT/src/main.rs"
|
2025-10-18 19:08:00 -03:00
|
|
|
#"$PROJECT_ROOT/src/basic/keywords/mod.rs"
|
2025-10-17 20:32:25 -03:00
|
|
|
|
2025-10-14 13:51:27 -03:00
|
|
|
)
|
2025-10-13 09:36:06 -03:00
|
|
|
|
2025-10-14 13:51:27 -03:00
|
|
|
for file in "${files[@]}"; do
|
|
|
|
|
if [[ "$file" == *.rs ]]; then
|
|
|
|
|
echo "$file" >> "$OUTPUT_FILE"
|
|
|
|
|
filter_rust_file "$file" >> "$OUTPUT_FILE"
|
|
|
|
|
else
|
|
|
|
|
echo "$file" >> "$OUTPUT_FILE"
|
|
|
|
|
cat "$file" >> "$OUTPUT_FILE"
|
|
|
|
|
fi
|
|
|
|
|
done
|
2025-10-12 11:44:35 -03:00
|
|
|
|
2025-10-14 13:51:27 -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"
|
|
|
|
|
|
2025-10-14 13:51:27 -03:00
|
|
|
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"
|