终端自动化,高效管理工时
简介
通过终端自动化管理 Otta 工时系统,支持考勤记录、请假管理与日历导出,适合 DevOps 流程集成。
原始描述
Use `otta-cli` to automate `otta.fi` workflows from terminal. This tool is usually used for tracking working time, absences, and sick leaves: authenticate, i...
通过你的 Agent 添加
安装目录:otta-cli/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: otta-cli
description: "Use otta-cli to automate otta.fi workflows from terminal. This tool is usually used for tracking working time, absences, and sick leaves: authenticate, inspect config/cache, check account status, manage worktimes (list/add/update/delete), browse absences, fetch holidays, and generate combined calendar overviews. Trigger this skill when a request needs CLI-first Otta operations, OTTA_CLI_* environment setup, machine-readable --format json output, or diagnosis of auth/config/API validation errors."
Otta CLI
Use this skill to execute Otta time-tracking tasks end-to-end with repeatable CLI commands.
Main repository: https://github.com/mekedron/otta-cli
Quick Start
-
Use the
ottabinary directly. -
Verify command surface and storage paths.
otta --help
otta config path
otta config cache-path
- Authenticate and hydrate cache.
otta auth login --username "$OTTA_CLI_USERNAME" --password "$OTTA_CLI_PASSWORD" --format json
otta status --format json
statusupdates cached user metadata (foruserandworktimegroupfallbacks used by worktimes/holidays/calendar commands).- For non-interactive automation, prefer
--password-stdinor secret env handling to reduce shell history exposure.
Command Recipes
Use explicit dates/times in YYYY-MM-DD and HH:MM formats.
List worktimes:
otta worktimes list --date 2026-02-20 --format json
Add worktime:
otta worktimes add \
--date 2026-02-20 \
--start 09:00 \
--end 17:00 \
--pause 30 \
--project <project-id> \
--worktype <worktype-id> \
--description "Example task description" \
--format json
--useris optional ifOTTA_CLI_USER_IDor cached user ID exists.
Update worktime:
otta worktimes update --id <worktime-id> --start 10:00 --end 18:00 --format json
- Send at least one changed field with
--id.
Delete worktime:
otta worktimes delete --id <worktime-id> --format json
Fetch holidays/workday calendar:
otta holidays \
--from 2026-02-20 \
--to 2026-02-29 \
--worktimegroup <worktimegroup-id> \
--format json
--worktimegroupis optional ifOTTA_CLI_WORKTIMEGROUP_IDor cached value exists.
Browse absences:
otta absence browse \
--from 2026-02-01 \
--to 2026-02-28 \
--format json
Generate combined calendar overview:
otta calendar overview \
--from 2026-02-01 \
--to 2026-02-28 \
--format json
Generate absence comment text:
otta absence comment \
--type sick \
--from 2026-02-20 \
--to 2026-02-20 \
--details "Flu symptoms" \
--format json
Environment Variables
Use these variables when running in CI/non-interactive environments:
OTTA_CLI_CONFIG_PATHOTTA_CLI_CACHE_PATHOTTA_CLI_API_BASE_URLOTTA_CLI_CLIENT_IDOTTA_CLI_USERNAMEOTTA_CLI_PASSWORDOTTA_CLI_ACCESS_TOKENOTTA_CLI_TOKEN_TYPEOTTA_CLI_REFRESH_TOKENOTTA_CLI_TOKEN_SCOPEOTTA_CLI_USER_IDOTTA_CLI_WORKTIMEGROUP_ID
Agent Operating Rules
- Prefer
--format jsonfor all data-producing commands and parse response fields instead of scraping text output. - Run
status --format jsonbefore operations that rely on cached user/worktimegroup metadata. - Validate dates/times before command execution (
YYYY-MM-DD,HH:MM). - Run
worktimes listbeforeupdateordeletewhen IDs are not explicitly known. - Return exact command, exit code, and concise stderr message when failures happen.
- Never print raw credentials or tokens in summaries.
Failure Recovery
no access token configured (run \otta auth login`)`- Run
auth login, then rerunstatus.
- Run
username is required (use --username)- Pass
--usernameor setOTTA_CLI_USERNAME.
- Pass
--worktimegroup is required (...)- Pass
--worktimegroup, setOTTA_CLI_WORKTIMEGROUP_ID, or runstatusto refresh cache.
- Pass
--date must be YYYY-MM-DD,--start must be HH:MM,--to must be greater than or equal to --from- Correct input format/order, rerun command.
directory ... is contained in a module that is not one of the workspace modules listed in go.work- Build/run with
GOWORK=offin this repository context.
- Build/run with
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。