From 610dc7bd61ddf2e3efea3749e84dfd74b8a92c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 3 Feb 2026 17:41:33 +0100 Subject: [PATCH] chore: add CLAUDE.md and gitignore - Add project context file for Claude - Ignore nix result symlink Co-Authored-By: Claude Opus 4.5 --- .gitignore | 1 + CLAUDE.md | 31 +++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/CLAUDE.md b/CLAUDE.md index dfbf965..b17a289 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -78,18 +78,32 @@ The first MCP server provides search and query capabilities for NixOS configurat - Support friendly aliases: `nixos-unstable`, `nixos-24.05`, `nixos-23.11`, etc. - Can be used in place of git hashes in all tools -## Database Schema (Planned) +## Database Schema **Tables:** -- `revisions` - nixpkgs git hash, date, channel name, metadata -- `options` - per revision: name, type, default, example, description -- `declarations` - file paths where options are declared -- `files` - cached nixpkgs file contents for `get_file` tool + +1. `revisions` - Indexed nixpkgs versions + - id, git_hash (unique), channel_name, commit_date, indexed_at, option_count + +2. `options` - NixOS options with hierarchy support + - id, revision_id (FK), name, parent_path, type, default_value (JSON text), example (JSON text), description, read_only + - parent_path enables efficient "list children" queries (derived from name) + +3. `declarations` - File paths where options are declared + - id, option_id (FK), file_path, line_number + +4. `files` - Cached file contents + - id, revision_id (FK), file_path, extension, content + - Configurable whitelist of extensions (default: .nix, .json, .md, .txt, .toml, .yaml, .yml) **Indexes:** -- Full-text search on option names and descriptions -- B-tree indexes on revision + option name -- Namespace prefix indexes for category filtering +- Full-text search: PostgreSQL (tsvector/GIN), SQLite (FTS5) +- B-tree on (revision_id, name) and (revision_id, parent_path) +- B-tree on (revision_id, file_path) for file lookups + +**Cross-DB Compatibility:** +- JSON stored as TEXT (not JSONB) for SQLite compatibility +- Separate FTS implementations per database engine ## Repository Structure (Planned) @@ -168,3 +182,4 @@ labmcp/ - Nix flake must provide importable packages for other repos - Use `database/sql` interface for database abstraction - File paths in responses should use format `path/to/file.go:123` +- **Always run `go fmt ./...` before committing Go code**