Building Packs
Overview
Section titled “Overview”Packs are the distribution unit in Greentic. This guide covers creating, building, signing, and publishing packs using the CLI tools.
Pack CLI Commands
Section titled “Pack CLI Commands”gtc pack
Section titled “gtc pack”gtc pack <COMMAND>
Commands: build Build a pack from source directory verify Verify pack signature and contents info Display pack metadata extract Extract pack contents sign Sign a pack publish Publish pack to registryCreating a Pack
Section titled “Creating a Pack”-
Create pack directory structure
Terminal window mkdir -p my-pack/{flows,components,assets} -
Create pack manifest
my-pack/pack.toml [pack]name = "my-feature"version = "1.0.0"description = "My awesome feature pack"authors = ["Your Name <you@example.com>"][capabilities]id = "greentic.cap.app.v1"provides = ["my-feature"][flows]main = "flows/main.ygtc"[components]processor = "components/processor.wasm"[assets]templates = "assets/templates/" -
Add flows
my-pack/flows/main.ygtc name: mainversion: "1.0"description: Main flownodes:- id: processtype: replyconfig:message: "Hello from my pack!"triggers:- type: messagetarget: process -
Add components (if any)
Build WASM components and place in
components/:Terminal window cd my-componentcargo build --target wasm32-wasip2 --releasecp target/wasm32-wasip2/release/my_component.wasm ../my-pack/components/
Building Packs
Section titled “Building Packs”Basic Build
Section titled “Basic Build”gtc pack build ./my-pack
# Output: my-feature-1.0.0.gtpackBuild with Options
Section titled “Build with Options”# Specify output pathgtc pack build ./my-pack --output ./dist/my-feature.gtpack
# Skip WASM optimizationgtc pack build ./my-pack --no-optimize
# Include debug infogtc pack build ./my-pack --debugBuild Output
Section titled “Build Output”Directorymy-feature-1.0.0.gtpack
- manifest.cbor
Directoryflows/
- main.ygtc
Directorycomponents/
- processor.wasm
Directoryassets/
Directorytemplates/
- …
- sbom.json
Signing Packs
Section titled “Signing Packs”Generate Signing Key
Section titled “Generate Signing Key”# Generate new Ed25519 key pairgtc pack keygen --output my-signing-key
# Creates:# - my-signing-key.pem (private key - keep secret!)# - my-signing-key.pub (public key - distribute)Sign a Pack
Section titled “Sign a Pack”gtc pack sign my-feature-1.0.0.gtpack --key my-signing-key.pem
# Output: my-feature-1.0.0.gtpack (updated with signature)Verify Signature
Section titled “Verify Signature”gtc pack verify my-feature-1.0.0.gtpack --pubkey my-signing-key.pub
# Output: Signature validPack Inspection
Section titled “Pack Inspection”View Metadata
Section titled “View Metadata”gtc pack info my-feature-1.0.0.gtpackOutput:
Pack: my-featureVersion: 1.0.0Description: My awesome feature packAuthors: Your Name <you@example.com>
Capabilities: ID: greentic.cap.app.v1 Provides: my-feature
Contents: Flows: 1 Components: 1 Assets: 2 directories
Signature: Valid (signed by: ABC123...)List Contents
Section titled “List Contents”gtc pack info my-feature-1.0.0.gtpack --list
# Lists all files in the packExtract Pack
Section titled “Extract Pack”gtc pack extract my-feature-1.0.0.gtpack --output ./extracted/
# Extracts pack contents for inspectionFlow Validation
Section titled “Flow Validation”Validate Flows
Section titled “Validate Flows”# Validate all flows in a directorygtc flow doctor ./my-pack/flows/
# Validate specific flowgtc flow validate ./my-pack/flows/main.ygtcDoctor Output
Section titled “Doctor Output”gtc flow doctor ./flows/
# Output:# Checking flows/main.ygtc... OK# Checking flows/helper.ygtc... OK## 2 flows checked, 0 errors, 0 warningsCommon Validation Errors
Section titled “Common Validation Errors”| Error | Cause | Fix |
|---|---|---|
Unknown node type | Invalid node type | Check available node types |
Missing target node | Edge points to non-existent node | Fix node ID reference |
Circular dependency | Nodes form a cycle | Break the cycle |
No trigger defined | Flow has no entry point | Add a trigger |
Publishing Packs
Section titled “Publishing Packs”Publish to OCI Registry
Section titled “Publish to OCI Registry”# Login to registrygtc pack login ghcr.io --username USER --password TOKEN
# Publish packgtc pack publish my-feature-1.0.0.gtpack --registry ghcr.io/greenticPull from Registry
Section titled “Pull from Registry”gtc pack pull ghcr.io/greentic/my-feature:1.0.0Use in Bundle
Section titled “Use in Bundle”apps: my-app: pack: "oci://ghcr.io/greentic/my-feature:1.0.0"Pack Templates
Section titled “Pack Templates”Provider Pack Template
Section titled “Provider Pack Template”[pack]name = "messaging-custom"version = "1.0.0"description = "Custom messaging provider"
[capabilities]id = "greentic.cap.messaging.provider.v1"provides = ["custom"]
[flows]setup_default = "flows/setup.ygtc"verify_webhooks = "flows/verify.ygtc"
[components]ingress = "components/ingress.wasm"egress = "components/egress.wasm"operator = "components/operator.wasm"
[secrets]required = ["api_key"]optional = ["webhook_secret"]Application Pack Template
Section titled “Application Pack Template”[pack]name = "helpdesk-bot"version = "1.0.0"description = "IT Helpdesk bot"
[capabilities]id = "greentic.cap.app.v1"provides = ["helpdesk"]
[dependencies]greentic-templates = "^0.4"greentic-llm-openai = "^0.4"
[flows]on_message = "flows/on_message.ygtc"on_ticket = "flows/on_ticket.ygtc"
[assets]cards = "assets/cards/"templates = "assets/templates/"Best Practices
Section titled “Best Practices”- Version semantically - Use semver (MAJOR.MINOR.PATCH)
- Sign all releases - Never distribute unsigned packs
- Include SBOM - Document dependencies for security audits
- Test before publishing - Validate flows and test components
- Document thoroughly - Include README in pack
- Keep packs focused - One feature or provider per pack
- Use CI/CD - Automate build and publish
CI/CD Example
Section titled “CI/CD Example”name: Build and Publish Pack
on: push: tags: - 'v*'
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Install Rust uses: dtolnay/rust-toolchain@1.90.0
- name: Build Pack run: gtc pack build ./my-pack
- name: Sign Pack run: | echo "${{ secrets.SIGNING_KEY }}" > key.pem gtc pack sign my-feature-*.gtpack --key key.pem
- name: Publish run: | gtc pack login ghcr.io --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} gtc pack publish my-feature-*.gtpack --registry ghcr.io/${{ github.repository }}Next Steps
Section titled “Next Steps”- Pack Format Reference - Complete specification
- Flow Schema Reference - YAML schema
- Components Guide - Building WASM components