diff --git a/.goosehints b/.goosehints index 8b6535a6..bb6acad1 100644 --- a/.goosehints +++ b/.goosehints @@ -1,3 +1,13 @@ This is a python CLI app that uses UV. Read CONTRIBUTING.md for information on how to build and test it as needed. -Some key concepts are that it is run as a command line interface, dependes on the "ai-exchange" package, and has the concept of toolkits which are ways that its behavior can be extended. Look in src/goose and tests. -Once the user has UV installed it should be able to be used effectively along with uvx to run tasks as needed + +Some key concepts are that it is run as a command line interface, dependes on the "ai-exchange" package (which is in packages/exchange in this repo), and has the concept of toolkits which are ways that its behavior can be extended. Look in src/goose and tests. + +Assume the user has UV installed and ensure UV is used to run any python related commands. + +To run tests: + +```sh +uv sync && uv run pytest tests -m 'not integration' +``` + +ideally after each change \ No newline at end of file diff --git a/README.md b/README.md index f1d3cb81..0cbaf35e 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,16 @@ Now you are interacting with Goose in conversational sessions - think of it as l > [!TIP] > You can place a `.goosehints` text file in any directory you launch goose from to give it some background info for new sessions in plain language (eg how to test, what instructions to read to get started or just tell it to read the README!) You can also put a global one `~/.config/goose/.goosehints` if you like for always loaded hints personal to you. +### Running a goose tasks (one off) + +You can run goose to do things just as a one off, such as tidying up, and then exiting: + +```sh +goose run instructions.md +``` + +This will run until completion as best it can. You can also pass `--resume-session` and it will re-use the first session it finds for context + #### Exit the session diff --git a/src/goose/cli/main.py b/src/goose/cli/main.py index fedae331..a7f484d9 100644 --- a/src/goose/cli/main.py +++ b/src/goose/cli/main.py @@ -207,7 +207,8 @@ def session_resume(name: Optional[str], profile: str, log_level: str) -> None: @click.argument("message_file", required=False, type=click.Path(exists=True)) @click.option("--profile") @click.option("--log-level", type=LOG_CHOICE, default="INFO") -def run(message_file: Optional[str], profile: str, log_level: str) -> None: +@click.option("--resume-session", is_flag=True, help="Resume the last session if available") +def run(message_file: Optional[str], profile: str, log_level: str, resume_session: bool = False) -> None: """Run a single-pass session with a message from a markdown input file""" if message_file: with open(message_file, "r") as f: @@ -215,7 +216,13 @@ def run(message_file: Optional[str], profile: str, log_level: str) -> None: else: initial_message = click.get_text_stream("stdin").read() - session = Session(profile=profile, log_level=log_level) + if resume_session: + session_files = get_session_files() + if session_files: + name = list(session_files.keys())[0] + session = Session(name=name, profile=profile, log_level=log_level) + else: + session = Session(profile=profile, log_level=log_level) session.single_pass(initial_message=initial_message)