repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

neovim: refactor lsp

824690a8d2b004c36abbe80cadf8a4004ba7c3f9

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (223)

.gitignore

Modified
1 1 tresor/box_do_key
3 +**/__pycache__
3 5 gh/hosts.yml
5 7 nugu/output/

MangoHud/MangoHud.conf

Added
new file mode 100644
1 +################### File Generated by Goverlay 1.6.5 stable ###################
2 +legacy_layout=false
4 +background_alpha=0.6
5 +round_corners=10
6 +background_color=000000
7 +font_size=24
8 +text_color=FFFFFF
9 +position=top-left
10 +toggle_hud=Shift_R+F12
11 +pci_dev=0:2d:00.0
12 +table_columns=3
13 +gpu_text=GPU
14 +gpu_stats
15 +gpu_load_change
16 +gpu_load_value=50,90
17 +gpu_load_color=FFFFFF,FFAA7F,CC0000
18 +vram
19 +vram_color=AD64C1
20 +gpu_core_clock
21 +gpu_mem_clock
22 +gpu_temp
23 +gpu_power
24 +gpu_color=2E9762
25 +cpu_text=CPU
26 +cpu_stats
27 +cpu_load_change
28 +cpu_load_value=50,90
29 +cpu_load_color=FFFFFF,FFAA7F,CC0000
30 +cpu_mhz
31 +cpu_temp
32 +cpu_power
33 +cpu_color=2E97CB
34 +ram
35 +ram_color=C26693
36 +battery
37 +battery_color=00FF00
38 +fps
39 +frame_timing
40 +frametime_color=00FF00
41 +engine_version
42 +engine_color=EB5B5B
43 +fps_limit_method=late
44 +toggle_fps_limit=Shift_L+F1
45 +fps_limit=0
46 +#offset=0
47 +vsync=4
48 +fps_color_change
49 +fps_color=B22222,FDFD09,39F900
50 +fps_value=30,60
51 +output_folder=/home/oli
52 +log_duration=30
53 +log_interval=100
54 +toggle_logging=Shift_L+F2
55 +blacklist=zenity,protonplus,lsfg-vk-ui,bazzar,gnome-calculator,pamac-manager,lact,ghb,bitwig-studio,ptyxis,yumex

containers/systemd/user/wills-world.container

Added
new file mode 100644
1 +[Unit]
2 +Description=NixOS Container - Will's World
4 +[Container]
5 +Image=docker.io/nixos/nix:latest
6 +Exec=bash -c "source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && sleep infinity"
7 +Volume=/home/oli/Will/World:/root:Z
8 +ContainerName=wills-world
9 +Memory=2g
10 +PodmanArgs=--cpus=2
12 +[Service]
13 +Restart=on-failure
15 +[Install]
16 +WantedBy=multi-user.target

desktop.symlinks

Added
new file mode 100644
1 +Notes
2 +~/Notes
4 +git/gitconfig
5 +~/.config/git/config
7 +git/gitattributes
8 +~/.config/git/gitattributes
10 +git/gitconfig.bugabinga
11 +~/.config/git/.gitconfig.include
13 +gh
14 +~/.config/gh
16 +subversion/config
17 +~/.subversion/config
19 +subversion/diff
20 +~/.local/bin/svn.diff
22 +subversion/merge
23 +~/.local/bin/svn.merge
25 +cargo/config.toml
26 +~/.cargo/config.toml
28 +bat/config
29 +~/.config/bat/config
31 +MangoHud
32 +~/.config/MangoHud
34 +MusicBrainz
35 +~/.config/MusicBrainz
37 +rbw
38 +~/.config/rbw
40 +opencode
41 +~/.config/opencode
43 +containers
44 +~/.config/containers
46 +jj
47 +~/.config/jj
49 +glow
50 +~/.config/glow
52 +mise
53 +~/.config/mise
55 +systemd/user/work.slice
56 +~/.config/systemd/user/work.slice
58 +mpv
59 +~/.config/mpv
61 +cmus/nugu.theme
62 +~/.config/cmus/nugu.theme
64 +nushell/config.nu
65 +~/.config/nushell/config.nu
67 +nushell/env.nu
68 +~/.config/nushell/env.nu
70 +nushell/login.nu
71 +~/.config/nushell/login.nu
73 +nushell/gen-aliases.nu
74 +~/.config/nushell/gen-aliases.nu
76 +nushell/gen-secrets.nu
77 +~/.config/nushell/gen-secrets.nu
79 +nushell/modules
80 +~/.config/nushell/modules
82 +topgrade/topgrade.toml
83 +~/.config/topgrade.toml
85 +topgrade/lnx.toml
86 +~/.config/topgrade.d/lnx.toml
88 +wezterm
89 +~/.config/wezterm
91 +ssh/config
92 +~/.ssh/config
94 +neovim
95 +~/.config/nvim
97 +neovide
98 +~/.config/neovide
100 +zed
101 +~/.config/zed
103 +niri
104 +~/.config/niri
106 +fonts
107 +~/.local/share/fonts
109 +fontconfig
110 +~/.config/fontconfig
112 +aerc/binds.conf
113 +~/.config/aerc/binds.conf
115 +aerc/aerc.conf
116 +~/.config/aerc/aerc.conf
118 +pueue
119 +~/.config/pueue
121 +pueue/pueued.service
122 +~/.config/systemd/user/pueued.service
124 +psd/psd.conf
125 +~/.config/psd/psd.conf
127 +tresor/1078030f-e587-4ed3-bce9-15f6ad113390
128 +~/.ssh/github.key
130 +tresor/1be0bc56-591a-4630-8ba4-0007506841cf
131 +~/.ssh/box.bugabinga.net.key
133 +tresor/f3c469df-6b5a-4755-897c-9597ca10b0af
134 +~/.ssh/klops.key
136 +tresor/f8f81035-cb10-4639-965f-2a1c33a7ce9e
137 +~/.ssh/tini.key

firefox/profiles.ini

Deleted
deleted file mode 100644
1 -[Install4F96D1932A9F858E]
2 -Default=qrza8u52.default-release
3 -Locked=1
5 -[InstallEE2BC402DB89A7EB]
6 -Default=kkbfwv6y.default-nightly
7 -Locked=1
9 -[Profile1]
10 -Name=default-nightly
11 -IsRelative=1
12 -Path=kkbfwv6y.default-nightly
14 -[Profile0]
15 -Name=default-release
16 -IsRelative=1
17 -Path=qrza8u52.default-release
18 -Default=1
20 -[General]
21 -Version=2
23 -[Install11457493C5A56847]
24 -Default=qrza8u52.default-release
25 -Locked=1

firefox/qrza8u52.default-release/user.js

Deleted
deleted file mode 100644
1 -// Printer Settings Default off
2 -user_pref("print.print_footerleft", "");
3 -user_pref("print.print_footerright", "");
4 -user_pref("print.print_headerleft", "");
5 -user_pref("print.print_headerright", "");
7 -// PREF: Disable Pocket
8 -// https://support.mozilla.org/en-US/kb/save-web-pages-later-pocket-firefox
9 -// https://github.com/pyllyukko/user.js/issues/143
10 -user_pref("browser.pocket.enabled", false);
11 -user_pref("extensions.pocket.enabled", false);
13 -// PREF: Enable blocking reported web forgeries
14 -// https://wiki.mozilla.org/Security/Safe_Browsing
15 -// http://kb.mozillazine.org/Safe_browsing
16 -// https://support.mozilla.org/en-US/kb/how-does-phishing-and-malware-protection-work
17 -// http://forums.mozillazine.org/viewtopic.php?f=39&t=2711237&p=12896849#p12896849
18 -// CIS 2.3.4
19 -user_pref("browser.safebrowsing.enabled", true); // Firefox < 50
20 -user_pref("browser.safebrowsing.phishing.enabled", true); // firefox >= 50
22 -// PREF: Enable blocking reported attack sites
23 -// http://kb.mozillazine.org/Browser.safebrowsing.malware.enabled
24 -// CIS 2.3.5
25 -user_pref("browser.safebrowsing.malware.enabled", true);
27 -// PREF: Disable querying Google Application Reputation database for downloaded binary files
28 -// https://www.mozilla.org/en-US/firefox/39.0/releasenotes/
29 -// https://wiki.mozilla.org/Security/Application_Reputation
30 -user_pref("browser.safebrowsing.downloads.remote.enabled", false);
32 -// PREF: Disable "Recommended by Pocket" in Firefox Quantum
33 -user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
35 -// PREF: Enable Global Privacy Control (GPC) (Firefox >= 120)
36 -// https://support.mozilla.org/1/firefox/126.0/Linux/en-US/global-privacy-control
37 -// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-GPC
38 -// https://globalprivacycontrol.org/
39 -user_pref("privacy.globalprivacycontrol.enabled", true);
41 -// PREF: Disable Firefox Hello metrics collection
42 -// https://groups.google.com/d/topic/mozilla.dev.platform/nyVkCx-_sFw/discussion
43 -user_pref("loop.logDomains", false);
45 -// PREF: Disable the built-in PDF viewer
46 -// https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-2743
47 -// https://blog.mozilla.org/security/2015/08/06/firefox-exploit-found-in-the-wild/
48 -// https://www.mozilla.org/en-US/security/advisories/mfsa2015-69/
49 -user_pref("pdfjs.disab
50 - // PREF: Enable Firefox Tracking Protection
51 -// https://wiki.mozilla.org/Security/Tracking_protection
52 -// https://support.mozilla.org/en-US/kb/tracking-protection-firefox
53 -// https://support.mozilla.org/en-US/kb/tracking-protection-pbm
54 -// https://kontaxis.github.io/trackingprotectionfirefox/
55 -// https://feeding.cloud.geek.nz/posts/how-tracking-protection-works-in-firefox/
56 -user_pref("privacy.trackingprotection.enabled", true);
57 -user_pref("privacy.trackingprotection.pbmode.enabled", true);
59 -// PREF: Enable contextual identity Containers feature (Firefox >= 52)
60 -// NOTICE: Containers are not available in Private Browsing mode
61 -// https://wiki.mozilla.org/Security/Contextual_Identity_Project/Containers
62 -user_pref("privacy.userContext.enabled", true);
64 -// PREF: Enable Firefox's anti-fingerprinting mode ("resist fingerprinting" or RFP) (Tor Uplift project)
65 -// https://wiki.mozilla.org/Security/Tor_Uplift/Tracking
66 -// https://bugzilla.mozilla.org/show_bug.cgi?id=1333933
67 -// https://wiki.mozilla.org/Security/Fingerprinting
68 -// NOTICE: RFP breaks some keyboard shortcuts used in certain websites (see #443)
69 -// NOTICE: RFP changes your time zone
70 -// NOTICE: RFP breaks some DDoS protection pages (Cloudflare)
71 -user_pref("privacy.resistFingerprinting", true);led", true);
73 -// PREF: Disable Extension recommendations (Firefox >= 65)
74 -// https://support.mozilla.org/en-US/kb/extension-recommendations
75 -user_pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr", false);
77 -// PREF: Trusted Recursive Resolver (DNS-over-HTTPS) (disabled)
78 -// https://wiki.mozilla.org/Trusted_Recursive_Resolver
79 -//user_pref("network.trr.mode", 0);
81 -// PREF: Disable WebIDE
82 -// https://trac.torproject.org/projects/tor/ticket/16222
83 -// https://developer.mozilla.org/docs/Tools/WebIDE
84 -user_pref("devtools.webide.enabled", false);
85 -user_pref("devtools.webide.autoinstallADBHelper", false);
86 -user_pref("devtools.webide.autoinstallFxdtAdapters", false);
88 -// PREF: Disable remote debugging
89 -// https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_Desktop
90 -// https://developer.mozilla.org/en-US/docs/Tools/Tools_Toolbox#Advanced_settings
91 -user_pref("devtools.debugger.remote-enabled", false);
92 -user_pref("devtools.chrome.enabled", false);
93 -user_pref("devtools.debugger.force-local", true);
95 -// PREF: Disable Mozilla telemetry/experiments
96 -// https://wiki.mozilla.org/Platform/Features/Telemetry
97 -// https://wiki.mozilla.org/Privacy/Reviews/Telemetry
98 -// https://wiki.mozilla.org/Telemetry
99 -// https://www.mozilla.org/en-US/legal/privacy/firefox.html#telemetry
100 -// https://support.mozilla.org/t5/Firefox-crashes/Mozilla-Crash-Reporter/ta-p/1715
101 -// https://wiki.mozilla.org/Security/Reviews/Firefox6/ReviewNotes/telemetry
102 -// https://gecko.readthedocs.io/en/latest/browser/experiments/experiments/manifest.html
103 -// https://wiki.mozilla.org/Telemetry/Experiments
104 -// https://support.mozilla.org/en-US/questions/1197144
105 -// https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/internals/preferences.html#id1
106 -user_pref("toolkit.telemetry.enabled", false);
107 -user_pref("toolkit.telemetry.unified", false);
108 -user_pref("toolkit.telemetry.archive.enabled", false);
109 -user_pref("experiments.supported", false);
110 -user_pref("experiments.enabled", false);
111 -user_pref("experiments.manifest.uri", "");
113 -// PREF: Disallow Necko to do A/B testing
114 -// https://trac.torproject.org/projects/tor/ticket/13170
115 -user_pref("network.allow-experiments", false);
117 -// PREF: Disable sending Firefox crash reports to Mozilla servers
118 -// https://wiki.mozilla.org/Breakpad
119 -// http://kb.mozillazine.org/Breakpad
120 -// https://dxr.mozilla.org/mozilla-central/source/toolkit/crashreporter
121 -// https://bugzilla.mozilla.org/show_bug.cgi?id=411490
122 -// A list of submitted crash reports can be found at about:crashes
123 -user_pref("breakpad.reportURL", "");
125 -// PREF: Disable sending reports of tab crashes to Mozilla (about:tabcrashed), don't nag user about unsent crash reports
126 -// https://hg.mozilla.org/mozilla-central/file/tip/browser/app/profile/firefox.js
127 -user_pref("browser.tabs.crashReporting.sendReport", false);
128 -user_pref("browser.crashReports.unsubmittedCheck.enabled", false);
130 -// PREF: Disable FlyWeb (discovery of LAN/proximity IoT devices that expose a Web interface)
131 -// https://wiki.mozilla.org/FlyWeb
132 -// https://wiki.mozilla.org/FlyWeb/Security_scenarios
133 -// https://docs.google.com/document/d/1eqLb6cGjDL9XooSYEEo7mE-zKQ-o-AuDTcEyNhfBMBM/edit
134 -// http://www.ghacks.net/2016/07/26/firefox-flyweb
135 -user_pref("dom.flyweb.enabled", false);
137 -// PREF: Disable the UITour backend
138 -// https://trac.torproject.org/projects/tor/ticket/19047#comment:3
139 -user_pref("browser.uitour.enabled", false);
141 -// PREF: Disable the "new tab page" feature and show a blank tab instead
142 -// https://wiki.mozilla.org/Privacy/Reviews/New_Tab
143 -// https://support.mozilla.org/en-US/kb/new-tab-page-show-hide-and-customize-top-sites#w_how-do-i-turn-the-new-tab-page-off
144 -user_pref("browser.newtabpage.enabled", false);
145 -user_pref("browser.newtab.url", "about:blank");
148 -// PREF: Disable Snippets
149 -// https://wiki.mozilla.org/Firefox/Projects/Firefox_Start/Snippet_Service
150 -// https://support.mozilla.org/en-US/kb/snippets-firefox-faq
151 -user_pref("browser.newtabpage.activity-stream.feeds.snippets", false);
153 -// PREF: Disable Activity Stream
154 -// https://wiki.mozilla.org/Firefox/Activity_Stream
155 -user_pref("browser.newtabpage.activity-stream.enabled", false);
157 -// PREF: Disable new tab tile ads & preload
158 -// http://www.thewindowsclub.com/disable-remove-ad-tiles-from-firefox
159 -// http://forums.mozillazine.org/viewtopic.php?p=13876331#p13876331
160 -// https://wiki.mozilla.org/Tiles/Technical_Documentation#Ping
161 -// https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-source
162 -// https://gecko.readthedocs.org/en/latest/browser/browser/DirectoryLinksProvider.html#browser-newtabpage-directory-ping
163 -// TODO: deprecated? not in DXR, some dead links
164 -user_pref("browser.newtabpage.enhanced", false);
165 -user_pref("browser.newtab.preload", false);
166 -user_pref("browser.newtabpage.directory.ping", "");
167 -user_pref("browser.newtabpage.directory.source", "data:text/plain,{}");
169 -// PREF: Disable Mozilla VPN ads on the about:protections page
170 -// https://support.mozilla.org/en-US/kb/what-mozilla-vpn-and-how-does-it-work
171 -// https://en.wikipedia.org/wiki/Mozilla_VPN
172 -// https://blog.mozilla.org/security/2021/08/31/mozilla-vpn-security-audit/
173 -// https://www.mozilla.org/en-US/security/advisories/mfsa2021-31/
174 -user_pref("browser.vpn_promo.enabled", false);
176 - // PREF: Do not check if Firefox is the default browser
177 -user_pref("browser.shell.checkDefaultBrowser", false);
181 -// PREF: Enable HTTPS-Only Mode
182 -// https://blog.mozilla.org/security/2020/11/17/firefox-83-introduces-https-only-mode/
183 -// https://www.feistyduck.com/bulletproof-tls-newsletter/issue_71_firefox_introduces_https_only_mode
184 -user_pref("dom.security.https_only_mode", true);
186 -// PREF: Enable HSTS preload list (pre-set HSTS sites list provided by Mozilla)
187 -// https://blog.mozilla.org/security/2012/11/01/preloading-hsts/
188 -// https://wiki.mozilla.org/Privacy/Features/HSTS_Preload_List
189 -// https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
190 -user_pref("network.stricttransportsecurity.preloadlist", true);
192 -// PREF: Enable Online Certificate Status Protocol
193 -// https://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol
194 -// https://www.imperialviolet.org/2014/04/19/revchecking.html
195 -// https://www.maikel.pro/blog/current-state-certificate-revocation-crls-ocsp/
196 -// https://wiki.mozilla.org/CA:RevocationPlan
197 -// https://wiki.mozilla.org/CA:ImprovingRevocation
198 -// https://wiki.mozilla.org/CA:OCSP-HardFail
199 -// https://news.netcraft.com/archives/2014/04/24/certificate-revocation-why-browsers-remain-affected-by-heartbleed.html
200 -// https://news.netcraft.com/archives/2013/04/16/certificate-revocation-and-the-performance-of-ocsp.html
201 -// NOTICE: OCSP leaks your IP and domains you visit to the CA when OCSP Stapling is not available on visited host
202 -// NOTICE: OCSP is vulnerable to replay attacks when nonce is not configured on the OCSP responder
203 -// NOTICE: OCSP adds latency (performance)
204 -// NOTICE: Short-lived certificates are not checked for revocation (security.pki.cert_short_lifetime_in_days, default:10)
205 -// CIS Version 1.2.0 October 21st, 2011 2.2.4
206 -user_pref("security.OCSP.enabled", 1);
208 -// PREF: Enable OCSP Stapling support
209 -// https://en.wikipedia.org/wiki/OCSP_stapling
210 -// https://blog.mozilla.org/security/2013/07/29/ocsp-stapling-in-firefox/
211 -// https://www.digitalocean.com/community/tutorials/how-to-configure-ocsp-stapling-on-apache-and-nginx
212 -user_pref("security.ssl.enable_ocsp_stapling", true);
214 -// PREF: Enable OCSP Must-Staple support (Firefox >= 45)
215 -// https://blog.mozilla.org/security/2015/11/23/improving-revocation-ocsp-must-staple-and-short-lived-certificates/
216 -// https://www.entrust.com/ocsp-must-staple/
217 -// https://github.com/schomery/privacy-settings/issues/40
218 -// NOTICE: Firefox falls back on plain OCSP when must-staple is not configured on the host certificate
219 -user_pref("security.ssl.enable_ocsp_must_staple", true);
221 -// PREF: Require a valid OCSP response for OCSP enabled certificates
222 -// https://groups.google.com/forum/#!topic/mozilla.dev.security/n1G-N2-HTVA
223 -// Disabling this will make OCSP bypassable by MitM attacks suppressing OCSP responses
224 -// NOTICE: `security.OCSP.require` will make the connection fail when the OCSP responder is unavailable
225 -// NOTICE: `security.OCSP.require` is known to break browsing on some [captive portals](https://en.wikipedia.org/wiki/Captive_portal)
226 -user_pref("security.OCSP.require", true);
228 -// PREF: Disable TLS Session Tickets
229 -// https://www.blackhat.com/us-13/briefings.html#NextGen
230 -// https://media.blackhat.com/us-13/US-13-Daigniere-TLS-Secrets-Slides.pdf
231 -// https://media.blackhat.com/us-13/US-13-Daigniere-TLS-Secrets-WP.pdf
232 -// https://bugzilla.mozilla.org/show_bug.cgi?id=917049
233 -// https://bugzilla.mozilla.org/show_bug.cgi?id=967977
234 -user_pref("security.ssl.disable_session_identifiers", true);
236 -// PREF: Only allow TLS 1.[2-3]
237 -// http://kb.mozillazine.org/Security.tls.version.*
238 -// 1 = TLS 1.0 is the minimum required / maximum supported encryption protocol. (This is the current default for the maximum supported version.)
239 -// 2 = TLS 1.1 is the minimum required / maximum supported encryption protocol.
240 -// 3 = TLS 1.2 is the minimum required / maximum supported encryption protocol.
241 -// 4 = TLS 1.3 is the minimum required / maximum supported encryption protocol.
242 -user_pref("security.tls.version.min", 3);
243 -user_pref("security.tls.version.max", 4);
245 -// PREF: Disable insecure TLS version fallback
246 -// https://bugzilla.mozilla.org/show_bug.cgi?id=1084025
247 -// https://github.com/pyllyukko/user.js/pull/206#issuecomment-280229645
248 -user_pref("security.tls.version.fallback-limit", 4);
250 -// PREF: Enforce Public Key Pinning
251 -// https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning
252 -// https://wiki.mozilla.org/SecurityEngineering/Public_Key_Pinning
253 -// "2. Strict. Pinning is always enforced."
254 -user_pref("security.cert_pinning.enforcement_level", 2);
256 -// PREF: Disallow SHA-1
257 -// https://bugzilla.mozilla.org/show_bug.cgi?id=1302140
258 -// https://shattered.io/
259 -user_pref("security.pki.sha1_enforcement_level", 1);
261 -// PREF: Warn the user when server doesn't support RFC 5746 ("safe" renegotiation)
262 -// https://wiki.mozilla.org/Security:Renegotiation#security.ssl.treat_unsafe_negotiation_as_broken
263 -// https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3555
264 -user_pref("security.ssl.treat_unsafe_negotiation_as_broken", true);
266 -// PREF: Disallow connection to servers not supporting safe renegotiation (disabled)
267 -// https://wiki.mozilla.org/Security:Renegotiation#security.ssl.require_safe_negotiation
268 -// https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2009-3555
269 -// TODO: `security.ssl.require_safe_negotiation` is more secure but makes browsing next to impossible (2012-2014-... - `ssl_error_unsafe_negotiation` errors), so is left disabled
270 -//user_pref("security.ssl.require_safe_negotiation", true);
272 -// PREF: Disable automatic reporting of TLS connection errors
273 -// https://support.mozilla.org/en-US/kb/certificate-pinning-reports
274 -// we could also disable security.ssl.errorReporting.enabled, but I think it's
275 -// good to leave the option to report potentially malicious sites if the user
276 -// chooses to do so.
277 -// you can test this at https://pinningtest.appspot.com/
278 -user_pref("security.ssl.errorReporting.automatic", false);
280 -// PREF: Pre-populate the current URL but do not pre-fetch the certificate in the "Add Security Exception" dialog
281 -// http://kb.mozillazine.org/Browser.ssl_override_behavior
282 -// https://github.com/pyllyukko/user.js/issues/210
283 -user_pref("browser.ssl_override_behavior", 1);
285 -// PREF: Encrypted SNI (when TRR is enabled)
286 -// https://www.cloudflare.com/ssl/encrypted-sni/
287 -// https://wiki.mozilla.org/Trusted_Recursive_Resolver#ESNI
288 -// https://en.wikipedia.org/wiki/Server_Name_Indication#Security_implications_(ESNI)
289 -user_pref("network.security.esni.enabled", true);
291 -// PREF: Disable null ciphers
292 -user_pref("security.ssl3.rsa_null_sha", false);
293 -user_pref("security.ssl3.rsa_null_md5", false);
294 -user_pref("security.ssl3.ecdhe_rsa_null_sha", false);
295 -user_pref("security.ssl3.ecdhe_ecdsa_null_sha", false);
296 -user_pref("security.ssl3.ecdh_rsa_null_sha", false);
297 -user_pref("security.ssl3.ecdh_ecdsa_null_sha", false);
299 -// PREF: Disable SEED cipher
300 -// https://en.wikipedia.org/wiki/SEED
301 -user_pref("security.ssl3.rsa_seed_sha", false);
303 -// PREF: Disable 40/56/128-bit ciphers
304 -// 40-bit ciphers
305 -user_pref("security.ssl3.rsa_rc4_40_md5", false);
306 -user_pref("security.ssl3.rsa_rc2_40_md5", false);
307 -// 56-bit ciphers
308 -user_pref("security.ssl3.rsa_1024_rc4_56_sha", false);
309 -// 128-bit ciphers
310 -user_pref("security.ssl3.rsa_camellia_128_sha", false);
311 -user_pref("security.ssl3.ecdhe_rsa_aes_128_sha", false);
312 -user_pref("security.ssl3.ecdhe_ecdsa_aes_128_sha", false);
313 -user_pref("security.ssl3.ecdh_rsa_aes_128_sha", false);
314 -user_pref("security.ssl3.ecdh_ecdsa_aes_128_sha", false);
315 -user_pref("security.ssl3.dhe_rsa_camellia_128_sha", false);
316 -user_pref("security.ssl3.dhe_rsa_aes_128_sha", false);
318 -// PREF: Disable RC4
319 -// https://developer.mozilla.org/en-US/Firefox/Releases/38#Security
320 -// https://bugzilla.mozilla.org/show_bug.cgi?id=1138882
321 -// https://rc4.io/
322 -// https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-2566
323 -user_pref("security.ssl3.ecdh_ecdsa_rc4_128_sha", false);
324 -user_pref("security.ssl3.ecdh_rsa_rc4_128_sha", false);
325 -user_pref("security.ssl3.ecdhe_ecdsa_rc4_128_sha", false);
326 -user_pref("security.ssl3.ecdhe_rsa_rc4_128_sha", false);
327 -user_pref("security.ssl3.rsa_rc4_128_md5", false);
328 -user_pref("security.ssl3.rsa_rc4_128_sha", false);
329 -user_pref("security.tls.unrestricted_rc4_fallback", false);
331 -// PREF: Disable 3DES (effective key size is < 128)
332 -// https://en.wikipedia.org/wiki/3des#Security
333 -// http://en.citizendium.org/wiki/Meet-in-the-middle_attack
334 -// http://www-archive.mozilla.org/projects/security/pki/nss/ssl/fips-ssl-ciphersuites.html
335 -user_pref("security.ssl3.dhe_dss_des_ede3_sha", false);
336 -user_pref("security.ssl3.dhe_rsa_des_ede3_sha", false);
337 -user_pref("security.ssl3.ecdh_ecdsa_des_ede3_sha", false);
338 -user_pref("security.ssl3.ecdh_rsa_des_ede3_sha", false);
339 -user_pref("security.ssl3.ecdhe_ecdsa_des_ede3_sha", false);
340 -user_pref("security.ssl3.ecdhe_rsa_des_ede3_sha", false);
341 -user_pref("security.ssl3.rsa_des_ede3_sha", false);
342 -user_pref("security.ssl3.rsa_fips_des_ede3_sha", false);
344 -// PREF: Disable ciphers with ECDH (non-ephemeral)
345 -user_pref("security.ssl3.ecdh_rsa_aes_256_sha", false);
346 -user_pref("security.ssl3.ecdh_ecdsa_aes_256_sha", false);
348 -// PREF: Disable 256 bits ciphers without PFS
349 -user_pref("security.ssl3.rsa_camellia_256_sha", false);
351 -// PREF: Enable GCM ciphers (TLSv1.2 only)
352 -// https://en.wikipedia.org/wiki/Galois/Counter_Mode
353 -user_pref("security.ssl3.ecdhe_ecdsa_aes_128_gcm_sha256", true); // 0xc02b
354 -user_pref("security.ssl3.ecdhe_rsa_aes_128_gcm_sha256", true); // 0xc02f
356 -// PREF: Enable ChaCha20 and Poly1305 (Firefox >= 47)
357 -// https://www.mozilla.org/en-US/firefox/47.0/releasenotes/
358 -// https://tools.ietf.org/html/rfc7905
359 -// https://bugzilla.mozilla.org/show_bug.cgi?id=917571
360 -// https://bugzilla.mozilla.org/show_bug.cgi?id=1247860
361 -// https://cr.yp.to/chacha.html
362 -user_pref("security.ssl3.ecdhe_ecdsa_chacha20_poly1305_sha256", true);
363 -user_pref("security.ssl3.ecdhe_rsa_chacha20_poly1305_sha256", true);
365 -// PREF: Disable ciphers susceptible to the logjam attack
366 -// https://weakdh.org/
367 -user_pref("security.ssl3.dhe_rsa_camellia_256_sha", false);
368 -user_pref("security.ssl3.dhe_rsa_aes_256_sha", false);
370 -// PREF: Disable ciphers with DSA (max 1024 bits)
371 -user_pref("security.ssl3.dhe_dss_aes_128_sha", false);
372 -user_pref("security.ssl3.dhe_dss_aes_256_sha", false);
373 -user_pref("security.ssl3.dhe_dss_camellia_128_sha", false);
374 -user_pref("security.ssl3.dhe_dss_camellia_256_sha", false);
376 -// PREF: Ciphers with CBC & SHA-1 (disabled)
377 -//user_pref("security.ssl3.rsa_aes_256_sha", false); // 0x35
378 -//user_pref("security.ssl3.rsa_aes_128_sha", false); // 0x2f
379 -//user_pref("security.ssl3.ecdhe_rsa_aes_256_sha", false); // 0xc014
380 -//user_pref("security.ssl3.ecdhe_ecdsa_aes_256_sha", false); // 0xc00a
382 -// PREF: Enable X25519Kyber768Draft00 (post-quantum key exchange) [FF Nightly 2024-01-18+]
383 -// https://datatracker.ietf.org/doc/draft-tls-westerbaan-xyber768d00/
384 -// https://twitter.com/bwesterb/status/1748017372764475519
385 -// https://pq.cloudflareresearch.com/
386 -user_pref("security.tls.enable_kyber", true);

git-hooks/README

Deleted
deleted file mode 100644

No text changes.

git-hooks/poly/poly-launcher.ps1

Deleted
deleted file mode 100755
1 -#!/bin/sh
2 -echo `# <#`
3 -final_current_script_file_path="$0"
4 -final_current_script_file_name=$(basename "$final_current_script_file_path")
5 -final_parent_directory_path=$(dirname $(dirname "$final_current_script_file_path"))
6 -final_java_file_path="$final_parent_directory_path/$final_current_script_file_name.java"
7 -if [ -f "$final_java_file_path" ]; then
8 - exec java "$final_java_file_path"
9 -fi
10 -exit
11 -#> > $null
13 -# TODO: figure this out on win32
15 -$finalCurrentScriptFilePath = Split-Path $MyInvocation.PSCommandPath -Leaf
16 -Write-Host $finalCurrentScriptFilePath
17 -$finalCurrentScriptFileName = [System.IO.Path]::GetFileNameWithoutExtension($finalCurrentScriptFilePath)
18 -$finalParentDirectoryPath = [System.IO.Path]::GetDirectoryName($finalCurrentScriptFilePath)
19 -$finalJavaFilePath = Join-Path $finalParentDirectoryPath "$finalCurrentScriptFileName.java"
21 -Write-Host "Executing $finalJavaFilePath"
23 -if (Test-Path $finalJavaFilePath) {
24 - java $finalJavaFilePath
25 -}

git-hooks/poly/pre-push

Deleted
deleted file mode 120000
1 -poly-launcher.ps1

git-hooks/pre-push.java

Deleted
deleted file mode 100644
1 -import java.util.Arrays;
3 -interface __ {
4 - static void main( String[] arguments) {
5 - System.out.println("Recevied args: " + Arrays.toString(arguments));
6 - }
7 -}

git/gitconfig

Modified
1 1 [alias]
2 - m = mergetool
4 - rc = rebase --continue
5 - ra = rebase --abort
7 - ci = commit --all
8 - st = status --short
10 - # interactive add
11 - ap = add --patch
13 2 a = add --all
3 + ap = add --patch
4 + ci = commit --all
5 + co = checkout
6 + bare = clone --bare
15 7 l = log --all --graph --pretty=format:'%C(magenta)%h %C(white) %an %ar%C(auto) %D%n%s%n'
8 + m = mergetool
9 + ra = rebase --abort
10 + rc = rebase --continue
11 + st = status --short
12 + w = worktree
13 + unstage = reset HEAD --
14 + last = log -1 HEAD
15 + ui = !gitu
17 17 [core]
18 - editor = nvim
19 - quotepath = false
18 + attributesfile = .gitattributes
20 19 autocrlf = false
20 + compression = 9
21 + editor = nvim
22 + fscache = true
23 + fsmonitor = true
24 + preloadindex = true
25 + quotepath = false
21 26 safecrlf = false
22 27 symlinks = true
23 - fscache = true
24 - preloadindex = true
25 - fsmonitor = true
26 - attributesfile = .gitattributes
27 28 untrackedcache = true
28 - compression = 9
29 + pager = delta
29 30 whitespace = error
31 32 [log]
71 72 required = true
73 74 [help]
74 - format = html
75 - # try to automatically correct mispelled git commands
75 + # try to automatically correct misspelled git commands
76 76 autocorrect = 1
78 78 [color]
93 93 renames = copies
94 94 interHunkContext = 10
95 95 colorMoved = default
96 - tool = difftastic
96 + tool = zed
98 98 [difftool]
99 99 prompt = false
101 -[difftool "meld"]
102 - cmd = "meld \"$LOCAL\" \"$REMOTE\""
101 +[difftool "zed"]
102 + cmd = "zeditor --wait --diff \"$LOCAL\" \"$REMOTE\""
104 104 [difftool "difftastic"]
105 105 cmd = "difft \"$LOCAL\" \"$REMOTE\""
107 -[pager]
108 - difftool = true
110 107 [merge]
111 108 tool = vim
109 + autostash = true
112 110 conflictstyle = zdiff3
114 112 [mergetool]
123 121 cmd = "nvim -d \"$LOCAL\" \"$MERGED\" \"$REMOTE\" "
125 123 [branch]
126 - sort = -committerdate
124 + sort = commiterdate
129 127 sort = version:refname
151 149 line-numbers = true
152 150 decorations = true
153 151 navigate = true
154 - syntax-theme = none
156 -[interactive]
157 - diffFilter = delta --color-only
159 153 [init]
160 154 defaultBranch = trunk
162 156 [commit]
163 157 verbose = true
159 +[submodule]
160 + recurse = true
165 162 [difftool "difftastic"]
166 163 # See `man git-difftool` for a description of MERGED, LOCAL and REMOTE.
167 164 cmd = difft "$MERGED" "$LOCAL" "abcdef1" "100644" "$REMOTE" "abcdef2" "100644"

glow/glow.yml

Added
new file mode 100644
1 +# style name or JSON path (default "auto")
2 +style: "auto"
3 +# mouse support (TUI-mode only)
4 +mouse: false
5 +# use pager to display markdown
6 +pager: false
7 +# word-wrap at width
8 +width: 80
9 +# show all files, including hidden and ignored.
10 +all: false

jj/config.toml

Added
new file mode 100644
1 +[user]
2 +name = "Oliver Jan Krylow"
3 +email = "oliver@bugabinga.net"
5 +[ui]
6 +default-command = "log"
7 +editor = "neovide --no-fork"

justfile

Modified
11 11 services:
12 12 nu enable_user_services.nu
14 +# install git hooks with lefthook
15 +hooks:
16 + lefthook install
14 18 # remove links to dorkfiles in HOME
15 19 unlink:
16 20 java bootstripper.java clean
23 27 git fetch
24 28 git branch --set-upstream-to=origin/trunk trunk
30 +# initial setup: link dotfiles, enable services, install hooks, fix permissions
31 +setup: link services hooks fix_permissions
26 33 # install previously exported winget apps. see topgrade config for exports.
27 34 import_winget:
28 35 winget import C:/Users/okr/Tools/winget_installed_apps.json

lefthook.yml

Added
new file mode 100644
1 +pre-commit:
2 + commands:
3 + gitleaks:
4 + run: gitleaks git --pre-commit --staged

mise/config.toml

Added
new file mode 100644
1 +[tools]
2 +"cargo:kdl-lsp" = "latest"
3 +"github:dev-cycles/contextive" = "latest"
4 +"go:github.com/edouard-claude/snip/cmd/snip" = "latest"
5 +"npm:gh-actions-language-server" = "latest"
7 +[settings]
8 +experimental = true

neovim/AGENTS.md

Modified
85 85 first).
86 86 4. **Plugin config** — Lives in `lua/bugabinga/` alongside native config.
88 +### Module Export Pattern
90 +Modules expose functionality two ways:
92 +**Side-effect modules** (most common): The module runs setup code on `require`
93 +and returns nothing. Use for plugins, autocmd registration, keymap setup, etc.
95 +```lua
96 +-- Module: sets up autocmds, registers keymaps, etc.
97 +-- Test: require triggers side effects
98 +require 'bugabinga.some_plugin'
99 +```
101 +**When a side-effect module needs to expose test-only or external APIs**, it
102 +creates a `_G` global with capitalized name:
104 +| Module path | Global name |
105 +| ---------------------- | --------------------- |
106 +| `bugabinga.statusline` | `BugabingaStatusline` |
107 +| `bugabinga.cmdline` | `BugabingaCmdline` |
108 +| `bugabinga.cycle` | `BugabingaCycle` |
109 +| `bugabinga.d2` | `BugabingaD2` |
110 +| `bugabinga.treesitter` | `BugabingaTreesitter` |
112 +The naming convention: drop the `lua/` prefix, replace dots with the module name
113 +parts capitalized, e.g. `bugabinga.foo_bar` → `BugabingaFooBar`.
115 +The module returns its global table, so
116 +`require('bugabinga.d2') === BugabingaD2` always holds — same table identity.
118 +Use `_G` globals only when needed — for test assertions or when external callers
119 +(internally or via `:BugabingaXxx` commands) need to invoke module functions.
120 +Library modules that are properly `require`d and used by other modules do not
121 +need this pattern.
88 123 ## Key stdlib APIs
90 125 ### std.auto(group_name)
197 232 - Table: `return { foo = foo, bar = bar }`
198 233 - setmetatable callable: `return setmetatable({...}, {__call = func})`
199 234 - Function: `return function(...) end`
200 - - Side-effect (plugin setup): no return needed
235 + - Side-effect (plugin setup): no return needed; if test/external access is
236 + needed, create a `_G.CapitalizedName` global (see Module Export Pattern
237 + above)
201 238 - **Avoid**: `local M = {}` / `function M.xxx()` / `return M` — use
202 239 `local function xxx()` and return the table at the end
203 240 - **Global table shadowing**: Modules do `local table = require 'std.table'`

neovim/after/ftplugin/markdown.lua

Modified
1 --- spell checking ON
2 -vim.opt_local.spell = true
1 +vim.opt_local.spell = false

neovim/colors/nugu.lua

Modified
1 -local const = require 'std.const'
1 +-- local const = require 'std.const'
3 3 if vim.g.colors_name then
4 - vim.cmd [[ highlight clear ]]
5 -else
6 - vim.opt.background = const.os_background
4 + vim.cmd [[ highlight clear ]]
5 + -- else
6 + -- NOTE: on linux, this is not needed anymore. check win32
7 + -- vim.opt.background = const.os_background
9 10 vim.g.colors_name = 'nugu'

neovim/documentation/specs/000-Spec-Zero.md

Added
new file mode 100644
1 +---
2 +author: Oliver Jan Krylow
3 +date: 2026-04-06
4 +status: done
5 +tags: [spec, meta]
6 +---
8 +# Spec Zero
10 +This is a specification of `specs`. A file-based system of persistent prompt,
11 +that encode human intent to AI's over time.
13 +Specs are Markdown files with YAML frontmatter. While the YAML has a strict
14 +schema, the Markdown part is a relatively free form prompt text. All spec files
15 +live in `documentation/specs` in arbitrary subfolders (or flat) and form a
16 +undirected graph by linking to each other.
18 +## Metadata in Frontmatter
20 +The schema for the YAML frontmatter metadata is:
22 +```yaml
23 +author: author name and email
24 +date: YYYY-MM-DD
25 +status: some status
26 +tags: [list of labels]
27 +```
29 +All fields are required, and only `tags` may be empty.
31 +## Human Intent in Markdown Prompt Text
33 +The whole point of a spec is to communicate human intent to AI Agents about
34 +software projects. As such, specs are basically normal LLM prompts but:
36 +- are persistent over time
37 +- have metadata
38 +- are carefully reviewed by humans and AIs
40 +That means we expect specs to be written and maintained by humans (with possible
41 +assistance by AI) and read many times by various agent systems.
43 +The scope of specs are anything about a software project, that a human cares
44 +about and values. That includes definitions of undesired state. By contrast,
45 +anything not specified by specs, is up to the interpretation of AI's. Specs are
46 +expected to be re-read by AI's many times in attempts to align the software with
47 +the specification.
49 +### Recommendations for a good spec
51 +- use bullet points, it helps in keeping it concise and short
52 +- not only define positive state (wishes, features, desired behaviour), but also
53 + negative space (things that are forbidden, should never happen, are undesired)
54 +- use references and keep them up to date
56 +### References to other specs
58 +3 types of references are supported:
60 +Markdown inline links:
62 +```md
63 +This is [inline link](/some-file.md#some-heading). This is an internal
64 +[anchor link](#heading).
65 +```
67 +Markdown reference links:
69 +```md
70 +See [reference].
72 +[reference]: /url "Title"
73 +```
75 +And Wiki-Links:
77 +```md
78 +Link to [[another-note]]. Link to [[another-notes#heading]]. Internal link to
79 +[[#a-heading]].
80 +```
82 +While all 3 types can be used for any kind of reference, the preferred mapping
83 +is:
85 +- external URLs -> reference link
86 +- internal ref to spec -> wiki link
87 +- anything else -> inline link
89 +## File Structure for Specs
91 +Spec files are placed in `./documentation/specs` in the local project root. The
92 +sub-folder hierarchy in this folder is arbitrary and may be organized by
93 +whatever system makes sense for the project.
95 +Spec files are markdown files with a strict naming pattern: `<XXXX>-<title>.md`.
97 +**XXXX**: 4 globally unique characters (`[a-zA-Z0-9]{4}`).
99 +**title**: a short and sluggified version of the spec title (e.g. "Spec Zero"
100 +becomes "0000-spec-zero") is recommended, but may be anything.
102 +The title is only meant to be a reminder about the long title. But it is
103 +imperative that the `<XXXX>` 4 characters are globally unique, such that specs
104 +can be referenced unambiguously across the entire project regardless of folder
105 +structure.
107 +Spec Zero is always named `0000-spec-zero.md` and placed in
108 +`./documentation/specs`. Example spec file structures: Flat:
110 +```
111 +-- ./documentation/specs
112 +-------------------------- 0000-spec-zero.md
113 +-------------------------- a88t-general-idea.md
114 +-------------------------- 94yt-main-view.md
115 +-------------------------- 123d-login-system.md
116 +-------------------------- 11hf-security.md
117 +-------------------------- 04n4-visual-design-and-language.md
118 +-------------------------- dfjr-the-send-button.md
119 +```
121 +Tree:
123 +```
124 +-- ./documentation/specs
125 +-------------------------- 0000-spec-zero.md
126 +-------------------------- general-idea/
127 +---------------------------- A001.md
128 +---------------------------- A002.md
129 +-------------------------- main-view/
130 +---------------------------- B001.md
131 +---------------------------- B002.md
132 +-------------------------- login-system/
133 +---------------------------- C001.md
134 +---------------------------- C002.md
135 +---------------------------- C003.md
136 +---------------------------- C004.md
137 +-------------------------- security/
138 +---------------------------- D001.md
139 +-------------------------- visual-design-and-language/
140 +---------------------------- E001.md
141 +---------------------------- E002.md
142 +-------------------------- the-send-button/
143 +---------------------------- F001.md
144 +```
146 +Or the files may be entirely unstructured. It is up to the human to decide a
147 +structure and for the AI's to interpret it.

neovim/documentation/specs/001-Multi-Module-Workspaces-With-LSPs.md

Added
new file mode 100644
1 +---
2 +author: Oliver Jan Krylow
3 +date: 2026-04-06
4 +status: wip
5 +tags: [lsp, projects]
6 +---
8 +# Multi module workspaces with LSPs
10 +In NeoVim, the model to map a buffer (file) to LSP server is very simplistic:
11 +Get the root directory of the buffer and start the LSP with that as its
12 +`rootUri`. If a LSP with that `rootUri` is already running, map the buffer to
13 +that LSP, otherwise start a fresh one.
15 +The way to determine the root directory of a buffer, is highly dependent on the
16 +configuration of the LSP in `lsp/*.lua`, but typically it uses a function based
17 +on `vim.fs.root` to traverse up the buffers path, until some special file or
18 +folder is found.
20 +That pattern is typically encoded with the `root_markers` shorthand config in
21 +the LSP configuration, that simply lists those special files.
23 +A common `root_marker` is `.git`, because for most simple cases, it can be
24 +assumed, that a version controlled directory managed by git, is some kind of
25 +"software project".
27 +However, what constitutes a "project" in practice is undefined and highly
28 +dependent on the context and practices of the development team.
30 +For example, I tend to work in projects, that are setup with a more complicated
31 +and nested structure. Projects may contain sub-projects and sub-projects may or
32 +may not use the same programming language as the host project.
34 +Some examples of nested projects I work on:
36 +## Dotfiles
38 +My dotfiles repo at `~/Workspaces/dotfiles` is a git repository, that contains
39 +configuration files for my host machines for various programs. Each program,
40 +such as neovim, wezterm or git, uses wildly different configuration formats and
41 +languages. This is an instance, where the simplistic `root_markers = {'.git'}`
42 +pattern can cause issues, because when I open the neovim config directory, I
43 +expect the root to be that, and not the dotfiles repo, where the `.git` folder
44 +happens to reside.
46 +## Java
48 +The Java projects I work on tend to be organized as maven multi module projects.
49 +If the `root_marker` was simply a `pom.xml` file, NeoVim, with a naive
50 +configuration, would spawn an LSP per sub module.
52 +## Zig
54 +Projects in Zig often use git sub modules for dependencies. Similar to Java
55 +projects, NeoVim would spawn multiple LSPs, when navigating such a code base.
57 +## Rust
59 +Projects in Rust are typically organized with cargo, and often I use workspaces
60 +to manage crates. There is complicated setup code in `lsp/rust_analyzer.lua`
61 +that is highly specific to cargo, that handles this case, so technically, this
62 +problem is solved for this case.
64 +## The Problem
66 +In each case, the problem I experience with the simplistic default model of
67 +NeoVim is
69 +- performance: Many LSP servers get launched in the background for large
70 + projects
71 +- usability: Since the LSPs of the sub projects are not aware of each other,
72 + certain features like code navigation, rename and others, do not work across
73 + sub projects.
75 +## Attempted solution in the past
77 +In the past, I wrote the `std.project` module to solve this issue. The idea was
78 +to have a more complicated mechanism to determine the root directory, by scoring
79 +many marker files based on their importance in a given language and their
80 +distance to the buffer file.
82 +And while the module does work well and as intended, I never really figured out
83 +how to integrate it with the LSP configuration such that:
85 +- the LSP initially starts with the correct `rootUri` of the host project
86 +- sub projects do not spawn a new LSP, but add themselves to the `workspaceUris`
87 + of the LSP
88 +- simple projects still work well
89 +- single file mode for buffers, where it makes sense, still works well
91 +In theory, LSPs can be configured in their initializations and during runtime,
92 +to add more "root directories" to a running instance. Those are called
93 +`workspaces` in the language server spec.
95 +## Investigation results
97 +### Root resolution already works
99 +Sample projects in `sample_files/projects/` were created to mimic the scenarios
100 +above. Testing `std.project` and `vim.fs.root` (via `root_markers`) against
101 +them showed that the stated problems are largely already solved by existing
102 +mechanisms:
104 +| Scenario | Naive `root_markers` | Result | Why |
105 +|---|---|---|---|
106 +| **Java multi-module** | `pom.xml` -> per module | jdtls uses priority `root_markers`: `mvnw`/`gradlew`/`.git` (high) then `pom.xml`/`build.gradle` (low) -> host root | No `std.project` needed |
107 +| **Zig + C deps** | `build.zig` -> host | zls finds `build.zig` at host level. C files in submodules have their own `.git` boundary. zls filetype gate prevents attaching to `.c` files | Works out of the box |
108 +| **Dotfiles neovim** | `.git` -> dotfiles root | lua_ls uses `std.project` which scores `.luarc.json`/`.stylua.toml` higher than `.git` -> roots to `neovim/` | Works with `std.project`, also works with lspconfig `root_markers` priority |
109 +| **Dotfiles wezterm** | `.git` -> dotfiles root | No lua-specific markers nearby -> falls back to dotfiles root. Fix: add `.luarc.jsonc` with wezterm-specific settings | Trivial fix, no module needed |
110 +| **Polyglot mono** | `.git` -> monorepo root | Each lspconfig config has language-specific markers (`build.zig`, `Cargo.toml`, `deno.json`) that resolve to the correct sub-project | Works out of the box |
112 +### `std.project` is only used by `lua_ls`
114 +Grep shows `std.project` is required only in `lsp/lua_ls.lua`. Every other LSP
115 +config uses `root_markers` or a custom `root_dir` function.
117 +### nvim-lspconfig replaces almost all custom configs
119 +Diffing each `lsp/*.lua` against upstream nvim-lspconfig showed that most are
120 +copies with only cosmetic differences (indentation, doc comments). lspconfig
121 +now ships configs as `lsp/*.lua` that `vim.lsp.config` auto-discovers and
122 +merges with local overrides.
124 +### `.lsp.settings.lua` is a dead convention
126 +The file in `~/Workspaces/dotfiles/wezterm/` is only used as a heavy marker
127 +(weight=7) by `std.project`. Its contents (lua_ls settings) are never loaded.
128 +The same purpose is better served by `.luarc.jsonc`, which lua_ls reads
129 +natively and which also acts as a root_marker.
131 +## Action plan
133 +### 1. Migrate wezterm to `.luarc.jsonc`
135 +Replace `~/Workspaces/dotfiles/wezterm/.lsp.settings.lua` with
136 +`~/Workspaces/dotfiles/wezterm/.luarc.jsonc`:
138 +```jsonc
140 + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
141 + "runtime.version": "Lua 5.4",
142 + "hint.enable": false
144 +```
146 +This also makes `.luarc.jsonc` a root_marker, fixing wezterm root detection
147 +without `std.project`.
149 +### 2. Add nvim-lspconfig as a plugin
151 +nvim-lspconfig provides `lsp/*.lua` configs that `vim.lsp.config` auto-discovers
152 +and merges with local overrides.
154 +### 3. Delete configs that lspconfig handles
156 +Delete all `lsp/*.lua` files where lspconfig provides an equivalent or better
157 +config. Verified by diffing against upstream for each:
159 +- ast_grep, clangd, contextive, cssls, denols, gopls, html, jdtls, jsonls,
160 + just, kdl_ls, markdown_oxide, marksman, nushell, protols, rust_analyzer,
161 + sqls, superhtml, taplo, yamlls, ziggy, ziggy_schema, zls
163 +**Keep** `tofu_ls` (not in lspconfig).
165 +### 4. Replace `lua_ls` with minimal override
167 +Lspconfig provides `cmd`, `filetypes`, `root_markers` (with priority), and
168 +`settings` (codeLens + hints). Keep only the `on_init` override that
169 +conditionally applies Neovim-config-specific settings (LuaJIT, diagnostics
170 +globals, runtime paths).
172 +Must use `realpath` + `normalize` because `~/.config/nvim` is a symlink.
173 +l``stdpath('config')` returns `/home/me/.config/nvim` (symlink), while
174 +`workspace_folders[1].name` resolves to the real path
175 +(`/home/me/Workspace/dotfiles/neovim/...`). The comparison would fail
176 +without `realpath`.
178 +### 5. Remove `std.project` module
180 +- Delete `lua/std/project.lua`
181 +- Delete `tests/std/project_spec.lua`
182 +- Delete `tests/project_probe.lua`
183 +- Delete `~/Workspace/dotfiles/wezterm/.lsp.settings.lua`
185 +### 6. Clean up sample projects
187 +Keep `sample_files/projects/` — they document the edge cases that informed
188 +this decision.

neovim/init.lua

Modified
9 9 -- ▀ ▀
11 11 local version = vim.version()
12 -local expected = { major = 0, minor = 11 }
12 +local expected = { major = 0, minor = 12 }
13 13 if version.major ~= expected.major or version.minor ~= expected.minor then
14 14 vim.notify(
15 15 'This configuration assumes NeoVim version ' ..
16 16 expected.major .. '.' .. expected.minor .. ', but it is ' .. version.major .. '.' .. version.minor .. '!',
17 - vim.log.levels.ERROR)
17 + vim.log.levels.ERROR )
18 18 return
33 33 events = 'VimEnter',
34 34 description = 'Measure startup time of neovim.',
35 35 once = true,
36 - command = function()
37 - local end_time = vim.uv.hrtime()
36 + command = function ()
37 + local end_time = vim.uv.hrtime() ---@diagnostic disable-line: undefined-field
38 38 local time_elapsed = end_time - start_time
39 - vim.schedule(function()
39 + vim.schedule( function ()
40 40 local time_elapsed_ms = time_elapsed / 1e6
41 - local msg = string.format('Neovim started in (%d ms).', time_elapsed_ms)
42 - vim.notify(msg, vim.log.levels.INFO)
43 - end)
41 + local msg = string.format( 'Neovim started in (%d ms).', time_elapsed_ms )
42 + vim.notify( msg, vim.log.levels.INFO )
43 + end )
44 44 end,
49 49 require 'patches'
51 +--- Defers loading the module to end of vim main loop.
52 +--- Useful for modules, that need not be loaded immediately on nvim startup.
53 +---
54 +--- @see require
55 +local defer = vim.schedule_wrap( require )
57 +--- Some modules need to be loaded immediately, when vim is started with parameters (files or folders),
58 +--- but could be deferred, when vim is started 'naked'.
59 +--- This function does that.
60 +--- If vim was started with no arguments, it defers loading the module, otherwise it is loaded immediately.
61 +---
62 +--- @param module_name string Name of lua module
63 +local defer_on_naked = function ( module_name )
64 + local now_if_args = vim.fn.argc( -1 ) > 0 and require or defer
65 + now_if_args( module_name )
66 +end
51 68 --[[ MY STUFF ]]
52 -require 'bugabinga.bigfile'
53 -require 'bugabinga.diagnostic'
54 -require 'bugabinga.editorconfig'
55 -require 'bugabinga.lsp'
56 -require 'bugabinga.snippet'
57 -require 'bugabinga.code_action'
58 -require 'bugabinga.statusline'.setup()
59 -require 'bugabinga.mkdir'
60 69 require 'bugabinga.options'
61 -require 'bugabinga.cycle'
62 -require 'bugabinga.sessions'
63 -require 'bugabinga.treesitter'
64 -require 'bugabinga.terminal'
65 -require 'bugabinga.cmdline'
66 -require 'bugabinga.inlay'
70 +defer_on_naked 'bugabinga.treesitter'
71 +defer_on_naked 'bugabinga.lsp'
72 +defer_on_naked 'bugabinga.bigfile'
73 +defer_on_naked 'bugabinga.editorconfig'
74 +defer 'bugabinga.sessions'
75 +defer 'bugabinga.statusline'
76 +defer 'bugabinga.diagnostic'
77 +defer 'bugabinga.cmdline'
78 +defer 'bugabinga.snippet'
79 +defer 'bugabinga.code_action'
80 +defer 'bugabinga.mkdir'
81 +defer 'bugabinga.cycle'
82 +defer 'bugabinga.terminal'
83 +defer 'bugabinga.inlay'
84 +defer 'bugabinga.d2'
87 +-- Key changes
88 +-- - 6 redundant keymaps removedj(gra/gri/grn/grr/grt/CTRL-S — Neovim 0.11 defaults)
89 +-- - 8 keymaps moved to buffer-local (grd, grwl, grwa, grwr, grc, grC, grh, grH)
90 +-- - 3 new keymaps added (grD, grs, grl)
91 +-- - Document highlight added (CursorHold + clear on CursorMoved)
92 +-- - Codelens support added (grl + auto-refresh)
93 +-- - LspRestart now: no args=buffer-local, bang=global, args=named
94 +-- - LspReload uses vim.lsp.enable instead of deprecated stop_client
95 +-- - Nil guards added to LspCapabilities/LspConfig
96 +-- - Buffer-scoped inlay hint toggle
98 +-- Plugins handle deferred loading via puk.
99 +-- No need to use `defer(...)`
68 101 --[[ PLUGINS ]]
102 +--TODO: slowly move over plugins to "my stuff"
69 103 require 'bugabinga.opencode'
70 104 require 'bugabinga.autotag'
71 105 require 'bugabinga.colorizer'
73 107 require 'bugabinga.diff'
74 108 require 'bugabinga.file_explorer'
75 109 require 'bugabinga.format'
76 -require 'bugabinga.d2'
77 110 require 'bugabinga.fuzzy_find'
78 -require 'bugabinga.grapple'
111 +require 'bugabinga.bookmarks'
79 112 require 'bugabinga.jump2d'
80 113 require 'bugabinga.key_preview'
81 114 require 'bugabinga.move'

neovim/lsp/clangd.lua

Modified
1 1 -- https://clangd.llvm.org/extensions.html#switch-between-sourceheader
2 +local user_command = require 'std.user_command'
2 4 local function switch_source_header(bufnr, client)
3 5 local method_name = 'textDocument/switchSourceHeader'
4 6 ---@diagnostic disable-next-line:param-type-mismatch
83 85 end,
84 86 on_attach = function(client, bufnr)
85 - vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdSwitchSourceHeader', function()
87 + user_command.buffer(bufnr).LspClangdSwitchSourceHeader 'Switch between source/header' (function()
86 88 switch_source_header(bufnr, client)
87 - end, { desc = 'Switch between source/header' })
89 + end)
89 - vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdShowSymbolInfo', function()
91 + user_command.buffer(bufnr).LspClangdShowSymbolInfo 'Show symbol info' (function()
90 92 symbol_info(bufnr, client)
91 - end, { desc = 'Show symbol info' })
93 + end)
92 94 end,

neovim/lsp/contextive.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [Contextive](https://github.com/dev-cycles/contextive)
4 +--- Language server for terminology/autocompletion from central definition files.
6 +---@type vim.lsp.Config
7 +return {
8 + cmd = { 'Contextive.LanguageServer' },
9 + root_markers = { '.contextive' },
10 + workspace_required = true,

neovim/lsp/cssls.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [vscode-css-language-server](https://github.com/hrsh7th/vscode-langservers-extracted)
5 +---@type vim.lsp.Config
6 +return {
7 + cmd = { 'vscode-css-language-server', '--stdio' },
8 + filetypes = { 'css', 'scss', 'less' },
9 + root_markers = { 'package.json', '.git' },
10 + init_options = { provideFormatter = true },
11 + settings = {
12 + css = { validate = true },
13 + scss = { validate = true },
14 + less = { validate = true },
15 + },

neovim/lsp/denols.lua

Added
new file mode 100644
1 +local lsp = vim.lsp
3 +local function virtual_text_document_handler(uri, res, client)
4 + if not res then
5 + return nil
6 + end
8 + local lines = vim.split(res.result, '\n')
9 + local bufnr = vim.uri_to_bufnr(uri)
11 + local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
12 + if #current_buf ~= 0 then
13 + return nil
14 + end
16 + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
17 + vim.api.nvim_set_option_value('readonly', true, { buf = bufnr })
18 + vim.api.nvim_set_option_value('modified', false, { buf = bufnr })
19 + vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr })
20 + lsp.buf_attach_client(bufnr, client.id)
21 +end
23 +local function virtual_text_document(uri, client)
24 + local params = {
25 + textDocument = {
26 + uri = uri,
27 + },
28 + }
29 + local result = client.request_sync('deno/virtualTextDocument', params)
30 + virtual_text_document_handler(uri, result, client)
31 +end
33 +local function denols_handler(err, result, ctx, config)
34 + if not result or vim.tbl_isempty(result) then
35 + return nil
36 + end
38 + local client = vim.lsp.get_client_by_id(ctx.client_id)
39 + for _, res in pairs(result) do
40 + local uri = res.uri or res.targetUri
41 + if uri:match '^deno:' then
42 + if client then
43 + virtual_text_document(uri, client)
44 + end
45 + res['uri'] = uri
46 + res['targetUri'] = uri
47 + end
48 + end
50 + lsp.handlers[ctx.method](err, result, ctx, config)
51 +end
53 +local function buf_cache(bufnr, client)
54 + local params = {
55 + command = 'deno.cache',
56 + arguments = { {}, vim.uri_from_bufnr(bufnr) },
57 + }
58 + client.request('workspace/executeCommand', params, function(err, _result, ctx)
59 + if err then
60 + local uri = ctx.params.arguments[2]
61 + vim.api.nvim_err_writeln('cache command failed for ' .. vim.uri_to_fname(uri))
62 + end
63 + end, bufnr)
64 +end
66 +return {
67 + cmd = { 'deno', 'lsp' },
68 + cmd_env = { NO_COLOR = true },
69 + filetypes = {
70 + 'javascript',
71 + 'javascriptreact',
72 + 'typescript',
73 + 'typescriptreact',
74 + 'json',
75 + 'jsonc',
76 + 'markdown',
77 + },
78 + root_markers = { 'deno.json', 'deno.jsonc' },
79 + workspace_required = true,
80 + settings = {
81 + deno = {
82 + enable = true,
83 + suggest = {
84 + imports = {
85 + hosts = {
86 + ['https://deno.land'] = true,
87 + },
88 + },
89 + },
90 + },
91 + },
92 + handlers = {
93 + ['textDocument/definition'] = denols_handler,
94 + ['textDocument/typeDefinition'] = denols_handler,
95 + ['textDocument/references'] = denols_handler,
96 + },
97 + on_attach = function(client, bufnr)
98 + local user_command = require 'std.user_command'
99 + user_command.buffer(bufnr).DenolsCache 'Cache a module and all of its dependencies.' { nargs = 0 } (function()
100 + local clients = vim.lsp.get_clients { bufnr = 0, name = 'denols' }
101 + if #clients > 0 then
102 + buf_cache(0, clients[#clients])
103 + end
104 + end)
105 + end,
106 + commands = {
107 + DenolsCache = {
108 + function()
109 + local clients = vim.lsp.get_clients { bufnr = 0, name = 'denols' }
110 + if #clients > 0 then
111 + buf_cache(0, clients[#clients])
112 + end
113 + end,
114 + description = 'Cache a module and all of its dependencies.',
115 + },
116 + },
117 + _test = {
118 + denols_handler = denols_handler,
119 + buf_cache = buf_cache,
120 + },

neovim/lsp/html.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [vscode-html-language-server](https://github.com/hrsh7th/vscode-langservers-extracted)
5 +---@type vim.lsp.Config
6 +return {
7 + cmd = { 'vscode-html-language-server', '--stdio' },
8 + filetypes = { 'html' },
9 + root_markers = { 'package.json', '.git' },
10 + init_options = {
11 + provideFormatter = true,
12 + embeddedLanguages = { css = true, javascript = true },
13 + configurationSection = { 'html', 'css', 'javascript' },
14 + },

neovim/lsp/jdtls.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- https://projects.eclipse.org/projects/eclipse.jdt.ls
4 +---
5 +--- Language server for Java.
6 +---
7 +--- ```lua
8 +--- -- init.lua
9 +--- vim.lsp.enable('jdtls')
10 +--- ```
11 +---
12 +--- You can also pass extra custom jvm arguments with the JDTLS_JVM_ARGS environment variable as a space separated list of arguments,
13 +--- that will be converted to multiple --jvm-arg=<param> args when passed to the jdtls script. This will allow for example tweaking
14 +--- the jvm arguments or integration with external tools like lombok:
15 +---
16 +--- ```sh
17 +--- export JDTLS_JVM_ARGS="-javaagent:$HOME/.local/share/java/lombok.jar"
18 +--- ```
19 +---
20 +local function get_jdtls_cache_dir()
21 + return vim.fn.stdpath 'cache' .. '/jdtls'
22 +end
24 +local function get_jdtls_workspace_dir()
25 + return get_jdtls_cache_dir() .. '/workspace'
26 +end
28 +local function get_jdtls_jvm_args()
29 + local env = os.getenv 'JDTLS_JVM_ARGS'
30 + local args = {}
31 + for a in string.gmatch( (env or ''), '%S+' ) do
32 + local arg = string.format( '--jvm-arg=%s', a )
33 + table.insert( args, arg )
34 + end
35 + return unpack( args )
36 +end
38 +local root_markers1 = {
39 + -- Multi-module projects
40 + 'mvnw', -- Maven
41 + 'gradlew', -- Gradle
42 + 'settings.gradle', -- Gradle
43 + 'settings.gradle.kts', -- Gradle
44 + -- Use git directory as last resort for multi-module maven projects
45 + -- In multi-module maven projects it is not really possible to determine what is the parent directory
46 + -- and what is submodule directory. And jdtls does not break if the parent directory is at higher level than
47 + -- actual parent pom.xml so propagating all the way to root git directory is fine
48 + '.git',
50 +local root_markers2 = {
51 + -- Single-module projects
52 + 'build.xml', -- Ant
53 + 'pom.xml', -- Maven
54 + 'build.gradle', -- Gradle
55 + 'build.gradle.kts', -- Gradle
58 +---@type vim.lsp.Config
59 +return {
60 + ---@param dispatchers? vim.lsp.rpc.Dispatchers
61 + ---@param config vim.lsp.ClientConfig
62 + cmd = function ( dispatchers, config )
63 + local workspace_dir = get_jdtls_workspace_dir()
64 + local data_dir = workspace_dir
66 + if config.root_dir then
67 + data_dir = data_dir .. '/' .. vim.fn.fnamemodify( config.root_dir, ':p:h:t' )
68 + end
70 + local config_cmd = {
71 + 'jdtls',
72 + '-data',
73 + data_dir,
74 + get_jdtls_jvm_args(),
75 + }
77 + return vim.lsp.rpc.start( config_cmd, dispatchers, {
78 + cwd = config.cmd_cwd,
79 + env = config.cmd_env,
80 + detached = config.detached,
81 + } )
82 + end,
83 + filetypes = { 'java' },
84 + root_markers = vim.fn.has 'nvim-0.11.3' == 1 and { root_markers1, root_markers2 }
85 + or vim.list_extend( root_markers1, root_markers2 ),
86 + init_options = {},

neovim/lsp/jsonls.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [vscode-json-language-server](https://github.com/hrsh7th/vscode-langservers-extracted)
5 +---@type vim.lsp.Config
6 +return {
7 + cmd = { 'vscode-json-language-server', '--stdio' },
8 + filetypes = { 'json', 'jsonc' },
9 + root_markers = { '.git' },
10 + init_options = {
11 + provideFormatter = true,
12 + },

neovim/lsp/kdl_ls.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [kdl-lsp](https://github.com/kittensql/kdl-lsp)
5 +---@type vim.lsp.Config
6 +return {
7 + cmd = { 'kdl-lsp' },
8 + filetypes = { 'kdl' },
9 + root_markers = { '.git' },

neovim/lsp/lua_ls.lua

Modified
3 3 local project = require 'std.project'
4 4 local normalize = vim.fs.normalize
5 5 local realpath = vim.uv.fs_realpath
7 7 return {
8 - cmd = { 'lua-language-server' },
9 - filetypes = { 'lua' },
10 - root_dir = function(_, set_root_dir) set_root_dir(project.find_lua_project_root()) end,
11 - settings = {
12 - Lua = {
13 - hint = { enable = true, setType = true },
14 - },
15 - },
16 - on_init = function(client)
17 - if client.workspace_folders then
18 - local root = client.workspace_folders[1].name
19 - local path = normalize(realpath(root))
20 - local config_path = normalize(realpath(vim.fn.stdpath('config')))
21 - if path ~= config_path then
22 - return
23 - end
24 - end
8 + cmd = { 'lua-language-server' },
9 + filetypes = { 'lua' },
10 + root_dir = function ( _, set_root_dir )
11 + local root = project.find_lua_project_root()
12 + if not root then return end
13 + set_root_dir( root )
14 + end,
15 + settings = {
16 + Lua = {
17 + hint = { enable = true, setType = true },
18 + },
19 + },
20 + on_init = function ( client )
21 + if client.workspace_folders then
22 + local root = client.workspace_folders[1].name
23 + local abs_root = assert( realpath( root ) )
24 + local path = normalize( abs_root )
25 + local abs_config = assert( realpath( vim.fn.stdpath 'config' ) )
26 + local config_path = normalize( abs_config )
27 + if path ~= config_path then
28 + return
29 + end
30 + end
26 - client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
27 - runtime = {
28 - version = 'LuaJIT',
29 - path = {
30 - 'lua/?.lua',
31 - 'lua/?/init.lua',
32 - },
33 - },
34 - diagnostics = { globals = { "vim" } },
35 - workspace = {
36 - checkThirdParty = false,
37 - library = {
38 - vim.env.VIMRUNTIME,
39 - '${3rd}/luv/library'
40 - }
41 - }
42 - })
43 - end,
32 + client.config.settings.Lua = vim.tbl_deep_extend( 'force', client.config.settings.Lua, {
33 + runtime = {
34 + version = 'LuaJIT',
35 + path = {
36 + 'lua/?.lua',
37 + 'lua/?/init.lua',
38 + },
39 + },
40 + diagnostics = {
41 + globals = {
42 + 'vim',
43 + 'describe',
44 + 'it',
45 + },
46 + },
47 + workspace = {
48 + checkThirdParty = false,
49 + library = {
50 + vim.env.VIMRUNTIME,
51 + '${3rd}/luv/library',
52 + },
53 + },
54 + } )
55 + end,

neovim/lsp/markdown_oxide.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [Markdown-Oxide](https://github.com/Feel-ix-343/markdown-oxide)
4 +--- Editor Agnostic PKM for Obsidian-compatible daily notes.
6 +---@type vim.lsp.Config
7 +return {
8 + cmd = { 'markdown-oxide' },
9 + filetypes = { 'markdown' },
10 + root_markers = { '.obsidian', '.moxide.toml' },
11 + workspace_required = true,
12 + on_attach = function(client, bufnr)
13 + local user_command = require 'std.user_command'
14 + for _, cmd in ipairs({ 'today', 'tomorrow', 'yesterday' }) do
15 + local name = 'MO' .. ('%s'):format(cmd:gsub('^%l', string.upper))
16 + user_command.buffer(bufnr)[name] ('Open %s daily note'):format(cmd) (function()
17 + client:exec_cmd({
18 + title = ('Markdown-Oxide-%s'):format(cmd),
19 + command = 'jump',
20 + arguments = { cmd },
21 + }, { bufnr = bufnr })
22 + end)
23 + end
24 + end,

neovim/lsp/rust_analyzer.lua

Modified
158 158 on_attach = function ( _, bufnr )
159 - vim.api.nvim_buf_create_user_command( bufnr, 'LspCargoReload', function ()
160 - reload_workspace( bufnr )
161 - end, { desc = 'Reload current cargo workspace' } )
159 + local user_command = require 'std.user_command'
160 + user_command.buffer(bufnr).LspCargoReload 'Reload current cargo workspace' (function()
161 + reload_workspace( bufnr )
162 + end)

neovim/lsp/sqls.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [sqls](https://github.com/sqls-server/sqls)
5 +---@type vim.lsp.Config
6 +return {
7 + cmd = { 'sqls' },
8 + filetypes = { 'sql', 'mysql' },
9 + root_markers = { 'config.yml' },

neovim/lsp/yamlls.lua

Added
new file mode 100644
1 +---@brief
2 +---
3 +--- [yaml-language-server](https://github.com/redhat-developer/yaml-language-server)
5 +---@type vim.lsp.Config
6 +return {
7 + cmd = { 'yaml-language-server', '--stdio' },
8 + filetypes = { 'yaml', 'yaml.docker-compose', 'yaml.gitlab', 'yaml.helm-values' },
9 + root_markers = { '.git' },
10 + settings = {
11 + redhat = { telemetry = { enabled = false } },
12 + yaml = { format = { enable = true } },
13 + },
14 + on_init = function(client)
15 + client.server_capabilities.documentFormattingProvider = true
16 + -- https://github.com/neovim/nvim-lspconfig/pull/4016
17 + -- Formatting is disabled by default in yaml-language-server.
18 + -- This hack sets the capability to true so autocmds checking
19 + -- `client:supports_method('textDocument/formatting')` work correctly.
20 + end,

neovim/lua/bugabinga/bookmarks.lua

Added
new file mode 100644
1 +local puk = require 'std.puk'
2 +local map = require 'std.map'
4 +puk.defer 'grapple' (function(grapple)
5 + grapple.setup {
6 + scope = "git",
7 + icons = true,
8 + quick_select = "123456789",
9 + }
11 + map.normal { description = 'toggle tag on current file', category = 'grapple', keys = '<leader>mt', command = grapple.toggle }
12 + map.normal { description = 'open tags window', category = 'grapple', keys = '<leader>mT', command = grapple.toggle_tags }
13 + map.normal { description = 'cycle to next tag', category = 'grapple', keys = '<leader>mn', command = function() grapple.cycle_tags("next") end }
14 + map.normal { description = 'cycle to previous tag', category = 'grapple', keys = '<leader>mp', command = function() grapple.cycle_tags("prev") end }
15 + map.normal { description = 'select tag 1', category = 'grapple', keys = '<leader>1', command = function() grapple.select { index = 1 } end }
16 + map.normal { description = 'select tag 2', category = 'grapple', keys = '<leader>2', command = function() grapple.select { index = 2 } end }
17 + map.normal { description = 'select tag 3', category = 'grapple', keys = '<leader>3', command = function() grapple.select { index = 3 } end }
18 + map.normal { description = 'select tag 4', category = 'grapple', keys = '<leader>4', command = function() grapple.select { index = 4 } end }
19 + map.normal { description = 'select tag 5', category = 'grapple', keys = '<leader>5', command = function() grapple.select { index = 5 } end }
21 + require('bugabinga.statusline').register(function()
22 + if not grapple.exists() then return '' end
23 + return '󰛢 ' .. grapple.name_or_index()
24 + end)
25 +end)

neovim/lua/bugabinga/cmdline/format.lua

Modified
27 27 if prompt and prompt ~= '' then
28 28 return { type = 'input', icon = icon.prompt_prefix, lang = nil }
30 + if prompt == '' and firstc == '' then
31 + return { type = 'input', icon = icon.prompt_prefix, lang = nil }
32 + end
30 33 if firstc == '/' then
31 34 return { type = 'search_down', icon = icon.search, lang = 'regex' }

neovim/lua/bugabinga/cmdline/init.lua

Modified
39 39 return false
42 -local function setup()
43 - if attached then
44 - return
45 - end
46 - vim.ui_attach(ns, { ext_cmdline = true, ext_popupmenu = true }, function(event, ...)
47 - return dispatch(event, ...)
48 - end)
49 - attached = true
50 -end
52 42 local function disable()
53 43 if not attached then
54 44 return
59 49 popupmenu.on_hide()
62 -setup()
52 +if not attached then
53 + vim.ui_attach(ns, { ext_cmdline = true, ext_popupmenu = true }, function(event, ...)
54 + return dispatch(event, ...)
55 + end)
56 + attached = true
57 +end
64 -return {
65 - setup = setup,
59 +_G.BugabingaCmdline = {
66 60 disable = disable,
67 -}
63 +return BugabingaCmdline

neovim/lua/bugabinga/code_action.lua

Modified
1 1 local auto = require 'std.auto'
2 +local table = require 'std.table'
3 4 local NS = vim.api.nvim_create_namespace 'bugabinga.code_action'

neovim/lua/bugabinga/cycle.lua

Modified
1 1 local auto = require 'std.auto'
2 +local map = require 'std.map'
3 +local table = require 'std.table'
3 5 local history = {}
230 232 apply_highlights(state.popup_buf, state.hl_ns, highlights)
232 - local mod = require 'bugabinga.cycle'
233 - vim.keymap.set('n', '<C-Tab>', function() mod.cycle(1) end, { buffer = state.popup_buf, silent = true })
234 - vim.keymap.set('n', '<C-S-Tab>', function() mod.cycle(-1) end, { buffer = state.popup_buf, silent = true })
235 - vim.keymap.set('n', '<Tab>', function() mod.cycle(1) end, { buffer = state.popup_buf, silent = true })
236 - vim.keymap.set('n', '<S-Tab>', function() mod.cycle(-1) end, { buffer = state.popup_buf, silent = true })
237 - vim.keymap.set('n', '<Esc>', cancel, { buffer = state.popup_buf, silent = true })
238 - vim.keymap.set('n', 'q', cancel, { buffer = state.popup_buf, silent = true })
234 + map.normal { keys = '<C-Tab>', command = function() BugabingaCycle.cycle(1) end, buffer = state.popup_buf }
235 + map.normal { keys = '<C-S-Tab>', command = function() BugabingaCycle.cycle(-1) end, buffer = state.popup_buf }
236 + map.normal { keys = '<Tab>', command = function() BugabingaCycle.cycle(1) end, buffer = state.popup_buf }
237 + map.normal { keys = '<S-Tab>', command = function() BugabingaCycle.cycle(-1) end, buffer = state.popup_buf }
238 + map.normal { keys = '<Esc>', command = cancel, buffer = state.popup_buf }
239 + map.normal { keys = 'q', command = cancel, buffer = state.popup_buf }
241 242 local function cycle(direction)
300 -local map = require 'std.map'
302 301 map.normal {
303 302 description = 'Cycle to next MRU buffer.',
304 303 category = 'cycle',
313 312 command = function() cycle(-1) end,
316 -vim.api.nvim_create_autocmd('BufWipeout', {
317 - callback = function(args)
315 +auto 'cycle_bufwipeout' {
316 + events = 'BufWipeout',
317 + command = function(args)
318 318 for i = #history, 1, -1 do
319 319 if history[i] == args.buf then table.remove(history, i) end
322 -})
324 -vim.api.nvim_create_autocmd('VimLeave', {
324 +auto 'cycle_vimleave' {
325 + events = 'VimLeave',
325 326 once = true,
326 - callback = function()
327 + command = function()
327 328 cancel()
329 -})
331 -return {
332 +_G.BugabingaCycle = {
332 333 cycle = cycle,
333 334 cancel = cancel,
334 335 history = history,
335 336 get_icon = get_icon,
336 337 shorten_path = shorten_path,
340 +return BugabingaCycle

neovim/lua/bugabinga/d2.lua

Modified
1 1 local auto = require 'std.auto'
2 2 local map = require 'std.map'
3 +local table = require 'std.table'
3 4 local user_command = require 'std.user_command'
5 6 local NS = 'd2'
239 240 description = 'D2 preview buffer keymaps',
240 241 command = function(args)
241 242 local preview_buf = args.bufnr
242 - vim.keymap.set('n', '<leader>dp', preview_toggle, { buffer = preview_buf, desc = 'Toggle D2 preview' })
243 - vim.keymap.set('n', '<leader>du', preview_update, { buffer = preview_buf, desc = 'Update D2 preview' })
244 - vim.keymap.set('n', 'q', close_preview_window, { buffer = preview_buf, desc = 'Close D2 preview' })
243 + map.normal { keys = '<leader>dp', command = preview_toggle, buffer = preview_buf, description = 'Toggle D2 preview' }
244 + map.normal { keys = '<leader>du', command = preview_update, buffer = preview_buf, description = 'Update D2 preview' }
245 + map.normal { keys = 'q', command = close_preview_window, buffer = preview_buf, description = 'Close D2 preview' }
248 -return {
249 +_G.BugabingaD2 = {
249 250 preview_toggle = preview_toggle,
250 251 preview_update = preview_update,
251 252 preview_copy = preview_copy,
252 253 validate = validate,
253 254 validate_toggle = validate_toggle,
254 255 _parse_validate_output = parse_validate_output,
258 +return BugabingaD2

neovim/lua/bugabinga/diagnostic.lua

Modified
63 63 severity_sort = true,
66 --- TODO: move to togglers
67 66 map.normal {
68 67 description = 'Toggle diagnostics',
69 68 category = 'diagnostic',

neovim/lua/bugabinga/file_explorer.lua

Modified
37 37 ['<C-s>'] = 'actions.select_split',
38 38 ['`'] = 'actions.tcd',
39 39 ['~'] = '<cmd>edit $HOME<CR>',
40 + gs = {
41 + callback = function()
42 + local prefills = { paths = require('oil').get_current_dir() }
43 + local grug_far = require 'grug-far'
44 + if not grug_far.has_instance 'explorer' then
45 + grug_far.open { instanceName = 'explorer', prefills = prefills, staticTitle = 'Find and Replace from Explorer' }
46 + else
47 + grug_far.get_instance('explorer'):open()
48 + grug_far.get_instance('explorer'):update_input_values(prefills, false)
49 + end
50 + end,
51 + desc = 'oil: Search in directory',
52 + },
41 54 float = {
42 55 max_width = 69,

neovim/lua/bugabinga/format.lua

Modified
6 6 local format = function ()
7 7 require 'conform'.format( { async = false }, function ( err )
8 8 if err then
9 - dbg.print( 'Format failed', err )
9 + dbg( 'Format failed %s', err )
11 11 end )
13 13 vim.lsp.buf.format {
14 14 filter = function ( client )
15 15 local ok = client:supports_method 'textDocument/formatting' ---@diagnostic disable-line: param-type-mismatch, missing-parameter
16 - if ok then dbg.print( 'Using LSP formatter: ' .. client.name ) end
16 + if ok then dbg( 'Using LSP formatter: %s', client.name ) end
17 17 return ok
18 18 end,
19 19 async = false,

neovim/lua/bugabinga/fun.lua

Modified
1 1 local puk = require 'std.puk'
2 2 local map = require 'std.map'
3 3 local ignored = require 'std.ignored'
4 +local dbg = require 'std.dbg'
5 6 map.normal {
6 7 description = 'Find cursor, for real!',
7 8 category = 'fun',
8 9 keys = '<leader><leader><leader>',
9 - command = function()
10 - require 'specs'.show_specs { width = 69, delay_ms = 69, inc_ms = 42 }
10 + command = function ()
11 + local opts = { width = 69, delay_ms = 69, inc_ms = 42 }
12 + dbg.kind( 'TRACE', 'Showing specs with {0}', opts )
13 + require 'specs'.show_specs( opts )
11 14 end,
14 -puk.defer 'specs' (function(specs)
17 +puk.defer 'specs' ( function ( specs )
15 18 specs.setup {
16 19 show_jumps = false,
17 20 min_jump = 10,
18 21 popup = {
19 22 delay_ms = 10, -- delay before popup displays
20 - inc_ms = 10, -- time increments used for fade/resize effects
21 - blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
23 + inc_ms = 10, -- time increments used for fade/resize effects
24 + blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend
22 25 width = 10,
23 26 winhl = 'Cursor',
24 27 fader = specs.exp_fader,
27 30 ignore_filetypes = ignored.filetypes_kv,
28 31 ignore_buftypes = ignored.buftypes_kv,
30 -end)
33 +end )

neovim/lua/bugabinga/fuzzy_find.lua

Modified
28 28 category = 'fuzzy'
31 + --TODO: improve these picker by being able to pipe their results to quicklist or loclist
32 + --TODO: add picker for other stuff: highlights, help, registers,...
31 34 map.normal {
32 35 description = 'live grep',
33 36 command = pick.builtin.grep_live,

neovim/lua/bugabinga/grapple.lua

Deleted
deleted file mode 100644
1 -local puk = require 'std.puk'
2 -local map = require 'std.map'
4 -puk.defer 'grapple' (function(grapple)
5 - grapple.setup {
6 - scope = "git",
7 - icons = true,
8 - quick_select = "123456789",
9 - }
11 - map.normal { description = 'toggle tag on current file', category = 'grapple', keys = '<leader>mt', command = grapple.toggle }
12 - map.normal { description = 'open tags window', category = 'grapple', keys = '<leader>mT', command = grapple.toggle_tags }
13 - map.normal { description = 'cycle to next tag', category = 'grapple', keys = '<leader>mn', command = function() grapple.cycle_tags("next") end }
14 - map.normal { description = 'cycle to previous tag', category = 'grapple', keys = '<leader>mp', command = function() grapple.cycle_tags("prev") end }
15 - map.normal { description = 'select tag 1', category = 'grapple', keys = '<leader>1', command = function() grapple.select { index = 1 } end }
16 - map.normal { description = 'select tag 2', category = 'grapple', keys = '<leader>2', command = function() grapple.select { index = 2 } end }
17 - map.normal { description = 'select tag 3', category = 'grapple', keys = '<leader>3', command = function() grapple.select { index = 3 } end }
18 - map.normal { description = 'select tag 4', category = 'grapple', keys = '<leader>4', command = function() grapple.select { index = 4 } end }
19 - map.normal { description = 'select tag 5', category = 'grapple', keys = '<leader>5', command = function() grapple.select { index = 5 } end }
21 - require('bugabinga.statusline').register(function()
22 - if not grapple.exists() then return '' end
23 - return '󰛢 ' .. grapple.name_or_index()
24 - end)
25 -end)

neovim/lua/bugabinga/incubator.lua

Modified
8 8 local const = require 'std.const'
9 9 local dbg = require 'std.dbg'
10 10 local ignored = require 'std.ignored'
12 +-- https://github.com/Prgebish/sigil.nvim
13 +-- https://github.com/spacedentist/resolve.nvim
14 +-- https://github.com/nvzone/minty

neovim/lua/bugabinga/inlay.lua

Modified
1 --- diaplay inlay hints at the END of the line, instead of
1 +local table = require 'std.table'
2 +local icon = require 'std.icon'
4 +-- display inlay hints at the END of the line, instead of
2 5 -- mixed with the source code
4 7 -- stolen from: https://github.com/chrisgrieser/nvim-lsp-endhints/blob/main/lua/lsp-endhints/override-handler.lua
6 9 local config = {
7 10 icons = {
8 - type = "󰜁 ",
9 - parameter = "󰏪 ",
10 - offspec = " ", -- hint kind not defined in official LSP spec
11 - unknown = " ", -- hint kind is nil
11 + type = icon.type,
12 + parameter = icon.parameter,
13 + offspec = icon.offspec,
14 + unknown = icon.unknown,
13 16 label = {
14 17 truncateAtChars = 20,
15 18 padding = 1,
16 19 marginLeft = 0,
17 - sameKindSeparator = ", ",
20 + sameKindSeparator = ', ',
19 22 extmark = {
20 23 priority = 50,
24 -local ns = vim.api.nvim_create_namespace("bugabinga-inlay")
27 +local ns = vim.api.nvim_create_namespace 'bugabinga-inlay'
26 -local function changedRefreshHandler(err, result, ctx, _)
29 +local function changedRefreshHandler( err, result, ctx, _ )
27 30 -- GUARD
28 31 if not vim.lsp.inlay_hint.is_enabled() then return end
29 32 local bufnr = ctx.bufnr or -1
30 - if not vim.api.nvim_buf_is_valid(bufnr) then return end
33 + if not vim.api.nvim_buf_is_valid( bufnr ) then return end
31 34 if not result then return end
32 - local client = vim.lsp.get_client_by_id(ctx.client_id)
35 + local client = vim.lsp.get_client_by_id( ctx.client_id )
33 36 if not client then return end
34 37 local inlayHintProvider = client.server_capabilities.inlayHintProvider
35 38 if not inlayHintProvider then return end
36 39 if err then
37 - vim.notify(vim.inspect(err), vim.log.levels.ERROR)
40 + vim.notify( vim.inspect( err ), vim.log.levels.ERROR )
38 41 return
41 - local padding = (" "):rep(config.label.padding)
42 - local marginLeft = (" "):rep(config.label.marginLeft)
44 + local padding = (' '):rep( config.label.padding )
45 + local marginLeft = (' '):rep( config.label.marginLeft )
44 - vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1)
47 + vim.api.nvim_buf_clear_namespace( bufnr, ns, 0, -1 )
46 49 -- Collect all hints for each line, so we can sort them by column in the loop
47 50 -- below. This ensures that the hints are displayed in the correct order.
48 - local hintLines = vim.iter(result):fold({}, function(acc, hint)
51 + local hintLines = vim.iter( result ):fold( {}, function ( acc, hint )
49 52 local lnum = hint.position.line
50 53 local col = hint.position.character
52 55 -- LABEL
53 56 local label = hint.label
54 - if type(label) ~= "string" then
57 + if type( label ) ~= 'string' then
55 58 -- label can be string or `InlayHintLabelPart[]` https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#inlayHint
56 - label = vim.iter(hint.label):map(function(labelPart) return labelPart.value end):join("")
59 + label = vim.iter( hint.label ):map( function ( labelPart ) return labelPart.value end ):join ''
58 - label = vim.trim(label:gsub("^:", ""):gsub(":$", ""))
61 + label = vim.trim( label:gsub( '^:', '' ):gsub( ':$', '' ) )
59 62 if config.label.truncateAtChars and #label > config.label.truncateAtChars then
60 - label = label:sub(1, config.label.truncateAtChars) .. "…"
63 + label = label:sub( 1, config.label.truncateAtChars ) .. '…'
63 66 -- KIND
64 67 -- 1: type, 2: parameter -- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#inlayHintKind
65 68 local kind
66 69 if hint.kind == 1 then
67 - kind = "type"
70 + kind = 'type'
68 71 elseif hint.kind == 2 then
69 - kind = "parameter"
72 + kind = 'parameter'
70 73 elseif hint.kind == nil then
71 - kind = "unknown"
74 + kind = 'unknown'
73 - kind = "offspec"
76 + kind = 'offspec'
76 79 if not acc[lnum] then acc[lnum] = {} end
77 - table.insert(acc[lnum], { label = label, col = col, kind = kind })
80 + table.insert( acc[lnum], { label = label, col = col, kind = kind } )
78 81 return acc
79 - end)
82 + end )
81 84 -- loop: add hints as extmarks for each line
82 - for lnum, hints in pairs(hintLines) do
83 - table.sort(hints, function(a, b) return a.col < b.col end)
85 + for lnum, hints in pairs( hintLines ) do
86 + table.sort( hints, function ( a, b ) return a.col < b.col end )
85 88 -- merge hints of same kind
86 89 -- add icon only when parameter kind is different from the previous one
87 - local hintsMerged = ""
90 + local hintsMerged = ''
88 91 for i = 1, #hints do
89 92 local hint = hints[i]
90 93 local lastKind = hints[i - 1] and hints[i - 1].kind
91 94 if lastKind == hint.kind then
92 95 hintsMerged = hintsMerged .. config.label.sameKindSeparator .. hint.label
94 - local icon = config.icons[hint.kind]
95 - local pad = i ~= 1 and " " or ""
96 - hintsMerged = hintsMerged .. pad .. icon .. hint.label
97 + local hint_icon = config.icons[hint.kind]
98 + local pad = i ~= 1 and ' ' or ''
99 + hintsMerged = hintsMerged .. pad .. hint_icon .. hint.label
100 103 -- add padding & margin
101 104 local virtText = {
102 - { padding .. hintsMerged .. padding, "LspInlayHint" },
105 + { padding .. hintsMerged .. padding, 'LspInlayHint' },
104 - if marginLeft ~= "" then table.insert(virtText, 1, { marginLeft }) end
107 + if marginLeft ~= '' then table.insert( virtText, 1, { marginLeft } ) end
106 109 -- add extmark for the line
107 - vim.api.nvim_buf_set_extmark(bufnr, ns, lnum, 0, {
110 + vim.api.nvim_buf_set_extmark( bufnr, ns, lnum, 0, {
108 111 virt_text = virtText,
109 - virt_text_pos = "eol",
110 - hl_mode = "combine", -- ensures highlights are combined with the background, see #2
112 + virt_text_pos = 'eol',
113 + hl_mode = 'combine', -- ensures highlights are combined with the background, see #2
111 114 strict = false, -- prevents error on quick buffer changes (e.g. quick series of undos)
112 115 priority = config.extmark.priority,
113 - })
116 + } )
117 -vim.lsp.handlers["textDocument/inlayHint"] = changedRefreshHandler
120 +vim.lsp.handlers['textDocument/inlayHint'] = changedRefreshHandler

neovim/lua/bugabinga/lsp.lua

Deleted
deleted file mode 100644
1 -local dbg = require 'std.dbg'
2 -local icon = require 'std.icon'
3 -local map = require 'std.map'
4 -local auto = require 'std.auto'
5 -local table = require 'std.table'
6 -local user_command = require 'std.user_command'
8 -if dbg.get() then
9 - vim.lsp.set_log_level 'debug'
10 -end
12 --- enable multiline tokens for all lsps
13 -vim.lsp.config( '*', {
14 - capabilities = {
15 - textDocument = {
16 - semanticTokens = {
17 - multilineTokenSupport = true,
18 - },
19 - completion = {
20 - completionItem = {
21 - snippetSupport = true,
22 - },
23 - },
24 - },
25 - },
26 -} )
28 -local lsp_configs = vim.api.nvim_get_runtime_file( 'lsp/*.lua', true )
29 -local servers = {}
30 -for _, path in ipairs( lsp_configs ) do
31 - local server_name = vim.fn.fnamemodify( path, ':t:r' ) -- remove .lua extension
32 - table.insert( servers, server_name )
33 -end
35 -vim.lsp.enable( servers )
37 -user_command.LspRestart 'Restarts LSP servers for current filetype or specified server' (
38 - function ( opts )
39 - local server = opts.args
40 - -- TODO of server was not given, restart all active lsps
41 - vim.lsp.enable( server, false )
42 - vim.lsp.enable( server, true )
43 - end
46 -local lsp_attach = function ( args )
47 - local bufnr = args.buf
48 - local client_id = args.data.client_id
49 - local client = vim.lsp.get_client_by_id( client_id )
50 - if not client then return end
52 - if client:supports_method 'textDocument/completion' then
53 - vim.lsp.completion.enable( true, client.id, bufnr, {
54 - autotrigger = true,
55 - } )
56 - end
58 - if client.server_capabilities.inlayHintProvider then
59 - map.normal {
60 - description = 'Toggle inlay hints',
61 - category = 'lsp',
62 - buffer = bufnr,
63 - keys = '<leader>ti',
64 - command = function ()
65 - vim.lsp.inlay_hint.enable( not vim.lsp.inlay_hint.is_enabled() )
66 - end,
67 - }
68 - end
69 -end
71 --- Global keymaps: registered once at module load, not per-LspAttach
72 -map.normal { description = 'code action', category = 'lsp', keys = 'gra', command = vim.lsp.buf.code_action }
73 -map.normal { description = 'implementation', category = 'lsp', keys = 'gri', command = vim.lsp.buf.implementation }
74 -map.normal { description = 'rename', category = 'lsp', keys = 'grn', command = vim.lsp.buf.rename }
75 -map.normal { description = 'references', category = 'lsp', keys = 'grr', command = vim.lsp.buf.references }
76 -map.normal { description = 'definition', category = 'lsp', keys = 'grd', command = vim.lsp.buf.definition }
77 -map.normal { description = 'list workspaces', category = 'lsp', keys = 'grwl', command = vim.lsp.buf.list_workspace_folders }
78 -map.normal { description = 'add workspace', category = 'lsp', keys = 'grwa', command = vim.lsp.buf.add_workspace_folder }
79 -map.normal { description = 'rm workspace', category = 'lsp', keys = 'grwr', command = vim.lsp.buf.remove_workspace_folder }
80 -map.normal { description = 'incoming calls', category = 'lsp', keys = 'grc', command = vim.lsp.buf.incoming_calls }
81 -map.normal { description = 'outgoing calls', category = 'lsp', keys = 'grC', command = vim.lsp.buf.outgoing_calls }
82 -map.normal { description = 'type definition',category = 'lsp', keys = 'grt', command = vim.lsp.buf.type_definition }
83 -map.normal { description = 'subtypes', category = 'lsp', keys = 'grh', command = function() vim.lsp.buf.typehierarchy 'subtypes' end }
84 -map.normal { description = 'supertypes', category = 'lsp', keys = 'grH', command = function() vim.lsp.buf.typehierarchy 'supertypes' end }
85 -map.insert { description = 'signature help', category = 'lsp', keys = '<c-s>', command = vim.lsp.buf.signature_help }
87 -auto 'lsp' {
88 - description = 'lsp: client attached to buffer',
89 - events = 'LspAttach',
90 - command = lsp_attach,
93 -local completion_icons = {
94 - Class = icon.class,
95 - Color = icon.color,
96 - Constant = icon.constant,
97 - Constructor = icon.constructor,
98 - Enum = icon.enum,
99 - EnumMember = icon.enum_member,
100 - Field = icon.field,
101 - File = icon.file,
102 - Folder = icon.folder,
103 - Function = icon['function'],
104 - Interface = icon.interface,
105 - Keyword = icon.keyword,
106 - Method = icon.method,
107 - Module = icon.module,
108 - Property = icon.property,
109 - Snippet = icon.snippet,
110 - Struct = icon.struct,
111 - Text = icon.text,
112 - Unit = icon.unit,
113 - Value = icon.value,
114 - Variable = icon.variable,
117 -local completion_kinds = vim.lsp.protocol.CompletionItemKind
118 -for i, kind in ipairs( completion_kinds ) do
119 - completion_kinds[i] = completion_icons[kind] or kind
120 -end
122 -user_command.LspCapabilities 'Show capabilities of currently running lsp server' ( function ()
123 - local caps = vim.lsp.get_clients()[1].server_capabilities
124 - vim.notify( vim.inspect( caps ) )
125 -end )
127 -user_command.LspReload 'Reload current lsp server and buffer' ( function ()
128 - vim.lsp.stop_client( vim.lsp.get_clients() )
129 - vim.cmd.edit()
130 -end )
132 -user_command.LspConfig 'Show configuration of current lsp server' ( function ()
133 - local client = vim.lsp.get_clients()[1]
134 - local config = client.config
135 - local server_info = client.settings
136 - vim.notify( vim.inspect( config ) )
137 - vim.notify( vim.inspect( server_info ) )
138 -end )
140 -user_command.LspInfo 'Show basic info about running LSP servers in a popup' ( function ()
141 - require('bugabinga.lsp_info').show(vim.lsp.get_clients())
142 -end )

neovim/lua/bugabinga/lsp/attach.lua

Added
new file mode 100644
1 +local map = require 'std.map'
2 +local auto = require 'std.auto'
4 +local lsp_attach = function( args )
5 + local bufnr = args.buf
6 + local client_id = args.data.client_id
7 + local client = vim.lsp.get_client_by_id( client_id )
8 + if not client then return end
10 + if client:supports_method 'textDocument/completion' then
11 + vim.lsp.completion.enable( true, client.id, bufnr, {
12 + autotrigger = false,
13 + } )
14 + end
16 + if client:supports_method 'textDocument/inlayHint' then
17 + map.normal {
18 + description = 'Toggle inlay hints',
19 + category = 'lsp',
20 + buffer = bufnr,
21 + keys = '<leader>ti',
22 + command = function()
23 + local current = vim.lsp.inlay_hint.is_enabled { bufnr = bufnr }
24 + vim.lsp.inlay_hint.enable( not current, { bufnr = bufnr } )
25 + end,
26 + }
27 + end
29 + map.normal {
30 + description = 'Go to definition',
31 + category = 'lsp',
32 + buffer = bufnr,
33 + keys = 'grd',
34 + command = vim.lsp.buf.definition,
35 + }
36 + map.normal {
37 + description = 'List workspaces',
38 + category = 'lsp',
39 + buffer = bufnr,
40 + keys = 'grwl',
41 + command = vim.lsp.buf.list_workspace_folders,
42 + }
43 + map.normal {
44 + description = 'Add workspace',
45 + category = 'lsp',
46 + buffer = bufnr,
47 + keys = 'grwa',
48 + command = vim.lsp.buf.add_workspace_folder,
49 + }
50 + map.normal {
51 + description = 'Remove workspace',
52 + category = 'lsp',
53 + buffer = bufnr,
54 + keys = 'grwr',
55 + command = vim.lsp.buf.remove_workspace_folder,
56 + }
57 + map.normal {
58 + description = 'Incoming calls',
59 + category = 'lsp',
60 + buffer = bufnr,
61 + keys = 'grc',
62 + command = vim.lsp.buf.incoming_calls,
63 + }
64 + map.normal {
65 + description = 'Outgoing calls',
66 + category = 'lsp',
67 + buffer = bufnr,
68 + keys = 'grC',
69 + command = vim.lsp.buf.outgoing_calls,
70 + }
71 + map.normal {
72 + description = 'Type definition',
73 + category = 'lsp',
74 + buffer = bufnr,
75 + keys = 'grt',
76 + command = vim.lsp.buf.type_definition,
77 + }
78 + map.normal {
79 + description = 'Subtypes',
80 + category = 'lsp',
81 + buffer = bufnr,
82 + keys = 'grh',
83 + command = function() vim.lsp.buf.typehierarchy 'subtypes' end,
84 + }
85 + map.normal {
86 + description = 'Supertypes',
87 + category = 'lsp',
88 + buffer = bufnr,
89 + keys = 'grH',
90 + command = function() vim.lsp.buf.typehierarchy 'supertypes' end,
91 + }
92 + map.normal {
93 + description = 'Declaration',
94 + category = 'lsp',
95 + buffer = bufnr,
96 + keys = 'grD',
97 + command = vim.lsp.buf.declaration,
98 + }
99 + map.normal {
100 + description = 'Workspace symbol',
101 + category = 'lsp',
102 + buffer = bufnr,
103 + keys = 'grs',
104 + command = vim.lsp.buf.workspace_symbol,
107 + if client:supports_method 'textDocument/codeLens' then
108 + map.normal {
109 + description = 'Run code lens',
110 + category = 'lsp',
111 + buffer = bufnr,
112 + keys = 'grl',
113 + command = vim.lsp.codelens.run,
115 + auto( 'lsp_codelens_refresh_' .. bufnr ) {
116 + events = { 'BufEnter', 'CursorHold', 'InsertLeave' },
117 + buffer = bufnr,
118 + command = function()
119 + vim.lsp.codelens.refresh { bufnr = bufnr }
120 + end,
122 + end
124 + if client:supports_method 'textDocument/documentHighlight' then
125 + auto( 'lsp_doc_highlight_' .. bufnr ) {
126 + events = { 'CursorHold', 'CursorHoldI' },
127 + buffer = bufnr,
128 + command = vim.lsp.buf.document_highlight,
130 + auto( 'lsp_clear_references_' .. bufnr ) {
131 + events = { 'CursorMoved', 'InsertEnter' },
132 + buffer = bufnr,
133 + command = vim.lsp.buf.clear_references,
135 + end
136 +end
138 +auto 'lsp' {
139 + description = 'lsp: client attached to buffer',
140 + events = 'LspAttach',
141 + command = lsp_attach,

neovim/lua/bugabinga/lsp/commands.lua

Added
new file mode 100644
1 +local user_command = require 'std.user_command'
3 +local restart_clients = function( opts )
4 + local server = opts.args
5 + if server and server ~= '' then
6 + vim.lsp.enable( server, false )
7 + vim.lsp.enable( server, true )
8 + return
9 + end
10 + local clients = opts.bang and vim.lsp.get_clients() or vim.lsp.get_clients { bufnr = 0 }
11 + local names = {}
12 + local seen = {}
13 + for _, client in ipairs( clients ) do
14 + if not seen[client.name] then
15 + seen[client.name] = true
16 + names[#names + 1] = client.name
17 + end
18 + end
19 + if #names == 0 then return end
20 + vim.lsp.enable( names, false )
21 + vim.lsp.enable( names, true )
22 +end
24 +user_command.LspRestart 'Restarts LSP servers' ({
25 + nargs = '?',
26 + bang = true,
27 + complete = function()
28 + local clients = vim.lsp.get_clients()
29 + local seen = {}
30 + local names = {}
31 + for _, client in ipairs( clients ) do
32 + if not seen[client.name] then
33 + seen[client.name] = true
34 + names[#names + 1] = client.name
35 + end
36 + end
37 + return names
38 + end,
39 +})( restart_clients )
41 +user_command.LspReload 'Reload current lsp server and buffer' ( function()
42 + local clients = vim.lsp.get_clients { bufnr = 0 }
43 + local names = {}
44 + local seen = {}
45 + for _, client in ipairs( clients ) do
46 + if not seen[client.name] then
47 + seen[client.name] = true
48 + names[#names + 1] = client.name
49 + end
50 + end
51 + if #names == 0 then return end
52 + vim.lsp.enable( names, false )
53 + vim.lsp.enable( names, true )
54 + vim.cmd.edit()
55 +end )
57 +user_command.LspCapabilities 'Show capabilities of currently running lsp server' ( function()
58 + local clients = vim.lsp.get_clients { bufnr = 0 }
59 + local client = clients[1]
60 + if not client then
61 + vim.notify( 'No LSP client attached to current buffer', vim.log.levels.WARN )
62 + return
63 + end
64 + vim.notify( vim.inspect( client.server_capabilities ) )
65 +end )
67 +user_command.LspConfig 'Show configuration of current lsp server' ( function()
68 + local clients = vim.lsp.get_clients { bufnr = 0 }
69 + local client = clients[1]
70 + if not client then
71 + vim.notify( 'No LSP client attached to current buffer', vim.log.levels.WARN )
72 + return
73 + end
74 + vim.notify( vim.inspect( client.config ) )
75 + vim.notify( vim.inspect( client.settings ) )
76 +end )
78 +user_command.LspInfo 'Show basic info about running LSP servers in a popup' ( function()
79 + require 'bugabinga.lsp.info'.show( vim.lsp.get_clients() )
80 +end )

neovim/lua/bugabinga/lsp/info.lua

Added
new file mode 100644
1 +local icon = require 'std.icon'
2 +local table = require 'std.table'
4 +local cap_fields = {
5 + hoverProvider = 'Hover',
6 + definitionProvider = 'Go to Definition',
7 + referencesProvider = 'References',
8 + completionProvider = 'Completion',
9 + renameProvider = 'Rename',
10 + codeActionProvider = 'Code Actions',
11 + documentFormattingProvider = 'Formatting',
12 + documentSymbolProvider = 'Document Symbols',
13 + workspaceSymbolProvider = 'Workspace Symbols',
14 + inlayHintProvider = 'Inlay Hints',
15 + semanticTokensProvider = 'Semantic Tokens',
16 + signatureHelpProvider = 'Signature Help',
17 + declarationProvider = 'Go to Declaration',
18 + typeDefinitionProvider = 'Go to Type Definition',
19 + implementationProvider = 'Go to Implementation',
20 + documentHighlightProvider = 'Document Highlight',
21 + codeLensProvider = 'Code Lens',
22 + documentLinkProvider = 'Document Links',
23 + foldingRangeProvider = 'Folding Range',
24 + selectionRangeProvider = 'Selection Range',
25 + callHierarchyProvider = 'Call Hierarchy',
26 + documentRangeFormattingProvider = 'Range Formatting',
27 + documentOnTypeFormattingProvider = 'On-Type Formatting',
28 + diagnosticProvider = 'Pull Diagnostics',
29 + executeCommandProvider = 'Execute Command',
32 +local show = function( clients )
33 + if #clients == 0 then
34 + vim.notify( 'No active LSP clients', vim.log.levels.INFO )
35 + return
36 + end
38 + local buf = vim.api.nvim_create_buf( false, true )
40 + local width = math.floor( vim.o.columns * 0.8 )
41 + local height = math.floor( vim.o.lines * 0.8 )
42 + local row = math.floor( (vim.o.lines - height) / 2 )
43 + local col = math.floor( (vim.o.columns - width) / 2 )
44 + local win = vim.api.nvim_open_win( buf, true, {
45 + relative = 'editor',
46 + width = width,
47 + height = height,
48 + row = row,
49 + col = col,
50 + style = 'minimal',
51 + border = 'rounded',
52 + title = icon.lsp .. ' LSP Info',
53 + title_pos = 'center',
54 + } )
56 + local lines = {}
57 + for i, client in ipairs( clients ) do
58 + if i > 1 then table.insert( lines, '' ) end
59 + table.insert( lines, string.format( '# %s %s', icon.lsp, client.name ) )
61 + local root = client.config.root_dir or 'No root'
62 + table.insert( lines, string.format( '**Root:** %s', root ) )
64 + if client.config.filetypes then
65 + table.insert( lines, string.format( '**Filetypes:** %s', table.concat( client.config.filetypes, ', ' ) ) )
66 + end
68 + table.insert( lines, string.format( '**ID:** %d', client.id ) )
69 + local cmd = client.config.cmd
70 + if type( cmd ) == 'table' and cmd[1] then
71 + table.insert( lines, string.format( '**Binary:** %s', cmd[1] ) )
72 + end
74 + if client.workspace_folders and #client.workspace_folders > 0 then
75 + table.insert( lines, '**Workspace Folders:**' )
76 + for _, wf in ipairs( client.workspace_folders ) do
77 + table.insert( lines, string.format( ' - %s', wf.name ) )
78 + end
79 + end
81 + local caps = client.server_capabilities
82 + local cap_list = {}
83 + for field, name in pairs( cap_fields ) do
84 + if caps[field] then cap_list[#cap_list + 1] = name end
85 + end
86 + table.insert( lines, string.format( '**Capabilities (%d):**', #cap_list ) )
87 + table.insert( lines, ' ' .. table.concat( cap_list, ', ' ) )
89 + if client.server_info and client.server_info.version then
90 + table.insert( lines, string.format( '**Version:** %s', client.server_info.version ) )
91 + end
92 + end
94 + vim.api.nvim_buf_set_lines( buf, 0, -1, false, lines )
95 + vim.api.nvim_buf_set_lines( buf, 0, -1, false, lines )
96 + vim.api.nvim_set_option_value( 'filetype', 'markdown', { buf = buf } )
97 + vim.api.nvim_set_option_value( 'spell', false, { win = win } )
98 + vim.api.nvim_set_option_value( 'wrap', true, { win = win } )
99 + vim.api.nvim_set_option_value( 'readonly', true, { buf = buf } )
100 + vim.api.nvim_set_option_value( 'modifiable', false, { buf = buf } )
101 + vim.keymap.set( 'n', 'q', '<cmd>close<CR>', { buffer = buf, noremap = true, silent = true } )
102 + vim.keymap.set( 'n', '<Esc>', '<cmd>close<CR>', { buffer = buf, noremap = true, silent = true } )
103 + vim.api.nvim_set_current_win( win )
104 +end
106 +return { show = show }

neovim/lua/bugabinga/lsp/init.lua

Added
new file mode 100644
1 +local dbg = require 'std.dbg'
2 +local icon = require 'std.icon'
3 +local table = require 'std.table'
5 +require 'bugabinga.lsp.attach'
6 +require 'bugabinga.lsp.commands'
7 +require 'bugabinga.lsp.info'
9 +if dbg.get() then
10 + vim.lsp.set_log_level 'debug'
11 +end
13 +vim.lsp.config( '*', {
14 + capabilities = {
15 + textDocument = {
16 + semanticTokens = {
17 + multilineTokenSupport = true,
18 + },
19 + completion = {
20 + completionItem = {
21 + snippetSupport = true,
22 + },
23 + },
24 + },
25 + },
26 +} )
28 +local lsp_configs = vim.api.nvim_get_runtime_file( 'lsp/*.lua', true )
29 +local servers = {}
30 +for _, path in ipairs( lsp_configs ) do
31 + local server_name = vim.fn.fnamemodify( path, ':t:r' )
32 + table.insert( servers, server_name )
33 +end
35 +vim.lsp.enable( servers )
37 +local completion_icons = {
38 + Class = icon.class,
39 + Color = icon.color,
40 + Constant = icon.constant,
41 + Constructor = icon.constructor,
42 + Enum = icon.enum,
43 + EnumMember = icon.enum_member,
44 + Field = icon.field,
45 + File = icon.file,
46 + Folder = icon.folder,
47 + Function = icon['function'],
48 + Interface = icon.interface,
49 + Keyword = icon.keyword,
50 + Method = icon.method,
51 + Module = icon.module,
52 + Property = icon.property,
53 + Snippet = icon.snippet,
54 + Struct = icon.struct,
55 + Text = icon.text,
56 + Unit = icon.unit,
57 + Value = icon.value,
58 + Variable = icon.variable,
61 +local completion_kinds = vim.lsp.protocol.CompletionItemKind
62 +for i, kind in ipairs( completion_kinds ) do
63 + completion_kinds[i] = completion_icons[kind] or kind
64 +end

neovim/lua/bugabinga/lsp_info.lua

Deleted
deleted file mode 100644
1 -local icon = require 'std.icon'
2 -local table = require 'std.table'
4 -local cap_fields = {
5 - hoverProvider = 'Hover',
6 - definitionProvider = 'Go to Definition',
7 - referencesProvider = 'References',
8 - completionProvider = 'Completion',
9 - renameProvider = 'Rename',
10 - codeActionProvider = 'Code Actions',
11 - documentFormattingProvider = 'Formatting',
12 - documentSymbolProvider = 'Document Symbols',
13 - workspaceSymbolProvider = 'Workspace Symbols',
14 - inlayHintProvider = 'Inlay Hints',
15 - semanticTokensProvider = 'Semantic Tokens',
16 - signatureHelpProvider = 'Signature Help',
17 - declarationProvider = 'Go to Declaration',
18 - typeDefinitionProvider = 'Go to Type Definition',
19 - implementationProvider = 'Go to Implementation',
20 - documentHighlightProvider = 'Document Highlight',
21 - codeLensProvider = 'Code Lens',
22 - documentLinkProvider = 'Document Links',
23 - foldingRangeProvider = 'Folding Range',
24 - selectionRangeProvider = 'Selection Range',
25 - callHierarchyProvider = 'Call Hierarchy',
26 - documentRangeFormattingProvider = 'Range Formatting',
27 - documentOnTypeFormattingProvider = 'On-Type Formatting',
28 - diagnosticProvider = 'Pull Diagnostics',
29 - executeCommandProvider = 'Execute Command',
32 -local function show(clients)
33 - if #clients == 0 then
34 - vim.notify('No active LSP clients', vim.log.levels.INFO)
35 - return
36 - end
38 - local buf = vim.api.nvim_create_buf(false, true)
40 - local width = math.floor(vim.o.columns * 0.8)
41 - local height = math.floor(vim.o.lines * 0.8)
42 - local row = math.floor((vim.o.lines - height) / 2)
43 - local col = math.floor((vim.o.columns - width) / 2)
44 - local win = vim.api.nvim_open_win(buf, true, {
45 - relative = 'editor',
46 - width = width,
47 - height = height,
48 - row = row,
49 - col = col,
50 - style = 'minimal',
51 - border = 'rounded',
52 - title = icon.lsp .. ' LSP Info',
53 - title_pos = 'center',
54 - })
56 - local lines = {}
57 - for i, client in ipairs(clients) do
58 - if i > 1 then table.insert(lines, '') end
59 - table.insert(lines, string.format('# %s %s', icon.lsp, client.name))
61 - local root = client.config.root_dir or 'No root'
62 - table.insert(lines, string.format('**Root:** %s', root))
64 - if client.config.filetypes then
65 - table.insert(lines, string.format('**Filetypes:** %s', table.concat(client.config.filetypes, ', ')))
66 - end
68 - table.insert(lines, string.format('**ID:** %d', client.id))
69 - local cmd = client.config.cmd
70 - if type(cmd) == 'table' and cmd[1] then
71 - table.insert(lines, string.format('**Binary:** %s', cmd[1]))
72 - end
74 - if client.workspace_folders and #client.workspace_folders > 0 then
75 - table.insert(lines, '**Workspace Folders:**')
76 - for _, wf in ipairs(client.workspace_folders) do
77 - table.insert(lines, string.format(' - %s', wf.name))
78 - end
79 - end
81 - local caps = client.server_capabilities
82 - local cap_list = {}
83 - for field, name in pairs(cap_fields) do
84 - if caps[field] then cap_list[#cap_list + 1] = name end
85 - end
86 - table.insert(lines, string.format('**Capabilities (%d):**', #cap_list))
87 - table.insert(lines, ' ' .. table.concat(cap_list, ', '))
89 - if client.server_info and client.server_info.version then
90 - table.insert(lines, string.format('**Version:** %s', client.server_info.version))
91 - end
92 - end
94 - vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
95 - vim.api.nvim_buf_set_option(buf, 'filetype', 'markdown')
96 - vim.api.nvim_buf_set_option(buf, 'spell', false)
97 - vim.api.nvim_buf_set_option(buf, 'wrap', true)
98 - vim.api.nvim_buf_set_option(buf, 'readonly', true)
99 - vim.api.nvim_buf_set_option(buf, 'modifiable', false)
100 - vim.api.nvim_buf_set_keymap(buf, 'n', 'q', '<cmd>close<CR>', { noremap = true, silent = true })
101 - vim.api.nvim_buf_set_keymap(buf, 'n', '<Esc>', '<cmd>close<CR>', { noremap = true, silent = true })
102 - vim.api.nvim_set_current_win(win)
103 -end
105 -return { show = show }

neovim/lua/bugabinga/notify.lua

Modified
1 1 local puk = require 'std.puk'
2 2 local map = require 'std.map'
3 +local dbg = require 'std.dbg'
3 4 local user_command = require 'std.user_command'
5 - puk.defer 'mini.notify' ( function ( notify )
6 +puk.defer 'mini.notify' ( function ( notify )
6 7 notify.setup {
7 8 lsp_progress = {
8 9 enable = true,
9 - duration_last = 1000,
10 + duration_last = 444,
11 12 window = {
12 13 winblend = 25,
13 - config = function()
14 + config = function ()
14 15 local has_statusline = vim.o.laststatus > 0
15 16 local pad = vim.o.cmdheight + (has_statusline and 1 or 0)
16 17 return { anchor = 'SE', col = vim.o.columns, row = vim.o.lines - pad }
17 18 end,
20 - vim.notify = notify.make_notify()
21 + local notify_options = {}
22 + if dbg.get() then
23 + notify_options = {
24 + DEBUG = { duration = 300, hl_group = 'DiagnosticHint' },
25 + TRACE = { duration = 100, hl_group = 'DiagnosticOk' },
26 + }
27 + end
28 + vim.notify = notify.make_notify( notify_options )
22 30 user_command.NotifyHistory 'Show notification history' ( function ()
23 31 notify.show_history()
26 34 map.normal {
27 35 keys = '<leader>nn',
28 - command = function() notify.show_history() end,
36 + command = function () notify.show_history() end,
29 37 description = 'show notification history',
30 38 category = 'notify',

neovim/lua/bugabinga/nugu/init.lua

Modified
109 109 _.CycleBufferFileName { fg = ui_accent, bold = true }
110 110 _.CycleBufferIcon { fg = ui_minor }
111 111 _.EndOfBuffer { bg = _.Normal.bg }
112 -_.Comment { fg = content_important_global, bold = true }
112 +_.Comment { fg = content_important_global, bold = true, italic = true }
113 113 _.NotifyBackground = _.NormalUi
114 114 _.LineNr { fg = ui_focus, bg = content_backdrop }
115 115 _.LineNrAbove { fg = ui_minor, bg = content_backdrop }
153 153 _.PmenuKind { fg = ui_minor }
154 154 _.PmenuKindSel { fg = ui_important_local }
155 155 _.BugabingaCmdlineCursor { fg = ui_important_local, bg = ui_unfocus, bold = true }
156 - _.CmdlineBorderSearch { fg = ui_important_global, bg = _.NormalFloat.bg }
157 - _.CmdlineBorderShell { fg = content_focus, bg = _.NormalFloat.bg }
158 - _.CmdlineBorderHelp { fg = info, bg = _.NormalFloat.bg }
159 - _.CmdlineBorderLua { fg = content_focus, bg = _.NormalFloat.bg }
160 - _.CmdlineBorderInput { fg = ui_important_local, bg = _.NormalFloat.bg }
161 - _.CmdlineBorderCmdline { fg = ui_minor, bg = _.NormalFloat.bg }
162 - _.CmdlineBorderCornerSearch { fg = _.CmdlineBorderSearch.fg, bg = _.FloatBorderCorner.bg }
163 - _.CmdlineBorderCornerShell { fg = _.CmdlineBorderShell.fg, bg = _.FloatBorderCorner.bg }
164 - _.CmdlineBorderCornerHelp { fg = _.CmdlineBorderHelp.fg, bg = _.FloatBorderCorner.bg }
165 - _.CmdlineBorderCornerLua { fg = _.CmdlineBorderLua.fg, bg = _.FloatBorderCorner.bg }
166 - _.CmdlineBorderCornerInput { fg = _.CmdlineBorderInput.fg, bg = _.FloatBorderCorner.bg }
167 - _.CmdlineBorderCornerCmdline { fg = _.CmdlineBorderCmdline.fg, bg = _.FloatBorderCorner.bg }
156 +_.CmdlineBorderSearch { fg = ui_important_global, bg = _.NormalFloat.bg }
157 +_.CmdlineBorderShell { fg = content_focus, bg = _.NormalFloat.bg }
158 +_.CmdlineBorderHelp { fg = info, bg = _.NormalFloat.bg }
159 +_.CmdlineBorderLua { fg = content_focus, bg = _.NormalFloat.bg }
160 +_.CmdlineBorderInput { fg = ui_important_local, bg = _.NormalFloat.bg }
161 +_.CmdlineBorderCmdline { fg = ui_minor, bg = _.NormalFloat.bg }
162 +_.CmdlineBorderCornerSearch { fg = _.CmdlineBorderSearch.fg, bg = _.FloatBorderCorner.bg }
163 +_.CmdlineBorderCornerShell { fg = _.CmdlineBorderShell.fg, bg = _.FloatBorderCorner.bg }
164 +_.CmdlineBorderCornerHelp { fg = _.CmdlineBorderHelp.fg, bg = _.FloatBorderCorner.bg }
165 +_.CmdlineBorderCornerLua { fg = _.CmdlineBorderLua.fg, bg = _.FloatBorderCorner.bg }
166 +_.CmdlineBorderCornerInput { fg = _.CmdlineBorderInput.fg, bg = _.FloatBorderCorner.bg }
167 +_.CmdlineBorderCornerCmdline { fg = _.CmdlineBorderCmdline.fg, bg = _.FloatBorderCorner.bg }
168 168 _.CmdlineIconSearch { fg = _.CmdlineBorderSearch.fg }
169 169 _.CmdlineIconShell { fg = _.CmdlineBorderShell.fg }
170 170 _.CmdlineIconHelp { fg = _.CmdlineBorderHelp.fg }
224 224 _.Macro = _.PreProc
225 225 _.PreCondit = _.PreProc
227 -_.Special { fg = content_important_global, italic = true, bold = true }
227 +_.Special { fg = content_important_global, bold = true }
228 228 _.SpecialChar = _.Special
229 229 _.Tag = _.Special
230 230 _.SpecialComment = _.Special
254 254 _.DiagnosticUnderlineError { fg = _.DiagnosticError.fg, sp = _.DiagnosticError.fg, underdouble = true }
255 255 _.DiagnosticUnderlineWarn { fg = _.DiagnosticWarn.fg, sp = _.DiagnosticWarn.fg, underline = true }
256 256 _.DiagnosticUnderlineInfo { fg = _.DiagnosticInfo.fg, sp = _.DiagnosticInfo.fg, underdashed = true }
257 -_.DiagnosticUnderlineHint { fg = _.DiagnosticHint.fg, sp = _.DiagnosticHint.fg, italic = true, underdotted = true }
258 -_.DiagnosticUnderlineOk { fg = _.DiagnosticOk.fg, italic = true }
257 +_.DiagnosticUnderlineHint { fg = _.DiagnosticHint.fg, sp = _.DiagnosticHint.fg, underdotted = true }
258 +_.DiagnosticUnderlineOk { fg = _.DiagnosticOk.fg }
259 259 _.DiagnosticSignError = _.DiagnosticError
260 260 _.DiagnosticSignWarn = _.DiagnosticWarn
261 261 _.DiagnosticSignInfo = _.DiagnosticInfo
271 271 _.BugabingaCodeActionSourceImports = _.DiagnosticHint
272 272 _.BugabingaCodeActionDefault = _.DiagnosticHint
274 -_.DbgViewerKind = _.Title
275 -_.DbgViewerTime = _.Comment
276 -_.DbgViewerMessage = _.Normal
277 -_.DbgViewerLocation = _.Comment
278 -_.DbgViewerFilter = _.Search
279 -_.DbgViewerKindIcon = _.DiagnosticInfo
274 +_.DbgViewerKind = _.Title
275 +_.DbgViewerTime = _.Comment
276 +_.DbgViewerMessage = _.Normal
277 +_.DbgViewerLocation = _.Comment
278 +_.DbgViewerFilter = _.Search
279 +_.DbgViewerKindIcon = _.DiagnosticInfo
281 281 _.LspReferenceText { sp = content_unfocus, underline = true }
282 282 _.LspReferenceRead = _.LspReferenceText
313 313 _['@label'] = _.Label
314 314 _['@macro'] = _.Macro
315 315 _['@method'] = _.Function
316 -_['@namespace'] = _.Italic
316 +_['@namespace'] = _.Function
317 317 _['@number'] = _.Number
318 318 _['@operator'] = _.Operator
319 319 _['@parameter'] = _.Parameter

neovim/lua/bugabinga/nugu/palette_dark.lua

Modified
1 1 return {
2 - debug = '#ff00ff',
3 - error = '#d973a1',
4 - info = '#e6e5f8',
5 - warning = '#f5dfdb',
2 + debug = '#ed5eed',
3 + error = '#e46479',
4 + info = '#3ec5dd',
5 + warning = '#9e9a69',
7 7 content_normal = '#ededed',
8 8 content_backdrop = '#121212',
9 9 content_accent = '#d151d1',
10 10 content_minor = '#8b8b8b',
11 11 content_focus = '#7ba1aa',
12 - content_unfocus = '#406f79',
12 + content_unfocus = '#5d5d5d',
13 13 content_important_global = '#dfd3f3',
14 14 content_important_local = '#b59ae4',
18 18 ui_accent = '#d86dd8',
19 19 ui_minor = '#9d9d9d',
20 20 ui_focus = '#9aabae',
21 - ui_unfocus = '#6e6e6e',
22 - ui_important_global = '#f4f3f6',
21 + ui_unfocus = '#6f6f6f',
22 + ui_important_global = '#f3effb',
23 23 ui_important_local = '#c9b6eb',

neovim/lua/bugabinga/nugu/palette_light.lua

Modified
1 1 return {
2 - debug = '#ff00ff',
3 - error = '#ca3c7c',
4 - info = '#b2aee9',
5 - warning = '#e7aea3',
2 + debug = '#a112a1',
3 + error = '#c0223c',
4 + info = '#13616e',
5 + warning = '#242317',
7 7 content_normal = '#121212',
8 8 content_backdrop = '#ededed',
19 19 ui_minor = '#292929',
20 20 ui_focus = '#15333b',
21 21 ui_unfocus = '#5d5d5d',
22 - ui_important_global = '#414141',
22 + ui_important_global = '#3e2f53',
23 23 ui_important_local = '#604980',

neovim/lua/bugabinga/options/behaviour.lua

Modified
26 26 end,
29 +local restore_cursor_handler = function(ev)
30 + if dbg.get() then
31 + vim.notify(string.format('RCP stage1: buf=%d cursor_line=%d mark_line=%d',
32 + ev.buf, vim.fn.line('.'), vim.fn.line([['"]])), vim.log.levels.DEBUG)
33 + end
35 + local ft = vim.bo[ev.buf].filetype
36 + local bt = vim.bo[ev.buf].buftype
38 + if ignored.buftypes_kv[bt] then return end
39 + if ignored.filetypes_kv[ft] then return end
40 + for _, pattern in ipairs(ignored.filetypes_patterns) do
41 + if ft:find(pattern) then return end
42 + end
44 + local cursor_line = vim.fn.line('.')
45 + local mark_line = vim.fn.line([['"]])
46 + if cursor_line == mark_line then return end
48 + local col = vim.fn.col([['"]]) - 1
49 + if mark_line > 0 and mark_line <= vim.fn.line('$') then
50 + if dbg.get() then
51 + vim.notify(string.format('RCP: creating stage2 for line=%d col=%d', mark_line, col), vim.log.levels.DEBUG)
52 + end
53 + auto 'restore_cursor_stage2' {
54 + events = 'BufWinEnter',
55 + buffer = ev.buf,
56 + once = true,
57 + command = function()
58 + if dbg.get() then
59 + vim.notify(string.format('RCP stage2: restoring to %d,%d', mark_line, col), vim.log.levels.DEBUG)
60 + end
61 + vim.api.nvim_win_set_cursor(0, { mark_line, col })
62 + vim.cmd.normal { 'zvzz', bang = true }
63 + end,
64 + }
65 + end
66 +end
29 68 auto 'restore_cursor_position' {
30 - description = 'Restore cursor position when opening a file',
31 - events = 'BufReadPost',
32 - command = function(ev)
33 - if dbg.get() then
34 - vim.notify(string.format('RCP stage1: buf=%d cursor_line=%d mark_line=%d',
35 - ev.buf, vim.fn.line('.'), vim.fn.line([['"]])), vim.log.levels.DEBUG)
36 - end
38 - local ft = vim.bo[ev.buf].filetype
39 - local bt = vim.bo[ev.buf].buftype
41 - if ignored.buftypes_kv[bt] then return end
42 - if ignored.filetypes_kv[ft] then return end
43 - for _, pattern in ipairs(ignored.filetypes_patterns) do
44 - if ft:find(pattern) then return end
45 - end
47 - local cursor_line = vim.fn.line('.')
48 - local mark_line = vim.fn.line([['"]])
49 - if cursor_line == mark_line then return end
51 - local col = vim.fn.col([['"]]) - 1
52 - if mark_line > 0 and mark_line <= vim.fn.line('$') then
53 - if dbg.get() then
54 - vim.notify(string.format('RCP: creating stage2 for line=%d col=%d', mark_line, col), vim.log.levels.DEBUG)
55 - end
56 - auto 'restore_cursor_stage2' {
57 - events = 'BufWinEnter',
58 - buffer = ev.buf,
59 - once = true,
60 - command = function()
61 - if dbg.get() then
62 - vim.notify(string.format('RCP stage2: restoring to %d,%d', mark_line, col), vim.log.levels.DEBUG)
63 - end
64 - vim.api.nvim_win_set_cursor(0, { mark_line, col })
65 - vim.cmd.normal { 'zvzz', bang = true }
66 - end,
67 - }
68 - end
69 - end,
69 + description = 'Restore cursor position when opening a file',
70 + events = 'BufReadPost',
71 + command = restore_cursor_handler,
72 74 auto 'handle_usr1_signal' {
73 - description = 'Reloads the current theme, when USR1 signal is received',
74 - events = { 'Signal' },
75 - pattern = 'SIGUSR1',
76 - command = function()
77 - dbg.print 'received signal USR1! Attempting to reload colorscheme.'
78 - vim.cmd.colorscheme 'nugu'
79 - end,
75 + description = 'Reloads the current theme, when USR1 signal is received',
76 + events = { 'Signal' },
77 + pattern = 'SIGUSR1',
78 + command = function()
79 + dbg.print 'received signal USR1! Attempting to reload colorscheme.'
80 + vim.cmd.colorscheme 'nugu'
81 + end,
84 +return {
85 + restore_cursor_handler = restore_cursor_handler,

neovim/lua/bugabinga/options/core.lua

Modified
158 158 vim.opt.wildoptions = 'fuzzy,pum'
160 160 -- completion popup in buffer
161 +vim.opt.completeopt:append 'menu'
161 162 vim.opt.completeopt:append 'menuone'
162 -vim.opt.completeopt:append 'preview'
163 -vim.opt.completeopt:append 'preinsert'
163 +vim.opt.completeopt:append 'popup'
164 +vim.opt.completeopt:append 'noinsert'
166 +-- control completion options for <c-n> and <c-p>
167 +vim.opt.complete:append 'kspell' -- scans spell dict, only used, when 'spell' is set
165 169 -- always display the signcolumn to avoid jitter
166 170 vim.opt.signcolumn = 'yes:2'

neovim/lua/bugabinga/options/init.lua

Modified
1 -# keymaps sets leader key. needs to be early
1 +-- TODO: check which options are default by now and remove them here
2 +--
3 +-- keymaps sets leader key. needs to be early
2 4 require 'bugabinga.options.keymaps'
3 5 require 'bugabinga.options.filetypes'
4 6 require 'bugabinga.options.core'
7 9 -- before the first file is loaded ( BufReadPost fires during startup, not after )
8 10 require 'bugabinga.options.behaviour'
10 -vim.schedule(function()
11 - require 'bugabinga.options.spelling'
12 - require 'bugabinga.options.commands'
13 - require 'bugabinga.options.menus'
14 - require 'bugabinga.options.shell'
15 - require 'bugabinga.options.win32'
16 - require 'bugabinga.options.neovide'
17 - require 'bugabinga.options.tty'
18 -end)
12 +vim.schedule( function ()
13 + require 'bugabinga.options.spelling'
14 + require 'bugabinga.options.commands'
15 + require 'bugabinga.options.menus'
16 + require 'bugabinga.options.shell'
17 + require 'bugabinga.options.win32'
18 + require 'bugabinga.options.neovide'
19 + require 'bugabinga.options.tty'
20 + require 'bugabinga.options.grep'
21 +end )

neovim/lua/bugabinga/search_and_replace.lua

Modified
10 10 keys = '<leader>fr',
11 11 command = function() grug.open { prefills = { search = vim.fn.expand '<cword>' } } end,
13 -end)
15 --- TODO: check grug-far README for binding in oil.nvim
13 + end)

neovim/lua/bugabinga/sessions.lua

Modified
1 1 local map = require 'std.map'
2 2 local auto = require 'std.auto'
3 +local table = require 'std.table'
4 5 local sessions = vim.fs.normalize( vim.fn.stdpath 'data' .. '/sessions' )
5 6 vim.fn.mkdir( sessions, 'p' )

neovim/lua/bugabinga/statusline.lua

Modified
1 1 --- Custom statusline using std APIs and no external dependencies
2 2 local icon = require 'std.icon'
3 +local table = require 'std.table'
4 +local auto = require 'std.auto'
4 6 -- Local state/cache
5 7 local cache = {
26 28 local function lsp_component()
27 29 local count = cache.lsp_count
28 30 if count == 0 then return '' end
29 - -- Clickable: single-click shows LSP info
30 - return '%@v:lua.__bugabinga_lsp_click@' .. icon.lsp .. ' ' .. count .. '%X'
31 + return '%@v:lua.BugabingaStatusline.on_lsp_click@' .. icon.lsp .. ' ' .. count .. '%X'
33 34 local registered = {}
36 37 table.insert(registered, fn)
40 +local function reset()
41 + for i = #registered, 1, -1 do table.remove(registered, i) end
42 +end
39 44 local function plugins_component()
40 - local results = vim.tbl_map(function(fn) return fn() end, registered)
41 - local filtered = vim.tbl_filter(function(c) return c ~= '' end, results)
45 + local results = table.map(function(fn) return fn() end, registered)
46 + local filtered = table.filter(function(c) return c ~= '' end, results)
42 47 return table.concat(filtered, ' ')
45 50 local function file_component()
46 51 local path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ':~:.')
47 - -- Truncate keeping last components visible (37 chars + ...)
48 52 if #path > 40 then
49 53 path = '...' .. path:sub(-37)
55 59 local function git_component()
56 60 local cwd = cached_cwd
57 61 if not cache.git_branch[cwd] then
58 - -- Async git branch detection
59 62 vim.system({ 'git', 'branch', '--show-current' }, {
60 63 cwd = cwd,
61 64 timeout = 2000,
62 65 }, function(result)
63 66 if result.code == 0 then
64 - local branch = result.stdout:gsub('\n', ''):sub(1, 15) -- truncate
67 + local branch = result.stdout:gsub('\n', ''):sub(1, 15)
65 68 cache.git_branch[cwd] = icon.branch .. ' ' .. branch
67 70 cache.git_branch[cwd] = ''
69 72 vim.schedule(function() vim.cmd.redrawstatus() end)
71 - return '' -- Return empty while loading
74 + return ''
73 76 return cache.git_branch[cwd]
87 90 -- Main statusline function
88 -local function statusline()
91 +local function render()
89 92 local components = {
90 93 mode_component(),
91 94 lsp_component(),
92 95 plugins_component(),
93 96 file_component(),
94 97 git_component(),
95 - '%=' .. position_component(), -- right-align position
98 + '%=' .. position_component(),
96 99 fileinfo_component(),
99 - -- Remove empty components and join with separators
100 - local filtered = vim.tbl_filter(function(c) return c ~= '' end, components)
102 + local filtered = table.filter(function(c) return c ~= '' end, components)
101 103 return table.concat(filtered, ' ')
104 --- Click handler for LSP component
105 -_G.__bugabinga_lsp_click = function()
106 - vim.cmd('LspInfo')
107 -end
109 --- Setup function
110 -local function setup()
111 - vim.opt.statusline = "%!v:lua.require'bugabinga.statusline'()"
113 - -- Update cache on events
114 - local auto = require 'std.auto'
115 - auto 'statusline' {
116 - {
117 - events = 'LspAttach',
118 - command = function()
119 - cache.lsp_count = #vim.lsp.get_clients()
120 - vim.cmd.redrawstatus()
121 - end,
122 - },
123 - {
124 - events = 'LspDetach',
125 - command = function()
126 - cache.lsp_count = #vim.lsp.get_clients()
127 - vim.cmd.redrawstatus()
128 - end,
129 - },
130 - {
131 - events = 'DirChanged',
132 - command = function()
133 - cached_cwd = vim.uv.cwd()
134 - cache.git_branch = {} -- Clear git cache on dir change
135 - vim.cmd.redrawstatus()
136 - end,
137 - },
138 - {
139 - events = { 'ModeChanged', 'BufEnter', 'WinEnter' },
140 - command = function() vim.cmd.redrawstatus() end,
141 - },
142 - }
143 -end
145 -return setmetatable({
146 - setup = setup,
106 +_G.BugabingaStatusline = {
107 + render = render,
147 108 register = register,
109 + reset = reset,
110 + plugins_component = plugins_component,
148 111 git_component = git_component,
149 112 _get_cache = function() return cache end,
150 113 _get_cached_cwd = function() return cached_cwd end,
151 -}, {
152 - __call = function() return statusline() end,
153 -})
114 + on_lsp_click = function()
115 + vim.cmd('LspInfo')
116 + end,
119 +vim.opt.statusline = '%!v:lua.BugabingaStatusline.render()'
121 +auto 'statusline' {
123 + events = 'LspAttach',
124 + command = function()
125 + cache.lsp_count = #vim.lsp.get_clients()
126 + vim.cmd.redrawstatus()
127 + end,
128 + },
130 + events = 'LspDetach',
131 + command = function()
132 + cache.lsp_count = #vim.lsp.get_clients()
133 + vim.cmd.redrawstatus()
134 + end,
135 + },
137 + events = 'DirChanged',
138 + command = function()
139 + cached_cwd = vim.uv.cwd()
140 + cache.git_branch = {}
141 + vim.cmd.redrawstatus()
142 + end,
143 + },
145 + events = { 'ModeChanged', 'BufEnter', 'WinEnter' },
146 + command = function() vim.cmd.redrawstatus() end,
147 + },
150 +return BugabingaStatusline

neovim/lua/bugabinga/treesitter.lua

Modified
22 22 treesitter.setup {}
23 23 treesitter.install { 'bash', 'nu' }
25 +-- TODO: in 0.12 check if this behaviour is builtin on vim.treesitter.start()
26 +-- if so, remove my stuff
25 27 auto 'look_for_treesitter_parser' {
26 28 description = 'Try loading a treesitter parser, if available.',
27 29 events = 'FileType',
30 32 local match = data.match
31 33 if match == 'text' then return end
32 34 if is_ignored( match ) then
33 - dbg.print( 'Ignore ' .. match .. ' for treesitter.' )
35 + dbg( 'Ignore %s for treesitter.', match )
34 36 return
36 38 local ok, _ = pcall( vim.treesitter.start, data.buf )
93 95 end,
96 -return {
98 +_G.BugabingaTreesitter = {
97 99 is_ignored = is_ignored,
102 +return BugabingaTreesitter

neovim/lua/bugabinga/winbar.lua

Modified
1 1 local puk = require 'std.puk'
2 2 local ignored = require 'std.ignored'
3 3 local icon = require 'std.icon'
4 +local table = require 'std.table'
5 -local function get_diagnostic_label(bufnr)
6 +local function get_diagnostic_label( bufnr )
6 7 local icons = {
7 8 Error = icon.error,
8 9 Warn = icon.warn,
13 14 local label = {}
14 - for severity, icon_txt in pairs(icons) do
15 - local n = #vim.diagnostic.get(bufnr, { severity = vim.diagnostic.severity[string.upper(severity)] })
15 + for severity, icon_txt in pairs( icons ) do
16 + local n = #vim.diagnostic.get( bufnr, { severity = vim.diagnostic.severity[string.upper( severity )] } )
16 17 if n > 0 then
17 - table.insert(label, { icon_txt .. ' ' .. n .. ' ', group = 'DiagnosticSign' .. severity })
18 + table.insert( label, { icon_txt .. ' ' .. n .. ' ', group = 'DiagnosticSign' .. severity } )
20 21 return label
23 -puk.defer 'incline' (function(incline)
24 +puk.defer 'incline' ( function ( incline )
24 25 incline.setup {
25 26 ignore = {
26 - filetypes = ignored.filetypes
27 + filetypes = ignored.filetypes,
28 29 debounce_threshold = { falling = 500, rising = 250 },
29 - highlight = {
30 - groups = {
31 - InclineNormal = { default = true, guifg = "NONE", guibg = "NONE" },
32 - InclineNormalNC = { default = true, guifg = "NONE", guibg = "NONE" },
33 - },
34 - },
35 30 window = {
36 31 placement = {
37 32 horizontal = 'right',
38 - vertical = 'top'
33 + vertical = 'bottom',
40 - padding = 0,
35 + padding = 1,
41 36 margin = {
42 37 horizontal = 0,
43 - vertical = 0,
44 - }
38 + vertical = 1,
39 + },
46 - render = function(properties)
41 + render = function ( properties )
47 42 local bufnr = properties.buf
48 43 local focused = properties.focused
49 - local buffer_full_name = vim.api.nvim_buf_get_name(bufnr)
50 - local buffer_name = vim.fn.fnamemodify(buffer_full_name, ':t')
44 + local buffer_full_name = vim.api.nvim_buf_get_name( bufnr )
45 + local buffer_name = vim.fn.fnamemodify( buffer_full_name, ':t' )
51 46 local filename = (buffer_name and buffer_name ~= '') and buffer_name or '[scratch]'
52 - local diagnostics = get_diagnostic_label(bufnr)
53 - local highlight = focused and 'Normal' or 'NonText'
54 - local modified_highlight = vim.api.nvim_get_option_value("modified", { buf = bufnr }) and "Title" or highlight
55 - local filetype_icon, icon_highlight = MiniIcons.get('file', buffer_name) ---@diagnostic disable-line: undefined-global
47 + local diagnostics = get_diagnostic_label( bufnr )
48 + local highlight = focused and 'WinBar' or 'WinBarNC'
49 + local modified_highlight = vim.api.nvim_get_option_value( 'modified', { buf = bufnr } ) and 'Title' or highlight
50 + local filetype_icon, icon_highlight = MiniIcons.get( 'file', buffer_name ) ---@diagnostic disable-line: undefined-global
57 52 local buffer = {
58 53 { filetype_icon, group = icon_highlight },
59 - { " " },
54 + { ' ' },
60 55 { filename, group = modified_highlight },
63 58 if #diagnostics > 0 then
64 - table.insert(diagnostics, { "| ", group = highlight })
59 + table.insert( diagnostics, { '| ', group = highlight } )
66 - for _, segment in ipairs(buffer) do
67 - table.insert(diagnostics, segment)
61 + for _, segment in ipairs( buffer ) do
62 + table.insert( diagnostics, segment )
69 64 return diagnostics
70 65 end,
72 -end)
67 +end )

neovim/lua/std/cheatsheet.lua

Added
new file mode 100644
1 +local categories = {
2 + lsp = 'LSP',
3 + fuzzy = 'FZF',
4 + files = 'FILE',
5 + terminal = 'TERM',
6 + editing = 'EDIT',
7 + search = 'FIND',
8 + session = 'SESS',
9 + diff = 'DIFF',
10 + operator = 'OP',
11 + fun = 'FUN',
14 +local category_patterns = {
15 + '^lsp: ', 'lsp',
16 + '^fuzzy: ', 'fuzzy',
17 + '^files: ', 'files',
18 + '^terminal: ', 'terminal',
19 + '^editing: ', 'editing',
20 + '^search: ', 'search',
21 + '^session: ', 'session',
22 + '^diff: ', 'diff',
23 + '^operator: ', 'operator',
24 + '^fun: ', 'fun',
27 +local get_category_icon = function(category)
28 + return categories[category] or category:upper()
29 +end
31 +local parse_description = function(desc)
32 + if not desc or desc == '' then
33 + return 'general', '*no description*'
34 + end
36 + for i = 1, #category_patterns, 2 do
37 + local pattern, category = category_patterns[i], category_patterns[i + 1]
38 + if desc:match(pattern) then
39 + return category, desc:gsub(pattern, '')
40 + end
41 + end
43 + return 'general', desc
44 +end
46 +return {
47 + categories = categories,
48 + category_patterns = category_patterns,
49 + get_category_icon = get_category_icon,
50 + parse_description = parse_description,

neovim/lua/std/dbg.lua.bak

Added
new file mode 100644
1 +local user_command = require 'std.user_command'
2 +local icon = require 'std.icon'
4 +local DBG_FILE = vim.fn.stdpath 'state' .. '/bugabinga_config_debug.jsonl'
6 +---Debug kinds and their mapped highlight groups and icons.
7 +---@type table<string,[string, string]>
8 +local DBG_KINDS = {
9 + --TODO
10 + DEBUG = {},
11 + TRACE = {},
12 + ERROR = {},
15 +---@alias dbg_kind
16 +---| 'DEBUG' normal debug event -> use this, when logging debug information
17 +---| 'TRACE' function trace event -> use this, when tracing function call flow
18 +---| 'ERROR' error event -> use this, when logging unexpected events
20 +---Get context information from `debug.traceback()` and other `debug` functions.
21 +---Wwhen getting the stacktrace, we need to account for the function call graph inside this `dbg` module.
22 +---Either its: `callsite -> metatable -> print_debug -> print_debug_kind -> get_context`.
23 +---Or: `callsite -> print_debug_kind -> get_context`.
24 +---In both cases we are only interested in callsite to determine file name, the function name and line number.
25 +---
26 +---@return string filename The filename, the calling function resides in.
27 +---@return string function_name The name of the function, where `dbg` was called in.
28 +---@return integer line_number Line number the calling functions is invoking the `dbg` function at.
29 +local function get_context()
30 + --TODO
31 + local filename = nil
32 + local function_name = nil
33 + local line_number = nil
34 + return filename, function_name, line_number
35 +end
37 +--- Encodes debug event to JSON
38 +--- @param event table<string, table, string, table, string, string, integer> debug event to log
39 +--- @return string json JSON-encoded debug event
40 +local function encode( event )
41 + return vim.json.encode( event, {
42 + escape_slash = true,
43 + } )
44 +end
46 +--- Decodes debug event from JSON
47 +--- @param line string JSON-encoded debug event
48 +--- @return table<string, table, string, table, string, string, integer> event debug event to log
49 +local function decode( line )
50 + return vim.json.decode( line, {
51 + luanil = {
52 + object = true,
53 + array = true,
54 + },
55 + } )
56 +end
58 +--- Writes debug events to the debug file, one per line.
59 +---
60 +--- @see encode
61 +--- @param event table<string, table, string, table, string, string, integer> debug event to log
62 +local function write_to_debug_file( event )
63 + local file, errmsg = io.open( DBG_FILE, 'a+' )
64 + if not file then
65 + error( 'Unable to open debug log file `' .. DBG_FILE .. '`: ' .. errmsg )
66 + end
67 + local json_line = encode( event )
68 + file:write( json_line )
69 + file:flush()
70 + file:close()
71 +end
73 +---Replaces expressions inside the given `format`, by indexing into `user_data`.
74 +---
75 +---Resolve `format`, by replacing `{<expr>}` inside format string.
76 +---`<expr>` is used to index into `user_data`.
77 +---e.g.: `user_data = {a = 1, b = 2, c = 3}`
78 +---To get `b`: the format expression would be `{b}`.
79 +---`{b}` would be replaced by `2` in format string.
80 +---
81 +---e.g.: `user_data = {{a=1},{b=2},{c=3}}`
82 +---To index into nested structures, use numbers: `{2.b}`.
83 +---`{2.b}` would be replaced by `2` in format string.
84 +---Indexing is 1-based, as per usual in lua.
85 +---Values are converted by `vim.inspect` to strings.
86 +---
87 +---@see vim.inspect
88 +---
89 +---@param format string Message with optional "{}"-style expressions inside
90 +---@param data table Arbitrary data, that can be indexed into, to pick values for the `format` string
91 +---@return string formatted_message Message with format expressions resolved
92 +local function format_message( format, data )
93 + local formatted_message
94 + --TODO
95 + return formatted_message
96 +end
98 +if vim.g.bugabinga_debug_mode == nil then
99 + vim.g.bugabinga_debug_mode = false
100 +end
102 +local function is_debug_mode()
103 + return vim.g.bugabinga_debug_mode
104 +end
106 +---Log debug message of particular kind.
107 +---@param kind dbg_kind kind of event
108 +---@param message string message format string
109 +---@param ... any arbitrary user data, that can be referenced in message format
110 +local function print_debug_kind( kind, message, ... )
111 + if not is_debug_mode() then
112 + return
113 + end
114 + local now = os.date '!*t'
115 + local user_data = { ... }
116 + local filename, function_name, line_number = get_context()
117 + write_to_debug_file {
118 + kind = kind,
119 + date = now,
120 + format = message,
121 + data = user_data,
122 + filename = filename,
123 + fn = function_name,
124 + line = line_number,
126 +end
128 +---Log a debug event.
129 +---@param message string message format string
130 +---@param ... any arbitrary user data, that can be referenced in message format
131 +local function print_debug( message, ... )
132 + if not is_debug_mode() then
133 + return
134 + end
135 + print_debug_kind( 'DEBUG', message, ... )
136 +end
138 +local function toggle_debug_mode()
139 + vim.g.bugabinga_debug_mode = not vim.g.bugabinga_debug_mode
140 + vim.notify( 'Toggled debug mode to ' .. tostring( is_debug_mode() ) )
141 +end
143 +--- Opens the debug file in a special buffer, that is not modifiable.
144 +--- It renders the debug events in a table with special functions:
145 +--- - filter by type
146 +--- - jump to location
147 +--- - colors and icons for different kinds
148 +--- Filters are a label, e.g. "Filter by kind: " plus a special region after it on one line in the buffer above the table.
149 +--- Typing in that region activates the filtering in the table.
150 +---
151 +--- Icons are shown as prefix to kind values in their cells: <icon> <KIND>.
152 +--- The table rows are highlighted according to kinds in `DBG_KINDS`.
153 +--- Note: table row can be multiline because of formatted messages. Highlighting needs to account for that.
154 +---
155 +--- Pressing enter while the cursor is on a table row, jumps to this events location.
156 +---
157 +--- Debug events are read and decoded from `DBG_FILE` and converted to a table of:
158 +--- Kind, Date, Message, Location
159 +---
160 +--- Kind -> debug event kind + icon
161 +--- Date -> human readable datetime in hosts timezone
162 +--- Message -> formatted message from format string and user data
163 +--- Locataion -> combined file name, function name and line number
164 +local function open_special_debug_buffer()
165 + --TODO
166 +end
168 +--- Opens the file `DBG_FILE` in a normal neovim buffer
169 +local function open_raw_debug_file()
170 + --TODO
171 +end
173 +user_command.Debug 'Toggle global vim config debug mode.' ( toggle_debug_mode )
174 +user_command.DebugOpen 'Open special buffer with debug events' ( open_special_debug_buffer )
175 +user_command.DebugOpenRaw 'Opens the JSON debug file in normal buffer' ( open_raw_debug_file )
177 +return setmetatable(
179 + kind = print_debug_kind,
180 + toggle = toggle_debug_mode,
181 + get = is_debug_mode,
182 + }, {
183 + --TODO: refactor usages of this function in other code to new name
184 + __call = print_debug,
185 + __newindex = function ( ... )
186 + error(
187 + 'Assignments are not supported for std.dbg.\n' .. vim.inspect( ... ), 2 )
188 + end,
189 + } )

neovim/lua/std/dbg/file.lua

Modified
3 3 local encode = require 'std.dbg.encode'
4 4 local decode = require 'std.dbg.encode'
6 6 local DBG_FILE = vim.fn.stdpath 'state' .. '/bugabinga_config_debug.jsonl'
8 -local H = {
9 - fd = nil,
12 8 ---Returns the path to the debug log file.
13 9 ---@return string
14 10 local function get_path()
15 - return DBG_FILE
11 + return vim.g.bugabinga_debug_file_override or DBG_FILE
18 14 ---Returns the filename, function name, and line number of the caller.
32 28 return 'unknown', '', 0
35 ----Ensures the debug file directory exists and the FD is open.
36 ----If the file was deleted while the old FD was still open, closes the old FD and reopens.
37 ----@return boolean success
38 ----@return string? error_message
39 -local function ensure_fd()
40 - local dir = vim.fs.dirname(DBG_FILE)
41 - vim.fn.mkdir(dir, 'p')
42 - local stat = vim.uv.fs_stat(DBG_FILE)
43 - if H.fd and stat then
44 - return true
45 - end
46 - if H.fd then
47 - vim.uv.fs_close(H.fd)
48 - H.fd = nil
49 - end
50 - local fd = vim.uv.fs_open(DBG_FILE, 'a', tonumber('644', 8))
51 - if not fd or fd == 0 then
52 - return false, 'Failed to open debug file: ' .. DBG_FILE
53 - end
54 - H.fd = fd
55 - return true
56 -end
58 31 ---Appends a debug event as a JSON line to the debug file.
59 ----Keeps the file descriptor open for efficient repeated writes to the default path.
60 32 ---@param event table debug event
61 ----@param path string? override path (falls back to io.open for custom paths)
33 +---@param path string? override path
62 34 local function write(event, path)
63 - if path then
64 - local file_path = path
65 - local file, errmsg = io.open(file_path, 'a+')
66 - if not file then
67 - error('Unable to open debug log file `' .. file_path .. '`: ' .. errmsg)
68 - end
69 - local json_line = encode.encode(event)
70 - file:write(json_line .. '\n')
71 - file:flush()
72 - file:close()
73 - return
35 + local file_path = path or DBG_FILE
36 + local dir = vim.fs.dirname(file_path)
37 + if dir and dir ~= '' then
38 + vim.fn.mkdir(dir, 'p')
75 - local ok, err = ensure_fd()
76 - if not ok then
77 - error(err)
40 + local file, errmsg = io.open(file_path, 'a')
41 + if not file then
42 + error('Unable to open debug log file `' .. file_path .. '`: ' .. tostring(errmsg))
79 44 local json_line = encode.encode(event)
80 - vim.uv.fs_write(H.fd, json_line .. '\n')
45 + file:write(json_line .. '\n')
46 + file:flush()
47 + file:close()
83 ----Closes the open file descriptor. Call on VimLeave.
50 +---Closes the open file descriptor. No-op with io.open.
84 51 local function close_fd()
85 - if H.fd then
86 - vim.uv.fs_close(H.fd)
87 - H.fd = nil
88 - end
91 ----Clears the debug log file by closing the FD and deleting the file.
54 +---Clears the debug log file by truncating it.
92 55 local function clear_log()
93 - close_fd()
94 - vim.fn.delete(DBG_FILE)
56 + local dir = vim.fs.dirname(DBG_FILE)
57 + if dir and dir ~= '' then
58 + vim.fn.mkdir(dir, 'p')
59 + end
60 + local file, errmsg = io.open(DBG_FILE, 'w')
61 + if file then
62 + file:close()
63 + end
97 66 ---Reads all debug events from a JSONL file.
145 114 return new_events, current_count
148 -vim.api.nvim_create_autocmd('VimLeave', {
149 - callback = close_fd,
150 -})
152 117 return {
153 118 get_path = get_path,
154 119 get_context = get_context,

neovim/lua/std/dbg/format.lua

Modified
9 9 --- {0} -> vim.inspect(all data)
10 10 --- {N} -> wrapped[N]
11 11 --- {N.key} -> wrapped[N].key
12 ---- {N.1.key} -> wrapped[N][1].key (numeric into array, then string)
12 +--- {N.1.key} -> wrapped[N][1].key (numeric into string)
13 13 --- {N.["key"]} -> wrapped[N]["key"] (bracket = always string key)
14 14 --- {N.["a.b"]} -> wrapped[N]["a.b"] (key containing dots)
15 15 --- Mixed bare and bracket: {N.a.["x.y"].z} works as expected
45 45 --- - Any nil result (missing index or missing chained key) produces an error
46 46 --- - Table values are rendered via vim.inspect
48 +---### Error Suggestions
49 +--- - Index off by 1-3: suggests correct index (e.g., {3} with 2 items suggests {2})
50 +--- - Wrong key name: suggests closest key using Levenshtein distance (threshold 2)
51 +---
48 52 ---@param format string format string with placeholders
49 53 ---@param data table varargs list packed as {...}
50 54 ---@return string formatted message
115 119 return keys
122 +---Computes Levenshtein edit distance between two strings.
123 +---Uses Wagner-Fischer dynamic programming algorithm.
124 +---@param a string first string
125 +---@param b string second string
126 +---@return number edit distance (0 = identical)
127 +local function levenshtein(a, b)
128 + local m, n = #a, #b
129 + if m == 0 then return n end
130 + if n == 0 then return m end
132 + local prev = {}
133 + local curr = {}
134 + for j = 0, n do
135 + prev[j] = j
136 + end
138 + for i = 1, m do
139 + curr[0] = i
140 + for j = 1, n do
141 + local cost = a:sub(i, i) == b:sub(j, j) and 0 or 1
142 + curr[j] = math.min(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost)
143 + end
144 + prev, curr = curr, prev
145 + end
147 + return prev[n]
148 +end
150 +---Suggests a similar key from a table based on Levenshtein distance.
151 +---Only suggests keys within threshold distance (<= 2).
152 +---@param tbl table the table to search
153 +---@param wrong_key string the key that was not found
154 +---@return string? suggested key or nil if none close enough
155 +local function suggest_key(tbl, wrong_key)
156 + if type(wrong_key) ~= 'string' then return nil end
157 + local best_key, best_dist = nil, math.huge
158 + for k in pairs(tbl) do
159 + if type(k) == 'string' then
160 + local d = levenshtein(k, wrong_key)
161 + if d < best_dist then
162 + best_key, best_dist = k, d
163 + end
164 + end
165 + end
166 + if best_dist <= 2 then return best_key end
167 + return nil
168 +end
118 170 local function format_message(format, data)
119 171 vim.validate('format', format, 'string')
120 172 vim.validate('data', data, 'table')
177 229 local current = data[idx]
230 + local failed_key = nil
231 + local parent_table = nil
178 233 for i = 2, #keys do
179 234 if current == nil then break end
180 235 local k = keys[i]
181 - current = current[k.is_string and k.key or tonumber(k.key) or k.key]
236 + local access_key = k.is_string and k.key or tonumber(k.key) or k.key
237 + if type(current) == 'table' then
238 + local key_exists = false
239 + for ek in pairs(current) do
240 + if ek == access_key then key_exists = true break end
241 + end
242 + if not key_exists then
243 + failed_key = access_key
244 + parent_table = current
245 + end
246 + end
247 + current = current[access_key]
184 250 if current == nil then
185 - error('Key not found while resolving {' .. inner .. '}')
251 + local msg = 'Key not found while resolving {' .. inner .. '}'
252 + if failed_key and parent_table then
253 + local suggestion = suggest_key(parent_table, failed_key)
254 + if suggestion then
255 + msg = msg .. " (did you mean '" .. suggestion .. "'?)"
256 + end
257 + end
258 + error(msg)
188 261 replacement = type(current) == 'table' and vim.inspect(current) or tostring(current)
196 269 return table.concat(result)
199 -return format_message
272 +return setmetatable(
273 + { levenshtein = levenshtein },
274 + { __call = function(_, ...) return format_message(...) end }

neovim/lua/std/dbg/init.lua

Modified
44 44 fn = function_name,
45 45 line = line_number,
47 - file.write( event )
47 + file.write( event, file.get_path() )
50 50 ---Logs a DEBUG event.

neovim/lua/std/icon.lua

Modified
126 126 calculator = '󰃬',
127 127 star = '󰧑',
128 128 command = '',
129 + offspec = ' ',

neovim/lua/std/localrc.lua

Modified
1 -local debug = require 'std.dbg'
1 +local dbg = require 'std.dbg'
3 3 --- loads given lua file path in current working directory into the current neovim lua runtime.
4 4 --- @param file_name string path to lua file, that should be loaded
15 15 local fn, err = loadstring( file )
16 16 if not fn or err then
17 - debug.print( 'unable to load ' .. file_name .. '. ' .. err )
17 + dbg( 'unable to load %s. %s', file_name, err )
18 18 return nil
20 20 local value = fn()

neovim/lua/std/map.lua

Modified
30 30 t = 't',
33 -local bind = function(self, map)
34 - vim.validate('map', map, 'table')
35 - vim.validate('map.keys', map.keys, { 'string', 'table' })
36 - vim.validate('map.command', map.command, { 'function', 'string' })
33 +local bind = function ( self, map )
34 + vim.validate( 'map', map, 'table' )
35 + vim.validate( 'map.keys', map.keys, { 'string', 'table' } )
36 + vim.validate( 'map.command', map.command, { 'function', 'string' } )
38 38 local keys = map.keys
39 39 local command = map.command
44 44 map.description = map.category .. ': ' .. map.description
47 - local options = vim.tbl_extend('keep', map.options, {
47 + local options = vim.tbl_extend( 'keep', map.options, {
48 48 silent = true,
49 49 desc = map.description,
50 50 buffer = map.buffer,
51 51 remap = map.remap,
52 - })
52 + } )
54 - if vim.tbl_isempty(self.modes) then
54 + if vim.tbl_isempty( self.modes ) then
55 55 self.modes[1] = available_modes.normal_visual_select_operator_pending
58 - -- vim.print('vim.keymap', self.modes, keys, command, options)
58 + local modes = self.modes
60 - if type(keys) == 'table' then
61 - for _, key in ipairs(keys) do
62 - vim.keymap.set(self.modes, key, command, options)
60 + if type( keys ) == 'table' then
61 + for _, key in ipairs( keys ) do
62 + vim.keymap.set( modes, key, command, options )
65 - vim.keymap.set(self.modes, keys, command, options)
65 + vim.keymap.set( modes, keys, command, options )
68 68 self.modes = {}
70 - return function()
70 + return function ()
71 71 local delete_options = options.buffer and { buffer = options.buffer } or {}
72 - if type(keys) == 'table' then
73 - for _, key in ipairs(keys) do
74 - vim.keymap.del(self.modes, key, delete_options)
72 + if type( keys ) == 'table' then
73 + for _, key in ipairs( keys ) do
74 + vim.keymap.del( modes, key, delete_options )
77 - vim.keymap.del(self.modes, keys, delete_options)
77 + vim.keymap.del( modes, keys, delete_options )
82 -local add_mode = function(self, key)
82 +local add_mode = function ( self, key )
83 83 local new_mode = available_modes[key]
84 84 if new_mode == nil then
85 - error('unknown keymap mode requested: ' .. key)
85 + error( 'unknown keymap mode requested: ' .. key )
87 - if not self.modes[new_mode] then
88 - table.insert(self.modes, new_mode)
87 + if not vim.tbl_contains( self.modes, new_mode ) then
88 + table.insert( self.modes, new_mode )
90 90 return self
99 99 __index = add_mode,
100 - __newindex = function(...) error('Assigments are not supported for std.map.\n' .. vim.inspect(...), 2) end,
100 + __newindex = function ( ... ) error( 'Assignments are not supported for std.map.\n' .. vim.inspect( ... ), 2 ) end,
101 101 __call = bind,

neovim/lua/std/prequire.lua

Modified
6 6 while true do
7 7 local info = debug.getinfo( level, 'nSl' )
8 8 if not info then break end
9 - dbg.print( string.format( "%s:%d in function '%s'", info.short_src, info.currentline, info.name or '' ) )
9 + dbg( '%s:%d in function %s', info.short_src, info.currentline, info.name or '' )
10 10 level = level + 1

neovim/lua/std/project.lua

Modified
3 3 local table = require 'std.table'
5 5 local join = table.join
6 6 local dirname = vim.fs.dirname
7 7 local normalize = vim.fs.normalize
8 -local exists = vim.uv.fs_stat
9 8 local validate = vim.validate
11 10 local cache = {}
53 52 { name = 'flake.nix', weight = MAYBE, },
55 +local function select_best_root(directory_scores)
56 + if #directory_scores == 0 then return nil end
57 + local project_root = nil
58 + local max_likelyhood = 0
59 + for _, score in ipairs(directory_scores) do
60 + local likelyhood = score.marker_count * (1 / score.distance_to_buffer_file)
61 + if likelyhood > max_likelyhood then
62 + max_likelyhood = likelyhood
63 + project_root = score.path
64 + end
65 + end
66 + return project_root
67 +end
56 69 --- Determines the path to a root directory, starting from the given path.
57 70 -- Markers have a name and weight.
58 71 -- Each name is checked for existence in all directories up to the root.
94 107 stop = stop or vim.uv.os_homedir()
95 108 stop = normalize(stop)
97 - if not exists(stop) then error(('the stop directory %s does not exist!'):format(stop)) end
110 + if not vim.uv.fs_stat(stop) then error(('the stop directory %s does not exist!'):format(stop)) end
99 112 if #path == 0 then return nil end
125 138 markers = {},
141 + local dir_entries = {}
142 + local handle = vim.uv.fs_scandir(current_path)
143 + if handle then
144 + while true do
145 + local name = vim.uv.fs_scandir_next(handle)
146 + if not name then break end
147 + dir_entries[name] = true
148 + end
149 + end
128 151 for _, marker in ipairs(markers) do
129 - local marker_path = current_path .. '/' .. marker.name
130 - if exists(marker_path) then
152 + if dir_entries[marker.name] then
153 + local marker_path = current_path .. '/' .. marker.name
131 154 score.marker_count = score.marker_count + marker.weight
132 155 table.insert(score.markers, marker_path)
143 166 loop_count = loop_count + 1
146 - local project_root = nil
147 - local max_likelyhood = 0
148 - -- the project root is most likely the directory with the highest marker count
149 - -- and closest distance to current buffer.
150 - -- however, if there are markers further away from the buffer than other markers,
151 - -- then it could be a nested project structure (multi-module).
152 - -- in those cases we are looking for the root project folder, instead the nearest
153 - -- child project root folder.
154 - for _, score in ipairs(directory_scores) do
155 - local likelyhood = score.marker_count * (1 / score.distance_to_buffer_file)
156 - if likelyhood > max_likelyhood then
157 - max_likelyhood = likelyhood
158 - project_root = score.path
159 - end
160 - end
169 + local project_root = select_best_root(directory_scores)
161 170 if project_root then
162 171 cache_set(project_root, path, markers, stop)
282 291 find_lua_project_root = find_lua_project_root,
283 292 find_zig_project_root = find_zig_project_root,
284 293 find_rust_project_root = find_rust_project_root,
294 + _select_best_root = select_best_root,

neovim/lua/std/rename.lua

Modified
15 - local clients = vim.lsp.get_clients()
15 + local clients = vim.lsp.get_clients { bufnr = 0 }
16 16 for _, client in ipairs(clients) do
17 17 if client:supports_method("workspace/willRenameFiles") then
18 18 local resp = client:request_sync("workspace/willRenameFiles", changes, 1000, 0)

neovim/lua/std/user_command.lua

Modified
1 1 --- Creates a new user command
2 2 --- @param user_command table Necessary data to create a new user command.
3 -local create_user_command = function ( user_command )
3 +local create_user_command = function( user_command )
4 4 local options = { desc = user_command.description, }
5 5 local merged_options = vim.tbl_deep_extend( 'force', options, user_command.options or {} )
6 - vim.api.nvim_create_user_command(
7 - user_command.name,
8 - user_command.command,
9 - merged_options
10 - )
6 + if user_command.bufnr then
7 + vim.api.nvim_buf_create_user_command(
8 + user_command.bufnr,
9 + user_command.name,
10 + user_command.command,
11 + merged_options
12 + )
13 + else
14 + vim.api.nvim_create_user_command(
15 + user_command.name,
16 + user_command.command,
17 + merged_options
18 + )
19 + end
13 22 --- Sets the field `command` in `self` to given value in `command`
15 24 --- @param self table any table.
16 25 --- @param command function command to be executed when the user command is run.
17 26 --- @return function deleter A function that deletes the created user command.
18 -local set_command = function ( self, command )
27 +local set_command = function( self, command )
19 28 self.command = command
20 29 create_user_command( self )
21 - --- Deletes the created user command
22 - return function () vim.api.nvim_del_user_command( self.name ) end
30 + if self.bufnr then
31 + return function() vim.api.nvim_buf_del_user_command( self.bufnr, self.name ) end
32 + end
33 + return function() vim.api.nvim_del_user_command( self.name ) end
25 36 --- meta table, that sets the function value, when called, to a field named `command`
26 37 local COMMAND_SETTER = {
27 - __call = function ( self, command )
28 - vim.validate('command', command, 'function')
38 + __call = function( self, command )
39 + vim.validate( 'command', command, 'function' )
29 40 return set_command( self, command )
30 41 end,
33 44 --- meta table, that either sets the table value to a field named `options`,
34 45 --- or the function value to a field named `command`, when called.
35 46 local OPTIONS_OR_COMMAND_SETTER = {
36 - __call = function ( self, options_or_command )
37 - vim.validate('options_or_command', options_or_command, { 'table', 'function', })
47 + __call = function( self, options_or_command )
48 + vim.validate( 'options_or_command', options_or_command, { 'table', 'function', } )
38 49 if type( options_or_command ) == 'table' then
39 50 self.options = options_or_command
40 51 return setmetatable( self, COMMAND_SETTER )
46 57 --- meta table, that sets the string value to a field named `description`, when called.
47 58 local DESCRIPTION_SETTER = {
48 - __call = function ( self, description )
49 - vim.validate('description', description, 'string')
59 + __call = function( self, description )
60 + vim.validate( 'description', description, 'string' )
50 61 self.description = description
51 62 return setmetatable( self, OPTIONS_OR_COMMAND_SETTER )
52 63 end,
66 +local new_cmd = function( name, bufnr )
67 + local cmd = { name = name }
68 + if bufnr then cmd.bufnr = bufnr end
69 + return cmd
70 +end
55 72 --- meta table, that sets the string value to a field named `name`, when indexed into.
56 73 local COMMAND_NAME_SETTER = {
57 - __index = function ( _, command_name )
58 - vim.validate('command_name', command_name, 'string')
59 - local new_user_command = { name = command_name, }
60 - return setmetatable( new_user_command, DESCRIPTION_SETTER )
74 + __index = function( _, command_name )
75 + vim.validate( 'command_name', command_name, 'string' )
76 + return setmetatable( new_cmd( command_name ), DESCRIPTION_SETTER )
61 77 end,
64 ---TODO: think about how to create buffer commands
80 +--- meta table, that sets the buffer number when called, then returns
81 +--- a fresh command name setter chain with the bufnr attached.
82 +local BUFFER_SETTER = {
83 + __call = function( _, bufnr )
84 + vim.validate( 'bufnr', bufnr, 'number' )
85 + local cmd_mt = {
86 + __index = function( _, command_name )
87 + vim.validate( 'command_name', command_name, 'string' )
88 + return setmetatable( new_cmd( command_name, bufnr ), DESCRIPTION_SETTER )
89 + end,
90 + }
91 + return setmetatable( {}, cmd_mt )
92 + end,
66 -return setmetatable( {}, COMMAND_NAME_SETTER )
95 +local M = setmetatable( {}, COMMAND_NAME_SETTER )
96 +M.buffer = setmetatable( {}, BUFFER_SETTER )
97 +return M

neovim/sample_files/.github/workflows/test.yaml

Added
new file mode 100644
1 +name: Test Workflow
3 +on:
4 + push:
5 + branches: [main]
6 + pull_request:
7 + branches: [main]
8 + workflow_dispatch:
10 +jobs:
11 + build:
12 + runs-on: ubuntu-latest
13 + steps:
14 + - uses: actions/checkout@v4
15 + - name: Setup Node
16 + uses: actions/setup-node@v4
17 + with:
18 + node-version: '20'
19 + - run: npm ci
20 + - run: npm test
22 + lint:
23 + runs-on: ubuntu-latest
24 + steps:
25 + - uses: actions/checkout@v4
26 + - name: Run linter
27 + run: echo "linting..."

neovim/sample_files/A.prg

Added
new file mode 100644
1 +CLEAR
2 +? "Hello, you glorious bastard of a world!"
4 +QUIT

neovim/sample_files/a.FXP

Added
new file mode 100644

Current version contains binary or non-UTF-8 data.

neovim/sample_files/a.d2

Added
new file mode 100644
1 +vars: {
2 + d2-config: {
3 + layout-engine: elk
4 + # Terminal theme code
5 + theme-id: 300
6 + }
7 +}
8 +network: {
9 + cell tower: {
10 + satellites: {
11 + shape: stored_data
12 + style.multiple: true
13 + }
15 + transmitter
17 + satellites -> transmitter: send
18 + satellites -> transmitter: send
19 + satellites -> transmitter: send
20 + }
22 + online portal: {
23 + jjkkkkjj
24 + ui: {shape: hexagon}
25 + }
27 + data processor: {
28 + storage: {
29 + shape: cylinder
30 + style.multiple: true
31 + }
32 + }
34 + cell tower.transmitter -> data processor.storage: phone logs
37 +user: {
38 + shape: person
39 + width: 130
42 +user -> network.cell tower: make call
43 +user -> network.online portal.ui: access {
44 + style.stroke-dash: 3
47 +api server -> network.online portal.ui: display
48 +api server -> logs: persist
49 +logs: {shape: page; style.multiple: true}
51 +network.data processor -> api server

neovim/sample_files/a.svg

Added
new file mode 100644
1 +<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-d2-version="v0.7.0-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 911 1902"><svg class="d2-2969716219 d2-svg" width="911" height="1902" viewBox="-89 -89 911 1902"><rect x="-89.000000" y="-89.000000" width="911.000000" height="1902.000000" rx="0.000000" fill="#FFFFFF" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
2 +.d2-2969716219 .text-mono {
3 + font-family: "d2-2969716219-font-mono";
4 +}
5 +@font-face {
6 + font-family: d2-2969716219-font-mono;
7 + src: url("data:application/font-woff;base64,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");
8 +}
9 +.d2-2969716219 .text-mono-bold {
10 + font-family: "d2-2969716219-font-mono-bold";
12 +@font-face {
13 + font-family: d2-2969716219-font-mono-bold;
14 + src: url("data:application/font-woff;base64,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");
16 +.d2-2969716219 .text-mono-italic {
17 + font-family: "d2-2969716219-font-mono-italic";
19 +@font-face {
20 + font-family: d2-2969716219-font-mono-italic;
21 + src: url("data:application/font-woff;base64,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");
22 +}]]></style><style type="text/css"><![CDATA[.shape {
23 + shape-rendering: geometricPrecision;
24 + stroke-linejoin: round;
26 +.connection {
27 + stroke-linecap: round;
28 + stroke-linejoin: round;
30 +.blend {
31 + mix-blend-mode: multiply;
32 + opacity: 0.5;
35 + .d2-2969716219 .fill-N1{fill:#000410;}
36 + .d2-2969716219 .fill-N2{fill:#0000B8;}
37 + .d2-2969716219 .fill-N3{fill:#9499AB;}
38 + .d2-2969716219 .fill-N4{fill:#CFD2DD;}
39 + .d2-2969716219 .fill-N5{fill:#C3DEF3;}
40 + .d2-2969716219 .fill-N6{fill:#EEF1F8;}
41 + .d2-2969716219 .fill-N7{fill:#FFFFFF;}
42 + .d2-2969716219 .fill-B1{fill:#000410;}
43 + .d2-2969716219 .fill-B2{fill:#0000E4;}
44 + .d2-2969716219 .fill-B3{fill:#5AA4DC;}
45 + .d2-2969716219 .fill-B4{fill:#E7E9EE;}
46 + .d2-2969716219 .fill-B5{fill:#F5F6F9;}
47 + .d2-2969716219 .fill-B6{fill:#FFFFFF;}
48 + .d2-2969716219 .fill-AA2{fill:#008566;}
49 + .d2-2969716219 .fill-AA4{fill:#45BBA5;}
50 + .d2-2969716219 .fill-AA5{fill:#7ACCBD;}
51 + .d2-2969716219 .fill-AB4{fill:#F1C759;}
52 + .d2-2969716219 .fill-AB5{fill:#F9E088;}
53 + .d2-2969716219 .stroke-N1{stroke:#000410;}
54 + .d2-2969716219 .stroke-N2{stroke:#0000B8;}
55 + .d2-2969716219 .stroke-N3{stroke:#9499AB;}
56 + .d2-2969716219 .stroke-N4{stroke:#CFD2DD;}
57 + .d2-2969716219 .stroke-N5{stroke:#C3DEF3;}
58 + .d2-2969716219 .stroke-N6{stroke:#EEF1F8;}
59 + .d2-2969716219 .stroke-N7{stroke:#FFFFFF;}
60 + .d2-2969716219 .stroke-B1{stroke:#000410;}
61 + .d2-2969716219 .stroke-B2{stroke:#0000E4;}
62 + .d2-2969716219 .stroke-B3{stroke:#5AA4DC;}
63 + .d2-2969716219 .stroke-B4{stroke:#E7E9EE;}
64 + .d2-2969716219 .stroke-B5{stroke:#F5F6F9;}
65 + .d2-2969716219 .stroke-B6{stroke:#FFFFFF;}
66 + .d2-2969716219 .stroke-AA2{stroke:#008566;}
67 + .d2-2969716219 .stroke-AA4{stroke:#45BBA5;}
68 + .d2-2969716219 .stroke-AA5{stroke:#7ACCBD;}
69 + .d2-2969716219 .stroke-AB4{stroke:#F1C759;}
70 + .d2-2969716219 .stroke-AB5{stroke:#F9E088;}
71 + .d2-2969716219 .background-color-N1{background-color:#000410;}
72 + .d2-2969716219 .background-color-N2{background-color:#0000B8;}
73 + .d2-2969716219 .background-color-N3{background-color:#9499AB;}
74 + .d2-2969716219 .background-color-N4{background-color:#CFD2DD;}
75 + .d2-2969716219 .background-color-N5{background-color:#C3DEF3;}
76 + .d2-2969716219 .background-color-N6{background-color:#EEF1F8;}
77 + .d2-2969716219 .background-color-N7{background-color:#FFFFFF;}
78 + .d2-2969716219 .background-color-B1{background-color:#000410;}
79 + .d2-2969716219 .background-color-B2{background-color:#0000E4;}
80 + .d2-2969716219 .background-color-B3{background-color:#5AA4DC;}
81 + .d2-2969716219 .background-color-B4{background-color:#E7E9EE;}
82 + .d2-2969716219 .background-color-B5{background-color:#F5F6F9;}
83 + .d2-2969716219 .background-color-B6{background-color:#FFFFFF;}
84 + .d2-2969716219 .background-color-AA2{background-color:#008566;}
85 + .d2-2969716219 .background-color-AA4{background-color:#45BBA5;}
86 + .d2-2969716219 .background-color-AA5{background-color:#7ACCBD;}
87 + .d2-2969716219 .background-color-AB4{background-color:#F1C759;}
88 + .d2-2969716219 .background-color-AB5{background-color:#F9E088;}
89 + .d2-2969716219 .color-N1{color:#000410;}
90 + .d2-2969716219 .color-N2{color:#0000B8;}
91 + .d2-2969716219 .color-N3{color:#9499AB;}
92 + .d2-2969716219 .color-N4{color:#CFD2DD;}
93 + .d2-2969716219 .color-N5{color:#C3DEF3;}
94 + .d2-2969716219 .color-N6{color:#EEF1F8;}
95 + .d2-2969716219 .color-N7{color:#FFFFFF;}
96 + .d2-2969716219 .color-B1{color:#000410;}
97 + .d2-2969716219 .color-B2{color:#0000E4;}
98 + .d2-2969716219 .color-B3{color:#5AA4DC;}
99 + .d2-2969716219 .color-B4{color:#E7E9EE;}
100 + .d2-2969716219 .color-B5{color:#F5F6F9;}
101 + .d2-2969716219 .color-B6{color:#FFFFFF;}
102 + .d2-2969716219 .color-AA2{color:#008566;}
103 + .d2-2969716219 .color-AA4{color:#45BBA5;}
104 + .d2-2969716219 .color-AA5{color:#7ACCBD;}
105 + .d2-2969716219 .color-AB4{color:#F1C759;}
106 + .d2-2969716219 .color-AB5{color:#F9E088;}.appendix text.text{fill:#000410}.md{--color-fg-default:#000410;--color-fg-muted:#0000B8;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#000410;--color-border-muted:#0000E4;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0000E4;--color-accent-emphasis:#0000E4;--color-attention-subtle:#0000B8;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-B4{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-2969716219);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N1{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-N3{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N6{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><style type="text/css"><![CDATA[
107 +.dots-overlay {
108 + fill: url(#dots-d2-2969716219);
109 + mix-blend-mode: multiply;
110 +}]]></style><defs><pattern id="dots-d2-2969716219" x="0" y="0" width="15" height="15" patternUnits="userSpaceOnUse">
111 +<g style="mix-blend-mode:multiply" opacity="0.1">
112 +<rect x="2" y="2" width="1" height="1" fill="#0A0F25"/>
113 +</g>
114 +<g style="mix-blend-mode:multiply" opacity="0.1">
115 +<rect x="12" y="2" width="1" height="1" fill="#0A0F25"/>
116 +</g>
117 +<g style="mix-blend-mode:multiply" opacity="0.1">
118 +<rect x="12" y="12" width="1" height="1" fill="#0A0F25"/>
119 +</g>
120 +<g style="mix-blend-mode:multiply" opacity="0.1">
121 +<rect x="2" y="12" width="1" height="1" fill="#0A0F25"/>
122 +</g>
123 +<g style="mix-blend-mode:multiply" opacity="0.1">
124 +<rect x="2" y="7" width="1" height="1" fill="#0A0F25"/>
125 +</g>
126 +<g style="mix-blend-mode:multiply" opacity="0.1">
127 +<rect x="12" y="7" width="1" height="1" fill="#0A0F25"/>
128 +</g>
129 +<g style="mix-blend-mode:multiply" opacity="0.1">
130 +<rect x="7" y="2" width="1" height="1" fill="#0A0F25"/>
131 +</g>
132 +<g style="mix-blend-mode:multiply" opacity="0.1">
133 +<rect x="7" y="12" width="1" height="1" fill="#0A0F25"/>
134 +</g>
135 +<g style="mix-blend-mode:multiply" opacity="0.1">
136 +<rect x="7" y="7" width="1" height="1" fill="#0A0F25"/>
137 +</g>
138 +</pattern>
139 +</defs><g class="bmV0d29yaw=="><g class="shape" ><rect x="12.000000" y="311.000000" width="621.000000" height="922.000000" stroke="#000410" fill="#E7E9EE" class=" stroke-B1 fill-B4" style="stroke-width:2;" /><rect x="12.000000" y="311.000000" width="621.000000" height="922.000000" class="dots-overlay" style="stroke-width:2;" /><rect x="17.000000" y="316.000000" width="611.000000" height="912.000000" stroke="#000410" fill="transparent" class=" stroke-B1" style="stroke-width:2;" /></g><text x="322.500000" y="344.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:28px">NETWORK</text></g><g class="dXNlcg=="><g class="shape" ><path d="M 348 99 H 218 V 98 C 218 83 232 70 255 63 C 242 58 235 50 235 40 C 235 25 256 12 283 12 C 309 12 331 25 331 40 C 331 49 324 58 311 63 C 333 69 348 83 348 98 V 99 H 348 Z" stroke="#000410" fill="#5AA4DC" class=" stroke-B1 fill-B3" style="stroke-width:2;" /></g><text x="283.000000" y="120.000000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">USER</text></g><g class="YXBpIHNlcnZlcg=="><g class="shape" ><rect x="341.000000" y="1388.000000" width="142.000000" height="66.000000" stroke="#000410" fill="#FFFFFF" class=" stroke-B1 fill-B6" style="stroke-width:2;" /></g><text x="412.000000" y="1426.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">API SERVER</text></g><g class="bG9ncw=="><g class="shape" ><path d="M 377 1615 H 437 C 438 1615 439 1615 440 1616 L 457 1632 C 458 1633 458 1634 458 1635 V 1702 C 458 1702 458 1702 458 1702 H 377 C 376 1702 376 1702 376 1702 V 1616 C 376 1615 376 1615 377 1615 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /><path d="M 457 1702 H 377 C 376 1702 376 1702 376 1701 V 1616 C 376 1615 376 1615 377 1615 H 436 C 437 1615 437 1615 437 1616 V 1633 C 437 1634 438 1635 439 1635 H 457 C 458 1635 458 1635 458 1636 V 1701 C 457 1702 458 1702 457 1702 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /><path d="M 367 1625 H 427 C 428 1625 429 1625 430 1626 L 447 1642 C 448 1643 448 1644 448 1645 V 1712 C 448 1712 448 1712 448 1712 H 367 C 366 1712 366 1712 366 1712 V 1626 C 366 1625 366 1625 367 1625 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /><path d="M 447 1712 H 367 C 366 1712 366 1712 366 1711 V 1626 C 366 1625 366 1625 367 1625 H 426 C 427 1625 427 1625 427 1626 V 1643 C 427 1644 428 1645 429 1645 H 447 C 448 1645 448 1645 448 1646 V 1711 C 447 1712 448 1712 447 1712 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /></g><text x="407.000000" y="1674.000000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">LOGS</text></g><g class="bmV0d29yay5jZWxsIHRvd2Vy"><g class="shape" ><rect x="62.000000" y="361.000000" width="271.000000" height="423.000000" stroke="#000410" fill="#F5F6F9" class=" stroke-B1 fill-B5" style="stroke-width:2;" /><rect x="62.000000" y="361.000000" width="271.000000" height="423.000000" class="dots-overlay" style="stroke-width:2;" /></g><text x="197.500000" y="390.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:24px">CELL TOWER</text></g><g class="bmV0d29yay5vbmxpbmUgcG9ydGFs"><g class="shape" ><rect x="353.000000" y="366.000000" width="230.000000" height="169.000000" stroke="#000410" fill="#F5F6F9" class=" stroke-B1 fill-B5" style="stroke-width:2;" /><rect x="353.000000" y="366.000000" width="230.000000" height="169.000000" class="dots-overlay" style="stroke-width:2;" /></g><text x="468.000000" y="395.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:24px">ONLINE PORTAL</text></g><g class="bmV0d29yay5kYXRhIHByb2Nlc3Nvcg=="><g class="shape" ><rect x="75.000000" y="955.000000" width="245.000000" height="228.000000" stroke="#000410" fill="#F5F6F9" class=" stroke-B1 fill-B5" style="stroke-width:2;" /><rect x="75.000000" y="955.000000" width="245.000000" height="228.000000" class="dots-overlay" style="stroke-width:2;" /></g><text x="197.500000" y="984.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:24px">DATA PROCESSOR</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLnNhdGVsbGl0ZXM="><g class="shape" ><path d="M 137 411 H 283 C 279 411 268 429 268 444 C 268 459 279 477 283 477 H 137 C 133 477 122 459 122 444 C 122 429 133 411 137 411 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 127 421 H 273 C 269 421 258 439 258 454 C 258 469 269 487 273 487 H 127 C 123 487 112 469 112 454 C 112 439 123 421 127 421 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /></g><text x="192.500000" y="459.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">SATELLITES</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLnRyYW5zbWl0dGVy"><g class="shape" ><rect x="122.000000" y="668.000000" width="151.000000" height="66.000000" stroke="#000410" fill="#FFFFFF" class=" stroke-B1 fill-B6" style="stroke-width:2;" /></g><text x="197.500000" y="706.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">TRANSMITTER</text></g><g class="bmV0d29yay5vbmxpbmUgcG9ydGFsLnVp"><g class="shape" ><path d="M 448 416 L 428 450 L 448 485 L 488 485 L 508 450 L 488 416 Z" stroke="#000410" fill="#C3DEF3" class=" stroke-B1 fill-N5" style="stroke-width:2;" /></g><text x="468.000000" y="456.000000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">UI</text></g><g class="bmV0d29yay5kYXRhIHByb2Nlc3Nvci5zdG9yYWdl"><g class="shape" ><path d="M 146 1029 C 146 1005 196 1005 202 1005 C 208 1005 258 1005 258 1029 V 1099 C 258 1123 208 1123 202 1123 C 196 1123 146 1123 146 1099 V 1029 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 146 1029 C 146 1053 196 1053 202 1053 C 208 1053 258 1053 258 1029" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 136 1039 C 136 1015 186 1015 192 1015 C 198 1015 248 1015 248 1039 V 1109 C 248 1133 198 1133 192 1133 C 186 1133 136 1133 136 1109 V 1039 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 136 1039 C 136 1063 186 1063 192 1063 C 198 1063 248 1063 248 1039" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /></g><text x="192.000000" y="1091.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">STORAGE</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLihzYXRlbGxpdGVzIC0mZ3Q7IHRyYW5zbWl0dGVyKVswXQ=="><marker id="mk-d2-2969716219-3488378134" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#000410" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 148.005525 488.999992 L 148.488950 664.000015" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="148.000000" y="583.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">SEND</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLihzYXRlbGxpdGVzIC0mZ3Q7IHRyYW5zbWl0dGVyKVsxXQ=="><path d="M 197.011050 488.999969 L 197.977901 664.000061" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="198.000000" y="583.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">SEND</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLihzYXRlbGxpdGVzIC0mZ3Q7IHRyYW5zbWl0dGVyKVsyXQ=="><path d="M 246.005525 488.999992 L 246.488950 664.000015" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="246.000000" y="583.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">SEND</text></g><g class="bmV0d29yay4oY2VsbCB0b3dlci50cmFuc21pdHRlciAtJmd0OyBkYXRhIHByb2Nlc3Nvci5zdG9yYWdlKVswXQ=="><path d="M 197.503690 735.999997 L 197.992620 1001.000007" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="198.000000" y="875.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">PHONE LOGS</text></g><g class="KHVzZXIgLSZndDsgbmV0d29yay5jZWxsIHRvd2VyKVswXQ=="><path d="M 261.665985 127.000000 L 261.665985 165.000000 S 261.665985 165.000000 261.665985 165.000000 L 117.916000 165.000000 S 117.916000 165.000000 117.916000 165.000000 L 117.916000 357.000000" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="118.000000" y="177.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">MAKE CALL</text></g><g class="KHVzZXIgLSZndDsgbmV0d29yay5vbmxpbmUgcG9ydGFsLnVpKVswXQ=="><marker id="mk-d2-2969716219-2177206569" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#0000E4" class="connection fill-B2" stroke-width="2" /> </marker><path d="M 305.000000 127.000000 L 305.000000 165.000000 S 305.000000 165.000000 305.000000 165.000000 L 448.750000 165.000000 S 448.750000 165.000000 448.750000 165.000000 L 448.996016 412.000002" stroke="#0000E4" fill="none" class="connection stroke-B2" style="stroke-width:2;stroke-dasharray:6.000000,5.919384;" marker-end="url(#mk-d2-2969716219-2177206569)" mask="url(#d2-2969716219)" /><text x="449.000000" y="204.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">ACCESS</text></g><g class="KGFwaSBzZXJ2ZXIgLSZndDsgbmV0d29yay5vbmxpbmUgcG9ydGFsLnVpKVswXQ=="><path d="M 435.665985 1386.000000 L 435.665985 1348.000000 S 435.665985 1348.000000 435.665985 1348.000000 L 687.500000 1348.000000 S 687.500000 1348.000000 687.500000 1348.000000 L 687.500000 266.000000 S 687.500000 266.000000 687.500000 266.000000 L 481.333008 266.000000 S 481.333008 266.000000 481.333008 266.000000 L 481.008880 412.000010" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="687.500000" y="780.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">DISPLAY</text></g><g class="KGFwaSBzZXJ2ZXIgLSZndDsgbG9ncylbMF0="><path d="M 412.000000 1456.000000 L 412.000000 1611.000000" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="412.000000" y="1540.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">PERSIST</text></g><g class="KG5ldHdvcmsuZGF0YSBwcm9jZXNzb3IgLSZndDsgYXBpIHNlcnZlcilbMF0="><path d="M 136.500000 1185.000000 L 136.500000 1348.000000 S 136.500000 1348.000000 136.500000 1348.000000 L 388.333008 1348.000000 S 388.333008 1348.000000 388.333008 1348.000000 L 388.333008 1384.000000" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /></g><mask id="d2-2969716219" maskUnits="userSpaceOnUse" x="-89" y="-89" width="911" height="1902">
140 +<rect x="-89" y="-89" width="911" height="1902" fill="white"></rect>
141 +<rect x="262.500000" y="316.000000" width="120" height="36" fill="rgba(0,0,0,0.75)"></rect>
142 +<rect x="262.000000" y="104.000000" width="42" height="21" fill="rgba(0,0,0,0.75)"></rect>
143 +<rect x="361.500000" y="1410.500000" width="101" height="21" fill="rgba(0,0,0,0.75)"></rect>
144 +<rect x="386.500000" y="1658.000000" width="41" height="21" fill="rgba(0,0,0,0.75)"></rect>
145 +<rect x="124.000000" y="366.000000" width="147" height="31" fill="rgba(0,0,0,0.75)"></rect>
146 +<rect x="373.500000" y="371.000000" width="189" height="31" fill="rgba(0,0,0,0.75)"></rect>
147 +<rect x="95.500000" y="960.000000" width="204" height="31" fill="rgba(0,0,0,0.75)"></rect>
148 +<rect x="142.500000" y="443.500000" width="100" height="21" fill="rgba(0,0,0,0.75)"></rect>
149 +<rect x="142.500000" y="690.500000" width="110" height="21" fill="rgba(0,0,0,0.75)"></rect>
150 +<rect x="457.000000" y="440.000000" width="22" height="21" fill="rgba(0,0,0,0.75)"></rect>
151 +<rect x="156.500000" y="1075.500000" width="71" height="21" fill="rgba(0,0,0,0.75)"></rect>
152 +<rect x="127.000000" y="567.000000" width="42" height="21" fill="black"></rect>
153 +<rect x="177.000000" y="567.000000" width="42" height="21" fill="black"></rect>
154 +<rect x="225.000000" y="567.000000" width="42" height="21" fill="black"></rect>
155 +<rect x="148.000000" y="859.000000" width="100" height="21" fill="black"></rect>
156 +<rect x="73.000000" y="161.000000" width="90" height="21" fill="black"></rect>
157 +<rect x="418.000000" y="188.000000" width="62" height="21" fill="black"></rect>
158 +<rect x="651.000000" y="764.000000" width="73" height="21" fill="black"></rect>
159 +<rect x="376.000000" y="1524.000000" width="72" height="21" fill="black"></rect>
160 +</mask></svg></svg>

neovim/sample_files/projects/dotfiles/.editorconfig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/.gitignore

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/README.md

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/git/.gitconfig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/neovim/.editorconfig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/neovim/.luarc.json

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/neovim/.stylua.toml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/neovim/lua/bugabinga/init.lua

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/neovim/lua/std/project.lua

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/neovim/tests/std/project_spec.lua

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/wezterm/.lsp.settings.lua

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/dotfiles/wezterm/.wezterm.lua

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/.mvn/wrapper/maven-wrapper.properties

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/data-module/pom.xml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/data-module/src/main/java/com/example/data/Repository.java

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/mvnw

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/pom.xml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/web-module/pom.xml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/java-maven-multi/web-module/src/main/java/com/example/web/App.java

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/.editorconfig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/README.md

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/frontend/deno.json

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/frontend/src/mod.ts

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/rust/Cargo.toml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/rust/crates/engine/Cargo.toml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/rust/crates/engine/src/lib.rs

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/rust/src/main.rs

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/zig/build.zig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/zig/deps/c-lib/Makefile

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/zig/deps/c-lib/src/lib.c

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/polyglot-mono/zig/src/main.zig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/Cargo.lock

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/Cargo.toml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/crates/api/Cargo.toml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/crates/api/src/lib.rs

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/crates/core/Cargo.toml

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/crates/core/src/lib.rs

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/rust-workspace/src/main.rs

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/zig-with-c-deps/build.zig

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/zig-with-c-deps/deps/c-lib/Makefile

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/zig-with-c-deps/deps/c-lib/README.md

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/zig-with-c-deps/deps/c-lib/include/lib.h

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/zig-with-c-deps/deps/c-lib/src/lib.c

Added
new file mode 100644

No text changes.

neovim/sample_files/projects/zig-with-c-deps/src/main.zig

Added
new file mode 100644

No text changes.

neovim/sample_files/sample.glossary.yml

Added
new file mode 100644
1 +contexts:
2 + - name: Sample Context
3 + domainVisionStatement: A sample glossary for testing Contextive LSP
4 + terms:
5 + - name: Widget
6 + definition: A reusable UI component that renders content.
7 + examples:
8 + - The button is a fundamental widget.
9 + - Every widget has a render method.
10 + aliases:
11 + - component
12 + - name: Feature
13 + definition: A user-facing capability delivered in a release.
14 + examples:
15 + - Dark mode is a new feature.
16 + - We track feature adoption metrics.
17 + - name: Bug
18 + definition: An unintended defect that causes incorrect behavior.
19 + examples:
20 + - This bug causes crashes on startup.
21 + - The bug was fixed in version 2.0.

neovim/sample_files/test.css

Added
new file mode 100644
1 +.container {
2 + display: flex;
3 + justify-content: center;
4 + align-items: flex-start;
5 + padding: 1rem;
6 + margin: 0 auto;
7 + max-width: 1200px;
8 +}
10 +.title {
11 + font-size: 2rem;
12 + font-weight: bold;
13 + color: #333;
16 +.button:hover {
17 + opacity: 0.8;

neovim/sample_files/test.html

Added
new file mode 100644
1 +<!DOCTYPE html>
2 +<html lang="en">
4 + <head>
5 + <meta charset="UTF-8">
6 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 + <title>Test Page</title>
8 + <style>
9 + body {
10 + margin: 0;
11 + padding: 2rem;
12 + }
14 + .container {
15 + max-width: 800px;
16 + margin: 0 auto;
17 + }
18 + </style>
19 + </head>
21 + <body>
22 + <div class="container">
23 + <h1>Hello World</h1>
24 + <p>Welcome to the test page.</p>
25 + </div>
26 + <script>
27 + console.log("hello");
28 + </script>
29 + </body>
30 +</html>

neovim/sample_files/test.json

Added
new file mode 100644
1 +{
2 + "$schema": "http://json-schema.org/draft-07/schema#",
3 + "title": "Test Config",
4 + "type": "object",
5 + "properties": {
6 + "name": {
7 + "type": "string",
8 + "description": "The name of the thing"
9 + },
10 + "version": {
11 + "type": "string",
12 + "pattern": "^\\d+\\.\\d+\\.\\d+$"
13 + },
14 + "enabled": {
15 + "type": "boolean"
16 + },
17 + "count": {
18 + "type": "integer",
19 + "minimum": 0
20 + },
21 + "tags": {
22 + "type": "array",
23 + "items": {
24 + "type": "string"
25 + }
26 + },
27 + "nested": {
28 + "type": "object",
29 + "properties": {
30 + "path": {
31 + "type": "string"
32 + },
33 + "depth": {
34 + "type": "number"
35 + }
36 + }
37 + }
38 + },
39 + "required": [
40 + "name",
41 + "version"
42 + ]

neovim/sample_files/test.jsonl

Added
new file mode 100644
1 +// TODO fill this

neovim/sample_files/test.kdl

Added
new file mode 100644
1 +// KDL sample file for kdl-ls
3 +package "test" version="1.0.0" {
4 + name "example"
5 + enabled true
6 + count 42
8 + server {
9 + host "localhost"
10 + port 8080
11 + timeout 30
12 + }
14 + tags ["alpha" "beta" "release"]
16 + nested {
17 + key "value"
18 + number 3.14
19 + }

neovim/sample_files/test.md

Added
new file mode 100644
1 +# Test Notes
3 +## Daily Notes
5 +This is a test file for markdown-oxide LSP.
7 +## Code Block
9 +```lua
10 +local greeting = "hello world"
11 +print(greeting)
12 +```
14 +## Task
16 +- [ ] Buy groceries
17 +- [ ] Write documentation
19 +## Links
21 +[[2026-04-01]] — daily note link
23 +[[test#Task]] -- popo

neovim/sample_files/test.sql

Added
new file mode 100644
1 +-- Test SQL file for sqls LSP
3 +CREATE TABLE IF NOT EXISTS users (
4 + id SERIAL PRIMARY KEY,
5 + username VARCHAR(255) NOT NULL UNIQUE,
6 + email VARCHAR(255) NOT NULL,
7 + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
8 +);
10 +CREATE TABLE IF NOT EXISTS posts (
11 + id SERIAL PRIMARY KEY,
12 + user_id INTEGER REFERENCES users(id),
13 + title VARCHAR(500) NOT NULL,
14 + body TEXT,
15 + published BOOLEAN DEFAULT FALSE
16 +);
18 +SELECT u.username, p.title, p.body
19 +FROM users u
20 +JOIN posts p ON u.id = p.user_id
21 +WHERE p.published = TRUE
22 +ORDER BY p.created_at DESC;
24 +INSERT INTO users (username, email)
25 +VALUES ('alice', 'alice@example.com');

neovim/sample_files/test.yaml

Added
new file mode 100644
1 +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2 +name: Test Workflow
4 +on:
5 + push:
6 + branches: [main]
7 + pull_request:
8 + branches: [main]
10 +jobs:
11 + build:
12 + runs-on: ubuntu-latest
13 + steps:
14 + - uses: actions/checkout@v4
15 + - name: Set up Node
16 + uses: actions/setup-node@v4
17 + with:
18 + node-version: "20"
19 + - run: npm ci
20 + - run: npm test

neovim/sample_files/test_contextive.md

Added
new file mode 100644
1 +# Sample Contextive Test
3 +This document demonstrates Contextive terminology linking.
5 +## Widgets
7 +The Widget system powers our component library. Every widget must implement the
8 +render method.
10 +## Features
12 +We shipped three features this sprint. Feature flags control rollout.
14 +## Bugs
16 +Bug reports go into the issue tracker. The bug was marked as critical.

neovim/test/A.prg

Deleted
deleted file mode 100644
1 -CLEAR
2 -? "Hello, you glorious bastard of a world!"
4 -QUIT

neovim/test/a.FXP

Deleted
deleted file mode 100644

Previous version contains binary or non-UTF-8 data.

neovim/test/a.d2

Deleted
deleted file mode 100644
1 -vars: {
2 - d2-config: {
3 - layout-engine: elk
4 - # Terminal theme code
5 - theme-id: 300
6 - }
7 -}
8 -network: {
9 - cell tower: {
10 - satellites: {
11 - shape: stored_data
12 - style.multiple: true
13 - }
15 - transmitter
17 - satellites -> transmitter: send
18 - satellites -> transmitter: send
19 - satellites -> transmitter: send
20 - }
22 - online portal: {
23 - ui: {shape: hexagon}
24 - }
26 - data processor: {
27 - storage: {
28 - shape: cylinder
29 - style.multiple: true
30 - }
31 - }
33 - cell tower.transmitter -> data processor.storage: phone logs
34 -}
36 -user: {
37 - shape: person
38 - width: 130
39 -}
41 -user -> network.cell tower: make call
42 -user -> network.online portal.ui: access {
43 - style.stroke-dash: 3
44 -}
46 -api server -> network.online portal.ui: display
47 -api server -> logs: persist
48 -logs: {shape: page; style.multiple: true}
50 -network.data processor -> api server

neovim/test/a.svg

Deleted
deleted file mode 100644
1 -<?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-d2-version="v0.7.0-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 911 1902"><svg class="d2-2969716219 d2-svg" width="911" height="1902" viewBox="-89 -89 911 1902"><rect x="-89.000000" y="-89.000000" width="911.000000" height="1902.000000" rx="0.000000" fill="#FFFFFF" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
2 -.d2-2969716219 .text-mono {
3 - font-family: "d2-2969716219-font-mono";
4 -}
5 -@font-face {
6 - font-family: d2-2969716219-font-mono;
7 - src: url("data:application/font-woff;base64,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");
8 -}
9 -.d2-2969716219 .text-mono-bold {
10 - font-family: "d2-2969716219-font-mono-bold";
12 -@font-face {
13 - font-family: d2-2969716219-font-mono-bold;
14 - src: url("data:application/font-woff;base64,d09GRgABAAAAAAzgAAwAAAAAFpgAAQScAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABHAAAAGAAAABgmKbWhWNtYXAAAAF8AAAAbAAAAIgBlgIwZ2FzcAAAAegAAAAIAAAACAAAABBnbHlmAAAB8AAABNgAAAYE50aU0mhlYWQAAAbIAAAANgAAADYbI9ohaGhlYQAABwAAAAAkAAAAJAYzAKpobXR4AAAHJAAAAFIAAABYM5AEUGxvY2EAAAd4AAAALgAAAC4Q4g+UbWF4cAAAB6gAAAAgAAAAIABKAmpuYW1lAAAHyAAABO8AAA2sAwZtKnBvc3QAAAy4AAAAIAAAACD/uAAzcHJlcAAADNgAAAAHAAAAB2gGjIUABAJYArwABQAAAooCWAAAAEsCigJYAAABXgAyAR4AAAILAwkDBAMCAgQgAAL3AgA4AwAAAAAAAAAAQURCTwCgACD//wPY/u8AAAQkAcZgAAGfAAAAAAHeApQAAAAgAAN4nFTMOQ5BURhA4e+6z/xwTb2tiIiIRjRiL5ZmXIqV/EI0TvkVB0mWUKucURQZC0trW3tHp4ifrGzsHD4Sr3jGI+5xi2tcvo//koas0tTS1tHV01cbGBopxiamZua8AQAA//8BAAD//3p4FboAAQAB//8AD3icdJRPbBNHFMbfvHXWEJzExtndJE7s2JvsJiHE9o53F+Imco0dAiYmgaAQksaAoBcSmmKXVqpRW/VSquVPGwIOJahSm0MvCKEKiaqXCnoJF4RQT/RCkXLoBaT0UuFNtWtzKBKX2ZH2zffeb943D2pABEAVrwADm8EFW4EDyHuCnk4qy6LTqcsC1XUxgB4Rt5orP3Z1ObqLudyKY1ugFPhoBq+UZ6dGjh+vu/fLfC4e/+keyQMgbAbA/WhAHXgA8l7qFRlJkkWWdTKyGuQ2P7z98Ma4q9XlcLXUHXKTHWiUC2Rv9DSlp6Pm3e/yeSCgbaxjP5bAD5AO9aEa0zSq8IJTksQQy3KNPE8VTRdYlpwYmBuPHLwwMXgiOCboHX3DPT2ZaEd/01jXrKvn0LkDs0tjtH2Kb6Yz7+7KKe0tk+EoIAwBYAwNqK0QU4XnuUaWFWWqaJoakyRRHPo5dyE78vWR7qbYvm3b9sWa0Ehdmp//dvfHXdPZ7GQnABCYBkAeDdhi3xsX5CgnckFumtw2n798SSQ0il9+erVox/ZurKOIJQhaTJL0FiZVVKmHZcnEwa9GR8+PJ2cCY5wi96Tk0BD1irW5v4Jzrszi6bmlUdo+xbVUsGpr5z8xnwQidp4EADa9rolyVKUe0SN6Egt3FhbuoPHqVblA3OYLO3YvANZXY604NciJHsrtLZXIg1KpSK4Ui+asVT4gpADwABqwCVy2sod6KeEoo3tTi8xvP5hLf5QmnqNh/kO2mNIdEs6bM3aOUwDYjgbUVE4FuVMLJIRG+YWtS6AfAP1oQJv9X7AsZ1USG0RddDpFWRb9DMf1X0/wDj5xvehgncgoyjANM+hkHWisHTmyVi6s+sYOj7bcWl6+1TJ6eMy3WtFOVvvjtbW9ApUk1eJkZJHnOS557fwOR437QuWDhvnr5djnO9fKBZK+qJ7rX7O5pY11VLAEDRD4X+dsx8iv/VJtIenNnk0mz2Yra0jx+ZSQvbqy1+bnFkdGFufmr2U/i+aGUtORyHRqKBe1cmQAMIoGuN7wo8h5qGIlEMXM2u58eqiQHs8MxAfiGTTk6f37jof/JAc0JdYNjO3p4apG89tUvLpXHFpLn0mnz6THh/sHBvqHd77/aAWNzsmRzMz2v8nRaCQimf/mzMvW/Skb6yhjCbbb5LJue9TileU3X6VFLwh+tDKSnuQX6qHOyXB4e1NfYLwjIQ+c2h0/05sJpSIdfa2RwP7ewVD8Q1ek76Rfam8WfFxdR304HdEm1N6e95p9/jZvS6Mr5A6n+rTpHUCsm8edaIDT4qq49Nl9bLmP7mKx/KLS68TGuu17oTozPNRTeVOava1H0vfOZNy/0NgVCHQ3XmyNH3aJu44lyDfmUVlrbdVk8r35QeLYLhEINADgHnuGQZ6hXp4XqKbpXso8+f1GtkGod7iF+pGrD9AwH2knNe2kRiLlAhBwAOA4GtBZOdfI8xwdRF2ngh8Fa+eljChXx6FzamKpEYnDscVV0zvTzda6HA5CCNl6afSmxNYiw2xiJTTMlVZV9ftVzXf3ri+m+/16zEemyoXVQKKtLRFYtdjd1d43WO+YoUK1YJ0y3LPHN5MNbQ0Od6A+ef3xU3J7uXOPLO/pXDZHnwL8BwAA//8BAAD//zfET6MAAQAAAAEEnCkLqShfDzz1AAMD6AAAAADcHHOkAAAAAN2XHqD/TP46AwwEJAABAAYAAgAAAAAAAAABAAAD2P7vAAACWP9M/0wDDAABAAAAAAAAAAAAAAAAAAAAFnicLMqhDcJQAADRywWDgg0QJCgUAoEiTVPRLnCiG3R/X/P9M54GxtX4GouxG2/jb6zGbBzGz5iMl7EN+zEew96Mi3E/AQAA//8BAAD//x2mDA0AAAAAACoAKgBMAHwAoAC2AOoBAAEWATIBQgFwAZIBxAHmAhACVAJmAowCqALkAwIAAAABAAAAFgH4ACoAbgAGAAEAAAAAAAAAAAAAAAAAAwADeJyclk1vG9UXxn9jp7bHTfvPP5TSFCiXEkoaJRM7SqMqRQK3aVVDSEqcUqFSCcd2nFH8JnvcNqxZsGTFZwDEqqsuEGKVBQuWiBUrxIoPgFggNGeOPWPXJG1VqXnu3PP6POfea+Cd2N/EscZs4AAUW5zjQHGMFL8rjrPCn4rHmLEuKD5G2VpXnGDaeqQ4yY/WL4pTLMW+UmyzFPtJ8XEWY/8oPhE38YzikywlbimeYjrxeYAtSCe+VmwxntBcVoyJxA+K40wkflY8xtnEb4qPMZ74S3GCyeSY4iSTydOKU0wmZxTbTCZXFKeZTq4pPo5JthSPM5f8UvEJMsnvFZ/ESSpX1v9YTJ1VPMHlVC/O/7mQ6vU1ydupbxW/EKn5FOdTfyh+MdL76UjvL0VynYnkmuKknVJ8lnG71+PLEd9XOGWfV/wqaXtZ8bmI72uM2+8qNkzYvfpfD2fDOs+k/YniN0jbDcXTkThvRmp4iyX7oeKLzNrfKZ7FsXVmrDnm0j2N5iN5HTJpnRNrIVJDhpn0p4oXmU1/ofhapN9V4fAbDItkyJLBMK+rRVnlKNNkmwqGAvt08KhQp4MhT4MSTdq05P+i7JUxzLCLh0eLFRZY4IH8cyj2ozniWWeBi8xheICLxy6GTSp0qNDmvka7QZMGHoZ1itT9WswZCjTp0qZExUzhRNcYrtGkLOgWbZpcpUmNMlkc6fQyV8ixylU2uDLg2/MM/Ob7nofHN327j6T2Dq5UbQYy7tLEk84b3O/vOWTJsswV6hTZoyJWO1R4KBkWcbiEwzKXWJZYz16vK4oVMXiiVFlULNJmD0OTnefW2pUufe18v9s0RMlgr4CnlkH2BmUWxN9Ij7vClZHIXdG4jSvWznNVc4siXWoYVnEw3NSo/oRtCa/+365Mnl93hcYzTKrHPi0qbLGrfIaTWRAOPR4IpyHjNVxRoCEz7XPSFRaCvnusFcizhmFD4jcGIq8NRPA7GTVhWek3rGwwb6j/fYq41CiyTU12wpNXlLw5PhTssYIZYqdDSRRq4YlGHYnliAZVFtjgBmtDlRzNUVn+Btpv0+1PT9CdPzX+ec9REOULZkpOW05YKwgjd8izxU02uM2WrHNsskmOdbbIc118N9iUk7vBOqvikRcc7N2QE7DOxxjeJy82fuyK8hMo5p/JllTfkdqDWXap0xLO/cod6bUiHT67woYdjdrz7YhPCZcdsTSiX4MqXYpUdSpaUmFduOzNRnjqgomoSy++tuF+labctG05uX5Uw77eHf60BjUFN4T3FKo6zzUz/32jbcrp87sIUV66CGa802e/It0Orqv6lrhynwb3leGC8FGQ18TFWO9Rkuy+r8+FiT964svjJ74ciMpttnGDKY0fcI19yVbT6gzbwop4cDf2K/foiH4dUdev6DOJ4t9Nd8lwT++ZJlW52VrCeUnO4r6sgvm5y/whtkW9L9ui157Yz47IXZbXoibaGemtqtGnuSccezobwR1raNCVN7gtu8Epld7IHlrPcKSO9jCndQ2qOCevwrAmw9qOsnosX4eUGcsOqD3K70B+eVTl/fDZuCMnvyrTfJ2H+m6u9b+F6APh0hVeCvJG+fdY8AqHnr13+arEL7E3cubDGZ8fmfUon6e3HOz2KOvBHg+3HebgKPtRv1hG2ylz/wIAAP//AQAA///7vB6iAAADAAAAAAAA/7UAMgAAAAEAAAAAAAAAAAAAAAAAAAAAuAH/hbAEjQA=");
16 -.d2-2969716219 .text-mono-italic {
17 - font-family: "d2-2969716219-font-mono-italic";
19 -@font-face {
20 - font-family: d2-2969716219-font-mono-italic;
21 - src: url("data:application/font-woff;base64,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");
22 -}]]></style><style type="text/css"><![CDATA[.shape {
23 - shape-rendering: geometricPrecision;
24 - stroke-linejoin: round;
26 -.connection {
27 - stroke-linecap: round;
28 - stroke-linejoin: round;
30 -.blend {
31 - mix-blend-mode: multiply;
32 - opacity: 0.5;
35 - .d2-2969716219 .fill-N1{fill:#000410;}
36 - .d2-2969716219 .fill-N2{fill:#0000B8;}
37 - .d2-2969716219 .fill-N3{fill:#9499AB;}
38 - .d2-2969716219 .fill-N4{fill:#CFD2DD;}
39 - .d2-2969716219 .fill-N5{fill:#C3DEF3;}
40 - .d2-2969716219 .fill-N6{fill:#EEF1F8;}
41 - .d2-2969716219 .fill-N7{fill:#FFFFFF;}
42 - .d2-2969716219 .fill-B1{fill:#000410;}
43 - .d2-2969716219 .fill-B2{fill:#0000E4;}
44 - .d2-2969716219 .fill-B3{fill:#5AA4DC;}
45 - .d2-2969716219 .fill-B4{fill:#E7E9EE;}
46 - .d2-2969716219 .fill-B5{fill:#F5F6F9;}
47 - .d2-2969716219 .fill-B6{fill:#FFFFFF;}
48 - .d2-2969716219 .fill-AA2{fill:#008566;}
49 - .d2-2969716219 .fill-AA4{fill:#45BBA5;}
50 - .d2-2969716219 .fill-AA5{fill:#7ACCBD;}
51 - .d2-2969716219 .fill-AB4{fill:#F1C759;}
52 - .d2-2969716219 .fill-AB5{fill:#F9E088;}
53 - .d2-2969716219 .stroke-N1{stroke:#000410;}
54 - .d2-2969716219 .stroke-N2{stroke:#0000B8;}
55 - .d2-2969716219 .stroke-N3{stroke:#9499AB;}
56 - .d2-2969716219 .stroke-N4{stroke:#CFD2DD;}
57 - .d2-2969716219 .stroke-N5{stroke:#C3DEF3;}
58 - .d2-2969716219 .stroke-N6{stroke:#EEF1F8;}
59 - .d2-2969716219 .stroke-N7{stroke:#FFFFFF;}
60 - .d2-2969716219 .stroke-B1{stroke:#000410;}
61 - .d2-2969716219 .stroke-B2{stroke:#0000E4;}
62 - .d2-2969716219 .stroke-B3{stroke:#5AA4DC;}
63 - .d2-2969716219 .stroke-B4{stroke:#E7E9EE;}
64 - .d2-2969716219 .stroke-B5{stroke:#F5F6F9;}
65 - .d2-2969716219 .stroke-B6{stroke:#FFFFFF;}
66 - .d2-2969716219 .stroke-AA2{stroke:#008566;}
67 - .d2-2969716219 .stroke-AA4{stroke:#45BBA5;}
68 - .d2-2969716219 .stroke-AA5{stroke:#7ACCBD;}
69 - .d2-2969716219 .stroke-AB4{stroke:#F1C759;}
70 - .d2-2969716219 .stroke-AB5{stroke:#F9E088;}
71 - .d2-2969716219 .background-color-N1{background-color:#000410;}
72 - .d2-2969716219 .background-color-N2{background-color:#0000B8;}
73 - .d2-2969716219 .background-color-N3{background-color:#9499AB;}
74 - .d2-2969716219 .background-color-N4{background-color:#CFD2DD;}
75 - .d2-2969716219 .background-color-N5{background-color:#C3DEF3;}
76 - .d2-2969716219 .background-color-N6{background-color:#EEF1F8;}
77 - .d2-2969716219 .background-color-N7{background-color:#FFFFFF;}
78 - .d2-2969716219 .background-color-B1{background-color:#000410;}
79 - .d2-2969716219 .background-color-B2{background-color:#0000E4;}
80 - .d2-2969716219 .background-color-B3{background-color:#5AA4DC;}
81 - .d2-2969716219 .background-color-B4{background-color:#E7E9EE;}
82 - .d2-2969716219 .background-color-B5{background-color:#F5F6F9;}
83 - .d2-2969716219 .background-color-B6{background-color:#FFFFFF;}
84 - .d2-2969716219 .background-color-AA2{background-color:#008566;}
85 - .d2-2969716219 .background-color-AA4{background-color:#45BBA5;}
86 - .d2-2969716219 .background-color-AA5{background-color:#7ACCBD;}
87 - .d2-2969716219 .background-color-AB4{background-color:#F1C759;}
88 - .d2-2969716219 .background-color-AB5{background-color:#F9E088;}
89 - .d2-2969716219 .color-N1{color:#000410;}
90 - .d2-2969716219 .color-N2{color:#0000B8;}
91 - .d2-2969716219 .color-N3{color:#9499AB;}
92 - .d2-2969716219 .color-N4{color:#CFD2DD;}
93 - .d2-2969716219 .color-N5{color:#C3DEF3;}
94 - .d2-2969716219 .color-N6{color:#EEF1F8;}
95 - .d2-2969716219 .color-N7{color:#FFFFFF;}
96 - .d2-2969716219 .color-B1{color:#000410;}
97 - .d2-2969716219 .color-B2{color:#0000E4;}
98 - .d2-2969716219 .color-B3{color:#5AA4DC;}
99 - .d2-2969716219 .color-B4{color:#E7E9EE;}
100 - .d2-2969716219 .color-B5{color:#F5F6F9;}
101 - .d2-2969716219 .color-B6{color:#FFFFFF;}
102 - .d2-2969716219 .color-AA2{color:#008566;}
103 - .d2-2969716219 .color-AA4{color:#45BBA5;}
104 - .d2-2969716219 .color-AA5{color:#7ACCBD;}
105 - .d2-2969716219 .color-AB4{color:#F1C759;}
106 - .d2-2969716219 .color-AB5{color:#F9E088;}.appendix text.text{fill:#000410}.md{--color-fg-default:#000410;--color-fg-muted:#0000B8;--color-fg-subtle:#9499AB;--color-canvas-default:#FFFFFF;--color-canvas-subtle:#EEF1F8;--color-border-default:#000410;--color-border-muted:#0000E4;--color-neutral-muted:#EEF1F8;--color-accent-fg:#0000E4;--color-accent-emphasis:#0000E4;--color-attention-subtle:#0000B8;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-B2{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-B3{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-B4{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-B5{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-dark-d2-2969716219);mix-blend-mode:overlay}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N1{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-darker-d2-2969716219);mix-blend-mode:lighten}.sketch-overlay-N3{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-normal-d2-2969716219);mix-blend-mode:color-burn}.sketch-overlay-N6{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-2969716219);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><style type="text/css"><![CDATA[
107 -.dots-overlay {
108 - fill: url(#dots-d2-2969716219);
109 - mix-blend-mode: multiply;
110 -}]]></style><defs><pattern id="dots-d2-2969716219" x="0" y="0" width="15" height="15" patternUnits="userSpaceOnUse">
111 -<g style="mix-blend-mode:multiply" opacity="0.1">
112 -<rect x="2" y="2" width="1" height="1" fill="#0A0F25"/>
113 -</g>
114 -<g style="mix-blend-mode:multiply" opacity="0.1">
115 -<rect x="12" y="2" width="1" height="1" fill="#0A0F25"/>
116 -</g>
117 -<g style="mix-blend-mode:multiply" opacity="0.1">
118 -<rect x="12" y="12" width="1" height="1" fill="#0A0F25"/>
119 -</g>
120 -<g style="mix-blend-mode:multiply" opacity="0.1">
121 -<rect x="2" y="12" width="1" height="1" fill="#0A0F25"/>
122 -</g>
123 -<g style="mix-blend-mode:multiply" opacity="0.1">
124 -<rect x="2" y="7" width="1" height="1" fill="#0A0F25"/>
125 -</g>
126 -<g style="mix-blend-mode:multiply" opacity="0.1">
127 -<rect x="12" y="7" width="1" height="1" fill="#0A0F25"/>
128 -</g>
129 -<g style="mix-blend-mode:multiply" opacity="0.1">
130 -<rect x="7" y="2" width="1" height="1" fill="#0A0F25"/>
131 -</g>
132 -<g style="mix-blend-mode:multiply" opacity="0.1">
133 -<rect x="7" y="12" width="1" height="1" fill="#0A0F25"/>
134 -</g>
135 -<g style="mix-blend-mode:multiply" opacity="0.1">
136 -<rect x="7" y="7" width="1" height="1" fill="#0A0F25"/>
137 -</g>
138 -</pattern>
139 -</defs><g class="bmV0d29yaw=="><g class="shape" ><rect x="12.000000" y="311.000000" width="621.000000" height="922.000000" stroke="#000410" fill="#E7E9EE" class=" stroke-B1 fill-B4" style="stroke-width:2;" /><rect x="12.000000" y="311.000000" width="621.000000" height="922.000000" class="dots-overlay" style="stroke-width:2;" /><rect x="17.000000" y="316.000000" width="611.000000" height="912.000000" stroke="#000410" fill="transparent" class=" stroke-B1" style="stroke-width:2;" /></g><text x="322.500000" y="344.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:28px">NETWORK</text></g><g class="dXNlcg=="><g class="shape" ><path d="M 348 99 H 218 V 98 C 218 83 232 70 255 63 C 242 58 235 50 235 40 C 235 25 256 12 283 12 C 309 12 331 25 331 40 C 331 49 324 58 311 63 C 333 69 348 83 348 98 V 99 H 348 Z" stroke="#000410" fill="#5AA4DC" class=" stroke-B1 fill-B3" style="stroke-width:2;" /></g><text x="283.000000" y="120.000000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">USER</text></g><g class="YXBpIHNlcnZlcg=="><g class="shape" ><rect x="341.000000" y="1388.000000" width="142.000000" height="66.000000" stroke="#000410" fill="#FFFFFF" class=" stroke-B1 fill-B6" style="stroke-width:2;" /></g><text x="412.000000" y="1426.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">API SERVER</text></g><g class="bG9ncw=="><g class="shape" ><path d="M 377 1615 H 437 C 438 1615 439 1615 440 1616 L 457 1632 C 458 1633 458 1634 458 1635 V 1702 C 458 1702 458 1702 458 1702 H 377 C 376 1702 376 1702 376 1702 V 1616 C 376 1615 376 1615 377 1615 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /><path d="M 457 1702 H 377 C 376 1702 376 1702 376 1701 V 1616 C 376 1615 376 1615 377 1615 H 436 C 437 1615 437 1615 437 1616 V 1633 C 437 1634 438 1635 439 1635 H 457 C 458 1635 458 1635 458 1636 V 1701 C 457 1702 458 1702 457 1702 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /><path d="M 367 1625 H 427 C 428 1625 429 1625 430 1626 L 447 1642 C 448 1643 448 1644 448 1645 V 1712 C 448 1712 448 1712 448 1712 H 367 C 366 1712 366 1712 366 1712 V 1626 C 366 1625 366 1625 367 1625 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /><path d="M 447 1712 H 367 C 366 1712 366 1712 366 1711 V 1626 C 366 1625 366 1625 367 1625 H 426 C 427 1625 427 1625 427 1626 V 1643 C 427 1644 428 1645 429 1645 H 447 C 448 1645 448 1645 448 1646 V 1711 C 447 1712 448 1712 447 1712 Z" stroke="#000410" fill="#F1C759" class=" stroke-B1 fill-AB4" style="stroke-width:2;" /></g><text x="407.000000" y="1674.000000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">LOGS</text></g><g class="bmV0d29yay5jZWxsIHRvd2Vy"><g class="shape" ><rect x="62.000000" y="361.000000" width="271.000000" height="423.000000" stroke="#000410" fill="#F5F6F9" class=" stroke-B1 fill-B5" style="stroke-width:2;" /><rect x="62.000000" y="361.000000" width="271.000000" height="423.000000" class="dots-overlay" style="stroke-width:2;" /></g><text x="197.500000" y="390.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:24px">CELL TOWER</text></g><g class="bmV0d29yay5vbmxpbmUgcG9ydGFs"><g class="shape" ><rect x="353.000000" y="366.000000" width="230.000000" height="169.000000" stroke="#000410" fill="#F5F6F9" class=" stroke-B1 fill-B5" style="stroke-width:2;" /><rect x="353.000000" y="366.000000" width="230.000000" height="169.000000" class="dots-overlay" style="stroke-width:2;" /></g><text x="468.000000" y="395.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:24px">ONLINE PORTAL</text></g><g class="bmV0d29yay5kYXRhIHByb2Nlc3Nvcg=="><g class="shape" ><rect x="75.000000" y="955.000000" width="245.000000" height="228.000000" stroke="#000410" fill="#F5F6F9" class=" stroke-B1 fill-B5" style="stroke-width:2;" /><rect x="75.000000" y="955.000000" width="245.000000" height="228.000000" class="dots-overlay" style="stroke-width:2;" /></g><text x="197.500000" y="984.000000" fill="#000410" class="text-mono fill-N1" style="text-anchor:middle;font-size:24px">DATA PROCESSOR</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLnNhdGVsbGl0ZXM="><g class="shape" ><path d="M 137 411 H 283 C 279 411 268 429 268 444 C 268 459 279 477 283 477 H 137 C 133 477 122 459 122 444 C 122 429 133 411 137 411 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 127 421 H 273 C 269 421 258 439 258 454 C 258 469 269 487 273 487 H 127 C 123 487 112 469 112 454 C 112 439 123 421 127 421 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /></g><text x="192.500000" y="459.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">SATELLITES</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLnRyYW5zbWl0dGVy"><g class="shape" ><rect x="122.000000" y="668.000000" width="151.000000" height="66.000000" stroke="#000410" fill="#FFFFFF" class=" stroke-B1 fill-B6" style="stroke-width:2;" /></g><text x="197.500000" y="706.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">TRANSMITTER</text></g><g class="bmV0d29yay5vbmxpbmUgcG9ydGFsLnVp"><g class="shape" ><path d="M 448 416 L 428 450 L 448 485 L 488 485 L 508 450 L 488 416 Z" stroke="#000410" fill="#C3DEF3" class=" stroke-B1 fill-N5" style="stroke-width:2;" /></g><text x="468.000000" y="456.000000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">UI</text></g><g class="bmV0d29yay5kYXRhIHByb2Nlc3Nvci5zdG9yYWdl"><g class="shape" ><path d="M 146 1029 C 146 1005 196 1005 202 1005 C 208 1005 258 1005 258 1029 V 1099 C 258 1123 208 1123 202 1123 C 196 1123 146 1123 146 1099 V 1029 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 146 1029 C 146 1053 196 1053 202 1053 C 208 1053 258 1053 258 1029" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 136 1039 C 136 1015 186 1015 192 1015 C 198 1015 248 1015 248 1039 V 1109 C 248 1133 198 1133 192 1133 C 186 1133 136 1133 136 1109 V 1039 Z" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /><path d="M 136 1039 C 136 1063 186 1063 192 1063 C 198 1063 248 1063 248 1039" stroke="#000410" fill="#7ACCBD" class=" stroke-B1 fill-AA5" style="stroke-width:2;" /></g><text x="192.000000" y="1091.500000" fill="#000410" class="text-mono-bold fill-N1" style="text-anchor:middle;font-size:16px">STORAGE</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLihzYXRlbGxpdGVzIC0mZ3Q7IHRyYW5zbWl0dGVyKVswXQ=="><marker id="mk-d2-2969716219-3488378134" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#000410" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 148.005525 488.999992 L 148.488950 664.000015" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="148.000000" y="583.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">SEND</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLihzYXRlbGxpdGVzIC0mZ3Q7IHRyYW5zbWl0dGVyKVsxXQ=="><path d="M 197.011050 488.999969 L 197.977901 664.000061" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="198.000000" y="583.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">SEND</text></g><g class="bmV0d29yay5jZWxsIHRvd2VyLihzYXRlbGxpdGVzIC0mZ3Q7IHRyYW5zbWl0dGVyKVsyXQ=="><path d="M 246.005525 488.999992 L 246.488950 664.000015" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="246.000000" y="583.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">SEND</text></g><g class="bmV0d29yay4oY2VsbCB0b3dlci50cmFuc21pdHRlciAtJmd0OyBkYXRhIHByb2Nlc3Nvci5zdG9yYWdlKVswXQ=="><path d="M 197.503690 735.999997 L 197.992620 1001.000007" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="198.000000" y="875.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">PHONE LOGS</text></g><g class="KHVzZXIgLSZndDsgbmV0d29yay5jZWxsIHRvd2VyKVswXQ=="><path d="M 261.665985 127.000000 L 261.665985 165.000000 S 261.665985 165.000000 261.665985 165.000000 L 117.916000 165.000000 S 117.916000 165.000000 117.916000 165.000000 L 117.916000 357.000000" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="118.000000" y="177.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">MAKE CALL</text></g><g class="KHVzZXIgLSZndDsgbmV0d29yay5vbmxpbmUgcG9ydGFsLnVpKVswXQ=="><marker id="mk-d2-2969716219-2177206569" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#0000E4" class="connection fill-B2" stroke-width="2" /> </marker><path d="M 305.000000 127.000000 L 305.000000 165.000000 S 305.000000 165.000000 305.000000 165.000000 L 448.750000 165.000000 S 448.750000 165.000000 448.750000 165.000000 L 448.996016 412.000002" stroke="#0000E4" fill="none" class="connection stroke-B2" style="stroke-width:2;stroke-dasharray:6.000000,5.919384;" marker-end="url(#mk-d2-2969716219-2177206569)" mask="url(#d2-2969716219)" /><text x="449.000000" y="204.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">ACCESS</text></g><g class="KGFwaSBzZXJ2ZXIgLSZndDsgbmV0d29yay5vbmxpbmUgcG9ydGFsLnVpKVswXQ=="><path d="M 435.665985 1386.000000 L 435.665985 1348.000000 S 435.665985 1348.000000 435.665985 1348.000000 L 687.500000 1348.000000 S 687.500000 1348.000000 687.500000 1348.000000 L 687.500000 266.000000 S 687.500000 266.000000 687.500000 266.000000 L 481.333008 266.000000 S 481.333008 266.000000 481.333008 266.000000 L 481.008880 412.000010" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="687.500000" y="780.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">DISPLAY</text></g><g class="KGFwaSBzZXJ2ZXIgLSZndDsgbG9ncylbMF0="><path d="M 412.000000 1456.000000 L 412.000000 1611.000000" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /><text x="412.000000" y="1540.000000" fill="#0000B8" class="text-mono-italic fill-N2" style="text-anchor:middle;font-size:16px">PERSIST</text></g><g class="KG5ldHdvcmsuZGF0YSBwcm9jZXNzb3IgLSZndDsgYXBpIHNlcnZlcilbMF0="><path d="M 136.500000 1185.000000 L 136.500000 1348.000000 S 136.500000 1348.000000 136.500000 1348.000000 L 388.333008 1348.000000 S 388.333008 1348.000000 388.333008 1348.000000 L 388.333008 1384.000000" stroke="#000410" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-2969716219-3488378134)" mask="url(#d2-2969716219)" /></g><mask id="d2-2969716219" maskUnits="userSpaceOnUse" x="-89" y="-89" width="911" height="1902">
140 -<rect x="-89" y="-89" width="911" height="1902" fill="white"></rect>
141 -<rect x="262.500000" y="316.000000" width="120" height="36" fill="rgba(0,0,0,0.75)"></rect>
142 -<rect x="262.000000" y="104.000000" width="42" height="21" fill="rgba(0,0,0,0.75)"></rect>
143 -<rect x="361.500000" y="1410.500000" width="101" height="21" fill="rgba(0,0,0,0.75)"></rect>
144 -<rect x="386.500000" y="1658.000000" width="41" height="21" fill="rgba(0,0,0,0.75)"></rect>
145 -<rect x="124.000000" y="366.000000" width="147" height="31" fill="rgba(0,0,0,0.75)"></rect>
146 -<rect x="373.500000" y="371.000000" width="189" height="31" fill="rgba(0,0,0,0.75)"></rect>
147 -<rect x="95.500000" y="960.000000" width="204" height="31" fill="rgba(0,0,0,0.75)"></rect>
148 -<rect x="142.500000" y="443.500000" width="100" height="21" fill="rgba(0,0,0,0.75)"></rect>
149 -<rect x="142.500000" y="690.500000" width="110" height="21" fill="rgba(0,0,0,0.75)"></rect>
150 -<rect x="457.000000" y="440.000000" width="22" height="21" fill="rgba(0,0,0,0.75)"></rect>
151 -<rect x="156.500000" y="1075.500000" width="71" height="21" fill="rgba(0,0,0,0.75)"></rect>
152 -<rect x="127.000000" y="567.000000" width="42" height="21" fill="black"></rect>
153 -<rect x="177.000000" y="567.000000" width="42" height="21" fill="black"></rect>
154 -<rect x="225.000000" y="567.000000" width="42" height="21" fill="black"></rect>
155 -<rect x="148.000000" y="859.000000" width="100" height="21" fill="black"></rect>
156 -<rect x="73.000000" y="161.000000" width="90" height="21" fill="black"></rect>
157 -<rect x="418.000000" y="188.000000" width="62" height="21" fill="black"></rect>
158 -<rect x="651.000000" y="764.000000" width="73" height="21" fill="black"></rect>
159 -<rect x="376.000000" y="1524.000000" width="72" height="21" fill="black"></rect>
160 -</mask></svg></svg>

neovim/tests/bugabinga/cmdline/init_spec.lua

Modified
10 10 end)
12 12 after_each(function()
13 - local ok, mod = pcall(require, 'bugabinga.cmdline')
14 - if ok and mod and mod.disable then
15 - mod.disable()
13 + if BugabingaCmdline then
14 + BugabingaCmdline.disable()
17 16 end)
36 35 end)
38 37 after_each(function()
39 - local ok, mod = pcall(require, 'bugabinga.cmdline')
40 - if ok and mod and mod.disable then
41 - mod.disable()
38 + if BugabingaCmdline then
39 + BugabingaCmdline.disable()
43 41 end)
45 43 it('disable is callable', function()
46 44 require 'bugabinga.cmdline'
47 - local ok, mod = pcall(require, 'bugabinga.cmdline')
48 - if ok and mod.disable then
49 - local disable_ok = pcall(function()
50 - mod.disable()
51 - end)
52 - assert.is_true(disable_ok)
53 - end
45 + assert.is_true(pcall(BugabingaCmdline.disable))
54 46 end)
55 -end)
47 +end)

neovim/tests/bugabinga/cursor_restore_spec.lua

Modified
1 1 local auto = require('std.auto')
2 2 local ignored = require('std.ignored')
3 +local behaviour = require('bugabinga.options.behaviour')
5 +local restore_cursor_handler = behaviour.restore_cursor_handler
4 7 describe('cursor restore behaviour', function()
5 - after_each(function()
6 - pcall(vim.api.nvim_del_augroup_by_name, 'restore_cursor_position')
7 - pcall(vim.api.nvim_del_augroup_by_name, 'restore_cursor_stage2')
8 - for _, buf in ipairs(vim.api.nvim_list_bufs()) do
9 - pcall(vim.api.nvim_buf_delete, buf, { force = true })
10 - end
11 - end)
8 + after_each(function()
9 + pcall(vim.api.nvim_del_augroup_by_name, 'restore_cursor_position')
10 + pcall(vim.api.nvim_del_augroup_by_name, 'restore_cursor_stage2')
11 + for _, buf in ipairs(vim.api.nvim_list_bufs()) do
12 + pcall(vim.api.nvim_buf_delete, buf, { force = true })
13 + end
14 + end)
13 - local function make_buffer_with_lines(buf, lines)
14 - vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
15 - end
16 + local function make_buffer_with_lines(buf, lines)
17 + vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
18 + end
17 - local function set_shada_mark(buf, line, col)
18 - vim.api.nvim_set_current_buf(buf)
19 - vim.cmd.normal { string.format('%dG', line), bang = true }
20 - vim.cmd.normal { string.format('%dl', col - 1), bang = true }
21 - vim.cmd([[normal! m"]])
22 - end
20 + local function set_shada_mark(buf, line, col)
21 + vim.api.nvim_set_current_buf(buf)
22 + vim.cmd.normal { string.format('%dG', line), bang = true }
23 + vim.cmd.normal { string.format('%dl', col - 1), bang = true }
24 + vim.cmd([[normal! m"]])
25 + end
24 - local function restore_cursor_logic(ev)
25 - local ft = vim.bo[ev.buf].filetype
26 - local bt = vim.bo[ev.buf].buftype
27 - if ignored.buftypes_kv[bt] then return end
28 - if ignored.filetypes_kv[ft] then return end
29 - for _, pattern in ipairs(ignored.filetypes_patterns) do
30 - if ft:find(pattern) then return end
31 - end
32 - if vim.fn.line('.') > 1 then return end
33 - local line = vim.fn.line([['"]])
34 - local col = vim.fn.col([['"]]) - 1
35 - if line > 0 and line <= vim.fn.line('$') then
36 - auto 'restore_cursor_stage2' {
37 - events = 'BufWinEnter',
38 - buffer = ev.buf,
39 - once = true,
40 - command = function()
41 - vim.api.nvim_win_set_cursor(0, { line, col })
42 - vim.cmd.normal { 'zvzz', bang = true }
43 - end,
44 - }
45 - end
46 - end
27 + describe('BufReadPost stage', function()
28 + it('should NOT create stage2 when buftype is nofile', function()
29 + local buf = vim.api.nvim_create_buf(false, false)
30 + vim.bo[buf].buftype = 'nofile'
31 + make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3' })
32 + set_shada_mark(buf, 3, 5)
48 - describe('BufReadPost stage', function()
49 - it('should NOT create stage2 when buftype is nofile', function()
50 - local buf = vim.api.nvim_create_buf(false, false)
51 - vim.bo[buf].buftype = 'nofile'
52 - make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3' })
53 - set_shada_mark(buf, 3, 5)
34 + auto 'restore_cursor_position' {
35 + events = 'BufReadPost',
36 + command = restore_cursor_handler,
37 + }
55 - auto 'restore_cursor_position' {
56 - events = 'BufReadPost',
57 - command = restore_cursor_logic,
58 - }
39 + vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
40 + local ok, stage2 = pcall(vim.api.nvim_get_autocmds, { group = 'restore_cursor_stage2' })
41 + if ok then
42 + assert.equals(0, #stage2)
43 + end
44 + end)
60 - vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
61 - local ok, stage2 = pcall(vim.api.nvim_get_autocmds, { group = 'restore_cursor_stage2' })
62 - if ok then
63 - assert.equals(0, #stage2)
64 - end
65 - end)
46 + it('should NOT create stage2 when filetype is help', function()
47 + local buf = vim.api.nvim_create_buf(false, false)
48 + vim.bo[buf].filetype = 'help'
49 + make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3' })
50 + set_shada_mark(buf, 3, 5)
67 - it('should NOT create stage2 when filetype is help', function()
68 - local buf = vim.api.nvim_create_buf(false, false)
69 - vim.bo[buf].filetype = 'help'
70 - make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3' })
71 - set_shada_mark(buf, 3, 5)
52 + auto 'restore_cursor_position' {
53 + events = 'BufReadPost',
54 + command = restore_cursor_handler,
55 + }
73 - auto 'restore_cursor_position' {
74 - events = 'BufReadPost',
75 - command = restore_cursor_logic,
76 - }
57 + vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
58 + local ok, stage2 = pcall(vim.api.nvim_get_autocmds, { group = 'restore_cursor_stage2' })
59 + if ok then
60 + assert.equals(0, #stage2)
61 + end
62 + end)
78 - vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
79 - local ok, stage2 = pcall(vim.api.nvim_get_autocmds, { group = 'restore_cursor_stage2' })
80 - if ok then
81 - assert.equals(0, #stage2)
82 - end
83 - end)
64 + it('should NOT create stage2 when cursor already at mark position', function()
65 + local buf = vim.api.nvim_create_buf(false, false)
66 + make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3', 'line 4', 'line 5' })
67 + set_shada_mark(buf, 3, 5)
68 + -- simulate nvim +3 file.lua - cursor already at line 3 (same as mark)
69 + vim.api.nvim_set_current_buf(buf)
70 + vim.cmd.normal { '3G' }
85 - it('should NOT create stage2 when cursor already at line > 1', function()
86 - local buf = vim.api.nvim_create_buf(false, false)
87 - make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3', 'line 4', 'line 5' })
88 - set_shada_mark(buf, 3, 5)
89 - -- simulate nvim +3 file.lua - cursor already at line 3
90 - vim.api.nvim_set_current_buf(buf)
91 - vim.cmd.normal { '3G' }
72 + auto 'restore_cursor_position' {
73 + events = 'BufReadPost',
74 + command = restore_cursor_handler,
75 + }
93 - auto 'restore_cursor_position' {
94 - events = 'BufReadPost',
95 - command = restore_cursor_logic,
96 - }
77 + vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
78 + local ok, stage2 = pcall(vim.api.nvim_get_autocmds, { group = 'restore_cursor_stage2' })
79 + if ok then
80 + assert.equals(0, #stage2)
81 + end
82 + end)
98 - vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
99 - local ok, stage2 = pcall(vim.api.nvim_get_autocmds, { group = 'restore_cursor_stage2' })
100 - if ok then
101 - assert.equals(0, #stage2)
102 - end
103 - end)
84 + it('should create stage2 autocmd when conditions are met', function()
85 + local buf = vim.api.nvim_create_buf(false, false)
86 + make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3', 'line 4', 'line 5' })
87 + set_shada_mark(buf, 3, 5)
88 + -- cursor at line 1, mark at line 3
89 + vim.api.nvim_set_current_buf(buf)
90 + vim.cmd.normal { 'gg' }
105 - it('should create stage2 autocmd when conditions are met', function()
106 - local buf = vim.api.nvim_create_buf(false, false)
107 - make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3', 'line 4', 'line 5' })
108 - set_shada_mark(buf, 3, 5)
109 - -- cursor at line 1
110 - vim.api.nvim_set_current_buf(buf)
111 - vim.cmd.normal { 'gg' }
92 + auto 'restore_cursor_position' {
93 + events = 'BufReadPost',
94 + command = restore_cursor_handler,
95 + }
113 - auto 'restore_cursor_position' {
114 - events = 'BufReadPost',
115 - command = restore_cursor_logic,
116 - }
97 + vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
98 + local stage2 = vim.api.nvim_get_autocmds({ group = 'restore_cursor_stage2' })
99 + assert.equals(1, #stage2)
100 + assert.equals(buf, stage2[1].buffer)
101 + end)
102 + end)
118 - vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
119 - local stage2 = vim.api.nvim_get_autocmds({ group = 'restore_cursor_stage2' })
120 - assert.equals(1, #stage2)
121 - assert.equals(buf, stage2[1].buffer)
122 - end)
123 - end)
104 + describe('BufWinEnter stage', function()
105 + it('should restore cursor to shada position', function()
106 + local buf = vim.api.nvim_create_buf(false, false)
107 + make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3', 'line 4', 'line 5' })
108 + set_shada_mark(buf, 3, 5)
125 - describe('BufWinEnter stage', function()
126 - it('should restore cursor to shada position', function()
127 - local buf = vim.api.nvim_create_buf(false, false)
128 - make_buffer_with_lines(buf, { 'line 1', 'line 2', 'line 3', 'line 4', 'line 5' })
129 - set_shada_mark(buf, 3, 5)
110 + -- create a window with this buffer
111 + vim.cmd.split()
112 + local win = vim.api.nvim_get_current_win()
113 + vim.api.nvim_win_set_buf(win, buf)
114 + vim.api.nvim_set_current_win(win)
115 + vim.cmd.normal { 'gg' } -- cursor at line 1
131 - -- create a window with this buffer
132 - vim.cmd.split()
133 - local win = vim.api.nvim_get_current_win()
134 - vim.api.nvim_win_set_buf(win, buf)
135 - vim.api.nvim_set_current_win(win)
136 - vim.cmd.normal { 'gg' } -- cursor at line 1
117 + auto 'restore_cursor_position' {
118 + events = 'BufReadPost',
119 + command = restore_cursor_handler,
138 - auto 'restore_cursor_position' {
139 - events = 'BufReadPost',
140 - command = restore_cursor_logic,
141 - }
122 + vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
123 + vim.api.nvim_exec_autocmds('BufWinEnter', { buffer = buf })
143 - vim.api.nvim_exec_autocmds('BufReadPost', { buffer = buf })
144 - vim.api.nvim_exec_autocmds('BufWinEnter', { buffer = buf })
146 - local cursor = vim.api.nvim_win_get_cursor(win)
147 - assert.equals(3, cursor[1])
148 - assert.equals(4, cursor[2])
149 - end)
150 - end)
151 -end)
125 + local cursor = vim.api.nvim_win_get_cursor(win)
126 + assert.equals(3, cursor[1])
127 + assert.equals(4, cursor[2])
128 + end)
129 + end)
130 +end)

neovim/tests/bugabinga/cycle_spec.lua

Modified
1 -local cycle = require 'bugabinga.cycle'
1 +require 'bugabinga.cycle'
3 3 describe('bugabinga.cycle', function()
4 4 local function create_buffer(name)
14 14 after_each(function()
15 - cycle.cancel()
15 + BugabingaCycle.cancel()
16 16 for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
17 17 if vim.api.nvim_buf_is_valid(bufnr) then
18 18 pcall(vim.api.nvim_buf_delete, bufnr, { force = true })
21 - if cycle.history then
22 - for i = #cycle.history, 1, -1 do
23 - cycle.history[i] = nil
21 + if BugabingaCycle.history then
22 + for i = #BugabingaCycle.history, 1, -1 do
23 + BugabingaCycle.history[i] = nil
33 33 vim.api.nvim_set_current_buf(bufnr2)
34 34 local bufnr3 = create_buffer('test3.lua')
35 35 vim.api.nvim_set_current_buf(bufnr3)
36 - assert.is_true(#cycle.history >= 1)
36 + assert.is_true(#BugabingaCycle.history >= 1)
39 39 it('should skip unnamed buffers', function()
40 40 vim.api.nvim_command('enew')
41 41 local bufnr = vim.api.nvim_get_current_buf()
42 42 vim.api.nvim_set_current_buf(bufnr)
43 - for _, b in ipairs(cycle.history) do
43 + for _, b in ipairs(BugabingaCycle.history) do
44 44 assert.is_not_equal(bufnr, b)
50 50 local bufnr = vim.api.nvim_get_current_buf()
51 51 vim.bo[bufnr].buflisted = false
52 52 vim.api.nvim_set_current_buf(bufnr)
53 - for _, b in ipairs(cycle.history) do
53 + for _, b in ipairs(BugabingaCycle.history) do
54 54 assert.is_not_equal(bufnr, b)
62 62 vim.api.nvim_set_current_buf(bufnr2)
63 63 local bufnr3 = create_buffer('mruseq3.lua')
64 64 vim.api.nvim_set_current_buf(bufnr3)
65 - local last = cycle.history[#cycle.history]
65 + local last = BugabingaCycle.history[#BugabingaCycle.history]
66 66 assert.is_equal(bufnr3, last)
74 74 local bufnr3 = create_buffer('del3.lua')
75 75 vim.api.nvim_set_current_buf(bufnr3)
76 76 vim.api.nvim_buf_delete(bufnr2, { force = true })
77 - for _, b in ipairs(cycle.history) do
77 + for _, b in ipairs(BugabingaCycle.history) do
78 78 assert.is_not_equal(bufnr2, b)
87 87 local bufnr2 = create_buffer('cycle2.lua')
88 88 vim.api.nvim_set_current_buf(bufnr2)
89 89 local win_count_before = #vim.api.nvim_list_wins()
90 - cycle.cycle(1)
90 + BugabingaCycle.cycle(1)
91 91 local win_count_after = #vim.api.nvim_list_wins()
92 92 assert.is_true(win_count_after > win_count_before)
93 - cycle.cancel()
93 + BugabingaCycle.cancel()
96 96 it('should open popup with current buffer included in list', function()
97 97 local bufnr1 = create_buffer('single1.lua')
98 98 vim.api.nvim_set_current_buf(bufnr1)
99 99 local win_count_before = #vim.api.nvim_list_wins()
100 - cycle.cycle(1)
100 + BugabingaCycle.cycle(1)
101 101 local win_count_after = #vim.api.nvim_list_wins()
102 102 assert.is_true(win_count_after > win_count_before, 'popup should open')
109 109 vim.api.nvim_set_current_buf(bufnr2)
110 110 local bufnr3 = create_buffer('fwd3.lua')
111 111 vim.api.nvim_set_current_buf(bufnr3)
112 - cycle.cycle(1)
113 - assert.is_not_nil(cycle.cancel)
114 - cycle.cancel()
112 + BugabingaCycle.cycle(1)
113 + assert.is_not_nil(BugabingaCycle.cancel)
114 + BugabingaCycle.cancel()
117 117 it('should not crash when cycling second time with multiple buffers', function()
121 121 vim.api.nvim_set_current_buf(bufnr2)
122 122 local bufnr3 = create_buffer('multifwd3.lua')
123 123 vim.api.nvim_set_current_buf(bufnr3)
124 - cycle.cycle(1)
125 - local ok, err = pcall(cycle.cycle, 1)
124 + BugabingaCycle.cycle(1)
125 + local ok, err = pcall(BugabingaCycle.cycle, 1)
126 126 assert.is_true(ok, 'second cycle should not error: ' .. tostring(err))
127 - cycle.cancel()
127 + BugabingaCycle.cancel()
130 130 it('should cycle backward through buffer list', function()
132 132 vim.api.nvim_set_current_buf(bufnr1)
133 133 local bufnr2 = create_buffer('bwd2.lua')
134 134 vim.api.nvim_set_current_buf(bufnr2)
135 - cycle.cycle(-1)
136 - assert.is_not_nil(cycle.cancel)
137 - cycle.cancel()
135 + BugabingaCycle.cycle(-1)
136 + assert.is_not_nil(BugabingaCycle.cancel)
137 + BugabingaCycle.cancel()
140 140 it('should wrap from first to last when cycling forward', function()
142 142 vim.api.nvim_set_current_buf(bufnr1)
143 143 local bufnr2 = create_buffer('wrap2.lua')
144 144 vim.api.nvim_set_current_buf(bufnr2)
145 - cycle.cycle(1)
146 - cycle.cancel()
145 + BugabingaCycle.cycle(1)
146 + BugabingaCycle.cancel()
154 154 local bufnr2 = create_buffer('rest2.lua')
155 155 vim.api.nvim_set_current_buf(bufnr2)
156 156 local original = vim.api.nvim_get_current_buf()
157 - cycle.cycle(1)
158 - cycle.cancel()
157 + BugabingaCycle.cycle(1)
158 + BugabingaCycle.cancel()
159 159 local restored = vim.api.nvim_get_current_buf()
160 160 assert.is_equal(original, restored)
165 165 vim.api.nvim_set_current_buf(bufnr1)
166 166 local bufnr2 = create_buffer('nocancel2.lua')
167 167 vim.api.nvim_set_current_buf(bufnr2)
168 - cycle.cancel()
168 + BugabingaCycle.cancel()
171 171 it('should stop and clear timer on cancel', function()
173 173 vim.api.nvim_set_current_buf(bufnr1)
174 174 local bufnr2 = create_buffer('timerclear2.lua')
175 175 vim.api.nvim_set_current_buf(bufnr2)
176 - cycle.cycle(1)
177 - cycle.cancel()
176 + BugabingaCycle.cycle(1)
177 + BugabingaCycle.cancel()
184 184 vim.api.nvim_set_current_buf(bufnr1)
185 185 local bufnr2 = create_buffer('commit2.lua')
186 186 vim.api.nvim_set_current_buf(bufnr2)
187 - cycle.cycle(1)
187 + BugabingaCycle.cycle(1)
188 188 vim.wait(1100)
189 189 local current = vim.api.nvim_get_current_buf()
190 190 assert.is_equal(bufnr1, current)
195 195 local bufnr = vim.api.nvim_get_current_buf()
196 196 vim.api.nvim_set_current_buf(bufnr)
197 197 local original = vim.api.nvim_get_current_buf()
198 - cycle.cycle(1)
198 + BugabingaCycle.cycle(1)
199 199 local current = vim.api.nvim_get_current_buf()
200 200 assert.is_equal(original, current)
204 204 describe('rendering', function()
205 205 it('shorten_path should return basename for paths outside cwd', function()
206 206 local short = '/a/b/c.lua'
207 - local result = cycle.shorten_path(short, 50)
207 + local result = BugabingaCycle.shorten_path(short, 50)
208 208 assert.is_equal('c.lua', result)
211 211 it('shorten_path should keep full relative path when it fits', function()
212 212 local path = '/home/user/project/file.lua'
213 - local result = cycle.shorten_path(path, 30)
213 + local result = BugabingaCycle.shorten_path(path, 30)
214 214 assert.is_true(#result <= 30, 'should fit: ' .. result .. ' (' .. #result .. ')')
215 215 assert.is_true(result:find('file.lua', 1, true) ~= nil, 'basename must be present: ' .. result)
218 218 it('shorten_path should return basename for paths outside cwd', function()
219 219 local long = '/home/user/very/deep/nested/path/to/file.lua'
220 - local result = cycle.shorten_path(long, 25)
220 + local result = BugabingaCycle.shorten_path(long, 25)
221 221 local basename = 'file.lua'
222 222 assert.is_equal(basename, result, 'should return basename: ' .. result)
225 225 it('shorten_path should truncate dirname, result may exceed max if basename is long', function()
226 226 local path = '/home/user/very/deep/nested/path/to/file.lua'
227 - local result = cycle.shorten_path(path, 15)
227 + local result = BugabingaCycle.shorten_path(path, 15)
228 228 local basename = vim.fn.fnamemodify(path, ':t')
229 229 assert.is_true(result:find(basename, 1, true) ~= nil, 'basename should be present: ' .. result)
230 230 assert.is_true(#result <= 20, 'should be shortened: ' .. result .. ' (' .. #result .. ')')
233 233 it('get_icon should return a string', function()
234 - local icon, _ = cycle.get_icon('test.lua')
234 + local icon, _ = BugabingaCycle.get_icon('test.lua')
235 235 assert.is_string(icon)
236 236 assert.is_true(#icon > 0)
240 240 describe('module API', function()
241 241 it('should export cycle, cancel, and history', function()
242 - assert.is_function(cycle.cycle)
243 - assert.is_function(cycle.cancel)
244 - assert.is_table(cycle.history)
242 + assert.is_function(BugabingaCycle.cycle)
243 + assert.is_function(BugabingaCycle.cancel)
244 + assert.is_table(BugabingaCycle.history)

neovim/tests/bugabinga/d2_spec.lua

Modified
1 -local d2 = require 'bugabinga.d2'
1 +require 'bugabinga.d2'
3 3 local D2_STUB_OUTPUT = [[
4 4 +-------+
67 67 describe('module API', function()
68 68 it('should export preview_toggle', function()
69 - local mod = require 'bugabinga.d2'
70 - assert.is_function(mod.preview_toggle)
69 + assert.is_function(BugabingaD2.preview_toggle)
73 72 it('should export preview_update', function()
74 - local mod = require 'bugabinga.d2'
75 - assert.is_function(mod.preview_update)
73 + assert.is_function(BugabingaD2.preview_update)
78 76 it('should export preview_copy', function()
79 - local mod = require 'bugabinga.d2'
80 - assert.is_function(mod.preview_copy)
77 + assert.is_function(BugabingaD2.preview_copy)
83 80 it('should export validate', function()
84 - local mod = require 'bugabinga.d2'
85 - assert.is_function(mod.validate)
81 + assert.is_function(BugabingaD2.validate)
88 84 it('should export validate_toggle', function()
89 - local mod = require 'bugabinga.d2'
90 - assert.is_function(mod.validate_toggle)
85 + assert.is_function(BugabingaD2.validate_toggle)
123 118 require 'bugabinga.d2'
124 119 vim.cmd 'enew'
125 120 vim.bo.filetype = 'd2'
126 - local ok, err = pcall(d2.validate)
121 + local ok, err = pcall(BugabingaD2.validate)
127 122 restore()
128 123 assert.is_true(ok, 'validate should not crash on unnamed buffer: ' .. tostring(err))
140 135 describe('validate_toggle', function()
141 136 it('should toggle auto-validate without error', function()
142 137 require 'bugabinga.d2'
143 - local ok, err = pcall(d2.validate_toggle)
138 + local ok, err = pcall(BugabingaD2.validate_toggle)
144 139 assert.is_true(ok, 'validate_toggle should not error: ' .. tostring(err))
145 - ok, err = pcall(d2.validate_toggle)
140 + ok, err = pcall(BugabingaD2.validate_toggle)
146 141 assert.is_true(ok, 'validate_toggle should not error on second call: ' .. tostring(err))
164 159 describe('parse_validate_output', function()
165 160 it('should parse line:col error format', function()
166 - local mod = require 'bugabinga.d2'
167 161 local stderr = 'err: /path/file.d2:27:11: unexpected text after map\n'
168 - local results = mod._parse_validate_output(stderr)
162 + local results = BugabingaD2._parse_validate_output(stderr)
169 163 assert.is_table(results)
170 164 assert.is_true(#results >= 1)
171 165 assert.is_equal(26, results[1].lnum)
175 169 it('should parse error with URL prefix', function()
176 - local mod = require 'bugabinga.d2'
177 170 local stderr = 'err: oss.terrastruct.com/d2/d2cli.validateCmd: 27:9: unexpected text after map\n'
178 - local results = mod._parse_validate_output(stderr)
171 + local results = BugabingaD2._parse_validate_output(stderr)
179 172 assert.is_table(results)
180 173 assert.is_true(#results >= 1)
181 174 assert.is_equal(26, results[1].lnum)
185 178 it('should return empty table for no errors', function()
186 - local mod = require 'bugabinga.d2'
187 179 local stderr = ''
188 - local results = mod._parse_validate_output(stderr)
180 + local results = BugabingaD2._parse_validate_output(stderr)
189 181 assert.is_table(results)
190 182 assert.is_equal(0, #results)
193 -end)
185 +end)

neovim/tests/bugabinga/statusline_spec.lua

Modified
1 -local statusline = require('bugabinga.statusline')
1 +require('bugabinga.statusline')
2 2 local icon = require('std.icon')
4 4 describe('statusline', function()
5 + describe('plugins_component', function()
6 + before_each(function()
7 + BugabingaStatusline.reset()
8 + end)
10 + after_each(function()
11 + BugabingaStatusline.reset()
12 + end)
14 + it('filters out empty string results from registered components', function()
15 + BugabingaStatusline.register(function() return 'foo' end)
16 + BugabingaStatusline.register(function() return '' end)
17 + BugabingaStatusline.register(function() return 'bar' end)
18 + BugabingaStatusline.register(function() return '' end)
19 + local result = BugabingaStatusline.plugins_component()
20 + assert.is_equal('foo bar', result)
21 + end)
23 + it('returns empty string when all components return empty', function()
24 + BugabingaStatusline.register(function() return '' end)
25 + BugabingaStatusline.register(function() return '' end)
26 + local result = BugabingaStatusline.plugins_component()
27 + assert.is_equal('', result)
28 + end)
29 + end)
5 31 describe('git_component', function()
6 32 local initial_cwd
8 34 before_each(function()
9 35 initial_cwd = vim.uv.cwd()
10 - statusline._get_cache().git_branch = {}
36 + BugabingaStatusline._get_cache().git_branch = {}
11 37 end)
13 39 after_each(function()
14 - statusline._get_cache().git_branch = {}
40 + BugabingaStatusline._get_cache().git_branch = {}
15 41 end)
17 43 it('returns empty string on first call (async loading)', function()
18 - local result = statusline.git_component()
44 + local result = BugabingaStatusline.git_component()
19 45 assert.is_equal('', result)
20 46 end)
22 48 it('returns cached branch string when available', function()
23 49 local fake_branch = icon.branch .. ' test-branch'
24 - statusline._get_cache().git_branch[initial_cwd] = fake_branch
25 - local result = statusline.git_component()
50 + BugabingaStatusline._get_cache().git_branch[initial_cwd] = fake_branch
51 + local result = BugabingaStatusline.git_component()
26 52 assert.is_equal(fake_branch, result)
27 53 end)
29 - it('DirChanged clears git branch cache (manual test)', function()
30 - -- DirChanged is tested manually since the event isn't reliably
31 - -- fireable in headless test environments.
55 + it('DirChanged clears git branch cache', function()
56 + local fake_branch = icon.branch .. ' test-branch'
57 + BugabingaStatusline._get_cache().git_branch[initial_cwd] = fake_branch
58 + assert.is_true(vim.tbl_count(BugabingaStatusline._get_cache().git_branch) > 0, 'cache should have entry before')
59 + vim.api.nvim_exec_autocmds('DirChanged', {})
60 + assert.equals(0, vim.tbl_count(BugabingaStatusline._get_cache().git_branch), 'cache should be cleared after DirChanged')
32 61 end)
33 62 end)
34 63 end)

neovim/tests/bugabinga/treesitter_spec.lua

Modified
1 1 local ignored = require('std.ignored')
2 -local treesitter = require('bugabinga.treesitter')
2 +require('bugabinga.treesitter')
4 4 local function deep_copy(t)
5 5 local copy = {}
42 42 describe('correctness', function()
43 43 local function expect_ignored(match, expected)
44 - local result = treesitter.is_ignored(match)
44 + local result = BugabingaTreesitter.is_ignored(match)
45 45 assert.is.equal(expected, result,
46 46 string.format('is_ignored(%q) = %s, expected %s', match, tostring(result), tostring(expected)))
90 - describe('benchmark results (informational only)', function()
91 - local warmup = 10000
92 - local iterations = 100000
94 - local function bench(name, fn, warmup, iterations)
95 - for _ = 1, warmup do fn() end
96 - local sink = false
97 - local start = vim.uv.hrtime()
98 - for _ = 1, iterations do
99 - sink = sink or fn()
100 - end
101 - local elapsed = vim.uv.hrtime() - start
102 - local ns_op = elapsed / iterations
103 - print(string.format('\n %s: %.1f ns/op', name, ns_op))
104 - return ns_op
105 - end
107 - it('informational: exact match "help" — kv short-circuits before pattern loop', function()
108 - bench('linear', function()
109 - for _, v in ipairs(ignored.filetypes) do
110 - if v == 'help' or ('help'):match(v) then return true end
111 - end
112 - return false
113 - end, warmup, iterations)
115 - bench('optimized (kv+patterns)', function()
116 - if ignored.filetypes_kv['help'] then return true end
117 - for _, v in ipairs(ignored.filetypes_patterns) do
118 - if ('help'):match(v) then return true end
119 - end
120 - return false
121 - end, warmup, iterations)
122 - end)
124 - it('informational: pattern match "gitcommit" — kv misses, falls back to patterns', function()
125 - bench('linear', function()
126 - for _, v in ipairs(ignored.filetypes) do
127 - if v == 'gitcommit' or ('gitcommit'):match(v) then return true end
128 - end
129 - return false
130 - end, warmup, iterations)
132 - bench('optimized (kv+patterns)', function()
133 - if ignored.filetypes_kv['gitcommit'] then return true end
134 - for _, v in ipairs(ignored.filetypes_patterns) do
135 - if ('gitcommit'):match(v) then return true end
136 - end
137 - return false
138 - end, warmup, iterations)
139 - end)
141 - it('informational: no match "lua" — full scan in both, but kv is O(1)', function()
142 - bench('linear', function()
143 - for _, v in ipairs(ignored.filetypes) do
144 - if v == 'lua' or ('lua'):match(v) then return true end
145 - end
146 - return false
147 - end, warmup, iterations)
149 - bench('optimized (kv+patterns)', function()
150 - if ignored.filetypes_kv['lua'] then return true end
151 - for _, v in ipairs(ignored.filetypes_patterns) do
152 - if ('lua'):match(v) then return true end
153 - end
154 - return false
155 - end, warmup, iterations)
156 - end)
157 - end)

neovim/tests/manual/input.lua

Added
new file mode 100644
1 +local M = {}
2 +local BUF = nil
3 +local WIN = nil
5 +M.tests = {
6 + { name = 'Basic short prompt (Path A - border title)', prompt = 'What is your name, brave adventurer?' },
7 + { name = 'Short prompt with question mark (Path A)', prompt = 'Are you sure you want to rm -rf /?' },
8 + { name = 'Han vs Greedo (Path A)', prompt = 'Who shot first? (Han/Greedo)' },
9 + { name = 'Vim proficiency rating (Path A)', prompt = 'Rate your Vim proficiency from 0 to :wq' },
10 + { name = 'Semicolons in Lua (Path A)', prompt = 'Describe your feelings about semicolons in one word:' },
11 + { name = 'Richard Stallman wisdom (Path A)', prompt = 'What would Richard Stallman do?' },
12 + { name = 'The meaning of life (Path A)', prompt = 'The answer to life, the universe, and everything is:' },
13 + { name = 'Long warning prompt (Path B - virt_lines)', prompt = 'You are about to perform an irreversible operation on your carefully crafted dotfiles that you have spent months perfecting. Your Neovim config, your WezTerm theme, your niri layout — all of it could vanish in a puff of smoke. Are you absolutely, positively, cross-your-heart-and-hope-to-die sure you want to proceed?' },
14 + { name = 'Commandment prompt (Path B)', prompt = 'Thou shalt not use nano. Thou shalt not use emacs. Thou shalt use Neovim exclusively, for it is written: "In the beginning was the command line, and the command line was good."' },
15 + { name = 'Warranty scam prompt (Path B)', prompt = 'Congratulations! You have been selected as the lucky winner of a free compilation error! To claim your prize, simply enter your credit card number, social security number, mother maiden name, and the name of your first pet. Good luck!' },
16 + { name = 'Terms and conditions with newlines (Path B)', prompt = 'TERMS AND CONDITIONS:\n1. You will not use nano.\n2. You will not use emacs.\n3. See points 1 and 2.\n\nDo you accept?' },
17 + { name = 'Mission briefing with newlines (Path B)', prompt = 'Your mission, should you choose to accept it:\n\n- Infiltrate the VS Code headquarters\n- Replace all extensions with Neovim plugins\n- Escape undetected\n\nEnter your codename:' },
18 + { name = 'Lua love letter with newlines (Path B)', prompt = 'We have been trying to reach you about your cars extended warranty.\n\nJUST KIDDING.\n\nActually, we need you to type I love Lua to continue. The interpreter is watching.' },
19 + { name = 'Empty prompt (no title)', prompt = '' },
20 + { name = 'Emoji spirit picker', prompt = 'Pick your spirit emoji (choose wisely):' },
21 + { name = 'Unicode smorgasbord', prompt = 'Raksmorgas heisst nicht Scoop. Enter your favorite umlaut:' },
22 + { name = 'Exactly 85% width', prompt = nil },
23 + { name = 'One char over 85% width', prompt = nil },
24 + { name = 'Tab-separated columns', prompt = 'Column A\tColumn B\tColumn C' },
25 + { name = 'Input with default (VS Code trap)', prompt = 'Your favorite editor (hint: wrong answers only):', default = 'VS Code' },
26 + { name = 'Input with file completion', prompt = 'Pick a file to accidentally delete:', completion = 'file' },
27 + { name = 'Rapid fire: 3 sequential inputs', prompt = nil },
28 + { name = 'Input then immediately cancel', prompt = 'Type something then press Esc:' },
29 + { name = 'The ultimate question', prompt = 'You have reached the end of this manual test suite. As a reward, please type the answer to life, the universe, and everything:' },
32 +local function get_buf()
33 + if BUF and vim.api.nvim_buf_is_valid(BUF) then
34 + return BUF
35 + end
36 + BUF = vim.api.nvim_create_buf(true, true)
37 + vim.bo[BUF].filetype = 'markdown'
38 + return BUF
39 +end
41 +local function ensure_window()
42 + local buf = get_buf()
43 + if WIN and vim.api.nvim_win_is_valid(WIN) then
44 + vim.api.nvim_win_set_buf(WIN, buf)
45 + return WIN
46 + end
47 + WIN = vim.api.nvim_open_win(buf, true, {
48 + relative = 'editor',
49 + width = math.floor(vim.o.columns * 0.7),
50 + height = math.floor(vim.o.lines * 0.65),
51 + row = math.floor(vim.o.lines * 0.33),
52 + col = math.floor(vim.o.columns * 0.15),
53 + style = 'minimal',
54 + border = 'rounded',
55 + title = ' cmdline input() manual test ',
56 + title_pos = 'center',
57 + })
58 + vim.wo[WIN].wrap = true
59 + vim.wo[WIN].cursorline = false
60 + vim.keymap.set('n', 'q', function()
61 + M.close()
62 + end, { buffer = buf, nowait = true })
63 + return WIN
64 +end
66 +local function append_content(lines)
67 + local buf = get_buf()
68 + vim.api.nvim_buf_set_lines(buf, -1, -1, false, lines)
69 + if WIN and vim.api.nvim_win_is_valid(WIN) then
70 + local line_count = vim.api.nvim_buf_line_count(buf)
71 + vim.api.nvim_win_set_cursor(WIN, { line_count, 0 })
72 + end
73 +end
75 +function M.set_content(lines)
76 + local buf = get_buf()
77 + vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
78 + ensure_window()
79 +end
81 +function M.show_menu()
82 + local lines = {
83 + '',
84 + '=== CMDLINE INPUT() MANUAL TEST SUITE ===',
85 + '',
86 + 'Path A = border title | Path B = in-popup virt_lines',
87 + '',
88 + 'Short prompts (Path A):',
89 + }
90 + for i = 1, 7 do table.insert(lines, string.format(' [%2d] %s', i, M.tests[i].name)) end
91 + table.insert(lines, '')
92 + table.insert(lines, 'Long prompts (Path B):')
93 + for i = 8, 10 do table.insert(lines, string.format(' [%2d] %s', i, M.tests[i].name)) end
94 + table.insert(lines, '')
95 + table.insert(lines, 'Multi-line prompts (Path B):')
96 + for i = 11, 13 do table.insert(lines, string.format(' [%2d] %s', i, M.tests[i].name)) end
97 + table.insert(lines, '')
98 + table.insert(lines, 'Edge cases:')
99 + for i = 14, 19 do
100 + local name = M.tests[i].name
101 + if i == 17 or i == 18 then name = name .. ' (dynamic)' end
102 + table.insert(lines, string.format(' [%2d] %s', i, name))
103 + end
104 + table.insert(lines, '')
105 + table.insert(lines, 'Interactive:')
106 + for i = 20, 24 do table.insert(lines, string.format(' [%2d] %s', i, M.tests[i].name)) end
107 + M.set_content(lines)
108 +end
110 +function M.run_test(idx)
111 + local test = M.tests[idx]
112 + if not test then
113 + append_content({ 'Invalid test number: ' .. tostring(idx) })
114 + vim.defer_fn(M.input_loop, 10)
115 + return
116 + end
118 + local prompt = test.prompt
119 + if idx == 17 then
120 + local max_w = math.floor(vim.o.columns * 0.85) - 3
121 + prompt = 'Exactly 85%: ' .. string.rep('x', math.max(0, max_w))
122 + elseif idx == 18 then
123 + local max_w = math.floor(vim.o.columns * 0.85) - 3
124 + prompt = 'One over 85%: ' .. string.rep('x', math.max(0, max_w + 1))
125 + end
127 + append_content({
128 + '',
129 + '--------------------------------------------------------------------------------',
130 + 'TEST: [' .. idx .. '] ' .. test.name,
131 + 'Prompt: ' .. vim.inspect(prompt),
132 + 'Display width: ' .. vim.fn.strdisplaywidth(prompt),
133 + '--------------------------------------------------------------------------------',
134 + })
136 + if idx == 22 then
137 + vim.ui.input({ prompt = 'First: ', default = 'one' }, function(a)
138 + append_content({ 'You entered: ' .. (a or 'nil') })
139 + vim.ui.input({ prompt = 'Second: ', default = 'two' }, function(b)
140 + append_content({ 'You entered: ' .. (b or 'nil') })
141 + vim.ui.input({ prompt = 'Third: ', default = 'three' }, function(c)
142 + append_content({ 'You entered: ' .. (c or 'nil') })
143 + append_content({ 'Rapid fire complete!' })
144 + vim.defer_fn(M.input_loop, 10)
145 + end)
146 + end)
147 + end)
148 + return
149 + end
151 + local opts = { prompt = prompt }
152 + if test.default then opts.default = test.default end
153 + if test.completion then opts.completion = test.completion end
155 + vim.ui.input(opts, function(answer)
156 + append_content({ 'You entered: ' .. (answer or 'nil') })
157 + vim.defer_fn(M.input_loop, 10)
158 + end)
159 +end
161 +function M.input_loop()
162 + if WIN and vim.api.nvim_win_is_valid(WIN) then
163 + vim.api.nvim_set_current_win(WIN)
164 + end
165 + vim.ui.input({ prompt = 'Enter test # (1-24) or q to quit: ' }, function(answer)
166 + if not answer or answer == 'q' or answer == 'Q' then
167 + append_content({ '', 'Done! Press q to close, or :TestAgain to run more tests.' })
168 + return
169 + end
170 + local num = tonumber(answer)
171 + if num and num >= 1 and num <= #M.tests then
172 + M.run_test(num)
173 + else
174 + if answer ~= '' then
175 + append_content({ 'Invalid selection: ' .. answer })
176 + end
177 + vim.defer_fn(M.input_loop, 10)
178 + end
179 + end)
180 +end
182 +function M.close()
183 + if WIN and vim.api.nvim_win_is_valid(WIN) then
184 + vim.api.nvim_win_close(WIN, true)
185 + WIN = nil
186 + end
187 +end
189 +vim.api.nvim_create_user_command('TestInputClose', function()
190 + M.close()
191 +end, {})
193 +vim.api.nvim_create_user_command('TestAgain', function()
194 + vim.defer_fn(M.input_loop, 10)
195 +end, {})
197 +vim.defer_fn(function()
198 + M.show_menu()
199 + vim.defer_fn(M.input_loop, 100)
200 +end, 0)
202 +return M

neovim/tests/minimal_init.lua

Modified
1 -vim.cmd('packadd plenary')
1 +vim.cmd.packadd 'plenary'
3 -local config_root = vim.uv.fs_realpath(vim.fn.stdpath('config')) or vim.fn.stdpath('config')
4 -vim.opt.runtimepath:prepend(config_root)
5 -package.path = config_root .. '/?.lua;' .. config_root .. '/lua/?.lua;' .. package.path
3 +vim.opt.swapfile = false
4 +vim.opt.undofile = false
5 +vim.opt.shadafile = 'NONE'
7 +vim.opt.runtimepath:append '.'

neovim/tests/project_probe.lua

Added
new file mode 100644
1 +local project = require('std.project')
2 +local p = 'sample_files/projects/dotfiles/'
4 +print('=== Dotfiles wezterm (before/after .lsp.settings.lua) ===')
5 +-- Clear cache so it re-evaluates
6 +package.loaded['std.project'] = nil
7 +local project2 = require('std.project')
9 +print(' neovim lua -> ' .. tostring(project2.find_lua_project_root(p .. 'neovim/lua/std/project.lua')))
10 +print(' wezterm lua -> ' .. tostring(project2.find_lua_project_root(p .. 'wezterm/wezterm.lua')))

neovim/tests/std/cheatsheet_spec.lua

Modified
1 --- Replicate the private functions from lua/std/cheatsheet.lua for testing
2 -local categories = {
3 - lsp = 'LSP',
4 - fuzzy = 'FZF',
5 - files = 'FILE',
6 - terminal = 'TERM',
7 - editing = 'EDIT',
8 - search = 'FIND',
9 - session = 'SESS',
10 - diff = 'DIFF',
11 - operator = 'OP',
12 - fun = 'FUN',
1 +-- Test the actual module at lua/std/cheatsheet.lua
2 +local cheatsheet = require 'std.cheatsheet'
15 -local category_patterns = {
16 - '^lsp: ', 'lsp',
17 - '^fuzzy: ', 'fuzzy',
18 - '^files: ', 'files',
19 - '^terminal: ', 'terminal',
20 - '^editing: ', 'editing',
21 - '^search: ', 'search',
22 - '^session: ', 'session',
23 - '^diff: ', 'diff',
24 - '^operator: ', 'operator',
25 - '^fun: ', 'fun',
28 -local get_category_icon = function(category)
29 - return categories[category] or category:upper()
30 -end
32 -local parse_description = function(desc)
33 - if not desc or desc == '' then
34 - return 'general', '*no description*'
35 - end
37 - for i = 1, #category_patterns, 2 do
38 - local pattern, category = category_patterns[i], category_patterns[i + 1]
39 - if desc:match(pattern) then
40 - return category, desc:gsub(pattern, '')
41 - end
42 - end
44 - return 'general', desc
45 -end
4 +local get_category_icon = cheatsheet.get_category_icon
5 +local parse_description = cheatsheet.parse_description
47 7 describe('std.cheatsheet helpers', function()
48 8 describe('get_category_icon', function()

neovim/tests/std/dbg/file_spec.lua

Modified
41 41 local test_file
43 43 before_each(function()
44 + mod.clear_log()
44 45 test_file = vim.fn.stdpath 'state' .. '/test_debug_spec.jsonl'
45 46 vim.fn.delete(test_file)

neovim/tests/std/dbg/format_spec.lua

Modified
419 419 assert.equals( 'ABC', result )
423 + describe( 'levenshtein()', function ()
424 + local lev = format_message.levenshtein
426 + it( 'returns 0 for identical strings', function ()
427 + assert.equals( 0, lev( 'hello', 'hello' ) )
428 + assert.equals( 0, lev( '', '' ) )
429 + assert.equals( 0, lev( 'a', 'a' ) )
430 + end )
432 + it( 'returns length difference for empty string', function ()
433 + assert.equals( 3, lev( '', 'abc' ) )
434 + assert.equals( 3, lev( 'abc', '' ) )
435 + end )
437 + it( 'returns 1 for single character difference', function ()
438 + assert.equals( 1, lev( 'cat', 'car' ) )
439 + assert.equals( 1, lev( 'name', 'nam' ) )
440 + assert.equals( 1, lev( 'name', 'names' ) )
441 + end )
443 + it( 'returns 2 for swapped characters', function ()
444 + assert.equals( 2, lev( 'name', 'nmae' ) )
445 + assert.equals( 2, lev( 'cat', 'act' ) )
446 + end )
448 + it( 'handles kitten vs sitting (distance 3)', function ()
449 + assert.equals( 3, lev( 'kitten', 'sitting' ) )
450 + end )
452 + it( 'returns correct distances for various pairs', function ()
453 + assert.equals( 1, lev( 'foo', 'fo' ) )
454 + assert.equals( 1, lev( 'foo', 'fOo' ) )
455 + assert.equals( 4, lev( 'hello', 'world' ) )
456 + end )
457 + end )
459 + describe( 'key not found errors', function ()
460 + it( 'suggests close key for typo in key name', function ()
461 + local ok, err = pcall( function ()
462 + format_message( '{1.namme}', { { name = 'hi' } } )
463 + end )
464 + assert.is_false( ok )
465 + assert.is_not_nil( err:find 'Key not found' )
466 + assert.is_not_nil( err:find "did you mean 'name'" )
467 + end )
469 + it( 'suggests from multiple keys', function ()
470 + local ok, err = pcall( function ()
471 + format_message( '{1.ags}', { { age = 10, name = 'bob' } } )
472 + end )
473 + assert.is_false( ok )
474 + assert.is_not_nil( err:find 'Key not found' )
475 + assert.is_not_nil( err:find "did you mean 'age'" )
476 + end )
478 + it( 'suggests correct key for minor typo', function ()
479 + local ok, err = pcall( function ()
480 + format_message( '{1.nam}', { { name = 'bob' } } )
481 + end )
482 + assert.is_false( ok )
483 + assert.is_not_nil( err:find 'Key not found' )
484 + assert.is_not_nil( err:find "did you mean 'name'" )
485 + end )
487 + it( 'does not suggest when key is too different', function ()
488 + local ok, err = pcall( function ()
489 + format_message( '{1.xyz}', { { name = 'bob' } } )
490 + end )
491 + assert.is_false( ok )
492 + assert.is_not_nil( err:find 'Key not found' )
493 + assert.is_nil( err:find 'did you mean' )
494 + end )
496 + it( 'suggests in deeply nested path', function ()
497 + local ok, err = pcall( function ()
498 + format_message( '{1.a.nmae}', { { a = { name = 'nested' } } } )
499 + end )
500 + assert.is_false( ok )
501 + assert.is_not_nil( err:find 'Key not found' )
502 + assert.is_not_nil( err:find "did you mean 'name'" )
503 + end )
505 + it( 'index suggestion still works when index exceeds data', function ()
506 + local ok, err = pcall( function ()
507 + format_message( '{3}', { 'a', 'b' } )
508 + end )
509 + assert.is_false( ok )
510 + assert.is_not_nil( err:find 'out of range' )
511 + assert.is_not_nil( err:find 'did you mean {2}' )
512 + end )
514 + it( 'no index suggestion when too far out of range', function ()
515 + local ok, err = pcall( function ()
516 + format_message( '{6}', { 'a', 'b' } )
517 + end )
518 + assert.is_false( ok )
519 + assert.is_not_nil( err:find 'out of range' )
520 + assert.is_nil( err:find 'did you mean' )
521 + end )
522 + end )

neovim/tests/std/dbg/init_spec.lua

Modified
3 3 describe( 'std.dbg.init', function ()
4 4 local dbg
5 5 local dbg_file
6 6 local mod
8 + local TEST_FILE = vim.fn.stdpath 'state' .. '/test_init_spec.jsonl'
10 + local function read_debug_file(path)
11 + local file = io.open(path, 'r')
12 + if not file then return nil end
13 + local content = file:read('*a')
14 + file:close()
15 + if not content or content == '' then return nil end
16 + return content
17 + end
8 19 before_each( function ()
9 20 package.loaded['std.dbg'] = nil
10 21 package.loaded['std.dbg.init'] = nil
22 + package.loaded['std.dbg.file'] = nil
23 + vim.g.bugabinga_debug_file_override = TEST_FILE
11 24 mod = require 'std.dbg.file'
12 - dbg_file = mod.get_path()
13 - vim.fn.delete( dbg_file )
25 + dbg_file = TEST_FILE
26 + vim.fn.delete(dbg_file)
14 27 dbg = require 'std.dbg'
15 28 vim.g.bugabinga_debug_mode = false
16 29 end )
18 31 after_each( function ()
19 32 vim.g.bugabinga_debug_mode = false
20 - vim.fn.delete( dbg_file )
33 + vim.g.bugabinga_debug_file_override = nil
34 + vim.fn.delete(dbg_file)
21 35 end )
23 37 describe( 'dbg(...) __call', function ()
28 42 it( 'should be no-op when debug mode is off', function ()
29 43 vim.g.bugabinga_debug_mode = false
30 44 dbg 'test message'
31 - local file = io.open( dbg_file, 'r' )
32 - assert.is_nil( file )
45 + local content = read_debug_file(dbg_file)
46 + assert.is_nil( content )
33 47 end )
35 49 it( 'should write event when debug mode is on', function ()
36 50 vim.g.bugabinga_debug_mode = true
37 51 dbg( 'test {1}', 'hello' )
38 - local file = io.open( dbg_file, 'r' )
39 - assert.is_not_nil( file )
40 - local content = file:read '*all'
41 - file:close()
52 + local content = read_debug_file(dbg_file)
53 + assert.is_not_nil( content )
42 54 assert.is_not_nil( content:match '"kind"' )
43 55 assert.is_not_nil( content:match '"message"' )
44 56 assert.is_not_nil( content:match '"data"' )
47 59 it( 'should write event with date as os.time() integer', function ()
48 60 vim.g.bugabinga_debug_mode = true
49 61 dbg 'test'
50 - local file = io.open( dbg_file, 'r' )
51 - local content = file:read '*all'
52 - file:close()
62 + local content = read_debug_file(dbg_file)
63 + assert.is_not_nil( content )
53 64 local json = vim.json.decode( content )
54 65 assert.is_number( json.date )
55 66 end )
57 68 it( 'should have all required fields in written event', function ()
58 69 vim.g.bugabinga_debug_mode = true
59 70 dbg( 'test {1}', 'y' )
60 - local file = io.open( dbg_file, 'r' )
61 - local content = file:read '*all'
62 - file:close()
71 + local content = read_debug_file(dbg_file)
72 + assert.is_not_nil( content )
63 73 local json = vim.json.decode( content )
64 74 assert.equals( 'DEBUG', json.kind )
65 75 assert.equals( 'test y', json.message )
78 88 it( 'should log with specified kind', function ()
79 89 vim.g.bugabinga_debug_mode = true
80 90 dbg.kind( 'ERROR', 'error message' )
81 - local file = io.open( dbg_file, 'r' )
82 - local content = file:read '*all'
83 - file:close()
91 + local content = read_debug_file(dbg_file)
92 + assert.is_not_nil( content )
84 93 local json = vim.json.decode( content )
85 94 assert.equals( 'ERROR', json.kind )
86 95 end )
88 97 it( 'should log TRACE kind', function ()
89 98 vim.g.bugabinga_debug_mode = true
90 99 dbg.kind( 'TRACE', 'trace message' )
91 - local file = io.open( dbg_file, 'r' )
92 - local content = file:read '*all'
93 - file:close()
100 + local content = read_debug_file(dbg_file)
101 + assert.is_not_nil( content )
94 102 local json = vim.json.decode( content )
95 103 assert.equals( 'TRACE', json.kind )

neovim/tests/std/dbg/viewer_spec.lua

Modified
9 9 package.loaded['std.dbg.viewer'] = nil
10 10 viewer = require 'std.dbg.viewer'
11 11 test_log_path = file.get_path()
12 - vim.fn.delete( test_log_path )
12 + file.clear_log()
13 13 vim.g.bugabinga_debug_mode = true
14 14 vim.ui.input = function( opts, on_choice )
15 15 on_choice( nil )
19 19 after_each( function ()
20 20 pcall(viewer.close)
21 - pcall(vim.fn.delete, test_log_path)
21 + file.clear_log()
22 22 vim.g.bugabinga_debug_mode = false
23 23 end )

neovim/tests/std/light_up_spec.lua

Added
new file mode 100644
1 +local light_up = require 'std.light_up'
3 +describe('std.light_up', function()
4 + local bufnr
6 + before_each(function()
7 + vim.api.nvim_buf_set_lines(0, 0, -1, true, {
8 + 'foo bar baz',
9 + 'test_word end_of_line',
10 + 'keyword1 keyword2 middle',
11 + })
12 + bufnr = 0
13 + end)
15 + after_each(function()
16 + pcall(vim.api.nvim_buf_delete, 0, { force = true })
17 + end)
19 + describe('_.buffer', function()
20 + it('should highlight a word at start of line without preceding boundary', function()
21 + local words = { test_word = 'Title' }
22 + local ns = light_up.buffer(bufnr, words)
23 + local marks = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, { details = true })
24 + assert.equals(1, #marks, 'should have exactly one highlight mark')
25 + assert.equals(1, marks[1][2], 'should be on line 1 (where test_word appears)')
26 + assert.equals(0, marks[1][3], 'test_word starts at column 0')
27 + end)
29 + it('should highlight multiple different words on the same line', function()
30 + local words = { keyword1 = 'Title', keyword2 = 'Comment' }
31 + local ns = light_up.buffer(bufnr, words)
32 + local marks = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, { details = true })
33 + assert.equals(2, #marks, 'both keyword1 and keyword2 on same line should be highlighted')
34 + end)
36 + it('should highlight all instances of same word on same line', function()
37 + vim.api.nvim_buf_set_lines(0, 0, -1, true, { 'foo foo foo' })
38 + local words = { foo = 'Title' }
39 + local ns = light_up.buffer(bufnr, words)
40 + local marks = vim.api.nvim_buf_get_extmarks(bufnr, ns, 0, -1, { details = true })
41 + assert.equals(3, #marks, 'all three foo occurrences should be highlighted')
42 + end)
43 + end)
45 + describe('_.get_vim_highlight_groups', function()
46 + it('should return a non-empty table', function()
47 + local groups = light_up.get_vim_highlight_groups()
48 + assert.is_table(groups)
49 + assert.is_true(next(groups) ~= nil, 'should have at least one highlight group')
50 + end)
52 + it('should contain common highlight groups', function()
53 + local groups = light_up.get_vim_highlight_groups()
54 + assert.is_not_nil(groups['Title'])
55 + assert.is_not_nil(groups['Comment'])
56 + assert.is_not_nil(groups['Normal'])
57 + end)
58 + end)
59 +end)

neovim/tests/std/map_spec.lua

Added
new file mode 100644
1 +local map = require 'std.map'
3 +describe( 'std.map', function ()
4 + before_each( function ()
5 + package.loaded['std.map'] = nil
6 + map = require 'std.map'
7 + end )
9 + after_each( function ()
10 + pcall( vim.keymap.del, 'n', '<test-map-keys>' )
11 + pcall( vim.keymap.del, 'n', '<test-map-keys-2>' )
12 + pcall( vim.keymap.del, 'i', 'k' )
13 + pcall( vim.keymap.del, 'n', 'gd' )
14 + pcall( vim.keymap.del, 'x', 'gd' )
15 + pcall( vim.keymap.del, 'n', 'gx' )
16 + end )
18 + local function find_keymap( mode, lhs )
19 + local keymaps = vim.api.nvim_get_keymap( mode )
20 + for _, km in ipairs( keymaps ) do
21 + if km.lhsraw == lhs then
22 + return km
23 + end
24 + end
25 + return nil
26 + end
28 + describe( 'mode aliases', function ()
29 + it( 'should support "n" as alias for normal mode', function ()
30 + local deleter = map.n { keys = '<test-map-keys>', command = 'echo "test"' }
31 + assert.is_function( deleter )
32 + local mapping = find_keymap( 'n', '<test-map-keys>' )
33 + assert.is_not_nil( mapping )
34 + assert.equals( '<test-map-keys>', mapping.lhsraw )
35 + end )
37 + it( 'should support "normal" as explicit normal mode', function ()
38 + local deleter = map.normal { keys = '<test-map-keys>', command = 'echo "test"' }
39 + assert.is_function( deleter )
40 + local mapping = find_keymap( 'n', '<test-map-keys>' )
41 + assert.is_not_nil( mapping )
42 + assert.equals( '<test-map-keys>', mapping.lhsraw )
43 + end )
45 + it( 'should support "i" as alias for insert mode', function ()
46 + local deleter = map.i { keys = 'k', command = 'echo "insert"' }
47 + assert.is_function( deleter )
48 + local mapping = find_keymap( 'i', 'k' )
49 + assert.is_not_nil( mapping )
50 + assert.equals( 'k', mapping.lhsraw )
51 + end )
53 + it( 'should support "insert" as explicit insert mode', function ()
54 + local deleter = map.insert { keys = 'k', command = 'echo "insert"' }
55 + assert.is_function( deleter )
56 + local mapping = find_keymap( 'i', 'k' )
57 + assert.is_not_nil( mapping )
58 + assert.equals( 'k', mapping.lhsraw )
59 + end )
61 + it( 'should support "x" as alias for visual mode', function ()
62 + local deleter = map.x { keys = '<test-map-keys>', command = 'echo "visual"' }
63 + assert.is_function( deleter )
64 + local mapping = find_keymap( 'x', '<test-map-keys>' )
65 + assert.is_not_nil( mapping )
66 + assert.equals( '<test-map-keys>', mapping.lhsraw )
67 + end )
69 + it( 'should support "visual" as explicit visual mode', function ()
70 + local deleter = map.visual { keys = '<test-map-keys>', command = 'echo "visual"' }
71 + assert.is_function( deleter )
72 + local mapping = find_keymap( 'x', '<test-map-keys>' )
73 + assert.is_not_nil( mapping )
74 + assert.equals( '<test-map-keys>', mapping.lhsraw )
75 + end )
77 + it( 'should support "v" as alias for visual_select mode', function ()
78 + local deleter = map.v { keys = '<test-map-keys>', command = 'echo "v"' }
79 + assert.is_function( deleter )
80 + local mapping = find_keymap( 'v', '<test-map-keys>' )
81 + assert.is_not_nil( mapping )
82 + assert.equals( '<test-map-keys>', mapping.lhsraw )
83 + end )
85 + it( 'should support "s" as alias for select mode', function ()
86 + local deleter = map.s { keys = '<test-map-keys>', command = 'echo "s"' }
87 + assert.is_function( deleter )
88 + local mapping = find_keymap( 's', '<test-map-keys>' )
89 + assert.is_not_nil( mapping )
90 + assert.equals( '<test-map-keys>', mapping.lhsraw )
91 + end )
93 + it( 'should support "o" as alias for operator_pending mode', function ()
94 + local deleter = map.o { keys = '<test-map-keys>', command = 'echo "o"' }
95 + assert.is_function( deleter )
96 + local mapping = find_keymap( 'o', '<test-map-keys>' )
97 + assert.is_not_nil( mapping )
98 + assert.equals( '<test-map-keys>', mapping.lhsraw )
99 + end )
101 + it( 'should support "c" as alias for command_line mode', function ()
102 + local deleter = map.c { keys = '<test-map-keys>', command = 'echo "c"' }
103 + assert.is_function( deleter )
104 + local mapping = find_keymap( 'c', '<test-map-keys>' )
105 + assert.is_not_nil( mapping )
106 + assert.equals( '<test-map-keys>', mapping.lhsraw )
107 + end )
109 + it( 'should support "t" as alias for terminal mode', function ()
110 + local deleter = map.t { keys = '<test-map-keys>', command = 'echo "t"' }
111 + assert.is_function( deleter )
112 + local mapping = find_keymap( 't', '<test-map-keys>' )
113 + assert.is_not_nil( mapping )
114 + assert.equals( '<test-map-keys>', mapping.lhsraw )
115 + end )
116 + end )
118 + describe( 'mode chaining', function ()
119 + it( 'should chain normal and visual modes', function ()
120 + local deleter = map.normal.visual { keys = 'gd', command = 'echo "chained"' }
121 + assert.is_function( deleter )
122 + local normal_mapping = find_keymap( 'n', 'gd' )
123 + local visual_mapping = find_keymap( 'x', 'gd' )
124 + assert.is_not_nil( normal_mapping )
125 + assert.is_not_nil( visual_mapping )
126 + end )
128 + it( 'should chain multiple modes', function ()
129 + local deleter = map.n.x.v { keys = 'gx', command = 'echo "multi"' }
130 + assert.is_function( deleter )
131 + local n_mapping = find_keymap( 'n', 'gx' )
132 + local x_mapping = find_keymap( 'x', 'gx' )
133 + local v_mapping = find_keymap( 'v', 'gx' )
134 + assert.is_not_nil( n_mapping )
135 + assert.is_not_nil( x_mapping )
136 + assert.is_not_nil( v_mapping )
137 + end )
139 + it( 'should return self after adding mode for further chaining', function ()
140 + local result = map.normal
141 + assert.equals( map, result )
142 + result = map.normal.visual
143 + assert.equals( map, result )
144 + end )
146 + it( 'should not duplicate mode when same mode is chained multiple times', function ()
147 + local m = map.normal.normal.normal
148 + local modes = m.modes
149 + local n_count = 0
150 + for _, mode in ipairs( modes ) do
151 + if mode == 'n' then n_count = n_count + 1 end
152 + end
153 + assert.equals( 1, n_count, 'mode "n" should appear exactly once in modes array before bind' )
154 + end )
155 + end )
157 + describe( 'keys handling', function ()
158 + it( 'should accept keys as string', function ()
159 + local deleter = map.normal { keys = '<test-map-keys>', command = 'echo "string keys"' }
160 + assert.is_function( deleter )
161 + local mapping = find_keymap( 'n', '<test-map-keys>' )
162 + assert.is_not_nil( mapping )
163 + assert.equals( '<test-map-keys>', mapping.lhsraw )
164 + end )
166 + it( 'should accept keys as table (array of keys)', function ()
167 + local deleter = map.normal { keys = { '<test-map-keys>', '<test-map-keys-2>' }, command = 'echo "table keys"' }
168 + assert.is_function( deleter )
169 + local mapping1 = find_keymap( 'n', '<test-map-keys>' )
170 + local mapping2 = find_keymap( 'n', '<test-map-keys-2>' )
171 + assert.is_not_nil( mapping1 )
172 + assert.is_not_nil( mapping2 )
173 + assert.equals( '<test-map-keys>', mapping1.lhsraw )
174 + assert.equals( '<test-map-keys-2>', mapping2.lhsraw )
175 + end )
176 + end )
178 + describe( 'command handling', function ()
179 + it( 'should accept command as string', function ()
180 + local deleter = map.normal { keys = '<test-map-keys>', command = 'echo "string command"' }
181 + assert.is_function( deleter )
182 + local mapping = find_keymap( 'n', '<test-map-keys>' )
183 + assert.is_not_nil( mapping )
184 + assert.equals( 'echo "string command"', mapping.rhs )
185 + end )
187 + it( 'should accept command as function', function ()
188 + local called = false
189 + local function test_func()
190 + called = true
191 + end
192 + local deleter = map.normal { keys = '<test-map-keys>', command = test_func }
193 + assert.is_function( deleter )
194 + local mapping = find_keymap( 'n', '<test-map-keys>' )
195 + assert.is_not_nil( mapping )
196 + assert.is_function( mapping.callback )
197 + mapping.callback()
198 + assert.is_true( called )
199 + end )
200 + end )
202 + describe( 'options handling', function ()
203 + it( 'should set silent=true by default', function ()
204 + local deleter = map.normal { keys = '<test-map-keys>', command = 'echo "silent"' }
205 + assert.is_function( deleter )
206 + local mapping = find_keymap( 'n', '<test-map-keys>' )
207 + assert.is_not_nil( mapping )
208 + assert.is_true( mapping.silent == 1 or mapping.silent == true )
209 + end )
211 + it( 'should concatenate category and description into desc', function ()
212 + local deleter = map.normal {
213 + keys = '<test-map-keys>',
214 + command = 'echo "desc"',
215 + category = 'TestCategory',
216 + description = 'TestDescription',
218 + assert.is_function( deleter )
219 + local mapping = find_keymap( 'n', '<test-map-keys>' )
220 + assert.is_not_nil( mapping )
221 + assert.equals( 'TestCategory: TestDescription', mapping.desc )
222 + end )
224 + it( 'should use description alone when category is not present', function ()
225 + local deleter = map.normal {
226 + keys = '<test-map-keys>',
227 + command = 'echo "desc"',
228 + description = 'JustDescription',
230 + assert.is_function( deleter )
231 + local mapping = find_keymap( 'n', '<test-map-keys>' )
232 + assert.is_not_nil( mapping )
233 + assert.equals( 'JustDescription', mapping.desc )
234 + end )
236 + it( 'should support buffer option for buffer-local keymap', function ()
237 + vim.api.nvim_buf_set_lines( 0, 0, -1, true, { 'buffer test content' } )
238 + local deleter = map.normal {
239 + keys = '<test-map-keys>',
240 + command = 'echo "buffer"',
241 + buffer = 0,
243 + assert.is_function( deleter )
244 + local keymaps = vim.api.nvim_buf_get_keymap( 0, 'n' )
245 + local found = false
246 + for _, km in ipairs( keymaps ) do
247 + if km.lhsraw == '<test-map-keys>' then
248 + found = true
249 + break
250 + end
251 + end
252 + assert.is_true( found )
253 + end )
255 + it( 'should merge options field with defaults', function ()
256 + local deleter = map.normal {
257 + keys = '<test-map-keys>',
258 + command = 'echo "merged"',
259 + options = {
260 + noremap = true,
261 + },
263 + assert.is_function( deleter )
264 + local mapping = find_keymap( 'n', '<test-map-keys>' )
265 + assert.is_not_nil( mapping )
266 + assert.is_true( mapping.noremap == 1 or mapping.noremap == true )
267 + end )
269 + it( 'should support remap option', function ()
270 + local deleter = map.normal {
271 + keys = '<test-map-keys>',
272 + command = 'echo "remap"',
273 + remap = true,
275 + assert.is_function( deleter )
276 + local mapping = find_keymap( 'n', '<test-map-keys>' )
277 + assert.is_not_nil( mapping )
278 + end )
279 + end )
281 + describe( 'cleanup function', function ()
282 + it( 'should return a cleanup function (deleter)', function ()
283 + local deleter = map.normal { keys = '<test-map-keys>', command = 'echo "delete"' }
284 + assert.is_function( deleter )
285 + local mapping_before = find_keymap( 'n', '<test-map-keys>' )
286 + assert.is_not_nil( mapping_before )
287 + deleter()
288 + local mapping_after = find_keymap( 'n', '<test-map-keys>' )
289 + assert.is_nil( mapping_after )
290 + end )
292 + it( 'should delete multiple keys when keys is a table', function ()
293 + local deleter = map.normal {
294 + keys = { '<test-map-keys>', '<test-map-keys-2>' },
295 + command = 'echo "delete multiple"',
297 + local mapping1_before = find_keymap( 'n', '<test-map-keys>' )
298 + local mapping2_before = find_keymap( 'n', '<test-map-keys-2>' )
299 + assert.is_not_nil( mapping1_before )
300 + assert.is_not_nil( mapping2_before )
301 + deleter()
302 + local mapping1_after = find_keymap( 'n', '<test-map-keys>' )
303 + local mapping2_after = find_keymap( 'n', '<test-map-keys-2>' )
304 + assert.is_nil( mapping1_after )
305 + assert.is_nil( mapping2_after )
306 + end )
308 + it( 'should delete buffer-local keymaps correctly', function ()
309 + vim.api.nvim_buf_set_lines( 0, 0, -1, true, { 'buffer test content' } )
310 + local deleter = map.normal {
311 + keys = '<test-map-keys>',
312 + command = 'echo "buffer delete"',
313 + buffer = 0,
315 + local keymaps_before = vim.api.nvim_buf_get_keymap( 0, 'n' )
316 + local found_before = false
317 + for _, km in ipairs( keymaps_before ) do
318 + if km.lhsraw == '<test-map-keys>' then
319 + found_before = true
320 + break
321 + end
322 + end
323 + assert.is_true( found_before, 'keymap should exist before deletion' )
324 + deleter()
325 + local keymaps_after = vim.api.nvim_buf_get_keymap( 0, 'n' )
326 + local found_after = false
327 + for _, km in ipairs( keymaps_after ) do
328 + if km.lhsraw == '<test-map-keys>' then
329 + found_after = true
330 + break
331 + end
332 + end
333 + assert.is_false( found_after, 'keymap should be deleted after calling deleter' )
334 + end )
335 + end )
337 + describe( 'default modes', function ()
338 + it( 'should use normal_visual_select_operator_pending when no modes specified', function ()
339 + local deleter = map { keys = '<test-map-keys>', command = 'echo "default modes"' }
340 + assert.is_function( deleter )
341 + local n_mapping = find_keymap( 'n', '<test-map-keys>' )
342 + local x_mapping = find_keymap( 'x', '<test-map-keys>' )
343 + local v_mapping = find_keymap( 'v', '<test-map-keys>' )
344 + local o_mapping = find_keymap( 'o', '<test-map-keys>' )
345 + assert.is_not_nil( n_mapping )
346 + assert.is_not_nil( x_mapping )
347 + assert.is_not_nil( v_mapping )
348 + assert.is_not_nil( o_mapping )
349 + end )
350 + end )
352 + describe( 'error handling', function ()
353 + it( 'should error on unknown mode', function ()
354 + assert.has_error( function ()
355 + map.unknown_mode { keys = '<test-map-keys>', command = 'echo "error"' }
356 + end, 'unknown keymap mode requested: unknown_mode' )
357 + end )
359 + it( 'should error when map.keys is not string or table', function ()
360 + local ok, err = pcall( function () map.normal { keys = 123, command = 'echo "error"' } end )
361 + assert.is_false( ok )
362 + assert.is_not_nil( vim.split( err, '\n' )[1]:match 'map.keys: expected' )
363 + end )
365 + it( 'should error when map.command is not function or string', function ()
366 + local ok, err = pcall( function () map.normal { keys = '<test-map-keys>', command = nil } end )
367 + assert.is_false( ok )
368 + assert.is_not_nil( vim.split( err, '\n' )[1]:match 'map.command: expected' )
369 + end )
371 + it( 'should error when map is not a table', function ()
372 + local ok, err = pcall( function () map( 123 ) end )
373 + assert.is_false( ok )
374 + assert.is_not_nil( vim.split( err, '\n' )[1]:match 'map: expected' )
375 + end )
377 + it( 'should error on assignment to map', function ()
378 + local ok, err = pcall( function () map.foo = 'bar' end )
379 + assert.is_false( ok )
380 + assert.is_not_nil( err:match 'Assignments are not supported for std.map' )
381 + end )
382 + end )
383 +end )

neovim/tests/std/prequire_spec.lua

Added
new file mode 100644
1 +local prequire = require('std.prequire')
3 +describe('std.prequire', function()
4 + before_each(function()
5 + package.loaded['std.prequire'] = nil
6 + prequire = require('std.prequire')
7 + end)
9 + describe('loading existing modules', function()
10 + it('should return the actual module for existing modules', function()
11 + local result = prequire('std.const')
12 + assert.is_table(result)
13 + assert.is_string(result.os_background)
14 + end)
16 + it('should return the first successfully loaded module as first_mod', function()
17 + local result = prequire('std.const', 'std.map')
18 + assert.is_table(result)
19 + assert.equals('table', type(result))
20 + end)
22 + it('should handle multiple existing modules', function()
23 + local modules = nil
24 + prequire('std.const', 'std.map', function(const, map)
25 + modules = { const, map }
26 + end)
27 + assert.is_table(modules)
28 + assert.is_table(modules[1])
29 + assert.is_table(modules[2])
30 + end)
31 + end)
33 + describe('loading missing modules', function()
34 + it('should return a proxy for missing modules', function()
35 + local result = prequire('this_module_does_not_exist_12345')
36 + assert.is_table(result)
37 + end)
39 + it('should not crash when calling on proxy (__call returns self)', function()
40 + local proxy = prequire('missing_module_12345')
41 + local call_result = proxy()
42 + assert.equals(proxy, call_result)
43 + end)
45 + it('should not crash when indexing on proxy (__index returns self)', function()
46 + local proxy = prequire('missing_module_12345')
47 + local result = proxy.foo
48 + assert.equals(proxy, result)
49 + local nested = proxy.foo.bar.baz
50 + assert.equals(proxy, nested)
51 + end)
53 + it('should return recursive proxy for nested access', function()
54 + local proxy = prequire('missing_module_67890')
55 + assert.equals(proxy, proxy.foo)
56 + assert.equals(proxy, proxy.foo.bar)
57 + assert.equals(proxy, proxy.foo.bar.baz.qux)
58 + end)
59 + end)
61 + describe('proxy_cache memoization', function()
62 + it('should return the same proxy on repeated calls for same missing module', function()
63 + local proxy1 = prequire('missing_module_same_123')
64 + local proxy2 = prequire('missing_module_same_123')
65 + assert.equals(proxy1, proxy2)
66 + end)
68 + it('should return different proxies for different missing modules', function()
69 + local proxy1 = prequire('missing_module_a_123')
70 + local proxy2 = prequire('missing_module_b_456')
71 + assert.is_not_nil(proxy1)
72 + assert.is_not_nil(proxy2)
73 + assert.is_not.equals(proxy1, proxy2)
74 + end)
75 + end)
77 + describe('callback behavior', function()
78 + it('should call callback with loaded modules in order', function()
79 + local received = nil
80 + prequire('std.const', 'std.map', function(const, map)
81 + received = { const = const, map = map }
82 + end)
83 + assert.is_table(received.const)
84 + assert.is_table(received.map)
85 + end)
87 + it('should NOT call callback when module is missing - returns proxy instead', function()
88 + -- When any module fails to load, callback is not called; proxy is returned
89 + local received = 'not_called'
90 + local result = prequire('missing_for_callback', function(missing)
91 + received = missing
92 + end)
93 + -- Callback was not called because module is missing
94 + assert.equals('not_called', received)
95 + -- But we got a proxy back
96 + assert.is_table(result)
97 + assert.equals(result, result.anything)
98 + end)
100 + it('should call callback only when ALL modules load successfully', function()
101 + -- callback is only called when no modules fail
102 + local called_with_args = nil
103 + prequire('std.const', function(const)
104 + called_with_args = { const }
105 + end)
106 + assert.is_table(called_with_args)
107 + assert.is_table(called_with_args[1])
108 + end)
110 + it('should pass all loaded modules before callback', function()
111 + local received_args = nil
112 + prequire('std.const', 'std.map', 'std.table', function(...)
113 + received_args = { ... }
114 + end)
115 + assert.equals(3, #received_args)
116 + end)
118 + it('should handle mixed existing and missing - callback NOT called', function()
119 + -- When there's a missing module, callback is skipped and proxy is returned
120 + local received = 'not_called'
121 + local result = prequire('std.const', 'missing_mod_xyz', function(const, missing)
122 + received = { const = const, missing = missing }
123 + end)
124 + assert.equals('not_called', received)
125 + -- Result is the proxy for the missing module
126 + assert.is_table(result)
127 + end)
128 + end)
130 + describe('return value behavior', function()
131 + it('should return first_mod when module loads successfully', function()
132 + local result = prequire('std.const')
133 + assert.is_table(result)
134 + assert.is_string(result.os_background)
135 + end)
137 + it('should return proxy when module fails to load', function()
138 + local result = prequire('definitely_missing_module_xyz')
139 + assert.is_table(result)
140 + assert.equals(result, result.anyfield)
141 + end)
142 + end)
144 + describe('error notification', function()
145 + it('should call vim.notify_once for missing modules', function()
146 + local notify_called = false
147 + local original_notify_once = vim.notify_once
148 + vim.notify_once = function(msg, level)
149 + notify_called = true
150 + return original_notify_once(msg, level)
151 + end
153 + prequire('missing_notify_module')
155 + vim.notify_once = original_notify_once
156 + assert.is_true(notify_called)
157 + end)
158 + end)
160 + describe('stack trace printing', function()
161 + it('should not crash when printing stack trace for missing modules', function()
162 + -- This is harder to test directly, but we can verify it doesn't crash
163 + local result = prequire('missing_trace_module')
164 + assert.is_table(result)
165 + end)
166 + end)
168 + describe('integration with std modules', function()
169 + it('should successfully load std.map', function()
170 + local map_mod = prequire('std.map')
171 + assert.is_table(map_mod)
172 + end)
174 + it('should successfully load std.user_command', function()
175 + local uc_mod = prequire('std.user_command')
176 + assert.is_table(uc_mod)
177 + end)
179 + it('should successfully load std.table module', function()
180 + local table_mod = prequire('std.table')
181 + assert.is_table(table_mod)
182 + end)
184 + it('should successfully load std.table.join function', function()
185 + local join_func = prequire('std.table.join')
186 + assert.is_function(join_func)
187 + end)
188 + end)
190 + describe('edge cases', function()
191 + it('should handle empty string module name', function()
192 + local result = pcall(function()
193 + return prequire('')
194 + end)
195 + assert.is_true(result)
196 + end)
198 + it('should handle callback as only argument', function()
199 + local called = false
200 + local result = prequire(function()
201 + called = true
202 + end)
203 + assert.is_true(called)
204 + end)
205 + end)
206 +end)

neovim/tests/std/project_spec.lua

Modified
366 366 vim.fn.delete(root2, 'rf')
370 + describe('_select_best_root (pure scoring)', function()
371 + local select_best_root
373 + before_each(function()
374 + select_best_root = project._select_best_root
375 + end)
377 + it('returns nil for empty directory_scores', function()
378 + local result = select_best_root({})
379 + assert.is_nil(result)
380 + end)
382 + it('returns the only scored directory', function()
383 + local scores = {
384 + { path = '/project', marker_count = 3, distance_to_buffer_file = 2 },
386 + local result = select_best_root(scores)
387 + assert.equals('/project', result)
388 + end)
390 + it('prefers higher likelihood (marker_count * 1/distance)', function()
391 + local scores = {
392 + { path = '/far', marker_count = 6, distance_to_buffer_file = 3 },
393 + { path = '/close', marker_count = 3, distance_to_buffer_file = 1 },
395 + -- /far: 6 * (1/3) = 2
396 + -- /close: 3 * (1/1) = 3 -> wins
397 + local result = select_best_root(scores)
398 + assert.equals('/close', result)
399 + end)
401 + it('DEFINITELY (7) at root beats LIKELY (3) close', function()
402 + local scores = {
403 + { path = '/project', marker_count = 7, distance_to_buffer_file = 3 },
404 + { path = '/project/sub', marker_count = 3, distance_to_buffer_file = 1 },
406 + -- /project: 7 * (1/3) = 2.33
407 + -- /project/sub: 3 * (1/1) = 3 -> wins without DEFINITELY bonus
408 + -- But if we adjust to make DEFINITELY win:
409 + local scores2 = {
410 + { path = '/project', marker_count = 7, distance_to_buffer_file = 2 },
411 + { path = '/project/sub', marker_count = 6, distance_to_buffer_file = 1 },
413 + -- /project: 7 * (1/2) = 3.5
414 + -- /project/sub: 6 * (1/1) = 6 -> still wins
415 + -- So DEFINITELY needs closer distance to win:
416 + local scores3 = {
417 + { path = '/project', marker_count = 7, distance_to_buffer_file = 1 },
418 + { path = '/project/sub', marker_count = 6, distance_to_buffer_file = 2 },
420 + -- /project: 7 * 1 = 7
421 + -- /project/sub: 6 * 0.5 = 3 -> /project wins
422 + local result = select_best_root(scores3)
423 + assert.equals('/project', result)
424 + end)
426 + it('multiple LIKELY (3) close beats single DEFINITELY (7) far', function()
427 + local scores = {
428 + { path = '/project', marker_count = 7, distance_to_buffer_file = 4 },
429 + { path = '/project/sub', marker_count = 6, distance_to_buffer_file = 1 },
431 + -- /project: 7 * 0.25 = 1.75
432 + -- /project/sub: 6 * 1 = 6 -> sub wins
433 + local result = select_best_root(scores)
434 + assert.equals('/project/sub', result)
435 + end)
437 + it('equal likelihood picks first (closest to root in traversal order)', function()
438 + local scores = {
439 + { path = '/first', marker_count = 3, distance_to_buffer_file = 1 },
440 + { path = '/second', marker_count = 3, distance_to_buffer_file = 1 },
442 + -- Equal likelihood, first in traversal order wins
443 + local result = select_best_root(scores)
444 + assert.equals('/first', result)
445 + end)
447 + it('marker_count 0 at any distance produces 0 likelihood', function()
448 + local scores = {
449 + { path = '/zero', marker_count = 0, distance_to_buffer_file = 1 },
450 + { path = '/has_markers', marker_count = 3, distance_to_buffer_file = 3 },
452 + -- /zero: 0 * 1 = 0
453 + -- /has_markers: 3 * 0.33 = 1 -> wins
454 + local result = select_best_root(scores)
455 + assert.equals('/has_markers', result)
456 + end)
458 + it('distance 1 (closest possible) maximizes score multiplier', function()
459 + local scores = {
460 + { path = '/root', marker_count = 3, distance_to_buffer_file = 1 },
461 + { path = '/deep', marker_count = 3, distance_to_buffer_file = 5 },
463 + -- /root: 3 * 1 = 3
464 + -- /deep: 3 * 0.2 = 0.6 -> /root wins
465 + local result = select_best_root(scores)
466 + assert.equals('/root', result)
467 + end)
469 + it('handles very large marker counts', function()
470 + local scores = {
471 + { path = '/project', marker_count = 100, distance_to_buffer_file = 10 },
472 + { path = '/project/sub', marker_count = 99, distance_to_buffer_file = 1 },
474 + -- /project: 100 * 0.1 = 10
475 + -- /project/sub: 99 * 1 = 99 -> sub wins
476 + local result = select_best_root(scores)
477 + assert.equals('/project/sub', result)
478 + end)
480 + it('handles fractional likelihood from large distance', function()
481 + local scores = {
482 + { path = '/project', marker_count = 7, distance_to_buffer_file = 100 },
483 + { path = '/project/sub', marker_count = 1, distance_to_buffer_file = 1 },
485 + -- /project: 7 * 0.01 = 0.07
486 + -- /project/sub: 1 * 1 = 1 -> sub wins easily
487 + local result = select_best_root(scores)
488 + assert.equals('/project/sub', result)
489 + end)
490 + end)

neovim/tests/std/user_command_spec.lua

Added
new file mode 100644
1 +local user_command = require('std.user_command')
3 +describe('std.user_command', function()
4 + before_each(function()
5 + package.loaded['std.user_command'] = nil
6 + user_command = require('std.user_command')
7 + end)
9 + after_each(function()
10 + pcall(vim.api.nvim_del_user_command, 'TestCommand')
11 + pcall(vim.api.nvim_del_user_command, 'AnotherCommand')
12 + pcall(vim.api.nvim_del_user_command, 'NoDescCommand')
13 + pcall(vim.api.nvim_del_user_command, 'NoOptsCommand')
14 + pcall(vim.api.nvim_del_user_command, 'FullChainCommand')
15 + pcall(vim.api.nvim_buf_del_user_command, 0, 'TestBufCmd')
16 + pcall(vim.api.nvim_buf_del_user_command, 0, 'TestBufCmd2')
17 + pcall(vim.api.nvim_buf_del_user_command, 0, 'AnotherBufCmd')
18 + pcall(vim.api.nvim_buf_del_user_command, 0, 'OptsBufCmd')
19 + pcall(vim.api.nvim_buf_del_user_command, 0, 'ExecBufCmd')
20 + end)
22 + local function get_user_command(name)
23 + local commands = vim.api.nvim_get_commands {}
24 + return commands[name]
25 + end
27 + describe('full chain: name -> description -> options -> command', function()
28 + it('should create a user command with all parameters', function()
29 + local deleter = user_command.FullChainCommand 'A test command' {
30 + nargs = '*',
31 + complete = 'file',
32 + } (function()
33 + return 'executed'
34 + end)
36 + assert.is_function(deleter)
37 + local info = get_user_command('FullChainCommand')
38 + assert.is_not_nil(info)
39 + assert.equals('FullChainCommand', info.name)
40 + assert.equals('*', info.nargs)
41 + assert.equals('file', info.complete)
42 + end)
44 + it('should return a deleter function that removes the command', function()
45 + local deleter = user_command.TestCommand 'Description' { nargs = '?' } (function() end)
46 + assert.is_function(deleter)
47 + local info_before = get_user_command('TestCommand')
48 + assert.is_not_nil(info_before)
49 + deleter()
50 + local info_after = get_user_command('TestCommand')
51 + assert.is_nil(info_after)
52 + end)
53 + end)
55 + describe('chain: name -> description -> command (no options)', function()
56 + it('should create a user command with just description and command', function()
57 + local deleter = user_command.TestCommand 'Just a description' (function()
58 + return 'simple'
59 + end)
61 + assert.is_function(deleter)
62 + local info = get_user_command('TestCommand')
63 + assert.is_not_nil(info)
64 + assert.equals('TestCommand', info.name)
65 + end)
66 + end)
68 + describe('command execution', function()
69 + it('should execute the command function when called', function()
70 + local executed = false
71 + local deleter = user_command.TestCommand 'Execute test' (function()
72 + executed = true
73 + return 'done'
74 + end)
76 + vim.cmd('TestCommand')
77 + assert.is_true(executed)
78 + end)
79 + end)
81 + describe('error handling', function()
82 + it('should error on invalid command_name (non-string)', function()
83 + local ok, err = pcall(function() return user_command[123] end)
84 + assert.is_false(ok)
85 + assert.is_not_nil(err:match('command_name: expected string'))
86 + end)
88 + it('should error on invalid description (non-string)', function()
89 + local desc_stage = user_command.TestCommand
90 + local ok, err = pcall(function() return desc_stage(123) end)
91 + assert.is_false(ok)
92 + assert.is_not_nil(err:match('description: expected string'))
93 + end)
95 + it('should error on invalid command (non-function when expected)', function()
96 + local ok, err = pcall(function() return user_command.TestCommand('description')({ nargs = '?' })(123) end)
97 + assert.is_false(ok)
98 + assert.is_not_nil(err:match('command: expected function'))
99 + end)
101 + it('should error on invalid options_or_command (non-table and non-function)', function()
102 + local ok, err = pcall(function() return user_command.TestCommand('description')(123) end)
103 + assert.is_false(ok)
104 + assert.is_not_nil(err:match('options_or_command: expected'))
105 + end)
106 + end)
108 + describe('metatable chaining behavior', function()
109 + it('should return DESCRIPTION_SETTER metatable after setting name', function()
110 + local mt = getmetatable(user_command.TestCommand)
111 + assert.is_function(mt.__call)
112 + end)
114 + it('should return OPTIONS_OR_COMMAND_SETTER metatable after setting description', function()
115 + local desc_stage = user_command.TestCommand 'description'
116 + local mt = getmetatable(desc_stage)
117 + assert.is_function(mt.__call)
118 + end)
120 + it('should return COMMAND_SETTER metatable after setting options', function()
121 + local opts_stage = user_command.TestCommand 'description' { nargs = '?' }
122 + local mt = getmetatable(opts_stage)
123 + assert.is_function(mt.__call)
124 + end)
126 + it('should return deleter function after setting command', function()
127 + local result = user_command.TestCommand 'description' (function() end)
128 + assert.is_function(result)
129 + end)
130 + end)
132 + describe('options merging', function()
133 + it('should create command with correct options', function()
134 + local deleter = user_command.TestCommand 'My description' (function() end)
135 + local info = get_user_command('TestCommand')
136 + assert.is_not_nil(info)
137 + end)
139 + it('should allow custom options to override defaults', function()
140 + local deleter = user_command.TestCommand 'Custom desc' {
141 + nargs = '*',
142 + bang = true,
143 + } (function() end)
145 + local info = get_user_command('TestCommand')
146 + assert.is_not_nil(info)
147 + assert.equals('*', info.nargs)
148 + assert.is_true(info.bang == 1 or info.bang == true)
149 + end)
150 + end)
152 + describe('multiple commands', function()
153 + it('should create multiple independent commands', function()
154 + local deleter1 = user_command.TestCommand 'First' (function() end)
155 + local deleter2 = user_command.AnotherCommand 'Second' (function() end)
157 + local info1 = get_user_command('TestCommand')
158 + local info2 = get_user_command('AnotherCommand')
159 + assert.is_not_nil(info1)
160 + assert.is_not_nil(info2)
161 + assert.equals('TestCommand', info1.name)
162 + assert.equals('AnotherCommand', info2.name)
164 + deleter1()
165 + deleter2()
166 + local after1 = get_user_command('TestCommand')
167 + local after2 = get_user_command('AnotherCommand')
168 + assert.is_nil(after1)
169 + assert.is_nil(after2)
170 + end)
171 + end)
173 + describe('buffer commands', function()
174 + local function get_buf_commands(bufnr)
175 + return vim.api.nvim_buf_get_commands(bufnr, {})
176 + end
178 + it('should create a buffer-local command', function()
179 + local deleter = user_command.buffer(0).TestBufCmd 'A buffer command' (function() end)
180 + local buf_cmds = get_buf_commands(0)
181 + assert.is_not_nil(buf_cmds['TestBufCmd'])
182 + end)
184 + it('should NOT appear in global command namespace', function()
185 + local deleter = user_command.buffer(0).TestBufCmd 'A buffer command' (function() end)
186 + local global_cmds = vim.api.nvim_get_commands {}
187 + assert.is_nil(global_cmds['TestBufCmd'])
188 + end)
190 + it('should appear in buffer-local command namespace', function()
191 + local deleter = user_command.buffer(0).TestBufCmd 'A buffer command' (function() end)
192 + local buf_cmds = get_buf_commands(0)
193 + assert.is_table(buf_cmds['TestBufCmd'])
194 + assert.equals('TestBufCmd', buf_cmds['TestBufCmd'].name)
195 + end)
197 + it('should return a deleter that removes the buffer command', function()
198 + local deleter = user_command.buffer(0).TestBufCmd 'To be deleted' (function() end)
199 + local buf_cmds_before = get_buf_commands(0)
200 + assert.is_not_nil(buf_cmds_before['TestBufCmd'])
201 + deleter()
202 + local buf_cmds_after = get_buf_commands(0)
203 + assert.is_nil(buf_cmds_after['TestBufCmd'])
204 + end)
206 + it('should create multiple independent buffer commands', function()
207 + local deleter1 = user_command.buffer(0).TestBufCmd 'First' (function() end)
208 + local deleter2 = user_command.buffer(0).TestBufCmd2 'Second' (function() end)
209 + local buf_cmds = get_buf_commands(0)
210 + assert.is_not_nil(buf_cmds['TestBufCmd'])
211 + assert.is_not_nil(buf_cmds['TestBufCmd2'])
212 + deleter1()
213 + deleter2()
214 + local buf_cmds_after = get_buf_commands(0)
215 + assert.is_nil(buf_cmds_after['TestBufCmd'])
216 + assert.is_nil(buf_cmds_after['TestBufCmd2'])
217 + end)
219 + it('should error on invalid buffer argument', function()
220 + local ok = pcall(function() return user_command.buffer('not_a_number') end)
221 + assert.is_false(ok)
222 + end)
224 + it('should accept an options table before command', function()
225 + local deleter = user_command.buffer(0).OptsBufCmd 'With options' {
226 + nargs = '*',
227 + bang = true,
228 + } (function() end)
229 + local buf_cmds = get_buf_commands(0)
230 + assert.is_not_nil(buf_cmds['OptsBufCmd'])
231 + assert.equals('*', buf_cmds['OptsBufCmd'].nargs)
232 + deleter()
233 + end)
235 + it('should execute the command function when called', function()
236 + local executed = false
237 + local deleter = user_command.buffer(0).ExecBufCmd 'Execute test' (function()
238 + executed = true
239 + end)
240 + vim.cmd('ExecBufCmd')
241 + assert.is_true(executed)
242 + deleter()
243 + end)
245 + it('should pass opts to command function', function()
246 + local received_opts = nil
247 + local deleter = user_command.buffer(0).TestBufCmd 'Opts test' (function(opts)
248 + received_opts = opts
249 + end)
250 + vim.cmd('TestBufCmd')
251 + assert.is_table(received_opts)
252 + assert.equals('TestBufCmd', received_opts.name)
253 + deleter()
254 + end)
256 + it('should be scoped to the specified buffer only', function()
257 + local bufnr1 = vim.api.nvim_create_buf(false, true)
258 + local bufnr2 = vim.api.nvim_create_buf(false, true)
259 + local deleter1 = user_command.buffer(bufnr1).TestBufCmd 'On buffer 1' (function() end)
260 + local deleter2 = user_command.buffer(bufnr2).AnotherBufCmd 'On buffer 2' (function() end)
261 + local cmds1 = get_buf_commands(bufnr1)
262 + local cmds2 = get_buf_commands(bufnr2)
263 + assert.is_not_nil(cmds1['TestBufCmd'])
264 + assert.is_nil(cmds1['AnotherBufCmd'])
265 + assert.is_not_nil(cmds2['AnotherBufCmd'])
266 + assert.is_nil(cmds2['TestBufCmd'])
267 + deleter1()
268 + deleter2()
269 + vim.api.nvim_buf_delete(bufnr1, { force = true })
270 + vim.api.nvim_buf_delete(bufnr2, { force = true })
271 + end)
272 + end)
273 +end)

niri/cfg/animation.kdl

Added
new file mode 100644
1 + animations {
2 + workspace-switch {
3 + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001
4 + }
5 + window-open {
6 + duration-ms 200
7 + curve "ease-out-quad"
8 + }
9 + window-close {
10 + duration-ms 200
11 + curve "ease-out-cubic"
12 + }
13 + horizontal-view-movement {
14 + spring damping-ratio=1.0 stiffness=900 epsilon=0.0001
15 + }
16 + window-movement {
17 + spring damping-ratio=1.0 stiffness=800 epsilon=0.0001
18 + }
19 + window-resize {
20 + spring damping-ratio=1.0 stiffness=1000 epsilon=0.0001
21 + }
22 + config-notification-open-close {
23 + spring damping-ratio=0.6 stiffness=1200 epsilon=0.001
24 + }
25 + screenshot-ui-open {
26 + duration-ms 300
27 + curve "ease-out-quad"
28 + }
29 + overview-open-close {
30 + spring damping-ratio=1.0 stiffness=900 epsilon=0.0001
31 + }
32 + }

niri/cfg/autostart.kdl

Added
new file mode 100644
1 +// ────────────── Startup Applications ──────────────
2 +// https://github.com/YaLTeR/niri/wiki/Configuration:-Miscellaneous#spawn-sh-at-startup
4 + spawn-sh-at-startup "qs -c noctalia-shell"
5 + spawn-at-startup "firefox"
6 + spawn-at-startup "wezterm"
7 + spawn-at-startup "bitwarden-desktop"

niri/cfg/cursor.kdl

Added
new file mode 100644
1 +cursor {
2 + xcursor-size 48
4 + hide-when-typing
5 + hide-after-inactive-ms 5000
7 + // Available xcursor-theme values:
8 + // xcursor-theme "capitaine-cursors"
9 + // xcursor-theme "Adwaita"
10 + // xcursor-theme "Pop"
11 + // xcursor-theme "Numix-Cursor"
12 + // xcursor-theme "capitaine-cursors"
13 + // xcursor-theme "capitaine-cursors-light"
14 + xcursor-theme "phinger-cursors-dark"
15 + // xcursor-theme "phinger-cursors-dark-left"
16 + // xcursor-theme "phinger-cursors-light"
17 + // xcursor-theme "phinger-cursors-light-left"
18 + // xcursor-theme "catppuccin-mocha-blue-cursors"
19 + // xcursor-theme "catppuccin-mocha-dark-cursors"
20 + // xcursor-theme "catppuccin-mocha-flamingo-cursors"
21 + // xcursor-theme "catppuccin-mocha-green-cursors"
22 + // xcursor-theme "catppuccin-mocha-lavender-cursors"
23 + // xcursor-theme "catppuccin-mocha-light-cursors"
24 + // xcursor-theme "catppuccin-mocha-maroon-cursors"
25 + // xcursor-theme "catppuccin-mocha-mauve-cursors"
26 + // xcursor-theme "catppuccin-mocha-peach-cursors"
27 + // xcursor-theme "catppuccin-mocha-pink-cursors"
28 + // xcursor-theme "catppuccin-mocha-red-cursors"
29 + // xcursor-theme "catppuccin-mocha-rosewater-cursors"
30 + // xcursor-theme "catppuccin-mocha-sapphire-cursors"
31 + // xcursor-theme "catppuccin-mocha-sky-cursors"
32 + // xcursor-theme "catppuccin-mocha-teal-cursors"
33 + // xcursor-theme "catppuccin-mocha-yellow-cursors"

niri/cfg/display.kdl

Added
new file mode 100644
1 +// ────────────── Output Configuration ──────────────
2 +// You can run `niri msg outputs` to get the correct name for your displays.
3 +// You will have to remove "/-" and edit it before it takes effect.
4 +// https://github.com/YaLTeR/niri/wiki/Configuration:-Outputs
6 +output "DP-1" {
7 + mode "2560x1440@143.995"
8 + variable-refresh-rate on-demand=true
9 + scale 1
12 +output "DP-2" {
13 + mode "2560x1440@143.995"
14 + variable-refresh-rate on-demand=true
15 + scale 1

niri/cfg/input.kdl

Added
new file mode 100644
1 +// ────────────── Input Configuration ──────────────
2 +// https://github.com/YaLTeR/niri/wiki/Configuration:-Input
4 +input {
5 + keyboard {
6 + xkb {
7 + //If you want to overwrite your keyboard layout,
8 + // uncomment the line below and change the layout accordingly.
9 + //layout "us" // Use the American keyboard layout
10 + layout "us"
11 + variant "altgr-intl"
12 + options "caps:none"
14 + }
15 + numlock // Enable numlock on startup
16 + }
18 + touchpad {
19 + tap // Enable tap-to-click
20 + natural-scroll // Enable natural (macOS-style) scrolling
21 + }
23 + mouse {
24 + // If you want to disable Mouse Acceleration,
25 + // uncomment the lines below.
26 + natural-scroll
27 + accel-profile "flat"
28 + accel-speed 0.5
29 + }
31 + workspace-auto-back-and-forth // Enable workspace back & forth switching

niri/cfg/keybinds.kdl

Added
new file mode 100644
1 +binds {
3 + // ────────────── Keybindings ──────────────
4 + // https://github.com/YaLTeR/niri/wiki/Configuration:-Key-Bindings
6 + // ─── noctalia-shell keybinds ───
7 + // https://docs.noctalia.dev/getting-started/keybinds/
9 + Mod+Shift+ESCAPE { show-hotkey-overlay; }
11 + // ─── Applications ───
12 + Mod+Return hotkey-overlay-title="Open a Terminal: Wezterm" { spawn "wezterm" "start" "--always-new-process"; }
13 + Mod+CTRL+Return hotkey-overlay-title="Open App Launcher: noctalia launcher" { spawn-sh "qs -c noctalia-shell ipc call launcher toggle"; }
14 + Mod+B hotkey-overlay-title="Open Browser: firefox" { spawn "firefox"; }
15 + Mod+ALT+L hotkey-overlay-title="Lock Screen: noctalia lock" { spawn-sh "qs -c noctalia-shell ipc call lockScreen lock"; }
16 + Mod+Shift+Q hotkey-overlay-title="Session Menu: noctalia sessionMenu" { spawn-sh "qs -c noctalia-shell ipc call sessionMenu toggle"; }
17 + Mod+TAB hotkey-overlay-title="Niri: Cycle right window" { spawn "sh" "-c" "niri msg action focus-column-right; niri msg action move-column-to-last; niri msg action focus-window-previous"; }
19 + CTRL+grave repeat=false hotkey-overlay-title="Handy: Toggle Transcription" { spawn "pkill" "-USR2" "-x" "handy"; }
20 + // seems to crash handy for now
21 + // CTRL+SHIFT+grave repeat=false hotkey-overlay-title="Handy: Toggle Post Process" { spawn "pkill" "-USR1" "-x" "handy"; }
23 + Mod+E hotkey-overlay-title="File Manager: Yazi" { spawn "wezterm" "start" "--always-new-process" "--" "yazi"; }
25 + // ─── Media Controls ───
26 + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call volume increase"; }
27 + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call volume decrease"; }
28 + XF86AudioMute allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call volume muteOutput"; }
29 + XF86AudioMicMute allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call volume muteInput"; }
30 + XF86AudioNext allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call media next"; }
31 + XF86AudioPrev allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call media previous"; }
32 + XF86AudioPlay allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call media playPause"; }
33 + XF86AudioPause allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call media playPause"; }
35 + // ─── Brightness Controls ───
36 + XF86MonBrightnessUp allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call brightness increase"; }
37 + XF86MonBrightnessDown allow-when-locked=true { spawn-sh "qs -c noctalia-shell ipc call brightness decrease"; }
39 + // ─── Window Movement and Focus ───
40 + Mod+Q { close-window; }
42 + Mod+Left { focus-column-left; }
43 + Mod+H { focus-column-left; }
44 + Mod+Right { focus-column-right; }
45 + Mod+L { focus-column-right; }
46 + Mod+Up { focus-window-up; }
47 + Mod+K { focus-window-up; }
48 + Mod+Down { focus-window-down; }
49 + Mod+J { focus-window-down; }
51 + Mod+CTRL+Left { move-column-left; }
52 + Mod+CTRL+H { move-column-left; }
53 + Mod+CTRL+Right { move-column-right; }
54 + Mod+CTRL+L { move-column-right; }
55 + Mod+CTRL+UP { move-window-up; }
56 + Mod+CTRL+K { move-window-up; }
57 + Mod+CTRL+Down { move-window-down; }
58 + Mod+CTRL+J { move-window-down; }
60 + Mod+Home { focus-column-first; }
61 + Mod+End { focus-column-last; }
62 + Mod+CTRL+Home { move-column-to-first; }
63 + Mod+CTRL+End { move-column-to-last; }
65 + Mod+Shift+Left { focus-monitor-left; }
66 + Mod+Shift+Right { focus-monitor-right; }
67 + Mod+Shift+UP { focus-monitor-up; }
68 + Mod+Shift+Down { focus-monitor-down; }
70 + Mod+Shift+CTRL+Left { move-column-to-monitor-left; }
71 + Mod+Shift+CTRL+Right { move-column-to-monitor-right; }
72 + Mod+Shift+CTRL+UP { move-column-to-monitor-up; }
73 + Mod+Shift+CTRL+Down { move-column-to-monitor-down; }
75 + // ─── Workspace Switching ───
76 + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
77 + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
78 + Mod+CTRL+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
79 + Mod+CTRL+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
81 + Mod+WheelScrollRight { focus-column-right; }
82 + Mod+WheelScrollLeft { focus-column-left; }
83 + Mod+CTRL+WheelScrollRight { move-column-right; }
84 + Mod+CTRL+WheelScrollLeft { move-column-left; }
86 + Mod+Shift+WheelScrollDown { focus-column-right; }
87 + Mod+Shift+WheelScrollUp { focus-column-left; }
88 + Mod+CTRL+Shift+WheelScrollDown { move-column-right; }
89 + Mod+CTRL+Shift+WheelScrollUp { move-column-left; }
91 + Mod+1 { focus-workspace "code"; }
92 + Mod+2 { focus-workspace "browser"; }
93 + Mod+3 { focus-workspace "media"; }
94 + Mod+4 { focus-workspace "games"; }
95 + Mod+5 { focus-workspace "vault"; }
97 + Mod+CTRL+1 { move-column-to-workspace "code"; }
98 + Mod+CTRL+2 { move-column-to-workspace "browser"; }
99 + Mod+CTRL+3 { move-column-to-workspace "media"; }
100 + Mod+CTRL+4 { move-column-to-workspace "games"; }
101 + Mod+CTRL+5 { move-column-to-workspace "vault"; }
103 + // ─── Layout Controls ───
104 + Mod+CTRL+F { expand-column-to-available-width; }
105 + Mod+C { center-column; }
106 + Mod+CTRL+C { center-visible-columns; }
107 + Mod+Minus { set-column-width "-10%"; }
108 + Mod+Equal { set-column-width "+10%"; }
109 + Mod+Shift+Minus { set-window-height "-10%"; }
110 + Mod+Shift+Equal { set-window-height "+10%"; }
112 + // ─── Modes ───
113 + Mod+T { toggle-window-floating; }
114 + Mod+F { fullscreen-window; }
115 + Mod+W { toggle-column-tabbed-display; }
117 + // ─── Screenshots ───
118 + CTRL+Shift+1 { screenshot; }
119 + CTRL+Shift+2 { screenshot-screen; }
120 + CTRL+Shift+3 { screenshot-window; }
122 + // ─── Emergency Escape Key ───
123 + // Use this when a fullscreen app blocks your keybinds.
124 + // It disables any active keyboard shortcut inhibitor, restoring control.
125 + Mod+ESCAPE allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
127 + // ─── Exit / Power ───
128 + CTRL+ALT+Delete { quit; } // Also quits Niri
129 + Mod+Shift+P { power-off-monitors; } // Turn off screens (useful for OLED or privacy)
130 + Mod+O repeat=false { toggle-overview; }

niri/cfg/layout.kdl

Added
new file mode 100644
1 + layout {
2 + gaps 16 // Gap between windows
3 + center-focused-column "never" // Don’t auto-center focused column
5 + background-color "transparent" // <- needed for noctalia-shell to set wallpaper
7 + preset-column-widths {
8 + proportion 0.33333
9 + proportion 0.5
10 + proportion 0.66667
11 + }
13 + struts {}
14 + }

niri/cfg/misc.kdl

Added
new file mode 100644
1 + // prefer-no-csd
2 + screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
4 + environment {
5 + ELECTRON_OZONE_PLATFORM_HINT "auto"
6 + QT_QPA_PLATFORM "wayland"
7 + QT_QPA_PLATFORMTHEME "gtk3"
8 + QT_WAYLAND_DISABLE_WINDOWDECORATION "1"
9 + XDG_CURRENT_DESKTOP "niri"
10 + XDG_SESSION_TYPE "wayland"
11 + }
13 + debug {
14 + // Allows notification actions and window activation from Noctalia.
15 + honor-xdg-activation-with-invalid-serial
16 + }
18 + hotkey-overlay {
19 + skip-at-startup
20 + }

niri/cfg/noctalia.kdl

Added
new file mode 100644
1 +layout {
3 + focus-ring {
4 + active-color "#cba6f7"
5 + inactive-color "#1e1e2e"
6 + urgent-color "#f38ba8"
7 + }
9 + border {
10 + active-color "#cba6f7"
11 + inactive-color "#1e1e2e"
12 + urgent-color "#f38ba8"
13 + }
15 + shadow {
16 + color "#11111b70"
17 + }
19 + tab-indicator {
20 + active-color "#cba6f7"
21 + inactive-color "#6b02e9"
22 + urgent-color "#f38ba8"
23 + }
25 + insert-hint {
26 + color "#cba6f780"
27 + }
30 +recent-windows {
31 + highlight {
32 + active-color "#cba6f7"
33 + urgent-color "#f38ba8"
34 + }

niri/cfg/rules.kdl

Added
new file mode 100644
1 +window-rule {
2 + geometry-corner-radius 20
3 + clip-to-geometry true
4 +}
6 +window-rule {
7 + match app-id="org.wezfurlong.wezterm"
8 + open-on-workspace "code"
9 + open-maximized true
12 +window-rule {
13 + match app-id="jetbrains-idea"
14 + open-on-workspace "code"
17 +window-rule {
18 + match app-id="neovide"
19 + open-on-workspace "code"
22 +window-rule {
23 + match app-id="dev.zed.Zed"
24 + open-on-workspace "code"
27 +window-rule {
28 + match app-id="firefox"
29 + open-on-workspace "browser"
30 + open-maximized true
33 +window-rule {
34 + match app-id="firefox" title="Extension: (Bitwarden Password Manager) - Bitwarden — Mozilla Firefox"
35 + open-on-workspace "browser"
36 + open-floating true
39 +window-rule {
40 + match app-id="Bitwarden"
41 + open-on-workspace "vault"
44 +window-rule {
45 + match app-id="mpv"
46 + open-on-workspace "media"
49 +window-rule {
50 + match app-id="steam"
51 + open-on-workspace "games"
54 +window-rule {
55 + match app-id=r#"^steam_app_\d+$"#
56 + open-on-workspace "games"
59 +window-rule {
60 + match app-id="steam_app_default"
61 + open-on-workspace "games"
64 +window-rule {
65 + match app-id="steam" title=r#"^notificationtoasts_\d+_desktop$"#
66 + default-floating-position x=10 y=10 relative-to="bottom-right"
69 +window-rule {
70 + match app-id="net.lutris.Lutris"
71 + open-on-workspace "games"
74 +window-rule {
75 + match app-id="steam_app_default" title="Battle.net"
76 + open-floating true
77 + open-on-workspace "games"
80 +window-rule {
81 + match app-id="steam" title="Friends List"
82 + open-floating true
85 +layer-rule {
86 + match namespace="^noctalia-wallpaper*"
87 + place-within-backdrop true

niri/cfg/workspaces.kdl

Added
new file mode 100644
1 +// ────────────── Workspace Names ──────────────
2 +// Workspaces exist per-monitor. Apps are routed here via window rules.
4 +workspace "code" {
5 + open-on-output "DP-1"
6 +}
8 +workspace "media" {
9 + open-on-output "DP-1"
12 +workspace "games" {
13 + open-on-output "DP-1"
16 +workspace "browser" {
17 + open-on-output "DP-2"
20 +workspace "vault" {
21 + open-on-output "DP-2"

niri/config.kdl

Modified
1 -// This config is in the KDL format: https://kdl.dev
2 -// "/-" comments out the following node.
3 -// Check the wiki for a full description of the configuration:
4 -// https://yalter.github.io/niri/Configuration:-Introduction
1 +include "cfg/autostart.kdl"
2 +include "cfg/animation.kdl"
3 +include "cfg/display.kdl"
4 +include "cfg/input.kdl"
5 +include "cfg/keybinds.kdl"
6 +include "cfg/layout.kdl"
7 +include "cfg/rules.kdl"
8 +include "cfg/misc.kdl"
9 +include "cfg/workspaces.kdl"
10 +include "cfg/noctalia.kdl"
11 +include "cfg/cursor.kdl"
13 +include "./noctalia.kdl"
6 -// Input device configuration.
7 -// Find the full list of options on the wiki:
8 -// https://yalter.github.io/niri/Configuration:-Input
9 -input {
10 - keyboard {
11 - xkb {
12 - // You can set rules, model, layout, variant and options.
13 - // For more information, see xkeyboard-config(7).
15 - // For example:
16 - // layout "us,ru"
17 - layout "us"
18 - variant "altgr-intl"
19 - options "caps:none"
21 - // If this section is empty, niri will fetch xkb settings
22 - // from org.freedesktop.locale1. You can control these using
23 - // localectl set-x11-keymap.
24 - }
26 - // Enable numlock on startup, omitting this setting disables it.
27 - numlock
28 - }
30 - // Next sections include libinput settings.
31 - // Omitting settings disables them, or leaves them at their default values.
32 - // All commented-out settings here are examples, not defaults.
33 - touchpad {
34 - // off
35 - tap
36 - // dwt
37 - // dwtp
38 - // drag false
39 - // drag-lock
40 - natural-scroll
41 - // accel-speed 0.2
42 - // accel-profile "flat"
43 - // scroll-method "two-finger"
44 - // disabled-on-external-mouse
45 - }
47 - mouse {
48 - // off
49 - natural-scroll
50 - // accel-speed 0.2
51 - accel-profile "flat"
52 - // scroll-method "no-scroll"
53 - }
55 - trackpoint {
56 - // off
57 - // natural-scroll
58 - // accel-speed 0.2
59 - // accel-profile "flat"
60 - // scroll-method "on-button-down"
61 - // scroll-button 273
62 - // scroll-button-lock
63 - // middle-emulation
64 - }
66 - // Uncomment this to make the mouse warp to the center of newly focused windows.
67 - // warp-mouse-to-focus
69 - // Focus windows and outputs automatically when moving the mouse into them.
70 - // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen.
71 - // focus-follows-mouse max-scroll-amount="0%"
74 -// You can configure outputs by their name, which you can find
75 -// by running `niri msg outputs` while inside a niri instance.
76 -// The built-in laptop monitor is usually called "eDP-1".
77 -// Find more information on the wiki:
78 -// https://yalter.github.io/niri/Configuration:-Outputs
79 -// Remember to uncomment the node by removing "/-"!
80 -/-output "eDP-1" {
81 - // Uncomment this line to disable this output.
82 - // off
84 - // Resolution and, optionally, refresh rate of the output.
85 - // The format is "<width>x<height>" or "<width>x<height>@<refresh rate>".
86 - // If the refresh rate is omitted, niri will pick the highest refresh rate
87 - // for the resolution.
88 - // If the mode is omitted altogether or is invalid, niri will pick one automatically.
89 - // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
90 - mode "1920x1080@120.030"
92 - // You can use integer or fractional scale, for example use 1.5 for 150% scale.
93 - scale 2
95 - // Transform allows to rotate the output counter-clockwise, valid values are:
96 - // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270.
97 - transform "normal"
99 - // Position of the output in the global coordinate space.
100 - // This affects directional monitor actions like "focus-monitor-left", and cursor movement.
101 - // The cursor can only move between directly adjacent outputs.
102 - // Output scale and rotation has to be taken into account for positioning:
103 - // outputs are sized in logical, or scaled, pixels.
104 - // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080,
105 - // so to put another output directly adjacent to it on the right, set its x to 1920.
106 - // If the position is unset or results in an overlap, the output is instead placed
107 - // automatically.
108 - position x=1280 y=0
111 -// Settings that influence how windows are positioned and sized.
112 -// Find more information on the wiki:
113 -// https://yalter.github.io/niri/Configuration:-Layout
114 -layout {
115 - // Set gaps around windows in logical pixels.
116 - gaps 16
118 - // When to center a column when changing focus, options are:
119 - // - "never", default behavior, focusing an off-screen column will keep at the left
120 - // or right edge of the screen.
121 - // - "always", the focused column will always be centered.
122 - // - "on-overflow", focusing a column will center it if it doesn't fit
123 - // together with the previously focused column.
124 - center-focused-column "never"
126 - // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.
127 - preset-column-widths {
128 - // Proportion sets the width as a fraction of the output width, taking gaps into account.
129 - // For example, you can perfectly fit four windows sized "proportion 0.25" on an output.
130 - // The default preset widths are 1/3, 1/2 and 2/3 of the output.
131 - proportion 0.33333
132 - proportion 0.5
133 - proportion 0.66667
135 - // Fixed sets the width in logical pixels exactly.
136 - // fixed 1920
137 - }
139 - // You can also customize the heights that "switch-preset-window-height" (Mod+Shift+R) toggles between.
140 - // preset-window-heights { }
142 - // You can change the default width of the new windows.
143 - default-column-width { proportion 0.5; }
144 - // If you leave the brackets empty, the windows themselves will decide their initial width.
145 - // default-column-width {}
147 - // By default focus ring and border are rendered as a solid background rectangle
148 - // behind windows. That is, they will show up through semitransparent windows.
149 - // This is because windows using client-side decorations can have an arbitrary shape.
150 - //
151 - // If you don't like that, you should uncomment `prefer-no-csd` below.
152 - // Niri will draw focus ring and border *around* windows that agree to omit their
153 - // client-side decorations.
154 - //
155 - // Alternatively, you can override it with a window rule called
156 - // `draw-border-with-background`.
158 - // You can change how the focus ring looks.
159 - focus-ring {
160 - // Uncomment this line to disable the focus ring.
161 - // off
163 - // How many logical pixels the ring extends out from the windows.
164 - width 4
166 - // Colors can be set in a variety of ways:
167 - // - CSS named colors: "red"
168 - // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa"
169 - // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others.
171 - // Color of the ring on the active monitor.
172 - active-color "#812281"
174 - // Color of the ring on inactive monitors.
175 - //
176 - // The focus ring only draws around the active window, so the only place
177 - // where you can see its inactive-color is on other monitors.
178 - inactive-color "#8b8b8b"
180 - // You can also use gradients. They take precedence over solid colors.
181 - // Gradients are rendered the same as CSS linear-gradient(angle, from, to).
182 - // The angle is the same as in linear-gradient, and is optional,
183 - // defaulting to 180 (top-to-bottom gradient).
184 - // You can use any CSS linear-gradient tool on the web to set these up.
185 - // Changing the color space is also supported, check the wiki for more info.
186 - //
187 - active-gradient from="#9d299d" to="#812281" angle=45
189 - // You can also color the gradient relative to the entire view
190 - // of the workspace, rather than relative to just the window itself.
191 - // To do that, set relative-to="workspace-view".
192 - //
193 - inactive-gradient from="#9d9d9d" to="#8b8b8b" angle=45 relative-to="workspace-view"
194 - }
196 - // You can also add a border. It's similar to the focus ring, but always visible.
197 - border {
198 - // The settings are the same as for the focus ring.
199 - // If you enable the border, you probably want to disable the focus ring.
200 - off
202 - width 4
203 - active-color "#9d299d"
204 - inactive-color "#6e6e6e"
206 - // Color of the border around windows that request your attention.
207 - urgent-color "#ac5a77"
209 - // Gradients can use a few different interpolation color spaces.
210 - // For example, this is a pastel rainbow gradient via in="oklch longer hue".
211 - //
212 - // active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue"
214 - // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
215 - }
217 - // You can enable drop shadows for windows.
218 - shadow {
219 - // Uncomment the next line to enable shadows.
220 - // on
222 - // By default, the shadow draws only around its window, and not behind it.
223 - // Uncomment this setting to make the shadow draw behind its window.
224 - //
225 - // Note that niri has no way of knowing about the CSD window corner
226 - // radius. It has to assume that windows have square corners, leading to
227 - // shadow artifacts inside the CSD rounded corners. This setting fixes
228 - // those artifacts.
229 - //
230 - // However, instead you may want to set prefer-no-csd and/or
231 - // geometry-corner-radius. Then, niri will know the corner radius and
232 - // draw the shadow correctly, without having to draw it behind the
233 - // window. These will also remove client-side shadows if the window
234 - // draws any.
235 - //
236 - // draw-behind-window true
238 - // You can change how shadows look. The values below are in logical
239 - // pixels and match the CSS box-shadow properties.
241 - // Softness controls the shadow blur radius.
242 - softness 30
244 - // Spread expands the shadow.
245 - spread 5
247 - // Offset moves the shadow relative to the window.
248 - offset x=0 y=5
250 - // You can also change the shadow color and opacity.
251 - color "#0007"
252 - }
254 - // Struts shrink the area occupied by windows, similarly to layer-shell panels.
255 - // You can think of them as a kind of outer gaps. They are set in logical pixels.
256 - // Left and right struts will cause the next window to the side to always be visible.
257 - // Top and bottom struts will simply add outer gaps in addition to the area occupied by
258 - // layer-shell panels and regular gaps.
259 - struts {
260 - // left 64
261 - // right 64
262 - // top 64
263 - // bottom 64
264 - }
267 -// Add lines like this to spawn processes at startup.
268 -// Note that running niri as a session supports xdg-desktop-autostart,
269 -// which may be more convenient to use.
270 -// See the binds section below for more spawn examples.
272 -// This line starts eww
273 -spawn-at-startup "eww open tray"
275 -// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup:
276 -// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell"
278 -hotkey-overlay {
279 - // Uncomment this line to disable the "Important Hotkeys" pop-up at startup.
280 - // skip-at-startup
283 -// Uncomment this line to ask the clients to omit their client-side decorations if possible.
284 -// If the client will specifically ask for CSD, the request will be honored.
285 -// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners.
286 -// This option will also fix border/focus ring drawing behind some semitransparent windows.
287 -// After enabling or disabling this, you need to restart the apps for this to take effect.
288 -prefer-no-csd
290 -// You can change the path where screenshots are saved.
291 -// A ~ at the front will be expanded to the home directory.
292 -// The path is formatted with strftime(3) to give you the screenshot date and time.
293 -screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
295 -// You can also set this to null to disable saving screenshots to disk.
296 -// screenshot-path null
298 -// Animation settings.
299 -// The wiki explains how to configure individual animations:
300 -// https://yalter.github.io/niri/Configuration:-Animations
301 -animations {
302 - // Uncomment to turn off all animations.
303 - // off
305 - // Slow down all animations by this factor. Values below 1 speed them up instead.
306 - slowdown 0.3
309 -// Window rules let you adjust behavior for individual windows.
310 -// Find more information on the wiki:
311 -// https://yalter.github.io/niri/Configuration:-Window-Rules
313 -// Work around WezTerm's initial configure bug
314 -// by setting an empty default-column-width.
315 -window-rule {
316 - // This regular expression is intentionally made as specific as possible,
317 - // since this is the default config, and we want no false positives.
318 - // You can get away with just app-id="wezterm" if you want.
319 - match app-id=r#"^org\.wezfurlong\.wezterm$"#
320 - default-column-width {}
323 -// Open the Firefox picture-in-picture player as floating by default.
324 -window-rule {
325 - // This app-id regular expression will work for both:
326 - // - host Firefox (app-id is "firefox")
327 - // - Flatpak Firefox (app-id is "org.mozilla.firefox")
328 - match app-id=r#"firefox$"# title="^Picture-in-Picture$"
329 - open-floating true
332 -// Example: block out two password managers from screen capture.
333 -// (This example rule is commented out with a "/-" in front.)
334 -/-window-rule {
335 - match app-id=r#"^org\.keepassxc\.KeePassXC$"#
336 - match app-id=r#"^org\.gnome\.World\.Secrets$"#
338 - block-out-from "screen-capture"
340 - // Use this instead if you want them visible on third-party screenshot tools.
341 - // block-out-from "screencast"
344 -// Example: enable rounded corners for all windows.
345 -// (This example rule is commented out with a "/-" in front.)
346 -/-window-rule {
347 - geometry-corner-radius 12
348 - clip-to-geometry true
351 -binds {
352 - // Keys consist of modifiers separated by + signs, followed by an XKB key name
353 - // in the end. To find an XKB name for a particular key, you may use a program
354 - // like wev.
355 - //
356 - // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt
357 - // when running as a winit window.
358 - //
359 - // Most actions that you can bind here can also be invoked programmatically with
360 - // `niri msg action do-something`.
362 - // Mod-Shift-/, which is usually the same as Mod-?,
363 - // shows a list of important hotkeys.
364 - Mod+Shift+Slash { show-hotkey-overlay; }
366 - // Suggested binds for running programs: terminal, app launcher, screen locker.
367 - Mod+T hotkey-overlay-title="Open a Terminal: wezterm" { spawn "wezterm" "start" "--always-new-process"; }
368 - Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; }
369 - Super+Alt+L hotkey-overlay-title="Lock the Screen: hyprlock" { spawn "hyprlock"; }
371 - // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc.
372 - // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`.
373 - // For example, this is a standard bind to toggle the screen reader (orca).
374 - // Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; }
376 - // Example volume keys mappings for PipeWire & WirePlumber.
377 - // The allow-when-locked=true property makes them work even when the session is locked.
378 - // Using spawn-sh allows to pass multiple arguments together with the command.
379 - XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+"; }
380 - XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; }
381 - XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; }
382 - XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; }
384 - // Example brightness key mappings for brightnessctl.
385 - // You can use regular spawn with multiple arguments too (to avoid going through "sh"),
386 - // but you need to manually put each argument in separate "" quotes.
387 - XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; }
388 - XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; }
390 - // Open/close the Overview: a zoomed-out view of workspaces and windows.
391 - // You can also move the mouse into the top-left hot corner,
392 - // or do a four-finger swipe up on a touchpad.
393 - Mod+O repeat=false { toggle-overview; }
395 - Mod+Q repeat=false { close-window; }
397 - Mod+Left { focus-column-left; }
398 - Mod+Down { focus-window-down; }
399 - Mod+Up { focus-window-up; }
400 - Mod+Right { focus-column-right; }
401 - Mod+H { focus-column-left; }
402 - Mod+J { focus-window-down; }
403 - Mod+K { focus-window-up; }
404 - Mod+L { focus-column-right; }
406 - Mod+Ctrl+Left { move-column-left; }
407 - Mod+Ctrl+Down { move-window-down; }
408 - Mod+Ctrl+Up { move-window-up; }
409 - Mod+Ctrl+Right { move-column-right; }
410 - Mod+Ctrl+H { move-column-left; }
411 - Mod+Ctrl+J { move-window-down; }
412 - Mod+Ctrl+K { move-window-up; }
413 - Mod+Ctrl+L { move-column-right; }
415 - // Alternative commands that move across workspaces when reaching
416 - // the first or last window in a column.
417 - // Mod+J { focus-window-or-workspace-down; }
418 - // Mod+K { focus-window-or-workspace-up; }
419 - // Mod+Ctrl+J { move-window-down-or-to-workspace-down; }
420 - // Mod+Ctrl+K { move-window-up-or-to-workspace-up; }
422 - Mod+Home { focus-column-first; }
423 - Mod+End { focus-column-last; }
424 - Mod+Ctrl+Home { move-column-to-first; }
425 - Mod+Ctrl+End { move-column-to-last; }
427 - Mod+Shift+Left { focus-monitor-left; }
428 - Mod+Shift+Down { focus-monitor-down; }
429 - Mod+Shift+Up { focus-monitor-up; }
430 - Mod+Shift+Right { focus-monitor-right; }
431 - Mod+Shift+H { focus-monitor-left; }
432 - Mod+Shift+J { focus-monitor-down; }
433 - Mod+Shift+K { focus-monitor-up; }
434 - Mod+Shift+L { focus-monitor-right; }
436 - Mod+Shift+Ctrl+Left { move-column-to-monitor-left; }
437 - Mod+Shift+Ctrl+Down { move-column-to-monitor-down; }
438 - Mod+Shift+Ctrl+Up { move-column-to-monitor-up; }
439 - Mod+Shift+Ctrl+Right { move-column-to-monitor-right; }
440 - Mod+Shift+Ctrl+H { move-column-to-monitor-left; }
441 - Mod+Shift+Ctrl+J { move-column-to-monitor-down; }
442 - Mod+Shift+Ctrl+K { move-column-to-monitor-up; }
443 - Mod+Shift+Ctrl+L { move-column-to-monitor-right; }
445 - // Alternatively, there are commands to move just a single window:
446 - // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; }
447 - // ...
449 - // And you can also move a whole workspace to another monitor:
450 - // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; }
451 - // ...
453 - Mod+Page_Down { focus-workspace-down; }
454 - Mod+Page_Up { focus-workspace-up; }
455 - Mod+U { focus-workspace-down; }
456 - Mod+I { focus-workspace-up; }
457 - Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
458 - Mod+Ctrl+Page_Up { move-column-to-workspace-up; }
459 - Mod+Ctrl+U { move-column-to-workspace-down; }
460 - Mod+Ctrl+I { move-column-to-workspace-up; }
462 - // Alternatively, there are commands to move just a single window:
463 - // Mod+Ctrl+Page_Down { move-window-to-workspace-down; }
464 - // ...
466 - Mod+Shift+Page_Down { move-workspace-down; }
467 - Mod+Shift+Page_Up { move-workspace-up; }
468 - Mod+Shift+U { move-workspace-down; }
469 - Mod+Shift+I { move-workspace-up; }
471 - // You can bind mouse wheel scroll ticks using the following syntax.
472 - // These binds will change direction based on the natural-scroll setting.
473 - //
474 - // To avoid scrolling through workspaces really fast, you can use
475 - // the cooldown-ms property. The bind will be rate-limited to this value.
476 - // You can set a cooldown on any bind, but it's most useful for the wheel.
477 - Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
478 - Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
479 - Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
480 - Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
482 - Mod+WheelScrollRight { focus-column-right; }
483 - Mod+WheelScrollLeft { focus-column-left; }
484 - Mod+Ctrl+WheelScrollRight { move-column-right; }
485 - Mod+Ctrl+WheelScrollLeft { move-column-left; }
487 - // Usually scrolling up and down with Shift in applications results in
488 - // horizontal scrolling; these binds replicate that.
489 - Mod+Shift+WheelScrollDown { focus-column-right; }
490 - Mod+Shift+WheelScrollUp { focus-column-left; }
491 - Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
492 - Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
494 - // Similarly, you can bind touchpad scroll "ticks".
495 - // Touchpad scrolling is continuous, so for these binds it is split into
496 - // discrete intervals.
497 - // These binds are also affected by touchpad's natural-scroll, so these
498 - // example binds are "inverted", since we have natural-scroll enabled for
499 - // touchpads by default.
500 - // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; }
501 - // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; }
503 - // You can refer to workspaces by index. However, keep in mind that
504 - // niri is a dynamic workspace system, so these commands are kind of
505 - // "best effort". Trying to refer to a workspace index bigger than
506 - // the current workspace count will instead refer to the bottommost
507 - // (empty) workspace.
508 - //
509 - // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on
510 - // will all refer to the 3rd workspace.
511 - Mod+1 { focus-workspace 1; }
512 - Mod+2 { focus-workspace 2; }
513 - Mod+3 { focus-workspace 3; }
514 - Mod+4 { focus-workspace 4; }
515 - Mod+5 { focus-workspace 5; }
516 - Mod+6 { focus-workspace 6; }
517 - Mod+7 { focus-workspace 7; }
518 - Mod+8 { focus-workspace 8; }
519 - Mod+9 { focus-workspace 9; }
520 - Mod+Ctrl+1 { move-column-to-workspace 1; }
521 - Mod+Ctrl+2 { move-column-to-workspace 2; }
522 - Mod+Ctrl+3 { move-column-to-workspace 3; }
523 - Mod+Ctrl+4 { move-column-to-workspace 4; }
524 - Mod+Ctrl+5 { move-column-to-workspace 5; }
525 - Mod+Ctrl+6 { move-column-to-workspace 6; }
526 - Mod+Ctrl+7 { move-column-to-workspace 7; }
527 - Mod+Ctrl+8 { move-column-to-workspace 8; }
528 - Mod+Ctrl+9 { move-column-to-workspace 9; }
530 - // Alternatively, there are commands to move just a single window:
531 - // Mod+Ctrl+1 { move-window-to-workspace 1; }
533 - // Switches focus between the current and the previous workspace.
534 - // Mod+Tab { focus-workspace-previous; }
536 - // The following binds move the focused window in and out of a column.
537 - // If the window is alone, they will consume it into the nearby column to the side.
538 - // If the window is already in a column, they will expel it out.
539 - Mod+BracketLeft { consume-or-expel-window-left; }
540 - Mod+BracketRight { consume-or-expel-window-right; }
542 - // Consume one window from the right to the bottom of the focused column.
543 - Mod+Comma { consume-window-into-column; }
544 - // Expel the bottom window from the focused column to the right.
545 - Mod+Period { expel-window-from-column; }
547 - Mod+R { switch-preset-column-width; }
548 - // Cycling through the presets in reverse order is also possible.
549 - // Mod+R { switch-preset-column-width-back; }
550 - Mod+Shift+R { switch-preset-window-height; }
551 - Mod+Ctrl+R { reset-window-height; }
552 - Mod+F { maximize-column; }
553 - Mod+Shift+F { fullscreen-window; }
555 - // Expand the focused column to space not taken up by other fully visible columns.
556 - // Makes the column "fill the rest of the space".
557 - Mod+Ctrl+F { expand-column-to-available-width; }
559 - Mod+C { center-column; }
561 - // Center all fully visible columns on screen.
562 - Mod+Ctrl+C { center-visible-columns; }
564 - // Finer width adjustments.
565 - // This command can also:
566 - // * set width in pixels: "1000"
567 - // * adjust width in pixels: "-5" or "+5"
568 - // * set width as a percentage of screen width: "25%"
569 - // * adjust width as a percentage of screen width: "-10%" or "+10%"
570 - // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0,
571 - // set-column-width "100" will make the column occupy 200 physical screen pixels.
572 - Mod+Minus { set-column-width "-10%"; }
573 - Mod+Equal { set-column-width "+10%"; }
575 - // Finer height adjustments when in column with other windows.
576 - Mod+Shift+Minus { set-window-height "-10%"; }
577 - Mod+Shift+Equal { set-window-height "+10%"; }
579 - // Move the focused window between the floating and the tiling layout.
580 - Mod+V { toggle-window-floating; }
581 - Mod+Shift+V { switch-focus-between-floating-and-tiling; }
583 - // Toggle tabbed column display mode.
584 - // Windows in this column will appear as vertical tabs,
585 - // rather than stacked on top of each other.
586 - Mod+W { toggle-column-tabbed-display; }
588 - // Actions to switch layouts.
589 - // Note: if you uncomment these, make sure you do NOT have
590 - // a matching layout switch hotkey configured in xkb options above.
591 - // Having both at once on the same hotkey will break the switching,
592 - // since it will switch twice upon pressing the hotkey (once by xkb, once by niri).
593 - // Mod+Space { switch-layout "next"; }
594 - // Mod+Shift+Space { switch-layout "prev"; }
596 - Print { screenshot; }
597 - Ctrl+Print { screenshot-screen; }
598 - Alt+Print { screenshot-window; }
600 - // Applications such as remote-desktop clients and software KVM switches may
601 - // request that niri stops processing the keyboard shortcuts defined here
602 - // so they may, for example, forward the key presses as-is to a remote machine.
603 - // It's a good idea to bind an escape hatch to toggle the inhibitor,
604 - // so a buggy application can't hold your session hostage.
605 - //
606 - // The allow-inhibiting=false property can be applied to other binds as well,
607 - // which ensures niri always processes them, even when an inhibitor is active.
608 - Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
610 - // The quit action will show a confirmation dialog to avoid accidental exits.
611 - Mod+Shift+E { quit; }
612 - Ctrl+Alt+Delete { quit; }
614 - // Powers off the monitors. To turn them back on, do any input like
615 - // moving the mouse or pressing any other key.
616 - Mod+Shift+P { power-off-monitors; }

niri/noctalia.kdl

Added
new file mode 100644
1 +layout {
3 + focus-ring {
4 + active-color "#cba6f7"
5 + inactive-color "#1e1e2e"
6 + urgent-color "#f38ba8"
7 + }
9 + border {
10 + active-color "#cba6f7"
11 + inactive-color "#1e1e2e"
12 + urgent-color "#f38ba8"
13 + }
15 + shadow {
16 + color "#11111b70"
17 + }
19 + tab-indicator {
20 + active-color "#cba6f7"
21 + inactive-color "#6b02e9"
22 + urgent-color "#f38ba8"
23 + }
25 + insert-hint {
26 + color "#cba6f780"
27 + }
30 +recent-windows {
31 + highlight {
32 + active-color "#cba6f7"
33 + urgent-color "#f38ba8"
34 + }

nugu/justfile

Modified
16 16 fmt: lint
17 17 taplo fmt
19 +check: fmt
20 + use nugu.nu; nugu check
19 22 output := 'output'
21 24 show THEME:

nugu/nugu.nu

Modified
1 -def print-block [ color: string ] {
1 +# === WCAG 2.1 contrast ratio ===
3 - let color_escape = {
4 - fg: $color
5 - bg: $color
3 +def hex-to-rgb [hex: string] {
4 + let clean = ($hex | str trim | str substring 1..)
5 + [
6 + ((($clean | str substring 0..<2) | into int --radix 16) / 255.0),
7 + ((($clean | str substring 2..<4) | into int --radix 16) / 255.0),
8 + ((($clean | str substring 4..<6) | into int --radix 16) / 255.0),
9 + ]
12 +def srgb-linearize [c: float] {
13 + if $c <= 0.04045 { $c / 12.92 } else { (($c + 0.055) / 1.055) ** 2.4 }
16 +def relative-luminance [hex: string] {
17 + let rgb = (hex-to-rgb $hex)
18 + let r = (0.2126 * (srgb-linearize $rgb.0))
19 + let g = (0.7152 * (srgb-linearize $rgb.1))
20 + let b = (0.0722 * (srgb-linearize $rgb.2))
21 + [$r, $g, $b] | math sum
24 +def wcag-contrast [fg: string, bg: string] {
25 + let l1 = (relative-luminance $fg)
26 + let l2 = (relative-luminance $bg)
27 + (([$l1 $l2] | math max) + 0.05) / (([$l1 $l2] | math min) + 0.05)
30 +# minimum contrast thresholds based on Nugu's stated intentions.
31 +# error: "nonnegotiable and urgent. very aggressive and visible." → WCAG AA text
32 +# warning: "likely to be problems, but not urgent. distracting but ignorable." → large text
33 +# info: "context relevant suggestions. relaxed and easy to ignore." → present but not demanding
34 +# debug: "easy to spot" → large text
35 +# content.normal: default text → WCAG AA text
36 +# content.accent: theme identity, prominent → WCAG AA text
37 +# content.minor: receded structural text → large text
38 +# content.focus: user is actively editing → WCAG AA text
39 +# content.unfocus: not in focus, receded → present but not demanding
40 +# content.important_local: system demands attention → WCAG AA text
41 +# content.important_global: important but lighter variant → between AA and large text
42 +# ui.*: same semantics but on ui.backdrop instead of content.backdrop
44 +const contrast_thresholds = [
45 + { color: "error", bg: "content.backdrop", min: 4.5 },
46 + { color: "warning", bg: "content.backdrop", min: 3.0 },
47 + { color: "info", bg: "content.backdrop", min: 2.5 },
48 + { color: "debug", bg: "content.backdrop", min: 3.0 },
49 + { color: "content.normal", bg: "content.backdrop", min: 4.5 },
50 + { color: "content.accent", bg: "content.backdrop", min: 4.5 },
51 + { color: "content.minor", bg: "content.backdrop", min: 3.0 },
52 + { color: "content.focus", bg: "content.backdrop", min: 4.5 },
53 + { color: "content.unfocus", bg: "content.backdrop", min: 2.5 },
54 + { color: "content.important_local", bg: "content.backdrop", min: 4.5 },
55 + { color: "content.important_global", bg: "content.backdrop", min: 2.5 },
56 + { color: "ui.normal", bg: "ui.backdrop", min: 4.5 },
57 + { color: "ui.accent", bg: "ui.backdrop", min: 4.5 },
58 + { color: "ui.minor", bg: "ui.backdrop", min: 3.0 },
59 + { color: "ui.focus", bg: "ui.backdrop", min: 4.5 },
60 + { color: "ui.unfocus", bg: "ui.backdrop", min: 2.5 },
61 + { color: "ui.important_local", bg: "ui.backdrop", min: 4.5 },
62 + { color: "ui.important_global", bg: "ui.backdrop", min: 2.5 },
65 +def validate-theme [theme: record, theme_name: string] {
66 + let pal = $theme.palette
68 + let results = ($contrast_thresholds | each {|t|
69 + let cparts = ($t.color | split row ".")
70 + let bparts = ($t.bg | split row ".")
71 + let color_val = if ($cparts | length) == 1 {
72 + $pal | get $t.color
73 + } else {
74 + $pal | get $cparts.0 | get $cparts.1
75 + }
76 + let bg_val = if ($bparts | length) == 1 {
77 + $pal | get $t.bg
78 + } else {
79 + $pal | get $bparts.0 | get $bparts.1
80 + }
81 + let ratio = (wcag-contrast $color_val $bg_val)
82 + {
83 + color: $t.color,
84 + hex: $color_val,
85 + bg_hex: $bg_val,
86 + ratio: ($ratio | math round --precision 1),
87 + min: $t.min,
88 + pass: ($ratio >= $t.min),
89 + }
90 + })
92 + let failures = ($results | where pass == false)
94 + print $"(ansi yellow_bold)WCAG AA: ($theme_name) theme(ansi reset)"
96 + if ($failures | length) > 0 {
97 + for f in $failures {
98 + print $" (ansi red)✗(ansi reset) ($f.color) ($f.hex) on ($f.bg_hex) — ($f.ratio):1, need ($f.min):1"
99 + }
100 + print $" (ansi red_bold)($failures | length) warnings(ansi reset)"
101 + } else {
102 + print $" (ansi green)✓ all colors pass(ansi reset)"
104 + print ""
8 - print --no-newline $"(ansi --escape $color_escape)██(ansi reset)"
107 +export def check [] {
108 + print ""
109 + validate-theme (new) "dark"
110 + validate-theme (new --light) "light"
113 +def readable-textcolor [bg: string] {
114 + pastel textcolor $bg | pastel format hex | ansi strip
11 117 export def print-colors [theme: record] {
12 118 let mat = [
14 - $theme.palette.debug
15 - $theme.palette.error
16 - $theme.palette.warning
17 - $theme.palette.info
120 + { name: "debug", color: $theme.palette.debug }
121 + { name: "error", color: $theme.palette.error }
122 + { name: "warning", color: $theme.palette.warning }
123 + { name: "info", color: $theme.palette.info }
24 - $theme.palette.content.normal
25 - $theme.palette.content.backdrop
26 - $theme.palette.content.accent
27 - $theme.palette.content.minor
28 - $theme.palette.content.focus
29 - $theme.palette.content.unfocus
30 - $theme.palette.content.important_local
31 - $theme.palette.content.important_global
130 + { name: "normal", color: $theme.palette.content.normal }
131 + { name: "backdrop", color: $theme.palette.content.backdrop }
132 + { name: "accent", color: $theme.palette.content.accent }
133 + { name: "minor", color: $theme.palette.content.minor }
134 + { name: "focus", color: $theme.palette.content.focus }
135 + { name: "unfocus", color: $theme.palette.content.unfocus }
136 + { name: "important_local", color: $theme.palette.content.important_local }
137 + { name: "important_global", color: $theme.palette.content.important_global }
34 - $theme.palette.ui.normal
35 - $theme.palette.ui.backdrop
36 - $theme.palette.ui.accent
37 - $theme.palette.ui.minor
38 - $theme.palette.ui.focus
39 - $theme.palette.ui.unfocus
40 - $theme.palette.ui.important_local
41 - $theme.palette.ui.important_global
140 + { name: "normal", color: $theme.palette.ui.normal }
141 + { name: "backdrop", color: $theme.palette.ui.backdrop }
142 + { name: "accent", color: $theme.palette.ui.accent }
143 + { name: "minor", color: $theme.palette.ui.minor }
144 + { name: "focus", color: $theme.palette.ui.focus }
145 + { name: "unfocus", color: $theme.palette.ui.unfocus }
146 + { name: "important_local", color: $theme.palette.ui.important_local }
147 + { name: "important_global", color: $theme.palette.ui.important_global }
44 - # FIXME: shirley, there is some clever way to create the matrix from the tree?
46 - let width = $mat | get 0 | length
47 - let height = $mat | length
48 - # FIXME: the math below is beautifully wrong and only happens to work
49 - # when pad is == 1, don't care right now..
50 - let pad = 1
51 - let size = (term size | get columns) // ($width + $width + $pad + $pad)
52 - let padded_size = $size + $pad
54 - let scaled_width = ($width * $padded_size) - $pad
55 - let scaled_height = ($height * $padded_size) - $pad
151 + let num_x = ($mat | get 0 | length)
152 + let num_y = ($mat | length)
57 153 let bg = "#000000"
154 + let cols = (term size | get columns)
155 + let pad = 2
156 + let block_w = (($cols - (($num_x - 1) * $pad)) // $num_x // 2) * 2
157 + let block_h = ($block_w // 2)
158 + let name_row = (($block_h // 2) - 1)
159 + let hex_row = ($block_h // 2)
59 - for y in 0..$scaled_height {
60 - for x in 0..$scaled_width {
61 - let pad_x = $x mod $padded_size
62 - let pad_y = $y mod $padded_size
63 - if ($pad_x == $padded_size - 1 or $pad_y == $padded_size - 1 ) {
64 - print-block $bg
65 - } else {
66 - let color_x = ($x // $padded_size) mod $width
67 - let color_y = ($y // $padded_size) mod $height
68 - let color = $mat | get $color_y | get $color_x
69 - if ($color | is-not-empty) {
70 - print-block $color
161 + for by in 0..<$num_y {
162 + for py in 0..<$block_h {
163 + for bx in 0..<$num_x {
164 + let item = $mat | get $by | get $bx
165 + let color = if ($item | is-not-empty) { $item.color } else { $bg }
166 + let has_text = ($item | is-not-empty) and ($block_w >= 8) and ($py == $name_row or $py == $hex_row)
168 + if $has_text {
169 + let fg_color = (readable-textcolor $color)
170 + let label = if $py == $name_row { $item.name } else { $color }
171 + let padded = ($label | fill --alignment c --character ' ' --width $block_w)
172 + let line = ($padded | str substring 0..<$block_w)
173 + print --no-newline $"(ansi --escape { bg: $color, fg: $fg_color })($line)(ansi reset)"
71 174 } else {
72 - print-block $bg
175 + let solid = ("" | fill --alignment l --character '█' --width $block_w)
176 + print --no-newline $"(ansi --escape { bg: $color, fg: $color })($solid)(ansi reset)"
179 + if $bx < ($num_x - 1) {
180 + print --no-newline $"(ansi --escape { bg: $bg, fg: $bg })██(ansi reset)"
183 + print ""
186 + if $by < ($num_y - 1) {
187 + let total_w = ($num_x * $block_w) + (($num_x - 1) * $pad)
188 + let solid = ("" | fill --alignment l --character '█' --width $total_w)
189 + print --no-newline $"(ansi --escape { bg: $bg, fg: $bg })($solid)(ansi reset)"
190 + print ""
76 - # it is amazingly difficult to print only one newline
77 - # print --no-newline (char nl)
78 - print ""
147 260 def mix [
148 261 color: string # color to mix into
262 + --fraction: float = 0.42 # OkLab blend fraction
150 - pastel mix --colorspace OkLab --fraction 0.42 $color
264 + pastel mix --colorspace OkLab --fraction $fraction $color
153 267 def new [
163 277 let error = (
164 278 $base.error
165 - | mix $base.accent
166 - | normal_flux
279 + | mix $base.accent --fraction 0.1
280 + | normal_flux --c 0.1 --d 0.3
168 282 let warning = (
169 283 $base.warning
170 - | mix $base.accent
171 - | normal_flux
284 + | mix $base.accent --fraction 0.1
285 + | mix $base.backdrop
286 + | normal_flux --c 0.2 --d 0.3
173 288 let info = (
174 289 $base.info
175 - | mix $base.accent
176 - | normal_flux
290 + | mix $base.important --fraction 0.2
291 + | mix $base.backdrop --fraction 0.15
292 + | normal_flux --c 0.15 --d 0.3
294 + let debug = (
295 + $base.debug
296 + | normal_flux --c 0.15 --d 0.2
178 298 let content_normal = (
179 299 $normal
202 322 $base.focus
203 323 | mix $content_backdrop
204 324 | mix $base.important
205 - | normal_flux --d 0.69
325 + | normal_flux --d 1
207 327 let content_important_local = (
208 328 $base.important
249 369 let ui_important_global = (
250 370 $content_important_global
251 - | normal_flux
371 + | normal_flux --d 0
254 - (make-palette $base.debug $error $warning $info
374 + (make-palette $debug $error $warning $info
255 375 $content_normal $content_backdrop
256 376 $content_accent
257 377 $content_minor

nushell/config.nu

Modified
23 23 highlight_resolved_externals : true
24 24 use_kitty_protocol : true
26 + color_config: {
27 + # -- primitives (data types) --
28 + int: green
29 + float: green
30 + bool: green_bold
31 + string: blue
32 + nothing: dark_gray
33 + binary: dark_gray
34 + duration: green
35 + range: dark_gray
36 + cell-path: dark_gray
38 + # -- table / presentation --
39 + separator: light_green
40 + header: light_blue_bold
41 + row_index: light_green
42 + leading_trailing_space_bg: dark_gray
43 + hints: cyan
44 + empty: dark_gray
45 + search_result: green_bold
47 + # -- shapes (syntax highlighting, Nugu philosophy) --
48 + # human meaning → prominent (important_local / focus)
49 + shape_string: blue
50 + shape_raw_string: blue
51 + shape_string_interpolation: green_bold
52 + shape_int: green_bold
53 + shape_float: green_bold
54 + shape_bool: green_bold
55 + shape_filepath: green
56 + shape_directory: green
57 + shape_globpattern: green
58 + shape_glob_interpolation: green_bold
59 + shape_record: green
60 + shape_list: green
61 + shape_table: green
62 + shape_datetime: green_bold
63 + shape_match_pattern: blue
64 + shape_signature: blue
65 + shape_literal: white
66 + shape_custom: magenta_bold
67 + shape_closure: blue_bold
68 + shape_block: blue_bold
69 + shape_range: dark_gray
71 + # structural / plumbing → receded (minor)
72 + shape_keyword: dark_gray
73 + shape_operator: dark_gray
74 + shape_pipe: dark_gray
75 + shape_redirection: dark_gray
76 + shape_flag: light_cyan
77 + shape_binary: dark_gray
78 + shape_nothing: dark_gray
79 + shape_matching_brackets: dark_gray_bold
80 + shape_vardecl: white
81 + shape_variable: white
83 + # externals
84 + shape_external: light_magenta
85 + shape_externalarg: green_bold
86 + shape_external_resolved: magenta_bold
87 + shape_internalcall: light_cyan_bold
89 + # errors
90 + shape_garbage: { fg: white, bg: red, attr: b }
91 + }
26 93 history: {
27 94 file_format: "sqlite"
28 95 isolation: true

nushell/env.nu

Modified
1 1 # GLOBAL VARIABLES
3 +#TODO move to config.nu
3 5 $env.WIN32 = ( $nu.os-info.name =~ "windows" )
4 6 $env.TERMUX = ( $nu.os-info.name =~ "android" )
10 12 $env.CARGO_HOME = ( "~/.cargo" | path expand )
11 13 if (which sccache | is-not-empty) { $env.RUSTC_WRAPPER = "sccache" }
12 14 $env.GO_HOME = ( "~/.go" | path expand )
15 +$env.DIFFTOOL = "zeditor --wait --diff"
13 16 $env.OPENCODE_HOME = ( "~/.opencode" | path expand)
14 -$env.MINIMAX_API_HOST = "https://api.minimax.io"
15 17 $env.OPENCODE_EXPERIMENTAL_LSP_TOOL = true
16 18 if (not $env.WIN32) {
17 19 # make sure to start ssh-agent user service: userctl enable --now ssh-agent
49 51 $env.VISUAL = 'neovide'
52 -$env.LS_COLORS = 'rs=0:di=1;34:ln=1;36:ex=1;32:bd=1;33;40:cd=1;33;40:pi=33:so=35:do=35:or=1;31:mi=1;37;41:su=37;41:sg=30;43:tw=30;46:ow=34;42:st=37;44:*.tar=1;31:*.tgz=1;31:*.zip=1;31:*.gz=1;31:*.xz=1;31:*.7z=1;31:*.rar=1;31:*.jpg=1;35:*.png=1;35:*.gif=1;35:*.bmp=1;35:*.mp4=1;36:*.mp3=1;36:*.flac=1;36:*.pdf=1;33:*.doc=1;33:*.docx=1;33:*.txt=0:*.md=0:*.c=1;34:*.cpp=1;34:*.h=1;34:*.java=1;34:*.py=1;34:*.sh=1;34:'
54 +$env.LS_COLORS = 'rs=0:di=1;34:ln=1;35:ex=1;32:bd=1;33;40:cd=1;33;40:pi=33:so=35:do=35:or=1;31:mi=1;37;41:su=37;41:sg=30;43:tw=30;41:ow=37;41:st=37;44:*.tar=1;31:*.tgz=1;31:*.zip=1;31:*.gz=1;31:*.xz=1;31:*.7z=1;31:*.rar=1;31:*.jpg=1;35:*.png=1;35:*.gif=1;35:*.bmp=1;35:*.mp4=1;33:*.mp3=1;33:*.flac=1;33:*.pdf=1;33:*.doc=1;33:*.docx=1;33:*.txt=0:*.md=0:*.c=1;34:*.cpp=1;34:*.h=1;34:*.java=1;34:*.py=1;34:*.sh=1;34:'
54 56 # Specifies how environment variables are:
55 57 # - converted from a string to a value on Nushell startup (from_string)
75 77 source ($nu.default-config-dir | path join 'gen-aliases.nu')
76 78 source ($nu.default-config-dir | path join 'gen-secrets.nu')
80 +# TODO move to vendor dirs
78 82 # generate zoxide hooks for sourcing later on
79 83 let zoxide_config_path = $nu.default-config-dir | path join 'zoxide.nu'
80 84 if not (which zoxide | is-empty) {
97 101 mkdir ($nu.vendor-autoload-dirs | last)
98 102 ^mise activate nu | save --force ($nu.vendor-autoload-dirs | last | path join 'mise.nu')
105 +if not (which niri | is-empty) {
106 + mkdir ($nu.vendor-autoload-dirs | last)
107 + ^niri completions nushell | save --force ($nu.vendor-autoload-dirs | last | path join 'niri.nu')

nushell/gen-aliases.nu

Modified
5 5 def aka [
6 6 name: string # name of the new alias
7 7 command: string # program to alias to
8 - ...args: string # optional arguemtns to program
8 + ...args: string # optional arguments to program
11 11 if (which $command | is-not-empty) {
40 40 aka vim nvim
41 41 aka vi nvim '--clean'
42 42 aka vide neovide
43 +aka zed zeditor
43 44 aka delta delta '--hyperlinks' '--hyperlinks-file-link-format="file://{path}#{line}"'
44 45 aka rg rg '--hyperlink-format=kitty'
45 46 if (not $env.WIN32) {
48 49 aka oc opencode
49 50 aka occ opencode '-c'
51 +# this is weird, but pi install does not work when i simply override "pi"
52 +aka pii pi 'install'
53 +aka pia pi '--tools' 'read,bash,edit,write,grep,find,ls'
54 +aka pic pi '--tools' 'read,bash,edit,write,grep,find,ls' '--continue'
51 56 aka userctl systemctl '--user'

nushell/gen-secrets.nu

Modified
27 27 secret CONTEXT7_TOKEN
28 28 secret GITHUB_PAT_TOKEN
29 29 secret GITHUB_PAT_TOKEN_LLM
30 -secret MINIMAX_API_KEY
31 -secret ZAI_API_KEY
32 -secret ANTHROPIC_AUTH_TOKEN
30 +secret MINIMAX_USAGE_API_KEY
31 +secret ZAI_USAGE_API_KEY

nushell/login.nu

Modified
3 3 use prompt.nu
4 4 use sy.nu
5 5 use md.nu
6 6 use todo.nu
7 7 use ssh.nu *
8 +use vim.nu
8 9 use btrfs.nu
9 10 use start.nu
10 11 use dwnld.nu
11 12 use notes.nu
12 13 use yazi.nu *
13 -use direnv.nu
14 14 use akku.nu
15 15 use colors.nu
16 16 use syncthing.nu
17 17 use minimax.nu
18 18 use zai.nu
20 -use wrappers.nu *
19 +use shim.nu
22 21 use std/clip
23 22 use std/util "path add"
25 -if $env.WIN32 {
26 - use refreshenv.nu
24 +export def vx [...rest] {
25 + NVIM_APPNAME=nvim-minimax nvim ...$rest
29 28 source ($nu.default-config-dir | path join 'aliases.nu')

nushell/modules/colors.nu

Modified
1 -def main [] {
1 +export def main [] {
2 2 let named_colors = [
3 3 [ name value ];
4 4 [ "black" "30;40" ]

nushell/modules/direnv.nu

Deleted
deleted file mode 100644
1 -def direnv [] {
2 - [
3 - {
4 - condition: {|before, after| ($before != $after) and ($after | path join '.env' | path exists) }
5 - code: "
6 - open .env
7 - | lines
8 - | parse -r '(?P<k>.+?)=(?P<v>.+)'
9 - | reduce -f {} {|x, acc| $acc | upsert $x.k $x.v}
10 - | load-env
11 - "
12 - }
13 - ]
14 -}
16 -export-env {
17 - $env.config = ( $env.config | upsert hooks.env_change.PWD { |config|
18 - let o = ($config | get --optional hooks.env_change.PWD)
19 - let val = (direnv)
20 - if $o == null {
21 - $val
22 - } else {
23 - $o | append $val
24 - }
25 - })
26 -}

nushell/modules/minimax.nu

Modified
1 -# Uses the unofficial Z.AI REST API to show current usage of the Coding Plan.
2 -# Needs the ZAI_API_KEY environment variable
1 +# MiniMax AI integration — image generation, text-to-speech, and usage.
2 +# Set MINIMAX_USAGE_API_KEY in secrets.nuon (unified sk-cp- token covers all models).
3 3 export def usage [] {
4 - let token = $env | get --optional ZAI_API_KEY
5 - if ($token | is-empty) {
6 - error make {
7 - msg: "Token for Z.AI missing in environment"
8 - help: "Make sure to put ZAI_API_KEY in your secrets.nuon file"
9 - }
10 - }
11 - let headers = {
12 - Authorization: $'Bearer ($token)'
13 - Content-Type: 'application/json'
14 - }
15 - let response = http get --headers $headers 'https://api.z.ai/api/monitor/usage/quota/limit'
16 - let base_response = $response | get base_resp
4 + let token = $env | get --optional MINIMAX_USAGE_API_KEY
5 + if ($token | is-empty) {
6 + error make {
7 + msg: "Token for MiniMax missing in environment"
8 + label: { text: "Set MINIMAX_USAGE_API_KEY in your secrets.nuon file" }
9 + }
10 + }
11 + let headers = {
12 + Authorization: $'Bearer ($token)'
13 + Content-Type: 'application/json'
14 + User-Agent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36'
15 + }
16 + let response = http get --headers $headers 'https://www.minimax.io/v1/api/openplatform/coding_plan/remains'
17 + let base = $response.base_resp
18 - if ($base_response.code ) != 200 {
19 - error make {
20 - msg: $base_response.msg
21 - help: "The Z.AI environment variable ZAI_API_KEY seems to be wrong."
22 - }
23 - }
19 + if ($base.status_code != 0) {
20 + error make {
21 + msg: $base.status_msg
22 + label: { text: $"MiniMax API error — check MINIMAX_USAGE_API_KEY" }
23 + }
24 + }
25 - $response.data.limits
26 - | update nextResetTime { $in // 1000 | into datetime --timezone u --format '%s' }
26 + $response.model_remains
27 + | each { |row|
28 + let interval_pct = if $row.current_interval_total_count > 0 {
29 + $row.current_interval_usage_count * 100 // $row.current_interval_total_count
30 + } else { 0 }
31 + let weekly_pct = if $row.current_weekly_total_count > 0 {
32 + $row.current_weekly_usage_count * 100 // $row.current_weekly_total_count
33 + } else { 0 }
34 + let remains_h = $row.remains_time // 3600000
35 + let remains_m = ($row.remains_time mod 3600000) // 60000
36 + {
37 + model: $row.model_name
38 + interval: $"($row.current_interval_usage_count) / ($row.current_interval_total_count) (($interval_pct)%)"
39 + weekly: $"($row.current_weekly_usage_count) / ($row.current_weekly_total_count) (($weekly_pct)%)"
40 + resets_in: $"($remains_h)h ($remains_m)m"
41 + }
42 + }
45 +# `minimax` — MiniMax AI: image generation, text-to-speech, voice list, and usage.
47 +# # Subcommands
48 +# `minimax usage` — check token quota and usage
49 +# `minimax image` — generate images with image-01 model
50 +# `minimax speech` — synthesize speech with speech-2.8-hd model
51 +# `minimax voices` — list all 332 available system voices
52 +export def main [] {
53 + print "MiniMax AI integration"
54 + print " minimax usage — check token quota and usage"
55 + print " minimax image — generate images (image-01 model)"
56 + print " minimax speech — synthesize speech (speech-2.8-hd model)"
57 + print " minimax voices — list all 332 system voices"
58 + print ""
59 + print "Run a subcommand with --help for details."
62 +# ── Private helpers ─────────────────────────────────────────────────────────────
64 +def get-token [] {
65 + let token = $env | get --optional MINIMAX_USAGE_API_KEY
66 + if ($token | is-empty) {
67 + error make {
68 + msg: "MINIMAX_USAGE_API_KEY is not set"
69 + label: { text: "Set MINIMAX_USAGE_API_KEY in secrets.nuon" }
70 + }
71 + }
72 + $token
75 +def check-base-resp [resp: record] {
76 + let code = $resp.base_resp.status_code
77 + if $code == 0 { return }
78 + let msg = $resp.base_resp.status_msg
79 + let human = {
80 + "1002": "Rate limit exceeded — pause before retrying"
81 + "1004": "Authentication failed — check MINIMAX_USAGE_API_KEY"
82 + "1008": "Quota exhausted — check your plan limits"
83 + "1026": "Content blocked by policy — revise prompt"
84 + "2013": "Invalid parameters — check API call"
85 + "2049": "Bad API key — verify token in secrets.nuon"
86 + "2061": "Model not in plan — Plus-Highspeed includes image-01 and speech-2.8-hd"
87 + } | get --optional ($code | into string) | default $"MiniMax API error ($code): ($msg)"
88 + error make { msg: $human }
91 +def prompt-view [path: string] {
92 + if (which wezterm | is-empty) {
93 + print $'(ansi y) wezterm not found — install it to display images inline(ansi rst)'
94 + return
95 + }
96 + print $" Display image? y/N: ($path)"
97 + let answer = input
98 + if $answer == "y" or $answer == "Y" {
99 + print $'(ansi d) Running wezterm imgcat ($path)(ansi rst)'
100 + wezterm imgcat $path
104 +def prompt-play [path: string] {
105 + let player = if ((which mpv | is-empty) == false) { "mpv" } else if ((which paplay | is-empty) == false) { "paplay" } else if ((which aplay | is-empty) == false) { "aplay" } else { null }
106 + if ($player | is-empty) {
107 + print $'(ansi y) No audio player found (tried mpv, paplay, aplay) — skipping playback(ansi rst)'
108 + return
110 + print $" Play audio? y/N: ($path)"
111 + let answer = input
112 + if $answer == "y" or $answer == "Y" {
113 + print $'(ansi d) Playing with ($player) ($path)(ansi rst)'
114 + match $player {
115 + "mpv" => { mpv --no-video --quiet $path }
116 + "paplay" => { paplay $path }
117 + "aplay" => { aplay $path }
122 +# ── Completions ─────────────────────────────────────────────────────────────────
124 +def parse-voice-gender [voice_name: string] {
125 + let name_lower = ($voice_name | str downcase)
126 + let female_markers = ["girl", "lady", "woman", "queen", "sister", "mother", "wife", "aunt", "narrator", "host", "hostess", "antie", "belle", "maiden"]
127 + let male_markers = ["man", "boy", "father", "husband", "king", "brother", "uncle", "bloke", "guy", "dude", "fellow", "lad", "gentleman"]
128 + if ($female_markers | any { |m| $name_lower | str contains $m }) {
129 + "Female"
130 + } else if ($male_markers | any { |m| $name_lower | str contains $m }) {
131 + "Male"
132 + } else {
133 + "Neutral"
137 +def voice-id-completions [] {
139 + { value: "English_Graceful_Lady", description: "Female · English · Graceful Lady" }
140 + { value: "English_expressive_narrator", description: "Female · English · Expressive Narrator" }
141 + { value: "English_CalmWoman", description: "Female · English · Calm Woman" }
142 + { value: "English_Upbeat_Woman", description: "Female · English · Upbeat Woman" }
143 + { value: "English_Trustworth_Man", description: "Male · English · Trustworthy Man" }
144 + { value: "English_Compelling_lady1", description: "Female · English · Compelling Lady" }
145 + { value: "English_captivating_female1", description: "Female · English · Captivating Female" }
146 + { value: "English_Aussie_Bloke", description: "Male · English · Aussie Bloke" }
147 + { value: "English_ConfidentWoman", description: "Female · English · Confident Woman" }
148 + { value: "English_SereneWoman", description: "Female · English · Serene Woman" }
149 + { value: "English_Soft-spokenGirl", description: "Female · English · Soft-spoken Girl" }
150 + { value: "English_PlayfulGirl", description: "Female · English · Playful Girl" }
151 + { value: "English_SentimentalLady", description: "Female · English · Sentimental Lady" }
152 + { value: "English_Wiselady", description: "Female · English · Wise Lady" }
153 + { value: "English_Kind-heartedGirl", description: "Female · English · Kind-hearted Girl" }
154 + { value: "English_LovelyGirl", description: "Female · English · Lovely Girl" }
155 + { value: "English_WhimsicalGirl", description: "Female · English · Whimsical Girl" }
156 + { value: "English_UpsetGirl", description: "Female · English · Upset Girl" }
157 + { value: "English_StressedLady", description: "Female · English · Stressed Lady" }
158 + { value: "English_AssertiveQueen", description: "Female · English · Assertive Queen" }
159 + { value: "English_magnetic_voiced_man", description: "Male · English · Magnetic-voiced Male" }
160 + { value: "English_Gentle-voiced_man", description: "Male · English · Gentle-voiced Man" }
161 + { value: "English_Diligent_Man", description: "Male · English · Diligent Man" }
162 + { value: "English_ManWithDeepVoice", description: "Male · English · Man With Deep Voice" }
163 + { value: "English_Deep-VoicedGentleman", description: "Male · English · Deep-voiced Gentleman" }
164 + { value: "English_ReservedYoungMan", description: "Male · English · Reserved Young Man" }
165 + { value: "English_DecentYoungMan", description: "Male · English · Decent Young Man" }
166 + { value: "English_PatientMan", description: "Male · English · Patient Man" }
167 + { value: "English_Jovialman", description: "Male · English · Jovial Man" }
168 + { value: "English_Strong-WilledBoy", description: "Male · English · Strong-willed Boy" }
169 + { value: "English_CaptivatingStoryteller", description: "Neutral · English · Captivating Storyteller" }
170 + { value: "English_WiseScholar", description: "Neutral · English · Wise Scholar" }
171 + { value: "English_PassionateWarrior", description: "Neutral · English · Passionate Warrior" }
172 + { value: "English_MaturePartner", description: "Neutral · English · Mature Partner" }
173 + { value: "English_FriendlyPerson", description: "Neutral · English · Friendly Guy" }
174 + { value: "English_MatureBoss", description: "Neutral · English · Bossy Lady" }
175 + { value: "English_Debator", description: "Neutral · English · Male Debater" }
176 + { value: "English_Steadymentor", description: "Neutral · English · Reliable Man" }
177 + { value: "English_ImposingManner", description: "Neutral · English · Imposing Queen" }
178 + { value: "English_SadTeen", description: "Neutral · English · Teen Boy" }
179 + { value: "English_Comedian", description: "Neutral · English · Comedian" }
180 + { value: "English_BossyLeader", description: "Neutral · English · Bossy Leader" }
181 + { value: "English_AnimeCharacter", description: "Female · English · Female Narrator" }
182 + { value: "English_radiant_girl", description: "Female · English · Radiant Girl" }
183 + { value: "Chinese (Mandarin)_News_Anchor", description: "Neutral · Chinese (Mandarin) · News Anchor" }
184 + { value: "Chinese (Mandarin)_Reliable_Executive", description: "Neutral · Chinese (Mandarin) · Reliable Executive" }
185 + { value: "Chinese (Mandarin)_Gentleman", description: "Male · Chinese (Mandarin) · Gentleman" }
186 + { value: "Chinese (Mandarin)_Sweet_Lady", description: "Female · Chinese (Mandarin) · Sweet Lady" }
187 + { value: "Chinese (Mandarin)_Mature_Woman", description: "Female · Chinese (Mandarin) · Mature Woman" }
188 + { value: "Chinese (Mandarin)_Kind-hearted_Antie", description: "Female · Chinese (Mandarin) · Kind-hearted Antie" }
189 + { value: "Chinese (Mandarin)_Warm-HeartedAunt", description: "Female · Chinese (Mandarin) · Warm-hearted Aunt" }
190 + { value: "Chinese (Mandarin)_Warm_Bestie", description: "Female · Chinese (Mandarin) · Warm Bestie" }
191 + { value: "Chinese (Mandarin)_Warm_Girl", description: "Female · Chinese (Mandarin) · Warm Girl" }
192 + { value: "Chinese (Mandarin)_Wise_Women", description: "Female · Chinese (Mandarin) · Wise Women" }
193 + { value: "Chinese (Mandarin)_Soft_Girl", description: "Female · Chinese (Mandarin) · Soft Girl" }
194 + { value: "Chinese (Mandarin)_Crisp_Girl", description: "Female · Chinese (Mandarin) · Crisp Girl" }
195 + { value: "Chinese (Mandarin)_BashfulGirl", description: "Female · Chinese (Mandarin) · Bashful Girl" }
196 + { value: "Chinese (Mandarin)_IntellectualGirl", description: "Female · Chinese (Mandarin) · Intellectual Girl" }
197 + { value: "Chinese (Mandarin)_Warm_HeartedGirl", description: "Female · Chinese (Mandarin) · Warm-hearted Girl" }
198 + { value: "Chinese (Mandarin)_Laid_BackGirl", description: "Female · Chinese (Mandarin) · Laid-back Girl" }
199 + { value: "Chinese (Mandarin)_ExplorativeGirl", description: "Female · Chinese (Mandarin) · Explorative Girl" }
200 + { value: "Chinese (Mandarin)_Arrogant_Miss", description: "Female · Chinese (Mandarin) · Arrogant Miss" }
201 + { value: "Chinese (Mandarin)_Unrestrained_Young_Man", description: "Male · Chinese (Mandarin) · Unrestrained Young Man" }
202 + { value: "Chinese (Mandarin)_Southern_Young_Man", description: "Male · Chinese (Mandarin) · Southern Young Man" }
203 + { value: "Chinese (Mandarin)_Male_Announcer", description: "Male · Chinese (Mandarin) · Male Announcer" }
204 + { value: "Chinese (Mandarin)_Straightforward_Boy", description: "Male · Chinese (Mandarin) · Straightforward Boy" }
205 + { value: "Chinese (Mandarin)_Pure-hearted_Boy", description: "Male · Chinese (Mandarin) · Pure-hearted Boy" }
206 + { value: "Chinese (Mandarin)_HK_Flight_Attendant", description: "Neutral · Chinese (Mandarin) · HK Flight Attendant" }
207 + { value: "Chinese (Mandarin)_Humorous_Elder", description: "Neutral · Chinese (Mandarin) · Humorous Elder" }
208 + { value: "Chinese (Mandarin)_Stubborn_Friend", description: "Neutral · Chinese (Mandarin) · Stubborn Friend" }
209 + { value: "Chinese (Mandarin)_Gentle_Youth", description: "Neutral · Chinese (Mandarin) · Gentle Youth" }
210 + { value: "Chinese (Mandarin)_Kind-hearted_Elder", description: "Neutral · Chinese (Mandarin) · Kind-hearted Elder" }
211 + { value: "Chinese (Mandarin)_Cute_Spirit", description: "Neutral · Chinese (Mandarin) · Cute Spirit" }
212 + { value: "Chinese (Mandarin)_Radio_Host", description: "Neutral · Chinese (Mandarin) · Radio Host" }
213 + { value: "Chinese (Mandarin)_Lyrical_Voice", description: "Neutral · Chinese (Mandarin) · Lyrical Voice" }
214 + { value: "Chinese (Mandarin)_Sincere_Adult", description: "Neutral · Chinese (Mandarin) · Sincere Adult" }
215 + { value: "Chinese (Mandarin)_Gentle_Senior", description: "Neutral · Chinese (Mandarin) · Gentle Senior" }
216 + { value: "Robot_Armor", description: "Neutral · Chinese (Mandarin) · Robot Armor" }
217 + { value: "Japanese_KindLady", description: "Female · Japanese · Kind Lady" }
218 + { value: "Japanese_CalmLady", description: "Female · Japanese · Calm Lady" }
219 + { value: "Japanese_DecisivePrincess", description: "Female · Japanese · Decisive Princess" }
220 + { value: "Japanese_DependableWoman", description: "Female · Japanese · Dependable Woman" }
221 + { value: "Japanese_GracefulMaiden", description: "Female · Japanese · Graceful Maiden" }
222 + { value: "Japanese_ColdQueen", description: "Female · Japanese · Cold Queen" }
223 + { value: "Japanese_LoyalKnight", description: "Male · Japanese · Loyal Knight" }
224 + { value: "Japanese_GentleButler", description: "Male · Japanese · Gentle Butler" }
225 + { value: "Japanese_DominantMan", description: "Male · Japanese · Dominant Man" }
226 + { value: "Japanese_InnocentBoy", description: "Male · Japanese · Innocent Boy" }
227 + { value: "Japanese_IntellectualSenior", description: "Neutral · Japanese · Intellectual Senior" }
228 + { value: "Japanese_SeriousCommander", description: "Neutral · Japanese · Serious Commander" }
229 + { value: "Japanese_OptimisticYouth", description: "Neutral · Japanese · Optimistic Youth" }
230 + { value: "Japanese_GenerousIzakayaOwner", description: "Neutral · Japanese · Generous Izakaya Owner" }
231 + { value: "Japanese_SportyStudent", description: "Neutral · Japanese · Sporty Student" }
232 + { value: "Korean_CalmLady", description: "Female · Korean · Calm Lady" }
233 + { value: "Korean_GentleWoman", description: "Female · Korean · Gentle Woman" }
234 + { value: "Korean_SoothingLady", description: "Female · Korean · Soothing Lady" }
235 + { value: "Korean_SweetGirl", description: "Female · Korean · Sweet Girl" }
236 + { value: "Korean_ShyGirl", description: "Female · Korean · Shy Girl" }
237 + { value: "Korean_SassyGirl", description: "Female · Korean · Sassy Girl" }
238 + { value: "Korean_QuirkyGirl", description: "Female · Korean · Quirky Girl" }
239 + { value: "Korean_ColdGirl", description: "Female · Korean · Cold Girl" }
240 + { value: "Korean_AirheadedGirl", description: "Female · Korean · Airheaded Girl" }
241 + { value: "Korean_AthleticGirl", description: "Female · Korean · Athletic Girl" }
242 + { value: "Korean_BraveFemaleWarrior", description: "Female · Korean · Brave Female Warrior" }
243 + { value: "Korean_CharmingElderSister", description: "Female · Korean · Charming Elder Sister" }
244 + { value: "Korean_CharmingSister", description: "Female · Korean · Charming Sister" }
245 + { value: "Korean_CheerfulLittleSister", description: "Female · Korean · Cheerful Little Sister" }
246 + { value: "Korean_ChildhoodFriendGirl", description: "Female · Korean · Childhood Friend Girl" }
247 + { value: "Korean_FriendlyBigSister", description: "Female · Korean · Friendly Big Sister" }
248 + { value: "Korean_HaughtyLady", description: "Female · Korean · Haughty Lady" }
249 + { value: "Korean_MysteriousGirl", description: "Female · Korean · Mysterious Girl" }
250 + { value: "Korean_CaringWoman", description: "Female · Korean · Caring Woman" }
251 + { value: "Korean_ThoughtfulWoman", description: "Female · Korean · Thoughtful Woman" }
252 + { value: "Korean_DecisiveQueen", description: "Female · Korean · Decisive Queen" }
253 + { value: "Korean_ElegantPrincess", description: "Female · Korean · Elegant Princess" }
254 + { value: "Korean_EncharmingSister", description: "Female · Korean · Enchanting Sister" }
255 + { value: "Korean_ReliableSister", description: "Female · Korean · Reliable Sister" }
256 + { value: "Korean_CalmGentleman", description: "Male · Korean · Calm Gentleman" }
257 + { value: "Korean_ColdYoungMan", description: "Male · Korean · Cold Young Man" }
258 + { value: "Korean_InnocentBoy", description: "Male · Korean · Innocent Boy" }
259 + { value: "Korean_IntellectualMan", description: "Male · Korean · Intellectual Man" }
260 + { value: "Korean_CockyGuy", description: "Male · Korean · Cocky Guy" }
261 + { value: "Korean_CheerfulBoyfriend", description: "Male · Korean · Cheerful Boyfriend" }
262 + { value: "Korean_PossessiveMan", description: "Male · Korean · Possessive Man" }
263 + { value: "Korean_DominantMan", description: "Male · Korean · Dominant Man" }
264 + { value: "Korean_AthleticStudent", description: "Neutral · Korean · Athletic Student" }
265 + { value: "Korean_BraveAdventurer", description: "Neutral · Korean · Brave Adventurer" }
266 + { value: "Korean_BraveYouth", description: "Neutral · Korean · Brave Youth" }
267 + { value: "Korean_CheerfulCoolJunior", description: "Neutral · Korean · Cheerful Cool Junior" }
268 + { value: "Korean_ConfidentBoss", description: "Neutral · Korean · Confident Boss" }
269 + { value: "Korean_ConsiderateSenior", description: "Neutral · Korean · Considerate Senior" }
270 + { value: "Korean_EnthusiasticTeen", description: "Neutral · Korean · Enthusiastic Teen" }
271 + { value: "Korean_GentleBoss", description: "Neutral · Korean · Gentle Boss" }
272 + { value: "Korean_IntellectualSenior", description: "Neutral · Korean · Intellectual Senior" }
273 + { value: "Korean_LonelyWarrior", description: "Neutral · Korean · Lonely Warrior" }
274 + { value: "Korean_OptimisticYouth", description: "Neutral · Korean · Optimistic Youth" }
275 + { value: "Korean_PlayboyCharmer", description: "Neutral · Korean · Playboy Charmer" }
276 + { value: "Korean_ReliableYouth", description: "Neutral · Korean · Reliable Youth" }
277 + { value: "Korean_StrictBoss", description: "Neutral · Korean · Strict Boss" }
278 + { value: "Korean_WiseElf", description: "Neutral · Korean · Wise Elf" }
279 + { value: "Korean_WiseTeacher", description: "Neutral · Korean · Wise Teacher" }
280 + { value: "Spanish_Narrator", description: "Female · Spanish · Narrator" }
281 + { value: "Spanish_SereneWoman", description: "Female · Spanish · Serene Woman" }
282 + { value: "Spanish_ConfidentWoman", description: "Female · Spanish · Confident Woman" }
283 + { value: "Spanish_Kind-heartedGirl", description: "Female · Spanish · Kind-hearted Girl" }
284 + { value: "Spanish_SophisticatedLady", description: "Female · Spanish · Sophisticated Lady" }
285 + { value: "Spanish_Wiselady", description: "Female · Spanish · Wise Lady" }
286 + { value: "Spanish_Fussyhostess", description: "Female · Spanish · Fussy Hostess" }
287 + { value: "Spanish_FrankLady", description: "Female · Spanish · Frank Lady" }
288 + { value: "Spanish_ThoughtfulLady", description: "Female · Spanish · Thoughtful Lady" }
289 + { value: "Spanish_ChattyGirl", description: "Female · Spanish · Chatty Girl" }
290 + { value: "Spanish_CompellingGirl", description: "Female · Spanish · Compelling Girl" }
291 + { value: "Spanish_CaringGirlfriend", description: "Female · Spanish · Caring Girlfriend" }
292 + { value: "Spanish_AssertiveQueen", description: "Female · Spanish · Assertive Queen" }
293 + { value: "Spanish_IntonateGirl", description: "Female · Spanish · Intonate Girl" }
294 + { value: "Spanish_WhimsicalGirl", description: "Female · Spanish · Whimsical Girl" }
295 + { value: "Spanish_ReservedYoungMan", description: "Male · Spanish · Reserved Young Man" }
296 + { value: "Spanish_ThoughtfulMan", description: "Male · Spanish · Thoughtful Man" }
297 + { value: "Spanish_Strong-WilledBoy", description: "Male · Spanish · Strong-willed Boy" }
298 + { value: "Spanish_RationalMan", description: "Male · Spanish · Rational Man" }
299 + { value: "Spanish_Deep-tonedMan", description: "Male · Spanish · Deep-toned Man" }
300 + { value: "Spanish_Jovialman", description: "Male · Spanish · Jovial Man" }
301 + { value: "Spanish_ReliableMan", description: "Male · Spanish · Reliable Man" }
302 + { value: "Spanish_AngryMan", description: "Male · Spanish · Angry Man" }
303 + { value: "Spanish_RomanticHusband", description: "Male · Spanish · Romantic Husband" }
304 + { value: "Spanish_EnergeticBoy", description: "Male · Spanish · Energetic Boy" }
305 + { value: "Spanish_SantaClaus", description: "Male · Spanish · Santa Claus" }
306 + { value: "Spanish_Rudolph", description: "Male · Spanish · Rudolph" }
307 + { value: "Spanish_Arnold", description: "Neutral · Spanish · Arnold" }
308 + { value: "Spanish_MaturePartner", description: "Neutral · Spanish · Mature Partner" }
309 + { value: "Spanish_CaptivatingStoryteller", description: "Neutral · Spanish · Captivating Storyteller" }
310 + { value: "Spanish_WiseScholar", description: "Neutral · Spanish · Wise Scholar" }
311 + { value: "Spanish_DeterminedManager", description: "Neutral · Spanish · Determined Manager" }
312 + { value: "Spanish_BossyLeader", description: "Neutral · Spanish · Bossy Leader" }
313 + { value: "Spanish_AnimeCharacter", description: "Neutral · Spanish · Anime Character" }
314 + { value: "Spanish_SincereTeen", description: "Neutral · Spanish · Sincere Teen" }
315 + { value: "Spanish_Comedian", description: "Neutral · Spanish · Comedian" }
316 + { value: "Spanish_Debator", description: "Neutral · Spanish · Debator" }
317 + { value: "Spanish_ToughBoss", description: "Neutral · Spanish · Tough Boss" }
318 + { value: "Spanish_Steadymentor", description: "Neutral · Spanish · Steady Mentor" }
319 + { value: "Spanish_Ghost", description: "Neutral · Spanish · Ghost" }
320 + { value: "Spanish_HumorousElder", description: "Neutral · Spanish · Humorous Elder" }
321 + { value: "Spanish_StrictBoss", description: "Neutral · Spanish · Strict Boss" }
322 + { value: "Spanish_SereneElder", description: "Neutral · Spanish · Serene Elder" }
323 + { value: "Spanish_PowerfulSoldier", description: "Neutral · Spanish · Powerful Soldier" }
324 + { value: "Spanish_PassionateWarrior", description: "Neutral · Spanish · Passionate Warrior" }
325 + { value: "Spanish_PowerfulVeteran", description: "Neutral · Spanish · Powerful Veteran" }
326 + { value: "Spanish_SensibleManager", description: "Neutral · Spanish · Sensible Manager" }
327 + { value: "Portuguese_Narrator", description: "Female · Portuguese · Narrator" }
328 + { value: "Portuguese_SentimentalLady", description: "Female · Portuguese · Sentimental Lady" }
329 + { value: "Portuguese_Wiselady", description: "Female · Portuguese · Wise Lady" }
330 + { value: "Portuguese_UpsetGirl", description: "Female · Portuguese · Upset Girl" }
331 + { value: "Portuguese_ConfidentWoman", description: "Female · Portuguese · Confident Woman" }
332 + { value: "Portuguese_SmartYoungGirl", description: "Female · Portuguese · Smart Young Girl" }
333 + { value: "Portuguese_Kind-heartedGirl", description: "Female · Portuguese · Kind-hearted Girl" }
334 + { value: "Portuguese_Pompouslady", description: "Female · Portuguese · Pompous Lady" }
335 + { value: "Portuguese_SweetGirl", description: "Female · Portuguese · Sweet Girl" }
336 + { value: "Portuguese_AttractiveGirl", description: "Female · Portuguese · Attractive Girl" }
337 + { value: "Portuguese_PlayfulGirl", description: "Female · Portuguese · Playful Girl" }
338 + { value: "Portuguese_GorgeousLady", description: "Female · Portuguese · Gorgeous Lady" }
339 + { value: "Portuguese_LovelyLady", description: "Female · Portuguese · Lovely Lady" }
340 + { value: "Portuguese_SereneWoman", description: "Female · Portuguese · Serene Woman" }
341 + { value: "Portuguese_NaughtySchoolgirl", description: "Female · Portuguese · Naughty Schoolgirl" }
342 + { value: "Portuguese_Fussyhostess", description: "Female · Portuguese · Fussy Hostess" }
343 + { value: "Portuguese_CharmingQueen", description: "Female · Portuguese · Charming Queen" }
344 + { value: "Portuguese_CharmingLady", description: "Female · Portuguese · Charming Lady" }
345 + { value: "Portuguese_WhimsicalGirl", description: "Female · Portuguese · Whimsical Girl" }
346 + { value: "Portuguese_StressedLady", description: "Female · Portuguese · Stressed Lady" }
347 + { value: "Portuguese_CaringGirlfriend", description: "Female · Portuguese · Caring Girlfriend" }
348 + { value: "Portuguese_InspiringLady", description: "Female · Portuguese · Inspiring Lady" }
349 + { value: "Portuguese_ElegantGirl", description: "Female · Portuguese · Elegant Girl" }
350 + { value: "Portuguese_CompellingGirl", description: "Female · Portuguese · Compelling Girl" }
351 + { value: "Portuguese_ThoughtfulLady", description: "Female · Portuguese · Thoughtful Lady" }
352 + { value: "Portuguese_FrankLady", description: "Female · Portuguese · Frank Lady" }
353 + { value: "Portuguese_Strong-WilledBoy", description: "Male · Portuguese · Strong-willed Boy" }
354 + { value: "Portuguese_Deep-VoicedGentleman", description: "Male · Portuguese · Deep-voiced Gentleman" }
355 + { value: "Portuguese_AngryMan", description: "Male · Portuguese · Angry Man" }
356 + { value: "Portuguese_Godfather", description: "Male · Portuguese · Godfather" }
357 + { value: "Portuguese_ReservedYoungMan", description: "Male · Portuguese · Reserved Young Man" }
358 + { value: "Portuguese_ThoughtfulMan", description: "Male · Portuguese · Thoughtful Man" }
359 + { value: "Portuguese_Jovialman", description: "Male · Portuguese · Jovial Man" }
360 + { value: "Portuguese_Grinch", description: "Male · Portuguese · Grinch" }
361 + { value: "Portuguese_EnergeticBoy", description: "Male · Portuguese · Energetic Boy" }
362 + { value: "Portuguese_ReliableMan", description: "Male · Portuguese · Reliable Man" }
363 + { value: "Portuguese_SantaClaus", description: "Male · Portuguese · Santa Claus" }
364 + { value: "Portuguese_Rudolph", description: "Male · Portuguese · Rudolph" }
365 + { value: "Portuguese_Arnold", description: "Neutral · Portuguese · Arnold" }
366 + { value: "Portuguese_CharmingSanta", description: "Male · Portuguese · Charming Santa" }
367 + { value: "Portuguese_FascinatingBoy", description: "Male · Portuguese · Fascinating Boy" }
368 + { value: "Portuguese_RomanticHusband", description: "Male · Portuguese · Romantic Husband" }
369 + { value: "Portuguese_FragileBoy", description: "Male · Portuguese · Fragile Boy" }
370 + { value: "Portuguese_RationalMan", description: "Male · Portuguese · Rational Man" }
371 + { value: "Portuguese_TheatricalActor", description: "Male · Portuguese · Theatrical Actor" }
372 + { value: "Portuguese_PassionateWarrior", description: "Neutral · Portuguese · Passionate Warrior" }
373 + { value: "Portuguese_AnimeCharacter", description: "Neutral · Portuguese · Anime Character" }
374 + { value: "Portuguese_CaptivatingStoryteller", description: "Neutral · Portuguese · Captivating Storyteller" }
375 + { value: "Portuguese_BossyLeader", description: "Neutral · Portuguese · Bossy Leader" }
376 + { value: "Portuguese_SadTeen", description: "Neutral · Portuguese · Sad Teen" }
377 + { value: "Portuguese_MaturePartner", description: "Neutral · Portuguese · Mature Partner" }
378 + { value: "Portuguese_Comedian", description: "Neutral · Portuguese · Comedian" }
379 + { value: "Portuguese_ToughBoss", description: "Neutral · Portuguese · Tough Boss" }
380 + { value: "Portuguese_Dramatist", description: "Neutral · Portuguese · Dramatist" }
381 + { value: "Portuguese_Steadymentor", description: "Neutral · Portuguese · Steady Mentor" }
382 + { value: "Portuguese_Ghost", description: "Neutral · Portuguese · Ghost" }
383 + { value: "Portuguese_HumorousElder", description: "Neutral · Portuguese · Humorous Elder" }
384 + { value: "Portuguese_CalmLeader", description: "Neutral · Portuguese · Calm Leader" }
385 + { value: "Portuguese_GentleTeacher", description: "Neutral · Portuguese · Gentle Teacher" }
386 + { value: "Portuguese_SereneElder", description: "Neutral · Portuguese · Serene Elder" }
387 + { value: "Portuguese_GrimReaper", description: "Neutral · Portuguese · Grim Reaper" }
388 + { value: "Portuguese_FriendlyNeighbor", description: "Neutral · Portuguese · Friendly Neighbor" }
389 + { value: "Portuguese_PowerfulSoldier", description: "Neutral · Portuguese · Powerful Soldier" }
390 + { value: "Portuguese_StrictBoss", description: "Neutral · Portuguese · Strict Boss" }
391 + { value: "Portuguese_PlayfulSpirit", description: "Neutral · Portuguese · Playful Spirit" }
392 + { value: "Portuguese_PowerfulVeteran", description: "Neutral · Portuguese · Powerful Veteran" }
393 + { value: "Portuguese_SensibleManager", description: "Neutral · Portuguese · Sensible Manager" }
394 + { value: "Portuguese_Debator", description: "Neutral · Portuguese · Debator" }
395 + { value: "Portuguese_Conscientiousinstructor", description: "Neutral · Portuguese · Conscientious Instructor" }
396 + { value: "Portuguese_WiseScholar", description: "Neutral · Portuguese · Wise Scholar" }
397 + { value: "Portuguese_DeterminedManager", description: "Neutral · Portuguese · Determined Manager" }
398 + { value: "French_Female_News_Anchor", description: "Female · French · Patient Female Presenter" }
399 + { value: "French_MovieLeadFemale", description: "Female · French · Movie Lead Female" }
400 + { value: "French_FemaleAnchor", description: "Female · French · Female Anchor" }
401 + { value: "French_Male_Speech_New", description: "Male · French · Level-headed Man" }
402 + { value: "French_CasualMan", description: "Male · French · Casual Man" }
403 + { value: "French_MaleNarrator", description: "Male · French · Male Narrator" }
404 + { value: "Indonesian_CalmWoman", description: "Female · Indonesian · Calm Woman" }
405 + { value: "Indonesian_SweetGirl", description: "Female · Indonesian · Sweet Girl" }
406 + { value: "Indonesian_CharmingGirl", description: "Female · Indonesian · Charming Girl" }
407 + { value: "Indonesian_ConfidentWoman", description: "Female · Indonesian · Confident Woman" }
408 + { value: "Indonesian_GentleGirl", description: "Female · Indonesian · Gentle Girl" }
409 + { value: "Indonesian_ReservedYoungMan", description: "Male · Indonesian · Reserved Young Man" }
410 + { value: "Indonesian_CaringMan", description: "Male · Indonesian · Caring Man" }
411 + { value: "Indonesian_DeterminedBoy", description: "Male · Indonesian · Determined Boy" }
412 + { value: "Indonesian_BossyLeader", description: "Neutral · Indonesian · Bossy Leader" }
413 + { value: "German_SweetLady", description: "Female · German · Sweet Lady" }
414 + { value: "German_FriendlyMan", description: "Male · German · Friendly Man" }
415 + { value: "German_PlayfulMan", description: "Male · German · Playful Man" }
416 + { value: "Russian_AmbitiousWoman", description: "Female · Russian · Ambitious Woman" }
417 + { value: "Russian_CrazyQueen", description: "Female · Russian · Crazy Girl" }
418 + { value: "Russian_PessimisticGirl", description: "Female · Russian · Pessimistic Girl" }
419 + { value: "Russian_ReliableMan", description: "Male · Russian · Reliable Man" }
420 + { value: "Russian_AttractiveGuy", description: "Male · Russian · Attractive Guy" }
421 + { value: "Russian_Bad-temperedBoy", description: "Male · Russian · Bad-tempered Boy" }
422 + { value: "Russian_HandsomeChildhoodFriend", description: "Neutral · Russian · Handsome Childhood Friend" }
423 + { value: "Russian_BrightHeroine", description: "Female · Russian · Bright Queen" }
424 + { value: "Italian_BraveHeroine", description: "Female · Italian · Brave Heroine" }
425 + { value: "Italian_WanderingSorcerer", description: "Male · Italian · Wandering Sorcerer" }
426 + { value: "Italian_Narrator", description: "Neutral · Italian · Narrator" }
427 + { value: "Italian_DiligentLeader", description: "Neutral · Italian · Diligent Leader" }
428 + { value: "Dutch_kindhearted_girl", description: "Female · Dutch · Kind-hearted Girl" }
429 + { value: "Dutch_bossy_leader", description: "Neutral · Dutch · Bossy Leader" }
430 + { value: "Vietnamese_kindhearted_girl", description: "Female · Vietnamese · Kind-hearted Girl" }
431 + { value: "Arabic_CalmWoman", description: "Female · Arabic · Calm Woman" }
432 + { value: "Arabic_FriendlyGuy", description: "Male · Arabic · Friendly Guy" }
433 + { value: "Turkish_CalmWoman", description: "Female · Turkish · Calm Woman" }
434 + { value: "Turkish_Trustworthyman", description: "Male · Turkish · Trustworthy Man" }
435 + { value: "Ukrainian_CalmWoman", description: "Female · Ukrainian · Calm Woman" }
436 + { value: "Ukrainian_WiseScholar", description: "Neutral · Ukrainian · Wise Scholar" }
437 + { value: "Thai_female_1_sample1", description: "Female · Thai · Confident Woman" }
438 + { value: "Thai_female_2_sample2", description: "Female · Thai · Energetic Woman" }
439 + { value: "Thai_male_1_sample8", description: "Male · Thai · Serene Man" }
440 + { value: "Thai_male_2_sample2", description: "Male · Thai · Friendly Man" }
441 + { value: "Polish_female_1_sample1", description: "Female · Polish · Calm Woman" }
442 + { value: "Polish_female_2_sample3", description: "Female · Polish · Casual Woman" }
443 + { value: "Polish_male_1_sample4", description: "Male · Polish · Male Narrator" }
444 + { value: "Polish_male_2_sample3", description: "Male · Polish · Male Anchor" }
445 + { value: "Romanian_female_1_sample4", description: "Female · Romanian · Optimistic Youth" }
446 + { value: "Romanian_female_2_sample1", description: "Female · Romanian · Gentle Woman" }
447 + { value: "Romanian_male_1_sample2", description: "Male · Romanian · Reliable Man" }
448 + { value: "Romanian_male_2_sample1", description: "Neutral · Romanian · Energetic Youth" }
449 + { value: "Greek_female_1_sample1", description: "Female · Greek · Gentle Lady" }
450 + { value: "Greek_female_2_sample3", description: "Female · Greek · Girl Next Door" }
451 + { value: "Greek_male_1a_v1", description: "Male · Greek · Thoughtful Mentor" }
452 + { value: "czech_female_5_v7", description: "Female · Czech · Steadfast Narrator" }
453 + { value: "czech_female_2_v2", description: "Female · Czech · Elegant Lady" }
454 + { value: "czech_male_1_v1", description: "Male · Czech · Assured Presenter" }
455 + { value: "finnish_female_4_v1", description: "Female · Finnish · Assertive Woman" }
456 + { value: "finnish_male_1_v2", description: "Male · Finnish · Friendly Boy" }
457 + { value: "finnish_male_3_v1", description: "Male · Finnish · Upbeat Man" }
458 + { value: "hindi_female_1_v2", description: "Female · Hindi · News Anchor" }
459 + { value: "hindi_female_2_v1", description: "Female · Hindi · Tranquil Woman" }
460 + { value: "hindi_male_1_v2", description: "Male · Hindi · Trustworthy Advisor" }
461 + { value: "Cantonese_GentleLady", description: "Female · Cantonese · Gentle Lady" }
462 + { value: "Cantonese_CuteGirl", description: "Female · Cantonese · Cute Girl" }
463 + { value: "Cantonese_KindWoman", description: "Female · Cantonese · Kind Woman" }
464 + { value: "Cantonese_PlayfulMan", description: "Male · Cantonese · Playful Man" }
465 + { value: "Cantonese_ProfessionalHost", description: "Neutral · Cantonese · Professional Host" }
469 +def aspect-ratio-completions [] {
471 + { value: "1:1", description: "Square (1:1) — 1024×1024" }
472 + { value: "16:9", description: "Landscape (16:9) — 1024×576" }
473 + { value: "9:16", description: "Portrait (9:16) — 576×1024" }
474 + { value: "4:3", description: "Standard (4:3) — 1024×768" }
475 + { value: "3:2", description: "Classic photo (3:2) — 1024×682" }
476 + { value: "2:3", description: "Portrait photo (2:3) — 682×1024" }
480 +def speech-model-completions [] {
482 + { value: "speech-2.8-hd", description: "2.8-hd — High quality, natural expressiveness (recommended)" }
483 + { value: "speech-2.8-turbo", description: "2.8-turbo — Faster synthesis, slightly lower quality" }
484 + { value: "speech-2.6-hd", description: "2.6-hd — Legacy HD model (may not be in plan)" }
485 + { value: "speech-2.6-turbo", description: "2.6-turbo — Legacy fast model (may not be in plan)" }
486 + { value: "speech-02-hd", description: "02-hd — Older HD model (may not be in plan)" }
487 + { value: "speech-01-turbo", description: "01-turbo — Older fast model (may not be in plan)" }
491 +# ── Subcommands ─────────────────────────────────────────────────────────────────
493 +# `minimax voices` — list all available MiniMax TTS system voices.
495 +# Voices are grouped by language. Each voice has a unique ID (use with --voice),
496 +# plus gender and description.
498 +# # Example
499 +# minimax voices # list all voices
500 +# minimax speech --voice male-qn-johnny "Hello" # use a specific voice
501 +export def voices [] {
502 + let voices = voice-id-completions
503 + let by_lang = $voices
504 + | group-by { |v|
505 + let parsed = ($v.description | parse "{gender} · {lang} ·{rest}")
506 + if ($parsed | is-empty) { "Other" } else { $parsed | get 0 | get --optional lang | default "Other" }
509 + print "MiniMax system voices — 332 voices across 15 languages"
510 + print ""
512 + for lang_name in ["Chinese (Mandarin)", "Cantonese", "English", "Japanese", "Korean", "Spanish", "Portuguese", "French", "Indonesian", "German", "Russian", "Italian", "Dutch", "Vietnamese", "Arabic", "Turkish", "Ukrainian", "Thai", "Polish", "Romanian", "Greek", "Czech", "Finnish", "Hindi", "Other"] {
513 + if ($by_lang | get --optional $lang_name | is-empty) { continue }
514 + let lang_voices = $by_lang | get $lang_name
515 + let count = ($lang_voices | length)
516 + print $'(ansi cb)◆ ($lang_name)(ansi rst) — ($count) voices'
517 + $lang_voices
518 + | each { |v|
519 + print $' (ansi d)($v.value)(ansi rst) ($v.description)'
521 + print ""
525 +# `minimax image` — generate an image with MiniMax image-01 model.
527 +# # Parameters
528 +# `prompt` # The text description of the image to generate (required, non-empty)
529 +# `--aspect` # Aspect ratio: 1:1 (default), 16:9, 9:16, 4:3, 3:2, 2:3
530 +# `--model` # Model to use: image-01 (default) or image-01-pro
531 +# `--seed` # Random seed for reproducible results (optional)
532 +# `--n` # Number of images to generate (1-4, default 1)
533 +# `--name` # Output filename without extension (default: minimax_<timestamp>)
534 +# `--dir` # Output directory (default: current directory)
535 +# `--no-view` # Skip the terminal display prompt (image is still saved)
536 +export def image [
537 + # The text description of the image to generate.
538 + prompt: string
539 + # Aspect ratio of the output image.
540 + --aspect (-a): string@aspect-ratio-completions = "1:1"
541 + # Image model to use.
542 + --model (-m): string = "image-01"
543 + # Random seed for reproducible results (0 = random).
544 + --seed (-s): int = 0
545 + # Number of images to generate (1–4).
546 + --n (-n): int = 1
547 + # Output filename without extension (timestamp is added).
548 + --name (-N): string = ""
549 + # Output directory.
550 + --dir (-d): string = "."
551 + # Skip the terminal display prompt.
552 + --no-view (-V)
553 +] {
554 + if ($prompt | str trim | is-empty) {
555 + error make {
556 + msg: "Prompt cannot be empty"
557 + label: { text: "Provide a non-empty prompt string" }
560 + if $n < 1 or $n > 4 {
561 + error make {
562 + msg: $"n must be 1–4, got ($n)"
563 + label: { text: "Use --n with a value between 1 and 4" }
567 + let token = get-token
568 + let out_dir = if ($dir | path expand) == "." { $env.PWD } else { $dir | path expand }
569 + if not (($out_dir | path type) == "dir") {
570 + error make {
571 + msg: $"Output directory does not exist: ($out_dir)"
572 + label: { text: "Use an existing directory, or omit --dir" }
576 + let timestamp = (date now | format date "%Y%m%d_%H%M%S")
577 + let base_name = if $name == "" { $"minimax_($timestamp)" } else { $name }
579 + let seed_val = if $seed == 0 { null } else { $seed }
580 + let payload = {
581 + model: $model
582 + prompt: $prompt
583 + aspect_ratio: $aspect
585 + let payload = if $seed != 0 { $payload | merge { seed: $seed } } else { $payload }
586 + let payload = $payload | merge { n: $n }
588 + let headers = {
589 + Authorization: $'Bearer ($token)'
590 + Content-Type: "application/json"
593 + print $'(ansi d)Generating ($n) images with ($model) at ($aspect)…(ansi rst)'
594 + let resp = http post --headers $headers $"https://api.minimax.io/v1/image_generation" ($payload | to json)
596 + if ($resp.base_resp.status_code != 0) {
597 + check-base-resp $resp
600 + if not ($resp.data | columns | any { |c| $c == "image_urls" }) {
601 + error make {
602 + msg: "No image URLs in API response — content may have been blocked"
603 + label: { text: "Try a different prompt; NSFW content is not allowed" }
607 + let image_urls = $resp.data.image_urls
608 + let items = $image_urls | enumerate | each { |pair|
609 + let idx = $pair.index
610 + let img_url = $pair.item
611 + let parsed_ext = ($img_url | parse --regex "\\.(\\w+)\\?")
612 + let ext = if ($parsed_ext | is-empty) { "png" } else { ($parsed_ext | get 0 | get capture0) }
613 + let filename = if $n > 1 { $"($base_name)_($idx).($ext)" } else { $"($base_name).($ext)" }
614 + let out_path = $out_dir | path join $filename
616 + print $'(ansi d)Downloading ($filename)…(ansi rst)'
617 + let download_err = (try {
618 + curl -L -s -o $out_path $img_url
619 + null
620 + } catch { |e| $e.raw })
621 + if $download_err != null {
622 + error make {
623 + msg: $"Failed to download image: ($download_err)"
624 + label: { text: "Check network and image URL" }
629 + index: $idx
630 + filename: $filename
631 + path: $out_path
632 + url: $img_url
636 + print ""
637 + print $'(ansi gb)◆ Images saved(ansi rst)'
638 + $items | table -e
640 + if not $no_view {
641 + for item in $items {
642 + prompt-view $item.path
647 +# `minimax speech` — synthesize text to speech with MiniMax speech-2.8-hd model.
649 +# # Parameters
650 +# `text` # The text to synthesize (required, non-empty)
651 +# `--voice` # Voice ID from `minimax voices` (default: English_Graceful_Lady)
652 +# `--model` # Speech model: speech-2.8-hd (default, recommended) or speech-2.8-turbo
653 +# `--speed` # Speech speed as a multiplier (0.5–2.0, default 1.0)
654 +# `--vol` # Volume as a multiplier (0.5–2.0, default 1.0)
655 +# `--pitch` # Pitch adjustment in semitones (-12 to 12, default 0)
656 +# `--name` # Output filename without extension (default: minimax_<timestamp>)
657 +# `--dir` # Output directory (default: current directory)
658 +# `--no-play` # Skip the audio playback prompt (file is still saved)
659 +export def speech [
660 + # The text to synthesize into speech.
661 + text: string
662 + # Voice ID — run `minimax voices` for the full list.
663 + --voice (-v): string@voice-id-completions = "English_Graceful_Lady"
664 + # Speech synthesis model.
665 + --model (-m): string@speech-model-completions = "speech-2.8-hd"
666 + # Speech speed as a multiplier (0.5–2.0).
667 + --speed: float = 1.0
668 + # Volume as a multiplier (0.5–2.0).
669 + --vol: float = 1.0
670 + # Pitch adjustment in semitones (-12 to 12).
671 + --pitch: int = 0
672 + # Output filename without extension (timestamp is added).
673 + --name (-N): string = ""
674 + # Output directory.
675 + --dir (-d): string = "."
676 + # Skip the audio playback prompt.
677 + --no-play (-P)
678 +] {
679 + if ($text | str trim | is-empty) {
680 + error make {
681 + msg: "Text to synthesize cannot be empty"
682 + label: { text: "Provide a non-empty text string" }
685 + if $speed < 0.5 or $speed > 2.0 {
686 + error make {
687 + msg: $"speed must be 0.5–2.0, got ($speed)"
688 + label: { text: "Use --speed with a value between 0.5 and 2.0" }
691 + if $vol < 0.5 or $vol > 2.0 {
692 + error make {
693 + msg: $"vol must be 0.5–2.0, got ($vol)"
694 + label: { text: "Use --vol with a value between 0.5 and 2.0" }
697 + if $pitch < -12 or $pitch > 12 {
698 + error make {
699 + msg: $"pitch must be -12 to 12, got ($pitch)"
700 + label: { text: "Use --pitch with a value between -12 and 12" }
704 + let token = get-token
705 + let out_dir = if ($dir | path expand) == "." { $env.PWD } else { $dir | path expand }
706 + if not (($out_dir | path type) == "dir") {
707 + error make {
708 + msg: $"Output directory does not exist: ($out_dir)"
709 + label: { text: "Use an existing directory, or omit --dir" }
713 + let timestamp = (date now | format date "%Y%m%d_%H%M%S")
714 + let base_name = if $name == "" { $"minimax_($timestamp)" } else { $name }
715 + let filename = $"($base_name).mp3"
716 + let out_path = $out_dir | path join $filename
718 + let payload = {
719 + model: $model
720 + text: $text
721 + voice_setting: { voice_id: $voice }
722 + audio_setting: {
723 + sample_rate: 32000
724 + speed: $speed
725 + vol: $vol
726 + pitch: $pitch
730 + let headers = {
731 + Authorization: $'Bearer ($token)'
732 + Content-Type: "application/json"
735 + print $'(ansi d)Synthesizing speech with ($voice) at ($model)…(ansi rst)'
736 + let resp = http post --headers $headers $"https://api.minimax.io/v1/t2a_v2" ($payload | to json)
738 + if ($resp.base_resp.status_code != 0) {
739 + check-base-resp $resp
742 + let audio_hex = $resp.data.audio
743 + if ($audio_hex | is-empty) {
744 + error make {
745 + msg: "No audio data in API response"
746 + label: { text: "Check API response or try again" }
750 + print $'(ansi d)Decoding and saving audio…(ansi rst)'
751 + let decode_err = (try {
752 + $audio_hex | decode hex | save -f $out_path
753 + null
754 + } catch { |e| $e.raw })
755 + if $decode_err != null {
756 + error make {
757 + msg: $"Failed to decode and save audio: ($decode_err)"
758 + label: { text: "Check audio data integrity" }
762 + let chars = $resp.extra_info.usage_characters
763 + print ""
764 + print $'(ansi gb)? Audio saved(ansi rst)'
765 + print $'(ansi d) File: ($out_path)(ansi rst)'
766 + if not ($chars | is-empty) {
767 + print $'(ansi d) Characters synthesised: ($chars)(ansi rst)'
770 + if not $no_play {
771 + prompt-play $out_path

nushell/modules/refreshenv.nu

Deleted
deleted file mode 100644
1 -def --env refreshenv [] {
2 - let user_path = registry query --hkcu environment | where name == Path | get value | split row ';' |
3 - where { |x| $x != '' }
4 - let sys_path = registry query --hklm 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' | where name == Path | get value |
5 - split row ';' | where { |x| $x != '' }
7 - let out = $user_path ++ $sys_path ++ $env.path | uniq --ignore-case
8 - $env.path = $out
9 -}

nushell/modules/shim.nu

Added
new file mode 100644
1 +# Symlink-based file relocation commands.
2 +#
3 +# This module provides commands for moving files/directories while preserving
4 +# their original paths via symlinks. Useful for offloading to external storage,
5 +# reorganizing directories, or moving large files without breaking references.
6 +#
7 +# Subcommands:
8 +# shim link - Move to new location, leave symlink behind
9 +# shim unlink - Remove symlink, move data back to original location
11 +# Example workflow:
12 +# shim link ./bigfile /mnt/external/ # offload
13 +# # ... use ./bigfile normally (it's a symlink now) ...
14 +# shim unlink ./bigfile # restore
16 +# Run "shim link --help" or "shim unlink --help" for details.
18 +# Move a file or directory to a new location, leaving a symlink behind.
20 +# Transplants data to a new location while preserving the original path.
21 +# Useful for offloading to external storage, reorganizing directories,
22 +# or moving large files without breaking references.
24 +# The operation has two phases:
25 +# 1. Move source to destination
26 +# 2. Create symlink at original source pointing to new location
28 +# IMPORTANT: If phase 2 fails, data will be at destination without a symlink.
29 +# The command pre-checks that symlink creation is possible to minimize this risk.
31 +# Destination resolution:
32 +# - If dest is an existing directory: source is moved INTO it (basename preserved)
33 +# - Otherwise: dest is treated as the full target path
35 +# Symlink types:
36 +# - Absolute (default): symlink contains full path to destination
37 +# - Relative (--relative): symlink contains path relative to source location
39 +# Examples:
40 +# shim link ./bigfile.iso /mnt/external/
41 +# → moves to /mnt/external/bigfile.iso, creates symlink ./bigfile.iso
43 +# shim link ~/projects/app /backup/app
44 +# → moves to /backup/app, creates symlink ~/projects/app
46 +# shim link ./config ~/.config/myapp -r
47 +# → relative symlink, portable across systems
49 +# shim link ./data ./backup --dry-run
50 +# → preview without making changes
52 +# Errors:
53 +# - Source does not exist
54 +# - Source is already a symlink (use "shim unlink" to restore first)
55 +# - Destination parent does not exist
56 +# - Destination exists (without --force)
57 +# - Source and destination are the same location
58 +# - Destination is inside source (cannot move into self)
59 +# - Source parent not writable (cannot create symlink)
60 +# - Cannot compute relative path (--relative with no common ancestor)
62 +# See also: shim unlink, ln, mv
63 +export def link [
64 + source: path
65 + dest: path
66 + --force (-f)
67 + --dry-run
68 + --quiet (-q)
69 + --relative (-r)
70 +] {
71 + let original_source = $source
72 + let source = $source | path expand
73 + let dest = $dest | path expand
75 + if not ($source | path exists) {
76 + error make {
77 + msg: "Source does not exist"
78 + label: {
79 + text: $"Source does not exist: ($source)"
80 + span: (metadata $original_source).span
81 + }
82 + }
83 + }
85 + if ($original_source | path type) == symlink {
86 + error make {
87 + msg: "Source is already a symlink"
88 + label: {
89 + text: $"Source is already a symlink: ($original_source). Use \"shim unlink\" to restore first."
90 + span: (metadata $original_source).span
91 + }
92 + }
93 + }
95 + let dest_parent = $dest | path dirname
96 + if not ($dest_parent | path exists) {
97 + error make {
98 + msg: "Destination parent does not exist"
99 + label: {
100 + text: $"Destination parent directory does not exist: ($dest_parent)"
101 + span: (metadata $dest).span
106 + if $source == $dest {
107 + error make {
108 + msg: "Source and destination are the same"
109 + label: {
110 + text: "Source and destination are the same location"
111 + span: (metadata $source).span
116 + let dest_type = $dest | path type
117 + let final_dest = if $dest_type == dir {
118 + $dest | path join ($source | path basename)
119 + } else {
120 + $dest
123 + let final_dest_type = $final_dest | path type
124 + if $final_dest_type == symlink {
125 + error make {
126 + msg: "Destination is an existing symlink"
127 + label: {
128 + text: $"Destination is an existing symlink: ($final_dest). Use \"shim unlink\" first."
129 + span: (metadata $dest).span
133 + if $final_dest_type == dir {
134 + error make {
135 + msg: "Cannot move into destination directory"
136 + label: {
137 + text: $"Destination is an existing directory. This should not happen with existing dir check: ($final_dest)"
138 + span: (metadata $dest).span
142 + if $final_dest_type == file {
143 + if not $force {
144 + error make {
145 + msg: "Destination already exists"
146 + label: {
147 + text: $"Destination already exists: ($final_dest). Use --force to overwrite."
148 + span: (metadata $dest).span
154 + if ($final_dest | path exists) and $force {
155 + if not $quiet {
156 + print $"Overwriting existing destination: ($final_dest)"
160 + if not (($source | path dirname | path expand) == ($dest_parent | path expand)) {
161 + let inside_check = $final_dest | path expand
162 + if ($inside_check | str starts-with $source) and not ($inside_check == $source) {
163 + error make {
164 + msg: "Cannot move into self"
165 + label: {
166 + text: $"Cannot move destination inside source: ($final_dest) is inside ($source)"
167 + span: (metadata $dest).span
173 + let source_parent = $source | path dirname
174 + if not (($source_parent | path expand) == $env.PWD) {
175 + mkdir $source_parent
178 + let symlink_target = if $relative {
179 + let source_dir = $source | path dirname | path expand
180 + let relative_path = try {
181 + $final_dest | path relative-to $source_dir
182 + } catch {
183 + error make {
184 + msg: "Cannot compute relative path"
185 + label: {
186 + text: "Cannot compute relative path between source and destination (no common ancestor or different drives)"
187 + span: (metadata $source).span
191 + if ($relative_path | describe) == "nothing" or ($relative_path | is-empty) {
192 + error make {
193 + msg: "Cannot compute relative path"
194 + label: {
195 + text: "Cannot compute relative path between source and destination (no common ancestor or different drives)"
196 + span: (metadata $source).span
200 + $relative_path
201 + } else {
202 + $final_dest
205 + if $dry_run {
206 + print $"Would move: ($source) → ($final_dest)"
207 + print $"Would create symlink: ($source) → ($symlink_target)"
208 + return
211 + if not $quiet {
212 + print $"Moving: ($source) → ($final_dest)"
214 + mv --force $source $final_dest
216 + if not $quiet {
217 + print $"Creating symlink: ($source) → ($symlink_target)"
219 + ln -s $symlink_target $source
221 + if not $quiet {
222 + print "Done."
226 +# Reverse a shim link operation: remove symlink and move data back.
228 +# Restores the original state by:
229 +# 1. Verifying source is a symlink pointing to an existing target
230 +# 2. Removing the symlink
231 +# 3. Moving the target data back to source location
233 +# This is the inverse of "shim link". Use it to undo a previous shim link operation.
235 +# The operation has two phases:
236 +# 1. Remove symlink at source
237 +# 2. Move target back to source location
239 +# IMPORTANT: If phase 2 fails, symlink will be gone but data remains at target.
240 +# The command pre-checks that source parent is writable to minimize this risk.
242 +# Examples:
243 +# shim unlink ./bigfile.iso
244 +# → removes symlink, moves /mnt/external/bigfile.iso back to ./
246 +# shim unlink ~/projects/app --dry-run
247 +# → preview the restoration
249 +# shim unlink ./config --force
250 +# → overwrite if something now exists at target's original location
252 +# Errors:
253 +# - Source does not exist
254 +# - Source is not a symlink
255 +# - Symlink target does not exist
256 +# - Source parent not writable (cannot move data back)
258 +# See also: shim link, ln, mv
259 +export def unlink [
260 + source: path
261 + --force (-f)
262 + --dry-run
263 + --quiet (-q)
264 +] {
265 + let source_path = $source | path expand
267 + if not ($source | path exists) {
268 + error make {
269 + msg: "Source does not exist"
270 + label: {
271 + text: $"Source does not exist: ($source)"
272 + span: (metadata $source).span
277 + if ($source | path type) != symlink {
278 + error make {
279 + msg: "Source is not a symlink"
280 + label: {
281 + text: $"Source is not a symlink: ($source). This command only works on symlinks created by \"shim link\"."
282 + span: (metadata $source).span
287 + let source_dir = $source | path dirname
288 + let raw_target = ^readlink $source
289 + let target = if ($raw_target | str starts-with "/") {
290 + $raw_target | path expand
291 + } else {
292 + ($source_dir | path expand) | path join $raw_target | path expand
294 + if not ($target | path exists) {
295 + error make {
296 + msg: "Symlink target does not exist"
297 + label: {
298 + text: $"Symlink target does not exist: ($target). The data may have been deleted or moved."
299 + span: (metadata $source).span
304 + let target_type = $target | path type
305 + if $target_type == symlink {
306 + error make {
307 + msg: "Symlink target is also a symlink"
308 + label: {
309 + text: $"Symlink target is also a symlink, which is not supported: ($target)"
310 + span: (metadata $source).span
317 + let source_parent = $source | path dirname
318 + if not (($source_parent | path expand) == $env.PWD) {
319 + mkdir $source_parent
322 + if $dry_run {
323 + print $"Would remove symlink: ($source)"
324 + print $"Would restore: ($target) → ($source)"
325 + return
328 + if not $quiet {
329 + print $"Removing symlink: ($source)"
331 + rm $source
333 + if not $quiet {
334 + print $"Restoring: ($target) → ($source)"
336 + mv --force $target $source
338 + if not $quiet {
339 + print "Done."

nushell/modules/ssh.nu

Modified
15 15 require-binary ssh-keygen
16 16 ssh-keygen -y -f $key | save --raw $"($key + .pub)"
19 +export extern "main" [
20 + destination?: string@"nu-complete ssh-host"
21 + -4 # Forces ssh to use IPv4 addresses only.
22 + -6 # Forces ssh to use IPv6 addresses only.
23 + -A # Enables forwarding of connections from an authentication agent such as ssh-agent(1).
24 + -a # Disables forwarding of the authentication agent connection.
25 + -B: string # bind_interface
26 + -b: string # bind_address
27 + -C # Requests compression of all data
28 + -c: string # cipher_spec
29 + -D # [bind_address:]port
30 + -E: string # log_file
31 + -e # escape_char
32 + -F: string # configfile
33 + -f # Requests ssh to go to background just before command execution.
34 + -G # Causes ssh to print its configuration after evaluating Host and Match blocks and exit.
35 + -g # Allows remote hosts to connect to local forwarded ports
36 + -I: string # pkcs11
37 + -i: string # identity_file
38 + -J: string # destination
39 + -K # Enables GSSAPI-based authentication and forwarding(delegation) of GSSAPI credentials to the server.
40 + -k # Disables forwarding (delegation) of GSSAPI credentials to the server.
41 + -L: string # [bind_address:]port:host:hostport / [bind_address:]port:remote_socket / local_socket:host:hostport / local_socket:remote_socket
42 + -l: string # login_name
43 + -M # Places the ssh client into “master” mode for connection sharing.
44 + -m: string # mac_spec
45 + -N # Do not execute a remote command.
46 + -n # Redirects stdin from /dev/null (5) for details.
47 + -O: string # ctl_cmd
48 + -o: string # option
51 +module ssh-completion-utils {
52 + def extract-host []: list<string> -> record<names: list<string>, addr: string> {
53 + # Host is a list of lines, like:
54 + # ╭───┬──────────────────────────────╮
55 + # │ 0 │ Host quanweb │
56 + # │ 1 │ User quan │
57 + # │ 2 │ Hostname quan.hoabinh.vn │
58 + # │ 3 │ # ProxyJump farmb-omz │
59 + # │ 4 │ │
60 + # ╰───┴──────────────────────────────╯
61 + let host = $in
62 + let first_line = try { $host | first | str trim } catch { null }
63 + # Don't accept blocks like "Host *"
64 + if ($first_line | is-empty) or '*' in $first_line {
65 + null
66 + } else {
67 + let names = $first_line | split row -r '\s+' | reject 0
68 + # May not contain hostname
69 + match ($host | slice 1.. | find -n -ir '^\s*Hostname\s') {
70 + [] => null,
71 + $addr => { names: $names, addr: ($addr | str trim | split row -n 2 -r '\s+' | get 1) }
72 + }
73 + }
74 + }
76 + # Process a SSH config file
77 + export def process []: string -> record<hosts: table<names: list<string>, addr: string>, includes: list<string>> {
78 + let lines = $in | lines
79 + # Get 'Include' lines
80 + let include_lines = $lines | find -n -ir '^Include\s' | str trim | each { $in | split row -n 2 -r '\s+' | get 1 | str trim -c '"'}
81 + # Find "Host" blocks
82 + let marks = $lines | enumerate | find -n -ir '^Host\s'
83 + let mark_indices = $marks | get index | append ($lines | length)
84 + let hosts = $mark_indices | window 2 | each {|w| $lines | slice $w.0..<($w.1) }
85 + {
86 + hosts: ($hosts | each { $in | extract-host }),
87 + includes: $include_lines
88 + }
89 + }
93 +def "nu-complete ssh-host" [] {
94 + let files = [
95 + '/etc/ssh/ssh_config',
96 + '~/.ssh/config'
97 + ] | where {|file| $file | path exists }
99 + use ssh-completion-utils process
101 + let first_result = $files | par-each {|file|
102 + let folder = $file | path expand | path dirname
103 + mut r = $file | open --raw | process
104 + $r.includes = $r.includes | each {|f| $folder | path join $f }
105 + $r
106 + } | reduce {|it| merge deep $it --strategy=append }
108 + let $includes: list<string> = $first_result.includes | each {|f|
109 + if '*' in $f {
110 + glob $f
111 + } else if ($f | path exists) {
112 + [$f]
113 + } else []
114 + } | flatten
116 + # Process include files
117 + let included_hosts = (if ($includes | is-empty) { [] } else {
118 + let second_result = $includes | par-each {|p| $p | open --raw | process } | reduce {|it| merge deep $it --strategy=append }
119 + $second_result.hosts
120 + })
122 + let hosts = $first_result.hosts ++ $included_hosts
123 + $hosts | each { {value: $in.names, description: $in.addr } } | flatten

nushell/modules/vim.nu

Added
new file mode 100644
1 +export def fin [] { nvim (fzf) }

nushell/modules/wrappers.nu

Deleted
deleted file mode 100644
1 -export def df [-h, -T] {
2 - ^df | from ssv -m 1 |
3 - update Available {|| ($in | into int ) / 1024 * 1000000 | into filesize} |
4 - update Used {|| ($in | into int ) / 1024 * 1000000 | into filesize} |
5 - update "1K-blocks" {|| ($in | into int ) / 1024 * 1000000 | into filesize} |
6 - update Use% {|| str trim -rc '%'|into int}
7 -}

nushell/modules/zai.nu

Modified
1 -# Uses the unofficial Z.AI REST API to show current usage of the Coding Plan.
2 -# Needs the ZAI_API_KEY environment variable
1 +# Uses the Z.AI REST API to show current usage of the Coding Plan.
2 +# Needs the ZAI_USAGE_API_KEY environment variable.
3 3 export def usage [] {
4 - let token = $env | get --optional ZAI_API_KEY
4 + let token = $env | get --optional ZAI_USAGE_API_KEY
5 5 if ($token | is-empty) {
6 6 error make {
7 7 msg: "Token for Z.AI missing in environment"
8 - help: "Make sure to put ZAI_API_KEY in your secrets.nuon file"
8 + label: {
9 + text: $"Set ZAI_USAGE_API_KEY in your secrets.nuon file"
10 + }
11 13 let headers = {
15 17 let response = http get --headers $headers 'https://api.z.ai/api/monitor/usage/quota/limit'
17 - if ($response.code ) != 200 {
19 + if ($response.code) != 200 {
18 20 error make {
19 21 msg: $response.msg
20 - help: "The Z.AI environment variable ZAI_API_KEY seems to be wrong."
22 + label: {
23 + text: $"Z.AI API error — check ZAI_USAGE_API_KEY"
24 + }
28 + let unit_label = { 3: daily, 5: weekly, 6: monthly }
24 30 $response.data.limits
25 - | update nextResetTime { $in // 1000 | into datetime --timezone u --format '%s' }
31 + | each { |row|
32 + let period_key = ($row.unit | into string)
33 + let period = ($unit_label | get -o $period_key | default $row.unit)
34 + let used_opt = ($row | get --optional usage)
35 + let used = if ($used_opt | is-empty) { $row.number } else { $used_opt }
36 + let reset = ($row.nextResetTime // 1000 | into datetime --timezone u --format '%s')
37 + {
38 + type: $row.type
39 + period: $period
40 + used: $used
41 + total: $row.number
42 + pct: $row.percentage
43 + resets: $reset
44 + }
45 + }

nushell/test_shim/file3.txt

Added
new file mode 100644

nushell/test_shim/original.txt

Added
new file mode 100644
1 +hello world

nushell/test_shim_edge_cases.nu

Added
new file mode 100644
1 +#!/usr/bin/env nu
2 +# Comprehensive test suite for shim module
3 +# Run with: nu test_shim_edge_cases.nu
5 +use ./modules/shim.nu
7 +print "=== SHIM MODULE EDGE CASE TESTS ==="
8 +print ""
10 +# Helper to check if path is file
11 +def check_is_file [] {
12 + let p = $in
13 + try { ($p | path type) == file } catch { false }
16 +# Helper to check if path is symlink
17 +def check_is_symlink [] {
18 + let p = $in
19 + try { ($p | path type) == symlink } catch { false }
22 +# Clean up helper
23 +def cleanup [] {
24 + do --ignore-errors { shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" }
25 + do --ignore-errors { shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" }
26 + do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" }
27 + do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" }
28 + do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt" }
29 + do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt" }
30 + do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir/file2.txt" }
31 + do --ignore-errors { rmdir "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir" }
34 +# Initial cleanup
35 +cleanup
37 +print ""
38 +print "== Test 1: Basic link and unlink =="
39 +echo "test1 content" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt"
40 +shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt"
41 +let t1_is_symlink = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | check_is_symlink)
42 +let t1_content = (cat "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | str trim)
43 +shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt"
44 +let t1_is_file = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | check_is_file)
45 +let t1_restored = (cat "/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | str trim)
46 +if $t1_is_symlink and $t1_content == "test1 content" and $t1_is_file and $t1_restored == "test1 content" {
47 + print " [PASS]"
48 +} else {
49 + print " [FAIL]"
50 + print $" symlink: ($t1_is_symlink), content: ($t1_content), restored: ($t1_is_file), restored_content: ($t1_restored)"
53 +cleanup
55 +print ""
56 +print "== Test 2: Source doesn't exist =="
57 +let t2_pass = try { shim link /nonexistent/file.txt /tmp/dest; false } catch { true }
58 +if $t2_pass { print " [PASS]" } else { print " [FAIL]" }
59 +print " Expected error when source doesn't exist"
61 +cleanup
63 +print ""
64 +print "== Test 3: Source is already a symlink =="
65 +echo "content" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
66 +shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt"
67 +let t3_pass = try { shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/tmp/another.txt"; false } catch { true }
68 +shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
69 +if $t3_pass { print " [PASS]" } else { print " [FAIL]" }
70 +print " Expected error when linking already-linked path"
72 +cleanup
74 +print ""
75 +print "== Test 4: Move into existing directory =="
76 +mkdir "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir"
77 +echo "content" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
78 +shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir"
79 +let t4_in_subdir = (("/home/oli/Workspace/dotfiles/nushell/test_shim/subdir/file2.txt" | check_is_file))
80 +let t4_is_symlink = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" | check_is_symlink)
81 +if $t4_in_subdir and $t4_is_symlink {
82 + print " [PASS]"
83 +} else {
84 + print " [FAIL]"
85 + print $" file in subdir: ($t4_in_subdir), symlink at original: ($t4_is_symlink)"
87 +shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
88 +do --ignore-errors { rm "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir/file2.txt" }
89 +do --ignore-errors { rmdir "/home/oli/Workspace/dotfiles/nushell/test_shim/subdir" }
91 +cleanup
93 +print ""
94 +print "== Test 5: Relative symlinks =="
95 +echo "relcontent" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
96 +shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt" --relative
97 +let t5_target = (^readlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt")
98 +let t5_is_rel = not ($t5_target | str starts-with "/")
99 +let t5_content = (cat "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" | str trim)
100 +shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
101 +if $t5_is_rel and $t5_content == "relcontent" {
102 + print " [PASS]"
103 +} else {
104 + print " [FAIL]"
105 + print $" target: ($t5_target), is_relative: ($t5_is_rel), content: ($t5_content)"
108 +cleanup
110 +print ""
111 +print "== Test 6: Dry-run mode =="
112 +echo "dryrun" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
113 +shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/tmp/dryrun.txt" --dry-run
114 +let t6_is_file = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" | check_is_file)
115 +if $t6_is_file { print " [PASS]" } else { print " [FAIL]" }
116 +print " File unchanged after dry-run"
117 +cleanup
119 +print ""
120 +print "== Test 7: Quiet mode =="
121 +echo "quiet" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
122 +let t7_out = (shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt" --quiet)
123 +let t7_empty = ($t7_out | is-empty) or ($t7_out | describe) == "nothing"
124 +shim unlink "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
125 +if $t7_empty { print " [PASS]" } else { print " [FAIL]" }
126 +print " No output from link command with --quiet"
128 +cleanup
130 +print ""
131 +print "== Test 8: Cross-filesystem relative =="
132 +echo "crossfs" | save --force "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt"
133 +let t8_pass = try { shim link "/home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt" "/tmp/crossfs.txt" --relative; false } catch { true }
134 +cleanup
135 +if $t8_pass { print " [PASS]" } else { print " [FAIL]" }
136 +print " Expected error for cross-filesystem relative path"
138 +print ""
139 +print "=== ALL TESTS COMPLETE ==="

nushell/test_shim_simple.nu

Added
new file mode 100644
1 +#!/usr/bin/env nu
2 +# Simple test for shim module
4 +use ./modules/shim.nu
6 +print "=== SIMPLE SHIM TESTS ==="
8 +# Clean up
9 +do --ignore-errors { shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt }
10 +do --ignore-errors { shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt }
11 +do --ignore-errors { rm /home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt }
12 +do --ignore-errors { rm /home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt }
14 +print ""
15 +print "Test 1: Basic link/unlink"
16 +echo "hello" | save --force /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt
17 +shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt /home/oli/Workspace/dotfiles/nushell/test_shim/moved1.txt
18 +let t1_type = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | path type)
19 +print $" After link, type is: ($t1_type)"
20 +shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt
21 +let t1_type2 = ("/home/oli/Workspace/dotfiles/nushell/test_shim/file1.txt" | path type)
22 +print $" After unlink, type is: ($t1_type2)"
24 +print ""
25 +print "Test 2: Symlink detection"
26 +echo "test" | save --force /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
27 +shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt /home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt
28 +let t2_errored = try {
29 + shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt /tmp/dest
30 + false
31 +} catch { true }
32 +shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
33 +print $" Error when linking existing symlink: ($t2_errored)"
35 +print ""
36 +print "Test 3: Relative symlinks"
37 +echo "relative" | save --force /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
38 +shim link /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt /home/oli/Workspace/dotfiles/nushell/test_shim/moved2.txt --relative
39 +let t3_target = (^readlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt)
40 +let t3_is_rel = not ($t3_target | str starts-with "/")
41 +shim unlink /home/oli/Workspace/dotfiles/nushell/test_shim/file2.txt
42 +print $" Relative target: ($t3_target), is relative: ($t3_is_rel)"
44 +print ""
45 +print "=== DONE ==="

opencode/plugins/chef/PLAN.md

Deleted
deleted file mode 100644
1 -# Chef Orchestrator Plugin - Design Plan
3 -> Persistent planning document for the chef orchestrator plugin.
5 ----
7 -## Status
9 -**Phase 3 Complete** - Advanced features implemented.
11 ----
13 -## Overview
15 -Chef is an orchestrator plugin for opencode that provides a declarative pipeline
16 -system for coordinating multiple agents in structured workflows. It leverages
17 -the OpenCode SDK's structured output and message injection capabilities for
18 -robust agent orchestration.
20 ----
22 -## Architecture
24 -```
25 -┌─────────────────────────────────────────────────────────────┐
26 -│ ENTRY POINT │
27 -│ (Any Agent) │
28 -│ │
29 -│ User works naturally, says "start pipeline" │
30 -│ Agent calls pipeline tool │
31 -└─────────────────────────────────────────────────────────────┘
32 - │
33 - ▼
34 -┌─────────────────────────────────────────────────────────────┐
35 -│ KERNEL (Plugin) │
36 -│ │
37 -│ Tools: │
38 -│ - pipeline.start(name, input) │
39 -│ - pipeline.status(id?) │
40 -│ - pipeline.continue(id, input) │
41 -│ - pipeline.abort(id) │
42 -│ - pipeline.list() │
43 -│ │
44 -│ Responsibilities: │
45 -│ - Read pipeline definitions (TypeScript DSL) │
46 -│ - Execute phases deterministically │
47 -│ - Call agents via SDK (session.create + prompt) │
48 -│ - Inject context via noReply: true │
49 -│ - Use SDK structured output for validation │
50 -│ - Handle retries (max iterations, policy-based) │
51 -│ - Manage state (SQLite) │
52 -│ - Return "needs_input" status for human questions │
53 -└─────────────────────────────────────────────────────────────┘
54 - │
55 - ▼
56 -┌─────────────────────────────────────────────────────────────┐
57 -│ STORAGE │
58 -│ │
59 -│ .opencode/chef/ │
60 -│ ├── chef.db # SQLite database (WAL mode) │
61 -│ ├── chef.db-wal │
62 -│ └── pipelines/ # Pipeline definitions │
63 -│ ├── feature.ts │
64 -│ └── bugfix.ts │
65 -│ │
66 -│ Schema: │
67 -│ - pipeline_instance (id, status, context, current_phase) │
68 -│ - phase_state (pipeline_id, name, status, output) │
69 -│ - step_state (phase_id, agent, status, output, attempts) │
70 -└─────────────────────────────────────────────────────────────┘
71 - │
72 - ▼
73 -┌─────────────────────────────────────────────────────────────┐
74 -│ PIPELINE DSL (TypeScript + Zod) │
75 -│ │
76 -│ Fluent chaining style with object configs: │
77 -│ - Steps as declarative objects (no side effects) │
78 -│ - Zod schemas for pipeline definition (author-time) │
79 -│ - SDK structured output for runtime validation │
80 -│ - Gates defined with expect() │
81 -│ - Parallel execution via parallel([]) │
82 -│ - Loops via when().loop() │
83 -└─────────────────────────────────────────────────────────────┘
84 -```
86 ----
88 -## Design Decisions
90 -### Storage
92 -| Decision | Choice |
93 -| --------------------- | -------------------------------------------- |
94 -| **Database** | SQLite with `bun:sqlite` (built into Bun) |
95 -| **Location** | `.opencode/chef/chef.db` |
96 -| **Concurrency** | WAL mode for concurrent reads, single writer |
97 -| **Schema migrations** | Versioned (schema_version table, sequential) |
99 -### State Schema (Draft)
101 -```typescript
102 -interface PipelineInstance {
103 - id: string;
104 - definition: string; // Pipeline name/path
105 - status: PipelineStatus;
106 - input: unknown; // Original user input
107 - context: unknown; // Accumulated outputs
108 - current_phase: number;
109 - created_at: number;
110 - updated_at: number;
113 -interface PhaseState {
114 - id: string;
115 - pipeline_id: string;
116 - name: string;
117 - status: PhaseStatus;
118 - output: unknown;
119 - error: string | null;
120 - attempts: number;
121 - started_at: number | null;
122 - completed_at: number | null;
124 -```
126 -### Pipeline DSL
128 -| Decision | Choice |
129 -| ------------------- | -------------------------------------------------------------- |
130 -| **Style** | Fluent chaining (`.step().gate().when().loop()`) |
131 -| **Step definition** | Object config (`{ agent, input, output, expect }`) |
132 -| **Gate syntax** | Expect-based (`expect: z.object({ approved: true })`) |
133 -| **Validation** | Zod for pipeline definition, SDK structured output for runtime |
134 -| **Reusable steps** | Via composable pipeline fragments |
136 -### DSL Syntax (Draft)
138 -```typescript
139 -import { gate, parallel, pipeline, step, when } from "@opencode/chef";
140 -import { z } from "zod";
142 -export default pipeline("feature")
143 - .step("research", {
144 - agent: "researcher",
145 - prompt: "Research the codebase",
146 - output: z.object({ findings: z.string() }),
147 - })
148 - .step("plan", {
149 - agent: "planner",
150 - prompt: (ctx) => `Create a plan based on: ${ctx.research.findings}`,
151 - output: z.object({ tasks: z.array(z.string()) }),
152 - })
153 - .gate("approval", {
154 - agent: "devil",
155 - expect: z.object({ approved: z.boolean() }),
156 - })
157 - .when((ctx) => !ctx.approval.approved)
158 - .loop("plan")
159 - .step("implement", {
160 - agent: "programmer",
161 - prompt: "Implement the approved plan",
162 - })
163 - .parallel([
164 - step("review_security", { agent: "security" }),
165 - step("review_perf", { agent: "profiler" }),
166 - step("review_code", { agent: "reviewer" }),
167 - ])
168 - .gate("all_passed", {
169 - check: (ctx) =>
170 - ctx.review_security.passed &&
171 - ctx.review_perf.passed &&
172 - ctx.review_code.passed,
173 - })
174 - .step("ship", { agent: "shipper" });
175 -```
177 -### Agent Execution Strategy
179 -| Aspect | Implementation |
180 -| --------------------- | ------------------------------------------------------------ |
181 -| **Session Creation** | `client.session.create({ body: { agent, title } })` |
182 -| **Context Injection** | `client.session.prompt({ body: { noReply: true, parts } })` |
183 -| **Agent Prompting** | `client.session.prompt({ body: { parts, format } })` |
184 -| **Output Validation** | SDK structured output with `format: { type: "json_schema" }` |
185 -| **Schema Conversion** | Zod → JSON Schema via `zodToJsonSchema()` |
186 -| **Error Handling** | SDK automatic retries (retryCount: 2) |
188 -### Error Taxonomy
190 -| Failure Type | Recoverable? | Handling |
191 -| ------------------------- | ------------ | ------------------------------------ |
192 -| Agent timeout | Yes | Retry or fail phase |
193 -| Agent error | Maybe | Retry with feedback |
194 -| Gate failure | Yes | Loop back to appropriate phase |
195 -| Max iterations reached | No | Fail pipeline, escalate |
196 -| SDK error | No | Fail immediately (plugin bug) |
197 -| User cancellation | No | Abort, preserve state |
198 -| Pipeline definition error | No | Fail immediately (caught at startup) |
199 -| Agent not found | No | Fail immediately (caught at startup) |
201 -### Pipeline Tools API
203 -```typescript
204 -// Start a new pipeline
205 -pipeline.start({
206 - name: "feature",
207 - input: "Add dark mode toggle",
208 -});
210 -// Check status of current/all pipelines
211 -pipeline.status();
212 -pipeline.status({ id: "abc-123" });
214 -// Continue after needs_input
215 -pipeline.continue({
216 - id: "abc-123",
217 - input: { answer: "PostgreSQL" },
218 -});
220 -// Cancel a running pipeline
221 -pipeline.abort({ id: "abc-123" });
223 -// List available pipelines
224 -pipeline.list();
225 -```
227 ----
229 -## Implementation Plan
231 -### Phase 1: Core Infrastructure (Current)
233 -- [x] Update PLUGIN_SDK.md with correct capabilities
234 -- [x] Update PLAN.md with revised architecture
235 -- [x] Create `package.json` with dependencies
236 -- [x] Create `store.ts` - SQLite setup and state management
237 -- [x] Create `chef.ts` - Plugin entry point with tools
238 -- [x] Create `pipeline/builder.ts` - Basic pipeline builder
240 -### Phase 2: Execution Engine
242 -- [x] Create `executor.ts` - Step execution logic
243 -- [x] Implement context injection via `noReply: true`
244 -- [x] Implement structured output with schema conversion
245 -- [x] Add error taxonomy (ChefError, AgentTimeoutError, AgentError,
246 - GateFailureError, MaxIterationsError, SchemaValidationError)
247 -- [x] Add configurable retry policies with exponential backoff
248 -- [x] Add session cleanup with try/finally blocks
249 -- [x] Add max loop iteration guard (default: 10)
250 -- [x] Add per-step timeout with Promise.race
252 -### Phase 3: Advanced Features
254 -- [x] Add pipeline validation on startup (agents, schemas, loop targets)
255 -- [x] Add builder validate() method for structural validation
256 -- [x] Add reusable fragments (fragment() function + use() method)
257 -- [x] Add gate onFail loop-back handling
258 -- [x] Add abort checking in executor loop
260 -### Phase 4: Polish
262 -- [x] Test suite
263 -- [x] DSL ergonomics improvements (typed context)
264 -- [ ] Documentation improvements
266 ----
268 -## Open Questions
270 -### Resolved
272 -- [x] Storage: SQLite with bun:sqlite
273 -- [x] DSL style: Fluent chaining
274 -- [x] Step definition: Object config
275 -- [x] Gate syntax: Expect-based with Zod
276 -- [x] Reusable steps: Via pipeline fragments
277 -- [x] State location: `.opencode/chef/`
278 -- [x] Concurrent pipelines: Supported from day one
279 -- [x] Schema validation: Zod for definition, SDK structured output for runtime
280 -- [x] Message injection: Works via `noReply: true`
281 -- [x] Agent spawning: Works via SDK `session.create()` and `session.prompt()`
283 -### Unresolved
285 -- [ ] Parallel result access syntax (by step name? by array?)
286 -- [ ] Exact Zod schema for pipeline definition
287 -- [ ] How chef agent integrates (if at all)
289 -### Resolved
291 -- [x] Reusable step/fragment syntax: fragment() function + use() method
292 -- [x] Loop target syntax: by step name
293 -- [x] Pipeline validation on startup: validate() + startup check
294 -- [x] Parallel result access syntax (by step name? by array?) — resolved: nested
295 - context by step name
296 -- [x] Exact Zod schema for pipeline definition — resolved: Zod schemas in step
297 - definitions
299 ----
301 -## Directory Structure (Planned)
303 -```
304 -.opencode/chef/
305 -├── package.json # Dependencies (zod, zod-to-json-schema)
306 -├── chef.ts # Main plugin entry point
307 -├── store.ts # SQLite state management
308 -├── executor.ts # Step execution engine
309 -├── pipeline/
310 -│ ├── mod.ts # Pipeline DSL exports
311 -│ ├── builder.ts # Pipeline builder
312 -│ ├── step.ts # Step definition
313 -│ ├── gate.ts # Gate definition
314 -│ └── context.ts # Context/interpolation
315 -├── tools/
316 -│ ├── start.ts # Start tool
317 -│ ├── status.ts # Status tool
318 -│ ├── continue.ts # Continue tool
319 -│ ├── abort.ts # Abort tool
320 -│ └── list.ts # List tool
321 -├── test/
322 -│ ├── pipeline.test.ts # Pipeline DSL tests
323 -│ ├── executor.test.ts # Executor tests
324 -│ └── store.test.ts # State tests
325 -└── pipelines/ # User pipeline definitions
326 - ├── feature.ts
327 - └── bugfix.ts
328 -```
330 ----
332 -## Key Implementation Details
334 -### 1. Context Injection Pattern
336 -```typescript
337 -// Inject previous step outputs before prompting agent
338 -async function injectContext(
339 - sessionId: string,
340 - context: any,
341 - client: SDKClient,
342 -) {
343 - await client.session.prompt({
344 - path: { id: sessionId },
345 - body: {
346 - noReply: true, // Don't trigger AI response
347 - parts: [
348 - {
349 - type: "text",
350 - text: `Previous context:\n${JSON.stringify(context, null, 2)}`,
351 - },
352 - ],
353 - },
354 - });
356 -```
358 -### 2. Structured Output Pattern
360 -```typescript
361 -// Convert Zod schema to JSON Schema for SDK
362 -import { zodToJsonSchema } from "zod-to-json-schema";
364 -async function executeStep(step: Step, context: any, client: SDKClient) {
365 - const jsonSchema = zodToJsonSchema(step.output);
367 - const result = await client.session.prompt({
368 - path: { id: sessionId },
369 - body: {
370 - parts: [{ type: "text", text: step.prompt }],
371 - format: {
372 - type: "json_schema",
373 - schema: jsonSchema,
374 - retryCount: 2,
375 - },
376 - },
377 - });
379 - // Already validated by SDK!
380 - return result.data.info.structured_output;
382 -```
384 -### 3. Session Management Pattern
386 -```typescript
387 -// Create dedicated session for each step
388 -const session = await client.session.create({
389 - body: {
390 - title: `Chef: ${step.name}`,
391 - agent: step.agent,
392 - },
393 -});
395 -try {
396 - await injectContext(session.id, context, client);
397 - const output = await executeStep(step, context, client);
398 - return output;
399 -} finally {
400 - // Optional: Clean up session
401 - await client.session.delete({ path: { id: session.id } });
403 -```
405 ----
407 -## Validated By
409 -- **@devil** - Challenged assumptions about LLM self-control, gate enforcement,
410 - schema injection
411 -- **@architect** - Identified missing specs (error taxonomy, state schema,
412 - concurrency, cancellation, observability)
413 -- **@simplify** - Challenged complexity (mostly rejected as our use cases
414 - require the complexity)
415 -- **@researcher** - Confirmed testability (Bun test patterns exist), storage
416 - options (bun:sqlite is standard)
417 -- **OpenCode SDK Docs** - Validated message injection and structured output
418 - capabilities
420 ----
422 -## References
424 -- OpenCode SDK Documentation - Structured output and message injection
425 -- Temporal.io workflow SDK - Orchestration patterns
426 -- Inngest step functions - Step execution model
427 -- Mastra workflow DSL - Fluent API design
428 -- Zod schema validation - Type-safe pipeline definitions
429 -- bun:sqlite documentation - State persistence
430 -- zod-to-json-schema - Schema conversion
432 ----
434 -_Last updated: 2026-04-01_

opencode/plugins/chef/PLUGIN_SDK.md

Deleted
deleted file mode 100644
1 -# OpenCode Plugin SDK - Research Findings
3 -> Compiled from official docs, source code analysis, ecosystem plugins, and GitHub issues.
5 ----
7 -## Overview
9 -Plugins are JavaScript/TypeScript modules that hook into OpenCode events, add custom tools, and modify behavior. They run within the OpenCode process and have access to a rich context API.
11 ----
13 -## Plugin Location
15 -- **Global**: `~/.config/opencode/plugins/` or `~/.config/opencode/plugin/`
16 -- **Project**: `.opencode/plugins/` or `.opencode/plugin/`
18 -Both locations work. Load order:
20 -1. Global config (`~/.config/opencode/opencode.json`)
21 -2. Project config (`opencode.json`)
22 -3. Global plugin directory
23 -4. Project plugin directory
25 ----
27 -## Basic Structure
29 -```typescript
30 -import type { Plugin } from "@opencode-ai/plugin";
32 -export const MyPlugin: Plugin = async (
33 - { client, project, directory, worktree, $ },
34 -) => {
35 - console.log("Plugin initialized!");
37 - return {
38 - // Hooks go here
39 - };
40 -};
41 -```
43 -### Context Parameters
45 -| Parameter | Type | Description |
46 -| ----------- | ---------- | ---------------------------------------- |
47 -| `client` | SDK Client | OpenCode SDK for AI/session interactions |
48 -| `project` | Project | Current project info `{ id, worktree }` |
49 -| `directory` | string | Current working directory |
50 -| `worktree` | string | Git worktree root |
51 -| `$` | Bun Shell | Bun's shell API for commands |
52 -| `serverUrl` | URL | Server URL (internal) |
54 ----
56 -## Available Hooks
58 -### Event Hook (General)
60 -```typescript
61 -event: (async ({ event }) => {
62 - console.log("Event:", event.type);
63 -});
64 -```
66 -**Session Events:**
68 -- `session.created` - New session started
69 -- `session.updated` - Session updated
70 -- `session.deleted` - Session deleted
71 -- `session.error` - Session error occurred
72 -- `session.idle` - Session became idle
73 -- `session.status` - Session status changed
74 -- `session.compacted` - Session was compacted
75 -- `session.diff` - Session diff occurred
77 -**Message Events:**
79 -- `message.updated` - Message updated
80 -- `message.removed` - Message removed
81 -- `message.part.updated` - Message part updated
82 -- `message.part.removed` - Message part removed
84 -**Tool Events:**
86 -- `tool.execute.before` - Before tool execution
87 -- `tool.execute.after` - After tool execution
89 -**File Events:**
91 -- `file.edited` - File edited
92 -- `file.watcher.updated` - File watcher updated
94 -**Permission Events:**
96 -- `permission.asked` - Permission requested
97 -- `permission.replied` - Permission answered
99 -**Other Events:**
101 -- `command.executed` - Command executed
102 -- `installation.updated` - Installation updated
103 -- `lsp.client.diagnostics` - LSP diagnostics
104 -- `lsp.updated` - LSP updated
105 -- `server.connected` - Server connected
106 -- `todo.updated` - Todo updated
107 -- `tui.prompt.append` - Prompt appended
108 -- `tui.command.execute` - Command executed
109 -- `tui.toast.show` - Toast shown
110 -- `shell.env` - Shell environment
112 -### Tool Execution Hooks
114 -```typescript
115 -"tool.execute.before": async (input, output) => {
116 - // input: { tool, args, sessionID, callID }
117 - // output: { args } - can modify args
118 - if (input.tool === "bash" && output.args.command.includes("rm -rf")) {
119 - throw new Error("Dangerous command blocked")
120 - }
123 -"tool.execute.after": async (input, output) => {
124 - // input: { tool, args, sessionID, callID }
125 - // output: { title, output, metadata }
126 - console.log(`Tool ${input.tool} completed:`, output.output)
128 -```
130 -### Chat/Message Hooks
132 -```typescript
133 -"chat.message": async (input, output) => {
134 - // input: { message, parts }
135 - // output: { message } - can modify
138 -"chat.params": async (input, output) => {
139 - // Modify LLM params before sending
140 - output.temperature = 0.7
141 - output.topP = 0.9
143 -```
145 -### Experimental Hooks
147 -```typescript
148 -"experimental.chat.system.transform": async (input, output) => {
149 - // Inject into system prompt
150 - output.system.push(`<custom-context>...</custom-context>`)
153 -"experimental.session.compacting": async (input, output) => {
154 - // Customize compaction context
155 - output.context.push(`## State\nTask progress: 75%`)
156 - // Or replace entirely:
157 - // output.prompt = "Custom prompt..."
159 -```
161 -### Permission Hook
163 -```typescript
164 -"permission.ask": async (perm, output) => {
165 - // output: { status: 'allow' | 'deny' }
166 - if (perm.type === "read_file" && perm.path.includes(".env")) {
167 - output.status = "deny"
168 - }
170 -```
172 -### Configuration Hook
174 -```typescript
175 -config: (async (config) => {
176 - // Modify config before it's applied
177 - config.model = "anthropic/claude-3-5-sonnet";
178 -});
179 -```
181 ----
183 -## Custom Tools
185 -```typescript
186 -import { type Plugin, tool } from "@opencode-ai/plugin";
188 -export const MyPlugin: Plugin = async (ctx) => {
189 - return {
190 - tool: {
191 - myTool: tool({
192 - description: "Does something useful",
193 - args: {
194 - input: tool.schema.string().describe("Input text"),
195 - count: tool.schema.number().optional().describe("Count"),
196 - },
197 - async execute(args, context) {
198 - // context: { sessionID, messageID, agent, directory, worktree, abort }
199 - return `Processed: ${args.input}`;
200 - },
201 - }),
202 - },
203 - };
204 -};
205 -```
207 -### Tool Schema (Zod)
209 -`tool.schema` is Zod. All Zod types are available:
211 -- `tool.schema.string()`, `.number()`, `.boolean()`, `.array()`, `.object()`
212 -- `.describe()`, `.optional()`, `.default()`, `.min()`, `.max()`
214 ----
216 -## SDK Client Capabilities
218 -```typescript
219 -const { client } = await createOpencode();
220 -// or from plugin context
221 -await client.session.prompt({
222 - path: { id: sessionId },
223 - body: { parts: [{ type: "text", text: "Hello" }] },
224 -});
225 -```
227 -### Key SDK Methods
229 -| Method | Description |
230 -| --------------------------- | ------------------------- |
231 -| `client.session.create()` | Create new session |
232 -| `client.session.get()` | Get session by ID |
233 -| `client.session.list()` | List sessions |
234 -| `client.session.prompt()` | Send prompt to session |
235 -| `client.session.abort()` | Abort session |
236 -| `client.session.messages()` | Get session messages |
237 -| `client.app.agents()` | List available agents |
238 -| `client.app.log()` | Write log entry |
239 -| `client.event.subscribe()` | Subscribe to events (SSE) |
240 -| `client.file.read()` | Read file |
241 -| `client.find.text()` | Search text |
242 -| `client.tui.showToast()` | Show toast |
244 -### ✅ Message Injection (WORKS!)
246 -**Updated: This DOES work via `noReply: true`**
248 -You CAN inject AI-visible messages into sessions:
250 -```typescript
251 -// Inject context without triggering AI response
252 -await client.session.prompt({
253 - path: { id: sessionId },
254 - body: {
255 - noReply: true, // ← Injects message, no AI response
256 - parts: [{
257 - type: "text",
258 - text: "Context: Previous step completed with findings..."
259 - }],
260 - },
261 -})
262 -```
264 -This is perfect for multi-agent orchestration - inject context from previous steps before prompting agent.
266 -### ✅ Structured Output (BUILT-IN!)
268 -The SDK supports native JSON schema validation with automatic retries:
270 -```typescript
271 -const result = await client.session.prompt({
272 - path: { id: sessionId },
273 - body: {
274 - parts: [{ type: "text", text: "Research the codebase and extract data" }],
275 - format: {
276 - type: "json_schema",
277 - schema: {
278 - type: "object",
279 - properties: {
280 - findings: { type: "string", description: "Research findings" },
281 - files: { type: "array", items: { type: "string" } },
282 - },
283 - required: ["findings", "files"],
284 - },
285 - retryCount: 2, // Auto-retry on validation failure
286 - },
287 - },
288 -})
290 -// Already validated! No manual parsing needed
291 -const output = result.data.info.structured_output
292 -// output.findings: string
293 -// output.files: string[]
294 -```
296 -**Benefits:**
297 -- LLM is instructed to generate valid JSON matching schema
298 -- Automatic validation and retries
299 -- No manual parsing or Zod validation needed at runtime
300 -- Type-safe output
302 -**For Chef Plugin:** Convert Zod schemas to JSON Schema using `zodToJsonSchema` library, then pass to SDK.
304 -### Additional SDK Methods (Updated)
306 -**File Operations:**
307 -- `client.find.files({ query: { query, type, directory, limit } })` - Find files by pattern
308 -- `client.file.status({ query? })` - Get file status
310 -**TUI Control:**
311 -- `client.tui.appendPrompt({ body: { text } })` - Append to prompt
312 -- `client.tui.submitPrompt()` - Submit current prompt
313 -- `client.tui.clearPrompt()` - Clear prompt
314 -- `client.tui.executeCommand({ body })` - Execute command
316 -**Project/Config:**
317 -- `client.project.list()` - List all projects
318 -- `client.project.current()` - Get current project
319 -- `client.path.get()` - Get current path
320 -- `client.config.get()` - Get config info
321 -- `client.config.providers()` - List providers and models
323 -**Session Management:**
324 -- `client.session.children({ path })` - List child sessions
325 -- `client.session.update({ path, body })` - Update session properties
326 -- `client.session.init({ path, body })` - Initialize session with app analysis
327 -- `client.session.share({ path })` / `unshare({ path })` - Share sessions
328 -- `client.session.summarize({ path, body })` - Summarize session
329 -- `client.session.command({ path, body })` - Send command
330 -- `client.session.shell({ path, body })` - Run shell command
331 -- `client.session.revert({ path, body })` / `unrevert({ path })` - Revert messages
333 -**Auth & Global:**
334 -- `client.auth.set({ path, body })` - Set authentication credentials
335 -- `client.global.health()` - Health check
337 ----
339 -## Critical Limitations
341 -### 1. Event Handlers Are Fire-and-Forget
343 -The `event` hook does NOT wait for async operations:
345 -```typescript
346 -// From source: plugin/index.ts L138
347 -hook["event"]?.({ event: input }); // return value dropped
348 -```
350 -**Workaround**: Use `session.stopping` (being added per issue #16626) or external processes.
352 -### 2. ~~No Message Injection~~ ✅ WORKS NOW
354 -~~You cannot inject AI-visible messages from plugins. Issue #17412 tracks this.~~
356 -**UPDATED**: Message injection WORKS via `noReply: true` parameter in `session.prompt()`.
358 -### 3. No Session Continuation
360 -`session.idle` fires AFTER the agent loop breaks. Cannot keep agent running.
362 -### 4. Subagent Hooks Don't Work
364 -`tool.execute.before/after` don't intercept subagent (task tool) calls. Security issue #5894.
366 -### 5. ~~No Native Agent Spawning~~ ✅ WORKS NOW
368 -~~Plugins cannot spawn agents or sessions programmatically in a blocking way.~~
370 -**UPDATED**: Plugins CAN create sessions and prompt agents using the SDK client.
372 ----
374 -## Storage Patterns
376 -Plugins have no built-in state persistence. Options:
378 -### 1. File-Based
380 -```typescript
381 -import { $ } from "@opencode-ai/plugin";
382 -import { readFileSync, writeFileSync } from "fs";
384 -const stateFile = join(directory, ".opencode/chef/state.json");
386 -function loadState() {
387 - try {
388 - return JSON.parse(readFileSync(stateFile, "utf-8"));
389 - } catch {
390 - return { pipelines: [] };
391 - }
394 -function saveState(state) {
395 - writeFileSync(stateFile, JSON.stringify(state, null, 2));
397 -```
399 -### 2. SQLite with bun:sqlite
401 -```typescript
402 -import { Database } from "bun:sqlite";
404 -const db = new Database(join(directory, ".opencode/chef/chef.db"));
405 -db.run("CREATE TABLE IF NOT EXISTS pipeline (...)");
406 -```
408 -**Note**: Need `package.json` in config dir for external deps.
410 ----
412 -## Package Dependencies
414 -Add `package.json` to config directory:
416 -```json
418 - "dependencies": {
419 - "bun:sqlite": "latest",
420 - "zod": "^3.0.0",
421 - "zod-to-json-schema": "^3.22.0"
422 - }
424 -```
426 -OpenCode runs `bun install` at startup.
428 ----
430 -## Open Source Plugin Examples
432 -### Community Plugins (from ecosystem)
434 -| Plugin | Description |
435 -| ---------------------------- | ----------------------------------------------- |
436 -| `opencode-workspace` | Bundled orchestration harness (16 components) |
437 -| `opencode-background-agents` | Claude Code-style background agents |
438 -| `@openspoon/subtask2` | Orchestration system with granular flow control |
439 -| `opencode-rules` | Rule file injection into prompts |
440 -| `opencode-skillful` | Lazy-load prompts on demand |
441 -| `opencode-supermemory` | Persistent memory across sessions |
442 -| `micode` | Structured Brainstorm → Plan → Implement |
444 -### Key Pattern from `opencode-workspace`
446 -Uses a **bundle** approach with:
448 -- Multiple plugins (reactive features)
449 -- Multiple agents (planner, coder, reviewer)
450 -- Multiple skills (protocol enforcement)
451 -- MCP servers (external tools)
453 -NOT a centralized kernel - distributed coordination.
455 ----
457 -## Related GitHub Issues
459 -| Issue | Status | Description |
460 -| ------ | ------ | ------------------------------------------------------- |
461 -| #16626 | Open | `session.stopping` hook to allow re-entering agent loop |
462 -| #17412 | Closed | ~~Plugin hooks should inject AI-visible messages~~ (Resolved via `noReply`) |
463 -| #16879 | Closed | Await plugin event handlers on session.idle |
464 -| #12472 | Open | Native Claude Code hooks compatibility |
465 -| #5894 | Open | Bug: Plugin hooks don't intercept subagents |
466 -| #18007 | PR | Add `session.start` lifecycle hook |
468 ----
470 -## Security Considerations
472 -1. **Subagent bypass**: `tool.execute.before` doesn't fire for subagents
473 -2. **Permission system bypass**: Subagents can bypass permission checks
474 -3. **No isolation**: Plugin code runs in same process
476 ----
478 -## References
480 -- [Official Plugin Docs](https://opencode.ai/docs/plugins/)
481 -- [Custom Tools Docs](https://opencode.ai/docs/custom-tools/)
482 -- [SDK Docs](https://opencode.ai/docs/sdk/)
483 -- [Plugin Source](https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/plugin/index.ts)
484 -- [Plugin Package](https://github.com/anomalyco/opencode/blob/dev/packages/plugin/src/index.ts)
485 -- [Ecosystem](https://opencode.ai/docs/ecosystem)
486 -- [opencode-workspace](https://github.com/kdcokenny/opencode-workspace)
488 ----
490 -_Last updated: 2026-03-23_

opencode/plugins/chef/README.md

Deleted
deleted file mode 100644
1 -# Chef Orchestrator Plugin
3 -Declarative pipeline orchestration for OpenCode multi-agent workflows.
5 -## Overview
7 -Chef provides a TypeScript DSL for defining structured workflows that coordinate
8 -multiple agents. It leverages OpenCode's SDK capabilities for:
10 -- **Message Injection**: Pass context between agents via `noReply: true`
11 -- **Structured Output**: Automatic JSON schema validation with retries
12 -- **State Persistence**: SQLite-backed state management
13 -- **Fluent API**: Chaining syntax for pipeline definitions
14 -- **Retry Policies**: Configurable retry with exponential backoff
15 -- **Timeout Handling**: Per-step timeouts with automatic session cleanup
16 -- **Reusable Fragments**: Composable sub-pipelines via `fragment()` and `.use()`
17 -- **Pipeline Validation**: Startup checks for schemas, agents, and loop targets
18 -- **Error Taxonomy**: Classified errors for targeted retry and debugging
20 -## Installation
22 -The plugin is automatically loaded from `.opencode/plugins/chef/` directory.
24 -Dependencies are installed automatically via `bun install`.
26 -## Quick Start
28 -### 1. Create a Pipeline
30 -Create `.opencode/chef/pipelines/feature.ts`:
32 -```typescript
33 -import { pipeline } from "@opencode-ai/chef";
34 -import { z } from "zod";
36 -export default pipeline("feature")
37 - .step("research", {
38 - agent: "researcher",
39 - prompt: "Research the codebase",
40 - output: z.object({
41 - findings: z.string(),
42 - files: z.array(z.string()),
43 - }),
44 - })
45 - .step("plan", {
46 - agent: "planner",
47 - prompt: (ctx) => `Create plan based on: ${ctx.research.findings}`,
48 - output: z.object({
49 - tasks: z.array(z.string()),
50 - }),
51 - })
52 - .build();
53 -```
55 -### 2. Start a Pipeline
57 -In OpenCode:
59 -```
60 -Use the pipeline.start tool:
61 -- name: "feature"
62 -- input: { feature: "dark mode toggle" }
63 -```
65 -Or say: "Start the feature pipeline to add dark mode toggle"
67 -### 3. Check Status
69 -```
70 -Use pipeline.status tool
71 -```
73 -## Pipeline DSL
75 -### Steps
77 -Define agent tasks with structured outputs:
79 -```typescript
80 -.step("name", {
81 - agent: "agent-name",
82 - prompt: "Task description" | ((ctx) => string),
83 - output: z.object({ ... }),
84 -})
85 -```
87 -### Gates
89 -Add approval or validation checkpoints:
91 -```typescript
92 -.gate("approval", {
93 - agent: "reviewer", // optional
94 - expect: z.object({ approved: z.boolean() }),
95 -})
96 -```
98 -### Conditionals & Loops
100 -Branch based on context:
102 -```typescript
103 -.when((ctx) => !ctx.approval.approved)
104 -.loop("plan") // loop back to "plan" step
105 -```
107 -### Parallel Execution
109 -Run multiple agents concurrently:
111 -```typescript
112 -.parallel([
113 - step("review_security", { agent: "security", ... }),
114 - step("review_perf", { agent: "profiler", ... }),
115 -])
116 -```
118 -## Retry Policies
120 -Steps support configurable retry behavior. When a step fails, Chef automatically
121 -retries with exponential backoff before marking the step as failed.
123 -### Configuration
125 -Add a `retry` option to any step:
127 -```typescript
128 -.step("implement", {
129 - agent: "programmer",
130 - prompt: "Implement the feature",
131 - output: z.object({ summary: z.string() }),
132 - retry: {
133 - maxAttempts: 3,
134 - backoffMs: 2000,
135 - retryOn: ["agent_error", "agent_timeout"],
136 - },
137 -})
138 -```
140 -**Fields:**
142 -| Field | Type | Default | Description |
143 -| ------------- | ----------------------- | ----------- | ---------------------------------------------------- |
144 -| `maxAttempts` | `number` | `1` | Maximum number of attempts (including the first run) |
145 -| `backoffMs` | `number` | `1000` | Base delay in milliseconds before the first retry |
146 -| `retryOn` | `string[] \| undefined` | `undefined` | Error types that trigger a retry |
148 -### Backoff Behavior
150 -Delays use exponential backoff: `backoffMs * 2^attempt`. For `backoffMs: 2000`
151 -with 3 attempts:
153 -- Attempt 1: immediate
154 -- Attempt 2: waits 2000ms
155 -- Attempt 3: waits 4000ms
157 -### Filtering Retries by Error Type
159 -The `retryOn` field controls which errors trigger a retry:
161 -- **`undefined`** (default): Retry on any error
162 -- **`["agent_error", "agent_timeout"]`**: Only retry on matching error types
163 -- **`["all"]`**: Explicitly retry on all errors
165 -See [Error Handling](#error-handling) for the full list of error types.
167 -### Retry Feedback
169 -On retry, Chef injects the previous error message into the agent's context so it
170 -can correct its behavior:
172 -```
173 -Previous attempt failed with: Step "implement" timed out after 30000ms.
174 -Please correct this and try again.
175 -```
177 -## Timeout Handling
179 -Steps support a `timeout` option (in milliseconds) that limits how long an agent
180 -can run. If the agent exceeds the deadline, the step fails with an
181 -`AgentTimeoutError`.
183 -### Usage
185 -```typescript
186 -.step("review_security", {
187 - agent: "security",
188 - prompt: "Review for security vulnerabilities",
189 - output: z.object({ passed: z.boolean(), findings: z.array(z.string()) }),
190 - timeout: 60000, // 60 seconds
191 -})
192 -```
194 -When a timeout occurs:
196 -1. The timed-out session is automatically deleted (best-effort cleanup)
197 -2. The error is classified as `agent_timeout` (retryable if configured)
198 -3. If the step has a retry policy, it may be retried
200 -### Combining with Retry
202 -Timeout and retry work together naturally:
204 -```typescript
205 -.step("analyze", {
206 - agent: "analyst",
207 - prompt: "Analyze the dataset",
208 - output: z.object({ results: z.array(z.string()) }),
209 - timeout: 30000,
210 - retry: {
211 - maxAttempts: 3,
212 - backoffMs: 1000,
213 - retryOn: ["agent_timeout"],
214 - },
215 -})
216 -```
218 -This retries up to 3 times but only when the agent times out.
220 -## Reusable Fragments
222 -Fragments let you define reusable sequences of steps that can be included in
223 -multiple pipelines. This avoids duplicating common step definitions.
225 -### Defining a Fragment
227 -Use the `fragment()` function with the `step()` helper:
229 -```typescript
230 -import { fragment, step } from "@opencode-ai/chef";
231 -import { z } from "zod";
233 -const reviewFragment = fragment("review", [
234 - step("review_security", {
235 - agent: "security",
236 - prompt: "Review for security vulnerabilities",
237 - output: z.object({
238 - passed: z.boolean(),
239 - findings: z.array(z.string()),
240 - }),
241 - timeout: 60000,
242 - }),
243 - step("review_quality", {
244 - agent: "reviewer",
245 - prompt: (ctx) => `Review code quality for:\n${ctx.implement.summary}`,
246 - output: z.object({
247 - passed: z.boolean(),
248 - feedback: z.array(z.string()),
249 - }),
250 - timeout: 60000,
251 - }),
252 -]);
253 -```
255 -### Including a Fragment
257 -Use the `.use()` method on a pipeline builder to include all steps from a
258 -fragment:
260 -```typescript
261 -export default pipeline("feature")
262 - .step("research", { ... })
263 - .step("implement", { ... })
264 - .use(reviewFragment) // Adds review_security and review_quality steps
265 - .build();
266 -```
268 -The `.use()` method adds each step from the fragment as an individual phase in
269 -the pipeline, preserving their order.
271 -## Pipeline Validation
273 -Chef validates pipeline definitions at startup when pipelines are loaded from
274 -disk. This catches configuration errors early, before any execution begins.
276 -### How It Works
278 -When the plugin loads pipeline files, it calls the builder's `validate()` method
279 -automatically. Validation warnings appear in the console:
281 -```
282 -Chef: Pipeline "feature" has validation errors:
283 - - Gate "approval" onFail target "unknown_step" not found in pipeline
284 -```
286 -### Manual Validation
288 -You can also call `validate()` explicitly before building:
290 -```typescript
291 -const builder = pipeline("feature")
292 - .step("research", { ... })
293 - .gate("approval", { ... });
295 -const result = builder.validate();
296 -if (!result.valid) {
297 - for (const err of result.errors) {
298 - console.error(`Validation error: ${err}`);
299 - }
302 -const definition = builder.build();
303 -```
305 -### What Gets Validated
307 -| Check | Description |
308 -| --------------------- | ----------------------------------------------------------------- |
309 -| Output schema | Each step must have a valid Zod schema (`parse` is a function) |
310 -| Agent name | Each step must have a non-empty string agent |
311 -| Gate expect schema | Each gate must have a valid Zod schema for `expect` |
312 -| Gate `onFail` target | If set, must reference a step that exists earlier in the pipeline |
313 -| `when` loop target | If set, must reference a step that exists in the pipeline |
314 -| `when` condition | Must be a function |
315 -| Parallel step schemas | Each parallel sub-step must have valid output and agent |
317 -### Agent Name Checks
319 -In addition to structural validation, Chef checks that referenced agent names
320 -exist at startup. Unknown agents produce warnings:
322 -```
323 -Chef: Pipeline "feature" step "research" references unknown agent "unknown_agent"
324 -```
326 -## Error Handling
328 -Chef classifies errors into a taxonomy so that retry policies and debugging can
329 -target specific failure modes.
331 -### Error Types
333 -| Error Class | Type String | Cause |
334 -| -------------------- | ---------------- | --------------------------------------------------------- |
335 -| `AgentTimeoutError` | `agent_timeout` | Step exceeded its `timeout` deadline |
336 -| `AgentError` | `agent_error` | Agent returned an error during execution |
337 -| `GateFailureError` | `gate_failure` | Gate validation or agent evaluation failed |
338 -| `MaxIterationsError` | `max_iterations` | A loop exceeded the maximum iteration count (default: 10) |
340 -All errors extend `ChefError`, which carries a `type` string for programmatic
341 -handling.
343 -### Error Flow
345 -1. A step, gate, or parallel phase throws an error during execution
346 -2. The executor catches the error and records it in the phase state
347 -3. If the step has a retry policy and the error type matches `retryOn`, the step
348 - is retried
349 -4. If all retries are exhausted, the step is marked as `failed`
350 -5. The pipeline status is updated to `failed`
352 -### Loop Iteration Guard
354 -Loops (via `.when()` / `.loop()` or gate `onFail`) are bounded by a maximum
355 -iteration count (default: 10). If a loop exceeds this limit, the pipeline fails
356 -with a `MaxIterationsError` to prevent infinite cycles.
358 -## Gate onFail
360 -Gates support an `onFail` option that creates a loop-back when the gate fails.
361 -Instead of failing the entire pipeline, execution jumps back to the specified
362 -step.
364 -### Usage
366 -```typescript
367 -.gate("approval", {
368 - agent: "devil",
369 - expect: z.object({
370 - approved: z.boolean(),
371 - feedback: z.string().optional(),
372 - }),
373 - onFail: "plan", // Loop back to "plan" step on failure
374 -})
375 -```
377 -When the gate fails:
379 -1. The gate's phase state is marked as `failed`
380 -2. A warning is logged: `Chef: Gate "approval" failed, looping back to "plan"`
381 -3. Execution resumes at the named step ("plan")
382 -4. The loop iteration counter increments
384 -### Combining with `.when()` / `.loop()`
386 -The `onFail` option and `.when()` / `.loop()` can be used together or
387 -independently:
389 -```typescript
390 -// Gate onFail: automatic loop-back on gate failure
391 -.gate("approval", {
392 - agent: "devil",
393 - expect: z.object({ approved: z.boolean() }),
394 - onFail: "plan",
395 -})
397 -// when/loop: conditional loop based on context
398 -.when((ctx) => !ctx.approval.approved)
399 -.loop("plan")
400 -```
402 -The `onFail` handles gate evaluation failures (e.g., the agent returns
403 -`{ approved: false }`). The `.when()` / `.loop()` handles the conditional branch
404 -after a successful gate evaluation that returns a negative result.
406 -### Validation
408 -The `onFail` target is validated at startup. If the target step does not exist
409 -in the pipeline, a validation error is reported.
411 -## Tools
413 -### pipeline.start
415 -Start a new pipeline execution.
417 -**Arguments:**
419 -- `name` (string): Pipeline name
420 -- `input` (any, optional): Input data
422 -**Returns:**
424 -```json
426 - "pipeline_id": "uuid",
427 - "status": "running" | "completed" | "failed" | "needs_input",
428 - "context": { ... }
430 -```
432 -### pipeline.status
434 -Check pipeline status.
436 -**Arguments:**
438 -- `id` (string, optional): Pipeline ID (defaults to all running)
440 -### pipeline.continue
442 -Continue after `needs_input` status.
444 -**Arguments:**
446 -- `id` (string): Pipeline ID
447 -- `input` (any): Input data for next phase
449 -### pipeline.abort
451 -Cancel a running pipeline.
453 -**Arguments:**
455 -- `id` (string): Pipeline ID
457 -### pipeline.list
459 -List available pipelines.
461 -## Architecture
463 -```
464 -User → pipeline.start()
465 - ↓
466 -Chef Plugin (chef.ts)
467 - ↓
468 -Load & Validate Pipelines (builder.ts validate())
469 - ↓
470 -Executor (executor.ts)
471 - ↓
472 -SDK Client → session.create()
473 - ↓
474 -Context Injection → prompt({ noReply: true })
475 - ↓
476 -Agent Execution → prompt({ format: { type: "json_schema" } })
477 - ↓
478 -Retry/Timeout → exponential backoff + Promise.race
479 - ↓
480 -State Persistence → SQLite (store.ts)
481 - ↳ schema_version (version tracking)
482 - ↳ pipeline_instance
483 - ↳ phase_state
484 -```
486 -## Schema Migrations
488 -Chef uses a versioned migration system to manage database schema changes. The
489 -`schema_version` table tracks which migrations have been applied.
491 -- Migrations run automatically on startup
492 -- Each migration has a version number, description, and array of SQL statements
493 -- Only migrations newer than the current version are applied
494 -- Applied migrations are logged:
495 - `Chef: Applied schema migration v2: Remove unused step_state table`
497 -Current schema version: **2** (removed unused `step_state` table from initial
498 -schema).
500 -## Example Pipeline
502 -See `pipelines/feature.ts` for a complete example with:
504 -- Research phase
505 -- Planning phase
506 -- Approval gate with `onFail` loop-back to "plan"
507 -- Conditional loop via `.when()` / `.loop()`
508 -- Implementation phase with retry policy (3 attempts, filtered to `agent_error`
509 - and `agent_timeout`)
510 -- Reusable review fragment via `fragment()` and `.use()`
511 -- Per-step timeouts on review steps
513 -## Status
515 -**Phase 1: Core Infrastructure** ✅
517 -- [x] SQLite state management
518 -- [x] Pipeline builder DSL
519 -- [x] Step execution with structured output
520 -- [x] Context injection
521 -- [x] Basic tools (start, status, continue, abort, list)
523 -**Phase 2: Execution Engine** ✅
525 -- [x] Enhanced error handling (error taxonomy)
526 -- [x] Gate evaluation
527 -- [x] Parallel execution
528 -- [x] Conditional loops
530 -**Phase 3: Advanced Features** ✅
532 -- [x] Pipeline validation on startup
533 -- [x] Reusable fragments
534 -- [x] Retry policies
535 -- [x] Timeout handling
537 -## Development
539 -```bash
540 -# Run tests
541 -bun test
543 -# Type checking
544 -bunx tsc --noEmit
545 -```
547 -## References
549 -- [PLAN.md](./PLAN.md) - Design documentation
550 -- [PLUGIN_SDK.md](./PLUGIN_SDK.md) - SDK capabilities research

opencode/plugins/chef/chef.ts

Deleted
deleted file mode 100644
1 -import { type Plugin, tool } from "@opencode-ai/plugin";
2 -import { join } from "path";
3 -import { glob } from "glob";
4 -import { Store } from "./store";
5 -import { Executor } from "./executor";
6 -import type {
7 - GateDefinition,
8 - PipelineDefinition,
9 - StepDefinition,
10 -} from "./pipeline/builder";
12 -export const ChefPlugin: Plugin = async ({
13 - client,
14 - project,
15 - directory,
16 - worktree,
17 -}) => {
18 - // Initialize store
19 - const store = new Store(directory);
21 - // Load pipeline definitions
22 - const pipelinesDir = join(directory, ".opencode/chef/pipelines");
23 - const pipelines = new Map<string, PipelineDefinition>();
25 - async function loadPipelines() {
26 - // Fetch available agents for validation
27 - let agentNames: Set<string> = new Set();
28 - try {
29 - const agents = await client.app.agents();
30 - agentNames = new Set(agents.map((a: any) => a.id ?? a.name));
31 - } catch {
32 - console.warn(
33 - "Chef: Could not fetch agent list, skipping agent validation",
34 - );
35 - }
37 - try {
38 - const files = await glob("*.ts", { cwd: pipelinesDir });
40 - for (const file of files) {
41 - try {
42 - const module = await import(join(pipelinesDir, file));
43 - const exported = module.default;
45 - if (!exported) continue;
47 - let definition: PipelineDefinition;
48 - let hasBuilder = false;
50 - if (typeof exported.build === "function") {
51 - definition = exported.build();
52 - hasBuilder = true;
53 - } else if (exported.name && exported.phases) {
54 - definition = exported;
55 - } else {
56 - continue;
57 - }
59 - // Run structural validation
60 - if (hasBuilder && typeof exported.validate === "function") {
61 - const result = exported.validate();
62 - if (!result.valid) {
63 - console.warn(
64 - `Chef: Pipeline "${definition.name}" has validation errors:`,
65 - );
66 - for (const err of result.errors) {
67 - console.warn(` - ${err}`);
68 - }
69 - }
70 - }
72 - // Check agent names exist
73 - for (const phase of definition.phases) {
74 - if (
75 - phase.type === "step" &&
76 - !agentNames.has((phase as StepDefinition).agent)
77 - ) {
78 - console.warn(
79 - `Chef: Pipeline "${definition.name}" step "${phase.name}" references unknown agent "${
80 - (phase as StepDefinition).agent
81 - }"`,
82 - );
83 - }
84 - if (
85 - phase.type === "gate" && (phase as GateDefinition).agent &&
86 - !agentNames.has((phase as GateDefinition).agent!)
87 - ) {
88 - console.warn(
89 - `Chef: Pipeline "${definition.name}" gate "${phase.name}" references unknown agent "${
90 - (phase as GateDefinition).agent
91 - }"`,
92 - );
93 - }
94 - if (phase.type === "parallel") {
95 - for (const s of (phase as any).steps) {
96 - if (!agentNames.has(s.agent)) {
97 - console.warn(
98 - `Chef: Pipeline "${definition.name}" parallel step "${s.name}" references unknown agent "${s.agent}"`,
99 - );
100 - }
101 - }
102 - }
103 - }
105 - pipelines.set(definition.name, definition);
106 - } catch (error) {
107 - console.error(`Chef: Failed to load pipeline ${file}:`, error);
108 - }
109 - }
110 - } catch (error) {
111 - // Pipelines directory doesn't exist yet
112 - console.log("Chef: No pipelines directory found");
113 - }
114 - }
116 - await loadPipelines();
118 - return {
119 - tool: {
120 - "pipeline.start": tool({
121 - description: "Start a new pipeline execution",
122 - args: {
123 - name: tool.schema.string().describe("Pipeline name"),
124 - input: tool.schema.any().optional().describe("Pipeline input data"),
125 - },
126 - async execute(args, context) {
127 - const definition = pipelines.get(args.name);
129 - if (!definition) {
130 - return `Pipeline "${args.name}" not found. Available pipelines: ${
131 - Array.from(pipelines.keys()).join(", ")
132 - }`;
133 - }
135 - // Create pipeline instance
136 - const instance = store.createPipeline(args.name, args.input || {});
138 - // Execute pipeline
139 - const executor = new Executor(store, client, definition);
141 - try {
142 - const result = await executor.execute(
143 - instance.id,
144 - args.input || {},
145 - );
147 - return JSON.stringify(
148 - {
149 - pipeline_id: instance.id,
150 - status: result.status,
151 - context: result.context,
152 - },
153 - null,
154 - 2,
155 - );
156 - } catch (error: any) {
157 - store.updatePipeline(instance.id, {
158 - status: "failed",
159 - });
161 - return `Pipeline execution failed: ${error.message}`;
162 - }
163 - },
164 - }),
166 - "pipeline.status": tool({
167 - description: "Check status of pipeline(s)",
168 - args: {
169 - id: tool.schema.string().optional().describe(
170 - "Pipeline ID (optional, defaults to all running)",
171 - ),
172 - },
173 - async execute(args, context) {
174 - if (args.id) {
175 - const pipeline = store.getPipeline(args.id);
177 - if (!pipeline) {
178 - return `Pipeline ${args.id} not found`;
179 - }
181 - return JSON.stringify(pipeline, null, 2);
182 - }
184 - const running = store.listPipelines("running");
185 - return JSON.stringify(running, null, 2);
186 - },
187 - }),
189 - "pipeline.continue": tool({
190 - description: "Continue a pipeline after needs_input",
191 - args: {
192 - id: tool.schema.string().describe("Pipeline ID"),
193 - input: tool.schema.any().describe("Input data for next phase"),
194 - },
195 - async execute(args, context) {
196 - const instance = store.getPipeline(args.id);
198 - if (!instance) {
199 - return `Pipeline ${args.id} not found`;
200 - }
202 - if (instance.status !== "needs_input") {
203 - return `Pipeline ${args.id} is not waiting for input (status: ${instance.status})`;
204 - }
206 - const definition = pipelines.get(instance.definition);
207 - if (!definition) {
208 - return `Pipeline definition ${instance.definition} not found`;
209 - }
211 - // Merge input into context
212 - const pipelineContext = JSON.parse(instance.context);
213 - Object.assign(pipelineContext, args.input);
214 - store.updatePipeline(args.id, {
215 - context: JSON.stringify(pipelineContext),
216 - status: "running",
217 - });
219 - // Continue execution
220 - const executor = new Executor(store, client, definition);
222 - try {
223 - const result = await executor.execute(args.id, pipelineContext);
225 - return JSON.stringify(
226 - {
227 - pipeline_id: args.id,
228 - status: result.status,
229 - context: result.context,
230 - },
231 - null,
232 - 2,
233 - );
234 - } catch (error: any) {
235 - store.updatePipeline(args.id, {
236 - status: "failed",
237 - });
239 - return `Pipeline execution failed: ${error.message}`;
240 - }
241 - },
242 - }),
244 - "pipeline.abort": tool({
245 - description: "Abort a running pipeline",
246 - args: {
247 - id: tool.schema.string().describe("Pipeline ID"),
248 - },
249 - async execute(args, context) {
250 - const instance = store.getPipeline(args.id);
252 - if (!instance) {
253 - return `Pipeline ${args.id} not found`;
254 - }
256 - store.updatePipeline(args.id, {
257 - status: "aborted",
258 - });
260 - return `Pipeline ${args.id} aborted`;
261 - },
262 - }),
264 - "pipeline.list": tool({
265 - description: "List available pipelines",
266 - args: {},
267 - async execute(args, context) {
268 - const names = Array.from(pipelines.keys());
270 - return `Available pipelines:\n${
271 - names.map((n) => `- ${n}`).join("\n")
272 - }\n\nLoad custom pipelines by creating .opencode/chef/pipelines/*.ts files`;
273 - },
274 - }),
275 - },
276 - };
277 -};
279 -export default ChefPlugin;

opencode/plugins/chef/executor.ts

Deleted
deleted file mode 100644
1 -import type { Client } from "@opencode-ai/sdk";
2 -import { zodToJsonSchema } from "zod-to-json-schema";
3 -import type {
4 - GateDefinition,
5 - ParallelDefinition,
6 - PhaseDefinition,
7 - PipelineDefinition,
8 - RetryPolicy,
9 - StepDefinition,
10 - WhenDefinition,
11 -} from "./pipeline/builder";
12 -import { Store } from "./store";
14 -// Error taxonomy
15 -export class ChefError extends Error {
16 - constructor(
17 - message: string,
18 - public readonly type: string,
19 - ) {
20 - super(message);
21 - this.name = "ChefError";
22 - }
25 -export class AgentTimeoutError extends ChefError {
26 - constructor(stepName: string, timeout: number) {
27 - super(`Step "${stepName}" timed out after ${timeout}ms`, "agent_timeout");
28 - this.name = "AgentTimeoutError";
29 - }
32 -export class AgentError extends ChefError {
33 - constructor(stepName: string, message: string) {
34 - super(`Agent error in "${stepName}": ${message}`, "agent_error");
35 - this.name = "AgentError";
36 - }
39 -export class GateFailureError extends ChefError {
40 - constructor(gateName: string, message: string) {
41 - super(`Gate "${gateName}" failed: ${message}`, "gate_failure");
42 - this.name = "GateFailureError";
43 - }
46 -export class MaxIterationsError extends ChefError {
47 - constructor(max: number) {
48 - super(`Max loop iterations (${max}) reached`, "max_iterations");
49 - this.name = "MaxIterationsError";
50 - }
53 -/** Internal context type for the executor. Uses `any` because context is a
54 - * JSON-serialized accumulator that flows into user-defined callbacks
55 - * (prompt functions, when conditions) typed as `(ctx: TContext) => ...`
56 - * where TContext defaults to Record<string, any>. */
57 -type PipelineContext = Record<string, any>;
59 -const DEFAULT_MAX_LOOP_ITERATIONS = 10;
60 -const DEFAULT_RETRY: RetryPolicy = {
61 - maxAttempts: 1,
62 - backoffMs: 1000,
63 - retryOn: undefined,
64 -};
66 -export class Executor {
67 - private maxLoopIterations: number;
68 - private leakedSessions = new Set<string>();
70 - constructor(
71 - private store: Store,
72 - private client: Client,
73 - private definition: PipelineDefinition,
74 - options?: { maxLoopIterations?: number },
75 - ) {
76 - this.maxLoopIterations = options?.maxLoopIterations ??
77 - DEFAULT_MAX_LOOP_ITERATIONS;
78 - }
80 - /** Truncate IDs for safe logging. Keeps first 8 chars + ellipsis. */
81 - private static redactId(id: string): string {
82 - return id.length > 8 ? `${id.slice(0, 8)}…` : id;
83 - }
85 - private async cleanupSession(sessionId: string): Promise<void> {
86 - try {
87 - await this.client.session.delete({ path: { id: sessionId } });
88 - } catch (e) {
89 - this.leakedSessions.add(sessionId);
90 - const msg = e instanceof Error ? e.message : String(e);
91 - console.warn(
92 - `Chef: session cleanup failed for ${
93 - Executor.redactId(sessionId)
94 - }: ${msg}`,
95 - );
96 - try {
97 - await this.client.app.log({
98 - body: {
99 - service: "chef",
100 - level: "warn",
101 - message: `Session cleanup failed`,
102 - extra: { sessionId: Executor.redactId(sessionId), error: msg },
103 - },
104 - });
105 - } catch {
106 - // truly best-effort — logging itself failed
107 - }
108 - }
109 - }
111 - async execute(pipelineId: string, input: PipelineContext): Promise<any> {
112 - const instance = this.store.getPipeline(pipelineId);
113 - if (!instance) {
114 - throw new Error(`Pipeline ${pipelineId} not found`);
115 - }
117 - let context: PipelineContext = JSON.parse(instance.context ?? "{}");
118 - // Merge input into context so it's available to prompts and gate validation
119 - context = { ...context, ...input };
120 - const phases = this.definition.phases;
121 - let loopIterations = 0;
123 - try {
124 - for (let i = instance.current_phase; i < phases.length; i++) {
125 - // Check if pipeline was aborted
126 - const current = this.store.getPipeline(pipelineId);
127 - if (current && current.status === "aborted") {
128 - return { status: "aborted", context };
129 - }
131 - const phase = phases[i];
133 - // Update current phase
134 - this.store.updatePipeline(pipelineId, {
135 - current_phase: i,
136 - status: "running",
137 - });
139 - try {
140 - const result = await this.executePhase(phase, context, pipelineId);
142 - if (result.status === "needs_input") {
143 - this.store.updatePipeline(pipelineId, {
144 - status: "needs_input",
145 - context: JSON.stringify(context),
146 - });
147 - return { status: "needs_input", context };
148 - }
150 - if (result.status === "loop") {
151 - loopIterations++;
152 - if (loopIterations > this.maxLoopIterations) {
153 - this.store.updatePipeline(pipelineId, {
154 - status: "failed",
155 - context: JSON.stringify(context),
156 - });
157 - return {
158 - status: "failed",
159 - error: new MaxIterationsError(this.maxLoopIterations).message,
160 - };
161 - }
162 - const targetIndex = phases.findIndex((p) =>
163 - p.name === result.target
164 - );
165 - if (targetIndex >= 0) {
166 - i = targetIndex - 1; // -1 because loop will increment
167 - continue;
168 - }
169 - }
171 - if (result.status === "failed") {
172 - this.store.updatePipeline(pipelineId, {
173 - status: "failed",
174 - context: JSON.stringify(context),
175 - });
176 - return { status: "failed", error: result.error };
177 - }
179 - // Merge output into context
180 - if (result.output) {
181 - context[phase.name] = result.output;
182 - this.store.updatePipeline(pipelineId, {
183 - context: JSON.stringify(context),
184 - });
185 - }
186 - } catch (error: any) {
187 - this.store.updatePipeline(pipelineId, {
188 - status: "failed",
189 - });
190 - throw error;
191 - }
192 - }
194 - // Pipeline completed
195 - this.store.updatePipeline(pipelineId, {
196 - status: "completed",
197 - current_phase: phases.length,
198 - });
200 - return { status: "completed", context };
201 - } finally {
202 - if (this.leakedSessions.size > 0) {
203 - const ids = Array.from(this.leakedSessions);
204 - console.warn(
205 - `Chef: pipeline ${pipelineId} completed with ${ids.length} leaked session(s): ${
206 - ids.map((id) => Executor.redactId(id)).join(", ")
207 - }`,
208 - );
209 - try {
210 - await this.client.app.log({
211 - body: {
212 - service: "chef",
213 - level: "warn",
214 - message: `Pipeline completed with leaked sessions`,
215 - extra: {
216 - pipelineId,
217 - leakedSessionIds: ids.map((id) => Executor.redactId(id)),
218 - },
219 - },
220 - });
221 - } catch {
222 - // best-effort
223 - }
224 - this.leakedSessions.clear();
225 - }
226 - }
227 - }
229 - private async executePhase(
230 - phase: PhaseDefinition,
231 - context: PipelineContext,
232 - pipelineId: string,
233 - ): Promise<
234 - { status: string; output?: any; error?: string; target?: string }
235 - > {
236 - switch (phase.type) {
237 - case "step":
238 - return this.executeStep(phase, context, pipelineId);
240 - case "gate":
241 - return this.executeGate(phase, context, pipelineId);
243 - case "parallel":
244 - return this.executeParallel(phase, context, pipelineId);
246 - case "when":
247 - return this.executeWhen(phase, context);
249 - default:
250 - throw new Error(`Unknown phase type: ${(phase as any).type}`);
251 - }
252 - }
254 - private async executeStep(
255 - step: StepDefinition,
256 - context: PipelineContext,
257 - pipelineId: string,
258 - parentPhaseId?: string,
259 - ): Promise<{ status: string; output?: any; error?: string }> {
260 - const phase = parentPhaseId
261 - ? (this.store.getPhase(parentPhaseId) ??
262 - this.store.createPhase(pipelineId, step.name))
263 - : this.store.createPhase(pipelineId, step.name);
264 - const retry: RetryPolicy = step.retry ?? DEFAULT_RETRY;
265 - let lastError: any;
267 - for (let attempt = 0; attempt < retry.maxAttempts; attempt++) {
268 - let sessionId: string | undefined;
270 - try {
271 - // Create fresh session for each attempt
272 - const session = await this.client.session.create({
273 - body: {
274 - title: `Chef: ${step.name}${
275 - attempt > 0 ? ` (retry ${attempt})` : ""
276 - }`,
277 - agent: step.agent,
278 - },
279 - });
280 - sessionId = session.id;
282 - // Inject context
283 - const contextParts: any[] = [
284 - {
285 - type: "text",
286 - text: `Previous context:\n${JSON.stringify(context, null, 2)}`,
287 - },
288 - ];
290 - // On retry, inject previous error as feedback
291 - if (attempt > 0 && lastError) {
292 - contextParts.push({
293 - type: "text",
294 - text:
295 - `Previous attempt failed with: ${lastError.message}. Please correct this and try again.`,
296 - });
297 - }
299 - await this.client.session.prompt({
300 - path: { id: session.id },
301 - body: {
302 - noReply: true,
303 - parts: contextParts,
304 - },
305 - });
307 - // Execute with structured output
308 - const prompt = typeof step.prompt === "function"
309 - ? step.prompt(context)
310 - : step.prompt;
312 - const jsonSchema = zodToJsonSchema(step.output);
314 - // Build prompt promise
315 - const promptPromise = this.client.session.prompt({
316 - path: { id: session.id },
317 - body: {
318 - parts: [{ type: "text", text: prompt }],
319 - format: {
320 - type: "json_schema",
321 - schema: jsonSchema,
322 - retryCount: 2,
323 - },
324 - },
325 - });
327 - // Apply timeout if configured
328 - let result: any;
329 - if (step.timeout) {
330 - result = await Promise.race([
331 - promptPromise,
332 - new Promise<never>((_, reject) =>
333 - setTimeout(
334 - () => reject(new AgentTimeoutError(step.name, step.timeout!)),
335 - step.timeout,
336 - )
337 - ),
338 - ]);
339 - } else {
340 - result = await promptPromise;
341 - }
343 - const output = result.data.info.structured_output;
345 - // Update phase state
346 - this.store.updatePhase(phase.id, {
347 - status: "completed",
348 - output: JSON.stringify(output),
349 - completed_at: Date.now(),
350 - attempts: attempt + 1,
351 - });
353 - return { status: "completed", output };
354 - } catch (error: any) {
355 - lastError = error;
357 - // Try to abort timed-out sessions
358 - if (sessionId && error instanceof AgentTimeoutError) {
359 - try {
360 - await this.client.session.delete({ path: { id: sessionId } });
361 - sessionId = undefined; // prevent double-delete in finally
362 - } catch {
363 - // best-effort abort
364 - }
365 - }
367 - this.store.updatePhase(phase.id, {
368 - attempts: attempt + 1,
369 - error: error.message,
370 - });
372 - // Check if error type is retryable
373 - const shouldRetry = retry.retryOn === undefined ||
374 - retry.retryOn.includes(error.type) ||
375 - retry.retryOn.includes("all");
377 - if (!shouldRetry || attempt >= retry.maxAttempts - 1) {
378 - break;
379 - }
381 - // Exponential backoff before retry
382 - const delay = retry.backoffMs * Math.pow(2, attempt);
383 - console.warn(
384 - `Chef: Step "${step.name}" attempt ${
385 - attempt + 1
386 - } failed, retrying in ${delay}ms...`,
387 - );
388 - await new Promise((r) => setTimeout(r, delay));
389 - } finally {
390 - if (sessionId) {
391 - await this.cleanupSession(sessionId);
392 - }
393 - }
394 - }
396 - // All attempts exhausted
397 - this.store.updatePhase(phase.id, {
398 - status: "failed",
399 - error: lastError?.message ?? "Unknown error",
400 - });
402 - return { status: "failed", error: lastError?.message ?? "Unknown error" };
403 - }
405 - private async executeGate(
406 - gate: GateDefinition,
407 - context: PipelineContext,
408 - pipelineId: string,
409 - ): Promise<
410 - { status: string; output?: any; error?: string; target?: string }
411 - > {
412 - const phase = this.store.createPhase(pipelineId, gate.name);
413 - let sessionId: string | undefined;
415 - try {
416 - // If gate has an agent, execute it
417 - if (gate.agent) {
418 - const session = await this.client.session.create({
419 - body: {
420 - title: `Chef Gate: ${gate.name}`,
421 - agent: gate.agent,
422 - },
423 - });
424 - sessionId = session.id;
426 - // Inject context
427 - await this.client.session.prompt({
428 - path: { id: session.id },
429 - body: {
430 - noReply: true,
431 - parts: [
432 - {
433 - type: "text",
434 - text: `Context:\n${
435 - JSON.stringify(context, null, 2)
436 - }\n\nEvaluate this gate.`,
437 - },
438 - ],
439 - },
440 - });
442 - const jsonSchema = zodToJsonSchema(gate.expect);
444 - const result = await this.client.session.prompt({
445 - path: { id: session.id },
446 - body: {
447 - parts: [{ type: "text", text: "Evaluate gate conditions" }],
448 - format: {
449 - type: "json_schema",
450 - schema: jsonSchema,
451 - retryCount: 2,
452 - },
453 - },
454 - });
456 - const output = result.data.info.structured_output;
458 - // Validate against expectation
459 - const validated = gate.expect.parse(output);
461 - this.store.updatePhase(phase.id, {
462 - status: "completed",
463 - output: JSON.stringify(validated),
464 - completed_at: Date.now(),
465 - });
467 - return { status: "completed", output: validated };
468 - } else {
469 - // Direct validation without agent
470 - const validated = gate.expect.parse(context);
472 - this.store.updatePhase(phase.id, {
473 - status: "completed",
474 - output: JSON.stringify(validated),
475 - completed_at: Date.now(),
476 - });
478 - return { status: "completed", output: validated };
479 - }
480 - } catch (error: any) {
481 - this.store.updatePhase(phase.id, {
482 - status: "failed",
483 - error: error.message,
484 - });
486 - // If gate has onFail, loop back to target phase
487 - if (gate.onFail) {
488 - console.warn(
489 - `Chef: Gate "${gate.name}" failed, looping back to "${gate.onFail}"`,
490 - );
491 - return { status: "loop", target: gate.onFail };
492 - }
494 - return { status: "failed", error: error.message };
495 - } finally {
496 - if (sessionId) {
497 - await this.cleanupSession(sessionId);
498 - }
499 - }
500 - }
502 - private async executeParallel(
503 - parallel: ParallelDefinition,
504 - context: PipelineContext,
505 - pipelineId: string,
506 - ): Promise<{ status: string; output?: any; error?: string }> {
507 - const phase = this.store.createPhase(pipelineId, parallel.name);
509 - try {
510 - const results = await Promise.all(
511 - parallel.steps.map((step) =>
512 - this.executeStep(step, context, pipelineId, phase.id)
513 - ),
514 - );
516 - // Check if any failed
517 - const failed = results.find((r) => r.status === "failed");
518 - if (failed) {
519 - this.store.updatePhase(phase.id, {
520 - status: "failed",
521 - error: failed.error,
522 - });
523 - return failed;
524 - }
526 - const outputs = Object.fromEntries(
527 - results.map((r, i) => [parallel.steps[i].name, r.output]),
528 - ) as PipelineContext;
530 - this.store.updatePhase(phase.id, {
531 - status: "completed",
532 - output: JSON.stringify(outputs),
533 - completed_at: Date.now(),
534 - });
536 - return { status: "completed", output: outputs };
537 - } catch (error: any) {
538 - this.store.updatePhase(phase.id, {
539 - status: "failed",
540 - error: error.message,
541 - });
543 - return { status: "failed", error: error.message };
544 - }
545 - }
547 - private executeWhen(
548 - when: WhenDefinition,
549 - context: PipelineContext,
550 - ): { status: string; target?: string } {
551 - const conditionMet = when.condition(context);
553 - if (conditionMet && when.loopTarget) {
554 - return { status: "loop", target: when.loopTarget };
555 - }
557 - return { status: "completed" };
558 - }

opencode/plugins/chef/package-lock.json

Deleted
deleted file mode 100644
1 -{
2 - "name": "@opencode-ai/chef",
3 - "version": "0.1.0",
4 - "lockfileVersion": 3,
5 - "requires": true,
6 - "packages": {
7 - "": {
8 - "name": "@opencode-ai/chef",
9 - "version": "0.1.0",
10 - "dependencies": {
11 - "glob": "^10.0.0",
12 - "zod": "^3.22.0",
13 - "zod-to-json-schema": "^3.22.0"
14 - },
15 - "devDependencies": {
16 - "@types/bun": "latest",
17 - "bun": "^1.3.11"
18 - }
19 - },
20 - "node_modules/@isaacs/cliui": {
21 - "version": "8.0.2",
22 - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
23 - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
24 - "license": "ISC",
25 - "dependencies": {
26 - "string-width": "^5.1.2",
27 - "string-width-cjs": "npm:string-width@^4.2.0",
28 - "strip-ansi": "^7.0.1",
29 - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
30 - "wrap-ansi": "^8.1.0",
31 - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
32 - },
33 - "engines": {
34 - "node": ">=12"
35 - }
36 - },
37 - "node_modules/@oven/bun-darwin-aarch64": {
38 - "version": "1.3.11",
39 - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.3.11.tgz",
40 - "integrity": "sha512-/8IzqSu4/OWGRs7Fs2ROzGVwJMFTBQkgAp6sAthkBYoN7OiM4rY/CpPVs2X9w9N1W61CHSkEdNKi8HrLZKfK3g==",
41 - "cpu": [
42 - "arm64"
43 - ],
44 - "dev": true,
45 - "license": "MIT",
46 - "optional": true,
47 - "os": [
48 - "darwin"
49 - ]
50 - },
51 - "node_modules/@oven/bun-darwin-x64": {
52 - "version": "1.3.11",
53 - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.3.11.tgz",
54 - "integrity": "sha512-TT7eUihnAzxM2tlZesusuC75PAOYKvUBgVU/Nm/lakZ/DpyuqhNkzUfcxSgmmK9IjVWzMmezLIGZl16XGCGJng==",
55 - "cpu": [
56 - "x64"
57 - ],
58 - "dev": true,
59 - "license": "MIT",
60 - "optional": true,
61 - "os": [
62 - "darwin"
63 - ]
64 - },
65 - "node_modules/@oven/bun-darwin-x64-baseline": {
66 - "version": "1.3.11",
67 - "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.3.11.tgz",
68 - "integrity": "sha512-CYjIHWaQG7T4phfjErHr6BiXRs0K/9DqMeiohJmuYSBF+H2m56vFslOenLCguGYQL9jeiiCZBeoVCpwjxZrMgQ==",
69 - "cpu": [
70 - "x64"
71 - ],
72 - "dev": true,
73 - "license": "MIT",
74 - "optional": true,
75 - "os": [
76 - "darwin"
77 - ]
78 - },
79 - "node_modules/@oven/bun-linux-aarch64": {
80 - "version": "1.3.11",
81 - "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.3.11.tgz",
82 - "integrity": "sha512-8XMLyRNxHF4jfLajkWt+F8UDxsWbzysyxQVMZKUXwoeGvaxB0rVd07r3YbgDtG8U6khhRFM3oaGp+CQ0whwmdA==",
83 - "cpu": [
84 - "arm64"
85 - ],
86 - "dev": true,
87 - "license": "MIT",
88 - "optional": true,
89 - "os": [
90 - "linux"
91 - ]
92 - },
93 - "node_modules/@oven/bun-linux-aarch64-musl": {
94 - "version": "1.3.11",
95 - "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-musl/-/bun-linux-aarch64-musl-1.3.11.tgz",
96 - "integrity": "sha512-jBwYCLG5Eb+PqtFrc3Wp2WMYlw1Id75gUcsdP+ApCOpf5oQhHxkFWCjZmcDoioDmEhMWAiM3wtwSrTlPg+sI6Q==",
97 - "cpu": [
98 - "arm64"
99 - ],
100 - "dev": true,
101 - "license": "MIT",
102 - "optional": true,
103 - "os": [
104 - "linux"
105 - ]
106 - },
107 - "node_modules/@oven/bun-linux-x64": {
108 - "version": "1.3.11",
109 - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.3.11.tgz",
110 - "integrity": "sha512-z3GFCk1UBzDOOiEBHL32lVP7Edi26BhOjKb6bIc0nRyabbRiyON4++GR0zmd/H5zM5S0+UcXFgCGnD+b8avTLw==",
111 - "cpu": [
112 - "x64"
113 - ],
114 - "dev": true,
115 - "license": "MIT",
116 - "optional": true,
117 - "os": [
118 - "linux"
119 - ]
120 - },
121 - "node_modules/@oven/bun-linux-x64-baseline": {
122 - "version": "1.3.11",
123 - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.3.11.tgz",
124 - "integrity": "sha512-KZlf1jKtf4jai8xiQv/0XRjxVVhHnw/HtUKtLdOeQpTOQ1fQFhLoz2FGGtVRd0LVa/yiRbSz9HlWIzWlmJClng==",
125 - "cpu": [
126 - "x64"
127 - ],
128 - "dev": true,
129 - "license": "MIT",
130 - "optional": true,
131 - "os": [
132 - "linux"
133 - ]
134 - },
135 - "node_modules/@oven/bun-linux-x64-musl": {
136 - "version": "1.3.11",
137 - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl/-/bun-linux-x64-musl-1.3.11.tgz",
138 - "integrity": "sha512-ADImD4yCHNpqZu718E2chWcCaAHvua90yhmpzzV6fF4zOhwkGGbPCgUWmKyJ83uz+DXaPdYxX0ttDvtolrzx3Q==",
139 - "cpu": [
140 - "x64"
141 - ],
142 - "dev": true,
143 - "license": "MIT",
144 - "optional": true,
145 - "os": [
146 - "linux"
147 - ]
148 - },
149 - "node_modules/@oven/bun-linux-x64-musl-baseline": {
150 - "version": "1.3.11",
151 - "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl-baseline/-/bun-linux-x64-musl-baseline-1.3.11.tgz",
152 - "integrity": "sha512-J+qz4Al05PrNIOdj7xsWVTyx0c/gjUauG5nKV3Rrx0Q+5JO+1pPVlnfNmWbOF9pKG4f3IGad8KXJUfGMORld+Q==",
153 - "cpu": [
154 - "x64"
155 - ],
156 - "dev": true,
157 - "license": "MIT",
158 - "optional": true,
159 - "os": [
160 - "linux"
161 - ]
162 - },
163 - "node_modules/@oven/bun-windows-aarch64": {
164 - "version": "1.3.11",
165 - "resolved": "https://registry.npmjs.org/@oven/bun-windows-aarch64/-/bun-windows-aarch64-1.3.11.tgz",
166 - "integrity": "sha512-UOdkwScHRkGPz+n9ZJU7sTkTvqV7rD1SLCLaru1xH8WRsV7tDorPqNCzEN1msOIiPRK825nvAtEm9UsomO1GsA==",
167 - "cpu": [
168 - "arm64"
169 - ],
170 - "dev": true,
171 - "license": "MIT",
172 - "optional": true,
173 - "os": [
174 - "win32"
175 - ]
176 - },
177 - "node_modules/@oven/bun-windows-x64": {
178 - "version": "1.3.11",
179 - "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.3.11.tgz",
180 - "integrity": "sha512-E51tyWDP1l0CbjZYhiUxhDGPaY8Hf5YBREx0PHBff1LM1/q3qsJ6ZvRUa8YbbOO0Ax9QP6GHjD9vf3n6bXZ7QA==",
181 - "cpu": [
182 - "x64"
183 - ],
184 - "dev": true,
185 - "license": "MIT",
186 - "optional": true,
187 - "os": [
188 - "win32"
189 - ]
190 - },
191 - "node_modules/@oven/bun-windows-x64-baseline": {
192 - "version": "1.3.11",
193 - "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.3.11.tgz",
194 - "integrity": "sha512-cCsXK9AQ9Zf18QlVnbrFu2IKfr4sf2sfbErkF2jfCzyCO9Bnhl0KRx63zlN+Ni1xU7gcBLAssgcui5R400N2eA==",
195 - "cpu": [
196 - "x64"
197 - ],
198 - "dev": true,
199 - "license": "MIT",
200 - "optional": true,
201 - "os": [
202 - "win32"
203 - ]
204 - },
205 - "node_modules/@pkgjs/parseargs": {
206 - "version": "0.11.0",
207 - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
208 - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
209 - "license": "MIT",
210 - "optional": true,
211 - "engines": {
212 - "node": ">=14"
213 - }
214 - },
215 - "node_modules/@types/bun": {
216 - "version": "1.3.11",
217 - "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.11.tgz",
218 - "integrity": "sha512-5vPne5QvtpjGpsGYXiFyycfpDF2ECyPcTSsFBMa0fraoxiQyMJ3SmuQIGhzPg2WJuWxVBoxWJ2kClYTcw/4fAg==",
219 - "dev": true,
220 - "license": "MIT",
221 - "dependencies": {
222 - "bun-types": "1.3.11"
223 - }
224 - },
225 - "node_modules/@types/node": {
226 - "version": "25.5.0",
227 - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
228 - "integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
229 - "dev": true,
230 - "license": "MIT",
231 - "dependencies": {
232 - "undici-types": "~7.18.0"
233 - }
234 - },
235 - "node_modules/ansi-regex": {
236 - "version": "6.2.2",
237 - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
238 - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
239 - "license": "MIT",
240 - "engines": {
241 - "node": ">=12"
242 - },
243 - "funding": {
244 - "url": "https://github.com/chalk/ansi-regex?sponsor=1"
245 - }
246 - },
247 - "node_modules/ansi-styles": {
248 - "version": "6.2.3",
249 - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
250 - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
251 - "license": "MIT",
252 - "engines": {
253 - "node": ">=12"
254 - },
255 - "funding": {
256 - "url": "https://github.com/chalk/ansi-styles?sponsor=1"
257 - }
258 - },
259 - "node_modules/balanced-match": {
260 - "version": "1.0.2",
261 - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
262 - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
263 - "license": "MIT"
264 - },
265 - "node_modules/brace-expansion": {
266 - "version": "2.0.3",
267 - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz",
268 - "integrity": "sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA==",
269 - "license": "MIT",
270 - "dependencies": {
271 - "balanced-match": "^1.0.0"
272 - }
273 - },
274 - "node_modules/bun": {
275 - "version": "1.3.11",
276 - "resolved": "https://registry.npmjs.org/bun/-/bun-1.3.11.tgz",
277 - "integrity": "sha512-AvXWYFO6j/ZQ7bhGm4X6eilq2JHsDVC90ZM32k2B7/srhC2gs3Sdki1QTbwrdRCo8o7eT+167vcB1yzOvPdbjA==",
278 - "cpu": [
279 - "arm64",
280 - "x64"
281 - ],
282 - "dev": true,
283 - "hasInstallScript": true,
284 - "license": "MIT",
285 - "os": [
286 - "darwin",
287 - "linux",
288 - "win32"
289 - ],
290 - "bin": {
291 - "bun": "bin/bun.exe",
292 - "bunx": "bin/bunx.exe"
293 - },
294 - "optionalDependencies": {
295 - "@oven/bun-darwin-aarch64": "1.3.11",
296 - "@oven/bun-darwin-x64": "1.3.11",
297 - "@oven/bun-darwin-x64-baseline": "1.3.11",
298 - "@oven/bun-linux-aarch64": "1.3.11",
299 - "@oven/bun-linux-aarch64-musl": "1.3.11",
300 - "@oven/bun-linux-x64": "1.3.11",
301 - "@oven/bun-linux-x64-baseline": "1.3.11",
302 - "@oven/bun-linux-x64-musl": "1.3.11",
303 - "@oven/bun-linux-x64-musl-baseline": "1.3.11",
304 - "@oven/bun-windows-aarch64": "1.3.11",
305 - "@oven/bun-windows-x64": "1.3.11",
306 - "@oven/bun-windows-x64-baseline": "1.3.11"
307 - }
308 - },
309 - "node_modules/bun-types": {
310 - "version": "1.3.11",
311 - "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.3.11.tgz",
312 - "integrity": "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg==",
313 - "dev": true,
314 - "license": "MIT",
315 - "dependencies": {
316 - "@types/node": "*"
317 - }
318 - },
319 - "node_modules/color-convert": {
320 - "version": "2.0.1",
321 - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
322 - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
323 - "license": "MIT",
324 - "dependencies": {
325 - "color-name": "~1.1.4"
326 - },
327 - "engines": {
328 - "node": ">=7.0.0"
329 - }
330 - },
331 - "node_modules/color-name": {
332 - "version": "1.1.4",
333 - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
334 - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
335 - "license": "MIT"
336 - },
337 - "node_modules/cross-spawn": {
338 - "version": "7.0.6",
339 - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
340 - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
341 - "license": "MIT",
342 - "dependencies": {
343 - "path-key": "^3.1.0",
344 - "shebang-command": "^2.0.0",
345 - "which": "^2.0.1"
346 - },
347 - "engines": {
348 - "node": ">= 8"
349 - }
350 - },
351 - "node_modules/eastasianwidth": {
352 - "version": "0.2.0",
353 - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
354 - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
355 - "license": "MIT"
356 - },
357 - "node_modules/emoji-regex": {
358 - "version": "9.2.2",
359 - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
360 - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
361 - "license": "MIT"
362 - },
363 - "node_modules/foreground-child": {
364 - "version": "3.3.1",
365 - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
366 - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
367 - "license": "ISC",
368 - "dependencies": {
369 - "cross-spawn": "^7.0.6",
370 - "signal-exit": "^4.0.1"
371 - },
372 - "engines": {
373 - "node": ">=14"
374 - },
375 - "funding": {
376 - "url": "https://github.com/sponsors/isaacs"
377 - }
378 - },
379 - "node_modules/glob": {
380 - "version": "10.5.0",
381 - "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
382 - "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
383 - "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
384 - "license": "ISC",
385 - "dependencies": {
386 - "foreground-child": "^3.1.0",
387 - "jackspeak": "^3.1.2",
388 - "minimatch": "^9.0.4",
389 - "minipass": "^7.1.2",
390 - "package-json-from-dist": "^1.0.0",
391 - "path-scurry": "^1.11.1"
392 - },
393 - "bin": {
394 - "glob": "dist/esm/bin.mjs"
395 - },
396 - "funding": {
397 - "url": "https://github.com/sponsors/isaacs"
398 - }
399 - },
400 - "node_modules/is-fullwidth-code-point": {
401 - "version": "3.0.0",
402 - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
403 - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
404 - "license": "MIT",
405 - "engines": {
406 - "node": ">=8"
407 - }
408 - },
409 - "node_modules/isexe": {
410 - "version": "2.0.0",
411 - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
412 - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
413 - "license": "ISC"
414 - },
415 - "node_modules/jackspeak": {
416 - "version": "3.4.3",
417 - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
418 - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
419 - "license": "BlueOak-1.0.0",
420 - "dependencies": {
421 - "@isaacs/cliui": "^8.0.2"
422 - },
423 - "funding": {
424 - "url": "https://github.com/sponsors/isaacs"
425 - },
426 - "optionalDependencies": {
427 - "@pkgjs/parseargs": "^0.11.0"
428 - }
429 - },
430 - "node_modules/lru-cache": {
431 - "version": "10.4.3",
432 - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
433 - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
434 - "license": "ISC"
435 - },
436 - "node_modules/minimatch": {
437 - "version": "9.0.9",
438 - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
439 - "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
440 - "license": "ISC",
441 - "dependencies": {
442 - "brace-expansion": "^2.0.2"
443 - },
444 - "engines": {
445 - "node": ">=16 || 14 >=14.17"
446 - },
447 - "funding": {
448 - "url": "https://github.com/sponsors/isaacs"
449 - }
450 - },
451 - "node_modules/minipass": {
452 - "version": "7.1.3",
453 - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
454 - "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
455 - "license": "BlueOak-1.0.0",
456 - "engines": {
457 - "node": ">=16 || 14 >=14.17"
458 - }
459 - },
460 - "node_modules/package-json-from-dist": {
461 - "version": "1.0.1",
462 - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
463 - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
464 - "license": "BlueOak-1.0.0"
465 - },
466 - "node_modules/path-key": {
467 - "version": "3.1.1",
468 - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
469 - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
470 - "license": "MIT",
471 - "engines": {
472 - "node": ">=8"
473 - }
474 - },
475 - "node_modules/path-scurry": {
476 - "version": "1.11.1",
477 - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
478 - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
479 - "license": "BlueOak-1.0.0",
480 - "dependencies": {
481 - "lru-cache": "^10.2.0",
482 - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
483 - },
484 - "engines": {
485 - "node": ">=16 || 14 >=14.18"
486 - },
487 - "funding": {
488 - "url": "https://github.com/sponsors/isaacs"
489 - }
490 - },
491 - "node_modules/shebang-command": {
492 - "version": "2.0.0",
493 - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
494 - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
495 - "license": "MIT",
496 - "dependencies": {
497 - "shebang-regex": "^3.0.0"
498 - },
499 - "engines": {
500 - "node": ">=8"
501 - }
502 - },
503 - "node_modules/shebang-regex": {
504 - "version": "3.0.0",
505 - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
506 - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
507 - "license": "MIT",
508 - "engines": {
509 - "node": ">=8"
510 - }
511 - },
512 - "node_modules/signal-exit": {
513 - "version": "4.1.0",
514 - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
515 - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
516 - "license": "ISC",
517 - "engines": {
518 - "node": ">=14"
519 - },
520 - "funding": {
521 - "url": "https://github.com/sponsors/isaacs"
522 - }
523 - },
524 - "node_modules/string-width": {
525 - "version": "5.1.2",
526 - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
527 - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
528 - "license": "MIT",
529 - "dependencies": {
530 - "eastasianwidth": "^0.2.0",
531 - "emoji-regex": "^9.2.2",
532 - "strip-ansi": "^7.0.1"
533 - },
534 - "engines": {
535 - "node": ">=12"
536 - },
537 - "funding": {
538 - "url": "https://github.com/sponsors/sindresorhus"
539 - }
540 - },
541 - "node_modules/string-width-cjs": {
542 - "name": "string-width",
543 - "version": "4.2.3",
544 - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
545 - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
546 - "license": "MIT",
547 - "dependencies": {
548 - "emoji-regex": "^8.0.0",
549 - "is-fullwidth-code-point": "^3.0.0",
550 - "strip-ansi": "^6.0.1"
551 - },
552 - "engines": {
553 - "node": ">=8"
554 - }
555 - },
556 - "node_modules/string-width-cjs/node_modules/ansi-regex": {
557 - "version": "5.0.1",
558 - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
559 - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
560 - "license": "MIT",
561 - "engines": {
562 - "node": ">=8"
563 - }
564 - },
565 - "node_modules/string-width-cjs/node_modules/emoji-regex": {
566 - "version": "8.0.0",
567 - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
568 - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
569 - "license": "MIT"
570 - },
571 - "node_modules/string-width-cjs/node_modules/strip-ansi": {
572 - "version": "6.0.1",
573 - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
574 - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
575 - "license": "MIT",
576 - "dependencies": {
577 - "ansi-regex": "^5.0.1"
578 - },
579 - "engines": {
580 - "node": ">=8"
581 - }
582 - },
583 - "node_modules/strip-ansi": {
584 - "version": "7.2.0",
585 - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
586 - "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
587 - "license": "MIT",
588 - "dependencies": {
589 - "ansi-regex": "^6.2.2"
590 - },
591 - "engines": {
592 - "node": ">=12"
593 - },
594 - "funding": {
595 - "url": "https://github.com/chalk/strip-ansi?sponsor=1"
596 - }
597 - },
598 - "node_modules/strip-ansi-cjs": {
599 - "name": "strip-ansi",
600 - "version": "6.0.1",
601 - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
602 - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
603 - "license": "MIT",
604 - "dependencies": {
605 - "ansi-regex": "^5.0.1"
606 - },
607 - "engines": {
608 - "node": ">=8"
609 - }
610 - },
611 - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
612 - "version": "5.0.1",
613 - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
614 - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
615 - "license": "MIT",
616 - "engines": {
617 - "node": ">=8"
618 - }
619 - },
620 - "node_modules/undici-types": {
621 - "version": "7.18.2",
622 - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
623 - "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
624 - "dev": true,
625 - "license": "MIT"
626 - },
627 - "node_modules/which": {
628 - "version": "2.0.2",
629 - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
630 - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
631 - "license": "ISC",
632 - "dependencies": {
633 - "isexe": "^2.0.0"
634 - },
635 - "bin": {
636 - "node-which": "bin/node-which"
637 - },
638 - "engines": {
639 - "node": ">= 8"
640 - }
641 - },
642 - "node_modules/wrap-ansi": {
643 - "version": "8.1.0",
644 - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
645 - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
646 - "license": "MIT",
647 - "dependencies": {
648 - "ansi-styles": "^6.1.0",
649 - "string-width": "^5.0.1",
650 - "strip-ansi": "^7.0.1"
651 - },
652 - "engines": {
653 - "node": ">=12"
654 - },
655 - "funding": {
656 - "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
657 - }
658 - },
659 - "node_modules/wrap-ansi-cjs": {
660 - "name": "wrap-ansi",
661 - "version": "7.0.0",
662 - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
663 - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
664 - "license": "MIT",
665 - "dependencies": {
666 - "ansi-styles": "^4.0.0",
667 - "string-width": "^4.1.0",
668 - "strip-ansi": "^6.0.0"
669 - },
670 - "engines": {
671 - "node": ">=10"
672 - },
673 - "funding": {
674 - "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
675 - }
676 - },
677 - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
678 - "version": "5.0.1",
679 - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
680 - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
681 - "license": "MIT",
682 - "engines": {
683 - "node": ">=8"
684 - }
685 - },
686 - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": {
687 - "version": "4.3.0",
688 - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
689 - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
690 - "license": "MIT",
691 - "dependencies": {
692 - "color-convert": "^2.0.1"
693 - },
694 - "engines": {
695 - "node": ">=8"
696 - },
697 - "funding": {
698 - "url": "https://github.com/chalk/ansi-styles?sponsor=1"
699 - }
700 - },
701 - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": {
702 - "version": "8.0.0",
703 - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
704 - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
705 - "license": "MIT"
706 - },
707 - "node_modules/wrap-ansi-cjs/node_modules/string-width": {
708 - "version": "4.2.3",
709 - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
710 - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
711 - "license": "MIT",
712 - "dependencies": {
713 - "emoji-regex": "^8.0.0",
714 - "is-fullwidth-code-point": "^3.0.0",
715 - "strip-ansi": "^6.0.1"
716 - },
717 - "engines": {
718 - "node": ">=8"
719 - }
720 - },
721 - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
722 - "version": "6.0.1",
723 - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
724 - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
725 - "license": "MIT",
726 - "dependencies": {
727 - "ansi-regex": "^5.0.1"
728 - },
729 - "engines": {
730 - "node": ">=8"
731 - }
732 - },
733 - "node_modules/zod": {
734 - "version": "3.25.76",
735 - "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
736 - "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
737 - "license": "MIT",
738 - "funding": {
739 - "url": "https://github.com/sponsors/colinhacks"
740 - }
741 - },
742 - "node_modules/zod-to-json-schema": {
743 - "version": "3.25.2",
744 - "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz",
745 - "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==",
746 - "license": "ISC",
747 - "peerDependencies": {
748 - "zod": "^3.25.28 || ^4"
749 - }
750 - }
751 - }

opencode/plugins/chef/package.json

Deleted
deleted file mode 100644
1 -{
2 - "name": "@opencode-ai/chef",
3 - "version": "0.1.0",
4 - "description": "Orchestrator plugin for coordinating multiple agents in structured workflows",
5 - "type": "module",
6 - "dependencies": {
7 - "glob": "^10.0.0",
8 - "zod": "^3.22.0",
9 - "zod-to-json-schema": "^3.22.0"
10 - },
11 - "devDependencies": {
12 - "@types/bun": "latest",
13 - "bun": "^1.3.11"
14 - }
15 -}

opencode/plugins/chef/pipeline/builder.ts

Deleted
deleted file mode 100644
1 -import { z } from "zod";
3 -export interface RetryPolicy {
4 - maxAttempts: number;
5 - backoffMs: number;
6 - retryOn: string[] | undefined;
7 -}
9 -export interface StepDefinition<
10 - TContext extends Record<string, any> = Record<string, any>,
11 -> {
12 - name: string;
13 - type: "step";
14 - agent: string;
15 - prompt: string | ((ctx: TContext) => string);
16 - output: z.ZodType<any>;
17 - timeout?: number;
18 - retry?: RetryPolicy;
21 -export interface GateDefinition {
22 - name: string;
23 - type: "gate";
24 - agent?: string;
25 - expect: z.ZodType<any>;
26 - onFail?: string;
29 -export interface ParallelDefinition<
30 - TContext extends Record<string, any> = Record<string, any>,
31 -> {
32 - name: string;
33 - type: "parallel";
34 - steps: StepDefinition<TContext>[];
37 -export interface WhenDefinition<
38 - TContext extends Record<string, any> = Record<string, any>,
39 -> {
40 - name: string;
41 - type: "when";
42 - condition: (ctx: TContext) => boolean;
43 - loopTarget?: string;
46 -export type PhaseDefinition<
47 - TContext extends Record<string, any> = Record<string, any>,
48 -> =
49 - | StepDefinition<TContext>
50 - | GateDefinition
51 - | ParallelDefinition<TContext>
52 - | WhenDefinition<TContext>;
54 -export interface PipelineDefinition {
55 - name: string;
56 - phases: PhaseDefinition[];
59 -export interface FragmentDefinition<
60 - TContext extends Record<string, any> = Record<string, any>,
61 -> {
62 - name: string;
63 - steps: Omit<StepDefinition<TContext>, "type">[];
66 -export class PipelineBuilder<
67 - TContext extends Record<string, any> = Record<string, any>,
68 -> {
69 - private phases: PhaseDefinition<TContext>[] = [];
71 - constructor(private name: string) {}
73 - step(name: string, config: {
74 - agent: string;
75 - prompt: string | ((ctx: TContext) => string);
76 - output: z.ZodType<any>;
77 - timeout?: number;
78 - retry?: RetryPolicy;
79 - }): this {
80 - this.phases.push({
81 - name,
82 - type: "step",
83 - ...config,
84 - });
85 - return this;
86 - }
88 - gate(name: string, config: {
89 - agent?: string;
90 - expect: z.ZodType<any>;
91 - onFail?: string;
92 - }): this {
93 - this.phases.push({
94 - name,
95 - type: "gate",
96 - ...config,
97 - });
98 - return this;
99 - }
101 - parallel(steps: Omit<StepDefinition<TContext>, "type">[]): this {
102 - this.phases.push({
103 - name: `parallel_${this.phases.length}`,
104 - type: "parallel",
105 - steps: steps.map((s) => ({ ...s, type: "step" as const })),
106 - });
107 - return this;
108 - }
110 - when(condition: (ctx: TContext) => boolean): this {
111 - this.phases.push({
112 - name: `when_${this.phases.length}`,
113 - type: "when",
114 - condition,
115 - });
116 - return this;
117 - }
119 - loop(targetStepName: string): this {
120 - const lastPhase = this.phases[this.phases.length - 1];
121 - if (lastPhase && lastPhase.type === "when") {
122 - lastPhase.loopTarget = targetStepName;
123 - }
124 - return this;
125 - }
127 - use(fragment: FragmentDefinition<TContext>): this {
128 - this.phases.push(
129 - ...fragment.steps.map((s) => ({ ...s, type: "step" as const })),
130 - );
131 - return this;
132 - }
134 - validate(): { valid: boolean; errors: string[] } {
135 - const errors: string[] = [];
136 - const stepNames = new Set<string>();
138 - for (const phase of this.phases) {
139 - // Collect step names
140 - stepNames.add(phase.name);
141 - if (phase.type === "parallel") {
142 - for (const s of phase.steps) {
143 - stepNames.add(s.name);
144 - }
145 - }
147 - // Validate each phase
148 - if (phase.type === "step") {
149 - if (!phase.output || typeof phase.output.parse !== "function") {
150 - errors.push(
151 - `Step "${phase.name}" has invalid output schema (expected Zod type)`,
152 - );
153 - }
154 - if (!phase.agent || typeof phase.agent !== "string") {
155 - errors.push(
156 - `Step "${phase.name}" has invalid agent (expected string)`,
157 - );
158 - }
159 - }
161 - if (phase.type === "gate") {
162 - if (!phase.expect || typeof phase.expect.parse !== "function") {
163 - errors.push(
164 - `Gate "${phase.name}" has invalid expect schema (expected Zod type)`,
165 - );
166 - }
167 - if (phase.onFail && !stepNames.has(phase.onFail)) {
168 - errors.push(
169 - `Gate "${phase.name}" onFail target "${phase.onFail}" not found in pipeline`,
170 - );
171 - }
172 - }
174 - if (phase.type === "when") {
175 - if (phase.loopTarget && !stepNames.has(phase.loopTarget)) {
176 - errors.push(
177 - `Loop target "${phase.loopTarget}" not found in pipeline`,
178 - );
179 - }
180 - if (typeof phase.condition !== "function") {
181 - errors.push(
182 - `When "${phase.name}" has invalid condition (expected function)`,
183 - );
184 - }
185 - }
187 - if (phase.type === "parallel") {
188 - for (const s of phase.steps) {
189 - if (!s.output || typeof s.output.parse !== "function") {
190 - errors.push(`Parallel step "${s.name}" has invalid output schema`);
191 - }
192 - if (!s.agent || typeof s.agent !== "string") {
193 - errors.push(`Parallel step "${s.name}" has invalid agent`);
194 - }
195 - }
196 - }
197 - }
199 - return { valid: errors.length === 0, errors };
200 - }
202 - build(): PipelineDefinition {
203 - return {
204 - name: this.name,
205 - phases: this.phases as PhaseDefinition[],
206 - };
207 - }
210 -export function pipeline<
211 - TContext extends Record<string, any> = Record<string, any>,
212 ->(
213 - name: string,
214 -): PipelineBuilder<TContext> {
215 - return new PipelineBuilder<TContext>(name);
218 -export function step<
219 - TContext extends Record<string, any> = Record<string, any>,
220 ->(
221 - name: string,
222 - config: Omit<StepDefinition<TContext>, "name" | "type">,
223 -): Omit<StepDefinition<TContext>, "type"> {
224 - return { name, ...config };
227 -export function fragment<
228 - TContext extends Record<string, any> = Record<string, any>,
229 ->(
230 - name: string,
231 - steps: Omit<StepDefinition<TContext>, "type">[],
232 -): FragmentDefinition<TContext> {
233 - return { name, steps };

opencode/plugins/chef/pipelines/feature.ts

Deleted
deleted file mode 100644
1 -import { fragment, pipeline, step } from "../pipeline/builder";
2 -import { z } from "zod";
4 -// Reusable review fragment
5 -const reviewFragment = fragment("review", [
6 - step("review_security", {
7 - agent: "security",
8 - prompt: "Review the implementation for security vulnerabilities",
9 - output: z.object({
10 - passed: z.boolean(),
11 - findings: z.array(z.string()),
12 - }),
13 - timeout: 60000,
14 - }),
15 - step("review_quality", {
16 - agent: "reviewer",
17 - prompt: (ctx) => `Review code quality for:\n${ctx.implement.summary}`,
18 - output: z.object({
19 - passed: z.boolean(),
20 - feedback: z.array(z.string()),
21 - }),
22 - timeout: 60000,
23 - }),
24 -]);
26 -export default pipeline("feature")
27 - .step("research", {
28 - agent: "researcher",
29 - prompt: "Research the codebase and identify relevant files and patterns",
30 - output: z.object({
31 - findings: z.string().describe("Summary of research findings"),
32 - files: z.array(z.string()).describe("List of relevant files"),
33 - patterns: z.array(z.string()).describe("Identified patterns"),
34 - }),
35 - })
36 - .step("plan", {
37 - agent: "planner",
38 - prompt: (ctx) =>
39 - `Based on the research findings, create an implementation plan.\n\nResearch:\n${ctx.research.findings}\n\nFiles:\n${
40 - ctx.research.files.join("\n")
41 - }`,
42 - output: z.object({
43 - tasks: z.array(z.string()).describe("List of implementation tasks"),
44 - approach: z.string().describe("Overall approach"),
45 - risks: z.array(z.string()).describe("Potential risks"),
46 - }),
47 - })
48 - .gate("approval", {
49 - agent: "devil",
50 - expect: z.object({
51 - approved: z.boolean().describe("Whether the plan is approved"),
52 - feedback: z.string().optional().describe("Feedback if not approved"),
53 - }),
54 - onFail: "plan",
55 - })
56 - .when((ctx) => !ctx.approval.approved)
57 - .loop("plan")
58 - .step("implement", {
59 - agent: "programmer",
60 - prompt: (ctx) =>
61 - `Implement the approved plan.\n\nTasks:\n${
62 - ctx.plan.tasks.join("\n")
63 - }\n\nApproach: ${ctx.plan.approach}`,
64 - output: z.object({
65 - completed: z.array(z.string()).describe("Completed tasks"),
66 - modified_files: z.array(z.string()).describe("Modified files"),
67 - summary: z.string().describe("Implementation summary"),
68 - }),
69 - retry: {
70 - maxAttempts: 3,
71 - backoffMs: 2000,
72 - retryOn: ["agent_error", "agent_timeout"],
73 - },
74 - })
75 - .use(reviewFragment)
76 - .build();

opencode/plugins/chef/store.ts

Deleted
deleted file mode 100644
1 -import { Database } from "bun:sqlite";
2 -import { mkdirSync } from "node:fs";
3 -import { join } from "path";
4 -import { randomUUID } from "crypto";
6 -export type PipelineStatus =
7 - | "running"
8 - | "completed"
9 - | "failed"
10 - | "aborted"
11 - | "needs_input";
12 -export type PhaseStatus =
13 - | "pending"
14 - | "running"
15 - | "completed"
16 - | "failed"
17 - | "skipped";
19 -export interface PipelineInstance {
20 - id: string;
21 - definition: string;
22 - status: PipelineStatus;
23 - input: string;
24 - context: string;
25 - current_phase: number;
26 - created_at: number;
27 - updated_at: number;
30 -export interface PhaseState {
31 - id: string;
32 - pipeline_id: string;
33 - name: string;
34 - status: PhaseStatus;
35 - output: string;
36 - error: string | null;
37 - attempts: number;
38 - started_at: number | null;
39 - completed_at: number | null;
42 -const ALLOWED_COLUMNS: Record<string, ReadonlySet<string>> = {
43 - pipeline_instance: new Set([
44 - "id",
45 - "definition",
46 - "status",
47 - "input",
48 - "context",
49 - "current_phase",
50 - "created_at",
51 - "updated_at",
52 - ]),
53 - phase_state: new Set([
54 - "id",
55 - "pipeline_id",
56 - "name",
57 - "status",
58 - "output",
59 - "error",
60 - "attempts",
61 - "started_at",
62 - "completed_at",
63 - ]),
64 -};
66 -/** Defense-in-depth: tripwire in case new callers pass an invalid table. */
67 -const ALLOWED_TABLES: ReadonlySet<string> = new Set(
68 - Object.keys(ALLOWED_COLUMNS),
69 -);
71 -export class Store {
72 - private db: Database;
74 - private static SCHEMA_VERSION = 2;
76 - private static MIGRATIONS: Array<{
77 - version: number;
78 - description: string;
79 - sql: string[];
80 - }> = [
81 - {
82 - version: 1,
83 - description: "Initial schema",
84 - sql: [
85 - `CREATE TABLE IF NOT EXISTS pipeline_instance (
86 - id TEXT PRIMARY KEY,
87 - definition TEXT NOT NULL,
88 - status TEXT NOT NULL,
89 - input TEXT,
90 - context TEXT,
91 - current_phase INTEGER DEFAULT 0,
92 - created_at INTEGER,
93 - updated_at INTEGER
94 - )`,
95 - `CREATE TABLE IF NOT EXISTS phase_state (
96 - id TEXT PRIMARY KEY,
97 - pipeline_id TEXT NOT NULL,
98 - name TEXT NOT NULL,
99 - status TEXT NOT NULL,
100 - output TEXT,
101 - error TEXT,
102 - attempts INTEGER DEFAULT 0,
103 - started_at INTEGER,
104 - completed_at INTEGER,
105 - FOREIGN KEY (pipeline_id) REFERENCES pipeline_instance(id)
106 - )`,
107 - `CREATE INDEX IF NOT EXISTS idx_phase_pipeline ON phase_state(pipeline_id)`,
108 - ],
109 - },
110 - {
111 - version: 2,
112 - description: "Remove unused step_state table",
113 - sql: [
114 - `DROP TABLE IF EXISTS step_state`,
115 - `DROP INDEX IF EXISTS idx_step_phase`,
116 - ],
117 - },
118 - ];
120 - constructor(directory: string) {
121 - const chefDir = join(directory, ".opencode/chef");
122 - mkdirSync(chefDir, { recursive: true });
123 - const dbPath = join(chefDir, "chef.db");
124 - this.db = new Database(dbPath);
125 - this.db.run("PRAGMA journal_mode = WAL");
126 - this.initSchema();
127 - }
129 - private initSchema() {
130 - this.db.run(`
131 - CREATE TABLE IF NOT EXISTS schema_version (
132 - version INTEGER PRIMARY KEY,
133 - applied_at INTEGER
134 - )
135 - `);
137 - const row = this.db
138 - .query<{ version: number | null }, []>(
139 - "SELECT MAX(version) as version FROM schema_version",
140 - )
141 - .get();
142 - const currentVersion = row?.version ?? 0;
144 - for (const migration of Store.MIGRATIONS) {
145 - if (migration.version > currentVersion) {
146 - for (const sql of migration.sql) {
147 - this.db.run(sql);
148 - }
149 - this.db.run(
150 - "INSERT INTO schema_version (version, applied_at) VALUES (?, ?)",
151 - [migration.version, Date.now()],
152 - );
153 - console.log(
154 - `Chef: Applied schema migration v${migration.version}: ${migration.description}`,
155 - );
156 - }
157 - }
158 - }
160 - // Pipeline operations
161 - createPipeline(definition: string, input: any): PipelineInstance {
162 - const id = randomUUID();
163 - const now = Date.now();
165 - this.db.run(
166 - `INSERT INTO pipeline_instance (id, definition, status, input, context, current_phase, created_at, updated_at)
167 - VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
168 - [id, definition, "running", JSON.stringify(input), "{}", 0, now, now],
169 - );
171 - return this.getPipeline(id)!;
172 - }
174 - getPipeline(id: string): PipelineInstance | null {
175 - const result = this.db.query<PipelineInstance, [string]>(
176 - "SELECT * FROM pipeline_instance WHERE id = ?",
177 - ).get(id);
179 - return result || null;
180 - }
182 - private updateRecord(
183 - table: string,
184 - id: string,
185 - updates: Record<string, any>,
186 - withTimestamp = false,
187 - ): void {
188 - if (!ALLOWED_TABLES.has(table)) {
189 - throw new Error(`Chef Store: unknown table "${table}"`);
190 - }
191 - const allowed = ALLOWED_COLUMNS[table];
192 - const filtered = Object.fromEntries(
193 - Object.entries(updates).filter(
194 - ([k]) => k !== "id" && (allowed ? allowed.has(k) : false),
195 - ),
196 - );
197 - if (Object.keys(filtered).length === 0) {
198 - if (withTimestamp) {
199 - this.db.run(
200 - `UPDATE ${table} SET updated_at = ? WHERE id = ?`,
201 - [Date.now(), id],
202 - );
203 - }
204 - return;
205 - }
206 - const fields = Object.keys(filtered).map((k) => `${k} = ?`).join(", ");
207 - const values = withTimestamp
208 - ? [...Object.values(filtered), Date.now(), id]
209 - : [...Object.values(filtered), id];
210 - const suffix = withTimestamp ? ", updated_at = ?" : "";
211 - this.db.run(
212 - `UPDATE ${table} SET ${fields}${suffix} WHERE id = ?`,
213 - values,
214 - );
215 - }
217 - updatePipeline(id: string, updates: Partial<PipelineInstance>): void {
218 - this.updateRecord("pipeline_instance", id, updates, true);
219 - }
221 - listPipelines(status?: PipelineStatus): PipelineInstance[] {
222 - if (status) {
223 - return this.db.query<PipelineInstance, [string]>(
224 - "SELECT * FROM pipeline_instance WHERE status = ? ORDER BY created_at DESC",
225 - ).all(status);
226 - }
228 - return this.db.query<PipelineInstance, []>(
229 - "SELECT * FROM pipeline_instance ORDER BY created_at DESC",
230 - ).all([]);
231 - }
233 - // Phase operations
234 - createPhase(pipelineId: string, name: string): PhaseState {
235 - const id = randomUUID();
237 - this.db.run(
238 - `INSERT INTO phase_state (id, pipeline_id, name, status, output, error, attempts, started_at, completed_at)
239 - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
240 - [id, pipelineId, name, "pending", "{}", null, 0, null, null],
241 - );
243 - return this.getPhase(id)!;
244 - }
246 - getPhase(id: string): PhaseState | null {
247 - const result = this.db.query<PhaseState, [string]>(
248 - "SELECT * FROM phase_state WHERE id = ?",
249 - ).get(id);
251 - return result || null;
252 - }
254 - updatePhase(id: string, updates: Partial<PhaseState>): void {
255 - this.updateRecord("phase_state", id, updates);
256 - }
258 - getPhasesByPipeline(pipelineId: string): PhaseState[] {
259 - return this.db.query<PhaseState, [string]>(
260 - "SELECT * FROM phase_state WHERE pipeline_id = ? ORDER BY started_at ASC",
261 - ).all(pipelineId);
262 - }
264 - close() {
265 - this.db.close();
266 - }

opencode/plugins/chef/test/builder.test.ts

Deleted
deleted file mode 100644
1 -import { describe, expect, test } from "bun:test";
2 -import { z } from "zod";
3 -import { fragment, pipeline, PipelineBuilder, step } from "../pipeline/builder";
5 -describe("pipeline()", () => {
6 - test("creates a PipelineBuilder instance", () => {
7 - const builder = pipeline("test");
8 - expect(builder).toBeInstanceOf(PipelineBuilder);
9 - });
11 - test("creates a builder with generic context type", () => {
12 - const builder = pipeline<{ foo: string }>("test");
13 - expect(builder).toBeInstanceOf(PipelineBuilder);
14 - // The type system ensures the context type is preserved
15 - });
16 -});
18 -describe("PipelineBuilder.step()", () => {
19 - test("adds a step phase to the pipeline", () => {
20 - const mockOutput = z.object({ result: z.string() });
21 - const builder = pipeline("test").step("s", {
22 - agent: "test-agent",
23 - prompt: "Hello",
24 - output: mockOutput,
25 - });
26 - const result = builder.build();
27 - expect(result.phases[0]).toMatchObject({
28 - name: "s",
29 - type: "step",
30 - agent: "test-agent",
31 - prompt: "Hello",
32 - output: mockOutput,
33 - });
34 - });
36 - test("accepts function prompt", () => {
37 - const mockOutput = z.object({ result: z.string() });
38 - const builder = pipeline("test").step("s", {
39 - agent: "test-agent",
40 - prompt: (ctx: Record<string, any>) => `Hello ${ctx.foo}`,
41 - output: mockOutput,
42 - });
43 - const result = builder.build();
44 - expect(result.phases[0]).toMatchObject({
45 - name: "s",
46 - type: "step",
47 - });
48 - // Verify prompt is stored as a function
49 - const stepPhase = result.phases[0] as { prompt?: unknown };
50 - expect(typeof stepPhase.prompt).toBe("function");
51 - });
53 - test("chains multiple steps", () => {
54 - const mockOutput = z.object({ result: z.string() });
55 - const builder = pipeline("test")
56 - .step("step1", { agent: "a1", prompt: "p1", output: mockOutput })
57 - .step("step2", { agent: "a2", prompt: "p2", output: mockOutput });
58 - const result = builder.build();
59 - expect(result.phases).toHaveLength(2);
60 - expect(result.phases[0]!.name).toBe("step1");
61 - expect(result.phases[1]!.name).toBe("step2");
62 - });
63 -});
65 -describe("PipelineBuilder.gate()", () => {
66 - test("adds a gate phase to the pipeline", () => {
67 - const mockExpect = z.object({ status: z.string() });
68 - const builder = pipeline("test").gate("g", {
69 - agent: "gate-agent",
70 - expect: mockExpect,
71 - });
72 - const result = builder.build();
73 - expect(result.phases[0]).toMatchObject({
74 - name: "g",
75 - type: "gate",
76 - agent: "gate-agent",
77 - expect: mockExpect,
78 - });
79 - });
81 - test("accepts optional agent", () => {
82 - const mockExpect = z.object({ status: z.string() });
83 - const builder = pipeline("test").gate("g", { expect: mockExpect });
84 - const result = builder.build();
85 - expect(result.phases[0]).toMatchObject({
86 - name: "g",
87 - type: "gate",
88 - expect: mockExpect,
89 - });
90 - // Agent is optional, so it should not be present when not provided
91 - const gatePhase = result.phases[0] as { agent?: string };
92 - expect(gatePhase.agent).toBeUndefined();
93 - });
95 - test("accepts onFail target", () => {
96 - const mockExpect = z.object({ status: z.string() });
97 - const mockOutput = z.object({ result: z.string() });
98 - const builder = pipeline("test")
99 - .step("s", { agent: "a", prompt: "p", output: mockOutput })
100 - .gate("g", { expect: mockExpect, onFail: "s" });
101 - const result = builder.build();
102 - expect(result.phases[1]).toMatchObject({
103 - name: "g",
104 - type: "gate",
105 - onFail: "s",
106 - });
107 - });
108 -});
110 -describe("PipelineBuilder.parallel()", () => {
111 - test("adds a parallel phase", () => {
112 - const mockOutput = z.object({ result: z.string() });
113 - const builder = pipeline("test").parallel([
114 - { name: "p1", agent: "a1", prompt: "p1", output: mockOutput },
115 - { name: "p2", agent: "a2", prompt: "p2", output: mockOutput },
116 - ]);
117 - const result = builder.build();
118 - const parallelPhase = result.phases[0] as {
119 - name: string;
120 - type: string;
121 - steps: any[];
122 - };
123 - expect(parallelPhase).toMatchObject({
124 - name: "parallel_0",
125 - type: "parallel",
126 - });
127 - expect(parallelPhase.steps).toHaveLength(2);
128 - expect(parallelPhase.steps[0]).toMatchObject({
129 - name: "p1",
130 - type: "step",
131 - agent: "a1",
132 - });
133 - expect(parallelPhase.steps[1]).toMatchObject({
134 - name: "p2",
135 - type: "step",
136 - agent: "a2",
137 - });
138 - });
140 - test("names parallel phase with index", () => {
141 - const mockOutput = z.object({ result: z.string() });
142 - const builder = pipeline("test")
143 - .parallel([{ name: "p1", agent: "a", prompt: "p", output: mockOutput }])
144 - .parallel([{ name: "p2", agent: "a", prompt: "p", output: mockOutput }]);
145 - const result = builder.build();
146 - expect(result.phases[0]!.name).toBe("parallel_0");
147 - expect(result.phases[1]!.name).toBe("parallel_1");
148 - });
149 -});
151 -describe("PipelineBuilder.when()", () => {
152 - test("adds a when phase", () => {
153 - const builder = pipeline("test").when((ctx) => ctx.condition === true);
154 - const result = builder.build();
155 - const whenPhase = result.phases[0] as {
156 - name: string;
157 - type: string;
158 - condition: Function;
159 - };
160 - expect(whenPhase).toMatchObject({
161 - name: "when_0",
162 - type: "when",
163 - });
164 - expect(typeof whenPhase.condition).toBe("function");
165 - });
167 - test("names when phase with index", () => {
168 - const builder = pipeline("test")
169 - .when((ctx) => ctx.a)
170 - .when((ctx) => ctx.b);
171 - const result = builder.build();
172 - expect(result.phases[0]!.name).toBe("when_0");
173 - expect(result.phases[1]!.name).toBe("when_1");
174 - });
175 -});
177 -describe("PipelineBuilder.loop()", () => {
178 - test("sets loopTarget on preceding when phase", () => {
179 - const mockOutput = z.object({ result: z.string() });
180 - const builder = pipeline("test")
181 - .step("target", { agent: "a", prompt: "p", output: mockOutput })
182 - .when((ctx) => ctx.continue)
183 - .loop("target");
184 - const result = builder.build();
185 - const whenPhase = result.phases[1]!;
186 - expect(whenPhase.type).toBe("when");
187 - if (whenPhase.type === "when") {
188 - expect(whenPhase.loopTarget).toBe("target");
189 - }
190 - });
192 - test("does nothing when last phase is not when", () => {
193 - const mockOutput = z.object({ result: z.string() });
194 - const builder = pipeline("test")
195 - .step("s", { agent: "a", prompt: "p", output: mockOutput })
196 - .loop("target");
197 - const result = builder.build();
198 - expect(result.phases).toHaveLength(1);
199 - expect(result.phases[0]!.type).toBe("step");
200 - });
201 -});
203 -describe("PipelineBuilder.use()", () => {
204 - test("adds fragment steps as phases", () => {
205 - const mockOutput = z.object({ result: z.string() });
206 - const myFragment = fragment("my-fragment", [
207 - { name: "f1", agent: "a1", prompt: "p1", output: mockOutput },
208 - { name: "f2", agent: "a2", prompt: "p2", output: mockOutput },
209 - ]);
210 - const builder = pipeline("test").use(myFragment);
211 - const result = builder.build();
212 - expect(result.phases).toHaveLength(2);
213 - expect(result.phases[0]!.name).toBe("f1");
214 - expect(result.phases[0]!.type).toBe("step");
215 - expect(result.phases[1]!.name).toBe("f2");
216 - expect(result.phases[1]!.type).toBe("step");
217 - });
219 - test("preserves step order from fragment", () => {
220 - const mockOutput = z.object({ result: z.string() });
221 - const myFragment = fragment("my-fragment", [
222 - { name: "first", agent: "a", prompt: "p", output: mockOutput },
223 - { name: "second", agent: "a", prompt: "p", output: mockOutput },
224 - { name: "third", agent: "a", prompt: "p", output: mockOutput },
225 - ]);
226 - const builder = pipeline("test").use(myFragment);
227 - const result = builder.build();
228 - expect(result.phases[0]!.name).toBe("first");
229 - expect(result.phases[1]!.name).toBe("second");
230 - expect(result.phases[2]!.name).toBe("third");
231 - });
232 -});
234 -describe("PipelineBuilder.validate()", () => {
235 - test("returns valid for a correct pipeline", () => {
236 - const mockOutput = z.object({ result: z.string() });
237 - const mockExpect = z.object({ status: z.string() });
238 - const builder = pipeline("test")
239 - .step("s", { agent: "a", prompt: "p", output: mockOutput })
240 - .gate("g", { agent: "gate-agent", expect: mockExpect });
241 - const result = builder.validate();
242 - expect(result.valid).toBe(true);
243 - expect(result.errors).toHaveLength(0);
244 - });
246 - test("catches invalid output schema", () => {
247 - const builder = pipeline("test").step("s", {
248 - agent: "a",
249 - prompt: "p",
250 - output: {} as any,
251 - });
252 - const result = builder.validate();
253 - expect(result.valid).toBe(false);
254 - expect(result.errors).toContain(
255 - 'Step "s" has invalid output schema (expected Zod type)',
256 - );
257 - });
259 - test("catches empty agent", () => {
260 - const mockOutput = z.object({ result: z.string() });
261 - const builder = pipeline("test").step("s", {
262 - agent: "",
263 - prompt: "p",
264 - output: mockOutput,
265 - });
266 - const result = builder.validate();
267 - expect(result.valid).toBe(false);
268 - expect(result.errors).toContain(
269 - 'Step "s" has invalid agent (expected string)',
270 - );
271 - });
273 - test("catches invalid gate expect", () => {
274 - const builder = pipeline("test").gate("g", { expect: {} as any });
275 - const result = builder.validate();
276 - expect(result.valid).toBe(false);
277 - expect(result.errors).toContain(
278 - 'Gate "g" has invalid expect schema (expected Zod type)',
279 - );
280 - });
282 - test("catches missing onFail target", () => {
283 - const mockExpect = z.object({ status: z.string() });
284 - const builder = pipeline("test").gate("g", {
285 - expect: mockExpect,
286 - onFail: "nonexistent",
287 - });
288 - const result = builder.validate();
289 - expect(result.valid).toBe(false);
290 - expect(result.errors).toContain(
291 - 'Gate "g" onFail target "nonexistent" not found in pipeline',
292 - );
293 - });
295 - test("catches missing loop target", () => {
296 - const builder = pipeline("test").when((ctx) => ctx.continue).loop(
297 - "nonexistent",
298 - );
299 - const result = builder.validate();
300 - expect(result.valid).toBe(false);
301 - expect(result.errors).toContain(
302 - 'Loop target "nonexistent" not found in pipeline',
303 - );
304 - });
306 - test("validates when loop target exists in later phase", () => {
307 - const mockOutput = z.object({ result: z.string() });
308 - // When is added first, then step - the step doesn't exist yet when validating
309 - // So this should fail
310 - const builder = pipeline("test")
311 - .when((ctx) => ctx.continue)
312 - .loop("target")
313 - .step("target", { agent: "a", prompt: "p", output: mockOutput });
314 - const result = builder.validate();
315 - // The loop target "target" is not yet seen when we validate the when phase
316 - expect(result.valid).toBe(false);
317 - expect(result.errors).toContain(
318 - 'Loop target "target" not found in pipeline',
319 - );
320 - });
322 - test("catches invalid parallel step schema", () => {
323 - const builder = pipeline("test").parallel([
324 - { name: "p1", agent: "a", prompt: "p", output: {} as any },
325 - ]);
326 - const result = builder.validate();
327 - expect(result.valid).toBe(false);
328 - expect(result.errors).toContain(
329 - 'Parallel step "p1" has invalid output schema',
330 - );
331 - });
333 - test("catches invalid parallel step agent", () => {
334 - const mockOutput = z.object({ result: z.string() });
335 - const builder = pipeline("test").parallel([
336 - { name: "p1", agent: "", prompt: "p", output: mockOutput },
337 - ]);
338 - const result = builder.validate();
339 - expect(result.valid).toBe(false);
340 - expect(result.errors).toContain('Parallel step "p1" has invalid agent');
341 - });
342 -});
344 -describe("PipelineBuilder.build()", () => {
345 - test("returns PipelineDefinition with correct name", () => {
346 - const builder = pipeline("my-pipeline");
347 - const result = builder.build();
348 - expect(result.name).toBe("my-pipeline");
349 - });
351 - test("returns all phases", () => {
352 - const mockOutput = z.object({ result: z.string() });
353 - const mockExpect = z.object({ status: z.string() });
354 - const builder = pipeline("test")
355 - .step("s1", { agent: "a1", prompt: "p1", output: mockOutput })
356 - .gate("g", { expect: mockExpect })
357 - .when((ctx) => ctx.continue);
358 - const result = builder.build();
359 - expect(result.phases).toHaveLength(3);
360 - expect(result.phases[0]!.name).toBe("s1");
361 - expect(result.phases[1]!.name).toBe("g");
362 - // when is named using phases.length, so after 2 phases it's "when_2"
363 - expect(result.phases[2]!.name).toBe("when_2");
364 - });
365 -});
367 -describe("step() helper", () => {
368 - test("creates step config with name", () => {
369 - const mockOutput = z.object({ result: z.string() });
370 - const result = step("my-step", {
371 - agent: "test-agent",
372 - prompt: "test prompt",
373 - output: mockOutput,
374 - });
375 - expect(result).toMatchObject({
376 - name: "my-step",
377 - agent: "test-agent",
378 - prompt: "test prompt",
379 - output: mockOutput,
380 - });
381 - // Should NOT have type field
382 - expect(result).not.toHaveProperty("type");
383 - });
384 -});
386 -describe("fragment() helper", () => {
387 - test("creates fragment definition", () => {
388 - const mockOutput = z.object({ result: z.string() });
389 - const step1 = step("f1", { agent: "a1", prompt: "p1", output: mockOutput });
390 - const step2 = step("f2", { agent: "a2", prompt: "p2", output: mockOutput });
391 - const result = fragment("my-fragment", [step1, step2]);
392 - expect(result).toMatchObject({
393 - name: "my-fragment",
394 - steps: [step1, step2],
395 - });
396 - expect(result.steps).toHaveLength(2);
397 - });
398 -});
400 -describe("chaining", () => {
401 - test("each method returns this for chaining", () => {
402 - const mockOutput = z.object({ result: z.string() });
403 - const mockExpect = z.object({ status: z.string() });
404 - const myFragment = fragment("frag", [
405 - { name: "frag1", agent: "a", prompt: "p", output: mockOutput },
406 - ]);
408 - // Test step()
409 - const builder1 = pipeline("test");
410 - const result1 = builder1.step("s", {
411 - agent: "a",
412 - prompt: "p",
413 - output: mockOutput,
414 - });
415 - expect(result1).toBe(builder1);
417 - // Test gate()
418 - const builder2 = pipeline("test");
419 - const result2 = builder2.gate("g", { expect: mockExpect });
420 - expect(result2).toBe(builder2);
422 - // Test parallel()
423 - const builder3 = pipeline("test");
424 - const result3 = builder3.parallel([
425 - { name: "p", agent: "a", prompt: "p", output: mockOutput },
426 - ]);
427 - expect(result3).toBe(builder3);
429 - // Test when()
430 - const builder4 = pipeline("test");
431 - const result4 = builder4.when((ctx) => ctx.cond);
432 - expect(result4).toBe(builder4);
434 - // Test loop()
435 - const builder5 = pipeline("test");
436 - builder5.step("s", { agent: "a", prompt: "p", output: mockOutput });
437 - builder5.when((ctx) => ctx.cond);
438 - const result5 = builder5.loop("s");
439 - expect(result5).toBe(builder5);
441 - // Test use()
442 - const builder6 = pipeline("test");
443 - const result6 = builder6.use(myFragment);
444 - expect(result6).toBe(builder6);
445 - });
446 -});

opencode/plugins/chef/test/executor.test.ts

Deleted
deleted file mode 100644
1 -import { afterEach, beforeEach, describe, expect, mock, test } from "bun:test";
2 -import { mkdtempSync, rmSync } from "node:fs";
3 -import { join } from "node:path";
4 -import { tmpdir } from "node:os";
6 -import {
7 - AgentError,
8 - AgentTimeoutError,
9 - ChefError,
10 - Executor,
11 - GateFailureError,
12 - MaxIterationsError,
13 -} from "../executor";
14 -import { Store } from "../store";
15 -import { z } from "zod";
17 -let store: Store;
18 -let tempDir: string;
19 -let mockClient: any;
21 -beforeEach(() => {
22 - tempDir = mkdtempSync(join(tmpdir(), "chef-exec-test-"));
23 - store = new Store(tempDir);
25 - mockClient = {
26 - session: {
27 - create: mock(() => Promise.resolve({ id: "session-1" })),
28 - prompt: mock(() =>
29 - Promise.resolve({
30 - data: { info: { structured_output: { result: "ok" } } },
31 - })
32 - ),
33 - delete: mock(() => Promise.resolve()),
34 - },
35 - app: {
36 - log: mock(() => Promise.resolve()),
37 - agents: mock(() => Promise.resolve([])),
38 - },
39 - };
40 -});
42 -afterEach(() => {
43 - store.close();
44 - rmSync(tempDir, { recursive: true, force: true });
45 -});
47 -// Helper to create a basic pipeline definition
48 -function createDefinition(phases: any[]) {
49 - return { name: "test-pipeline", phases };
52 -function createExecutor(
53 - definition: any,
54 - options?: { maxLoopIterations?: number },
55 -) {
56 - return new Executor(
57 - store,
58 - mockClient as any,
59 - definition,
60 - options,
61 - );
64 -describe("Executor - Basic step execution", () => {
65 - test("executes a single step pipeline", async () => {
66 - const definition = createDefinition([
67 - {
68 - name: "step1",
69 - type: "step",
70 - agent: "test-agent",
71 - prompt: "do thing",
72 - output: z.object({ result: z.string() }),
73 - },
74 - ]);
76 - const instance = store.createPipeline("test-pipe", {});
77 - const executor = createExecutor(definition);
78 - const result = await executor.execute(instance.id, {});
80 - expect(result.status).toBe("completed");
81 - expect(result.context.step1).toEqual({ result: "ok" });
82 - });
84 - test("creates session with correct agent", async () => {
85 - const definition = createDefinition([
86 - {
87 - name: "step1",
88 - type: "step",
89 - agent: "my-special-agent",
90 - prompt: "do thing",
91 - output: z.object({ result: z.string() }),
92 - },
93 - ]);
95 - const instance = store.createPipeline("test-pipe", {});
96 - const executor = createExecutor(definition);
97 - await executor.execute(instance.id, {});
99 - expect(mockClient.session.create).toHaveBeenCalled();
100 - const createCall = (mockClient.session.create as any).mock.calls[0][0];
101 - expect(createCall.body.agent).toBe("my-special-agent");
102 - });
104 - test("injects context before prompting", async () => {
105 - const definition = createDefinition([
106 - {
107 - name: "step1",
108 - type: "step",
109 - agent: "test-agent",
110 - prompt: "do thing",
111 - output: z.object({ result: z.string() }),
112 - },
113 - ]);
115 - const instance = store.createPipeline("test-pipe", { existing: "data" });
116 - const executor = createExecutor(definition);
117 - await executor.execute(instance.id, {});
119 - // Two prompt calls: context injection (noReply: true) and execution
120 - expect(mockClient.session.prompt).toHaveBeenCalledTimes(2);
122 - // First call is context injection
123 - const contextCall = (mockClient.session.prompt as any).mock.calls[0][0];
124 - expect(contextCall.body.noReply).toBe(true);
126 - // Second call is execution
127 - const execCall = (mockClient.session.prompt as any).mock.calls[1][0];
128 - expect(execCall.body.noReply).toBeUndefined();
129 - expect(execCall.body.format).toBeDefined();
130 - });
132 - test("uses string prompt directly", async () => {
133 - const definition = createDefinition([
134 - {
135 - name: "step1",
136 - type: "step",
137 - agent: "test-agent",
138 - prompt: "do the thing now",
139 - output: z.object({ result: z.string() }),
140 - },
141 - ]);
143 - const instance = store.createPipeline("test-pipe", {});
144 - const executor = createExecutor(definition);
145 - await executor.execute(instance.id, {});
147 - const execCall = (mockClient.session.prompt as any).mock.calls[1][0];
148 - expect(execCall.body.parts[0].text).toBe("do the thing now");
149 - });
151 - test("evaluates function prompt with context", async () => {
152 - const definition = createDefinition([
153 - {
154 - name: "step1",
155 - type: "step",
156 - agent: "test-agent",
157 - prompt: (ctx: any) => `dynamic prompt based on ${ctx.inputValue}`,
158 - output: z.object({ result: z.string() }),
159 - },
160 - ]);
162 - const instance = store.createPipeline("test-pipe", {
163 - inputValue: "test-input",
164 - });
165 - const executor = createExecutor(definition);
166 - await executor.execute(instance.id, { inputValue: "test-input" });
168 - const execCall = (mockClient.session.prompt as any).mock.calls[1][0];
169 - expect(execCall.body.parts[0].text).toBe(
170 - "dynamic prompt based on test-input",
171 - );
172 - });
173 -});
175 -describe("Executor - Context flow", () => {
176 - test("context flows between steps", async () => {
177 - let capturedContext: any;
178 - let callCount = 0;
180 - const definition = createDefinition([
181 - {
182 - name: "step1",
183 - type: "step",
184 - agent: "test-agent",
185 - prompt: "first step",
186 - output: z.object({ findings: z.string() }),
187 - },
188 - {
189 - name: "step2",
190 - type: "step",
191 - agent: "test-agent",
192 - prompt: (ctx: any) => {
193 - capturedContext = ctx;
194 - return "second step";
195 - },
196 - output: z.object({ result: z.string() }),
197 - },
198 - ]);
200 - // Replace mock with one that returns different values based on call count
201 - mockClient.session.prompt = mock(() => {
202 - callCount++;
203 - // Odd calls are context injection (1, 3), even calls are execution (2, 4)
204 - if (callCount % 2 === 0) {
205 - // Execution call - return step1's output on second execution
206 - return Promise.resolve({
207 - data: { info: { structured_output: { findings: "important-data" } } },
208 - });
209 - }
210 - // Context injection
211 - return Promise.resolve({});
212 - });
214 - const instance = store.createPipeline("test-pipe", {});
215 - const executor = createExecutor(definition);
216 - await executor.execute(instance.id, {});
218 - // The second step's prompt function should have received context with step1's output
219 - expect(capturedContext.step1).toEqual({ findings: "important-data" });
220 - });
221 -});
223 -describe("Executor - Retry logic", () => {
224 - test("retries on failure and succeeds", async () => {
225 - let attemptCount = 0;
226 - mockClient.session.prompt = mock(() => {
227 - attemptCount++;
228 - // Even calls (0, 2) are context injection, odd calls (1, 3) are execution
229 - if (attemptCount % 2 === 0) {
230 - // Execution prompt
231 - if (attemptCount < 4) {
232 - // First execution fails
233 - return Promise.reject(new AgentError("step1", "Temporary failure"));
234 - }
235 - return Promise.resolve({
236 - data: { info: { structured_output: { result: "ok" } } },
237 - });
238 - }
239 - // Context injection succeeds
240 - return Promise.resolve({});
241 - });
243 - const definition = createDefinition([
244 - {
245 - name: "step1",
246 - type: "step",
247 - agent: "test-agent",
248 - prompt: "do thing",
249 - retry: { maxAttempts: 3, backoffMs: 1, retryOn: undefined },
250 - output: z.object({ result: z.string() }),
251 - },
252 - ]);
254 - const instance = store.createPipeline("test-pipe", {});
255 - const executor = createExecutor(definition);
256 - const result = await executor.execute(instance.id, {});
258 - expect(result.status).toBe("completed");
259 - expect(result.context.step1).toEqual({ result: "ok" });
260 - });
262 - test("gives up after maxAttempts", async () => {
263 - let attemptCount = 0;
264 - mockClient.session.prompt = mock(() => {
265 - attemptCount++;
266 - if (attemptCount % 2 === 0) {
267 - // Execution - always fails
268 - return Promise.reject(new AgentError("step1", "Permanent failure"));
269 - }
270 - return Promise.resolve({});
271 - });
273 - const definition = createDefinition([
274 - {
275 - name: "step1",
276 - type: "step",
277 - agent: "test-agent",
278 - prompt: "do thing",
279 - retry: { maxAttempts: 2, backoffMs: 1, retryOn: undefined },
280 - output: z.object({ result: z.string() }),
281 - },
282 - ]);
284 - const instance = store.createPipeline("test-pipe", {});
285 - const executor = createExecutor(definition);
286 - const result = await executor.execute(instance.id, {});
288 - expect(result.status).toBe("failed");
289 - expect(result.error).toContain("Permanent failure");
290 - });
292 - test("only retries on matching error types", async () => {
293 - let attemptCount = 0;
294 - mockClient.session.prompt = mock(() => {
295 - attemptCount++;
296 - if (attemptCount % 2 === 0) {
297 - // Execution - throws agent_error (not agent_timeout)
298 - return Promise.reject(new AgentError("step1", "Wrong error type"));
299 - }
300 - return Promise.resolve({});
301 - });
303 - const definition = createDefinition([
304 - {
305 - name: "step1",
306 - type: "step",
307 - agent: "test-agent",
308 - prompt: "do thing",
309 - retry: { maxAttempts: 3, backoffMs: 1, retryOn: ["agent_timeout"] },
310 - output: z.object({ result: z.string() }),
311 - },
312 - ]);
314 - const instance = store.createPipeline("test-pipe", {});
315 - const executor = createExecutor(definition);
316 - const result = await executor.execute(instance.id, {});
318 - // Should fail immediately because agent_error doesn't match retryOn
319 - expect(result.status).toBe("failed");
320 - expect(result.error).toContain("Wrong error type");
321 - // Only one attempt made (context injection + 1 execution)
322 - expect(attemptCount).toBe(2);
323 - });
325 - test("retries on 'all' error type", async () => {
326 - let attemptCount = 0;
327 - mockClient.session.prompt = mock(() => {
328 - attemptCount++;
329 - if (attemptCount % 2 === 0) {
330 - if (attemptCount < 4) {
331 - return Promise.reject(new AgentError("step1", "Some error"));
332 - }
333 - return Promise.resolve({
334 - data: { info: { structured_output: { result: "ok" } } },
335 - });
336 - }
337 - return Promise.resolve({});
338 - });
340 - const definition = createDefinition([
341 - {
342 - name: "step1",
343 - type: "step",
344 - agent: "test-agent",
345 - prompt: "do thing",
346 - retry: { maxAttempts: 3, backoffMs: 1, retryOn: ["all"] },
347 - output: z.object({ result: z.string() }),
348 - },
349 - ]);
351 - const instance = store.createPipeline("test-pipe", {});
352 - const executor = createExecutor(definition);
353 - const result = await executor.execute(instance.id, {});
355 - expect(result.status).toBe("completed");
356 - expect(result.context.step1).toEqual({ result: "ok" });
357 - });
358 -});
360 -describe("Executor - Timeout", () => {
361 - test("step that takes too long throws AgentTimeoutError", async () => {
362 - let callCount = 0;
363 - mockClient.session.prompt = mock(() => {
364 - callCount++;
365 - // First call is context injection - resolve immediately
366 - if (callCount === 1) {
367 - return Promise.resolve({});
368 - }
369 - // Second call (execution) - never resolves (will timeout)
370 - return new Promise(() => {});
371 - });
373 - const definition = createDefinition([
374 - {
375 - name: "step1",
376 - type: "step",
377 - agent: "test-agent",
378 - prompt: "do thing",
379 - timeout: 10, // very short timeout
380 - output: z.object({ result: z.string() }),
381 - },
382 - ]);
384 - const instance = store.createPipeline("test-pipe", {});
385 - const executor = createExecutor(definition);
386 - const result = await executor.execute(instance.id, {});
388 - expect(result.status).toBe("failed");
389 - expect(result.error).toContain("timed out");
390 - });
391 -});
393 -describe("Executor - Session cleanup", () => {
394 - test("cleans up session on success", async () => {
395 - const definition = createDefinition([
396 - {
397 - name: "step1",
398 - type: "step",
399 - agent: "test-agent",
400 - prompt: "do thing",
401 - output: z.object({ result: z.string() }),
402 - },
403 - ]);
405 - const instance = store.createPipeline("test-pipe", {});
406 - const executor = createExecutor(definition);
407 - await executor.execute(instance.id, {});
409 - expect(mockClient.session.delete).toHaveBeenCalled();
410 - const deleteCall = (mockClient.session.delete as any).mock.calls[0][0];
411 - expect(deleteCall.path.id).toBe("session-1");
412 - });
414 - test("cleans up session on failure", async () => {
415 - let attemptCount = 0;
416 - mockClient.session.prompt = mock(() => {
417 - attemptCount++;
418 - if (attemptCount % 2 === 0) {
419 - return Promise.reject(new AgentError("step1", "Failure"));
420 - }
421 - return Promise.resolve({});
422 - });
424 - const definition = createDefinition([
425 - {
426 - name: "step1",
427 - type: "step",
428 - agent: "test-agent",
429 - prompt: "do thing",
430 - retry: { maxAttempts: 1, backoffMs: 1, retryOn: undefined },
431 - output: z.object({ result: z.string() }),
432 - },
433 - ]);
435 - const instance = store.createPipeline("test-pipe", {});
436 - const executor = createExecutor(definition);
437 - await executor.execute(instance.id, {});
439 - expect(mockClient.session.delete).toHaveBeenCalled();
440 - });
442 - test("tracks leaked sessions when cleanup fails", async () => {
443 - mockClient.session.delete = mock(() =>
444 - Promise.reject(new Error("Delete failed"))
445 - );
447 - const definition = createDefinition([
448 - {
449 - name: "step1",
450 - type: "step",
451 - agent: "test-agent",
452 - prompt: "do thing",
453 - output: z.object({ result: z.string() }),
454 - },
455 - ]);
457 - const instance = store.createPipeline("test-pipe", {});
458 - const executor = createExecutor(definition);
459 - const result = await executor.execute(instance.id, {});
461 - expect(result.status).toBe("completed");
462 - // The cleanup failed but pipeline still completed
463 - expect(mockClient.app.log).toHaveBeenCalled();
464 - });
466 - test("redacts session IDs in leaked session logs", async () => {
467 - const longSessionId = "abcdefghijklmnop-1234-5678-9abc-def012345678";
468 - mockClient.session.create = mock(() =>
469 - Promise.resolve({ id: longSessionId })
470 - );
471 - mockClient.session.delete = mock(() =>
472 - Promise.reject(new Error("Delete failed"))
473 - );
475 - // Capture console.warn output
476 - const warnSpy: string[] = [];
477 - const origWarn = console.warn;
478 - console.warn = (...args: any[]) => warnSpy.push(args.join(" "));
480 - try {
481 - const definition = createDefinition([
482 - {
483 - name: "step1",
484 - type: "step",
485 - agent: "test-agent",
486 - prompt: "do thing",
487 - output: z.object({ result: z.string() }),
488 - },
489 - ]);
490 - const instance = store.createPipeline("test-pipe", {});
491 - const executor = createExecutor(definition);
492 - await executor.execute(instance.id, {});
494 - // Check that the warn output contains truncated ID, not full ID
495 - const leakedWarn = warnSpy.find((w) => w.includes("leaked session"));
496 - expect(leakedWarn).toBeDefined();
497 - expect(leakedWarn!).toContain("abcdefgh…");
498 - expect(leakedWarn!).not.toContain(
499 - "abcdefghijklmnop-1234-5678-9abc-def012345678",
500 - );
501 - } finally {
502 - console.warn = origWarn;
503 - }
504 - });
506 - test("redactId handles short and long IDs correctly", () => {
507 - // Access the private static method via (Executor as any)
508 - const redact = (Executor as any).redactId;
509 - expect(redact).toBeDefined();
511 - // Long IDs are truncated to first 8 chars + ellipsis
512 - expect(redact("abcdefghijklmnop")).toBe("abcdefgh…");
513 - expect(redact("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")).toBe("aaaaaaaa…");
515 - // Short IDs (<= 8 chars) are returned unchanged
516 - expect(redact("short")).toBe("short");
517 - expect(redact("12345678")).toBe("12345678");
518 - });
519 -});
521 -describe("Executor - Gate execution", () => {
522 - test("gate with agent succeeds", async () => {
523 - const definition = createDefinition([
524 - {
525 - name: "gate1",
526 - type: "gate",
527 - agent: "test-agent",
528 - expect: z.object({ result: z.string() }),
529 - },
530 - ]);
532 - const instance = store.createPipeline("test-pipe", {});
533 - const executor = createExecutor(definition);
534 - const result = await executor.execute(instance.id, {});
536 - expect(result.status).toBe("completed");
537 - expect(result.context.gate1).toEqual({ result: "ok" });
538 - });
540 - test("gate without agent validates context directly", async () => {
541 - const definition = createDefinition([
542 - {
543 - name: "gate1",
544 - type: "gate",
545 - expect: z.object({ research: z.object({ findings: z.string() }) }),
546 - },
547 - ]);
549 - const instance = store.createPipeline("test-pipe", {
550 - research: { findings: "valid-data" },
551 - });
552 - const executor = createExecutor(definition);
553 - const result = await executor.execute(instance.id, {
554 - research: { findings: "valid-data" },
555 - });
557 - expect(result.status).toBe("completed");
558 - expect(result.context.gate1).toEqual({
559 - research: { findings: "valid-data" },
560 - });
561 - });
563 - test("gate failure with onFail loops back", async () => {
564 - let promptCallCount = 0;
566 - mockClient.session.prompt = mock((opts: any) => {
567 - promptCallCount++;
568 - // Flow:
569 - // Call 1: step1 context injection
570 - // Call 2: step1 execution
571 - // Call 3: gate1 context injection
572 - // Call 4: gate1 first evaluation (FAIL - loops back to step1)
573 - // Call 5: step1 retry context injection
574 - // Call 6: step1 retry execution
575 - // Call 7: gate1 second context injection
576 - // Call 8: gate1 second evaluation (SUCCEED)
577 - if (promptCallCount === 4) {
578 - // First gate evaluation - fail
579 - return Promise.reject(
580 - new GateFailureError("gate1", "Validation failed"),
581 - );
582 - }
583 - if (promptCallCount === 8) {
584 - // Second gate evaluation - succeed
585 - return Promise.resolve({
586 - data: { info: { structured_output: { result: "gate-ok" } } },
587 - });
588 - }
589 - // All other calls succeed
590 - return Promise.resolve({
591 - data: { info: { structured_output: { result: "ok" } } },
592 - });
593 - });
595 - const definition = createDefinition([
596 - {
597 - name: "step1",
598 - type: "step",
599 - agent: "test-agent",
600 - prompt: "do step1",
601 - output: z.object({ result: z.string() }),
602 - },
603 - {
604 - name: "gate1",
605 - type: "gate",
606 - agent: "test-agent",
607 - expect: z.object({ result: z.string() }),
608 - onFail: "step1",
609 - },
610 - ]);
612 - const instance = store.createPipeline("test-pipe", {});
613 - const executor = createExecutor(definition);
614 - const result = await executor.execute(instance.id, {});
616 - // Gate fails, loops back to step1, then gate succeeds
617 - expect(result.status).toBe("completed");
618 - expect(result.context.gate1).toEqual({ result: "gate-ok" });
619 - });
621 - test("gate failure without onFail fails pipeline", async () => {
622 - mockClient.session.prompt = mock(() =>
623 - Promise.reject(new GateFailureError("gate1", "Validation failed"))
624 - );
626 - const definition = createDefinition([
627 - {
628 - name: "gate1",
629 - type: "gate",
630 - agent: "test-agent",
631 - expect: z.object({ result: z.string() }),
632 - },
633 - ]);
635 - const instance = store.createPipeline("test-pipe", {});
636 - const executor = createExecutor(definition);
637 - const result = await executor.execute(instance.id, {});
639 - expect(result.status).toBe("failed");
640 - expect(result.error).toContain("Validation failed");
641 - });
642 -});
644 -describe("Executor - Parallel execution", () => {
645 - test("executes all parallel steps", async () => {
646 - let sessionCreateCount = 0;
647 - const sessionStepMap = new Map<string, number>();
648 - const outputs = ["result-a", "result-b"];
650 - // Mock session.create to return unique IDs and track which step
651 - const originalCreate = mockClient.session.create;
652 - mockClient.session.create = mock(() => {
653 - sessionCreateCount++;
654 - const sessionId = `session-${sessionCreateCount}`;
655 - sessionStepMap.set(sessionId, sessionCreateCount - 1); // step index
656 - return Promise.resolve({ id: sessionId });
657 - });
659 - // Reset prompt mock to use the session mapping
660 - mockClient.session.prompt = mock((opts: any) => {
661 - const stepIndex = sessionStepMap.get(opts?.path?.id) ?? 0;
662 - // Context injection: noReply is true
663 - if (opts?.body?.noReply) {
664 - return Promise.resolve({});
665 - }
666 - // Execution
667 - return Promise.resolve({
668 - data: { info: { structured_output: { value: outputs[stepIndex] } } },
669 - });
670 - });
672 - const definition = createDefinition([
673 - {
674 - name: "parallel_0",
675 - type: "parallel",
676 - steps: [
677 - {
678 - name: "step1",
679 - agent: "test-agent",
680 - prompt: "do thing A",
681 - output: z.object({ value: z.string() }),
682 - },
683 - {
684 - name: "step2",
685 - agent: "test-agent",
686 - prompt: "do thing B",
687 - output: z.object({ value: z.string() }),
688 - },
689 - ],
690 - },
691 - ]);
693 - const instance = store.createPipeline("test-pipe", {});
694 - const executor = createExecutor(definition);
695 - const result = await executor.execute(instance.id, {});
697 - expect(result.status).toBe("completed");
698 - expect(result.context.parallel_0.step1).toEqual({ value: "result-a" });
699 - expect(result.context.parallel_0.step2).toEqual({ value: "result-b" });
700 - });
702 - test("parallel fails if any step fails", async () => {
703 - let callCount = 0;
704 - mockClient.session.prompt = mock(() => {
705 - callCount++;
706 - // Context injection: odd calls - succeed with empty structured output
707 - // Execution: even calls - fail with AgentError
708 - if (callCount % 2 === 0) {
709 - return Promise.reject(new AgentError("step1", "One step failed"));
710 - }
711 - // Return a proper response structure for context injection
712 - return Promise.resolve({
713 - data: { info: { structured_output: {} } },
714 - });
715 - });
717 - const definition = createDefinition([
718 - {
719 - name: "parallel_0",
720 - type: "parallel",
721 - steps: [
722 - {
723 - name: "step1",
724 - agent: "test-agent",
725 - prompt: "do thing",
726 - output: z.object({ value: z.string() }),
727 - },
728 - {
729 - name: "step2",
730 - agent: "test-agent",
731 - prompt: "do thing",
732 - output: z.object({ value: z.string() }),
733 - },
734 - ],
735 - },
736 - ]);
738 - const instance = store.createPipeline("test-pipe", {});
739 - const executor = createExecutor(definition);
740 - const result = await executor.execute(instance.id, {});
742 - expect(result.status).toBe("failed");
743 - expect(result.error).toContain("One step failed");
744 - });
745 -});
747 -describe("Executor - When/Loop", () => {
748 - test("when condition met causes loop", async () => {
749 - let whenCallCount = 0;
751 - const definition = createDefinition([
752 - {
753 - name: "step1",
754 - type: "step",
755 - agent: "test-agent",
756 - prompt: "do thing",
757 - output: z.object({ result: z.string() }),
758 - },
759 - {
760 - name: "when_0",
761 - type: "when",
762 - condition: (ctx: any) => {
763 - whenCallCount++;
764 - return whenCallCount < 2; // Loop once, then pass through
765 - },
766 - loopTarget: "step1",
767 - },
768 - {
769 - name: "step2",
770 - type: "step",
771 - agent: "test-agent",
772 - prompt: "do next thing",
773 - output: z.object({ result: z.string() }),
774 - },
775 - ]);
777 - const instance = store.createPipeline("test-pipe", {});
778 - const executor = createExecutor(definition);
779 - const result = await executor.execute(instance.id, {});
781 - expect(result.status).toBe("completed");
782 - expect(whenCallCount).toBe(2); // Called twice - once to trigger loop, once to pass through
783 - });
785 - test("when condition not met passes through", async () => {
786 - const definition = createDefinition([
787 - {
788 - name: "step1",
789 - type: "step",
790 - agent: "test-agent",
791 - prompt: "do thing",
792 - output: z.object({ result: z.string() }),
793 - },
794 - {
795 - name: "when_0",
796 - type: "when",
797 - condition: () => false, // Never loop
798 - },
799 - {
800 - name: "step2",
801 - type: "step",
802 - agent: "test-agent",
803 - prompt: "do next thing",
804 - output: z.object({ result: z.string() }),
805 - },
806 - ]);
808 - const instance = store.createPipeline("test-pipe", {});
809 - const executor = createExecutor(definition);
810 - const result = await executor.execute(instance.id, {});
812 - expect(result.status).toBe("completed");
813 - expect(result.context.step2).toEqual({ result: "ok" });
814 - });
816 - test("max iterations guard", async () => {
817 - const definition = createDefinition([
818 - {
819 - name: "step1",
820 - type: "step",
821 - agent: "test-agent",
822 - prompt: "do thing",
823 - output: z.object({ result: z.string() }),
824 - },
825 - {
826 - name: "when_0",
827 - type: "when",
828 - condition: () => true, // Always loop back
829 - loopTarget: "step1",
830 - },
831 - ]);
833 - const instance = store.createPipeline("test-pipe", {});
834 - const executor = createExecutor(definition, { maxLoopIterations: 3 });
835 - const result = await executor.execute(instance.id, {});
837 - expect(result.status).toBe("failed");
838 - expect(result.error).toContain("Max loop iterations");
839 - });
840 -});
842 -describe("Executor - Abort", () => {
843 - test("aborted pipeline stops execution", async () => {
844 - let stepCount = 0;
845 - let pipelineId: string | undefined;
847 - mockClient.session.prompt = mock(() => {
848 - stepCount++;
849 - if (stepCount === 2) {
850 - // After first step completes, abort the pipeline
851 - const instance = store.getPipeline(pipelineId!);
852 - if (instance) {
853 - store.updatePipeline(instance.id, { status: "aborted" });
854 - }
855 - }
856 - return Promise.resolve({
857 - data: { info: { structured_output: { result: "ok" } } },
858 - });
859 - });
861 - const definition = createDefinition([
862 - {
863 - name: "step1",
864 - type: "step",
865 - agent: "test-agent",
866 - prompt: "do thing",
867 - output: z.object({ result: z.string() }),
868 - },
869 - {
870 - name: "step2",
871 - type: "step",
872 - agent: "test-agent",
873 - prompt: "should not run",
874 - output: z.object({ result: z.string() }),
875 - },
876 - ]);
878 - const instance = store.createPipeline("test-pipe", {});
879 - pipelineId = instance.id;
880 - const executor = createExecutor(definition);
881 - const result = await executor.execute(instance.id, {});
883 - expect(result.status).toBe("aborted");
884 - // Only first step should have run
885 - expect(result.context.step1).toEqual({ result: "ok" });
886 - expect(result.context.step2).toBeUndefined();
887 - });
888 -});
890 -describe("Executor - Pipeline completion", () => {
891 - test("completed pipeline returns accumulated context", async () => {
892 - const outputs = [
893 - { data: { info: { structured_output: { a: 1 } } } },
894 - { data: { info: { structured_output: { b: 2 } } } },
895 - ];
896 - let outputIndex = 0;
898 - mockClient.session.prompt = mock(() => {
899 - const callIndex = (mockClient.session.prompt as any).mock.calls.length;
900 - if (callIndex % 2 === 0) {
901 - // Execution call
902 - return Promise.resolve(outputs[outputIndex++]);
903 - }
904 - return Promise.resolve({});
905 - });
907 - const definition = createDefinition([
908 - {
909 - name: "step1",
910 - type: "step",
911 - agent: "test-agent",
912 - prompt: "do first thing",
913 - output: z.object({ a: z.number() }),
914 - },
915 - {
916 - name: "step2",
917 - type: "step",
918 - agent: "test-agent",
919 - prompt: "do second thing",
920 - output: z.object({ b: z.number() }),
921 - },
922 - ]);
924 - const instance = store.createPipeline("test-pipe", {});
925 - const executor = createExecutor(definition);
926 - const result = await executor.execute(instance.id, {});
928 - expect(result.status).toBe("completed");
929 - expect(result.context.step1).toEqual({ a: 1 });
930 - expect(result.context.step2).toEqual({ b: 2 });
931 - });
932 -});
934 -describe("Executor - Error classes", () => {
935 - test("exports correct error classes", async () => {
936 - // Verify all expected error classes exist
937 - expect(ChefError).toBeDefined();
938 - expect(AgentTimeoutError).toBeDefined();
939 - expect(AgentError).toBeDefined();
940 - expect(GateFailureError).toBeDefined();
941 - expect(MaxIterationsError).toBeDefined();
943 - // Verify they are Error subclasses
944 - const chefError = new ChefError("test", "test_type");
945 - expect(chefError).toBeInstanceOf(Error);
946 - expect(chefError.name).toBe("ChefError");
948 - const timeoutError = new AgentTimeoutError("step1", 1000);
949 - expect(timeoutError).toBeInstanceOf(ChefError);
950 - expect(timeoutError.name).toBe("AgentTimeoutError");
951 - expect(timeoutError.message).toContain("step1");
952 - expect(timeoutError.message).toContain("1000ms");
954 - const agentError = new AgentError("step1", "something went wrong");
955 - expect(agentError).toBeInstanceOf(ChefError);
956 - expect(agentError.name).toBe("AgentError");
957 - expect(agentError.message).toContain("step1");
958 - expect(agentError.message).toContain("something went wrong");
960 - const gateError = new GateFailureError("gate1", "validation failed");
961 - expect(gateError).toBeInstanceOf(ChefError);
962 - expect(gateError.name).toBe("GateFailureError");
963 - expect(gateError.message).toContain("gate1");
965 - const maxIterError = new MaxIterationsError(5);
966 - expect(maxIterError).toBeInstanceOf(ChefError);
967 - expect(maxIterError.name).toBe("MaxIterationsError");
968 - expect(maxIterError.message).toContain("5");
969 - });
970 -});

opencode/plugins/chef/test/sdk-smoke.test.ts

Deleted
deleted file mode 100644
1 -import { afterAll, beforeAll, describe, expect, test } from "bun:test";
2 -import { mkdtempSync, rmSync } from "node:fs";
3 -import { tmpdir } from "node:os";
4 -import { join } from "node:path";
6 -// Gate the test behind the environment variable
7 -// In bun:test, describe.skip is used directly, so we conditionally select describe or describe.skip
8 -const describeSmokeTest = process.env.CHEF_SDK_SMOKE_TEST === "1"
9 - ? describe
10 - : describe.skip;
12 -describeSmokeTest("Chef Plugin SDK Smoke Test", () => {
13 - let tempDir: string;
15 - beforeAll(() => {
16 - // Create a temporary directory for the test
17 - tempDir = mkdtempSync(join(tmpdir(), "chef-smoke-test-"));
18 - });
20 - afterAll(() => {
21 - // Clean up the temporary directory
22 - rmSync(tempDir, { recursive: true, force: true });
23 - });
25 - test("SDK imports resolve without throwing", async () => {
26 - // This tests that the plugin can import its dependencies
27 - const { ChefPlugin } = await import("../chef.ts");
28 - expect(ChefPlugin).toBeDefined();
29 - expect(typeof ChefPlugin).toBe("function");
30 - });
32 - test("ChefPlugin returns tools when called with mock input", async () => {
33 - const { ChefPlugin } = await import("../chef.ts");
35 - const mockClient = {
36 - session: {
37 - create: () => Promise.resolve({ id: "test-session" }),
38 - prompt: () =>
39 - Promise.resolve({ data: { info: { structured_output: {} } } }),
40 - delete: () => Promise.resolve(),
41 - },
42 - app: {
43 - log: () => Promise.resolve(),
44 - agents: () => Promise.resolve([]),
45 - },
46 - };
48 - const mockInput = {
49 - client: mockClient as any,
50 - project: {
51 - id: "test-project",
52 - worktree: tempDir,
53 - time: { created: Date.now() },
54 - },
55 - directory: tempDir,
56 - worktree: tempDir,
57 - serverUrl: new URL("http://localhost:0"),
58 - $: {} as any,
59 - };
61 - const result = await ChefPlugin(mockInput);
63 - expect(result).toBeDefined();
64 - expect(result.tool).toBeDefined();
65 - });
67 - test("all 5 expected tools are present", async () => {
68 - const { ChefPlugin } = await import("../chef.ts");
70 - const mockClient = {
71 - session: {
72 - create: () => Promise.resolve({ id: "test-session" }),
73 - prompt: () =>
74 - Promise.resolve({ data: { info: { structured_output: {} } } }),
75 - delete: () => Promise.resolve(),
76 - },
77 - app: {
78 - log: () => Promise.resolve(),
79 - agents: () => Promise.resolve([]),
80 - },
81 - };
83 - const mockInput = {
84 - client: mockClient as any,
85 - project: {
86 - id: "test-project",
87 - worktree: tempDir,
88 - time: { created: Date.now() },
89 - },
90 - directory: tempDir,
91 - worktree: tempDir,
92 - serverUrl: new URL("http://localhost:0"),
93 - $: {} as any,
94 - };
96 - const result = await ChefPlugin(mockInput);
98 - const expectedTools = [
99 - "pipeline.start",
100 - "pipeline.status",
101 - "pipeline.continue",
102 - "pipeline.abort",
103 - "pipeline.list",
104 - ];
106 - // Type assertion since we verified result.tool is defined above
107 - const tools = result.tool!;
108 - const actualTools = Object.keys(tools);
110 - for (const toolName of expectedTools) {
111 - expect(actualTools).toContain(toolName);
112 - expect(tools[toolName]).toBeDefined();
113 - expect(typeof tools[toolName]).toBe("object");
114 - expect(tools[toolName].execute).toBeDefined();
115 - expect(typeof tools[toolName].execute).toBe("function");
116 - }
118 - expect(actualTools).toHaveLength(expectedTools.length);
119 - });
120 -});

opencode/plugins/chef/test/store.test.ts

Deleted
deleted file mode 100644
1 -import { afterEach, beforeEach, describe, expect, test } from "bun:test";
2 -import { existsSync, rmSync } from "node:fs";
3 -import { join } from "node:path";
4 -import { tmpdir } from "node:os";
5 -import { mkdtempSync } from "node:fs";
6 -import { Store } from "../store";
8 -let store: Store;
9 -let tempDir: string;
11 -beforeEach(() => {
12 - tempDir = mkdtempSync(join(tmpdir(), "chef-test-"));
13 - store = new Store(tempDir);
14 -});
16 -afterEach(() => {
17 - store.close();
18 - rmSync(tempDir, { recursive: true, force: true });
19 -});
21 -describe("Store - Pipeline operations", () => {
22 - test("creates a pipeline instance", () => {
23 - const pipeline = store.createPipeline("test-pipeline", { key: "value" });
25 - expect(pipeline).toMatchObject({
26 - id: expect.any(String),
27 - definition: "test-pipeline",
28 - status: "running",
29 - input: JSON.stringify({ key: "value" }),
30 - context: "{}",
31 - current_phase: 0,
32 - created_at: expect.any(Number),
33 - updated_at: expect.any(Number),
34 - });
35 - });
37 - test("gets pipeline by id", () => {
38 - const created = store.createPipeline("test-pipeline", { key: "value" });
39 - const retrieved = store.getPipeline(created.id);
41 - expect(retrieved).toMatchObject({
42 - id: created.id,
43 - definition: "test-pipeline",
44 - status: "running",
45 - input: JSON.stringify({ key: "value" }),
46 - context: "{}",
47 - current_phase: 0,
48 - });
49 - });
51 - test("returns null for nonexistent pipeline", () => {
52 - const result = store.getPipeline("nonexistent");
53 - expect(result).toBeNull();
54 - });
56 - test("updates pipeline status", () => {
57 - const pipeline = store.createPipeline("test-pipeline", {});
58 - store.updatePipeline(pipeline.id, { status: "completed" });
59 - const updated = store.getPipeline(pipeline.id);
61 - expect(updated?.status).toBe("completed");
62 - });
64 - test("updates pipeline context", () => {
65 - const pipeline = store.createPipeline("test-pipeline", {});
66 - store.updatePipeline(pipeline.id, {
67 - context: JSON.stringify({ foo: "bar" }),
68 - });
69 - const updated = store.getPipeline(pipeline.id);
71 - expect(updated?.context).toBe(JSON.stringify({ foo: "bar" }));
72 - });
74 - test("updates pipeline current_phase", () => {
75 - const pipeline = store.createPipeline("test-pipeline", {});
76 - store.updatePipeline(pipeline.id, { current_phase: 3 });
77 - const updated = store.getPipeline(pipeline.id);
79 - expect(updated?.current_phase).toBe(3);
80 - });
82 - test("updates multiple fields at once", () => {
83 - const pipeline = store.createPipeline("test-pipeline", {});
84 - store.updatePipeline(pipeline.id, { status: "failed", current_phase: 2 });
85 - const updated = store.getPipeline(pipeline.id);
87 - expect(updated?.status).toBe("failed");
88 - expect(updated?.current_phase).toBe(2);
89 - });
91 - test("lists all pipelines", () => {
92 - store.createPipeline("pipeline-1", {});
93 - store.createPipeline("pipeline-2", {});
94 - const pipelines = store.listPipelines();
96 - expect(pipelines).toHaveLength(2);
97 - });
99 - test("lists pipelines filtered by status", () => {
100 - const p1 = store.createPipeline("pipeline-1", {});
101 - store.createPipeline("pipeline-2", {});
102 - store.createPipeline("pipeline-3", {});
103 - store.updatePipeline(p1.id, { status: "completed" });
105 - const running = store.listPipelines("running");
106 - expect(running).toHaveLength(2);
107 - });
109 - test("lists pipelines filtered by completed status", () => {
110 - const p1 = store.createPipeline("pipeline-1", {});
111 - store.createPipeline("pipeline-2", {});
112 - store.updatePipeline(p1.id, { status: "completed" });
114 - const completed = store.listPipelines("completed");
115 - expect(completed).toHaveLength(1);
116 - });
117 -});
119 -describe("Store - Phase operations", () => {
120 - test("creates a phase", () => {
121 - const pipeline = store.createPipeline("test-pipeline", {});
122 - const phase = store.createPhase(pipeline.id, "step-1");
124 - expect(phase).toMatchObject({
125 - id: expect.any(String),
126 - pipeline_id: pipeline.id,
127 - name: "step-1",
128 - status: "pending",
129 - output: "{}",
130 - error: null,
131 - attempts: 0,
132 - started_at: null,
133 - completed_at: null,
134 - });
135 - });
137 - test("gets phase by id", () => {
138 - const pipeline = store.createPipeline("test-pipeline", {});
139 - const created = store.createPhase(pipeline.id, "step-1");
140 - const retrieved = store.getPhase(created.id);
142 - expect(retrieved).toMatchObject({
143 - id: created.id,
144 - pipeline_id: pipeline.id,
145 - name: "step-1",
146 - status: "pending",
147 - });
148 - });
150 - test("returns null for nonexistent phase", () => {
151 - const result = store.getPhase("nonexistent");
152 - expect(result).toBeNull();
153 - });
155 - test("updates phase status", () => {
156 - const pipeline = store.createPipeline("test-pipeline", {});
157 - const phase = store.createPhase(pipeline.id, "step-1");
158 - store.updatePhase(phase.id, {
159 - status: "completed",
160 - output: JSON.stringify({ result: true }),
161 - });
162 - const updated = store.getPhase(phase.id);
164 - expect(updated?.status).toBe("completed");
165 - expect(updated?.output).toBe(JSON.stringify({ result: true }));
166 - });
168 - test("updates phase error", () => {
169 - const pipeline = store.createPipeline("test-pipeline", {});
170 - const phase = store.createPhase(pipeline.id, "step-1");
171 - store.updatePhase(phase.id, { error: "something went wrong" });
172 - const updated = store.getPhase(phase.id);
174 - expect(updated?.error).toBe("something went wrong");
175 - });
177 - test("updates phase attempts", () => {
178 - const pipeline = store.createPipeline("test-pipeline", {});
179 - const phase = store.createPhase(pipeline.id, "step-1");
180 - store.updatePhase(phase.id, { attempts: 3 });
181 - const updated = store.getPhase(phase.id);
183 - expect(updated?.attempts).toBe(3);
184 - });
186 - test("gets phases by pipeline", () => {
187 - const pipeline = store.createPipeline("test-pipeline", {});
188 - store.createPhase(pipeline.id, "step-1");
189 - store.createPhase(pipeline.id, "step-2");
190 - const phases = store.getPhasesByPipeline(pipeline.id);
192 - expect(phases).toHaveLength(2);
193 - });
194 -});
196 -describe("Store - Column whitelist", () => {
197 - test("whitelist allows valid columns", () => {
198 - const pipeline = store.createPipeline("test-pipeline", {});
199 - store.updatePipeline(pipeline.id, { status: "completed" });
200 - const updated = store.getPipeline(pipeline.id);
202 - expect(updated?.status).toBe("completed");
203 - });
205 - test("whitelist blocks unknown columns", () => {
206 - const pipeline = store.createPipeline("test-pipeline", {});
207 - // This should not crash and should not set the evil column
208 - store.updatePipeline(pipeline.id, { evil_column: "hack" } as any);
209 - const updated = store.getPipeline(pipeline.id);
211 - // The pipeline should still exist and have original values
212 - expect(updated).not.toBeNull();
213 - expect(updated?.definition).toBe("test-pipeline");
214 - expect((updated as any).evil_column).toBeUndefined();
215 - });
216 -});
218 -describe("Store - Schema migration", () => {
219 - test("store works correctly after schema initialization", () => {
220 - // Schema initialization is implicitly tested by all other tests
221 - // This test verifies basic CRUD still works
222 - const pipeline = store.createPipeline("migrated-pipeline", { test: true });
223 - expect(pipeline.id).toBeDefined();
225 - const phase = store.createPhase(pipeline.id, "phase-1");
226 - expect(phase.id).toBeDefined();
228 - store.updatePipeline(pipeline.id, { status: "completed" });
229 - store.updatePhase(phase.id, { status: "completed" });
231 - const updatedPipeline = store.getPipeline(pipeline.id);
232 - const updatedPhase = store.getPhase(phase.id);
234 - expect(updatedPipeline?.status).toBe("completed");
235 - expect(updatedPhase?.status).toBe("completed");
236 - });
237 -});
239 -describe("Store - close", () => {
240 - test("close does not throw", () => {
241 - const testStore = new Store(tempDir);
242 - expect(() => testStore.close()).not.toThrow();
243 - });
244 -});
246 -describe("Store - auto-creates parent directories", () => {
247 - test("creates .opencode/chef if it does not exist", () => {
248 - const deepDir = join(tempDir, "a", "b", "c");
249 - const deepStore = new Store(deepDir);
250 - try {
251 - const pipeline = deepStore.createPipeline("auto-dir-test", {});
252 - expect(pipeline.id).toBeDefined();
253 - expect(pipeline.status).toBe("running");
254 - expect(existsSync(join(deepDir, ".opencode", "chef"))).toBe(true);
255 - } finally {
256 - deepStore.close();
257 - }
258 - });
259 -});
261 -describe("Store - Table name validation", () => {
262 - test("updatePipeline and updatePhase use valid tables", () => {
263 - const pipeline = store.createPipeline("test-pipeline", {});
264 - expect(() => store.updatePipeline(pipeline.id, { status: "completed" }))
265 - .not.toThrow();
267 - const phase = store.createPhase(pipeline.id, "test-phase");
268 - expect(() => store.updatePhase(phase.id, { status: "completed" }))
269 - .not.toThrow();
270 - });
272 - test("updateRecord throws on unknown table name", () => {
273 - expect(() =>
274 - (store as any).updateRecord("evil_table", "some-id", { status: "hacked" })
275 - )
276 - .toThrow(/unknown table/);
277 - });
278 -});

pueue/pueued.service

Modified
3 3 [Unit]
4 4 Description=Pueue Daemon - CLI process scheduler and manager
6 6 [Service]
7 7 Restart=no
8 -ExecStart=%h/.cargo/bin/pueued -vvv
8 +ExecStart=/usr/bin/pueued -vvv
10 10 [Install]
11 11 WantedBy=default.target

syncthing/syncthing.service

Added
new file mode 100644
1 +[Unit]
2 +Description=Syncthing - Open Source Continuous File Synchronization
3 +Documentation=man:syncthing(1)
4 +StartLimitIntervalSec=60
5 +StartLimitBurst=4
7 +[Service]
8 +ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
9 +Restart=on-failure
10 +RestartSec=1
11 +SuccessExitStatus=3 4
12 +RestartForceExitStatus=3 4
14 +# Hardening
15 +SystemCallArchitectures=native
16 +MemoryDenyWriteExecute=true
17 +NoNewPrivileges=true
19 +[Install]
20 +WantedBy=default.target

systemd/user/work.slice

Added
new file mode 100644
1 +[Slice]
2 +MemoryHigh=24G
3 +MemoryMax=28G
4 +CPUWeight=50
5 +IOWeight=50

tools/fedora_pkgs.txt

Added
new file mode 100644
1 +=== Mise ===
2 +act 0.2.84
3 +aqua:Macchina-CLI/macchina 6.4.0 ~/Workspace/dotfiles/mise/config.toml latest
4 +aqua:codeberg.org/mergiraf/mergiraf latest ~/Workspace/dotfiles/mise/config.toml latest
5 +aqua:coder3101/protols 0.13.3 ~/Workspace/dotfiles/mise/config.toml latest
6 +aqua:dduan/tre 0.4.0 ~/Workspace/dotfiles/mise/config.toml latest
7 +aqua:doy/rbw 1.15.0 ~/Workspace/dotfiles/mise/config.toml latest
8 +aqua:mfontanini/presenterm 0.16.1 ~/Workspace/dotfiles/mise/config.toml latest
9 +aqua:opentofu/tofu-ls 0.4.0 ~/Workspace/dotfiles/mise/config.toml latest
10 +aqua:ouch-org/ouch 0.6.1 ~/Workspace/dotfiles/mise/config.toml latest
11 +aqua:printfn/fend 1.5.8 ~/Workspace/dotfiles/mise/config.toml latest
12 +aqua:rgwood/systemctl-tui 0.5.1 ~/Workspace/dotfiles/mise/config.toml latest
13 +aqua:sharkdp/diskus 0.9.0 ~/Workspace/dotfiles/mise/config.toml latest
14 +aqua:sharkdp/pastel 0.12.0 ~/Workspace/dotfiles/mise/config.toml latest
15 +aqua:skim-rs/skim 4.0.0 ~/Workspace/dotfiles/mise/config.toml latest
16 +aqua:sqls-server/sqls 0.2.45 ~/Workspace/dotfiles/mise/config.toml latest
17 +aqua:topgrade-rs/topgrade 17.1.0 ~/Workspace/dotfiles/mise/config.toml latest
18 +ast-grep 0.42.0 ~/Workspace/dotfiles/mise/config.toml latest
19 +bottom 0.12.3 ~/Workspace/dotfiles/mise/config.toml latest
20 +cargo:clock-tui 0.6.1 ~/Workspace/dotfiles/mise/config.toml latest
21 +cargo:codesort 1.0.1 ~/Workspace/dotfiles/mise/config.toml latest
22 +cargo:dssim 3.4.0 ~/Workspace/dotfiles/mise/config.toml latest
23 +cargo:imgdiff 0.1.1 ~/Workspace/dotfiles/mise/config.toml latest
24 +cargo:meli 0.8.13 ~/Workspace/dotfiles/mise/config.toml latest
25 +cargo:tfmcp 0.1.9 ~/Workspace/dotfiles/mise/config.toml latest
26 +d2 0.7.1 ~/Workspace/dotfiles/mise/config.toml latest
27 +delta 0.19.1 ~/Workspace/dotfiles/mise/config.toml latest
28 +deno 2.7.7 ~/Workspace/dotfiles/mise/config.toml latest
29 +gemini 0.34.0 ~/Workspace/dotfiles/mise/config.toml latest
30 +gh 2.88.1 ~/Workspace/dotfiles/mise/config.toml latest
31 +github:Feel-ix-343/markdown-oxide 0.25.10 ~/Workspace/dotfiles/mise/config.toml latest
32 +github:Inlyne-Project/inlyne 0.5.0 ~/Workspace/dotfiles/mise/config.toml latest
33 +github:JFryy/systemd-lsp 2026.01.17 ~/Workspace/dotfiles/mise/config.toml latest
34 +github:caarlos0/timer 1.4.6 ~/Workspace/dotfiles/mise/config.toml latest
35 +github:cousine/neovim-mcp 0.1.1 ~/Workspace/dotfiles/mise/config.toml latest
36 +github:dev-cycles/contextive 1.17.8 ~/Workspace/dotfiles/mise/config.toml latest
37 +github:facebook/zstd 1.5.7 ~/Workspace/dotfiles/mise/config.toml latest
38 +github:h0rv/d2-mcp 1.1.0 ~/Workspace/dotfiles/mise/config.toml latest
39 +github:ifd3f/caligula 0.4.10 ~/Workspace/dotfiles/mise/config.toml latest
40 +github:max-niederman/ttyper 1.6.0 ~/Workspace/dotfiles/mise/config.toml latest
41 +github:okooo5km/time-mcp-server 0.2.0 ~/Workspace/dotfiles/mise/config.toml latest
42 +github:terror/just-lsp 0.4.0 ~/Workspace/dotfiles/mise/config.toml latest
43 +github:todotxt/todo.txt-cli 2.13.0 ~/Workspace/dotfiles/mise/config.toml latest
44 +github:toolprint/just-mcp 0.2.0 ~/Workspace/dotfiles/mise/config.toml latest
45 +github:ttytm/wthrr-the-weathercrab 1.2.1 ~/Workspace/dotfiles/mise/config.toml latest
46 +gitleaks 8.30.1 ~/Workspace/dotfiles/mise/config.toml latest
47 +gitu 0.41.0 ~/Workspace/dotfiles/mise/config.toml latest
48 +glow 2.1.1 ~/Workspace/dotfiles/mise/config.toml latest
49 +go:mvdan.cc/sh/v3/cmd/shfmt 3.13.0
50 +hexyl 0.17.0 ~/Workspace/dotfiles/mise/config.toml latest
51 +java 26.0.0 ~/Workspace/dotfiles/mise/config.toml latest
52 +jbang 0.137.0 ~/Workspace/dotfiles/mise/config.toml latest
53 +jj 0.39.0 ~/Workspace/dotfiles/mise/config.toml latest
54 +just 1.47.1 ~/Workspace/dotfiles/mise/config.toml latest
55 +lefthook 2.1.4 ~/Workspace/dotfiles/mise/config.toml latest
56 +lua-language-server 3.17.1 ~/Workspace/dotfiles/mise/config.toml latest
57 +lychee 0.23.0 ~/Workspace/dotfiles/mise/config.toml latest
58 +marksman 2026-02-08 ~/Workspace/dotfiles/mise/config.toml latest
59 +mdbook 0.5.2 ~/Workspace/dotfiles/mise/config.toml latest
60 +npm:@mariozechner/pi-coding-agent 0.62.0 ~/Workspace/dotfiles/mise/config.toml latest
61 +npm:screenpipe-mcp 0.10.0 ~/Workspace/dotfiles/mise/config.toml latest
62 +npm:stylelint 17.5.0 ~/Workspace/dotfiles/mise/config.toml latest
63 +npm:stylelint-config-standard 40.0.0 ~/Workspace/dotfiles/mise/config.toml latest
64 +python 3.11.14
65 +ripgrep 15.1.0 ~/Workspace/dotfiles/mise/config.toml latest
66 +rust-analyzer 2026-03-23 ~/Workspace/dotfiles/mise/config.toml latest
67 +shellcheck 0.11.0
68 +superhtml 0.6.2 ~/Workspace/dotfiles/mise/config.toml latest
69 +taplo 0.10.0 ~/Workspace/dotfiles/mise/config.toml latest
70 +tokei 14.0.0 ~/Workspace/dotfiles/mise/config.toml latest
71 +tree-sitter 0.26.7 ~/Workspace/dotfiles/mise/config.toml latest
72 +typos 1.44.0 ~/Workspace/dotfiles/mise/config.toml latest
73 +typst 0.14.2 ~/Workspace/dotfiles/mise/config.toml latest
74 +vivid 0.10.1 ~/Workspace/dotfiles/mise/config.toml latest
75 +yamllint 1.38.0
76 +yt-dlp 2026.03.17 ~/Workspace/dotfiles/mise/config.toml latest
77 +zig 0.15.2 ~/Workspace/dotfiles/mise/config.toml latest
78 +zls 0.15.1 ~/Workspace/dotfiles/mise/config.toml latest
80 +=== Cargo ===
81 +cargo-about
82 +cargo-add
83 +cargo-audit
84 +cargo-cache
85 +cargo-edit
86 +cargo-insta
87 +cargo-install-update
88 +cargo-install-update-config
89 +cargo-rm
90 +cargo-set-version
91 +cargo-tarpaulin
92 +cargo-update
93 +cargo-upgrade
94 +cargo-upgrades
95 +cargo-watch
96 +cyber-timer
97 +dictator
98 +kitdiff
99 +wasm-tools
101 +=== DNF ===
102 +alien
103 +aquamarine-devel
104 +asciidoctor
105 +bat
106 +bees
107 +binutils-gold
108 +btdu
109 +btrfs
110 +btrfs-assistant
111 +buttermanager
112 +caddy
113 +capstone-devel
114 +cava
115 +clang-tools-extra
116 +clipse
117 +cloud-init
118 +cmake
119 +cosmic-*
120 +cosmic-config-fedora
121 +cosmic-ext-applet-classi
122 +cosmic-session
123 +cosmic-store
124 +dmg2img
125 +dnf
126 +expect
127 +fedora-release-cosmic
128 +ffmpeg-devel
129 +fontawesome
130 +fuse3-devel
131 +gcc-c++
132 +ghostty
133 +git
134 +git-filter-repo
135 +git-lfs
136 +glslc
137 +gnome-keyring
138 +goverlay
139 +gtk2-devel
140 +gtk3-devel
141 +gtk4-layer-shell
142 +gtk-layer-shell
143 +gum
144 +hfsplus-tools
145 +hfsutils
146 +hyperfine
147 +hyprcursor-devel
148 +hypr*-devel
149 +hyprgraphics-devel
150 +hyprl
151 +hyprland
152 +hyprlang-devel
153 +hyprpaper
154 +hyprpicker
155 +hyprpolkitage
156 +hyprshot
157 +hyprsunset
158 +hyprutils-devel
159 +install
160 +iperf3
161 +java-latest-openjdk-jmod
162 +kdbg
163 +keepassxc
164 +libasan
165 +libcxx-devel
166 +libmicrohttpd-devel
167 +libr
168 +libssh2-devel
169 +libva-utils
170 +libXt-deve
171 +libXtst-devel
172 +llama-cpp
173 +llvm-libunwind-devel
174 +luajit-devel
175 +luarocks
176 +lzip
177 +mangohud
178 +maven
179 +mise
180 +mkcert
181 +monaspace-nerd-fonts
182 +nas-libs
183 +neohtop
184 +neovide
185 +neovim
186 +nerdfontssymbolsonly-ner
187 +ninja-
188 +niri
189 +nushell
190 +obs
191 +opencv-devel
192 +opentofu
193 +perf
194 +php
195 +php-cli
196 +php-json
197 +php-xml
198 +plymouth-theme-script
199 +podman
200 +podman-compose
201 +pre-commit
202 +protonplus
203 +python3-pip
204 +python3-tkinter
205 +qimgv
206 +quickemu
207 +rocm-hip
208 +rocminfo
209 +rocm-opencl
210 +rpi-imager
211 +rpmdistro-repoquery
212 +rpmreaper
213 +sccache
214 +smartctl
215 +speedtest-cli
216 +stow
217 +s-tui
218 +syncthing
219 +sysbench
221 +teamviewer
222 +telnet
223 +tesseract
224 +tesseract-deve
225 +tesseract-langpack-pol
226 +timg
227 +todocli
228 +trash-cli
229 +typescript
230 +udisks2-btrfs
232 +valgrind
233 +vlc-gui-ncurses
234 +vulkan-tools
235 +vulkan-utility-libraries
236 +waydroid
237 +webkit2gtk4.1-devel
238 +wezterm
239 +wireguard-tools
240 +wkhtmltopdf
241 +wlogout
242 +wtype
243 +xar
244 +xdg-desktop-portal-cosmi
245 +xdg-desktop-portal-hyprl
246 +xinput
247 +ydotool
248 +zed
249 +zoxide
250 +zram-generator-defaul

tools/list_installs.sh

Added
new file mode 100755
1 +#!/usr/bin/env bash
2 +# List all programs installed via Mise, Cargo, and DNF
4 +echo "=== Mise ==="
5 +mise list
7 +echo ""
8 +echo "=== Cargo ==="
9 +cargo install --list | grep -v '^$' | awk '{print $1}' | sort -u
11 +echo ""
12 +echo "=== DNF ==="
13 +sudo dnf history list 2>/dev/null | rg "dnf install" | sed 's/^[0-9]* *dnf install *//' | sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}.*//' | sed 's/ -y / /g' | tr ' ' '\n' | grep -v '^$' | grep -v '^-' | grep -v '^/' | sed 's/-[0-9].*//' | sed 's/\.[a-z].*//' | grep -E '^[a-z]' | sort -u

topgrade/lnx.toml

Modified
1 1 [git]
2 -repos = ["/home/oli/Source/*"]
2 +repos = ["/home/me/Source/*"]
3 3 arguments = "--ff --rebase"
4 4 max_concurrency = 12
5 5 pull_predefined = false

wezterm/bugabinga/ai_shell.lua

Modified
3 3 local wezterm = require 'wezterm'
4 4 local system_prompt = require 'bugabinga.ai_system_prompt'
6 6 local M = {}
8 -local OLLAMA_URL = 'http://localhost:11434/api/generate'
9 -local MODEL = 'minimax-m2.5:cloud'
8 +local API_URL = 'https://api.z.ai/api/coding/paas/v4/chat/completions'
9 +local MODEL = 'glm-5-turbo'
10 10 local MAX_SCROLLBACK_LINES = 300
12 12 local ai_state = {}
26 26 local scrollback = pane:get_lines_as_text(MAX_SCROLLBACK_LINES)
28 - local full_prompt = system_prompt.prompt .. '\n\n---\n\nRECENT SCROLLBACK:\n' .. scrollback .. '\n\n---\n\nUSER QUESTION: ' .. question .. '\n\nRESPONSE:'
28 + local api_key = os.getenv 'ZAI_WEZTERM_API_KEY' or ''
29 + wezterm.log_info('ai_shell: ZAI_WEZTERM_API_KEY present: ' .. (api_key ~= '' and 'yes' or 'NO - check WezTerm env vars'))
31 + local user_content = 'RECENT SCROLLBACK:\n' .. scrollback .. '\n\n---\n\nUSER QUESTION: ' .. question
30 33 local json_payload = wezterm.json_encode({
31 34 model = MODEL,
32 - prompt = full_prompt,
35 + messages = {
36 + { role = 'system', content = system_prompt.prompt },
37 + { role = 'user', content = user_content },
38 + },
39 + thinking = { type = 'disabled' },
33 40 stream = false,
41 + max_tokens = 4096,
42 + temperature = 0.6,
45 + wezterm.log_info('ai_shell: requesting z.ai API')
36 47 local success, stdout, stderr = wezterm.run_child_process({
37 - 'curl', '-s', '-X', 'POST', OLLAMA_URL,
48 + 'curl', '-s', '-X', 'POST', API_URL,
38 49 '-H', 'Content-Type: application/json',
50 + '-H', 'Authorization: Bearer ' .. api_key,
39 51 '-d', json_payload,
42 54 if not success or stdout == '' then
55 + wezterm.log_error('ai_shell: curl failed or empty response: ' .. stderr)
43 56 state.status = 'offline'
44 57 wezterm.time.call_after(2, function()
45 58 state.status = 'idle'
51 64 return wezterm.json_parse(stdout)
54 - if not ok or not response or not response.response then
67 + if not ok or not response or not response.choices or not response.choices[1] or not response.choices[1].message then
68 + wezterm.log_error('ai_shell: API error: ' .. tostring(stdout))
69 + state.status = 'error'
55 70 state.status = 'error'
56 71 wezterm.time.call_after(2, function()
57 72 state.status = 'idle'
59 74 return
62 - local command = M.strip_markdown(response.response)
77 + local command = M.strip_markdown(response.choices[1].message.content)
63 78 command = command:match('^%s*(.-)%s*$')
79 + wezterm.log_info('ai_shell: executing: ' .. command)
65 81 pane:send_text(command)

wezterm/bugabinga/dotfiles_workspace.lua

Modified
13 13 local gui_window = window:gui_window();
14 - gui_window:maximize()
14 + if not os.getenv('WAYLAND_DISPLAY') and not os.getenv('NIRI_SOCKET') then
15 + gui_window:maximize()
16 + end
15 17 end )

wezterm/bugabinga/hosts/desktop.lua

Added
new file mode 100644
1 +return function ( cfg )
2 + cfg.enable_wayland = true
3 + cfg.max_fps = 144
4 + cfg.font_size = 16
5 +end

wezterm/bugabinga/nugu/init.lua

Modified
23 23 -- The color of the split lines between panes
24 24 split = palette.ui.unfocus,
25 25 ansi = {
26 - palette.content.normal, -- Index 0: BLACK (Should be dark)
27 - palette.error, -- Index 1: RED
28 - palette.content.focus, -- Index 2: GREEN
29 - palette.content.focus, -- Index 3: YELLOW/OLIVE
30 - palette.content.important_local, -- Index 4: BLUE
31 - palette.content.focus, -- Index 5: PURPLE
32 - palette.content.accent, -- Index 6: CYAN
33 - palette.content.unfocus, -- Index 7: WHITE (Should be light-ish)
26 + -- Standard 8: content.* + global colors (for syntax, markdown, text)
27 + palette.content.backdrop, -- Index 0: BLACK (darkest = background)
28 + palette.error, -- Index 1: RED (urgent, non-negotiable)
29 + palette.content.focus, -- Index 2: GREEN (active attention)
30 + palette.warning, -- Index 3: YELLOW (distracting but ignorable)
31 + palette.content.important_local, -- Index 4: BLUE (prominent content)
32 + palette.content.accent, -- Index 5: MAGENTA (brand identity)
33 + palette.content.unfocus, -- Index 6: CYAN (deepest visible, dim)
34 + palette.content.normal, -- Index 7: WHITE (brightest = foreground)
35 36 brights = {
36 - palette.content.minor, -- Index 8: BRIGHT BLACK (Grey)
37 - palette.error, -- Index 9: BRIGHT RED
38 - palette.content.focus, -- Index 10: BRIGHT GREEN
39 - palette.content.unfocus, -- Index 11: BRIGHT YELLOW
40 - palette.content.important_global,-- Index 12: BRIGHT BLUE
41 - palette.content.focus, -- Index 13: BRIGHT PURPLE
42 - palette.content.accent, -- Index 14: BRIGHT CYAN
43 - palette.content.backdrop, -- Index 15: BRIGHT WHITE (Should be very light)
37 + -- Bright 8: ui.* + content.important_global (for chrome, panels, indicators)
38 + palette.content.minor, -- Index 8: BRIGHT BLACK (receded content)
39 + palette.error, -- Index 9: BRIGHT RED (dup: error)
40 + palette.ui.unfocus, -- Index 10: BRIGHT GREEN (UI dim borders)
41 + palette.ui.backdrop, -- Index 11: BRIGHT YELLOW (UI panel backgrounds)
42 + palette.content.important_global, -- Index 12: BRIGHT BLUE (most visible content)
43 + palette.ui.accent, -- Index 13: BRIGHT MAGENTA (UI brand accent)
44 + palette.ui.important_local, -- Index 14: BRIGHT CYAN (UI highlights/selections)
45 + palette.ui.important_global, -- Index 15: BRIGHT WHITE (prominent UI)
45 47 -- Arbitrary colors of the palette in the range from 16 to 255
46 48 indexed = {},

wezterm/bugabinga/nugu/palette_dark.lua

Modified
1 1 return
2 -{palette = {debug = "#ff00ff", error = "#d973a1", warning = "#f5dfdb", info = "#e6e5f8", content = {normal = "#ededed", backdrop = "#121212", accent = "#d151d1", minor = "#8b8b8b", focus = "#7ba1aa", unfocus = "#406f79", important_local = "#b59ae4", important_global = "#dfd3f3"}, ui = {normal = "#dbdbdb", backdrop = "#242424", accent = "#d86dd8", minor = "#9d9d9d", focus = "#9aabae", unfocus = "#6e6e6e", important_local = "#c9b6eb", important_global = "#f4f3f6"}}}
2 +{palette = {debug = "#ed5eed", error = "#e46479", warning = "#9e9a69", info = "#3ec5dd", content = {normal = "#ededed", backdrop = "#121212", accent = "#d151d1", minor = "#8b8b8b", focus = "#7ba1aa", unfocus = "#5d5d5d", important_local = "#b59ae4", important_global = "#dfd3f3"}, ui = {normal = "#dbdbdb", backdrop = "#242424", accent = "#d86dd8", minor = "#9d9d9d", focus = "#9aabae", unfocus = "#6f6f6f", important_local = "#c9b6eb", important_global = "#f3effb"}}}

wezterm/bugabinga/nugu/palette_light.lua

Modified
1 1 return
2 -{
3 - palette = {
4 - debug = "#ff00ff",
5 - error = "#ca3c7c",
6 - warning = "#e7aea3",
7 - info = "#b2aee9",
8 - content = {
9 - normal = "#121212",
10 - backdrop = "#ededed",
11 - accent = "#ae2eae",
12 - minor = "#3b3b3b",
13 - focus = "#184e5b",
14 - unfocus = "#6f6f6f",
15 - important_local = "#715696",
16 - important_global = "#4f3c69"
17 - },
18 - ui = {
19 - normal = "#242424",
20 - backdrop = "#dbdbdb",
21 - accent = "#922792",
22 - minor = "#292929",
23 - focus = "#15333b",
24 - unfocus = "#5d5d5d",
25 - important_local = "#604980",
26 - important_global = "#414141"
27 - }
28 - }
29 -}
2 +{palette = {debug = "#a112a1", error = "#c0223c", warning = "#242317", info = "#13616e", content = {normal = "#121212", backdrop = "#ededed", accent = "#ae2eae", minor = "#3b3b3b", focus = "#184e5b", unfocus = "#6f6f6f", important_local = "#715696", important_global = "#4f3c69"}, ui = {normal = "#242424", backdrop = "#dbdbdb", accent = "#922792", minor = "#292929", focus = "#15333b", unfocus = "#5d5d5d", important_local = "#604980", important_global = "#3e2f53"}}}

wezterm/bugabinga/status.lua

Modified
2 2 local wez = require 'wezterm'
3 3 local bat = require 'bugabinga.battery'
5 5 local DELIMITER = ' · '
6 +local ai_shell = require 'bugabinga.ai_shell'
7 8 local zoomed = function ( pane )
8 9 local tab = pane:tab()
20 21 wez.on( 'update-status', function ( window, pane )
21 22 local key_table = window:active_key_table()
22 23 local current_workspace = window:active_workspace()
23 - local zoomed_state = zoomed( pane )
24 + local zoomed_state_ok, zoomed_state = pcall(zoomed, pane)
25 + zoomed_state = zoomed_state_ok and zoomed_state or nil
24 26 local leader = nil
25 27 if window:leader_is_active() then
26 28 leader = '󱁐 '
28 - local pane_domain = pane:get_domain_name()
30 + local pane_domain_ok, pane_domain = pcall(pane.get_domain_name, pane)
31 + if not pane_domain_ok then return end
30 33 local os_icon = wez.target_triple:find 'windows' and ' ' or ' '
31 34 local time = wez.time.now():format '%H:%M'
32 - local ai_shell = require 'bugabinga.ai_shell'
33 35 local ai_status = ai_shell.get_status(window)
34 36 local status = { time, os_icon, ai_status, leader, }

wezterm/bugabinga/theme.lua

Modified
23 23 cfg.color_scheme = current_scheme
24 24 cfg.color_schemes = nugu.schemes
25 25 nugu.apply_window_frame( cfg, current_scheme )
27 + cfg.font = wez.font_with_fallback { 'IBM Plex Mono', }
28 + cfg.font_rules = {
29 + -- the goal is to make comments in neovim look beautiful
30 + -- because comments are the true GOAT of code
31 + {
32 + italic = true,
33 + intensity = 'Bold',
34 + font = wez.font_with_fallback { {
35 + family = 'Monaspace Xenon Var',
36 + weight = 'Bold',
37 + style = 'Italic',
38 + }, },
39 + },
40 + -- this gives string values in neovim a special touch
41 + {
42 + italic = true,
43 + intensity = 'Normal',
44 + font = wez.font_with_fallback { {
45 + family = 'VictorMono',
46 + style = 'Italic',
47 + }, },
48 + },
50 + }

wezterm/bugabinga/window.lua

Modified
2 2 local wez = require 'wezterm'
4 4 return function ( cfg )
5 5 cfg.window_background_opacity = 1.0
6 - if wez.target_triple:find('windows') then
6 + if wez.target_triple:find 'windows' then
7 7 cfg.window_decorations = 'RESIZE'
8 8 else
9 9 cfg.window_decorations = 'RESIZE|NONE'