diff --git a/.github/workflows/auto-assign-issue.yaml b/.github/workflows/auto-assign-issue.yaml deleted file mode 100644 index 940f7cf54e4..00000000000 --- a/.github/workflows/auto-assign-issue.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Issue assignment - -on: - issues: - types: [opened] - -jobs: - auto-assign: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - name: "Auto-assign issue" - uses: pozil/auto-assign-issue@v2 - with: - repo-token: ${{ secrets.CI_GITHUB_TOKEN }} - assignees: sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa - numOfAssignee: 1 - # - name: "Add default labels" - # uses: actions-ecosystem/action-add-labels@v1 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # labels: | - # "needs-triage" diff --git a/.github/workflows/auto-assign-pr.yaml b/.github/workflows/auto-assign-pr.yaml deleted file mode 100644 index 4fd701a1548..00000000000 --- a/.github/workflows/auto-assign-pr.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: PR assignment -on: - pull_request: - types: [opened, ready_for_review] - -jobs: - add-reviews: - runs-on: ubuntu-latest - steps: - - uses: kentaro-m/auto-assign-action@v2.0.0 diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml deleted file mode 100644 index 43d65d5b5f4..00000000000 --- a/.github/workflows/auto-release.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Create Automatic Release - -on: - push: - branches: - - nate/auto-main-release-draft - schedule: - - cron: "0 17 * * 1,3,5" # Run at 9am PST (17:00 UTC) on Monday, Wednesday, Friday - workflow_dispatch: # Keep manual trigger option - -jobs: - create-vscode-release: - runs-on: ubuntu-latest - permissions: - contents: write # Needed for creating releases - - steps: - - uses: actions/checkout@v4 - - - name: Get version from package.json - id: get_version - run: | - # Read version from package.json and add -vscode suffix - version=$(node -p "require('./extensions/vscode/package.json').version") - new_version="v${version}-vscode" - echo "New version will be: $new_version" - echo "NEW_VERSION=$new_version" >> $GITHUB_ENV - - - name: Create Release - env: - GH_TOKEN: ${{ github.token }} - run: | - # Create a new draft release with auto-generated release notes - gh release create "$NEW_VERSION" \ - --generate-notes \ - --title "$NEW_VERSION" \ - --draft \ - --latest \ - --prerelease - - create-jetbrains-release: - runs-on: ubuntu-latest - permissions: - contents: write # Needed for creating releases - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get version from gradle.properties - id: get_version - run: | - # Read version from gradle.properties and add -jetbrains suffix - version=$(grep '^pluginVersion=' extensions/intellij/gradle.properties | cut -d'=' -f2) - new_version="v${version}-jetbrains" - echo "New version will be: $new_version" - echo "NEW_VERSION=$new_version" >> $GITHUB_ENV - - - name: Create Release - env: - GH_TOKEN: ${{ github.token }} - run: | - # Create a new draft release with auto-generated release notes - gh release create "$NEW_VERSION" \ - --generate-notes \ - --title "$NEW_VERSION" \ - --draft \ - --latest \ - --prerelease diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000000..b2040ab3dee --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,70 @@ +name: Build and Upload VSIX + +on: + pull_request: + branches: + - "**" + +jobs: + Build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Build packages (Unix) + run: ./scripts/build-packages.sh + + - name: Install dependencies (Unix) + run: ./scripts/install-dependencies.sh + + - name: Run Pre-package + run: | + cd extensions/vscode + npm run prepackage + + - name: Package the extension + run: | + cd extensions/vscode + npx vsce package --no-dependencies + + - name: Add VSIX as artifacts + uses: actions/upload-artifact@v4 + with: + name: vsix-package + path: extensions/vscode/*.vsix + + UploadToS3: + needs: build + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + + steps: + - name: Download VSIX artifact + uses: actions/download-artifact@v4 + with: + name: vsix-package + path: ./vsix + + - name: Configure AWS credentials via OIDC + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: ${{ secrets.AWS_ROLE_ARN }} + aws-region: ${{ secrets.AWS_REGION }} + + - name: Upload to S3 + run: | + VSIX_FILE=$(find ./vsix -name "*.vsix" | head -n 1) + echo "Uploading $VSIX_FILE to ${S3_BUCKET_NAME}" + aws s3 cp "$VSIX_FILE" "s3://${S3_BUCKET_NAME}/" + env: + S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }} + diff --git a/.github/workflows/cla.yaml b/.github/workflows/cla.yaml deleted file mode 100644 index 225439ced36..00000000000 --- a/.github/workflows/cla.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: "CLA Assistant" -on: - issue_comment: - types: [created] - pull_request_target: - types: [opened, closed, synchronize] - -permissions: - actions: write - contents: write - pull-requests: write - statuses: write - -jobs: - CLAAssistant: - runs-on: ubuntu-latest - # Only run this workflow on the main repository (continuedev/continue) - if: github.repository == 'continuedev/continue' - steps: - - name: "CLA Assistant" - if: (contains(github.event.comment.body, 'recheck') || contains(github.event.comment.body, 'I have read the CLA Document and I hereby sign the CLA')) || github.event_name == 'pull_request_target' - uses: contributor-assistant/github-action@v2.6.1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - path-to-signatures: "signatures/version1/cla.json" - path-to-document: "https://github.com/continuedev/continue/blob/main/CLA.md" - branch: cla-signatures - # Bots and CLAs signed outside of GitHub - allowlist: dependabot[bot],fbricon,panyamkeerthana,Jazzcort,owtaylor,halfline - signed-commit-message: "CLA signed in $pullRequestNo" diff --git a/.github/workflows/compliance.yaml b/.github/workflows/compliance.yaml deleted file mode 100644 index 1c4adce0c3e..00000000000 --- a/.github/workflows/compliance.yaml +++ /dev/null @@ -1,199 +0,0 @@ -name: PR Compliance Checks - -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - branches: [main] - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - conventional-commits: - name: Validate Conventional Commits (Warning Only) - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - continue-on-error: true - permissions: - pull-requests: write - issues: write - contents: read - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Validate conventional commits - id: commitlint - uses: wagoid/commitlint-github-action@v6 - with: - configFile: .commitlintrc.warning.json - # Only check the last commit instead of all commits in the PR - commitDepth: 1 - continue-on-error: true - - - name: Add commit message guidance comment - if: steps.commitlint.outcome == 'failure' - uses: actions/github-script@v7 - with: - script: | - const { data: comments } = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - - const botComment = comments.find(comment => - comment.user.type === 'Bot' && - comment.body.includes('Conventional Commit Format') - ); - - if (!botComment) { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - body: [ - "## ⚠️ Conventional Commit Format", - "", - "Your latest commit message doesn't follow the conventional commit format, but **this won't block your PR from being merged**. We recommend downloading [this extension](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits) if you are using VS Code.", - "", - "### Expected Format:", - "```", - "[optional scope]: ", - "", - "[optional body]", - "", - "[optional footer(s)]", - "```", - "", - "### Examples:", - "- `feat: add changelog generation support`", - "- `fix: resolve login redirect issue`", - "- `docs: update README with new instructions`", - "- `chore: update dependencies`", - "", - "### Valid Types:", - "`feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`", - "", - "This helps with:", - "- 📝 Automatic changelog generation", - "- 🚀 Automated semantic versioning", - "- 📊 Better project history tracking", - "", - "*This is a non-blocking warning - your PR can still be merged without fixing this.*" - ].join('\n') - }); - } - - security-audit: - name: Security Audit - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - permissions: - security-events: write - contents: read - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Fix vulnerabilities - run: npm audit fix - - - name: Run npm audit - run: npm audit --audit-level=moderate - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: javascript - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - - # Use this for any files that we want to be certain exist - # Basically creates a forcing function to discuss were anyone to want to remove them - file-validation: - name: Required Files Check - runs-on: ubuntu-latest - if: ${{ !github.event.pull_request.draft }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Check required files - run: | - required_files=( - "package.json" - "package-lock.json" - "README.md" - "LICENSE" - ".gitignore" - "tsconfig.json" - "SECURITY.md" - "CONTRIBUTING.md" - ".nvmrc" - ".prettierrc" - ".prettierignore" - ) - - missing_files=() - for file in "${required_files[@]}"; do - if [[ ! -f "$file" ]]; then - missing_files+=("$file") - fi - done - - if [[ ${#missing_files[@]} -gt 0 ]]; then - echo "❌ Missing required files:" - printf '%s\n' "${missing_files[@]}" - exit 1 - else - echo "✅ All required files present" - fi - - compliance-summary: - name: Compliance Summary - runs-on: ubuntu-latest - needs: [conventional-commits, security-audit, file-validation] - if: always() && !github.event.pull_request.draft - steps: - - name: Check compliance status - run: | - echo "## 🔍 Compliance Check Results" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - if [[ "${{ needs.conventional-commits.result }}" == "success" ]]; then - echo "✅ Conventional Commits: PASSED" >> $GITHUB_STEP_SUMMARY - elif [[ "${{ needs.conventional-commits.result }}" == "failure" ]]; then - echo "⚠️ Conventional Commits: WARNING (non-blocking)" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Conventional Commits: SKIPPED" >> $GITHUB_STEP_SUMMARY - fi - - if [[ "${{ needs.security-audit.result }}" == "success" ]]; then - echo "✅ Security Audit: PASSED" >> $GITHUB_STEP_SUMMARY - else - echo "❌ Security Audit: FAILED" >> $GITHUB_STEP_SUMMARY - fi - - if [[ "${{ needs.file-validation.result }}" == "success" ]]; then - echo "✅ File Validation: PASSED" >> $GITHUB_STEP_SUMMARY - else - echo "❌ File Validation: FAILED" >> $GITHUB_STEP_SUMMARY - fi - - echo "" >> $GITHUB_STEP_SUMMARY - echo "📊 **Overall Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index b83567fcab4..00000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Docs Check - -on: - push: - paths: - - 'docs2/**' - pull_request: - paths: - - 'docs2/**' - -jobs: - check-broken-links: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - cache-dependency-path: docs2/package-lock.json - - - name: Install dependencies - working-directory: ./docs2 - run: npm ci - - - name: Check for broken links - working-directory: ./docs2 - run: npx mintlify broken-links \ No newline at end of file diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml deleted file mode 100644 index 956d249c4c0..00000000000 --- a/.github/workflows/jetbrains-release.yaml +++ /dev/null @@ -1,590 +0,0 @@ -# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow. -# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN. -# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. - -name: JetBrains Release - -on: - release: - types: [prereleased] - workflow_dispatch: - inputs: - publish_build: - description: "Whether or not to publish the built extension to the JetBrains marketplace" - required: true - default: false - -defaults: - run: - working-directory: extensions/intellij - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - check_release_name: - runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.check.outputs.should_run }} - steps: - - id: check - working-directory: . - run: | - if [[ "${{ github.event.release.tag_name }}" == v1.0.*-jetbrains ]]; then - echo "should_run=true" >> $GITHUB_OUTPUT - else - echo "should_run=false" >> $GITHUB_OUTPUT - fi - - bump-version: - runs-on: ubuntu-latest - needs: - - check_release_name - if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' - permissions: - contents: write - pull-requests: write - steps: - # 0. Setup git - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Create PR branch - run: | - BRANCH_NAME="chore/bump-jetbrains-version-$(date +%Y%m%d-%H%M%S)" - git checkout -b $BRANCH_NAME - echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV - - - name: Bump version in gradle.properties - run: | - cd extensions/intellij - awk '/pluginVersion=/{split($0,a,"="); split(a[2],b,"."); b[3]+=1; printf "%s=%s.%s.%s\n",a[1],b[1],b[2],b[3];next}1' gradle.properties > tmp && mv tmp gradle.properties - rm -rf tmp - NEW_VERSION=$(grep 'pluginVersion=' gradle.properties | cut -d'=' -f2) - echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.CI_GITHUB_TOKEN }} - commit-message: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}" - title: "chore: bump jetbrains extension version to ${{ env.NEW_VERSION }}" - body: | - Automated PR to bump the JetBrains extension version after successful pre-release publication. - - - Bumped version in extensions/intellij/gradle.properties to ${{ env.NEW_VERSION }} - branch: ${{ env.BRANCH_NAME }} - base: main - delete-branch: true - - # Prepare and publish the plugin to JetBrains Marketplace repository - build: - needs: check_release_name - if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' - name: Build Plugin - runs-on: macos-latest - permissions: - contents: write - pull-requests: write - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - with: - ref: ${{ github.event.release.tag_name }} - - - name: Import Apple certificate - uses: apple-actions/import-codesign-certs@v5 - with: - keychain: ${{ github.run_id }} - keychain-password: ${{ github.run_id }} - p12-file-base64: ${{ secrets.APPLE_CERT_DATA }} - p12-password: ${{ secrets.APPLE_CERT_PASSWORD }} - - # Validate wrapper - - name: Gradle Wrapper Validation - uses: gradle/actions/wrapper-validation@v3 - - # # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew properties --console=plain -q)" - VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" - CHANGELOG="" - - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT - - echo "changelog<> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - - # # Setup Node.js - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache binary node_modules - uses: actions/cache@v3 - with: - path: binary/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Unix) - run: cd ../.. && ./scripts/build-packages.sh - - # npm install core - - name: Install core node_modules - run: | - cd ../../core - npm ci - - # npm install gui - - name: Install gui node_modules and build - run: | - cd ../../gui - npm ci - npm run build - - # Run prepackage.js script - - name: Run prepackage script - run: | - cd ../../extensions/vscode - npm ci - npm run prepackage - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - # npm install binary - - name: Install binary node_modules - run: | - cd ../../binary - npm ci - - # Build binaries - - name: Build the binaries - run: | - cd ../../binary - npm run build - - # - name: Code sign darwin binaries - # run: | - # echo "Signing executable with keychain: ${{ github.run_id }}" - # codesign --sign - ../../binary/bin/darwin-x64/continue-binary - # codesign --sign - ../../binary/bin/darwin-arm64/continue-binary - - # - name: Sign darwin-arm64 binary - # uses: lando/code-sign-action@v2 - # with: - # file: ./binary/bin/darwin-arm64/continue-binary - # certificate-data: ${{ secrets.APPLE_CERT_DATA }} - # certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} - # apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} - # apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} - # apple-notary-tool: altool - # apple-team-id: 43XFLY66ZD - # apple-product-id: dev.continue.continue-binary - # options: --options runtime --entitlements entitlements.xml - - # Build plugin - - name: Build plugin - run: ./gradlew buildPlugin - - # Publish the plugin to JetBrains Marketplace - - name: Publish EAP Plugin - if: github.event_name == 'release' || github.event.inputs.publish_build == 'true' - env: - PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} - RELEASE_CHANNEL: eap - run: ./gradlew publishPlugin - - - name: Publish Stable Plugin - if: github.event_name == 'release' || github.event.inputs.publish_build == 'true' - env: - PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} - RELEASE_CHANNEL: default - run: ./gradlew publishPlugin - - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ../../extensions/intellij/build/distributions - echo "Contents of distributions folder:" - ls - echo "---" - FILENAME=`ls continue-intellij-extension-*.zip` - echo "Filename=${FILENAME}" - unzip "$FILENAME" -d content - - echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT - - # Store already-built plugin as an artifact for downloading - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./extensions/intellij/build/distributions/content/*/* - - # Upload binaries as artifacts - - name: Upload artifact (darwin-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-arm64 - path: ./binary/bin/darwin-arm64/ - - - name: Upload artifact (darwin-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-x64 - path: ./binary/bin/darwin-x64/ - - - name: Upload artifact (win32-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-win32-x64 - path: ./binary/bin/win32-x64/ - - - name: Upload artifact (win32-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-win32-arm64 - path: ./binary/bin/win32-arm64/ - - - name: Upload artifact (linux-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-linux-arm64 - path: ./binary/bin/linux-arm64/ - - - name: Upload artifact (linux-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-linux-x64 - path: ./binary/bin/linux-x64/ - - test-binaries: - needs: build - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - # arm64 not actually supported by GitHub - # - os: ubuntu-latest - # platform: linux - # arch: arm64 - # npm_config_arch: arm64 - - os: macos-12 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-latest - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} - steps: - # 1. Check-out repository - - name: Check-out repository - uses: actions/checkout@v4 - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache binary node_modules - uses: actions/cache@v3 - with: - path: binary/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - - name: Install Core Dependencies - run: | - cd ../../core - npm ci - - - name: Install Binary Dependencies - run: | - cd ../../binary - npm ci - - # Download the binary artifact - - name: Download binary artifact - uses: actions/download-artifact@v4 - with: - name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }} - path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/ - - # Set execute permissions for the binary (non-Windows) - - name: Set execute permissions - run: | - cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} - chmod +x continue-binary - chmod +x build/Release/node_sqlite3.node - chmod +x index.node - if: ${{ matrix.platform }} != 'win32' - - # Run tests for binary - - name: Run binary tests - run: | - cd ../../binary - npm run test - - - name: Upload logs - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} - path: ~/.continue/logs/core.log - - # Run tests and upload a code coverage report - test: - name: Test - needs: [build] - runs-on: ubuntu-latest - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Run tests - - name: Run Tests - run: ./gradlew check - - # Collect Tests Result of failed tests - - name: Collect Tests Result - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: tests-result - path: ${{ github.workspace }}/extensions/intellij/build/reports/tests - - # Upload the Kover report to CodeCov - # - name: Upload Code Coverage Report - # uses: codecov/codecov-action@v4 - # with: - # files: ${{ github.workspace }}/build/reports/kover/report.xml - - # Run Qodana inspections and provide report - inspectCode: - if: false - name: Inspect code - needs: [build] - runs-on: ubuntu-latest - permissions: - contents: write - checks: write - pull-requests: write - steps: - # Free GitHub Actions Environment Disk Space - - name: Maximize Build Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Run Qodana inspections - - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2025.1.1 - with: - cache-default-branch-only: true - - # Run plugin structure verification along with IntelliJ Plugin Verifier - verify: - if: false - name: Verify plugin - needs: [build] - runs-on: ubuntu-latest - steps: - # Free GitHub Actions Environment Disk Space - - name: Maximize Build Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Cache Plugin Verifier IDEs - - name: Setup Plugin Verifier IDEs Cache - uses: actions/cache@v4 - with: - path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides - key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} - - # Run Verify Plugin task and IntelliJ Plugin Verifier tool - - name: Run Plugin Verification tasks - run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} - - # Collect Plugin Verifier Result - - name: Collect Plugin Verifier Result - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: pluginVerifier-result - path: ${{ github.workspace }}/build/reports/pluginVerifier - - upload-release: - if: false - name: Upload Release - needs: - - build - - test-binaries - - test - runs-on: ubuntu-latest - steps: - # # Update Unreleased section with the current release note - # - name: Patch Changelog - # if: ${{ steps.properties.outputs.changelog != '' }} - # env: - # CHANGELOG: ${{ steps.properties.outputs.changelog }} - # run: | - # ./gradlew patchChangelog --release-note="$CHANGELOG" - - - name: Download the plugin - uses: actions/download-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./build/distributions/ - - # Upload artifact as a release asset - # - name: Upload Release Asset - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* - - # Publish the plugin to JetBrains Marketplace - - name: Publish Plugin - env: - PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} - CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} - PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} - PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} - run: ./gradlew publishPlugin - - # Create a pull request - - name: Create Pull Request - if: ${{ steps.properties.outputs.changelog != '' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - VERSION="${{ github.event.release.tag_name }}" - BRANCH="changelog-update-$VERSION" - LABEL="release changelog" - - git config user.email "action@github.com" - git config user.name "GitHub Action" - - git checkout -b $BRANCH - git commit -am "Changelog update - $VERSION" - git push --set-upstream origin $BRANCH - - gh label create "$LABEL" \ - --description "Pull requests with release changelog update" \ - --force \ - || true - - gh pr create \ - --title "Changelog update - \`$VERSION\`" \ - --body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \ - --label "$LABEL" \ - --head $BRANCH diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index ce1e59e66a0..00000000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,255 +0,0 @@ -name: Publish Extension - -on: - release: - types: [released] - - workflow_dispatch: - inputs: - publish_build: - description: "Whether or not to publish the built extension to the VS Code marketplace" - required: true - default: false - -jobs: - check_release_name: - runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.check.outputs.should_run }} - steps: - - id: check - working-directory: . - run: | - if [[ "${{ github.event.release.tag_name }}" == v1.0.*-vscode ]]; then - echo "should_run=true" >> $GITHUB_OUTPUT - else - echo "should_run=false" >> $GITHUB_OUTPUT - fi - - build: - needs: check_release_name - if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: windows-latest - platform: win32 - arch: arm64 - npm_config_arch: arm - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: arm64 - npm_config_arch: arm64 - - os: ubuntu-latest - platform: linux - arch: armhf - npm_config_arch: arm - - os: ubuntu-latest - platform: alpine - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} - steps: - # 1. Check-out repository - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # This ensures all tags are fetched - - - name: Checkout tag - run: git checkout ${GITHUB_REF#refs/tags/} - - - name: Make sure version isn't odd - run: | - cd extensions/vscode - node scripts/versionCheck.js - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache extension node_modules - uses: actions/cache@v3 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Windows) - run: ./scripts/build-packages.ps1 - if: matrix.os == 'windows-latest' - - - name: Build packages (Unix) - run: ./scripts/build-packages.sh - if: matrix.os != 'windows-latest' - - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Install gui Dependencies - run: | - cd gui - npm ci - - # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - - name: Install Core Dependencies - run: | - cd core - npm ci - npm i vectordb - - # - name: Run core tests - # run: | - # cd core - # npm run test - # env: - # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - # 2.5. Pre package - - name: Set var for environment info - shell: pwsh - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - - - name: Prepackage the extension - run: | - cd extensions/vscode - npm run prepackage -- --target ${{ env.target }} - - # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) - - name: Re-install esbuild - run: | - cd extensions/vscode - npm install -f esbuild - - # 4. Run tests for the extension - # - name: Install Xvfb for Linux and run tests - # run: | - # sudo apt-get install -y xvfb # Install Xvfb - # Xvfb :99 & # Start Xvfb - # export DISPLAY=:99 # Export the display number to the environment - # cd extensions/vscode - # npm run test - # if: matrix.os == 'ubuntu-latest' - - # - name: Run extension tests - # run: | - # cd extensions/vscode - # npm run test - # if: matrix.os != 'ubuntu-latest' - - # 5. Package the extension - - name: Package the extension - run: cd extensions/vscode && npx vsce package --no-dependencies --target ${{ env.target }} - - # 6. Upload the .vsix as an artifact - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.target }}-vsix - path: "extensions/vscode/*.vsix" - - release: - permissions: - contents: write - runs-on: ubuntu-latest - needs: - - build - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - # Download the .vsix artifacts - - uses: actions/download-artifact@v4 - with: - pattern: "*-vsix" - path: vsix-artifacts - merge-multiple: true - - - name: Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.ref_name }} - files: | - vsix-artifacts/*.vsix - token: ${{ secrets.CI_GITHUB_TOKEN }} - repository: continuedev/continue - - publish: - runs-on: ubuntu-latest - needs: - - build - if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' - permissions: - contents: write - steps: - # 0. Setup git - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Pull latest changes from release - run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }} - - # 1. Download the artifacts - - uses: actions/download-artifact@v4 - with: - pattern: "*-vsix" - path: vsix-artifacts - merge-multiple: true - - # 2. Publish the extension to VS Code Marketplace - - name: Publish to VS Code Marketplace - run: | - cd extensions/vscode - npx @vscode/vsce publish --packagePath ../../vsix-artifacts/*.vsix - env: - VSCE_PAT: ${{ secrets.VSCE_TOKEN }} - - # 3. Publish the extension to Open VSX Registry - - name: Publish (Open VSX Registry) - continue-on-error: true - run: | - cd extensions/vscode - npx ovsx publish -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix diff --git a/.github/workflows/metrics.yaml b/.github/workflows/metrics.yaml deleted file mode 100644 index ba4e1cd4abd..00000000000 --- a/.github/workflows/metrics.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: Monthly issue metrics -on: - workflow_dispatch: - schedule: - # Runs every Monday at 9:00 AM PST (17:00 UTC) - - cron: "0 17 * * 1" - - push: - branches: - - nate/metrics-action - -permissions: - contents: read - -jobs: - build: - name: issue metrics - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: read - steps: - - name: Get dates for last month - shell: bash - run: | - # Calculate the first day of the previous month - first_day=$(date -d "last month" +%Y-%m-01) - - # Calculate the last day of the previous month - last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d) - - #Set an environment variable with the date range - echo "$first_day..$last_day" - echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV" - - - name: Run issue-metrics tool - uses: github/issue-metrics@v3 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SEARCH_QUERY: 'repo:continuedev/continue created:${{ env.last_month }} -reason:"not planned"' - - - name: Read metrics file content - id: read-metrics - run: | - content=$(cat ./issue_metrics.md) - # This prepares the content in a way that can be used in GitHub Actions - content="${content//'%'/'%25'}" - content="${content//$'\n'/'%0A'}" - # content="${content//$'\r'/'%0D'}" - echo "metrics_content=$content" >> "$GITHUB_OUTPUT" - - - name: Post a message in a channel - uses: slackapi/slack-github-action@v2.1.1 - with: - webhook: ${{ secrets.ISSUE_PR_METRICS_SLACK_WEBHOOK_URL }} - webhook-type: incoming-webhook - payload: | - text: "Issue / PR Metrics Report" - blocks: - - type: "header" - text: - type: "plain_text" - text: "Monthly Issue Metrics Report" - emoji: true - - type: "section" - text: - type: "mrkdwn" - text: | - ${{ steps.read-metrics.outputs.metrics_content }} - - - name: Upload metrics report as artifact - uses: actions/upload-artifact@v4 - with: - name: issue-metrics-report - path: ./issue_metrics.md diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml deleted file mode 100644 index 36eebc970dd..00000000000 --- a/.github/workflows/pr_checks.yaml +++ /dev/null @@ -1,1076 +0,0 @@ -name: PR checks - -# PR Checks run on all PRs to the main branch and must pass before merging. -on: - pull_request: - branches: - - main - - push: - branches: - - main - -jobs: - install-root: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: root-cache - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - name: Install root dependencies - if: steps.root-cache.outputs.cache-hit != 'true' - run: npm ci - - prettier-check: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - name: Check code formatting with Prettier - run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore --ignore-path .prettierignore - - install-config-yaml: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Install config-yaml dependencies - if: steps.config-yaml-cache.outputs.cache-hit != 'true' - run: | - cd packages/config-yaml - npm ci - - install-openai-adapters: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Install openai-adapters dependencies - if: steps.openai-adapters-cache.outputs.cache-hit != 'true' - run: | - cd packages/openai-adapters - npm ci - - config-yaml-checks: - needs: install-config-yaml - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build and check config-yaml - run: | - cd packages/config-yaml - npx tsc --noEmit - # Tests are currently failing, commenting out for now - # npm test - npm run build - - install-core: - needs: install-root - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: root-cache - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: core-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - name: Install core dependencies - if: steps.core-cache.outputs.cache-hit != 'true' - run: | - cd core - npm ci - - core-checks: - needs: [install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: root-cache - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - id: core-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - name: Type check and lint - run: | - cd core - npx tsc --noEmit - npm run lint - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - install-gui: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install gui dependencies - if: steps.gui-cache.outputs.cache-hit != 'true' - run: | - cd gui - npm ci - - gui-checks: - needs: install-gui - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Type check and lint - run: | - cd gui - npx tsc --noEmit - npm run lint - - binary-checks: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: binary-cache - with: - path: binary/node_modules - key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install binary dependencies - if: steps.binary-cache.outputs.cache-hit != 'true' - run: | - cd binary - npm ci - - - name: Type check - run: | - cd binary - npx tsc --noEmit - - install-vscode: - needs: - [install-root, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: vscode-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install vscode dependencies - if: steps.vscode-cache.outputs.cache-hit != 'true' - run: | - cd extensions/vscode - npm ci - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - vscode-checks: - needs: install-vscode - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: node_modules - key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: vscode-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Type check and lint - run: | - cd extensions/vscode - npm run write-build-timestamp - npx tsc --noEmit - npm run lint - - - name: Run vitest tests - run: | - cd extensions/vscode - npm run vitest - - core-tests: - needs: [install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Run core tests - run: | - cd core - npm test - npm run vitest - env: - IGNORE_API_KEY_TESTS: ${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} - MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} - AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} - AZURE_FOUNDRY_CODESTRAL_API_KEY: ${{ secrets.AZURE_FOUNDRY_CODESTRAL_API_KEY }} - AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY: ${{ secrets.AZURE_FOUNDRY_MISTRAL_SMALL_API_KEY }} - AZURE_OPENAI_GPT41_API_KEY: ${{ secrets.AZURE_OPENAI_GPT41_API_KEY }} - - package-tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Install dependencies - run: | - cd packages/config-yaml - npm ci - - - name: Run config-yaml tests - run: | - cd packages/config-yaml - npm test - - vscode-get-test-file-matrix: - runs-on: ubuntu-latest - needs: [install-root, install-vscode, install-config-yaml] - outputs: - test_file_matrix: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }} - steps: - - uses: actions/checkout@v4 - - - name: Cache node modules - uses: actions/cache@v4 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Get test files - id: vscode-get-test-file-matrix - run: | - cd extensions/vscode - npm ci - npm run e2e:compile - if [[ "${{ github.event.pull_request.head.repo.fork }}" == "true" || "${{ github.actor }}" == "dependabot[bot]" ]]; then - # Exclude SSH tests for forks - FILES=$(ls -1 e2e/_output/tests/*.test.js | grep -v "SSH" | jq -R . | jq -s .) - else - # Include all tests for non-forks - FILES=$(ls -1 e2e/_output/tests/*.test.js | jq -R . | jq -s .) - fi - echo "test_file_matrix<> $GITHUB_OUTPUT - echo "$FILES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - - name: Debug Outputs - run: | - echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}" - - vscode-package-extension: - runs-on: ubuntu-latest - needs: - [ - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: core-node-modules-cache - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Package extension - run: | - cd extensions/vscode - npm run package - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: vscode-extension-build - path: extensions/vscode/build - - vscode-download-e2e-dependencies: - runs-on: ubuntu-latest - needs: - [ - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: storage-cache - with: - path: extensions/vscode/e2e/storage - key: ${{ runner.os }}-vscode-storage-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Download Dependencies - if: steps.storage-cache.outputs.cache-hit != 'true' - run: | - cd extensions/vscode - npm run e2e:ci:download - - - name: Upload e2e dependencies - uses: actions/upload-artifact@v4 - with: - name: vscode-e2e-dependencies - path: extensions/vscode/e2e/storage - - vscode-e2e-tests: - name: ${{ matrix.test_file || 'unknown' }} (${{ matrix.command }}) - needs: - [ - vscode-download-e2e-dependencies, - vscode-get-test-file-matrix, - vscode-package-extension, - install-vscode, - install-core, - install-config-yaml, - install-openai-adapters, - ] - runs-on: ubuntu-latest - # Tests requiring secrets need approval from maintainers - strategy: - fail-fast: false - matrix: - test_file: ${{ fromJson(needs.vscode-get-test-file-matrix.outputs.test_file_matrix) }} - command: ["e2e:ci:run", "e2e:ci:run-yaml"] - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: vscode-node-modules-cache - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} - - # We don't want to cache the Continue extension, so it is deleted at the end of the job - - uses: actions/cache@v4 - id: test-extensions-cache - with: - path: extensions/vscode/e2e/.test-extensions - key: CONSTANT - - - name: Download build artifact - uses: actions/download-artifact@v4 - with: - name: vscode-extension-build - path: extensions/vscode/build - - - name: Download e2e dependencies - uses: actions/download-artifact@v4 - with: - name: vscode-e2e-dependencies - path: extensions/vscode/e2e/storage - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Fix VSCode binary permissions - run: | - chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code - chmod +x extensions/vscode/e2e/storage/chromedriver-linux64/chromedriver - - - name: Set up SSH - env: - SSH_KEY: ${{ secrets.GH_ACTIONS_SSH_TEST_KEY_PEM }} - SSH_HOST: ${{ secrets.GH_ACTIONS_SSH_TEST_DNS_NAME }} - run: | - mkdir -p ~/.ssh - echo "$SSH_KEY" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts - echo -e "Host ssh-test-container\n\tHostName $SSH_HOST\n\tUser ec2-user\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config - if: ${{ github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' }} - - - name: Set up Xvfb - run: | - Xvfb :99 & - export DISPLAY=:99 - - - name: Run e2e tests - run: | - cd extensions/vscode - IGNORE_SSH_TESTS="${{ github.event.pull_request.head.repo.fork == true || github.actor == 'dependabot[bot]' }}" TEST_FILE="${{ matrix.test_file }}" npm run ${{ matrix.command }} - env: - DISPLAY: :99 - - - name: Delete continue from test extensions - run: | - cd extensions/vscode - rm -rf e2e/.test-extensions/continue* - - - name: Sanitize test file name - id: sanitize_filename - if: always() - run: | - FILENAME="${{ matrix.test_file }}" - SANITIZED_FILENAME="${FILENAME//\//-}" # Replace / with - using bash parameter expansion - echo "sanitized_test_file=${SANITIZED_FILENAME}" >> $GITHUB_OUTPUT - - - name: Upload e2e test screenshots - if: failure() - uses: actions/upload-artifact@v4 - with: - name: e2e-failure-screenshots-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ matrix.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} - path: extensions/vscode/e2e/storage/screenshots - - - name: Find e2e log file - if: always() - run: | - echo "Searching for e2e.log file..." - find $GITHUB_WORKSPACE -name "e2e.log" -type f - - - name: Upload e2e logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: e2e-logs-${{ steps.sanitize_filename.outputs.sanitized_test_file || 'unknown' }}-${{ matrix.command == 'e2e:ci:run-yaml' && 'yaml' || 'json' }} - path: extensions/vscode/e2e.log - - gui-tests: - needs: - [install-gui, install-core, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Install GUI dependencies - if: steps.gui-cache.outputs.cache-hit != 'true' - run: cd gui && npm ci - env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Run gui tests - run: | - cd gui - npm test - - jetbrains-tests: - needs: - [install-root, core-checks, install-config-yaml, install-openai-adapters] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: core/node_modules - key: ${{ runner.os }}-core-node-modules-${{ hashFiles('core/package-lock.json') }} - - - uses: actions/cache@v4 - id: config-yaml-cache - with: - path: packages/config-yaml/node_modules - key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} - - - uses: actions/cache@v4 - id: openai-adapters-cache - with: - path: packages/openai-adapters/node_modules - key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} - - - name: Build config-yaml - run: | - cd packages/config-yaml - npm run build - - - name: Build openai-adapters - run: | - cd packages/openai-adapters - npm run build - - - name: Setup Java - uses: actions/setup-java@v4.5.0 - with: - distribution: zulu - java-version: 17 - - - name: Setup FFmpeg - uses: AnimMouse/setup-ffmpeg@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - uses: actions/cache@v4 - id: gui-cache - with: - path: gui/node_modules - key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} - - # We can shave off another minute off our CI script by finding a way to share this with vscode-tests - - name: Run prepackage script - run: | - cd extensions/vscode - npm ci - npm run prepackage - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - uses: actions/cache@v4 - id: binary-cache - with: - path: binary/node_modules - key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }} - - - name: Build the binaries - run: | - cd binary - npm run build - - - name: Start test IDE - run: | - cd extensions/intellij - export DISPLAY=:99.0 - Xvfb -ac :99 -screen 0 1920x1080x24 & - sleep 10 - mkdir -p build/reports - ./gradlew runIdeForUiTests & - - - name: Wait for JB connection - uses: jtalk/url-health-check-action@v3 - with: - url: http://127.0.0.1:8082 - max-attempts: 15 - retry-delay: 30s - - - name: Run tests - run: | - cd extensions/intellij - export DISPLAY=:99.0 - ./gradlew test - - - name: Move video - if: ${{ failure() }} - run: | - cd extensions/intellij - mv video build/reports - - - name: Copy logs - if: ${{ failure() }} - run: | - cd extensions/intellij - mv build/idea-sandbox/system/log/ build/reports - - - name: Save fails report - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: jb-failure-report - path: | - ${{ github.workspace }}/extensions/intellij/build/reports - - # GitHub does not have a way of requiring that all checks pass (you must manually select each job) - # This action at least lets us manage the list of required tests via source control - # so that creators of new jobs can add them to this list - require-all-checks-to-pass: - if: always() - runs-on: ubuntu-latest - needs: - - install-root - - prettier-check - - install-core - - core-checks - - install-gui - - gui-checks - - binary-checks - - install-vscode - - vscode-checks - - core-tests - - package-tests - - vscode-get-test-file-matrix - - vscode-package-extension - - vscode-download-e2e-dependencies - - vscode-e2e-tests - - gui-tests - - jetbrains-tests - - config-yaml-checks - - install-config-yaml - - install-openai-adapters - - steps: - - name: Decide whether the needed jobs succeeded or failed - uses: re-actors/alls-green@release/v1 - with: - jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml deleted file mode 100644 index 3ef4920ede6..00000000000 --- a/.github/workflows/preview.yaml +++ /dev/null @@ -1,302 +0,0 @@ -name: Publish Pre-release Extension - -on: - release: - types: [prereleased] - - workflow_dispatch: - inputs: - publish_build: - description: "Whether or not to publish the built extension to the VS Code marketplace" - required: true - default: false - -jobs: - check_release_name: - runs-on: ubuntu-latest - outputs: - should_run: ${{ steps.check.outputs.should_run }} - steps: - - id: check - working-directory: . - run: | - if [[ "${{ github.event.release.tag_name }}" == v1.1.*-vscode ]]; then - echo "should_run=true" >> $GITHUB_OUTPUT - else - echo "should_run=false" >> $GITHUB_OUTPUT - fi - - build: - needs: check_release_name - if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch' - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: windows-latest - platform: win32 - arch: arm64 - npm_config_arch: arm - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: arm64 - npm_config_arch: arm64 - - os: ubuntu-latest - platform: linux - arch: armhf - npm_config_arch: arm - - os: ubuntu-latest - platform: alpine - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-13 - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} - steps: - # 1. Check-out repository - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 # This ensures all tags are fetched - - - name: Checkout tag - run: git checkout ${GITHUB_REF#refs/tags/} - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache extension node_modules - uses: actions/cache@v3 - with: - path: extensions/vscode/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - - name: Build packages (Windows) - run: ./scripts/build-packages.ps1 - if: matrix.os == 'windows-latest' - - - name: Build packages (Unix) - run: ./scripts/build-packages.sh - if: matrix.os != 'windows-latest' - - - name: Install extension Dependencies - run: | - cd extensions/vscode - npm ci - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - - name: Install gui Dependencies - run: | - cd gui - npm ci - - # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - - name: Install Core Dependencies - run: | - cd core - npm ci - npm i vectordb - - # - name: Run core tests - # run: | - # cd core - # npm run test - # env: - # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - - # 2.5. Pre package - - name: Set var for environment info - shell: pwsh - run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV - - - name: Prepackage the extension - run: | - cd extensions/vscode - npm run prepackage -- --target ${{ env.target }} - - # 3. Re-install esbuild (for cases that we force installed for another arch in prepackage.js) - - name: Re-install esbuild - run: | - cd extensions/vscode - npm install -f esbuild - - # 4. Run tests for the extension - # - name: Install Xvfb for Linux and run tests - # run: | - # sudo apt-get install -y xvfb # Install Xvfb - # Xvfb :99 & # Start Xvfb - # export DISPLAY=:99 # Export the display number to the environment - # cd extensions/vscode - # npm run test - # if: matrix.os == 'ubuntu-latest' - - # - name: Run extension tests - # run: | - # cd extensions/vscode - # npm run test - # if: matrix.os != 'ubuntu-latest' - - # 5. Package the extension - - name: Package the extension - run: cd extensions/vscode && npx vsce package --pre-release --no-dependencies --target ${{ env.target }} - - # 6. Upload the .vsix as an artifact - - uses: actions/upload-artifact@v4 - with: - name: ${{ env.target }}-vsix - path: "extensions/vscode/*.vsix" - - release: - permissions: - contents: write - runs-on: ubuntu-latest - needs: - - build - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - # Download the .vsix artifacts - - uses: actions/download-artifact@v4 - with: - pattern: "*-vsix" - path: vsix-artifacts - merge-multiple: true - - - name: Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ github.ref_name }} - files: | - vsix-artifacts/*.vsix - token: ${{ secrets.CI_GITHUB_TOKEN }} - repository: continuedev/continue - prerelease: true - - publish: - runs-on: ubuntu-latest - needs: - - build - if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish_build == 'true' - permissions: - contents: write - pull-requests: write - steps: - # 0. Setup git - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Pull latest changes from release - run: git fetch origin ${{ github.ref }} && git checkout ${{ github.ref }} - - # 1. Download the artifacts - - uses: actions/download-artifact@v4 - with: - pattern: "*-vsix" - path: vsix-artifacts - merge-multiple: true - - # 2. Publish the extension to VS Code Marketplace - - name: Publish to VS Code Marketplace - run: | - cd extensions/vscode - npx @vscode/vsce publish --pre-release --packagePath ../../vsix-artifacts/*.vsix - env: - VSCE_PAT: ${{ secrets.VSCE_TOKEN }} - - # 3. Publish the extension to Open VSX Registry - - name: Publish (Open VSX Registry) - continue-on-error: true - run: | - cd extensions/vscode - npx ovsx publish --pre-release -p ${{ secrets.VSX_REGISTRY_TOKEN }} --packagePath ../../vsix-artifacts/*.vsix - - # 4. Create PR with version bump - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Create PR branch - run: | - BRANCH_NAME="chore/bump-vscode-version-$(date +%Y%m%d-%H%M%S)" - git checkout -b $BRANCH_NAME - echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV - - - name: Bump version in package.json - run: | - cd extensions/vscode - npm version patch --no-git-tag-version - VERSION=$(node -p "require('./package.json').version") - echo "NEW_VERSION=$VERSION" >> $GITHUB_ENV - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.CI_GITHUB_TOKEN }} - commit-message: "chore: bump vscode extension version to ${{ env.NEW_VERSION }}" - title: "chore: bump vscode extension version to ${{ env.NEW_VERSION }}" - body: | - Automated PR to bump the VS Code extension version after successful pre-release publication. - - - Bumped version in extensions/vscode/package.json to ${{ env.NEW_VERSION }} - branch: ${{ env.BRANCH_NAME }} - base: main - delete-branch: true - - # 5. Update version in package.json - # - name: Update version in package.json - # run: | - # cd extensions/vscode - # npm version patch - # - 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 }} - # branch: ${{ github.ref }} diff --git a/.github/workflows/release-config-yaml.yml b/.github/workflows/release-config-yaml.yml deleted file mode 100644 index f0d220ed029..00000000000 --- a/.github/workflows/release-config-yaml.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Release @continuedev/config-yaml - -on: - push: - branches: - - main - paths: - - "packages/config-yaml/**" - -jobs: - release: - uses: ./.github/workflows/reusable-release.yml - with: - package-name: "config-yaml" - package-path: "packages/config-yaml" - secrets: - SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} diff --git a/.github/workflows/release-fetch.yml b/.github/workflows/release-fetch.yml deleted file mode 100644 index 2fa1124bc19..00000000000 --- a/.github/workflows/release-fetch.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Release @continuedev/fetch - -on: - push: - branches: - - main - paths: - - "packages/fetch/**" - -jobs: - release: - uses: ./.github/workflows/reusable-release.yml - with: - package-name: "fetch" - package-path: "packages/fetch" - secrets: - SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} diff --git a/.github/workflows/release-llm-info.yml b/.github/workflows/release-llm-info.yml deleted file mode 100644 index 1b1c044dcd1..00000000000 --- a/.github/workflows/release-llm-info.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Release @continuedev/llm-info - -on: - push: - branches: - - main - paths: - - "packages/llm-info/**" - -jobs: - release: - uses: ./.github/workflows/reusable-release.yml - with: - package-name: "llm-info" - package-path: "packages/llm-info" - secrets: - SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} diff --git a/.github/workflows/release-openai-adapters.yml b/.github/workflows/release-openai-adapters.yml deleted file mode 100644 index ce7f4fda821..00000000000 --- a/.github/workflows/release-openai-adapters.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Release @continuedev/openai-adapters - -on: - push: - branches: - - main - paths: - - "packages/openai-adapters/**" - -jobs: - release: - uses: ./.github/workflows/reusable-release.yml - with: - package-name: "openai-adapters" - package-path: "packages/openai-adapters" - secrets: - SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} diff --git a/.github/workflows/reusable-release.yml b/.github/workflows/reusable-release.yml deleted file mode 100644 index 7de9d732072..00000000000 --- a/.github/workflows/reusable-release.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Reusable Release Workflow - -on: - workflow_call: - inputs: - package-name: - required: true - type: string - package-path: - required: true - type: string - secrets: - SEMANTIC_RELEASE_GITHUB_TOKEN: - required: true - SEMANTIC_RELEASE_NPM_TOKEN: - required: true - -permissions: - contents: write - issues: write - pull-requests: write - -jobs: - release: - name: Release ${{ inputs.package-name }} - runs-on: ubuntu-latest - defaults: - run: - working-directory: ${{ inputs.package-path }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Install dependencies - run: npm ci - - - name: Build - run: npm run build - - - name: Run tests - run: npm test - - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} - run: npx semantic-release \ No newline at end of file diff --git a/.github/workflows/stale-issue-helper.yaml b/.github/workflows/stale-issue-helper.yaml deleted file mode 100644 index 067f4c60fc6..00000000000 --- a/.github/workflows/stale-issue-helper.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: "Label / close stale issues" -on: - schedule: - - cron: "30 1 * * *" - -jobs: - stale: - permissions: - issues: write - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v9 - with: - close-issue-message: "This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, please reopen + comment and we'll gladly take another look!" - stale-issue-message: "This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue." - days-before-stale: 90 - days-before-close: 10 - days-before-pr-stale: -1 - days-before-pr-close: -1 - operations-per-run: 1000 - stale-issue-label: "stale" - stale-pr-label: "stale" - exempt-issue-labels: "needs-triage,no-stale,high,highest" - exempt-pr-labels: "no-stale" diff --git a/.github/workflows/submit-github-dependency-graph.yml b/.github/workflows/submit-github-dependency-graph.yml deleted file mode 100644 index 50987cc2cca..00000000000 --- a/.github/workflows/submit-github-dependency-graph.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Submit Gradle Dependency Graph For Dependabot - -on: - push: - branches: ["main"] - -permissions: - contents: write - -jobs: - dependency-submission: - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: 17 - - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@v4 - with: - # The gradle project is not in the root of the repository. - build-root-directory: extensions/intellij diff --git a/.github/workflows/vscode-version-bump.yml b/.github/workflows/vscode-version-bump.yml deleted file mode 100644 index c05da185f28..00000000000 --- a/.github/workflows/vscode-version-bump.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: Create VS Code main release draft -on: - schedule: - # Runs at 7 AM PST (15:00 UTC) every Friday - - cron: "0 15 * * 5" - workflow_dispatch: - # Allows manual triggering - -jobs: - version-bump: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history and tags - - - name: Setup GitHub CLI - run: | - gh auth login --with-token <<< "${{ github.token }}" - - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Find and process version tags - run: | - echo "Starting version bump process..." - - # Find last v1.1.x-vscode tag that's at least 6 days old - CURRENT_TIMESTAMP=$(date +%s) - SIX_DAYS_AGO=$((CURRENT_TIMESTAMP - 6*24*60*60)) - echo "Current timestamp: $(date -d @${CURRENT_TIMESTAMP})" - echo "Six days ago: $(date -d @${SIX_DAYS_AGO})" - - echo "Looking for v1.1.x-vscode tags..." - git for-each-ref --sort=-creatordate --format '%(refname:short) %(creatordate:iso)' refs/tags | grep 'v1\.1\.[0-9]\+-vscode' || echo "No matching tags found" - - LAST_1_1_TAG=$(git for-each-ref --sort=-creatordate --format '%(refname:short) %(creatordate:unix)' refs/tags \ - | grep 'v1\.1\.[0-9]\+-vscode' \ - | while read tag timestamp; do - if [ $timestamp -le $SIX_DAYS_AGO ]; then - echo ${tag% *} - break - fi - done) - - echo "Selected v1.1.x tag: $LAST_1_1_TAG" - if [ -z "$LAST_1_1_TAG" ]; then - echo "::error::No suitable v1.1.x-vscode tag found" - exit 1 - fi - - # Find last v1.0.y-vscode tag - echo "Looking for v1.0.y-vscode tags..." - git tag --sort=-v:refname | grep '^v1\.0\.[0-9]\+-vscode' || echo "No matching tags found" - - LAST_1_0_TAG=$(git tag --sort=-v:refname | grep '^v1\.0\.[0-9]\+-vscode' | head -n1) - echo "Selected v1.0.y tag: $LAST_1_0_TAG" - if [ -z "$LAST_1_0_TAG" ]; then - echo "::error::No v1.0.y-vscode tag found" - exit 1 - fi - - # Extract the y number and increment it - Y_NUMBER=$(echo $LAST_1_0_TAG | sed 's/v1\.0\.\([0-9]\+\)-vscode/\1/') - NEXT_Y=$((Y_NUMBER + 1)) - NEW_BRANCH="v1.0.${NEXT_Y}-vscode" - NEW_VERSION="1.0.${NEXT_Y}" - echo "Current Y number: $Y_NUMBER" - echo "Next Y number: $NEXT_Y" - echo "New branch name: $NEW_BRANCH" - echo "New version: $NEW_VERSION" - - # Create new branch from the v1.1.x tag - echo "Creating new branch from $LAST_1_1_TAG..." - git checkout $LAST_1_1_TAG - git checkout -b $NEW_BRANCH - - # Update the version in package.json - echo "Current package.json version:" - cat extensions/vscode/package.json | grep version - - echo "Updating version in package.json..." - jq ".version = \"$NEW_VERSION\"" extensions/vscode/package.json > temp.json && mv temp.json extensions/vscode/package.json - - echo "New package.json version:" - cat extensions/vscode/package.json | grep version - - # Configure git - echo "Configuring git..." - git config user.name "GitHub Actions Bot" - git config user.email "actions@github.com" - - # Commit and push changes - echo "Committing changes..." - git add extensions/vscode/package.json - git commit -m "Bump VS Code extension to ${NEW_VERSION}" - - echo "Pushing branch to origin..." - git push origin $NEW_BRANCH - - # Add release creation - echo "Creating draft release..." - gh release create "${NEW_BRANCH}" \ - --title "${NEW_BRANCH}" \ - --generate-notes \ - --draft \ - --latest \ - --notes-start-tag "${LAST_1_0_TAG}" - - echo "Version bump process completed successfully!" - - - name: Check for errors - if: failure() - run: | - echo "::error::Failed to process version tags and create new branch" - echo "Last few lines of git log:" - git log -n 5 --oneline - echo "Current git status:" - git status - echo "Current branches:" - git branch -a diff --git a/core/protocol/core.ts b/core/protocol/core.ts index f06d1db042a..e5d5e6de736 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -53,6 +53,7 @@ export enum OnboardingModes { export interface ListHistoryOptions { offset?: number; limit?: number; + workspaceDirectory?: string; } export type ToCoreFromIdeOrWebviewProtocol = { diff --git a/core/util/history.ts b/core/util/history.ts index ab332a11b33..36d777852a9 100644 --- a/core/util/history.ts +++ b/core/util/history.ts @@ -32,7 +32,16 @@ class HistoryManager { let sessions = safeParseArray(content) ?? []; sessions = sessions.filter((session: any) => { // Filter out old format - return typeof session.session_id !== "string"; + if (typeof session.session_id === "string") { + return false; + } + + // Filter by workspace directory if specified + if (options.workspaceDirectory && session.workspaceDirectory !== options.workspaceDirectory) { + return false; + } + + return true; }); // Apply limit and offset diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 35d10c3f923..8780ab1e28d 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "1.1.60", + "version": "1.1.63", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.60", + "version": "1.1.63", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index c731b761b86..77c86edc604 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -8,7 +8,7 @@ import { ContextItemsPeek } from "./belowMainInput/ContextItemsPeek"; import { RulesPeek } from "./belowMainInput/RulesPeek"; import { GradientBorder } from "./GradientBorder"; import { ToolbarOptions } from "./InputToolbar"; -import { Lump } from "./Lump"; +// import { Lump } from "./Lump"; import { TipTapEditor } from "./TipTapEditor"; interface ContinueInputBoxProps { @@ -88,7 +88,7 @@ function ContinueInputBox(props: ContinueInputBoxProps) { data-testid={`continue-input-box-${props.inputId}`} >
- {props.isMainInput && } + {/* {props.isMainInput && } */} { void initialLoadAuthAndConfig(true); - const interval = setInterval(() => { + let mounted = true; + + const loadInitialData = async () => { + if (!mounted) return; + + // Get the current workspace directory from the IDE + let workspaceDirectory: string | undefined; + try { + const response = await ideMessenger.request("getWorkspaceDirs", undefined); + if (Array.isArray(response) && response.length > 0) { + workspaceDirectory = response[0]; + } + } catch (e) { + console.warn("Failed to get workspace directory", e); + } + if (hasDoneInitialConfigLoad.current) { // Init to run on initial config load ideMessenger.post("docs/initStatuses", undefined); void dispatch(updateFileSymbolsFromHistory()); - void dispatch(refreshSessionMetadata({})); - - // This triggers sending pending status to the GUI for relevant docs indexes - clearInterval(interval); + void dispatch(refreshSessionMetadata({ workspaceDirectory })); } else { - void initialLoadAuthAndConfig(true); + // If config isn't loaded yet, try again after a delay + setTimeout(loadInitialData, 2000); } - }, 2_000); - - return () => clearInterval(interval); - }, [hasDoneInitialConfigLoad, initialLoadAuthAndConfig, ideMessenger]); + }; + + // Initial load + loadInitialData(); + + return () => { + mounted = false; + }; + }, [hasDoneInitialConfigLoad, initialLoadAuthAndConfig, ideMessenger, dispatch]); useWebviewListener( "configUpdate", diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 383f18241d7..195a35c263b 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -38,7 +38,7 @@ import { updateToolCallOutput, } from "../../redux/slices/sessionSlice"; import { streamEditThunk } from "../../redux/thunks/edit"; -import { loadLastSession } from "../../redux/thunks/session"; +import { loadLastSession, refreshSessionMetadata } from "../../redux/thunks/session"; import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util"; import { ToolCallDiv } from "./ToolCallDiv"; @@ -94,6 +94,41 @@ export function Chat() { (store) => store.config?.config.selectedModelByRole, ); const isStreaming = useAppSelector((state) => state.session.isStreaming); + + // Track the current workspace directory + const [workspaceDirectory, setWorkspaceDirectory] = useState(); + + // Load the current workspace directory and refresh session metadata when it changes + useEffect(() => { + let isMounted = true; + + const loadWorkspaceDirectory = async () => { + try { + const response = await ideMessenger.request("getWorkspaceDirs", undefined); + if (isMounted && Array.isArray(response) && response.length > 0) { + const newWorkspaceDirectory = response[0]; + if (newWorkspaceDirectory !== workspaceDirectory) { + setWorkspaceDirectory(newWorkspaceDirectory); + // Refresh session metadata with the new workspace directory + await dispatch(refreshSessionMetadata({ workspaceDirectory: newWorkspaceDirectory })); + } + } + } catch (e) { + console.warn("Failed to get workspace directory", e); + } + }; + + // Initial load + loadWorkspaceDirectory(); + + // Set up a polling mechanism to check for workspace changes + const pollInterval = setInterval(loadWorkspaceDirectory, 5000); + + return () => { + isMounted = false; + clearInterval(pollInterval); + }; + }, [dispatch, ideMessenger, workspaceDirectory]); const [stepsOpen] = useState<(boolean | undefined)[]>([]); const mainTextInputRef = useRef(null); const stepsDivRef = useRef(null); diff --git a/gui/src/redux/thunks/session.ts b/gui/src/redux/thunks/session.ts index b42090e67c4..3c476a6653e 100644 --- a/gui/src/redux/thunks/session.ts +++ b/gui/src/redux/thunks/session.ts @@ -34,12 +34,14 @@ export const refreshSessionMetadata = createAsyncThunk< { offset?: number; limit?: number; + workspaceDirectory?: string; }, ThunkApiType ->("session/refreshMetadata", async ({ offset, limit }, { dispatch, extra }) => { +>("session/refreshMetadata", async ({ offset, limit, workspaceDirectory }, { dispatch, extra }) => { const result = await extra.ideMessenger.request("history/list", { limit, offset, + workspaceDirectory, }); if (result.status === "error") { throw new Error(result.error); @@ -76,10 +78,11 @@ export const updateSession = createAsyncThunk( updateSessionMetadata({ sessionId: session.sessionId, title: session.title, + workspaceDirectory: session.workspaceDirectory, }), ); // optimistic session metadata update await extra.ideMessenger.request("history/save", session); - await dispatch(refreshSessionMetadata({})); + await dispatch(refreshSessionMetadata({ workspaceDirectory: session.workspaceDirectory })); }, ); @@ -118,20 +121,48 @@ export const loadLastSession = createAsyncThunk< ThunkApiType >( "session/loadLast", - async ({ saveCurrentSession }, { extra, dispatch, getState }) => { + async ({ saveCurrentSession: shouldSaveCurrentSession }, { extra, dispatch, getState }) => { const state = getState(); - if (state.session.id && saveCurrentSession) { + // Get the current workspace directory from the IDE + let workspaceDirectory: string | undefined; + try { + const response = await extra.ideMessenger.request("getWorkspaceDirs", undefined); + if (Array.isArray(response) && response.length > 0) { + workspaceDirectory = response[0]; + } + } catch (e) { + console.warn("Failed to get workspace directory", e); } - const lastSessionId = getState().session.lastSessionId; - if (!lastSessionId) { - dispatch(newSession()); - return; + // Save current session if needed + if (state.session.id && shouldSaveCurrentSession) { + await dispatch( + saveCurrentSession({ + openNewSession: false, + generateTitle: true, + }) + ); } - const session = await getSession(extra.ideMessenger, lastSessionId); - dispatch(newSession(session)); + // Get the last session ID from the current workspace + const metadataResult = await dispatch( + refreshSessionMetadata({ + limit: 1, + workspaceDirectory + }) + ); + + const metadata = metadataResult.payload as SessionMetadata[] | undefined; + const lastSession = metadata?.[0]; + + if (lastSession) { + const session = await getSession(extra.ideMessenger, lastSession.sessionId); + dispatch(newSession(session)); + } else { + // If no sessions found in the current workspace, start a new one + dispatch(newSession()); + } }, ); @@ -161,6 +192,17 @@ export const saveCurrentSession = createAsyncThunk< return; } + // Get the current workspace directory from the IDE + let workspaceDirectory = ""; + try { + const response = await extra.ideMessenger.request("getWorkspaceDirs", undefined); + if (Array.isArray(response) && response.length > 0) { + workspaceDirectory = response[0]; + } + } catch (e) { + console.warn("Failed to get workspace directory", e); + } + if (openNewSession) { dispatch(newSession()); } @@ -213,7 +255,7 @@ export const saveCurrentSession = createAsyncThunk< const session: Session = { sessionId: state.session.id, title, - workspaceDirectory: window.workspacePaths?.[0] || "", + workspaceDirectory, history: state.session.history, };