Skip to content

feat: COMMAND-mode Tab completion + newcomer onboarding + tntctl shell completion#62

Merged
m1ngsama merged 4 commits into
mainfrom
feat/command-completion
Jun 29, 2026
Merged

feat: COMMAND-mode Tab completion + newcomer onboarding + tntctl shell completion#62
m1ngsama merged 4 commits into
mainfrom
feat/command-completion

Conversation

@m1ngsama

Copy link
Copy Markdown
Owner

Makes TNT's commands discoverable for both the developer/Vim majority and first-time/non-technical users. All changes are core UX or packaging — no gating, equal for every user.

1. COMMAND-mode Tab completion (for the dev/Vim majority)

Mirrors the existing INSERT @mention Tab completion.

  • :the+Tab → :theme ; unique prefixes complete fully.
  • Ambiguous prefixes fill the longest common prefix and list candidates inline on the status line (:mmsg mute-joins); :+Tab lists all commands.
  • First-argument completion for closed sets: :theme /:lang values, and online usernames for :msg /:w (reuses room data like @mention).
  • New tested command_catalog_complete() + tui_render_command_hint().

2. Newcomer onboarding (for non-technical users)

  • A dim, centered 'getting started' line under the welcome banner, shown to every connecting user before the name prompt: i type · Enter send · : commands · :help guide.
  • The always-visible wide INSERT hint now surfaces : commands and :help.
  • (The empty-room placeholder is deliberately not used — joining always writes a system message, so it never shows to a logged-in user.)

3. tntctl shell completion (for the CLI side)

  • packaging/completions/ with bash, zsh, and fish completion: flags, subcommands, --json after users/stats, --host-key-checking modes. Install notes included.

Tests & verification

  • New command_catalog_complete unit tests (6) + interactive expect regression for name/ambiguous/argument completion. Full unit + interactive + docs-surface suites pass on macOS and the Linux deploy host.
  • Completion scripts validated under bash/zsh/fish (parse + functional checks).
  • Built & deployed to aliyun.m1ng.space:2222; live-verified welcome guide, name completion, inline candidates, and argument completion over SSH.
  • Docs (README, QUICKREF, tnt.1) updated in the same change set.

All i18n strings localized (en/zh).

m1ngsama added 4 commits June 29, 2026 10:11
Add command_catalog_complete(): a tested, case-insensitive prefix completer
over canonical command names that reports matches and their longest common
prefix. Wire Tab in COMMAND mode (mirroring the existing INSERT @mention Tab):

- ':the'+Tab -> ':theme '; unique prefixes complete fully.
- Ambiguous prefixes fill the longest common prefix and show candidates
  inline on the status line (e.g. ':m' -> 'msg  mute-joins'); ':'+Tab lists all.
- First-argument completion for closed sets: ':theme '/':lang ' values and
  online usernames for ':msg '/':w ' (reusing room data like @mention).

New tui_render_command_hint() renders the dim, width-truncated candidate list.
Covered by command_catalog unit tests and an interactive expect regression.
Add a dim, centered 'getting started' line under the welcome banner
(shown to every connecting user before the name prompt) and expand the
always-visible wide INSERT-mode hint to surface ':' commands and ':help'.

The empty-room placeholder is intentionally not used for onboarding since
joining always writes a system message, so it is never shown to a logged-in
user. Both new strings are localized (en/zh).
Add packaging/completions/ with bash, zsh, and fish completion for tntctl:
option flags, the stable subcommands (health/stats/users/tail/dump/post/
help/exit), --json after users/stats, and --host-key-checking modes. The
remote host is free-form and intentionally not completed. Includes install
instructions in packaging/completions/README.md.
Add the Tab completion keybinding to README, QUICKREF, and the tnt.1 man
page in the same change set as the feature.
@m1ngsama m1ngsama merged commit 048bd33 into main Jun 29, 2026
9 of 10 checks passed
@m1ngsama m1ngsama deleted the feat/command-completion branch June 29, 2026 05:59
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.

1 participant