Skip to content

Conversation

@AmirSa12
Copy link

@AmirSa12 AmirSa12 commented Oct 11, 2025

πŸ”— 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();

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2025

πŸ“¦ Bundle Size Comparison

πŸ“ˆ nuxi

Metric Base Head Diff
Rendered 4297.93 KB 4338.54 KB +40.61 KB (+0.94%)

πŸ“ˆ nuxt-cli

Metric Base Head Diff
Rendered 120.80 KB 123.77 KB +2.97 KB (+2.46%)

πŸ“ˆ create-nuxt

Metric Base Head Diff
Rendered 2320.92 KB 2361.75 KB +40.83 KB (+1.76%)

@pkg-pr-new
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: 243bf65

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 11, 2025

CodSpeed Performance Report

Merging #1082 will not alter performance

Comparing AmirSa12:feat/tab-completions (243bf65) with main (f38bb1a)

Summary

βœ… 2 untouched

@AmirSa12 AmirSa12 force-pushed the feat/tab-completions branch 2 times, most recently 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
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

this is looking very, very exciting!

@AmirSa12 AmirSa12 force-pushed the feat/tab-completions branch from b605055 to 81e36cf Compare October 17, 2025 11:01
@AmirSa12 AmirSa12 requested a review from danielroe October 28, 2025 08:28
@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2025

Codecov Report

❌ Patch coverage is 3.22581% with 150 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@df17ad4). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/nuxi/src/completions.ts 2.85% 68 Missing ⚠️
scripts/generate-completions-data.ts 2.17% 45 Missing ⚠️
packages/nuxi/src/completions-init.ts 4.34% 22 Missing ⚠️
packages/create-nuxt/src/main.ts 0.00% 6 Missing ⚠️
packages/nuxi/src/main.ts 0.00% 5 Missing ⚠️
packages/nuxt-cli/src/run.ts 20.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1082   +/-   ##
=======================================
  Coverage        ?   24.98%           
=======================================
  Files           ?       85           
  Lines           ?     4350           
  Branches        ?      220           
=======================================
  Hits            ?     1087           
  Misses          ?     3233           
  Partials        ?       30           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AmirSa12
Copy link
Author

@danielroe, thank you for reporting the issue! I updated tab to version 0.0.8

@danielroe
Copy link
Member

thank you!

CleanShot.2025-10-30.at.15.24.23.mp4

testing this after installing tab completions for pnpm, it doesn't seem to work, however.

am I missing anything?

@AmirSa12
Copy link
Author

thank you!

CleanShot.2025-10-30.at.15.24.23.mp4
testing this after installing tab completions for pnpm, it doesn't seem to work, however.

am I missing anything?

I tested and it did work!
Screenshot 2025-10-30 at 7 15 46β€―PM

Did you source the script that tab generates?
Can you test with pnpm <TAB> and see if pnpm completions work in the first place?

@danielroe
Copy link
Member

yes, no completions are printing at all.

CleanShot.2025-10-30.at.16.53.09.mp4

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.

4 participants