Skip to content

@mochabug/adaptkit

Adaptkit is the command-line tool for Adapt applications. It creates projects, adds vertices, installs the agent skills, runs the local emulator, and uploads your application.

Adaptkit needs Node.js 24 or newer.

Terminal window
npm install --global @mochabug/adaptkit@latest

Or run it without installing: npx --yes --package @mochabug/adaptkit@latest adaptkit <command>. Generated projects also include Adaptkit, and their npm scripts use that copy.

Adaptkit tells you once a day when a new version exists. To turn this off, set NO_UPDATE_NOTIFIER=1 or pass --no-update-check. After an update, refresh the agent skills with adaptkit skill.

Command What it does
adaptkit init Creates an application with its first vertex.
adaptkit add Adds a vertex.
adaptkit skill Installs or refreshes the agent skills.
adaptkit emulator Starts the emulator. Also setup, stop, and logs.
adaptkit emulate Uploads a build to the emulator.
adaptkit publish Publishes a build to Adapt.
adaptkit version Raises the version in manifest.json.

Each command has --help.

Creates a project and its first vertex, installs the dependencies, and installs the agent skills. Without options, a wizard asks for each choice.

Terminal window
adaptkit init --dir ./ticket_form --name ticket_form --vertex ticket_form \
--capabilities browser configurator --endpoints http --api http \
--frontend react --ssg --no-interactive
Option Description
-d, --dir <directory> Project folder. Default: the current folder.
--name <name> Application name.
--vertex <name> First vertex name.
--capabilities <values...> browser, configurator, cron, external, or none alone.
--endpoints <values...> http, tcp, datagram. Required with browser or external.
--api <protocol> http or connect. Required for HTTP: Browser pages, settings pages, and External HTTP.
--frontend <framework> typescript or react. Required with browser or configurator.
--ssg, --no-ssg Render pages at build time, or not. Required with pages.
--no-interactive Never ask. Fail when a choice is missing.

Names use letters, numbers, and underscores, and start with a letter or underscore. Adaptkit makes them lowercase.

Capabilities decide what the vertex can do. See Capabilities.

Capability The vertex gets
none Nothing extra. It runs when the flow reaches it.
browser A page that people use while it runs.
configurator A settings page.
cron Calls on a schedule.
external Endpoints for callers outside Adapt, such as webhooks.

Endpoints: browser needs http. tcp gives raw TCP connections, and datagram, which needs external, gives QUIC datagrams.

API: http gives plain routes. connect gives Connect RPC services from Protocol Buffers, which also accept gRPC and gRPC-Web. Adaptkit sets up Buf and generates the code.

Frontend and SSG: pages in plain TypeScript or React. With --ssg, the build renders each page’s first HTML, so people see content before JavaScript runs. See Browser pages.

Adds a vertex to an existing project. It takes the same options as init, except --vertex, plus these:

Option Description
--name <name> Vertex name.
--folder <path> Folder under src/. Default: src/<name>.
--executor-program <number|new> Executor program in runtime.json, counted from 1, or new. Required without the wizard.
--configurator-program <number|new> Configurator program, for vertices with a settings page. Required without the wizard.
Terminal window
adaptkit add --name ticket_status --capabilities none --executor-program 1 --no-interactive

A new program gets the default runtime and limits: 64 MB of memory, 30 seconds of wall time, and 100 ms of CPU time. See Programs.

Installs the agent skills, or replaces them with the versions in your Adaptkit. Use --dir for another folder.

Terminal window
adaptkit emulator setup # once per user: certificates and local trust
adaptkit emulator # start, and open http://localhost:51001
adaptkit emulator logs # follow the logs
adaptkit emulator stop # stop, and discard the emulator's state
Option Description
--tag <tag> Image tag. Default: latest, which checks Docker Hub for updates.
--no-open Do not open a browser.

See Local emulator.

Uploads an emulator build to the running emulator. npm run emulate builds and uploads in one step. Use -d, --dir for another project folder, and --upload <file> for another upload description. The default is dist/upload.json.

Publishes a production build. npm run publish builds and publishes in one step.

Adaptkit opens your browser to sign in, and prints a link in case the browser does not open. You have 10 minutes. Press Ctrl+C to cancel.

Option Description
-d, --dir <directory> Project folder.
--upload <file> Upload description. Default: dist/upload.json.
--staging Publish to the staging services. Needs a staging build.
-c, --client <id> OAuth client ID for sign-in. Only with --staging.
Terminal window
adaptkit version patch # 1.2.3 → 1.2.4
adaptkit version minor # 1.2.3 → 1.3.0
adaptkit version major # 1.2.3 → 2.0.0

Only manifest.json changes.

Generated projects have these scripts:

Script What it does
npm run dev Starts the development server, with the mock API.
npm run build Installs, type-checks, and builds for production.
npm run emulator Starts the emulator. Also emulator:logs and emulator:stop.
npm run emulate Builds for the emulator, and uploads.
npm run publish Builds for production, and publishes.
npm run add Runs adaptkit add.

build:emulate, build:staging, and publish:staging build and publish for the other environments. Connect projects also have npm run generate for the Protocol Buffers code. There is no test script yet. See Unit tests.

Each build targets one environment, and each upload command accepts only builds for its own.

Script Uploads to Sign-in
npm run publish Production: https://adapt.mochabugapis.com Yes
npm run publish:staging Staging: https://adapt-dev.mochabugapis.com Yes
npm run emulate The emulator: http://localhost:51001 No

All builds use the real APIs. Only npm run dev uses the mock API.

Before it uploads, Adaptkit checks that the build is for the right environment, and validates manifest.json, each vertex.json, and each vertex’s metadata. It never builds your application.

It also resizes logos: the application logo to 80 × 80 pixels, and vertex logos to 40 × 40. SVG files are sent as they are. Each logo must end up at most 25,600 bytes.

Run the same checks without uploading, after npm run build:

scripts/check-artifact.mjs
import { readUploadArtifact } from "@mochabug/adaptkit/upload";
await readUploadArtifact({
root: ".",
upload: "dist/upload.json",
expectedEnvironment: "production",
});
console.log("dist/upload.json is valid");
Problem Solution
Adaptkit refuses your Node.js version. Install Node.js 24 or newer.
--endpoints is required for Browser or External capability Give every option that your capabilities need, or leave out --no-interactive.
--name: Use letters, numbers, and underscores; start with a letter or underscore Use a name such as ticket_form.
The upload rejects the build’s environment. Use the matching script: npm run publish or npm run emulate.
The upload rejects the organization. You changed organization after the build. Build again.
A logo is too large. Use a smaller image, or an SVG file.
The emulator does not start. See emulator troubleshooting.