Compare commits
10 Commits
4b2d24e1f4
...
74973c1449
| Author | SHA1 | Date | |
|---|---|---|---|
| 74973c1449 | |||
| 545a5927e5 | |||
| c6b2743cf6 | |||
| 430bec1708 | |||
| d9e25eec77 | |||
| a588604d91 | |||
| d9911dd2ce | |||
| b397fab3f2 | |||
| 1246f42638 | |||
| 06fb7dd4b8 |
@@ -1,144 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
from collections import defaultdict
|
||||
|
||||
|
||||
def get_task_data():
|
||||
command = (
|
||||
"task +PENDING or +WAITING -COMPLETED -DELETED export | "
|
||||
"jq '[.[] | {uuid: .uuid, id, depends: .depends, description: .description, status: .status }]'"
|
||||
)
|
||||
output = subprocess.check_output(command, shell=True)
|
||||
return json.loads(output)
|
||||
|
||||
|
||||
def parse_task_data(data):
|
||||
dependency_graph = defaultdict(list)
|
||||
task_details = {}
|
||||
dependent_tasks = set()
|
||||
|
||||
for task in data:
|
||||
task_id = task["uuid"]
|
||||
task_details[task_id] = {
|
||||
"id": task.get("id", "?"),
|
||||
"description": task.get("description", "No description"),
|
||||
"status": task.get("status", "Unknown status"),
|
||||
}
|
||||
if task["depends"]:
|
||||
for dependency in task["depends"]:
|
||||
dependency_graph[dependency].append(task_id)
|
||||
dependent_tasks.add(task_id)
|
||||
|
||||
root_tasks = set(task_details.keys()) - dependent_tasks
|
||||
return task_details, dependency_graph, root_tasks
|
||||
|
||||
|
||||
def get_all_parents(task_id, dependency_graph):
|
||||
return [
|
||||
parent for parent, children in dependency_graph.items() if task_id in children
|
||||
]
|
||||
|
||||
|
||||
def build_ascii_dag(
|
||||
task_id,
|
||||
task_details,
|
||||
dependency_graph,
|
||||
prefix="",
|
||||
is_last=True,
|
||||
show_id=True,
|
||||
visited=None,
|
||||
):
|
||||
if visited is None:
|
||||
visited = set()
|
||||
|
||||
if task_id in visited:
|
||||
return [f"{prefix}{'└── ' if is_last else '├── '}... (cycle detected)"]
|
||||
|
||||
visited.add(task_id)
|
||||
|
||||
task_info = task_details[task_id]
|
||||
task_line = f"{prefix}{'└── ' if is_last else '├── '}{task_info['id'] + ': ' if show_id else ''}{task_info['description']} ({task_info['status']})"
|
||||
lines = [task_line]
|
||||
|
||||
children = dependency_graph.get(task_id, [])
|
||||
for idx, child in enumerate(children):
|
||||
child_is_last = idx == len(children) - 1
|
||||
child_prefix = prefix + (" " if is_last else "│ ")
|
||||
lines.extend(
|
||||
build_ascii_dag(
|
||||
child,
|
||||
task_details,
|
||||
dependency_graph,
|
||||
child_prefix,
|
||||
child_is_last,
|
||||
show_id,
|
||||
visited.copy(),
|
||||
)
|
||||
)
|
||||
|
||||
return lines
|
||||
|
||||
|
||||
def render_dependency_dag(task_details, dependency_graph, root_tasks, show_id):
|
||||
dag_lines = []
|
||||
global_visited = set()
|
||||
|
||||
def dfs(task_id, prefix="", is_last=True, visited=None):
|
||||
if visited is None:
|
||||
visited = set()
|
||||
|
||||
if task_id in visited:
|
||||
return
|
||||
|
||||
visited.add(task_id)
|
||||
global_visited.add(task_id)
|
||||
|
||||
task_info = task_details[task_id]
|
||||
task_line = f"{prefix}{'└── ' if is_last else '├── '}{str(task_info['id']) + ': ' if show_id else ''}{task_info['description']} ({task_info['status']})"
|
||||
dag_lines.append(task_line)
|
||||
|
||||
children = dependency_graph.get(task_id, [])
|
||||
for idx, child in enumerate(children):
|
||||
child_is_last = idx == len(children) - 1
|
||||
child_prefix = prefix + (" " if is_last else "│ ")
|
||||
dfs(child, child_prefix, child_is_last, visited.copy())
|
||||
|
||||
root_tasks_with_children = [
|
||||
root for root in root_tasks if dependency_graph.get(root, [])
|
||||
]
|
||||
for root in sorted(
|
||||
root_tasks_with_children,
|
||||
key=lambda x: len(dependency_graph.get(x, [])),
|
||||
reverse=True,
|
||||
):
|
||||
if root not in global_visited:
|
||||
dfs(root)
|
||||
dag_lines.append("")
|
||||
|
||||
return "\n".join(dag_lines).rstrip()
|
||||
|
||||
|
||||
def main(args):
|
||||
data = get_task_data()
|
||||
task_details, dependency_graph, root_tasks = parse_task_data(data)
|
||||
ascii_dag = render_dependency_dag(
|
||||
task_details, dependency_graph, root_tasks, show_id=args.show_id
|
||||
)
|
||||
print(ascii_dag)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Generates a task dependency DAG for Taskwarrior tasks."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--show-id",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Include task IDs in the output.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
main(args)
|
||||
78
dots/.config/nvim/after/plugin/formatter.nvim.lua
Normal file
78
dots/.config/nvim/after/plugin/formatter.nvim.lua
Normal file
@@ -0,0 +1,78 @@
|
||||
-- require("formatter").setup({
|
||||
-- logging = true,
|
||||
-- filetype = {
|
||||
-- typescriptreact = {
|
||||
-- -- prettier
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "prettier",
|
||||
-- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- typescript = {
|
||||
-- -- prettier
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "prettier",
|
||||
-- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- -- linter
|
||||
-- -- function()
|
||||
-- -- return {
|
||||
-- -- exe = "eslint",
|
||||
-- -- args = {
|
||||
-- -- "--stdin-filename",
|
||||
-- -- vim.api.nvim_buf_get_name(0),
|
||||
-- -- "--fix",
|
||||
-- -- "--cache"
|
||||
-- -- },
|
||||
-- -- stdin = false
|
||||
-- -- }
|
||||
-- -- end
|
||||
-- },
|
||||
-- javascript = {
|
||||
-- -- prettier
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "prettier",
|
||||
-- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- javascriptreact = {
|
||||
-- -- prettier
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "prettier",
|
||||
-- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- json = {
|
||||
-- -- prettier
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "prettier",
|
||||
-- args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0) },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- lua = {
|
||||
-- -- luafmt
|
||||
-- function()
|
||||
-- return {
|
||||
-- exe = "luafmt",
|
||||
-- args = { "--indent-count", 2, "--stdin" },
|
||||
-- stdin = true,
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
@@ -1,10 +1,10 @@
|
||||
require("image").setup({
|
||||
backend = "kitty",
|
||||
kitty_method = "normal",
|
||||
processor = "magick_cli",
|
||||
integrations = {
|
||||
markdown = {
|
||||
filetypes = { "markdown", "pandoc" },
|
||||
},
|
||||
},
|
||||
})
|
||||
-- require("image").setup({
|
||||
-- backend = "kitty",
|
||||
-- kitty_method = "normal",
|
||||
-- processor = "magick_cli",
|
||||
-- integrations = {
|
||||
-- markdown = {
|
||||
-- filetypes = { "markdown", "pandoc" },
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
|
||||
@@ -20,7 +20,6 @@ local servers = {
|
||||
-- emmet_language_server = {},
|
||||
gdscript = {},
|
||||
helm_ls = { filetypes = { "helm", "yaml.helm-values" } },
|
||||
},
|
||||
hls = { filetypes = { "haskell", "lhaskell", "cabal" } },
|
||||
html = {},
|
||||
jsonls = {
|
||||
@@ -94,7 +93,6 @@ local servers = {
|
||||
},
|
||||
tailwindcss = {},
|
||||
terraformls = {},
|
||||
vtsls = {
|
||||
-- ts_ls = {},
|
||||
vtsls = {
|
||||
maxTsServerMemory = 16384,
|
||||
@@ -111,17 +109,11 @@ local servers = {
|
||||
vtsls = {
|
||||
enableMoveToFileCodeAction = true,
|
||||
autoUseWorkspaceTsdk = true,
|
||||
experimental = {
|
||||
completion = {
|
||||
enableServerSideFuzzyMatch = true,
|
||||
},
|
||||
},
|
||||
experimental = { completion = { enableServerSideFuzzyMatch = true } },
|
||||
},
|
||||
typescript = {
|
||||
updateImportsOnFileMove = { enabled = "always" },
|
||||
suggest = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
suggest = { completeFunctionCalls = true },
|
||||
inlayHints = {
|
||||
enumMemberValues = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
|
||||
@@ -62,12 +62,12 @@ cmp.setup({
|
||||
["<CR>"] = c_l,
|
||||
}),
|
||||
sources = {
|
||||
{ name = "copilot", group_index = 2 },
|
||||
{ name = "zk" },
|
||||
{ name = "copilot", group_index = 2 },
|
||||
{ name = "nvim_lsp", keyword_length = 8 },
|
||||
{ name = "luasnip", max_item_count = 16 },
|
||||
{ name = "luasnip", max_item_count = 16 },
|
||||
{ name = "path" },
|
||||
{ name = "buffer", max_item_count = 8 },
|
||||
{ name = "buffer", max_item_count = 8 },
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered({ border = { "┌", "─", "┐", "│", "┘", "─", "└", "│" } }),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
vim.cmd([[
|
||||
" Change local buffer to directory of current file after the plugin has loaded
|
||||
autocmd VimEnter * lcd %:p:h
|
||||
" " Change local buffer to directory of current file after the plugin has loaded
|
||||
" autocmd VimEnter * lcd %:p:h
|
||||
|
||||
" " Override wiki index mapping to also cd into the wiki
|
||||
nm <leader>ww <plug>(wiki-index)
|
||||
|
||||
1
dots/.config/nvim/ftplugin/dotenv.lua
Normal file
1
dots/.config/nvim/ftplugin/dotenv.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.opt_local.filetype = "sh"
|
||||
@@ -20,6 +20,7 @@ require("statusline")
|
||||
require("diagnostic")
|
||||
require("utils")
|
||||
require("zk")
|
||||
require("skeleton")
|
||||
require("reload")
|
||||
|
||||
require("paq-setup") -- when not on nixCats
|
||||
|
||||
@@ -41,11 +41,10 @@ require("nixCatsUtils.catPacker").setup({
|
||||
{ "ravitemer/mcphub.nvim", build = "pnpm install -g mcp-hub@latest" },
|
||||
{ "zbirenbaum/copilot.lua" },
|
||||
{ "zbirenbaum/copilot-cmp" },
|
||||
{ "saghen/blink.download" },
|
||||
{ "qvalentin/helm-ls.nvim", ft = "helm" },
|
||||
{ "saghen/blink.download" },
|
||||
{ "ramilito/kubectl.nvim" },
|
||||
{ "mikesmithgh/kitty-scrollback.nvim" },
|
||||
{ "chrisgrieser/nvim-early-retirement" },
|
||||
{ "euclio/vim-markdown-composer" },
|
||||
{ "greggh/claude-code.nvim" },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user