-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadd_makefiles_fixed.sh
More file actions
executable file
·98 lines (84 loc) · 2.59 KB
/
Copy pathadd_makefiles_fixed.sh
File metadata and controls
executable file
·98 lines (84 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
#
# add_makefiles_fixed.sh - Add Makefile to modules missing one (robust version)
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TEMPLATE_FILE="${SCRIPT_DIR}/templates/Makefile"
if [[ ! -f "$TEMPLATE_FILE" ]]; then
echo "Error: Makefile template not found at $TEMPLATE_FILE" >&2
exit 1
fi
# List of modules (excluding HelixMemory and HelixSpecifier)
MODULES=(
"EventBus"
"Concurrency"
"Observability"
"Auth"
"Storage"
"Streaming"
# Security removed — canonical at meta-repo root security/ (P1.5-T03.03)
"VectorDB"
"Embeddings"
"Database"
"Cache"
"Messaging"
"Formatters"
"MCP_Module"
"RAG"
"Memory"
"Optimization"
"Plugins"
# Containers removed — canonical at meta-repo root containers/ (P1.5-T03.02)
"Challenges"
"Agentic"
"LLMOps"
"SelfImprove"
"Planning"
"Benchmark"
"BuildCheck"
)
echo "Adding Makefiles to modules missing one..."
echo
for module in "${MODULES[@]}"; do
module_dir="${SCRIPT_DIR}/${module}"
makefile_path="${module_dir}/Makefile"
if [[ ! -d "$module_dir" ]]; then
echo "Skipping $module: directory not found"
continue
fi
if [[ -f "$makefile_path" ]]; then
echo "Skipping $module: Makefile already exists"
continue
fi
echo "Adding Makefile to $module..."
# Determine module description from README first line (skip heading)
description="Generic, reusable Go module"
readme_file="${module_dir}/README.md"
if [[ -f "$readme_file" ]]; then
# Extract first non-empty line that doesn't start with '#'
first_line=$(grep -v '^#' "$readme_file" | grep -v '^$' | head -1)
if [[ -n "$first_line" ]]; then
# Trim leading/trailing whitespace
first_line=$(echo "$first_line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
description="$first_line"
fi
fi
# Convert module name to lowercase for module path
module_lower=$(echo "$module" | tr '[:upper:]' '[:lower:]')
# Use awk to replace placeholders (awk handles special characters better)
awk -v module="$module" \
-v description="$description" \
-v module_lower="$module_lower" \
'
{
gsub("{{MODULE_NAME}}", module)
gsub("{{MODULE_DESCRIPTION}}", description)
gsub("{{MODULE_LOWER}}", module_lower)
print
}
' "$TEMPLATE_FILE" > "$makefile_path"
echo " Created Makefile with description: $description"
done
echo
echo "=== Done ==="