@gmickel/gno 0.9.6 → 0.10.1

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 (41) hide show
  1. package/README.md +15 -14
  2. package/assets/skill/SKILL.md +31 -0
  3. package/assets/skill/cli-reference.md +46 -8
  4. package/assets/skill/examples.md +44 -0
  5. package/assets/skill/mcp-reference.md +46 -1
  6. package/package.json +1 -1
  7. package/src/cli/CLAUDE.md +24 -0
  8. package/src/cli/commands/tags.ts +718 -0
  9. package/src/cli/options.ts +2 -0
  10. package/src/cli/program.ts +167 -0
  11. package/src/core/errors.ts +4 -0
  12. package/src/core/tags.ts +102 -0
  13. package/src/ingestion/frontmatter.ts +325 -0
  14. package/src/ingestion/sync.ts +66 -1
  15. package/src/mcp/CLAUDE.md +21 -0
  16. package/src/mcp/resources/index.ts +110 -1
  17. package/src/mcp/tools/capture.ts +68 -1
  18. package/src/mcp/tools/index.ts +34 -0
  19. package/src/mcp/tools/list-tags.ts +112 -0
  20. package/src/mcp/tools/query.ts +5 -1
  21. package/src/mcp/tools/search.ts +5 -1
  22. package/src/mcp/tools/vsearch.ts +5 -1
  23. package/src/pipeline/hybrid.ts +78 -7
  24. package/src/pipeline/search.ts +2 -0
  25. package/src/pipeline/types.ts +4 -0
  26. package/src/pipeline/vsearch.ts +71 -21
  27. package/src/serve/CLAUDE.md +21 -0
  28. package/src/serve/public/components/CaptureModal.tsx +23 -1
  29. package/src/serve/public/components/TagFacets.tsx +454 -0
  30. package/src/serve/public/components/TagInput.tsx +565 -0
  31. package/src/serve/public/components/editor/CodeMirrorEditor.tsx +10 -13
  32. package/src/serve/public/globals.built.css +1 -1
  33. package/src/serve/public/globals.css +54 -0
  34. package/src/serve/public/pages/DocView.tsx +153 -1
  35. package/src/serve/public/pages/Search.tsx +353 -203
  36. package/src/serve/routes/api.ts +323 -32
  37. package/src/serve/server.ts +7 -0
  38. package/src/store/migrations/003-doc-tags.ts +56 -0
  39. package/src/store/migrations/index.ts +2 -1
  40. package/src/store/sqlite/adapter.ts +282 -34
  41. package/src/store/types.ts +80 -2
package/README.md CHANGED
@@ -303,20 +303,21 @@ graph TD
303
303
 
304
304
  ## Features
305
305
 
306
- | Feature | Description |
307
- | :------------------ | :---------------------------------------------------- |
308
- | **Hybrid Search** | BM25 + vector + RRF fusion + cross-encoder reranking |
309
- | **Document Editor** | Create, edit, delete docs with live markdown preview |
310
- | **Web UI** | Visual dashboard for search, browse, edit, and AI Q&A |
311
- | **REST API** | HTTP API for custom tools and integrations |
312
- | **Multi-Format** | Markdown, PDF, DOCX, XLSX, PPTX, plain text |
313
- | **Local LLM** | AI answers via llama.cpp, no API keys |
314
- | **Privacy First** | 100% offline, zero telemetry, your data stays yours |
315
- | **MCP Server** | Works with Claude Desktop, Cursor, Zed, + 8 more |
316
- | **Collections** | Organize sources with patterns, excludes, contexts |
317
- | **Multilingual** | 30+ languages, auto-detection, cross-lingual search |
318
- | **Incremental** | SHA-256 tracking, only changed files re-indexed |
319
- | **Keyboard First** | ⌘N capture, ⌘K search, ⌘/ shortcuts, ⌘S save |
306
+ | Feature | Description |
307
+ | :------------------ | :----------------------------------------------------------------------------- |
308
+ | **Hybrid Search** | BM25 + vector + RRF fusion + cross-encoder reranking |
309
+ | **Document Editor** | Create, edit, delete docs with live markdown preview |
310
+ | **Web UI** | Visual dashboard for search, browse, edit, and AI Q&A |
311
+ | **REST API** | HTTP API for custom tools and integrations |
312
+ | **Multi-Format** | Markdown, PDF, DOCX, XLSX, PPTX, plain text |
313
+ | **Local LLM** | AI answers via llama.cpp, no API keys |
314
+ | **Privacy First** | 100% offline, zero telemetry, your data stays yours |
315
+ | **MCP Server** | Works with Claude Desktop, Cursor, Zed, + 8 more |
316
+ | **Collections** | Organize sources with patterns, excludes, contexts |
317
+ | **Tag Filtering** | Frontmatter tags with hierarchical paths, filter via `--tags-any`/`--tags-all` |
318
+ | **Multilingual** | 30+ languages, auto-detection, cross-lingual search |
319
+ | **Incremental** | SHA-256 tracking, only changed files re-indexed |
320
+ | **Keyboard First** | ⌘N capture, ⌘K search, ⌘/ shortcuts, ⌘S save |
320
321
 
321
322
  ---
322
323
 
@@ -22,6 +22,8 @@ Fast local semantic search for your documents. Index once, search instantly. No
22
22
  - User needs to **set up MCP** for document access
23
23
  - User wants a **web UI** to browse/search documents
24
24
  - User asks to **get AI answers** from their documents
25
+ - User wants to **tag, categorize, or label** documents
26
+ - User needs to **filter search by tags** or categories
25
27
 
26
28
  ## Quick Start
27
29
 
@@ -59,6 +61,10 @@ gno search "api" -n 10
59
61
  # Filter by collection
60
62
  gno query "auth" --collection work
61
63
 
64
+ # Filter by tags
65
+ gno search "api" --tags-any project,work # Has ANY of these tags
66
+ gno query "auth" --tags-all security,prod # Has ALL of these tags
67
+
62
68
  # Search modes (for query/ask)
63
69
  gno query "topic" --fast # ~0.7s, skip expansion/rerank
64
70
  gno query "topic" # ~2-3s, default with rerank
@@ -135,6 +141,31 @@ gno context add "/" "Corporate knowledge base"
135
141
  gno context add "work:" "Work documents and contracts"
136
142
  ```
137
143
 
144
+ ### Tags
145
+
146
+ | Command | Description |
147
+ | -------------------------- | ------------------------- |
148
+ | `gno tags` | List all tags with counts |
149
+ | `gno tags add <doc> <tag>` | Add tag to document |
150
+ | `gno tags rm <doc> <tag>` | Remove tag from document |
151
+
152
+ ```bash
153
+ # List tags
154
+ gno tags
155
+ gno tags --collection work
156
+ gno tags --prefix project/ # Hierarchical tags
157
+
158
+ # Add/remove tags
159
+ gno tags add gno://work/readme.md project/api
160
+ gno tags rm "#a1b2c3d4" draft
161
+
162
+ # Filter searches by tags
163
+ gno search "api" --tags-any project,work
164
+ gno query "auth" --tags-all security,reviewed
165
+ ```
166
+
167
+ Tag format: lowercase, alphanumeric, hyphens, dots. Hierarchical with `/` (e.g., `project/web`, `status/draft`).
168
+
138
169
  ### Web UI
139
170
 
140
171
  | Command | Description |
@@ -103,14 +103,16 @@ BM25 keyword search.
103
103
  gno search <query> [options]
104
104
  ```
105
105
 
106
- | Option | Default | Description |
107
- | ------------------ | ------- | --------------------------- |
108
- | `-n` | 5 | Max results |
109
- | `--min-score` | 0 | Minimum score (0-1) |
110
- | `-c, --collection` | all | Filter to collection |
111
- | `--full` | false | Full content (not snippets) |
112
- | `--line-numbers` | false | Include line numbers |
113
- | `--lang` | auto | Language filter |
106
+ | Option | Default | Description |
107
+ | ------------------ | ------- | -------------------------------- |
108
+ | `-n` | 5 | Max results |
109
+ | `--min-score` | 0 | Minimum score (0-1) |
110
+ | `-c, --collection` | all | Filter to collection |
111
+ | `--tags-any` | - | Filter: has ANY tag (comma-sep) |
112
+ | `--tags-all` | - | Filter: has ALL tags (comma-sep) |
113
+ | `--full` | false | Full content (not snippets) |
114
+ | `--line-numbers` | false | Include line numbers |
115
+ | `--lang` | auto | Language filter |
114
116
 
115
117
  Output formats: `--json`, `--files`, `--csv`, `--md`, `--xml`
116
118
 
@@ -222,6 +224,42 @@ gno context list [--json|--md]
222
224
  gno context rm <scope>
223
225
  ```
224
226
 
227
+ ## Tags
228
+
229
+ ### gno tags
230
+
231
+ List tags with document counts.
232
+
233
+ ```bash
234
+ gno tags [options]
235
+ ```
236
+
237
+ | Option | Description |
238
+ | ------------------ | --------------------- |
239
+ | `-c, --collection` | Filter by collection |
240
+ | `--prefix` | Filter by tag prefix |
241
+ | `--json` | JSON output |
242
+ | `--md` | Markdown table output |
243
+
244
+ ### gno tags add
245
+
246
+ Add tag to document.
247
+
248
+ ```bash
249
+ gno tags add <doc> <tag>
250
+ ```
251
+
252
+ - `doc`: URI (`gno://...`) or docid (`#abc123`)
253
+ - `tag`: Tag string (lowercase, alphanumeric, hyphens, dots, `/` for hierarchy)
254
+
255
+ ### gno tags rm
256
+
257
+ Remove tag from document.
258
+
259
+ ```bash
260
+ gno tags rm <doc> <tag>
261
+ ```
262
+
225
263
  ## Models
226
264
 
227
265
  ### gno models list
@@ -191,6 +191,50 @@ gno models use quality
191
191
  gno models pull
192
192
  ```
193
193
 
194
+ ## Tagging
195
+
196
+ ### List and manage tags
197
+
198
+ ```bash
199
+ # List all tags with counts
200
+ gno tags
201
+
202
+ # Filter by collection
203
+ gno tags -c work
204
+
205
+ # Filter by prefix (hierarchical)
206
+ gno tags --prefix project/
207
+ ```
208
+
209
+ ### Add/remove tags
210
+
211
+ ```bash
212
+ # Add tag to document
213
+ gno tags add gno://work/readme.md project/api
214
+
215
+ # Remove tag
216
+ gno tags rm gno://work/readme.md draft
217
+
218
+ # Tags in frontmatter are extracted automatically
219
+ cat myfile.md
220
+ # ---
221
+ # tags: [project/web, status/review]
222
+ # ---
223
+ ```
224
+
225
+ ### Filter search by tags
226
+
227
+ ```bash
228
+ # Find docs with ANY of these tags (OR)
229
+ gno search "api" --tags-any project,work
230
+
231
+ # Find docs with ALL of these tags (AND)
232
+ gno query "auth" --tags-all security,reviewed
233
+
234
+ # Combine with other filters
235
+ gno ask "deployment steps" -c work --tags-any devops --answer
236
+ ```
237
+
194
238
  ## Tips
195
239
 
196
240
  ### Search Modes
@@ -45,10 +45,21 @@ BM25 keyword search.
45
45
  "collection": "optional-collection",
46
46
  "limit": 5,
47
47
  "minScore": 0.5,
48
- "lang": "en"
48
+ "lang": "en",
49
+ "tagsAny": ["project", "work"],
50
+ "tagsAll": ["reviewed"]
49
51
  }
50
52
  ```
51
53
 
54
+ | Parameter | Description |
55
+ | ------------ | ----------------------------------- |
56
+ | `query` | Search query (required) |
57
+ | `collection` | Filter by collection |
58
+ | `limit` | Max results (default: 5) |
59
+ | `minScore` | Minimum score 0-1 |
60
+ | `tagsAny` | Filter: has ANY of these tags (OR) |
61
+ | `tagsAll` | Filter: has ALL of these tags (AND) |
62
+
52
63
  ### gno.vsearch
53
64
 
54
65
  Vector semantic search. Same parameters as `gno.search`.
@@ -122,6 +133,40 @@ Get index status.
122
133
  {}
123
134
  ```
124
135
 
136
+ ### gno.list_tags
137
+
138
+ List tags with document counts.
139
+
140
+ ```json
141
+ {
142
+ "collection": "optional-collection",
143
+ "prefix": "project/"
144
+ }
145
+ ```
146
+
147
+ | Parameter | Description |
148
+ | ------------ | --------------------------------------- |
149
+ | `collection` | Filter by collection |
150
+ | `prefix` | Filter by tag prefix (e.g., `project/`) |
151
+
152
+ ### gno.tag
153
+
154
+ Add or remove tag from document.
155
+
156
+ ```json
157
+ {
158
+ "ref": "gno://work/readme.md",
159
+ "tag": "project/api",
160
+ "action": "add"
161
+ }
162
+ ```
163
+
164
+ | Parameter | Description |
165
+ | --------- | ---------------------------------- |
166
+ | `ref` | Document URI or docid (required) |
167
+ | `tag` | Tag string (required) |
168
+ | `action` | `add` or `remove` (default: `add`) |
169
+
125
170
  ## Resources
126
171
 
127
172
  Documents accessible as MCP resources:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gmickel/gno",
3
- "version": "0.9.6",
3
+ "version": "0.10.1",
4
4
  "description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
5
5
  "keywords": [
6
6
  "embeddings",
package/src/cli/CLAUDE.md CHANGED
@@ -19,6 +19,7 @@ src/cli/
19
19
  ├── search.ts
20
20
  ├── query.ts
21
21
  ├── ask.ts
22
+ ├── tags.ts # Tag management (list, add, remove)
22
23
  └── ...
23
24
  ```
24
25
 
@@ -94,3 +95,26 @@ bun test test/cli/
94
95
  ```
95
96
 
96
97
  Use `--json` output for assertions in tests.
98
+
99
+ ## Tag Commands
100
+
101
+ Tag management commands in `src/cli/commands/tags.ts`:
102
+
103
+ ```bash
104
+ # List all tags (with doc counts)
105
+ gno tags
106
+
107
+ # Add tags to document
108
+ gno tag add <path> tag1 tag2
109
+
110
+ # Remove tags from document
111
+ gno tag remove <path> tag1
112
+
113
+ # Filter search/query by tags
114
+ gno search "query" --tags=foo,bar
115
+ ```
116
+
117
+ - Tags normalized via `src/core/tags.ts`: lowercase, trimmed, validated
118
+ - Stored in `doc_tags` junction table with `source` column (frontmatter|user)
119
+ - Frontmatter tags extracted during ingestion (`src/ingestion/frontmatter.ts`)
120
+ - User-added tags can be removed; frontmatter tags are read-only