Skip to content

feat: add attendance user_task.query#405

Open
chengyiming wants to merge 1 commit intolarksuite:mainfrom
chengyiming:fix/leave_attendance_cli
Open

feat: add attendance user_task.query#405
chengyiming wants to merge 1 commit intolarksuite:mainfrom
chengyiming:fix/leave_attendance_cli

Conversation

@chengyiming
Copy link
Copy Markdown

@chengyiming chengyiming commented Apr 10, 2026

Change-Id: I0c99b2178dd874f2a9f0e30ed8145b888c3a9965

Summary

Add a new Lark attendance skill (lark-attendance) that enables querying user clock-in/attendance records via lark-cli. This skill provides the user_tasks.query API with built-in default parameter auto-fill rules to simplify usage.

Changes

  • Added lark-attendance/SKILL.md
    • Skill metadata definition (name, version, description, dependencies)
    • Default parameter auto-fill rules:
      • employee_type is always set to "employee_no" (in --params)
      • user_ids is always set to [] (in --data)
    • API resource documentation for user_tasks.query
    • Permission table: requires attendance:task:readonly scope
    • Reference to shared authentication module (../lark-shared/SKILL.md)

Test Plan

  • Run lark-cli schema attendance.user_tasks.query and verify the parameter structure is returned correctly
  • Run lark-cli attendance user_tasks query with employee_type="employee_no" and user_ids=[], verify it returns the current user's attendance records
  • Verify the ../lark-shared/SKILL.md reference path resolves correctly
  • Verify the API call succeeds after granting attendance:task:readonly permission

Related Issues

Summary by CodeRabbit

  • New Feature: Introduced a new lark-attendance skill for querying user attendance and clock-in records through the lark-cli tool.
  • Documentation: Added SKILL.md with complete API usage instructions, including default parameter auto-fill rules (employee_type="employee_no", user_ids=[]), API resource reference (user_tasks.query), and required permission scope (attendance:task:readonly).

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


chengyiming seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

📝 Walkthrough

Walkthrough

Added a new skill specification lark-attendance (v1.0.0) for querying Lark attendance punch records; includes dependency on lark-cli, required pre-step referencing shared auth guidance, deterministic parameter auto-fill rules, CLI usage guidance, and the user_tasks.query resource with its permission scope.

Changes

Cohort / File(s) Summary
Lark Attendance Skill Definition
skills/lark-attendance/SKILL.md
New skill spec adding lark-attendance v1.0.0: references ../lark-shared/SKILL.md pre-step, declares lark-cli dependency and lark-cli attendance --help text, mandates lark-cli schema attendance.<resource>.<method> before calls, sets default auto-fill params (employee_type="employee_no", user_ids=[]), provides examples, and defines user_tasks.query with attendance:task:readonly scope.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Dev as Developer
participant CLI as lark-cli
participant API as Lark API
Dev->>CLI: read ../lark-shared/SKILL.md (auth/perm guidance)
Dev->>CLI: lark-cli schema attendance.user_tasks.query
CLI->>Dev: display schema / validation
Dev->>CLI: lark-cli attendance user_tasks query --params ... --data ...
CLI->>API: POST /attendance/user_tasks/query (with injected employee_type="employee_no", user_ids=[])
API-->>CLI: attendance punch records
CLI-->>Dev: return query results

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit peeks where punch-lines hide, 🐰
I nibble specs with gentle pride,
CLI hops, schema first we seek,
Queries run, attendance speaks,
A tiny hop—new skill applied!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add attendance user_task.query' directly corresponds to the main change - adding a new skill specification for querying Lark attendance punch records via user_tasks.query method.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description includes all required sections from the template: Summary, Changes, Test Plan, and Related Issues.

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

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

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


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

@github-actions github-actions bot added the size/M Single-domain feat or fix with limited business impact label Apr 10, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Greptile Summary

This PR introduces a new skills/lark-attendance/SKILL.md that teaches AI agents to query Lark attendance punch records via attendance/v1/user_tasks/query. The skill has three P1 problems that block correct operation:

  • user_ids is hardcoded to [] (empty array), so the API will always return zero records or a validation error — defeating the skill's stated purpose of querying the authenticated user's own records. (flagged in prior review)
  • The skill omits --as user identity guidance; calling the attendance API as a bot will return wrong data or a permission error. (flagged in prior review)
  • check_date_from and check_date_to are required body fields per the Lark API spec but are absent from the auto-fill table, causing agents to call the API without a date range and receive a validation error.

Confidence Score: 2/5

Not safe to merge — three P1 issues mean every invocation of this skill will fail at runtime with no useful results.

Two P1s from prior review rounds (empty user_ids, missing identity type) remain unaddressed, and a third P1 (missing required date-range parameters) was found in this round. All three will cause the API call to fail or silently return empty data.

skills/lark-attendance/SKILL.md — requires fixes to user_ids resolution, --as user identity guidance, and date-range parameter documentation before this skill is functional.

Important Files Changed

Filename Overview
skills/lark-attendance/SKILL.md New attendance skill with three P1 issues: user_ids hardcoded as empty (prior thread), missing --as user identity guidance (prior thread), and required date-range parameters (check_date_from / check_date_to) absent from the auto-fill table.

Sequence Diagram

sequenceDiagram
    participant User
    participant Agent
    participant LarkShared as lark-shared/SKILL.md
    participant LarkCLI as lark-cli
    participant LarkAPI as attendance/v1/user_tasks/query

    User->>Agent: "查询我的考勤打卡记录"
    Agent->>LarkShared: Read (auth / identity rules)
    Note over Agent: ❌ Missing: resolve current user's employee_no
    Note over Agent: ❌ Missing: ensure --as user identity
    Note over Agent: ❌ Missing: collect check_date_from / check_date_to
    Agent->>LarkCLI: lark-cli schema attendance.user_tasks.query
    LarkCLI-->>Agent: schema (employee_type, user_ids, check_date_from, check_date_to)
    Agent->>LarkAPI: POST user_ids=[] employee_type="employee_no" (no dates, no real user ID)
    LarkAPI-->>Agent: ❌ Validation error or empty result set
    Agent-->>User: No attendance records found
Loading

Reviews (2): Last reviewed commit: "feat: add attendance user_task.query" | Re-trigger Greptile

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 (1)
skills/lark-attendance/SKILL.md (1)

48-56: Consider documenting additional attendance API methods if they exist in the Feishu API.

The skill currently exposes only user_tasks.query with read-only permissions. Verify against the Feishu API documentation whether other attendance operations (e.g., creating attendance records, retrieving configurations, etc.) exist and should be included. The codebase search found no evidence of other exposed methods, suggesting the minimal scope may be intentional for the v1.0.0 release.

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

In `@skills/lark-attendance/SKILL.md` around lines 48 - 56, The docs currently
list only the user_tasks.query method with the attendance:task:readonly scope in
SKILL.md; verify the Feishu attendance API for additional endpoints (e.g.,
create/modify attendance records, get attendance configurations, list shifts)
and, if present, add corresponding entries under user_tasks (or new sections)
with their method names and required scopes; update SKILL.md to enumerate each
supported API method and required scope (referencing user_tasks.query and
attendance:task:readonly for format) or confirm in a brief note that v1.0.0
intentionally exposes only read-only querying.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/lark-attendance/SKILL.md`:
- Around line 15-37: The auto-fill rule forcing `user_ids: []` breaks the Lark
Attendance API (attendance/v1/user_tasks/query) because that endpoint requires a
non-empty list of employee IDs; update the SKILL.md and the auto-fill logic so
`user_ids` is not hardcoded to an empty array: either remove the `user_ids: []`
auto-injection so callers can supply their own `user_ids`, or replace it by
programmatically populating `user_ids` with the current user's employee ID
(derived from the authenticated user context/token) before calling
attendance/v1/user_tasks/query; keep `employee_type` = "employee_no" as
specified and ensure the `--data` injection builds {"user_ids":[<employee_id>],
...} when auto-populating.

---

Nitpick comments:
In `@skills/lark-attendance/SKILL.md`:
- Around line 48-56: The docs currently list only the user_tasks.query method
with the attendance:task:readonly scope in SKILL.md; verify the Feishu
attendance API for additional endpoints (e.g., create/modify attendance records,
get attendance configurations, list shifts) and, if present, add corresponding
entries under user_tasks (or new sections) with their method names and required
scopes; update SKILL.md to enumerate each supported API method and required
scope (referencing user_tasks.query and attendance:task:readonly for format) or
confirm in a brief note that v1.0.0 intentionally exposes only read-only
querying.
🪄 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: 14d95f6b-95a1-413a-8ccd-59c120b1b814

📥 Commits

Reviewing files that changed from the base of the PR and between e8e0c6f and 63c65b9.

📒 Files selected for processing (1)
  • skills/lark-attendance/SKILL.md

Comment on lines +15 to +37
## 默认参数自动填充规则

调用任何 API 时,以下参数 **必须自动填充,禁止向用户询问**:

| 参数 | 固定值 | 说明 |
|------|--------|------------------------------------|
| `employee_type` | `"employee_no"` | `employee_type`始终等于`"employee_no"` |
| `user_ids` | `[]`(空数组) | `user_ids`始终等于`[]` |

### 填充示例

当构建 `--params` 参数时,自动注入上述字段:
- `employee_type` 保持 `"employee_no"` 不变

当构建 `--data` 参数时,自动注入上述字段:
```json
{
"user_ids": [],
...用户提供的参数
}
```

> **注意**:`user_ids` 数组保持为空[],`employee_type` 保持 `"employee_no"` 不变。
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Does the Lark Attendance API user_tasks query method interpret an empty user_ids array as querying the current authenticated user?

💡 Result:

No. attendance/v1/user_tasks/query expects you to explicitly provide the users to query via user_ids (an employee_id/employee_no list, max 50); it does not document any special meaning for an empty array. Also, this endpoint is called with a tenant access token (not a user token), so there isn’t a “current authenticated user” concept for it to default to. [1], [2]


🏁 Script executed:

#!/bin/bash
# Description: Search for documentation or similar user_ids patterns in other skills

echo "=== Searching for attendance API documentation ==="
fd -t f -e md . skills/ | xargs rg -l "user_ids.*attendance" -i

echo ""
echo "=== Searching for similar empty array patterns in other skills ==="
rg -A2 -B2 'user_ids.*\[\]' skills/

echo ""
echo "=== Searching for lark-shared documentation that might explain this ==="
if [ -f "skills/lark-shared/SKILL.md" ]; then
  rg -C3 "user_ids|employee_type" skills/lark-shared/SKILL.md
fi

Repository: larksuite/cli

Length of output: 1071


Critical bug: user_ids: [] breaks the Lark Attendance API call.

The auto-fill rules mandate user_ids must always be an empty array [], but the Lark Attendance API attendance/v1/user_tasks/query endpoint explicitly requires user_ids to be a non-empty list of employee IDs (max 50). The API does not document any special behavior for empty arrays and will return no results when user_ids is empty.

Since this skill's purpose is to query "one's own attendance records" (自己的考勤打卡记录), the auto-fill rules are incorrect. Either:

  1. Remove the hardcoded empty array and allow the user to specify their employee ID in user_ids, or
  2. Obtain the current user's employee ID and populate user_ids with that value instead of leaving it empty.

Fix the auto-fill logic before this skill can function correctly.

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

In `@skills/lark-attendance/SKILL.md` around lines 15 - 37, The auto-fill rule
forcing `user_ids: []` breaks the Lark Attendance API
(attendance/v1/user_tasks/query) because that endpoint requires a non-empty list
of employee IDs; update the SKILL.md and the auto-fill logic so `user_ids` is
not hardcoded to an empty array: either remove the `user_ids: []` auto-injection
so callers can supply their own `user_ids`, or replace it by programmatically
populating `user_ids` with the current user's employee ID (derived from the
authenticated user context/token) before calling attendance/v1/user_tasks/query;
keep `employee_type` = "employee_no" as specified and ensure the `--data`
injection builds {"user_ids":[<employee_id>], ...} when auto-populating.

@github-actions
Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@63c65b9bf4200f7558685bae6c1f71a96adcba80

🧩 Skill update

npx skills add chengyiming/cli#fix/leave_attendance_cli -y -g

Change-Id: Ie34b9b98859942ff368a9808fc2efab4d2bf27fa
@chengyiming chengyiming force-pushed the fix/leave_attendance_cli branch from 63c65b9 to 62f79a9 Compare April 10, 2026 14:20
@chengyiming chengyiming changed the title add feat: add attendance user_task.query Apr 10, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 10, 2026

Tip:

Greploop — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.

Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants