Skip to content

Conversation

AmirSa12
Copy link

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR introduces tab completion functionality for the nuxt cli, improving developer experience by allowing shell(zsh, powershell, fish, bash) autocompletion for commands, options, values, and flags. With this PR, users can navigate available commands, options and values more efficiently and faster with speeding up workflow.

A small video of how this works:

nuxi.mp4

A small documentation of how CLIs can integrate tab ( in this case, I'm using the citty adapter )

import { defineCommand, createMain } from 'citty';
import tab from '@bomb.sh/tab/citty';

const main = defineCommand({
  meta: { name: 'my-cli', description: 'My CLI tool' },
  subCommands: {
    dev: defineCommand({
      meta: { name: 'dev', description: 'Start dev server' },
      args: {
        port: { type: 'string', description: 'Specify port' },
        host: { type: 'string', description: 'Specify host' },
      },
    }),
  },
});

// Initialize tab completions
const completion = await tab(main);

// Add custom completions
const devCommand = completion.commands.get('dev');
const portOption = devCommand?.options.get('port');
if (portOption) {
  portOption.handler = (complete) => {
    complete('3000', 'Development port');
    complete('8080', 'Production port');
  };
}

const cli = createMain(main);
cli();

Copy link
Contributor

github-actions bot commented Oct 11, 2025

πŸ“¦ Bundle Size Comparison

πŸ“ˆ nuxi

Metric Base Head Diff
Rendered 5079.11 KB 5114.86 KB +35.75 KB (+0.70%)

➑️ nuxt-cli

Metric Base Head Diff
Rendered 108.86 KB 108.86 KB 0.00 KB (0.00%)

➑️ create-nuxt

Metric Base Head Diff
Rendered 2178.73 KB 2178.73 KB 0.00 KB (0.00%)

Copy link

pkg-pr-new bot commented Oct 11, 2025

nuxt-cli-playground

npm i https://pkg.pr.new/create-nuxt@1082
npm i https://pkg.pr.new/nuxi@1082
npm i https://pkg.pr.new/@nuxt/cli@1082

commit: 11dd4bd

Copy link

codspeed-hq bot commented Oct 11, 2025

CodSpeed Performance Report

Merging #1082 will not alter performance

Comparing AmirSa12:feat/tab-completions (11dd4bd) with main (d8e89aa)

Summary

βœ… 2 untouched

@AmirSa12 AmirSa12 force-pushed the feat/tab-completions branch from b48598c to 2e68892 Compare October 13, 2025 08:52
@AmirSa12 AmirSa12 force-pushed the feat/tab-completions branch from 3fab8fe to 911f4b4 Compare October 13, 2025 09:08
@AmirSa12 AmirSa12 marked this pull request as ready for review October 13, 2025 09:17
@AmirSa12 AmirSa12 requested a review from danielroe as a code owner October 13, 2025 09:17
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.

2 participants