Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A code generator needs a second-run strategy when people are expected to edit its output and regenerate it later. Without one, a rerun can overwrite those edits or create conflicts—so teams may stop regenerating and maintain generated files by hand. Jostraca is a framework for building generators that can handle an already-edited output tree, with different policies for different files.

What makes the second run different?

A first run writes files into an output tree. The second run faces a different situation: someone may have changed those files since they were generated. A basic overwrite can replace those changes with newly generated content. A merge can also encounter conflicts between the generator’s latest output and a person’s edits.

Shiv Rai, the author of the Jostraca article, describes this as the point where generators can “clobber work” and teams may switch to hand-maintaining output. That is an explanation of the risk, not a measured estimate of how often it happens.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How can a generator handle existing files?

Jostraca describes five policies for dealing with files that already exist: write, preserve, present, diff and merge. The generator author can choose a policy per file rather than treating the entire output tree identically.

Policy What it does When it can fit
write Writes the generated file, replacing the existing version. Files wholly owned by the generator and safe to recreate.
preserve Keeps the prior version of an existing file. Files whose existing contents should remain untouched on rerun.
present Offers the generated version as an alternative rather than silently replacing the existing file. Cases where a person should decide whether to adopt the new output.
diff Writes a diff for review. Changes that should be inspected before being applied.
merge Uses a three-way merge against the last generation. Files that combine generated content with edits and need changes reconciled.

Jostraca also describes protected regions that the generator does not modify. This can help when a file contains both generated material and a section reserved for user-written content.

Why use different policies in one output tree?

Generated output is not always uniformly owned. A project might contain files that should always match the generator, files that developers customize, and mixed files with both kinds of content. Applying one overwrite rule to all of them can discard work; preserving everything can leave generated portions out of date.

Jostraca’s described approach lets the generator assign policies according to each file’s role. Its article gives examples including a fully generated file, a file with user-written and generated regions, a protected notes file, a merged HTML file, a preserved prior version and a diff for review. These illustrate the author’s intended workflow; they are not independent test results.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When is a second-run-aware generator worth the effort?

Generated output must track changes over time

An SDK generated from an API may need to reflect later API changes. If developers also customize generated files, a rerun needs to account for both the new generated version and those edits.

Shared templates evolve

An internal template or shared boilerplate may change after teams have already created projects from it. A regeneration-aware process can make it possible to offer those updates without assuming that every existing file is untouched.

Developers are expected to customize output

If customization is an accepted part of using generated output, the generator needs a policy for those changes. Protected regions, preservation, reviewable alternatives, diffs or merging offer different ways to balance customization with synchronization.

When is a simpler scaffold enough?

If generation happens once and the output is not expected to be regenerated, second-run handling may add complexity without solving a real problem. The Jostraca article notes that a simpler scaffolding approach can be sufficient in that case. The deciding question is whether regeneration is an ongoing feature—not simply whether the first run creates files.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What Jostraca is—and is not

Jostraca is described as a framework for creating generators, not as a layer over an existing generator. Its workflow defines an output tree and then applies a build phase, allowing the generator to know the planned files before writing them. Its project description emphasizes handling a second run over an edited tree and lists overwrite, preserve, present, diff, merge and protected-region behavior.

The sources do not establish how frequently regeneration failures occur, how much time this approach saves, or how widely it is adopted. They also do not provide a multi-tool product comparison. The practical distinction is instead about the workflow: whether output will be regenerated, which parts are generator-owned, and whether changes should be overwritten, protected, reviewed or merged.

Sources: Jostraca project description and Shiv Rai’s article.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.