Skip to content
Back to skills

2492 2026 02 20 App Lifecycle Class Refactor 1b2690be

ASecurity

Replaced free lifecycle functions with an `AppLifecycle` class in `src/tunacode/ui/lifecycle.py`.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
testinggo

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2492-2026-02-20-app-lifecycle-class-refactor_1b2690be --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2492 2026 02 20 App Lifecycle Class Refactor 1b2690be?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2492 2026 02 20 App Lifecycle Class Refactor 1b2690be
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2492-2026-02-20-app-lifecycle-class-refactor-1b269/badge)](https://www.skillsdirectory.com/skills/tools-only-2492-2026-02-20-app-lifecycle-class-refactor-1b269)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
title: Refactor UI lifecycle functions into AppLifecycle with persistent ownership
type: delta
link: app-lifecycle-class-refactor
path: src/tunacode/ui/lifecycle.py
depth: 0
seams: [M]
ontological_relations:
  - affects: [[ui]]
  - affects: [[lifecycle]]
  - affects: [[state-management]]
tags:
  - ui
  - lifecycle
  - refactor
  - setup-flow
created_at: 2026-02-20T16:25:25-06:00
updated_at: 2026-02-20T16:25:25-06:00
uuid: 18a250e5-28d9-4b2a-be2f-ed3a667378fd
---

# Refactor UI lifecycle functions into AppLifecycle with persistent ownership

## Summary

Replaced free lifecycle functions with an `AppLifecycle` class in `src/tunacode/ui/lifecycle.py`.

Updated `TextualReplApp` to persist a single lifecycle instance (`self._lifecycle`) and reuse that instance across `on_mount` and `on_unmount`.

This removes function-level indirection and makes REPL startup idempotent through `_repl_started` inside lifecycle state.

## Files changed

- `src/tunacode/ui/PLAN.md`
- `src/tunacode/ui/lifecycle.py`
- `src/tunacode/ui/app.py`

## Behavior notes

- Theme and session metadata initialization stay in mount flow.
- Setup dismissal still proceeds into REPL startup.
- Slopgotchi timer ownership remains on `TextualReplApp._slopgotchi_timer`, with lifecycle start/stop helpers managing it.
- `on_unmount` now fails loudly if lifecycle was never initialized.

## Validation

- `uv run ruff check src/tunacode/ui/app.py src/tunacode/ui/lifecycle.py` ✅
- `uv run pytest tests/unit/ui/test_supported_themes.py -q` ✅
- `uv run ruff check .` ✅

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.