{"id":30447031,"url":"https://github.com/mcchrish/ube-tsp","last_synced_at":"2026-04-19T07:31:37.709Z","repository":{"id":306765643,"uuid":"1027142635","full_name":"mcchrish/ube-tsp","owner":"mcchrish","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-18T14:35:26.000Z","size":446,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-29T17:04:08.592Z","etag":null,"topics":["openapi","openapi3","typespec"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcchrish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-27T12:05:09.000Z","updated_at":"2026-02-18T14:39:57.000Z","dependencies_parsed_at":"2025-07-27T14:43:55.103Z","dependency_job_id":null,"html_url":"https://github.com/mcchrish/ube-tsp","commit_stats":null,"previous_names":["mcchrish/ube-tsp"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mcchrish/ube-tsp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchrish%2Fube-tsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchrish%2Fube-tsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchrish%2Fube-tsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchrish%2Fube-tsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcchrish","download_url":"https://codeload.github.com/mcchrish/ube-tsp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchrish%2Fube-tsp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31998792,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["openapi","openapi3","typespec"],"created_at":"2025-08-23T11:33:46.723Z","updated_at":"2026-04-19T07:31:37.692Z","avatar_url":"https://github.com/mcchrish.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ube-tsp\n\n🚀 **TypeScript emitter with namespace structure and Ky HTTP client generator for TypeSpec.**\n\nTransform your TypeSpec definitions into production-ready, type-safe HTTP clients with zero runtime overhead.\n\n## ✨ Features\n\n- **🏗️ Namespace-Aware** - Preserves your TypeSpec namespace hierarchy in generated TypeScript code\n- **🔒 Fully Type-Safe** - Complete end-to-end type safety from API definition to client usage\n- **⚡ Zero Runtime Overhead** - Generates lightweight clients with minimal bundle impact\n- **🎯 Modern \u0026 Fast** - Built on Ky for modern fetch-based HTTP requests\n- **🛠️ Developer Experience** - IntelliSense, auto-completion, and compile-time error checking\n- **📦 Production Ready** - Used in production environments with robust error handling\n\nPerfect for teams who want to maintain API contracts while building fast, reliable TypeScript applications.\n\n## Packages\n\n- **[@ube-tsp/ky-emitter](./packages/ky-emitter)** - TypeSpec emitter generating namespace-structured TypeScript\n- **[@ube-tsp/ky-client](./packages/ky-client)** - Type-safe HTTP client generator\n\n## Quick Start\n\n### 1. Install the emitter\n\n```bash\nnpm install @ube-tsp/ky-emitter\n```\n\n### 2. Configure TypeSpec\n\n```yaml\n# tspconfig.yaml\nemit:\n  - \"@ube-tsp/ky-emitter\"\n```\n\n### 3. Compile your TypeSpec\n\n```bash\ntsp compile .\n```\n\n### 4. Use the generated client\n\n```bash\nnpm install @ube-tsp/ky-client ky\n```\n\n```typescript\nimport ky from \"ky\";\nimport { createClient } from \"@ube-tsp/ky-client\";\nimport { operationMap, type OperationMap } from \"./generated/operation-map.js\";\n\nconst kyInstance = ky.create({ prefixUrl: \"https://api.example.com\" });\nconst client = createClient\u003cOperationMap\u003e(kyInstance, operationMap);\n\n// Use nested methods based on your TypeSpec namespaces\nawait client.PetStore.getPet({ params: { path: { petId: 123 } } });\n```\n\n## 🔧 More Usage\n\n### Custom Ky Configuration\n\nPass additional Ky options for advanced scenarios:\n\n```typescript\n// Custom timeout and headers\nconst result = await client.PetStore.getPet(\n  { params: { path: { petId: 123 } } },\n  {\n    timeout: 5000,\n    headers: { Authorization: \"Bearer token\" },\n    retry: { limit: 3 },\n  },\n);\n\n// Global configuration\nconst kyInstance = ky.create({\n  prefixUrl: \"https://api.example.com\",\n  timeout: 10000,\n  hooks: {\n    beforeRequest: [\n      (request) =\u003e {\n        request.headers.set(\"User-Agent\", \"MyApp/1.0\");\n      },\n    ],\n  },\n});\n```\n\n### Nested Namespaces\n\n```typescript\n// For deeply nested TypeSpec namespaces\nawait client.Store.Inventory.Products.getProduct({\n  params: { path: { productId: \"abc123\" } },\n});\n\nawait client.Admin.Users.Permissions.grantPermission({\n  params: {\n    path: { userId: 456, permissionId: 789 },\n    body: { reason: \"Promotion to manager\" },\n  },\n});\n```\n\n## How it works\n\nThe emitter generates:\n\n- **Namespace-structured TypeScript types** - Mirrors your TypeSpec namespace hierarchy\n- **Runtime operation map** - Contains HTTP method, path, and status code information\n- **Type-safe client methods** - Automatically creates nested client structure from flat operation keys\n\n### Output Structure\n\nFor a TypeSpec like:\n\n```typespec\n@service({\n  title: \"Pet Store API\",\n})\nnamespace PetStore {\n  @route(\"/pets/{petId}\")\n  op getPet(@path petId: int32): Pet | NotFoundError;\n}\n```\n\nThe emitter generates:\n\n```\ngenerated/\n├── Spec.ts              # Namespace-structured types\n├── operation-map.ts     # Runtime operation mapping\n└── Spec/\n    └── PetStore.ts      # PetStore namespace types\n```\n\nThe operation map contains:\n\n```typescript\nexport const operationMap = {\n  \"PetStore.getPet\": {\n    path: \"/pets/{petId}\",\n    method: \"GET\",\n    statusCodes: [200, 404],\n  },\n};\n```\n\nThe client transforms this into:\n\n```typescript\n// Typed as: (params: { path: { petId: number } }) =\u003e Promise\u003cApiResponse\u003e\nclient.PetStore.getPet({ params: { path: { petId: 123 } } });\n```\n\n## Development\n\n```bash\nnpm run build    # Build all packages\nnpm run test     # Test all packages\nnpm run lint     # Lint all packages\nnpm run format   # Format code\n```\n\n## Credits\n\nBased on [typespec-zod](https://github.com/bterlson/typespec-zod) implementation patterns. Built with AI assistance from Claude Code.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcchrish%2Fube-tsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcchrish%2Fube-tsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcchrish%2Fube-tsp/lists"}