feat(cli): add pqa where to print the .pqa directory and indexes - #1350
Open
krudo-taco wants to merge 1 commit into
Open
feat(cli): add pqa where to print the .pqa directory and indexes#1350krudo-taco wants to merge 1 commit into
krudo-taco wants to merge 1 commit into
Conversation
Print the PQA home directory, the configured index directory, and the names of built indexes so users can find cached data without guessing PQA_HOME. Fixes Future-House#891.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new paperqa where CLI subcommand to help users discover where PaperQA stores its local .pqa data and what indexes exist, addressing the “where is the index stored?” request from #891.
Changes:
- Introduces
whereCLI command that logs the.pqaroot directory, configured index directory, and built index names. - Adds helpers (
pqa_root,list_built_indexes,show_pqa_paths) to support the new command. - Adds CLI tests covering the printed paths and directory-only index listing behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_cli.py | Adds tests validating paperqa where output and list_built_indexes directory filtering behavior. |
| src/paperqa/agents/init.py | Implements the where subcommand and supporting helpers for path/index reporting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+152
to
+156
| def pqa_root() -> Path: | ||
| """Return the `.pqa` directory used for indexes and saved settings.""" | ||
| if pqa_home := os.environ.get("PQA_HOME"): | ||
| return Path(pqa_home) / ".pqa" | ||
| return Path.home() / ".pqa" |
Comment on lines
+161
to
+164
| directory = Path(index_directory) | ||
| if not directory.is_dir(): | ||
| return [] | ||
| return sorted(path.name for path in directory.iterdir() if path.is_dir()) |
| show_pqa_paths(settings) | ||
| case _: | ||
| commands = ", ".join({"view", "ask", "search", "index"}) | ||
| commands = ", ".join({"view", "ask", "search", "index", "where"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #891.
Adds
pqa whereso the CLI can print:.pqadirectory ($PQA_HOME/.pqaor~/.pqa)Validation:
tests/test_cli.py::test_cli_where_prints_pqa_directory_and_indexesandtests/test_cli.py::test_list_built_indexes_skips_files_and_missing_dirspassed.