Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
* origin/main:
  chore: release 0.9.0 (block#58)
  fix: goose should track files it reads and not overwrite changes (block#46)
  docs: Small dev notes for using exchange from source (block#50)
  fix: typo in exchange method `rewind` (block#54)
  fix: remove unsafe pop of messages (block#47)
  chore: Update LICENSE (block#53)
  chore(docs): update is_dangerous_command method description (block#48)
  refactor: improve safety rails speed and prompt (block#45)
  feat: make goosehints jinja templated (block#43)
  ci: enforce PR title follows conventional commit (block#14)
  feat: show available toolkits (block#37)
  adding in ability to provide per repo hints (block#32)
  Apply ruff and add to CI (block#40)
  added some regex based checks for dangerous commands (block#38)
  chore: Update publish github workflow to check package versions before publishing (block#19)

# Conflicts:
#	src/goose/toolkit/developer.py
#	src/goose/utils/check_shell_command.py
#	tests/utils/test_check_shell_command.py
  • Loading branch information
Kvadratni committed Sep 12, 2024
2 parents a5575ed + 0023f3d commit c2c6c60
Show file tree
Hide file tree
Showing 22 changed files with 370 additions and 128 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install UV
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: Source Cargo Environment
run: source $HOME/.cargo/env
- name: Source Cargo Environment
run: source $HOME/.cargo/env

- name: Run tests
run: |
uv run pytest tests -m 'not integration'
- name: Ruff
run: |
uvx ruff check
uvx ruff format --check
- name: Run tests
run: |
uv run pytest tests -m 'not integration'
48 changes: 48 additions & 0 deletions .github/workflows/pull_request_title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: 'Lint PR'

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

permissions:
pull-requests: write

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: false

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://gist.github.com/Zekfad/f51cb06ac76e2457f11c80ed705c95a3#file-conventional-commits-md) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
18 changes: 18 additions & 0 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,26 @@ jobs:
- name: Build with UV
run: uvx --from build pyproject-build --installer uv

- name: Check version
id: check_version
run: |
PACKAGE_NAME=$(grep '^name =' pyproject.toml | sed -E 's/name = "(.*)"/\1/')
TAG_VERSION=$(echo "$GITHUB_REF" | sed -E 's/refs\/tags\/v(.+)/\1/')
CURRENT_VERSION=$(curl -s https://pypi.org/pypi/$PACKAGE_NAME/json | jq -r .info.version)
PROJECT_VERSION=$(grep '^version =' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then
echo "Tag version does not match version in pyproject.toml"
exit 1
fi
if python -c "from packaging.version import parse as parse_version; exit(0 if parse_version('$TAG_VERSION') > parse_version('$CURRENT_VERSION') else 1)"; then
echo "new_version=true" >> $GITHUB_OUTPUT
else
exit 1
fi
- name: Publish
uses: pypa/[email protected]
if: steps.check_version.outputs.new_version == 'true'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN_TEMP }}
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.0] - 2024-09-10

This also updates the minimum version of exchange to 0.9.0.

- fix: goose should track files it reads and not overwrite changes (#46)
- docs: Small dev notes for using exchange from source (#50)
- fix: typo in exchange method rewind (#54)
- fix: remove unsafe pop of messages (#47)
- chore: Update LICENSE (#53)
- chore(docs): update is_dangerous_command method description (#48)
- refactor: improve safety rails speed and prompt (#45)
- feat: make goosehints jinja templated (#43)
- ci: enforce PR title follows conventional commit (#14)
- feat: show available toolkits (#37)
- feat: adding in ability to provide per repo hints (#32)
- chore: apply ruff and add to CI (#40)
- feat: added some regex based checks for dangerous commands (#38)
- chore: Update publish github workflow to check package versions before publishing (#19)
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ to develop a fix, we recommend you open an issue before starting.
We provide a shortcut to standard commands using [just][just] in our `justfile`.

* *goose* uses [uv][uv] for dependency management, and formats with [ruff][ruff] - install UV first: https://pypi.org/project/uv/
* clone both this repository as well as https://github.com/square/exchange next to it.

## Developing and testing

Expand All @@ -30,7 +29,14 @@ just test

will run a fresh goose session (can use the usual goose commands with `uv run` prefixed)

## Running ai-exchange from source

goose depends heavily on the https://github.com/square/exchange project, you can clone that repo and then work on both by running:

```sh
uv add --editable <path/to/cloned/exchange>

then when you run goose with `uv run goose` it will be running it all from source.

## Evaluations

Expand Down Expand Up @@ -124,7 +130,11 @@ And now you can run goose with this new profile to use the new toolkit!
goose session start --profile demo
```

[developer]: src/goose/toolkit/developer.py
## Conventional Commits

This project follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification for PR titles. Conventional Commits make it easier to understand the history of a project and facilitate automation around versioning and changelog generation.

[developer]: src/goose/toolkit/developer.py
[uv]: https://docs.astral.sh/uv/
[ruff]: https://docs.astral.sh/ruff/
[just]: https://github.com/casey/just
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2024 Block, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
46 changes: 32 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ goose
</p>

<p align="center">
<a href="#usage">Usage</a> •
<a href="#usage">Usage</a> •
<a href="#configuration">Configuration</a> •
<a href="#tips">Tips</a> •
<a href="#faq">FAQ</a> •
Expand All @@ -25,7 +25,7 @@ To solve problems, `goose` breaks down instructions into sequences of tasks and


## Usage
### Installation
### Installation

To install `goose`, we recommend `pipx`

Expand All @@ -36,7 +36,7 @@ brew install pipx
pipx ensurepath
```

Then you can install `goose` with
Then you can install `goose` with

```sh
pipx install goose-ai
Expand All @@ -45,7 +45,7 @@ pipx install goose-ai
There is an early version of a VS Code extension with goose support you can try here: https://github.com/square/goose-vscode - more to come soon.

### LLM provider access setup
`goose` works on top of LLMs (you need to bring your own LLM). By default, `goose` uses `openai` as LLM provider. You need to set OPENAI_API_KEY as an environment variable if you would like to use `openai`.
`goose` works on top of LLMs (you need to bring your own LLM). By default, `goose` uses `openai` as LLM provider. You need to set OPENAI_API_KEY as an environment variable if you would like to use `openai`.
```sh
export OPENAI_API_KEY=your_open_api_key
```
Expand Down Expand Up @@ -80,10 +80,10 @@ goose session resume

## Configuration

`goose` can detect what LLM and toolkits it can work with from the configuration file `~/.config/goose/profiles.yaml` automatically.
`goose` can detect what LLM and toolkits it can work with from the configuration file `~/.config/goose/profiles.yaml` automatically.

### Configuration options
Example:
Example:

```yaml
default:
Expand Down Expand Up @@ -124,12 +124,30 @@ Rules designed to control or manage the output of the model. Moderators that cur

#### toolkits

`goose` can be extended with toolkits, and out of the box there are some available:
`goose` can be extended with toolkits, and out of the box there are some available:

* `developer`: for general-purpose development capabilities, including plan management, shell execution, and file operations, with default shell strategies like using ripgrep.
* `screen`: for letting goose take a look at your screen to help debug or work on designs (gives goose eyes)
* `github`: for awareness and suggestions on how to use github
* `repo_context`: for summarizing and understanding a repository you are working in.

#### Configuring goose per repo

If you are using the `developer` toolkit, `goose` adds the content from `.goosehints`
file in working directory to the system prompt of the `developer` toolkit. The hints
file is meant to provide additional context about your project. The context can be
user-specific or at the project level in which case, you
can commit it to git. `.goosehints` file is Jinja templated so you could have something
like this:
```
Here is an overview of how to contribute:
{% include 'CONTRIBUTING.md' %}
The following justfile shows our common commands:
```just
{% include 'justfile' %}
```

### Examples
#### provider as `anthropic`

Expand Down Expand Up @@ -158,33 +176,33 @@ Here are some collected tips we have for working efficiently with `goose`

- **`goose` can and will edit files**. Use a git strategy to avoid losing anything - such as staging your
personal edits and leaving `goose` edits unstaged until reviewed. Or consider using individual commits which can be reverted.
- **`goose` can and will run commands**. You can ask it to check with you first if you are concerned. It will check commands for safety as well.
- **`goose` can and will run commands**. You can ask it to check with you first if you are concerned. It will check commands for safety as well.
- You can interrupt `goose` with `CTRL+C` to correct it or give it more info.
- `goose` works best when solving concrete problems - experiment with how far you need to break that problem
down to get `goose` to solve it. Be specific! E.g. it will likely fail to `"create a banking app"`,
down to get `goose` to solve it. Be specific! E.g. it will likely fail to `"create a banking app"`,
but probably does a good job if prompted with `"create a Fastapi app with an endpoint for deposit and withdrawal
and with account balances stored in mysql keyed by id"`
- If `goose` doesn't have enough context to start with, it might go down the wrong direction. Tell it
to read files that you are referring to or search for objects in code. Even better, ask it to summarize
them for you, which will help it set up its own next steps.
- Refer to any objects in files with something that is easy to search for, such as `"the MyExample class"
- `goose` *loves* to know how to run tests to get a feedback loop going, just like you do. If you tell it how you test things locally and quickly, it can make use of that when working on your project
- You can use `goose` for tasks that would require scripting at times, even looking at your screen and correcting designs/helping you fix bugs, try asking it to help you in a way you would ask a person.
- You can use `goose` for tasks that would require scripting at times, even looking at your screen and correcting designs/helping you fix bugs, try asking it to help you in a way you would ask a person.
- `goose` will make mistakes, and go in the wrong direction from times, feel free to correct it, or start again.
- You can tell `goose` to run things for you continuously (and it will iterate, try, retry) but you can also tell it to check with you before doing things (and then later on tell it to go off on its own and do its best to solve).
- `goose` can run anywhere, doesn't have to be in a repo, just ask it!


### Examples

Here are some examples that have been used:
Here are some examples that have been used:

```
G❯ Looking at the in progress changes in this repo, help me finish off the feature. CONTRIBUTING.md shows how to run the tests.
```

```
G❯ In this golang project, I want you to add open telemetry to help me get started with it. Look in the moneymovements module, run the `just test` command to check things work.
G❯ In this golang project, I want you to add open telemetry to help me get started with it. Look in the moneymovements module, run the `just test` command to check things work.
```
```
Expand All @@ -196,7 +214,7 @@ G❯ This is a fresh checkout of a golang project. I do not have my golang envir
```
```
G❯ In this repo, I want you to look at how to add a new provider for azure.
G❯ In this repo, I want you to look at how to add a new provider for azure.
Some hints are in this github issue: https://github.com/square/exchange/issues
/4 (you can use gh cli to access it).
```
Expand All @@ -213,7 +231,7 @@ G❯ I want you to help me increase the test coverage in src/java... use mvn tes
## Open Source
Yes, `goose` is open source and always will be. `goose` is released under the ASL2.0 license meaning you can use it however you like.
Yes, `goose` is open source and always will be. `goose` is released under the ASL2.0 license meaning you can use it however you like.
See LICENSE.md for more details.
To run `goose` from source, please see `CONTRIBUTING.md` for instructions on how to set up your environment and you can then run `uv run `goose` session start`.
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ integration *FLAGS:
uv run pytest tests -m integration {{FLAGS}}

format:
ruff check . --fix
ruff format .
uvx ruff check . --fix
uvx ruff format .

coverage *FLAGS:
uv run coverage run -m pytest tests -m "not integration" {{FLAGS}}
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[project]
name = "goose-ai"
description = "a programming agent that runs on your machine"
version = "0.8.6"
version = "0.9.0"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"attrs>=23.2.0",
"rich>=13.7.1",
"ruamel-yaml>=0.18.6",
"ai-exchange>=0.8.4",
"ai-exchange>=0.9.0",
"click>=8.1.7",
"prompt-toolkit>=3.0.47",
]
Expand Down
Loading

0 comments on commit c2c6c60

Please sign in to comment.