Adding Optic to your Projects

You can add Optic to any repository by including an optic.yml file in its the root directory. This config file specifies which Optic Skills to use when working with your project. Each skill determines how Optic reads and writes a certain type of code.

Here's an example optic.yml file:

name: My Project            # Used when referencing code from another project
parsers:                    # A list of language parsers to include
  - es7

skills:                     # A list of the skills to include
  - optic:express-js@0.1.0
  - optic:rest@0.1.0
  - optic:mongoose@0.1.0

exclude:                    # (optional) list of directories Optic should not index
  - vendor/


Using the CLI to add Optic to an Existing Project

To add Optic to an existing project run: optic init

optic init
? Project Name: Test Project
Project file created: /Users/aidancunniffe/Desktop/test-project/optic.yml

You can use the --presets flag to include popular skills in your new project file.

optic init --presets express rest

Running Optic & Next Steps

Optic must be started from the root directory of an Optic project or one of its decedents. Once you've navigated to a valid working directory you can: