codemod-com / codemod

The end-to-end platform for creating, sharing, and running codemods with engines like jscodeshift, ast-grep, ts-morph, and more. Automate code migrations, cleanups, and refactors for you, your team, and the community. AI-powered and CLI-first.
https://go.codemod.com/docs
Apache License 2.0
417 stars 35 forks source link

[studio] It's easy to forget to click "Copy to Codemod panel" button when having a conversation that generates updated versions of a Codemod #1244

Open with-heart opened 2 months ago

with-heart commented 2 months ago

Issue Description

Select one of: [ ] Generated codemod is not correct [ ] Bug in Codemod Studio [x] UI/UX improvement request [ ] Feature request

It's easy to forget to click "Copy to Codemod panel" button when having a conversation that generates updated versions of a Codemod.

Steps to Reproduce

  1. Fill out Before and After
  2. Click "Autogenerate with Codemod AI"
  3. Notice that generated code is now in the Codemod panel
  4. Send a message to Codemod AI that causes it to generate an updated version of the existing Codemod
  5. Notice that the updated version's code isn't in the Codemod panel
  6. Find the "Copy to Codemod panel" button (typically by scrolling up)
  7. Click "Copy to Codemod panel" button
  8. Notice that the updated version's code is now in the Codemod panel

Or if you're me, the reason you're opening this issue is because your steps are 1-4 and then

  1. Fail to notice that the updated version's code isn't in the Codemod panel
  2. Get frustrated that the "updated" Codemod still isn't working
  3. Repeat 4-6 with increasing frustration until you notice that the updated version's code isn't in the Codemod panel
  4. Weep

Actual Results

Expected Results

The application helps make sure that the updated version's code is copied to the Codemod panel if that's what I failed but otherwise intended to do.

Intentionally left this vague because I think there are a lot of ways the app could do that.

r4zendev commented 2 months ago

I can see where you're coming from with this one, copying the generated/updated codemod to the codemod panel should happen automatically in case it succeeds. Putting this in our Backlog.

with-heart commented 2 months ago

That sounds great! I can't think of a time where it generated an update that I didn't want to try right away.

One thought that popped in my head with that solution is related to a question I just saw in Slack:

Since there's no "history" for the codemod code as it's being generated and updated, copying the code automatically would be a destructive action. I'm imagining a situation where an update causes codemod functionality that worked previously to stop working, and I'd have no way to get back to it or figure out what changed to break it.

alexbit-codemod commented 2 months ago

cc @mohebifar