• Stars
    star
    24,563
  • Rank 889 (Top 0.02 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

IDE-style autocomplete for your existing terminal & shell

Fig logo Fig logo


Badge: macOS Badge: Sign up (public beta) Badge: Documentation Badge: contributors Badge: Join the Discord server Badge: Follow on Twitter

Fig makes the command line easier for individuals and more collaborative for teams.

Our most popular product is Autocomplete. As you type, Fig pops up subcommands, options, and contextually relevant arguments in your existing terminal.

⚑️ Installation

NOTE: Once it's downloaded, launch the app to set up Fig!


Demo of Fig's visual autocomplete in a terminal


πŸ‘‹ What are "completion specs"?

A completion spec is a declarative schema that specifies the subcommands, options and args for a CLI tool. Fig uses these schemas to generate suggestions.


😎 Contribute your first spec in < 3 minutes

Use the steps below or follow our getting started guide: fig.io/docs

Prerequisites:

  • Download Fig for macOS
  • Node and Pnpm

Steps

  1. Make sure you have pnpm installed, as that's the package manager used in this repo.

  2. Click here to fork this repo.

  3. Clone your forked repo and create an example spec

    # Replace `YOUR_GITHUB_USERNAME` with your own GitHub username
    git clone https://github.com/YOUR_GITHUB_USERNAME/autocomplete.git fig-autocomplete
    cd fig-autocomplete
    
    # Add withfig/autocomplete as a remote
    git remote add upstream https://github.com/withfig/autocomplete.git
    
    # Install packages
    pnpm install
    
    # Create an example spec (call it "abc")
    pnpm create-spec abc
    
    # Turn on "dev mode"
    pnpm dev
  4. Now go to your terminal and type abc[space]. Your example spec will appear. 😊

Other things to know

  • Edit your spec in TypeScript in the src/ folder
  • On save, specs are compiled to the build/ folder
  • In dev mode, specs are read from the build folder, and generators run every keystroke.

πŸͺ„ Add AI to completions

You can use Fig's autocomplete for your own tools too. Here's how to create private completions:

import { ai } from "@fig/autocomplete-generators"

...

generators: [
  ai({
    // the prompt
    prompt: "Generate a git commit message",
    
    // Send any relevant local context.
    message: async ({ executeShellCommand }) => {
      return executeShellCommand("git diff")
    },
    
    // turn each newline into a suggestion (can specify instead a `postProcess1 function if more flexibility is required)
    splitOn: "\n",
  })
]

πŸ“¦ Other available package.json commands

# Typecheck all specs in the src/ folder
pnpm test

# Compile typescripts specs from src/ folder to build/ folder
pnpm build

# Lint and fix issues
pnpm lint:fix

πŸ”₯ Contributions

We would love contributions for:

  • new completion specs
  • errors with existing completion specs (e.g. missing subcommands, options, or arguments)
  • generators for argument suggestions
  • better descriptions, icons etc
  • themes!

If you aren't able to contribute, please feel free to open an issue.

😊 Need Help?

Join our community
Discord logo

πŸ§‘β€πŸ’» Teams / Enterprise

Want to use Fig to add autocomplete internal CLI tools? Or want to use Fig at work but have security / compliance concerns?

We would love to help get you set up. Please email [email protected]

πŸ™‹β€β™€οΈ FAQ

What terminals does Fig work with?

Fig works with the native macOS Terminal app, iTerm, Tabby, Hyper, Kitty, WezTerm, and Alacritty. It also works in the integrated terminals of VSCode, JetBrains IDEs, Android Studio, and Nova.

Want to see another terminal included? Check our issue tracker and add your support for it!

How does Fig work?

Fig uses the Accessibility API on Mac to position the window, and integrates with your shell to read what you've typed.

Does Fig work on Windows or Linux?

Not yet, Fig is only available on macOS for now. Windows and Linux support is in progress!

How can I download Fig?

Run brew install fig or, downloading the app at fig.io/download. Then, launch the Fig app!

Can I use Fig to build autocomplete for my team's internal scripts and CLI tools?

Yes! Check out our guide on how to get started building autocomplete specs.

How do I submit a PR?

Check out our How to Contribute guide. Many of Fig's 200+ contributors made their first open source contribution to Fig!

Fig doesn't work for me!

Join the Discord server and we'll debug it. Fixing Fig in your setup will fix it for other people too! πŸ™‚

Did we miss something?

Get in touch at [email protected] or chat with us on Discord.


✨ Contributors

Grid of profile icons of the 200+ contributors

More Repositories

1

fig

Public issue tracker for Fig.
2,048
star
2

plugins

Plugin store for zsh, bash & fish.
TypeScript
165
star
3

themes

68
star
4

config

Fig's integrations with bash, zsh, fish, ssh, and tmux. Also contains Fig's installation and update scripts. Finally, this repo is the root of the .fig folder that is installed on your computer when you download Fig!
Shell
59
star
5

autocomplete-tools

Command line tools for working with Fig autocomplete specs
TypeScript
41
star
6

push-to-fig-autocomplete-action

Action to automatically open a new PR to the https://github.com/withfig/autocomplete repo
TypeScript
11
star
7

gnome-shell-extension

JavaScript
10
star
8

fig-apps

A list of all open source Fig Apps
10
star
9

features

Shell
9
star
10

oh-my-fig

Sane, opinionated shell defaults
Shell
9
star
11

challenge-window-events

Implement a Swift wrapper around the macOS accessibility API that listens for window events
7
star
12

man-page-scraper

Automatically convert man pages to completion specs
TypeScript
6
star
13

lezer-bash

Lezer grammar for shell scripts
JavaScript
6
star
14

cli-help-parser

Generate completion specs based on --help text
JavaScript
5
star
15

dotfiles

Library of dotfiles used for testing Fig
Shell
5
star
16

vscode-extension

The Visual Studios Code extension used to communicate with the host macOS application.
JavaScript
4
star
17

challenge-ansi-parser

4
star
18

fig-swift-argument-parser

Fig autocomplete generator for swift-argument-parser
Swift
4
star
19

autocomplete-boilerplate

Boilerplate for private CLIs
JavaScript
4
star
20

curl-scraper

A scraper for the curl --help command
Python
3
star
21

swift-api-bindings

Swift bindings for Fig API
Swift
2
star
22

challenge-history-search

Implement fzf-style history search as a Fig app
TypeScript
2
star
23

fig-issues

PLEASE USE withfig/fig to report issues!
2
star
24

aws-cli-plugin

Generate CLI skeleton from the aws CLI's internal representation
Python
2
star
25

.github

.github files that are inherited by all org repos unless specifically included in a repo
2
star
26

oclif-plugin

Generate CLI skeleton from the oclif's internal representation
TypeScript
1
star
27

challenge-support-engineer

1
star
28

fig_kingpin

Generate Fig Spec from Go Kingpin
Go
1
star
29

challenge-fullstack

1
star