You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add vaultquery reference command with embedded documentation
Embeds a canonical reference document (DQL syntax, functions, file.* fields,
shell quoting, examples) in the binary via go:embed. Users can pipe it to a
file for AI assistant context, ensuring every instance gets identical,
version-matched documentation.
Also overhauls README with command reference table, corrected DQL examples
(double quotes instead of single quotes), shell quoting section, and
complete DQL overview including all query types, FROM sources, and functions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@@ -7,7 +7,7 @@ Query Obsidian vault files by YAML frontmatter using a DQL-like query language.
7
7
### Homebrew (macOS / Linux)
8
8
9
9
```bash
10
-
brew install andinger/vaultquery/vaultquery
10
+
brew install andinger/tap/vaultquery
11
11
```
12
12
13
13
### Binary download
@@ -21,26 +21,160 @@ go install github.com/andinger/vaultquery/cmd/vaultquery@latest
21
21
## Usage
22
22
23
23
```bash
24
-
#Index the vault (run from vault root, or use --vault)
25
-
vaultquery index --vault ~/my-vault
24
+
#Query with DQL (auto-syncs index before each query)
25
+
vaultquery query "TABLE customer, status FROM \"Clients\" WHERE type = \"Lead\" SORT customer ASC" --vault ~/my-vault
26
26
27
-
#Query with DQL
28
-
vaultquery query "TABLE customer, kubectl_context WHERE type = 'Kubernetes Cluster' SORT customer ASC"
27
+
#List all files with a specific tag
28
+
vaultquery query "LIST FROM #project WHERE status != \"archived\"" --vault ~/my-vault
29
29
30
-
#List all leads that aren't lost
31
-
vaultquery query "LIST FROM \"Sales\" WHERE type = 'Lead' AND status != 'lost'"
30
+
#Find files linking to a specific page
31
+
vaultquery query "TABLE file.name FROM [[My Note]]" --vault ~/my-vault
32
32
33
-
# Find files with a specific tag
34
-
vaultquery query "TABLE customer WHERE tags contains 'linux'"
33
+
# TOON output (recommended for LLM/agent workflows)
34
+
vaultquery query "TABLE customer WHERE type = \"Server\"" --vault ~/my-vault --format toon
35
+
```
36
+
37
+
Every `query` command automatically syncs the index before executing (incremental, mtime+size based). Pass `--index-only` to skip syncing and use the existing index as-is.
38
+
39
+
## Commands
40
+
41
+
| Command | Description |
42
+
|---|---|
43
+
|`vaultquery query "<DQL>"`| Execute a DQL query against the vault |
44
+
|`vaultquery index`| Build or update the vault index (incremental) |
45
+
|`vaultquery reindex`| Drop and rebuild the vault index from scratch |
46
+
|`vaultquery status`| Show index status (file count, vault path) |
47
+
|`vaultquery reference`| Print the full reference documentation to stdout |
48
+
49
+
### Options
50
+
51
+
| Flag | Applies to | Description | Default |
52
+
|---|---|---|---|
53
+
|`--vault <PATH>`| all | Vault root directory | current directory |
54
+
|`--format <FORMAT>`| query | Output format: `json` or `toon`| from config or `json`|
55
+
|`-v, --verbose`| all | Show detailed progress during indexing | off |
56
+
|`--index-only`| query | Skip index sync, use existing index as-is | off |
57
+
58
+
## Built-in reference
35
59
36
-
# Check index status
37
-
vaultquery status
60
+
vaultquery ships with a comprehensive reference document embedded in the binary. This reference covers the full DQL syntax, all built-in functions, `file.*` metadata fields, shell quoting rules, and usage examples.
38
61
39
-
# Full reindex (drop + rebuild)
40
-
vaultquery reindex --vault ~/my-vault
62
+
The reference is designed as a machine-readable context file for AI coding assistants. Instead of each assistant session interpreting the tool's behavior on its own, every instance gets the exact same canonical documentation — matched to the installed version.
63
+
64
+
```bash
65
+
# Print reference to stdout
66
+
vaultquery reference
67
+
68
+
# Create a local reference file (e.g. for Claude Code)
Every `query` command automatically syncs the index before executing (incremental, mtime+size based). Pass `--index-only` to skip syncing and use the existing index as-is.
75
+
The reference is rebuilt with each release, so re-running the command after an upgrade keeps your local copy in sync.
76
+
77
+
## Shell quoting
78
+
79
+
DQL uses double quotes for string values and folder paths. **Always use double-quoted shell strings with escaped inner quotes:**
80
+
81
+
```bash
82
+
# CORRECT — double quotes with escaped inner quotes
83
+
vaultquery query "TABLE customer WHERE type = \"System\"" --vault ~/base
84
+
85
+
# CORRECT — no inner quotes needed
86
+
vaultquery query "LIST FROM #project" --vault ~/base
87
+
88
+
# WRONG — single quotes break negation (!) in zsh (BANG_HIST)
For full function signatures and detailed syntax, run `vaultquery reference`.
44
178
45
179
## Vault-local storage
46
180
@@ -71,47 +205,7 @@ exclude:
71
205
72
206
Paths are relative to the vault root. Matching is prefix-based (e.g. `Archive/Old` excludes everything under that path). The `.vaultquery` directory itself is always excluded.
Short: "Print the vaultquery reference documentation to stdout",
17
+
Long: "Prints a comprehensive reference for vaultquery usage, DQL syntax, and built-in functions. Pipe to a file to create a local reference: vaultquery reference > ~/.claude/references/vaultquery.md",
0 commit comments