generated from eblume/project-template
Some checks failed
Build / validate (pull_request) Failing after 2s
Backend: enrich `list` to return titled RankedTask rows (title + canonical_context_id, via a shared ranked_from_row with `next`), so the Organizational view needs no N+1 node.get. TDD: query_surface test asserts list rows carry title + context id. Plugin: - view.lua: Tactical `next` + Organizational `list` rendered scratch buffers; <CR> opens the row's canonical-context doc. Narrowed the node autocmd to heph://node/* so view buffers (heph://next, heph://list) don't trip it. - task.lua: capture, set-attention, done/drop, skip, per-task log append, all resolving "the current task" from the buffer (a task node, or a context doc via its canonical-context backlink). - picker.lua: vim.ui.select with Telescope auto-upgrade (headless-safe). - command.lua: :Heph next/list/capture/attention/done/drop/skip/log/search. e2e: capture→next→open context→add/check checklist→done; recurring fresh-checklist (complete rolls forward in place, next occurrence all-unchecked — the §4.4 hard requirement). 6 specs green via `mise run test-nvim`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
56 lines
2 KiB
Lua
56 lines
2 KiB
Lua
-- Workflow (a): capture a task -> it appears in :Heph next -> open its canonical
|
|
-- context -> add a checklist item -> check it -> mark the task done.
|
|
|
|
local h = require("e2e.helpers")
|
|
|
|
describe("task capture to done", function()
|
|
local ctx
|
|
before_each(function()
|
|
ctx = h.start()
|
|
end)
|
|
after_each(function()
|
|
h.stop(ctx)
|
|
end)
|
|
|
|
it("captures, surfaces in next, edits the context checklist, and marks done", function()
|
|
local task = require("heph.task").capture("Fix roof", { attention = "orange" })
|
|
assert.is_truthy(task.node_id)
|
|
|
|
-- Surfaces in the Tactical view.
|
|
local ranked = require("heph.view").next()
|
|
local viewbuf = vim.api.nvim_get_current_buf()
|
|
local present = false
|
|
for _, l in ipairs(vim.api.nvim_buf_get_lines(viewbuf, 0, -1, false)) do
|
|
if l:find("Fix roof", 1, true) then
|
|
present = true
|
|
end
|
|
end
|
|
assert.is_true(present, "task missing from :Heph next")
|
|
assert.are.equal(task.node_id, ranked[1].node_id)
|
|
assert.is_truthy(ranked[1].canonical_context_id)
|
|
|
|
-- Jump to its canonical context from the view (the one-keystroke jump).
|
|
vim.api.nvim_win_set_cursor(0, { 1, 0 })
|
|
require("heph.view").open_under_cursor()
|
|
local ctxbuf = vim.api.nvim_get_current_buf()
|
|
assert.are.equal(
|
|
"heph://node/" .. ranked[1].canonical_context_id,
|
|
vim.api.nvim_buf_get_name(ctxbuf)
|
|
)
|
|
|
|
-- Add a checklist item and save.
|
|
vim.api.nvim_buf_set_lines(ctxbuf, 0, -1, false, { "- [ ] buy shingles" })
|
|
h.save(ctxbuf)
|
|
local stored = ctx.q:call("node.get", { id = ranked[1].canonical_context_id })
|
|
assert.are.equal("- [ ] buy shingles", stored.body)
|
|
|
|
-- Check it off and save.
|
|
vim.api.nvim_buf_set_lines(ctxbuf, 0, -1, false, { "- [x] buy shingles" })
|
|
h.save(ctxbuf)
|
|
|
|
-- Mark the task done from its context buffer (resolves the owning task).
|
|
local done_id = require("heph.task").set_state_current("done")
|
|
assert.are.equal(task.node_id, done_id)
|
|
assert.are.equal("done", ctx.q:call("task.get", { id = task.node_id }).state)
|
|
end)
|
|
end)
|