Skip to content

feat(cmd): rename upgrade command to self-update#192

Merged
skevetter merged 1 commit into
mainfrom
b511-80ea-devsy-016-self-update
May 4, 2026
Merged

feat(cmd): rename upgrade command to self-update#192
skevetter merged 1 commit into
mainfrom
b511-80ea-devsy-016-self-update

Conversation

@skevetter

@skevetter skevetter commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Renames the CLI self-update command from upgrade to self-update to free the upgrade verb for devcontainer feature upgrades (per spec alignment). Adds unit tests verifying the command name, flags, and argument constraints. Renames the E2E test directory and updates all imports accordingly. The internal pkg/upgrade/ package is unchanged — only user-facing command naming is affected.

Summary by CodeRabbit

  • New Features

    • Renamed the CLI upgrade command to self-update with corresponding updates to error messages and help text.
  • Tests

    • Added comprehensive unit tests validating command structure, flags, and argument handling.
    • Added end-to-end tests verifying the self-update command correctly reports system information.

Free the `upgrade` verb for devcontainer feature upgrades by renaming
the CLI self-update command from `upgrade` to `self-update`.
@netlify

netlify Bot commented May 4, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 4f2fe27
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/69f8214434719d0008dfe058

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR renames the CLI's upgrade command to self-update by changing the exported command struct and constructor function from UpgradeCmd / NewUpgradeCmd to SelfUpdateCmd / NewSelfUpdateCmd, updating related error messages and flag descriptions, and adding corresponding unit and e2e test coverage.

Changes

Self-Update Command Rename

Layer / File(s) Summary
Core Command Implementation
cmd/self_update.go
Struct UpgradeCmd renamed to SelfUpdateCmd; function NewUpgradeCmd() renamed to NewSelfUpdateCmd(). Error message updated from "unable to upgrade" to "unable to update"; flag description updated from "without actually upgrading" to "without actually updating".
Root Command Integration
cmd/root.go
Subcommand registration updated to use NewSelfUpdateCmd() instead of NewUpgradeCmd().
Unit Tests
cmd/self_update_test.go
New test file with four tests: command name verification, --version flag validation, --dry-run flag validation, and positional argument validation.
E2E Test Suite & Tests
e2e/e2e_suite_test.go, e2e/tests/selfupdate/selfupdate.go, e2e/tests/upgrade/upgrade.go
E2E suite imports updated to register selfupdate package and deregister upgrade package. New e2e test added that verifies self-update --dry-run output contains correct OS, architecture, and asset name. Old upgrade command e2e test removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Suggested labels

size/m

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: renaming the upgrade command to self-update. It is concise, specific, and clearly summarizes the primary purpose of the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the size/l label May 4, 2026
@skevetter
skevetter marked this pull request as ready for review May 4, 2026 04:32
@skevetter
skevetter enabled auto-merge (squash) May 4, 2026 04:32
@coderabbitai coderabbitai Bot added the size/m label May 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
e2e/tests/selfupdate/selfupdate.go (1)

20-23: 💤 Low value

Prefer filepath.Join over string concatenation for path construction.

initialDir + "/bin" works on Linux/macOS, but filepath.Join is idiomatic Go and portable.

♻️ Proposed refactor
 import (
     "context"
     "os"
+    "path/filepath"
     "runtime"
     "strings"
     ...
 )

-f := framework.NewDefaultFramework(initialDir + "/bin")
+f := framework.NewDefaultFramework(filepath.Join(initialDir, "bin"))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/tests/selfupdate/selfupdate.go` around lines 20 - 23, Replace the
string-concatenated path initialDir + "/bin" with a portable
filepath.Join(initialDir, "bin") when constructing the argument to
framework.NewDefaultFramework; update the imports to include "path/filepath" if
missing and pass filepath.Join(initialDir, "bin") to NewDefaultFramework so path
construction is platform-independent (refer to the initialDir variable and
NewDefaultFramework call).
cmd/root.go (1)

128-128: Consider surfacing a migration hint for users of the old upgrade command.

Since devsy upgrade is being removed with no Cobra alias, any user script or CI pipeline that calls devsy upgrade will now receive a generic "unknown command" error with no guidance. Given the upgrade verb can't be aliased (it's being reserved for a future subcommand), a brief note in release notes or the command's Long description pointing to the rename would improve the upgrade experience.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/root.go` at line 128, Add a brief migration hint for users of the removed
"upgrade" command by updating the Long help text for the new self-update command
(NewSelfUpdateCmd) or the rootCmd description: mention that "devsy upgrade" was
renamed to "devsy self-update" (or whichever new verb is provided), provide a
short migration note or link to release notes, and ensure the hint appears in
CLI help output so scripts/CI users seeing "unknown command" can find the
rename; modify the Long field returned by NewSelfUpdateCmd (or the rootCmd help
string) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@cmd/root.go`:
- Line 128: Add a brief migration hint for users of the removed "upgrade"
command by updating the Long help text for the new self-update command
(NewSelfUpdateCmd) or the rootCmd description: mention that "devsy upgrade" was
renamed to "devsy self-update" (or whichever new verb is provided), provide a
short migration note or link to release notes, and ensure the hint appears in
CLI help output so scripts/CI users seeing "unknown command" can find the
rename; modify the Long field returned by NewSelfUpdateCmd (or the rootCmd help
string) accordingly.

In `@e2e/tests/selfupdate/selfupdate.go`:
- Around line 20-23: Replace the string-concatenated path initialDir + "/bin"
with a portable filepath.Join(initialDir, "bin") when constructing the argument
to framework.NewDefaultFramework; update the imports to include "path/filepath"
if missing and pass filepath.Join(initialDir, "bin") to NewDefaultFramework so
path construction is platform-independent (refer to the initialDir variable and
NewDefaultFramework call).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 586eea18-2e3b-4d50-8034-340e6ca4c505

📥 Commits

Reviewing files that changed from the base of the PR and between 8e1e7dd and 4f2fe27.

📒 Files selected for processing (6)
  • cmd/root.go
  • cmd/self_update.go
  • cmd/self_update_test.go
  • e2e/e2e_suite_test.go
  • e2e/tests/selfupdate/selfupdate.go
  • e2e/tests/upgrade/upgrade.go
💤 Files with no reviewable changes (1)
  • e2e/tests/upgrade/upgrade.go

@skevetter
skevetter merged commit bb0c72f into main May 4, 2026
53 checks passed
@skevetter
skevetter deleted the b511-80ea-devsy-016-self-update branch May 4, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant