forked from contextforge-org/contextforge-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.py
More file actions
34 lines (26 loc) · 780 Bytes
/
Copy pathconsole.py
File metadata and controls
34 lines (26 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
"""
SPDX-License-Identifier: Apache-2.0
Console and CLI application factories.
This module centralizes creation of the shared Rich console and Typer app.
Both are cached so commands across the process use consistent output and app
configuration without repeated construction.
"""
# Standard
from functools import lru_cache
# Third-Party
from rich.console import Console
import typer
@lru_cache
def get_console() -> Console:
"""Get the console singleton."""
return Console()
@lru_cache
def get_app() -> typer.Typer:
"""Get the typer singleton."""
return typer.Typer(
name="mcpgateway",
help="MCP Gateway - Production-grade MCP Gateway & Proxy CLI",
add_completion=True,
rich_markup_mode="rich",
)