Files
AIPass/src/aipass/prax/apps/plugins/devpulse_dashboard/refresh.py
T
AIOSAIandClaude Opus 4.8 626ab81a46 refactor(status): decommission entire STATUS flow — STATUS.local.md + central STATUS.md retired, replaced by local.json todos[] + dashboard count (TDPLAN-0007)
Cross-branch coordinated change. Per-branch STATUS.local.md (13) + central
STATUS.md deleted; all prompts/docs/skills/hooks/footer/scaffolding scrubbed.
Status-sync engine kept intact-but-inert (trigger registry unwired, 3 lines).
Replacement: operational todos[] in .trinity/local.json (@memory schema, capped,
rollover-exempt), pushed to all 13 branches + surfaced as dashboard todo_count.

Owners: memory (schema+global push+template), prax (dashboard todo_section +
engine dormant), trigger (unwire), aipass (init scaffolding), spawn (template
delete + todos[] seed), hooks (compact recovery), ai_mail (footer), seedgo
(_RUNTIME_ARTIFACTS cleanup), devpulse (scrub+delete+assemble).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 21:53:24 -07:00

80 lines
2.2 KiB
Python

# =================== AIPass ====================
# Name: refresh.py
# Description: Orchestrates all devpulse custom dashboard sections
# Version: 1.0.0
# Created: 2026-05-16
# Modified: 2026-05-16
# =============================================
"""Refresh orchestrator for devpulse dashboard plugin.
Calls each section builder in sequence. Each builder gathers its own data
and writes to DASHBOARD.local.json via prax's write_section() API.
Failures in one section don't block others.
"""
from pathlib import Path
from typing import Dict, List, Optional
from aipass.prax.apps.modules.logger import system_logger as logger
# Devpulse branch path — resolved relative to this file's location
_AIPASS_SRC = Path(__file__).resolve().parents[4] # .../src/aipass/
DEVPULSE_PATH = _AIPASS_SRC / "devpulse"
def refresh(branch_path: Optional[Path] = None) -> Dict:
"""Refresh all devpulse custom dashboard sections.
Args:
branch_path: Override path to devpulse branch root.
Defaults to auto-resolved path.
Returns:
Dict with results per section: {section_name: {"success": bool, "error": str|None}}
"""
target = branch_path or DEVPULSE_PATH
results: Dict[str, Dict] = {}
builders: List[tuple] = [
("git", _refresh_git),
("session", _refresh_session),
("dispatch", _refresh_dispatch),
("todo", _refresh_todo),
]
for name, builder_fn in builders:
try:
builder_fn(target)
results[name] = {"success": True, "error": None}
except Exception as e:
logger.error("Failed to refresh section '%s': %s", name, e)
results[name] = {"success": False, "error": str(e)}
return results
def _refresh_git(branch_path: Path) -> None:
from .git_section import build_git_section
build_git_section(branch_path)
def _refresh_session(branch_path: Path) -> None:
from .session_section import build_session_section
build_session_section(branch_path)
def _refresh_dispatch(branch_path: Path) -> None:
from .dispatch_section import build_dispatch_section
build_dispatch_section(branch_path)
def _refresh_todo(branch_path: Path) -> None:
from .todo_section import build_todo_section
build_todo_section(branch_path)