@theglitchking/semantic-pages 0.4.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -401,13 +401,31 @@ The deployment guide links to the microservices overview, which links to the use
401
401
  semantic-pages --notes ./vault --stats
402
402
  ```
403
403
 
404
- ### Adding Semantic Pages to a Project (2 minutes)
404
+ ### Adding Semantic Pages to a Project (30 seconds)
405
+ ```bash
406
+ # Auto-detects hit-em-with-the-docs and configures one or two vaults
407
+ npx @theglitchking/semantic-pages@latest init
408
+
409
+ # Then start Claude — it now has 21 (or 42) note tools
410
+ claude
411
+ ```
412
+
413
+ **What `init` does**:
414
+ - Detects [hit-em-with-the-docs](https://github.com/TheGlitchKing/hit-em-with-the-docs) by checking for `.documentation/INDEX.md`, `.hewtd.json`, or the `hewtd` binary
415
+ - **If detected** → configures two vaults: `semantic-pages → .documentation/` (project docs, search-only) and `semantic-vault → .claude/.vault/` (research notes, read+write). Creates `.claude/.vault/` if absent.
416
+ - **If not detected** → configures a single vault: `semantic-pages → ./vault/` (or `--notes <path>` override). Creates the directory if absent.
417
+ - Merges into existing `.mcp.json` without clobbering other servers (playwright, etc.)
418
+ - Adds index directories to `.gitignore`
419
+
420
+ **Manual setup (if preferred)**:
405
421
  ```bash
406
422
  # Step 1: Create .mcp.json in your project root
407
423
  echo '{
408
- "semantic-pages": {
409
- "command": "npx",
410
- "args": ["-y", "semantic-pages", "--notes", "./notes"]
424
+ "mcpServers": {
425
+ "semantic-pages": {
426
+ "command": "npx",
427
+ "args": ["-y", "@theglitchking/semantic-pages@latest", "--notes", "./notes"]
428
+ }
411
429
  }
412
430
  }' > .mcp.json
413
431
 
package/dist/cli/index.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  // src/cli/index.ts
4
4
  import { program } from "commander";
5
- import { resolve } from "path";
6
- import { existsSync } from "fs";
5
+ import { resolve, join } from "path";
6
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
7
+ import { spawnSync } from "child_process";
7
8
  var TOOL_HELP = {
8
9
  // Search
9
10
  search_semantic: {
@@ -198,8 +199,8 @@ function printToolDetail(name) {
198
199
  console.log();
199
200
  }
200
201
  program.name("semantic-pages").description(
201
- "Semantic search + knowledge graph MCP server for markdown files\n\n Start MCP server: semantic-pages --notes ./vault\n Show vault stats: semantic-pages --notes ./vault --stats\n Force reindex: semantic-pages --notes ./vault --reindex\n List MCP tools: semantic-pages tools\n Tool details: semantic-pages tools search_semantic"
202
- ).version("0.4.3");
202
+ "Semantic search + knowledge graph MCP server for markdown files\n\n Auto-configure: semantic-pages init\n Start MCP server: semantic-pages --notes ./vault\n Show vault stats: semantic-pages --notes ./vault --stats\n Force reindex: semantic-pages --notes ./vault --reindex\n List MCP tools: semantic-pages tools\n Tool details: semantic-pages tools search_semantic"
203
+ ).version("0.5.0");
203
204
  program.command("tools [name]").description("List all MCP tools, or show details for a specific tool").action((name) => {
204
205
  if (name) {
205
206
  printToolDetail(name);
@@ -244,5 +245,98 @@ program.command("serve", { isDefault: true }).description("Start the MCP server
244
245
  const { startServer } = await import("../mcp/server.js");
245
246
  await startServer(notesPath, { watch: opts.watch, model: opts.model, workers: opts.workers, batchSize: opts.batchSize, quantized: opts.quantized });
246
247
  });
248
+ function detectHewtd(cwd) {
249
+ if (existsSync(join(cwd, ".documentation", "INDEX.md"))) return true;
250
+ if (existsSync(join(cwd, ".hewtd.json"))) return true;
251
+ try {
252
+ const r = spawnSync("hewtd", ["--version"], { stdio: "ignore" });
253
+ if (r.status === 0) return true;
254
+ } catch {
255
+ }
256
+ return false;
257
+ }
258
+ function readMcpJson(cwd) {
259
+ const mcpPath = join(cwd, ".mcp.json");
260
+ if (!existsSync(mcpPath)) return {};
261
+ try {
262
+ return JSON.parse(readFileSync(mcpPath, "utf8"));
263
+ } catch {
264
+ console.warn(" \u26A0 Could not parse existing .mcp.json \u2014 will merge carefully.");
265
+ return {};
266
+ }
267
+ }
268
+ function writeMcpJson(cwd, config) {
269
+ writeFileSync(join(cwd, ".mcp.json"), JSON.stringify(config, null, 2) + "\n", "utf8");
270
+ }
271
+ function ensureGitignore(cwd, entry) {
272
+ const gitignorePath = join(cwd, ".gitignore");
273
+ if (existsSync(gitignorePath)) {
274
+ const content = readFileSync(gitignorePath, "utf8");
275
+ if (!content.includes(entry)) {
276
+ writeFileSync(gitignorePath, content.trimEnd() + "\n" + entry + "\n", "utf8");
277
+ }
278
+ } else {
279
+ writeFileSync(gitignorePath, entry + "\n", "utf8");
280
+ }
281
+ }
282
+ function mcpEntry(notesPath) {
283
+ return {
284
+ type: "stdio",
285
+ command: "npx",
286
+ args: ["-y", "@theglitchking/semantic-pages@latest", "--notes", notesPath]
287
+ };
288
+ }
289
+ program.command("init").description(
290
+ "Auto-configure MCP servers for this project.\nDetects hit-em-with-the-docs and sets up one or two vaults accordingly."
291
+ ).option("--notes <path>", "Custom notes path (single-vault fallback only)").option("--cwd <path>", "Project root to configure (default: current directory)").action((opts) => {
292
+ const cwd = resolve(opts.cwd || process.cwd());
293
+ const hewtd = detectHewtd(cwd);
294
+ console.log("\nSemantic Pages \u2014 init\n");
295
+ console.log(` Project root : ${cwd}`);
296
+ console.log(` hit-em-with-the-docs : ${hewtd ? "\u2705 detected" : "not found"}
297
+ `);
298
+ const existing = readMcpJson(cwd);
299
+ const servers = existing.mcpServers ?? {};
300
+ const notesPath = opts.notes || "./vault";
301
+ if (hewtd) {
302
+ servers["semantic-pages"] = mcpEntry("./.documentation");
303
+ servers["semantic-vault"] = mcpEntry("./.claude/.vault");
304
+ const vaultDir = join(cwd, ".claude", ".vault");
305
+ if (!existsSync(vaultDir)) {
306
+ mkdirSync(vaultDir, { recursive: true });
307
+ writeFileSync(join(vaultDir, ".gitkeep"), "", "utf8");
308
+ console.log(" Created .claude/.vault/");
309
+ }
310
+ ensureGitignore(cwd, ".documentation/.semantic-pages-index/");
311
+ ensureGitignore(cwd, ".claude/.vault/.semantic-pages-index/");
312
+ console.log(" Configured semantic-pages \u2192 .documentation/ (project docs, read-only)");
313
+ console.log(" Configured semantic-vault \u2192 .claude/.vault/ (research notes, read+write)");
314
+ } else {
315
+ servers["semantic-pages"] = mcpEntry(notesPath);
316
+ const vaultDir = resolve(cwd, notesPath);
317
+ if (!existsSync(vaultDir)) {
318
+ mkdirSync(vaultDir, { recursive: true });
319
+ console.log(` Created ${notesPath}/`);
320
+ }
321
+ ensureGitignore(cwd, ".semantic-pages-index/");
322
+ console.log(` Configured semantic-pages \u2192 ${notesPath}/`);
323
+ }
324
+ writeMcpJson(cwd, { ...existing, mcpServers: servers });
325
+ console.log(" Updated .mcp.json");
326
+ console.log(" Updated .gitignore\n");
327
+ if (hewtd) {
328
+ console.log(" Next steps:");
329
+ console.log(" \u2022 Restart Claude \u2014 it will have 42 MCP tools across two vaults");
330
+ console.log(" \u2022 Search docs : mcp__semantic-pages__search_hybrid");
331
+ console.log(" \u2022 Save research : mcp__semantic-vault__create_note\n");
332
+ } else {
333
+ console.log(" Next steps:");
334
+ console.log(" \u2022 Drop .md files into the vault directory");
335
+ console.log(` \u2022 Restart Claude \u2014 it will have 21 MCP tools over ${notesPath}/
336
+ `);
337
+ console.log(" Tip: install hit-em-with-the-docs for the two-vault setup:");
338
+ console.log(" npx @theglitchking/hit-em-with-the-docs init\n");
339
+ }
340
+ });
247
341
  program.parse();
248
342
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { program } from \"commander\";\nimport { resolve } from \"node:path\";\nimport { existsSync } from \"node:fs\";\n\nconst TOOL_HELP: Record<string, { description: string; args: string; examples: string[] }> = {\n // Search\n search_semantic: {\n description: \"Vector similarity search — find notes by meaning, not just keywords\",\n args: '{ \"query\": \"string\", \"limit?\": 10 }',\n examples: [\n '{ \"query\": \"microservices architecture\", \"limit\": 5 }',\n '{ \"query\": \"how to deploy to production\" }',\n ],\n },\n search_text: {\n description: \"Full-text keyword or regex search with optional filters\",\n args: '{ \"pattern\": \"string\", \"regex?\": false, \"caseSensitive?\": false, \"pathGlob?\": \"string\", \"tagFilter?\": [\"string\"], \"limit?\": 20 }',\n examples: [\n '{ \"pattern\": \"RabbitMQ\" }',\n '{ \"pattern\": \"OAuth\\\\\\\\d\", \"regex\": true }',\n '{ \"pattern\": \"deploy\", \"pathGlob\": \"devops/**\", \"tagFilter\": [\"kubernetes\"] }',\n ],\n },\n search_graph: {\n description: \"Graph traversal — find notes connected to a concept via wikilinks and tags\",\n args: '{ \"concept\": \"string\", \"maxDepth?\": 2 }',\n examples: [\n '{ \"concept\": \"microservices\" }',\n '{ \"concept\": \"auth\", \"maxDepth\": 3 }',\n ],\n },\n search_hybrid: {\n description: \"Combined semantic + graph search — vector results re-ranked by graph proximity\",\n args: '{ \"query\": \"string\", \"limit?\": 10 }',\n examples: [\n '{ \"query\": \"event driven architecture\", \"limit\": 5 }',\n ],\n },\n\n // Read\n read_note: {\n description: \"Read the full content of a specific note by path\",\n args: '{ \"path\": \"string\" }',\n examples: [\n '{ \"path\": \"project-overview.md\" }',\n '{ \"path\": \"notes/meeting-2024-01-15.md\" }',\n ],\n },\n read_multiple_notes: {\n description: \"Batch read multiple notes in one call\",\n args: '{ \"paths\": [\"string\"] }',\n examples: [\n '{ \"paths\": [\"overview.md\", \"architecture.md\", \"deployment.md\"] }',\n ],\n },\n list_notes: {\n description: \"List all indexed notes with metadata (title, tags, link count)\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n\n // Write\n create_note: {\n description: \"Create a new markdown note with optional YAML frontmatter\",\n args: '{ \"path\": \"string\", \"content\": \"string\", \"frontmatter?\": {} }',\n examples: [\n '{ \"path\": \"new-guide.md\", \"content\": \"# Guide\\\\n\\\\nContent here.\" }',\n '{ \"path\": \"tagged.md\", \"content\": \"Content.\", \"frontmatter\": { \"title\": \"Tagged Note\", \"tags\": [\"test\"] } }',\n ],\n },\n update_note: {\n description: \"Edit note content — overwrite, append, prepend, or patch by heading\",\n args: '{ \"path\": \"string\", \"content\": \"string\", \"mode\": \"overwrite|append|prepend|patch-by-heading\", \"heading?\": \"string\" }',\n examples: [\n '{ \"path\": \"guide.md\", \"content\": \"New content.\", \"mode\": \"overwrite\" }',\n '{ \"path\": \"guide.md\", \"content\": \"\\\\n## Appendix\\\\nExtra info.\", \"mode\": \"append\" }',\n '{ \"path\": \"guide.md\", \"content\": \"Updated architecture section.\", \"mode\": \"patch-by-heading\", \"heading\": \"Architecture\" }',\n ],\n },\n delete_note: {\n description: \"Delete a note permanently (requires confirm=true)\",\n args: '{ \"path\": \"string\", \"confirm\": true }',\n examples: [\n '{ \"path\": \"old-note.md\", \"confirm\": true }',\n '{ \"path\": \"old-note.md\", \"confirm\": false } // returns warning, does not delete',\n ],\n },\n move_note: {\n description: \"Move or rename a note — automatically updates wikilinks across the vault\",\n args: '{ \"from\": \"string\", \"to\": \"string\" }',\n examples: [\n '{ \"from\": \"user-service.md\", \"to\": \"auth-service.md\" }',\n '{ \"from\": \"old/note.md\", \"to\": \"new/location/note.md\" }',\n ],\n },\n\n // Metadata\n get_frontmatter: {\n description: \"Read parsed YAML frontmatter from a note as JSON\",\n args: '{ \"path\": \"string\" }',\n examples: ['{ \"path\": \"project-overview.md\" }'],\n },\n update_frontmatter: {\n description: \"Set or delete YAML frontmatter keys — pass null to delete a key\",\n args: '{ \"path\": \"string\", \"fields\": {} }',\n examples: [\n '{ \"path\": \"note.md\", \"fields\": { \"status\": \"active\", \"priority\": 1 } }',\n '{ \"path\": \"note.md\", \"fields\": { \"deprecated_field\": null } } // deletes the key',\n ],\n },\n manage_tags: {\n description: \"Add, remove, or list tags on a note (frontmatter and inline)\",\n args: '{ \"path\": \"string\", \"action\": \"add|remove|list\", \"tags?\": [\"string\"] }',\n examples: [\n '{ \"path\": \"note.md\", \"action\": \"list\" }',\n '{ \"path\": \"note.md\", \"action\": \"add\", \"tags\": [\"important\", \"reviewed\"] }',\n '{ \"path\": \"note.md\", \"action\": \"remove\", \"tags\": [\"draft\"] }',\n ],\n },\n rename_tag: {\n description: \"Rename a tag across all notes in the vault (frontmatter + inline)\",\n args: '{ \"oldTag\": \"string\", \"newTag\": \"string\" }',\n examples: ['{ \"oldTag\": \"architecture\", \"newTag\": \"arch\" }'],\n },\n\n // Graph\n backlinks: {\n description: \"Find all notes that link TO a given note via [[wikilinks]]\",\n args: '{ \"path\": \"string\" }',\n examples: ['{ \"path\": \"microservices.md\" }'],\n },\n forwardlinks: {\n description: \"Find all notes linked FROM a given note\",\n args: '{ \"path\": \"string\" }',\n examples: ['{ \"path\": \"project-overview.md\" }'],\n },\n graph_path: {\n description: \"Find the shortest path between two notes in the knowledge graph\",\n args: '{ \"from\": \"string\", \"to\": \"string\" }',\n examples: ['{ \"from\": \"project-overview.md\", \"to\": \"user-service.md\" }'],\n },\n graph_statistics: {\n description: \"Knowledge graph stats — most connected nodes, orphans, density\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n\n // System\n get_stats: {\n description: \"Vault and index statistics — note count, chunks, embeddings, graph density\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n reindex: {\n description: \"Force a full reindex of the vault\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n};\n\nconst TOOL_CATEGORIES: Record<string, string[]> = {\n Search: [\"search_semantic\", \"search_text\", \"search_graph\", \"search_hybrid\"],\n Read: [\"read_note\", \"read_multiple_notes\", \"list_notes\"],\n Write: [\"create_note\", \"update_note\", \"delete_note\", \"move_note\"],\n Metadata: [\"get_frontmatter\", \"update_frontmatter\", \"manage_tags\", \"rename_tag\"],\n Graph: [\"backlinks\", \"forwardlinks\", \"graph_path\", \"graph_statistics\"],\n System: [\"get_stats\", \"reindex\"],\n};\n\nfunction printToolList() {\n console.log(\"\\nSemantic Pages — 21 MCP Tools\\n\");\n console.log(\"Usage: These tools are available via MCP when the server is running.\");\n console.log(\" Run `semantic-pages tools <name>` for details on a specific tool.\\n\");\n\n for (const [category, tools] of Object.entries(TOOL_CATEGORIES)) {\n console.log(` ${category}:`);\n for (const name of tools) {\n const tool = TOOL_HELP[name];\n console.log(` ${name.padEnd(24)} ${tool.description}`);\n }\n console.log();\n }\n\n console.log(\"Run `semantic-pages tools <tool-name>` for arguments and examples.\");\n}\n\nfunction printToolDetail(name: string) {\n const tool = TOOL_HELP[name];\n if (!tool) {\n console.error(`Unknown tool: ${name}`);\n console.error(`Run \\`semantic-pages tools\\` to see all available tools.`);\n process.exit(1);\n }\n\n console.log(`\\n ${name}`);\n console.log(` ${\"─\".repeat(name.length)}`);\n console.log(` ${tool.description}\\n`);\n console.log(` Arguments:`);\n console.log(` ${tool.args}\\n`);\n console.log(` Examples:`);\n for (const ex of tool.examples) {\n console.log(` ${ex}`);\n }\n console.log();\n}\n\nprogram\n .name(\"semantic-pages\")\n .description(\n \"Semantic search + knowledge graph MCP server for markdown files\\n\\n\" +\n \" Start MCP server: semantic-pages --notes ./vault\\n\" +\n \" Show vault stats: semantic-pages --notes ./vault --stats\\n\" +\n \" Force reindex: semantic-pages --notes ./vault --reindex\\n\" +\n \" List MCP tools: semantic-pages tools\\n\" +\n \" Tool details: semantic-pages tools search_semantic\"\n )\n .version(\"0.4.3\");\n\nprogram\n .command(\"tools [name]\")\n .description(\"List all MCP tools, or show details for a specific tool\")\n .action((name?: string) => {\n if (name) {\n printToolDetail(name);\n } else {\n printToolList();\n }\n process.exit(0);\n });\n\nprogram\n .command(\"serve\", { isDefault: true })\n .description(\"Start the MCP server (default command)\")\n .requiredOption(\"--notes <path>\", \"Path to markdown notes directory\")\n .option(\"--reindex\", \"Force full reindex and exit\")\n .option(\"--stats\", \"Show vault statistics and exit\")\n .option(\"--model <name>\", \"Embedding model to use (default: all-MiniLM-L6-v2, fast; use nomic-ai/nomic-embed-text-v1.5 for higher quality)\")\n .option(\"--workers <n>\", \"Number of worker threads for parallel embedding\", parseInt)\n .option(\"--batch-size <n>\", \"Texts per ONNX forward pass (default: 8)\", parseInt)\n .option(\"--no-quantized\", \"Use full-precision model instead of quantized (slower, slightly higher quality)\")\n .option(\"--no-watch\", \"Disable file watcher\")\n .action(async (opts) => {\n const notesPath = resolve(opts.notes);\n\n if (!existsSync(notesPath)) {\n console.error(`Error: notes directory not found: ${notesPath}`);\n process.exit(1);\n }\n\n if (opts.stats) {\n const { Indexer } = await import(\"../core/indexer.js\");\n const indexer = new Indexer(notesPath);\n const docs = await indexer.indexAll();\n console.log(`Notes: ${docs.length}`);\n console.log(`Chunks: ${docs.reduce((n: number, d: any) => n + d.chunks.length, 0)}`);\n console.log(`Wikilinks: ${docs.reduce((n: number, d: any) => n + d.wikilinks.length, 0)}`);\n console.log(`Tags: ${new Set(docs.flatMap((d: any) => d.tags)).size} unique`);\n process.exit(0);\n }\n\n if (opts.reindex) {\n const { createServer } = await import(\"../mcp/server.js\");\n await createServer(notesPath, {\n watch: false,\n waitForReady: true,\n model: opts.model,\n workers: opts.workers,\n batchSize: opts.batchSize,\n quantized: opts.quantized,\n onProgress: (embedded, total) => {\n process.stderr.write(`\\rEmbedding ${embedded}/${total} chunks...`);\n },\n });\n process.stderr.write(\"\\n\");\n console.log(\"Reindex complete.\");\n process.exit(0);\n }\n\n // Default: start MCP server on stdio\n const { startServer } = await import(\"../mcp/server.js\");\n await startServer(notesPath, { watch: opts.watch, model: opts.model, workers: opts.workers, batchSize: opts.batchSize, quantized: opts.quantized });\n });\n\nprogram.parse();\n"],"mappings":";;;AAEA,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAE3B,IAAM,YAAuF;AAAA;AAAA,EAE3F,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb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AK,CAAC;AAAA,EAChB;AAGA,QAAM,EAAE,YAAY,IAAI,MAAM,OAAO,kBAAkB;AACvD,QAAM,YAAY,WAAW,EAAE,OAAO,KAAK,OAAO,OAAO,KAAK,OAAO,SAAS,KAAK,SAAS,WAAW,KAAK,WAAW,WAAW,KAAK,UAAU,CAAC;AACpJ,CAAC;AAEH,QAAQ,MAAM;","names":[]}
1
+ {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { program } from \"commander\";\nimport { resolve, join } from \"node:path\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { spawnSync } from \"node:child_process\";\n\nconst TOOL_HELP: Record<string, { description: string; args: string; examples: string[] }> = {\n // Search\n search_semantic: {\n description: \"Vector similarity search — find notes by meaning, not just keywords\",\n args: '{ \"query\": \"string\", \"limit?\": 10 }',\n examples: [\n '{ \"query\": \"microservices architecture\", \"limit\": 5 }',\n '{ \"query\": \"how to deploy to production\" }',\n ],\n },\n search_text: {\n description: \"Full-text keyword or regex search with optional filters\",\n args: '{ \"pattern\": \"string\", \"regex?\": false, \"caseSensitive?\": false, \"pathGlob?\": \"string\", \"tagFilter?\": [\"string\"], \"limit?\": 20 }',\n examples: [\n '{ \"pattern\": \"RabbitMQ\" }',\n '{ \"pattern\": \"OAuth\\\\\\\\d\", \"regex\": true }',\n '{ \"pattern\": \"deploy\", \"pathGlob\": \"devops/**\", \"tagFilter\": [\"kubernetes\"] }',\n ],\n },\n search_graph: {\n description: \"Graph traversal — find notes connected to a concept via wikilinks and tags\",\n args: '{ \"concept\": \"string\", \"maxDepth?\": 2 }',\n examples: [\n '{ \"concept\": \"microservices\" }',\n '{ \"concept\": \"auth\", \"maxDepth\": 3 }',\n ],\n },\n search_hybrid: {\n description: \"Combined semantic + graph search — vector results re-ranked by graph proximity\",\n args: '{ \"query\": \"string\", \"limit?\": 10 }',\n examples: [\n '{ \"query\": \"event driven architecture\", \"limit\": 5 }',\n ],\n },\n\n // Read\n read_note: {\n description: \"Read the full content of a specific note by path\",\n args: '{ \"path\": \"string\" }',\n examples: [\n '{ \"path\": \"project-overview.md\" }',\n '{ \"path\": \"notes/meeting-2024-01-15.md\" }',\n ],\n },\n read_multiple_notes: {\n description: \"Batch read multiple notes in one call\",\n args: '{ \"paths\": [\"string\"] }',\n examples: [\n '{ \"paths\": [\"overview.md\", \"architecture.md\", \"deployment.md\"] }',\n ],\n },\n list_notes: {\n description: \"List all indexed notes with metadata (title, tags, link count)\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n\n // Write\n create_note: {\n description: \"Create a new markdown note with optional YAML frontmatter\",\n args: '{ \"path\": \"string\", \"content\": \"string\", \"frontmatter?\": {} }',\n examples: [\n '{ \"path\": \"new-guide.md\", \"content\": \"# Guide\\\\n\\\\nContent here.\" }',\n '{ \"path\": \"tagged.md\", \"content\": \"Content.\", \"frontmatter\": { \"title\": \"Tagged Note\", \"tags\": [\"test\"] } }',\n ],\n },\n update_note: {\n description: \"Edit note content — overwrite, append, prepend, or patch by heading\",\n args: '{ \"path\": \"string\", \"content\": \"string\", \"mode\": \"overwrite|append|prepend|patch-by-heading\", \"heading?\": \"string\" }',\n examples: [\n '{ \"path\": \"guide.md\", \"content\": \"New content.\", \"mode\": \"overwrite\" }',\n '{ \"path\": \"guide.md\", \"content\": \"\\\\n## Appendix\\\\nExtra info.\", \"mode\": \"append\" }',\n '{ \"path\": \"guide.md\", \"content\": \"Updated architecture section.\", \"mode\": \"patch-by-heading\", \"heading\": \"Architecture\" }',\n ],\n },\n delete_note: {\n description: \"Delete a note permanently (requires confirm=true)\",\n args: '{ \"path\": \"string\", \"confirm\": true }',\n examples: [\n '{ \"path\": \"old-note.md\", \"confirm\": true }',\n '{ \"path\": \"old-note.md\", \"confirm\": false } // returns warning, does not delete',\n ],\n },\n move_note: {\n description: \"Move or rename a note — automatically updates wikilinks across the vault\",\n args: '{ \"from\": \"string\", \"to\": \"string\" }',\n examples: [\n '{ \"from\": \"user-service.md\", \"to\": \"auth-service.md\" }',\n '{ \"from\": \"old/note.md\", \"to\": \"new/location/note.md\" }',\n ],\n },\n\n // Metadata\n get_frontmatter: {\n description: \"Read parsed YAML frontmatter from a note as JSON\",\n args: '{ \"path\": \"string\" }',\n examples: ['{ \"path\": \"project-overview.md\" }'],\n },\n update_frontmatter: {\n description: \"Set or delete YAML frontmatter keys — pass null to delete a key\",\n args: '{ \"path\": \"string\", \"fields\": {} }',\n examples: [\n '{ \"path\": \"note.md\", \"fields\": { \"status\": \"active\", \"priority\": 1 } }',\n '{ \"path\": \"note.md\", \"fields\": { \"deprecated_field\": null } } // deletes the key',\n ],\n },\n manage_tags: {\n description: \"Add, remove, or list tags on a note (frontmatter and inline)\",\n args: '{ \"path\": \"string\", \"action\": \"add|remove|list\", \"tags?\": [\"string\"] }',\n examples: [\n '{ \"path\": \"note.md\", \"action\": \"list\" }',\n '{ \"path\": \"note.md\", \"action\": \"add\", \"tags\": [\"important\", \"reviewed\"] }',\n '{ \"path\": \"note.md\", \"action\": \"remove\", \"tags\": [\"draft\"] }',\n ],\n },\n rename_tag: {\n description: \"Rename a tag across all notes in the vault (frontmatter + inline)\",\n args: '{ \"oldTag\": \"string\", \"newTag\": \"string\" }',\n examples: ['{ \"oldTag\": \"architecture\", \"newTag\": \"arch\" }'],\n },\n\n // Graph\n backlinks: {\n description: \"Find all notes that link TO a given note via [[wikilinks]]\",\n args: '{ \"path\": \"string\" }',\n examples: ['{ \"path\": \"microservices.md\" }'],\n },\n forwardlinks: {\n description: \"Find all notes linked FROM a given note\",\n args: '{ \"path\": \"string\" }',\n examples: ['{ \"path\": \"project-overview.md\" }'],\n },\n graph_path: {\n description: \"Find the shortest path between two notes in the knowledge graph\",\n args: '{ \"from\": \"string\", \"to\": \"string\" }',\n examples: ['{ \"from\": \"project-overview.md\", \"to\": \"user-service.md\" }'],\n },\n graph_statistics: {\n description: \"Knowledge graph stats — most connected nodes, orphans, density\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n\n // System\n get_stats: {\n description: \"Vault and index statistics — note count, chunks, embeddings, graph density\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n reindex: {\n description: \"Force a full reindex of the vault\",\n args: \"{}\",\n examples: [\"{}\"],\n },\n};\n\nconst TOOL_CATEGORIES: Record<string, string[]> = {\n Search: [\"search_semantic\", \"search_text\", \"search_graph\", \"search_hybrid\"],\n Read: [\"read_note\", \"read_multiple_notes\", \"list_notes\"],\n Write: [\"create_note\", \"update_note\", \"delete_note\", \"move_note\"],\n Metadata: [\"get_frontmatter\", \"update_frontmatter\", \"manage_tags\", \"rename_tag\"],\n Graph: [\"backlinks\", \"forwardlinks\", \"graph_path\", \"graph_statistics\"],\n System: [\"get_stats\", \"reindex\"],\n};\n\nfunction printToolList() {\n console.log(\"\\nSemantic Pages — 21 MCP Tools\\n\");\n console.log(\"Usage: These tools are available via MCP when the server is running.\");\n console.log(\" Run `semantic-pages tools <name>` for details on a specific tool.\\n\");\n\n for (const [category, tools] of Object.entries(TOOL_CATEGORIES)) {\n console.log(` ${category}:`);\n for (const name of tools) {\n const tool = TOOL_HELP[name];\n console.log(` ${name.padEnd(24)} ${tool.description}`);\n }\n console.log();\n }\n\n console.log(\"Run `semantic-pages tools <tool-name>` for arguments and examples.\");\n}\n\nfunction printToolDetail(name: string) {\n const tool = TOOL_HELP[name];\n if (!tool) {\n console.error(`Unknown tool: ${name}`);\n console.error(`Run \\`semantic-pages tools\\` to see all available tools.`);\n process.exit(1);\n }\n\n console.log(`\\n ${name}`);\n console.log(` ${\"─\".repeat(name.length)}`);\n console.log(` ${tool.description}\\n`);\n console.log(` Arguments:`);\n console.log(` ${tool.args}\\n`);\n console.log(` Examples:`);\n for (const ex of tool.examples) {\n console.log(` ${ex}`);\n }\n console.log();\n}\n\nprogram\n .name(\"semantic-pages\")\n .description(\n \"Semantic search + knowledge graph MCP server for markdown files\\n\\n\" +\n \" Auto-configure: semantic-pages init\\n\" +\n \" Start MCP server: semantic-pages --notes ./vault\\n\" +\n \" Show vault stats: semantic-pages --notes ./vault --stats\\n\" +\n \" Force reindex: semantic-pages --notes ./vault --reindex\\n\" +\n \" List MCP tools: semantic-pages tools\\n\" +\n \" Tool details: semantic-pages tools search_semantic\"\n )\n .version(\"0.5.0\");\n\nprogram\n .command(\"tools [name]\")\n .description(\"List all MCP tools, or show details for a specific tool\")\n .action((name?: string) => {\n if (name) {\n printToolDetail(name);\n } else {\n printToolList();\n }\n process.exit(0);\n });\n\nprogram\n .command(\"serve\", { isDefault: true })\n .description(\"Start the MCP server (default command)\")\n .requiredOption(\"--notes <path>\", \"Path to markdown notes directory\")\n .option(\"--reindex\", \"Force full reindex and exit\")\n .option(\"--stats\", \"Show vault statistics and exit\")\n .option(\"--model <name>\", \"Embedding model to use (default: all-MiniLM-L6-v2, fast; use nomic-ai/nomic-embed-text-v1.5 for higher quality)\")\n .option(\"--workers <n>\", \"Number of worker threads for parallel embedding\", parseInt)\n .option(\"--batch-size <n>\", \"Texts per ONNX forward pass (default: 8)\", parseInt)\n .option(\"--no-quantized\", \"Use full-precision model instead of quantized (slower, slightly higher quality)\")\n .option(\"--no-watch\", \"Disable file watcher\")\n .action(async (opts) => {\n const notesPath = resolve(opts.notes);\n\n if (!existsSync(notesPath)) {\n console.error(`Error: notes directory not found: ${notesPath}`);\n process.exit(1);\n }\n\n if (opts.stats) {\n const { Indexer } = await import(\"../core/indexer.js\");\n const indexer = new Indexer(notesPath);\n const docs = await indexer.indexAll();\n console.log(`Notes: ${docs.length}`);\n console.log(`Chunks: ${docs.reduce((n: number, d: any) => n + d.chunks.length, 0)}`);\n console.log(`Wikilinks: ${docs.reduce((n: number, d: any) => n + d.wikilinks.length, 0)}`);\n console.log(`Tags: ${new Set(docs.flatMap((d: any) => d.tags)).size} unique`);\n process.exit(0);\n }\n\n if (opts.reindex) {\n const { createServer } = await import(\"../mcp/server.js\");\n await createServer(notesPath, {\n watch: false,\n waitForReady: true,\n model: opts.model,\n workers: opts.workers,\n batchSize: opts.batchSize,\n quantized: opts.quantized,\n onProgress: (embedded, total) => {\n process.stderr.write(`\\rEmbedding ${embedded}/${total} chunks...`);\n },\n });\n process.stderr.write(\"\\n\");\n console.log(\"Reindex complete.\");\n process.exit(0);\n }\n\n // Default: start MCP server on stdio\n const { startServer } = await import(\"../mcp/server.js\");\n await startServer(notesPath, { watch: opts.watch, model: opts.model, workers: opts.workers, batchSize: opts.batchSize, quantized: opts.quantized });\n });\n\n// ─── init command ────────────────────────────────────────────────────────────\n\nfunction detectHewtd(cwd: string): boolean {\n // 1. hit-em-with-the-docs always creates .documentation/INDEX.md\n if (existsSync(join(cwd, \".documentation\", \"INDEX.md\"))) return true;\n // 2. Explicit config file\n if (existsSync(join(cwd, \".hewtd.json\"))) return true;\n // 3. hewtd binary available in PATH\n try {\n const r = spawnSync(\"hewtd\", [\"--version\"], { stdio: \"ignore\" });\n if (r.status === 0) return true;\n } catch {}\n return false;\n}\n\nfunction readMcpJson(cwd: string): Record<string, unknown> {\n const mcpPath = join(cwd, \".mcp.json\");\n if (!existsSync(mcpPath)) return {};\n try {\n return JSON.parse(readFileSync(mcpPath, \"utf8\"));\n } catch {\n console.warn(\" ⚠ Could not parse existing .mcp.json — will merge carefully.\");\n return {};\n }\n}\n\nfunction writeMcpJson(cwd: string, config: Record<string, unknown>): void {\n writeFileSync(join(cwd, \".mcp.json\"), JSON.stringify(config, null, 2) + \"\\n\", \"utf8\");\n}\n\nfunction ensureGitignore(cwd: string, entry: string): void {\n const gitignorePath = join(cwd, \".gitignore\");\n if (existsSync(gitignorePath)) {\n const content = readFileSync(gitignorePath, \"utf8\");\n if (!content.includes(entry)) {\n writeFileSync(gitignorePath, content.trimEnd() + \"\\n\" + entry + \"\\n\", \"utf8\");\n }\n } else {\n writeFileSync(gitignorePath, entry + \"\\n\", \"utf8\");\n }\n}\n\nfunction mcpEntry(notesPath: string) {\n return {\n type: \"stdio\",\n command: \"npx\",\n args: [\"-y\", \"@theglitchking/semantic-pages@latest\", \"--notes\", notesPath],\n };\n}\n\nprogram\n .command(\"init\")\n .description(\n \"Auto-configure MCP servers for this project.\\n\" +\n \"Detects hit-em-with-the-docs and sets up one or two vaults accordingly.\"\n )\n .option(\"--notes <path>\", \"Custom notes path (single-vault fallback only)\")\n .option(\"--cwd <path>\", \"Project root to configure (default: current directory)\")\n .action((opts) => {\n const cwd = resolve(opts.cwd || process.cwd());\n const hewtd = detectHewtd(cwd);\n\n console.log(\"\\nSemantic Pages — init\\n\");\n console.log(` Project root : ${cwd}`);\n console.log(` hit-em-with-the-docs : ${hewtd ? \"✅ detected\" : \"not found\"}\\n`);\n\n // Read existing .mcp.json so we don't clobber other servers (e.g. playwright)\n const existing = readMcpJson(cwd);\n const servers: Record<string, unknown> = (existing as any).mcpServers ?? {};\n const notesPath: string = (opts.notes as string) || \"./vault\";\n\n if (hewtd) {\n // Two-vault setup\n servers[\"semantic-pages\"] = mcpEntry(\"./.documentation\");\n servers[\"semantic-vault\"] = mcpEntry(\"./.claude/.vault\");\n\n // Create .claude/.vault/ if absent\n const vaultDir = join(cwd, \".claude\", \".vault\");\n if (!existsSync(vaultDir)) {\n mkdirSync(vaultDir, { recursive: true });\n writeFileSync(join(vaultDir, \".gitkeep\"), \"\", \"utf8\");\n console.log(\" Created .claude/.vault/\");\n }\n\n // Gitignore both indexes\n ensureGitignore(cwd, \".documentation/.semantic-pages-index/\");\n ensureGitignore(cwd, \".claude/.vault/.semantic-pages-index/\");\n\n console.log(\" Configured semantic-pages → .documentation/ (project docs, read-only)\");\n console.log(\" Configured semantic-vault → .claude/.vault/ (research notes, read+write)\");\n } else {\n // Single-vault fallback\n servers[\"semantic-pages\"] = mcpEntry(notesPath);\n\n // Create vault dir if absent\n const vaultDir = resolve(cwd, notesPath);\n if (!existsSync(vaultDir)) {\n mkdirSync(vaultDir, { recursive: true });\n console.log(` Created ${notesPath}/`);\n }\n\n ensureGitignore(cwd, \".semantic-pages-index/\");\n\n console.log(` Configured semantic-pages → ${notesPath}/`);\n }\n\n writeMcpJson(cwd, { ...existing, mcpServers: servers });\n console.log(\" Updated .mcp.json\");\n console.log(\" Updated .gitignore\\n\");\n\n if (hewtd) {\n console.log(\" Next steps:\");\n console.log(\" • Restart Claude — it will have 42 MCP tools across two vaults\");\n console.log(\" • Search docs : mcp__semantic-pages__search_hybrid\");\n console.log(\" • Save research : mcp__semantic-vault__create_note\\n\");\n } else {\n console.log(\" Next steps:\");\n console.log(\" • Drop .md files into the vault directory\");\n console.log(` • Restart Claude — it will have 21 MCP tools over ${notesPath}/\\n`);\n console.log(\" Tip: install hit-em-with-the-docs for the two-vault setup:\");\n console.log(\" npx @theglitchking/hit-em-with-the-docs init\\n\");\n }\n });\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nprogram.parse();\n"],"mappings":";;;AAEA,SAAS,eAAe;AACxB,SAAS,SAAS,YAAY;AAC9B,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,iBAAiB;AAE1B,IAAM,YAAuF;AAAA;AAAA,EAE3F,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,eAAe;AAAA,IACb,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,WAAW;AAAA,IACT,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAAA,EACA,qBAAqB;AAAA,IACnB,aAAa;AAAA,IACb,MAAM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AAAA,EACxE,OAAO;AACL,YAAQ,IAAI,eAAe;AAC3B,YAAQ,IAAI,oDAA+C;AAC3D,YAAQ,IAAI,mEAAyD,SAAS;AAAA,CAAK;AACnF,YAAQ,IAAI,8DAA8D;AAC1E,YAAQ,IAAI,oDAAoD;AAAA,EAClE;AACF,CAAC;AAIH,QAAQ,MAAM;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theglitchking/semantic-pages",
3
- "version": "0.4.9",
3
+ "version": "0.5.0",
4
4
  "description": "Semantic search + knowledge graph MCP server for any folder of markdown files",
5
5
  "type": "module",
6
6
  "main": "./dist/core/index.js",