Skip to content

Conversation

@tis24dev
Copy link
Owner

@tis24dev tis24dev commented Feb 2, 2026

  • Add --upgrade-config-json and auto-config upgrade
  • Refine upgrade prompts, previews, and errors

Introduce a machine-readable config-upgrade mode (--upgrade-config-json) and wire automatic configuration upgrades into the binary upgrade flow. The upgrade command now attempts to run the newly installed binary to merge template changes into backup.env (adding missing keys while preserving existing values).

Implemented robust parsing and rendering for multi-line (block) env values, refactored value parsing into helpers (parseEnvValues, splitKeyValueRaw, renderEnvValue, findClosingQuoteLine) and updated computeConfigUpgrade to preserve block entries and multiple values per key. Added tests covering block preservation and missing-block detection.

printUpgradeFooter now reports detailed config-upgrade results or errors, and installer/help text was updated to reflect the behavior change. Error handling for the JSON mode and subprocess invocation was added to ensure clear diagnostics.
Make the upgrade UX and diagnostics clearer: update the interactive prompt to inform users a backup will be created and backup.env may be updated; extract maxUpgradeConfigJSONPreviewLength constant and use it when truncating invalid JSON preview. Improve error messages to include the config path when parsing fails and the starting line number for unterminated multi-line values. Update tests to normalize CRLF vs LF so assertions are deterministic across platforms.
Copilot AI review requested due to automatic review settings February 2, 2026 23:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic configuration upgrade functionality during binary upgrades and introduces a new --upgrade-config-json flag for internal use. The upgrade process now automatically adds missing keys from the new template to backup.env while preserving existing values, and creates a backup before making changes.

Changes:

  • Added --upgrade-config-json flag for JSON-formatted upgrade output (internal use by --upgrade)
  • Enhanced upgrade workflow to automatically upgrade configuration files using the newly installed binary
  • Implemented support for multi-line block values in environment configuration files

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/config/upgrade.go Added block value parsing and rendering for multi-line configuration values
internal/config/upgrade_test.go Added tests for block value preservation and missing block key tracking
internal/cli/args.go Added UpgradeConfigJSON flag and updated --upgrade description
cmd/proxsave/upgrade.go Implemented automatic config upgrade during binary upgrade with detailed user feedback
cmd/proxsave/main.go Added --upgrade-config-json command handling and updated help text
cmd/proxsave/install.go Updated --upgrade help text to reflect automatic config upgrade behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

continue
}

if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) {
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable blockValueKeys is referenced but never defined or imported in this file. This will cause a compilation error unless blockValueKeys is defined elsewhere in the codebase that isn't shown in the diff.

Suggested change
if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) {
if trimmed == fmt.Sprintf("%s=\"", key) {

Copilot uses AI. Check for mistakes.

templateKeys[key] = true

if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) {
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable blockValueKeys is referenced but never defined or imported in this file. This will cause a compilation error unless blockValueKeys is defined elsewhere in the codebase that isn't shown in the diff.

Suggested change
if blockValueKeys[key] && trimmed == fmt.Sprintf("%s=\"", key) {
if trimmed == fmt.Sprintf("%s=\"", key) {

Copilot uses AI. Check for mistakes.
@tis24dev tis24dev merged commit 9505c08 into main Feb 2, 2026
11 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.

2 participants