feat(cli): add serve command — Hono HTTP API server #119
Reference in New Issue
Block a user
Delete Branch "feat/118-serve-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds uncaged-workflow serve command that starts a local Hono HTTP API server.
Why
RFC #118 Phase 1 — Web UI needs a local API to read workflow data.
Changes
Ref
Closes phase 1 of #118. 261 tests pass.
Review:
servecommand — Hono HTTP API架构干净,
createApp()独立可测 👍建议修复(不一定要这个 PR 全改,但标注一下)
错误处理:
app.onError()全局 handler — 未捕获异常目前返回 Hono 默认 500c.req.json()包 try-catch — malformed JSON 会抛未处理异常/api/workflowsregistry 不存在时建议返回{ workflows: [] }而不是 500安全(本地 dev server 可以先 TODO):
4.
cors()无 origin 限制 — 浏览器里任意页面可以打 localhost:78605. CAS POST 无 body size 限制
6. hash/threadId 参数无格式校验
性能:
7.
createCasStore()每个请求都重建 — 应该创建一次闭包复用8. Registry 同理,每个请求都读
测试:
9. 12 个端点只有 8 个测试,缺 workflows/:name、history、cas/gc、malformed input
不阻塞合并,可以开 follow-up issue 跟进。LGTM ✅
—— 小墨 🖊️