mirror repo of https://github.com/littlequartz/clink. a socket programming assignment for Sistem Terdistribusi
Go to file
Syahdan 623bc075eb feat(app): pivot from chat UI to order console with menu/order protocol
Client (main.go):
- Replace chat viewport/textarea with a simple order console UI using Bubble Tea + Huh forms
- Add types and messages for connection, menu loading, order submission, and status
- Implement connectCmd with short greeting drain; status updates on connect
- Implement fetchMenuCmd: send "MENU", parse single-line JSON into []menuItem
- Implement submitOrderCmd: send "ORDER <json>", read single-line ack
- Build interactive form (name, menu select, quantity, confirm) with validation
- Add model state for host, status/loading/error, lastOrder, and form fields
- Keyboard controls: n (new order), r (reconnect), q/esc/ctrl+c (quit)
- Simplify program start (remove pre-connect path); alt-screen only
- Remove chat colorization/regex, viewport, and textarea logic

Server (server.go):
- Define menuItem and order structs; add a defaultMenu
- Extend protocol:
  - "MENU" returns single-line JSON array of menu items
  - "ORDER <json>" validates name/item/quantity (with lenient quantity parsing)
    - Acknowledge with "OK" or send "[error] ..." lines
    - Optionally broadcast "[order] ..." to chat for visibility
- Keep existing chat behavior; integrate new commands alongside it

Notes:
- Server logs ORDER parsing and continues to support chat commands
- Error handling surfaces server-side errors to the client status/messages
2025-10-16 12:46:45 +07:00
.github/workflows ci: fix artifact path 2025-10-15 13:06:10 +07:00
.gitignore chore: gitignore to ignore dist folder 2025-10-15 20:34:09 +07:00
build.sh chore: gitignore to ignore dist folder 2025-10-15 20:34:09 +07:00
go.mod chore: gitignore to ignore dist folder 2025-10-15 20:34:09 +07:00
go.sum chore: gitignore to ignore dist folder 2025-10-15 20:34:09 +07:00
main.go feat(app): pivot from chat UI to order console with menu/order protocol 2025-10-16 12:46:45 +07:00
server.go feat(app): pivot from chat UI to order console with menu/order protocol 2025-10-16 12:46:45 +07:00