devgrep
Install

Commands

devgrep exposes a small Cobra command tree. Global flags apply to all subcommands.

Global flags

FlagDescription
--configPath to config file (default: ~/.config/devgrep/config.yaml)
--dbOverride SQLite database path
--plainDisable interactive TUI and styled output
--verboseEnable debug logging

search

Search indexed developer workflows. Opens the TUI when stdout is a terminal.

sh
devgrep search [query]
devgrep [query]          # direct search shorthand

Flags

FlagDefaultDescription
-n, --limit20Maximum results
--sourceallSources: all, history, logs, notes (comma-separated)
-i, --interactivefalseForce interactive TUI
--tailfalseTail matching log lines (logs source)
--regexRegular expression for log tail filtering
--severityLog severity: DEBUG, INFO, WARN, ERROR
--pathPath 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

FlagDefaultDescription
--sourceallSources to index: all, history, logs, notes
--pathAdditional path for logs and notes (repeatable)
--watchfalseWatch configured paths and re-index on changes
--no-watchfalseDisable auto-watch after explicit path index
--dry-runfalsePreview indexing without database writes
-y, --yesfalseConfirm 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 logs

Behavior

  • 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 stats

Terminal 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 --tree

Plain 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