Function bodies 48 total
rect function · python · L34-L37 (4 LOC)diagrams/build-01-base-architecture.py
def rect(x,y,w,h,fill="none",stroke="none",sw=1,rx=0,opacity=1,dash=""):
d = f' stroke-dasharray="{dash}"' if dash else ""
o = f' opacity="{opacity}"' if opacity<1 else ""
S(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="{rx}" fill="{fill}" stroke="{stroke}" stroke-width="{sw}"{d}{o}/>')pill function · python · L42-L47 (6 LOC)diagrams/build-01-base-architecture.py
def pill(x,y,t,bg,border,tw=None,h=22,fs=9,fc=WHITE):
if tw is None:
tw = len(t)*5.5+16
rx=h/2
rect(x,y,tw,h,fill=bg,stroke=border,sw=1,rx=rx)
text(x+tw/2, y+h/2+3, t, size=fs, fill=fc, weight=500)service_card function · python · L49-L55 (7 LOC)diagrams/build-01-base-architecture.py
def service_card(x,y,name,w=135,h=24,accent="#2563EB"):
rect(x,y,w,h,fill="#0f1629",stroke="#1e293b",sw=1,rx=4)
rect(x,y,w,3,fill=accent,rx=0)
# top-left corner rounding
rect(x,y,4,3,fill=accent)
S(f'<rect x="{x}" y="{y}" width="{4}" height="{3}" rx="4" fill="{accent}"/>')
text(x+w/2, y+h/2+5, name, size=8, fill="#CBD5E1", weight=500)section_header function · python · L57-L61 (5 LOC)diagrams/build-01-base-architecture.py
def section_header(x,y,w,label,color,count=None):
rect(x,y,w,22,fill=color,rx=6,opacity=0.25)
rect(x,y,w,22,fill="none",stroke=color,sw=1,rx=6,opacity=0.5)
lbl = label if not count else f"{label} ({count})"
text(x+w/2, y+15, lbl, size=10, fill=color, weight=700)t function · python · L7-L9 (3 LOC)diagrams/build-04-solution3-apim.py
def t(text):
"""Escape XML entities."""
return str(text).replace("&", "&").replace("<", "<").replace(">", ">").replace('"', """)step_circle function · python · L94-L96 (3 LOC)diagrams/build-04-solution3-apim.py
def step_circle(x, y, num, color="#2563EB"):
add(f'<circle cx="{x}" cy="{y}" r="9" fill="{color}"/>')
add(f'<text x="{x}" y="{y+3}" text-anchor="middle" class="step-num">{num}</text>')step_circle function · python · L86-L88 (3 LOC)diagrams/build-07-solution6-nva.py
def step_circle(x, y, num, color="#2563EB"):
add(f'<circle cx="{x}" cy="{y}" r="11" fill="{color}" filter="url(#ds)"/>')
add(f'<text x="{x}" y="{y+3.5}" text-anchor="middle" class="step-num">{num}</text>')Source: Repobility analyzer · https://repobility.com
arrow_h function · python · L90-L94 (5 LOC)diagrams/build-07-solution6-nva.py
def arrow_h(x1, y1, x2, y2, color="#374151", dash=""):
d = f' stroke-dasharray="{dash}"' if dash else ""
mid = f"ah-{'blue' if color=='#2563EB' else 'red' if color=='#DC2626' else 'green' if color=='#059669' else 'amber' if color=='#D97706' else ''}"
if mid.endswith("-"): mid = "ah"
add(f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" stroke="{color}" stroke-width="1.8" marker-end="url(#{mid})"{d}/>')arrow_path function · python · L96-L98 (3 LOC)diagrams/build-07-solution6-nva.py
def arrow_path(path, color="#374151", dash="", marker="ah"):
d = f' stroke-dasharray="{dash}"' if dash else ""
add(f'<path d="{path}" fill="none" stroke="{color}" stroke-width="1.8" marker-end="url(#{marker})"{d}/>')esc function · python · L136-L138 (3 LOC)diagrams/build-comparison-matrix.py
def esc(s):
"""Escape XML entities."""
return s.replace("&", "&").replace("<", "<").replace(">", ">").replace('"', """)rating_colors function · python · L140-L148 (9 LOC)diagrams/build-comparison-matrix.py
def rating_colors(r):
if r == "g":
return GREEN_BG, GREEN_BORDER, GREEN_TEXT
elif r == "y":
return YELLOW_BG, YELLOW_BORDER, YELLOW_TEXT
elif r == "r":
return RED_BG, RED_BORDER, RED_TEXT
else:
return GRAY_BG, GRAY_BORDER, GRAY_TEXTbuild_svg function · python · L150-L341 (192 LOC)diagrams/build-comparison-matrix.py
def build_svg():
parts = []
# Calculate total height needed
num_rows = len(ROWS)
table_bottom = TABLE_Y + HEADER_H + num_rows * ROW_H
decision_y = table_bottom + 28
decision_h = 190
footnote_y = decision_y + decision_h + 12
legend_y = footnote_y + len(FOOTNOTES) * 16 + 16
total_h = legend_y + 50
parts.append(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {total_h}" width="{W}" height="{total_h}">')
# Defs
parts.append('''<defs>
<filter id="shadow" x="-2%" y="-2%" width="104%" height="108%">
<feDropShadow dx="0" dy="2" stdDeviation="3" flood-opacity="0.08"/>
</filter>
<linearGradient id="headerGrad" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#0F172A"/>
<stop offset="100%" stop-color="#1E293B"/>
</linearGradient>
<linearGradient id="titleGrad" x1="0" y1="0" x2="1" y2="0">
<stop offset="0%" stop-color="#0F172A"/>
<stop offset="100%" stop-color="#334155"/>
</linearGradient>
<linbuild_svg function · python · L37-L269 (233 LOC)diagrams/build-dr-failover-svg.py
def build_svg():
parts = []
# SVG header
parts.append(f'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {H}" width="{W}" height="{H}">
<defs>
<marker id="arrow" viewBox="0 0 10 7" refX="9" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<path d="M0,0 L10,3.5 L0,7 z" fill="#64748B"/>
</marker>
<marker id="arrow-red" viewBox="0 0 10 7" refX="9" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<path d="M0,0 L10,3.5 L0,7 z" fill="{P1_COLOR}"/>
</marker>
<marker id="arrow-blue" viewBox="0 0 10 7" refX="9" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<path d="M0,0 L10,3.5 L0,7 z" fill="{P2_COLOR}"/>
</marker>
<marker id="arrow-green" viewBox="0 0 10 7" refX="9" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<path d="M0,0 L10,3.5 L0,7 z" fill="{P4_COLOR}"/>
</marker>
<filter id="shadow" x="-4%" y="-4%" width="108%" height="116%">
_step_node function · python · L272-L295 (24 LOC)diagrams/build-dr-failover-svg.py
def _step_node(parts, x, y, w, h, label, color, icon_type="step"):
"""Draw a step node card."""
parts.append(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="6" fill="white" stroke="{color}" stroke-width="1" filter="url(#shadow-sm)"/>')
parts.append(f'<rect x="{x}" y="{y}" width="{w}" height="3" rx="1.5" fill="{color}"/>')
# Wrap text
words = label.split()
lines = []
current = ""
max_chars = int((w - 12) / 6)
for word in words:
test = (current + " " + word).strip()
if len(test) <= max_chars:
current = test
else:
if current:
lines.append(current)
current = word
if current:
lines.append(current)
total_h = len(lines) * 12
start_y = y + (h + 3) / 2 - total_h / 2 + 10
for li, line in enumerate(lines):
parts.append(f'<text x="{x + w/2}" y="{start_y + li * 12}" font-family="{FONT}" font-size="9.5" font-weight="500" fill="{TEXT}" text-anchor="midd_timing_badge function · python · L298-L302 (5 LOC)diagrams/build-dr-failover-svg.py
def _timing_badge(parts, x, y, label, color):
"""Draw a small timing pill badge."""
tw = len(label) * 5.5 + 12
parts.append(f'<rect x="{x}" y="{y}" width="{tw}" height="16" rx="8" fill="{color}" fill-opacity="0.1" stroke="{color}" stroke-width="0.5"/>')
parts.append(f'<text x="{x + tw/2}" y="{y + 11}" font-family="{FONT}" font-size="8" font-weight="600" fill="{color}" text-anchor="middle">{esc(label)}</text>')All rows scored by the Repobility analyzer (https://repobility.com)
_draw_arrow function · python · L305-L308 (4 LOC)diagrams/build-dr-failover-svg.py
def _draw_arrow(parts, x1, y1, x2, y2, color="#64748B", dashed=False):
dash = ' stroke-dasharray="4,3"' if dashed else ""
mid = "arrow-red" if color == P1_COLOR else ("arrow-blue" if color == P2_COLOR else ("arrow-green" if color == P4_COLOR else "arrow"))
parts.append(f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" stroke="{color}" stroke-width="1.5"{dash} marker-end="url(#{mid})"/>')_draw_detection_phase function · python · L319-L370 (52 LOC)diagrams/build-dr-failover-svg.py
def _draw_detection_phase(parts, x, y, w, h, color):
"""Phase 1: Detection."""
nw, nh = 140, 42
gap = 20
# Step 1: Health Probe
x1 = x + 10
_step_node(parts, x1, y + 16, nw, nh, "Health Probe Fails (3 consecutive)", color)
_timing_badge(parts, x1 + 10, y + 62, "10-30s", color)
# Arrow
_draw_arrow(parts, x1 + nw, y + 37, x1 + nw + gap, y + 37, color)
# Step 2: Azure Monitor
x2 = x1 + nw + gap
_step_node(parts, x2, y + 16, nw, nh, "Azure Monitor Alert Fires", color)
# Arrow
_draw_arrow(parts, x2 + nw, y + 37, x2 + nw + gap, y + 37, color)
# Step 3: Detection varies
x3 = x2 + nw + gap
_step_node(parts, x3, y + 16, nw + 20, nh, "Detection Mechanism (varies per solution)", color)
# Variant badges
variants = [
("TM Probe", x3 + 2),
("FD Probe", x3 + 60),
("Monitor Alert", x3 + 112),
]
for label, bx in variants:
tw = len(label) * 5.5 + 10
parts.append(f'<rect x="{b_draw_traffic_shift_phase function · python · L373-L397 (25 LOC)diagrams/build-dr-failover-svg.py
def _draw_traffic_shift_phase(parts, x, y, w, h, color):
"""Phase 2: Traffic Shift."""
nw, nh = 150, 42
gap = 16
x1 = x + 10
_step_node(parts, x1, y + 12, nw, nh, "Gateway Routes 100% to DR (automatic)", color)
_draw_arrow(parts, x1 + nw, y + 33, x1 + nw + gap, y + 33, color)
x2 = x1 + nw + gap
_step_node(parts, x2, y + 12, nw, nh, "DNS TTL Propagation (30-60s for DNS)", color)
_timing_badge(parts, x2 + 15, y + 58, "30-60s", color)
_draw_arrow(parts, x2 + nw, y + 33, x2 + nw + gap, y + 33, color)
x3 = x2 + nw + gap
_step_node(parts, x3, y + 12, nw + 10, nh, "Front Door: Anycast Instant Switch", P4_COLOR_G)
_timing_badge(parts, x3 + 25, y + 58, "<30s", P4_COLOR_G)
# Info badge
x4 = x3 + nw + 10 + gap
parts.append(f'<rect x="{x4}" y="{y + 14}" width="100" height="38" rx="6" fill="{color}" fill-opacity="0.06" stroke="{color}" stroke-width="0.5" stroke-dasharray="4,3"/>')
parts.append(f'<text x="{x4 + 50}" y="{y + 30_draw_dr_scaleup_phase function · python · L400-L423 (24 LOC)diagrams/build-dr-failover-svg.py
def _draw_dr_scaleup_phase(parts, x, y, w, h, color):
"""Phase 3: DR Scales Up."""
nw, nh = 175, 44
gap = 16
x1 = x + 10
_step_node(parts, x1, y + 12, nw, nh, "Container Apps: min replicas 0 -> 3 (cold start 5-15s)", color)
_timing_badge(parts, x1 + 40, y + 60, "5-15s", color)
_draw_arrow(parts, x1 + nw, y + 34, x1 + nw + gap, y + 34, "#64748B")
x2 = x1 + nw + gap
_step_node(parts, x2, y + 12, nw - 20, nh, "Function Apps: warm instances activate", color)
_timing_badge(parts, x2 + 25, y + 60, "~0s", P4_COLOR_G)
_draw_arrow(parts, x2 + nw - 20, y + 34, x2 + nw - 20 + gap, y + 34, "#64748B")
x3 = x2 + nw - 20 + gap
_step_node(parts, x3, y + 12, nw - 10, nh, "NGINX/F5 in DR: already running (no cold start)", P4_COLOR_G)
_timing_badge(parts, x3 + 30, y + 60, "0ms", P4_COLOR_G)
# Note
parts.append(f'<text x="{x3 + nw - 10 + 12}" y="{y + 30}" font-family="{FONT}" font-size="8" fill="{TEXT_LIGHT}" font-style="italic">Image s_draw_data_continuity_phase function · python · L426-L453 (28 LOC)diagrams/build-dr-failover-svg.py
def _draw_data_continuity_phase(parts, x, y, w, h, color):
"""Phase 4: Data Continuity."""
nw, nh = 160, 44
gap = 16
x1 = x + 10
# Cosmos DB node (special - green highlight)
parts.append(f'<rect x="{x1}" y="{y + 12}" width="{nw}" height="{nh}" rx="6" fill="{color}" fill-opacity="0.06" stroke="{color}" stroke-width="1.5" filter="url(#shadow-sm)"/>')
parts.append(f'<rect x="{x1}" y="{y + 12}" width="{nw}" height="3" rx="1.5" fill="{color}"/>')
parts.append(f'<text x="{x1 + nw/2}" y="{y + 34}" font-family="{FONT}" font-size="10" font-weight="700" fill="{color}" text-anchor="middle">Cosmos DB</text>')
parts.append(f'<text x="{x1 + nw/2}" y="{y + 47}" font-family="{FONT}" font-size="8.5" fill="{TEXT_MUTED}" text-anchor="middle">NO failover needed</text>')
_timing_badge(parts, x1 + 40, y + 60, "0ms", color)
_draw_arrow(parts, x1 + nw, y + 34, x1 + nw + gap, y + 34, color)
x2 = x1 + nw + gap
_step_node(parts, x2, y + 12, nw, nh, "Multi-re_draw_validation_phase function · python · L456-L480 (25 LOC)diagrams/build-dr-failover-svg.py
def _draw_validation_phase(parts, x, y, w, h, color):
"""Phase 5: Validation."""
nw, nh = 155, 42
gap = 14
x1 = x + 10
_step_node(parts, x1, y + 14, nw, nh, "Synthetic monitors verify DR serving correctly", color)
_draw_arrow(parts, x1 + nw, y + 35, x1 + nw + gap, y + 35, color)
x2 = x1 + nw + gap
_step_node(parts, x2, y + 14, nw - 10, nh, "Log Analytics confirms traffic flowing", color)
_draw_arrow(parts, x2 + nw - 10, y + 35, x2 + nw - 10 + gap, y + 35, color)
x3 = x2 + nw - 10 + gap
_step_node(parts, x3, y + 14, nw - 20, nh, "Ops dashboard confirmation", color)
_draw_arrow(parts, x3 + nw - 20, y + 35, x3 + nw - 20 + gap, y + 35, color)
# Resolved notification (success)
x4 = x3 + nw - 20 + gap
parts.append(f'<rect x="{x4}" y="{y + 14}" width="105" height="{nh}" rx="6" fill="{P4_COLOR_G}" fill-opacity="0.08" stroke="{P4_COLOR_G}" stroke-width="1.5" filter="url(#shadow-sm)"/>')
parts.append(f'<text x="{x4 + 52}" y="_draw_failback_phase function · python · L483-L521 (39 LOC)diagrams/build-dr-failover-svg.py
def _draw_failback_phase(parts, x, y, w, h, color):
"""Phase 6: Failback (Manual)."""
nw, nh = 132, 42
gap = 12
x1 = x + 10
_step_node(parts, x1, y + 16, nw, nh, "Prod restored and verified", color)
_draw_arrow(parts, x1 + nw, y + 37, x1 + nw + gap, y + 37, color)
x2 = x1 + nw + gap
# Gradual traffic shift - special multi-step node
gw = 180
parts.append(f'<rect x="{x2}" y="{y + 16}" width="{gw}" height="{nh}" rx="6" fill="white" stroke="{color}" stroke-width="1" filter="url(#shadow-sm)"/>')
parts.append(f'<rect x="{x2}" y="{y + 16}" width="{gw}" height="3" rx="1.5" fill="{color}"/>')
parts.append(f'<text x="{x2 + gw/2}" y="{y + 34}" font-family="{FONT}" font-size="9" font-weight="500" fill="{TEXT}" text-anchor="middle">Gradual traffic shift back to prod</text>')
# Progress indicators
steps_t = ["10%", "50%", "100%"]
for si, st in enumerate(steps_t):
sx = x2 + 28 + si * 56
col_s = color if si < 2 else P4_COLOmarker_defs function · python · L8-L27 (20 LOC)diagrams/build-solution1-svg.py
def marker_defs():
return '''
<marker id="arrow" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#374151"/>
</marker>
<marker id="arrow-blue" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#2563EB"/>
</marker>
<marker id="arrow-orange" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#EA580C"/>
</marker>
<marker id="arrow-red" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#DC2626"/>
</marker>
<marker id="arrow-green" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="8" markerHeight="6" orient="auto-start-reverse">
<polygon points="0 0, 10 Want this analysis on your repo? https://repobility.com/scan/
filters function · python · L29-L42 (14 LOC)diagrams/build-solution1-svg.py
def filters():
return '''
<filter id="shadow" x="-4%" y="-4%" width="108%" height="108%">
<feDropShadow dx="1" dy="2" stdDeviation="2.5" flood-color="#000" flood-opacity="0.1"/>
</filter>
<filter id="shadow-sm" x="-4%" y="-4%" width="108%" height="108%">
<feDropShadow dx="0.5" dy="1" stdDeviation="1.5" flood-color="#000" flood-opacity="0.08"/>
</filter>
<filter id="glow-blue" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="0" stdDeviation="3" flood-color="#2563EB" flood-opacity="0.3"/>
</filter>
<filter id="glow-orange" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="0" stdDeviation="3" flood-color="#EA580C" flood-opacity="0.3"/>
</filter>'''styles function · python · L44-L61 (18 LOC)diagrams/build-solution1-svg.py
def styles():
return '''
<style>
text { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
.title { font-size: 18px; font-weight: 700; fill: #111827; }
.subtitle { font-size: 11px; font-weight: 500; fill: #6B7280; }
.region-label { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; }
.node-title { font-size: 10.5px; font-weight: 600; fill: #1F2937; }
.node-detail { font-size: 8.5px; font-weight: 400; fill: #6B7280; }
.node-detail-sm { font-size: 7.5px; font-weight: 400; fill: #9CA3AF; }
.edge-label { font-size: 8px; font-weight: 500; fill: #6B7280; }
.step-num { font-size: 9px; font-weight: 700; fill: #FFFFFF; }
.section-label { font-size: 9px; font-weight: 600; fill: #374151; letter-spacing: 0.3px; text-transform: uppercase; }
.footer-text { font-size: 8px; font-weight: 500; fill: #6B7280; }
.legend-text { font-size: 8px; font-weight: 500; fill: #374151; }
.badge { font-size: 7pxstep_circle function · python · L63-L65 (3 LOC)diagrams/build-solution1-svg.py
def step_circle(x, y, num, color="#2563EB"):
return f'''<circle cx="{x}" cy="{y}" r="10" fill="{color}"/>
<text x="{x}" y="{y+3.5}" text-anchor="middle" class="step-num">{num}</text>'''rounded_box function · python · L67-L70 (4 LOC)diagrams/build-solution1-svg.py
def rounded_box(x, y, w, h, fill="#FFFFFF", stroke="#D1D5DB", rx=8, sw=1.2, filt="shadow-sm", opacity=1):
f_attr = f' filter="url(#{filt})"' if filt else ''
o_attr = f' opacity="{opacity}"' if opacity != 1 else ''
return f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="{rx}" fill="{fill}" stroke="{stroke}" stroke-width="{sw}"{f_attr}{o_attr}/>'node_card function · python · L72-L90 (19 LOC)diagrams/build-solution1-svg.py
def node_card(x, y, w, h, title, details, accent_color="#2563EB", icon_text=None):
lines = [rounded_box(x, y, w, h, "#FFFFFF", accent_color, 6, 1.2)]
# accent bar
lines.append(f'<rect x="{x}" y="{y}" width="{w}" height="4" rx="6" fill="{accent_color}"/>')
lines.append(f'<rect x="{x}" y="{y+2}" width="{w}" height="4" fill="{accent_color}"/>')
lines.append(f'<rect x="{x}" y="{y+4}" width="{w}" height="{h-4}" rx="0" ry="0" fill="none"/>')
# icon badge
if icon_text:
lines.append(f'<rect x="{x+w-30}" y="{y+8}" width="24" height="14" rx="7" fill="{accent_color}" opacity="0.12"/>')
lines.append(f'<text x="{x+w-18}" y="{y+18}" text-anchor="middle" class="badge" fill="{accent_color}">{icon_text}</text>')
# title
ty = y + 19 if not details else y + 17
lines.append(f'<text x="{x+8}" y="{ty}" class="node-title">{title}</text>')
# details
dy = ty + 12
for d in details:
lines.append(f'<text x="{x+8}" y="{dy}" class="node-detregion_container function · python · L92-L101 (10 LOC)diagrams/build-solution1-svg.py
def region_container(x, y, w, h, label, color, vnet, is_dr=False):
dash = ' stroke-dasharray="6,3"' if is_dr else ''
lines = []
lines.append(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="12" fill="{color}" opacity="0.06" stroke="{color}" stroke-width="1.5"{dash}/>')
# header bar
lines.append(f'<rect x="{x}" y="{y}" width="{w}" height="28" rx="12" fill="{color}" opacity="0.12"/>')
lines.append(f'<rect x="{x}" y="{y+14}" width="{w}" height="14" fill="{color}" opacity="0.12"/>')
lines.append(f'<text x="{x+12}" y="{y+18}" class="region-label" fill="{color}">{label}</text>')
lines.append(f'<text x="{x+w-12}" y="{y+18}" text-anchor="end" class="node-detail mono" fill="{color}">{vnet}</text>')
return '\n '.join(lines)subnet_box function · python · L103-L106 (4 LOC)diagrams/build-solution1-svg.py
def subnet_box(x, y, w, h, label, cidr, color="#94A3B8"):
return f'''<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="6" fill="none" stroke="{color}" stroke-width="0.8" stroke-dasharray="4,2" opacity="0.6"/>
<text x="{x+6}" y="{y+11}" class="node-detail-sm" fill="{color}">{label}</text>
<text x="{x+w-6}" y="{y+11}" text-anchor="end" class="node-detail-sm mono" fill="{color}">{cidr}</text>'''arrow_path function · python · L108-L110 (3 LOC)diagrams/build-solution1-svg.py
def arrow_path(x1, y1, x2, y2, color="#374151", marker="arrow", dash="", lw=1.3):
d_attr = f' stroke-dasharray="{dash}"' if dash else ''
return f'<line x1="{x1}" y1="{y1}" x2="{x2}" y2="{y2}" stroke="{color}" stroke-width="{lw}" marker-end="url(#{marker})"{d_attr}/>'Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
curved_arrow function · python · L112-L114 (3 LOC)diagrams/build-solution1-svg.py
def curved_arrow(x1, y1, cx1, cy1, cx2, cy2, x2, y2, color="#374151", marker="arrow", dash="", lw=1.3):
d_attr = f' stroke-dasharray="{dash}"' if dash else ''
return f'<path d="M{x1},{y1} C{cx1},{cy1} {cx2},{cy2} {x2},{y2}" stroke="{color}" stroke-width="{lw}" fill="none" marker-end="url(#{marker})"{d_attr}/>'step_badge function · python · L117-L120 (4 LOC)diagrams/build-solution2.py
def step_badge(x, y, num, label, color=BLUE_P):
add(f'<circle cx="{x}" cy="{y}" r="11" fill="{color}"/>')
add(f'<text x="{x}" y="{y+4}" font-family="{FONT}" font-size="10" font-weight="700" fill="{WHITE}" text-anchor="middle">{num}</text>')
add(f'<text x="{x}" y="{y+20}" font-family="{FONT}" font-size="7.5" font-weight="500" fill="{GRAY_M}" text-anchor="middle">{e(label)}</text>')draw_service_group function · python · L232-L247 (16 LOC)diagrams/build-solution2.py
def draw_service_group(gx, gy, title, count, services, color, gw=200):
gh_per = 18
gh = 26 + len(services) * gh_per + 6
add(f'<rect x="{gx}" y="{gy}" width="{gw}" height="{gh}" rx="8" fill="{WHITE}" fill-opacity="0.92" stroke="{color}" stroke-width="1.2" filter="url(#shadow)"/>')
add(f'<rect x="{gx}" y="{gy}" width="{gw}" height="20" rx="8" fill="{color}" fill-opacity="0.12"/>')
add(f'<rect x="{gx}" y="{gy+8}" width="{gw}" height="12" fill="{color}" fill-opacity="0.12"/>')
add(f'<text x="{gx+8}" y="{gy+14}" font-family="{FONT}" font-size="7.5" font-weight="700" fill="{color}">{e(title)}</text>')
add(f'<rect x="{gx+gw-30}" y="{gy+3}" width="24" height="14" rx="7" fill="{color}"/>')
add(f'<text x="{gx+gw-18}" y="{gy+13}" font-family="{FONT}" font-size="7.5" font-weight="700" fill="{WHITE}" text-anchor="middle">x{count}</text>')
sy = gy + 26
for svc in services:
add(f'<circle cx="{gx+10}" cy="{sy+5}" r="3.5" fill="{TEAL}" opacity="0.25"/>')
rounded_rect function · python · L10-L13 (4 LOC)diagrams/build-solution4.py
def rounded_rect(x, y, w, h, rx=8, fill="#FFFFFF", stroke="#CBD5E1", sw=1.5, opacity=1, dash="", extra=""):
d = f' stroke-dasharray="{dash}"' if dash else ""
o = f' opacity="{opacity}"' if opacity != 1 else ""
return f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="{rx}" fill="{fill}" stroke="{stroke}" stroke-width="{sw}"{d}{o}{extra}/>'circle_num function · python · L18-L20 (3 LOC)diagrams/build-solution4.py
def circle_num(cx, cy, num, r=12, bg="#2563EB", fg="#FFFFFF"):
return (f'<circle cx="{cx}" cy="{cy}" r="{r}" fill="{bg}"/>'
f'<text x="{cx}" y="{cy+4}" font-family="\'Segoe UI\', system-ui, sans-serif" font-size="11" font-weight="700" fill="{fg}" text-anchor="middle">{num}</text>')arrow_path function · python · L22-L30 (9 LOC)diagrams/build-solution4.py
def arrow_path(points, color="#2563EB", sw=2, marker="url(#arrow-blue)", dash=""):
if len(points) == 2:
d = f"M{points[0][0]},{points[0][1]} L{points[1][0]},{points[1][1]}"
else:
d = f"M{points[0][0]},{points[0][1]}"
for p in points[1:]:
d += f" L{p[0]},{p[1]}"
ds = f' stroke-dasharray="{dash}"' if dash else ""
return f'<path d="{d}" fill="none" stroke="{color}" stroke-width="{sw}" marker-end="{marker}"{ds}/>'arrow_markers function · python · L11-L30 (20 LOC)diagrams/build-solution7-svg.py
def arrow_markers():
return '''
<marker id="ah" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="10" markerHeight="7" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#374151"/>
</marker>
<marker id="ah-blue" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="10" markerHeight="7" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#2563EB"/>
</marker>
<marker id="ah-green" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="10" markerHeight="7" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#059669"/>
</marker>
<marker id="ah-amber" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="10" markerHeight="7" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7" fill="#D97706"/>
</marker>
<marker id="ah-red" viewBox="0 0 10 7" refX="10" refY="3.5" markerWidth="10" markerHeight="7" orient="auto-start-reverse">
<polygon points="0 0, 10 3.5, 0 7"drop_shadow function · python · L32-L45 (14 LOC)diagrams/build-solution7-svg.py
def drop_shadow():
return '''
<filter id="ds" x="-4%" y="-4%" width="108%" height="112%">
<feDropShadow dx="0" dy="2" stdDeviation="3" flood-color="#000" flood-opacity="0.08"/>
</filter>
<filter id="ds-lg" x="-4%" y="-4%" width="108%" height="116%">
<feDropShadow dx="0" dy="3" stdDeviation="5" flood-color="#000" flood-opacity="0.12"/>
</filter>
<filter id="glow-blue" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="0" stdDeviation="4" flood-color="#2563EB" flood-opacity="0.3"/>
</filter>
<filter id="glow-green" x="-20%" y="-20%" width="140%" height="140%">
<feDropShadow dx="0" dy="0" stdDeviation="4" flood-color="#059669" flood-opacity="0.25"/>
</filter>'''Source: Repobility analyzer · https://repobility.com
css function · python · L47-L64 (18 LOC)diagrams/build-solution7-svg.py
def css():
return '''
<style>
text { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
.title { font-size: 18px; font-weight: 700; fill: #111827; }
.subtitle { font-size: 11px; font-weight: 500; fill: #6B7280; }
.section-label { font-size: 12px; font-weight: 700; fill: #FFFFFF; letter-spacing: 0.5px; }
.node-title { font-size: 11px; font-weight: 600; fill: #1F2937; }
.node-text { font-size: 9.5px; font-weight: 400; fill: #4B5563; }
.node-text-sm { font-size: 8.5px; font-weight: 400; fill: #6B7280; }
.badge { font-size: 8px; font-weight: 600; }
.step-num { font-size: 10px; font-weight: 700; fill: #FFFFFF; }
.edge-label { font-size: 8.5px; font-weight: 500; fill: #6B7280; }
.legend-text { font-size: 9px; font-weight: 500; fill: #374151; }
.footer-text { font-size: 9.5px; font-weight: 500; fill: #6B7280; }
.cost-text { font-size: 9px; font-weight: 600; fill: #059669; }
.mono { font-fstep_circle function · python · L66-L68 (3 LOC)diagrams/build-solution7-svg.py
def step_circle(x, y, num, color="#2563EB"):
return f'''<circle cx="{x}" cy="{y}" r="11" fill="{color}"/>
<text x="{x}" y="{y+3.5}" text-anchor="middle" class="step-num">{num}</text>'''pill_badge function · python · L70-L73 (4 LOC)diagrams/build-solution7-svg.py
def pill_badge(x, y, text, bg="#EFF6FF", border="#2563EB", text_color="#2563EB", w=None):
tw = w or len(text) * 5.5 + 12
return f'''<rect x="{x}" y="{y}" width="{tw}" height="16" rx="8" fill="{bg}" stroke="{border}" stroke-width="0.8"/>
<text x="{x + tw/2}" y="{y + 11}" text-anchor="middle" class="badge" fill="{text_color}">{esc(text)}</text>'''card function · python · L75-L86 (12 LOC)diagrams/build-solution7-svg.py
def card(x, y, w, h, title, lines, accent="#2563EB", icon_text=None):
s = f'''<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="8" fill="#FFFFFF" stroke="#E5E7EB" stroke-width="1" filter="url(#ds)"/>
<rect x="{x}" y="{y}" width="{w}" height="3" rx="1.5" fill="{accent}"/>'''
ty = y + 18
if icon_text:
s += f'<text x="{x+8}" y="{ty}" class="node-text-sm" fill="{accent}">{esc(icon_text)}</text>'
s += f'<text x="{x + 8 + len(icon_text)*5 + 4}" y="{ty}" class="node-title">{esc(title)}</text>'
else:
s += f'<text x="{x+8}" y="{ty}" class="node-title">{esc(title)}</text>'
for i, line in enumerate(lines):
s += f'<text x="{x+8}" y="{ty + 14 + i*12}" class="node-text-sm">{esc(line)}</text>'
return sregion_box function · python · L88-L95 (8 LOC)diagrams/build-solution7-svg.py
def region_box(x, y, w, h, label, sublabel, color, is_dr=False):
dash = ' stroke-dasharray="6,3"' if is_dr else ''
s = f'''<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="12" fill="{color}" fill-opacity="0.06" stroke="{color}" stroke-width="1.5"{dash}/>
<rect x="{x}" y="{y}" width="{w}" height="28" rx="12" fill="{color}" fill-opacity="0.12"/>
<rect x="{x}" y="{y+16}" width="{w}" height="12" fill="{color}" fill-opacity="0.12"/>
<text x="{x+12}" y="{y+18}" class="node-title" fill="{color}">{esc(label)}</text>
<text x="{x+w-8}" y="{y+18}" text-anchor="end" class="node-text-sm" fill="{color}">{esc(sublabel)}</text>'''
return sbuild_svg function · python · L98-L454 (357 LOC)diagrams/build-solution7-svg.py
def build_svg():
parts = []
# SVG open
parts.append(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {H}" width="{W}" height="{H}">')
parts.append('<defs>')
parts.append(arrow_markers())
parts.append(drop_shadow())
parts.append('</defs>')
parts.append(css())
# Background
parts.append(f'<rect width="{W}" height="{H}" fill="#F8FAFC" rx="12"/>')
# Subtle grid
parts.append('<pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse">')
parts.append('<path d="M 20 0 L 0 0 0 20" fill="none" stroke="#94A3B8" stroke-width="0.3" opacity="0.15"/>')
parts.append('</pattern>')
parts.append(f'<rect width="{W}" height="{H}" fill="url(#grid)" rx="12"/>')
# ──── Title ────
parts.append(f'<text x="30" y="32" class="title">Solution 7: Azure Front Door (Private Link Origins)</text>')
parts.append(f'<text x="30" y="48" class="subtitle">Global anycast entry + WAF + Private Link to backends | Zero public IP expowrite_file function · python · L1906-L1909 (4 LOC)infrastructure/terraform/generate-solutions.py
def write_file(path, content):
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write(content.strip() + "\n")generate_solution function · python · L1912-L1969 (58 LOC)infrastructure/terraform/generate-solutions.py
def generate_solution(name, spec):
sol_dir = os.path.join(BASE, name)
os.makedirs(sol_dir, exist_ok=True)
# 1. providers.tf
write_file(os.path.join(sol_dir, "providers.tf"), PROVIDERS_TF)
# 2. variables.tf
write_file(os.path.join(sol_dir, "variables.tf"),
VARIABLES_COMMON + spec.get("extra_vars", ""))
# 3. terraform.tfvars
write_file(os.path.join(sol_dir, "terraform.tfvars"), f'''
project = "hawkai"
environment = "poc"
prod_location = "eastus2"
dr_location = "centralus"
prod_vnet_cidr = "10.1.0.0/16"
dr_vnet_cidr = "10.2.0.0/16"
tags = {{
Project = "hawkai"
Environment = "poc"
ManagedBy = "terraform"
Solution = "{name}"
DeleteAfter = "2026-05-09"
}}
''')
# 4. Common modules
for mod_name, (main, vars, outputs) in COMMON_MODULES.items():
mod_dir = os.path.join(sol_dir, "modules", mod_name)
write_file(os.path.join(mod_dir, "main.tf"), main)
write_file(os.path.join(mod_dir, "variabAll rows scored by the Repobility analyzer (https://repobility.com)
main function · python · L1972-L1983 (12 LOC)infrastructure/terraform/generate-solutions.py
def main():
print("Generating HawkAI Terraform solutions...")
for name, spec in SOLUTION_SPECIFICS.items():
generate_solution(name, spec)
total = 0
for name in SOLUTION_SPECIFICS:
sol_dir = os.path.join(BASE, name)
count = sum(1 for r, d, f in os.walk(sol_dir) for fn in f if fn.endswith(".tf") or fn.endswith(".tfvars"))
total += count
print(f" {name}: {count} files")
print(f"\nTotal: {total} Terraform files across {len(SOLUTION_SPECIFICS)} solutions")