From 55a3a6396786dee6a5786be7680bec9255735b68 Mon Sep 17 00:00:00 2001 From: mavantgarderc Date: Wed, 3 Dec 2025 05:48:36 +0330 Subject: [PATCH 1/3] chore(lint): stylua & luacheck applied --- lua/raphael/config.lua | 2 +- lua/raphael/core/init.lua | 24 ++++++++++++------------ lua/raphael/core/samples.lua | 2 +- lua/raphael/picker/keymaps.lua | 2 +- lua/raphael/picker/preview.lua | 8 ++------ lua/raphael/picker/render.lua | 6 ++---- 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/lua/raphael/config.lua b/lua/raphael/config.lua index 3d929f1..6c9d3fb 100644 --- a/lua/raphael/config.lua +++ b/lua/raphael/config.lua @@ -102,7 +102,7 @@ M.defaults = { icons = vim.deepcopy(constants.ICON), - on_apply = function(theme) + on_apply = function(_theme) vim.schedule(function() local ok, lualine = pcall(require, "lualine") if ok then diff --git a/lua/raphael/core/init.lua b/lua/raphael/core/init.lua index 8e6d4e1..ab08fa7 100644 --- a/lua/raphael/core/init.lua +++ b/lua/raphael/core/init.lua @@ -34,18 +34,18 @@ M.config = {} --- In-memory state mirror of what is persisted via cache. --- This is NOT the only source of truth; cache is canonical. ---@class RaphaelState ----@field current? string -- currently active theme ----@field saved? string -- last manually saved theme ----@field previous? string -- theme before current (for quick revert) ----@field auto_apply boolean -- whether BufEnter/FileType auto-apply is enabled ----@field bookmarks table -- scope -> list of bookmarked themes ----@field history string[] -- recent themes (newest first) ----@field usage table -- usage count per theme ----@field collapsed table -- group collapse state ----@field sort_mode string -- current sort mode ("alpha", "recent", "usage", or custom) ----@field undo_history table -- detailed undo stack (managed by extras.history/cache) +---@field current? string -- currently active theme +---@field saved? string -- last manually saved theme +---@field previous? string -- theme before current (for quick revert) +---@field auto_apply boolean -- whether BufEnter/FileType auto-apply is enabled +---@field bookmarks table -- scope -> list of bookmarked themes +---@field history string[] -- recent themes (newest first) +---@field usage table -- usage count per theme +---@field collapsed table -- group collapse state +---@field sort_mode string -- current sort mode ("alpha", "recent", "usage", or custom) +---@field undo_history table -- detailed undo stack (managed by extras.history/cache) ---@field quick_slots table> -- scope -> slot("0"-"9")->theme_name ----@field current_profile? string -- active profile name (if any) +---@field current_profile? string -- active profile name (if any) M.state = { current = nil, saved = nil, @@ -248,7 +248,7 @@ function M.save_state() end function M.toggle_auto() - M.state.auto_apply = not (M.state.auto_apply == true) + M.state.auto_apply = not (M.state.auto_apply == true) -- luacheck: ignore cache.set_auto_apply(M.state.auto_apply) vim.api.nvim_set_var("raphael_auto_theme", M.state.auto_apply) diff --git a/lua/raphael/core/samples.lua b/lua/raphael/core/samples.lua index ed18793..09249ad 100644 --- a/lua/raphael/core/samples.lua +++ b/lua/raphael/core/samples.lua @@ -300,7 +300,7 @@ class ApiClient { // TODO: Add request timeout const response = await fetch(`${this.baseUrl}/users/${id}`); const data = await response.json(); - + const user = UserSchema.parse(data); this.cache.set(`user_${id}`, user); diff --git a/lua/raphael/picker/keymaps.lua b/lua/raphael/picker/keymaps.lua index 3287e5e..de40209 100644 --- a/lua/raphael/picker/keymaps.lua +++ b/lua/raphael/picker/keymaps.lua @@ -335,7 +335,7 @@ function M.attach(ctx, fns) local state = ctx.state local base_title = ctx.base_title - local opts = ctx.opts + -- local opts = ctx.opts --- Expand all groups that contain the given theme in themes.theme_map. --- diff --git a/lua/raphael/picker/preview.lua b/lua/raphael/picker/preview.lua index 2146cb0..963f30f 100644 --- a/lua/raphael/picker/preview.lua +++ b/lua/raphael/picker/preview.lua @@ -293,9 +293,7 @@ local function get_active_theme_label(ctx) end end - return active_preview_theme - or (ctx.core.state and ctx.core.state.current) - or "?" + return active_preview_theme or (ctx.core.state and ctx.core.state.current) or "?" end --- Update code preview buffer based on current_lang and preview/compare state. @@ -447,9 +445,7 @@ function M.toggle_compare(ctx, candidate_theme) return end - local base = (ctx.core.state and ctx.core.state.current) - or vim.g.colors_name - or ctx.core.config.default_theme + local base = (ctx.core.state and ctx.core.state.current) or vim.g.colors_name or ctx.core.config.default_theme if not base or not themes.is_available(base) then vim.notify("raphael: no valid current theme to compare against", vim.log.levels.WARN) diff --git a/lua/raphael/picker/render.lua b/lua/raphael/picker/render.lua index 4eac2d1..09656c9 100644 --- a/lua/raphael/picker/render.lua +++ b/lua/raphael/picker/render.lua @@ -93,7 +93,7 @@ local function debounce(ms, fn) local timer = nil return function(ctx) if timer then - local ok = pcall(function() + local ok = pcall(function() -- luacheck: ignore if timer and not timer:is_closing() then timer:stop() vim.schedule(function() @@ -103,8 +103,6 @@ local function debounce(ms, fn) end) end end) - if not ok then - end timer = nil end timer = vim.defer_fn(function() @@ -149,7 +147,7 @@ local function render_internal(ctx) end local current_group - local current_line = 1 + local current_line = 1 -- luacheck: ignore local current_theme if picker_win and vim.api.nvim_win_is_valid(picker_win) then From 6da93bd10d099d9515fbe850c877b6df01bd93f5 Mon Sep 17 00:00:00 2001 From: mavantgarderc Date: Wed, 3 Dec 2025 05:54:59 +0330 Subject: [PATCH 2/3] maintenance(ci): added ci.yml & .actrc --- .actrc | 3 ++ .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .actrc create mode 100644 .github/workflows/ci.yml diff --git a/.actrc b/.actrc new file mode 100644 index 0000000..2bb0a93 --- /dev/null +++ b/.actrc @@ -0,0 +1,3 @@ +-P ubuntu-latest=catthehacker/ubuntu:act-latest +-P ubuntu-22.04=catthehacker/ubuntu:act-22.04 +-P ubuntu-20.04=catthehacker/ubuntu:act-20.04 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..eaa375d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: CI + +on: + push: + branches: [main, dev] + pull_request: + branches: [main, dev] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + lint: + name: Lint (luacheck + stylua) + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Lua, Luarocks, and luacheck + run: | + sudo apt-get update + sudo apt-get install -y lua5.1 luarocks + sudo luarocks install luacheck + + - name: Run luacheck + run: | + luacheck . lua/* plugin/* + + - name: Run stylua (format check) + uses: JohnnyMorganz/stylua-action@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --check . + + neovim-startup: + name: Neovim startup sanity check + runs-on: ubuntu-latest + needs: lint + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Neovim + run: | + sudo apt-get update + sudo apt-get install -y neovim + + - name: Minimal startup test + run: | + cat << 'EOF' > minimal_init.lua + -- Add current repo to runtimepath so lua/raphael and plugin/ are visible + vim.cmd("set rtp^=.") + -- Basic setup call; adjust options if you want stricter checks + require("raphael").setup({}) + EOF + + nvim --headless -u minimal_init.lua -c 'qa' From a49b31eceebbec4bdd964196c094a5beb733cfcf Mon Sep 17 00:00:00 2001 From: mavantgarderc Date: Wed, 3 Dec 2025 06:09:43 +0330 Subject: [PATCH 3/3] fix(ci): stylua version added --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eaa375d..48e884c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: uses: JohnnyMorganz/stylua-action@v4 with: token: ${{ secrets.GITHUB_TOKEN }} + version: latest args: --check . neovim-startup: