@getlore/cli 0.2.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.
Files changed (148) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +80 -0
  3. package/dist/cli/colors.d.ts +48 -0
  4. package/dist/cli/colors.js +48 -0
  5. package/dist/cli/commands/ask.d.ts +7 -0
  6. package/dist/cli/commands/ask.js +97 -0
  7. package/dist/cli/commands/auth.d.ts +10 -0
  8. package/dist/cli/commands/auth.js +484 -0
  9. package/dist/cli/commands/daemon.d.ts +22 -0
  10. package/dist/cli/commands/daemon.js +244 -0
  11. package/dist/cli/commands/docs.d.ts +7 -0
  12. package/dist/cli/commands/docs.js +188 -0
  13. package/dist/cli/commands/extensions.d.ts +7 -0
  14. package/dist/cli/commands/extensions.js +204 -0
  15. package/dist/cli/commands/misc.d.ts +7 -0
  16. package/dist/cli/commands/misc.js +172 -0
  17. package/dist/cli/commands/pending.d.ts +7 -0
  18. package/dist/cli/commands/pending.js +63 -0
  19. package/dist/cli/commands/projects.d.ts +7 -0
  20. package/dist/cli/commands/projects.js +136 -0
  21. package/dist/cli/commands/search.d.ts +7 -0
  22. package/dist/cli/commands/search.js +102 -0
  23. package/dist/cli/commands/skills.d.ts +24 -0
  24. package/dist/cli/commands/skills.js +447 -0
  25. package/dist/cli/commands/sources.d.ts +7 -0
  26. package/dist/cli/commands/sources.js +121 -0
  27. package/dist/cli/commands/sync.d.ts +31 -0
  28. package/dist/cli/commands/sync.js +768 -0
  29. package/dist/cli/helpers.d.ts +30 -0
  30. package/dist/cli/helpers.js +119 -0
  31. package/dist/core/auth.d.ts +62 -0
  32. package/dist/core/auth.js +330 -0
  33. package/dist/core/config.d.ts +41 -0
  34. package/dist/core/config.js +96 -0
  35. package/dist/core/data-repo.d.ts +31 -0
  36. package/dist/core/data-repo.js +146 -0
  37. package/dist/core/embedder.d.ts +22 -0
  38. package/dist/core/embedder.js +104 -0
  39. package/dist/core/git.d.ts +37 -0
  40. package/dist/core/git.js +140 -0
  41. package/dist/core/index.d.ts +4 -0
  42. package/dist/core/index.js +5 -0
  43. package/dist/core/insight-extractor.d.ts +26 -0
  44. package/dist/core/insight-extractor.js +114 -0
  45. package/dist/core/local-search.d.ts +43 -0
  46. package/dist/core/local-search.js +221 -0
  47. package/dist/core/themes.d.ts +15 -0
  48. package/dist/core/themes.js +77 -0
  49. package/dist/core/types.d.ts +177 -0
  50. package/dist/core/types.js +9 -0
  51. package/dist/core/user-settings.d.ts +15 -0
  52. package/dist/core/user-settings.js +42 -0
  53. package/dist/core/vector-store-lance.d.ts +98 -0
  54. package/dist/core/vector-store-lance.js +384 -0
  55. package/dist/core/vector-store-supabase.d.ts +89 -0
  56. package/dist/core/vector-store-supabase.js +295 -0
  57. package/dist/core/vector-store.d.ts +131 -0
  58. package/dist/core/vector-store.js +503 -0
  59. package/dist/daemon-runner.d.ts +8 -0
  60. package/dist/daemon-runner.js +246 -0
  61. package/dist/extensions/config.d.ts +22 -0
  62. package/dist/extensions/config.js +102 -0
  63. package/dist/extensions/proposals.d.ts +30 -0
  64. package/dist/extensions/proposals.js +178 -0
  65. package/dist/extensions/registry.d.ts +35 -0
  66. package/dist/extensions/registry.js +309 -0
  67. package/dist/extensions/sandbox.d.ts +16 -0
  68. package/dist/extensions/sandbox.js +17 -0
  69. package/dist/extensions/types.d.ts +114 -0
  70. package/dist/extensions/types.js +4 -0
  71. package/dist/extensions/worker.d.ts +1 -0
  72. package/dist/extensions/worker.js +49 -0
  73. package/dist/index.d.ts +17 -0
  74. package/dist/index.js +105 -0
  75. package/dist/mcp/handlers/archive-project.d.ts +51 -0
  76. package/dist/mcp/handlers/archive-project.js +112 -0
  77. package/dist/mcp/handlers/get-quotes.d.ts +27 -0
  78. package/dist/mcp/handlers/get-quotes.js +61 -0
  79. package/dist/mcp/handlers/get-source.d.ts +9 -0
  80. package/dist/mcp/handlers/get-source.js +40 -0
  81. package/dist/mcp/handlers/ingest.d.ts +25 -0
  82. package/dist/mcp/handlers/ingest.js +305 -0
  83. package/dist/mcp/handlers/list-projects.d.ts +4 -0
  84. package/dist/mcp/handlers/list-projects.js +16 -0
  85. package/dist/mcp/handlers/list-sources.d.ts +11 -0
  86. package/dist/mcp/handlers/list-sources.js +20 -0
  87. package/dist/mcp/handlers/research-agent.d.ts +21 -0
  88. package/dist/mcp/handlers/research-agent.js +369 -0
  89. package/dist/mcp/handlers/research.d.ts +22 -0
  90. package/dist/mcp/handlers/research.js +225 -0
  91. package/dist/mcp/handlers/retain.d.ts +18 -0
  92. package/dist/mcp/handlers/retain.js +92 -0
  93. package/dist/mcp/handlers/search.d.ts +52 -0
  94. package/dist/mcp/handlers/search.js +145 -0
  95. package/dist/mcp/handlers/sync.d.ts +47 -0
  96. package/dist/mcp/handlers/sync.js +211 -0
  97. package/dist/mcp/server.d.ts +10 -0
  98. package/dist/mcp/server.js +268 -0
  99. package/dist/mcp/tools.d.ts +16 -0
  100. package/dist/mcp/tools.js +297 -0
  101. package/dist/sync/config.d.ts +26 -0
  102. package/dist/sync/config.js +140 -0
  103. package/dist/sync/discover.d.ts +51 -0
  104. package/dist/sync/discover.js +190 -0
  105. package/dist/sync/index.d.ts +11 -0
  106. package/dist/sync/index.js +11 -0
  107. package/dist/sync/process.d.ts +50 -0
  108. package/dist/sync/process.js +285 -0
  109. package/dist/sync/processors.d.ts +24 -0
  110. package/dist/sync/processors.js +351 -0
  111. package/dist/tui/browse-handlers-ask.d.ts +30 -0
  112. package/dist/tui/browse-handlers-ask.js +372 -0
  113. package/dist/tui/browse-handlers-autocomplete.d.ts +49 -0
  114. package/dist/tui/browse-handlers-autocomplete.js +270 -0
  115. package/dist/tui/browse-handlers-extensions.d.ts +18 -0
  116. package/dist/tui/browse-handlers-extensions.js +107 -0
  117. package/dist/tui/browse-handlers-pending.d.ts +22 -0
  118. package/dist/tui/browse-handlers-pending.js +100 -0
  119. package/dist/tui/browse-handlers-research.d.ts +32 -0
  120. package/dist/tui/browse-handlers-research.js +363 -0
  121. package/dist/tui/browse-handlers-tools.d.ts +42 -0
  122. package/dist/tui/browse-handlers-tools.js +289 -0
  123. package/dist/tui/browse-handlers.d.ts +239 -0
  124. package/dist/tui/browse-handlers.js +1944 -0
  125. package/dist/tui/browse-render-extensions.d.ts +14 -0
  126. package/dist/tui/browse-render-extensions.js +114 -0
  127. package/dist/tui/browse-render-tools.d.ts +18 -0
  128. package/dist/tui/browse-render-tools.js +259 -0
  129. package/dist/tui/browse-render.d.ts +51 -0
  130. package/dist/tui/browse-render.js +599 -0
  131. package/dist/tui/browse-types.d.ts +142 -0
  132. package/dist/tui/browse-types.js +70 -0
  133. package/dist/tui/browse-ui.d.ts +10 -0
  134. package/dist/tui/browse-ui.js +432 -0
  135. package/dist/tui/browse.d.ts +17 -0
  136. package/dist/tui/browse.js +625 -0
  137. package/dist/tui/markdown.d.ts +22 -0
  138. package/dist/tui/markdown.js +223 -0
  139. package/package.json +71 -0
  140. package/plugins/claude-code/.claude-plugin/plugin.json +10 -0
  141. package/plugins/claude-code/.mcp.json +6 -0
  142. package/plugins/claude-code/skills/lore/SKILL.md +63 -0
  143. package/plugins/codex/SKILL.md +36 -0
  144. package/plugins/codex/agents/openai.yaml +10 -0
  145. package/plugins/gemini/GEMINI.md +31 -0
  146. package/plugins/gemini/gemini-extension.json +11 -0
  147. package/skills/generic-agent.md +99 -0
  148. package/skills/openclaw.md +67 -0
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2026 Mishkin Faustini. All rights reserved.
2
+
3
+ This software is proprietary and confidential. No part of this software
4
+ may be reproduced, distributed, or transmitted in any form or by any means
5
+ without the prior written permission of the copyright holder.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
10
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
13
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # Lore
2
+
3
+ > The lore behind your projects.
4
+
5
+ A research knowledge repository with **semantic search** and **citations**. Unlike memory systems that store processed facts, Lore preserves your original sources and lets you cite exactly what was said, by whom, and when.
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ npm install -g @getlore/cli
11
+
12
+ # Setup (API keys + login)
13
+ lore setup
14
+
15
+ # Add a source directory (interactive prompts)
16
+ lore sync add
17
+
18
+ # Sync and search
19
+ lore sync
20
+ lore search "user pain points"
21
+ ```
22
+
23
+ ## What It Does
24
+
25
+ - **Hybrid Search** — Semantic + keyword search with Reciprocal Rank Fusion
26
+ - **Citations** — Every insight links back to the original source with context
27
+ - **MCP Integration** — 9 tools for Claude Desktop and Claude Code
28
+ - **Agentic Research** — Claude iteratively explores your knowledge, synthesizes findings with citations
29
+ - **Multi-Machine Sync** — Content hash deduplication across machines
30
+ - **Universal Formats** — Markdown, JSONL, JSON, PDF, images, CSV, HTML, and more
31
+
32
+ ## MCP Configuration
33
+
34
+ Add to your Claude Code or Claude Desktop MCP config:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "lore": {
40
+ "command": "lore",
41
+ "args": ["mcp"]
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ If the MCP host doesn't inherit your shell environment (e.g. Claude Desktop), add your API keys to the `env` block.
48
+
49
+ ## CLI Commands
50
+
51
+ | Command | Description |
52
+ |---------|-------------|
53
+ | `lore setup` | Guided configuration wizard |
54
+ | `lore login` | Sign in with email OTP |
55
+ | `lore sync` | Sync all configured sources |
56
+ | `lore sync add` | Add a source directory |
57
+ | `lore search <query>` | Hybrid search |
58
+ | `lore research <query>` | AI-powered deep research |
59
+ | `lore browse` | Interactive TUI browser |
60
+ | `lore docs list` | List documents |
61
+ | `lore projects` | List projects |
62
+ | `lore mcp` | Start MCP server |
63
+
64
+ ## Requirements
65
+
66
+ - **Node.js** 18+
67
+ - **OpenAI API key** (embeddings)
68
+ - **Anthropic API key** (metadata extraction & research)
69
+ - **Lore account** (free — sign up via `lore login`)
70
+
71
+ ## How Sync Works
72
+
73
+ 1. **Discovery** (free) — Finds files, computes SHA256 hashes, checks for duplicates
74
+ 2. **Processing** (new files only) — Claude extracts metadata, OpenAI generates embeddings, stores in Supabase
75
+
76
+ Same content on different machines produces the same hash — no duplicate processing.
77
+
78
+ ## License
79
+
80
+ Proprietary. All rights reserved.
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ANSI color utilities for CLI output
3
+ */
4
+ export declare const colors: {
5
+ reset: string;
6
+ bold: string;
7
+ dim: string;
8
+ italic: string;
9
+ underline: string;
10
+ inverse: string;
11
+ green: string;
12
+ yellow: string;
13
+ blue: string;
14
+ magenta: string;
15
+ cyan: string;
16
+ white: string;
17
+ gray: string;
18
+ red: string;
19
+ bgGreen: string;
20
+ bgYellow: string;
21
+ bgBlue: string;
22
+ bgRed: string;
23
+ bgCyan: string;
24
+ bgMagenta: string;
25
+ };
26
+ /**
27
+ * Semantic color helpers
28
+ */
29
+ export declare const c: {
30
+ title: (s: string) => string;
31
+ success: (s: string) => string;
32
+ warning: (s: string) => string;
33
+ error: (s: string) => string;
34
+ info: (s: string) => string;
35
+ dim: (s: string) => string;
36
+ file: (s: string) => string;
37
+ path: (s: string) => string;
38
+ time: (s: string) => string;
39
+ badge: (s: string, bg: string) => string;
40
+ bold: (s: string) => string;
41
+ italic: (s: string) => string;
42
+ underline: (s: string) => string;
43
+ code: (s: string) => string;
44
+ header: (s: string) => string;
45
+ quote: (s: string) => string;
46
+ link: (s: string) => string;
47
+ list: (s: string) => string;
48
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ANSI color utilities for CLI output
3
+ */
4
+ export const colors = {
5
+ reset: '\x1b[0m',
6
+ bold: '\x1b[1m',
7
+ dim: '\x1b[2m',
8
+ italic: '\x1b[3m',
9
+ underline: '\x1b[4m',
10
+ inverse: '\x1b[7m',
11
+ green: '\x1b[32m',
12
+ yellow: '\x1b[33m',
13
+ blue: '\x1b[34m',
14
+ magenta: '\x1b[35m',
15
+ cyan: '\x1b[36m',
16
+ white: '\x1b[37m',
17
+ gray: '\x1b[90m',
18
+ red: '\x1b[31m',
19
+ bgGreen: '\x1b[42m',
20
+ bgYellow: '\x1b[43m',
21
+ bgBlue: '\x1b[44m',
22
+ bgRed: '\x1b[41m',
23
+ bgCyan: '\x1b[46m',
24
+ bgMagenta: '\x1b[45m',
25
+ };
26
+ /**
27
+ * Semantic color helpers
28
+ */
29
+ export const c = {
30
+ title: (s) => `${colors.bold}${colors.cyan}${s}${colors.reset}`,
31
+ success: (s) => `${colors.green}${s}${colors.reset}`,
32
+ warning: (s) => `${colors.yellow}${s}${colors.reset}`,
33
+ error: (s) => `${colors.bgRed}${colors.white} ${s} ${colors.reset}`,
34
+ info: (s) => `${colors.blue}${s}${colors.reset}`,
35
+ dim: (s) => `${colors.dim}${s}${colors.reset}`,
36
+ file: (s) => `${colors.magenta}${s}${colors.reset}`,
37
+ path: (s) => `${colors.gray}${s}${colors.reset}`,
38
+ time: (s) => `${colors.dim}${s}${colors.reset}`,
39
+ badge: (s, bg) => `${bg}${colors.white}${colors.bold} ${s} ${colors.reset}`,
40
+ bold: (s) => `${colors.bold}${s}${colors.reset}`,
41
+ italic: (s) => `${colors.italic}${s}${colors.reset}`,
42
+ underline: (s) => `${colors.underline}${s}${colors.reset}`,
43
+ code: (s) => `${colors.bgMagenta}${colors.white}${s}${colors.reset}`,
44
+ header: (s) => `${colors.bold}${colors.cyan}${s}${colors.reset}`,
45
+ quote: (s) => `${colors.dim}${colors.italic}${s}${colors.reset}`,
46
+ link: (s) => `${colors.underline}${colors.blue}${s}${colors.reset}`,
47
+ list: (s) => `${colors.yellow}•${colors.reset} ${s}`,
48
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * lore ask - AI-powered query of the knowledge base
3
+ *
4
+ * Searches relevant sources and uses AI to synthesize an answer.
5
+ */
6
+ import { Command } from 'commander';
7
+ export declare function registerAskCommand(program: Command, dataDir: string): void;
@@ -0,0 +1,97 @@
1
+ /**
2
+ * lore ask - AI-powered query of the knowledge base
3
+ *
4
+ * Searches relevant sources and uses AI to synthesize an answer.
5
+ */
6
+ import Anthropic from '@anthropic-ai/sdk';
7
+ import { searchSources } from '../../core/vector-store.js';
8
+ import { generateEmbedding } from '../../core/embedder.js';
9
+ const SYSTEM_PROMPT = `You are a research assistant with access to a knowledge base.
10
+ Your job is to answer questions based on the provided sources.
11
+
12
+ When answering:
13
+ - Cite specific sources when making claims
14
+ - Be concise but thorough
15
+ - If the sources don't contain enough information, say so
16
+
17
+ Source format: Each source has an ID, title, and content summary.`;
18
+ export function registerAskCommand(program, dataDir) {
19
+ const dbPath = `${dataDir}/lore.lance`;
20
+ program
21
+ .command('ask <question...>')
22
+ .description('Ask questions about your knowledge base')
23
+ .option('-p, --project <name>', 'Filter sources by project')
24
+ .option('-n, --max-sources <n>', 'Maximum sources to include', '10')
25
+ .option('-m, --model <model>', 'AI model to use', 'claude-sonnet-4-20250514')
26
+ .option('-v, --verbose', 'Show source details')
27
+ .action(async (questionParts, options) => {
28
+ const question = questionParts.join(' ');
29
+ if (!process.env.ANTHROPIC_API_KEY) {
30
+ console.error('Error: ANTHROPIC_API_KEY environment variable required');
31
+ process.exit(1);
32
+ }
33
+ const maxSources = parseInt(options.maxSources || '10', 10);
34
+ try {
35
+ // Search for relevant sources
36
+ console.error('Searching knowledge base...');
37
+ const embedding = await generateEmbedding(question);
38
+ const sources = await searchSources(dbPath, embedding, {
39
+ limit: maxSources,
40
+ project: options.project,
41
+ queryText: question,
42
+ mode: 'hybrid',
43
+ });
44
+ if (sources.length === 0) {
45
+ console.error('No relevant sources found.');
46
+ if (options.project) {
47
+ console.error(`(Filtered by project: ${options.project})`);
48
+ }
49
+ process.exit(1);
50
+ }
51
+ console.error(`Found ${sources.length} relevant sources`);
52
+ if (options.verbose) {
53
+ console.error('\nSources:');
54
+ for (const source of sources) {
55
+ console.error(` - ${source.title} (${source.id})`);
56
+ }
57
+ console.error('');
58
+ }
59
+ // Build context from sources
60
+ const sourceContext = sources.map((s, i) => {
61
+ const parts = [`[Source ${i + 1}: ${s.title}]`, `ID: ${s.id}`];
62
+ if (s.summary)
63
+ parts.push(`Summary: ${s.summary}`);
64
+ if (s.themes?.length)
65
+ parts.push(`Themes: ${s.themes.map(t => t.name).join(', ')}`);
66
+ if (s.quotes?.length) {
67
+ parts.push('Key quotes:');
68
+ for (const q of s.quotes.slice(0, 3)) {
69
+ parts.push(` "${q.text}"`);
70
+ }
71
+ }
72
+ return parts.join('\n');
73
+ }).join('\n\n---\n\n');
74
+ // Stream response
75
+ console.error('Thinking...\n');
76
+ const anthropic = new Anthropic();
77
+ const stream = anthropic.messages.stream({
78
+ model: options.model || 'claude-sonnet-4-20250514',
79
+ max_tokens: 4096,
80
+ system: SYSTEM_PROMPT,
81
+ messages: [{
82
+ role: 'user',
83
+ content: `Question: ${question}\n\n---\nSources:\n${sourceContext}`
84
+ }],
85
+ });
86
+ stream.on('text', (text) => {
87
+ process.stdout.write(text);
88
+ });
89
+ await stream.finalMessage();
90
+ console.log('');
91
+ }
92
+ catch (error) {
93
+ console.error('Error:', error instanceof Error ? error.message : error);
94
+ process.exit(1);
95
+ }
96
+ });
97
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Auth Commands
3
+ *
4
+ * lore auth login — interactive OTP flow
5
+ * lore auth logout — clear session
6
+ * lore auth whoami — show current user/status
7
+ * lore setup — guided wizard (config + login + init + first sync source)
8
+ */
9
+ import type { Command } from 'commander';
10
+ export declare function registerAuthCommands(program: Command): void;