Conversation
|
@silvioprog is attempting to deploy a commit to the Modem Team on Vercel. A member of the Team first needs to authorize it. |
|
PR author is not in the allowed authors list. |
4ae12de to
1cb4665
Compare
1cb4665 to
d7e1ded
Compare
|
Pushed a follow-up fix in 999914b, keeping the metadata-driven static completion approach:
Verified on Linux:
macOS/Bash 3.2 and Windows were not tested for this follow-up. Fish/PowerShell, dynamic extension/ref completion, and This comment was generated by Pi using gpt-6.1-sol |
|
Pushed another follow-up in 13c3503. This keeps static, metadata-driven completion and adds no runtime dependency.
Verification on Linux:
The This comment was generated by Pi using gpt-6.1-sol |
Problem
Hunk's CLI has grown a broad surface (
session,daemon,extension,markup, and their subcommands), but it ships no shell completions, so users have to remember command names, flags, and option values or keep checking--help.Demo
Screen.Recording.2026-10-11.at.7.23.00.PM.mp4
Fix
hunk completion <bash|zsh>, which prints a static completion script.CLI_REFERENCE_COMMANDS,COMMON_REVIEW_OPTIONS,WATCH_OPTION, andSESSION_AGENT_COMMAND_LIST), so completions stay in sync with the commands and the generated docs. Hidden options are excluded.ext,mcp), nested subcommands, and per-command flags. A new optionalvaluesfield on option metadata completes--mode,--cursor-line, and--methodfrom their existing value constants (LAYOUT_MODE_VALUESandCURSOR_LINE_VALUESadded incommandInputs.ts,UPDATE_METHOD_VALUES)._hunkusescompgen -Wand registers withcomplete -o default, so file completion still works for paths. Load it witheval "$(hunk completion bash)", which also works with macOS's default bash 3.2 (source <(...)silently loads nothing there)._describewith descriptions and falls back to_files. It works when loaded withsource <(hunk completion zsh)aftercompinit, or when saved as_hunkinfpath.main.tsxandstartup.tsare unchanged.completionis reserved inBUILT_IN_CLI_COMMAND_NAMESand listed in top-level help.minorchangeset.Why core
Completions need the built-in command and flag metadata, which lives in the core CLI, and the script has to stay in sync with it. An extension could not see or track that surface.
Verification
bun test packages/hunk/src/app/shellCompletion.test.ts packages/hunk/src/app/cli.test.ts: 174 pass. Covers a metadata drift guard, hidden flags, enum values, real bashCOMPREPLYchecks,bash -n/zsh -nsyntax checks (skipped on Windows or when the shell is missing), and CLI parsing forcompletion bash|zsh,--help, and invalid shells.bun run typecheck,bun run lint,bun run deps:check,bun run format:check,bun run ./scripts/generate/generate-docs.ts --check: all clean./bin/bash3.2 (video below): top-level commands,sessionsubcommands, review flags,--mode/--cursor-line/--methodvalues, and file fallback forhunk diff <TAB>.Platforms
Tested on macOS (zsh, bash 3.2). Not manually tested on Linux or Windows.
Limitations and follow-ups
--flag=valueforms do not complete values; the space-separated form does.Closes #1123