Skip to content

Tasks like Churros! Churrera is a CLI tool designed to orchestrate Cursor Cloud Agents REST API in an easy way.

License

Notifications You must be signed in to change notification settings

jabrena/churrera-cli

Repository files navigation

Churrera

CI Builds

SonarQube Cloud

Goal

Churrera is a CLI tool designed to orchestrate Cursor Cloud Agents REST API in an easy way.

What is Cursor Cloud Agents REST API?

Cursor Cloud Agents REST API (Beta) allows you to programmatically create and manage AI-powered coding agents that work autonomously on your repositories.

OpenAPI: https://editor-next.swagger.io/?url=https://cursor.com/docs-static/cloud-agents-openapi.yaml

How does it work?

Churrera CLI processes a PML-Workflow file which defines a Job to be processed and it is composed of one or more Prompts which are executed by a Frontier model.

Agentic patterns

Sequence

<?xml version="1.0" encoding="UTF-8"?>
<pml-workflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.3.0/pml-workflow.xsd">

    <sequence
        model="default" repository="https://github.com/jabrena/churrera-cli"
        timeout="30m" fallback-src="999-fallback.xml">

        <prompt src="1-pml-java25-installation.xml" />
        <prompt src="2-pml-jbang-sonar-search-cli-installation.xml" />
        <prompt src="3-pml-fix-sonar-issues.xml" />
    </sequence>
</pml-workflow>

Parallel

<?xml version="1.0" encoding="UTF-8"?>
<pml-workflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.3.0/pml-workflow.xsd">
    <parallel src="euler-problem-extractor-prompt.xml" bindResultType="List_Integer">
        <sequence model="default" repository="https://github.com/jabrena/wjax25-demos">
            <prompt src="euler-problem-solver-prompt.xml" bindResultExp="$get()"/>
        </sequence>
    </parallel>
</pml-workflow>

Churrera recipes

Examples using Churrera with PML-Workflow:

Limitations

Currently, the solution has the following limitations

  • Limited Java types to be desearialized data from prompts.
  • No capacity to pass parameters from Pipelines to prompts.
  • No Directed graph support for complex workflow
  • Not released in Maven Central

Getting started

1. Generate a CURSOR_API_KEY

Visit Integrations in Cursor to generate a new CURSOR_API_KEY and click the button New User API Key to generate it:

Type the name that you want and click the Save button to generate the new CURSOR_API_KEY:

Then a popup window will appear with the CURSOR_API_KEY created:

2. Store or put visible CURSOR_API_KEY to be used by Churrera

With the new CURSOR_API_KEY created, you could add it into the .env file with the following format:

CURSOR_API_KEY=key_xxx

Note: Remember to add the file .env inside of a .cursorignore file. Further information about it here.

On the other hand, you could use that CURSOR_API_KEY and export it as an environment variable in your system:

export CURSOR_API_KEY=key_xxx

Note: Churrera reads CURSOR_API_KEY values from a .env file stored in the same path where you run Churrera or define an environment variable in your terminal.

3. Give Cursor permissions to interact with Github

Configure Github to allow Cursor to interact with the repository that you want Cursor Cloud Agents to interact with, so visit Integrations and click the button Manage in the Github area.

Once you are in Github, you will have to select which Github User you are going to give permissions to and click the Configure link:

Once you have installed Cursor in your Github User, you will need to define which repositories you will give permissions to:

You will indicate in the attribute repository the repository that you defined before in the pml-workflow file.

4. Running your first PML Workflow

1. Define a pml-workflow file:

<?xml version="1.0" encoding="UTF-8"?>
<pml-workflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.3.0/pml-workflow.xsd">
    <sequence model="default" repository="https://github.com/jabrena/wjax25-demos">
        <prompt src="pml-hello-world-bash.xml" />
    </sequence>
</pml-workflow>

2. Define a PML prompt file:

<?xml version="1.0" encoding="UTF-8"?>
<prompt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="https://jabrena.github.io/pml/schemas/0.3.0/pml.xsd">
    <goal>
        Print "Hello World" in the console using a echo command
    </goal>
</prompt>

Further information about PML here.

3. Launch the tool:

Build & run Churrera:

#JBang
sdk install jbang

jbang trust add https://github.com/jabrena/
jbang cache clear
jbang catalog list jabrena

# Single execution (Designed for Pipelines)
jbang churrera@jabrena run \
--workflow churrera-cli/src/test/resources/examples/hello-world-bash/workflow-hello-world.xml --delete-on-success-completion
jbang churrera@jabrena run --workflow churrera-cli/src/test/resources/examples/hello-world/workflow-hello-world.xml --show-logs --delete-on-success-completion
jbang churrera@jabrena run --retrieve-models
jbang churrera@jabrena run --retrieve-repositories

Using the tool

#JBang
sdk install jbang

jbang trust list
jbang trust add https://github.com/jabrena/
jbang cache clear
jbang catalog list jabrena

jbang churrera@jabrena --help
# Single execution (Designed for Pipelines)
jbang churrera@jabrena run --help
jbang churrera@jabrena run --workflow churrera-cli/src/test/resources/examples/hello-world-bash/workflow-hello-world.xml
jbang churrera@jabrena run --workflow churrera-cli/src/test/resources/examples/hello-world/workflow-hello-world.xml --show-logs
jbang churrera@jabrena run --workflow churrera-cli/src/test/resources/examples/euler-problems/workflow-euler.xml

Build in local

./mvnw clean package -DskipTests
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --help
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --workflow churrera-cli/src/test/resources/examples/hello-world-bash/workflow-hello-world.xml --delete-on-success-completion --polling-interval 10
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --workflow churrera-cli/src/test/resources/examples/hello-world-bash/workflow-hello-world.xml --delete-on-completion
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --workflow churrera-cli/src/test/resources/examples/hello-world/workflow-hello-world.xml --delete-on-success-completion --show-logs
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --workflow churrera-cli/src/test/resources/examples/euler-problems/workflow-euler.xml --delete-on-success-completion --polling-interval 10 --show-logs
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --retrieve-models
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --retrieve-repositories
java -jar churrera-cli/target/churrera-cli-0.3.0-SNAPSHOT.jar run --workflow churrera-cli/src/test/resources/examples/failed-job/workflow.xml --delete-on-completion --show-logs

Changelog

References

Cursor rules ecosystem

Powered by Cursor with ❤️ from Madrid

About

Tasks like Churros! Churrera is a CLI tool designed to orchestrate Cursor Cloud Agents REST API in an easy way.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •