Skip to content

CLI & TUI Tools

Overview

Planned command-line and terminal UI tools for interacting with the calculatecost4 system.


vcc CLI (Planned)

Purpose

Local command-line tool for testing order calculations without a browser or curl.

Planned Commands

vcc calculate <order.yaml>       # Calculate cost from YAML file
vcc calculate --json '<json>'    # Calculate from inline JSON
vcc compare <order.yaml>         # Compare new vs old endpoint
vcc validate <order.yaml>        # Validate order schema
vcc health                       # Check endpoint health
vcc version                      # Show version info

Example Usage

Calculate a simple order:

echo '{"productList":[{"cprcode":57822,"productName":"Oil","quantity":1}],"branchId":"1049"}' \
  | vcc calculate --json -

Compare against the original endpoint:

vcc compare test/testData/orderInput1.yaml

Run all fixtures and print a summary:

vcc compare test/testData/*.yaml --summary

Configuration

The CLI reads from ~/.vcc/config.yaml:

endpoints:
  new: https://api.villaecommerce.com/calculatecost4
  old: https://0hbymt9qbk.execute-api.ap-southeast-1.amazonaws.com/Prod/resolveCoupon
output:
  format: table  # table, json, yaml
  color: true

TUI Dashboard (Planned)

Purpose

Terminal UI for monitoring calculatecost4 health, viewing recent calculations, and debugging issues.

Planned Screens

Health Dashboard

+------------------------------------------+
| calculatecost4 Health                     |
+------------------------------------------+
| Endpoint: api.villaecommerce.com         |
| Status:   HEALTHY                         |
| Uptime:   99.97%                          |
| Avg Latency: 450ms                        |
+------------------------------------------+
| Last 5 Calculations                       |
| Order        | Total  | Status | Time    |
| 002500018134 | 385.0  | OK     | 320ms   |
| 492500000852 | 585.0  | OK     | 410ms   |
| 002500074158 | 3636.0 | OK     | 890ms   |
+------------------------------------------+
| Adapter Health                            |
| DynamoDB Pricing    | OK  | 120ms       |
| DynamoDB Product    | OK  | 85ms        |
| HTTP Shipping       | OK  | 200ms       |
| Lambda Coupon       | OK  | 150ms       |
| Lambda Voucher      | OK  | 130ms       |
+------------------------------------------+

Order Detail View

+------------------------------------------+
| Order: 002500018134                       |
+------------------------------------------+
| Branch: 1000  | Products: 1              |
| subTotal: 295.0                           |
| deliveryFee: 90.0                         |
| grandTotal: 385.0                         |
| Coupons: none | Vouchers: none           |
+------------------------------------------+
| Products                                  |
| cprcode | name        | qty | price      |
| 192612  | S-Pure Eggs | 5   | 59.0       |
+------------------------------------------+

Tech Stack (Planned)

Tool Purpose
Textual or Rich TUI rendering
Click or Typer CLI argument parsing
YAML Configuration file format

Gas Town Integration

Both the CLI and TUI integrate with the Gas Town gt and bd (beads) systems:

# View rig status
gt rig status villaCalculateCost4

# List open tasks
bd list --status=open

# Create a new task
bd create --title "Add rate limiting" --type task --priority 3