Skip to content

feat: centralize state file location and fix clear command behavior

Kuruva Laxmi requested to merge feature/centralize-state-location into develop

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 clear command — Now removes all state files including uploaded_extracted_text.log, using module-level constants instead of hardcoded filenames

Bug Fixes

  • Fixed clear command not removing uploaded_extracted_text.log

🧪 Testing

  • State files created in ~/.corpus-cli/
  • CLI works from any directory
  • clear removes all state files
  • No state files created in project directory

🔗 Related Issue

Closes #15 (closed)

Edited by Ahlad Pataparla

Merge request reports

Loading