summaryrefslogtreecommitdiff
path: root/server/continuedev/plugins/steps/welcome.py
blob: ef1acfc12e5c856f0adb23a93d7b21b405afee3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
from textwrap import dedent

from ...core.main import Step
from ...core.sdk import ContinueSDK, Models
from ...models.filesystem_edit import AddFile


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 learn how to use it, delete this comment and try to use Continue for the following:
            - "Write me a calculator class"
            - Ask for a new method (e.g. "exp", "mod", "sqrt")
            - Type /comment to write comments for the entire class
            - Ask about how the class works, how to write it in another language, etc.
            \"\"\""""
                ),
            )
        )

        # await sdk.ide.setFileOpen(filepath=filepath)