chore: scaffold tvctl foundation
Set up the Rust crate, baseline module layout, and project docs so the repository matches the design bundle and builds cleanly as a starting point.
This commit is contained in:
+60
@@ -0,0 +1,60 @@
|
||||
# API.md
|
||||
# tvctl HTTP API Specification
|
||||
|
||||
`tvctl` exposes a loopback-only HTTP API for tool builders at `/v1/...`.
|
||||
This file captures the v1 surface promised by the design bundle so the
|
||||
repository has a dedicated API spec from day one.
|
||||
|
||||
## Base URL
|
||||
|
||||
`http://127.0.0.1:7272/v1`
|
||||
|
||||
## Response Envelope
|
||||
|
||||
Successful responses:
|
||||
|
||||
```json
|
||||
{ "ok": true, "data": { "...": "..." } }
|
||||
```
|
||||
|
||||
Error responses:
|
||||
|
||||
```json
|
||||
{
|
||||
"ok": false,
|
||||
"error": {
|
||||
"code": "device_not_found",
|
||||
"message": "No device with id 'living-room' exists.",
|
||||
"hint": "Run tvctl device list to see known devices."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Planned Routes
|
||||
|
||||
- `GET /devices`
|
||||
- `POST /devices/discover`
|
||||
- `GET /devices/{id}`
|
||||
- `DELETE /devices/{id}`
|
||||
- `GET /devices/{id}/state`
|
||||
- `GET /devices/{id}/apps`
|
||||
- `POST /devices/{id}/apps/launch`
|
||||
- `POST /devices/{id}/apps/stop`
|
||||
- `POST /devices/{id}/apps/refresh`
|
||||
- `POST /devices/{id}/remote/key`
|
||||
- `POST /devices/{id}/remote/sequence`
|
||||
- `POST /devices/{id}/dev/install`
|
||||
- `POST /devices/{id}/dev/reload`
|
||||
- `GET /devices/{id}/dev/logs`
|
||||
- `GET /daemon/status`
|
||||
- `GET /config`
|
||||
- `PATCH /config`
|
||||
- `POST /config/reload`
|
||||
|
||||
## API Rules
|
||||
|
||||
- All routes return the standard JSON envelope.
|
||||
- `error.code` values are stable machine contracts.
|
||||
- `error.hint` is optional but recommended for user-actionable failures.
|
||||
- Devices may be addressed by UUID or friendly name.
|
||||
- Platform-specific field names must not leak past the adapter layer.
|
||||
Reference in New Issue
Block a user