feat(cli): add 'add-all' command and auto_delete_added_files config - #232
feat(cli): add 'add-all' command and auto_delete_added_files config#232sebastianbraun25 wants to merge 3 commits into
Conversation
eecc0bc to
680c04b
Compare
|
Rewrote this branch's history to remove unrelated commits. The branch had accidentally picked up commits from the (now-withdrawn, see Rebuilt cleanly from current |
0885647 to
153149c
Compare
…ption - New 'openkb add-all' command processes all files in raw/ directory - New config parameter 'auto_delete_added_files' (default: false) - When enabled, both 'add' and 'add-all' automatically delete successfully ingested files - Updated help texts to document the new cleanup behavior - Config applies to all ingest methods: direct files, directories, and URLs
Duplicates (skipped files) should also be auto-deleted when auto_delete_added_files is enabled, so raw/ stays clean. Only 'failed' status files are preserved to allow retries. Updated docstrings and helper function logic accordingly.
When auto_delete_added_files is enabled, the add-all command now recursively cleans up empty subdirectories in raw/ after file deletion. Directories are deleted from deepest to shallowest to ensure proper cleanup. Added summary output showing count of cleaned directories.
153149c to
a57bcd9
Compare
Note
This PR was created in collaboration between a human and AI: implementation, tests, and
PR text were created by an AI assistant under the guidance and review of the human author.
Problem
The
openkb addcommand supports adding directories recursively, but users who frequently download documents to/rawmust manually invokeopenkb add raw/and then manually delete processed files. There is no batch processing command for the/rawstaging directory, and no configuration option to auto-delete successfully ingested files and duplicates.Solution / Changes
New CLI command:
openkb add-allprocesses all files in the KB'sraw/directory recursivelyNew configuration parameter:
auto_delete_added_files(boolean, default:false)addandadd-allautomatically delete files after processingImplementation:
_delete_if_auto_cleanup_enabled()helper function to handle cleanup logicaddandadd-allcommands to use the helper functionIssues