Cloving Chat Command Documentation

Learn how to use the cloving chat command to have a conversation with the AI and generate code snippets.

Usage

cloving chat [options]

You can also specify files to use as context:

cloving chat -f path/to/file

Description

The cloving chat command starts an interactive chat session with the AI. It uses the AI APIs configured with cloving config as well as the cloving.json file created by cloving init to understand your prompts and generate relevant code, which can then be reviewed, revised, or saved.

Interactive Prompts

The cloving chat command uses the following interactive prompts:

  • Type a freeform request or question: Type a description of the code to be generated or a question to ask the AI.
  • Available special commands:
    • save: Save all the changes from the last response to files.
    • commit: Commit the changes to git with an AI-generated message that you can edit.
    • copy: Copy the last response to clipboard.
    • review: Start a code review.
    • find <file-name>: Find and add files matching the name to the chat context (supports * for glob matching).
    • add <file-path>: Add a file to the chat context (supports * for glob matching).
    • rm <pattern>: Remove files from the chat context (supports * for glob matching).
    • ls <pattern>: List files in the chat context (supports * for glob matching).
    • git <command>: Run a git command.
    • help: Display this help message.
    • exit: Quit this session.

Example Process

Example Chat Session

Here is an example of what a chat session might look like:


$ cloving chat
🍀 🍀 🍀 Welcome to Cloving REPL 🍀 🍀 🍀

Type a freeform request or question to interact with your Cloving AI pair programmer.

Available special commands:
 - save             Save all the changes from the last response to files
 - commit           Commit the changes to git with an AI-generated message that you can edit
 - copy             Copy the last response to clipboard
 - review           Start a code review
 - find  Find and add files matching the name to the chat context (supports * for glob matching)
 - add   Add a file to the chat context (supports * for glob matching)
 - rm      Remove files from the chat context (supports * for glob matching)
 - ls      List files in the chat context (supports * for glob matching)
 - git     Run a git command
 - help             Display this help message
 - exit             Quit this session

What would you like to do?
cloving> 
      

You can then ask the AI to generate code in response to a prompt:

> Generate a function to calculate the factorial of a number
Generated code:

1. **src/factorial.ts**:

```typescript
<<<<<<< CURRENT src factorial.ts=======
function factorial(n: number): number {
  if (n <0) return -1
  else if (n === 0) return 1
  else return n * factorial(n - 1)
}
>>>>>>> NEW
```

You can follow up with another request or:
  - type "save" to save all the changes to files
  - type "commit" to commit the changes to git with a AI - generated message
  - type "copy" to copy the last response to clipboard
  - type "review" to start a code review
  - type "add " to add a file to the chat context
  - type "rm " to remove files from the chat context
  - type "ls " to list files in the chat context
  - type "git " to run a git command
  - type "exit" to quit this session