diff options
| author | Nate Sesti <sestinj@gmail.com> | 2023-06-03 10:26:07 -0400 | 
|---|---|---|
| committer | Nate Sesti <sestinj@gmail.com> | 2023-06-03 10:26:07 -0400 | 
| commit | 917ba983d604bf9f590265b38e65be5c75643828 (patch) | |
| tree | 40ecae6ae6fb20dc7d8c4db391335d543b4713c3 /continuedev | |
| parent | 08eacb7914b392d85ffcfe5b80ee31e3d36c77bc (diff) | |
| download | sncontinue-917ba983d604bf9f590265b38e65be5c75643828.tar.gz sncontinue-917ba983d604bf9f590265b38e65be5c75643828.tar.bz2 sncontinue-917ba983d604bf9f590265b38e65be5c75643828.zip | |
README work
Diffstat (limited to 'continuedev')
| -rw-r--r-- | continuedev/src/continuedev/recipes/README.md | 8 | ||||
| -rw-r--r-- | continuedev/src/continuedev/steps/draft/migration.py | 11 | ||||
| -rw-r--r-- | continuedev/src/continuedev/steps/main.py | 25 | 
3 files changed, 16 insertions, 28 deletions
| diff --git a/continuedev/src/continuedev/recipes/README.md b/continuedev/src/continuedev/recipes/README.md index 5e01cc97..d5a006fb 100644 --- a/continuedev/src/continuedev/recipes/README.md +++ b/continuedev/src/continuedev/recipes/README.md @@ -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. diff --git a/continuedev/src/continuedev/steps/draft/migration.py b/continuedev/src/continuedev/steps/draft/migration.py index ea538bb7..b386bed8 100644 --- a/continuedev/src/continuedev/steps/draft/migration.py +++ b/continuedev/src/continuedev/steps/draft/migration.py @@ -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", +        ]) diff --git a/continuedev/src/continuedev/steps/main.py b/continuedev/src/continuedev/steps/main.py index a0872564..bb720b20 100644 --- a/continuedev/src/continuedev/steps/main.py +++ b/continuedev/src/continuedev/steps/main.py @@ -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 | 
