๐ŸŽ Get the FREE AI Skills Starter Guide โ€” Subscribe โ†’
BytesAgainBytesAgain
๐Ÿฆ€ ClawHub

lark-doc-reviser

by @billzhuang6569

Read unresolved comments in a Feishu (Lark) document and apply targeted edits block-by-block based on those comments. Use when the user shares a Feishu doc U...

Versionv1.0.0
Downloads456
TERMINAL
clawhub install lark-doc-reviser

๐Ÿ“– About This Skill


name: lark-doc-reviser description: "Read unresolved comments in a Feishu (Lark) document and apply targeted edits block-by-block based on those comments. Use when the user shares a Feishu doc URL and asks to: (1) fetch/show document comments, (2) revise or edit the doc based on comments, (3) process feedback left in a Feishu doc. Requires lark-cli installed and authenticated."

Lark Doc Reviser

Workflow

Step 1 โ€” Fetch doc state

python3 scripts/fetch_doc.py  --out workspace/_state.json

This saves full doc state to workspace/_state.json and prints a summary to stdout:

  • commented_blocks: blocks that have unresolved comments, each with elements, full_text, and comments[]{comment_id, anchor_text, instruction}
  • all_blocks: full block list (no elements, for structural reference)
  • Always save to workspace. The editing process may span multiple sessions.

    Step 2 โ€” Present comments to user

    Show each entry in commented_blocks as:

    [block_type] full_text
      โ†’ ใ€anchor_textใ€‘ instruction
    

    Ask the user to confirm which comments to address, or proceed if the intent is clear.

    Step 3 โ€” Apply text edits

    For each comment requiring a text change, construct a patches list and run:

    python3 scripts/patch_blocks.py  patches.json
    

    patches.json format โ€” elements completely replace the block's existing content:

    [
      {
        "block_id": "doxcnXXXX",
        "elements": [
          {"text": "ๆ™ฎ้€šๆ–‡ๅญ—"},
          {"text": "ๅŠ ็ฒ—", "bold": true},
          {"text": "ไปฃ็ ", "code": true},
          {"text": "ๆ–œไฝ“", "italic": true}
        ]
      }
    ]
    

    Supported element fields: text (required), bold, italic, code, strikethrough, underline.

    Note: update_text_elements clears comment_ids from the elements. This is expected โ€” always resolve addressed comments in Step 4.

    Step 4 โ€” Resolve addressed comments

    python3 scripts/resolve_comments.py   [comment_id ...]
    

    or via stdin:

    echo '["id1","id2"]' | python3 scripts/resolve_comments.py -

    Step 5 โ€” Re-fetch and update state

    Re-run Step 1 to refresh workspace/_state.json after edits.

    Limitations

    These operations are not handled by this skill's scripts and require additional API calls:

  • Insert blank line / empty block: needs Create Block API
  • Delete a block (e.g., remove a divider): needs Delete Block API
  • Structural reordering: needs Move Block API
  • For such operations, use lark-cli api directly or ask the user if they want to handle them manually.

    Warning

    Never use lark-cli docs +update --mode replace_range --selection-by-title to rename a heading. It selects the entire section (heading + all content until next heading) and deletes it all. Use --selection-with-ellipsis "heading text" instead.