Problem: Due dates had no time component, the undo stack was lost on restart and stored in a separate file, and many public functions lacked required @return annotations. Solution: Add YYYY-MM-DDThh:mm support across parse, views, recur, complete, and init with time-aware overdue checks. Merge the undo stack into the task store JSON so a single file holds all state. Add @return nil annotations to all 27 void public functions across every module.
63 lines
1.9 KiB
Lua
63 lines
1.9 KiB
Lua
local M = {}
|
|
|
|
---@return nil
|
|
function M.check()
|
|
vim.health.start('pending.nvim')
|
|
|
|
local ok, config = pcall(require, 'pending.config')
|
|
if not ok then
|
|
vim.health.error('Failed to load pending.config')
|
|
return
|
|
end
|
|
|
|
local cfg = config.get()
|
|
vim.health.ok('Config loaded')
|
|
vim.health.info('Data path: ' .. cfg.data_path)
|
|
|
|
local data_dir = vim.fn.fnamemodify(cfg.data_path, ':h')
|
|
if vim.fn.isdirectory(data_dir) == 1 then
|
|
vim.health.ok('Data directory exists: ' .. data_dir)
|
|
else
|
|
vim.health.warn('Data directory does not exist yet: ' .. data_dir)
|
|
end
|
|
|
|
if vim.fn.filereadable(cfg.data_path) == 1 then
|
|
local store_ok, store = pcall(require, 'pending.store')
|
|
if store_ok then
|
|
local load_ok, err = pcall(store.load)
|
|
if load_ok then
|
|
local tasks = store.tasks()
|
|
vim.health.ok('Data file loaded: ' .. #tasks .. ' tasks')
|
|
local recur = require('pending.recur')
|
|
local invalid_count = 0
|
|
for _, task in ipairs(tasks) do
|
|
if task.recur and not recur.validate(task.recur) then
|
|
invalid_count = invalid_count + 1
|
|
vim.health.warn('Task ' .. task.id .. ' has invalid recurrence spec: ' .. task.recur)
|
|
end
|
|
end
|
|
if invalid_count == 0 then
|
|
vim.health.ok('All recurrence specs are valid')
|
|
end
|
|
else
|
|
vim.health.error('Failed to load data file: ' .. tostring(err))
|
|
end
|
|
end
|
|
else
|
|
vim.health.info('No data file yet (will be created on first save)')
|
|
end
|
|
|
|
if vim.fn.executable('curl') == 1 then
|
|
vim.health.ok('curl found (required for Google Calendar sync)')
|
|
else
|
|
vim.health.warn('curl not found (needed for Google Calendar sync)')
|
|
end
|
|
|
|
if vim.fn.executable('openssl') == 1 then
|
|
vim.health.ok('openssl found (required for OAuth PKCE)')
|
|
else
|
|
vim.health.warn('openssl not found (needed for Google Calendar OAuth)')
|
|
end
|
|
end
|
|
|
|
return M
|