DocsTutorialsBuilding internal CLIs

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.

Init the .fig folder

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 initialize a .fig/ folder in your current working directory like the following

├── .fig/
│   └── autocomplete/
│       ├── src/                # where you edit your completion specs
│       ├── build/              # where your specs compile to
│       ├── .eslintrc.js
│       ├──
│       ├── package-lock.json
│       ├── package.json
│       └── tsconfig.json
├── node_modules/

This is like a minimal version of the withfig/autocomplete repo with an empty src folder and all the tooling you need to build specs.

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

# Compile your specs from the src/ folder to build/ folder (dev mode does this automatically for you)
npm run build

Push Specs to Fig's Cloud

# 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>

# Link your compiled completion specs to a team (use space to select / deselect)
# Note: currently, you must run this with the .fig/ folder as your cwd
npx fig-teams@latest manifest

# Deploy your completion spec to the Fig cloud
# Note: currently, you must run this with the .fig/ folder as your cwd
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 :)

If you have any problems, please email We are working hard to make this experience much better

Final notes

  • The fig-teams CLI is temporary and will soon be wrapped beneath the fig CLI.
  • To see all fig-teams commands run npx fig-teams@latest --help