Open
Conversation
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.
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.iniconfiguration for user defaults, parallelized file uploads with local caching, and more detailed HTTP request/response logging.Configuration and Defaults:
cli.iniconfiguration file (CliSettings) to allow users to specify CLI defaults such aslog_level,output_format, and preferrededitor. 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:
BodyFormatterclass 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 aBufferedResponsehelper 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:
shlex.joinandshlex.quoteto 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.