feat: centralize state file location and fix clear command behavior
Summary
This MR centralizes CLI state management by moving all state files to a dedicated directory in the user's home folder: ~/.corpus-cli/. Previously, state files were stored in the project's working directory, which caused inconsistent behavior when running the CLI from different locations.
Changes Made
-
Centralized State Paths — All state files now live in
~/.corpus-cli/:-
corpus_client_state.json(auth session) -
extracted_text_state.json(extracted text upload progress) -
uploaded_extracted_text.log(legacy upload log) -
upload_state.json,upload_log.txt,failed_uploads.txt(record uploads)
-
-
Updated modules:
cli.py,upload.py,extracted_text_upload.py -
Fixed
clearcommand — Now removes all state files includinguploaded_extracted_text.log, using module-level constants instead of hardcoded filenames
Bug Fixes
- Fixed
clearcommand not removinguploaded_extracted_text.log
🧪 Testing
-
✔ State files created in~/.corpus-cli/ -
✔ CLI works from any directory -
✔ clearremoves all state files -
✔ No state files created in project directory
🔗 Related Issue
Closes #15 (closed)
Edited by Ahlad Pataparla