generated from eblume/project-template
heph.nvim: :Heph home — a base index/landing page for the zk
Some checks failed
Build / validate (pull_request) Failing after 5m3s
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>
This commit is contained in:
parent
9249ca46a1
commit
e99c284941
6 changed files with 62 additions and 1 deletions
|
|
@ -18,5 +18,5 @@ Begin the v1 prototype (Phase 1, tech-spec §11.1), built in TDD slices:
|
|||
- `heph.nvim` slice 11b (§8) — task views: `list` is enriched to return titled rows (the same shape as `next`, with the canonical-context id) so the Organizational survey needs no per-row `node.get`. The plugin gains the Tactical **`:Heph next`** and Organizational **`:Heph list`** views (`<CR>` opens a task's canonical-context doc), task **capture**, **set-attention**, **done/drop**, **skip**, and per-task **`log`** append — each resolving "the current task" from the buffer (a task node, or a context doc via its `canonical-context` backlink). A `vim.ui.select` picker (Telescope auto-upgrade when installed) backs `:Heph search`/`capture`/`attention`. Headless e2e adds the capture→next→context→checklist→done workflow and the recurring fresh-checklist workflow (completing a recurring task rolls it forward and the next occurrence presents an all-unchecked checklist).
|
||||
- `heph.nvim` slice 11c (§8) — promotion + CI: `task.promote` mints a committed task from a `- [ ]` context-item line (addressed by its 1-based index) and rewrites that line into a `[[link]]` to the new task; `:Heph promote` does this for the line under the cursor. Wiki-link resolution now excludes a task's canonical-context doc, so `[[Task Title]]` resolves to the task itself (not its identically-titled context doc). The headless e2e suite runs in CI via a Dagger function that bakes a pinned, arch-detected Neovim onto a Rust image and runs the same self-contained suite developers run natively with `mise run test-nvim`; the runner fails on a zero-spec discovery so a misconfigured path can't pass silently.
|
||||
- `heph.nvim` managed daemon — plug-and-play by default: `require("heph").setup({})` spawns and supervises a local `hephd` against the default paths when none is running, kills only the daemon it spawned on exit, and self-heals (respawns + reconnects if the daemon dies mid-session). A daemon you started yourself (a `server`/`client` architecture, or a service) is always respected — the plugin only spawns when nothing is serving the socket; with `autostart = false` it connects only and warns if unreachable. `$HEPH_SOCKET` / `$HEPH_DB` isolate a development Neovim onto a separate daemon + DB.
|
||||
- `heph.nvim` follow-or-create: pressing `<CR>` on a `[[wiki-link]]` whose target doesn't exist yet now **creates** a doc with that title and opens it (the zettelkasten gesture), materializing the source's backlink — so you can link a journal entry to a brand-new note in one keystroke. Plus `:Heph doc <title>` to create a standalone wiki entry.
|
||||
- `heph.nvim` follow-or-create: pressing `<CR>` on a `[[wiki-link]]` whose target doesn't exist yet now **creates** a doc with that title and opens it (the zettelkasten gesture), materializing the source's backlink — so you can link a journal entry to a brand-new note in one keystroke. Plus `:Heph doc <title>` to create a standalone wiki entry, and `:Heph home` — a single designated landing/index page (open-or-create by title, configurable via `opts.home`) to grow a map of content around.
|
||||
- Dev/installed isolation tooling: a `mise run dev` task runs the working-tree `hephd` on isolated `.dev/` paths, and a how-to ([[install-heph]]) covers installing `heph`/`hephd` from the forge (build-from-source), the lazy.nvim plugin setup, and pointing a dev Neovim at the dev daemon via `$HEPH_SOCKET`/`$HEPH_DB` so it never touches the installed store.
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ edits, else adding the `wiki` link directly).
|
|||
|
||||
| Command | Action |
|
||||
|---|---|
|
||||
| `:Heph home` | Open the home / index landing page (created on first use; title via `opts.home`) |
|
||||
| `:Heph today` / `:Heph journal <YYYY-MM-DD>` | Open today's / a dated journal |
|
||||
| `:Heph follow` (also `<CR>` in a node buffer) | Follow the `[[link]]` under the cursor — **creating** the target doc if it doesn't exist yet |
|
||||
| `:Heph doc <title>` | Create (and open) a new wiki doc |
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ local ATTENTIONS = { "white", "orange", "red", "blue" }
|
|||
--- subcommand -> handler(args: string[])
|
||||
M.subs = {
|
||||
-- knowledge base
|
||||
home = function()
|
||||
local cfg = require("heph").config or {}
|
||||
require("heph.home").open(cfg.home)
|
||||
end,
|
||||
today = function()
|
||||
require("heph.journal").open()
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ M.defaults = {
|
|||
autostart = true,
|
||||
--- hephd binary for autostart (on PATH for an installed heph).
|
||||
bin = "hephd",
|
||||
--- Title of the home / index page (`:Heph home`).
|
||||
home = "Home",
|
||||
--- Set the default `<leader>h*` keymaps. `false` to opt out.
|
||||
keymaps = true,
|
||||
}
|
||||
|
|
|
|||
27
heph.nvim/lua/heph/home.lua
Normal file
27
heph.nvim/lua/heph/home.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
--- The home / index page (tech-spec §8): a single designated `doc` that is the
|
||||
--- base landing page of the knowledge base — a stable place to grow a map of
|
||||
--- content. Open-or-create by title, so the first `:Heph home` mints it and
|
||||
--- every later one returns the same doc.
|
||||
|
||||
local rpc = require("heph.rpc")
|
||||
|
||||
local M = {}
|
||||
|
||||
--- Open (creating if absent) the home page titled `title` (default "Home").
|
||||
--- Returns the node.
|
||||
function M.open(title)
|
||||
title = (title and #title > 0) and title or "Home"
|
||||
local node = rpc.call("node.resolve", { title = title })
|
||||
if not node then
|
||||
node = rpc.call("node.create", {
|
||||
kind = "doc",
|
||||
title = title,
|
||||
body = "# " .. title .. "\n\n",
|
||||
})
|
||||
require("heph.util").notify("created home page [[" .. title .. "]]")
|
||||
end
|
||||
require("heph.node").open(node.id)
|
||||
return node
|
||||
end
|
||||
|
||||
return M
|
||||
27
heph.nvim/tests/e2e/home_spec.lua
Normal file
27
heph.nvim/tests/e2e/home_spec.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
-- The home / index landing page: open-or-create by title, idempotent.
|
||||
|
||||
local h = require("e2e.helpers")
|
||||
|
||||
describe("home page", function()
|
||||
local ctx
|
||||
before_each(function()
|
||||
ctx = h.start()
|
||||
end)
|
||||
after_each(function()
|
||||
h.stop(ctx)
|
||||
end)
|
||||
|
||||
it("creates the home page on first open and reuses it after", function()
|
||||
local n1 = require("heph.home").open("Home")
|
||||
assert.is_truthy(n1.id)
|
||||
assert.are.equal("heph://node/" .. n1.id, vim.api.nvim_buf_get_name(0))
|
||||
assert.are.equal("doc", n1.kind)
|
||||
|
||||
-- Reopening returns the SAME doc (open-or-create is idempotent by title).
|
||||
local n2 = require("heph.home").open("Home")
|
||||
assert.are.equal(n1.id, n2.id)
|
||||
|
||||
-- It's a real, resolvable wiki target, so other notes can [[Home]] into it.
|
||||
assert.are.equal(n1.id, ctx.q:call("node.resolve", { title = "Home" }).id)
|
||||
end)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue