Feat/cli config non interactive - #661
Merged
Merged
Conversation
do_subprocess() built commands as "cd <dir> && <cmd>" and ran them through os.system. On Windows that goes to `cmd.exe /c`, whose `cd` does not switch drives without /d, so a cross-drive prepare/build step silently ran in the original directory. Unquoted directories with spaces broke the same way on every platform. do_subprocess() now takes an optional cwd and uses subprocess.call, so the directory is handed to the process and never parsed by the shell. Updated the call sites that prefixed `cd`: platform prepare, build setup, cmake configure, ninja build, ninja clean, and submodule download. KeyboardInterrupt is intentionally left uncaught so Ctrl-C aborts the whole command rather than being reported as a build failure. Adds tools/cli_command/tests/test_util_subprocess.py covering cwd handling, exit-code propagation, and the Ctrl-C path.
Configuring a build without a TTY meant hand-editing app_default.config,
which bypasses kconfiglib: `choice` symbols are not made mutually
exclusive, derived symbols (CONFIG_PLATFORM_CHOICE, CONFIG_CHIP_CHOICE)
are not updated, and the generated using.cmake / tuya_kconfig.h stay
stale on a warm build tree because tools/kconfiglib/CMakeLists.txt only
generates them when absent.
New subcommands, all driving the real Kconfig tree (CONFIG_ prefix
optional everywhere):
config set NAME=VALUE ... dependency-aware assignment, -u to revert
a symbol to its Kconfig default
config get NAME ... value, or -a for type/prompt/deps
config list [-p PATTERN] effective config, substring or glob filter
config diff A [B] compare two configs, expanded through
Kconfig so equivalent minimal files match
config save -n NAME [-f] save without prompting
`config set` parses every token before touching state and exits
non-zero writing nothing if any assignment fails, so a batch is
all-or-nothing. After a successful write it re-derives using.config
from app_default.config and invalidates the derived build artifacts.
Changing platform/board identity triggers the full clean that switch
requires; --no-save is rejected in that case because the clean would
discard the change.
`config save` now guards against overwriting an existing file (-f to
override) and fails with a clear message instead of hanging when stdin
is not a TTY. The overwrite guard is scoped to -n so the interactive
flow is unchanged.
Adds tools/cli_command/util_kconfig.py with the kconfiglib helpers, unit
tests for it and for cli_config, and an opt-in end-to-end suite that
loads the real Kconfig tree (TUYAOPEN_E2E=1, no compilation). Documents
both in AGENTS.md.
yingtao450
approved these changes
Aug 5, 2026
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.
PR 描述/PR description
[在此详细描述 PR 的内容]/[Describe the PR content in detail here]
代码质量/Code Quality:
在本次拉取请求中,我已考虑以下事项 As part of this pull request, I've considered the following: