Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support markdown plans #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: support markdown plans #79

wants to merge 1 commit into from

Conversation

elenazherdeva
Copy link
Collaborator

@elenazherdeva elenazherdeva commented Sep 19, 2024

Supported Markdown plans, made them Jinja-templated, and allowed passing parameters.

The plan.md file can be in a free format, but the last group of lines that start with “-” is considered the plan.

Some examples:

Example 1:

# plan.md

Here is the python repo

-use {{ dep }}
-use poetry

Here is a plan:

- Open a file
- Run a test
- Setup {{ repo }}

the plan is:

- Open a file
- Run a test
- Setup {{ repo }}

Example 2:

Here is the python repo.

You should follow these steps:

- Open a file
- Run a test
- Setup {{ repo }}

the plan is:

- Open a file
- Run a test
- Setup {{ repo }}

To start a session with a plan:

goose session planned plan.md -p param1:value1 param2:value2

@elenazherdeva
Copy link
Collaborator Author

should we get rid of plan.yaml in the goose session start command?



def test_parse_plan_simple():
plan_str = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: is this our recommended style for multiline strings? what are the trade offs for this over triple-quoted multiline strings or even keeping the markdown as a fixture?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be honest, I did it to pass the ruff checks. Not sure if we've discussed it before

Copy link
Collaborator

@michaelneale michaelneale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this myself - but would want to see others sure as it kind of is a UX/api change (not that plans are well known). I guess main benefit of yaml is if you had a tool emitting it etc for goose to consume

@lily-de
Copy link
Collaborator

lily-de commented Sep 19, 2024

do we have to use - or will it also pick up * ? because i tend to use * and I think we should be very explicit to users writing their own plans if a certain formatting is needed. We should also add a page in the docs for custom plans -- I don't think I added one

@elenazherdeva
Copy link
Collaborator Author

yes @lily-de I agree, we should mention it in the docs somehow, because now only the last group of lines that start with “-” is considered the plan

Copy link
Collaborator

@lukealvoeiro lukealvoeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Some small nits, nothing blocking

Comment on lines +93 to +94
@click.option("--plan", type=click.Path(exists=True))
@click.option("-p", "--params", callback=parse_params, help="Parameters in the format param1:value1,param2:value2")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can see -p being confusing for plan and params... maybe -a/--args instead? up to you tho!

"-Run a test\n\n"
"Now actually follow the steps:"
),
"tasks": ["-Step1", "-Step2"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit/maybe not even applicable]should we be stripping - from the tasks? Just wondering because if someone happens to type in a plan:

-1:do this 
-2:do that

then that could be inferred as negative numbers which maybe would change the order of events?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants