Skip to content

feat(zcode-wakatime): add WakaTime plugin for AI coding time tracking - #8

Open
RoiexLee wants to merge 2 commits into
zai-org:mainfrom
RoiexLee:feat/zcode-wakatime
Open

feat(zcode-wakatime): add WakaTime plugin for AI coding time tracking#8
RoiexLee wants to merge 2 commits into
zai-org:mainfrom
RoiexLee:feat/zcode-wakatime

Conversation

@RoiexLee

@RoiexLee RoiexLee commented Sep 6, 2026

Copy link
Copy Markdown

What

Adds zcode-wakatime, a WakaTime plugin for ZCode (Z.ai's agentic coding tool). It registers ZCode lifecycle hooks to trigger wakatime-cli's official AI-activity sync:

  • SessionStart — installs/updates wakatime-cli into ~/.wakatime/
  • UserPromptSubmit / PostToolUse (edit tools) — runs wakatime-cli --sync-ai-heartbeats, which parses ZCode's own session store (~/.zcode/cli/db/db.sqlite) via the official ZCode parser (pkg/ai/zcode.go, shipped in wakatime-cli v2.26.0) and uploads AI Coding heartbeats (session entities, AI line changes, token counts)

Why

wakatime-cli already parses ZCode sessions, but the AI sync only runs when some wakatime plugin sends a heartbeat. This plugin triggers that sync exactly when ZCode activity happens, so ZCode sessions are tracked even when no other editor is open.

Structure

  • .zcode-plugin/plugin.json + hooks/hooks.json + bin/zcode-wakatime.js — single zero-dependency Node script, two-stage detached execution so hooks never block the session
  • Derived from wakatime/codex-cli-wakatime (BSD-3-Clause): upstream structure retained verbatim, identity strings adapted for ZCode

Testing

  • Windows 11 + ZCode desktop + wakatime-cli v2.26.0
  • Real-session verified: hooks fire on SessionStart / UserPromptSubmit / PostToolUse, sync exits 0, zero errors in logs
  • Heartbeats confirmed on the WakaTime dashboard (AI Coding category, ZCode sess_* session entities)
  • python scripts/validate.pyOK: 17 plugin(s) validated

Version

plugin.json 0.2.0 matches the marketplace entry 0.2.0 (version-sync rule).

License

BSD-3-Clause

Self-check / 自查清单

  • Plugin name is unique kebab-case; directory is plugins/<name>/ / 插件名唯一且 kebab-case,目录为 plugins/<name>/
  • version bumped in BOTH plugin.json and marketplace.json (artifacts are immutable) / plugin.jsonmarketplace.json 两处版本号已同步升级(制品不可变)
  • README.md (EN) and README_CN.md (中文) both updated and equivalent / 中英文 README 均已更新且语义一致
  • description_i18n has both en and zh-CN / description_i18n 包含 enzh-CN
  • No secrets, machine-specific paths, or private dependencies / 不含密钥、机器专属路径或私有依赖
  • Model/API/network dependencies documented / 模型、API、网络依赖已写明
  • python3 scripts/validate.py and python3 scripts/build_dist.py pass locally / 本地校验与构建均通过

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant