Skip to content

Sandbox Config Tool v1

Latest
Compare
Choose a tag to compare
@kevinlu1248 kevinlu1248 released this 11 Sep 03:51
· 5426 commits to main since this release

sweep-sandbox is a CLI tool that tests your sweep.yaml configuration, making the sandbox config setup process easier.

Sweep Sandbox is our execution environment that checks against static code analysis tools like formatters, linters, type-checkers and tests after every file edit, ensuring pristine generated code.

Getting Started

Start by running the following installation script in the background while setting up the rest of the sandbox configs. This should take a couple minutes.

curl https://raw.githubusercontent.com/sweepai/sweep/main/bin/install_sweep_sandbox.sh | sh

Config setup

To get started, go to your local clone of your repo. Then, create your sweep.yaml if it doesn't already exist with touch sweep.yaml then set up the sandbox section of your sweep.yaml.

For example, for Sweep, which is Python-based, we have the following sandbox config:

sandbox:
  install:
    - apt install python3.11 -y
    - pip install poetry
    - poetry env use python3.11
    - poetry install
  check: 
    - poetry run pylint --errors-only {file_path}

And for our landing page, which is Typescript-based, we have the following config

sandbox:
  install:
    - yarn install --ignore-engines
  check:
    - yarn run prettier --write {file_path}
    - yarn run eslint {file_path}
    - yarn run tsc

By default, we use the following config that runs Trunk, an opinionated super-linter that installs all the common formatters and linters for your codebase. You can set up and configure Trunk for yourself by following https://docs.trunk.io/get-started.

sandbox:
  install:
    - trunk init
  check:
    - trunk fmt {file_path}
    - trunk check {file_path}

We recommend starting with the formatters, followed by the linters and type-checkers.

Testing

Ensure that sweep-sandbox is installed properly by running it. Then execute the following in the base of your repo in the following format:

sweep-sandbox {file_path}

For example in the Sweep repo, we run sweep-sandbox sweepai to test it on the entire sweepai directory and sweep-sandbox sweepai/api.py to check the single file api.py.