Skip to content

Commit 642851d

Browse files
committed
feat(ui): add ReScript-TEA Cadre router with HAR/script API bridge
1 parent 1aa48fa commit 642851d

14 files changed

Lines changed: 2585 additions & 0 deletions

ui/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
dist/
3+
lib/
4+
src/*.res.js
5+

ui/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Git Scripts UI (ReScript + TEA)
2+
3+
This is a ReScript-TEA UI for `git-scripts` with:
4+
5+
- Cadre-style typed route module (`src/CadreTeaRouter.res`)
6+
- Hybrid Automation Router API wiring (`/api/har/*`)
7+
- Allowlisted script execution API (`/api/scripts/run`)
8+
9+
## Run
10+
11+
```bash
12+
cd /var/mnt/eclipse/repos/git-scripts/ui
13+
npm i
14+
npm run dev
15+
```
16+
17+
`npm run dev` starts:
18+
19+
- API server on `http://127.0.0.1:4077` (`server.mjs`)
20+
- ReScript compiler watch
21+
- Vite dev UI on `http://127.0.0.1:5174`
22+
23+
## Build
24+
25+
```bash
26+
cd /var/mnt/eclipse/repos/git-scripts/ui
27+
rm -f lib/rescript.lock
28+
npm run build
29+
```
30+
31+
## API
32+
33+
- `GET /api/health`
34+
- `GET /api/scripts`
35+
- `POST /api/scripts/run` body: `{ "action": "<allowlisted-action>" }`
36+
- `GET /api/har/status`
37+
- `GET /api/har/targets`
38+
- `POST /api/har/route` body: `{ "category": "filesystem", "target": "optional" }`
39+
40+
## HAR command resolution
41+
42+
The server resolves HAR in this order:
43+
44+
1. `HAR_CMD` environment variable (if set)
45+
2. `hybrid-automation-router/target/release/har`
46+
3. `hybrid-automation-router/target/debug/har`
47+
4. `har` on `PATH`
48+
5. `cargo run -q -p har-cli --` in `hybrid-automation-router`
49+

ui/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Git Scripts Router UI</title>
7+
</head>
8+
<body>
9+
<div id="app"></div>
10+
<script type="module" src="/src/main.js"></script>
11+
</body>
12+
</html>
13+

0 commit comments

Comments
 (0)