AGENTS.md
1376 bytes
RPN Calculator
Structure
main.gocomposes the calculator and terminal UI.rpn/lexer.gotokenizes calculator input.rpn/rpn.gois terminal-free: it evaluates tokens against the stack and exposes calculator events and stack snapshots.rpn/stack.go,rpn/token.go, andrpn/parser.godefine the stack, token types, and input cursor.rpn/rpn_test.gocovers calculator evaluation, events, and stack snapshots.tui/application.gorenders the tview interface and owns terminal input, layout, status messages, help, and exit behavior.
Local Development
Run the following from the repository root:
go test ./...
go vet ./...
golangci-lint run
Gotchas
- Do not run
go run .or the compiled REPL from an agent loop. It waits indefinitely for terminal input. Use the compile, test, vet, and lint commands above for automated verification; test the REPL manually in a real terminal when necessary. - The terminal UI uses
github.com/rivo/tview. Do not combine it with readline or direct ANSI cursor handling: tview owns raw terminal input and rendering. - Keep
rpnindependent of tview and terminal output. Exchange calculator events and copied stack snapshots through its public API instead. golangci-lintis the project lint command. Error strings must begin with lowercase letters to satisfy its staticcheck configuration.