Skip to content

mission control for agent skills

Polish metadata and preview panes

Alvin Unreal87cf3b745ac9
diff --git a/go.mod b/go.mod
index 4fbbe04..6d60228 100644
--- a/go.mod
+++ b/go.mod
@@ -9,26 +9,41 @@ require (
)
require (
+ charm.land/glamour/v2 v2.0.1 // indirect
+ charm.land/lipgloss/v2 v2.0.4 // indirect
+ github.com/alecthomas/chroma/v2 v2.14.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
+ github.com/aymerick/douceur v0.2.0 // indirect
github.com/charmbracelet/bubbles v1.0.0 // indirect
- github.com/charmbracelet/colorprofile v0.4.1 // indirect
- github.com/charmbracelet/x/ansi v0.11.6 // indirect
+ github.com/charmbracelet/colorprofile v0.4.3 // indirect
+ github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318 // indirect
+ github.com/charmbracelet/x/ansi v0.11.7 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
+ github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
github.com/charmbracelet/x/term v0.2.2 // indirect
- github.com/clipperhouse/displaywidth v0.9.0 // indirect
+ github.com/charmbracelet/x/termios v0.1.1 // indirect
+ github.com/charmbracelet/x/windows v0.2.2 // indirect
+ github.com/clipperhouse/displaywidth v0.11.0 // indirect
github.com/clipperhouse/stringish v0.1.1 // indirect
- github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
+ github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
+ github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
- github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
+ github.com/gorilla/css v1.0.1 // indirect
+ github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
- github.com/mattn/go-runewidth v0.0.19 // indirect
+ github.com/mattn/go-runewidth v0.0.23 // indirect
+ github.com/microcosm-cc/bluemonday v1.0.27 // indirect
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/muesli/reflow v0.3.0 // indirect
github.com/muesli/termenv v0.16.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
- golang.org/x/sys v0.38.0 // indirect
- golang.org/x/text v0.3.8 // indirect
+ github.com/yuin/goldmark v1.7.8 // indirect
+ github.com/yuin/goldmark-emoji v1.0.5 // indirect
+ golang.org/x/net v0.39.0 // indirect
+ golang.org/x/sync v0.18.0 // indirect
+ golang.org/x/sys v0.45.0 // indirect
+ golang.org/x/text v0.24.0 // indirect
)
diff --git a/go.sum b/go.sum
index 52de7c2..7e4064b 100644
--- a/go.sum
+++ b/go.sum
@@ -1,5 +1,13 @@
+charm.land/glamour/v2 v2.0.1 h1:xl+r00A4aJWU0z8fgwKd9fQQ4rsphqGUzuEiXZP5n+c=
+charm.land/glamour/v2 v2.0.1/go.mod h1:jo9z8XqVKPeEFMVdvCRLGk++RyJ3CdUwgNr7EvXLw3k=
+charm.land/lipgloss/v2 v2.0.4 h1:lcPeVtcp23SNra7lHy8iYE4UC2aIipVQ47sbGyyxR5Q=
+charm.land/lipgloss/v2 v2.0.4/go.mod h1:0653x8epbZSzdDfO/XPS1a/uYPOBeSsCssOpJOqDzik=
+github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E=
+github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
+github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
+github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
@@ -8,32 +16,54 @@ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4p
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk=
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
+github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
+github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
+github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318 h1:OqDqxQZliC7C8adA7KjelW3OjtAxREfeHkNcd66wpeI=
+github.com/charmbracelet/ultraviolet v0.0.0-20251205161215-1948445e3318/go.mod h1:Y6kE2GzHfkyQQVCSL9r2hwokSrIlHGzZG+71+wDYSZI=
github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=
github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
+github.com/charmbracelet/x/ansi v0.11.7 h1:kzv1kJvjg2S3r9KHo8hDdHFQLEqn4RBCb39dAYC84jI=
+github.com/charmbracelet/x/ansi v0.11.7/go.mod h1:9qGpnAVYz+8ACONkZBUWPtL7lulP9No6p1epAihUZwQ=
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
+github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf h1:rLG0Yb6MQSDKdB52aGX55JT1oi0P0Kuaj7wi1bLUpnI=
+github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf/go.mod h1:B3UgsnsBZS/eX42BlaNiJkD1pPOUa+oF1IYC6Yd2CEU=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
+github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY=
+github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo=
+github.com/charmbracelet/x/windows v0.2.2 h1:IofanmuvaxnKHuV04sC0eBy/smG6kIKrWG2/jYn2GuM=
+github.com/charmbracelet/x/windows v0.2.2/go.mod h1:/8XtdKZzedat74NQFn0NGlGL4soHB0YQZrETF96h75k=
github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=
github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA=
+github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8=
+github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U=
github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
+github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
+github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
+github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
+github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
+github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
+github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
+github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
+github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
@@ -43,6 +73,10 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
+github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw=
+github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
+github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
+github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
@@ -57,17 +91,30 @@ github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
+github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
+github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
+github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
+github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk=
+github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
+golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY=
+golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E=
+golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
+golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
+golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
+golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
+golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
diff --git a/internal/tui/tui_test.go b/internal/tui/tui_test.go
index f6ad2db..90eafd9 100644
--- a/internal/tui/tui_test.go
+++ b/internal/tui/tui_test.go
@@ -1262,7 +1262,7 @@ func TestSearchEscapeClearsQueryAndBackspaceWorksOutsideSearch(t *testing.T) {
}
func TestDetailPaneClipsLongPreview(t *testing.T) {
- preview := strings.Repeat("line\n", 80)
+ preview := strings.Repeat("- line\n", 80)
m := appModel{width: 100, height: 20, result: model.ScanResult{Skills: []*model.Skill{{Name: "Long", Description: "desc", Scope: model.ScopeProject, Preview: preview}}}}
m.syncViewport()
out := m.previewViewport.View()
@@ -1272,8 +1272,20 @@ func TestDetailPaneClipsLongPreview(t *testing.T) {
}
}
+func TestMarkdownPreviewStripsFrontmatter(t *testing.T) {
+ preview := "---\nname: better-icons\ndescription: icons\n---\n# Better Icons\n\nSearch icons."
+ lines := renderMarkdownPreview(preview, 80)
+ out := strings.Join(lines, "\n")
+ if strings.Contains(out, "name: better-icons") || strings.Contains(out, "description: icons") || strings.Contains(out, "--------") {
+ t.Fatalf("expected frontmatter to be hidden from markdown preview, got %q", out)
+ }
+ if !strings.Contains(out, "Better") || !strings.Contains(out, "Icons") || !strings.Contains(out, "Search") || !strings.Contains(out, "icons") {
+ t.Fatalf("expected rendered markdown body, got %q", out)
+ }
+}
+
func TestDetailScrollKeysMoveViewport(t *testing.T) {
- preview := strings.Repeat("line\n", 80)
+ preview := strings.Repeat("- line\n", 80)
m := appModel{width: 100, height: 20, selected: 1, result: model.ScanResult{Skills: []*model.Skill{{Name: "Long", Description: "desc", Scope: model.ScopeProject, Preview: preview}}}}
m.syncViewport()
updated, _ := m.Update(tea.KeyMsg{Type: tea.KeyPgDown})
@@ -1547,7 +1559,7 @@ func TestDetailsOnboardingEmptyState(t *testing.T) {
}
linesMissing := mMissingDeps.detailLines(80)
joinedMissing := strings.Join(linesMissing, "\n")
- if !strings.Contains(joinedMissing, "Dependency Issue") || !strings.Contains(joinedMissing, "skills: missing") {
+ if !strings.Contains(joinedMissing, "Dependency Issue") || !strings.Contains(joinedMissing, "skills:") || !strings.Contains(joinedMissing, "missing") {
t.Fatalf("expected dependency error details, got %q", joinedMissing)
}
}
@@ -1741,7 +1753,7 @@ func TestCollapseExpandSourceGroups(t *testing.T) {
m.selected = 0 // select header row owner/one
m.collapsedGroups["owner/one"] = true
outHeader := m.View()
- if !strings.Contains(outHeader, "State: collapsed") {
+ if !strings.Contains(outHeader, "State:") || !strings.Contains(outHeader, "collapsed") {
t.Fatalf("expected header placeholder/metadata in Metadata pane, got:\n%s", outHeader)
}
@@ -1788,13 +1800,13 @@ func TestRichSourceInventoryMetadataAndActions(t *testing.T) {
if !strings.Contains(metaJoined, "Source: owner/one") {
t.Errorf("expected source name in metadata, got %q", metaJoined)
}
- if !strings.Contains(metaJoined, "State: expanded") {
+ if !strings.Contains(metaJoined, "State:") || !strings.Contains(metaJoined, "expanded") {
t.Errorf("expected state in metadata, got %q", metaJoined)
}
if !strings.Contains(metaJoined, "Skills: 2 visible / 2 total") {
t.Errorf("expected skills count in metadata, got %q", metaJoined)
}
- if !strings.Contains(metaJoined, "Scope: mixed") {
+ if !strings.Contains(metaJoined, "Scope:") || (!strings.Contains(metaJoined, "mixed") && !strings.Contains(metaJoined, "Mixed")) {
t.Errorf("expected scope mixed in metadata, got %q", metaJoined)
}
if strings.Contains(metaJoined, "Hash:") {
diff --git a/internal/tui/view.go b/internal/tui/view.go
index 637941a..85ee092 100644
--- a/internal/tui/view.go
+++ b/internal/tui/view.go
@@ -4,6 +4,9 @@ import (
"fmt"
"strings"
+ "charm.land/glamour/v2"
+ "charm.land/glamour/v2/ansi"
+ "charm.land/glamour/v2/styles"
"github.com/alvinunreal/lazyskills/internal/compat"
"github.com/alvinunreal/lazyskills/internal/display"
"github.com/alvinunreal/lazyskills/internal/model"
@@ -89,6 +92,20 @@ func scopeStyle(scope string) lipgloss.Style {
}
}
+func styledScopeBadge(scope string) string {
+ s := strings.ToLower(scope)
+ switch s {
+ case "project":
+ return scopeProjectStyle.Render("[Project]")
+ case "global":
+ return scopeGlobalStyle.Render("[Global]")
+ case "mixed":
+ return lipgloss.NewStyle().Foreground(lipgloss.Color("141")).Render("[Mixed]")
+ default:
+ return dimStyle.Render("[" + strings.Title(s) + "]")
+ }
+}
+
func (m appModel) listTitle() string {
title := "1 Inventory"
if m.agent != "" {
@@ -296,9 +313,9 @@ func (m appModel) metadataLines(width int) []string {
var lines []string
if len(m.result.HealthIssues) > 0 {
- lines = append(lines, errorStyle.Render("Scan health:"), "")
+ lines = append(lines, errorStyle.Render("✗ Scan health issues"), "")
for _, issue := range m.result.HealthIssues {
- lines = append(lines, truncate(fmt.Sprintf("- %s: %s", compat.SanitizeMetadata(issue.Type), compat.SanitizeMetadata(issue.Message)), width))
+ lines = append(lines, truncate(fmt.Sprintf(" • %s: %s", compat.SanitizeMetadata(issue.Type), compat.SanitizeMetadata(issue.Message)), width))
}
lines = append(lines, "")
}
@@ -312,12 +329,12 @@ func (m appModel) metadataLines(width int) []string {
)
for _, tool := range []string{"skills", "npx", "node", "npm"} {
status := "missing"
- style := errorStyle
+ statusStyled := errorStyle.Render(status)
if m.result.Preflight.Tools[tool].Exists {
status = "available"
- style = successStyle
+ statusStyled = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render(status)
}
- lines = append(lines, style.Render(fmt.Sprintf(" • %s: %s", tool, status)))
+ lines = append(lines, fmt.Sprintf(" • %-8s %s", tool+":", statusStyled))
}
} else if len(m.result.Skills) == 0 {
lines = append(lines,
@@ -326,9 +343,9 @@ func (m appModel) metadataLines(width int) []string {
wrapText("No skills were found in your project or global directory.", width),
"",
dimStyle.Render("Quick Onboarding:"),
- wrapText("1. Press 'c' to open actions and choose 'Initialize skills in project' to create a local skills directory.", width),
- wrapText("2. Choose 'Find new skills (interactive)' to search and install online skills.", width),
- wrapText("3. Link your existing skills using symlinks.", width),
+ wrapText(" 1. Press 'c' to open actions and choose 'Initialize skills in project' to create a local skills directory.", width),
+ wrapText(" 2. Choose 'Find new skills (interactive)' to search and install online skills.", width),
+ wrapText(" 3. Link your existing skills using symlinks.", width),
)
} else {
lines = append(lines,
@@ -352,9 +369,9 @@ func (m appModel) metadataLines(width int) []string {
row := rows[m.selected]
if row.isHeader {
visible, total := m.getGroupCounts(row.groupName)
- stateStr := "expanded"
+ stateVal := "▼ expanded"
if m.isCollapsed(row.groupName) {
- stateStr = "collapsed"
+ stateVal = "▶ collapsed"
}
skills := m.sourceGroupSkills(row.groupName)
@@ -390,11 +407,18 @@ func (m appModel) metadataLines(width int) []string {
scopeStr = "unknown"
}
+ scopeVal := styledScopeBadge(scopeStr)
+
+ healthVal := lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render("✓ healthy")
+ if len(skillIssues) > 0 {
+ healthVal = errorStyle.Render("✗ issues detected")
+ }
+
lines := []string{
formatMetaLine("Source:", row.groupName, width),
- formatMetaLine("State:", stateStr, width),
+ formatMetaLine("State:", stateVal, width),
formatMetaLine("Skills:", fmt.Sprintf("%d visible / %d total", visible, total), width),
- formatMetaLine("Scope:", scopeStr, width),
+ formatMetaLine("Scope:", scopeVal, width),
}
if len(folders) > 0 {
@@ -404,23 +428,33 @@ func (m appModel) metadataLines(width int) []string {
lines = append(lines, formatMetaLine("Ref:", refs[0], width))
}
- healthStr := "healthy"
- if len(skillIssues) > 0 {
- healthStr = "issues detected"
- }
- lines = append(lines, formatMetaLine("Health:", healthStr, width))
+ lines = append(lines, formatMetaLine("Health:", healthVal, width))
if len(skillIssues) > 0 {
- lines = append(lines, "", healthHeaderStyle.Render("Health Issues"))
+ hasErrors := false
for _, issue := range skillIssues {
- line := fmt.Sprintf("- %s: %s", humanHealthIssueType(issue.Type), humanHealthIssueMessage(issue.Type, issue.Message))
- if issue.Path != "" {
- line += " (" + issue.Path + ")"
+ if issue.Severity == "error" {
+ hasErrors = true
+ break
}
+ }
+ headerText := "▲ Warnings"
+ headerStyle := warningStyle.Bold(true)
+ if hasErrors {
+ headerText = "✗ Health Issues"
+ headerStyle = healthHeaderStyle
+ }
+ lines = append(lines, "", headerStyle.Render(headerText))
+ for _, issue := range skillIssues {
+ bullet := " • "
style := warningStyle
if issue.Severity == "error" {
style = errorStyle
}
+ line := fmt.Sprintf("%s%s: %s", bullet, humanHealthIssueType(issue.Type), humanHealthIssueMessage(issue.Type, issue.Message))
+ if issue.Path != "" {
+ line += " (" + issue.Path + ")"
+ }
lines = append(lines, style.Render(wrapText(line, width)))
}
}
@@ -429,14 +463,18 @@ func (m appModel) metadataLines(width int) []string {
view := display.Skill(row.skill)
lines := []string{
- formatMetaLine("Scope:", string(view.Scope), width),
+ formatMetaLine("Scope:", styledScopeBadge(string(view.Scope)), width),
}
if sourceLines := sourceDetailLines(row.skill, width); len(sourceLines) > 0 {
lines = append(lines, sourceLines...)
} else {
// No source block to show; fall back to the lock/tracking state
// (covers "not tracked" and path-only locks).
- lines = append(lines, formatMetaLine("Lock:", display.LockSummary(view), width))
+ lockVal := display.LockSummary(view)
+ if lockVal == "not tracked" {
+ lockVal = warningStyle.Render("not tracked")
+ }
+ lines = append(lines, formatMetaLine("Lock:", lockVal, width))
}
if view.CanonicalPath != "" {
lines = append(lines, formatMetaLine("Canonical:", view.CanonicalPath, width))
@@ -467,7 +505,13 @@ func (m appModel) metadataLines(width int) []string {
lines = append(lines, "", sectionHeaderStyle.Render("Observed Paths"))
showObservedSection = true
}
- line := fmt.Sprintf("- %s %s %s", p.Agent, p.Scope, p.Status)
+ statusStyled := p.Status
+ if p.Status == "linked" || p.Status == "active" {
+ statusStyled = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render(p.Status)
+ } else {
+ statusStyled = dimStyle.Render(p.Status)
+ }
+ line := fmt.Sprintf(" • %s (%s): %s", p.Agent, p.Scope, statusStyled)
if p.TargetPath != "" {
line += " → " + p.TargetPath
}
@@ -479,29 +523,30 @@ func (m appModel) metadataLines(width int) []string {
if len(view.HealthIssues) > 0 {
issueErrors, _ := healthIssueCounts(view.HealthIssues)
headerStyle := warningStyle.Bold(true)
- header := "Warnings"
+ header := "▲ Warnings"
if issueErrors > 0 {
headerStyle = healthHeaderStyle
- header = "Health Issues"
+ header = "✗ Health Issues"
}
lines = append(lines, "", headerStyle.Render(header))
for _, issue := range view.HealthIssues {
- line := fmt.Sprintf("- %s: %s", humanHealthIssueType(issue.Type), humanHealthIssueMessage(issue.Type, issue.Message))
- if issue.Path != "" {
- line += " (" + issue.Path + ")"
- }
+ bullet := " • "
style := warningStyle
if issue.Severity == "error" {
style = errorStyle
}
+ line := fmt.Sprintf("%s%s: %s", bullet, humanHealthIssueType(issue.Type), humanHealthIssueMessage(issue.Type, issue.Message))
+ if issue.Path != "" {
+ line += " (" + issue.Path + ")"
+ }
lines = append(lines, style.Render(wrapText(line, width)))
}
}
if len(m.result.HealthIssues) > 0 {
- lines = append(lines, "", errorStyle.Render("Scan health"))
+ lines = append(lines, "", errorStyle.Render("✗ Scan Health Issues"))
for _, issue := range m.result.HealthIssues {
- lines = append(lines, truncate(fmt.Sprintf("- %s: %s", compat.SanitizeMetadata(issue.Type), compat.SanitizeMetadata(issue.Message)), width))
+ lines = append(lines, truncate(fmt.Sprintf(" • %s: %s", compat.SanitizeMetadata(issue.Type), compat.SanitizeMetadata(issue.Message)), width))
}
}
@@ -587,14 +632,64 @@ func (m appModel) previewLines(width int) []string {
return []string{dimStyle.Render("No preview available for this skill.")}
}
+ return renderMarkdownPreview(view.Preview, width)
+}
+
+func renderMarkdownPreview(markdown string, width int) []string {
+ markdown = stripMarkdownFrontmatter(markdown)
+ if strings.TrimSpace(markdown) == "" {
+ return []string{dimStyle.Render("No preview available for this skill.")}
+ }
+ renderWidth := max(20, width-2)
+ renderer, err := glamour.NewTermRenderer(
+ glamour.WithStyles(compactPreviewMarkdownStyle()),
+ glamour.WithWordWrap(renderWidth),
+ )
+ if err == nil {
+ rendered, renderErr := renderer.Render(markdown)
+ if renderErr == nil && strings.TrimSpace(rendered) != "" {
+ return strings.Split(strings.TrimRight(rendered, "\n"), "\n")
+ }
+ }
lines := []string{}
- previewLines := strings.Split(view.Preview, "\n")
- for _, line := range previewLines {
+ for _, line := range strings.Split(markdown, "\n") {
lines = append(lines, wrapText(line, width))
}
return lines
}
+func stripMarkdownFrontmatter(markdown string) string {
+ trimmed := strings.TrimLeft(markdown, "\ufeff\r\n\t ")
+ if !strings.HasPrefix(trimmed, "---\n") && !strings.HasPrefix(trimmed, "---\r\n") {
+ return markdown
+ }
+ lines := strings.Split(trimmed, "\n")
+ for i := 1; i < len(lines); i++ {
+ if strings.TrimSpace(lines[i]) == "---" {
+ return strings.Join(lines[i+1:], "\n")
+ }
+ }
+ return markdown
+}
+
+func compactPreviewMarkdownStyle() ansi.StyleConfig {
+ style := styles.DarkStyleConfig
+ zero := uint(0)
+ headingColor := "39"
+ bold := true
+ style.Document.Margin = &zero
+ style.Document.BlockPrefix = ""
+ style.Document.BlockSuffix = ""
+ style.Heading.BlockSuffix = ""
+ style.H1.Prefix = "# "
+ style.H1.Suffix = ""
+ style.H1.Color = &headingColor
+ style.H1.BackgroundColor = nil
+ style.H1.Bold = &bold
+ style.HorizontalRule.Format = strings.Repeat("─", 8)
+ return style
+}
+
func (m appModel) detailLines(width int) []string {
if m.modalSource != "" {
return m.sourceModalDetailLines(width)
@@ -626,9 +721,9 @@ func (m appModel) detailLines(width int) []string {
func (m appModel) sourceModalDetailLines(width int) []string {
groupName := m.modalSource
visible, total := m.getGroupCounts(groupName)
- stateStr := "expanded"
+ stateVal := "▼ expanded"
if m.isCollapsed(groupName) {
- stateStr = "collapsed"
+ stateVal = "▶ collapsed"
}
skills := m.sourceGroupSkills(groupName)
@@ -663,11 +758,18 @@ func (m appModel) sourceModalDetailLines(width int) []string {
scopeStr = "unknown"
}
+ scopeVal := styledScopeBadge(scopeStr)
+
+ healthVal := lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render("✓ healthy")
+ if len(skillIssues) > 0 {
+ healthVal = errorStyle.Render("✗ issues detected")
+ }
+
lines := []string{
formatMetaLine("Source:", groupName, width),
- formatMetaLine("State:", stateStr, width),
+ formatMetaLine("State:", stateVal, width),
formatMetaLine("Skills:", fmt.Sprintf("%d visible / %d total", visible, total), width),
- formatMetaLine("Scope:", scopeStr, width),
+ formatMetaLine("Scope:", scopeVal, width),
}
if len(folders) > 0 {
@@ -677,23 +779,33 @@ func (m appModel) sourceModalDetailLines(width int) []string {
lines = append(lines, formatMetaLine("Ref:", refs[0], width))
}
- healthStr := "healthy"
- if len(skillIssues) > 0 {
- healthStr = "issues detected"
- }
- lines = append(lines, formatMetaLine("Health:", healthStr, width))
+ lines = append(lines, formatMetaLine("Health:", healthVal, width))
if len(skillIssues) > 0 {
- lines = append(lines, "", healthHeaderStyle.Render("Health Issues"))
+ hasErrors := false
for _, issue := range skillIssues {
- line := fmt.Sprintf("- %s: %s", humanHealthIssueType(issue.Type), humanHealthIssueMessage(issue.Type, issue.Message))
- if issue.Path != "" {
- line += " (" + issue.Path + ")"
+ if issue.Severity == "error" {
+ hasErrors = true
+ break
}
+ }
+ headerText := "▲ Warnings"
+ headerStyle := warningStyle.Bold(true)
+ if hasErrors {
+ headerText = "✗ Health Issues"
+ headerStyle = healthHeaderStyle
+ }
+ lines = append(lines, "", headerStyle.Render(headerText))
+ for _, issue := range skillIssues {
+ bullet := " • "
style := warningStyle
if issue.Severity == "error" {
style = errorStyle
}
+ line := fmt.Sprintf("%s%s: %s", bullet, humanHealthIssueType(issue.Type), humanHealthIssueMessage(issue.Type, issue.Message))
+ if issue.Path != "" {
+ line += " (" + issue.Path + ")"
+ }
lines = append(lines, style.Render(wrapText(line, width)))
}
}
@@ -707,14 +819,21 @@ func (m appModel) sourceModalDetailLines(width int) []string {
for idx, cr := range childRows {
if !cr.isAvailable {
installedCount++
- scopeBadgeStr := "P"
- if cr.skill.Scope == model.ScopeGlobal {
- scopeBadgeStr = "G"
- }
- label := fmt.Sprintf("%s [%s]", cr.skill.Name, scopeBadgeStr)
if idx == m.modalSelected {
- lines = append(lines, selectedStyle.Render(fmt.Sprintf("> %s", label)))
+ scopeBadgeStr := "P"
+ if cr.skill.Scope == model.ScopeGlobal {
+ scopeBadgeStr = "G"
+ }
+ label := fmt.Sprintf("%s [%s]", cr.skill.Name, scopeBadgeStr)
+ lines = append(lines, selectedStyle.Render(fmt.Sprintf("› %s", label)))
} else {
+ var scopeBadgeStyled string
+ if cr.skill.Scope == model.ScopeProject {
+ scopeBadgeStyled = scopeProjectStyle.Render("[P]")
+ } else {
+ scopeBadgeStyled = scopeGlobalStyle.Render("[G]")
+ }
+ label := fmt.Sprintf("%s %s", cr.skill.Name, scopeBadgeStyled)
lines = append(lines, fmt.Sprintf(" %s", label))
}
}
@@ -754,10 +873,11 @@ func (m appModel) sourceModalDetailLines(width int) []string {
for idx, cr := range childRows {
if cr.isAvailable {
availableCount++
- label := fmt.Sprintf("%s [available]", cr.discoveredSkill.Name)
if idx == m.modalSelected {
- lines = append(lines, selectedStyle.Render(fmt.Sprintf("> %s", label)))
+ label := fmt.Sprintf("%s [available]", cr.discoveredSkill.Name)
+ lines = append(lines, selectedStyle.Render(fmt.Sprintf("› %s", label)))
} else {
+ label := fmt.Sprintf("%s %s", cr.discoveredSkill.Name, lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render("[available]"))
lines = append(lines, fmt.Sprintf(" %s", label))
}
}
@@ -779,7 +899,7 @@ func (m appModel) sourceModalDetailLines(width int) []string {
lines = append(lines,
titleStyle.Render(ds.Name+" [available]"),
"",
- formatMetaLine("Status:", "available", width),
+ formatMetaLine("Status:", lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render("available"), width),
formatMetaLine("Source:", ds.Source, width),
)
if ds.SkillPath != "" {
@@ -798,11 +918,15 @@ func (m appModel) sourceModalDetailLines(width int) []string {
} else {
sk := selectedChild.skill
view := display.Skill(sk)
+ lockVal := display.LockSummary(view)
+ if lockVal == "not tracked" {
+ lockVal = warningStyle.Render("not tracked")
+ }
lines = append(lines,
titleStyle.Render(view.Name),
"",
- formatMetaLine("Scope:", string(view.Scope), width),
- formatMetaLine("Lock:", display.LockSummary(view), width),
+ formatMetaLine("Scope:", styledScopeBadge(string(view.Scope)), width),
+ formatMetaLine("Lock:", lockVal, width),
)
if sourceLines := sourceDetailLines(sk, width); len(sourceLines) > 0 {
lines = append(lines, sourceLines...)
@@ -854,7 +978,15 @@ func (m appModel) visibilitySummary(view display.SkillView, width int) []string
case "missing_agent_link":
statusText = "not linked"
}
- val := fmt.Sprintf("%s: %s", visibility.Display, statusText)
+ var statusStyled string
+ if visibility.Visible {
+ statusStyled = lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render(statusText)
+ } else if visibility.Reason == "broken_symlink" {
+ statusStyled = errorStyle.Render(statusText)
+ } else {
+ statusStyled = dimStyle.Render(statusText)
+ }
+ val := fmt.Sprintf("%s: %s", visibility.Display, statusStyled)
if visibility.Path != "" {
val += " at " + visibility.Path
}
@@ -906,7 +1038,15 @@ func (m appModel) visibilitySummary(view display.SkillView, width int) []string
}
}
}
- val := fmt.Sprintf("Available to %d/%d %s", visible, total, label)
+ var val string
+ fraction := fmt.Sprintf("%d/%d", visible, total)
+ if visible == total && total > 0 {
+ val = fmt.Sprintf("Available to %s %s", lipgloss.NewStyle().Foreground(lipgloss.Color("114")).Render(fraction), label)
+ } else if visible > 0 {
+ val = fmt.Sprintf("Available to %s %s", warningStyle.Render(fraction), label)
+ } else {
+ val = fmt.Sprintf("Available to %s %s", errorStyle.Render(fraction), label)
+ }
return []string{formatMetaLine("Visibility:", val, width)}
}