Chapter 5: Hello, Pack!
TL;DR
- Create the pack:
worka init --tenant <your-github-username> --name my-first-pack
- Navigate into the directory:
cd my-first-pack
- Start the dev server:
worka dev
- View in Worka: Open the Worka application. Your pack will appear in the sidebar under the "Development" section. Click it to see the starter UI.
With your environment set up, you're ready for the most exciting part: creating and running your very first pack. This is the "Hello, World!" of Worka development.
Step 1: Scaffold Your Pack with worka init
The Worka CLI provides a command to generate a complete starter template for a new pack. Open your terminal and navigate to the directory where you want to store your projects.
Run the following command:
worka init --tenant <your-github-username> --name my-first-pack
Let's break down the arguments:
--tenant
: This is a namespace for your packs, similar to a publisher ID. It prevents name collisions with packs from other developers. Using your GitHub username is a common and recommended convention.--name
: This is the machine-readable name of your pack. It should be lowercase and use hyphens instead of spaces.
The CLI will ask you for a human-readable display_name
and then create a new folder named my-first-pack
with all the necessary starter files.
Step 2: Explore the Generated Files
Navigate into the new directory (cd my-first-pack
). You will see the structure we discussed in Chapter 2:
my-first-pack/
├── aip.json
├── views/
│ └── MainView.tsx
└── mcp/
└── ...
- The
aip.json
is pre-filled with your tenant and name. - The
views/
directory contains a simple starter UI component. - The
mcp/
directory contains a basic backend server with a placeholder tool.
Step 3: Start the Development Server
This is where the magic happens. While inside the my-first-pack
directory, run:
worka dev
This single command kicks off a powerful development process:
- It immediately does an initial bundle of your pack.
- It starts a file watcher that monitors all your pack's source files for changes.
- It starts a local server to communicate with the main Worka Host application.
Any time you save a file, the CLI will automatically re-bundle your pack and instantly notify the Worka application to hot-reload the changes. This creates a fast and seamless development loop.
Step 4: See Your Pack in Worka
With the worka dev
command still running in your terminal, open (or switch to) the main Worka desktop application.
In the sidebar on the left, you should see a new section labeled Development, and inside it, an item for "My First Pack". Click on it.
The main content area of Worka will now display the simple user interface from your pack's views/MainView.tsx
file.
Congratulations! You have successfully created, run, and viewed your first AI Pack.