Skip to content

feat: safely export custom configurations without overwriting files - #11

Merged
lonecoding merged 1 commit into
mainfrom
improve/safe-config-export
Sep 12, 2026
Merged

lonecoding merged 1 commit into
mainfrom
improve/safe-config-export

Conversation

@lonecoding

Copy link
Copy Markdown
Owner

Changes

Saving a custom configuration with shell redirection can truncate an existing file before the generator rejects an invalid group. Add --output PATH to create a new file exclusively after validation, supporting preset, custom-group and interactive modes. Existing files and symlink targets remain untouched, and prompts/status stay on stderr.

Interactive EOF previously exited successfully without producing a configuration. It now reports failure; blank Enter still selects the recommended preset and Ctrl+C cancels with exit status 130. Update the README, setup examples, maintenance notes and changelog to explain safe exports.

Source and testing

  • Scope: local configuration generator only; no upstream rule or published preset changes.
  • Verification date: 2026-09-12. Local Node.js 22.23.1 and Python 3.11.15.
  • All 14 JavaScript tests pass, including all 32,768 policy-group selections, file preservation, symlinks, paths with spaces, invalid arguments and interactive EOF.
  • All 28 Python tests, 34 offline routing cases and every generation/validation check in CONTRIBUTING.md pass.
  • Manual terminal check: Ctrl+C exits 130, reports cancellation and creates no output file.
  • git diff --check passes. No Quantumult X/iOS device testing: this change affects the desktop generator; app configuration contents are unchanged.

Checklist

  • Checked generated compatibility output and READMEs; ran validation, routing cases, and unit tests in CONTRIBUTING.md.
  • Recorded verification limits; no device testing was performed.
  • Included no servers, subscriptions, keys, or personal information.
  • Preserved existing policies and updated generator documentation together.

@lonecoding
lonecoding merged commit ae9a536 into main Sep 12, 2026
4 checks passed
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