<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cli(ctx, ids, query, filters, details, interval):
 """Watch for new alerts."""

    if details:
        display = 'details'
    else:
        display = 'compact'
    from_date = None

    auto_refresh = True
    while auto_refresh:
        try:
            auto_refresh, from_date = ctx.invoke(query_cmd, ids=ids, query=query,
                                                 filters=filters, display=display, from_date=from_date)
            time.sleep(interval)
        except (KeyboardInterrupt, SystemExit) as e:
            sys.exit(e)