DocsAutocomplete for teams

Building Autocomplete for Internal CLIs

Build and share autocomplete specs for your team's private CLIs and scripts.

Fig supports completion specs for public CLI tools. And now we can support you building completions for your teams internal CLI.

This guide will walk through setting up a completion spec for an internal CLI tool, and how you share it with your team.

Set up your dev environment

Go to the directory that contains your CLI tool, script, or NPM package and run the following

npx @withfig/autocomplete-tools@latest init

This will create a .fig/ folder in that directory described in our setup dev environment guide.

We will be working in the .fig/autocomplete folder.

Create, test, and compile specs

cd into the .fig/autocomplete/ folder and run the remaining commands as package.json scripts

# Make a new empty completion spec in src/. 
# It should be named the same as your CLI tool e.g. `git`, `docker`, `cargo`
npm run create-spec <spec_name>

# Start dev mode to see live updates to your spec in your terminal as you edit.
npm run dev

Push Specs to Fig's Cloud

First, you must create a team and add your colleagues to the team.

# Create a new team
npx fig-teams@latest teams create <team>

# Add co-workers to your team
npx fig-teams@latest teams add:user <email> -t <team>

Second, you must link your local completion spec to a team by updating the .fig/manifest.json file.

# Link your compiled completion specs to a team (use space to select / deselect)
npx fig-teams@latest manifest

Third, you deploy your completion spec to the Fig cloud

npx fig-teams@latest deploy

Finally, right click on the autocomplete window and hit reload.

If you type in the name of your spec, it should pop up with the completions you just pushed! All members of your team can do the same :)

Deploy Future Changes

# Compile your specs
npm run build

# Deploy them!
npx fig-teams@latest deploy

Next Steps

Want to associate your spec with a specific version of the CLI?
See How can my spec account for different versions of a CLI

Use a framework to build your CLI tool?
Check out our integrations with:

Questions? Problems?