9c122a312face64367a8d0578a93c2e4e3eb1f86
- Extract JASPER_URL into a shared constants module - Pass login credentials via a temp curl config file to avoid exposure in the process argument list (ps/proc) - Replace vim.ui.input secret prompt with vim.fn.inputsecret() - Add -s (silent) flag to all curl calls to suppress progress output - Guard curl output parser against missing newline in stdout - Track per-activity shared timestamp file (/tmp/jasper_<id>.last_activity) so the inactivity watchdog skips auto-pause when another Neovim instance is still active on the same task - Clean up leftover uv_timer on repeated begin_tracking calls - Remove shared activity file on teardown only when this instance wrote it
jasper.nvim
Neovim plugin for automatic time tracking via Jasper.
Features
- Reads a per-project
.jasper_config.jsonto know which Jasper activity to track. - Automatically starts the timer when Neovim opens and stops it when Neovim closes.
- Auto-pauses after a configurable period of inactivity (no cursor movement, typing, etc.) and resumes on the next keystroke.
- Shares the auth token cache with
jasper_waybar.py($XDG_CONFIG_HOME/jasper/token.json). - If no token is found, prompts for credentials inside Neovim.
Requirements
- Neovim ≥ 0.10 (uses
vim.systemandvim.uv) curlavailable in$PATH
Installation (lazy.nvim)
{
url = "https://git.donadeo.net/pdonadeo/jasper.nvim",
config = function()
require("jasper").setup({
-- Global default inactivity timeout in minutes (can be overridden per project).
-- inactivity_timeout = 10,
})
end,
}
Project configuration
Place a .jasper_config.json file at the root of the project (next to .git):
{
"attivita_id": 12345,
"inactivity_timeout": 10
}
| Key | Required | Description |
|---|---|---|
attivita_id |
✅ | Numeric ID of the Jasper activity (the value field returned by the API). |
inactivity_timeout |
❌ | Minutes of inactivity before auto-pause. Defaults to 10. |
How it works
- On
VimEnter, the plugin looks for.jasper_config.jsonby walking up from the current working directory. - If found, it reads the cached auth token from
$XDG_CONFIG_HOME/jasper/token.json. If the token is missing or expired, it prompts for credentials. - It fetches the list of timers from Jasper and finds the one associated with
attivita_id. If none exists, it creates one. - The timer is started. A libuv countdown is armed; after
inactivity_timeoutminutes of silence the timer is paused. - Any cursor movement or keystroke resets the countdown (and resumes the timer if it was paused).
- On
VimLeavethe timer is stopped.
$
AI Disclosure
This project was written entirely with the assistance of GitHub Copilot using the Claude Sonnet 4.6 model.
Description
Languages
Lua
100%