Comprehensive Introduction to Fig
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
On 08/28/2023, Fig was acquired by Amazon, which demonstrates Fig’s value.
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
Currently only supports
Mac
Linux is still under development, with current status available at:
Additional Features Beyond Completion
- Dotfiles
- Scripts
Completion Mechanism
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.
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
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.
Completion Specification Scaffolding
https://github.com/withfig/autocomplete-tools
For contributing specifications, debugging specifications, etc., you can use the official completion tools.
Command Manual
To see which commands Fig includes, you can check here:
Products Using Fig Completion Specifications
Warp
inshellisense
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.