@gmickel/gno 0.3.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 (131) hide show
  1. package/README.md +256 -0
  2. package/assets/skill/SKILL.md +112 -0
  3. package/assets/skill/cli-reference.md +327 -0
  4. package/assets/skill/examples.md +234 -0
  5. package/assets/skill/mcp-reference.md +159 -0
  6. package/package.json +90 -0
  7. package/src/app/constants.ts +313 -0
  8. package/src/cli/colors.ts +65 -0
  9. package/src/cli/commands/ask.ts +545 -0
  10. package/src/cli/commands/cleanup.ts +105 -0
  11. package/src/cli/commands/collection/add.ts +120 -0
  12. package/src/cli/commands/collection/index.ts +10 -0
  13. package/src/cli/commands/collection/list.ts +108 -0
  14. package/src/cli/commands/collection/remove.ts +64 -0
  15. package/src/cli/commands/collection/rename.ts +95 -0
  16. package/src/cli/commands/context/add.ts +67 -0
  17. package/src/cli/commands/context/check.ts +153 -0
  18. package/src/cli/commands/context/index.ts +10 -0
  19. package/src/cli/commands/context/list.ts +109 -0
  20. package/src/cli/commands/context/rm.ts +52 -0
  21. package/src/cli/commands/doctor.ts +393 -0
  22. package/src/cli/commands/embed.ts +462 -0
  23. package/src/cli/commands/get.ts +356 -0
  24. package/src/cli/commands/index-cmd.ts +119 -0
  25. package/src/cli/commands/index.ts +102 -0
  26. package/src/cli/commands/init.ts +328 -0
  27. package/src/cli/commands/ls.ts +217 -0
  28. package/src/cli/commands/mcp/config.ts +300 -0
  29. package/src/cli/commands/mcp/index.ts +24 -0
  30. package/src/cli/commands/mcp/install.ts +203 -0
  31. package/src/cli/commands/mcp/paths.ts +470 -0
  32. package/src/cli/commands/mcp/status.ts +222 -0
  33. package/src/cli/commands/mcp/uninstall.ts +158 -0
  34. package/src/cli/commands/mcp.ts +20 -0
  35. package/src/cli/commands/models/clear.ts +103 -0
  36. package/src/cli/commands/models/index.ts +32 -0
  37. package/src/cli/commands/models/list.ts +214 -0
  38. package/src/cli/commands/models/path.ts +51 -0
  39. package/src/cli/commands/models/pull.ts +199 -0
  40. package/src/cli/commands/models/use.ts +85 -0
  41. package/src/cli/commands/multi-get.ts +400 -0
  42. package/src/cli/commands/query.ts +220 -0
  43. package/src/cli/commands/ref-parser.ts +108 -0
  44. package/src/cli/commands/reset.ts +191 -0
  45. package/src/cli/commands/search.ts +136 -0
  46. package/src/cli/commands/shared.ts +156 -0
  47. package/src/cli/commands/skill/index.ts +19 -0
  48. package/src/cli/commands/skill/install.ts +197 -0
  49. package/src/cli/commands/skill/paths-cmd.ts +81 -0
  50. package/src/cli/commands/skill/paths.ts +191 -0
  51. package/src/cli/commands/skill/show.ts +73 -0
  52. package/src/cli/commands/skill/uninstall.ts +141 -0
  53. package/src/cli/commands/status.ts +205 -0
  54. package/src/cli/commands/update.ts +68 -0
  55. package/src/cli/commands/vsearch.ts +188 -0
  56. package/src/cli/context.ts +64 -0
  57. package/src/cli/errors.ts +64 -0
  58. package/src/cli/format/search-results.ts +211 -0
  59. package/src/cli/options.ts +183 -0
  60. package/src/cli/program.ts +1330 -0
  61. package/src/cli/run.ts +213 -0
  62. package/src/cli/ui.ts +92 -0
  63. package/src/config/defaults.ts +20 -0
  64. package/src/config/index.ts +55 -0
  65. package/src/config/loader.ts +161 -0
  66. package/src/config/paths.ts +87 -0
  67. package/src/config/saver.ts +153 -0
  68. package/src/config/types.ts +280 -0
  69. package/src/converters/adapters/markitdownTs/adapter.ts +140 -0
  70. package/src/converters/adapters/officeparser/adapter.ts +126 -0
  71. package/src/converters/canonicalize.ts +89 -0
  72. package/src/converters/errors.ts +218 -0
  73. package/src/converters/index.ts +51 -0
  74. package/src/converters/mime.ts +163 -0
  75. package/src/converters/native/markdown.ts +115 -0
  76. package/src/converters/native/plaintext.ts +56 -0
  77. package/src/converters/path.ts +48 -0
  78. package/src/converters/pipeline.ts +159 -0
  79. package/src/converters/registry.ts +74 -0
  80. package/src/converters/types.ts +123 -0
  81. package/src/converters/versions.ts +24 -0
  82. package/src/index.ts +27 -0
  83. package/src/ingestion/chunker.ts +238 -0
  84. package/src/ingestion/index.ts +32 -0
  85. package/src/ingestion/language.ts +276 -0
  86. package/src/ingestion/sync.ts +671 -0
  87. package/src/ingestion/types.ts +219 -0
  88. package/src/ingestion/walker.ts +235 -0
  89. package/src/llm/cache.ts +467 -0
  90. package/src/llm/errors.ts +191 -0
  91. package/src/llm/index.ts +58 -0
  92. package/src/llm/nodeLlamaCpp/adapter.ts +133 -0
  93. package/src/llm/nodeLlamaCpp/embedding.ts +165 -0
  94. package/src/llm/nodeLlamaCpp/generation.ts +88 -0
  95. package/src/llm/nodeLlamaCpp/lifecycle.ts +317 -0
  96. package/src/llm/nodeLlamaCpp/rerank.ts +94 -0
  97. package/src/llm/registry.ts +86 -0
  98. package/src/llm/types.ts +129 -0
  99. package/src/mcp/resources/index.ts +151 -0
  100. package/src/mcp/server.ts +229 -0
  101. package/src/mcp/tools/get.ts +220 -0
  102. package/src/mcp/tools/index.ts +160 -0
  103. package/src/mcp/tools/multi-get.ts +263 -0
  104. package/src/mcp/tools/query.ts +226 -0
  105. package/src/mcp/tools/search.ts +119 -0
  106. package/src/mcp/tools/status.ts +81 -0
  107. package/src/mcp/tools/vsearch.ts +198 -0
  108. package/src/pipeline/chunk-lookup.ts +44 -0
  109. package/src/pipeline/expansion.ts +256 -0
  110. package/src/pipeline/explain.ts +115 -0
  111. package/src/pipeline/fusion.ts +185 -0
  112. package/src/pipeline/hybrid.ts +535 -0
  113. package/src/pipeline/index.ts +64 -0
  114. package/src/pipeline/query-language.ts +118 -0
  115. package/src/pipeline/rerank.ts +223 -0
  116. package/src/pipeline/search.ts +261 -0
  117. package/src/pipeline/types.ts +328 -0
  118. package/src/pipeline/vsearch.ts +348 -0
  119. package/src/store/index.ts +41 -0
  120. package/src/store/migrations/001-initial.ts +196 -0
  121. package/src/store/migrations/index.ts +20 -0
  122. package/src/store/migrations/runner.ts +187 -0
  123. package/src/store/sqlite/adapter.ts +1242 -0
  124. package/src/store/sqlite/index.ts +7 -0
  125. package/src/store/sqlite/setup.ts +129 -0
  126. package/src/store/sqlite/types.ts +28 -0
  127. package/src/store/types.ts +506 -0
  128. package/src/store/vector/index.ts +13 -0
  129. package/src/store/vector/sqlite-vec.ts +373 -0
  130. package/src/store/vector/stats.ts +152 -0
  131. package/src/store/vector/types.ts +115 -0
@@ -0,0 +1,234 @@
1
+ # GNO Usage Examples
2
+
3
+ Real-world examples for common tasks.
4
+
5
+ ## Getting Started
6
+
7
+ ### Index a folder of docs
8
+
9
+ ```bash
10
+ # Initialize
11
+ gno init
12
+
13
+ # Add your docs folder
14
+ gno collection add ~/Documents/work --name work
15
+
16
+ # Build index
17
+ gno index
18
+ ```
19
+
20
+ ### Index multiple folders
21
+
22
+ ```bash
23
+ gno init
24
+ gno collection add ~/notes --name notes --pattern "**/*.md"
25
+ gno collection add ~/work/contracts --name contracts --pattern "**/*.{pdf,docx}"
26
+ gno index
27
+ ```
28
+
29
+ ## Searching
30
+
31
+ ### Find by keywords
32
+
33
+ ```bash
34
+ # Simple search
35
+ gno search "quarterly report"
36
+
37
+ # More results
38
+ gno search "budget" -n 20
39
+
40
+ # Filter to collection
41
+ gno search "NDA" -c contracts
42
+ ```
43
+
44
+ ### Find by meaning (semantic)
45
+
46
+ ```bash
47
+ # Semantic search finds related concepts
48
+ gno vsearch "how to cancel subscription"
49
+
50
+ # Even if docs say "terminate agreement"
51
+ gno vsearch "end contract early"
52
+ ```
53
+
54
+ ### Best quality search
55
+
56
+ ```bash
57
+ # Hybrid combines keywords + semantics + reranking
58
+ gno query "deployment process"
59
+
60
+ # See how results were found
61
+ gno query "deployment" --explain
62
+ ```
63
+
64
+ ## Getting Answers
65
+
66
+ ### Q&A with citations
67
+
68
+ ```bash
69
+ # Just retrieve relevant chunks
70
+ gno ask "what are the payment terms"
71
+
72
+ # Get an AI-generated answer
73
+ gno ask "what are the payment terms" --answer
74
+ ```
75
+
76
+ ### Scoped answers
77
+
78
+ ```bash
79
+ # Search only contracts
80
+ gno ask "termination clause" -c contracts --answer
81
+
82
+ # Limit answer length
83
+ gno ask "summarize project goals" --answer --max-answer-tokens 200
84
+ ```
85
+
86
+ ## Reading Documents
87
+
88
+ ### Get full document
89
+
90
+ ```bash
91
+ # By URI
92
+ gno get gno://work/readme.md
93
+
94
+ # By document ID
95
+ gno get "#a1b2c3d4"
96
+
97
+ # With line numbers
98
+ gno get gno://notes/meeting.md --line-numbers
99
+ ```
100
+
101
+ ### Get specific lines
102
+
103
+ ```bash
104
+ # Start at line 50
105
+ gno get gno://work/report.md --from 50
106
+
107
+ # Get 20 lines starting at 100
108
+ gno get gno://work/report.md --from 100 -l 20
109
+ ```
110
+
111
+ ### List documents
112
+
113
+ ```bash
114
+ # All documents
115
+ gno ls
116
+
117
+ # In a collection
118
+ gno ls work
119
+
120
+ # As JSON
121
+ gno ls --json
122
+ ```
123
+
124
+ ## JSON Output (Scripting)
125
+
126
+ ### Search results to JSON
127
+
128
+ ```bash
129
+ # Get URIs of matches
130
+ gno search "api endpoint" --json | jq '.[] | .uri'
131
+
132
+ # Get snippets
133
+ gno search "config" --json | jq '.[] | {uri, snippet}'
134
+ ```
135
+
136
+ ### Check index health
137
+
138
+ ```bash
139
+ # Get stats
140
+ gno status --json | jq '{docs: .totalDocuments, chunks: .totalChunks}'
141
+
142
+ # Run diagnostics
143
+ gno doctor --json
144
+ ```
145
+
146
+ ### Batch processing
147
+
148
+ ```bash
149
+ # Export all document IDs
150
+ gno ls --json | jq -r '.[].docid' > doc-ids.txt
151
+
152
+ # Search and process results
153
+ gno search "error" --json | jq -r '.[] | .uri' | while read uri; do
154
+ echo "Processing: $uri"
155
+ gno get "$uri" > "output/$(basename $uri)"
156
+ done
157
+ ```
158
+
159
+ ## Maintenance
160
+
161
+ ### Update index after changes
162
+
163
+ ```bash
164
+ # Sync files from disk
165
+ gno update
166
+
167
+ # Full re-index
168
+ gno index
169
+ ```
170
+
171
+ ### Git integration
172
+
173
+ ```bash
174
+ # Pull and re-index
175
+ gno index --git-pull
176
+
177
+ # Useful for docs repos
178
+ gno update --git-pull
179
+ ```
180
+
181
+ ### Model management
182
+
183
+ ```bash
184
+ # List models and status
185
+ gno models list
186
+
187
+ # Switch to quality preset
188
+ gno models use quality
189
+
190
+ # Download models
191
+ gno models pull
192
+ ```
193
+
194
+ ## Tips
195
+
196
+ ### Speed vs Quality
197
+
198
+ | Command | Speed | Quality | Use When |
199
+ |---------|-------|---------|----------|
200
+ | `gno search` | Fast | Good for keywords | Exact phrase matching |
201
+ | `gno vsearch` | Medium | Good for concepts | Finding similar meaning |
202
+ | `gno query` | Slower | Best | Important queries |
203
+
204
+ ### Output formats
205
+
206
+ ```bash
207
+ # Human readable (default)
208
+ gno search "query"
209
+
210
+ # JSON (scripting)
211
+ gno search "query" --json
212
+
213
+ # File list (for piping)
214
+ gno search "query" --files
215
+
216
+ # CSV (spreadsheets)
217
+ gno search "query" --csv
218
+
219
+ # Markdown (docs)
220
+ gno search "query" --md
221
+ ```
222
+
223
+ ### Large result sets
224
+
225
+ ```bash
226
+ # Increase limit
227
+ gno search "common term" -n 50
228
+
229
+ # Filter by score
230
+ gno search "common term" --min-score 0.7
231
+
232
+ # Get full content
233
+ gno search "term" --full
234
+ ```
@@ -0,0 +1,159 @@
1
+ # GNO MCP Reference
2
+
3
+ GNO provides an MCP (Model Context Protocol) server for AI integration.
4
+
5
+ ## Setup
6
+
7
+ ### Claude Desktop
8
+
9
+ Add to `claude_desktop_config.json`:
10
+
11
+ ```json
12
+ {
13
+ "mcpServers": {
14
+ "gno": {
15
+ "command": "gno",
16
+ "args": ["mcp"]
17
+ }
18
+ }
19
+ }
20
+ ```
21
+
22
+ Config location:
23
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
24
+ - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
25
+ - Linux: `~/.config/Claude/claude_desktop_config.json`
26
+
27
+ ### Start Server
28
+
29
+ ```bash
30
+ gno mcp
31
+ ```
32
+
33
+ Runs JSON-RPC 2.0 over stdio.
34
+
35
+ ## Tools
36
+
37
+ ### gno.search
38
+
39
+ BM25 keyword search.
40
+
41
+ ```json
42
+ {
43
+ "query": "search terms",
44
+ "collection": "optional-collection",
45
+ "limit": 5,
46
+ "minScore": 0.5,
47
+ "lang": "en"
48
+ }
49
+ ```
50
+
51
+ ### gno.vsearch
52
+
53
+ Vector semantic search. Same parameters as `gno.search`.
54
+
55
+ ### gno.query
56
+
57
+ Hybrid search (best quality).
58
+
59
+ ```json
60
+ {
61
+ "query": "search terms",
62
+ "collection": "optional-collection",
63
+ "limit": 5,
64
+ "expand": true,
65
+ "rerank": true
66
+ }
67
+ ```
68
+
69
+ ### gno.get
70
+
71
+ Retrieve document by reference.
72
+
73
+ ```json
74
+ {
75
+ "ref": "gno://collection/path or #docid",
76
+ "fromLine": 1,
77
+ "lineCount": 100,
78
+ "lineNumbers": true
79
+ }
80
+ ```
81
+
82
+ ### gno.multi_get
83
+
84
+ Retrieve multiple documents.
85
+
86
+ ```json
87
+ {
88
+ "refs": ["gno://work/doc1.md", "#a1b2c3d4"],
89
+ "maxBytes": 10240,
90
+ "lineNumbers": true
91
+ }
92
+ ```
93
+
94
+ Or by pattern:
95
+
96
+ ```json
97
+ {
98
+ "pattern": "work/**/*.md",
99
+ "maxBytes": 10240
100
+ }
101
+ ```
102
+
103
+ ### gno.status
104
+
105
+ Get index status.
106
+
107
+ ```json
108
+ {}
109
+ ```
110
+
111
+ ## Resources
112
+
113
+ Documents accessible as MCP resources:
114
+
115
+ ```
116
+ gno://{collection}/{path}
117
+ ```
118
+
119
+ Examples:
120
+ - `gno://work/contracts/nda.docx`
121
+ - `gno://notes/2025/01/meeting.md`
122
+
123
+ Returns Markdown content with line numbers.
124
+
125
+ ## Response Format
126
+
127
+ All tools return:
128
+
129
+ ```json
130
+ {
131
+ "content": [
132
+ { "type": "text", "text": "Human-readable summary" }
133
+ ],
134
+ "structuredContent": {
135
+ "results": [...],
136
+ "meta": { "query": "...", "mode": "hybrid" }
137
+ }
138
+ }
139
+ ```
140
+
141
+ ## Error Handling
142
+
143
+ Errors return:
144
+
145
+ ```json
146
+ {
147
+ "isError": true,
148
+ "content": [
149
+ { "type": "text", "text": "Error: Document not found" }
150
+ ]
151
+ }
152
+ ```
153
+
154
+ ## Graceful Degradation
155
+
156
+ `gno.query` degrades gracefully:
157
+ - No vectors → BM25 only
158
+ - No expansion model → skips expansion
159
+ - No rerank model → skips reranking
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "@gmickel/gno",
3
+ "version": "0.3.0",
4
+ "description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
5
+ "keywords": [
6
+ "search",
7
+ "semantic-search",
8
+ "rag",
9
+ "vector-search",
10
+ "embeddings",
11
+ "local-first",
12
+ "mcp",
13
+ "llm"
14
+ ],
15
+ "author": "Gordon Mickel <gordon@mickel.tech>",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/gmickel/gno.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/gmickel/gno/issues"
23
+ },
24
+ "homepage": "https://gno.sh",
25
+ "type": "module",
26
+ "module": "src/index.ts",
27
+ "bin": {
28
+ "gno": "src/index.ts"
29
+ },
30
+ "files": [
31
+ "src",
32
+ "assets"
33
+ ],
34
+ "engines": {
35
+ "bun": ">=1.0.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "dev": "bun run --hot src/index.ts",
42
+ "build": "bun build src/index.ts",
43
+ "start": "bun run src/index.ts",
44
+ "lint": "biome check",
45
+ "lint:fix": "biome check --write",
46
+ "test": "bun test",
47
+ "test:watch": "bun test --watch",
48
+ "test:coverage": "bun test --coverage",
49
+ "test:coverage:html": "bun test --coverage --html",
50
+ "typecheck": "tsgo --noEmit",
51
+ "lint:typeaware": "bun x oxlint --type-aware",
52
+ "reset": "bun run src/index.ts reset --confirm",
53
+ "docs:verify": "bun run scripts/docs-verify.ts",
54
+ "website:install": "cd website && bundle install",
55
+ "website:dev": "cd website && make serve",
56
+ "website:build": "cd website && make build",
57
+ "website:demos": "cd website/demos && ./build-demos.sh",
58
+ "version:patch": "npm version patch --no-git-tag-version",
59
+ "version:minor": "npm version minor --no-git-tag-version",
60
+ "version:major": "npm version major --no-git-tag-version",
61
+ "prerelease": "bun run lint && bun run typecheck && bun test",
62
+ "release:dry-run": "gh workflow run publish.yml -f publish=false",
63
+ "release:trigger": "gh workflow run publish.yml -f publish=true"
64
+ },
65
+ "dependencies": {
66
+ "@modelcontextprotocol/sdk": "^1.25.1",
67
+ "commander": "^14.0.2",
68
+ "franc": "^6.2.0",
69
+ "markitdown-ts": "^0.0.8",
70
+ "node-llama-cpp": "^3.14.5",
71
+ "officeparser": "^5.2.2",
72
+ "picocolors": "^1.1.1",
73
+ "sqlite-vec": "^0.1.7-alpha.2",
74
+ "zod": "^4.2.1"
75
+ },
76
+ "devDependencies": {
77
+ "@biomejs/biome": "2.3.10",
78
+ "@types/bun": "latest",
79
+ "@typescript/native-preview": "^7.0.0-dev.20251215.1",
80
+ "ajv": "^8.17.1",
81
+ "ajv-formats": "^3.0.1",
82
+ "evalite": "^1.0.0-beta.15",
83
+ "lefthook": "^2.0.12",
84
+ "oxlint-tsgolint": "^0.10.0",
85
+ "ultracite": "^6.5.0"
86
+ },
87
+ "peerDependencies": {
88
+ "typescript": "^5"
89
+ }
90
+ }