feat: rename cascade command to restack, keep cascade as alias#32
feat: rename cascade command to restack, keep cascade as alias#32
Conversation
Stack
Managed by gh-stack |
There was a problem hiding this comment.
Pull request overview
Renames the user-facing cascade command to restack while keeping cascade as a Cobra alias, and updates help text/output/docs to use the new terminology (including renaming sync’s --no-cascade flag to --no-restack).
Changes:
- Rename the Cobra command
cascade→restackand keepcascadeas an alias. - Update user-facing strings in CLI commands (
sync,submit,continue,undo,abort) to say “restack”. - Update docs (
README.md,ARCHITECTURE.md,e2e/README.md) to reflect the rename and flag change.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| e2e/README.md | Updates E2E docs to refer to “restack” workflows/tests. |
| cmd/undo.go | Updates undo help/error messaging to say “restack”. |
| cmd/sync.go | Updates sync help text and renames flag to --no-restack. |
| cmd/submit.go | Updates submit help text and phase output to “restack”. |
| cmd/continue.go | Updates continue help/success messaging to “restack”. |
| cmd/cascade.go | Implements the restack command name with cascade alias and updates output strings. |
| cmd/abort.go | Updates abort help/output messaging to “restack”. |
| README.md | Updates user documentation and command reference to “restack” (and notes alias). |
| ARCHITECTURE.md | Updates architecture docs to reflect restack naming while preserving internal cascade operation state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7d1877b to
55e58bf
Compare
The `cascade` command is now `restack`, with `cascade` retained as a Cobra alias for backward compatibility. All user-facing strings (help text, output messages, error messages) and documentation updated accordingly. The `--no-cascade` flag on `sync` is now `--no-restack`. Internal identifiers (function names, `STACK_CASCADE_STATE`, `OperationCascade`, etc.) are intentionally unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
55e58bf to
938f1d2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| opName = "Operation" | ||
| } | ||
| fmt.Printf("%s %s aborted. Original HEAD was %s\n", s.WarningIcon(), strings.ToUpper(opName[:1])+opName[1:], st.OriginalHead) |
There was a problem hiding this comment.
abort prints the operation name based on st.Operation, but restack (and sync's restack phase) store OperationCascade ("cascade") in the state file. This means aborting a gh stack restack run will currently print “Cascade aborted…”, which conflicts with the renamed command. Consider mapping "cascade" to the display name "restack" (while still keeping "submit" as-is), or deriving the display name from the command invoked rather than the internal operation key.
| opName = "Operation" | |
| } | |
| fmt.Printf("%s %s aborted. Original HEAD was %s\n", s.WarningIcon(), strings.ToUpper(opName[:1])+opName[1:], st.OriginalHead) | |
| opName = "operation" | |
| } | |
| if opName == state.OperationCascade { | |
| opName = "restack" | |
| } | |
| displayName := strings.ToUpper(opName[:1]) + opName[1:] | |
| fmt.Printf("%s %s aborted. Original HEAD was %s\n", s.WarningIcon(), displayName, st.OriginalHead) |
| Short: "Abort an operation in progress", | ||
| Long: `Abort a restack or submit operation and restore the original state.`, |
There was a problem hiding this comment.
The abort help text says it “restore[s] the original state”, but runAbort only does git rebase --abort, removes the state file, and restores the stash; it does not roll back any branches already successfully rebased earlier in the operation. To avoid misleading users, adjust the Short/Long description to reflect what actually happens (and optionally point users to gh stack undo for a full rollback).
| Short: "Abort an operation in progress", | |
| Long: `Abort a restack or submit operation and restore the original state.`, | |
| Short: "Abort a restack or submit operation in progress", | |
| Long: `Abort a restack or submit operation in progress. | |
| This stops the current operation, aborts any in-progress rebase, cleans up | |
| internal state, and restores any auto-stashed local changes. | |
| It does not roll back branches that were already successfully rebased or | |
| otherwise modified earlier in the operation. For a full rollback of changes | |
| made by a restack or submit, use "gh stack undo".`, |
| Use: "continue", | ||
| Short: "Continue an operation after resolving conflicts", | ||
| Long: `Continue a cascade or submit operation after resolving rebase conflicts.`, | ||
| Long: `Continue a restack or submit operation after resolving rebase conflicts.`, |
There was a problem hiding this comment.
continue can be triggered by a conflict during sync as well (the same state file is used), but the Long help text only mentions “restack or submit”. Update the Long text to include sync (or describe it generically as “an operation”) so CLI help matches actual behavior.
| Long: `Continue a restack or submit operation after resolving rebase conflicts.`, | |
| Long: `Continue a restack, submit, or sync operation after resolving rebase conflicts.`, |
|
|
||
| func init() { | ||
| syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-cascade", false, "skip cascading branches") | ||
| syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-restack", false, "skip restacking branches") |
There was a problem hiding this comment.
Renaming --no-cascade to --no-restack is a breaking CLI change for scripts. If backward compatibility is a goal (as it is for the command rename via Aliases), consider keeping --no-cascade as a deprecated/hidden alias bound to the same variable so existing automation keeps working.
| syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-restack", false, "skip restacking branches") | |
| syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-restack", false, "skip restacking branches") | |
| // Deprecated alias for backward compatibility; prefer --no-restack | |
| syncCmd.Flags().BoolVar(&syncNoCascadeFlag, "no-cascade", false, "skip restacking branches (deprecated; use --no-restack)") | |
| _ = syncCmd.Flags().MarkDeprecated("no-cascade", "use --no-restack instead") | |
| _ = syncCmd.Flags().MarkHidden("no-cascade") |
| // Cascade all (if not disabled) | ||
| if !syncNoCascadeFlag { | ||
| fmt.Println(s.Bold("\nCascading all branches...")) | ||
| fmt.Println(s.Bold("\nRestacking all branches...")) |
There was a problem hiding this comment.
The comment // Cascade all (if not disabled) is now out of date relative to the renamed user-facing terminology (“Restacking all branches…”). Updating these internal comments to “Restack” (and similarly for “Cascade from trunk's children”) will reduce confusion when maintaining this code.
| @@ -54,7 +54,7 @@ func runUndo(cmd *cobra.Command, args []string) error { | |||
|
|
|||
| // Check if a cascade/submit is in progress | |||
There was a problem hiding this comment.
This inline comment still refers to “cascade/submit” even though the check blocks any in-progress operation state and the surrounding user-facing strings have been generalized. Consider updating the comment to match the current behavior/terminology (e.g., “operation in progress”).
| // Check if a cascade/submit is in progress | |
| // Check if an operation is in progress |
| @@ -53,7 +54,7 @@ func runCascade(cmd *cobra.Command, args []string) error { | |||
|
|
|||
| // Check if cascade already in progress | |||
There was a problem hiding this comment.
This comment says “Check if cascade already in progress”, but the command is now user-facing as restack and the error message is generalized to “operation already in progress”. Updating the comment to match the new terminology will make the flow easier to follow.
| // Check if cascade already in progress | |
| // Check if a restack operation is already in progress |
| Abort a cascade or submit operation in progress. | ||
| Abort a restack or submit operation in progress. | ||
|
|
||
| This aborts any in-progress rebase and cleans up the operation state. Your branches will be left in their pre-operation state. |
There was a problem hiding this comment.
The docs claim abort leaves branches in their pre-operation state, but the implementation only aborts the current rebase and removes the state file; any branches already successfully rebased earlier in the operation are not rolled back. Please adjust this description (and/or mention using gh stack undo for a full rollback) so user expectations match behavior.
| This aborts any in-progress rebase and cleans up the operation state. Your branches will be left in their pre-operation state. | |
| This aborts the currently in-progress rebase and cleans up the operation state. It does not roll back branches that were already successfully restacked earlier in the operation; use `gh stack undo` if you need to fully revert previously applied changes. |
The
cascadecommand is nowrestack, withcascaderetained as aCobra alias for backward compatibility. All user-facing strings (help
text, output messages, error messages) and documentation updated
accordingly. The
--no-cascadeflag onsyncis now--no-restack.Internal identifiers (function names,
STACK_CASCADE_STATE,OperationCascade, etc.) are intentionally unchanged.