Skip to content

feat(cli): add ingest progress hint and --quiet/-q flag (with test coverage) - #1

Open
als3453 wants to merge 2 commits into
RaghavOG:mainfrom
als3453:als3453-patch-1
Open

feat(cli): add ingest progress hint and --quiet/-q flag (with test coverage)#1
als3453 wants to merge 2 commits into
RaghavOG:mainfrom
als3453:als3453-patch-1

Conversation

@als3453

@als3453 als3453 commented Aug 19, 2026

Copy link
Copy Markdown

Summary

This PR improves the UX of the rag-python ingest CLI command by adding two user-facing features that were previously missing:

  • Progress hint before chunking/embedding: default behaviour now prints an Ingesting N paths: <preview> line BEFORE calling the (potentially slow) chunk + ingest pipeline. Large docs or slow embedding models previously looked like the command had hung; users now get immediate visible feedback.
  • Silent mode (--quiet / -q): suppresses ALL stdout from the ingest subcommand — useful for CI, shell scripts, cron jobs, and embedding pipelines where you only care about the exit code / vector-store side effects.

UX polish

  • Singular/plural agreement: "1 path" vs "2 paths".
  • Path preview shows the first 3 inputs, followed by ... when more than 3 paths are supplied — keeps the line short even for glob expansions.
  • Short flag -q is registered as an alias for --quiet for faster interactive use.

Backwards compatibility

✅ 100% backwards compatible.

  • All existing flags for ingest (e.g. --vector-dir, --config, --reindex, positional PATHS...) are preserved.
  • No new required arguments.
  • The existing final summary line (e.g. "Ingested 13 chunks.") is preserved in non-quiet mode; only a new progress-header line is prepended.

Testing

Developed with a RED → GREEN → REFACTOR TDD cycle. Added a new test module tests/test_cli_ingest_progress.py containing 6 test cases:

  1. test_quiet_flag_is_registered — both --quiet and -q are accepted by argparse, and default to False.
  2. test_quiet_mode_produces_no_stdout — stdout is completely empty (0 chars stripped) for a 2-path quiet ingest.
  3. test_default_mode_prints_progress_and_summary — both the "Ingesting N paths" header AND a summary count appear on stdout.
  4. test_single_path_says_path_not_paths — asserts the exact singular form ("1 path", not "1 paths").
  5. test_long_path_list_is_ellipsised — 6 inputs produce "6 paths" and a ... ellipsis in the preview.
  6. test_short_flag_q_is_silent — the -q short alias behaves identically to --quiet.

The tests inject a stub RAG (monkey-patching _build_rag) so no real embeddings, Chroma store, or network calls are made — the suite is hermetic, fast, and exercises only the CLI dispatch + print branches.

Files changed

  • src/rag_python/cli.py — register the -q/--quiet flag on the ingest subparser and add print/quiet logic in main().
  • tests/test_cli_ingest_progress.py — new file, 6 tests as above.

- Added --quiet/-q CLI flag to the ingest subcommand. When set, all stdout output (progress + final summary) is suppressed — useful for CI/scripting.
- Default mode (non-quiet) now prints an ingest progress header line (e.g. "Ingesting 3 paths: docs/, README.md, ...") BEFORE the chunk/embed step, improving UX for large or slow ingest jobs.
- Backwards compatible: all existing CLI args and behaviour are preserved.
- Added test coverage for both --quiet mode (silent stdout) and default progress output.
This test suite verifies the behavior of the '--quiet' flag and progress output for the 'ingest' CLI command. It includes tests for output suppression, progress indication, singular/plural path handling, and flag registration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant