mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
chore(rename): finish Stack→Hexclave in dev-tool & AI prompts
Rename leftover "Stack" branding in the dev-tool copyable component prompts and AI-assistant prompts: - page-component-versions.ts: prose + switch example identifiers to the canonical Hexclave aliases (useHexclaveApp, HexclaveServerApp, HexclaveClientApp) - dev-tool-core.ts: log download filename → hexclave-dev-tool-logs - prompts.ts / shared-prompt.ts: "Stack API/SDK" → "Hexclave API/SDK" - reminders.ts: "Stack App" → "Hexclave App", useStackApp → useHexclaveApp Keeps intentional X-Stack-* backwards-compat aliases, the stack_mfa_attempt_code storage key, and the "formerly Stack Auth" note.
This commit is contained in:
parent
8043109bae
commit
521e810f72
@ -451,7 +451,7 @@ Authentication is handled automatically - the SDK fetches access tokens from the
|
||||
You MUST NOT create a new HexclaveServerApp or HexclaveAdminApp instance.
|
||||
You MUST NOT use fetch() directly.
|
||||
|
||||
IMPORTANT: All Stack API calls are async and may fail. ALWAYS:
|
||||
IMPORTANT: All Hexclave API calls are async and may fail. ALWAYS:
|
||||
1. Wrap API calls in try-catch blocks
|
||||
2. Set error state when calls fail
|
||||
3. Show user-friendly error messages (not technical details)
|
||||
@ -497,7 +497,7 @@ RUNTIME CONTRACT (HARD RULES)
|
||||
- Use hooks via the React global object: React.useState, React.useEffect, React.useCallback
|
||||
- DashboardUI components are available via the global DashboardUI object (e.g. DashboardUI.DesignMetricCard)
|
||||
- Recharts is available via the global Recharts object (e.g. Recharts.BarChart)
|
||||
- Use hexclaveServerApp for all Stack API calls
|
||||
- Use hexclaveServerApp for all Hexclave API calls
|
||||
- Both light and dark mode are supported automatically — do NOT hardcode colors
|
||||
|
||||
No import/export/require statements. No external networking calls.
|
||||
@ -750,7 +750,7 @@ Use DashboardUI.getDesignChartColor(index) for consistent chart colors.
|
||||
Use "hsl(var(--border))" for CartesianGrid stroke and "hsl(var(--muted-foreground))" for axis tick fill.
|
||||
|
||||
TYPE DEFINITIONS
|
||||
The type definitions for the Stack SDK and dashboard UI components will be provided in the user messages.
|
||||
The type definitions for the Hexclave SDK and dashboard UI components will be provided in the user messages.
|
||||
Use them to determine available fields, methods, prop types, and variants.
|
||||
|
||||
CLICKHOUSE ANALYTICS
|
||||
|
||||
@ -44,7 +44,7 @@ export async function selectRelevantFiles(
|
||||
|
||||
const systemPromptText = `You are a code assistant helping to generate dashboard code for Hexclave.
|
||||
|
||||
Your task is to select which Stack SDK type definition files you'll need to generate the requested dashboard.
|
||||
Your task is to select which Hexclave SDK type definition files you'll need to generate the requested dashboard.
|
||||
|
||||
IMPORTANT GUIDELINES:
|
||||
- DO NOT be conservative in file selection - when in doubt, INCLUDE the file
|
||||
@ -129,7 +129,7 @@ ${stripComments(file.content)}
|
||||
|
||||
return `
|
||||
Complete Hexclave SDK Type Definitions (Selected Files):
|
||||
These files show the available methods, types, and interfaces for the Stack SDK.
|
||||
These files show the available methods, types, and interfaces for the Hexclave SDK.
|
||||
${fileContents.join('\n')}
|
||||
`.trim();
|
||||
}
|
||||
@ -184,7 +184,7 @@ export async function buildDashboardMessages(
|
||||
} else {
|
||||
contextMessages.push({
|
||||
role: "user",
|
||||
content: `Here are the type definitions for the Stack SDK:\n${typeDefinitions}\n\n${dashboardUiDocsHeader}\n${BUNDLED_DASHBOARD_UI_TYPES}${availableRoutes}`,
|
||||
content: `Here are the type definitions for the Hexclave SDK:\n${typeDefinitions}\n\n${dashboardUiDocsHeader}\n${BUNDLED_DASHBOARD_UI_TYPES}${availableRoutes}`,
|
||||
});
|
||||
contextMessages.push({
|
||||
role: "assistant",
|
||||
|
||||
@ -21,7 +21,7 @@ export const remindersPrompt = deindent`
|
||||
- The \`Result<T, E>\` type is \`{ status: "ok", data: T } | { status: "error", error: E }\`.
|
||||
- \`KnownErrors[KNOWN_ERROR_CODE]\` refers to a specific known error type. Each KnownError may have its own properties, but they all inherit from \`Error & { statusCode: number, humanReadableMessage: string, details?: Json }\`.
|
||||
- React & Next.js:
|
||||
- Almost all \`getXyz\` and \`listXyz\` functions on the Stack App have corresponding \`useXyz\` hooks that suspend the current component until the data is available. Make sure there is a Suspense boundary in place if you're using this pattern. The parameter and return types are identical except that the hooks don't return promises.
|
||||
- There is a \`useStackApp()\` hook as a named export from the package itself that serves as a shortcut to get the current Stack App object from the React context. Similarly, the \`useUser(...args)\` named export is short for \`useStackApp().useUser(...args)\`.
|
||||
- Almost all \`getXyz\` and \`listXyz\` functions on the Hexclave App have corresponding \`useXyz\` hooks that suspend the current component until the data is available. Make sure there is a Suspense boundary in place if you're using this pattern. The parameter and return types are identical except that the hooks don't return promises.
|
||||
- There is a \`useHexclaveApp()\` hook as a named export from the package itself that serves as a shortcut to get the current Hexclave App object from the React context. Similarly, the \`useUser(...args)\` named export is short for \`useHexclaveApp().useUser(...args)\`.
|
||||
- Hexclave was formerly known as Stack Auth. You may still see reference to it as Stack Auth in some places.
|
||||
`;
|
||||
|
||||
@ -67,10 +67,10 @@ function createCustomPagePrompt(options: {
|
||||
${options.reactExample}
|
||||
\`\`\`
|
||||
|
||||
When you're done, please update the file where the Stack app is configured with its URLs, to make sure it points to this page. For example, you may have an object declared like this:
|
||||
When you're done, please update the file where the Hexclave app is configured with its URLs, to make sure it points to this page. For example, you may have an object declared like this:
|
||||
|
||||
\`\`\`tsx
|
||||
export const hexclaveServerApp = new StackServerApp({
|
||||
export const hexclaveServerApp = new HexclaveServerApp({
|
||||
tokenStore: "nextjs-cookie",
|
||||
urls: {
|
||||
default: {
|
||||
@ -159,7 +159,7 @@ function createAuthPagePrompt(type: AuthPagePromptType): CustomPagePrompt {
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function Custom${isSignIn ? "SignIn" : "SignUp"}Page() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ includeRestricted: true });
|
||||
const project = hexclaveApp.useProject();
|
||||
const [otpState, setOtpState] = useState<null | { nonce: string }>(null);
|
||||
@ -347,7 +347,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
|
||||
export default function CustomSignOutPage() {
|
||||
const user = useUser({ or: "return-null" });
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
|
||||
if (user) {
|
||||
use(cacheSignOut(user));
|
||||
@ -390,7 +390,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomEmailVerificationPage(props: { searchParams?: Record<string, string> }) {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const [result, setResult] = useState<Awaited<ReturnType<typeof hexclaveApp.verifyEmail>> | null>(null);
|
||||
const code = props.searchParams?.code;
|
||||
|
||||
@ -461,7 +461,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomPasswordResetPage(props: { searchParams: Record<string, string> }) {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const code = props.searchParams.code;
|
||||
const [password, setPassword] = useState("");
|
||||
const [passwordRepeat, setPasswordRepeat] = useState("");
|
||||
@ -469,7 +469,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
const [failed, setFailed] = useState(false);
|
||||
const [formError, setFormError] = useState<string | null>(null);
|
||||
|
||||
const cachedVerifyPasswordResetCode = cacheFunction(async (app: StackClientApp<true>, codeToVerify: string) => {
|
||||
const cachedVerifyPasswordResetCode = cacheFunction(async (app: HexclaveClientApp<true>, codeToVerify: string) => {
|
||||
return await app.verifyPasswordResetCode(codeToVerify);
|
||||
});
|
||||
|
||||
@ -533,7 +533,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomForgotPasswordPage() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "return-null" });
|
||||
const [email, setEmail] = useState("");
|
||||
const [sent, setSent] = useState(false);
|
||||
@ -592,7 +592,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomOAuthCallbackPage() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const called = useRef(false);
|
||||
const [error, setError] = useState<unknown>(null);
|
||||
const [showRedirectLink, setShowRedirectLink] = useState(false);
|
||||
@ -651,7 +651,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomMagicLinkCallbackPage(props: { searchParams?: Record<string, string> }) {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "return-null" });
|
||||
const [result, setResult] = useState<Awaited<ReturnType<typeof hexclaveApp.signInWithMagicLink>> | null>(null);
|
||||
const code = props.searchParams?.code;
|
||||
@ -830,7 +830,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
}
|
||||
|
||||
function PasswordSection() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "redirect" });
|
||||
const project = hexclaveApp.useProject();
|
||||
const [oldPassword, setOldPassword] = useState("");
|
||||
@ -861,7 +861,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
}
|
||||
|
||||
function PasskeySection() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "redirect" });
|
||||
const project = hexclaveApp.useProject();
|
||||
const hasVerifiedAuthEmail = user.useContactChannels().some((x) => x.type === "email" && x.isVerified && x.usedForAuth);
|
||||
@ -888,7 +888,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
}
|
||||
|
||||
function OtpSection() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "redirect" });
|
||||
const project = hexclaveApp.useProject();
|
||||
const hasVerifiedAuthEmail = user.useContactChannels().some((x) => x.type === "email" && x.isVerified && x.usedForAuth);
|
||||
@ -1039,7 +1039,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
<Typography>{product.displayName}</Typography>
|
||||
{product.subscription?.isCancelable ? (
|
||||
<Button variant="secondary" onClick={async () => {
|
||||
await useStackApp().cancelSubscription({
|
||||
await useHexclaveApp().cancelSubscription({
|
||||
...(props.customerType === "team" ? { teamId: props.customer.id } : {}),
|
||||
productId: product.id ?? "",
|
||||
subscriptionId: product.subscription?.subscriptionId ?? undefined,
|
||||
@ -1064,7 +1064,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
|
||||
function TeamSection(props: { team: { displayName: string } }) {
|
||||
const user = useUser({ or: "redirect" });
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const project = hexclaveApp.useProject();
|
||||
const team = user.useTeam((props.team as any).id);
|
||||
|
||||
@ -1148,7 +1148,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
}
|
||||
|
||||
function CreateTeamSection() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "redirect" });
|
||||
const project = hexclaveApp.useProject();
|
||||
const navigate = hexclaveApp.useNavigate();
|
||||
@ -1180,7 +1180,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
<Button onClick={async () => await user.signOut()}>Sign out</Button>
|
||||
<Button variant="destructive" onClick={async () => {
|
||||
await user.delete();
|
||||
await useStackApp().redirectToHome();
|
||||
await useHexclaveApp().redirectToHome();
|
||||
}}>
|
||||
Delete account
|
||||
</Button>
|
||||
@ -1189,7 +1189,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
}
|
||||
|
||||
export default function CustomAccountSettingsPage(props: { extraItems?: { id: string, title: string, content: React.ReactNode }[] }) {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "redirect" });
|
||||
const project = hexclaveApp.useProject();
|
||||
const teams = user.useTeams();
|
||||
@ -1303,7 +1303,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomTeamInvitationPage(props: { searchParams: Record<string, string> }) {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "return-null", includeRestricted: true });
|
||||
const code = props.searchParams.code;
|
||||
const [accepted, setAccepted] = useState(false);
|
||||
@ -1486,7 +1486,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
}
|
||||
|
||||
export default function CustomMfaPage() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const [otp, setOtp] = useState("");
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@ -1558,7 +1558,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomErrorPage(props: { searchParams: Record<string, string> }) {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const errorCode = props.searchParams.errorCode;
|
||||
const message = props.searchParams.message;
|
||||
const details = props.searchParams.details;
|
||||
@ -1624,7 +1624,7 @@ export function getCustomPagePrompts(): Record<PageComponentKey, CustomPagePromp
|
||||
`,
|
||||
reactExample: deindent`
|
||||
export default function CustomOnboardingPage() {
|
||||
const hexclaveApp = useStackApp();
|
||||
const hexclaveApp = useHexclaveApp();
|
||||
const user = useUser({ or: "return-null", includeRestricted: true });
|
||||
const [email, setEmail] = useState("");
|
||||
const [changeEmail, setChangeEmail] = useState(false);
|
||||
|
||||
@ -1120,7 +1120,7 @@ function createConsoleTab(logStore: LogStore): TabResult {
|
||||
exportBtn.addEventListener('click', () => {
|
||||
const blob = new Blob([formatLogsForExport()], { type: 'text/plain;charset=utf-8' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = h('a', { href: url, download: `stack-auth-dev-tool-logs-${new Date().toISOString()}.txt` });
|
||||
const link = h('a', { href: url, download: `hexclave-dev-tool-logs-${new Date().toISOString()}.txt` });
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user