Skip to content

Feature/unifies contree home#2

Open
mosquito wants to merge 8 commits intomasterfrom
feature/unifies-contree-home
Open

Feature/unifies contree home#2
mosquito wants to merge 8 commits intomasterfrom
feature/unifies-contree-home

Conversation

@mosquito
Copy link
Copy Markdown
Collaborator

@mosquito mosquito commented May 4, 2026

This pull request introduces several improvements and refactors to the CLI, focusing on configuration flexibility, file upload efficiency, and enhanced logging for debugging. The main highlights are the addition of a new cli.ini configuration for user defaults, parallelized file uploads with local caching, and more detailed HTTP request/response logging.

Configuration and Defaults:

  • Added support for a cli.ini configuration file (CliSettings) to allow users to specify CLI defaults such as log_level, output_format, and preferred editor. These defaults are loaded and applied at startup, and the editor default is now used in file editing commands. ([[1]](https://github.com/nebius/contree-cli/pull/2/files#diff-388aa0832650292b5e85f0e5e60d494a00b91251c9144995882b0b118afb4440R1-R41), [[2]](https://github.com/nebius/contree-cli/pull/2/files#diff-3bdb1edae3c4e48dd7da3e83d7ba06f36031b0f4f510fd08e6da2f9919733f10L11-R11), [[3]](https://github.com/nebius/contree-cli/pull/2/files#diff-3bdb1edae3c4e48dd7da3e83d7ba06f36031b0f4f510fd08e6da2f9919733f10R24-R32), [[4]](https://github.com/nebius/contree-cli/pull/2/files#diff-ef53e076b15ba1e03353742592511c277797e36c02543c183080571ae1d3369bR31), [[5]](https://github.com/nebius/contree-cli/pull/2/files#diff-ef53e076b15ba1e03353742592511c277797e36c02543c183080571ae1d3369bL181-R183))

File Uploads and Caching:

  • Refactored the file upload logic to support parallel uploads using a thread pool, with improved local caching of file UUIDs to avoid redundant uploads. The cache now persists host file to UUID mappings and reuses them if within the retention period. ([[1]](https://github.com/nebius/contree-cli/pull/2/files#diff-e1d1d59d05ce4ab826c18d37bde2c867f834f5c05afe057e52eefa84c42f70dbL354-R432), [[2]](https://github.com/nebius/contree-cli/pull/2/files#diff-e1d1d59d05ce4ab826c18d37bde2c867f834f5c05afe057e52eefa84c42f70dbL537-R575))

  • Updated the file upload implementation to stream files directly from disk (using file handles) instead of reading all bytes into memory, improving efficiency and reducing memory usage. ([[1]](https://github.com/nebius/contree-cli/pull/2/files#diff-ef53e076b15ba1e03353742592511c277797e36c02543c183080571ae1d3369bL131-R136), [[2]](https://github.com/nebius/contree-cli/pull/2/files#diff-e1d1d59d05ce4ab826c18d37bde2c867f834f5c05afe057e52eefa84c42f70dbL354-R432))

Logging and Debugging:

  • Introduced a BodyFormatter class and enhanced HTTP request/response logging. Now logs request and response bodies in detail (with truncation for large/binary data), and logs errors with more context. Added a BufferedResponse helper for replaying buffered responses in debug mode. ([[1]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710R38-R124), [[2]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710L83-R172), [[3]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710R188-R194), [[4]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710L109-R213), [[5]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710R229-R230), [[6]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710R242-R250), [[7]](https://github.com/nebius/contree-cli/pull/2/files#diff-6eeb005451cd1cb39243b4499164f5b6eea61a03dbd4efa655351147bd921710R262-R295))

Command Handling and Robustness:

  • Improved command dispatch logic to correctly distinguish between commands that require a remote client/profile and those that operate purely locally (such as auth, agent, man, skill). ([contree_cli/__main__.pyL41-R62](https://github.com/nebius/contree-cli/pull/2/files#diff-3bdb1edae3c4e48dd7da3e83d7ba06f36031b0f4f510fd08e6da2f9919733f10L41-R62))

  • Added fatal logging for failed operations in cmd_run, providing clear feedback when remote operations do not succeed. ([contree_cli/cli/run.pyR709-R716](https://github.com/nebius/contree-cli/pull/2/files#diff-e1d1d59d05ce4ab826c18d37bde2c867f834f5c05afe057e52eefa84c42f70dbR709-R716))

Command Argument Handling:

  • Improved shell command argument quoting using shlex.join and shlex.quote to ensure safe and accurate command construction in both shell and non-shell modes. ([[1]](https://github.com/nebius/contree-cli/pull/2/files#diff-e1d1d59d05ce4ab826c18d37bde2c867f834f5c05afe057e52eefa84c42f70dbL406-R447), [[2]](https://github.com/nebius/contree-cli/pull/2/files#diff-e1d1d59d05ce4ab826c18d37bde2c867f834f5c05afe057e52eefa84c42f70dbL421-R459))

These changes collectively improve usability, reliability, and debuggability of the CLI.

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