-
Notifications
You must be signed in to change notification settings - Fork 12
Add TypeSpec AI Tools emitter to generate Effect Schemas #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adilhbay
wants to merge
13
commits into
the-dev-tools:main
Choose a base branch
from
adilhbay:feature/schema-gen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
- Use Object.values().map() instead of manual listing in index.ts - Delete schemas-effect.ts (209 lines of unnecessary re-exports) - Delete test-effect-schemas.ts (development artifact) - Build validation map dynamically from EffectSchemas Adding a new tool now requires only 2 steps: 1. Add schema to MutationSchemas/ExplorationSchemas/ExecutionSchemas 2. Run pnpm generate:schemas
Replace hand-written Effect Schema definitions with TypeSpec-generated code. This introduces a new emitter that transforms @aitool decorated models into Effect Schema TypeScript files. New emitter infrastructure (tools/spec-lib/src/ai-tools/): - lib.ts: @aitool decorator and ToolCategory enum - main.tsp: TypeSpec declarations - emitter.tsx: Alloy.js emitter generating Effect Schemas - index.ts: Module exports Tool definitions moved to TypeSpec (packages/spec/api/flow.tsp): - 12 Mutation tools (CreateJsNode, ConnectNodes, etc.) - 8 Exploration tools (GetWorkflowGraph, SearchApiDocs, etc.) - 3 Execution tools (RunWorkflow, StopWorkflow, ValidateWorkflow) The emitter generates code that imports shared schemas from common.ts and produces the same JSON Schema output as the hand-written files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… decorator Replace 23 duplicate AI tool models with a @mutationTool decorator on collection models. The emitter resolves Insert/Update/Delete properties at emit time based on primary keys, visibility, and exclude lists. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Auto-generate Get{ModelName} exploration tools from @mutationTool-decorated
collections using PK fields. Annotate FlowRunRequest/FlowStopRequest with
@aitool for execution schema generation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ema generation Add a new @explorationTool decorator that generates custom exploration tools from collection model primary keys. Apply it to the Flow model to create a ValidateWorkflow tool. Also wire up execution and exploration schemas into the JSON schema generator alongside mutations. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract getFieldSchema/formatStringLiteral to field-schema.ts, replace implicit auto-generated Get* exploration tools with explicit @explorationTool decorators on each mutation model, unify 3 import components and 4 tool/property schema components into single generic versions, and simplify CategoryFiles to a uniform rendering path. Reduces emitter from 772 to 331 lines. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Make sourceHandle optional on Edge model so ConnectNodes allows omitting it for sequential flows. Add exclude support to the emitter's Update case so UpdateNodeConfig correctly omits the immutable kind field. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…o feature/schema-gen
…tools into feature/schema-gen
Replace single ConnectNodes tool with two specialized tools: - ConnectSequentialNodes: excludes sourceHandle for ManualStart/JS/HTTP nodes - ConnectBranchingNodes: requires sourceHandle for Condition/For/ForEach nodes This eliminates the need for optional sourceHandle which caused Go type issues. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix OptionalPosition to apply annotations inside Schema.optional wrapper - Fix emitter to generate correct code for optional fields with descriptions - Add src/tools to tsconfig.lib.json include list - Fix index signature access to use bracket notation in index.ts Schema.optional() returns a PropertySignature that cannot be piped, so annotations must be applied to the inner schema first. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
@mutationTool,@explorationTool, and@executionTooldecoratorsTest plan