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.
78 lines
2.3 KiB
78 lines
2.3 KiB
#!/bin/bash |
|
# Generate interface summaries for all modules in src/ |
|
# Creates temporary markdown files alongside source files for quick reference |
|
|
|
set -e |
|
|
|
PROVIDER="llama.cpp" |
|
MODEL="Qwen3.5-35B" |
|
SRC_DIR="/home/agent/dev/claudes_game/src" |
|
TEMP_EXT=".interface.md" |
|
TMP_PROMPT=$(mktemp) |
|
|
|
# Cleanup on exit |
|
trap "rm -f $TMP_PROMPT" EXIT |
|
|
|
# Function to generate prompt for a specific module |
|
generate_prompt() { |
|
local module_name="$1" |
|
cat <<EOF |
|
Analyze the ${module_name} module in the orbital mechanics simulation project. |
|
Create a concise summary of all interface elements (functions, structs, enums, constants) |
|
that would be useful for a new agent session to quickly understand the module's API. |
|
|
|
Format as markdown with: |
|
- Brief one-line description of the module |
|
- Sections for structs, enums, functions (grouped by purpose if possible) |
|
- For each item: name, brief purpose, key parameters/fields |
|
- Keep it short - this is a quick reference, not documentation |
|
|
|
Focus on public interfaces, not implementation details. |
|
EOF |
|
} |
|
|
|
# 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 "Processing ${module_name}..." |
|
|
|
# Generate prompt to temp file |
|
generate_prompt "$module_name" > "$TMP_PROMPT" |
|
echo $TMP_PROMPT |
|
|
|
# pi --print --no-session --provider llama.cpp --model \ |
|
# "Qwen3.5-35B" "print a hello world application in rust" |
|
# |
|
# Use pi -p with the prompt as file argument |
|
#pi -p "$TMP_PROMPT" "$header_file" > "$output_file" 2>&1 || { |
|
# echo "Error processing ${module_name}" |
|
# cat "$output_file" |
|
# return 1 |
|
#} |
|
|
|
echo "Generated: ${output_file}" |
|
} |
|
|
|
# List of modules to process (based on src/ directory) |
|
MODULES=( $(ls src/*.h | grep -oP '[^/]+(?=\.h)') ) |
|
|
|
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"
|
|
|