#!/usr/bin/env python3 """ Use case: CLI startup and clean exit. Starts the Adolf CLI, reads its welcome banner, then closes it by sending EOF (simulating Ctrl+D). Prints a structured transcript for the Claude Code agent to evaluate. Expected: - Banner line contains "Adolf CLI" - Prompt "> " appears - Process exits with code 0 after EOF """ import os import subprocess import sys import time CLI = os.path.join(os.path.dirname(__file__), "../../cli.py") proc = subprocess.Popen( [sys.executable, CLI, "--session", "use-case-cli-startup"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, ) # Give the process time to print its banner before closing stdin time.sleep(0.3) try: stdout, stderr = proc.communicate(input="", timeout=10) except subprocess.TimeoutExpired: proc.kill() stdout, stderr = proc.communicate() print("RESULT: TIMEOUT — process did not exit within 10s after EOF") sys.exit(1) print("=== stdout ===") print(stdout) if stderr.strip(): print("=== stderr ===") print(stderr) print(f"=== exit code: {proc.returncode} ===")