airbyte_ops_mcp.cli.lighthouse
CLI commands for the Project Lighthouse outreach job.
1# Copyright (c) 2025 Airbyte, Inc., all rights reserved. 2"""CLI commands for the Project Lighthouse outreach job.""" 3 4from __future__ import annotations 5 6from datetime import date, datetime, timezone 7from pathlib import Path 8from typing import Annotated 9 10from cyclopts import Parameter 11 12from airbyte_ops_mcp.cli._base import App, app 13from airbyte_ops_mcp.lighthouse.job import default_fire_dates, run_lighthouse 14 15lighthouse_app = App(name="lighthouse", help="Project Lighthouse outreach job.") 16app.command(lighthouse_app) 17 18 19@lighthouse_app.command(name="run") 20def lighthouse_run( 21 run_date: Annotated[ 22 date | None, 23 Parameter( 24 name="--date", 25 help=( 26 "UTC fire date in YYYY-MM-DD format (defaults to yesterday, " 27 "or Friday through Sunday on Mondays)." 28 ), 29 ), 30 ] = None, 31 live: Annotated[ 32 bool, 33 Parameter(help="Enable Zendesk and Slack writes; default is dry-run."), 34 ] = False, 35) -> None: 36 """Plan or execute the Project Lighthouse outreach job.""" 37 fire_dates = ( 38 [run_date] 39 if run_date is not None 40 else default_fire_dates(datetime.now(timezone.utc).date()) 41 ) 42 result = run_lighthouse( 43 fire_dates, 44 live=live, 45 plan_path=Path("lighthouse_plan.json"), 46 ) 47 print(result.markdown) 48 print(f"\nPlan written to {result.plan_path}") 49 if result.errors: 50 print("\nErrors:") 51 for error in result.errors: 52 print(f"- {error}") 53 raise SystemExit(1)
lighthouse_app =
App(name=('lighthouse',), help='Project Lighthouse outreach job.', alias=(), version='0.0.0.post1.dev0+2e820a9', version_flags=(), help_flags=('--help', '-h'), group=(), validator=[], name_transform=<function default_name_transform>, sort_key=<UNSET>)
@lighthouse_app.command(name='run')
def
lighthouse_run( run_date: typing.Annotated[datetime.date | None, Parameter(name=('--date',), help='UTC fire date in YYYY-MM-DD format (defaults to yesterday, or Friday through Sunday on Mondays).')] = None, live: typing.Annotated[bool, Parameter(help='Enable Zendesk and Slack writes; default is dry-run.')] = False) -> None:
20@lighthouse_app.command(name="run") 21def lighthouse_run( 22 run_date: Annotated[ 23 date | None, 24 Parameter( 25 name="--date", 26 help=( 27 "UTC fire date in YYYY-MM-DD format (defaults to yesterday, " 28 "or Friday through Sunday on Mondays)." 29 ), 30 ), 31 ] = None, 32 live: Annotated[ 33 bool, 34 Parameter(help="Enable Zendesk and Slack writes; default is dry-run."), 35 ] = False, 36) -> None: 37 """Plan or execute the Project Lighthouse outreach job.""" 38 fire_dates = ( 39 [run_date] 40 if run_date is not None 41 else default_fire_dates(datetime.now(timezone.utc).date()) 42 ) 43 result = run_lighthouse( 44 fire_dates, 45 live=live, 46 plan_path=Path("lighthouse_plan.json"), 47 ) 48 print(result.markdown) 49 print(f"\nPlan written to {result.plan_path}") 50 if result.errors: 51 print("\nErrors:") 52 for error in result.errors: 53 print(f"- {error}") 54 raise SystemExit(1)
Plan or execute the Project Lighthouse outreach job.