stackgen-sdk
v0.1.6
Published
StackGen SDK — Aiden, SRE, and Vault from one client
Readme
StackGen TypeScript SDK
Documentation: https://appcd-dev.github.io/stackgen-sdk/ — Aiden guide, code samples, FAQ, and CI integration.
Install:
npm install stackgen-sdkConstruct the client with an explicit config:
import { readFileSync } from "node:fs";
import { StackgenClient, StackgenConfig } from "stackgen-sdk";
const client = new StackgenClient(
new StackgenConfig({
baseUrl: "https://app.stackgen.com",
apiToken: "stackgen_…",
orgId: "<project-uuid>",
webhookToken: "sg_aios_…", // webhook journeys only
}),
);
const result = await client.aiden.runWebhookAndDownloadReport(
readFileSync("alert.json", "utf8"),
);
console.log(result.sessionId, result.outputPath);
const ask = await client.aiden.runAskAndDownloadArtifact({
message: "Run triage for checkout CPU alert",
entityRefs: [{ name: "observe-uber-triage", type: "workflow" }],
});
console.log(ask.traceId, ask.outputPath);
const alerts = await client.sre.listAlerts();Default environment variables
StackgenConfig.fromEnv() reads only these (optional convenience):
| Variable | Purpose |
|----------|---------|
| STACKGEN_URL | Mothership URL (no path suffix) |
| STACKGEN_TOKEN | API token (stackgen_…) |
| STACKGEN_PROJECT | Project / org UUID (orgId) |
Pass webhookToken, webhookId, timeouts, and artifact paths as StackgenConfig fields — not via env.
const base = StackgenConfig.fromEnv();
const client = new StackgenClient(
new StackgenConfig({
baseUrl: base.baseUrl,
apiToken: base.apiToken,
orgId: base.orgId,
webhookToken: "sg_aios_…",
}),
);Namespaces
client.aiden— webhooks, Ask Guild, sessions, artifact downloadclient.sre— alerts and investigationsclient.vault— secrets (not enabled in this release)
Requires Node.js 18+. All network methods are async.
Pin versions in CI: npm install [email protected].
Documentation: https://appcd-dev.github.io/stackgen-sdk/ (Aiden guide, FAQ, code samples)
