#661 exit-code foundation: @cli resolve_exit + error() auto-trip (inert) + @seedgo output_routing checker + devpulse reference adoption

- @cli: process failure-flag + resolve_exit(handled)->0/1/2; error() auto-trips the flag; inert until a branch adopts it; 10 tests, seedgo 100%
- @seedgo: new output_routing standard (39th checker) flags user-facing status output bypassing cli helpers; 254-site per-branch migration checklist; precise (0 FP, dogfooded on devpulse); 1178 tests
- devpulse: first adopter — main()->reset_command_state()+resolve_exit(); feedback module+handlers migrated raw-red/logger.error->error(); exit 2/0/1 verified; 380 tests green; seedgo 100%
- CHANGELOG updated. Fleet migration (remaining 13 branches) to follow. Tracked in DPLAN-0236.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HeaAmr3oj2ZexB6ng311Vj
This commit is contained in:
AIOSAI
2026-07-09 19:38:17 -07:00
co-authored by Claude Opus 4.8
parent 1edea552bf
commit d2d1adca0a
13 changed files with 978 additions and 14 deletions
+35
View File
@@ -48,6 +48,36 @@ err_console = Console(stderr=True, force_terminal=sys.stderr.isatty()) # Stderr
_TRIGGER = None
_TRIGGER_LOADED = False
# Process-level command failure flag — mutable container avoids global statement
_CMD_STATE = {"failed": False}
def mark_command_failed() -> None:
"""Set the process-level failure flag (called automatically by error())."""
_CMD_STATE["failed"] = True
def command_failed() -> bool:
"""Return whether mark_command_failed() has been called since last reset."""
return _CMD_STATE["failed"]
def reset_command_state() -> None:
"""Reset the failure flag to False (for tests and main() entry)."""
_CMD_STATE["failed"] = False
def resolve_exit(handled: bool) -> int:
"""Map handled/failed state to an exit code.
Returns 1 if not handled, 2 if handled but failed, 0 otherwise.
"""
if not handled:
return 1
if _CMD_STATE["failed"]:
return 2
return 0
# ============================================================================
# MODULE PATTERN FUNCTIONS (SEEDGO compliant)
@@ -341,6 +371,7 @@ def error(message: str, suggestion: str | None = None) -> None:
Example:
error('Branch not found', suggestion='Check branch name spelling')
"""
mark_command_failed()
err_console.print(f"❌ [red bold]{message}[/red bold]")
if suggestion:
err_console.print(f" [yellow]→ Try: {suggestion}[/yellow]")
@@ -411,6 +442,10 @@ __all__ = [
"warning",
"fatal",
"section",
"mark_command_failed",
"command_failed",
"reset_command_state",
"resolve_exit",
]
# ============================================================================