rg — Infrastructure Auditing

Infrastructure Auditing

Search across all domus spoke repos
rg -l 'antora\.yml' ~/atelier/_bibliotheca/domus-{captures,infra-ops,ise-linux,netapi-docs,secrets-ops,docs}/docs/

Brace expansion generates the full path list. rg searches all in one invocation — faster than looping. Add --stats to see aggregate counts across the entire documentation system.


Find hardcoded IPs in AsciiDoc — STD-019 violation audit
rg -n '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b' -g '*.adoc' ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/ | head -20

Every IP should be an {attribute} reference. Matches in prose (not code block examples) indicate STD-019 violations. Filter out code blocks with: rg -v '^\s*(//|----|\[source)' <(rg -n '\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b' -g '*.adoc' docs/).


Missing :description: audit — find pages without metadata
rg --files-without-match ':description:' -g '*.adoc' ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/ | head -20

Every .adoc page must have :description: in the header. Files returned by this command are non-compliant. Pipe to wc -l for a violation count.


:toc: violation audit — STD-004 enforcement
rg -n '^:toc:' -g '*.adoc' ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/

Antora UI provides a sidebar TOC globally. Any file with :toc: creates a duplicate. This command should return zero results. Non-zero = STD-004 violation.


TODO/FIXME/HACK search — technical debt inventory
rg -n 'TODO|FIXME|HACK|XXX' -g '*.adoc' --stats ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/ 2>&1 | tail -10

Audit technical debt markers across the entire codex. --stats at the end shows total count. Pair with rg -c to rank files by debt density.


Search gitignored files for leaked secrets — security audit
rg --no-ignore --hidden -l '(password|secret|token|api.key)\s*[:=]' ~/atelier/_bibliotheca/domus-captures/ 2>/dev/null | head -10

--no-ignore --hidden searches EVERYTHING including gitignored and hidden files. Use this to verify no secrets leaked into the repo. Any matches in non-.age files require immediate remediation.


Config auditing in /etc — find active settings
rg -v '^\s*(#|$)' /etc/ssh/sshd_config

Strips comments () and blank lines. Shows only active configuration directives. Works for any -comment config format: sshd_config, fstab, pacman.conf, nftables.conf.


Log searching with journalctl pipe
journalctl --since '1 hour ago' --no-pager | rg -i 'error|fail|denied' | head -20

rg reads stdin when no file argument is given. Faster than grep on large log streams due to SIMD-accelerated search. --no-pager prevents journalctl from invoking less.


Count lines per file type (--type-list + --stats)
rg --stats -c '.' -t adoc ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/ 2>&1 | tail -6

Counts all non-empty lines in every .adoc file. --stats at the end gives the grand total. Alternative: rg --stats '' -t adoc docs/ 2>&1 | grep 'searched' for file count only.


Search with replacement preview (-r --passthru) — dry-run refactoring
rg 'grep' -r 'rg' --passthru ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/partials/codex/rg/basics.adoc | head -20

--passthru prints all lines (not just matches), with -r showing what the replacement would look like. This does NOT modify the file — it is a preview. Use sed -i or rg -l | xargs sed -i for actual replacement.