Show your last 3 visited code projects as a Finder sidebar folder, updated automatically by zsh.
There's no reliable public API for programmatically adding items to the macOS Finder sidebar Favorites. The old LSSharedFileList API was deprecated in macOS 10.11 and removed in 10.13. Tools like mysides no longer work on modern macOS (Sequoia).
I keep all my code projects in ~/code. I frequently want to drag files to a recently used project (I work mostly in the terminal). This shows a work-around to keep the Finder Favorites sidebar updated with the last 3 code projects I've worked on.