You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.8 KiB
72 lines
1.8 KiB
#!/bin/bash |
|
# Generate interface summaries for all modules in src/ |
|
# Creates temporary markdown files alongside source files for quick reference |
|
|
|
set -e |
|
|
|
SRC_DIR="/home/agent/dev/claudes_game/src" |
|
TEMP_EXT=".summary.md" |
|
PROMPT_FILE="scripts/prompt.md" |
|
|
|
# Function to generate prompt for a specific module |
|
generate_prompt() { |
|
local module_name="$1" |
|
sed "s|\${module_name}|$module_name|g" "$PROMPT_FILE" | sed "s|\${SRC_DIR}|$SRC_DIR|g" |
|
} |
|
|
|
# Function to process a single module |
|
process_module() { |
|
local module_name="$1" |
|
local header_file="${SRC_DIR}/${module_name}.h" |
|
local output_file="${SRC_DIR}/${module_name}${TEMP_EXT}" |
|
|
|
if [ ! -f "$header_file" ]; then |
|
echo "Warning: No header file found for ${module_name}, skipping" |
|
return |
|
fi |
|
|
|
echo "----------" |
|
echo "Processing ${module_name}..." |
|
|
|
# Build command as array |
|
CMD=() |
|
CMD+=("pi" "--print" "--no-session" "--provider" "llama.cpp" "--model" "Qwen3.6-35B") |
|
CMD+=("$(generate_prompt "$module_name")") |
|
|
|
#echo "CMD would execute: ${CMD[*]}" |
|
"${CMD[@]}" |
|
echo "Generated: ${output_file}" |
|
} |
|
|
|
# List of modules to process (based on src/ directory) |
|
# Modules to exclude from processing |
|
EXCLUDED=("renderer" "ui_renderer" "config_validator") |
|
|
|
# Filter function |
|
is_excluded() { |
|
local mod="$1" |
|
for exc in "${EXCLUDED[@]}"; do |
|
[[ "$mod" == "$exc" ]] && return 0 |
|
done |
|
return 1 |
|
} |
|
|
|
# Build filtered list |
|
MODULES=() |
|
for h in src/*.h; do |
|
mod=$(basename "$h" .h) |
|
is_excluded "$mod" || MODULES+=("$mod") |
|
done |
|
|
|
echo "=== Interface Summary Generator ===" |
|
echo "Processing ${#MODULES[@]} modules..." |
|
echo "" |
|
|
|
for module in "${MODULES[@]}"; do |
|
process_module "$module" |
|
done |
|
|
|
echo "" |
|
echo "=== Complete ===" |
|
echo "Generated ${TEMP_EXT} files alongside source files in ${SRC_DIR}" |
|
echo "These files are temporary and should be added to .gitignore"
|
|
|