Skip to content

feat: add playground and refactor code structure#358

Open
jonaslagoni wants to merge 1 commit intomainfrom
playground
Open

feat: add playground and refactor code structure#358
jonaslagoni wants to merge 1 commit intomainfrom
playground

Conversation

@jonaslagoni
Copy link
Copy Markdown
Contributor

@jonaslagoni jonaslagoni commented Apr 19, 2026

Note

Medium Risk
Medium risk because it refactors the generation pipeline from writing files during generation to returning GeneratedFile[] and moves filesystem writes into the CLI, which can affect output paths/deduplication and downstream integrations.

Overview
Adds a browser build + API for in-browser codegen. Introduces src/browser entrypoints (generate, parseConfig, BrowserOutput) plus an esbuild browser bundling setup with Node polyfills and targeted shims for fs, @asyncapi/parser/browser, swagger-parser, and json-schema-ref-parser (including lodash-to-lodash-es redirection and a SlowBuffer patch).

Refactors core generation to be I/O-free. Generators and renderGraph now return GeneratedFile[] (path+content) instead of filesWritten paths, with shared Modelina generation via generateModels() and new portable path helpers (joinPath, relativePath); the CLI generate command now writes results to disk via writeGeneratedFiles() and updates verbose/JSON output accordingly.

Tests and tooling updated. Adds comprehensive browser generation tests (AsyncAPI/OpenAPI/JSON Schema, $ref cases, dependency ordering) and updates snapshots/path handling; adds esbuild tooling and typecheck steps to lint.

Reviewed by Cursor Bugbot for commit c972979. Bugbot is set up for automated code reviews on this repo. Configure here.

@jonaslagoni jonaslagoni requested a review from ALagoni97 as a code owner April 19, 2026 07:43
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
the-codegen-project Error Error Apr 19, 2026 7:43am
the-codegen-project-mcp Ready Ready Preview, Comment Apr 19, 2026 7:43am

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 19, 2026

Deploy Preview for the-codegen-project failed.

Name Link
🔨 Latest commit c972979
🔍 Latest deploy log https://app.netlify.com/projects/the-codegen-project/deploys/69e487aea2835a00087f013f

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c972979. Configure here.

Comment thread src/browser/config.ts
// For YAML, we'd need to import stringify from yaml
// For now, default to JSON
return JSON.stringify(config, null, 2);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serializeConfig silently returns JSON for YAML format

Medium Severity

serializeConfig accepts a format parameter of 'json' | 'yaml' but always returns JSON output regardless. When a caller passes 'yaml', they silently get JSON back instead. The function's contract promises YAML support but doesn't deliver it, which will produce unexpected output for any consumer relying on YAML serialization.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c972979. Configure here.

typeof browserBundle.default?.Parser
);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug logging left in production browser shim

Medium Severity

Multiple console.debug calls in the browser shim will fire every time the module loads in a browser environment, logging internal bundle structure details (Bundle keys:, Parser type:, default type:, default.Parser type:) to the user's console. This appears to be diagnostic code left from development.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c972979. Configure here.

get size(): number {
return this.files.size;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BrowserOutput duplicates MemoryAdapter functionality entirely

Low Severity

BrowserOutput in src/browser/adapters/output.ts duplicates nearly all functionality of MemoryAdapter in src/codegen/output/memory.ts. Both use a Map<string, string> to store files in memory, both implement OutputAdapter, and both expose write, read, has, clear, getWrittenFiles, and getAllFiles. The browser index even exports both classes side by side.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c972979. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant