README work
This commit is contained in:
parent
225d493e41
commit
fe22fcefa3
5 changed files with 44 additions and 31 deletions
|
|
@ -7,3 +7,11 @@ The `recipes` folder contains all recipes, each with the same structure. **If yo
|
|||
1. Create a new subfolder in `recipes`, with the name of your recipe (for example `MyNewRecipe`).
|
||||
2. Make 2 files in this folder: 1) a `README.md` describing your recipe and how to use it and 2) a `main.py` including a single class with the name of your recipe (e.g. `MyNewRecipe`).
|
||||
3. Write any utility code other than the main recipe class in a separate file, which you can import in `main.py`. Particularly if you decide to break the recipe into multiple sub-steps, try to keep these separate.
|
||||
|
||||
# Existing Recipes
|
||||
|
||||
`ContinueRecipeRecipe` - Write a Continue recipe with Continue.
|
||||
|
||||
`CreatePipelineRecipe` - Build a dlt pipeline from scratch for an API of your choice.
|
||||
|
||||
`WritePytestsRecipe` - Write Pytest unit tests in a folder adjacent to your Python file.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# When an edit is made to an existing class or a new sqlalchemy class is created,
|
||||
# this should be kicked off.
|
||||
|
||||
from ..main import EditCodeStep, RunCommandStep
|
||||
from ...core.main import Step
|
||||
|
||||
|
||||
|
|
@ -15,11 +14,17 @@ class MigrationStep(Step):
|
|||
recent_edits_string = "\n\n".join(
|
||||
map(lambda x: x.to_string(), recent_edits))
|
||||
description = await (await sdk.models.gpt35()).complete(f"{recent_edits_string}\n\nGenerate a short description of the migration made in the above changes:\n")
|
||||
await sdk.run_step(RunCommandStep(cmd=f"cd libs && poetry run alembic revision --autogenerate -m {description}"))
|
||||
await sdk.run([
|
||||
"cd libs",
|
||||
"poetry run alembic revision --autogenerate -m " + description,
|
||||
])
|
||||
migration_file = f"libs/alembic/versions/{?}.py"
|
||||
contents = await sdk.ide.readFile(migration_file)
|
||||
await sdk.run_step(EditCodeStep(
|
||||
range_in_files=[RangeInFile.from_entire_file(migration_file, contents)],
|
||||
prompt=f"Here are the changes made to the sqlalchemy classes:\n\n{recent_edits_string}\n\nThis is the generated migration file:\n\n{{code}}\n\nReview the migration file to make sure it correctly reflects the changes made to the sqlalchemy classes.",
|
||||
))
|
||||
await sdk.run_step(RunCommandStep(cmd="cd libs && poetry run alembic upgrade head"))
|
||||
await sdk.run([
|
||||
"cd libs",
|
||||
"poetry run alembic upgrade head",
|
||||
])
|
||||
|
|
|
|||
|
|
@ -54,31 +54,6 @@ class RunPolicyUntilDoneStep(Step):
|
|||
return observation
|
||||
|
||||
|
||||
class RunCommandStep(Step):
|
||||
cmd: str
|
||||
name: str = "Run command"
|
||||
_description: str = None
|
||||
|
||||
async def describe(self, models: Models) -> Coroutine[str, None, None]:
|
||||
if self._description is not None:
|
||||
return self._description
|
||||
return self.cmd
|
||||
|
||||
async def run(self, sdk: ContinueSDK) -> Coroutine[Observation, None, None]:
|
||||
cwd = await sdk.ide.getWorkspaceDirectory()
|
||||
result = subprocess.run(
|
||||
self.cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)
|
||||
stdout = result.stdout.decode("utf-8")
|
||||
stderr = result.stderr.decode("utf-8")
|
||||
print(stdout, stderr)
|
||||
|
||||
# If it fails, return the error
|
||||
if result.returncode != 0:
|
||||
return TextObservation(text=stderr)
|
||||
else:
|
||||
return TextObservation(text=stdout)
|
||||
|
||||
|
||||
class FasterEditHighlightedCodeStep(Step):
|
||||
user_input: str
|
||||
hide = True
|
||||
|
|
|
|||
|
|
@ -40,12 +40,14 @@ the code that should run when the step is rerun with feedback
|
|||
|
||||
### Core
|
||||
|
||||
#### RunCommandStep
|
||||
|
||||
#### EditCodeStep
|
||||
|
||||
Provide a prompt and a list of file ranges to be edited by a language model.
|
||||
|
||||
### ManualEditStep
|
||||
|
||||
A core step that tracks all user edits in the IDE so that they can be reversed along with other steps
|
||||
|
||||
## Community
|
||||
|
||||
### CreateTableStep
|
||||
|
|
@ -67,3 +69,7 @@ Write unit tests for this file.
|
|||
#### Parameters
|
||||
|
||||
- for_filepath (required): the path of the file that unit tests should be created for
|
||||
|
||||
### AnswerQuestionChromaStep
|
||||
|
||||
Type `/ask` and ask any question about your whole codebase. The Chroma embeddings store will help find important snippets and answer your question.
|
||||
|
|
|
|||
|
|
@ -2,4 +2,23 @@
|
|||
|
||||
**[Continue](https://continue.dev/docs) is the open-source library for accelerating software development with language models**
|
||||
|
||||
You can find the Continue GitHub repo [here](https://github.com/continuedev/continue)
|
||||
The Continue VS Code extension lets you make edits with natural langauge, ask questions of your codebase, automatically generate unit tests, and more. Beyond the built-in functionality, you can easily write your own recipes to automate the most repetitive sequences of tasks in your workflow.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Get started by opening the command pallet with cmd+shift+p and then selecting Continue: Open Debug Panel.
|
||||
|
||||
To test a few common recipes, open a blank python file and try the following:
|
||||
|
||||
- Ask it to "write me a calculator class in python"
|
||||
- /comment to write comments for the class
|
||||
- /pytest to write Pytest unit tests in a separate file
|
||||
- Ask in natural language for a new method
|
||||
|
||||
See [here](https://continue.dev/docs/concepts/recipe) for the full list of recipes currently available to use.
|
||||
|
||||
You can find the Continue GitHub repo [here](https://github.com/continuedev/continue)
|
||||
|
||||
## Feedback
|
||||
|
||||
Have thoughts about Continue? Please [leave an issue](https://github.com/continuedev/continue/issues/new) or email us at hi@continue.dev :)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue