botserver/add-req.sh
Rodrigo Rodriguez (Pragmatismo) fd45f4e0dd refactor: simplify UI panels, use pooled DB, add --noui flag
- Removed unused `id` and `app_state` fields from `ChatPanel`; updated constructor to accept but ignore the state, reducing memory footprint.
- Switched database access in `ChatPanel` from a raw `Mutex` lock to a connection pool (`app_state.conn.get()`), improving concurrency and error handling.
- Reordered and cleaned up imports in `status_panel.rs` and formatted struct fields for readability.
- Updated VS Code launch configuration to pass `--noui` argument, enabling headless mode for debugging.
- Bumped several crate versions in `Cargo.lock` (e.g., `bitflags` to 2.10.0, `syn` to 2.0.108, `cookie` to 0.16.2) and added the new `ashpd` dependency, aligning the project with latest library releases.
2025-11-11 09:42:52 -03:00

94 lines
2 KiB
Bash
Executable file

#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$SCRIPT_DIR"
OUTPUT_FILE="/tmp/prompt.out"
echo "Consolidated LLM Context" > "$OUTPUT_FILE"
prompts=(
"./prompts/dev/platform/shared.md"
"./prompts/dev/platform/cli.md"
"./prompts/dev/platform/ide.md"
"./Cargo.toml"
)
for file in "${prompts[@]}"; do
if [ -f "$file" ]; then
cat "$file" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
fi
done
dirs=(
"auth"
"automation"
"basic"
"bootstrap"
"bot"
#"channels"
"config"
#"context"
"drive_monitor"
#"email"
#"file"
#"kb"
"llm"
#"llm_models"
#"org"
#"package_manager"
#"riot_compiler"
"session"
"shared"
#"tests"
#"tools"
#"ui"
"ui_tree"
#"web_server"
#"web_automation"
)
for dir in "${dirs[@]}"; do
find "$PROJECT_ROOT/src/$dir" -name "*.rs" | while read -r file; do
echo "$file" >> "$OUTPUT_FILE"
filter_rust_file "$file" >> "$OUTPUT_FILE"
echo "" >> "$OUTPUT_FILE"
done
done
# Additional specific files
files=(
"$PROJECT_ROOT/src/main.rs"
#"$PROJECT_ROOT/src/basic/keywords/mod.rs"
)
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
# 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")
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)"
rm -f "$OUTPUT_FILE"