The knetik CLI
The knetik command comes from @knetikdotdev/cli. In a module repo it is available through the check, test and dev npm scripts. From the host repository, run it directly:
node packages/cli/src/bin.ts <command>knetik <command>
init <id> create a new module repo that already passes check and test keygen print a new vault key (KNETIK_SECRET_KEY) for encrypting connector tokens dev run the module in the current directory in a host with mocks and hot reload check validate the module in the current directory test [files...] run the module's *.test.ts headless add <source>@<sha> install a module from a pinned commit sync regenerate apps/server/src/modules.generated.ts list show installed modules and verify their integrity verify exit non-zero if any installed module differs from its recorded integrity hash
options: --host <dir> (default: cwd), --yes (skip the confirmation prompt)From a module repo
Section titled “From a module repo”knetik init <id>
Section titled “knetik init <id>”Creates a new module repository that already passes check and test: npx knetik init weekly-report. Options: --dir <path> (default ./<id>), --title <text>, and --link <path to a knetik clone> to link that clone’s packages (file:) instead of using npm. It refuses a folder that is not empty. See Create a module.
knetik check
Section titled “knetik check”Validates the module in the current directory. Shared with knetik add, so installs and local checks use one set of rules.
- the manifest loads and validates;
- every agent a stage uses exists, starts with
'use agent', exports a capitalized function and has a namespaced identity; - the input and config schemas convert to JSON Schema;
- files in
fixtures/inputs/*.jsonsatisfy the input schema; - connectors used in code (
ctx.connectors.hasorget) are declared, with a warning for declared but unused ones.
Output is ERROR or warn lines, then ok or FAILED with a summary. It exits non-zero on errors.
knetik test [files...]
Section titled “knetik test [files...]”Runs the module’s *.test.ts files headless with Node’s test runner. With no arguments it finds every *.test.ts under the directory, skipping node_modules and .git. Tests use the real executor on in-memory SQLite, a scripted model and mock connectors. See Testing.
knetik dev
Section titled “knetik dev”Runs the module in a real host with hot reload.
knetik dev --host ../knetik| Option | Meaning |
|---|---|
--host <dir> |
The Knetik checkout to run in. Required in practice: a packaged host is not available yet. |
--port <n> |
Port, default 3000 |
--fresh |
Start with an empty dev database |
It builds the web app once if it is missing, validates the module, links the module repo into the host (stashing any installed copy), and starts the server with a SQLite database, a scripted model and mock connectors. Edits reload the host. State persists in <host>/.knetik/dev/<id>/ unless --fresh. On exit it puts the host back; after a crash, the next add, sync, list or verify restores it.
It reads these optional files from the module repo:
| File | Purpose |
|---|---|
fixtures/dev-model.ts |
export default (prompt) => string: what the model answers |
fixtures/dev-connectors.ts |
export default { slack: { 'chat.postMessage': (params) => ({...}) } }: mock connectors |
fixtures/dev-config.json |
The module’s per-deployment config values |
fixtures/inputs/*.json |
Sample inputs, validated by check |
A connector the module needs but has no mock for counts as not connected: the run waits with “no mock for --live (real connectors and models) is refused.
From the host repo
Section titled “From the host repo”knetik add <source>@<sha>
Section titled “knetik add <source>@<sha>”Installs a module from a pinned commit. A branch or tag is not accepted.
| Source form | Example |
|---|---|
| A local git repository path | ../hello-module |
| GitHub | github:org/repo |
| Any git URL | git+https://example.com/repo.git |
SHA=$(git -C ../hello-module rev-parse HEAD)node packages/cli/src/bin.ts add ../hello-module@$SHAIt clones the repo, resolves the commit, runs the same checks as knetik check, shows the module’s connectors, scopes and pinned MCP server URLs, and asks you to confirm (--yes skips the prompt). Then it vendors the runtime files into apps/server/src/modules/<id>/ (tests, fixtures and lockfiles stay behind), records the source, commit, integrity hash and approver in knetik.modules.json, and regenerates the wiring. The approver defaults to your OS user name, or KNETIK_APPROVER.
Rebuild afterwards: npm run build.
knetik sync
Section titled “knetik sync”Regenerates apps/server/src/modules.generated.ts from the installed modules.
knetik list and knetik verify
Section titled “knetik list and knetik verify”list prints each installed module with ok or MODIFIED (its files no longer match the recorded integrity hash), its source and commit, and who approved it and when. verify does the same and exits non-zero if any module was modified. Use verify in CI.
knetik keygen
Section titled “knetik keygen”Prints a new KNETIK_SECRET_KEY for encrypting connector tokens. Keep it secret and backed up: losing it means every connection must be authorized again. See Connectors.
Known limits
Section titled “Known limits”- Nothing is published to npm yet; modules reference the Knetik packages by
file:path. - There is no record mode for the model or connectors; you script them.
- Windows is untested.