Skip to content

Feat/task section updates#430

Merged
zero-my merged 4 commits intolarksuite:mainfrom
zero-my:feat/task-section-updates
Apr 12, 2026
Merged

Feat/task section updates#430
zero-my merged 4 commits intolarksuite:mainfrom
zero-my:feat/task-section-updates

Conversation

@zero-my
Copy link
Copy Markdown
Collaborator

@zero-my zero-my commented Apr 12, 2026

Summary

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark xxx command works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added optional --section-guid parameter to place tasks into a specific custom section within tasklists (falls back to default section when omitted)
  • Documentation

    • Added sections API resource methods: create, delete, get, list, patch, tasks
    • Updated guidance and examples for the --section-guid parameter
  • Tests

    • Added an end-to-end test verifying successful task addition with --section-guid

@github-actions github-actions Bot added domain/task PR touches the task domain size/M Single-domain feat or fix with limited business impact labels Apr 12, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b0112aeb-59be-4ae3-aa40-6a317f42337b

📥 Commits

Reviewing files that changed from the base of the PR and between a55c04d and 065fc0e.

📒 Files selected for processing (3)
  • shortcuts/task/tasklist_add_task.go
  • shortcuts/task/tasklist_add_task_test.go
  • skills/lark-task/SKILL.md
✅ Files skipped from review due to trivial changes (1)
  • skills/lark-task/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • shortcuts/task/tasklist_add_task_test.go
  • shortcuts/task/tasklist_add_task.go

📝 Walkthrough

Walkthrough

Added an optional --section-guid flag to the AddTaskToTasklist shortcut; DryRun and Execute now include section_guid in request bodies when provided. Added a unit test for the flag and updated task-related CLI/skill documentation to document sections APIs and the new parameter.

Changes

Cohort / File(s) Summary
Task Shortcut Implementation
shortcuts/task/tasklist_add_task.go
Added optional section-guid shortcut flag; conditionally trim and set section_guid in DryRun and Execute request bodies when non-empty.
Tests
shortcuts/task/tasklist_add_task_test.go
Added TestAddTaskToTasklist_Success to exercise --section-guid flow, register HTTP mock for POST /open-apis/task/v2/tasks/{task}/add_tasklist, and assert expected JSON output.
Documentation: Skill & CLI
skills/lark-task/SKILL.md, skills/lark-task/references/lark-task-tasklist-task-add.md
Documented new sections resource and methods with permission scopes; added --section-guid parameter description and example for adding tasks into a specific section.

Sequence Diagram(s)

(Skipped — changes are minor flag+request-body handling, tests, and docs; no new multi-component flow requiring visualization.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • LuckyTerry
  • liangshuo-1
  • tengchengwei

Poem

🐰 I hopped through flags both new and neat,
A tiny guid to help tasks meet,
CLI hums, API nods,
Sections line up like welcoming pods,
A carrot-coded cheer — concise and sweet! 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is incomplete. It contains only placeholder text ('Change 1', 'Change 2', 'lark xxx') without actual details about the implemented changes, test coverage specifics, or related issues. Fill in the Summary with motivation for task section support, list actual changes (section-guid flag, test, documentation updates), specify which tests pass, and confirm manual verification steps.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title is partially related to the changeset. It mentions 'task section updates,' which aligns with the feature of adding a section-guid flag to task management and new sections API documentation, but it is somewhat generic and does not highlight the specific main change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 12, 2026

Greptile Summary

This PR adds an optional --section-guid parameter to the +tasklist-task-add command, allowing tasks to be placed into a specific custom section of a tasklist rather than the default section. The implementation is symmetric across DryRun and Execute, correctly trims whitespace, and conditionally omits the field when not provided. Documentation and sections-resource permissions in SKILL.md are also updated.

Confidence Score: 5/5

Safe to merge; all remaining findings are minor suggestions that do not affect correctness.

The core implementation is correct — section_guid is properly handled in both DryRun and Execute paths. The only open items are a P2 suggestion to echo section_guid in the output and the pre-existing test coverage gap (already noted in prior review threads). Neither blocks merge.

shortcuts/task/tasklist_add_task_test.go — test coverage for the section_guid request body is still incomplete.

Important Files Changed

Filename Overview
shortcuts/task/tasklist_add_task.go Adds optional --section-guid flag; correctly conditionally includes section_guid in both DryRun and Execute request bodies. Minor: section_guid is not echoed in the command output.
shortcuts/task/tasklist_add_task_test.go New test file with copyright header present; test only asserts on tasklist_guid in output and does not verify section_guid reaches the HTTP request body via stub.CapturedBody.
skills/lark-task/SKILL.md Adds sections resource API methods and corresponding scope permissions to the skill documentation; entries look consistent with existing resource/scope patterns.
skills/lark-task/references/lark-task-tasklist-task-add.md Adds example usage and parameter description for --section-guid; documentation is clear and consistent with existing style.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as lark-cli (Execute)
    participant API as Lark Task API

    User->>CLI: +tasklist-task-add --tasklist-id tl-123 --task-id task-1,task-2 --section-guid sec-456
    CLI->>CLI: extractTasklistGuid("tl-123")
    CLI->>CLI: build body {tasklist_guid, section_guid}

    loop for each task-id
        CLI->>API: POST /open-apis/task/v2/tasks/{taskId}/add_tasklist
        note right of API: body: {tasklist_guid, section_guid}
        API-->>CLI: {code:0, data:{task:{guid,url}}}
        CLI->>CLI: append to successful / failed
    end

    CLI-->>User: JSON {successful_tasks, failed_tasks, tasklist_guid}
Loading

Reviews (3): Last reviewed commit: "Merge branch 'feat/tasklist-add-section-..." | Re-trigger Greptile

Comment thread shortcuts/task/tasklist_add_task_test.go
Comment thread shortcuts/task/tasklist_add_task_test.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
shortcuts/task/tasklist_add_task.go (1)

44-46: Trim --section-guid before deciding whether to send it.

A whitespace-only flag value currently passes the non-empty check and can produce an invalid section_guid payload.

Proposed fix
-		if sectionGuid := runtime.Str("section-guid"); sectionGuid != "" {
+		if sectionGuid := strings.TrimSpace(runtime.Str("section-guid")); sectionGuid != "" {
 			body["section_guid"] = sectionGuid
 		}
...
-		if sectionGuid := runtime.Str("section-guid"); sectionGuid != "" {
+		if sectionGuid := strings.TrimSpace(runtime.Str("section-guid")); sectionGuid != "" {
 			body["section_guid"] = sectionGuid
 		}

Also applies to: 65-67

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/task/tasklist_add_task.go` around lines 44 - 46, Trim the
--section-guid flag value before deciding to include it in the payload: call
strings.TrimSpace on runtime.Str("section-guid") (e.g., assign trimmed :=
strings.TrimSpace(runtime.Str("section-guid"))) and only set
body["section_guid"] = trimmed when trimmed != ""; apply the same change to the
second occurrence at the other runtime.Str("section-guid") check (lines around
the body assignment at 65-67) and add the strings import if missing.
shortcuts/task/tasklist_add_task_test.go (1)

14-25: Test does not verify the new section-guid behavior end-to-end.

The test passes --section-guid but only asserts tasklist_guid in output. Please also assert the outgoing request body contains section_guid, otherwise regressions in the new feature can slip through.

Also applies to: 30-38

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/task/tasklist_add_task_test.go` around lines 14 - 25, The test
registers an httpmock.Stub (reg.Register(&httpmock.Stub{...})) for the POST
add_tasklist call but never verifies the outgoing request includes the new
"section_guid" field when the test runs with --section-guid; update the stub or
the test harness to assert the request body contains "section_guid" with the
expected value (e.g. add a Body matcher or inspect the recorded request in the
test and assert reqBody["section_guid"] == "expected-guid") in the
tasklist_add_task_test.go test (and repeat the same assertion for the other
similar cases referenced around lines 30-38) so the feature is exercised
end-to-end.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@shortcuts/task/tasklist_add_task_test.go`:
- Line 1: Add the required project license header at the top of the test file
before the package declaration to satisfy license-eye; update
shortcuts/task/tasklist_add_task_test.go by inserting the standard license block
above the existing "package task" line so the file begins with the approved
license header followed by the package declaration.

---

Nitpick comments:
In `@shortcuts/task/tasklist_add_task_test.go`:
- Around line 14-25: The test registers an httpmock.Stub
(reg.Register(&httpmock.Stub{...})) for the POST add_tasklist call but never
verifies the outgoing request includes the new "section_guid" field when the
test runs with --section-guid; update the stub or the test harness to assert the
request body contains "section_guid" with the expected value (e.g. add a Body
matcher or inspect the recorded request in the test and assert
reqBody["section_guid"] == "expected-guid") in the tasklist_add_task_test.go
test (and repeat the same assertion for the other similar cases referenced
around lines 30-38) so the feature is exercised end-to-end.

In `@shortcuts/task/tasklist_add_task.go`:
- Around line 44-46: Trim the --section-guid flag value before deciding to
include it in the payload: call strings.TrimSpace on runtime.Str("section-guid")
(e.g., assign trimmed := strings.TrimSpace(runtime.Str("section-guid"))) and
only set body["section_guid"] = trimmed when trimmed != ""; apply the same
change to the second occurrence at the other runtime.Str("section-guid") check
(lines around the body assignment at 65-67) and add the strings import if
missing.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a98aaf10-ed16-4124-aacb-27d77748b4a0

📥 Commits

Reviewing files that changed from the base of the PR and between 0e7f507 and aec407b.

📒 Files selected for processing (4)
  • shortcuts/task/tasklist_add_task.go
  • shortcuts/task/tasklist_add_task_test.go
  • skills/lark-task/SKILL.md
  • skills/lark-task/references/lark-task-tasklist-task-add.md

Comment thread shortcuts/task/tasklist_add_task_test.go
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 12, 2026

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@065fc0e34f3f3c24e0e01090e8a141d438b24ce6

🧩 Skill update

npx skills add zero-my/cli#feat/task-section-updates -y -g

@zero-my zero-my force-pushed the feat/task-section-updates branch from aec407b to a55c04d Compare April 12, 2026 07:51
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@shortcuts/task/tasklist_add_task.go`:
- Around line 44-47: Trim the value returned by runtime.Str("section-guid")
before checking emptiness and adding body["section_guid"]; i.e., assign a
trimmed variable (e.g., sectionGuid :=
strings.TrimSpace(runtime.Str("section-guid"))) then if sectionGuid != "" set
body["section_guid"] = sectionGuid. Apply the same pattern to the other
conditional that reads a runtime.Str and sets a body field (the second
occurrence around the other body[...] assignment) so whitespace-only input is
rejected there as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44807091-7e59-4e19-bfa2-57ddc2fdcbae

📥 Commits

Reviewing files that changed from the base of the PR and between aec407b and a55c04d.

📒 Files selected for processing (3)
  • shortcuts/task/tasklist_add_task.go
  • shortcuts/task/tasklist_add_task_test.go
  • skills/lark-task/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • skills/lark-task/SKILL.md
  • shortcuts/task/tasklist_add_task_test.go

Comment thread shortcuts/task/tasklist_add_task.go Outdated
@zero-my zero-my force-pushed the feat/task-section-updates branch from a55c04d to 065fc0e Compare April 12, 2026 08:02
@zero-my zero-my merged commit f6b8091 into larksuite:main Apr 12, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/task PR touches the task domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants