Files
calctext/_bmad-output/implementation-artifacts/11-4-interactive-repl.md
2026-03-16 19:54:53 -04:00

43 lines
1.4 KiB
Markdown

---
epic: 11
story: 11.4
title: "Interactive REPL"
status: draft
---
## Epic 11 — CLI Tool
**Goal:** Command-line tool for scripting and automation, same Rust engine.
### Story 11.4: Interactive REPL
As a power user,
I want an interactive CalcPad session in my terminal,
So that I can iteratively build up calculations with persistent variables.
**Acceptance Criteria:**
**Given** the user runs `calcpad --repl`
**When** the REPL starts
**Then** a prompt is displayed (e.g., `> `) indicating readiness for input
**And** the REPL session begins with a clean variable scope
**Given** the user is in the REPL
**When** they type `x = 10` and press Enter, then type `x * 5` and press Enter
**Then** the first line outputs `10` and the second line outputs `50`
**And** variables persist for the duration of the session
**Given** the user is in the REPL
**When** they press the Up arrow key
**Then** the previous expression is recalled into the input line
**And** history navigation (up/down) works via rustyline or equivalent library
**Given** the user is in the REPL
**When** they type `exit`, `quit`, or press `Ctrl+D`
**Then** the REPL session ends cleanly
**And** the process exits with code 0
**Given** the user enters an invalid expression in the REPL
**When** they press Enter
**Then** an error message is displayed inline
**And** the REPL continues to accept input (does not crash or exit)