npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@withfig/autocomplete

v2.654.1

Published

Fig Autocomplete Specs

Downloads

126,496

Readme


Badge: macOS Badge: Sign up (public beta) Badge: Documentation Badge: contributors Badge: Join the Discord server Badge: Follow on Twitter

Fig makes the command line easier for individuals and more collaborative for teams.

Our most popular product is Autocomplete. As you type, Fig pops up subcommands, options, and contextually relevant arguments in your existing terminal.

⚡️ Installation

NOTE: Once it's downloaded, launch the app to set up Fig!

Demo of Fig's visual autocomplete in a terminal

👋 What are "completion specs"?

A completion spec is a declarative schema that specifies the subcommands, options and args for a CLI tool. Fig uses these schemas to generate suggestions.

😎 Contribute your first spec in < 3 minutes

Use the steps below or follow our getting started guide: fig.io/docs

Prerequisites:

  • Download Fig for macOS
  • Node and Pnpm

Steps

  1. Make sure you have pnpm installed, as that's the package manager used in this repo.

  2. Click here to fork this repo.

  3. Clone your forked repo and create an example spec

    # Replace `YOUR_GITHUB_USERNAME` with your own GitHub username
    git clone https://github.com/YOUR_GITHUB_USERNAME/autocomplete.git fig-autocomplete
    cd fig-autocomplete
    
    # Add withfig/autocomplete as a remote
    git remote add upstream https://github.com/withfig/autocomplete.git
    
    # Install packages
    pnpm install
    
    # Create an example spec (call it "abc")
    pnpm create-spec abc
    
    # Turn on "dev mode"
    pnpm dev
  4. Now go to your terminal and type abc[space]. Your example spec will appear. 😊

Other things to know

  • Edit your spec in TypeScript in the src/ folder
  • On save, specs are compiled to the build/ folder
  • In dev mode, specs are read from the build folder, and generators run every keystroke.

🪄 Add AI to completions

You can use Fig's autocomplete for your own tools too. Here's how to create private completions:

import { ai } from "@fig/autocomplete-generators"

...

generators: [
  ai({
    // the prompt
    prompt: "Generate a git commit message",
    
    // Send any relevant local context.
    message: async ({ executeShellCommand }) => {
      return executeShellCommand("git diff")
    },
    
    // turn each newline into a suggestion (can specify instead a `postProcess1 function if more flexibility is required)
    splitOn: "\n",
  })
]

📦 Other available package.json commands

# Typecheck all specs in the src/ folder
pnpm test

# Compile typescripts specs from src/ folder to build/ folder
pnpm build

# Lint and fix issues
pnpm lint:fix

🔥 Contributions

We would love contributions for:

  • new completion specs
  • errors with existing completion specs (e.g. missing subcommands, options, or arguments)
  • generators for argument suggestions
  • better descriptions, icons etc
  • themes!

If you aren't able to contribute, please feel free to open an issue.

😊 Need Help?

🧑‍💻 Teams / Enterprise

Want to use Fig to add autocomplete internal CLI tools? Or want to use Fig at work but have security / compliance concerns?

We would love to help get you set up. Please email [email protected]

🙋‍♀️ FAQ

What terminals does Fig work with?

Fig works with the native macOS Terminal app, iTerm, Tabby, Hyper, Kitty, WezTerm, and Alacritty. It also works in the integrated terminals of VSCode, JetBrains IDEs, Android Studio, and Nova.

Want to see another terminal included? Check our issue tracker and add your support for it!

How does Fig work?

Fig uses the Accessibility API on Mac to position the window, and integrates with your shell to read what you've typed.

Does Fig work on Windows or Linux?

Not yet, Fig is only available on macOS for now. Windows and Linux support is in progress!

How can I download Fig?

Run brew install fig or, downloading the app at fig.io/download. Then, launch the Fig app!

Can I use Fig to build autocomplete for my team's internal scripts and CLI tools?

Yes! Check out our guide on how to get started building autocomplete specs.

How do I submit a PR?

Check out our How to Contribute guide. Many of Fig's 200+ contributors made their first open source contribution to Fig!

Fig doesn't work for me!

Join the Discord server and we'll debug it. Fixing Fig in your setup will fix it for other people too! 🙂

Did we miss something?

Get in touch at [email protected] or chat with us on Discord.

✨ Contributors