-- AstroCommunity: import any community modules here -- We import this file in `lazy_setup.lua` before the `plugins/` folder. -- This guarantees that the specs are processed before any user plugins. --- @alias FrameworkModuleSpec { import: string } --- @alias FrameworkModules table -- Framework-specific community module configurations --- @type FrameworkModules local FRAMEWORK_COMMUNITY_MODULES = { -- Base Lua pack - always included lua = { { import = "astrocommunity.pack.lua" }, }, -- Vue.js framework modules vue = { { import = "astrocommunity.pack.vue" }, }, } --- Retrieves the appropriate community modules based on the current framework environment --- @return LazySpec[] List of community modules to import for the detected framework local function get_framework_modules() --- @type string|nil local current_framework = os.getenv "FRAMEWORK" --- @type LazySpec[] local modules = {} -- Always include base Lua pack for _, module in ipairs(FRAMEWORK_COMMUNITY_MODULES.lua) do table.insert(modules, module) end -- If framework is not set or empty string, use only base modules if not current_framework or current_framework == "" then return modules end -- Check if framework is valid (vue or python) if current_framework ~= "vue" and current_framework ~= "python" then error("Invalid framework: '" .. current_framework .. "'. Valid frameworks are: vue, python") end -- Add framework-specific modules if framework is valid if FRAMEWORK_COMMUNITY_MODULES[current_framework] then for _, module in ipairs(FRAMEWORK_COMMUNITY_MODULES[current_framework]) do table.insert(modules, module) end end return modules end --- Checks if third-party AI assistant is enabled and adds Avante-nvim if true --- @return LazySpec|nil Avante-nvim module if AI is enabled, nil otherwise local function get_ai_modules() -- Check if third-party AI assistant is enabled local ai_enabled = os.getenv "THIRD_PARTY_AI_ASSISTANT" if ai_enabled and ai_enabled:lower() == "true" then return { import = "astrocommunity.completion.avante-nvim" } end return nil end ---@type LazySpec return { -- Base AstroCommunity plugin "AstroNvim/astrocommunity", -- Framework-specific modules unpack(get_framework_modules()), -- AI modules if enabled get_ai_modules(), }