Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,23 @@ JSON_PRETTIER_FILTER_REGEX_EXCLUDE: "(home/.*modify_[^/]*\\.json)"

# rtk.ts is vendored from https://github.com/rtk-ai/rtk and must not be modified
# locally (see header comment in the file). Exclude it from ts-standard.
TYPESCRIPT_STANDARD_FILTER_REGEX_EXCLUDE: "(home/dot_config/opencode/plugins/rtk\\.ts)"
# skills/agent-audit/lib/opencode-plugin.ts is a standalone skill resource (a
# reference OpenCode plugin distributed via the skills CLI), not part of this
# repo's TS project. It is outside tsconfig.json's `include`, so ts-standard's
# parserOptions.project parse fails on it; exclude rather than pull an external
# skill example into the maintained opencode plugin project.
TYPESCRIPT_STANDARD_FILTER_REGEX_EXCLUDE: "(home/dot_config/opencode/plugins/rtk\\.ts|skills/agent-audit/lib/opencode-plugin\\.ts)"

# *.workflow.js files are Workflow-tool script bodies: the runtime wraps them in
# an async function, so top-level `return`/`await` is valid there but parses as
# `'return' outside of function` under standardjs. Exclude them from standard.
JAVASCRIPT_STANDARD_FILTER_REGEX_EXCLUDE: "(skills/.*\\.workflow\\.js)"

# SchemaStore matches **/glazewm/config.yaml to schemastore.org/glazewm.json,
# which is the GlazeWM v2 schema. This config targets GlazeWM v3 (restructured
# config; v3 ships no authoritative JSON schema), so v8r reports every v3 key as
# an unknown property. Exclude until SchemaStore publishes a v3 schema.
YAML_V8R_FILTER_REGEX_EXCLUDE: "(home/dot_glzr/glazewm/config\\.yaml)"

REPOSITORY_KICS_ARGUMENTS: "--exclude-paths .github/workflows/e2e-install.yml"

Expand Down
52 changes: 28 additions & 24 deletions home/dot_config/nvim/scripts/headless-install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,62 @@
-- regardless. This script waits for the work that *does* run headless.

local function log(msg)
io.stderr:write(string.format('[headless-install] %s\n', msg))
io.stderr:write(string.format("[headless-install] %s\n", msg))
end

log('starting Lazy sync (wait=true)')
require('lazy').sync({ wait = true, show = false })
log('Lazy sync done')
log("starting Lazy sync (wait=true)")
require("lazy").sync({ wait = true, show = false })
log("Lazy sync done")

require('lazy').load({ plugins = { 'mason.nvim' } })
local mr = require('mason-registry')
require("lazy").load({ plugins = { "mason.nvim" } })
local mr = require("mason-registry")

local pending = 0
local seen_any = false

-- Mason emits `package:install:handle` when an install starts (carrying the
-- InstallHandle) and `package:install:success`/`:failed` on completion. There
-- is no `:start` event.
mr:on('package:install:handle', function(handle)
mr:on("package:install:handle", function(handle)
pending = pending + 1
seen_any = true
local name = handle.package and handle.package.name or '?'
log(string.format('install start: %s (pending=%d)', name, pending))
local name = handle.package and handle.package.name or "?"
log(string.format("install start: %s (pending=%d)", name, pending))
end)
mr:on('package:install:success', function(pkg)
mr:on("package:install:success", function(pkg)
pending = pending - 1
log(string.format('install success: %s (pending=%d)', pkg.name, pending))
log(string.format("install success: %s (pending=%d)", pkg.name, pending))
end)
mr:on('package:install:failed', function(pkg)
mr:on("package:install:failed", function(pkg)
pending = pending - 1
log(string.format('install failed: %s (pending=%d)', pkg.name, pending))
log(string.format("install failed: %s (pending=%d)", pkg.name, pending))
end)

log('loading mason-lspconfig and mason-nvim-dap (triggers ensure_installed)')
require('lazy').load({ plugins = { 'mason-lspconfig.nvim', 'mason-nvim-dap.nvim' } })
log("loading mason-lspconfig and mason-nvim-dap (triggers ensure_installed)")
require("lazy").load({ plugins = { "mason-lspconfig.nvim", "mason-nvim-dap.nvim" } })

-- Wait up to 30s for the first install:handle event. ensure_installed runs
-- inside mason-registry.refresh() callbacks, which are async. If nothing
-- needs installing (everything already present and registry cache fresh),
-- no event fires and we proceed to exit.
log('waiting up to 30s for an install:handle event')
vim.wait(30000, function() return seen_any end, 200)
log("waiting up to 30s for an install:handle event")
vim.wait(30000, function()
return seen_any
end, 200)

if not seen_any then
log('no installs triggered; assuming nothing to do')
log("no installs triggered; assuming nothing to do")
else
log(string.format('draining mason install queue (%d pending, 10m cap)', pending))
local ok = vim.wait(600000, function() return pending <= 0 end, 500)
log(string.format("draining mason install queue (%d pending, 10m cap)", pending))
local ok = vim.wait(600000, function()
return pending <= 0
end, 500)
if not ok then
log(string.format('timeout: %d installs still pending; exiting anyway', pending))
log(string.format("timeout: %d installs still pending; exiting anyway", pending))
else
log('all mason installs complete')
log("all mason installs complete")
end
end

log('exiting')
vim.cmd('qa!')
log("exiting")
vim.cmd("qa!")