Ir al contenido

What gtdx new Generates

Esta página aún no está disponible en tu idioma.

gtdx new writes about twenty files. Most of them you will never touch. This page says what each one is, so you know where to start and — just as usefully — what to leave alone.

Run it and see:

Terminal window
gtdx new my-ext --kind design --yes
cd my-ext

Everything else is scaffolding around these.

FileWhat it is
src/lib.rsThe component. Implements the exports your kind’s contract requires.
describe.jsonThe manifest. Identity, permissions, and what the extension contributes.
wit/world.witThe world your component targets — which interfaces it imports and exports.

Since 1.2.7, four kinds scaffold with one working example rather than empty stubs, so a fresh gtdx dev --once produces something you can see and copy:

--kindExampleWhat it exercises
designan echo tooltool listing, input/output schemas, invocation
providera webhook channelchannel listing, credential + config schemas, dry-run encoding
deploya dry-run targettarget listing, both schemas, a deploy/poll cycle that completes
bundlea starter reciperecipe listing, config schema, supported capabilities

llm and mcp already shipped working examples. wasm-component has no guest at all — it wraps a component someone else published, so it is describe-only.

addon (added in 1.2.13) sits between those two extremes: validation.validate-config, validation.validate-desired-state, workload.render-workload, and reconciler.plan are fully implemented, but reconciler.observe and reconciler.apply deliberately fail — they need a live backing service the scaffold cannot provide. See Addon Extensions.

Replace the example rather than adding beside it. It exists to be read once and then deleted.

Editing them is wasted work: they are rewritten on the next build, or they encode a version you do not control.

FileWhy
src/bindings.rs~3,400 lines of WIT ABI glue, regenerated by cargo component on every build. Header says DO NOT EDIT. Already gitignored.
wit/deps/Vendored copies of the contracts your world depends on, pinned by the lock below.
.gtdx-contract.lockRecords which contract version was vendored, so a rebuild cannot silently drift.
Cargo.lockStandard Cargo lockfile.

src/bindings.rs being large is normal — it is the canonical ABI marshalling for every interface in your world, not code anyone wrote by hand. Your own file next to it is under 200 lines.

FileWhat it does
Cargo.tomlCrate manifest, plus [package.metadata.component] telling cargo-component which WIT world to build against.
rust-toolchain.tomlPins the Rust version and the wasm32-wasip2 target, so the project builds the same everywhere.
build.shOne-liner wrapper for cargo component build --release.
ci/local_check.shThe gate to run before publishing: fmt, clippy, test, build.
.gitignoreExcludes target/, dist/, src/bindings.rs, and *.gtxpack.
FileWhat it does
i18n/en.jsonUser-facing strings. Add locales alongside it; the designer picks by the viewer’s locale.
prompts/system.mdPrompt text contributed to the designer’s LLM context. Only scaffolded for kinds that can contribute prompts.
README.mdStarter readme for your extension, not for the SDK.
FileWhat it does
AGENTS.mdWhich values are placeholders to replace, and which files must never be hand-edited.
CLAUDE.mdPoints Claude Code at AGENTS.md.
.claude/settings.jsonPre-approved build permissions, so an agent can compile without prompting for each command.
.claude/commands/check.mdA /check command that runs the local quality gate.

These are inert if you do not use an agent — plain markdown and a settings file.

The layout above is the same for every kind. Only two things change:

  • wit/deps/ carries the contracts that kind needs — extension-bundle for bundle, extension-provider for provider, wasix-mcp for mcp, and so on.
  • prompts/system.md is scaffolded only for kinds that can contribute prompts (design, wasm-component, llm).

gtdx dev --once adds two paths, both gitignored:

  • target/ — Cargo’s build directory, including the compiled .wasm
  • dist/<name>-<version>.gtxpack — the packed extension, with a manifest.json integrity ledger the runtime verifies at install

It also fills the real sha256 digests into describe.json, replacing the all-zero placeholders the scaffold ships. Those placeholders are why gtdx lint --publish fails on a project that has never been built — build once, and it passes.