Draft
Conversation
Initial project structure with TypeScript, ESLint, Prettier, Jest, and stub parser/RPC entry points. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- location.ts: source index building and loc encoding helpers - violations.ts: violation factory functions for parser diagnostics - type-mapping.ts: TypeSpec scalar to Basketry IR primitive mapping Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements the TypeSpecParser class that compiles TypeSpec files, extracts HTTP services, maps the type graph to Basketry IR, and produces HTTP protocol info. Updates jest config for ESM compatibility with @typespec packages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a multi-file TypeSpec fixture (main.tsp, models.tsp, operations.tsp) exercising inheritance, enums, named unions, nullable/array properties, and all HTTP verbs. Fixes encodeLoc to walk the AST parent chain to find the source file, enabling correct sourceIndex values in multi-file scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rors - Add unsupportedFeature violation when anonymous unions drop variants beyond the first one, warning about data loss - Early return from parse() when compiler has error-severity diagnostics to prevent generating garbage IR from invalid input Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add ScalarShowcase model to example fixture exercising coerced scalars - Add Scalars interface endpoint to expose ScalarShowcase in operations - Fix ValidationRule id field to be plain string (not wrapped object) - Remove float16 (not a TypeSpec built-in scalar type) - Update type-mapping.test.ts to match corrected rule structure - Add scalar mapping describe block in parser.test.ts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Basketry resolves sourcePaths relative to its project root via path.resolve(cwd, sourcePaths[0]). When .tsp files lived in a subdirectory, the relative paths caused ENOENT errors. Absolute paths let Basketry handle relativization on its end. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire getDoc() from @typespec/compiler into all IR node types: Interface, Method, Parameter, Type, Property, Enum, EnumMember, and Union. Multi-paragraph doc comments are split by double newlines into separate StringLiteral array entries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace Jest with Vitest for native ESM support — eliminates the need for --experimental-vm-modules and ts-jest workarounds. Add CJS entry point (index.cjs) with conditional exports so Basketry's NodeEngine can load the parser via require() despite being an ESM package. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use TypeSpec AST node.id for precise name locations instead of full node spans that include doc comments and body declarations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ReturnValue was missing a loc, causing the response-envelope rule to default to main.tsp:1:1. Now points to the response model definition. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Read TypeSpec @extension("x-*", value) decorators via @typespec/openapi and map them to MetaValue[] on methods, parameters, types, properties, enums, and unions. Strips the x- prefix to match OpenAPI parser behavior, enabling existing Basketry rules like require-auth-module to work unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ions Use nameLoc (AST node.id span) for the node-level loc field, falling back to the full span only when no id is available. This ensures rules like require-auth-module and response-envelope highlight the specific name rather than the entire block including doc comments and body. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
TODO: still needs massive cleanup 🤖, but it works at least on a small multi-file setup for happy-path. Will update the description more thoroughly.
TL;DR: it does the thing. (loc mapping across different files from a single entrypoint, handles multi-file via offsets, tracks violations)
Clanker summary:
Complete rewrite of the @basketry/typespec parser — replaces the incomplete alpha implementation with a fully functional TypeSpec-to-Basketry IR parser with HTTP
protocol support.
Core Parser
Type System
format, int32/int64 range)
Error Handling
Testing
Packaging