Files
wehub-resource-sync 26382a7ac6
CI / Clippy (push) Failing after 15m13s
CI / Test (ubuntu-latest) (push) Failing after 16m1s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (no embeddings / no ORT) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / Cookbook (Node) (push) Has been cancelled
CI / Pi Extension (Node) (push) Has been cancelled
CI / Rust SDK (lean-ctx-client) (push) Has been cancelled
CI / Embed SDK (lean-ctx-sdk) (push) Has been cancelled
CI / Python SDK (leanctx) (push) Has been cancelled
CI / Hermes Plugin (Python) (push) Has been cancelled
CI / SDK Conformance Matrix (push) Has been cancelled
CI / Coverage (push) Has been cancelled
CI / cargo-deny (push) Has been cancelled
CI / Adversarial Safety (push) Has been cancelled
CI / Benchmarks (push) Has been cancelled
CI / Output-Quality Gate (eval A/B) (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / CI Green (push) Has been cancelled
JetBrains Plugin / Actionlint (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (rust) (push) Has been cancelled
JetBrains Plugin / Validation (push) Has been cancelled
JetBrains Plugin / Build (push) Has been cancelled
JetBrains Plugin / Test (push) Has been cancelled
Security Check / Security Scan (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:30 +08:00

58 lines
1.0 KiB
Lua

local M = {}
local cached_path = nil
local candidates = {
"lean-ctx",
vim.fn.expand("~/.cargo/bin/lean-ctx"),
"/usr/local/bin/lean-ctx",
"/opt/homebrew/bin/lean-ctx",
vim.fn.expand("~/.local/bin/lean-ctx"),
}
function M.resolve()
if cached_path then
return cached_path
end
for _, candidate in ipairs(candidates) do
if vim.fn.executable(candidate) == 1 then
cached_path = candidate
return candidate
end
end
return nil
end
function M.run(args, callback)
local bin = M.resolve()
if not bin then
callback("lean-ctx binary not found")
return
end
local cmd = vim.list_extend({ bin }, args)
local env = {
LEAN_CTX_ACTIVE = "0",
NO_COLOR = "1",
PATH = vim.env.PATH,
HOME = vim.env.HOME,
}
vim.system(cmd, {
env = env,
text = true,
}, function(result)
vim.schedule(function()
local output = result.stdout or ""
if output == "" then
output = result.stderr or ""
end
callback(output)
end)
end)
end
return M