feat: changed to and interactive workflow

This commit is contained in:
2024-12-11 00:06:28 +01:00
parent 8919795603
commit ce2b77b0ec
5 changed files with 109 additions and 80 deletions

View File

@@ -21,7 +21,6 @@ function M.get_project_structure()
end
end
-- Fallback if not in a git repo
local dhandle = io.popen("find . -type f")
if dhandle then
local dresult = dhandle:read("*a")
@@ -32,26 +31,21 @@ function M.get_project_structure()
return "No files found."
end
-- Helper to find the git root directory
local function get_git_root()
local handle = io.popen("git rev-parse --show-toplevel 2>/dev/null")
if handle then
local root = handle:read("*l")
handle:close()
if root and root ~= "" then
return root
end
return root
end
return nil
end
-- Attempt to read README.md from the root of the git repository
function M.get_readme_content()
local root = get_git_root()
if not root then
return nil
end
local readme_path = root .. "/README.md"
local f = io.open(readme_path, "r")
if f then