DEV Community

Anthony Viard
Anthony Viard

Posted on

Adding the anime side without holding my breath

A week later, OtakuShelf has a few franchises and their manga in it. Now Sam wants the other half: anime. That means new entities — Anime, Season, Episode — wired into the existing Franchise. The difference from last time is important: this is a live project with data and a model Sam cares about. Running the generator blind on it is how you end up with a clobbered entity and a bad afternoon. So Sam slows down by exactly one habit: preview first.

A quick gut-check before anything else

Before even applying, Sam sketches the new shape and asks the agent to validate it:

Validate this without changing anything: an Anime (title, studio) linked many-to-one to Franchise, a Season (number, title, episode count) under an anime, and an Episode (number, title, air date, duration in minutes) under a season.

The validate_jdl tool runs a fast local lint first (is the JDL even well-formed?), then generates the whole thing in a throwaway directory and reports any error — all without touching OtakuShelf. It comes back clean. Good: the idea is sound. Now, what would it actually do to the project?

The dry run that's actually dry

Here's the part every JHipster veteran needs to hear, because it bit us too: in JHipster 9, --dry-run still writes files. It only prints conflicts. So you cannot trust that flag to keep your project pristine.

The MCP sidesteps the whole problem. When Sam asks for a preview:

In /Users/sam/projects/otakushelf, show me what adding the anime entities and their relationships would change — don't write anything yet.

…the agent calls the apply tool with dryRun: true, and the server does something more honest than a flag: it makes a temp directory, copies OtakuShelf's .yo-rc.json and existing entities into it for fidelity, generates there, lists what would change, and throws the temp away. The real project sees zero writes. Sam reads the file list — new Anime, Season, Episode sources, updated Liquibase changelogs, a couple of Vue components — nods, and only then drops the dryRun. The exact same call, now for real.

This is the rhythm Sam settles into for the rest of the project: validate → dry-run → apply. It costs a few seconds and removes all the adrenaline.

The agent already knows the shelf

There's a quieter thing happening that makes this safe. When Sam says "link Anime to Franchise," the agent doesn't guess what Franchise looks like — it reads the project's current entities through a resource (jhipster://project/entities). So it knows Franchise already exists with its title/synopsis/status/startYear, and it adds the relationship without redefining and accidentally trimming those fields. It's working from the real model, not from a fuzzy memory of last week's chat.

For this batch Sam lets the agent do it all in one shot — three new entities and their relationships belong together, so the agent composes a single import_jdl call instead of three separate ones:

entity Anime { title String required, studio String }
entity Season { number Integer required min(1), title String, episodeCount Integer min(0) }
entity Episode { number Integer required min(1), title String, airDate LocalDate, durationMinutes Integer min(0) }

relationship OneToMany {
  Franchise{animes} to Anime{franchise}
  Anime{seasons} to Season{anime}
  Season{episodes} to Episode{season}
}
Enter fullscreen mode Exit fullscreen mode

One generator run, one diff to review. (If Sam had wanted just a single entity, there's an add_entity tool that builds the JDL from a plain description — handy for one-offs. For a coordinated batch like this, one import_jdl is tidier and faster.)

Why the preview habit pays off here specifically

The anime side touches the manga side — Franchise gains an animes collection. That's precisely the kind of cross-cutting change where a blind regeneration makes you nervous. With the dry run, Sam saw in advance that Franchise.java and its Vue views would be regenerated, confirmed nothing surprising was in the list, and proceeded with a clear conscience. The MCP didn't make the change safe by being clever; it made it safe by letting Sam look first, for free, as many times as wanted.

Where this is going

OtakuShelf now models both halves of a franchise — manga and anime — from Franchise down to individual Episodes. It works, but it's a little rough: no DTOs, and Sam already realized a field is missing. Next, the polish pass — and a look at how to read what the agent actually did to your code.

Next in the series: "Polishing the catalog (and reading the agent's receipts)" — options, a forgotten field with a backup, and trusting what the agent did.

Top comments (0)