summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--continuedev/src/continuedev/core/policy.py5
-rw-r--r--continuedev/src/continuedev/recipes/WritePytestsRecipe/main.py18
-rw-r--r--continuedev/src/continuedev/steps/comment_code.py12
-rw-r--r--continuedev/src/continuedev/steps/main.py1
-rw-r--r--extension/package-lock.json4
-rw-r--r--extension/package.json4
-rw-r--r--extension/react-app/src/components/VSCodeFileLink.tsx4
-rw-r--r--extension/react-app/src/tabs/chat/MessageDiv.tsx2
-rw-r--r--extension/scripts/continuedev-0.1.1-py3-none-any.whlbin0 -> 56962 bytes
9 files changed, 37 insertions, 13 deletions
diff --git a/continuedev/src/continuedev/core/policy.py b/continuedev/src/continuedev/core/policy.py
index f7fcf21a..dc71cfa9 100644
--- a/continuedev/src/continuedev/core/policy.py
+++ b/continuedev/src/continuedev/core/policy.py
@@ -8,6 +8,7 @@ from ..steps.main import EditHighlightedCodeStep, SolveTracebackStep, RunCodeSte
from ..recipes.WritePytestsRecipe.main import WritePytestsRecipe
# from ..libs.steps.chroma import AnswerQuestionChroma, EditFileChroma
from ..recipes.ContinueRecipeRecipe.main import ContinueStepStep
+from ..steps.comment_code import CommentCodeStep
class DemoPolicy(Policy):
@@ -21,10 +22,12 @@ class DemoPolicy(Policy):
observation = history.get_current().observation
if observation is not None and isinstance(observation, UserInputObservation):
# This could be defined with ObservationTypePolicy. Ergonomics not right though.
- if " test" in observation.user_input.lower():
+ if "/pytest" in observation.user_input.lower():
return WritePytestsRecipe(instructions=observation.user_input)
elif "/dlt" in observation.user_input.lower() or " dlt" in observation.user_input.lower():
return CreatePipelineRecipe()
+ elif "/comment" in observation.user_input.lower():
+ return CommentCodeStep()
# elif "/ask" in observation.user_input:
# return AnswerQuestionChroma(question=" ".join(observation.user_input.split(" ")[1:]))
# elif "/edit" in observation.user_input:
diff --git a/continuedev/src/continuedev/recipes/WritePytestsRecipe/main.py b/continuedev/src/continuedev/recipes/WritePytestsRecipe/main.py
index a35055f3..82876a08 100644
--- a/continuedev/src/continuedev/recipes/WritePytestsRecipe/main.py
+++ b/continuedev/src/continuedev/recipes/WritePytestsRecipe/main.py
@@ -1,14 +1,20 @@
from textwrap import dedent
+from typing import Union
from ...models.filesystem_edit import AddDirectory, AddFile
from ...core.main import Step, ContinueSDK
import os
class WritePytestsRecipe(Step):
- for_filepath: str
+ for_filepath: Union[str, None] = None
+ instructions: str = "Write unit tests for this file."
async def run(self, sdk: ContinueSDK):
- filename, dirname = os.path.split(self.for_filepath)
+ if self.for_filepath is None:
+ self.for_filepath = (await sdk.ide.getOpenFiles())[0]
+
+ filename = os.path.basename(self.for_filepath)
+ dirname = os.path.dirname(self.for_filepath)
path_dir = os.path.join(dirname, "tests")
if not os.path.exists(path_dir):
@@ -16,7 +22,7 @@ class WritePytestsRecipe(Step):
path = os.path.join(path_dir, f"test_{filename}")
if os.path.exists(path):
- return
+ return None
for_file_contents = await sdk.ide.readFile(self.for_filepath)
@@ -31,7 +37,9 @@ class WritePytestsRecipe(Step):
"{self.instructions}"
- Here is a complete set of pytest unit tests:
- """)
+ Here is a complete set of pytest unit tests:""")
tests = (await sdk.models.gpt35()).complete(prompt)
+
await sdk.apply_filesystem_edit(AddFile(filepath=path, content=tests))
+
+ return None
diff --git a/continuedev/src/continuedev/steps/comment_code.py b/continuedev/src/continuedev/steps/comment_code.py
new file mode 100644
index 00000000..c538347b
--- /dev/null
+++ b/continuedev/src/continuedev/steps/comment_code.py
@@ -0,0 +1,12 @@
+from ..core.main import ContinueSDK, Models, Step
+from .main import StarCoderEditHighlightedCodeStep
+
+
+class CommentCodeStep(Step):
+ hide: bool = True
+
+ async def describe(self, models: Models):
+ return "Writing comments"
+
+ async def run(self, sdk: ContinueSDK):
+ await sdk.run_step(StarCoderEditHighlightedCodeStep(user_input="Wrote comprehensive comments in the canonical format for every class and function"))
diff --git a/continuedev/src/continuedev/steps/main.py b/continuedev/src/continuedev/steps/main.py
index 8588ec92..a0872564 100644
--- a/continuedev/src/continuedev/steps/main.py
+++ b/continuedev/src/continuedev/steps/main.py
@@ -215,6 +215,7 @@ class FasterEditHighlightedCodeStep(Step):
class StarCoderEditHighlightedCodeStep(Step):
user_input: str
+ name: str = "Editing code"
hide = False
_prompt: str = "<commit_before>{code}<commit_msg>{user_request}<commit_after>"
diff --git a/extension/package-lock.json b/extension/package-lock.json
index 15ea6428..2db9cac5 100644
--- a/extension/package-lock.json
+++ b/extension/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "continue",
- "version": "0.0.14",
+ "version": "0.0.16",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
- "version": "0.0.14",
+ "version": "0.0.16",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",
diff --git a/extension/package.json b/extension/package.json
index 2d83a58c..13086954 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -14,7 +14,7 @@
"displayName": "Continue",
"pricing": "Free",
"description": "Refine code 10x faster",
- "version": "0.0.14",
+ "version": "0.0.16",
"publisher": "Continue",
"engines": {
"vscode": "^1.74.0"
@@ -161,7 +161,7 @@
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js",
"package": "cp ./config/prod_config.json ./config/config.json && mkdir -p ./build && vsce package --out ./build && cp ./config/dev_config.json ./config/config.json",
- "full-package": "cd ../continuedev && poetry build && cp ./dist/continuedev-0.1.0-py3-none-any.whl ../extension/scripts/continuedev-0.1.0-py3-none-any.whl && cd ../extension && npm run typegen && npm run clientgen && cd react-app && npm run build && cd .. && npm run package",
+ "full-package": "cd ../continuedev && poetry build && cp ./dist/continuedev-0.1.1-py3-none-any.whl ../extension/scripts/continuedev-0.1.1-py3-none-any.whl && cd ../extension && npm run typegen && npm run clientgen && cd react-app && npm run build && cd .. && npm run package",
"install-extension": "code --install-extension ./build/continue-0.0.8.vsix",
"uninstall": "code --uninstall-extension .continue",
"reinstall": "rm -rf ./build && npm run package && npm run uninstall && npm run install-extension"
diff --git a/extension/react-app/src/components/VSCodeFileLink.tsx b/extension/react-app/src/components/VSCodeFileLink.tsx
index 12ce5af8..6219654d 100644
--- a/extension/react-app/src/components/VSCodeFileLink.tsx
+++ b/extension/react-app/src/components/VSCodeFileLink.tsx
@@ -1,7 +1,7 @@
import React from "react";
import { postVscMessage } from "../vscode";
-function VS CodeFileLink(props: { path: string; text?: string }) {
+function VSCodeFileLink(props: { path: string; text?: string }) {
return (
<a
href={`file://${props.path}`}
@@ -14,4 +14,4 @@ function VS CodeFileLink(props: { path: string; text?: string }) {
);
}
-export default VS CodeFileLink;
+export default VSCodeFileLink;
diff --git a/extension/react-app/src/tabs/chat/MessageDiv.tsx b/extension/react-app/src/tabs/chat/MessageDiv.tsx
index 9bdd8638..ad81f5e9 100644
--- a/extension/react-app/src/tabs/chat/MessageDiv.tsx
+++ b/extension/react-app/src/tabs/chat/MessageDiv.tsx
@@ -6,7 +6,7 @@ import {
defaultBorderRadius,
secondaryDark,
} from "../../components";
-import VS CodeFileLink from "../../components/VS CodeFileLink";
+import VSCodeFileLink from "../../components/VSCodeFileLink";
import ReactMarkdown from "react-markdown";
import "../../highlight/dark.min.css";
import hljs from "highlight.js";
diff --git a/extension/scripts/continuedev-0.1.1-py3-none-any.whl b/extension/scripts/continuedev-0.1.1-py3-none-any.whl
new file mode 100644
index 00000000..663eb14a
--- /dev/null
+++ b/extension/scripts/continuedev-0.1.1-py3-none-any.whl
Binary files differ