# CLI

### Installing the  CLI

Download the precompiled binary for your operating system on the [release page](https://github.com/runvelocity/cli/releases)

### Creating a function

Let's use the CLI to create a function that just returns hello world.  Create a file called `function.js` and input the following code

```javascript
module.exports = (args) => {
    return {
        hello: "world",
    }
}
```

Next, you have to create a zip file containing this code. If you are on windows with poershell, use the following command

```bash
Compress-Archive -LiteralPath .\function.js -DestinationPath  code.zip
```

If you are on Linux/Mac, use the following command

```bash
zip code.zip function.js
```

Next, create a function by running the following command

```bash
.\cli.exe create --name demo-func --file-path code.zip --handler function
```

<figure><img src="/files/3O0yAWLp4xSknatSzfmH" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
NOTE: By default, the CLI attempts to connect to my self-hosted Manager API which is definitely not guaranteed to be available. To pass in your custom Manager URL, use the `--manager-url` flag.
{% endhint %}

### Listing functions

To list all the functions you have deployed, run the following command

```bash
.\cli.exe list
```

<figure><img src="/files/mvRTPOXJqHsLUmigTMe9" alt=""><figcaption></figcaption></figure>

### Invoking a function

To invoke a function, run the following command

```bash
.\cli.exe invoke --name demo-func
```

<figure><img src="/files/35nErsqnnQw97pUozu3C" alt=""><figcaption></figcaption></figure>

### Deleting a function

To delete a function, run the following command

```sh
.\cli.exe delete --name demo-func
```

<figure><img src="/files/myy9c17xwQDTb9JBRgTs" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.runvelocity.dev/components/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
