summaryrefslogtreecommitdiff
path: root/server/continuedev/plugins/steps/draft/redux.py
blob: 83b5e5929c975fdb84dd85b71f09ac39b0404c29 (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
41
42
43
44
45
46
47
48
49
50
from ....core.main import Step
from ....core.sdk import ContinueSDK
from ....core.steps import EditFileStep


class EditReduxStateStep(Step):
    description: str  # e.g. "I want to load data from the weatherapi.com API"

    async def run(self, sdk: ContinueSDK):
        # Find the right file to edit

        # RootStore
        store_filename = ""
        sdk.run_step(
            EditFileStep(
                filename=store_filename,
                prompt=f"Edit the root store to add a new slice for {self.description}",
            )
        )
        store_file_contents = await sdk.ide.readFile(store_filename)

        # Selector
        selector_filename = ""
        sdk.run_step(
            EditFileStep(
                filepath=selector_filename,
                prompt=f"Edit the selector to add a new property for {self.description}. The store looks like this: {store_file_contents}",
            )
        )

        # Reducer
        reducer_filename = ""
        sdk.run_step(
            EditFileStep(
                filepath=reducer_filename,
                prompt=f"Edit the reducer to add a new property for {self.description}. The store looks like this: {store_file_contents}",
            )
        )
        """
        Starts with implementing selector
        1. RootStore
        2. Selector
        3. Reducer or entire slice

        Need to first determine whether this is an:
        1. edit
        2. add new reducer and property in existing slice
        3. add whole new slice
        4. build redux from scratch
        """