Commands
devgrep exposes a small Cobra command tree. Global flags apply to all subcommands.
Global flags
| Flag | Description |
|---|---|
| --config | Path to config file (default: ~/.config/devgrep/config.yaml) |
| --db | Override SQLite database path |
| --plain | Disable interactive TUI and styled output |
| --verbose | Enable debug logging |
search
Search indexed developer workflows. Opens the TUI when stdout is a terminal.
sh
devgrep search [query]
devgrep [query] # direct search shorthandFlags
| Flag | Default | Description |
|---|---|---|
| -n, --limit | 20 | Maximum results |
| --source | all | Sources: all, history, logs, notes (comma-separated) |
| -i, --interactive | false | Force interactive TUI |
| --tail | false | Tail matching log lines (logs source) |
| --regex | Regular expression for log tail filtering | |
| --severity | Log severity: DEBUG, INFO, WARN, ERROR | |
| --path | Path to search or tail (repeatable) |
Examples
sh
devgrep docker postgres
devgrep --plain search "failed migration"
devgrep search --source logs --tail --regex "ERROR|WARN"
devgrep search --source history,logs "kube auth"Behavior
- Records query frequency in search_stats when not in TUI mode
- TUI mode sets Record=false to avoid polluting stats during live search
- Empty database shows: No index found. Run: devgrep index
- No matches shows: No results found. Try a broader query.
index
Index shell history, logs, and markdown notes into SQLite.
sh
devgrep index [path...]Flags
| Flag | Default | Description |
|---|---|---|
| --source | all | Sources to index: all, history, logs, notes |
| --path | Additional path for logs and notes (repeatable) | |
| --watch | false | Watch configured paths and re-index on changes |
| --no-watch | false | Disable auto-watch after explicit path index |
| --dry-run | false | Preview indexing without database writes |
| -y, --yes | false | Confirm dangerous paths non-interactively |
Examples
sh
devgrep index
devgrep index .
devgrep index ~/projects/api --dry-run
devgrep index ~/projects/api --no-watch
devgrep index --watch
devgrep index . --source logsBehavior
- Without paths, uses indexed_paths from config
- Explicit directories are saved to watched_paths when indexing succeeds
- Auto-watch follows indexing.auto_watch in config (default true)
- Refuses / and ~ without confirmation; non-interactive requires --yes
- Prints per-indexer timing: shell-history, markdown-notes, logs
stats
Show indexed document counts, database size, per-source breakdown, top searches, and recent index runs.
sh
devgrep statsTerminal output uses accent color from TUI config for the title line.
sources
List indexed source locations grouped by type, deduplicated from SQLite metadata.
sh
devgrep sources
devgrep sources --treePlain output groups [history], [notes], and [logs]. Tree mode renders a directory tree with common root detection.
doctor
Run local health checks and print human-readable fixes.
sh
devgrep doctor- Config validity and YAML errors
- Database health and permissions
- Missing or unreadable paths from config
- Shell history availability
version
Print version, commit, and build date embedded at compile time.
sh
devgrep version