Grep is a command line utility used to search for string patterns in a file, it uses regex syntax which, as illustrated, can be more than a bit arcane.
At a glance it appears to be looking for files that start with useEffect and have a tsx extension. Its capturing a portion of what comes after useEffect but before the tsx extension ETA: it just captures the lines with useEffect up until the first [, but it's doing so for all tsx files, the captured value is then referenced as $1 in the piped call afterwards.
You're mixing up the regex with the files to search. The tsx part is just specifying to search those files. The regex finds useEffect followed by arbitrary characters, up until the first [, then matches everything before the next ] character. So essentially it finds dependencies to useEffects. Except I'm pretty sure it breaks if you have any square brackets in the useEffect callback itself (like an array)
I mean .... why not? I don't understand what it exactly wants to filter but there's nothing in it which looks like it could bork my machine or do any write-operation in the first place.
The nugget of truth is that we don’t actually comb through every part of these commands, but rather glance over it looking for rm -rf /* or some shit and hit enter
True, but I think that's still okayish. There's certainly a risk that it cleverly selects dangerous code that gets piped into `exec` or something similar or uses a command that looks safe but actually is a destructive operation, but all in all well written agents seem to do a pretty good job at isolating things and making sure you can give consent properly.
I once ran an agent under Zed in a Distrobox that seemed to be broken. It could read code and run terminal commands but could not use any of the normal edit tools. Somehow it still got me my MVP by abusing sed and shit lmao
40
u/Adventurous-Fox2740 Feb 18 '26
Hey, do you mind if I run a quick check to see which dependencies you're using most in your useEffect hooks? I'll just grab a top 20 list for you.
11
u/RangerMike81 Feb 18 '26
pretty sure i've seen this approval request come across my desk LOL
5
u/brunoha Feb 18 '26
Grok Code Fast: hey, mind if I :(){ :|:& };: ?
7
u/iamwisespirit Feb 18 '26
Is there any person who can explain to me ?
2
u/pancomputationalist Feb 18 '26
Yeah sure let me get out my rubber stamp.
1
u/aksdb Feb 18 '26
I mean .... why not? I don't understand what it exactly wants to filter but there's nothing in it which looks like it could bork my machine or do any write-operation in the first place.
1
u/ingenarel-NeoJesus Feb 19 '26
.*?pardon my posix-extended brain but I'M SORRY WHAT?????
1
u/vgf89 Feb 20 '26
I once ran an agent under Zed in a Distrobox that seemed to be broken. It could read code and run terminal commands but could not use any of the normal edit tools. Somehow it still got me my MVP by abusing sed and shit lmao
1
u/Gigibesi Feb 22 '26
nice shellshock
...or is it?
0
u/[deleted] Feb 18 '26
[deleted] — view deleted comment