-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathservice-taxonomy-gen.sh
More file actions
executable file
·67 lines (55 loc) · 2.14 KB
/
Copy pathservice-taxonomy-gen.sh
File metadata and controls
executable file
·67 lines (55 loc) · 2.14 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
#!/usr/bin/env bash
# Generates service class assignments from filesystem ground truth.
# Order matters — each check eliminates by precedence.
# Run from monorepo root: bash docs/reference/service-taxonomy-gen.sh
set -euo pipefail
if ! compgen -G "bin-*/" > /dev/null 2>&1; then
echo "ERROR: run from monorepo root (no bin-*/ directories found)" >&2
exit 1
fi
echo "# Service Taxonomy"
echo "# Generated by docs/reference/service-taxonomy-gen.sh"
echo "# DO NOT EDIT MANUALLY — regenerate and commit when services change"
echo ""
echo "| Service | Class | Notes |"
echo "|---------|-------|-------|"
for svc_dir in bin-*/ voip-*/; do
name=$(basename "$svc_dir")
# Class D: Non-Go service (no go.mod at service root — currently only bin-dbscheme-manager)
if [ ! -f "${svc_dir}go.mod" ]; then
echo "| $name | D | Python/Alembic migrations |"
continue
fi
# Class E: OpenAPI codegen (no cmd/, has openapi/)
if [ ! -d "${svc_dir}cmd" ] && [ -d "${svc_dir}openapi" ]; then
echo "| $name | E | OpenAPI codegen, no runtime |"
continue
fi
# Class C: shared library (no cmd/, has pkg/)
if [ ! -d "${svc_dir}cmd" ] && [ -d "${svc_dir}pkg" ]; then
echo "| $name | C | Shared library, no cmd/ |"
continue
fi
# Class B: API gateway (has cmd/, no listenhandler, uses oapi-codegen)
if [ -d "${svc_dir}cmd" ] && [ ! -d "${svc_dir}pkg/listenhandler" ] && \
grep -q "oapi-codegen" "${svc_dir}go.mod" 2>/dev/null; then
echo "| $name | B | HTTP/REST gateway |"
continue
fi
# Class A2: event-driven worker (has cmd/, no listenhandler, not B)
if [ -d "${svc_dir}cmd" ] && [ ! -d "${svc_dir}pkg/listenhandler" ]; then
echo "| $name | A2 | Event-driven worker, no inbound RPC |"
continue
fi
# Class A+sub: voip-* proxies with listenhandler
if [ -d "${svc_dir}pkg/listenhandler" ] && [[ "$name" == voip-* ]]; then
echo "| $name | A+sub | Go RPC + embedded native daemon |"
continue
fi
# Class A: standard Go RPC manager
if [ -d "${svc_dir}pkg/listenhandler" ]; then
echo "| $name | A | Standard Go RPC manager |"
continue
fi
echo "| $name | UNKNOWN | Manual classification needed |"
done