From 4524944daeaf63c0a45aa61ab11c1990dceaba21 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Tue, 18 Nov 2025 11:15:23 -0500 Subject: [PATCH] refactor(core): migrate ai files from claude to ai --- lua/community.lua | 9 --- lua/config/ignore_patterns.lua | 22 +---- lua/lazy_setup.lua | 1 + lua/plugins/astrocore.lua | 143 ++------------------------------- lua/plugins/astrolsp.lua | 22 ++--- lua/plugins/astroui.lua | 34 +------- lua/plugins/avante.lua | 32 ++------ lua/plugins/buildtools.lua | 78 +++++++++++++++++- lua/plugins/neotree.lua | 79 +++++++----------- lua/plugins/supermaven.lua | 22 +++++ lua/polish.lua | 104 ------------------------ 11 files changed, 149 insertions(+), 397 deletions(-) create mode 100644 lua/plugins/supermaven.lua diff --git a/lua/community.lua b/lua/community.lua index a61dace..94a911f 100644 --- a/lua/community.lua +++ b/lua/community.lua @@ -7,33 +7,24 @@ return { "AstroNvim/astrocommunity", version = false, -- Use latest astrocommunity { import = "astrocommunity.pack.bash" }, - { import = "astrocommunity.pack.chezmoi" }, { import = "astrocommunity.pack.lua" }, { import = "astrocommunity.pack.markdown" }, { import = "astrocommunity.pack.json" }, - { import = "astrocommunity.pack.mdx" }, { import = "astrocommunity.pack.go" }, { import = "astrocommunity.pack.golangci-lint" }, { import = "astrocommunity.pack.html-css" }, -- oxlint configured manually in astrolsp.lua via nvim-lint { import = "astrocommunity.pack.toml" }, - { import = "astrocommunity.pack.templ" }, - { import = "astrocommunity.pack.tailwindcss" }, { import = "astrocommunity.pack.typescript" }, { import = "astrocommunity.pack.yaml" }, - { import = "astrocommunity.utility.noice-nvim" }, { import = "astrocommunity.git.octo-nvim" }, { import = "astrocommunity.bars-and-lines.bufferline-nvim" }, { import = "astrocommunity.code-runner.overseer-nvim" }, - { import = "astrocommunity.completion.supermaven-nvim" }, { import = "astrocommunity.completion.blink-cmp" }, { import = "astrocommunity.editing-support.auto-save-nvim" }, { import = "astrocommunity.editing-support.conform-nvim" }, { import = "astrocommunity.lsp.inc-rename-nvim" }, { import = "astrocommunity.lsp.nvim-lsp-file-operations" }, { import = "astrocommunity.colorscheme.cyberdream-nvim" }, - { import = "astrocommunity.recipes.disable-borders" }, - { import = "astrocommunity.recipes.picker-lsp-mappings" }, - { import = "astrocommunity.recipes.telescope-nvim-snacks" }, { import = "astrocommunity.recipes.vscode-icons" }, } diff --git a/lua/config/ignore_patterns.lua b/lua/config/ignore_patterns.lua index 4999209..6917887 100644 --- a/lua/config/ignore_patterns.lua +++ b/lua/config/ignore_patterns.lua @@ -25,23 +25,10 @@ M.patterns = { "*_test.go", -- Configuration files - "*config.*.js", - "*config.js", - "deps.mjs", - ".parcelrc", - "worker-configuration.d.ts", - "wrangler.jsonc", - "biome*", - ".cz.toml", ".editorconfig", ".gitpod.*", - "cspell.*", - -- Documentation - "*_query_docs.md", - "*_tx_docs.md", - "readme.md", - "CLAUDE*", + -- Lock files and dependencies "*.lock", @@ -65,10 +52,6 @@ M.patterns = { ".tsbuildinfo", ".wrangler", ".parcel-cache", - ".aider.tags.cache.v4", - ".aider.tags.cache.v3", - ".aider.chat.history.md", - ".aider.input.history", ".conform*", ".null-ls_*", @@ -92,7 +75,7 @@ M.patterns = { M.never_show = { -- Version control ".git", - ".claude", + ".ai", -- Dependencies "node_modules", @@ -177,7 +160,6 @@ M.never_show_patterns = { ".parcel-cache", "*.icns", "*.ico", - ".aider.tags.cache.v4", "*.iml", "Icon?", "iCloud~", diff --git a/lua/lazy_setup.lua b/lua/lazy_setup.lua index b076d56..9b0a50b 100644 --- a/lua/lazy_setup.lua +++ b/lua/lazy_setup.lua @@ -12,6 +12,7 @@ require("lazy").setup({ }, { import = "community" }, { import = "plugins" }, + { import = "plugins.local" }, } --[[@as LazySpec]], { install = { colorscheme = { "cyberdream" } }, ui = { backdrop = 100 }, diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index 86760d5..076373f 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -314,120 +314,22 @@ return { }, ["gc"] = { function() - local claude_dir = vim.fn.getcwd() .. "/.claude" + local ai_dir = vim.fn.getcwd() .. "/.ai" -- Check if directory exists - if vim.fn.isdirectory(claude_dir) == 0 then - vim.notify("No .claude directory found in current project", vim.log.levels.WARN) + if vim.fn.isdirectory(ai_dir) == 0 then + vim.notify("No .ai directory found in current project", vim.log.levels.WARN) return end - -- Use files picker to find Claude files + -- Use files picker to find AI files require("snacks").picker.files { - cwd = claude_dir, + cwd = ai_dir, transform = file_filter, } end, - desc = "Find Claude files", + desc = "Find AI files", }, ["p"] = { desc = "Find Package files" }, - ["pc"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/code/github.com/sonr-io/sonr/packages/cli" }, - exclude = { "packages/cli/dist" }, - ft = { "ts", "tsx", "js" }, - } - end, - desc = "Find @sonr.io/cli files", - }, - ["pe"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/code/github.com/sonr-io/sonr/packages/es" }, - exclude = { "packages/es/dist" }, - ft = { "ts", "tsx", "js" }, - } - end, - desc = "Find @sonr.io/es files", - }, - ["pp"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/code/github.com/sonr-io/sonr/packages/pkl" }, - exclude = { "packages/pkl/dist" }, - ft = { "ts", "tsx", "js" }, - } - end, - desc = "Find @sonr.io/es files", - }, - ["ps"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/code/github.com/sonr-io/sonr/packages/sdk" }, - exclude = { "packages/sdk/dist" }, - ft = { "ts", "tsx", "js" }, - } - end, - desc = "Find @sonr.io/sdk files", - }, - ["pu"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/code/github.com/sonr-io/sonr/packages/ui" }, - exclude = { "packages/ui/dist" }, - ft = { "ts", "tsx", "js" }, - } - end, - desc = "Find @sonr.io/ui files", - }, ["m"] = { desc = "Find Module files" }, - ["me"] = { - function() - require("snacks").picker.files { - dirs = { - "/home/prad/code/github.com/sonr-io/sonr/proto/dex", - "/home/prad/code/github.com/sonr-io/sonr/x/dex", - }, - ft = { "go", "md", "proto" }, - } - end, - desc = "Find x/dex files", - }, - ["mi"] = { - function() - require("snacks").picker.files { - dirs = { - "/home/prad/code/github.com/sonr-io/sonr/proto/did", - "/home/prad/code/github.com/sonr-io/sonr/x/did", - }, - ft = { "go", "md", "proto" }, - } - end, - desc = "Find x/did files", - }, - ["md"] = { - function() - require("snacks").picker.files { - dirs = { - "/home/prad/code/github.com/sonr-io/sonr/proto/dwn", - "/home/prad/code/github.com/sonr-io/sonr/x/dwn", - }, - ft = { "go", "md", "proto" }, - } - end, - desc = "Find x/dwn files", - }, - ["ms"] = { - function() - require("snacks").picker.files { - dirs = { - "/home/prad/code/github.com/sonr-io/sonr/proto/svc", - "/home/prad/code/github.com/sonr-io/sonr/x/svc", - }, - ft = { "go", "md", "proto" }, - } - end, - desc = "Find x/svc files", - }, ["g"] = { desc = "Find by Group", }, @@ -480,38 +382,7 @@ return { end, desc = "Find Package.json files", }, - ["."] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/.local/share/chezmoi" }, - } - end, - desc = "Find dotfiles", - }, - ["c."] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/.local/share/chezmoi" }, - } - end, - desc = "Find chezmoi config files", - }, - ["cn"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/code/github.com/prnk28/nvim" }, - } - end, - desc = "Find nvim files", - }, - ["cs"] = { - function() - require("snacks").picker.files { - dirs = { "/home/prad/.local/share/chezmoi/dot_local/share/services" }, - } - end, - desc = "Find Service files", - }, + [""] = { function() terminals.scratch_toggle() end, desc = "Open Scratch Terminal" }, -- AI/Assistant mappings (Avante) [""] = { nil, desc = "Avante AI" }, diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua index df12c94..aea31f6 100644 --- a/lua/plugins/astrolsp.lua +++ b/lua/plugins/astrolsp.lua @@ -275,10 +275,11 @@ return { enable = true, url = "https://www.schemastore.org/api/json/catalog.json", }, - schemas = { - ["https://json.schemastore.org/github-workflow.json"] = ".github/workflows/*.yml", - ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = "docker-compose*.yml", - }, + schemas = { + ["https://json.schemastore.org/github-workflow.json"] = ".github/workflows/*.yml", + ["https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json"] = + "docker-compose*.yml", + }, validate = true, hover = true, completion = true, @@ -670,19 +671,6 @@ return { }, -- ============================================================================ - -- Diagnostics UI - -- ============================================================================ - { - "folke/trouble.nvim", - optional = true, - opts = { - modes = { - lsp = { - win = { position = "right" }, - }, - }, - }, - }, -- Inline linting hints { diff --git a/lua/plugins/astroui.lua b/lua/plugins/astroui.lua index a4e9005..f592486 100644 --- a/lua/plugins/astroui.lua +++ b/lua/plugins/astroui.lua @@ -13,39 +13,7 @@ return { GitChange = "", GitDelete = "", }, - -- modify variables used by heirline but not defined in the setup call directly - status = { - -- define the separators between each section - separators = { - left = { "", "" }, -- separator for the left side of the statusline - right = { "", "" }, -- separator for the right side of the statusline - tab = { "", "" }, - }, - -- add new colors that can be used by heirline - colors = function(hl) - local get_hlgroup = require("astroui").get_hlgroup - -- use helper function to get highlight group properties - local comment_fg = get_hlgroup("Comment").fg - hl.git_branch_fg = comment_fg - hl.git_added = comment_fg - hl.git_changed = comment_fg - hl.git_removed = comment_fg - hl.blank_bg = get_hlgroup("Folded").fg - hl.file_info_bg = get_hlgroup("Visual").bg - hl.nav_icon_bg = get_hlgroup("String").fg - hl.nav_fg = hl.nav_icon_bg - hl.folder_icon_bg = get_hlgroup("Error").fg - return hl - end, - attributes = { - mode = { bold = true }, - }, - icon_highlights = { - file_icon = { - statusline = false, - }, - }, - }, + }, }, { diff --git a/lua/plugins/avante.lua b/lua/plugins/avante.lua index b97a9d5..ada6c21 100644 --- a/lua/plugins/avante.lua +++ b/lua/plugins/avante.lua @@ -4,9 +4,8 @@ return { "yetone/avante.nvim", -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` -- ⚠️ must add this setting! ! ! - build = vim.fn.has("win32") ~= 0 - and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" - or "make", + build = vim.fn.has "win32" ~= 0 and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" + or "make", event = "VeryLazy", version = false, -- Never set this value to "*"! Never! ---@module 'avante' @@ -16,25 +15,11 @@ return { -- this file can contain specific instructions for your project instructions_file = "avante.md", -- for example - provider = "claude", - providers = { - claude = { - endpoint = "https://api.anthropic.com", - model = "claude-sonnet-4-20250514", - timeout = 30000, -- Timeout in milliseconds - extra_request_body = { - temperature = 0.75, - max_tokens = 20480, - }, - }, - moonshot = { - endpoint = "https://api.moonshot.ai/v1", - model = "kimi-k2-0711-preview", - timeout = 30000, -- Timeout in milliseconds - extra_request_body = { - temperature = 0.75, - max_tokens = 32768, - }, + provider = "opencode", + acp_providers = { + ["opencode"] = { + command = "opencode", + args = { "acp" }, }, }, -- Keybindings for navigation within Avante windows @@ -73,7 +58,7 @@ return { windows = { position = "right", -- the position of the sidebar wrap = true, -- similar to vim.o.wrap - width = 30, -- default % based on available width + width = 26, -- default % based on available width sidebar_header = { align = "center", -- left, center, right for title rounded = true, @@ -91,7 +76,6 @@ return { "stevearc/dressing.nvim", -- for input provider dressing "folke/snacks.nvim", -- for input provider snacks "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons - "zbirenbaum/copilot.lua", -- for providers='copilot' { -- support for image pasting "HakonHarnes/img-clip.nvim", diff --git a/lua/plugins/buildtools.lua b/lua/plugins/buildtools.lua index 238ea35..69c5aaf 100644 --- a/lua/plugins/buildtools.lua +++ b/lua/plugins/buildtools.lua @@ -95,8 +95,13 @@ return { opts = { strategy = { "toggleterm", - direction = "horizontal", - open_on_start = false, + use_shell = false, + auto_scroll = true, + close_on_exit = false, + direction = "tab", + quit_on_exit = "success", + open_on_start = true, + hidden = true, }, templates = { "builtin", @@ -181,6 +186,75 @@ return { end, }, } + + -- Register Devbox template for Overseer + overseer.register_template { + name = "devbox", + params = { + script = { + type = "string", + optional = false, + desc = "The devbox script to run", + }, + }, + strategy = { + "toggleterm", + use_shell = true, + auto_scroll = true, + close_on_exit = true, + direction = "tab", + quit_on_exit = "success", + open_on_start = true, + hidden = true, + }, + condition = { + callback = function() + if vim.fn.executable "git" == 0 then return false, "git not found" end + local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] + if vim.v.shell_error ~= 0 or not git_root or git_root == "" then return false, "Not in a git repository" end + local devbox_file = git_root .. "/devbox.json" + if vim.fn.filereadable(devbox_file) == 0 then return false, "No devbox.json found in git root" end + if vim.fn.executable "devbox" == 0 then return false, "devbox command not found" end + return true + end, + }, + generator = function(_, cb) + local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] + if vim.v.shell_error ~= 0 or not git_root or git_root == "" then + cb {} + return + end + local devbox_file = git_root .. "/devbox.json" + + local file = io.open(devbox_file, "r") + if not file then + cb {} + return + end + local content = file:read "*all" + file:close() + local ok, data = pcall(vim.json.decode, content) + if not ok or not data then + cb {} + return + end + + local tasks = {} + if data.shell and data.shell.scripts then + for script_name, _ in pairs(data.shell.scripts) do + table.insert(tasks, { + name = "devbox run " .. script_name, + builder = function() return { cmd = { "devbox" }, args = { "run", script_name }, cwd = git_root } end, + }) + end + end + table.insert(tasks, { + name = "devbox shell", + builder = function() return { cmd = { "devbox" }, args = { "shell" }, cwd = git_root } end, + }) + cb(tasks) + end, + } end, }, -- Seamless navigation between build errors diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index effe0d5..5d5f50c 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -28,55 +28,7 @@ return { -- Get all hide patterns from shared module local hide_patterns = ignore_patterns.get_all_patterns() - -- Setup LSP file operations integration - local events = require "neo-tree.events" - return { - -- LSP file operation event handlers for refactoring support - event_handlers = { - { - event = events.BEFORE_FILE_ADD, - handler = function(args) require("astrolsp.file_operations").willCreateFiles(args) end, - }, - { - event = events.FILE_ADDED, - handler = function(args) require("astrolsp.file_operations").didCreateFiles(args) end, - }, - { - event = events.BEFORE_FILE_DELETE, - handler = function(args) require("astrolsp.file_operations").willDeleteFiles(args) end, - }, - { - event = events.FILE_DELETED, - handler = function(args) require("astrolsp.file_operations").didDeleteFiles(args) end, - }, - { - event = events.BEFORE_FILE_MOVE, - handler = function(args) - require("astrolsp.file_operations").willRenameFiles { from = args.source, to = args.destination } - end, - }, - { - event = events.BEFORE_FILE_RENAME, - handler = function(args) - require("astrolsp.file_operations").willRenameFiles { from = args.source, to = args.destination } - end, - }, - { - event = events.FILE_MOVED, - handler = function(args) - require("astrolsp.file_operations").didRenameFiles { from = args.source, to = args.destination } - require("snacks").rename.on_rename_file(args.source, args.destination) - end, - }, - { - event = events.FILE_RENAMED, - handler = function(args) - require("astrolsp.file_operations").didRenameFiles { from = args.source, to = args.destination } - require("snacks").rename.on_rename_file(args.source, args.destination) - end, - }, - }, popup_border_style = "rounded", enable_git_status = true, @@ -109,9 +61,11 @@ return { ["/"] = "fuzzy_finder", ["f"] = "filter_on_submit", [""] = "clear_filter", - [""] = "open_and_close_neotree", - [""] = "open", - -- Git keybindings from astrocore + [""] = "open_and_close_neotree", + [""] = "open", + -- Avante integration + [""] = "avante_add_files", + -- Git keybindings from astrocore ["o"] = function() vim.cmd "!gh repo view --web" end, ["h"] = function() require("snacks").terminal("gh dash", { @@ -131,7 +85,6 @@ return { ["b"] = function() require("snacks").picker.git_branches() end, -- Terminal keybindings from astrocore ["m"] = terminals.mk_toggle, - ["j"] = terminals.lazyjournal_toggle, ["l"] = function() require("snacks").terminal("lazydocker", { hidden = true, @@ -269,6 +222,28 @@ return { -- Filesystem specific settings filesystem = { commands = { + -- Avante integration: Add files to avante selected files + avante_add_files = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + local relative_path = require('avante.utils').relative_path(filepath) + + local sidebar = require('avante').get() + + local open = sidebar:is_open() + -- ensure avante sidebar is open + if not open then + require('avante.api').ask() + sidebar = require('avante').get() + end + + sidebar.file_selector:add_selected_file(relative_path) + + -- remove neo tree buffer + if not open then + sidebar.file_selector:remove_selected_file('neo-tree filesystem [1]') + end + end, -- Refresh patterns when changing directories refresh_patterns = function(state) -- Re-read patterns when navigating diff --git a/lua/plugins/supermaven.lua b/lua/plugins/supermaven.lua new file mode 100644 index 0000000..bf1b021 --- /dev/null +++ b/lua/plugins/supermaven.lua @@ -0,0 +1,22 @@ +--- Supermaven - Fast AI code completion +--- @module plugins.supermaven +return { + "supermaven-inc/supermaven-nvim", + config = function() + require("supermaven-nvim").setup({ + keymaps = { + accept_suggestion = "", + clear_suggestion = "", + accept_word = "", + }, + ignore_filetypes = { "cpp" }, + color = { + suggestion_color = "#ffffff", + cterm = 244, + }, + log_level = "info", -- set to "off" to disable logging completely + disable_inline_completion = false, -- disables inline completion for use with cmp + disable_keymaps = false, -- disables built in keymaps for more manual control + }) + end, +} \ No newline at end of file diff --git a/lua/polish.lua b/lua/polish.lua index 2fac67a..de12d49 100644 --- a/lua/polish.lua +++ b/lua/polish.lua @@ -36,111 +36,7 @@ vim.api.nvim_create_autocmd("VimResume", { desc = "Check for file changes after Screen reattach/resume", }) --- Overseer setup and template (optional) -local ok_overseer, overseer = pcall(require, "overseer") -if ok_overseer then - overseer.setup { - strategy = { - "toggleterm", - use_shell = false, - auto_scroll = true, - close_on_exit = false, - direction = "tab", - quit_on_exit = "success", - open_on_start = true, - hidden = true, - }, - } -end --- ToggleTerm setup (optional) -local ok_toggleterm, toggleterm = pcall(require, "toggleterm") -if ok_toggleterm then - toggleterm.setup { - size = function(term) - if term.direction == "horizontal" then - return 15 - elseif term.direction == "vertical" then - return math.floor(vim.o.columns * 0.35) - else - return 20 - end - end, - shade_terminals = false, - start_in_insert = true, - } -end - --- Register Devbox template for Overseer (if available) -if ok_overseer then - overseer.register_template { - name = "devbox", - params = { - script = { - type = "string", - optional = false, - desc = "The devbox script to run", - }, - }, - strategy = { - "toggleterm", - use_shell = true, - auto_scroll = true, - close_on_exit = true, - direction = "tab", - quit_on_exit = "success", - open_on_start = true, - hidden = true, - }, - condition = { - callback = function() - if vim.fn.executable "git" == 0 then return false, "git not found" end - local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] - if vim.v.shell_error ~= 0 or not git_root or git_root == "" then return false, "Not in a git repository" end - local devbox_file = git_root .. "/devbox.json" - if vim.fn.filereadable(devbox_file) == 0 then return false, "No devbox.json found in git root" end - if vim.fn.executable "devbox" == 0 then return false, "devbox command not found" end - return true - end, - }, - generator = function(_, cb) - local git_root = vim.fn.systemlist("git rev-parse --show-toplevel")[1] - if vim.v.shell_error ~= 0 or not git_root or git_root == "" then - cb {} - return - end - local devbox_file = git_root .. "/devbox.json" - - local file = io.open(devbox_file, "r") - if not file then - cb {} - return - end - local content = file:read "*all" - file:close() - local ok, data = pcall(vim.json.decode, content) - if not ok or not data then - cb {} - return - end - - local tasks = {} - if data.shell and data.shell.scripts then - for script_name, _ in pairs(data.shell.scripts) do - table.insert(tasks, { - name = "devbox run " .. script_name, - builder = function() return { cmd = { "devbox" }, args = { "run", script_name }, cwd = git_root } end, - }) - end - end - table.insert(tasks, { - name = "devbox shell", - builder = function() return { cmd = { "devbox" }, args = { "shell" }, cwd = git_root } end, - }) - cb(tasks) - end, - } -end require("cyberdream").setup { variant = "default", -- use "light" for the light variant. Also accepts "auto" to set dark or light colors based on the current value of `vim.o.background`