{"id":22862408,"url":"https://github.com/dylibso/xtp-bindgen","last_synced_at":"2025-07-06T07:08:04.342Z","repository":{"id":247652312,"uuid":"826464667","full_name":"dylibso/xtp-bindgen","owner":"dylibso","description":"A typescript library for parsing and using the XTP Schema https://docs.xtp.dylibso.com/docs/concepts/xtp-schema/","archived":false,"fork":false,"pushed_at":"2025-02-12T15:08:31.000Z","size":325,"stargazers_count":18,"open_issues_count":5,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-30T21:51:41.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dylibso.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-09T18:56:41.000Z","updated_at":"2025-04-24T16:02:25.000Z","dependencies_parsed_at":"2024-09-11T23:40:03.812Z","dependency_job_id":"0bcc5c41-8759-46d2-a831-c75df93b2c30","html_url":"https://github.com/dylibso/xtp-bindgen","commit_stats":null,"previous_names":["dylibso/xtp-bindgen"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/dylibso/xtp-bindgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fxtp-bindgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fxtp-bindgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fxtp-bindgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fxtp-bindgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dylibso","download_url":"https://codeload.github.com/dylibso/xtp-bindgen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dylibso%2Fxtp-bindgen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263861947,"owners_count":23521355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-12-13T10:13:28.129Z","updated_at":"2025-07-06T07:08:04.324Z","avatar_url":"https://github.com/dylibso.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xtp-bindgen\n\nXTP Bindgen is an open source framework to generate PDK bindings for\n[Extism](https://extism.org) plug-ins. It's used by the\n[XTP Platform](https://www.getxtp.com/), but can be used outside of the platform\nto define any Extism compatible plug-in system.\n\n\u003e Note: This repository hosts the core schema parser and validation code, and is\n\u003e not meant for typical day-to-day use. Instead, you should use the\n\u003e [`xtp` CLI]((https://docs.xtp.dylibso.com/docs/cli#installation)) to generate\n\u003e bindings from an\n\u003e [XTP Schema](https://docs.xtp.dylibso.com/docs/concepts/xtp-schema).\n\n## Quickstart\n\n### 1. Install the `xtp` CLI.\n\nSee installation instructions\n[here](https://docs.xtp.dylibso.com/docs/cli#installation).\n\n### 2. Create a schema using our OpenAPI-inspired IDL:\n\n```yaml\nversion: v1-draft\nexports: \n  CountVowels:\n      input: \n          type: string\n          contentType: text/plain; charset=utf-8\n      output:\n          $ref: \"#/components/schemas/VowelReport\"\n          contentType: application/json\n# components.schemas defined in example-schema.yaml...\n```\n\n\u003e See an example in [example-schema.yaml](./example-schema.yaml), or a full\n\u003e \"kitchen sink\" example on\n\u003e [the docs page](https://docs.xtp.dylibso.com/docs/concepts/xtp-schema/).\n\n### 3. Generate bindings to use from your plugins:\n\n```\nxtp plugin init --schema-file ./example-schema.yaml\n  \u003e 1. TypeScript                      \n    2. Go                              \n    3. Rust                            \n    4. Python                          \n    5. C#                              \n    6. Zig                             \n    7. C++                             \n    8. GitHub Template                 \n    9. Local Template\n```\n\nThis will create an entire boilerplate plugin project for you to get started\nwith. Implement the empty function(s), and run `xtp plugin build` to compile\nyour plugin.\n\n## How Does It Work?\n\n[Extism](https://extism.org) has a very simple bytes-in / bytes-out interface.\nThe host and the guest must agree on the interface used (exports functions,\nimports functions, and types). The purpose of this project is to create a\ncanonical document and set of tools for defining this interface and generating\nbindings. That document is the\n[XTP Schema](https://docs.xtp.dylibso.com/docs/concepts/xtp-schema). This is an\nIDL of our creation. It is similar to [OpenAPI](https://www.openapis.org/), but\nis focused on defining plug-in interfaces, not HTTP interfaces.\n\nOnce you define your interface as a schema, you can use one of the bindgens to\ngenerate code. We have some official bindgens available for writing PDKs, but\nmore will be availble soon for a variety of purposes. There may also be\ncommunity bindgens you can use.\n\n- [TypeScript](https://github.com/dylibso/xtp-typescript-bindgen)\n- [Go](https://github.com/dylibso/xtp-go-bindgen)\n- [Python](https://github.com/dylibso/xtp-python-bindgen)\n- [Rust](https://github.com/dylibso/xtp-rust-bindgen)\n- [C#](https://github.com/dylibso/xtp-csharp-bindgen)\n- [Zig](https://github.com/dylibso/xtp-zig-bindgen)\n- [C++](https://github.com/dylibso/xtp-cpp-bindgen)\n\n## How Do I Use A Bindgen?\n\nYou can use the [XTP CLI](https://docs.xtp.dylibso.com/docs/cli/) to generate\nplug-ins.\n\n\u003e _Note_: You don't need to authenticate to XTP to use the plugin generator\n\nUse the `plugin init` command to generate a plugin:\n\n```\nxtp plugin init \\\n    --schema myschema.yaml \\\n    --template @dylibso/xtp-typescript-bindgen \\\n    --path ./myplugin \\\n    --feature none\n```\n\nYou can point to a bindgen template on github or directly to a bindgen bundle.\n\n## How Do I Write A Bindgen?\n\n\u003e We recommended that you use any of the existing bindgens as a starting point\n\u003e for writing your own bindgen.\n\nA bindgen is simply a zip file with the following attributes:\n\n- `plugin.wasm` an extism plugin to generate the code\n- `config.yaml` a config file for the generator\n- `template` a template folder of files and templates that the generator will\n  recursively process\n\nFor reference, Here is what is inside the typescript bindgen:\n\n```\n$ tree bundle\nbundle\n├── config.yaml\n├── plugin.wasm\n└── template\n    ├── esbuild.js\n    ├── package.json.ejs\n    ├── src\n    │   ├── index.d.ts.ejs\n    │   ├── index.ts.ejs\n    │   ├── main.ts.ejs\n    │   └── pdk.ts.ejs\n    ├── tsconfig.json\n    └── xtp.toml.ejs\n```\n\nThe XTP CLI will download and unpack this template, it will load the plugin, and\nit will recursively walk through the template and pass each file through the\nplugin to be rendered. Our official bindgens currently use typescript and EJS to\nrender the projects, but these are not mandatory. It can be any Extism plug-in.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fxtp-bindgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdylibso%2Fxtp-bindgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdylibso%2Fxtp-bindgen/lists"}