@tektonic-company/autofixer
v0.1.1
Published
Minimal AutoFix ingest SDK for catch blocks and server-side error reporting.
Maintainers
Readme
@tektonic-company/autofixer
Minimal AutoFix ingest SDK for apps that want to report caught errors to the orchestrator with an ingest key.
What it does
- sends a normalized error payload to
POST /v1/ingest/error - uses an org-scoped ingest key
- works in Node and any runtime with
fetch - adds almost no surface area:
capture,captureMessage, andwrap
Install
Use this folder as its own package or publish it as a separate repo/package.
npm install @tektonic-company/autofixerMinimal usage
import { createAutoFixClient } from "@tektonic-company/autofixer";
const autofix = createAutoFixClient({
endpoint: "https://tektonic-auto-fixer-api-production.up.railway.app",
apiKey: process.env.AUTOFIX_INGEST_KEY,
repository: "clawpump-dashboard",
environment: process.env.NODE_ENV ?? "development",
service: "dashboard",
source: "nextjs",
});
try {
await dangerousCall();
} catch (error) {
await autofix.capture(error, {
route: "/checkout",
component: "CheckoutButton",
affectedFiles: ["src/app/checkout/page.tsx"],
context: {
feature: "checkout",
orderId,
},
metadata: {
release: process.env.VERCEL_GIT_COMMIT_SHA ?? "local",
},
});
throw error;
}Wrap helper
await autofix.wrap(async () => {
await dangerousCall();
}, {
context: { feature: "checkout" },
});endpoint is optional. If omitted, the SDK uses Tektonic's hosted AutoFix API. The dashboard-generated setup snippet pins the current hosted endpoint so app code is explicit.
wrap captures the thrown error and then rethrows it.
Payload shape
The SDK sends:
{
"repository": "clawpump-dashboard",
"environment": "production",
"service": "dashboard",
"source": "nextjs",
"message": "boom",
"stack": "Error: boom ...",
"stackFrames": [
{
"function": "submitCheckout",
"file": "src/app/checkout/page.tsx",
"line": 42,
"column": 7
}
],
"affectedFiles": ["src/app/checkout/page.tsx"],
"route": "/checkout",
"component": "CheckoutButton",
"requestId": "req_123",
"release": "abc123",
"commitSha": "abc123",
"occurredAt": "2026-04-23T12:00:00.000Z",
"context": {
"feature": "checkout"
},
"metadata": {
"release": "abc123"
},
"runtime": {
"name": "node",
"version": "v22.0.0"
},
"request": {
"method": "POST",
"path": "/api/checkout"
}
}The request header is:
X-Ingest-Key: your-org-ingest-keyServer config
The current Go API accepts org-scoped ingest keys through:
INGEST_API_KEYS=default:afx_live_default,other-org:afx_live_otherEach entry is organizationSlug:key.
For dashboard-created keys, allowed browser origins are configured per key. For local env-configured keys, configure the API with:
INGEST_ALLOWED_ORIGINS=https://your-app.example.comThe API handles OPTIONS preflight for X-Ingest-Key only for configured origins. Origin filtering is a browser/CORS protection; keep ingest keys secret for server-side usage.
Notes
capturereturns{ ok: false }on request failure instead of throwing.wraprethrows the original application error after reporting it.- context is sanitized so circular objects do not break serialization.
- JavaScript stack traces are parsed into
stackFrames, andaffectedFilesis inferred from frames plus any files you pass explicitly. - Do not send secrets, tokens, cookies, private keys, or full request bodies in
contextorrequest.
License
@tektonic-company/autofixer is licensed under the Business Source License 1.1
(BUSL-1.1). See LICENSE for the Tektonic Additional Use Grant,
Change Date, and Change License.
