feat: Add offline mode - #410
Conversation
|
hello. i fixed the lint |
* Add support for custom OpenAI model in fix command * Use Openai Offcial SDK and disable thinking for model
|
Thanks for working on this. I agree the offline use case is useful, but I don't think we should add it as a separate
The current PR adds a lot of parallel machinery:
Most of that duplicates behavior that already exists in It also creates some behavioral risks:
I would prefer a smaller design:
So I don't think this PR should be merged in its current shape. The direction I would support is a smaller change that makes |
|
@j178 Thanks for the feedback. I reworked the PR around the existing local test flow:
I also added tests for local testcase parsing without metadata, saved question resolution, and saved contest resolution. |
|
Thank you for your work on this, and sorry for the delayed response. I haven’t been actively working on this project lately and don’t have much time or focus to dedicate to it right now, so I can’t guarantee when this will be merged. However, I’ll come back to it when I can and take care of any changes that may be needed. |
This pull request introduces a new "offline mode" to the CLI tool, allowing users to save and run LeetCode questions and tests locally without network access. It adds mechanisms to persist question metadata and test artifacts, as well as new commands and interfaces to support running tests offline for supported languages. The implementation includes code changes across the command layer, configuration, language backends, and new tests to ensure correctness.
Offline mode support:
--offlineflag to theleetgo testcommand, enabling users to run tests using only locally saved artifacts. This mode is mutually exclusive with other test modes (--local,--both,--submit,--force). [1] [2] [3]offline.json) when picking a question, enabling later retrieval for offline testing. [1] [2] [3]runOfflineQuestionfunction to handle offline test execution, including validation and error handling for unsupported question types (e.g., system design).Configuration and state management:
config/offline.goto manage offline questions and state, including saving, loading, and resolving offline questions based on language and slug/frontend ID. [1] [2]Language backend support for offline testing:
OfflineTestableinterface inlang/base.gofor languages that support offline testing, and implementedRunOfflineTestfor Go, C++, Python, and Rust backends. [1] [2] [3] [4] [5]GenerateResultfrom offline metadata, enabling language backends to locate code and test files for offline runs.Testing and utilities:
GenerateResultconstruction from offline data.Dependency and import updates:
These changes together enable robust offline workflows for users who want to practice or test LeetCode problems locally, improving usability in environments with limited or no network access.