From 4c2312e173fd00a49da98c9d1f422a29a096c267 Mon Sep 17 00:00:00 2001 From: Natalie Date: Mon, 29 Jun 2026 10:20:13 -0400 Subject: [PATCH] feat(infra-net): read .infra*.yaml + tag rows by environment Glob every .infra*.yaml (was .infra.yaml only) so .infra.dev.yaml variants are reconciled too; add an ENV column + environment field to the inventory. A project can now appear once per environment (prod DO + dev mac). Co-Authored-By: Claude Opus 4.8 (1M context) --- bin/infra-net | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/infra-net b/bin/infra-net index 586195e..9acfbbe 100755 --- a/bin/infra-net +++ b/bin/infra-net @@ -25,10 +25,10 @@ OUT = os.path.join(NET_TOOLS, "data", "infra-net.json") # Where deployable projects live (each may carry a root .infra.yaml). ROOTS = [ - os.path.join(CODE, "@applications", "*", ".infra.yaml"), - os.path.join(CODE, "@projects", "@cocottetech", "@platform", "codebase", "@features", "*", ".infra.yaml"), - os.path.join(CODE, "@projects", "@cocottetech", ".infra.yaml"), - os.path.join(CODE, "@projects", "@magic-civilization", ".infra.yaml"), + os.path.join(CODE, "@applications", "*", ".infra*.yaml"), + os.path.join(CODE, "@projects", "@cocottetech", "@platform", "codebase", "@features", "*", ".infra*.yaml"), + os.path.join(CODE, "@projects", "@cocottetech", ".infra*.yaml"), + os.path.join(CODE, "@projects", "@magic-civilization", ".infra*.yaml"), ] @@ -76,6 +76,7 @@ def main() -> int: db = m.get("database", {}) or {} rows.append({ "project": m["project"], + "environment": m.get("environment", "prod"), "provider": m.get("provider"), "host": host, "port": port, @@ -87,11 +88,11 @@ def main() -> int: rows.sort(key=lambda r: (r["host"] or "~", r["port"] or 0)) w = max([len(r["project"]) for r in rows] + [7]) print(f"\n infra-net — {len(rows)} services across {len(hosts)} hosts\n") - print(f" {'PROJECT'.ljust(w)} {'HOST'.ljust(8)} {'PORT'.ljust(5)} {'PROVIDER'.ljust(12)} DB / DEPS") + print(f" {'PROJECT'.ljust(w)} {'ENV'.ljust(4)} {'HOST'.ljust(8)} {'PORT'.ljust(5)} {'PROVIDER'.ljust(12)} DB / DEPS") for r in rows: deps = (" deps:" + ",".join(r["depends_on"])) if r["depends_on"] else "" dbp = (r["db"] or "") + deps - print(f" {r['project'].ljust(w)} {str(r['host']).ljust(8)} {str(r['port'] or '').ljust(5)} {str(r['provider']).ljust(12)} {dbp}") + print(f" {r['project'].ljust(w)} {str(r['environment']).ljust(4)} {str(r['host']).ljust(8)} {str(r['port'] or '').ljust(5)} {str(r['provider']).ljust(12)} {dbp}") if problems: print("\n PROBLEMS:")