Commit Graph

7 Commits

Author SHA1 Message Date
Arnav 52c9f2bae2 feat(server): run a vault as a Dockerized HTTP + MCP memory service (#185)
Everything else here is local: skills on your machine, a vault on your disk.
This puts a vault behind a URL so an agent elsewhere can search and write it.

One container, one vault, one API key. The vault stays plain markdown on a
mounted volume, so Obsidian still opens it. The container does no LLM work --
search and packing delegate to the existing graphrag/context_pack modules, and
the caller's agent does the thinking.

- obsidian_wiki/server.py: four vault functions, five REST routes and four MCP
  tools as transport over them. Auth is one bearer key; the process refuses to
  start without WIKI_API_KEY unless WIKI_ALLOW_ANONYMOUS=1. Every path is
  resolved inside the vault or refused.
- Dockerfile, docker-compose.yml, .dockerignore, and a ghcr push on v* tags.
- New [server] extra; the core wheel stays dependency-free.
- docs/deployment.md, plus the WIKI_* vars in configuration.md and .env.example.

Requires mcp>=2.0: 2.0 renamed FastMCP to MCPServer, and session_manager only
exists once streamable_http_app() has been called -- a mounted sub-app's own
lifespan is ignored, so it is wired into the FastAPI lifespan by hand.
2026-08-21 14:37:37 -07:00
ar9av 9cf167480d feat(packaging): ship the Brain extension in the wheel
Loading an unpacked extension needs a directory on disk, so pip users had no
way to reach the feature at all. The extension now ships under
_data/extension/ and `obsidian-wiki info` prints the path to point Chrome at.

install.sh now handles both origins: a checkout stages a copy of the package
(so the host survives the checkout later moving into a TCC-protected folder),
while a wheel install uses the already-importable package and stages nothing.

The private signing key moved out of the repo to ~/.obsidian-wiki/. This is
load-bearing, not tidiness: hatchling's force-include copies straight from the
working tree and honours neither .gitignore nor the target's exclude list, so
every file in a force-included directory ships. Verified empirically — the key
appeared in both wheel and sdist until it was moved out, and exclude patterns
did not stop it. pyproject now says so at the include site.
2026-08-14 23:50:46 -07:00
Arnav 9c260f78aa fix(packaging): bundle scripts/ in the wheel (#152) (#155)
The daily-update skill's Setup Mode references scripts/daily-update.sh,
the launchd plist, and wiki-notify.sh via $OBSIDIAN_WIKI_REPO/scripts/ —
same class of gap as #143 (the Stop hook), which didn't cover this
directory. force-include scripts/ under obsidian_wiki/_data/scripts/ so
pip/uv installs actually have it, and exclude __pycache__/*.pyc from the
wheel target since force-include copies straight from the working tree
(a local scripts/__pycache__ was otherwise leaking stray .pyc files in).
2026-07-25 22:04:17 -07:00
ar9av 14bdb41096 fix(packaging): bundle wiki-stop-capture.sh in the wheel (#143)
The wiki-setup skill wires a Claude Code Stop hook pointing at
<REPO_PATH>/.claude/hooks/wiki-stop-capture.sh, but /.claude is pruned
from the sdist, so the script was missing from the published wheel and
the installed hook dangled at a nonexistent path.

- force-include the hook into the wheel under _data/hooks/ (and re-add it
  to the sdist, which the wheel is built from)
- wiki-setup now resolves the packaged hooks/ path, falls back to the
  source-checkout .claude/hooks/ path, then to a GitHub raw fetch
- wiki-setup now creates .manifest.json so 'obsidian-wiki doctor' passes
  its required-core-files check (secondary note in the issue)
- add regression tests pinning the packaging config and skill wiring
2026-07-18 09:37:34 -07:00
ar9av e87ef958b2 feat(graph-analysis): wikilink graph analysis with community detection and god nodes
Adds obsidian-wiki graph-analyse <vault> — computes god nodes, community
clusters, surprising cross-community connections, dead-ends, and isolated
pages from the vault's wikilink graph. No LLM, no API calls.

- New obsidian_wiki/graph_analysis.py: parse_vault_graph() (wikilink + tag
  extraction), god_nodes() (degree ranking), detect_communities_greedy()
  (label-propagation, pure Python, O(n·k)), detect_communities() (tries
  leidenalg+igraph first, falls back to greedy), surprising_connections()
  (cross-community edges ranked by inverse sqrt of cross-degree product),
  analyse_vault() top-level entry returning JSON-ready dict.
- CLI: graph-analyse <vault> [--top N] [--pretty]
- Optional obsidian-wiki[graph] extra for Leiden (leidenalg + igraph).
- wiki-status SKILL.md insights mode updated: now calls graph-analyse first
  instead of building the wikilink graph manually, with fallback instructions.
- 27 new tests covering parsing, metrics, community detection, surprising
  connections, full integration, and CLI.
2026-06-30 13:47:16 -07:00
ar9av 7535910719 feat(ast-extractor): local code structure extraction with no LLM calls
Adds `obsidian-wiki ast-extract <path>` — a free, local pass that extracts
classes, functions, imports, and inheritance edges from code files using
deterministic regex patterns before any token is spent on the LLM.

- New `obsidian_wiki/ast_extractor.py`: Graph/Node/Edge datamodel + per-language
  LangSpec patterns for Python, JS/TS, Go, Rust, Java, Kotlin, Ruby, C/C++,
  Swift, Shell (12 languages). Outputs god_nodes (top hubs by degree), stats,
  and a node-link JSON dict compatible with any graph tool.
- New `ast-extract` CLI subcommand with `--pretty` flag.
- Optional `obsidian-wiki[ast]` extra for tree-sitter upgrade path.
- wiki-ingest SKILL.md gets Step 1c: run ast-extract first on code sources,
  seed entity pages from class nodes, skip sending code files to the LLM.
- 19 new tests covering file extraction, directory merge, CLI output, edge cases.
2026-06-30 13:27:30 -07:00
Arnav 46e699b91f Package as a pip-installable PyPI distribution (#72)
* feat(pypi): package obsidian-wiki as a pip-installable distribution (#71)

Add a PyPI package so users can install without cloning the repo.

- pyproject.toml (hatchling, no runtime deps); force-include .skills/ and
  bootstrap files into the wheel under obsidian_wiki/_data/ — repo root stays
  the single source of truth. Force-include .skills/ into the sdist too, or
  hatchling's VCS walker drops it (the committed agent symlink mirrors shadow
  the real .skills/<name> files).
- obsidian_wiki CLI: Python port of setup.sh. `obsidian-wiki setup` writes
  ~/.obsidian-wiki/config and symlinks all skills into every supported agent
  (--copy / --project / --project-only); plus `list` and `info`.
- .github/workflows/publish.yml: build + twine check + skill-bundle assertion,
  publish to PyPI on v* tags via Trusted Publishing (OIDC).
- README + SETUP: pip install instructions; gitignore build artifacts.

* build(pypi): derive version from git tag via hatch-vcs; skip-existing on publish

Align the package version with the repo's CalVer release tags (v2026.05.2 ->
2026.5.2) so tagging a release is the version bump and future release tags
auto-publish the matching version.
2026-05-27 21:21:39 +05:30