summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/main.yaml44
-rw-r--r--continuedev/src/continuedev/core/sdk.py2
-rw-r--r--continuedev/src/continuedev/steps/chat.py10
-rw-r--r--extension/workflows/main.yml30
4 files changed, 49 insertions, 37 deletions
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
new file mode 100644
index 00000000..467277e4
--- /dev/null
+++ b/.github/workflows/main.yaml
@@ -0,0 +1,44 @@
+name: Publish Extension
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: "14"
+
+ - name: Install Dependencies
+ run: npm install
+
+ - name: Build and Publish
+ run: |
+ cd extension
+ npm run full-package
+
+ - name: Commit changes
+ run: |
+ git config --local user.email "action@github.com"
+ git config --local user.name "GitHub Action"
+ git commit -am "Update package.json version [skip ci]"
+
+ - name: Push changes
+ uses: ad-m/github-push-action@master
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Upload .vsix artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: vsix-artifact
+ path: extension/build/*
diff --git a/continuedev/src/continuedev/core/sdk.py b/continuedev/src/continuedev/core/sdk.py
index cfe2e436..efebe9e3 100644
--- a/continuedev/src/continuedev/core/sdk.py
+++ b/continuedev/src/continuedev/core/sdk.py
@@ -136,6 +136,8 @@ class ContinueSDK(AbstractContinueSDK):
async def add_file(self, filename: str, content: Union[str, None]):
filepath = await self._ensure_absolute_path(filename)
+ dir_name = os.path.dirname(filepath)
+ os.makedirs(dir_name, exist_ok=True)
return await self.run_step(FileSystemEditStep(edit=AddFile(filepath=filepath, content=content)))
async def delete_file(self, filename: str):
diff --git a/continuedev/src/continuedev/steps/chat.py b/continuedev/src/continuedev/steps/chat.py
index 34a97a17..9d3384dd 100644
--- a/continuedev/src/continuedev/steps/chat.py
+++ b/continuedev/src/continuedev/steps/chat.py
@@ -62,7 +62,7 @@ class SimpleChatStep(Step):
class AddFileStep(Step):
name: str = "Add File"
- description = "Add a file to the workspace."
+ description = "Add a file to the workspace. Should always view the directory tree before this."
filename: str
file_contents: str
@@ -70,11 +70,7 @@ class AddFileStep(Step):
return f"Added a file named `{self.filename}` to the workspace."
async def run(self, sdk: ContinueSDK):
- try:
- await sdk.add_file(self.filename, self.file_contents)
- except FileNotFoundError:
- self.description = f"File {self.filename} does not exist."
- return
+ await sdk.add_file(self.filename, self.file_contents)
await sdk.ide.setFileOpen(os.path.join(sdk.ide.workspace_directory, self.filename))
@@ -132,7 +128,7 @@ class ViewDirectoryTreeStep(Step):
return f"Viewed the directory tree."
async def run(self, sdk: ContinueSDK):
- self.description = f"```\n{display_tree(sdk.ide.workspace_directory, True)}\n```"
+ self.description = f"```\n{display_tree(sdk.ide.workspace_directory, True, max_depth=2)}\n```"
class EditFileStep(Step):
diff --git a/extension/workflows/main.yml b/extension/workflows/main.yml
deleted file mode 100644
index 95dc2465..00000000
--- a/extension/workflows/main.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-# GitHub Actions Workflow to compile the extension and `npm run package`
-
-name: Build
-
-on:
- push:
- branches:
- - main
- pull_request:
- branches:
- - main
-
-jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-node@v1
- with:
- node-version: 19.0.0
- - run: npm ci
- - run: npm run clientgen
- - run: npm run compile
- - run: cd react-app && npm install && npm run build
- - run: npm run package
- - name: Save build as artifact
- uses: actions/upload-artifact@v3
- with:
- name: packaged-extension
- path: build/*.vsix