For developers automating API integrations, SDK generators promise efficiency but come with a notorious pain point: any custom files or modifications added to generated codebases get obliterated during regeneration. This limitation forces teams into convoluted workarounds or manual patching workflows, undermining the very automation benefits code generation should provide.

Article illustration 1

Sideko's new "Roach" system tackles this head-on using Rust's powerful macro system. By defining SDK structures through declarative roach_dir! macros, the generator maintains an explicit manifest of all generated files and their expected boilerplate content. This enables intelligent differentiation between generated files (which can be safely modified or removed during updates) and developer-added custom files (which persist through regenerations).

roach_dir! {
    sdk: [
        "client.py",
        "models.py",
        "apis/": {
            "report_api.py",
            "user_api.py"
        }
    ]
}

Example of the Rust macro defining SDK structure (Source: Sideko)

The technical workflow operates through a synchronous HTTP API:
1. Initial generation: POST /sdk returns complete SDK tarball
2. Updates: POST /sdk/{id}/update returns minimal Git patch with only necessary changes

When an API schema evolves—say by removing a /legacy-reports endpoint—the system:
1. Compares current roach_dir! definitions against previous state
2. Automatically deletes obsolete generated files (e.g., legacy_report.py)
3. Preserves unrecognized files (e.g., custom retry_wrapper.py)
4. Outputs a clean patch applicable via git apply

"Traditional generators force an ugly choice: accept generated code as-is, or maintain complex separation between generated and custom code. Our API-first approach fixes both the technical problem and the workflow problem" — Sideko Engineering

The implications are significant for modern development:
- CI/CD integration: Regeneration becomes a single API call in pipelines
- Fearless customization: Teams can extend SDKs without regeneration anxiety
- Transparent updates: Git patches show exact delta for code reviews

By solving the file preservation challenge, Sideko unlocks code generation's true potential—letting developers automate boilerplate while retaining creative control. The Rust-powered foundation also enables remarkable performance, reportedly generating Stripe-level SDKs (600k+ LOC) in under 60 seconds. As APIs continue proliferating, such intelligent regeneration systems will become essential infrastructure.