DocsAutocompleteGuidesContributing to public specs

If you're looking to improve existing autocomplete functionality, or to add support for a new CLI tool, you can contribute to the autocomplete repo.

Add a completion spec for a CLI tool

Completion specs are defined in a declarative schema that specifies subcommands, options and arguments. Suggestions can be generated dynamically by running shell commands or reading local files, in addition to the information in the spec itself.

For more documentation and tutorials, visit withfig.com/docs

To request completions for a CLI tool, open an issue.

1. Set up the Autocomplete Repo

Fork the autocomplete repo on Github, and clone it to your computer. Then, install the required npm packages.

git clone [fork git url] fig-autocomplete

cd fig-autocomplete

# Install packages
npm install

# Create a new branch
git checkout -b myBranchName

Make sure you're working on a new branch!

2. Develop your spec

To develop a spec, we need to first enter testing mode. From the autocomplete folder, run the following command:

# Go into testing mode
npm run dev

In your autocomplete folder, there will be a build/ folder and a src/ folder. When making changes, make sure to edit the TypeScript files in the src/ folder.

When testing mode is on, all changes made in the src/ folder will automatically compile to the build/ folder. Test your spec's functionality directly in the terminal.

Note: Fig usually looks for completion specs in your ~/.fig/autocomplete folder. When in testing mode, we check your cloned repo's build/ folder

3. Test your spec

To make sure all the specs are of the right format, we can lint all specs in the src/ folder by running the following:

npm test

4. Commit your spec, and make a pull request

git add .
git commit -am "commit message"
git push origin myBranchName

Make a pull request on the autocomplete repo. Your PR will be reviewed and merged when ready!

Other available commands


# Create a new spec from a boilerplate template
npm run create-boilerplate

# Typecheck all specs in the src/ folder
npm test

# Compile typescripts specs from src/ folder to build/ folder
npm run build

# Copy all specs from the build/ folder to the ~/.fig/autocomplete folder
npm run copy:all

# Copy an individual spec from the build/ folder to the ~/.fig/autocomplete folder
npm run copy <spec-name>