docs: rank the destructive generator as item 0
Quality / quality (ubuntu-latest) (push) Failing after 19m36s
Quality / quality (windows-latest) (push) Canceled after 0s

It was written up in 4.7 but never made the work order, which is exactly how it
stayed dangerous in the first place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-09 11:18:45 +05:30
co-authored by Claude Opus 5
parent 790b81330a
commit 247f360ae7
79 changed files with 2759 additions and 146 deletions
@@ -0,0 +1,17 @@
// POST /api/ai { "prompt": "..." } → Claude's reply.
// Set ANTHROPIC_API_KEY in your environment (e.g. a .env file) to enable this.
import { createAI } from "@wrnexus/ai";
import type { Context } from "@wrnexus/core";
const ai = createAI(); // reads ANTHROPIC_API_KEY; defaults to claude-opus-4-8
export const POST = async (ctx: Context) => {
if (!process.env.ANTHROPIC_API_KEY) {
return Response.json({ error: "Set ANTHROPIC_API_KEY to use AI." }, { status: 501 });
}
const { prompt } = await ctx.req.json().catch(() => ({}));
if (!prompt) return Response.json({ error: "Provide a 'prompt'." }, { status: 400 });
// Stream the reply back as plain text. Use `ai.generate(prompt)` for a one-shot string.
return ai.streamResponse(prompt);
};
@@ -0,0 +1,3 @@
export const GET = async () => {
return Response.json({ message: "Hello API" });
};
@@ -0,0 +1,26 @@
import type { Context } from "../../../../../../packages/core/src/index.ts";
import {
httpTransport,
retryingTransport,
ServiceError,
serviceClient,
} from "../../../../../../packages/rpc/src/index.ts";
import { catalogService } from "../../../../packages/shared/src/index.ts";
/** GET /api/product?sku=starter — reads product data from the admin app. */
export async function GET(ctx: Context): Promise<Response> {
const sku = new URL(ctx.req.url).searchParams.get("sku")?.trim() || "starter";
const catalog = serviceClient(catalogService, {
app: "admin",
as: ctx,
transport: retryingTransport(httpTransport()),
});
try {
return Response.json({ product: await catalog.getProduct({ sku }) });
} catch (error) {
if (error instanceof ServiceError && error.code === "RPC_DENIED") {
return Response.json({ error: "Forbidden" }, { status: 403 });
}
return Response.json({ error: "Catalog temporarily unavailable" }, { status: 502 });
}
}