Skip to content

[feat] Support changing branch type (prefix) in rimba rename#341

Merged
lugassawan merged 7 commits into
mainfrom
feature/rename-retype
Jun 22, 2026
Merged

[feat] Support changing branch type (prefix) in rimba rename#341
lugassawan merged 7 commits into
mainfrom
feature/rename-retype

Conversation

@lugassawan

Copy link
Copy Markdown
Owner

Summary

  • Add RenameParams struct to internal/operations/rename.go (NewPrefix "" = inherit from branch)
  • Extend rimba rename to accept an optional [new-task] arg and prefix flags (--bugfix, --hotfix, --docs, --test, --chore) so users can change the branch type without recreating the worktree
  • Output now shows full branch names (feature/auth -> bugfix/auth) instead of task names
  • No-op guard updated to "nothing to change: branch is already <branch>" (exit 1)

Test Plan

  • Unit tests pass (make test)
  • Linter passes (make lint)
  • E2E tests pass (make test-e2e)

Type-tailored checks ([feat])

  • rimba rename auth --bugfixbugfix/auth branch and bugfix-auth dir created; feature/auth gone
  • rimba rename auth login --bugfixbugfix/login (rename + retype in one step)
  • rimba rename auth (no flag, no change) → exit 1, stderr contains "nothing to change"
  • Task-only rename still inherits prefix (existing TestRenamePreservesPrefix stays green)
  • Coverage ≥ 97% (actual: 97.3%)

Issue

Closes #329

Comment thread tests/e2e/rename_test.go
Comment thread docs/commands/rename.md
Also adds --feature note to rename docs (no flag exists for
reverting to feature/ prefix).
Comment thread internal/operations/rename.go
Comment thread docs/commands/rename.md Outdated
Comment thread tests/e2e/rename_test.go
Comment thread cmd/rename.go
}

_, task = operations.ResolveTaskInput(task, repoRoot)
_, newTask = operations.ResolveTaskInput(newTask, repoRoot)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Medium (advisory): ResolveTaskInput is called on newTask here but the source task goes through findWorktree which internally re-resolves it. The code is functionally correct — monorepo inputs like auth-api/login work correctly because findWorktree handles the service prefix. The asymmetry is subtle though: a reader of this function must trace into findWorktree to understand why task doesn't also go through ResolveTaskInput at this call site. Consider explicitly resolving both here and passing the resolved task to findWorktree so the data flow is auditable in one place. Not a blocker, just a readability note.

Also documents bare-branch promotion behavior in rename.md intro.
Comment thread tests/e2e/rename_test.go
Comment thread docs/commands/rename.md Outdated
Comment thread tests/e2e/rename_test.go
Comment thread docs/commands/rename.md Outdated
Comment thread cmd/rename_test.go Outdated
@lugassawan lugassawan merged commit 7ffc35f into main Jun 22, 2026
10 checks passed
@lugassawan lugassawan deleted the feature/rename-retype branch June 22, 2026 12:43
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.

[feat] Support changing branch type (prefix) in rimba rename

1 participant