Enhancement: set wiki node position among siblings on move/create

Open
#2,828 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go, openapi
Domain
api, cli

Research direction

Start with the wiki +move and wiki +node-create command definitions and the SDK's service/wiki/v2 request types, including MoveSpaceNodeReqBody. Check whether the upstream Lark Open API now supports a sibling-position field; the matching larksuite/oapi-sdk-go request may determine when this work can begin. Done means the supported ordering option is exposed by both commands and behaves as documented for move and create.

Written by the indexing model from the issue text.

Description

domain/wiki

Summary

Please let wiki +move and wiki +node-create say where a node should go among its siblings, not just which parent it goes under.

Current behaviour

lark-cli wiki +move (v1.0.98) accepts --node-token, --target-parent-token, --target-space-id, --source-space-id, --obj-type / --obj-token and --apply. +node-create likewise only takes a parent. Lark decides where the node lands among its siblings, and the order can only be changed by dragging the node in the web UI.

This is a gap in the Open API rather than in the CLI: POST /open-apis/wiki/v2/spaces/:space_id/nodes/:node_token/move only accepts target_parent_token and target_space_id, and node create has no position field. So this request is really for the API, with CLI flags to follow. I filed a matching request on larksuite/oapi-sdk-go.

Proposed enhancement

Any one of these would solve it:

  1. An optional prev_node_token (or before / after sibling token) on the move and create endpoints, exposed as e.g. --after-node-token / --before-node-token.
  2. A writable sort_id on move and create, exposed as --sort-id.
  3. A dedicated reorder endpoint that moves a node among its current siblings without changing its parent, e.g. lark-cli wiki +node-reorder --node-token X --after-node-token Y.

Why

The wiki is a natural target for automated publishing: release notes, changelogs, runbooks and generated reports written by CI or by agents through lark-cli. Those trees have a meaningful order, such as newest release first or chapters in sequence. Today every automated publish lands in a position the publisher can't control, so a person has to open the wiki and drag the node into place after each run. That makes a fully automated pipeline impossible and lets the tree drift out of order whenever someone forgets.

The workarounds aren't good. One parent folder per item fragments the tree. Prefixing titles with dates or versions changes the titles readers see and still doesn't control the displayed order. A hand-kept index page duplicates the tree it's meant to describe.

Lark's own UI already supports placing a node anywhere among its siblings, so this would bring the API and CLI up to what the product can already do.

Environment

  • lark-cli 1.0.98
  • Also checked: github.com/larksuite/oapi-sdk-go/v3 v3.12.2, service/wiki/v2 MoveSpaceNodeReqBody
Dominant language
Go
Stars
18.2k
Forks
1.4k
Avg merge
1d 3h
Merged PRs (30d)
18

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from larksuite/cli

All issues in larksuite/cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.