Skip to content

Instantly share code, notes, and snippets.

@sourman
Created February 7, 2025 17:39
Show Gist options
  • Save sourman/04f2a633a8409225cada2d0521938a86 to your computer and use it in GitHub Desktop.
Save sourman/04f2a633a8409225cada2d0521938a86 to your computer and use it in GitHub Desktop.
.cursorrules nextjs file structure update script
#!/bin/bash
tree -I 'tree.tmp|*.tar.gz|desktop.ini|*.pkl|delete_me|node_modules|.vscode|*.tsbuildinfo|next-env.d.ts|.env*|*.log|.vercel|build|' > tree.tmp && awk '
BEGIN {in_tree_section = 0}
/START_TREE/ {
print "START_TREE"
print "```"
system("cat tree.tmp")
print "```"
print "END_TREE"
in_tree_section = 1
next
}
/END_TREE/ {in_tree_section = 0; next}
!in_tree_section {print}
' .cursorrules > .cursorrules.tmp && mv .cursorrules.tmp .cursorrules && rm tree.tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment