Zum Inhalt springen

Packs erstellen

Packs sind die Distributionseinheit in Greentic. Diese Anleitung behandelt das Erstellen, Bauen, Signieren und Veröffentlichen von Packs mit den CLI-Tools.

Terminal-Fenster
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 registry
  1. Pack-Verzeichnisstruktur erstellen

    Terminal-Fenster
    mkdir -p my-pack/{flows,components,assets}
  2. Pack-Manifest erstellen

    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/"
  3. Flows hinzufügen

    my-pack/flows/main.ygtc
    name: main
    version: "1.0"
    description: Main flow
    nodes:
    - id: process
    type: reply
    config:
    message: "Hello from my pack!"
    triggers:
    - type: message
    target: process
  4. Komponenten hinzufügen (falls vorhanden)

    WASM-Komponenten bauen und in components/ ablegen:

    Terminal-Fenster
    cd my-component
    cargo build --target wasm32-wasip2 --release
    cp target/wasm32-wasip2/release/my_component.wasm ../my-pack/components/
Terminal-Fenster
gtc pack build ./my-pack
# Output: my-feature-1.0.0.gtpack
Terminal-Fenster
# Specify output path
gtc pack build ./my-pack --output ./dist/my-feature.gtpack
# Skip WASM optimization
gtc pack build ./my-pack --no-optimize
# Include debug info
gtc pack build ./my-pack --debug
  • Ordnermy-feature-1.0.0.gtpack
    • manifest.cbor
    • Ordnerflows/
      • main.ygtc
    • Ordnercomponents/
      • processor.wasm
    • Ordnerassets/
      • Ordnertemplates/
    • sbom.json
Terminal-Fenster
# Generate new Ed25519 key pair
gtc pack keygen --output my-signing-key
# Creates:
# - my-signing-key.pem (private key - keep secret!)
# - my-signing-key.pub (public key - distribute)
Terminal-Fenster
gtc pack sign my-feature-1.0.0.gtpack --key my-signing-key.pem
# Output: my-feature-1.0.0.gtpack (updated with signature)
Terminal-Fenster
gtc pack verify my-feature-1.0.0.gtpack --pubkey my-signing-key.pub
# Output: Signature valid
Terminal-Fenster
gtc pack info my-feature-1.0.0.gtpack

Ausgabe:

Pack: 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
Contents:
Flows: 1
Components: 1
Assets: 2 directories
Signature: Valid (signed by: ABC123...)
Terminal-Fenster
gtc pack info my-feature-1.0.0.gtpack --list
# Lists all files in the pack
Terminal-Fenster
gtc pack extract my-feature-1.0.0.gtpack --output ./extracted/
# Extracts pack contents for inspection
Terminal-Fenster
# Validate all flows in a directory
gtc flow doctor ./my-pack/flows/
# Validate specific flow
gtc flow validate ./my-pack/flows/main.ygtc
Terminal-Fenster
gtc flow doctor ./flows/
# Output:
# Checking flows/main.ygtc... OK
# Checking flows/helper.ygtc... OK
#
# 2 flows checked, 0 errors, 0 warnings
FehlerUrsacheLösung
Unknown node typeUngültiger KnotentypVerfügbare Knotentypen prüfen
Missing target nodeEdge verweist auf einen nicht existierenden KnotenReferenz auf die Knoten-ID korrigieren
Circular dependencyKnoten bilden einen ZyklusDen Zyklus aufbrechen
No trigger definedFlow hat keinen EinstiegspunktEinen Trigger hinzufügen
Terminal-Fenster
# Login to registry
gtc pack login ghcr.io --username USER --password TOKEN
# Publish pack
gtc pack publish my-feature-1.0.0.gtpack --registry ghcr.io/greentic
Terminal-Fenster
gtc pack pull ghcr.io/greentic/my-feature:1.0.0
greentic.demo.yaml
apps:
my-app:
pack: "oci://ghcr.io/greentic/my-feature:1.0.0"
pack.toml
[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"]
pack.toml
[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/"
  1. Semantisch versionieren - Verwende semver (MAJOR.MINOR.PATCH)
  2. Alle Releases signieren - Verteile niemals unsignierte Packs
  3. SBOM einbinden - Dokumentiere Abhängigkeiten für Sicherheitsprüfungen
  4. Vor dem Veröffentlichen testen - Flows validieren und Komponenten testen
  5. Gründlich dokumentieren - Eine README in das Pack aufnehmen
  6. Packs fokussiert halten - Ein Feature oder Provider pro Pack
  7. CI/CD verwenden - Build und Veröffentlichung automatisieren
.github/workflows/pack.yml
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 }}