This guide walks from a clean workstation all the way to a “hello world” Greentic component that you can validate locally. Follow the steps in order; each section calls out the exact commands you need to run.
-
Install Rust (via rustup).
curl https://sh.rustup.rs -sSf | sh source "$HOME/.cargo/env" rustup update stable
-
Add the WASI target required by
cargo component.rustup target add wasm32-wasip2
-
Install component tooling.
cargo install cargo-component --locked
cargo-componentperforms the WIT-driven build; install it once and keep it updated withcargo install cargo-component --locked --force. -
(Optional) Install supporting CLI tools.
cargo install wasm-tools --lockedif you want to inspect component metadata withwasm-tools component wit.cargo install justif you prefer using the repo’s shorthand tasks.
-
(Optional) Install
greentic-devglobally.cargo binstall greentic-dev
For the latest commit or local forks:
cargo install --git https://github.com/greenticai/greentic-dev greentic-dev # or from the current checkout cargo install --path .
Installing the CLI lets you run
greentic-dev component …without prefixing commands withcargo run -p.
For most workflows (including this guide) you only need the installed CLI. Clone the
greentic-devrepository only if you intend to contribute code or work on the tooling itself.
The happy path is entirely CLI-driven:
- Scaffold the pack workspace.
greentic-dev pack new --dir ./hello-pack dev.local.hello-pack
cd hello-pack- Scaffold the component inside the pack.
greentic-dev component new --name hello-world --path ./components/hello-world --non-interactive --no-git --no-check- Build and doctor the component. (Doctor validates the component is correctly formatted and needs either a colocated manifest or an explicit
--manifest.)
greentic-dev component build --manifest components/hello-world/component.manifest.json
greentic-dev component doctor components/hello-world/target/wasm32-wasip2/release/hello_world.wasm \
--manifest components/hello-world/component.manifest.json- Add the main flow and the component to the flow. This wires your built component into the default flow using greentic-flow via greentic-dev.
greentic-dev flow add-step \
--flow flows/main.ygtc \
--local-wasm components/hello-world/target/wasm32-wasip2/release/hello_world.wasm \
--node-id hello-world \
--operation handle_message \
--payload '{"input": "Hello from hello-world!"}' \
--routing-outTip: if your manifest defines the operation, you can omit
--operation;--payload/--routingcan also be omitted for the default shape.
- Sync pack.yaml components from the components/ directory. This uses the underlying
greentic-pack componentsto add your built component entry intopack.yaml.
greentic-dev pack components --in .- Validate the flow.
greentic-dev flow doctor flows/main.ygtc- Build and check the pack.
greentic-dev pack build --in . --gtpack-out dist/hello.gtpack
greentic-dev pack doctor dist/hello.gtpack- Run the pack.
greentic-dev pack run --pack dist/hello.gtpack --artifacts dist/artifactsThat sequence yields a runnable pack that pulls a config-flow-defined node from your component, bundles it, and executes it locally without touching the network.
If doctor/pack build fails, double-check: (a) the WASM is a component (built with
cargo component), (b)component.manifest.jsonincludesdev_flows.default, and (c) the pack’spack.yamlreferences your component artifact. If a.gtbundlehas an issue, usegtc setup doctor <bundle>to diagnose setup issues andgtc start doctor <bundle>to diagnose runtime issues.
If you want to wire a remote component into your pack and flow, you can reference it via OCI and keep it in pack.yaml under the components extension.
- Scaffold a second pack workspace.
greentic-dev pack new --dir ./hello2-pack dev.local.hello2-pack
cd hello2-pack- Generate answers for the remote templates component and add the resulting node.
mkdir -p flows/answers
greentic-dev flow answers \
--component oci://ghcr.io/greenticai/components/templates:latest \
--operation text \
--mode config \
--name templates \
--out-dir flows/answers
greentic-dev flow add-step \
--flow flows/main.ygtc \
--node-id templates \
--operation text \
--mode config \
--component oci://ghcr.io/greenticai/components/templates:latest \
--answers-file flows/answers/templates.example.json \
--routing-outThe templates
textoperation expects aconfigobject; confirm the generatedtemplates.example.jsonincludes a top-levelconfigfield containing thetextyou want to render before runningadd-step.flow answerswritesflows/answers/templates.schema.jsonandflows/answers/templates.example.json; edit the example JSON to ensure you provide a fullChannelMessageEnvelopefor bothconfig.msgandmsg(the schema mirrorsgreentic_types::ChannelMessageEnvelope, e.g.,id,tenant.{env,tenant,tenant_id},channel,session_id,text,metadata, etc.) before re-runningadd-stepwith--answers-file. Use--pinonflow add-stepto resolve the OCI tag to a digest if you want reproducible builds.
- Optionally: Validate the flow and pack. (
:latestrequires--allow-oci-tags.)
greentic-dev flow doctor flows/main.ygtc- Build and run the pack. (Requires network access to pull the remote component.)
greentic-dev pack build --in . --gtpack-out dist/hello2.gtpack --allow-oci-tags
greentic-dev pack doctor --pack dist/hello2.gtpack
greentic-dev pack run --pack dist/hello2.gtpack --artifacts dist/artifactsOffline test rigs sometimes skip this last command because the templates component expects runtime metadata we cannot provide artificially; if a real registry is accessible the run should succeed once the manifest's
configpayload matchestemplates.schema.json.
# one-time setup
rustup target add wasm32-wasip2
cargo install cargo-component --locked
# scaffold + build + doctor
greentic-dev pack new -- --dir ./hello-pack dev.local.hello-pack
cd hello-pack
greentic-dev component new --name hello-world --path ./components/hello-world --non-interactive --no-git --no-check
GREENTIC_DEV_OFFLINE=1 CARGO_NET_OFFLINE=true greentic-dev component build --manifest components/hello-world/component.manifest.json
greentic-dev component doctor components/hello-world/target/wasm32-wasip2/release/component_hello_world.wasm \
--manifest components/hello-world/component.manifest.json
# pack + run
greentic-dev pack components -- --in .
greentic-dev flow doctor flows/main.ygtc --json
greentic-dev pack doctor --pack pack.yaml
greentic-dev pack build -- --in . --gtpack-out dist/hello.gtpack
greentic-dev pack run --pack dist/hello.gtpack --offline
# optional: register and inspect provider extensions
# (this lives outside the main flow wiring steps)
# greentic-dev pack new-provider --pack manifest.cbor --id dev.local.hello.provider --runtime components/hello-world::greentic_provider@greentic:provider/runtime --manifest providers/dev.local.hello.provider/provider.yaml --kind demo
# greentic-pack providers list dist/hello.gtpack
# greentic-pack providers info dist/hello.gtpack --id dev.local.hello.provider
# greentic-pack providers validate dist/hello.gtpack