mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
Document init script less
This commit is contained in:
parent
e3e4ac908d
commit
dff454f47f
@ -461,7 +461,7 @@ function ProjectsListPage() {
|
||||
</DialogHeader>
|
||||
<div className="space-y-3">
|
||||
<Typography variant="secondary">
|
||||
Point the local dashboard at the <code>stack.config.ts</code> in your project. If you just ran <code>stack init</code>, it was created at the root of that project.
|
||||
Point the local dashboard at the <code>stack.config.ts</code> in your project.
|
||||
</Typography>
|
||||
<Typography variant="secondary" className="text-xs">
|
||||
Don't have one yet? Paste your project folder path instead and we'll create <code>stack.config.ts</code> for you.
|
||||
|
||||
@ -20,11 +20,11 @@ function escapeHtml(s: string): string {
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
const INSTALL_CMD = "npx @hexclave/cli@latest init";
|
||||
const SETUP_PROMPT_URL = "https://docs.hexclave.com/guides/getting-started/setup";
|
||||
|
||||
function renderHtml(): string {
|
||||
const skillEscaped = escapeHtml(SKILL_MD);
|
||||
const installEscaped = escapeHtml(INSTALL_CMD);
|
||||
const setupPromptUrlEscaped = escapeHtml(SETUP_PROMPT_URL);
|
||||
return `<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@ -166,11 +166,11 @@ function renderHtml(): string {
|
||||
<h1>The Hexclave Agent Skill</h1>
|
||||
<p class="lede">This endpoint serves the canonical <span translate="no">SKILL.md</span> that teaches coding agents how to wire Hexclave into a project — auth, orgs, payments, emails, analytics, and the <span translate="no">hexclave-cli</span>.</p>
|
||||
|
||||
<h2>Install in One Command</h2>
|
||||
<p>Run this in any project root. It detects your agent, installs the skill, registers the MCP server, and writes credentials.</p>
|
||||
<div class="install" role="group" aria-label="Install command">
|
||||
<code id="install-cmd" translate="no">${installEscaped}</code>
|
||||
<button class="copy-btn" type="button" aria-label="Copy install command" data-copy="${installEscaped}">Copy</button>
|
||||
<h2>Set Up with the Prompt</h2>
|
||||
<p>Copy the canonical setup prompt into your coding agent. It contains the current Hexclave setup instructions and links back to this skill for follow-up questions.</p>
|
||||
<div class="install" role="group" aria-label="Setup prompt URL">
|
||||
<code id="install-cmd" translate="no">${setupPromptUrlEscaped}</code>
|
||||
<button class="copy-btn" type="button" aria-label="Copy setup prompt URL" data-copy="${setupPromptUrlEscaped}">Copy</button>
|
||||
</div>
|
||||
|
||||
<h2>Fetch the Skill Directly</h2>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Stack CLI"
|
||||
description: "Use the Hexclave CLI to initialize projects, manage config, and run admin scripts"
|
||||
description: "Use the Hexclave CLI to manage config and run admin scripts"
|
||||
sidebarTitle: "Stack CLI"
|
||||
---
|
||||
|
||||
@ -10,7 +10,7 @@ import { hexclaveAgentRemindersText } from "/snippets/hexclave-agent-reminders.j
|
||||
{hexclaveAgentRemindersText}
|
||||
</Visibility>
|
||||
|
||||
The Hexclave CLI is published as `@hexclave/cli` and exposes the `stack` command. Use it for project setup, branch config workflows, and quick admin scripts.
|
||||
The Hexclave CLI is published as `@hexclave/cli` and exposes the `stack` command. Use it for branch config workflows and quick admin scripts.
|
||||
|
||||
## Install
|
||||
|
||||
@ -29,7 +29,7 @@ stack --help
|
||||
You can also run any command without installing globally by prefixing it with `npx @hexclave/cli@latest`, for example:
|
||||
|
||||
```sh title="Terminal"
|
||||
npx @hexclave/cli@latest init
|
||||
npx @hexclave/cli@latest project list
|
||||
```
|
||||
|
||||
## Global options
|
||||
@ -66,37 +66,6 @@ stack logout
|
||||
|
||||
If you have an anonymous CLI session that should be linked during login, set `STACK_CLI_ANON_REFRESH_TOKEN` before running `login`.
|
||||
|
||||
## Initialize a project
|
||||
|
||||
Run the interactive setup wizard:
|
||||
|
||||
```sh title="Terminal"
|
||||
stack init
|
||||
```
|
||||
|
||||
The wizard can create a cloud project, create a local config file, or link an existing project. In interactive terminals, it can run an agent to apply the setup changes to your app. Use `--no-agent` to print manual setup instructions instead.
|
||||
|
||||
### Non-interactive init
|
||||
|
||||
Use `--mode` to skip prompts:
|
||||
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| `stack init --mode create --apps authentication,teams` | Create `stack.config.ts` for local config-driven development. |
|
||||
| `stack init --mode create-cloud` | Create a new Hexclave Cloud project and write keys to `.env`. |
|
||||
| `stack init --mode link-config --config-file ./stack.config.ts` | Link setup instructions to an existing local config file. |
|
||||
| `stack init --mode link-cloud --select-project-id <id>` | Write keys for an existing cloud project to `.env`. |
|
||||
|
||||
Other useful flags:
|
||||
|
||||
| Option | Description |
|
||||
| --- | --- |
|
||||
| `--apps <apps>` | Comma-separated app IDs to enable in `create` mode. |
|
||||
| `--config-file <path>` | Existing config file for `link-config` mode. |
|
||||
| `--select-project-id <id>` | Existing cloud project for `link-cloud` mode. |
|
||||
| `--output-dir <dir>` | Directory where output files should be written. Defaults to the current directory. |
|
||||
| `--no-agent` | Skip the setup agent and print manual instructions. |
|
||||
|
||||
## Project commands
|
||||
|
||||
List projects owned by the logged-in user:
|
||||
|
||||
@ -17,12 +17,7 @@ Then, run `npx convex dev` to start the Convex backend, and `npm run dev` to sta
|
||||
|
||||
### 2) Install Hexclave
|
||||
|
||||
Next, install Hexclave using the setup wizard:
|
||||
|
||||
```bash
|
||||
cd my-app/ # replace with your app name
|
||||
npx @hexclave/cli@latest init
|
||||
```
|
||||
Next, open your app directory and follow the [Hexclave setup prompt](/guides/getting-started/setup). Choose **Next.js** and **Convex** in the setup builder, then copy the generated prompt into your coding agent.
|
||||
|
||||
### 3) Create a Hexclave project
|
||||
|
||||
|
||||
@ -54,9 +54,10 @@ Let's create a sample table and some RLS policies to demonstrate how to integrat
|
||||
```bash title="Terminal"
|
||||
npx create-next-app@latest -e with-supabase stack-supabase
|
||||
cd stack-supabase
|
||||
npx @hexclave/cli@latest init
|
||||
```
|
||||
|
||||
Then follow the [Hexclave setup prompt](/guides/getting-started/setup). Choose **Next.js** and **Supabase** in the setup builder, then copy the generated prompt into your coding agent.
|
||||
|
||||
Now copy the environment variables from the Supabase dashboard to the `.env.local` file:
|
||||
|
||||
- `NEXT_PUBLIC_SUPABASE_URL`
|
||||
|
||||
@ -25,11 +25,7 @@ The examples below focus on **Next.js (App Router)**. The same ideas apply on ot
|
||||
|
||||
## 1. Install Hexclave and wire environment variables
|
||||
|
||||
The fastest path for JavaScript and TypeScript is the **setup wizard**:
|
||||
|
||||
```bash title="Terminal"
|
||||
npx @hexclave/cli@latest init
|
||||
```
|
||||
The fastest path for JavaScript and TypeScript is the [Hexclave setup prompt](/guides/getting-started/setup). Choose **Next.js** in the setup builder, then copy the generated prompt into your coding agent.
|
||||
|
||||
Then create or open a project in the dashboard and copy **project ID**, **publishable client key** (if your project uses one), and **secret server key** into your app configuration. For Next.js, that usually means `.env.local`:
|
||||
|
||||
@ -39,9 +35,9 @@ NEXT_PUBLIC_HEXCLAVE_PUBLISHABLE_CLIENT_KEY=<your-publishable-client-key>
|
||||
HEXCLAVE_SECRET_SERVER_KEY=<your-secret-server-key>
|
||||
```
|
||||
|
||||
### What the wizard sets up (Next.js)
|
||||
### What the setup prompt creates (Next.js)
|
||||
|
||||
After `init`, you should see files similar to:
|
||||
After setup, you should see files similar to:
|
||||
|
||||
- `app/handler/[...hexclave]/page.tsx` - hosted sign-in, sign-up, account settings, and more
|
||||
- `app/layout.tsx` - wraps the app with `HexclaveProvider` and `HexclaveTheme`
|
||||
|
||||
@ -6,7 +6,7 @@ export const setupExamples = {
|
||||
{
|
||||
language: 'JavaScript',
|
||||
framework: 'Next.js',
|
||||
code: `npx @stackframe/stack-cli@latest init`,
|
||||
code: `Follow the setup prompt for your framework.`,
|
||||
highlightLanguage: 'bash',
|
||||
filename: 'Terminal'
|
||||
}
|
||||
|
||||
@ -23,18 +23,10 @@ We recommend using our **setup wizard** for JavaScript frameworks for a seamless
|
||||
<TabsContent value="wizard">
|
||||
<Steps>
|
||||
<Step>
|
||||
### Run installation wizard
|
||||
### Follow the setup prompt
|
||||
</Step>
|
||||
|
||||
<Info>
|
||||
The setup wizard is available for JavaScript/TypeScript frameworks. For Python projects, please use the manual installation method.
|
||||
</Info>
|
||||
|
||||
Run Stack's installation wizard with the following command:
|
||||
|
||||
```sh title="Terminal"
|
||||
npx @stackframe/stack-cli@latest init
|
||||
```
|
||||
Use the setup prompt for your framework and apply the relevant sections to your project.
|
||||
|
||||
<Step>
|
||||
### Update API keys
|
||||
|
||||
@ -17,12 +17,7 @@ Then, run `npx convex dev` to start the Convex backend, and `npm run dev` to sta
|
||||
|
||||
### 2) Install Stack Auth
|
||||
|
||||
Next, install Stack Auth using the setup wizard:
|
||||
|
||||
```bash
|
||||
cd my-app/ # replace with your app name
|
||||
npx @stackframe/stack-cli@latest init
|
||||
```
|
||||
Next, open your app directory and follow the Stack Auth setup prompt for your framework.
|
||||
|
||||
### 3) Create a Stack Auth project
|
||||
|
||||
|
||||
@ -53,9 +53,10 @@ Now let's create a new Next.js project and install Stack Auth and Supabase clien
|
||||
```bash title="Terminal"
|
||||
npx create-next-app@latest -e with-supabase stack-supabase
|
||||
cd stack-supabase
|
||||
npx @stackframe/stack-cli@latest init
|
||||
```
|
||||
|
||||
Then follow the Stack Auth setup prompt for your framework.
|
||||
|
||||
Now copy the environment variables from the Supabase dashboard to the `.env.local` file:
|
||||
- `NEXT_PUBLIC_SUPABASE_URL`
|
||||
- `NEXT_PUBLIC_SUPABASE_ANON_KEY`
|
||||
|
||||
@ -19,21 +19,13 @@ Before proceeding, you MUST identify the project framework:
|
||||
|
||||
**IMPORTANT**: Only proceed with the installation if you can clearly identify the project as either Next.js or React.
|
||||
|
||||
### 1) Run the Stack Auth initializer
|
||||
- Use the `stack-auth` MCP server (`ask_stack_auth` tool), or run the command:
|
||||
- **For Next.js projects**:
|
||||
```bash
|
||||
npx @stackframe/stack-cli@latest init
|
||||
```
|
||||
- **For React projects**:
|
||||
```bash
|
||||
npx @stackframe/stack-cli@latest init
|
||||
```
|
||||
- Accept defaults for Next.js (App Router) or React.
|
||||
- Add all generated files to the repo.
|
||||
### 1) Follow the setup prompt
|
||||
- Use the setup prompt from the docs as the source of truth.
|
||||
- Apply only the sections relevant to the detected framework.
|
||||
- Do not run the Stack Auth CLI initializer unless the user explicitly asks for that workflow.
|
||||
|
||||
### 2) Scaffold the auth setup
|
||||
Confirm these files exist (created by the initializer):
|
||||
Create or confirm the setup files from the relevant setup prompt section:
|
||||
- `src/stack.tsx`
|
||||
- `src/app/handler/[...stack]/page.tsx`
|
||||
- `src/app/loading.tsx`
|
||||
|
||||
@ -122,7 +122,7 @@ export async function lookupLocalEmulatorProjectIdByPath(absolutePath: string):
|
||||
const projects = await listLocalEmulatorProjects();
|
||||
const match = findProjectByAbsolutePath(projects, absolutePath);
|
||||
if (!match) {
|
||||
throw new CliError(`No development-environment project registered for ${absolutePath}. Open it in the dashboard or run \`hexclave init\` from that directory first.`);
|
||||
throw new CliError(`No development-environment project registered for ${absolutePath}. Open it in the dashboard from that directory first.`);
|
||||
}
|
||||
return match.projectId;
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ HEXCLAVE SETUP INSTRUCTIONS
|
||||
|
||||
These instructions describe how to set up Hexclave.
|
||||
${web ? `
|
||||
First of all, if you have access to a terminal, it is better to use \`npx @hexclave/cli init\`.
|
||||
First of all, use the full setup prompt below as the source of truth. Do not run the Hexclave CLI initializer unless the user explicitly asks for the CLI workflow.
|
||||
` : ""}
|
||||
|
||||
${getCliProjectSetupContext(configPath)}
|
||||
|
||||
@ -4,11 +4,9 @@ This component is the official way to integrate Hexclave with your Convex projec
|
||||
|
||||
## Installation
|
||||
|
||||
To get started, first install Hexclave using the setup wizard:
|
||||
To get started, follow the Hexclave setup prompt and choose Convex for the integration steps:
|
||||
|
||||
```bash
|
||||
npx @hexclave/cli@latest init
|
||||
```
|
||||
https://docs.hexclave.com/guides/getting-started/setup
|
||||
|
||||
## Get Started
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user