diff --git a/src/atocore/engineering/wiki.py b/src/atocore/engineering/wiki.py index 547b19c..a15df0c 100644 --- a/src/atocore/engineering/wiki.py +++ b/src/atocore/engineering/wiki.py @@ -47,32 +47,74 @@ def render_homepage() -> str: for p in registered: entity_count = len(get_entities(project=p.project_id, limit=200)) memory_count = len(get_memories(project=p.project_id, active_only=True, limit=200)) - state_count = len(get_state(p.project_id)) + state_entries = get_state(p.project_id) + + # Pull stage/type/client from state entries + stage = "" + proj_type = "" + client = "" + for e in state_entries: + if e.category == "status": + if e.key == "stage": + stage = e.value + elif e.key == "type": + proj_type = e.value + elif e.key == "client": + client = e.value + projects.append({ "id": p.project_id, "description": p.description, "entities": entity_count, "memories": memory_count, - "state": state_count, + "state": len(state_entries), + "stage": stage, + "type": proj_type, + "client": client, }) except Exception: pass + # Group by high-level bucket + buckets: dict[str, list] = { + "Active Contracts": [], + "Leads & Prospects": [], + "Internal Tools & Infra": [], + "Other": [], + } + for p in projects: + t = p["type"].lower() + s = p["stage"].lower() + if "lead" in t or "lead" in s or "prospect" in s: + buckets["Leads & Prospects"].append(p) + elif "contract" in t or ("active" in s and "contract" in s): + buckets["Active Contracts"].append(p) + elif "infra" in t or "tool" in t or "internal" in t: + buckets["Internal Tools & Infra"].append(p) + else: + buckets["Other"].append(p) + lines = ['
{p["description"][:120]}
') - lines.append(f'{p["description"][:140]}
') + lines.append(f'