|
| 1 | +# Agents |
| 2 | + |
| 3 | +## Fern SDK Regeneration |
| 4 | + |
| 5 | +### Overview |
| 6 | + |
| 7 | +This SDK is generated by [Fern](https://buildwithfern.com/). Most files under `src/main/java/com/deepgram/` are auto-generated and should not be edited directly. Some files are hand-written or carry manual patches and are listed in `.fernignore` to prevent the generator from overwriting them. |
| 8 | + |
| 9 | +When a new Fern generator release is available, we prepare the repo so the generator can overwrite previously frozen files, then re-apply manual patches after reviewing the diff. |
| 10 | + |
| 11 | +### Freeze classification rules |
| 12 | + |
| 13 | +Every entry in `.fernignore` falls into one of two categories. The comment above each entry in `.fernignore` indicates which category it belongs to, but when in doubt, apply these rules: |
| 14 | + |
| 15 | +#### Never unfreeze (permanently frozen) |
| 16 | + |
| 17 | +These files are entirely hand-written or are maintained independently from Fern. The generator would delete or replace them with something unrelated. They must stay in `.fernignore` at all times. |
| 18 | + |
| 19 | +How to identify: |
| 20 | + |
| 21 | +- The file was created by us, not by Fern, such as custom client wrappers or transport abstractions |
| 22 | +- The file is a doc, config, build, or CI artifact we maintain independently |
| 23 | +- The file lives outside the generated Java package tree or is a manually maintained test/example |
| 24 | + |
| 25 | +Current permanently frozen files: |
| 26 | + |
| 27 | +- `src/main/java/com/deepgram/DeepgramClient.java`, `src/main/java/com/deepgram/AsyncDeepgramClient.java`, `src/main/java/com/deepgram/DeepgramClientBuilder.java`, `src/main/java/com/deepgram/AsyncDeepgramClientBuilder.java` - custom wrapper entrypoints that add Bearer auth, session ID support, and custom transport behavior on top of Fern's generated API client |
| 28 | +- `src/main/java/com/deepgram/core/transport/` - hand-written transport abstraction |
| 29 | +- `build.gradle`, `settings.gradle`, `gradle/`, `gradlew`, `gradlew.bat`, `pom.xml`, `Makefile` - build and project configuration |
| 30 | +- `README.md`, `CHANGELOG.md`, `CONTRIBUTING.md`, `LICENSE` - docs |
| 31 | +- `src/test/` - manually maintained tests |
| 32 | +- `examples/` - manually maintained examples |
| 33 | +- `.editorconfig`, `.githooks/`, `.github/`, `.gitignore` - repo and CI configuration |
| 34 | +- `target/` - build output |
| 35 | +- `CLAUDE.md`, `AGENTS.md`, `.claude/` - agent files |
| 36 | + |
| 37 | +Note: `.fernignore` also includes flat-path variants such as `src/main/java/DeepgramClient.java` as defensive entries for alternate local generation layouts. Those files do not currently exist in this repo checkout and should not be treated as current maintained source files. |
| 38 | + |
| 39 | +#### Unfreeze for regen (temporarily frozen) |
| 40 | + |
| 41 | +These files are Fern-generated but carry manual patches to fix issues in the generator output. We freeze them to protect our patches between regenerations, but unfreeze them before a regen so we can compare the new output against our patches. |
| 42 | + |
| 43 | +How to identify: |
| 44 | + |
| 45 | +- The file exists in Fern's output - if you removed it from `.fernignore` and ran the generator, Fern would produce a version of it |
| 46 | +- Our version is a modified copy of what Fern generates |
| 47 | + |
| 48 | +Current temporarily frozen files: |
| 49 | + |
| 50 | +- `src/main/java/com/deepgram/core/ClientOptions.java` - preserves release-please version markers and correct SDK header constants that Fern currently overwrites |
| 51 | + |
| 52 | +### Prepare repo for regeneration |
| 53 | + |
| 54 | +1. Create a new branch off `main` named `lo/sdk-gen-<YYYY-MM-DD>`. |
| 55 | +2. Push the branch and create a PR titled `chore: SDK regeneration <YYYY-MM-DD>` (empty commit if needed). |
| 56 | +3. Read `.fernignore` and classify each entry using the rules above. |
| 57 | +4. For each temporarily frozen file only: |
| 58 | + - Copy the file to `<filename>.bak` alongside the original. |
| 59 | + - In `.fernignore`, replace the original path with the `.bak` path. This protects our patched version from the generator while allowing Fern to overwrite the original. |
| 60 | +5. Never touch permanently frozen entries. Leave them in `.fernignore` as-is. |
| 61 | +6. Commit as `chore: unfreeze files pending regen` and push. |
| 62 | +7. The branch is now ready for the Fern generator to push changes. |
| 63 | + |
| 64 | +### After regeneration |
| 65 | + |
| 66 | +The `.bak` files are our manually patched versions protected by `.fernignore`. The original paths now contain the freshly generated versions. By comparing the two, we can see what the generator now produces versus what we had patched. |
| 67 | + |
| 68 | +1. Diff each `.bak` file against the new generated version to understand what changed and whether our patches are still needed. |
| 69 | +2. Re-apply any patches that are still necessary to the newly generated files. |
| 70 | +3. In `.fernignore`, replace each `.bak` path back to the original path for files that still need patches. |
| 71 | +4. Remove `.fernignore` entries entirely for any files where the generator now produces correct output. |
| 72 | +5. Delete all `.bak` files once review is complete. |
| 73 | +6. Run checks (`./gradlew test`) to verify. |
| 74 | +7. Commit as `chore: re-apply manual patches after regen` and push. |
0 commit comments