feat(api): backend prereqs for CLI v1
Merged
SA
6mo ago+425+425+012345678901234567890123456789-205-205-012345678901234567890123456789
Summary
Lands the cloud + desktop changes the new CLI depends on, ahead of the CLI itself, so the next CLI PR can stack cleanly.
- task router:
task.list(filters + pagination),task.byIdOrSlug,task.create. Keepstask.allandtask.createFromUias deprecated aliases so the shipped CLI onmainkeeps compiling against this backend during the rollout.task.updateaccepts-but-ignores the deprecatedbranchfield for the same reason. - automation router: list / create / update / delete / run-now shape the CLI talks to.
- host router: list / checkAccess / setOnline shape the CLI talks to.
- v2-workspace router:
workspace.listand create entry points the CLI uses. - web:
cli/authorizeandoauth/consentflows +pendingAuthRedirectutil. - desktop / mobile: drop unused
sessionHostscollection registrations. - host-service: project router shape adjustments.
CLI sources land in a follow-up PR stacked on top of this one.
Test plan
-
bun run typecheckclean -
bun run lint:fixclean - CLI on
maincontinues to compile/run against this backend (deprecated aliases verified) -
task.listfilters (priority/status/assignee/search) return expected rows -
automationcreate + dispatch works end-to-end -
cli/authorize+oauth/consentround-trip on web
Summary by cubic
Preps the backend for CLI v1 with new task/host/workspace/automation endpoints and improved sign-in redirects. Also tightens CLI OAuth callback validation, adds stricter automation input checks, and improves JWT auth fallback.
-
New Features
- Tasks: added
task.list(filters + pagination incl.assigneeMe,creatorMe,search),task.byIdOrSlug, and unifiedtask.create; kepttask.allandtask.createFromUias temporary aliases;task.updateaccepts-but-ignores deprecatedbranch. - Automation: list/create/update/delete/run-now;
createacceptsv2ProjectIdorv2WorkspaceIdand derives the project when a workspace is given; one of the two is required. - Hosts: added
host.listscoped to the user’s orgs and membership. - Workspaces: added
v2-workspace.listwith org and optional host filter; includes project info. - Web:
/cli/authorizeand/oauth/consentnow rely onproxyto preserve and restore the full path + query via?redirect=....
- Tasks: added
-
Bug Fixes
- Automation:
createnow validatesv2ProjectIdandv2WorkspaceIdconsistency (must match when both provided) and verifiesv2ProjectIdbelongs to the org when no workspace is given. - CLI OAuth: tightened
redirect_urivalidation by parsing withURLand requiring http loopback with no userinfo. - Auth:
jwtProcedurenow re-throwsTRPCErrorfromverifyJWTand falls back to session only for unverifiable tokens; clearer bearer token errors. - Tasks:
task.listsearch escapes%and_before building theilikepattern.
- Automation:
Summary by CodeRabbit
-
New Features
- Task listing with filters and lookup by ID or slug
- New host and workspace listing endpoints (organization-scoped)
- Project list now returns richer project metadata
-
Bug Fixes
- Preserves original destination when redirecting to sign-in
- Improved JWT handling with clearer error messaging and session fallback
- Tighter redirect URI validation for CLI/oauth flows
-
Refactor
- Unified task creation flow; removed automatic remote task-create calls from local insert hooks