TAPD 引导式工时
Use this Skill as a guided workflow, not as a form-filling page. Keep the user-facing path to four steps: 导入考勤、筛选工作项、编辑预览、确认提交。
Credentials and safety
- Obtain the API token only from
TAPD_TOKENin the invoking process environment. Never ask the user to paste it into a page, save it in an artifact, echo it, or put it in a command transcript. - Require
TAPD_OWNER_CONFIRMEDto exactly match the validated owner before submission. An owner may contain only Chinese characters, ASCII letters, and digits; reject whitespace and special characters. - Never submit based only on a past approval. Before every write, show the complete preview, task IDs, owner, record count, total hours, and memo policy; wait for an explicit confirmation for that exact period.
- Submit serially with a delay. Persist a receipt after every successful call. On timeout or failure, stop; do not retry blindly because the record may already exist.
- Treat rollback as a separate destructive action: list the exact receipt IDs, require an explicit rollback confirmation, then delete serially. Do not assume a token has delete permission.
Guided workflow
1. Obtain and clean attendance
Use Enterprise WeChat 登录OA (not 智租OA): 考勤管理 → 考勤报表 → 每日统计报表 → select period → 导出 Excel. Use Computer Use only after the user is already logged in; let the user handle login or verification.
Create an attendance JSON with period and days (date, max_hours, rule). Apply user-confirmed rules only:
- Exclude leave days.
- Include weekend days only when there is a real punch; cap them at the actual punched duration.
- Treat late and missing punch rules exactly as the user specifies. Do not silently infer a universal cap.
- State the resulting date count and hour total before moving on.
2. Collect and classify work items
Use Enterprise WeChat 智能助理·大圆 as evidence support when requested. Ask it for project/topic, evidence, likely date range, suggested share, TAPD search keywords, and uncertainty. Chat frequency is only supporting evidence.
Before assigning percentages, require a human classification gate for every candidate:
- Include as a TAPD work item.
- Merge into a named TAPD task.
- Exclude as administration, scattered work, or someone else's project.
The included shares must total 100. Task date ranges may be a subset of the period, but every fillable date must be covered by at least one included task before preview generation.
3. Match TAPD tasks
For each included item, find a 19-digit TAPD task ID and confirm it is a product task the user created, owns, or is allowed to use. Capture task name, workspace, and date range. Mark no match as 需要补建任务; never attach it to a similar task without user confirmation.
Store the allocation using the schema in references/input-schema.md. Use scripts/tapd_timesheet.py to generate a deterministic preview. The script merges same-task entries occurring on the same date and proportionally re-normalizes only the tasks active that day.
4. Review and submit
Run:
python3 scripts/tapd_timesheet.py preview \
--attendance /path/attendance.json \
--allocation /path/allocation.json \
--owner '姓名' --out /path/preview.json
Present the resulting summary and an editable detailed table. Default memo is blank; ask for a memo only if the user wants one. Confirm the owner again immediately before write.
TAPD_TOKEN='provided-outside-the-chat' \
TAPD_OWNER_CONFIRMED='姓名' \
python3 scripts/tapd_timesheet.py submit \
--preview /path/preview.json --receipts /path/receipt.json
Afterward, validate receipt count, successful count, owner, total hours, and blank memo policy. Give the user the receipt file path. For deletion, first show the matching receipt IDs and request a new explicit confirmation; see rollback --help.
Stop conditions
Stop and ask for direction when attendance cannot distinguish leave from attendance, shares do not total 100, dates lack task coverage, a task has no valid 19-digit ID, the owner fails validation, the token is unavailable, or a submit request returns timeout/failure. Do not create tasks, write worklogs, or delete worklogs in these cases.