DocsAutocomplete for local scripts

Building Autocomplete for Local Scripts

Build autocomplete for your local scripts like,, or build.js.

Setting up your dev environment

Init the .fig folder

Go to the directory that contains your script and run the following

npx @withfig/autocomplete-tools@latest init

This will create 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 completion spec in src/. 
# You must name it the exact same as your script including the extension
# e.g. if your script is called "", call your spec ""
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)
npm run build

That's it!

Now when you type something like ./, Fig will load up the .fig/autocomplete/ completion spec automatically. This also works for things like python or node tests.js.

Note: Fig is working on providing a much better experience for building specs for your scripts. In the meantime if you need help, please email

Up Next

Looking to build comprehensive internal CLIs for your team with Fig?

See "Building Autocomplete for teams" for more details.

For more information on building more complex autocomplete specs, see "Dynamic Suggestions".