@vibe-agent-toolkit/cli 0.1.0-rc.7

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 (162) hide show
  1. package/README.md +125 -0
  2. package/dist/bin/vat.d.ts +7 -0
  3. package/dist/bin/vat.d.ts.map +1 -0
  4. package/dist/bin/vat.js +52 -0
  5. package/dist/bin/vat.js.map +1 -0
  6. package/dist/bin.d.ts +7 -0
  7. package/dist/bin.d.ts.map +1 -0
  8. package/dist/bin.js +103 -0
  9. package/dist/bin.js.map +1 -0
  10. package/dist/commands/agent/audit.d.ts +9 -0
  11. package/dist/commands/agent/audit.d.ts.map +1 -0
  12. package/dist/commands/agent/audit.js +139 -0
  13. package/dist/commands/agent/audit.js.map +1 -0
  14. package/dist/commands/agent/build.d.ts +13 -0
  15. package/dist/commands/agent/build.d.ts.map +1 -0
  16. package/dist/commands/agent/build.js +52 -0
  17. package/dist/commands/agent/build.js.map +1 -0
  18. package/dist/commands/agent/help.d.ts +5 -0
  19. package/dist/commands/agent/help.d.ts.map +1 -0
  20. package/dist/commands/agent/help.js +10 -0
  21. package/dist/commands/agent/help.js.map +1 -0
  22. package/dist/commands/agent/import.d.ts +10 -0
  23. package/dist/commands/agent/import.d.ts.map +1 -0
  24. package/dist/commands/agent/import.js +50 -0
  25. package/dist/commands/agent/import.js.map +1 -0
  26. package/dist/commands/agent/index.d.ts +7 -0
  27. package/dist/commands/agent/index.d.ts.map +1 -0
  28. package/dist/commands/agent/index.js +293 -0
  29. package/dist/commands/agent/index.js.map +1 -0
  30. package/dist/commands/agent/install.d.ts +15 -0
  31. package/dist/commands/agent/install.d.ts.map +1 -0
  32. package/dist/commands/agent/install.js +107 -0
  33. package/dist/commands/agent/install.js.map +1 -0
  34. package/dist/commands/agent/installed.d.ts +13 -0
  35. package/dist/commands/agent/installed.d.ts.map +1 -0
  36. package/dist/commands/agent/installed.js +106 -0
  37. package/dist/commands/agent/installed.js.map +1 -0
  38. package/dist/commands/agent/list.d.ts +8 -0
  39. package/dist/commands/agent/list.d.ts.map +1 -0
  40. package/dist/commands/agent/list.js +41 -0
  41. package/dist/commands/agent/list.js.map +1 -0
  42. package/dist/commands/agent/run.d.ts +17 -0
  43. package/dist/commands/agent/run.d.ts.map +1 -0
  44. package/dist/commands/agent/run.js +44 -0
  45. package/dist/commands/agent/run.js.map +1 -0
  46. package/dist/commands/agent/uninstall.d.ts +13 -0
  47. package/dist/commands/agent/uninstall.d.ts.map +1 -0
  48. package/dist/commands/agent/uninstall.js +48 -0
  49. package/dist/commands/agent/uninstall.js.map +1 -0
  50. package/dist/commands/agent/validate.d.ts +8 -0
  51. package/dist/commands/agent/validate.d.ts.map +1 -0
  52. package/dist/commands/agent/validate.js +51 -0
  53. package/dist/commands/agent/validate.js.map +1 -0
  54. package/dist/commands/rag/clear-command.d.ts +10 -0
  55. package/dist/commands/rag/clear-command.d.ts.map +1 -0
  56. package/dist/commands/rag/clear-command.js +22 -0
  57. package/dist/commands/rag/clear-command.js.map +1 -0
  58. package/dist/commands/rag/command-helpers.d.ts +27 -0
  59. package/dist/commands/rag/command-helpers.d.ts.map +1 -0
  60. package/dist/commands/rag/command-helpers.js +58 -0
  61. package/dist/commands/rag/command-helpers.js.map +1 -0
  62. package/dist/commands/rag/help.d.ts +5 -0
  63. package/dist/commands/rag/help.d.ts.map +1 -0
  64. package/dist/commands/rag/help.js +10 -0
  65. package/dist/commands/rag/help.js.map +1 -0
  66. package/dist/commands/rag/index-command.d.ts +10 -0
  67. package/dist/commands/rag/index-command.d.ts.map +1 -0
  68. package/dist/commands/rag/index-command.js +49 -0
  69. package/dist/commands/rag/index-command.js.map +1 -0
  70. package/dist/commands/rag/index.d.ts +7 -0
  71. package/dist/commands/rag/index.d.ts.map +1 -0
  72. package/dist/commands/rag/index.js +168 -0
  73. package/dist/commands/rag/index.js.map +1 -0
  74. package/dist/commands/rag/query-command.d.ts +11 -0
  75. package/dist/commands/rag/query-command.d.ts.map +1 -0
  76. package/dist/commands/rag/query-command.js +54 -0
  77. package/dist/commands/rag/query-command.js.map +1 -0
  78. package/dist/commands/rag/stats-command.d.ts +10 -0
  79. package/dist/commands/rag/stats-command.d.ts.map +1 -0
  80. package/dist/commands/rag/stats-command.js +25 -0
  81. package/dist/commands/rag/stats-command.js.map +1 -0
  82. package/dist/commands/resources/command-helpers.d.ts +5 -0
  83. package/dist/commands/resources/command-helpers.d.ts.map +1 -0
  84. package/dist/commands/resources/command-helpers.js +6 -0
  85. package/dist/commands/resources/command-helpers.js.map +1 -0
  86. package/dist/commands/resources/help.d.ts +5 -0
  87. package/dist/commands/resources/help.d.ts.map +1 -0
  88. package/dist/commands/resources/help.js +10 -0
  89. package/dist/commands/resources/help.js.map +1 -0
  90. package/dist/commands/resources/index.d.ts +7 -0
  91. package/dist/commands/resources/index.d.ts.map +1 -0
  92. package/dist/commands/resources/index.js +64 -0
  93. package/dist/commands/resources/index.js.map +1 -0
  94. package/dist/commands/resources/scan.d.ts +9 -0
  95. package/dist/commands/resources/scan.d.ts.map +1 -0
  96. package/dist/commands/resources/scan.js +47 -0
  97. package/dist/commands/resources/scan.js.map +1 -0
  98. package/dist/commands/resources/validate.d.ts +9 -0
  99. package/dist/commands/resources/validate.d.ts.map +1 -0
  100. package/dist/commands/resources/validate.js +61 -0
  101. package/dist/commands/resources/validate.js.map +1 -0
  102. package/dist/index.d.ts +14 -0
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +15 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/schemas/config.d.ts +1034 -0
  107. package/dist/schemas/config.d.ts.map +1 -0
  108. package/dist/schemas/config.js +135 -0
  109. package/dist/schemas/config.js.map +1 -0
  110. package/dist/utils/agent-discovery.d.ts +32 -0
  111. package/dist/utils/agent-discovery.d.ts.map +1 -0
  112. package/dist/utils/agent-discovery.js +108 -0
  113. package/dist/utils/agent-discovery.js.map +1 -0
  114. package/dist/utils/agent-runner.d.ts +22 -0
  115. package/dist/utils/agent-runner.d.ts.map +1 -0
  116. package/dist/utils/agent-runner.js +120 -0
  117. package/dist/utils/agent-runner.js.map +1 -0
  118. package/dist/utils/command-error.d.ts +19 -0
  119. package/dist/utils/command-error.d.ts.map +1 -0
  120. package/dist/utils/command-error.js +36 -0
  121. package/dist/utils/command-error.js.map +1 -0
  122. package/dist/utils/config-loader.d.ts +12 -0
  123. package/dist/utils/config-loader.d.ts.map +1 -0
  124. package/dist/utils/config-loader.js +39 -0
  125. package/dist/utils/config-loader.js.map +1 -0
  126. package/dist/utils/help-loader.d.ts +12 -0
  127. package/dist/utils/help-loader.d.ts.map +1 -0
  128. package/dist/utils/help-loader.js +39 -0
  129. package/dist/utils/help-loader.js.map +1 -0
  130. package/dist/utils/logger.d.ts +14 -0
  131. package/dist/utils/logger.d.ts.map +1 -0
  132. package/dist/utils/logger.js +21 -0
  133. package/dist/utils/logger.js.map +1 -0
  134. package/dist/utils/output.d.ts +20 -0
  135. package/dist/utils/output.d.ts.map +1 -0
  136. package/dist/utils/output.js +40 -0
  137. package/dist/utils/output.js.map +1 -0
  138. package/dist/utils/project-root.d.ts +11 -0
  139. package/dist/utils/project-root.d.ts.map +1 -0
  140. package/dist/utils/project-root.js +35 -0
  141. package/dist/utils/project-root.js.map +1 -0
  142. package/dist/utils/resource-loader.d.ts +30 -0
  143. package/dist/utils/resource-loader.d.ts.map +1 -0
  144. package/dist/utils/resource-loader.js +63 -0
  145. package/dist/utils/resource-loader.js.map +1 -0
  146. package/dist/utils/scope-locations.d.ts +17 -0
  147. package/dist/utils/scope-locations.d.ts.map +1 -0
  148. package/dist/utils/scope-locations.js +40 -0
  149. package/dist/utils/scope-locations.js.map +1 -0
  150. package/dist/utils/validate-help-files.d.ts +14 -0
  151. package/dist/utils/validate-help-files.d.ts.map +1 -0
  152. package/dist/utils/validate-help-files.js +61 -0
  153. package/dist/utils/validate-help-files.js.map +1 -0
  154. package/dist/version.d.ts +13 -0
  155. package/dist/version.d.ts.map +1 -0
  156. package/dist/version.js +27 -0
  157. package/dist/version.js.map +1 -0
  158. package/docs/agent.md +100 -0
  159. package/docs/index.md +65 -0
  160. package/docs/rag.md +449 -0
  161. package/docs/resources.md +158 -0
  162. package/package.json +68 -0
package/docs/rag.md ADDED
@@ -0,0 +1,449 @@
1
+ # vat rag - RAG (Retrieval-Augmented Generation) Commands
2
+
3
+ ## Overview
4
+
5
+ The `vat rag` commands provide semantic search capabilities over your markdown documentation
6
+ using vector embeddings. RAG enables you to query your docs using natural language and get
7
+ back the most relevant content based on meaning, not just keyword matching.
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # 1. Index your documentation (recursively finds all *.md under docs/)
13
+ vat rag index docs/
14
+
15
+ # 2. Query for relevant content
16
+ vat rag query "error handling patterns"
17
+
18
+ # 3. Check database statistics
19
+ vat rag stats
20
+
21
+ # 4. Clear database when needed
22
+ vat rag clear
23
+ ```
24
+
25
+ ## Commands
26
+
27
+ ### vat rag index [path]
28
+
29
+ **Purpose:** Index markdown files into vector database for semantic search
30
+
31
+ **What it does:**
32
+ 1. Discovers markdown files recursively (respects config include/exclude patterns)
33
+ 2. Chunks documents into smaller pieces for efficient embedding
34
+ 3. Generates vector embeddings using transformer models (Xenova/all-MiniLM-L6-v2)
35
+ 4. Stores chunks and embeddings in LanceDB vector database
36
+ 5. Supports incremental updates (skips files with unchanged content)
37
+
38
+ **Path Argument Behavior:**
39
+ - `[path]` specifies the **base directory** to start crawling from
40
+ - Recursively finds all `*.md` files under that directory (default pattern: `**/*.md`)
41
+ - When path is specified, **config patterns are ignored** (to avoid pattern conflicts)
42
+ - To use config patterns, run without path argument: `vat rag index`
43
+
44
+ **Options:**
45
+ - `[path]` - Base directory to crawl (defaults to current directory)
46
+ - `--db <path>` - Database path (default: `.rag-db` in project root)
47
+ - `--debug` - Enable debug logging
48
+
49
+ **Exit Codes:**
50
+ - `0` - Indexing completed successfully
51
+ - `2` - System error (config invalid, database error, etc.)
52
+
53
+ **Output:** YAML on stdout with indexing statistics
54
+
55
+ **Example:**
56
+ ```bash
57
+ # Index all *.md files recursively under docs/
58
+ vat rag index docs/
59
+ # Equivalent to: find all files matching docs/**/*.md pattern
60
+
61
+ # Output:
62
+ # ---
63
+ # status: success
64
+ # resourcesIndexed: 12
65
+ # resourcesSkipped: 0
66
+ # resourcesUpdated: 0
67
+ # chunksCreated: 48
68
+ # chunksDeleted: 0
69
+ # duration: 2.4s
70
+ # ---
71
+ ```
72
+
73
+ **Incremental Updates:**
74
+
75
+ The index command is idempotent - run it multiple times and it will:
76
+ - Skip files with unchanged content (content hash matching)
77
+ - Update files that changed (delete old chunks, add new ones)
78
+ - Add new files that weren't previously indexed
79
+
80
+ ```bash
81
+ # First run: indexes all *.md files recursively under docs/
82
+ vat rag index docs/
83
+
84
+ # Second run (no changes): skips all files (content hash match)
85
+ vat rag index docs/
86
+ # resourcesSkipped: 12, chunksCreated: 0
87
+
88
+ # After editing one file: updates only that file
89
+ vat rag index docs/
90
+ # resourcesSkipped: 11, resourcesUpdated: 1
91
+ # chunksDeleted: 4, chunksCreated: 5
92
+ ```
93
+
94
+ ### vat rag query <text>
95
+
96
+ **Purpose:** Search vector database using semantic similarity
97
+
98
+ **What it does:**
99
+ 1. Converts your query text to a vector embedding
100
+ 2. Searches database for chunks with similar embeddings (cosine similarity)
101
+ 3. Returns ranked results with full chunk content and metadata
102
+ 4. Results are ordered by relevance (most similar first)
103
+
104
+ **Options:**
105
+ - `<text>` - Query text (required)
106
+ - `--limit <n>` - Maximum results to return (default: 10)
107
+ - `--db <path>` - Database path (default: `.rag-db` in project root)
108
+ - `--debug` - Enable debug logging
109
+
110
+ **Exit Codes:**
111
+ - `0` - Query completed successfully
112
+ - `2` - System error (no database, embedding error, etc.)
113
+
114
+ **Output:** YAML on stdout with query results
115
+
116
+ **Example:**
117
+ ```bash
118
+ vat rag query "error handling patterns" --limit 5
119
+
120
+ # Output:
121
+ # ---
122
+ # status: success
123
+ # query: error handling patterns
124
+ # stats:
125
+ # totalMatches: 5
126
+ # searchDurationMs: 62
127
+ # embedding:
128
+ # model: Xenova/all-MiniLM-L6-v2
129
+ # duration: 65ms
130
+ # chunks:
131
+ # - chunkId: doc1-chunk2
132
+ # resourceId: doc1-hash
133
+ # filePath: docs/guide.md
134
+ # headingPath: Error Handling > Try-Catch Patterns
135
+ # headingLevel: 2
136
+ # startLine: 42
137
+ # endLine: 58
138
+ # title: Developer Guide
139
+ # type: markdown
140
+ # contentHash: abc123...
141
+ # tokenCount: 245
142
+ # embeddingModel: Xenova/all-MiniLM-L6-v2
143
+ # embeddedAt: 2025-12-29T10:30:45.123Z
144
+ # content: |
145
+ # ## Try-Catch Patterns
146
+ #
147
+ # When handling errors in async code...
148
+ # [full content, not truncated]
149
+ # - [more chunks...]
150
+ # ---
151
+ ```
152
+
153
+ **Chunk Fields Explained:**
154
+
155
+ Each chunk includes comprehensive metadata:
156
+
157
+ **Identifiers:**
158
+ - `chunkId` - Unique ID for this chunk
159
+ - `resourceId` - ID of source document (content-based hash)
160
+
161
+ **Location:**
162
+ - `filePath` - Path to source markdown file
163
+ - `headingPath` - Full heading hierarchy (e.g., "Guide > Setup > Installation")
164
+ - `headingLevel` - Markdown heading level (1-6)
165
+ - `startLine` / `endLine` - Line numbers in source file
166
+
167
+ **Metadata:**
168
+ - `title` - Document title (from frontmatter or first heading)
169
+ - `type` - Resource type (always "markdown" currently)
170
+ - `tags` - Tags from frontmatter (if present)
171
+
172
+ **Technical:**
173
+ - `contentHash` - Hash of chunk content (for change detection)
174
+ - `tokenCount` - Approximate token count for this chunk
175
+ - `embeddingModel` - Model used to generate embedding
176
+ - `embeddedAt` - Timestamp when embedding was created
177
+
178
+ **Context:**
179
+ - `previousChunkId` - ID of previous chunk in same document (if exists)
180
+ - `nextChunkId` - ID of next chunk in same document (if exists)
181
+
182
+ **Content:**
183
+ - `content` - Full text content of the chunk (not truncated)
184
+
185
+ ### vat rag stats
186
+
187
+ **Purpose:** Display vector database statistics and metadata
188
+
189
+ **What it does:**
190
+ 1. Queries database for total chunk and resource counts
191
+ 2. Shows embedding model information
192
+ 3. Reports database size and last indexed timestamp
193
+ 4. Useful for verifying indexing completed successfully
194
+
195
+ **Options:**
196
+ - `--db <path>` - Database path (default: `.rag-db` in project root)
197
+ - `--debug` - Enable debug logging
198
+
199
+ **Exit Codes:**
200
+ - `0` - Stats retrieved successfully
201
+ - `2` - System error (no database exists)
202
+
203
+ **Output:** YAML on stdout with database statistics
204
+
205
+ **Example:**
206
+ ```bash
207
+ vat rag stats
208
+
209
+ # Output:
210
+ # ---
211
+ # status: success
212
+ # totalChunks: 48
213
+ # totalResources: 12
214
+ # dbSizeBytes: 0
215
+ # embeddingModel: Xenova/all-MiniLM-L6-v2
216
+ # lastIndexed: 2025-12-29T10:30:45.123Z
217
+ # duration: 15ms
218
+ # ---
219
+ ```
220
+
221
+ **Field Descriptions:**
222
+ - `totalChunks` - Total document chunks in database
223
+ - `totalResources` - Unique documents indexed
224
+ - `dbSizeBytes` - Database size (0 if not available from provider)
225
+ - `embeddingModel` - Transformer model used for embeddings
226
+ - `lastIndexed` - Timestamp of most recent indexing operation
227
+
228
+ ### vat rag clear
229
+
230
+ **Purpose:** Delete entire RAG database directory
231
+
232
+ **What it does:**
233
+ 1. Closes database connection
234
+ 2. Deletes entire database directory (`.rag-db/` by default)
235
+ 3. Removes all indexed data and embeddings
236
+ 4. Cannot be undone - use with caution
237
+
238
+ **When to use:**
239
+ - Changing embedding models (incompatible with existing embeddings)
240
+ - Database corruption detected
241
+ - Starting fresh after major documentation restructure
242
+ - Testing/development (reset to clean state)
243
+
244
+ **Options:**
245
+ - `--db <path>` - Database path (default: `.rag-db` in project root)
246
+ - `--debug` - Enable debug logging
247
+
248
+ **Exit Codes:**
249
+ - `0` - Database cleared successfully
250
+ - `2` - System error
251
+
252
+ **Output:** YAML on stdout with confirmation
253
+
254
+ **Example:**
255
+ ```bash
256
+ vat rag clear
257
+
258
+ # Output:
259
+ # ---
260
+ # status: success
261
+ # message: Database cleared
262
+ # duration: 12ms
263
+ # ---
264
+ ```
265
+
266
+ **Warning:** This operation is **permanent and cannot be undone**. The entire
267
+ database directory will be deleted. After clearing, re-run `vat rag index` to
268
+ rebuild the database from your markdown source files.
269
+
270
+ ## Configuration
271
+
272
+ RAG respects the same `vibe-agent-toolkit.config.yaml` patterns as other commands:
273
+
274
+ ```yaml
275
+ version: 1
276
+ resources:
277
+ include:
278
+ - "docs/**/*.md"
279
+ - "README.md"
280
+ exclude:
281
+ - "node_modules/**"
282
+ - "docs/plans/**" # Exclude planning docs
283
+ - "**/test/**"
284
+ ```
285
+
286
+ **Note:** RAG only indexes files that match the configured patterns. Update your
287
+ config to control which markdown files are indexed.
288
+
289
+ ## How RAG Works
290
+
291
+ ### 1. Document Chunking
292
+
293
+ Large documents are split into smaller chunks (default: 512 tokens each) because:
294
+ - Transformer models have input length limits
295
+ - Smaller chunks provide more precise search results
296
+ - Users get exactly the relevant section, not entire documents
297
+
298
+ Chunks preserve context:
299
+ - Maintain heading hierarchy
300
+ - Link to previous/next chunks
301
+ - Include source file location (line numbers)
302
+
303
+ ### 2. Vector Embeddings
304
+
305
+ Each chunk is converted to a 384-dimensional vector using the
306
+ `Xenova/all-MiniLM-L6-v2` transformer model. Semantically similar text produces
307
+ similar vectors, enabling semantic search.
308
+
309
+ **Example:**
310
+ - Query: "error handling"
311
+ - Matches: "exception management", "failure recovery", "try-catch patterns"
312
+ - Why: Similar meaning → similar vectors
313
+
314
+ ### 3. Vector Search
315
+
316
+ When you query:
317
+ 1. Query text → vector embedding (same model)
318
+ 2. Database searches for chunks with similar vectors (cosine similarity)
319
+ 3. Returns top N most similar chunks, ranked by relevance
320
+
321
+ ## Database Storage
322
+
323
+ RAG uses LanceDB for local vector storage:
324
+
325
+ - **Format:** Columnar Apache Arrow format
326
+ - **Location:** `.rag-db/` directory (configurable)
327
+ - **Size:** Depends on documents (embeddings are 384 floats × chunk count)
328
+ - **Portability:** Database directory can be copied/moved
329
+
330
+ **Git:** Add `.rag-db/` to `.gitignore` (databases are generated, not source)
331
+
332
+ ## Performance Tips
333
+
334
+ **Indexing:**
335
+ - First indexing takes time (embedding generation is CPU-intensive)
336
+ - Incremental updates are fast (only changed files re-indexed)
337
+ - Larger chunks = fewer chunks = faster indexing (but less precise search)
338
+
339
+ **Querying:**
340
+ - First query after starting CLI is slower (model loading)
341
+ - Subsequent queries are fast (model cached in memory)
342
+ - Use `--limit` to reduce result size for faster responses
343
+
344
+ **Chunk Size:**
345
+ Default 512 tokens balances:
346
+ - Precision (smaller chunks → more precise matches)
347
+ - Context (larger chunks → more complete information)
348
+ - Performance (fewer chunks → faster indexing/search)
349
+
350
+ ## Embedding Model
351
+
352
+ Current model: `Xenova/all-MiniLM-L6-v2`
353
+
354
+ **Characteristics:**
355
+ - 384-dimensional embeddings
356
+ - Fast inference (~50ms per chunk)
357
+ - Good quality for documentation search
358
+ - Runs locally (no API calls, no cost, privacy-preserving)
359
+
360
+ **Changing Models:**
361
+
362
+ To use a different model, you'll need to:
363
+ 1. Update model in code (currently hardcoded)
364
+ 2. Run `vat rag clear` (embeddings are model-specific)
365
+ 3. Re-index documents with new model
366
+
367
+ Different models produce incompatible embeddings - never mix embeddings from
368
+ different models in the same database.
369
+
370
+ ## Integration Examples
371
+
372
+ ### CI/CD: Verify documentation indexed
373
+
374
+ ```yaml
375
+ # GitHub Actions
376
+ - name: Build RAG database
377
+ run: vat rag index docs/
378
+
379
+ - name: Verify database created
380
+ run: vat rag stats | grep 'totalChunks'
381
+ ```
382
+
383
+ ### CLI Tool: Query from script
384
+
385
+ ```bash
386
+ #!/bin/bash
387
+ # Search docs and extract first result
388
+
389
+ query="$1"
390
+ result=$(vat rag query "$query" --limit 1)
391
+ echo "$result" | yq '.chunks[0].content'
392
+ ```
393
+
394
+ ### Pre-commit: Keep database fresh
395
+
396
+ ```yaml
397
+ # .husky/pre-commit
398
+ vat rag index --debug
399
+ ```
400
+
401
+ ## Troubleshooting
402
+
403
+ ### "No data indexed yet"
404
+
405
+ **Error:** Query or stats fails with "No data indexed yet"
406
+
407
+ **Solution:** Run `vat rag index` first to create the database
408
+
409
+ ```bash
410
+ vat rag index docs/
411
+ vat rag query "your search"
412
+ ```
413
+
414
+ ### Outdated search results
415
+
416
+ **Problem:** Query returns content that no longer exists in docs
417
+
418
+ **Solution:** Re-index to update database (automatic change detection)
419
+
420
+ ```bash
421
+ vat rag index docs/
422
+ ```
423
+
424
+ ### Database corruption
425
+
426
+ **Problem:** Errors about corrupted database or schema mismatches
427
+
428
+ **Solution:** Clear and rebuild
429
+
430
+ ```bash
431
+ vat rag clear
432
+ vat rag index docs/
433
+ ```
434
+
435
+ ### Poor search results
436
+
437
+ **Problem:** Queries don't return expected content
438
+
439
+ **Possible causes:**
440
+ 1. Content not indexed yet → Run `vat rag index`
441
+ 2. Query too broad/vague → Be more specific
442
+ 3. Chunk boundaries split relevant content → Adjust chunk size (future feature)
443
+
444
+ ## More Information
445
+
446
+ - **GitHub:** https://github.com/jdutton/vibe-agent-toolkit
447
+ - **Issues:** https://github.com/jdutton/vibe-agent-toolkit/issues
448
+ - **Embedding Model:** https://huggingface.co/Xenova/all-MiniLM-L6-v2
449
+ - **LanceDB:** https://lancedb.com
@@ -0,0 +1,158 @@
1
+ # vat resources - Markdown Resource Commands
2
+
3
+ ## Overview
4
+
5
+ The `vat resources` commands provide intelligent discovery and validation of markdown resources,
6
+ including link integrity checking and anchor validation.
7
+
8
+ ## Commands
9
+
10
+ ### vat resources scan [path]
11
+
12
+ **Purpose:** Discover markdown resources in a directory
13
+
14
+ **What it does:**
15
+ 1. Recursively scans for markdown files
16
+ 2. Parses each file to extract links and headings
17
+ 3. Shows statistics about discovered resources
18
+ 4. Exits 0 always (informational only)
19
+
20
+ **Path Argument:**
21
+ - `[path]` specifies the **base directory** to start crawling from
22
+ - Recursively finds all `*.md` files under that directory (default pattern: `**/*.md`)
23
+ - When path is specified, **config patterns are ignored** (to avoid pattern conflicts)
24
+ - To use config patterns, run without path argument: `vat resources scan`
25
+
26
+ **Options:**
27
+ - `[path]` - Base directory to crawl (defaults to current directory)
28
+ - `--debug` - Enable debug logging
29
+
30
+ **Exit Codes:**
31
+ - `0` - Always (scan is informational)
32
+ - `2` - System error (file access, parsing error)
33
+
34
+ **Output:** YAML on stdout, logs on stderr
35
+
36
+ **Example:**
37
+ ```bash
38
+ # Recursively scan all *.md files under docs/
39
+ vat resources scan docs/
40
+ # Equivalent to: find all files matching docs/**/*.md pattern
41
+
42
+ # Output:
43
+ # ---
44
+ # status: success
45
+ # filesScanned: 12
46
+ # linksFound: 47
47
+ # anchorsFound: 23
48
+ # files:
49
+ # - path: docs/README.md
50
+ # links: 5
51
+ # anchors: 3
52
+ # duration: 234ms
53
+ # ---
54
+ ```
55
+
56
+ ### vat resources validate [path]
57
+
58
+ **Purpose:** Validate markdown resources with strict error reporting
59
+
60
+ **What it does:**
61
+ 1. Recursively scans for markdown resources
62
+ 2. Validates all links (internal, anchors, external if configured)
63
+ 3. Reports errors in dual format (YAML + test format)
64
+ 4. Exits 0 if valid, 1 if errors found
65
+
66
+ **Path Argument:**
67
+ - `[path]` specifies the **base directory** to start crawling from
68
+ - Recursively finds all `*.md` files under that directory (default pattern: `**/*.md`)
69
+ - When path is specified, **config patterns are ignored** (to avoid pattern conflicts)
70
+ - To use config patterns, run without path argument: `vat resources validate`
71
+
72
+ **Options:**
73
+ - `[path]` - Base directory to crawl (defaults to current directory)
74
+ - `--debug` - Enable debug logging
75
+
76
+ **Exit Codes:**
77
+ - `0` - Validation passed
78
+ - `1` - Validation errors found
79
+ - `2` - System error
80
+
81
+ **Output:**
82
+ - YAML on stdout (structured results)
83
+ - Test-format errors on stderr (file:line:column: message)
84
+
85
+ **Example (success):**
86
+ ```bash
87
+ # Recursively validate all *.md files under docs/
88
+ vat resources validate docs/
89
+ # Equivalent to: find all files matching docs/**/*.md pattern
90
+
91
+ # Output:
92
+ # ---
93
+ # status: success
94
+ # filesScanned: 12
95
+ # linksChecked: 47
96
+ # anchorsChecked: 23
97
+ # duration: 456ms
98
+ # ---
99
+ ```
100
+
101
+ **Example (errors):**
102
+ ```bash
103
+ vat resources validate docs/
104
+
105
+ # stderr:
106
+ # docs/README.md:15:25: Link target not found: ./missing.md
107
+ # docs/guide.md:42:10: Broken anchor: #non-existent-section
108
+
109
+ # stdout:
110
+ # ---
111
+ # status: failed
112
+ # errorsFound: 2
113
+ # errors:
114
+ # - file: docs/README.md
115
+ # line: 15
116
+ # column: 25
117
+ # type: broken-link
118
+ # message: Link target not found: ./missing.md
119
+ # duration: 456ms
120
+ # ---
121
+ ```
122
+
123
+ ## Configuration
124
+
125
+ Place `vibe-agent-toolkit.config.yaml` at project root:
126
+
127
+ ```yaml
128
+ version: 1
129
+ resources:
130
+ include:
131
+ - "docs/**/*.md"
132
+ - "agents/**/README.md"
133
+ exclude:
134
+ - "node_modules/**"
135
+ - "**/test/fixtures/**"
136
+ validation:
137
+ checkLinks: true
138
+ checkAnchors: true
139
+ allowExternal: true
140
+ ```
141
+
142
+ ## Integration with vibe-validate
143
+
144
+ The test-format error output (stderr) integrates seamlessly with vibe-validate:
145
+
146
+ ```yaml
147
+ # vibe-validate.config.yaml
148
+ validators:
149
+ markdown:
150
+ run: vat resources validate docs/
151
+ extract:
152
+ - type: test-format
153
+ ```
154
+
155
+ ## More Information
156
+
157
+ - GitHub: https://github.com/jdutton/vibe-agent-toolkit
158
+ - Issues: https://github.com/jdutton/vibe-agent-toolkit/issues
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@vibe-agent-toolkit/cli",
3
+ "version": "0.1.0-rc.7",
4
+ "description": "Command-line interface for vibe-agent-toolkit",
5
+ "type": "module",
6
+ "bin": {
7
+ "vat": "./dist/bin/vat"
8
+ },
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ },
16
+ "./package.json": "./package.json"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "docs",
21
+ "README.md"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsx src/utils/validate-help-files.ts && tsc && tsx ../dev-tools/src/prepare-bin.ts",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "test:integration": "vitest run --config ../../vitest.integration.config.ts",
28
+ "test:system": "vitest run --config ../../vitest.system.config.ts",
29
+ "typecheck": "tsc --noEmit",
30
+ "clean": "rimraf dist *.tsbuildinfo"
31
+ },
32
+ "keywords": [
33
+ "cli",
34
+ "command-line",
35
+ "agent-toolkit",
36
+ "markdown",
37
+ "validation"
38
+ ],
39
+ "author": "Jeff Dutton",
40
+ "license": "MIT",
41
+ "dependencies": {
42
+ "@anthropic-ai/sdk": "^0.71.2",
43
+ "@vibe-agent-toolkit/agent-config": "workspace:*",
44
+ "@vibe-agent-toolkit/discovery": "workspace:*",
45
+ "@vibe-agent-toolkit/rag": "workspace:*",
46
+ "@vibe-agent-toolkit/rag-lancedb": "workspace:*",
47
+ "@vibe-agent-toolkit/resources": "workspace:*",
48
+ "@vibe-agent-toolkit/runtime-claude-skills": "workspace:*",
49
+ "@vibe-agent-toolkit/utils": "workspace:*",
50
+ "commander": "^12.1.0",
51
+ "js-yaml": "^4.1.0",
52
+ "zod": "^3.24.1"
53
+ },
54
+ "devDependencies": {
55
+ "@types/js-yaml": "^4.0.9",
56
+ "@types/node": "^22.10.5",
57
+ "rimraf": "^6.0.1",
58
+ "typescript": "^5.7.3",
59
+ "vitest": "^2.1.8"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ },
64
+ "repository": {
65
+ "type": "git",
66
+ "url": "https://github.com/jdutton/vibe-agent-toolkit.git"
67
+ }
68
+ }