clink/AGENTS.md
Syahdan b94670f138 feat(order-console): add pricing, recent order feed, and responsive layout; extend protocol
Client:
- Add menuItem.Price; show prices in menu and compute totals from server ack
- Track and render recent “[order] …” broadcasts in right column
- Responsive layout with header/body/footer and window size handling
- Listen for server broadcasts after connect; keep last 10 orders
- Parse ORDER ack as “OK|<total>”; display “Total: $<amount>”
- Split view rendering into header/left/right/footer helpers
- Enhance form options to include “Name - $Price”
- Add width/height state; remove fixed 80-col assumption

Server:
- Extend defaultMenu with prices
- Compute total = qty × price; broadcast “[order] … ($xx.xx)”
- Acknowledge ORDER with “OK|<total>” instead of plain “OK”

Proto/UX:
- MENU returns items with price
- ORDER response now includes total for client display
2025-10-16 12:47:38 +07:00

1.0 KiB

Agent Guidelines for clink

Build & Test Commands

  • Build: go build -o clink .
  • Cross-compile: ./build.sh (creates binaries in dist/ for all platforms)
  • Run client: go run . -host localhost:9000
  • Run server: go run . -server -host localhost:9000
  • Test: go test ./... (currently no tests)
  • Format: gofmt -w .
  • Lint: go vet ./...

Code Style

  • Imports: Standard library first, then third-party (blank line between), use named imports for clarity (e.g., tea "github.com/charmbracelet/bubbletea")
  • Formatting: Use gofmt, tabs for indentation
  • Types: Explicit types, struct fields exported when needed for JSON/external use
  • Naming: CamelCase for exports, camelCase for private, descriptive names (e.g., connectedMsg, fetchMenuCmd)
  • Error handling: Check all errors explicitly, wrap with fmt.Errorf("context: %w", err) for context
  • Comments: Minimal, only for public APIs or complex logic
  • Concurrency: Use channels and goroutines for I/O operations (see connectCmd, Hub.Run)