mirror of
https://github.com/stack-auth/stack.git
synced 2026-07-20 21:29:36 +08:00
Add LLM metadata endpoints (#1499)
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import path from "path";
|
||||
import { readFileSync } from "fs";
|
||||
import { aiSetupPrompt, cliSetupPrompt, convexSetupPrompt, getSdkSetupPrompt, supabaseSetupPrompt } from "../packages/stack-shared/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt";
|
||||
import { deindent } from "../packages/stack-shared/src/utils/strings";
|
||||
import { writeFileSyncIfChanged } from "./utils";
|
||||
import { remindersPrompt } from "../packages/stack-shared/src/ai/unified-prompts/reminders";
|
||||
import { buildLlmsFullTxt } from "../packages/stack-shared/src/ai/llms/llms";
|
||||
|
||||
const generatedComment = "This file is auto-generated by scripts/generate-setup-prompt-docs.ts. Do not edit it manually; edit packages/stack-shared/src/ai/unified-prompts/skill-site-prompt-parts/ai-setup-prompt.ts instead.";
|
||||
type SdkSetupToolCategory = "frontend" | "backend" | "database" | "other";
|
||||
@@ -15,6 +18,7 @@ type SdkSetupTool = {
|
||||
};
|
||||
|
||||
const repoRoot = path.resolve(__dirname, "..");
|
||||
const docsJson = JSON.parse(readFileSync(path.join(repoRoot, "docs-mintlify/docs.json"), "utf-8"));
|
||||
const setupPromptText = aiSetupPrompt;
|
||||
|
||||
const sdkSetupTools: Record<string, SdkSetupTool> = {
|
||||
@@ -274,6 +278,17 @@ function renderUnifiedAiPromptTab() {
|
||||
`;
|
||||
}
|
||||
|
||||
writeFileSyncIfChanged(
|
||||
path.join(repoRoot, "packages/stack-shared/src/ai/unified-prompts/skill-site-prompt-parts/docs-json.generated.ts"),
|
||||
deindent`
|
||||
// This file is generated from docs-mintlify/docs.json.
|
||||
|
||||
const docsJson = ${JSON.stringify(docsJson, null, 2)} as const;
|
||||
|
||||
export default docsJson;
|
||||
` + "\n",
|
||||
);
|
||||
|
||||
writeFileSyncIfChanged(
|
||||
path.join(repoRoot, "docs-mintlify/snippets/home-prompt-island.jsx"),
|
||||
deindent`
|
||||
@@ -309,6 +324,7 @@ writeFileSyncIfChanged(
|
||||
export const generatedSetupPromptText = ${JSON.stringify(setupPromptText)};
|
||||
export const setupToolIds = ${JSON.stringify(setupToolIds)};
|
||||
export const setupTabMetadata = ${JSON.stringify(setupTabMetadata)};
|
||||
import { HexclaveAgentReminders } from "/snippets/hexclave-agent-reminders.jsx";
|
||||
export const unifiedAiPromptTabTitle = ${JSON.stringify(unifiedAiPromptTabTitle)};
|
||||
|
||||
export const copyGeneratedSetupPrompt = async (event) => {
|
||||
@@ -420,6 +436,8 @@ writeFileSyncIfChanged(
|
||||
updateSetupBuilder(root);
|
||||
};
|
||||
|
||||
<HexclaveAgentReminders />
|
||||
|
||||
<Note>
|
||||
<p className="font-semibold">Setting up with AI? Use this single prompt:</p>
|
||||
<div className="not-prose relative mt-3">
|
||||
@@ -462,3 +480,20 @@ writeFileSyncIfChanged(
|
||||
</div>
|
||||
` + "\n",
|
||||
);
|
||||
|
||||
|
||||
writeFileSyncIfChanged(
|
||||
path.join(repoRoot, "docs-mintlify/snippets/hexclave-agent-reminders.jsx"),
|
||||
deindent`
|
||||
export const hexclaveReminders = ${JSON.stringify(remindersPrompt)};
|
||||
|
||||
export const HexclaveAgentReminders = () => (
|
||||
<pre>{hexclaveReminders}</pre>
|
||||
);
|
||||
` + "\n",
|
||||
);
|
||||
|
||||
writeFileSyncIfChanged(
|
||||
path.join(repoRoot, "docs-mintlify/llms-full.txt"),
|
||||
buildLlmsFullTxt(docsJson).replace(/[ \t]+$/gm, "") + "\n",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user