Skip to main content

Local Testing with the SDK

The SDK is the right tool for local scripts, local verification, and agent-driven smoke tests against a deployed org.

Install

npm install @w7s-io/sdk drizzle-orm

Required environment

The SDK reads from process environment:

export W7S_ORG_URL="https://omattic.w7s.cloud"
export W7S_REPO="omattic/my-app"
export GITHUB_TOKEN="<your-token>"

Supported patterns:

  • W7S_ORG_URL=https://guerrerocarlos.w7s.cloud
  • W7S_ORG_URL=guerrerocarlos.w7s.cloud

Local invoke example

import { createW7SClient } from "@w7s-io/sdk";

const client = createW7SClient({
orgUrl: process.env.W7S_ORG_URL,
token: process.env.GITHUB_TOKEN,
repo: process.env.W7S_REPO,
});

const result = await client.invoke("agent", ["Say hello in one sentence"]);
console.log(result);

Local DB status example

import { createW7SClient } from "@w7s-io/sdk";

const client = createW7SClient({
orgUrl: process.env.W7S_ORG_URL,
token: process.env.GITHUB_TOKEN,
repo: process.env.W7S_REPO,
});

const status = await client.db.status({
database: "app",
migrations: [],
});

console.log(status);

Local Drizzle example

import { desc } from "drizzle-orm";
import { createW7SDbClient } from "@w7s-io/sdk";
import * as schema from "./schema.js";

const db = createW7SDbClient({
repo: process.env.W7S_REPO,
databaseName: "app",
schema,
});

const rows = await db
.select()
.from(schema.notes)
.orderBy(desc(schema.notes.createdAtMs))
.limit(10);

console.log(rows);

Mirror snapshot example

import { createW7SClient } from "@w7s-io/sdk";

const client = createW7SClient({
orgUrl: process.env.W7S_ORG_URL,
token: process.env.GITHUB_TOKEN,
repo: process.env.W7S_REPO,
});

const rows = await client.mirrors.snapshot.rows({
database: "app",
mirrorId: "config",
});

console.log(rows);

Use the SDK locally for:

  • smoke tests after deploy
  • quick DB checks
  • validating plugin config
  • agent-run scripts that need typed access to runtime capabilities

Do not build a second local-only backend abstraction if the SDK already provides the surface you need.