Problem
sentrysearch/cli.py:1224-1249 only emits human-formatted text. Users wiring SentrySearch into shell scripts or other tools have no machine-readable output to parse, and the [missing] marker is mixed into the file string rather than being a separate field.
Suggested fix
Add --json to the stats command. When set, print a single JSON object:
{
"backend": "gemini",
"model": null,
"total_chunks": 1234,
"unique_source_files": 42,
"source_files": ["/abs/path/a.mp4", "/abs/path/b.mp4"],
"missing_files": ["/abs/path/gone.mp4"]
}
Keep missing_files as its own key (rather than " [missing]" suffixes on source_files) so downstream tools can act on it cleanly. The human path stays exactly as it is today.
Acceptance
sentrysearch stats --json | jq .total_chunks returns the chunk count.
sentrysearch stats (no flag) output is unchanged.
- Empty-index case still works (
--json returns the same schema with total_chunks: 0).
Scope
Touches only stats in sentrysearch/cli.py plus a test in tests/test_cli.py.
Problem
sentrysearch/cli.py:1224-1249only emits human-formatted text. Users wiring SentrySearch into shell scripts or other tools have no machine-readable output to parse, and the[missing]marker is mixed into the file string rather than being a separate field.Suggested fix
Add
--jsonto thestatscommand. When set, print a single JSON object:{ "backend": "gemini", "model": null, "total_chunks": 1234, "unique_source_files": 42, "source_files": ["/abs/path/a.mp4", "/abs/path/b.mp4"], "missing_files": ["/abs/path/gone.mp4"] }Keep
missing_filesas its own key (rather than" [missing]"suffixes onsource_files) so downstream tools can act on it cleanly. The human path stays exactly as it is today.Acceptance
sentrysearch stats --json | jq .total_chunksreturns the chunk count.sentrysearch stats(no flag) output is unchanged.--jsonreturns the same schema withtotal_chunks: 0).Scope
Touches only
statsinsentrysearch/cli.pyplus a test intests/test_cli.py.