Skip to content

feat(cli): grok-style clap completions with tiny rc hook - #37

Open
Blankeos wants to merge 2 commits into
mainfrom
feat/clap-completion-install
Open

feat(cli): grok-style clap completions with tiny rc hook#37
Blankeos wants to merge 2 commits into
mainfrom
feat/clap-completion-install

Conversation

@Blankeos

@Blankeos Blankeos commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

Grok-style crabcode completion <shell> on clap. Tiny rc hook; clap_complete Tab UX.

What

  • crabcode completion zsh / bash / fish / elvish / powershell — prints the script
  • --install writes the autoload file + a marked rc block appended at the end
  • Zsh: fpath + autoload + compdef (script is not sourced at startup; parsed on first Tab). Never nests inside grok installer
  • Empty Tab is clap _arguments (shared - prefix then flags, same as grok)
  • Install-time scan of .zshrc for alias foo=crabcode into #compdef (no runtime loop, no hardcoded cc)
  • clap#6282 workaround: drop the unused [PROMPT] slot so nested commands complete

Install

crabcode completion zsh --install
exec zsh

Then crabcode completion <tab> → shells; crabcode completion zsh <tab>- then flags.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploying crabcode with  Cloudflare Pages  Cloudflare Pages

Latest commit: 646827f
Status: ✅  Deploy successful!
Preview URL: https://72f1421f.crabcode.pages.dev
Branch Preview URL: https://feat-clap-completion-install.crabcode.pages.dev

View logs

@Blankeos
Blankeos force-pushed the feat/clap-completion-install branch from 5445899 to 294eea0 Compare August 29, 2026 05:34
`crabcode completion <shell>` prints a clap_complete script.
`--install` writes it to the autoload path and a marked rc block
appended after other installers. Zsh uses fpath + autoload +
compdef so the script is not sourced at startup (parsed on first
Tab). `#compdef` includes aliases discovered from `.zshrc` at
install time. clap#6282: drop the unused prompt slot.
@Blankeos
Blankeos force-pushed the feat/clap-completion-install branch from 7574c97 to 9f95d32 Compare August 29, 2026 19:43
…HOME dotsources, strip old inline dumps

- Default shell from `$SHELL` env var (zsh/fish/elvish/pwsh, else bash)
- Script paths use `$XDG_DATA_HOME` / `$XDG_CONFIG_HOME` when set
- Bash falls back to `.bash_profile` when `.bashrc` is absent
- PowerShell hooks dotsource `"$HOME/..."` instead of bare `~`
- Strip old inline completion dumps from rc before installing marked block
- Add CI workflow for rustfmt + completion tests on PRs
- Add PR review doc
- Update README and npm/README with XDG, $SHELL default, and re-run note
- 19 completion tests pass

chore(ci): drop PR Actions workflow

Too expensive, and cargo test hits build.rs requiring remote-client assets.
Keep local completion tests; merge confidence stays 4.5/5.
@Blankeos
Blankeos force-pushed the feat/clap-completion-install branch from 56b69cc to 646827f Compare August 29, 2026 21:14
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