I told ChatGPT to be bin/magento and THIS HAPPENED

YouTube video (creator: Mark Shust) demonstrating prompts that make ChatGPT emulate command-line tools. Shust adapts a Linux-terminal emulator prompt to recreate Magento's CLI (bin/magento), showing examples: clearing cache, creating an admin user, changing admin session lifetime, and reindexing product-related indexers. He shares the prompt and invites viewers to try it and view a follow-up on ChatGPT-generated Magento modules.
Chapters
I am a Magenta developer and I've been playing around with ChatGPT for a little while now. It's done some really amazing things, which made me think maybe there's something out there that would really help us out in Magenta land. In ChatGPT. One of the most useful things about using ChatGPT is the ability to feed it prompts. This can make it behave in a way that sort of emulates either something or someone else. For example, you can use a prompt to direct it to become a dream interpreter that just type out your dreams and it will reply back as a dream interpreter. Someone used this capability to make ChatGPT emulate a virtual machine, which is essentially a Linux bash prompt. The prompt is, I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. My first command is pwd and we can see that this outputs the current working directory. We can tell it to list out all of the files and folders with ls-lah and we can even tell it to give us the output of one of these fake files in this file system. And what's even neater about this is we can tell it to output a file that doesn't even exist, and it'll actually give us the output that there is no such file or directory. This is really, really neat. And you can use this for all sorts of things, including learning how the prompt works and to play around with the Linux terminal without having any repercussions of messing with an actual file system. This is super, super neat. But I was wondering if there's something unique that I can do. To me as a Magento developer, ChatGPT is specifically very good at processing information and executing lines of code that are hard for humans to understand. So it got me wondering, what's something in Magento that I'd be able to do with this AI to emulate that is also hard to remember and execute that Bin Magento script. That's what. So I use that Linux Terminal emulator prompt to inspire my own tool that should act as bin slash magento. And here's what I came up with. I want you to act as the Magento to CLI script. Bin slash magento. I will type my desired action and you will reply with the command that should be typed to achieve that action. I want you to only reply to the terminal command inside one unique code block and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English. I will do so by putting text within curly brackets like this. My first desired action is how do I clear the cache before I execute this command? Be sure to tap that like button if you've liked this video so far to help it spread to other Magento developers. I appreciate it. So when I execute this it will actually tell me how to clear the cache. What's really cool about this though is that I can ask it anything a Bin Magento script would do. So let's run through a few examples. What about create an admin use user for Mark Schust and then I'll just type my email address and very cool. It outputted the full line with admin user create using Mark as the username password one two three is the password and my email address and first and last name. Really cool because this is one of those lines that is just impossible to remember. It also told us to please make sure to use a strong and unique password instead of password1 23 which is very useful for security purposes. What about another example to increase the admin session lifetime to 30 days? Really cool. This is one of those lines that I can never remember the config path for or the value of 30 days in seconds and it even explained what that 2,592,000 value is that it equals 30 days. We can even ask it something that requires a bit more intelligence. For example re index only the indexers that deal with the product catalog. And very cool. It outputted all of these indexers catalog, product attribute, product price, product flat, all of the indexers that deal with the product catalog. Very, very neat. The sky is really the limit of what you can do here. I put this prompt in the description below so you can copy and paste it into your own ChatGPT prompt to test it out. And if you came up with something else that's really neat or interesting along the way of what you did with Magento and ChatGPT, please share it in the comments below. I experimented a bit myself and actually had ChatGPT create a fully functional Magento module and reviewed its code for best practices. If you want to learn how I prompted it to do this and what the results were, you'll want to check out this next video.










