Skip to content

Add code generation, generate tool, and Gemini integration#14

Draft
sezallagwal wants to merge 3 commits into
feature/workflow-engine-executionfrom
feature/code-generation
Draft

Add code generation, generate tool, and Gemini integration#14
sezallagwal wants to merge 3 commits into
feature/workflow-engine-executionfrom
feature/code-generation

Conversation

@sezallagwal

Copy link
Copy Markdown
Collaborator

Summary

  • Add code generation pipeline that converts DSL workflows into standalone MCP server projects
  • Generate tool files, endpoint maps, server entry points, and project scaffolding
  • Add a generate MCP tool that accepts DSL input and produces ready-to-run server code
  • Include engine runtime bundle so generated servers can execute workflows independently
  • Add DSL-to-workflow mapping layer and project structure generation
  • Add Gemini extension config and DSL reference documentation for AI-assisted generation
  • Add integration tests for the generate tool and code generation pipeline

Depends on

#13

…ration

Add the Week 5 code generation layer and the integration glue that turns a DSL
document into a runnable MCP server project:

- generator/dsl-mapping.ts: bridge the flat DSL step shape to the composer's
  StepConfig union (the seam between the DSL front end and the workflow model)
- generator/engine-bundle.ts: vendor the real engine source into generated
  projects (no re-authored copies)
- generator/codegen.ts + scaffold.ts: emit server entry, RC client, endpoint
  map, per-workflow tool files, README, package.json, tsconfig, env, gitignore
- generator/project.ts + pipeline.ts: assemble the file set and run the full
  DSL -> compose -> generate pipeline
- tools/generate.ts: the `generate` MCP tool — resolves endpoints via the
  parser and writes the project to disk; registered in server.ts
- Gemini CLI extension: gemini-extension.json, GEMINI.md (DSL reference),
  commands/generator/generate.toml

Integration test drives DSL -> generated project, asserts the file set, and
executes the embedded workflow through the engine. Generated projects compile
cleanly under tsc.

@dhairyashiil dhairyashiil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi Sezal, could we fix a few generator safety issues before this PR lands?

First, the built generator currently cannot bundle the workflow engine. engine-bundle reads files like types.ts relative to the running module, but after npm run build those source .ts files are not in dist/workflow. So generation works from source, but the built package path fails. Could we add a built/dist smoke test for generate, and copy/embed the engine sources in a way that works after build?

Second, generated TypeScript embeds DSL-controlled text inside block comments. A workflow DESCRIPTION containing */ can break out of the comment and become executable generated code. Could we escape or remove user-controlled text before putting it in comments?

Third, unresolved operationIds should fail closed. Right now generation can continue with missing endpoints, and the runtime can fall back to an empty GET path. Could we return an error when any operationId cannot be resolved, or rewrite corrected ids before generating?

These are all generator-level issues, so this feels like the right PR to fix them.

@dhairyashiil dhairyashiil marked this pull request as draft July 1, 2026 09:04
…closed on unresolved operationIds

Addresses review feedback on PR #14:

- engine-bundle: resolve engine sources across src/dist layouts and copy .ts sources into dist/ during build so the built package is self-contained; add a built/dist smoke test for generation

- codegen/project/scaffold: escape DSL-controlled text embedded in block comments and README tables; derive safe, unique module basenames for tool files and imports so an unconstrained workflow name cannot break out

- generate tool: fail closed when an operationId cannot be resolved and rewrite parser-corrected operationIds before generating so the embedded workflow and endpoint map agree

- api-call runtime: throw on an unregistered operationId instead of falling back to an empty GET path (also vendored into generated servers)

- tests: escaping, injection safety, fail-closed + corrected-id rewrite, missing-endpoint runtime guard, and a built/dist smoke test
…n' into feature/code-generation

# Conflicts:
#	src/workflow/api-call.ts
@sezallagwal sezallagwal requested a review from dhairyashiil July 7, 2026 21:09
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.

2 participants