Files
nexu-io__open-design/apps/daemon/tests/project-cli.test.ts
Nicholas-Xiong 9c03ae35ff fix(cli): make od project list honor the signed-in workspace (#6679) (#6736)
* fix(cli): make od project list honor the signed-in workspace (#6679)

od project list always called GET /api/projects (the NO-SCOPE catalog),
which after 0.18.0's workspace isolation returns only projects never
adopted into a workspace.  immediately
workspace-adopts its result, so  reported 0 projects
while the UI listed them (#6679).

Mirror #6595's MCP fix: when no explicit --workspace/--workspace-member
pair is supplied, resolve the signed-in workspace once via
GET /api/workspace/directory (caching the result for 15s to avoid
repeated directory hits during interactive use), then route to
GET /api/workspaces/:id/projects with the workspace headers. When the
directory is unavailable (signed-out, non-vela, or transient outage),
fall back to the original headerless catalog so unbound projects still
appear. An explicit --workspace pair wins and short-circuits the
auto-resolution, preserving the existing behavior.

Refs: #6569, #6595 (MCP bridge fix, cli.ts line 6589 in 0.16.2)
Refs: #6679 (CLI/UI project list inconsistency)
Signed-off-by: xxiaoxiong <2482929840@qq.com>

* fix(cli): route explicit --workspace to the scoped catalog too (#6679)

PerishCode review caught that the implicit signed-in path now uses the
scoped catalog, but an explicit --workspace/--workspace-member pair still
fell back to /api/projects, which is the unbound catalog — passing
--workspace to /api/projects does NOT scope it (#6679 repro). Route both
the implicit resolved identity and the explicit flags through
GET /api/workspaces/:id/projects so the explicit path fixes the same
#6679 behavior the implicit path fixed.

Updates the explicit test case to assert the workspace-scoped URL, and
adds a /api/workspaces/ws-1/projects branch to the test stub server.

Signed-off-by: xxiaoxiong <2482929840@qq.com>

---------

Signed-off-by: xxiaoxiong <2482929840@qq.com>
2026-08-12 07:19:45 +00:00

21 KiB