Skip to content

Add nillsec upgrade self-update command#7

Merged
403-html merged 4 commits intomainfrom
copilot/add-script-updating-method
Mar 17, 2026
Merged

Add nillsec upgrade self-update command#7
403-html merged 4 commits intomainfrom
copilot/add-script-updating-method

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 17, 2026

  • Add ### Upgrade to the latest release section to README
  • Fix parseMajorVersion to preserve original input in error message (use orig before mutation)
  • Normalize v prefix when comparing current vs latest version to avoid false "update available" when versions differ only by prefix

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
Copilot AI changed the title [WIP] Add way of updating script via nillsec upgrade Add nillsec upgrade command for self-updating Mar 17, 2026
Copilot AI requested a review from 403-html March 17, 2026 14:50
@403-html 403-html requested a review from Copilot March 17, 2026 14:51
Copy link
Copy Markdown
Contributor

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 a nillsec upgrade command that enables self-updating the binary by checking GitHub Releases for the latest version, comparing semver, and atomically replacing the running executable.

Changes:

  • New upgrade.go with full upgrade logic: GitHub API fetch, semver comparison, tar.gz extraction, and atomic binary replacement
  • New upgrade_test.go with 7 tests covering version parsing, asset naming, dev skip, up-to-date check, major version prompt (cancel/confirm), and minor version upgrade
  • main.go updated to wire the upgrade subcommand into the command router and usage text

Reviewed changes

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

File Description
upgrade.go New file implementing the self-update command: fetches latest release, compares versions, downloads platform-specific asset, extracts and atomically replaces binary
upgrade_test.go New file with comprehensive tests using httptest servers and injectable globals
main.go Registers upgrade subcommand in the router and adds it to usage/doc strings

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

Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
Copilot AI changed the title Add nillsec upgrade command for self-updating Add nillsec upgrade self-update command Mar 17, 2026
…alize version prefix in comparison

Co-authored-by: 403-html <57900160+403-html@users.noreply.github.com>
@403-html 403-html marked this pull request as ready for review March 17, 2026 15:29
@403-html 403-html merged commit 3aeadad into main Mar 17, 2026
1 check passed
@403-html 403-html deleted the copilot/add-script-updating-method branch March 17, 2026 19:17
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.

3 participants