# Architecture Testapp is a Python CLI built around a REPL (Read-Eval-Print Loop). ## Structure ``` src/ __init__.py — package marker main.py — entry point; contains the REPL loop commands.py — command registry and handlers tests/ __init__.py test_commands.py test_main.py requirements.txt — pytest (dev) ``` ## Command registry `src/commands.py` defines two things: - `COMMAND_DESCRIPTIONS` — `{name: one-line description}` used by `help` - `COMMANDS` — `{name: callable}` mapping command names to handler functions Every handler takes no arguments and returns a string. The REPL prints that string. To add a new command: 1. Define a handler function `_my_command() -> str` 2. Add it to `COMMAND_DESCRIPTIONS` with a description 3. Add it to `COMMANDS` under its name ## REPL loop (`src/main.py`) ``` print welcome message loop: print "> " prompt read input → strip whitespace → lowercase if empty: skip if in COMMANDS: call handler, print result else: print "Unknown command" error on KeyboardInterrupt: exit loop cleanly ```