From fe118e0885ecb3176616815becb1e06646201a80 Mon Sep 17 00:00:00 2001 From: Carlos Gutierrez Date: Wed, 18 Mar 2026 23:20:00 -0400 Subject: [PATCH] fixing github actions --- .github/workflows/lua.yaml | 115 +++++------- .github/workflows/pre-commit.yaml | 38 ---- .github/workflows/release.yaml | 218 +++++------------------ .github/workflows/rust.yaml | 31 ---- lua/codetyper/adapters/nvim/commands.lua | 7 +- lua/codetyper/init.lua | 6 +- 6 files changed, 106 insertions(+), 309 deletions(-) delete mode 100644 .github/workflows/pre-commit.yaml delete mode 100644 .github/workflows/rust.yaml diff --git a/.github/workflows/lua.yaml b/.github/workflows/lua.yaml index 65b7349..70d690d 100644 --- a/.github/workflows/lua.yaml +++ b/.github/workflows/lua.yaml @@ -2,85 +2,64 @@ name: Lua CI on: push: - branches: - - main + branches: [master] paths: - - "**/*.lua" + - "lua/**/*.lua" + - "plugin/**/*.lua" - .github/workflows/lua.yaml pull_request: - branches: - - main + branches: [master] paths: - - "**/*.lua" + - "lua/**/*.lua" + - "plugin/**/*.lua" - .github/workflows/lua.yaml jobs: - # reference from: https://github.com/nvim-lua/plenary.nvim/blob/2d9b06177a975543726ce5c73fca176cedbffe9d/.github/workflows/default.yml#L6C3-L43C20 - run_tests: - name: unit tests - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-22.04 - rev: v0.10.0 - steps: - - uses: actions/checkout@v6 - - - id: todays-date - run: echo "date=$(date +%F)" >> "$GITHUB_OUTPUT" - - - name: Restore cache for today's nightly. - id: cache-neovim - uses: actions/cache@v4 - with: - path: _neovim - key: ${{ runner.os }}-${{ matrix.rev }}-${{ steps.todays-date.outputs.date }} - - - name: Download neovim ${{ matrix.rev }} - env: - GH_TOKEN: ${{ github.token }} - NEOVIM_VERSION: ${{ matrix.rev }} - if: steps.cache-neovim.outputs.cache-hit != 'true' - run: | - mkdir -p _neovim - gh release download \ - --output - \ - --pattern nvim-linux64.tar.gz \ - --repo neovim/neovim \ - "$NEOVIM_VERSION" | tar xvz --strip-components 1 --directory _neovim - - - name: Prepare - run: | - sudo apt-get update - sudo apt-get install -y ripgrep - sudo apt-get install -y silversearcher-ag - echo "${PWD}/_neovim/bin" >> "$GITHUB_PATH" - echo VIM="${PWD}/_neovim/share/nvim/runtime" >> "$GITHUB_ENV" - - - name: Run tests - run: | - nvim --version - make luatest - - typecheck: - name: Typecheck + lint: + name: Luacheck runs-on: ubuntu-latest - strategy: - matrix: - nvim_version: [ stable ] - luals_version: [ 3.13.6 ] steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v4 - - uses: rhysd/action-setup-vim@v1 + - uses: leafo/gh-actions-lua@v11 + with: + luaVersion: "5.1" + + - uses: leafo/gh-actions-luarocks@v5 + + - name: Install luacheck + run: luarocks install luacheck + + - name: Run luacheck + run: luacheck lua/ plugin/ --globals vim describe it before_each after_each assert --no-max-line-length + + stylua: + name: StyLua format check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + version: latest + args: --check lua/ plugin/ + + health: + name: Plugin load check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Neovim + uses: rhysd/action-setup-vim@v1 with: neovim: true - version: ${{ matrix.nvim_version }} + version: stable - - name: Typecheck - env: - VIMRUNTIME: /home/runner/nvim-${{ matrix.nvim_version }}/share/nvim/runtime + - name: Verify plugin loads run: | - make lua-typecheck + nvim --headless -u NONE \ + -c "set rtp+=." \ + -c "lua require('codetyper')" \ + -c "qa!" 2>&1 diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index b90dba6..0000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: pre-commit - -on: - pull_request: - types: [labeled, opened, reopened, synchronize] - push: - branches: [main, test-me-*] - -jobs: - pre-commit: - if: "github.event.action != 'labeled' || github.event.label.name == 'pre-commit ci run'" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run' - if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run' - env: - GH_TOKEN: ${{ github.token }} - - uses: actions/setup-python@v3 - with: - python-version: '3.11' - - name: Install uv - uses: astral-sh/setup-uv@v5 - - run: | - uv venv - source .venv/bin/activate - uv pip install -r py/rag-service/requirements.txt - - uses: leafo/gh-actions-lua@v11 - - uses: leafo/gh-actions-luarocks@v5 - - run: luarocks install luacheck - - name: Install stylua from crates.io - uses: baptiste0928/cargo-install@v3 - with: - crate: stylua - args: --features lua54 - - uses: pre-commit/action@v3.0.1 - - uses: pre-commit-ci/lite-action@v1.1.0 - if: always() diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6ba9f1f..44925ab 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,184 +2,64 @@ name: Release on: push: - tags: [v\d+\.\d+\.\d+] + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" permissions: contents: write - packages: write - -env: - CARGO_TERM_COLOR: always jobs: - create-release: - permissions: - contents: write - runs-on: ubuntu-24.04 - outputs: - release_id: ${{ steps.create-release.outputs.id }} - release_upload_url: ${{ steps.create-release.outputs.upload_url }} - release_body: "${{ steps.tag.outputs.message }}" - + release: + name: Create GitHub Release + runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Get version - id: get_version - uses: battila7/get-version-action@d97fbc34ceb64d1f5d95f4dfd6dce33521ccccf5 # ratchet:battila7/get-version-action@v2 + - name: Get version from tag + id: version + run: echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" - - name: Get tag message - id: tag + - name: Extract changelog for this version + id: changelog run: | - git fetch --depth=1 origin +refs/tags/*:refs/tags/* - echo "message<> $GITHUB_OUTPUT - echo "$(git tag -l --format='%(contents)' ${{ steps.get_version.outputs.version }})" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + version="${{ steps.version.outputs.version }}" + # Strip leading 'v' for matching in CHANGELOG.md + semver="${version#v}" + + # Extract the section for this version from CHANGELOG.md + body=$(awk -v ver="$semver" ' + /^## \[/ { + if (found) exit + if (index($0, ver)) found=1 + next + } + found { print } + ' CHANGELOG.md) + + if [ -z "$body" ]; then + body="Release $version" + fi + + # Write to file to avoid escaping issues + echo "$body" > /tmp/release_body.md + + - name: Generate help tags + uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: stable + + - name: Verify help tags + run: nvim --headless -c "helptags doc/" -c "qa" 2>/dev/null || true - name: Create Release - id: create-release - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # ratchet:ncipollo/release-action@v1 + uses: ncipollo/release-action@v1 with: - draft: true - name: "avante-libs ${{ steps.get_version.outputs.version }}" - tag: ${{ steps.get_version.outputs.version }} - body: "${{ steps.tag.outputs.message }}" - - releases-matrix: - needs: [create-release] - strategy: - fail-fast: false - matrix: - feature: [lua51, luajit] - config: - - os: ubuntu-24.04-arm - os_name: linux - arch: aarch64 - rust_target: aarch64-unknown-linux-gnu - docker_platform: linux/aarch64 - container: quay.io/pypa/manylinux2014_aarch64 - - os: ubuntu-latest - os_name: linux - arch: x86_64 - rust_target: x86_64-unknown-linux-gnu - docker_platform: linux/amd64 - container: quay.io/pypa/manylinux2014_x86_64 # for glibc 2.17 - - os: macos-13 - os_name: darwin - arch: x86_64 - rust_target: x86_64-apple-darwin - - os: macos-latest - os_name: darwin - arch: aarch64 - rust_target: aarch64-apple-darwin - - os: windows-latest - os_name: windows - arch: x86_64 - rust_target: x86_64-pc-windows-msvc - - os: windows-latest - os_name: windows - arch: aarch64 - rust_target: aarch64-pc-windows-msvc - - runs-on: ${{ matrix.config.os }} - - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2 - if: ${{ matrix.config.container == null }} - - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master - if: ${{ matrix.config.container == null }} - with: - targets: ${{ matrix.config.rust_target }} - toolchain: "1.85.0" - - name: Build all crates - if: ${{ matrix.config.container == null }} - run: | - cargo build --release --features ${{ matrix.feature }} - - - name: Build all crates with glibc 2.17 # for glibc 2.17 - if: ${{ matrix.config.container != null }} - run: | - # sudo apt-get install -y qemu qemu-user-static - docker run \ - --rm \ - -v $(pwd):/workspace \ - -w /workspace \ - --platform ${{ matrix.config.docker_platform }} \ - ${{ matrix.config.container }} \ - bash -c "yum install -y perl-IPC-Cmd openssl-devel && curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && . /root/.cargo/env && cargo build --release --features ${{ matrix.feature }}" - - - name: Handle binaries - if: ${{ matrix.config.os_name != 'windows' }} - shell: bash - run: | - mkdir -p results - if [ "${{ matrix.config.os_name }}" == "linux" ]; then - EXT="so" - else - EXT="dylib" - fi - cp target/release/libavante_templates.$EXT results/avante_templates.$EXT - cp target/release/libavante_tokenizers.$EXT results/avante_tokenizers.$EXT - cp target/release/libavante_repo_map.$EXT results/avante_repo_map.$EXT - cp target/release/libavante_html2md.$EXT results/avante_html2md.$EXT - - cd results - tar zcvf avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz *.${EXT} - - - name: Handle binaries (Windows) - if: ${{ matrix.config.os_name == 'windows' }} - shell: pwsh - run: | - New-Item -ItemType Directory -Force -Path results - - Copy-Item -Path "target\release\avante_templates.dll" -Destination "results\avante_templates.dll" - Copy-Item -Path "target\release\avante_tokenizers.dll" -Destination "results\avante_tokenizers.dll" - Copy-Item -Path "target\release\avante_repo_map.dll" -Destination "results\avante_repo_map.dll" - Copy-Item -Path "target\release\avante_html2md.dll" -Destination "results\avante_html2md.dll" - - Set-Location -Path results - - $dllFiles = Get-ChildItem -Filter "*.dll" | Select-Object -ExpandProperty Name - Compress-Archive -Path $dllFiles -DestinationPath "avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip" - - - name: Upload Release Asset - uses: shogo82148/actions-upload-release-asset@8482bd769644976d847e96fb4b9354228885e7b4 # ratchet:shogo82148/actions-upload-release-asset@v1 - if: ${{ matrix.config.os_name != 'windows' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ASSET_NAME: avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz - with: - upload_url: ${{ needs.create-release.outputs.release_upload_url }} - asset_path: ./results/avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz - - name: Upload Release Asset (Windows) - uses: shogo82148/actions-upload-release-asset@8482bd769644976d847e96fb4b9354228885e7b4 # ratchet:shogo82148/actions-upload-release-asset@v1 - if: ${{ matrix.config.os_name == 'windows' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ASSET_NAME: avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip - with: - upload_url: ${{ needs.create-release.outputs.release_upload_url }} - asset_path: ./results/avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip - - publish-release: - permissions: - contents: write - runs-on: ubuntu-24.04 - needs: [create-release, releases-matrix] - - steps: - - name: publish release - id: publish-release - uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # ratchet:actions/github-script@v6 - env: - release_id: ${{ needs.create-release.outputs.release_id }} - with: - script: | - github.rest.repos.updateRelease({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: process.env.release_id, - draft: false, - prerelease: false - }) + name: "codetyper.nvim ${{ steps.version.outputs.version }}" + tag: ${{ steps.version.outputs.version }} + bodyFile: /tmp/release_body.md + draft: false + prerelease: ${{ contains(steps.version.outputs.version, '-') }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml deleted file mode 100644 index 4c3519c..0000000 --- a/.github/workflows/rust.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: Rust CI - -on: - push: - branches: - - main - paths: - - "crates/**/*" - - "Cargo.lock" - - "Cargo.toml" - pull_request: - branches: - - main - paths: - - "crates/**/*" - - "Cargo.lock" - - "Cargo.toml" - -jobs: - tests: - name: Run Rust tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 - - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2 - - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master - with: - toolchain: stable - components: clippy, rustfmt - - name: Run rust tests - run: cargo test --features luajit diff --git a/lua/codetyper/adapters/nvim/commands.lua b/lua/codetyper/adapters/nvim/commands.lua index 09cfeb5..2d54427 100644 --- a/lua/codetyper/adapters/nvim/commands.lua +++ b/lua/codetyper/adapters/nvim/commands.lua @@ -220,9 +220,13 @@ local function cmd_llm_reset_stats() end local function coder_cmd(args) - local subcommand = args.fargs[1] or "toggle" + local subcommand = args.fargs[1] or "version" local commands = { + ["version"] = function() + local codetyper = require("codetyper") + utils.notify("Codetyper.nvim " .. codetyper.version, vim.log.levels.INFO) + end, tree = cmd_tree, ["tree-view"] = cmd_tree_view, reset = cmd_reset, @@ -287,6 +291,7 @@ function M.setup() nargs = "?", complete = function() return { + "version", "tree", "tree-view", "reset", diff --git a/lua/codetyper/init.lua b/lua/codetyper/init.lua index d0823d1..1ac1766 100644 --- a/lua/codetyper/init.lua +++ b/lua/codetyper/init.lua @@ -1,14 +1,16 @@ ---@mod codetyper Codetyper.nvim - AI-powered coding partner ---@brief [[ --- Codetyper.nvim is a Neovim plugin that acts as your coding partner. ---- It uses LLM APIs (OpenAI, Gemini, Copilot, Ollama) to help you ---- write code faster using special `.codetyper/*` files and inline prompt tags. +--- It uses LLM APIs (Copilot, Ollama) to help you write code faster +--- with inline prompt tags and visual selection transforms. --- Features an event-driven scheduler with confidence scoring and --- completion-aware injection timing. ---@brief ]] local M = {} +M.version = "0.7.0-dev" + ---@type CoderConfig M.config = {}