Commit graph

62 commits

Author SHA1 Message Date
2c8d8b101f feat(tui): delete/tombstone a task with D (y/N confirm) (§8.1)
`D` arms a delete on the highlighted task; the status line shows
"Delete \"title\"? (y / N)" and the next key confirms (y) or cancels (anything
else). Confirming calls node.tombstone — a true soft-delete that removes the
task from every view, recurring tasks included (unlike `x` done, which rolls a
recurring task forward, or `d` dropped, which keeps it in the store). Backend
gains `tombstone`.

Tests: confirm-flow unit test against a recording fake (arm → cancel keeps it;
arm → confirm tombstones), plus a real-daemon integration test that deleting a
recurring task drops it from the view and sets the node's tombstoned flag.
186 workspace tests; clippy/fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 08:48:32 -07:00
bed2d6a8aa docs(tui): note recurring ↻ marker + inline selected-row detail (§8.1)
All checks were successful
Build / validate (pull_request) Successful in 25m8s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 08:08:42 -07:00
1833863594 feat(tui): recurring-task glyph + inline detail under the selected row (§8.1)
Recurring tasks now show a ↻ marker on their row, and the highlighted task
expands inline beneath itself with a dimmed detail block: project name,
recurrence rule, and do/late dates (only the fields that are set). Project
name resolves client-side from the sidebar; dates were already on the row.

Backend: RankedTask gains `recurrence: Option<String>` (populated in
ranked_from_row from t.recurrence; both list/next select lists updated) — the
only data the row was missing. Serializes over the socket automatically.

Tested: a real-daemon render test asserts the ↻ glyph plus the selected
detail block (recurs: FREQ=DAILY, project: Routines). 184 workspace tests;
clippy/fmt clean.

Note: the recurrence is shown as the raw RRULE for now (humanizing it is a
later polish). Subtask/checklist folding was dropped — those reference items
turned out to be blue backlog items, not sub-items.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 08:08:16 -07:00
391277c939 fix(build): commit the datespec-move wiring (orphaned in T2c)
Some checks are pending
Build / validate (pull_request) Has started running
The T2c commit moved datespec.rs into hephd but left its wiring uncommitted:
hephd's lib never exported `pub mod datespec`, hephd lacked the chrono dep,
and the CLI still declared `mod datespec` for a file that had moved. The
working tree had these (so local builds passed) but the pushed tree didn't,
breaking `cargo install` of heph + heph-tui. Commit them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:45:27 -07:00
ffec575249 docs(tui): FTS search done; move-to-project (needs task.set_project) is the last gap
Some checks failed
Build / validate (pull_request) Failing after 11s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:41:12 -07:00
dc8e06ecaa feat(tui): heph-tui T3 — full-text search overlay (§8.1)
`/` opens a search prompt; submitting runs the FTS `search` RPC and overlays
the results on the center pane (title + [kind]). j/k move, Enter opens the hit
(a task hit opens its canonical-context doc via context_of; docs/journals open
themselves) in nvim, Esc exits search. Backend gained `search` + `context_of`.

Tests: fake-backend flow (results populate; task hit resolves to its context,
doc hit to itself; clear) + a real-daemon integration test (seed a doc, search,
assert the hit + that the Search pane renders). 183 workspace tests; clippy/fmt
clean.

Move-to-project is the last Todoist-parity gap; it needs a new task.set_project
RPC (no link-remove RPC yet) and is deferred.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:40:21 -07:00
3099034d43 docs(tui): NL quick-add done; T3 remainder is search + move-to-project
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:33:37 -07:00
b4624af021 feat(tui): heph-tui T3 — single-line NL quick-add (§8.1)
`a` is now Todoist-style one-line capture: parse a line like
`Water plants tomorrow p2 #Camano Chores every 3 days` into title + attention
(p1 red / p2 orange / p3 blue / p4 white) + do-date (today/tomorrow/+3d/fri/ISO)
+ recurrence (`every …`, longest suffix that parses) + project (`#Name`, greedy
multi-word match against existing projects). An unresolved `#tag` stays in the
title verbatim (no surprise project creation); with no `#project`, the task is
filed under the selected sidebar project.

The parser (`quickadd::parse`) is pure — `today` and the project list are
passed in — reusing hephd::datespec for dates/recurrence, so it's exhaustively
unit-tested (priority, relative/weekday dates, single + multi-word projects,
recurrence extraction, unresolved tags, the all-at-once case, and the
"every"-not-a-recurrence fallback). `Backend::create_task` gained a recurrence
arg. The multi-step guided add it replaces is gone.

181 workspace tests; clippy/fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:32:45 -07:00
2e0e37f76d docs(tui): mark heph-tui daily-driver core built (§8.1, §14)
§8.1 status → "core built" with the implemented panes/gestures/handoff; §14
adds the heph-tui Done bullet, retargets the resume list to T3 (NL quick-add +
search), and bumps the count to 171 Rust tests. Changelog fragment for the TUI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:23:18 -07:00
8f10287a7f feat(tui): heph-tui T2c — guided add + reschedule (§8.1)
A single-line input modal (centered popup, Esc cancels, Enter submits) drives
the two input-requiring gestures:

- a: guided capture — title → attention (o/r/b, blank=white) → do-date
  (today/tomorrow/+3d, blank=none). If a project is the current sidebar
  selection, the task is filed there (Todoist's add-within-project).
- e: reschedule the highlighted task's do-date (blank clears it).

Parse errors keep the input step (typed text isn't lost) and show in the
status line. Shared client-side date/recurrence parsing (datespec) moved from
the heph CLI into hephd's lib so both the CLI and TUI use one parser; heph-core
stays clock-pure. The CLI now uses hephd::datespec (no behavior change; its
tests moved with it).

Tests: add-flow + reschedule unit tests against a recording fake (asserting the
collected title/attention/project and the clear-on-blank double-option), plus
real-daemon integration tests that guided-add surfaces a task and reschedule
sets the do_date. 171 workspace tests; clippy/fmt clean.

With done/drop/skip/attention/blue (T2a) + nvim handoff (T2b), all four
day-one daily-driver gestures now land. NL single-line quick-add + search are T3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:21:12 -07:00
ae2eff401c feat(tui): heph-tui T2b — nvim context handoff (§8.1)
`o` on a task suspends the TUI, opens its canonical-context doc in the owner's
nvim via heph.nvim's live buffer surface (+lua require('heph.node').open), then
restores the alternate screen and reloads to pick up edits. The child nvim is
pointed at the same daemon via $HEPH_SOCKET, so it works under a custom
--socket too. This is the KB↔task fusion — edit the description/checklist in
the real editor and return straight to triage.

handle_key now returns an Action the event loop performs (the suspend/spawn is
terminal-owning, kept out of App). nvim arg builder unit-tested; the actual
suspend/spawn is interactive so it's exercised manually.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:11:47 -07:00
10cf0fc395 feat(tui): heph-tui T2a — instant triage gestures (§8.1)
Single-keypress mutations on the highlighted task, each → RPC → reload with a
status confirmation: x done (recurring roll-forward), d drop, s skip, A cycle
attention (white→orange→red→blue, §6.2), b push-to-blue (On Deck). The bulk of
daily triage — the daily orange reconfirm and blue keep/drop review made fast.

Tests: next_attention cycle unit test; integration tests against a real daemon
that completing/pushing-to-blue removes a task from Top of Mind (and it then
shows under On Deck). 11 heph-tui tests; clippy/fmt clean.

Input-requiring actions (a add, e reschedule) + nvim context handoff are T2b.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:08:58 -07:00
a21f9e575b feat(tui): heph-tui T1 — read-only 3-pane agenda (§8.1)
New crate crates/heph-tui: a ratatui terminal agenda, thin client of the
hephd unix socket (never touches SQLite, same as heph.nvim). The next big
surface — the interactive triage UI the §6.2.1 Todoist study calls for.

- 3-pane layout: sidebar (the five §8.2 filter views + projects), task list
  (attention-colored rows with compact human do/late dates), and a preview
  pane (the highlighted task's canonical-context doc body + log tail).
- App state is generic over a `Backend` seam, so navigation/selection logic
  is unit-testable without a terminal or daemon; `ClientBackend` forwards to
  the socket. Rendering is a pure `ui::render(frame, &app)`.
- Navigation: j/k within the focused pane, Tab / h / l to move focus,
  selecting a sidebar source reloads the list, moving the task cursor
  refreshes the preview. r refresh, q quit.
- Socket resolution: --socket flag, then $HEPH_SOCKET, then the standard
  runtime path (the TUI honors the env var the CLI doesn't).

Tests: a headless TestBackend render against a real spawned daemon (asserts
views/projects/tasks/preview paint, and Top of Mind excludes blue), plus
in-memory navigation unit tests. 8 heph-tui tests; clippy/fmt clean.

Mutations (add/done/attention/reschedule/blue) + nvim handoff land in T2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 07:06:48 -07:00
a5fc578525 feat(views): filter views (§8.2) — saved agenda slices
Some checks failed
Build / validate (pull_request) Failing after 18m44s
Make the owner's saved filters first-class so the agenda isn't one flat
list. `list` now takes a ListFilter predicate-as-data (heph-core::filter):
attention include/exclude sets, project-id scope, exclude_projects, and an
actionable do-date gate. New Store::view(name) resolves a built-in ViewSpec
— looking project names up to ids and subtree-expanding them through parent
links — then lists.

Five built-ins seeded from the Todoist queries (design §6.2.1): tom, ondeck,
chores, work, tasks (Schedule dropped — time-of-day isn't modeled on
date-grained do-dates). Surfaced as `heph view <name>` (no name lists them),
the `view` RPC + RemoteStore forward, and `:Heph view <name>` in nvim.

The list RPC/RemoteStore/CLI/heph.nvim migrate to the filter wire; legacy
--scope/--attention/--no-blue map onto it (nvim view.lua updated).

Tests: filter unit predicate, a views integration suite (subtree
scope+exclude, actionable gate, unknown-view error, absent-project empties),
a socket list/view dispatch test, two nvim e2e specs. 154 Rust tests + 18
nvim e2e green; clippy/fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 06:39:07 -07:00
eb4a827700 docs: plan the filter-views slice + TUI coherence; note chores rework
Some checks failed
Build / validate (pull_request) Failing after 8m9s
- tech-spec §8.2 (new): filter-views slice — extend `list` to a data-expressed
  predicate (attention set, project-subtree/multi scope, exclude-projects,
  actionable toggle), five built-in views (`heph view <name>`) seeded from the
  owner's verbatim Todoist queries; the TUI's filter pane reuses them
- tech-spec §8.1: TUI filter pane = the §8.2 views; depends on that slice
- tech-spec §14: filter-views is the next slice (before heph-tui); CLI +
  daemon-service marked done
- design §6.2.1: record the verbatim filter queries + the reference-context →
  wiki reclassification, and note future direction: chores as a first-class
  feature (own do-date/recurrence; retire Chores/Camano-Chores projects) and
  dropping the Schedule filter (time-of-day not modeled)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 22:02:08 -07:00
cdd4d9f62a heph.nvim: rip out auto-spawn — connect-only plugin
All checks were successful
Build / validate (pull_request) Successful in 10m44s
The daemon is now an OS service (`heph daemon`); the plugin no longer spawns or
supervises one. Removes the managed-daemon machinery entirely.

- delete lua/heph/daemon.lua (spawn/ensure/stop_spawned/self-heal)
- init.lua: connect-only; probe `health` once and guide to `heph daemon start`
- rpc.lua: drop set_respawn + respawn-on-drop; a dropped connection just
  reconnects once (e.g. after `heph daemon restart`), never spawns
- config.lua: drop autostart/bin/db; stable socket fallback (data-dir, matches
  hephd::default_socket_path), keep $HEPH_SOCKET for dev isolation
- tests: spawn/wait_ready move into the e2e harness (test infra); rework
  managed_daemon_spec into a connect-only spec (connect / clean-fail / reconnect)

16 nvim e2e specs pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 21:21:28 -07:00
0cfe627055 feat(cli): heph daemon — manage hephd as a launchd/systemd service
Some checks failed
Build / validate (pull_request) Has been cancelled
Surfaces are connect-only; the daemon now runs as an explicit OS service so it
can be shared without any surface owning its lifecycle.

- service.rs: heph daemon start/stop/restart/status/uninstall, idempotent;
  launchd LaunchAgent (macOS) / systemd user service (Linux); resolves hephd
  next to heph else on PATH; pure plist/unit render fns unit-tested
- main.rs: Command::Daemon handled before connecting (like auth)
- hephd: default socket is now a STABLE <data-dir>/heph/hephd.sock when
  XDG_RUNTIME_DIR is unset (was $TMPDIR — fragile for a persistent service;
  macOS prunes /var/folders and the path varied per session)
- tech-spec §14: CLI + daemon-service done entries

Verified live on macOS: start/restart/stop/uninstall + CLI reaches the store.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 21:14:50 -07:00
1315b9ce18 docs: daemon lifecycle becomes an explicit service (connect-only surfaces)
Some checks failed
Build / validate (pull_request) Has been cancelled
A surface-owned, auto-spawned daemon can't be shared once the CLI is also a
first-class client — so drop auto-spawn and manage the daemon as an OS service.

- design §4: daemon lifecycle = explicit OS service; surfaces connect-only
- heph-nvim.md: rewrite the daemon-lifecycle section (connect-only) + history
- new how-to/run-the-daemon.md (heph daemon start/stop/restart/status); indexed
- install-heph.md: post-install is `heph daemon start`; plugin no longer spawns
- tech-spec §14: mark the managed-daemon entry superseded
- changelog fragment

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 21:07:11 -07:00
0b32ed4397 feat(tooling): mise run import-todoist — seed a heph store from Todoist
All checks were successful
Build / validate (pull_request) Successful in 7m1s
Turn the one-off Todoist importer into a documented, repeatable mise task.
Self-contained (spawns its own hephd), dry-run by default into a throwaway
store, `-- --commit` writes into the real store after backing it up. Auth via
TODOIST_TOKEN or TODOIST_OP_REF (op://). Mapping per design §6.2.1:
project hierarchy (+ Inbox→unfiled), priority→attention by meaning, due→do-date,
NL recurrence, descriptions + sub-tasks→canonical-context doc.

- mise-tasks/import-todoist
- docs/how-to/import-todoist.md (+ how-to index, reference mise-tasks table)
- changelog fragment

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 20:15:05 -07:00
2d4e4ae4d7 feat(cli): parse "every Nth" recurrence → monthly by day-of-month
All checks were successful
Build / validate (pull_request) Successful in 2m47s
Todoist uses "every 5th" for monthly-on-the-5th; map it to
FREQ=MONTHLY;BYMONTHDAY=N (1..=31). Surfaced by the Todoist import.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 20:02:22 -07:00
f122c9e6a4 feat(cli): heph project list (+ node.list RPC)
Some checks failed
Build / validate (pull_request) Has been cancelled
Add a list-by-kind primitive so projects (and later tags) can be enumerated.

- core: Store::list_nodes(kind?) — owner-scoped, non-tombstoned, title-sorted;
  sqlite nodes::list; LocalStore/RemoteStore impls
- rpc: node.list {kind?} dispatch
- cli: `heph project list`
- tests: core list_nodes (kind filter, case-insensitive sort, tombstone
  exclusion) + cli project_list (projects only, not tasks)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 19:50:19 -07:00
07e4d786b3 feat(cli): complete task surface — human dates, recurrence, full API
Some checks failed
Build / validate (pull_request) Failing after 1m52s
Make heph a real task driver and the complete daemon-API surface (the
three-surface model's capture/scripting role). Structured fields are flags.

- datespec: human date parsing (today/tomorrow/+3d/fri/ISO, injectable today
  for deterministic tests) + compact display; recurrence presets + the common
  Todoist-style natural-language forms ("every 3 days", "every fri", "every
  April 15") + raw RRULE passthrough. Table-driven unit tests.
- main: new commands covering every RPC — list, done/drop/skip, attention,
  edit (reschedule via task.set_schedule), promote, show, log (append/tail),
  health, node update/rm, resolve, links/backlinks, link add,
  project add [--parent], sync [--status], conflicts [resolve]. task/next/list
  show human dates; projects referenced by name (resolved, errors if absent).
- tests/cli.rs: real-socket process tests for the new verbs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 19:36:50 -07:00
70d5af5bdc feat(core): task.set_schedule — reschedule do-date/late-on/recurrence
Some checks failed
Build / validate (pull_request) Has been cancelled
There was no way to change a task's do-date, late-on, or recurrence after
creation (only attention/state had setters) — a real reschedule gap. Add a
single patch method covering the three schedule scalars with no setter.

- model: SchedulePatch with double-option fields (absent=leave, null=clear,
  value=set), serde-skips absent fields so the distinction round-trips
- Store::set_task_schedule + LocalStore/RemoteStore impls; sqlite set_schedule
  overlays present fields then records the LWW task.set op (sync-correct)
- rpc dispatch: task.set_schedule (id + flattened patch)
- tests: core set/clear/leave + missing-task; rpc_socket round-trip asserting
  the absent/null/value semantics over the wire

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 19:26:25 -07:00
0aa7e725a5 docs: revise to a three-surface model (CLI/TUI/nvim) from a Todoist study
Some checks failed
Build / validate (pull_request) Has been cancelled
Study of the owner's live Todoist (387 tasks, 34 hierarchical projects)
grounds a surface-strategy revision: structured task fields suit CLI flags,
large-set triage suits an interactive TUI, and context/KB suits nvim — so v1
adopts three surfaces, each to its strength. Supersedes the earlier
"heph.nvim is the primary surface" framing.

- design.md: new §6.2.1 (Todoist study) + revised §4 (three-surface model)
- tech-spec §1/§8: reframe surface roles; new §8.1 (planned heph-tui agenda)
- tech-spec §14: reorder remaining work (CLI-complete task surface in progress,
  heph-tui next, nvim navigation polish, tags/hierarchy deferred)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 19:21:05 -07:00
7188daeb32 docs: refresh §14 tracker + README/AGENTS for the heph.nvim UX iteration
Some checks failed
Build / validate (pull_request) Has been cancelled
The plugin is built, installed, and well past 11a–11c. Record the post-11c UX
iteration (managed daemon + self-heal, follow-or-create, home/index, dailies
picker, interactive views, dev isolation, fully-Dagger CI) as done, and reset
the "not yet done" backlog to lead with the highest-value next work:
task-scheduling UX (do-date/late-on/recurrence from the editor), then more
surfacing (backlinks/tags/health/log-read), 11d (deferred), and the heph.nvim
repo split.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 12:27:43 -07:00
95948d5563 heph.nvim: make the view key-hint actually visible (header line, not virt-line)
Some checks failed
Build / validate (pull_request) Failing after 6m25s
virt_lines_above on the first line renders above the top screen row, which can't
be scrolled into view — so the hint was invisible. Use a real header line at the
top of next/list (dimmed via an extmark highlight); task rows start at line 2,
and the cursor lands on the first task. Specs updated for the +1 offset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 12:01:36 -07:00
0462a6e43b heph.nvim: interactive next/list views (add, done, refresh) + key hint
Some checks failed
Build / validate (pull_request) Failing after 4m47s
The Tactical next and Organizational list buffers are now actionable:
- a  add a task from the list (prompt title + attention)
- d  mark the task under the cursor done
- r  refresh
- <CR> open the task's context (as before)

A dimmed key hint renders above the rows as a virtual line (extmark), so it's
discoverable without taking a task row. e2e covers add-from-list and
done-from-list via stubbed vim.ui.input/select.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:48:09 -07:00
d0930aa6a3 heph.nvim: :Heph journals — recent-days picker with preview + @create
All checks were successful
Build / validate (pull_request) Successful in 16m0s
A dailies picker (zkd-style): lists the last `journal_days` (default 7) days
newest-first, previews existing journals and shows "@create" for new ones, and
opens the chosen day (creating if new). Journals resolve by their ISO-date
title, so no new RPC is needed. picker.select gains an optional Telescope
preview pane. e2e covers the recent-days list (exists/@create across a month
boundary) and open-on-pick via a stubbed vim.ui.select.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:26:45 -07:00
e99c284941 heph.nvim: :Heph home — a base index/landing page for the zk
Some checks failed
Build / validate (pull_request) Failing after 5m3s
A single designated "home" doc (open-or-create by title, configurable via
opts.home, default "Home") — a stable landing page to grow a map of content
around. e2e covers create-on-first-open + idempotent reuse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:14:12 -07:00
9249ca46a1 heph.nvim: follow-or-create wiki links + :Heph doc
Some checks failed
Build / validate (pull_request) Failing after 4m13s
Pressing <CR> on a [[wiki-link]] whose target doesn't exist now creates a doc
with that title and opens it (the zettelkasten gesture), and materializes the
source's backlink: if the source has unsaved edits, saving re-extracts and
links it (and persists the edits); otherwise the wiki link is added directly
(a no-op re-save wouldn't re-extract). Adds :Heph doc <title> to create a
standalone wiki entry. e2e covers both the saved-source and just-typed-source
paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:07:09 -07:00
acb3949896 heph.nvim: regression test for the stale-socket wait_ready deadlock
Some checks failed
Build / validate (pull_request) Failing after 5m35s
Recreates a crash-left stale socket (spawn a managed daemon, SIGKILL it) and
asserts wait_ready returns promptly (a deadlock would freeze the suite) and that
a fresh autostart recovers. Verified it fails (suite hangs) against the buggy
nested-vim.wait version.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 10:29:58 -07:00
b932a814ca heph.nvim: fix daemon.wait_ready deadlock on a stale socket
Some checks failed
Build / validate (pull_request) Failing after 5m51s
wait_ready ran the rpc health probe inside a `vim.wait` predicate, and the probe
itself uses `vim.wait` — nesting vim.wait inside another vim.wait's predicate
deadlocks Neovim. It only bit when the socket file existed: the first launch's
socket doesn't exist yet (probe short-circuits), but the second launch hit the
stale socket left by the prior daemon and froze in setup().

- wait_ready now probes in a plain Lua loop (deadline via uv.hrtime + a bare
  vim.wait(50) yield) — never a vim.wait inside a vim.wait predicate.
- stop_spawned now unlinks the socket on exit, so a clean exit leaves no stale
  socket (a crash still can — the wait_ready fix handles that too).

Verified: two-launch repro no longer hangs; a crash-left stale socket recovers
in ~460ms. 10 e2e specs green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 10:23:42 -07:00
652d2e89e6 heph: dev/installed isolation — mise run dev task + install how-to
Some checks failed
Build / validate (pull_request) Failing after 10m32s
- mise-tasks/dev runs the working-tree hephd on isolated .dev/ paths (gitignored)
  so in-repo development never touches the installed daemon's data; point a dev
  nvim at it via HEPH_SOCKET/HEPH_DB.
- docs/how-to/install-heph.md: install heph/hephd from the forge (build from
  source), the lazy.nvim `dir` setup for the subdir plugin, and dev isolation.
- gitignore .dev/ and the transient .claude scheduled-task state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 09:39:59 -07:00
e3db2ac550 heph.nvim: plug-and-play managed daemon (autostart, self-heal, client/server guardrail)
The plugin now manages its own hephd by default (autostart = true): if nothing
is serving the socket it spawns a local daemon against the default XDG paths,
kills only what it spawned on VimLeavePre, and self-heals — rpc.call retries
once through a respawn hook when the connection drops (the prior owner releases
the DB lock on exit, so a respawn can claim it).

- daemon.ensure() connects to an already-running daemon (any mode) or spawns one
  we own; stop_spawned()/is_managed() track lifecycle.
- A server/client daemon you started is always respected (spawn only when nothing
  serves the socket). autostart = false → connect-only, warns/errors if down,
  and clears the self-heal hook so it fails loudly.
- config: autostart defaults true; new `db` option; $HEPH_SOCKET / $HEPH_DB
  fallbacks isolate a dev Neovim onto a separate daemon + DB.

e2e: managed_daemon_spec covers autostart spawn, self-heal-after-kill, and
connect-only error. 10 specs green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 09:37:49 -07:00
fef0e82d26 ci: run build entirely through Dagger; drop prek from CI
All checks were successful
Build / validate (pull_request) Successful in 21m0s
The Forgejo k8s job image is a thin Alpine + Dagger orchestrator (no native
Rust/Neovim toolchain, no prek) with a DinD sidecar — so CI was failing on
step 1 (`prek: command not found`) on every run, and a native cargo hook
wouldn't work there either.

- build.yaml now runs `dagger call check` (cargo fmt/clippy/test on
  rust:1-bookworm) + `dagger call test-nvim` (build hephd + headless e2e).
- New Dagger `check` function; CARGO_BUILD_JOBS capped on both functions so
  parallel rustc on heavy crates doesn't OOM the build engine; cargo registry
  + target caches shared across runs.
- prek is intentionally not run in CI — it runs locally via git hooks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 07:14:15 -07:00
b97c387252 heph.nvim: context-item promotion + Dagger headless-nvim CI (slice 11c)
Some checks failed
Build / validate (pull_request) Failing after 3s
Backend (TDD):
- task.promote {container_id, item_ref, attention?, project?}: mint a committed
  task from the item_ref-th `- [ ]` context item (1-based, document order via a
  new extract::context_item_lines) and rewrite that source line into a [[link]]
  to it. Unit + rpc_socket tests.
- resolve_id now excludes canonical-context docs, so [[Task Title]] resolves to
  the task, not its identically-titled context doc (deterministic; a general fix
  surfaced by promotion's ULID-tiebreak ambiguity).

Plugin: :Heph promote / promote_under_cursor (save-if-dirty → compute item index
with a code-fence-aware scanner mirroring extract.rs → task.promote → reload the
rewritten buffer). e2e spec (f): promote a context line, assert the new task in
next, the source line became a link, and the container backlinks the task.

CI via Dagger: a test_nvim function bakes a pinned, arch-detected Neovim
(v0.11.2 — Debian's is too old for vim.uv) onto rust:1-bookworm, builds hephd,
and runs the self-contained shim suite (cargo + target cache volumes);
build.yaml calls `dagger call test-nvim`. run.lua now fails on zero specs (no
false-green). Validated end-to-end: passing suite → exit 0, failing spec →
Dagger exit 1.

117 Rust tests + 7 nvim e2e specs green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 06:08:41 -07:00
7c9a734ebd heph.nvim: task views — next/list/capture/attention/state/log (slice 11b)
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>
2026-06-01 21:12:56 -07:00
3997e948ed heph.nvim: run e2e via mise run test-nvim, drop the Makefile
Some checks failed
Build / validate (pull_request) Failing after 3s
Make mise the dev entrypoint for the headless e2e suite, matching the repo's
mise-tasks convention (auto-discovered, shows in `mise tasks`). Dev relies on
system-installed nvim + rustc; CI will provide them via Dagger (slice 11c).
The self-contained shim runner is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 21:02:46 -07:00
ee865e5635 heph.nvim: RPC client + buffer editing + wiki-links + journal (slice 11a)
Some checks failed
Build / validate (pull_request) Failing after 4s
The primary surface begins (tech-spec §8): a Neovim plugin that is a thin
client of the local hephd over its unix-socket JSON-RPC.

- node.resolve {title} → Node|null (heph-core Store + dispatch): exact,
  owner-scoped, non-tombstoned alias-then-title match — the same mapping that
  materializes wiki links, so follow-link jumps to the node the stored link
  points at (never fuzzy search). Unit + rpc_socket integration tests.
- heph.nvim/: vim.uv unix-socket JSON-RPC client (blocking call via vim.wait,
  id-demuxed, partial-line buffered, luanil so JSON null → Lua nil; isolated
  Sessions for tests). Buffer-backed nodes (heph://node/<id>, acwrite;
  BufReadCmd→node.get / BufWriteCmd→node.update, whole-buffer body round-trips
  exactly through the CRDT). [[wiki-link]] follow on <CR>. Daily journal.
  :Heph command surface + completion.
- Headless e2e (§9): a self-contained busted-style runner (tests/e2e/runner.lua)
  — no external plugins, no network, deterministic CI exit codes. Specs: journal
  round-trip, follow-link (+ unresolved no-op), link-two-docs/backlink.
  `make -C heph.nvim test` builds hephd and runs it.

Docs: heph-nvim reference card, §14 tracker (11a done; 11b/11c/11d queued),
changelog fragment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 20:33:29 -07:00
87c76da659 docs: refresh resume state for next session (AGENTS structure + §14 order)
Some checks failed
Build / validate (pull_request) Failing after 5s
Backend is feature-complete; point the trackers at heph.nvim as the next
slice so a cold-start session resumes correctly.

- AGENTS.md: update the (always-in-context) project-structure block — all
  three daemon modes + sync + auth are done; CLI gained search/journal/auth;
  heph.nvim is the next slice. Point at tech-spec §14 as the live tracker.
- tech-spec §14: reorder "not yet done" so heph.nvim is #1 (the remaining
  build slice), with adoption refinement and the dependency-refresh sweep as
  non-blocking follow-ups.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 19:07:03 -07:00
f4db186234 hephd: OIDC client auth — device-code flow + token attach (auth 10b)
Some checks failed
Build / validate (pull_request) Failing after 9s
Close the auth loop: clients obtain a bearer token and present it to the
hub (tech-spec §13).

- oauth module: DeviceFlow (RFC 8628 — discover, start, poll handling
  authorization_pending/slow_down, refresh) + StoredToken + TokenStore
  (OS keyring via `keyring`, in-memory for tests) + current_bearer (loads
  and refreshes-on-expiry).
- heph auth login/logout: runs the device flow, prints the verification
  URL + user code, caches the token in the keyring.
- sync_once gains a bearer arg; the daemon (Daemon::spawn_sync_loop +
  sync.now) obtains it via current_bearer; RemoteStore attaches it to /rpc.
  --oidc-issuer/--oidc-client-id configure the spoke/client.
- Fix a latent panic: reqwest::blocking spins its own runtime and panics
  inside the daemon's spawn_blocking pool. All blocking auth/proxy HTTP
  (OidcVerifier JWKS, DeviceFlow, RemoteStore) now uses runtime-free `ureq`;
  async reqwest remains only for sync_once. (Caught by the new e2e test.)
- Tests (offline): device flow + refresh + token store vs a mock OAuth
  server; a full spoke->authenticated-hub loop (valid token accepted,
  missing token rejected) signed by a runtime-generated RSA key.

112 tests green; clippy -D warnings + fmt + prek clean. Slice 10 (auth)
complete; next is heph.nvim.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 16:27:36 -07:00
497c62a988 hephd: OIDC hub authentication — verification side (auth 10a)
Some checks failed
Build / validate (pull_request) Failing after 3s
Authenticate op exchange at the network boundary (tech-spec §13). The hub
now requires a valid OIDC bearer token on /sync/* and /rpc; local mode is
unchanged (no auth).

- heph-core: Store::authorize_owner_sub — single-tenant gate that claims the
  owner's oidc_sub on first sight, then authorizes only that sub (403 for any
  other identity). LocalStore impl over users.oidc_sub; RemoteStore stub.
- hephd auth module: TokenVerifier trait (mockable seam) + OidcVerifier
  (jsonwebtoken, rust_crypto). Strict validation: RS256 pinned, exact iss +
  aud, exp/nbf, required sub; JWKS discovered + cached, refetched on unknown
  kid (rotation). Claims/AuthError.
- Hub router takes Option<verifier>; an axum middleware on every route
  extracts the Bearer token, verifies it off the async worker, and runs the
  owner gate — 401 missing/invalid, 403 wrong identity, 503 IdP-unreachable.
  Open (no auth) when unconfigured, for local dev.
- main: --oidc-issuer/--oidc-audience enable the hub verifier (server mode).
- Security tests, all offline: stub-verifier middleware (missing/bad/valid +
  owner gate) and an adversarial battery driving OidcVerifier against an
  in-process mock IdP — rejects expired, wrong iss/aud, unknown kid, tampered
  signature, alg confusion (HS256/none), and missing sub. The RSA key + JWKS
  are generated at runtime (rsa/rand/base64 dev-deps) so no key is committed.
- tech-spec: add an end-of-v1 dependency-refresh pass to the roadmap.

108 tests green; clippy -D warnings + fmt + prek clean. Next: client-side
device-code login + keyring (10b).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 15:58:20 -07:00
5d54e913c2 hephd: client mode + RemoteStore (sync 9b)
Some checks failed
Build / validate (pull_request) Failing after 4s
Add the online-only escape hatch — a no-replica daemon that proxies every
Store call to a server over HTTP (tech-spec §3.1).

- Daemon is now generic over the backing store (Arc<Mutex<dyn Store +
  Send>>), so the same unix-socket surface fronts either a LocalStore
  (local/server) or a RemoteStore (client). sync::router/sync_once and the
  Ctx follow suit.
- New POST /rpc route on the hub router runs the full rpc::dispatch over
  HTTP (result-xor-error body, always 200). dispatch gains task.get and
  links.add so the proxied API is complete.
- RemoteStore (hephd): implements heph_core::Store by forwarding each call
  to /rpc via a blocking reqwest client (Store is sync; the daemon only
  calls it from the blocking pool). Error::Remote for transport failures;
  NOT_FOUND is preserved as Error::NodeNotFound. Sync primitives are
  stubbed (a client keeps no op-log).
- main: --mode client + --server-url; client skips the file lock and opens
  no LocalStore.
- tests/client_mode.rs: a RemoteStore drives node/task/search/list/health
  against a real HTTP server, and not-found maps back correctly.

102 tests green; clippy -D warnings + fmt + prek clean. Next: OIDC auth.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 15:29:28 -07:00
8c25d114c4 hephd: network sync over HTTP — hub + spoke (sync 9a)
Some checks failed
Build / validate (pull_request) Failing after 2s
Wire the existing merge engine over the network so the everyday config
(local + hub_url) syncs through a hub. Transport ratified = axum HTTP/JSON
(tech-spec §6.1, §12).

- heph-core: SyncCursors model + Store::sync_state/record_sync over the
  sync_state table (per-peer push/pull HLC cursors). Incremental, so each
  exchange transfers only the tail.
- hephd::sync: the hub router (POST /sync/push, GET /sync/pull?after=<hlc>)
  served from the shared LocalStore, and sync_once — a spoke's pull-then-
  merge, then push-tail exchange, advancing the cursors. Idempotent: a
  re-pushed op the hub already has is a no-op.
- Daemon carries optional hub config; sync.now/sync.status handled at the
  daemon (they need the hub transport the store can't reach). conflicts.
  list/resolve now reachable over the unix socket too.
- main: --mode local|server, --hub-url, --http-addr. server mode binds the
  hub HTTP endpoint on the same store; a local+hub_url spoke background-
  syncs on a 30s interval.
- tests/sync_http.rs: two spokes converge through a real-HTTP hub on an
  ephemeral port — node propagation and a divergent-scalar conflict.

Unauthenticated/single-owner for now; OIDC + per-user scoping is slice 10,
client mode + RemoteStore is 9b. 100 tests green; clippy -D warnings + fmt
+ prek clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 15:14:20 -07:00
455f172a54 heph-core: body text-CRDT via yrs (sync 8d)
Some checks failed
Build / validate (pull_request) Failing after 4s
Replace last-writer-wins for node bodies with the yrs text CRDT, so
concurrent edits to different regions of a body merge instead of one
clobbering the other (tech-spec §5, §12).

- New crate::crdt module wraps yrs: a device authors under a stable
  client_id derived from its sync origin; a whole-buffer write is diffed
  (common prefix/suffix, char-boundary safe) into the doc and the yrs
  delta is captured; merge is commutative/idempotent.
- nodes::create/update/journal maintain the body_crdt BLOB and put the
  yrs delta in the node.create/node.set op payload (body_crdt field).
  Recurrence's local checklist reset goes through the same path to keep
  body and body_crdt consistent (still records no op, as before).
- apply::node_upsert merges the body delta through the CRDT regardless of
  HLC order and drops body-conflict recording; titles + task scalars stay
  LWW with the conflict queue.
- convergence test now asserts disjoint concurrent body edits both survive
  and enqueue no conflict.

97 tests green; clippy -D warnings + fmt + prek clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 09:06:17 -07:00
16b552abd5 docs: rewrite README for the hephaestus application
Some checks failed
Build / validate (pull_request) Failing after 2s
Replace the template-residue body (docs-scaffolding focus) with content
about the actual project: what heph is, the "what is next?" discipline,
current Phase 1 status table, the workspace/crate architecture, build &
run instructions (hephd + heph CLI), and development conventions. Keep
the All-Rights-Reserved license.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 05:26:18 -07:00
662a360da8 docs: Phase 1 progress tracker (design roadmap + tech-spec §14)
Some checks failed
Build / validate (pull_request) Failing after 5s
Record what's built and the resume order for the next context session:
heph-core + hephd local mode + CLI/export + local query surface + the
sync engine (HLC, op-log, converging merge/conflict-queue) are done;
resume at yrs body-CRDT → network sync → OIDC auth → heph.nvim.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 05:23:43 -07:00
b05ddf4bb5 heph-core: op-log recording + merge/apply engine (sync 8b/8c)
Some checks failed
Build / validate (pull_request) Failing after 3s
The conceptual core of sync: every mutation records an Op, and foreign
ops are applied with merge rules to converge replicas (tech-spec §12).

Recording (8b): each node/task/link mutation appends an oplog Op stamped
with its HLC — node.create/set/tombstone, task.create/set, link.add/
remove. `Store::ops_since(cursor)` is the push cursor.

Merge/apply (8c): `Store::apply_op` replays a foreign op idempotently —
  - bodies/titles + task scalars: last-writer-wins by HLC; a discarded
    cross-device value is recorded in `conflicts` (surfaced, not dropped);
  - links: OR-set add/remove by link id;
  - tombstones: monotonic.
The local clock absorbs each applied HLC. `conflicts_list`/
`conflicts_resolve` expose the queue. `adopt_owner` rewrites a replica to
a canonical user id (basic §13 adoption) so replicas can share data.

13 tests: HLC stamping (4) + 6-case two-replica convergence (round-trip,
idempotency, scalar LWW + conflict, body LWW, link OR-set, monotonic
tombstone). 102 tests green. Body merge is LWW for now; the yrs text
CRDT (8d) upgrades concurrent body edits to auto-merge.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 21:29:20 -07:00
c81d45a291 heph-core: real HLC + persistent device origin (sync 8a)
Some checks failed
Build / validate (pull_request) Failing after 4s
First sync slice. Ratifies yrs for body merge in the tech-spec.

- hlc module: Hlc (physical, counter, origin) with a fixed-width encoding
  whose lexical order equals causal order; HlcClock generator (tick/update)
  — clock-injected, strictly monotonic. Unit + 2 proptests.
- meta table (migration v3) holds the stable per-device `origin` and the
  last HLC. next_hlc() does a read-modify-write inside the caller's
  transaction (store is single-writer, so no race), replacing the
  timestamp placeholder. Every node write is now stamped with a real,
  monotonic, causally-ordered HLC.

4 stamping integration tests (monotonic under stalled/regressed clock;
origin shared + persists across reopen; HLC resumes from persisted state).
89 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 21:13:55 -07:00
5d8ec45c55 heph-core: full-text search (FTS5)
Some checks failed
Build / validate (pull_request) Failing after 3s
Slice query-surface, part 2 (tech-spec §6). Migration v2 adds an FTS5
external-content table over nodes(title, body), kept in sync by
insert/update/delete triggers (with a backfill for existing rows).

- Store::search(query): owner-scoped, tombstones excluded, best-match
  first (FTS5 MATCH + rank). Exposed over RPC; `heph search` and
  `heph journal` CLI commands added.

3 search integration tests (title/body match, edits reflected via trigger,
tombstone exclusion, all insert paths indexed). 79 tests green. This
completes the local feature surface; the remaining slices are the
distributed/auth/nvim layer.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-31 20:43:05 -07:00