Comprehensive Introduction to Fig

· 2 min read

Fig is a tool designed to enhance command-line efficiency and collaboration. It offers a range of features. Recently, due to work requirements, I’ve gained a relatively comprehensive understanding of Fig, so I’m documenting it here.

Update: Fig » Amazon

  1. On 08/28/2023, Fig was acquired by Amazon, which demonstrates Fig’s value.

    https://fig.io/blog/post/fig-joins-aws

  2. Currently, Fig has been sunsetted. Downloading Fig from the official website now redirects to CodeWhisperer. However, the completion experience remains consistent, with the main difference being the removal of non-completion features.

Fig Supported Platforms

  1. Currently only supports Mac

  2. Linux is still under development, with current status available at:

Additional Features Beyond Completion

  1. Dotfiles
  2. Scripts

Completion Mechanism

  1. Traditional command completion is installed on the target machine, but many command-line tools either lack completion support or have fragmented support when installed. Fig addresses this by implementing the solution on the client side. After installation, Fig essentially loads predefined completion specifications on the client, prompting users to select appropriate command options, and then writing them back to the original terminal when Enter is pressed. This cycle repeats to solve the problem of difficult command input. The advantage of this approach is speed, though it does consume some performance and storage space since more commands need to be loaded as the user’s command repertoire grows.

  2. How Fig achieves cross-terminal completion GUI display:

    • The GUI itself is built using frontend JS/HTML/CSS

    • Terminal interaction is achieved through a combination of shell function hooks, accessibility positioning, and frontend completion display

Fig Resources

Fig is not just an App; over the years it has contributed a set of valuable resources

  1. Completion Specifications

    The specifications loaded in the App come from here, and with the power of the GitHub community, they are continuously updated. If you want to build a completion tool, you can directly use these specifications, meaning the Fig App is also a user of these specifications.

    https://github.com/withfig/autocomplete

  2. Completion Specification Scaffolding

    https://github.com/withfig/autocomplete-tools

    For contributing specifications, debugging specifications, etc., you can use the official completion tools.

  3. Command Manual

    To see which commands Fig includes, you can check here:

https://fig.io/manual

Products Using Fig Completion Specifications

  1. Warp

  2. inshellisense

  3. XTerminal

Final Thoughts

Fig is an App, and its most important feature is command completion.

Fig’s most valuable aspect isn’t the App itself, but rather the establishment of a complete set of completion specification protocols. Leveraging community power, it has contributed 500+ command completion specifications. If we’re talking about subcommands, that’s 28k (currently), which is excellent. This is likely why it was acquired by Amazon.

  1. https://fig.io/blog
  2. https://github.com/withfig
Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover