From 33b3bbed4c848927919a845bda06bc3b775453ed Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Sun, 18 Jun 2023 13:19:51 -0700 Subject: docs and welcome step --- continuedev/src/continuedev/core/policy.py | 6 +++++- continuedev/src/continuedev/steps/welcome.py | 30 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 continuedev/src/continuedev/steps/welcome.py (limited to 'continuedev') diff --git a/continuedev/src/continuedev/core/policy.py b/continuedev/src/continuedev/core/policy.py index 1b53834b..fb13dd27 100644 --- a/continuedev/src/continuedev/core/policy.py +++ b/continuedev/src/continuedev/core/policy.py @@ -1,5 +1,7 @@ +from textwrap import dedent from typing import List, Tuple, Type +from ..steps.welcome import WelcomeStep from .config import ContinueConfig from ..steps.chroma import AnswerQuestionChroma, EditFileChroma, CreateCodebaseIndexChroma from ..steps.steps_on_startup import StepsOnStartupStep @@ -26,7 +28,9 @@ class DemoPolicy(Policy): # At the very start, run initial Steps spcecified in the config if history.get_current() is None: return ( - MessageStep(name="Welcome to Continue!", message="Type '/' to see the list of available slash commands. If you highlight code, edits and explanations will be localized to the highlighted range. Otherwise, the currently open file is used. In both cases, the code is combined with the previous steps to construct the context.") >> + MessageStep(name="Welcome to Continue!", message=dedent("""\ + Type '/' to see the list of available slash commands. If you highlight code, edits and explanations will be localized to the highlighted range. Otherwise, the currently open file is used. In both cases, the code is combined with the previous steps to construct the context.""")) >> + WelcomeStep() >> # SetupContinueWorkspaceStep() >> # CreateCodebaseIndexChroma() >> StepsOnStartupStep()) diff --git a/continuedev/src/continuedev/steps/welcome.py b/continuedev/src/continuedev/steps/welcome.py new file mode 100644 index 00000000..fd9e9f65 --- /dev/null +++ b/continuedev/src/continuedev/steps/welcome.py @@ -0,0 +1,30 @@ +from textwrap import dedent +from ..models.filesystem_edit import AddFile +from ..core.main import Step +from ..core.sdk import ContinueSDK, Models +import os + + +class WelcomeStep(Step): + name: str = "Welcome to Continue!" + hide: bool = True + + async def describe(self, models: Models): + return "Welcome to Continue!" + + async def run(self, sdk: ContinueSDK): + continue_dir = os.path.expanduser("~/.continue") + filepath = os.path.join(continue_dir, "calculator.py") + if os.path.exists(filepath): + return + if not os.path.exists(continue_dir): + os.mkdir(continue_dir) + + await sdk.ide.applyFileSystemEdit(AddFile(filepath=filepath, content=dedent("""\ + \"\"\" + Welcome to Continue! To get acquainted, delete this comment and try to use Continue for the following: + - "Write me a calculator class" + - Ask for a new method, maybe "exp" or "mod" or sqrt" + - Type /comment to write comments for the entire class + - Ask about how the class works, how to write it in another language, or anything else you can think of + \"\"\""""))) -- cgit v1.2.3-70-g09d2