Start a project
Choose one supported input and review its format-specific requirements. This example uses an OpenAPI document to write the two manifests without interactive prompts:
tungsten init --from openapi.yaml --dir my-api --targets webmcp,py
tungsten check my-api
tungsten doctor my-api --strict
tungsten generate my-api
--targets accepts the built-in SDK targets typescript, python, rust,
java, kotlin, csharp, fsharp, dart and ruby, plus docs, mcp,
webmcp and mock. Use ts, py, rs, kt, cs, fs or rb as aliases.
Select cli for the Rust SDK and its generated command-line client.
Go uses an external emitter; follow Go emitter setup to build
and configure that command. Separate targets with commas or repeat
--targets. Duplicates are removed. Unknown names fail before files are written.
The mock target is reserved; use tungsten mock to run the built-in mock server.
Without --targets, init keeps the existing TypeScript, Python, and docs defaults.
Converted imports carry enforced operation policy. Fresh setup refuses built-in targets that cannot enforce it before saving the conversion or manifests; choose TypeScript, Python, Rust, MCP, WebMCP or docs for those inputs. This restriction is separate from ordinary declared OpenAPI generation. External emitters must explicitly declare their policy capability before generation.
Selecting webmcp also configures the TypeScript SDK and connects the browser
adapter to it using sdk_path: ../typescript. Selecting both mcp and
typescript also connects the server to that local SDK. Edit the package names,
versions, output locations, and other target settings in tungsten.yml as needed.
Init derives the API name, namespace, and default server from the specification.
When no document is found, it writes a placeholder spec path with a TODO.
Review the safety rules in agent.yml, especially operations with side effects.
Existing manifests are preserved unless --force is given. Symlinks and other
nonregular manifest entries are refused even with --force.
The target list above describes the 0.1.3 source candidate. Kotlin, F# and Dart are absent from the released 0.1.2 compiler; use the candidate compiler and matching runtime source for those targets. The runtime distribution guide separates stable package installation from candidate source requirements.
Go emitter setup
With Go 1.22 or newer, build the external emitter from the matching public source
checkout and put the binary on PATH:
(cd emitters/go && go build -o tungsten-emit-go .)
Add a Go target to the project's tungsten.yml (ordinary declared OpenAPI input):
targets:
go:
external: true
out: generated/go
module: example.com/my-api/sdk
external: true selects tungsten-emit-go on PATH. Alternatively, set
external to the command's absolute path. Generate with tungsten generate my-api;
the Go SDK guide covers the resulting package and runtime dependency.
For an unpublished candidate runtime, set runtime_path to the matching
runtimes/go source directory relative to generated/go.
Check local prerequisites
Bare tungsten doctor remains an informational list of optional tools and always
succeeds. Give it a project directory or a tungsten manifest to identify the tools
required by its configured targets:
tungsten doctor my-api
tungsten doctor my-api --strict
TypeScript, MCP, and WebMCP require Node.js 22 or newer and npm to build and install
the generated packages. Python defaults to 3.12; the 0.1.3 candidate also supports
opt-in Python 3.10/3.11 output
with matching runtime source. Published 0.1.2 Python packages require 3.12.
Rust requires Cargo and rustc 1.88 or newer.
Other tools remain optional. --strict fails when a required tool is missing, its
version is unsupported, or a required minimum version cannot be determined. With
--strict and no path, doctor checks the current project. A docs-only project has
no required external tools. Invalid project manifests fail in either project mode.
Explicit sdk_path, runtime_path, and sdk_runtime_path settings are inspected
for local package.json files relative to the generated target's output directory.
These checks are informational: generation or dependency installation may still be
pending. Doctor performs no registry requests, package installation, login, or
credential prompts; success does not verify package publication or registry access.
Build generated packages
Generate first, then build the SDK before its agent adapter:
(cd my-api/generated/typescript && npm install && npm run build)
(cd my-api/generated/webmcp && npm install && npm run build)
The browser adapter requires the @elysra/tungsten-webmcp and @elysra/tungsten-runtime packages.
Their versions and any local development paths belong in the target options.
See the Browser WebMCP guide for frontend registration and disposal.
If hand-written TypeScript extensions under src/custom import npm packages,
declare them in the manifest so regeneration keeps their dependencies:
targets:
typescript:
package: "@my-api/sdk"
out: generated/typescript
dependencies:
"@hpke/core": "1.7.5"
dependencies maps valid npm package names to non-empty version specifiers.
Generation rejects invalid entries with TG0711. The emitter manages
@elysra/tungsten-runtime, zod, and typescript, so these names cannot be
added here; use runtime or runtime_path to configure the runtime dependency.
Published TypeScript packages include preserved src/custom source and its
license and provenance notices alongside compiled dist output.