docs / guide / The Cajeta Guide

Chapters — 3. Your first project
  1. Introduction
  2. 0. Introduction
  3. 1. Installation
  4. 2. Kick the tires
  5. 3. Your first project
  6. 4. Running your application
  7. 5. Debugging
  8. 6. Keywords
  9. 7. Comments
  10. 8. Native types
  11. 9. Type kinds
  12. 10. Allocation
  13. 11. Ownership & borrowing
  14. 12. Control flow
  15. 13. Strings & formatting
  16. 14. Templates & wildcards
  17. 15. Lambdas & captures
  18. 16. Operator overloading
  19. 17. Inheritance
  20. 18. Annotations & synthesis
  21. 19. DI & aspects
  22. 20. Error handling
  23. 21. Reflection
  24. 22. Differentiation
  25. 23. Code coverage
  26. 23. Profiling
  27. 24. Notebooks
  28. 25. Writing XPU Kernels

03 — Your first project

Chapter 02 built and ran hello. Now look at what init actually created, and what else the toolchain can make.

The layout

hello/
├── cajeta.json                          # the manifest
├── src/main/cajeta/<package>/*.cajeta   # sources, dirs mirror packages
└── build/                               # outputs (gitignored)

The manifest

cajeta.json has three parts:

  • details — name, version, description, license.
  • settings — capabilities (see chapter 04), dependencies, repositories, and settings.build.entry-method (com.example.basic.Main::main) — the presence of an entry method is what makes this a binary project.
  • tasks — named action pipelines. The archetype ships build, test, clean, lint, and release; you add your own. cajeta tasks lists them:
$ cajeta tasks
  build    Local development build
  clean    Wipe build outputs
  lint     Run native + plugin lint actions
  release  Release build + ship
  test     Unit tests with coverage instrumentation

Project types

cajeta init --list:

ArchetypeWhat you get
basicA binary: entry method, builds to build/exe/<name>
libraryNo entry method: builds to a .cja archive other projects depend on
workspaceA multi-member tree with shared configuration
multi-binaryOne project, several entry points / binaries
meltA curated bundle of dependency versions and properties (a BOM)

A library is the same project minus the entry method:

$ cajeta init library greetlib && cd greetlib
$ cajeta build
# → build/archive/greetlib-0.1.0.cja

cajeta install publishes the .cja into your local repository so sibling projects can depend on it before it’s ever published remotely.

Every artifact kind

The package action turns build outputs into distributables. Shipped today:

FormatOutput
obj-treePer-source native .o tree
uber-irSingle linked LLVM bitcode .bc
uber-archiveOne .cja carrying the project and all transitive deps
static-lib / shared-libNative .a / .so/.dylib/.dll
tarball / zipCompressed binary distributions
containerOCI container image

Deferred (the build tool rejects these with a “deferred slice” error for now): deb, rpm, msi, app-bundle, pkg, dmg, appimage, flatpak, snap.

The wider command surface

One binary does everything; unknown subcommands fall through to your manifest’s tasks (that’s how cajeta run works when a run task exists — chapter 04).

CommandWhat it does
cajeta build / test / cleanProject tasks
cajeta add / remove / upgrade / pinManage dependencies
cajeta install / publishPublish locally / remotely
cajeta info / showInspect the project / a dependency
cajeta depsPrint the dependency tree (text, JSON, CSV)
cajeta archive <cmd>Create, inspect, sign .cja archives
cajeta doc <root>Generate API documentation
cajeta search-skill / list-skills / get-skillsSkill discovery in dependencies
cajeta coverage / verify / verify-reproducible / trustQuality and provenance
cajeta workspace / members / toolchain / which / sandbox-infoEnvironment
cajeta ide / dap / jit-runIDE plugin, debug server, quick runs
cajeta compiler-mcpMCP server (stdio) serving those skills to a coding agent

cajeta --help shows the same list.

Skills, for AI coding agents

The same skills the search-skill / get-skills commands return are also served over the Model Context Protocol by cajeta compiler-mcp — a stdio server built into the compiler, exposing searchSkills, listSkills, and getSkills. Register it with your agent (this repo ships a .mcp.json doing exactly that) and the agent can look up authoritative guidance for a class, package, or language topic before it writes code, instead of guessing.

The corpus is embedded in the binary, so it works with no project, no lockfile, and no network — more than 180 skills covering the language itself (cajeta.language), the toolchain (cajeta.toolchain), and every stdlib package.

Your library ships skills too. Skills are part of the .cja archive format, not a compiler privilege: write them as skills/*.md at your package root, and cajeta build validates, indexes, and embeds them beside the bitcode. Anyone who resolves your dependency gets your guidance offline, pinned to the version they resolved, discoverable by name.

mylib.cja
├── … compiled bitcode members
├── skills/index.json
├── skills/opening-files.md
└── skills/retry-policy.md

The format is a Markdown body under YAML frontmatter (id, applies-to, title, description) — see Skills for the authoring levels and the review checklist, and CompilerMcp for the server’s tools and lifecycle.

For the longer walk — dependencies, publishing, uber-archives end to end — see the build tool reference.

Next: Running your application.

Source: docs/guide/03-your-first-project.md · 3 min · 708 words