tynd plugin types
tynd plugin types # every local native plugintynd plugin types ./plugins/indexertynd plugin types --check # CI: fail when a catalog is staleRuns each native plugin’s type generator and writes its output to the plugin’s *.gen.ts file. The file exports CommandsCatalog and _commands, which defineTypedPlugin<CommandsCatalog>(name) from @tynd/plugin-sdk consumes.
Which plugins
Section titled “Which plugins”- With
[plugin]: that plugin, resolved like the argument oftynd plugin dev. - Without it: the package at
--cwdand everyplugins/*directory that holds apackage.json.
Only packages whose package.json has a tynd.native block count. The native crate lives in tynd.native.path (default native), which must stay inside the package and hold a Cargo.toml.
How it generates
Section titled “How it generates”- The generator is the crate’s single binary whose name contains
gen-typesor whose path ends in/gen-types.rs, or elsesrc/bin/gen-types.rs. - It runs as
cargo run --release --quiet -p <crate> --bin <bin>with a sanitized environment. Its stdout must containexport type CommandsCatalogand_commands. - The output file is the package’s only
*.gen.ts, or<name>.gen.tswhen there is none (<name>is the package name without its scope andplugin-prefix). - A crate that uses
workspace = truebut is not part of a Cargo workspace is built in a temporary workspace that points to the native SDK of the installed@tynd/plugin-sdk.
| Flag | Default | Effect |
|---|---|---|
[plugin] |
all local native plugins | Plugin directory or package name |
--cwd <dir> |
. |
Search directory |
--dry-run |
false | Print would update <file> instead of writing |
--check |
false | Fail with generated plugin types are stale when a file differs |
What can go wrong
Section titled “What can go wrong”no local native plugins found: no package in scope hastynd.native.has no gen-types binaryorhas multiple gen-types binaries: keep exactly one generator binary.has multiple *.gen.ts files: keep one generated catalog per package.- Cargo must be on
PATH, with a toolchain that meets the crate’srust-version.