Bug
ResolveWorkspaceID in cmd/ws/client.go calls GET /rest/api/v1/workspaces/{key}, but that endpoint only accepts numeric IDs. Passing a workspace key like "CP" returns Invalid ID: must be numeric, which the CLI surfaces as:
Error: failed to resolve workspace: workspace not found: CP
This breaks every CLI command that depends on workspace resolution (ws task ls, ws workspace info, etc.) when configured with a workspace key.
Steps to reproduce
ws config init # set workspace_key = "CP"
ws task ls # fails: "workspace not found: CP"
Meanwhile ws workspace ls works fine — because it calls the list endpoint.
Fix
Replace the single-workspace GET with a list + match (branch):
- // Look up by key
- var ws Workspace
- if err := c.GET("/rest/api/v1/workspaces/"+url.PathEscape(keyOrID), &ws); err != nil {
- return 0, fmt.Errorf("workspace not found: %s", keyOrID)
+ // Look up by key from workspace list
+ workspaces, err := c.ListWorkspaces()
+ if err != nil {
+ return 0, fmt.Errorf("failed to list workspaces: %w", err)
+ }
+
+ upperKey := strings.ToUpper(keyOrID)
+ for _, ws := range workspaces.Data {
+ if strings.ToUpper(ws.Key) == upperKey {
+ return ws.ID, nil
+ }
}
- return ws.ID, nil
+
+ return 0, fmt.Errorf("workspace not found: %s", keyOrID)
Tested: ws task ls, ws workspace info CP, and numeric IDs all work after this change.
Note: CONTRIBUTING.md asks for PRs on Codeberg. The fix branch is at https://github.com/stanleyswiss/core/tree/fix/resolve-workspace-by-key — happy to re-submit on Codeberg if preferred.
Bug
ResolveWorkspaceIDincmd/ws/client.gocallsGET /rest/api/v1/workspaces/{key}, but that endpoint only accepts numeric IDs. Passing a workspace key like"CP"returnsInvalid ID: must be numeric, which the CLI surfaces as:This breaks every CLI command that depends on workspace resolution (
ws task ls,ws workspace info, etc.) when configured with a workspace key.Steps to reproduce
Meanwhile
ws workspace lsworks fine — because it calls the list endpoint.Fix
Replace the single-workspace GET with a list + match (branch):
Tested:
ws task ls,ws workspace info CP, and numeric IDs all work after this change.