Skip to content
Merged
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
41 changes: 28 additions & 13 deletions lua/code-preview/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,6 @@ function M.status()
table.insert(lines, "Neovim socket : not found")
end

-- Hooks installed?
local settings_path = vim.fn.getcwd() .. "/.claude/settings.local.json"
local hooks_ok = false
local f = io.open(settings_path, "r")
if f then
local content = f:read("*a")
f:close()
-- Detect both new and legacy hook markers
hooks_ok = content:find("code-preview", 1, true) ~= nil
or content:find("claude-preview", 1, true) ~= nil
end
table.insert(lines, "Hooks : " .. (hooks_ok and "installed" or "not installed"))

-- jq dependency
local jq_ok = vim.fn.executable("jq") == 1
table.insert(lines, "jq : " .. (jq_ok and "found" or "MISSING"))
Expand All @@ -206,6 +193,34 @@ function M.status()
local diff = require("code-preview.diff")
table.insert(lines, "Diff tab : " .. (diff.is_open() and "open" or "closed"))

-- Backends
table.insert(lines, "")
table.insert(lines, "Backends:")

-- Claude Code
local claude_ok = false
local settings_path = vim.fn.getcwd() .. "/.claude/settings.local.json"
local f = io.open(settings_path, "r")
if f then
local content = f:read("*a")
f:close()
claude_ok = content:find("code-preview", 1, true) ~= nil
or content:find("claude-preview", 1, true) ~= nil
end
if claude_ok then
table.insert(lines, " Claude Code : installed")
else
table.insert(lines, " Claude Code : not installed -> :CodePreviewInstallClaudeCodeHooks")
end

-- OpenCode
local opencode_ok = vim.fn.filereadable(vim.fn.getcwd() .. "/.opencode/plugins/index.ts") == 1
if opencode_ok then
table.insert(lines, " OpenCode : installed")
else
table.insert(lines, " OpenCode : not installed -> :CodePreviewInstallOpenCodeHooks")
end

vim.notify(table.concat(lines, "\n"), vim.log.levels.INFO, { title = "code-preview" })
end

Expand Down
Loading