Skip to content

Point users at shell completion setup on first start - #484

Merged
joe4dev merged 4 commits into
mainfrom
devx-821-completion-tip
Sep 8, 2026
Merged

Point users at shell completion setup on first start#484
joe4dev merged 4 commits into
mainfrom
devx-821-completion-tip

Conversation

@joe4dev

@joe4dev joe4dev commented Sep 4, 2026

Copy link
Copy Markdown
Member

Motivation

Only Homebrew installs get shell completion set up automatically (homebrew_casks.completions). npm and GitHub-release users have to find the docs themselves, so a shipped time-saving feature goes mostly unused.

Solution

Emit one line after the first successful interactive start, pointing at lstk completion [bash|zsh|fish|powershell] and the docs section:

> Tip: Enable tab completion for your shell: lstk completion [bash|zsh|fish|powershell] See https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/#shell-completions

Two deliberate deviations from the ticket: the trigger is the first run, not install (no install path offers a usable hook — npm's package.json is generated, a postinstall that edits a shell rc is hostile and is skipped under --ignore-scripts, and binary installs have no hook), and it is a pointer, not a prompt — lstk never writes to the user's shell config. An automated lstk completion --write was designed and dropped in favour of this because the big complexity (cross-platform, cross-shell, cross-install-method) is not worth maintaining for a small gain.

Needs no new persisted state: firstRun means "config.toml was absent", and that same path creates the config, so the tip cannot repeat. Interactive-only, so CI and --json output are unchanged. Prefix and severity match tipsForType, whose tip renders directly above it.

The wording follows the Verb ...: <command> shape the neighbouring tips already use.

The main_test.go/awsconfig_test.go part of the diff is test plumbing: these tests isolate HOME under t.TempDir() and start a real emulator, whose container writes root-owned files into the bind-mounted volume that Go's TempDir cleanup cannot delete on Linux. awsconfig_test.go already solved this; scheduleVolumeCleanup extracts it so there is one copy rather than two.

Manual testing

make build
export LOCALSTACK_AUTH_TOKEN=<token>
H=$(mktemp -d)

HOME=$H bin/lstk start   # accept AWS at the emulator picker
#   -> last line is the "> Tip: Enable tab completion ..." line above

HOME=$H bin/lstk start   # tip must NOT reappear (config now exists)
HOME=$H bin/lstk stop

HOME=$(mktemp -d) bin/lstk start --json   # envelope must contain no tip

Screenshot from manual testing:

  • Tip appears on first launch
  • Tip does not appear on subsequent commands
Screenshot 2026-09-04 at 16 19 37
Docs

No documentation change needed — the tip points at the existing "Shell completions" section and adds no command, flag, or env var. Worth knowing that the CLI now links to that section directly, so the #shell-completions anchor should stay stable.

Review

Human review advised — new user-facing output on the shared start path.

Todo

  • Manual testing (see above)

Closes DEVX-821

@joe4dev joe4dev added semver: patch docs: skip Pull request does not require documentation changes labels Sep 4, 2026
@joe4dev
joe4dev marked this pull request as ready for review September 4, 2026 14:25
@joe4dev
joe4dev requested review from a team and peter-smith-phd as code owners September 4, 2026 14:25
@joe4dev
joe4dev force-pushed the devx-821-completion-tip branch 2 times, most recently from 6d5ed2a to 3039a2b Compare September 7, 2026 10:07

@anisaoshafi anisaoshafi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the thorough integration testing, looks robust 👏🏼

Comment thread internal/ui/run.go Outdated
joe4dev added a commit that referenced this pull request Sep 8, 2026
Addresses review feedback on #484: the comments were verbose even where the
code was obvious. Trimmed 74 comment lines to 31, keeping only what a future
reader would otherwise break — the MessageEvent/DeferredEvent constraint in
Run, the LIFO ordering scheduleVolumeCleanup depends on, why --type still
counts as a first run — and dropping the design narration around them.

Also fixes startTestContainer's doc comment, which scheduleVolumeCleanup had
been inserted in front of, silently reattaching it to the wrong function.

CLAUDE.md gains a length budget in Code Style, and the "Maintaining This File"
bullet no longer reads as an invitation to write essays in doc comments.

Co-Authored-By: Claude <noreply@anthropic.com>
joe4dev added a commit that referenced this pull request Sep 8, 2026
Addresses review feedback on #484: the comments were verbose even where the
code was obvious. Trimmed 74 comment lines to 31, keeping only what a future
reader would otherwise break — the MessageEvent/DeferredEvent constraint in
Run, the LIFO ordering scheduleVolumeCleanup depends on, why --type still
counts as a first run — and dropping the design narration around them.

Also fixes startTestContainer's doc comment, which scheduleVolumeCleanup had
been inserted in front of, silently reattaching it to the wrong function.

CLAUDE.md gains a length budget in Code Style, and the "Maintaining This File"
bullet no longer reads as an invitation to write essays in doc comments.

Co-Authored-By: Claude <noreply@anthropic.com>
@joe4dev
joe4dev force-pushed the devx-821-completion-tip branch from c90cfae to 763353e Compare September 8, 2026 10:10
joe4dev added a commit that referenced this pull request Sep 8, 2026
Addresses review feedback on #484: the comments were verbose even where the
code was obvious. Trimmed 74 comment lines to 31, keeping only what a future
reader would otherwise break — the MessageEvent/DeferredEvent constraint in
Run, the LIFO ordering scheduleVolumeCleanup depends on, why --type still
counts as a first run — and dropping the design narration around them.

Also fixes startTestContainer's doc comment, which scheduleVolumeCleanup had
been inserted in front of, silently reattaching it to the wrong function.

CLAUDE.md gains a length budget in Code Style, and the "Maintaining This File"
bullet no longer reads as an invitation to write essays in doc comments.

Co-Authored-By: Claude <noreply@anthropic.com>
@joe4dev
joe4dev force-pushed the devx-821-completion-tip branch from 763353e to a286f0e Compare September 8, 2026 12:00
joe4dev and others added 4 commits September 8, 2026 12:14
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Addresses review feedback on #484: the comments were verbose even where the
code was obvious. Trimmed 74 comment lines to 31, keeping only what a future
reader would otherwise break — the MessageEvent/DeferredEvent constraint in
Run, the LIFO ordering scheduleVolumeCleanup depends on, why --type still
counts as a first run — and dropping the design narration around them.

Also fixes startTestContainer's doc comment, which scheduleVolumeCleanup had
been inserted in front of, silently reattaching it to the wrong function.

CLAUDE.md gains a length budget in Code Style, and the "Maintaining This File"
bullet no longer reads as an invitation to write essays in doc comments.

Co-Authored-By: Claude <noreply@anthropic.com>
@joe4dev
joe4dev force-pushed the devx-821-completion-tip branch from a286f0e to 06c440e Compare September 8, 2026 12:14
@joe4dev
joe4dev enabled auto-merge (squash) September 8, 2026 12:15
@joe4dev
joe4dev merged commit c442e22 into main Sep 8, 2026
19 checks passed
@joe4dev
joe4dev deleted the devx-821-completion-tip branch September 8, 2026 12:26

gtsiolis commented Sep 8, 2026

Copy link
Copy Markdown
Member

Showing two tips side-by-side is a UX regression. ⚠️ Cc @joe4dev @anisaoshafi

Things that can help:

  1. Rotating the tip
  2. Showing more instructions after DEVX-877

@joe4dev

joe4dev commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Showing two tips side-by-side is a UX regression. ⚠️ Cc @joe4dev @anisaoshafi

Things that can help:

  1. Rotating the tip
  2. Showing more instructions after DEVX-877

@gtsiolis Should we only show the completion tip upon first launch and suppress the default tip (lstk status); i.e., enforcing max 1 tip?
This only applies to the very first launch of lstk.

gtsiolis commented Sep 8, 2026

Copy link
Copy Markdown
Member

Enforcing max one tip would be great, that's why we added the tip rotation. Otherwise we will definitely end up with multiple tips listed as every new thing would race for attention.

I remember opening PRO-245 few months ago specifically for promoting for auto-completion. Options to consider:

  1. Detect the shell and show appropriate commands
  2. Prompt for adding auto-completion step-by-step as described in the issue
  3. Using a short URL is highly recommended for such terminal output

joe4dev commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Enforcing max one tip would be great, that's why we added the tip rotation.

Good point. I can create a follow-up PR (EDIT: see draft here) and suppress other tips on first launch.

  1. Using a short URL is highly recommended for such terminal output

❓ How do we configure such short URLs ? Do we have an example?

Regarding the other options:

  1. Detect the shell and show appropriate commands

I started designing such a solution, but reconsidered in favor of a simple approach (completion is also irrelevant for agents):

An automated lstk completion --write was designed and dropped in favour of this because the big complexity (cross-platform, cross-shell, cross-install-method) is not worth maintaining for a small gain.

  1. Prompt for adding auto-completion step-by-step as described in the issue

Thanks for sharing PRO-245

That could be a viable middle-ground. We'd need keep it in sync with the docs (https://docs.localstack.cloud/aws/developer-tools/running-localstack/lstk/#shell-completions) and do further testing (e.g., powershell instructions are missing).

@joe4dev

joe4dev commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

@gtsiolis Can you have a look at #495 whether it addresses your UX feedback?
It enforces the max one tip approach (see screenshots in PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants