MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / InitApp

Class InitApp

uncommon_route/tui/init_app.py:322–853  ·  view source on GitHub ↗

Stepper-style wizard for uncommon-route init.

Source from the content-addressed store, hash-verified

320
321
322class InitApp(App):
323 """Stepper-style wizard for uncommon-route init."""
324
325 CSS = CSS
326 TITLE = "uncommon-route init"
327 BINDINGS = [
328 Binding("ctrl+n", "next_step", "Next", priority=True),
329 Binding("ctrl+p", "prev_step", "Prev", priority=True),
330 Binding("ctrl+q", "quit", "Quit", priority=True),
331 ]
332
333 step_index: reactive[int] = reactive(0)
334
335 def __init__(
336 self,
337 *,
338 rc_path: Path,
339 rc_display: str,
340 render_exports: Callable[[str, int], list[str]],
341 start_background_proxy: Callable[..., tuple[bool, str]],
342 port: int = 8403,
343 ) -> None:
344 super().__init__()
345 self._rc_path = rc_path
346 self._rc_display = rc_display
347 self._render_exports = render_exports
348 self._start_background_proxy = start_background_proxy
349 self.answers = InitAnswers(
350 port=port,
351 connection_choice="commonstack",
352 upstream_url="https://api.commonstack.ai/v1",
353 )
354 self.applied: bool = False
355 self.last_result: ApplyResult | None = None
356 self._lang: str = DEFAULT_LANG
357 try:
358 self._existing_upstream = ConnectionsStore().primary().upstream
359 except Exception:
360 self._existing_upstream = ""
361
362 def t(self, key: str, **fmt: object) -> str:
363 return translate(key, self._lang, **fmt)
364
365 # ------------------------------------------------------------------
366 # Compose
367 # ------------------------------------------------------------------
368
369 def compose(self) -> ComposeResult:
370 yield Header(show_clock=False)
371 with Horizontal():
372 with Vertical(id="sidebar"):
373 yield Static(self.t("app.title"), id="sidebar-title")
374 for i, (_, label_key) in enumerate(STEPS):
375 yield Static(
376 f"{i + 1}. {self.t(label_key)}",
377 id=f"step-row-{i}",
378 classes="step-row",
379 )

Callers 1

run_init_tuiFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected