Creating a Loop

Use Olive's npx command to get started!

npx

First, make sure you have node and npm installed on your computer.

In your terminal, navigate to the directory you want your loop to be in. Then use the following command:

npx @oliveai/create-loop

Enter the name of the project.

Project name

Select the Aptitudes you would like to use.

These selections are not final! These just generate examples, but any aptitude can be imported and used at any time.

And finally, select the language you would like to use. Right now, we support TypeScript and JavaScript.

Select your language

This will create a directory with the name of your project, generate the project files and automatically run npm install

Don't understand aptitude permissions? See our Permissions guide.

Generated Code

The generated project contains a pre-populated package.json to get you started. It also comes with examples of the Aptitudes you selected in the step above. Jest testing has also been included.

Need more examples? Take a look at our GitHub

At this point you're off to the races! 🏇 Explore the example code: once you have a feel for how things work, you are free to delete it.

Sample Project Directory Structure

Hello World

If you wanted to create the Hello World example shown on the Your First Loop page, you would replace the code in the index.js file with:

const { whisper } = require('@oliveai/ldk');
whisper.create({
  label: 'Hello world',
  onClose: () => {},
  components: [
    {
      type: whisper.WhisperComponentType.Message,
      body: "Hello World",
      style: "success",
      textAlign: "center"
    },
  ],
});

This example is far simpler than those provided, but is useful if you're brand new to programming. Feel free to use whatever you're comfortable with while learning the Loop process.

Last updated

Was this helpful?