Codegen sync API and all enums#2845
Merged
andrewbranch merged 5 commits intomicrosoft:mainfrom Feb 20, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces comprehensive code generation infrastructure to automatically generate the sync API and all TypeScript enums from their source counterparts. The sync API is generated from async API source files using directive-based and AST-based transformations, while TypeScript enums are generated from Go source constants. This significantly reduces manual maintenance burden and ensures consistency between implementations.
Changes:
- Implements sync API codegen from async source using directives (
@sync:,@sync-skip) and AST transforms (removingasync/await, unwrappingPromise<T>) - Implements enum generation from Go const blocks to TypeScript, with topological sorting to handle forward references
- Reorganizes file structure: moves enums to
src/enums/, removessrc/base/directory, consolidates imports using wildcard patterns
Reviewed changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
_packages/api/scripts/generate-sync.ts |
New codegen script that transforms async API to sync using directives and AST manipulation |
Herebyfile.mjs |
Adds generate:enums task to parse Go const blocks and generate TypeScript enums with dependency resolution |
_packages/api/src/sync/api.ts |
Generated sync API with async/await removed, Promise types unwrapped |
_packages/api/src/sync/types.ts |
Generated sync type definitions |
_packages/api/src/sync/client.ts |
Sync client with socket check, synchronous request methods |
_packages/api/src/enums/*.ts |
Generated enum files from Go source with auto-generated headers |
_packages/api/package.json |
Updated with generation scripts, wildcard import maps for enums |
_packages/api/test/sync/*.ts |
Generated sync tests and benchmarks from async source |
.github/workflows/ci.yml |
Added enum generation and sync API generation steps to CI |
internal/api/callbackfs.go |
Refactored null check logic to be more concise |
jakebailey
approved these changes
Feb 19, 2026
jakebailey
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the sync API types, implementation, tests, and benchmarks with ones generated from their async counterparts.
It also generates all the TypeScript enums used in the packages from the Go source.