Skip to content

feat: add wiki move-to-drive shortcut#1869

Open
liujinkun2025 wants to merge 2 commits into
mainfrom
feat/wiki-move-to-docs
Open

feat: add wiki move-to-drive shortcut#1869
liujinkun2025 wants to merge 2 commits into
mainfrom
feat/wiki-move-to-docs

Conversation

@liujinkun2025

@liujinkun2025 liujinkun2025 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add wiki +move-to-drive to move an existing Wiki node into a Drive folder or the caller personal-space root. The shortcut submits the asynchronous Wiki API request, polls task status, and returns a resumable command when the bounded polling window expires.

Changes

  • Add the wiki +move-to-drive shortcut with optional --folder-token support.
  • Poll the Wiki task endpoint with the fixed backend task_type=move_wiki_to_docs and parse move_wiki_to_docs_result.
  • Add the wiki_move_to_drive scenario to the shared drive +task_result continuation command.
  • Preserve the resolved --profile and --as identity in generated continuation commands.
  • Add focused unit coverage, dry-run E2E coverage, and a self-contained live E2E workflow.
  • Update Wiki and Drive skill documentation to use the move-to-drive terminology.

Test Plan

  • Affected Wiki and Drive race tests pass
  • Fresh-binary dry-run E2E passes: TestWikiMoveToDriveDryRun
  • make build
  • make quality-gate QUALITY_GATE_CHANGED_FROM=origin/main
  • go vet ./...
  • gofmt -l . produces no output
  • go mod tidy -diff produces no diff
  • golangci-lint reports 0 issues
  • Full make unit-test still hits existing schema baseline failures in cmd/schema and internal/schema; all affected shortcut packages pass
  • Live E2E is included but was not run locally because the available app lacks drive:drive and space:folder:create

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Added wiki +move-to-drive to move Wiki nodes into a Drive folder or the personal “我的空间” root via an async task.
    • Extended drive +task_result with the wiki_move_to_drive scenario, including polling orchestration, scope enforcement, and enriched result fields.
  • Improvements
    • Enhanced numeric extraction to correctly distinguish valid 0 values from missing or malformed data.
  • Documentation
    • Updated Wiki/Drive quick-decision guidance and reference docs with the proper command to use and what to avoid.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths labels Jul 13, 2026
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af370650-3e2e-4f50-8438-9955937b2b60

📥 Commits

Reviewing files that changed from the base of the PR and between 520d300 and 039d729.

📒 Files selected for processing (17)
  • shortcuts/common/extract.go
  • shortcuts/common/extract_test.go
  • shortcuts/drive/drive_task_result.go
  • shortcuts/drive/drive_task_result_test.go
  • shortcuts/wiki/shortcuts.go
  • shortcuts/wiki/wiki_move_to_drive.go
  • shortcuts/wiki/wiki_move_to_drive_test.go
  • skill-template/domains/drive.md
  • skill-template/domains/wiki.md
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-move.md
  • skills/lark-drive/references/lark-drive-task-result.md
  • skills/lark-wiki/SKILL.md
  • skills/lark-wiki/references/lark-wiki-move-to-drive.md
  • skills/lark-wiki/references/lark-wiki-move.md
  • tests/cli_e2e/wiki/wiki_move_to_drive_dryrun_test.go
  • tests/cli_e2e/wiki/wiki_move_to_drive_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (14)
  • shortcuts/wiki/shortcuts.go
  • shortcuts/common/extract_test.go
  • shortcuts/common/extract.go
  • skill-template/domains/wiki.md
  • skills/lark-wiki/references/lark-wiki-move.md
  • shortcuts/wiki/wiki_move_to_drive.go
  • skill-template/domains/drive.md
  • tests/cli_e2e/wiki/wiki_move_to_drive_workflow_test.go
  • skills/lark-wiki/references/lark-wiki-move-to-drive.md
  • tests/cli_e2e/wiki/wiki_move_to_drive_dryrun_test.go
  • shortcuts/drive/drive_task_result_test.go
  • skills/lark-drive/references/lark-drive-task-result.md
  • shortcuts/wiki/wiki_move_to_drive_test.go
  • skills/lark-drive/references/lark-drive-move.md

📝 Walkthrough

Walkthrough

Adds wiki +move-to-drive with asynchronous task polling, timeout continuation, and Drive task-result support. It also adds numeric extraction presence reporting, updates Wiki/Drive routing documentation, and introduces unit, dry-run, and live workflow coverage.

Changes

Wiki Move-to-Drive Workflow

Layer / File(s) Summary
Move-to-drive command and request contract
shortcuts/wiki/wiki_move_to_drive.go, shortcuts/wiki/shortcuts.go, shortcuts/wiki/wiki_move_to_drive_test.go
Adds the shortcut, token validation, optional folder targeting, move/task API request construction, and contract tests.
Async polling and resumable execution
shortcuts/wiki/wiki_move_to_drive.go, shortcuts/wiki/wiki_move_to_drive_test.go
Adds bounded status polling, result parsing, timeout resume commands, cancellation handling, and typed error coverage.
Task-result scenario integration
shortcuts/drive/drive_task_result.go, shortcuts/drive/drive_task_result_test.go
Adds wiki_move_to_drive validation, dry-run and runtime dispatch, scope enforcement, normalized task results, and malformed-response tests.
Numeric extraction presence contract
shortcuts/common/extract.go, shortcuts/common/extract_test.go
Adds GetFloatOK while preserving GetFloat behavior and tests valid zero versus malformed or missing values.
Command routing documentation
skill-template/domains/*, skills/lark-drive/*, skills/lark-wiki/*
Documents Wiki-to-Drive routing, command distinctions, continuation requirements, permissions, and the new shortcut reference.
CLI end-to-end workflows
tests/cli_e2e/wiki/wiki_move_to_drive_*
Adds dry-run request-shape coverage and live workflow validation for task completion, source removal, target discovery, and cleanup.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • larksuite/cli#194: Introduces the drive +task_result scaffold extended by this change.
  • larksuite/cli#436: Adds related Wiki task-result scenario plumbing.
  • larksuite/cli#610: Extends the same task-result dispatch and scope-handling paths for another Wiki scenario.

Suggested labels: feature

Suggested reviewers: fangshuyu-768, wittam-01

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant WikiMoveToDrive
  participant WikiAPI
  participant DriveTaskResult
  CLI->>WikiMoveToDrive: submit move request
  WikiMoveToDrive->>WikiAPI: POST move_wiki_to_docs
  WikiAPI-->>WikiMoveToDrive: return task_id
  WikiMoveToDrive->>WikiAPI: poll task status
  WikiAPI-->>WikiMoveToDrive: return status and moved object
  WikiMoveToDrive-->>CLI: return ready or timed_out result
  CLI->>DriveTaskResult: resume with task_id
  DriveTaskResult->>WikiAPI: GET task result with task_type
  WikiAPI-->>DriveTaskResult: return normalized task result
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.58% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the wiki move-to-drive shortcut.
Description check ✅ Passed The description matches the required template and includes a summary, changes, test plan, and related issues.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wiki-move-to-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@039d729827584d76e7554aff96c79e15dcf35a5d

🧩 Skill update

npx skills add larksuite/cli#feat/wiki-move-to-docs -y -g

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.34921% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.71%. Comparing base (37d490a) to head (039d729).

Files with missing lines Patch % Lines
shortcuts/wiki/wiki_move_to_drive.go 86.61% 24 Missing and 8 partials ⚠️
shortcuts/drive/drive_task_result.go 85.29% 7 Missing and 3 partials ⚠️
shortcuts/common/extract.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1869      +/-   ##
==========================================
+ Coverage   74.66%   74.71%   +0.04%     
==========================================
  Files         877      878       +1     
  Lines       91731    92033     +302     
==========================================
+ Hits        68494    68761     +267     
- Misses      17926    17954      +28     
- Partials     5311     5318       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liujinkun2025 liujinkun2025 force-pushed the feat/wiki-move-to-docs branch from 0a091e6 to 520d300 Compare July 14, 2026 03:31
@liujinkun2025 liujinkun2025 changed the title feat: add wiki move-to-docs shortcut feat: add wiki move-to-drive shortcut Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
shortcuts/drive/drive_task_result.go (1)

505-573: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Extract shared wiki move-to-drive status parsing

queryWikiMoveToDriveTask duplicates the same status/result-shape parsing already in shortcuts/wiki/wiki_move_to_drive.go::parseWikiMoveToDriveTaskStatus. Pulling that contract into a helper (for example under shortcuts/common) would keep the allowed status set and status_msg fallback in sync across both pollers.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shortcuts/drive/drive_task_result.go` around lines 505 - 573, Extract the
shared status/result parsing logic from queryWikiMoveToDriveTask and wiki
move-to-drive’s parseWikiMoveToDriveTaskStatus into a common helper, reusing it
from both pollers. Preserve the existing validation of numeric statuses, allowed
values (-1, 0, 1), and status_msg fallbacks while keeping each caller’s
task-specific resource fields and response shaping unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@shortcuts/drive/drive_task_result.go`:
- Around line 505-573: Extract the shared status/result parsing logic from
queryWikiMoveToDriveTask and wiki move-to-drive’s parseWikiMoveToDriveTaskStatus
into a common helper, reusing it from both pollers. Preserve the existing
validation of numeric statuses, allowed values (-1, 0, 1), and status_msg
fallbacks while keeping each caller’s task-specific resource fields and response
shaping unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ab7dc6cb-ca9e-479c-92a8-c692ce113fec

📥 Commits

Reviewing files that changed from the base of the PR and between 0a091e6 and 520d300.

📒 Files selected for processing (17)
  • shortcuts/common/extract.go
  • shortcuts/common/extract_test.go
  • shortcuts/drive/drive_task_result.go
  • shortcuts/drive/drive_task_result_test.go
  • shortcuts/wiki/shortcuts.go
  • shortcuts/wiki/wiki_move_to_drive.go
  • shortcuts/wiki/wiki_move_to_drive_test.go
  • skill-template/domains/drive.md
  • skill-template/domains/wiki.md
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-move.md
  • skills/lark-drive/references/lark-drive-task-result.md
  • skills/lark-wiki/SKILL.md
  • skills/lark-wiki/references/lark-wiki-move-to-drive.md
  • skills/lark-wiki/references/lark-wiki-move.md
  • tests/cli_e2e/wiki/wiki_move_to_drive_dryrun_test.go
  • tests/cli_e2e/wiki/wiki_move_to_drive_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (4)
  • shortcuts/wiki/shortcuts.go
  • skill-template/domains/drive.md
  • shortcuts/common/extract_test.go
  • skill-template/domains/wiki.md

@liujinkun2025 liujinkun2025 force-pushed the feat/wiki-move-to-docs branch from 520d300 to 039d729 Compare July 14, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant