Skip to content

refactor: rename --clear-screen flags to symmetric --clear-on-attach/--clear-on-detach#432

Merged
eminwux merged 1 commit into
mainfrom
feat/clear-on-attach-detach-rename
Jun 12, 2026
Merged

refactor: rename --clear-screen flags to symmetric --clear-on-attach/--clear-on-detach#432
eminwux merged 1 commit into
mainfrom
feat/clear-on-attach-detach-rename

Conversation

@eminwux

@eminwux eminwux commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Scope notes (calls the reviewer can push back on)

  • Beyond the issue's table: the table didn't enumerate the public builder surface, but it's the programmatic mirror of the flags and had to move for consistency: pkg/builder.WithClientClearScreenWithClientClearOnAttach, WithClientClearScreenOnDetachWithClientClearOnDetach (+ their internal clientConfig fields), and pkg/attach.Options.ClearScreen/ClearScreenOnDetachClearOnAttach/ClearOnDetach. pkg/spawn.buildClientAttachArgs (the producer of the sb attach argv) was updated in lockstep with the renamed flag strings. Leaving these on the old names would have re-created the exact asymmetry the issue removes. All are fix: stop clearing terminal on attach/detach by default, add opt-in clear flags #426-era, pre-entrenchment surfaces.
  • Left as-is (issue explicitly permits): the internal lowercase clearScreen params/vars/struct fields in internal/terminal/terminalrunner/* and internal/client/clientrunner/terminal.go, plus the escClearScreen/escClearScreenHome consts (which literally name the \x1b[2J ANSI sequence, not the flag). Doc-comment / test-error references to the removed --clear-screen flag literal were updated to --clear-on-attach for accuracy.

AC #3 — on-disk metadata / migration (dev to confirm whether on-disk metadata is affected)

No migration path needed. Findings:

  • The JSON tags clearScreen/clearScreenOnDetach live only on the ephemeral api.ClientSpec (pkg/api/client.go). The persistent server-side api.TerminalSpec carries no such field, so persisted terminal metadata is unaffected.
  • The clear settings are supplied fresh from flags on every sb attach; the live session's behavior is driven by the in-memory Spec value (io.go, lifecycle.go), never read back from a persisted client doc to drive the clear. The on-disk client doc is written for live-client discovery only. A pre-rename client doc belongs to a still-running pre-rename client whose behavior is already in memory — so a hard tag rename cannot make an existing session "silently lose the setting." Clients are short-lived (one per interactive attach).

AC #6 — docs/README references

git grep over the whole tree for the old flag/env/viper literals on non-.go files returns none, so no documentation follow-up issue is warranted.

Test plan

  • make sbsh-sb — canonical build; binary is ELF (7f 45 4c 46), sb/sbsh hardlinked.
  • ./sb attach --help and ./sbsh --help show --clear-on-attach / --clear-on-detach; --clear-screen* no longer present.
  • go build ./... clean.
  • go vet ./... clean.
  • make test (full CI target, incl. e2e) — all green.
  • go test ./pkg/... — all green (builder/spawn/attach/api tests updated for the new names).
  • Tree-wide git grep confirms no remaining --clear-screen / CLEAR_SCREEN / old viper-key / exported ClearScreen* identifiers (only the permitted internal lowercase locals + ANSI-escape consts remain).

Closes #430

@eminwux eminwux added ready-for-review PR is handed off to the reviewer agent in-review Reviewer agent is actively reading this PR and removed ready-for-review PR is handed off to the reviewer agent labels Jun 12, 2026
@eminwux

eminwux commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

PR #432 Review — refactor: rename --clear-screen flags to symmetric --clear-on-attach/--clear-on-detach

LGTM — complete, symmetric hard-rename across every layer (CLI flags, env/viper keys, ClientSpec/Options/AttachRequest fields, JSON wire tags, and the pkg/builder public façade); tree-wide grep confirms zero dangling old identifiers, the old names shipped in no tagged release (0a171ff not in any tag) so dropping back-compat aliases is safe, and CI is green.

@eminwux eminwux added ready-to-merge Reviewed and ready to merge and removed in-review Reviewer agent is actively reading this PR labels Jun 12, 2026
@eminwux eminwux merged commit efe5cd6 into main Jun 12, 2026
5 checks passed
@eminwux eminwux deleted the feat/clear-on-attach-detach-rename branch June 12, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Reviewed and ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cli: rename --clear-screen/--clear-screen-on-detach to symmetric --clear-on-attach/--clear-on-detach

1 participant