Skip to content

wk folders update cannot move a folder to a new parent #97

Description

@Abhishek-Bhatta

Behavior

wk folders update <id> --name <new> can rename a folder or project, but there's
no way to move a folder to a different parent. internal/commands/folder.go
only registers a --name flag, and folderService.Update() in
internal/api/folders.go only ever sends {"name": name} to PUT /folders/{id}.

Verified against the live API

PUT /folders/{id} accepts a parent_id field and actually performs the move:

curl -X PUT .../api/folders/32091444 -d '{"parent_id": 32091445}'
→ {"id":32091444,...,"parent_id":32091445,...}   # 200, applied

Confirmed with wk folders list --parent <new-parent> showing the folder
correctly nested afterward, and a recipe inside it (folder_id unchanged)
transitively moved along with its containing folder.

So this is the exact same endpoint wk already calls for rename. The client
just never sends the second field.

Fix

Adding wk folders move <id> --parent <id> as its own command, mirroring
wk recipes move (a separate explicit opt-in from update, same reasoning:
update shouldn't relocate something as a side effect). Already implemented
and tested locally, PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions