Skip to content

Open source alternative to Semrush and Ahrefs

Simplify signup and move setup into the dashboard (#589)

Ben Senescu13a829260046
diff --git a/.agents/PAPERCUTS.md b/.agents/PAPERCUTS.md
index 87b12b41..e9684668 100644
--- a/.agents/PAPERCUTS.md
+++ b/.agents/PAPERCUTS.md
@@ -10,7 +10,7 @@ data, or sensitive paths.
## Open
-None after the 2026-09-05 review.
+- `2026-09-05T23:52:53Z` — `codex` — After `pnpm build` ran alongside an active Vite dev server, browser navigation failed and server functions returned undefined. The server logged `Cannot read properties of undefined (reading 'map')` in `runInRunnerObject` / `loadEntries`. Restarting Vite restored the same dashboard without code changes. Stop and restart the dev server around production builds before browser QA; consider documenting or isolating the shared build/runtime state.
## Deferred
diff --git a/.agents/skills/setup-openseo/SKILL.md b/.agents/skills/setup-openseo/SKILL.md
new file mode 100644
index 00000000..c554484f
--- /dev/null
+++ b/.agents/skills/setup-openseo/SKILL.md
@@ -0,0 +1,68 @@
+---
+name: setup-openseo
+description: Set up OpenSEO in the current AI agent. Use when a user pastes the OpenSEO installation prompt or asks to connect its plugin, MCP, and skills.
+metadata:
+ internal: true
+---
+
+Set up OpenSEO in this agent. Do what you can; guide me through anything that needs my input.
+
+## 1. Check this agent
+
+- Identify this agent and its version. Ask only if you cannot tell.
+- Check for an existing OpenSEO connection. Preserve other integrations and avoid duplicates.
+
+## 2. Install the plugin first
+
+The official plugin bundles MCP + SEO skills, with OpenSEO namespacing and shared updates.
+
+- **Codex:** follow the [plugin guide](https://openseo.so/docs/codex-plugin).
+- **Claude Code:** follow the [plugin guide](https://openseo.so/docs/claude-code-plugin).
+- **Other agents:** verify plugin compatibility in their current documentation.
+- Check the installed client's help before running commands.
+
+## 3. Fall back to MCP + skills
+
+If the plugin is unsupported:
+
+- Add `https://app.openseo.so/mcp` using the [MCP guide](https://openseo.so/docs/mcp).
+- Install the [public SEO skills](https://openseo.so/docs/skills/setup) for this agent only.
+- Do not copy internal repository skills or duplicate bundled skills.
+- If skills are unsupported, use MCP alone and link to the workflow guides.
+
+For self-hosted OpenSEO, use its endpoint directly; the official plugin targets the hosted service.
+
+## 4. Sign in
+
+- **Prefer OAuth.** Start login; let me approve it in my browser.
+- **No OAuth?** Send me to `https://app.openseo.so/settings` → API keys. Have me enter the key in the client's secret settings or environment, never chat or a repository.
+- **Manual setup needed?** Use this agent’s current documentation and give only the steps I need to do myself.
+
+## 5. Reload and verify
+
+- Use the current agent’s native reload flow, checking its installed version, help, or official documentation. Prefer automatic discovery or an in-place reload; restart only if required to load the new tools and skills.
+- Once tools load in this session, run whoami and list_projects (free reads). Check skill discovery too. If a reload needs my action, give the instructions rather than repeatedly retrying unavailable tools.
+- Track installation, sign-in, and verification separately. A connected server is not proof that this session can use its tools. Never claim verification before the free reads succeed.
+- Do not create projects or run paid research during installation.
+
+## 6. Finish with a short handoff
+
+Keep progress updates brief. The final reply must be **140 words or fewer** and follow this template:
+
+**Status**
+[Briefly say what succeeded or what blocked setup.]
+
+**Next**
+1. `[Give the native reload command or UI action for this agent, only if needed.]` Then say “Check that OpenSEO is connected.” Approve sign-in if prompted.
+2. Try one of these:
+ - `[SEO Audit invocation]` **(recommended)** — find your website's biggest SEO issues.
+ - `[SEO Project Setup invocation]` — interview you about your website and set up its project context.
+ - `[Keyword Research invocation]` — find keywords worth targeting.
+ - `[Local SEO invocation]` — review your Google Business Profile and local competitors.
+
+Want to know what was set up? Just ask.
+
+Adapt the template to the actual result:
+- If installation failed, name the blocker and replace reload with the fix. If fully verified, say it is ready and omit reload. Do not claim sign-in failed or is required merely because tools need reloading.
+- Recommend this agent’s idiomatic way to invoke each installed skill: its native command, mention, picker, or natural-language request. Use the discovered skill name and plugin namespace; do not assume `/skill-name` works everywhere or create aliases to force it. Check the agent’s help or official documentation when unsure. If skills are unsupported, give equivalent plain-language requests using the connected tools. Recommend workflows; do not run them during installation.
+- Keep tool names such as whoami and list_projects in your checks, not the final reply. Omit versions, paths, connection details, skill counts, other integrations, and cleanup commands unless they explain the blocker or I ask. Do not add more sections or a verification checklist.
diff --git a/drizzle-pg/0024_tense_echo.sql b/drizzle-pg/0024_tense_echo.sql
new file mode 100644
index 00000000..4f012165
--- /dev/null
+++ b/drizzle-pg/0024_tense_echo.sql
@@ -0,0 +1,10 @@
+CREATE TABLE "dashboard_step_dismissals" (
+ "user_id" text NOT NULL,
+ "project_id" text NOT NULL,
+ "step" text NOT NULL,
+ CONSTRAINT "dashboard_step_dismissals_user_id_project_id_step_pk" PRIMARY KEY("user_id","project_id","step")
+);
+--> statement-breakpoint
+ALTER TABLE "dashboard_step_dismissals" ADD CONSTRAINT "dashboard_step_dismissals_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "dashboard_step_dismissals" ADD CONSTRAINT "dashboard_step_dismissals_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+CREATE INDEX "dashboard_step_dismissals_project_idx" ON "dashboard_step_dismissals" USING btree ("project_id");
\ No newline at end of file
diff --git a/drizzle-pg/meta/0024_snapshot.json b/drizzle-pg/meta/0024_snapshot.json
new file mode 100644
index 00000000..3b05415f
--- /dev/null
+++ b/drizzle-pg/meta/0024_snapshot.json
@@ -0,0 +1,4210 @@
+{
+ "id": "a4f3d0e2-89b0-47ac-80d5-88c5f850523b",
+ "prevId": "b8dd2f0b-4b65-4d01-b966-abca9d168773",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.backlink_snapshots": {
+ "name": "backlink_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rank": {
+ "name": "rank",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backlinks": {
+ "name": "backlinks",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "referring_domains": {
+ "name": "referring_domains",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "broken_backlinks": {
+ "name": "broken_backlinks",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "new_backlinks": {
+ "name": "new_backlinks",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lost_backlinks": {
+ "name": "lost_backlinks",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "new_referring_domains": {
+ "name": "new_referring_domains",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lost_referring_domains": {
+ "name": "lost_referring_domains",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "captured_at": {
+ "name": "captured_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "backlink_snapshots_project_captured_idx": {
+ "name": "backlink_snapshots_project_captured_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "captured_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "backlink_snapshots_project_id_projects_id_fk": {
+ "name": "backlink_snapshots_project_id_projects_id_fk",
+ "tableFrom": "backlink_snapshots",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dashboard_step_dismissals": {
+ "name": "dashboard_step_dismissals",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step": {
+ "name": "step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "dashboard_step_dismissals_project_idx": {
+ "name": "dashboard_step_dismissals_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "dashboard_step_dismissals_user_id_user_id_fk": {
+ "name": "dashboard_step_dismissals_user_id_user_id_fk",
+ "tableFrom": "dashboard_step_dismissals",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dashboard_step_dismissals_project_id_projects_id_fk": {
+ "name": "dashboard_step_dismissals_project_id_projects_id_fk",
+ "tableFrom": "dashboard_step_dismissals",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "dashboard_step_dismissals_user_id_project_id_step_pk": {
+ "name": "dashboard_step_dismissals_user_id_project_id_step_pk",
+ "columns": [
+ "user_id",
+ "project_id",
+ "step"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.keyword_metrics": {
+ "name": "keyword_metrics",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "search_volume": {
+ "name": "search_volume",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cpc": {
+ "name": "cpc",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "competition": {
+ "name": "competition",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "keyword_difficulty": {
+ "name": "keyword_difficulty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "intent": {
+ "name": "intent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monthly_searches": {
+ "name": "monthly_searches",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fetched_at": {
+ "name": "fetched_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "keyword_metrics_unique_project_keyword_location_language": {
+ "name": "keyword_metrics_unique_project_keyword_location_language",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "keyword",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "location_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "language_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "keyword_metrics_lookup_idx": {
+ "name": "keyword_metrics_lookup_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "keyword",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "location_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "language_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "fetched_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "keyword_metrics_project_id_projects_id_fk": {
+ "name": "keyword_metrics_project_id_projects_id_fk",
+ "tableFrom": "keyword_metrics",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_activation_state": {
+ "name": "organization_activation_state",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "first_mcp_authorized_at": {
+ "name": "first_mcp_authorized_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_mcp_tool_call_at": {
+ "name": "first_mcp_tool_call_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_activation_state_organization_id_organization_id_fk": {
+ "name": "organization_activation_state_organization_id_organization_id_fk",
+ "tableFrom": "organization_activation_state",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_activation_state": {
+ "name": "project_activation_state",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "competitor_step_clicked_at": {
+ "name": "competitor_step_clicked_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_card_dismissed_at": {
+ "name": "mcp_card_dismissed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ga4_card_dismissed_at": {
+ "name": "ga4_card_dismissed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_activation_state_project_id_projects_id_fk": {
+ "name": "project_activation_state_project_id_projects_id_fk",
+ "tableFrom": "project_activation_state",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.projects": {
+ "name": "projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 2840
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "projects_one_default_per_organization_idx": {
+ "name": "projects_one_default_per_organization_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"projects\".\"name\" = 'Default' AND \"projects\".\"domain\" IS NULL AND \"projects\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "projects_organization_id_idx": {
+ "name": "projects_organization_id_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "projects_organization_id_organization_id_fk": {
+ "name": "projects_organization_id_organization_id_fk",
+ "tableFrom": "projects",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rank_check_runs": {
+ "name": "rank_check_runs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "keywords_total": {
+ "name": "keywords_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "keywords_checked": {
+ "name": "keywords_checked",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "is_subset_run": {
+ "name": "is_subset_run",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "rank_check_runs_config_idx": {
+ "name": "rank_check_runs_config_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "rank_check_runs_project_idx": {
+ "name": "rank_check_runs_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "started_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "rank_check_runs_one_active_per_config_idx": {
+ "name": "rank_check_runs_one_active_per_config_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"rank_check_runs\".\"status\" IN ('pending', 'running')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "rank_check_runs_config_id_rank_tracking_configs_id_fk": {
+ "name": "rank_check_runs_config_id_rank_tracking_configs_id_fk",
+ "tableFrom": "rank_check_runs",
+ "tableTo": "rank_tracking_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "rank_check_runs_project_id_projects_id_fk": {
+ "name": "rank_check_runs_project_id_projects_id_fk",
+ "tableFrom": "rank_check_runs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rank_snapshots": {
+ "name": "rank_snapshots",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tracking_keyword_id": {
+ "name": "tracking_keyword_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device": {
+ "name": "device",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "serp_features": {
+ "name": "serp_features",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checked_at": {
+ "name": "checked_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "rank_snapshots_keyword_device_idx": {
+ "name": "rank_snapshots_keyword_device_idx",
+ "columns": [
+ {
+ "expression": "tracking_keyword_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "device",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "checked_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "rank_snapshots_run_keyword_device_idx": {
+ "name": "rank_snapshots_run_keyword_device_idx",
+ "columns": [
+ {
+ "expression": "run_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tracking_keyword_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "device",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "rank_snapshots_run_id_rank_check_runs_id_fk": {
+ "name": "rank_snapshots_run_id_rank_check_runs_id_fk",
+ "tableFrom": "rank_snapshots",
+ "tableTo": "rank_check_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rank_tracking_configs": {
+ "name": "rank_tracking_configs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 2840
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "devices": {
+ "name": "devices",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'both'"
+ },
+ "serp_depth": {
+ "name": "serp_depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "schedule_interval": {
+ "name": "schedule_interval",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'weekly'"
+ },
+ "location_name": {
+ "name": "location_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "last_checked_at": {
+ "name": "last_checked_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "next_check_at": {
+ "name": "next_check_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_skip_reason": {
+ "name": "last_skip_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "rank_tracking_configs_project_active_created_idx": {
+ "name": "rank_tracking_configs_project_active_created_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "is_active",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "rank_tracking_configs_national_idx": {
+ "name": "rank_tracking_configs_national_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "location_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"rank_tracking_configs\".\"location_name\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "rank_tracking_configs_local_idx": {
+ "name": "rank_tracking_configs_local_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "location_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "location_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"rank_tracking_configs\".\"location_name\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "rank_tracking_configs_project_id_projects_id_fk": {
+ "name": "rank_tracking_configs_project_id_projects_id_fk",
+ "tableFrom": "rank_tracking_configs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rank_tracking_keywords": {
+ "name": "rank_tracking_keywords",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "match_case": {
+ "name": "match_case",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "search_volume": {
+ "name": "search_volume",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "keyword_difficulty": {
+ "name": "keyword_difficulty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cpc": {
+ "name": "cpc",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metrics_fetched_at": {
+ "name": "metrics_fetched_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "rank_tracking_keywords_config_keyword_idx": {
+ "name": "rank_tracking_keywords_config_keyword_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "keyword",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "rank_tracking_keywords_config_id_rank_tracking_configs_id_fk": {
+ "name": "rank_tracking_keywords_config_id_rank_tracking_configs_id_fk",
+ "tableFrom": "rank_tracking_keywords",
+ "tableTo": "rank_tracking_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.saved_keyword_tag_assignments": {
+ "name": "saved_keyword_tag_assignments",
+ "schema": "",
+ "columns": {
+ "saved_keyword_id": {
+ "name": "saved_keyword_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "saved_keyword_tag_assignments_unique_idx": {
+ "name": "saved_keyword_tag_assignments_unique_idx",
+ "columns": [
+ {
+ "expression": "saved_keyword_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tag_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "saved_keyword_tag_assignments_tag_idx": {
+ "name": "saved_keyword_tag_assignments_tag_idx",
+ "columns": [
+ {
+ "expression": "tag_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "saved_keyword_tag_assignments_saved_keyword_id_saved_keywords_id_fk": {
+ "name": "saved_keyword_tag_assignments_saved_keyword_id_saved_keywords_id_fk",
+ "tableFrom": "saved_keyword_tag_assignments",
+ "tableTo": "saved_keywords",
+ "columnsFrom": [
+ "saved_keyword_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "saved_keyword_tag_assignments_tag_id_saved_keyword_tags_id_fk": {
+ "name": "saved_keyword_tag_assignments_tag_id_saved_keyword_tags_id_fk",
+ "tableFrom": "saved_keyword_tag_assignments",
+ "tableTo": "saved_keyword_tags",
+ "columnsFrom": [
+ "tag_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.saved_keyword_tags": {
+ "name": "saved_keyword_tags",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "normalized_name": {
+ "name": "normalized_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "saved_keyword_tags_project_normalized_name_idx": {
+ "name": "saved_keyword_tags_project_normalized_name_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "normalized_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "saved_keyword_tags_project_name_idx": {
+ "name": "saved_keyword_tags_project_name_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "saved_keyword_tags_project_id_projects_id_fk": {
+ "name": "saved_keyword_tags_project_id_projects_id_fk",
+ "tableFrom": "saved_keyword_tags",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.saved_keywords": {
+ "name": "saved_keywords",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 2840
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "saved_keywords_unique_project_keyword_location_language": {
+ "name": "saved_keywords_unique_project_keyword_location_language",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "keyword",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "location_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "language_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "saved_keywords_project_created_idx": {
+ "name": "saved_keywords_project_created_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "saved_keywords_project_id_projects_id_fk": {
+ "name": "saved_keywords_project_id_projects_id_fk",
+ "tableFrom": "saved_keywords",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_onboarding_answers": {
+ "name": "user_onboarding_answers",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "interested_features": {
+ "name": "interested_features",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'"
+ },
+ "work_for": {
+ "name": "work_for",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_website_count": {
+ "name": "client_website_count",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "found_via": {
+ "name": "found_via",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_setup_intent": {
+ "name": "mcp_setup_intent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gsc_nudge_dismissed_at": {
+ "name": "gsc_nudge_dismissed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "user_onboarding_answers_organization_idx": {
+ "name": "user_onboarding_answers_organization_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_onboarding_answers_user_id_user_id_fk": {
+ "name": "user_onboarding_answers_user_id_user_id_fk",
+ "tableFrom": "user_onboarding_answers",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_onboarding_answers_organization_id_organization_id_fk": {
+ "name": "user_onboarding_answers_organization_id_organization_id_fk",
+ "tableFrom": "user_onboarding_answers",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_competitors": {
+ "name": "project_competitors",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "project_competitors_project_domain_idx": {
+ "name": "project_competitors_project_domain_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "domain",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_competitors_project_id_projects_id_fk": {
+ "name": "project_competitors_project_id_projects_id_fk",
+ "tableFrom": "project_competitors",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_context_sections": {
+ "name": "project_context_sections",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_context_sections_project_id_projects_id_fk": {
+ "name": "project_context_sections_project_id_projects_id_fk",
+ "tableFrom": "project_context_sections",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_context_sections_project_id_key_pk": {
+ "name": "project_context_sections_project_id_key_pk",
+ "columns": [
+ "project_id",
+ "key"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_key_pages": {
+ "name": "project_key_pages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "topic": {
+ "name": "topic",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "project_key_pages_project_url_idx": {
+ "name": "project_key_pages_project_url_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_key_pages_project_id_projects_id_fk": {
+ "name": "project_key_pages_project_id_projects_id_fk",
+ "tableFrom": "project_key_pages",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_research_log": {
+ "name": "project_research_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entry_date": {
+ "name": "entry_date",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "project_research_log_project_date_idx": {
+ "name": "project_research_log_project_date_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entry_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_research_log_project_id_projects_id_fk": {
+ "name": "project_research_log_project_id_projects_id_fk",
+ "tableFrom": "project_research_log",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.audit_issues": {
+ "name": "audit_issues",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "audit_id": {
+ "name": "audit_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "page_url": {
+ "name": "page_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_type": {
+ "name": "issue_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "severity": {
+ "name": "severity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'info'"
+ },
+ "details_json": {
+ "name": "details_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "audit_issues_audit_type_idx": {
+ "name": "audit_issues_audit_type_idx",
+ "columns": [
+ {
+ "expression": "audit_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "issue_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_issues_page_id_idx": {
+ "name": "audit_issues_page_id_idx",
+ "columns": [
+ {
+ "expression": "page_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "audit_issues_audit_id_audits_id_fk": {
+ "name": "audit_issues_audit_id_audits_id_fk",
+ "tableFrom": "audit_issues",
+ "tableTo": "audits",
+ "columnsFrom": [
+ "audit_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "audit_issues_page_id_audit_pages_id_fk": {
+ "name": "audit_issues_page_id_audit_pages_id_fk",
+ "tableFrom": "audit_issues",
+ "tableTo": "audit_pages",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.audit_lighthouse_results": {
+ "name": "audit_lighthouse_results",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "audit_id": {
+ "name": "audit_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "strategy": {
+ "name": "strategy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "performance_score": {
+ "name": "performance_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accessibility_score": {
+ "name": "accessibility_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "best_practices_score": {
+ "name": "best_practices_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seo_score": {
+ "name": "seo_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lcp_ms": {
+ "name": "lcp_ms",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cls": {
+ "name": "cls",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "inp_ms": {
+ "name": "inp_ms",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ttfb_ms": {
+ "name": "ttfb_ms",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "r2_key": {
+ "name": "r2_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload_size_bytes": {
+ "name": "payload_size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "audit_lighthouse_results_audit_id_idx": {
+ "name": "audit_lighthouse_results_audit_id_idx",
+ "columns": [
+ {
+ "expression": "audit_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audit_lighthouse_results_page_id_idx": {
+ "name": "audit_lighthouse_results_page_id_idx",
+ "columns": [
+ {
+ "expression": "page_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "audit_lighthouse_results_audit_id_audits_id_fk": {
+ "name": "audit_lighthouse_results_audit_id_audits_id_fk",
+ "tableFrom": "audit_lighthouse_results",
+ "tableTo": "audits",
+ "columnsFrom": [
+ "audit_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "audit_lighthouse_results_page_id_audit_pages_id_fk": {
+ "name": "audit_lighthouse_results_page_id_audit_pages_id_fk",
+ "tableFrom": "audit_lighthouse_results",
+ "tableTo": "audit_pages",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.audit_pages": {
+ "name": "audit_pages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "audit_id": {
+ "name": "audit_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirect_url": {
+ "name": "redirect_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "meta_description": {
+ "name": "meta_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "canonical_url": {
+ "name": "canonical_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "robots_meta": {
+ "name": "robots_meta",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "og_title": {
+ "name": "og_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "og_description": {
+ "name": "og_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "og_image": {
+ "name": "og_image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "h1_count": {
+ "name": "h1_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "h2_count": {
+ "name": "h2_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "h3_count": {
+ "name": "h3_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "h4_count": {
+ "name": "h4_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "h5_count": {
+ "name": "h5_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "h6_count": {
+ "name": "h6_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "heading_order_json": {
+ "name": "heading_order_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "word_count": {
+ "name": "word_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "images_total": {
+ "name": "images_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "images_missing_alt": {
+ "name": "images_missing_alt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "images_json": {
+ "name": "images_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "internal_link_count": {
+ "name": "internal_link_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "external_link_count": {
+ "name": "external_link_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "has_structured_data": {
+ "name": "has_structured_data",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "hreflang_tags_json": {
+ "name": "hreflang_tags_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_indexable": {
+ "name": "is_indexable",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "x_robots_tag": {
+ "name": "x_robots_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "header_canonical_url": {
+ "name": "header_canonical_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "crawl_depth": {
+ "name": "crawl_depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "in_sitemap": {
+ "name": "in_sitemap",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "fetch_class": {
+ "name": "fetch_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ok'"
+ },
+ "response_time_ms": {
+ "name": "response_time_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "audit_pages_audit_url_idx": {
+ "name": "audit_pages_audit_url_idx",
+ "columns": [
+ {
+ "expression": "audit_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "url",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "audit_pages_audit_id_audits_id_fk": {
+ "name": "audit_pages_audit_id_audits_id_fk",
+ "tableFrom": "audit_pages",
+ "tableTo": "audits",
+ "columnsFrom": [
+ "audit_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.audits": {
+ "name": "audits",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "started_by_user_id": {
+ "name": "started_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "start_url": {
+ "name": "start_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'running'"
+ },
+ "workflow_instance_id": {
+ "name": "workflow_instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "config": {
+ "name": "config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'"
+ },
+ "pages_crawled": {
+ "name": "pages_crawled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "pages_total": {
+ "name": "pages_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lighthouse_total": {
+ "name": "lighthouse_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lighthouse_completed": {
+ "name": "lighthouse_completed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "lighthouse_failed": {
+ "name": "lighthouse_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "current_phase": {
+ "name": "current_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'discovery'"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_detail": {
+ "name": "error_detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "failed_phase": {
+ "name": "failed_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "audits_project_id_idx": {
+ "name": "audits_project_id_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "audits_started_by_user_id_idx": {
+ "name": "audits_started_by_user_id_idx",
+ "columns": [
+ {
+ "expression": "started_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "audits_project_id_projects_id_fk": {
+ "name": "audits_project_id_projects_id_fk",
+ "tableFrom": "audits",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sam_sessions": {
+ "name": "sam_sessions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'New chat'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "sam_sessions_project_updated_idx": {
+ "name": "sam_sessions_project_updated_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "sam_sessions_project_id_projects_id_fk": {
+ "name": "sam_sessions_project_id_projects_id_fk",
+ "tableFrom": "sam_sessions",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sam_sessions_user_id_user_id_fk": {
+ "name": "sam_sessions_user_id_user_id_fk",
+ "tableFrom": "sam_sessions",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "account_accountId_providerId_idx": {
+ "name": "account_accountId_providerId_idx",
+ "columns": [
+ {
+ "expression": "account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "provider_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 60000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 120
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "invitation_organizationId_idx": {
+ "name": "invitation_organizationId_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "invitation_organization_id_organization_id_fk": {
+ "name": "invitation_organization_id_organization_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": [
+ "inviter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member": {
+ "name": "member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "member_organizationId_idx": {
+ "name": "member_organizationId_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_userId_idx": {
+ "name": "member_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_organizationId_userId_uidx": {
+ "name": "member_organizationId_userId_uidx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "member_organization_id_organization_id_fk": {
+ "name": "member_organization_id_organization_id_fk",
+ "tableFrom": "member",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_user_id_user_id_fk": {
+ "name": "member_user_id_user_id_fk",
+ "tableFrom": "member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization": {
+ "name": "organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "organization_slug_uidx": {
+ "name": "organization_slug_uidx",
+ "columns": [
+ {
+ "expression": "slug",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_slug_unique": {
+ "name": "organization_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "analytics_opted_out": {
+ "name": "analytics_opted_out",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_active_organization_id": {
+ "name": "last_active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "verification_expiresAt_idx": {
+ "name": "verification_expiresAt_idx",
+ "columns": [
+ {
+ "expression": "expires_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.billing_customer_status": {
+ "name": "billing_customer_status",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "is_paying": {
+ "name": "is_paying",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "paid_plan_id": {
+ "name": "paid_plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "paid_plan_status": {
+ "name": "paid_plan_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "customer_json": {
+ "name": "customer_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "billing_customer_status_organization_id_organization_id_fk": {
+ "name": "billing_customer_status_organization_id_organization_id_fk",
+ "tableFrom": "billing_customer_status",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ga4_connections": {
+ "name": "ga4_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "property_id": {
+ "name": "property_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "property_display_name": {
+ "name": "property_display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "property_time_zone": {
+ "name": "property_time_zone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "property_currency_code": {
+ "name": "property_currency_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connected_by_user_id": {
+ "name": "connected_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ga4_account_id": {
+ "name": "ga4_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connected_account_email": {
+ "name": "connected_account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "ga4_connections_project_idx": {
+ "name": "ga4_connections_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ga4_connections_organization_idx": {
+ "name": "ga4_connections_organization_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ga4_connections_connector_idx": {
+ "name": "ga4_connections_connector_idx",
+ "columns": [
+ {
+ "expression": "connected_by_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "ga4_account_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ga4_connections_project_id_projects_id_fk": {
+ "name": "ga4_connections_project_id_projects_id_fk",
+ "tableFrom": "ga4_connections",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ga4_connections_organization_id_organization_id_fk": {
+ "name": "ga4_connections_organization_id_organization_id_fk",
+ "tableFrom": "ga4_connections",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.gsc_connections": {
+ "name": "gsc_connections",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "site_url": {
+ "name": "site_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connected_by_user_id": {
+ "name": "connected_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "gsc_account_id": {
+ "name": "gsc_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "connected_account_email": {
+ "name": "connected_account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "to_char(now() AT TIME ZONE 'utc', 'YYYY-MM-DD\"T\"HH24:MI:SS.MS\"Z\"')"
+ }
+ },
+ "indexes": {
+ "gsc_connections_project_idx": {
+ "name": "gsc_connections_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "gsc_connections_organization_idx": {
+ "name": "gsc_connections_organization_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "gsc_connections_project_id_projects_id_fk": {
+ "name": "gsc_connections_project_id_projects_id_fk",
+ "tableFrom": "gsc_connections",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "gsc_connections_organization_id_organization_id_fk": {
+ "name": "gsc_connections_organization_id_organization_id_fk",
+ "tableFrom": "gsc_connections",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.telemetry_state": {
+ "name": "telemetry_state",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "default": 1
+ },
+ "install_id": {
+ "name": "install_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "installed_at": {
+ "name": "installed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_heartbeat_at": {
+ "name": "last_heartbeat_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_version": {
+ "name": "last_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_tool_call_count": {
+ "name": "mcp_tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle-pg/meta/_journal.json b/drizzle-pg/meta/_journal.json
index faff3a34..407a0c1d 100644
--- a/drizzle-pg/meta/_journal.json
+++ b/drizzle-pg/meta/_journal.json
@@ -169,6 +169,13 @@
"when": 1788490192736,
"tag": "0023_clammy_screwball",
"breakpoints": true
+ },
+ {
+ "idx": 24,
+ "version": "7",
+ "when": 1788651419109,
+ "tag": "0024_tense_echo",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/drizzle/0046_plain_the_watchers.sql b/drizzle/0046_plain_the_watchers.sql
new file mode 100644
index 00000000..f00e7eb0
--- /dev/null
+++ b/drizzle/0046_plain_the_watchers.sql
@@ -0,0 +1,10 @@
+CREATE TABLE `dashboard_step_dismissals` (
+ `user_id` text NOT NULL,
+ `project_id` text NOT NULL,
+ `step` text NOT NULL,
+ PRIMARY KEY(`user_id`, `project_id`, `step`),
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE INDEX `dashboard_step_dismissals_project_idx` ON `dashboard_step_dismissals` (`project_id`);
\ No newline at end of file
diff --git a/drizzle/meta/0046_snapshot.json b/drizzle/meta/0046_snapshot.json
new file mode 100644
index 00000000..489aa7df
--- /dev/null
+++ b/drizzle/meta/0046_snapshot.json
@@ -0,0 +1,3830 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "cfb3ee2c-43a2-413e-a538-ec7dfe0a7a6a",
+ "prevId": "aa0700ab-db87-43a7-b354-ae59678c778b",
+ "tables": {
+ "backlink_snapshots": {
+ "name": "backlink_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "rank": {
+ "name": "rank",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "backlinks": {
+ "name": "backlinks",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "referring_domains": {
+ "name": "referring_domains",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "broken_backlinks": {
+ "name": "broken_backlinks",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "new_backlinks": {
+ "name": "new_backlinks",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lost_backlinks": {
+ "name": "lost_backlinks",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "new_referring_domains": {
+ "name": "new_referring_domains",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lost_referring_domains": {
+ "name": "lost_referring_domains",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "captured_at": {
+ "name": "captured_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "backlink_snapshots_project_captured_idx": {
+ "name": "backlink_snapshots_project_captured_idx",
+ "columns": [
+ "project_id",
+ "captured_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "backlink_snapshots_project_id_projects_id_fk": {
+ "name": "backlink_snapshots_project_id_projects_id_fk",
+ "tableFrom": "backlink_snapshots",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "dashboard_step_dismissals": {
+ "name": "dashboard_step_dismissals",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "step": {
+ "name": "step",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "dashboard_step_dismissals_project_idx": {
+ "name": "dashboard_step_dismissals_project_idx",
+ "columns": [
+ "project_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "dashboard_step_dismissals_user_id_user_id_fk": {
+ "name": "dashboard_step_dismissals_user_id_user_id_fk",
+ "tableFrom": "dashboard_step_dismissals",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dashboard_step_dismissals_project_id_projects_id_fk": {
+ "name": "dashboard_step_dismissals_project_id_projects_id_fk",
+ "tableFrom": "dashboard_step_dismissals",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "dashboard_step_dismissals_user_id_project_id_step_pk": {
+ "columns": [
+ "user_id",
+ "project_id",
+ "step"
+ ],
+ "name": "dashboard_step_dismissals_user_id_project_id_step_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "keyword_metrics": {
+ "name": "keyword_metrics",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'en'"
+ },
+ "search_volume": {
+ "name": "search_volume",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cpc": {
+ "name": "cpc",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "competition": {
+ "name": "competition",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "keyword_difficulty": {
+ "name": "keyword_difficulty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "intent": {
+ "name": "intent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "monthly_searches": {
+ "name": "monthly_searches",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fetched_at": {
+ "name": "fetched_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "keyword_metrics_unique_project_keyword_location_language": {
+ "name": "keyword_metrics_unique_project_keyword_location_language",
+ "columns": [
+ "project_id",
+ "keyword",
+ "location_code",
+ "language_code"
+ ],
+ "isUnique": true
+ },
+ "keyword_metrics_lookup_idx": {
+ "name": "keyword_metrics_lookup_idx",
+ "columns": [
+ "project_id",
+ "keyword",
+ "location_code",
+ "language_code",
+ "fetched_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "keyword_metrics_project_id_projects_id_fk": {
+ "name": "keyword_metrics_project_id_projects_id_fk",
+ "tableFrom": "keyword_metrics",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "organization_activation_state": {
+ "name": "organization_activation_state",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "first_mcp_authorized_at": {
+ "name": "first_mcp_authorized_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "first_mcp_tool_call_at": {
+ "name": "first_mcp_tool_call_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_activation_state_organization_id_organization_id_fk": {
+ "name": "organization_activation_state_organization_id_organization_id_fk",
+ "tableFrom": "organization_activation_state",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_activation_state": {
+ "name": "project_activation_state",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "competitor_step_clicked_at": {
+ "name": "competitor_step_clicked_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "mcp_card_dismissed_at": {
+ "name": "mcp_card_dismissed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "ga4_card_dismissed_at": {
+ "name": "ga4_card_dismissed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_activation_state_project_id_projects_id_fk": {
+ "name": "project_activation_state_project_id_projects_id_fk",
+ "tableFrom": "project_activation_state",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "projects": {
+ "name": "projects",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 2840
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'en'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "projects_one_default_per_organization_idx": {
+ "name": "projects_one_default_per_organization_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": true,
+ "where": "\"projects\".\"name\" = 'Default' AND \"projects\".\"domain\" IS NULL AND \"projects\".\"archived_at\" IS NULL"
+ },
+ "projects_organization_id_idx": {
+ "name": "projects_organization_id_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "projects_organization_id_organization_id_fk": {
+ "name": "projects_organization_id_organization_id_fk",
+ "tableFrom": "projects",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "rank_check_runs": {
+ "name": "rank_check_runs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "keywords_total": {
+ "name": "keywords_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "keywords_checked": {
+ "name": "keywords_checked",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "is_subset_run": {
+ "name": "is_subset_run",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "rank_check_runs_config_idx": {
+ "name": "rank_check_runs_config_idx",
+ "columns": [
+ "config_id",
+ "started_at"
+ ],
+ "isUnique": false
+ },
+ "rank_check_runs_project_idx": {
+ "name": "rank_check_runs_project_idx",
+ "columns": [
+ "project_id",
+ "started_at"
+ ],
+ "isUnique": false
+ },
+ "rank_check_runs_one_active_per_config_idx": {
+ "name": "rank_check_runs_one_active_per_config_idx",
+ "columns": [
+ "config_id"
+ ],
+ "isUnique": true,
+ "where": "\"rank_check_runs\".\"status\" IN ('pending', 'running')"
+ }
+ },
+ "foreignKeys": {
+ "rank_check_runs_config_id_rank_tracking_configs_id_fk": {
+ "name": "rank_check_runs_config_id_rank_tracking_configs_id_fk",
+ "tableFrom": "rank_check_runs",
+ "tableTo": "rank_tracking_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "rank_check_runs_project_id_projects_id_fk": {
+ "name": "rank_check_runs_project_id_projects_id_fk",
+ "tableFrom": "rank_check_runs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "rank_snapshots": {
+ "name": "rank_snapshots",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "run_id": {
+ "name": "run_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tracking_keyword_id": {
+ "name": "tracking_keyword_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "device": {
+ "name": "device",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "serp_features": {
+ "name": "serp_features",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "checked_at": {
+ "name": "checked_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "rank_snapshots_keyword_device_idx": {
+ "name": "rank_snapshots_keyword_device_idx",
+ "columns": [
+ "tracking_keyword_id",
+ "device",
+ "checked_at"
+ ],
+ "isUnique": false
+ },
+ "rank_snapshots_run_keyword_device_idx": {
+ "name": "rank_snapshots_run_keyword_device_idx",
+ "columns": [
+ "run_id",
+ "tracking_keyword_id",
+ "device"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "rank_snapshots_run_id_rank_check_runs_id_fk": {
+ "name": "rank_snapshots_run_id_rank_check_runs_id_fk",
+ "tableFrom": "rank_snapshots",
+ "tableTo": "rank_check_runs",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "rank_tracking_configs": {
+ "name": "rank_tracking_configs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 2840
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'en'"
+ },
+ "devices": {
+ "name": "devices",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'both'"
+ },
+ "serp_depth": {
+ "name": "serp_depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "schedule_interval": {
+ "name": "schedule_interval",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'weekly'"
+ },
+ "location_name": {
+ "name": "location_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "last_checked_at": {
+ "name": "last_checked_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "next_check_at": {
+ "name": "next_check_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_skip_reason": {
+ "name": "last_skip_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "rank_tracking_configs_project_active_created_idx": {
+ "name": "rank_tracking_configs_project_active_created_idx",
+ "columns": [
+ "project_id",
+ "is_active",
+ "created_at"
+ ],
+ "isUnique": false
+ },
+ "rank_tracking_configs_national_idx": {
+ "name": "rank_tracking_configs_national_idx",
+ "columns": [
+ "project_id",
+ "domain",
+ "location_code"
+ ],
+ "isUnique": true,
+ "where": "\"rank_tracking_configs\".\"location_name\" IS NULL"
+ },
+ "rank_tracking_configs_local_idx": {
+ "name": "rank_tracking_configs_local_idx",
+ "columns": [
+ "project_id",
+ "domain",
+ "location_code",
+ "location_name"
+ ],
+ "isUnique": true,
+ "where": "\"rank_tracking_configs\".\"location_name\" IS NOT NULL"
+ }
+ },
+ "foreignKeys": {
+ "rank_tracking_configs_project_id_projects_id_fk": {
+ "name": "rank_tracking_configs_project_id_projects_id_fk",
+ "tableFrom": "rank_tracking_configs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "rank_tracking_keywords": {
+ "name": "rank_tracking_keywords",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "match_case": {
+ "name": "match_case",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "search_volume": {
+ "name": "search_volume",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "keyword_difficulty": {
+ "name": "keyword_difficulty",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cpc": {
+ "name": "cpc",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metrics_fetched_at": {
+ "name": "metrics_fetched_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "rank_tracking_keywords_config_keyword_idx": {
+ "name": "rank_tracking_keywords_config_keyword_idx",
+ "columns": [
+ "config_id",
+ "keyword"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "rank_tracking_keywords_config_id_rank_tracking_configs_id_fk": {
+ "name": "rank_tracking_keywords_config_id_rank_tracking_configs_id_fk",
+ "tableFrom": "rank_tracking_keywords",
+ "tableTo": "rank_tracking_configs",
+ "columnsFrom": [
+ "config_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "saved_keyword_tag_assignments": {
+ "name": "saved_keyword_tag_assignments",
+ "columns": {
+ "saved_keyword_id": {
+ "name": "saved_keyword_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "saved_keyword_tag_assignments_unique_idx": {
+ "name": "saved_keyword_tag_assignments_unique_idx",
+ "columns": [
+ "saved_keyword_id",
+ "tag_id"
+ ],
+ "isUnique": true
+ },
+ "saved_keyword_tag_assignments_tag_idx": {
+ "name": "saved_keyword_tag_assignments_tag_idx",
+ "columns": [
+ "tag_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "saved_keyword_tag_assignments_saved_keyword_id_saved_keywords_id_fk": {
+ "name": "saved_keyword_tag_assignments_saved_keyword_id_saved_keywords_id_fk",
+ "tableFrom": "saved_keyword_tag_assignments",
+ "tableTo": "saved_keywords",
+ "columnsFrom": [
+ "saved_keyword_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "saved_keyword_tag_assignments_tag_id_saved_keyword_tags_id_fk": {
+ "name": "saved_keyword_tag_assignments_tag_id_saved_keyword_tags_id_fk",
+ "tableFrom": "saved_keyword_tag_assignments",
+ "tableTo": "saved_keyword_tags",
+ "columnsFrom": [
+ "tag_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "saved_keyword_tags": {
+ "name": "saved_keyword_tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "normalized_name": {
+ "name": "normalized_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "saved_keyword_tags_project_normalized_name_idx": {
+ "name": "saved_keyword_tags_project_normalized_name_idx",
+ "columns": [
+ "project_id",
+ "normalized_name"
+ ],
+ "isUnique": true
+ },
+ "saved_keyword_tags_project_name_idx": {
+ "name": "saved_keyword_tags_project_name_idx",
+ "columns": [
+ "project_id",
+ "name"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "saved_keyword_tags_project_id_projects_id_fk": {
+ "name": "saved_keyword_tags_project_id_projects_id_fk",
+ "tableFrom": "saved_keyword_tags",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "saved_keywords": {
+ "name": "saved_keywords",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "keyword": {
+ "name": "keyword",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "location_code": {
+ "name": "location_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 2840
+ },
+ "language_code": {
+ "name": "language_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'en'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "saved_keywords_unique_project_keyword_location_language": {
+ "name": "saved_keywords_unique_project_keyword_location_language",
+ "columns": [
+ "project_id",
+ "keyword",
+ "location_code",
+ "language_code"
+ ],
+ "isUnique": true
+ },
+ "saved_keywords_project_created_idx": {
+ "name": "saved_keywords_project_created_idx",
+ "columns": [
+ "project_id",
+ "created_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "saved_keywords_project_id_projects_id_fk": {
+ "name": "saved_keywords_project_id_projects_id_fk",
+ "tableFrom": "saved_keywords",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "user_onboarding_answers": {
+ "name": "user_onboarding_answers",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "interested_features": {
+ "name": "interested_features",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "work_for": {
+ "name": "work_for",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "client_website_count": {
+ "name": "client_website_count",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "found_via": {
+ "name": "found_via",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "mcp_setup_intent": {
+ "name": "mcp_setup_intent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "gsc_nudge_dismissed_at": {
+ "name": "gsc_nudge_dismissed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "user_onboarding_answers_organization_idx": {
+ "name": "user_onboarding_answers_organization_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "user_onboarding_answers_user_id_user_id_fk": {
+ "name": "user_onboarding_answers_user_id_user_id_fk",
+ "tableFrom": "user_onboarding_answers",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_onboarding_answers_organization_id_organization_id_fk": {
+ "name": "user_onboarding_answers_organization_id_organization_id_fk",
+ "tableFrom": "user_onboarding_answers",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_competitors": {
+ "name": "project_competitors",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "project_competitors_project_domain_idx": {
+ "name": "project_competitors_project_domain_idx",
+ "columns": [
+ "project_id",
+ "domain"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "project_competitors_project_id_projects_id_fk": {
+ "name": "project_competitors_project_id_projects_id_fk",
+ "tableFrom": "project_competitors",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_context_sections": {
+ "name": "project_context_sections",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_context_sections_project_id_projects_id_fk": {
+ "name": "project_context_sections_project_id_projects_id_fk",
+ "tableFrom": "project_context_sections",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_context_sections_project_id_key_pk": {
+ "columns": [
+ "project_id",
+ "key"
+ ],
+ "name": "project_context_sections_project_id_key_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_key_pages": {
+ "name": "project_key_pages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "topic": {
+ "name": "topic",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "project_key_pages_project_url_idx": {
+ "name": "project_key_pages_project_url_idx",
+ "columns": [
+ "project_id",
+ "url"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "project_key_pages_project_id_projects_id_fk": {
+ "name": "project_key_pages_project_id_projects_id_fk",
+ "tableFrom": "project_key_pages",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "project_research_log": {
+ "name": "project_research_log",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "entry_date": {
+ "name": "entry_date",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(strftime('%Y-%m-%dT%H:%M:%fZ','now'))"
+ }
+ },
+ "indexes": {
+ "project_research_log_project_date_idx": {
+ "name": "project_research_log_project_date_idx",
+ "columns": [
+ "project_id",
+ "entry_date"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "project_research_log_project_id_projects_id_fk": {
+ "name": "project_research_log_project_id_projects_id_fk",
+ "tableFrom": "project_research_log",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "audit_issues": {
+ "name": "audit_issues",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "audit_id": {
+ "name": "audit_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "page_url": {
+ "name": "page_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "issue_type": {
+ "name": "issue_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "severity": {
+ "name": "severity",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'info'"
+ },
+ "details_json": {
+ "name": "details_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "audit_issues_audit_type_idx": {
+ "name": "audit_issues_audit_type_idx",
+ "columns": [
+ "audit_id",
+ "issue_type"
+ ],
+ "isUnique": false
+ },
+ "audit_issues_page_id_idx": {
+ "name": "audit_issues_page_id_idx",
+ "columns": [
+ "page_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "audit_issues_audit_id_audits_id_fk": {
+ "name": "audit_issues_audit_id_audits_id_fk",
+ "tableFrom": "audit_issues",
+ "tableTo": "audits",
+ "columnsFrom": [
+ "audit_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "audit_issues_page_id_audit_pages_id_fk": {
+ "name": "audit_issues_page_id_audit_pages_id_fk",
+ "tableFrom": "audit_issues",
+ "tableTo": "audit_pages",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "audit_lighthouse_results": {
+ "name": "audit_lighthouse_results",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "audit_id": {
+ "name": "audit_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "page_id": {
+ "name": "page_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "strategy": {
+ "name": "strategy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "performance_score": {
+ "name": "performance_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "accessibility_score": {
+ "name": "accessibility_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "best_practices_score": {
+ "name": "best_practices_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "seo_score": {
+ "name": "seo_score",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lcp_ms": {
+ "name": "lcp_ms",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "cls": {
+ "name": "cls",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "inp_ms": {
+ "name": "inp_ms",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "ttfb_ms": {
+ "name": "ttfb_ms",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_message": {
+ "name": "error_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "r2_key": {
+ "name": "r2_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "payload_size_bytes": {
+ "name": "payload_size_bytes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "audit_lighthouse_results_audit_id_idx": {
+ "name": "audit_lighthouse_results_audit_id_idx",
+ "columns": [
+ "audit_id"
+ ],
+ "isUnique": false
+ },
+ "audit_lighthouse_results_page_id_idx": {
+ "name": "audit_lighthouse_results_page_id_idx",
+ "columns": [
+ "page_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "audit_lighthouse_results_audit_id_audits_id_fk": {
+ "name": "audit_lighthouse_results_audit_id_audits_id_fk",
+ "tableFrom": "audit_lighthouse_results",
+ "tableTo": "audits",
+ "columnsFrom": [
+ "audit_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "audit_lighthouse_results_page_id_audit_pages_id_fk": {
+ "name": "audit_lighthouse_results_page_id_audit_pages_id_fk",
+ "tableFrom": "audit_lighthouse_results",
+ "tableTo": "audit_pages",
+ "columnsFrom": [
+ "page_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "audit_pages": {
+ "name": "audit_pages",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "audit_id": {
+ "name": "audit_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status_code": {
+ "name": "status_code",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "redirect_url": {
+ "name": "redirect_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "meta_description": {
+ "name": "meta_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "canonical_url": {
+ "name": "canonical_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "robots_meta": {
+ "name": "robots_meta",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "og_title": {
+ "name": "og_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "og_description": {
+ "name": "og_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "og_image": {
+ "name": "og_image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "h1_count": {
+ "name": "h1_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "h2_count": {
+ "name": "h2_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "h3_count": {
+ "name": "h3_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "h4_count": {
+ "name": "h4_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "h5_count": {
+ "name": "h5_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "h6_count": {
+ "name": "h6_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "heading_order_json": {
+ "name": "heading_order_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "word_count": {
+ "name": "word_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "images_total": {
+ "name": "images_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "images_missing_alt": {
+ "name": "images_missing_alt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "images_json": {
+ "name": "images_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "internal_link_count": {
+ "name": "internal_link_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "external_link_count": {
+ "name": "external_link_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "has_structured_data": {
+ "name": "has_structured_data",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "hreflang_tags_json": {
+ "name": "hreflang_tags_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "is_indexable": {
+ "name": "is_indexable",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "x_robots_tag": {
+ "name": "x_robots_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "header_canonical_url": {
+ "name": "header_canonical_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "crawl_depth": {
+ "name": "crawl_depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "in_sitemap": {
+ "name": "in_sitemap",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "content_hash": {
+ "name": "content_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "fetch_class": {
+ "name": "fetch_class",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'ok'"
+ },
+ "response_time_ms": {
+ "name": "response_time_ms",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "audit_pages_audit_url_idx": {
+ "name": "audit_pages_audit_url_idx",
+ "columns": [
+ "audit_id",
+ "url"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "audit_pages_audit_id_audits_id_fk": {
+ "name": "audit_pages_audit_id_audits_id_fk",
+ "tableFrom": "audit_pages",
+ "tableTo": "audits",
+ "columnsFrom": [
+ "audit_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "audits": {
+ "name": "audits",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "started_by_user_id": {
+ "name": "started_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "start_url": {
+ "name": "start_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'running'"
+ },
+ "workflow_instance_id": {
+ "name": "workflow_instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "config": {
+ "name": "config",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{}'"
+ },
+ "pages_crawled": {
+ "name": "pages_crawled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "pages_total": {
+ "name": "pages_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "lighthouse_total": {
+ "name": "lighthouse_total",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "lighthouse_completed": {
+ "name": "lighthouse_completed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "lighthouse_failed": {
+ "name": "lighthouse_failed",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "current_phase": {
+ "name": "current_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": "'discovery'"
+ },
+ "error_code": {
+ "name": "error_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "error_detail": {
+ "name": "error_detail",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "failed_phase": {
+ "name": "failed_phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "audits_project_id_idx": {
+ "name": "audits_project_id_idx",
+ "columns": [
+ "project_id"
+ ],
+ "isUnique": false
+ },
+ "audits_started_by_user_id_idx": {
+ "name": "audits_started_by_user_id_idx",
+ "columns": [
+ "started_by_user_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "audits_project_id_projects_id_fk": {
+ "name": "audits_project_id_projects_id_fk",
+ "tableFrom": "audits",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "sam_sessions": {
+ "name": "sam_sessions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'New chat'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "sam_sessions_project_updated_idx": {
+ "name": "sam_sessions_project_updated_idx",
+ "columns": [
+ "project_id",
+ "updated_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "sam_sessions_project_id_projects_id_fk": {
+ "name": "sam_sessions_project_id_projects_id_fk",
+ "tableFrom": "sam_sessions",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "sam_sessions_user_id_user_id_fk": {
+ "name": "sam_sessions_user_id_user_id_fk",
+ "tableFrom": "sam_sessions",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "account": {
+ "name": "account",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ "user_id"
+ ],
+ "isUnique": false
+ },
+ "account_accountId_providerId_idx": {
+ "name": "account_accountId_providerId_idx",
+ "columns": [
+ "account_id",
+ "provider_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "apikey": {
+ "name": "apikey",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 60000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 120
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ "config_id"
+ ],
+ "isUnique": false
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ "reference_id"
+ ],
+ "isUnique": false
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ "key"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "invitation": {
+ "name": "invitation",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'pending'"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "invitation_organizationId_idx": {
+ "name": "invitation_organizationId_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": false
+ },
+ "invitation_email_idx": {
+ "name": "invitation_email_idx",
+ "columns": [
+ "email"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "invitation_organization_id_organization_id_fk": {
+ "name": "invitation_organization_id_organization_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": [
+ "inviter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "member": {
+ "name": "member",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'member'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "member_organizationId_idx": {
+ "name": "member_organizationId_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": false
+ },
+ "member_userId_idx": {
+ "name": "member_userId_idx",
+ "columns": [
+ "user_id"
+ ],
+ "isUnique": false
+ },
+ "member_organizationId_userId_uidx": {
+ "name": "member_organizationId_userId_uidx",
+ "columns": [
+ "organization_id",
+ "user_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "member_organization_id_organization_id_fk": {
+ "name": "member_organization_id_organization_id_fk",
+ "tableFrom": "member",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_user_id_user_id_fk": {
+ "name": "member_user_id_user_id_fk",
+ "tableFrom": "member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "organization": {
+ "name": "organization",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "organization_slug_unique": {
+ "name": "organization_slug_unique",
+ "columns": [
+ "slug"
+ ],
+ "isUnique": true
+ },
+ "organization_slug_uidx": {
+ "name": "organization_slug_uidx",
+ "columns": [
+ "slug"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "columns": [
+ "token"
+ ],
+ "isUnique": true
+ },
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ "user_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ },
+ "analytics_opted_out": {
+ "name": "analytics_opted_out",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_active_organization_id": {
+ "name": "last_active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "columns": [
+ "email"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "verification": {
+ "name": "verification",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(cast(unixepoch('subsecond') * 1000 as integer))"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ "identifier"
+ ],
+ "isUnique": false
+ },
+ "verification_expiresAt_idx": {
+ "name": "verification_expiresAt_idx",
+ "columns": [
+ "expires_at"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "billing_customer_status": {
+ "name": "billing_customer_status",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_paying": {
+ "name": "is_paying",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "paid_plan_id": {
+ "name": "paid_plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "paid_plan_status": {
+ "name": "paid_plan_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "customer_json": {
+ "name": "customer_json",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "synced_at": {
+ "name": "synced_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "billing_customer_status_organization_id_organization_id_fk": {
+ "name": "billing_customer_status_organization_id_organization_id_fk",
+ "tableFrom": "billing_customer_status",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "ga4_connections": {
+ "name": "ga4_connections",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "property_id": {
+ "name": "property_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "property_display_name": {
+ "name": "property_display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "property_time_zone": {
+ "name": "property_time_zone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "property_currency_code": {
+ "name": "property_currency_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "connected_by_user_id": {
+ "name": "connected_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "ga4_account_id": {
+ "name": "ga4_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "connected_account_email": {
+ "name": "connected_account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "ga4_connections_project_idx": {
+ "name": "ga4_connections_project_idx",
+ "columns": [
+ "project_id"
+ ],
+ "isUnique": true
+ },
+ "ga4_connections_organization_idx": {
+ "name": "ga4_connections_organization_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": false
+ },
+ "ga4_connections_connector_idx": {
+ "name": "ga4_connections_connector_idx",
+ "columns": [
+ "connected_by_user_id",
+ "ga4_account_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "ga4_connections_project_id_projects_id_fk": {
+ "name": "ga4_connections_project_id_projects_id_fk",
+ "tableFrom": "ga4_connections",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ga4_connections_organization_id_organization_id_fk": {
+ "name": "ga4_connections_organization_id_organization_id_fk",
+ "tableFrom": "ga4_connections",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "gsc_connections": {
+ "name": "gsc_connections",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "site_url": {
+ "name": "site_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "connected_by_user_id": {
+ "name": "connected_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "gsc_account_id": {
+ "name": "gsc_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "connected_account_email": {
+ "name": "connected_account_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(current_timestamp)"
+ }
+ },
+ "indexes": {
+ "gsc_connections_project_idx": {
+ "name": "gsc_connections_project_idx",
+ "columns": [
+ "project_id"
+ ],
+ "isUnique": true
+ },
+ "gsc_connections_organization_idx": {
+ "name": "gsc_connections_organization_idx",
+ "columns": [
+ "organization_id"
+ ],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "gsc_connections_project_id_projects_id_fk": {
+ "name": "gsc_connections_project_id_projects_id_fk",
+ "tableFrom": "gsc_connections",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "gsc_connections_organization_id_organization_id_fk": {
+ "name": "gsc_connections_organization_id_organization_id_fk",
+ "tableFrom": "gsc_connections",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "telemetry_state": {
+ "name": "telemetry_state",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "install_id": {
+ "name": "install_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "installed_at": {
+ "name": "installed_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_heartbeat_at": {
+ "name": "last_heartbeat_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "last_version": {
+ "name": "last_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "mcp_tool_call_count": {
+ "name": "mcp_tool_call_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json
index 9d57acb9..705de0a8 100644
--- a/drizzle/meta/_journal.json
+++ b/drizzle/meta/_journal.json
@@ -323,6 +323,13 @@
"when": 1788490190561,
"tag": "0045_slimy_master_chief",
"breakpoints": true
+ },
+ {
+ "idx": 46,
+ "version": "6",
+ "when": 1788651415740,
+ "tag": "0046_plain_the_watchers",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/src/client/features/ai-mcp/AgentSetup.tsx b/src/client/features/ai-mcp/AgentSetup.tsx
new file mode 100644
index 00000000..1f2acd76
--- /dev/null
+++ b/src/client/features/ai-mcp/AgentSetup.tsx
@@ -0,0 +1,111 @@
+import { useState } from "react";
+import { ArrowLeft, ArrowRight } from "lucide-react";
+import { AgentSetupPanel, AGENT_SETUP_DESCRIPTION } from "./AgentSetupPanel";
+import { getAgentSetupPrompt } from "./agentSetupPrompt";
+import { captureClientEvent } from "@/client/lib/posthog";
+
+export function AgentSetup({
+ onIntentChange,
+ initialIntent,
+ onComplete,
+ onBack,
+ disabled = false,
+}: {
+ onIntentChange?: (intent: "yes" | "no") => void;
+ initialIntent?: "yes" | "no" | "";
+ onComplete?: (intent: "yes" | "no") => void;
+ onBack?: () => void;
+ disabled?: boolean;
+}) {
+ const [intent, setIntent] = useState(initialIntent ?? "");
+ const prompt = getAgentSetupPrompt(
+ typeof window === "undefined"
+ ? "https://app.openseo.so"
+ : window.location.origin,
+ );
+ const Heading = onComplete ? "h1" : "h2";
+ const chooseIntent = (answer: "yes" | "no") => {
+ if (answer === "yes" || !onComplete) setIntent(answer);
+ onIntentChange?.(answer);
+ captureClientEvent("onboarding:agent_intent", { answer });
+ if (answer === "no") onComplete?.("no");
+ };
+
+ return (
+ <fieldset disabled={disabled}>
+ <div className="mb-8">
+ <Heading className="text-2xl font-semibold tracking-tight">
+ {intent === "yes" ? "Set up your agent" : "Already use an AI agent?"}
+ </Heading>
+ <p className="mt-3 text-pretty text-sm leading-relaxed text-base-content/60">
+ {intent === "yes"
+ ? AGENT_SETUP_DESCRIPTION
+ : "Like Claude, ChatGPT Desktop, or Grok Bot."}
+ </p>
+ </div>
+ {intent === "yes" ? (
+ <>
+ <AgentSetupPanel
+ prompt={prompt}
+ onCopy={() => captureClientEvent("onboarding:setup_prompt_copy")}
+ />
+ <div className="mt-7 flex items-center justify-between gap-3 border-t border-base-300 pt-5">
+ <button
+ type="button"
+ className="flex min-h-10 items-center gap-1.5 text-xs text-base-content/60 hover:text-base-content"
+ onClick={() => setIntent("")}
+ >
+ <ArrowLeft className="size-3.5" /> Back
+ </button>
+ {onComplete && (
+ <button
+ type="button"
+ className="btn btn-ghost btn-sm gap-2"
+ onClick={() => onComplete("yes")}
+ >
+ Go to dashboard <ArrowRight className="size-4" />
+ </button>
+ )}
+ </div>
+ </>
+ ) : (
+ <>
+ <div className="flex items-center justify-between gap-3">
+ {onBack && (
+ <button
+ type="button"
+ className="flex min-h-10 items-center gap-1.5 text-xs text-base-content/60 hover:text-base-content"
+ onClick={onBack}
+ >
+ <ArrowLeft className="size-3.5" /> Back
+ </button>
+ )}
+ <div className="ml-auto flex gap-3">
+ <button
+ type="button"
+ className="btn btn-outline min-w-16"
+ aria-pressed={onComplete ? undefined : intent === "no"}
+ onClick={() => chooseIntent("no")}
+ >
+ No
+ </button>
+ <button
+ type="button"
+ className="btn btn-primary min-w-24"
+ onClick={() => chooseIntent("yes")}
+ >
+ Yes <ArrowRight className="size-4" />
+ </button>
+ </div>
+ </div>
+ {intent === "no" && (
+ <p className="mt-4 text-sm text-base-content/60">
+ You can use the dashboard on its own and connect an agent anytime
+ from AI &amp; MCP.
+ </p>
+ )}
+ </>
+ )}
+ </fieldset>
+ );
+}
diff --git a/src/client/features/ai-mcp/AgentSetupPanel.tsx b/src/client/features/ai-mcp/AgentSetupPanel.tsx
new file mode 100644
index 00000000..85986d13
--- /dev/null
+++ b/src/client/features/ai-mcp/AgentSetupPanel.tsx
@@ -0,0 +1,50 @@
+import { Package } from "lucide-react";
+import { CopyButton } from "./SetupControls";
+
+export const AGENT_SETUP_DESCRIPTION =
+ "Paste this prompt into your agent to automatically configure OpenSEO for you.";
+
+export function AgentSetupPanel({
+ prompt,
+ onCopy,
+}: {
+ prompt: string;
+ onCopy?: () => void;
+}) {
+ return (
+ <>
+ <div className="rounded-xl border border-base-300 bg-base-200/25 p-5">
+ <div className="mb-5 flex items-center gap-3">
+ <span className="flex size-10 shrink-0 items-center justify-center rounded-lg border border-base-300 bg-base-100">
+ <Package className="size-5 text-base-content/70" />
+ </span>
+ <div>
+ <p className="text-sm font-medium">OpenSEO plugin</p>
+ <p className="mt-1 text-xs text-base-content/55">
+ MCP connection + SEO skills
+ </p>
+ </div>
+ </div>
+ <div className="[&>button]:h-11 [&>button]:w-full [&>button]:gap-2 [&>button]:text-sm">
+ <CopyButton
+ primary
+ value={prompt}
+ label="Copy setup prompt"
+ successMessage="Setup prompt copied"
+ onCopy={onCopy}
+ />
+ </div>
+ </div>
+ <div className="mt-4 text-center">
+ <a
+ href="https://openseo.so/docs/mcp"
+ target="_blank"
+ rel="noreferrer"
+ className="text-xs text-base-content/60 underline decoration-base-content/25 underline-offset-4 hover:text-base-content"
+ >
+ Manual setup
+ </a>
+ </div>
+ </>
+ );
+}
diff --git a/src/client/features/ai-mcp/SetupControls.tsx b/src/client/features/ai-mcp/SetupControls.tsx
index 2040ff76..b9fd4925 100644
--- a/src/client/features/ai-mcp/SetupControls.tsx
+++ b/src/client/features/ai-mcp/SetupControls.tsx
@@ -84,12 +84,16 @@ export function CodeBlock({
export function CopyButton({
value,
successMessage,
+ label = "Copy",
iconOnly = false,
+ primary = false,
onCopy,
}: {
value: string;
successMessage: string;
+ label?: string;
iconOnly?: boolean;
+ primary?: boolean;
onCopy?: () => void;
}) {
const [copied, setCopied] = useState(false);
@@ -115,7 +119,7 @@ export function CopyButton({
<button
type="button"
onClick={handleCopy}
- aria-label="Copy"
+ aria-label={label}
className="flex size-7 items-center justify-center rounded-md text-base-content/60 transition-colors hover:bg-base-200 hover:text-base-content"
>
{copied ? (
@@ -131,14 +135,18 @@ export function CopyButton({
<button
type="button"
onClick={handleCopy}
- className="inline-flex items-center gap-1.5 rounded-md border border-base-300 bg-base-100 px-2 py-1 text-xs font-medium text-base-content/70 transition-colors hover:bg-base-300/50 hover:text-base-content"
+ className={
+ primary
+ ? "btn btn-primary"
+ : "inline-flex items-center gap-1.5 rounded-md border border-base-300 bg-base-100 px-2 py-1 text-xs font-medium text-base-content/70 transition-colors hover:bg-base-300/50 hover:text-base-content"
+ }
>
{copied ? (
<Check className="size-3 text-success" />
) : (
<Copy className="size-3" />
)}
- Copy
+ {copied ? "Copied" : label}
</button>
);
}
diff --git a/src/client/features/ai-mcp/agentSetupPrompt.test.ts b/src/client/features/ai-mcp/agentSetupPrompt.test.ts
new file mode 100644
index 00000000..8e229273
--- /dev/null
+++ b/src/client/features/ai-mcp/agentSetupPrompt.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from "vitest";
+import { getAgentSetupPrompt } from "./agentSetupPrompt";
+
+describe("agent setup prompt", () => {
+ it("copies the installer body without its internal skill metadata", () => {
+ const prompt = getAgentSetupPrompt("https://app.openseo.so");
+ expect(prompt).toContain("Identify this agent and its version");
+ expect(prompt).not.toContain("I use Codex");
+ expect(prompt).not.toContain("internal: true");
+ expect(prompt).toContain("https://openseo.so/docs/codex-plugin");
+ expect(prompt).toContain("https://openseo.so/docs/skills/setup");
+ expect(prompt).toContain("whoami and list_projects");
+ });
+ it("uses the current instance for MCP and API keys while keeping public docs links", () => {
+ const prompt = getAgentSetupPrompt("https://seo.example.com");
+ expect(prompt).toContain("https://seo.example.com/mcp");
+ expect(prompt).toContain("https://seo.example.com/settings");
+ expect(prompt).not.toContain("https://app.openseo.so");
+ expect(prompt).toContain("https://openseo.so/docs/mcp");
+ expect(prompt).not.toContain("I use Other agent");
+ });
+});
diff --git a/src/client/features/ai-mcp/agentSetupPrompt.ts b/src/client/features/ai-mcp/agentSetupPrompt.ts
new file mode 100644
index 00000000..9c0b654d
--- /dev/null
+++ b/src/client/features/ai-mcp/agentSetupPrompt.ts
@@ -0,0 +1,9 @@
+import installerSkill from "../../../../.agents/skills/setup-openseo/SKILL.md?raw";
+
+// The copyable installer and internal skill share one source of truth.
+export function getAgentSetupPrompt(origin: string) {
+ const instructions = installerSkill
+ .replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, "")
+ .trim();
+ return instructions.replaceAll("https://app.openseo.so", origin);
+}
diff --git a/src/client/features/dashboard/DashboardOnboarding.test.ts b/src/client/features/dashboard/DashboardOnboarding.test.ts
new file mode 100644
index 00000000..2042150c
--- /dev/null
+++ b/src/client/features/dashboard/DashboardOnboarding.test.ts
@@ -0,0 +1,73 @@
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import type { DashboardActivation } from "@/server/features/dashboard/services/DashboardService";
+import { DashboardOnboarding } from "./DashboardOnboarding";
+import { setupSteps } from "./dashboardSteps";
+
+vi.mock("@/serverFunctions/dashboard", () => ({
+ setDashboardStepDismissed: vi.fn(),
+}));
+vi.mock("@/client/features/integrations/googleLinkError", () => ({
+ getGoogleLinkError: () => null,
+}));
+vi.mock("./DashboardSetupAction", () => ({
+ DashboardSetupAction: () => createElement("div", null, "Connection setup"),
+}));
+
+const fresh: DashboardActivation = {
+ domain: null,
+ ga4: { connected: false, propertyDisplayName: null, cardDismissedAt: null },
+ gsc: { connected: false, siteUrl: null },
+ mcp: { authorizedAt: null, firstToolCallAt: null, cardDismissedAt: null },
+ competitorClickedAt: null,
+ hasMultipleProjects: false,
+ hasTeammate: false,
+ dismissedSteps: [],
+};
+
+function renderChecklist(activation = fresh) {
+ return renderToStaticMarkup(
+ createElement(
+ QueryClientProvider,
+ { client: new QueryClient() },
+ createElement(DashboardOnboarding, {
+ projectId: "project-a",
+ activation,
+ }),
+ ),
+ );
+}
+
+afterEach(() => vi.unstubAllGlobals());
+
+describe("dashboard onboarding visibility", () => {
+ it("opens Search Console setup on the successful OAuth return URL", () => {
+ vi.stubGlobal("window", {
+ location: new URL("https://app.openseo.so/p/project-a#connect-gsc"),
+ });
+ const markup = renderChecklist();
+ expect(markup).toContain('aria-expanded="true" aria-controls="setup-gsc"');
+ expect(markup).toContain("Connection setup");
+ });
+
+ it("keeps setup actions collapsed on an ordinary dashboard visit", () => {
+ vi.stubGlobal("window", {
+ location: new URL("https://app.openseo.so/p/project-a"),
+ });
+ const markup = renderChecklist();
+ expect(markup).not.toContain("Connection setup");
+ expect(markup).toContain('id="setup-gsc" hidden=""');
+ });
+
+ it("renders nothing once every step is completed or skipped", () => {
+ expect(
+ renderChecklist({
+ ...fresh,
+ domain: "example.com",
+ dismissedSteps: setupSteps.map((step) => step.id),
+ }),
+ ).toBe("");
+ });
+});
diff --git a/src/client/features/dashboard/DashboardOnboarding.tsx b/src/client/features/dashboard/DashboardOnboarding.tsx
new file mode 100644
index 00000000..b8d5c038
--- /dev/null
+++ b/src/client/features/dashboard/DashboardOnboarding.tsx
@@ -0,0 +1,193 @@
+import { useState } from "react";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { Check, ChevronRight, RotateCcw } from "lucide-react";
+import { toast } from "sonner";
+import { isHostedClientAuthMode } from "@/lib/auth-mode";
+import { getStandardErrorMessage } from "@/client/lib/error-messages";
+import { captureClientEvent } from "@/client/lib/posthog";
+import { getGoogleLinkError } from "@/client/features/integrations/googleLinkError";
+import { setDashboardStepDismissed } from "@/serverFunctions/dashboard";
+import type { DashboardActivation } from "@/server/features/dashboard/services/DashboardService";
+import type { DashboardSetupStep } from "@/types/schemas/dashboard";
+import { getStepStatus, setupSteps } from "./dashboardSteps";
+import { DashboardSetupAction } from "./DashboardSetupAction";
+
+export function DashboardOnboarding({
+ projectId,
+ activation,
+}: {
+ projectId: string;
+ activation: DashboardActivation;
+}) {
+ const queryClient = useQueryClient();
+ const [selected, setSelected] = useState<DashboardSetupStep | null>(() =>
+ getGoogleLinkError("gsc") ||
+ (typeof window !== "undefined" && window.location.hash === "#connect-gsc")
+ ? "gsc"
+ : null,
+ );
+ const dismiss = useMutation({
+ mutationFn: ({
+ step,
+ dismissed,
+ }: {
+ step: DashboardSetupStep;
+ dismissed: boolean;
+ }) => setDashboardStepDismissed({ data: { projectId, step, dismissed } }),
+ onSuccess: async (_, { step, dismissed }) => {
+ await queryClient.invalidateQueries({
+ queryKey: ["dashboardActivation", projectId],
+ });
+ setSelected(dismissed ? null : step);
+ captureClientEvent("dashboard:setup_step_defer", { step, dismissed });
+ },
+ onError: (error) =>
+ toast.error(
+ getStandardErrorMessage(
+ error,
+ "Couldn’t save your preference. Try again.",
+ ),
+ ),
+ });
+ const steps = setupSteps.filter(
+ (step) => step.id !== "team" || isHostedClientAuthMode(),
+ );
+ const remaining = steps.filter(
+ (step) => getStepStatus(activation, step.id) === "todo",
+ );
+ const completed = steps.filter(
+ (step) => getStepStatus(activation, step.id) === "done",
+ );
+ const deferred = steps.filter(
+ (step) => getStepStatus(activation, step.id) === "skipped",
+ );
+
+ if (remaining.length === 0) return null;
+
+ return (
+ <section
+ aria-label="Onboarding checklist"
+ className="overflow-hidden rounded-xl border border-base-300 bg-base-100"
+ >
+ <header className="border-b border-base-300 px-5 py-5 sm:px-6">
+ <h2 className="text-lg font-semibold">Set up your workspace</h2>
+ <p className="mt-1 text-sm text-base-content/65">
+ Add your website, connect your tools, and invite your team.
+ </p>
+ </header>
+ {remaining.map((item) => {
+ const active = selected === item.id;
+ const Icon = item.icon;
+ return (
+ <div key={item.id} className="border-b border-base-300">
+ <button
+ type="button"
+ aria-expanded={active}
+ aria-controls={`setup-${item.id}`}
+ onClick={() => {
+ setSelected(active ? null : item.id);
+ if (!active)
+ captureClientEvent("dashboard:next_move_click", {
+ step: item.id,
+ });
+ }}
+ className={`flex w-full items-center gap-3 px-5 py-4 text-left sm:px-6 ${active ? "bg-primary/5" : "hover:bg-base-200/50"}`}
+ >
+ <span className="flex size-8 shrink-0 items-center justify-center rounded-lg bg-base-200">
+ <Icon className="size-4" />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="block text-sm font-medium">{item.label}</span>
+ <span className="mt-1 hidden text-xs text-base-content/65 sm:block">
+ {item.detail}
+ </span>
+ </span>
+ {item.id === "domain" && (
+ <span className="hidden text-xs text-primary sm:block">
+ Start here
+ </span>
+ )}
+ <ChevronRight
+ className={`size-4 shrink-0 text-base-content/60 transition-transform ${active ? "rotate-90" : ""}`}
+ />
+ </button>
+ <div id={`setup-${item.id}`} hidden={!active}>
+ {active && (
+ <div className="space-y-5 px-5 py-5 sm:px-6">
+ <DashboardSetupAction
+ step={item.id}
+ projectId={projectId}
+ onComplete={() => setSelected(null)}
+ />
+ <div className="border-t border-base-300 pt-3">
+ <button
+ type="button"
+ className="btn btn-ghost btn-sm text-base-content/60"
+ disabled={dismiss.isPending}
+ onClick={() =>
+ dismiss.mutate({ step: item.id, dismissed: true })
+ }
+ >
+ {item.id === "project"
+ ? "I only need one project"
+ : "Skip for now"}
+ </button>
+ </div>
+ </div>
+ )}
+ </div>
+ </div>
+ );
+ })}
+ {deferred.length > 0 && (
+ <details className="group border-t border-base-300">
+ <summary className="flex cursor-pointer list-none items-center gap-2 px-5 py-4 text-sm text-base-content/65 sm:px-6 [&::-webkit-details-marker]:hidden">
+ <ChevronRight className="size-4 transition-transform group-open:rotate-90" />
+ {deferred.length} saved for later
+ </summary>
+ <ul className="space-y-1 px-5 pb-4 sm:px-6">
+ {deferred.map((item) => (
+ <li
+ key={item.id}
+ className="flex items-center justify-between gap-3 rounded-lg bg-base-200/40 px-3 py-2"
+ >
+ <span className="text-sm">{item.label}</span>
+ <button
+ type="button"
+ aria-label={`Restore ${item.label}`}
+ className="btn btn-ghost btn-sm shrink-0"
+ disabled={dismiss.isPending}
+ onClick={() =>
+ dismiss.mutate({ step: item.id, dismissed: false })
+ }
+ >
+ <RotateCcw className="size-3.5" /> Restore
+ </button>
+ </li>
+ ))}
+ </ul>
+ </details>
+ )}
+ {completed.length > 0 && (
+ <details className="group border-t border-base-300">
+ <summary className="flex cursor-pointer list-none items-center gap-2 px-5 py-4 text-sm sm:px-6 [&::-webkit-details-marker]:hidden">
+ <Check className="size-4 text-success" />
+ {completed.length} completed
+ <ChevronRight className="ml-auto size-4 text-base-content/60 transition-transform group-open:rotate-90" />
+ </summary>
+ <ul className="space-y-3 px-5 pb-5 sm:px-6">
+ {completed.map((item) => (
+ <li
+ key={item.id}
+ className="flex items-center gap-3 text-sm text-base-content/65"
+ >
+ <Check className="size-4 shrink-0 text-success" />
+ {item.label}
+ </li>
+ ))}
+ </ul>
+ </details>
+ )}
+ </section>
+ );
+}
diff --git a/src/client/features/dashboard/DashboardPage.tsx b/src/client/features/dashboard/DashboardPage.tsx
index 6c26e1b5..636d186e 100644
--- a/src/client/features/dashboard/DashboardPage.tsx
+++ b/src/client/features/dashboard/DashboardPage.tsx
@@ -1,237 +1,20 @@
-import { useEffect, useRef, useState } from "react";
-import { Link, useNavigate } from "@tanstack/react-router";
+import { useEffect, useRef } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { toast } from "sonner";
-import { ChevronLeft, ChevronRight, Check } from "lucide-react";
import { sort } from "remeda";
-import { captureClientEvent } from "@/client/lib/posthog";
-import {
- computeNextStep,
- isStepDone,
- STEP_ORDER,
-} from "@/client/features/dashboard/dashboardSteps";
+import { DashboardOnboarding } from "./DashboardOnboarding";
import {
AuditHealthCard,
BacklinkPulseCard,
GscCard,
} from "@/client/features/dashboard/DashboardCards";
import { Ga4Card } from "@/client/features/dashboard/Ga4Card";
-import { McpConnectCard } from "@/client/features/dashboard/McpConnectCard";
import { WorkspaceMergeBanner } from "@/client/features/dashboard/WorkspaceMergeBanner";
import { getStandardErrorMessage } from "@/client/lib/error-messages";
-import type { DashboardActivation } from "@/server/features/dashboard/services/DashboardService";
import {
getDashboardActivation,
getDashboardOverview,
- markDashboardCompetitorClicked,
refreshDashboardBacklinkSnapshot,
} from "@/serverFunctions/dashboard";
-import { setProjectDomain } from "@/serverFunctions/projects";
-import type { DashboardHeroStep } from "@/types/schemas/dashboard";
-
-const HERO_COPY: Record<
- DashboardHeroStep,
- { title: string; body: string; cta: string }
-> = {
- domain: {
- title: "What site are you working on?",
- body: "Set your project's domain and every card on this page starts working for it — backlinks and audits.",
- cta: "Save",
- },
- mcp: {
- title: "Connect your AI agent",
- body: "OpenSEO is built to be used from agents like Claude. Connect once, then ask it to use OpenSEO to help build your SEO strategy.",
- cta: "Show me how",
- },
- gsc: {
- title: "Connect Search Console",
- body: "Your real queries and clicks, straight from Google.",
- cta: "Connect",
- },
- competitor: {
- title: "Size up a competitor",
- body: "Paste a competitor's domain to see what they rank for and who links to them.",
- cta: "Open domain lookup",
- },
-};
-
-function scrollToCard(id: string) {
- document.getElementById(id)?.scrollIntoView({
- behavior: "smooth",
- block: "center",
- });
-}
-
-// Users paste full URLs; store the bare host like settings expects.
-function normalizeDomainInput(value: string): string {
- return value
- .trim()
- .replace(/^https?:\/\//i, "")
- .replace(/\/.*$/, "");
-}
-
-function OnboardingChecklist({
- projectId,
- activation,
-}: {
- projectId: string;
- activation: DashboardActivation;
-}) {
- const navigate = useNavigate();
- const queryClient = useQueryClient();
- const [domainInput, setDomainInput] = useState("");
- // null = follow the first actionable step; set once the user pages with ‹ ›.
- const [viewedIndex, setViewedIndex] = useState<number | null>(null);
- const invalidateActivation = () =>
- void queryClient.invalidateQueries({
- queryKey: ["dashboardActivation", projectId],
- });
-
- const competitorClickMutation = useMutation({
- mutationFn: () => markDashboardCompetitorClicked({ data: { projectId } }),
- onSuccess: invalidateActivation,
- });
- const domainMutation = useMutation({
- mutationFn: (domain: string) =>
- setProjectDomain({ data: { projectId, domain } }),
- onSuccess: () => {
- invalidateActivation();
- void queryClient.invalidateQueries({
- queryKey: ["dashboardOverview", projectId],
- });
- void queryClient.invalidateQueries({ queryKey: ["projects"] });
- },
- onError: (error) =>
- toast.error(
- getStandardErrorMessage(error, "Couldn't save the domain. Try again."),
- ),
- });
-
- // Hidden once every step is done.
- const nextStep = computeNextStep(activation);
- if (!nextStep) return null;
-
- const index = viewedIndex ?? STEP_ORDER.indexOf(nextStep);
- const step = STEP_ORDER[index];
- const copy = HERO_COPY[step];
- const done = isStepDone(activation, step);
-
- const page = (delta: number) =>
- setViewedIndex(Math.min(Math.max(index + delta, 0), STEP_ORDER.length - 1));
-
- const onSubmitDomain = () => {
- const domain = normalizeDomainInput(domainInput);
- if (!domain) return;
- captureClientEvent("dashboard:next_move_click", { step: "domain" });
- domainMutation.mutate(domain);
- };
-
- // Only the gsc/competitor steps use the fallback CTA button — domain
- // renders an inline form and mcp renders a Link.
- const onCta = () => {
- captureClientEvent("dashboard:next_move_click", { step });
- if (step === "gsc") {
- scrollToCard("connect-gsc");
- } else if (step === "competitor") {
- competitorClickMutation.mutate();
- void navigate({ to: "/p/$projectId/domain", params: { projectId } });
- }
- };
-
- return (
- <div className="rounded-xl border border-primary/25 bg-primary/5 shadow-sm">
- <div className="flex items-center justify-between gap-4 px-5 pt-4">
- <p className="text-xs font-medium uppercase tracking-wide text-primary">
- Onboarding checklist
- </p>
- <div className="flex items-center gap-1">
- <button
- type="button"
- className={`btn btn-ghost btn-xs btn-square ${
- index === 0 ? "invisible" : ""
- }`}
- aria-label="Previous step"
- disabled={index === 0}
- onClick={() => page(-1)}
- >
- <ChevronLeft className="size-4" />
- </button>
- <span className="text-xs tabular-nums text-base-content/60">
- {index + 1} / {STEP_ORDER.length}
- </span>
- <button
- type="button"
- className={`btn btn-ghost btn-xs btn-square ${
- index === STEP_ORDER.length - 1 ? "invisible" : ""
- }`}
- aria-label="Next step"
- disabled={index === STEP_ORDER.length - 1}
- onClick={() => page(1)}
- >
- <ChevronRight className="size-4" />
- </button>
- </div>
- </div>
- <div className="flex flex-row flex-wrap items-center justify-between gap-4 p-5 pt-2">
- <div className="min-w-0">
- <h2 className="text-lg font-semibold">{copy.title}</h2>
- <p className="mt-1 max-w-xl text-sm text-base-content/70">
- {copy.body}
- </p>
- </div>
- <div className="flex shrink-0 flex-wrap items-center gap-3">
- {done ? (
- <span className="inline-flex items-center gap-1.5 text-sm font-medium text-success">
- <Check className="size-4" />
- Done
- </span>
- ) : step === "domain" ? (
- <form
- className="join"
- onSubmit={(event) => {
- event.preventDefault();
- onSubmitDomain();
- }}
- >
- <input
- type="text"
- className="input input-bordered join-item w-52"
- placeholder="acme.com"
- value={domainInput}
- onChange={(event) => setDomainInput(event.target.value)}
- aria-label="Your site's domain"
- />
- <button
- type="submit"
- className="btn btn-primary join-item"
- disabled={
- domainMutation.isPending ||
- normalizeDomainInput(domainInput) === ""
- }
- >
- {copy.cta}
- </button>
- </form>
- ) : step === "mcp" ? (
- <Link
- to="/ai"
- className="link link-primary text-sm font-medium"
- onClick={() =>
- captureClientEvent("dashboard:next_move_click", { step })
- }
- >
- {copy.cta} →
- </Link>
- ) : (
- <button type="button" className="btn btn-primary" onClick={onCta}>
- {copy.cta}
- </button>
- )}
- </div>
- </div>
- </div>
- );
-}
export function DashboardPage({ projectId }: { projectId: string }) {
const queryClient = useQueryClient();
@@ -302,25 +85,16 @@ export function DashboardPage({ projectId }: { projectId: string }) {
const gscConnected = activation.gsc.connected;
const ga4Connected = activation.ga4.connected;
- // Array order is the within-bucket order after the data-first sort below:
- // the MCP pitch leads the setup cards.
const cards = [
- ...(activation.mcp.firstToolCallAt || activation.mcp.cardDismissedAt
- ? []
- : [
+ ...(gscConnected
+ ? [
{
- key: "mcp",
- hasData: false,
- node: (
- <McpConnectCard projectId={projectId} activation={activation} />
- ),
+ key: "gsc",
+ hasData: true,
+ node: <GscCard projectId={projectId} connected />,
},
- ]),
- {
- key: "gsc",
- hasData: gscConnected,
- node: <GscCard projectId={projectId} connected={gscConnected} />,
- },
+ ]
+ : []),
...(ga4Connected || !activation.ga4.cardDismissedAt
? [
{
@@ -364,7 +138,11 @@ export function DashboardPage({ projectId }: { projectId: string }) {
<WorkspaceMergeBanner />
- <OnboardingChecklist projectId={projectId} activation={activation} />
+ <DashboardOnboarding
+ key={projectId}
+ projectId={projectId}
+ activation={activation}
+ />
{/* Every card is half width on large screens (only the checklist spans).
Cards with data render before setup pitches and empty states. */}
diff --git a/src/client/features/dashboard/DashboardSetupAction.tsx b/src/client/features/dashboard/DashboardSetupAction.tsx
new file mode 100644
index 00000000..89b627b8
--- /dev/null
+++ b/src/client/features/dashboard/DashboardSetupAction.tsx
@@ -0,0 +1,345 @@
+import { useState } from "react";
+import { useForm } from "@tanstack/react-form";
+import { Link, useNavigate } from "@tanstack/react-router";
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { toast } from "sonner";
+import { getAgentSetupPrompt } from "@/client/features/ai-mcp/agentSetupPrompt";
+import { CopyButton } from "@/client/features/ai-mcp/SetupControls";
+import { SearchConsoleConnectionCard } from "@/client/features/gsc/SearchConsoleConnectionCard";
+import { CreateProjectModal } from "@/client/features/projects/CreateProjectModal";
+import { ProjectMarketFields } from "@/client/features/projects/ProjectMarketFields";
+import type { ProjectSummary } from "@/client/features/projects/types";
+import { InviteTeammateModal } from "@/client/features/team/InviteTeammateModal";
+import { organizationContextQueryOptions } from "@/client/features/team/organizationQueries";
+import { getStandardErrorMessage } from "@/client/lib/error-messages";
+import { captureClientEvent } from "@/client/lib/posthog";
+import { hasOrgPermission } from "@/lib/org-permissions";
+import { getProjects, setProjectWebsite } from "@/serverFunctions/projects";
+import { markDashboardCompetitorClicked } from "@/serverFunctions/dashboard";
+import type { DashboardSetupStep } from "@/types/schemas/dashboard";
+import { parseResearchTarget } from "@/shared/researchScope";
+
+const projectPrompt = `Use OpenSEO to set up a separate project for each website below. List my existing projects first and reuse matches so you don’t create duplicates. Set the country and language for each site, and ask me about anything missing.
+
+Replace this list with my websites:
+- Project name — website — country — language`;
+
+export function DashboardSetupAction({
+ step,
+ projectId,
+ onComplete,
+}: {
+ step: DashboardSetupStep;
+ projectId: string;
+ onComplete: () => void;
+}) {
+ const queryClient = useQueryClient();
+ const navigate = useNavigate();
+ const [showModal, setShowModal] = useState(false);
+ const org = useQuery(organizationContextQueryOptions());
+ const projects = useQuery({
+ queryKey: ["projects"],
+ queryFn: () => getProjects(),
+ enabled: step === "domain",
+ });
+ const project = projects.data?.find((item) => item.id === projectId);
+ const competitor = useMutation({
+ mutationFn: () => markDashboardCompetitorClicked({ data: { projectId } }),
+ onSuccess: async () => {
+ await queryClient.invalidateQueries({
+ queryKey: ["dashboardActivation", projectId],
+ });
+ onComplete();
+ void navigate({ to: "/p/$projectId/domain", params: { projectId } });
+ },
+ onError: (error) => toast.error(getStandardErrorMessage(error)),
+ });
+ if (step === "domain")
+ return project ? (
+ <WebsiteForm project={project} onComplete={onComplete} />
+ ) : projects.isError ? (
+ <p role="alert" className="text-sm text-error">
+ {getStandardErrorMessage(projects.error)}
+ </p>
+ ) : (
+ <div className="skeleton h-36" aria-busy />
+ );
+ if (step === "mcp")
+ return (
+ <div className="max-w-2xl space-y-4">
+ <p className="text-sm leading-relaxed text-base-content/65">
+ Paste this prompt into your agent to automatically configure OpenSEO
+ for you.
+ </p>
+ <div className="flex flex-col gap-4 rounded-lg border border-base-300 bg-base-200/25 p-4 sm:flex-row sm:items-center sm:justify-between">
+ <div>
+ <p className="text-sm font-medium">OpenSEO plugin</p>
+ <p className="mt-1 text-xs text-base-content/60">
+ MCP connection + SEO skills
+ </p>
+ </div>
+ <div className="shrink-0 [&>button]:h-10 [&>button]:w-full [&>button]:gap-2 [&>button]:text-sm">
+ <CopyButton
+ primary
+ value={getAgentSetupPrompt(
+ typeof window === "undefined"
+ ? "https://app.openseo.so"
+ : window.location.origin,
+ )}
+ label="Copy setup prompt"
+ successMessage="Setup prompt copied"
+ onCopy={() =>
+ captureClientEvent("onboarding:setup_prompt_copy", {
+ source: "dashboard",
+ })
+ }
+ />
+ </div>
+ </div>
+ <a
+ href="https://openseo.so/docs/mcp"
+ target="_blank"
+ rel="noreferrer"
+ className="inline-block text-xs text-base-content/60 underline decoration-base-content/25 underline-offset-4 hover:text-base-content"
+ >
+ Manual setup instructions
+ </a>
+ </div>
+ );
+ if (step === "competitor")
+ return (
+ <div className="space-y-4">
+ <p className="text-sm leading-relaxed text-base-content/65">
+ Explore a competitor’s domain to discover the topics they rank for and
+ the websites linking to them.
+ </p>
+ <button
+ type="button"
+ className="btn btn-primary btn-sm"
+ disabled={competitor.isPending}
+ onClick={() => competitor.mutate()}
+ >
+ Open domain lookup
+ </button>
+ </div>
+ );
+
+ const canManage =
+ org.data &&
+ hasOrgPermission(
+ org.data.role,
+ step === "project"
+ ? { project: ["create"] }
+ : step === "team"
+ ? { invitation: ["create"] }
+ : { integration: ["manage"] },
+ );
+ if (!canManage)
+ return (
+ <p className="text-sm text-base-content/65">
+ {org.isPending
+ ? "Checking workspace permissions…"
+ : org.isError
+ ? getStandardErrorMessage(org.error)
+ : "Ask a workspace owner or admin to help with this step."}
+ </p>
+ );
+ if (step === "gsc")
+ return (
+ <SearchConsoleConnectionCard
+ projectId={projectId}
+ returnTo={
+ typeof window === "undefined"
+ ? undefined
+ : `${window.location.href.split("#")[0]}#connect-gsc`
+ }
+ />
+ );
+ if (step === "project")
+ return (
+ <div className="space-y-4">
+ <p className="text-sm leading-relaxed text-base-content/65">
+ Keep each website’s research, rankings, and connections in its own
+ project. Use the project switcher in the sidebar → New project
+ anytime.
+ </p>
+ <button
+ type="button"
+ className="btn btn-primary btn-sm"
+ onClick={() => setShowModal(true)}
+ >
+ Create another project
+ </button>
+ <details className="rounded-lg border border-base-300 p-4">
+ <summary className="cursor-pointer text-sm font-medium">
+ Have a list of websites? Let your agent set them up.
+ </summary>
+ <div className="mt-3 space-y-3">
+ <p className="text-sm text-base-content/65">
+ <Link to="/ai" className="link">
+ Connect your agent
+ </Link>
+ , then paste this prompt with your list of websites.
+ </p>
+ <pre className="whitespace-pre-wrap break-words font-sans text-sm leading-relaxed text-base-content/65">
+ {projectPrompt}
+ </pre>
+ <CopyButton
+ value={projectPrompt}
+ label="Copy project prompt"
+ successMessage="Project prompt copied"
+ />
+ </div>
+ </details>
+ {showModal && (
+ <CreateProjectModal onClose={() => setShowModal(false)} />
+ )}
+ </div>
+ );
+ return (
+ <div className="space-y-4">
+ <p className="text-sm leading-relaxed text-base-content/65">
+ Bring a teammate into your workspace to share projects, research, and
+ results.
+ </p>
+ <button
+ type="button"
+ className="btn btn-primary btn-sm"
+ onClick={() => setShowModal(true)}
+ >
+ Invite a teammate
+ </button>
+ {showModal && (
+ <InviteTeammateModal
+ onClose={() => setShowModal(false)}
+ onInvited={() => {
+ void queryClient.invalidateQueries({
+ queryKey: ["organization-team"],
+ });
+ void queryClient.invalidateQueries({
+ queryKey: ["dashboardActivation"],
+ });
+ }}
+ />
+ )}
+ </div>
+ );
+}
+
+function WebsiteForm({
+ project,
+ onComplete,
+}: {
+ project: ProjectSummary;
+ onComplete: () => void;
+}) {
+ const queryClient = useQueryClient();
+ const save = useMutation({
+ mutationFn: (value: {
+ domain: string;
+ locationCode: number;
+ languageCode: string;
+ }) => setProjectWebsite({ data: { projectId: project.id, ...value } }),
+ onSuccess: async () => {
+ await Promise.all([
+ queryClient.invalidateQueries({ queryKey: ["projects"] }),
+ queryClient.invalidateQueries({
+ queryKey: ["dashboardActivation", project.id],
+ }),
+ queryClient.invalidateQueries({
+ queryKey: ["dashboardOverview", project.id],
+ }),
+ queryClient.invalidateQueries({
+ queryKey: ["projectAccess", project.id],
+ }),
+ ]);
+ toast.success("Website saved");
+ onComplete();
+ },
+ onError: (error) =>
+ toast.error(
+ getStandardErrorMessage(
+ error,
+ "Couldn’t save your website. Try again.",
+ ),
+ ),
+ });
+ const form = useForm({
+ defaultValues: {
+ domain: project.domain ?? "",
+ market: {
+ locationCode: project.locationCode,
+ languageCode: project.languageCode,
+ },
+ },
+ onSubmit: ({ value }) =>
+ save.mutate({ domain: value.domain.trim(), ...value.market }),
+ });
+ return (
+ <form
+ className="max-w-lg space-y-4"
+ onSubmit={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ void form.handleSubmit();
+ }}
+ >
+ <p className="text-sm leading-relaxed text-base-content/65">
+ Add the website for this project and choose the country your customers
+ search from. You can change these in project settings anytime.
+ </p>
+ <form.Field
+ name="domain"
+ validators={{
+ onChange: ({ value }) => {
+ const parsed = parseResearchTarget(value);
+ return parsed.ok ? undefined : parsed.message;
+ },
+ }}
+ >
+ {(field) => (
+ <label className="flex flex-col gap-1.5 text-sm">
+ <span className="font-medium">Website</span>
+ <input
+ type="text"
+ required
+ maxLength={255}
+ placeholder="example.com"
+ className="input input-bordered w-full"
+ value={field.state.value}
+ onBlur={field.handleBlur}
+ onChange={(event) => field.handleChange(event.target.value)}
+ aria-invalid={field.state.meta.errors.length > 0}
+ />
+ {field.state.meta.errors.length > 0 && (
+ <span className="text-xs text-error">
+ {field.state.meta.errors.join(", ")}
+ </span>
+ )}
+ </label>
+ )}
+ </form.Field>
+ <form.Field name="market">
+ {(field) => (
+ <ProjectMarketFields
+ value={field.state.value}
+ onChange={field.handleChange}
+ />
+ )}
+ </form.Field>
+ <form.Subscribe
+ selector={(state) => [state.canSubmit, state.isSubmitting]}
+ >
+ {([canSubmit, isSubmitting]) => (
+ <button
+ type="submit"
+ className="btn btn-primary btn-sm"
+ disabled={!canSubmit || isSubmitting || save.isPending}
+ >
+ {save.isPending ? "Saving…" : "Save website"}
+ </button>
+ )}
+ </form.Subscribe>
+ </form>
+ );
+}
diff --git a/src/client/features/dashboard/McpConnectCard.tsx b/src/client/features/dashboard/McpConnectCard.tsx
deleted file mode 100644
index 860b0dad..00000000
--- a/src/client/features/dashboard/McpConnectCard.tsx
+++ /dev/null
@@ -1,126 +0,0 @@
-import { Link } from "@tanstack/react-router";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { CopyButton } from "@/client/features/ai-mcp/SetupControls";
-import { captureClientEvent } from "@/client/lib/posthog";
-import type { DashboardActivation } from "@/server/features/dashboard/services/DashboardService";
-import { dismissDashboardMcpCard } from "@/serverFunctions/dashboard";
-
-function firstPrompts(domain: string | null): string[] {
- const site = domain ?? "my site";
- return [
- `Review ${site}. Ideas for what keywords we could target? Use OpenSEO`,
- "Research my competitors top pages and keywords and tell me what's working. Use OpenSEO",
- ];
-}
-
-/**
- * The MCP activation card. Pitches the agent workflow and links to the
- * AI & MCP page for setup; disappears for good after the org's first
- * external tool call (or an explicit "I already connected").
- */
-export function McpConnectCard({
- projectId,
- activation,
-}: {
- projectId: string;
- activation: DashboardActivation;
-}) {
- const queryClient = useQueryClient();
- const dismissMutation = useMutation({
- mutationFn: () => dismissDashboardMcpCard({ data: { projectId } }),
- onSuccess: () =>
- void queryClient.invalidateQueries({
- queryKey: ["dashboardActivation", projectId],
- }),
- });
-
- if (activation.mcp.firstToolCallAt || activation.mcp.cardDismissedAt) {
- return null;
- }
-
- const connected = activation.mcp.authorizedAt !== null;
-
- return (
- <div className="overflow-hidden rounded-xl border border-base-300 bg-base-100 shadow-sm">
- <div className="flex items-center justify-between gap-4 px-5 py-4">
- <h2 className="text-base font-semibold leading-tight">
- Connect your AI agent
- </h2>
- <div className="flex items-center gap-2">
- {connected ? (
- <span className="badge badge-success badge-outline badge-sm">
- Connected
- </span>
- ) : null}
- <button
- type="button"
- className="btn btn-ghost btn-xs text-base-content/60"
- disabled={dismissMutation.isPending}
- onClick={() => {
- captureClientEvent("dashboard:mcp_already_connected");
- dismissMutation.mutate();
- }}
- >
- I already connected
- </button>
- </div>
- </div>
- <div className="space-y-3 border-t border-base-300 p-5">
- {connected ? (
- <>
- <p className="text-sm text-base-content/70">
- Your agent is connected. Try asking it:
- </p>
- <ul className="space-y-2">
- {firstPrompts(activation.domain).map((prompt) => (
- <li
- key={prompt}
- className="flex items-center justify-between gap-2 rounded-md border border-base-300 bg-base-200/50 px-3 py-2"
- >
- <span className="min-w-0 truncate text-xs text-base-content/80">
- {prompt}
- </span>
- <CopyButton
- value={prompt}
- successMessage="Prompt copied"
- iconOnly
- onCopy={() =>
- captureClientEvent("dashboard:mcp_prompt_copy")
- }
- />
- </li>
- ))}
- </ul>
- <p className="text-xs text-base-content/50">
- Waiting for your first call — this card disappears once your agent
- talks to OpenSEO.
- </p>
- </>
- ) : (
- <>
- <div className="space-y-2 text-sm text-base-content/70">
- <p>
- OpenSEO is designed to give your AI agent the data it needs to
- build a great SEO strategy and help you execute it.
- </p>
- <p>
- This way you aren&rsquo;t limited on &ldquo;AI credits&rdquo;.
- </p>
- <p>
- You can work with your agent to figure out what automations make
- sense for you and it can help you write content too.
- </p>
- </div>
- <Link
- to="/ai"
- className="link link-primary text-sm font-medium"
- onClick={() => captureClientEvent("dashboard:mcp_setup_open")}
- >
- Set up in AI &amp; MCP →
- </Link>
- </>
- )}
- </div>
- </div>
- );
-}
diff --git a/src/client/features/dashboard/dashboardSteps.test.ts b/src/client/features/dashboard/dashboardSteps.test.ts
new file mode 100644
index 00000000..6d601858
--- /dev/null
+++ b/src/client/features/dashboard/dashboardSteps.test.ts
@@ -0,0 +1,60 @@
+import { describe, expect, it } from "vitest";
+import type { DashboardActivation } from "@/server/features/dashboard/services/DashboardService";
+import { getStepStatus, setupSteps } from "./dashboardSteps";
+
+const fresh: DashboardActivation = {
+ domain: null,
+ ga4: { connected: false, propertyDisplayName: null, cardDismissedAt: null },
+ gsc: { connected: false, siteUrl: null },
+ mcp: { authorizedAt: null, firstToolCallAt: null, cardDismissedAt: null },
+ competitorClickedAt: null,
+ hasMultipleProjects: false,
+ hasTeammate: false,
+ dismissedSteps: [],
+};
+
+describe("dashboard checklist", () => {
+ it("starts with the website and has no SAM chat step", () => {
+ expect(setupSteps.map((step) => step.id)).toEqual([
+ "domain",
+ "project",
+ "competitor",
+ "mcp",
+ "gsc",
+ "team",
+ ]);
+ expect(
+ setupSteps.every((step) => getStepStatus(fresh, step.id) === "todo"),
+ ).toBe(true);
+ });
+ it("does not count skipped steps as completed", () => {
+ expect(
+ getStepStatus({ ...fresh, dismissedSteps: ["project"] }, "project"),
+ ).toBe("skipped");
+ expect(
+ getStepStatus(
+ { ...fresh, mcp: { ...fresh.mcp, cardDismissedAt: "2026-09-05" } },
+ "mcp",
+ ),
+ ).toBe("skipped");
+ });
+ it("recognizes setup completed elsewhere even after skipping it", () => {
+ const complete: DashboardActivation = {
+ ...fresh,
+ domain: "example.com",
+ hasMultipleProjects: true,
+ hasTeammate: true,
+ competitorClickedAt: "2026-09-05",
+ gsc: { connected: true, siteUrl: "sc-domain:example.com" },
+ mcp: { ...fresh.mcp, firstToolCallAt: "2026-09-05" },
+ dismissedSteps: setupSteps.map((step) => step.id),
+ };
+ expect(
+ setupSteps.every((step) => getStepStatus(complete, step.id) === "done"),
+ ).toBe(true);
+ });
+ it("makes disconnected and no-longer-completed steps available again", () => {
+ expect(getStepStatus(fresh, "gsc")).toBe("todo");
+ expect(getStepStatus(fresh, "team")).toBe("todo");
+ });
+});
diff --git a/src/client/features/dashboard/dashboardSteps.ts b/src/client/features/dashboard/dashboardSteps.ts
index aae78f2b..0a7b3ee0 100644
--- a/src/client/features/dashboard/dashboardSteps.ts
+++ b/src/client/features/dashboard/dashboardSteps.ts
@@ -1,42 +1,72 @@
+import { Bot, FolderPlus, Globe, Search, Users } from "lucide-react";
import type { DashboardActivation } from "@/server/features/dashboard/services/DashboardService";
-import type { DashboardHeroStep } from "@/types/schemas/dashboard";
+import type { DashboardSetupStep } from "@/types/schemas/dashboard";
-export const STEP_ORDER: DashboardHeroStep[] = [
- "domain",
- "mcp",
- "gsc",
- "competitor",
+export const setupSteps: {
+ id: DashboardSetupStep;
+ label: string;
+ detail: string;
+ icon: typeof Globe;
+}[] = [
+ {
+ id: "domain",
+ label: "Add your website",
+ detail: "Set the website and country for this project.",
+ icon: Globe,
+ },
+ {
+ id: "project",
+ label: "Working on multiple websites?",
+ detail:
+ "Create another project, or let your AI agent set up a list of sites.",
+ icon: FolderPlus,
+ },
+ {
+ id: "competitor",
+ label: "Explore a competitor",
+ detail: "Find topics and links worth learning from.",
+ icon: Search,
+ },
+ {
+ id: "mcp",
+ label: "Connect your AI agent",
+ detail: "Use OpenSEO inside Claude or your favorite agent.",
+ icon: Bot,
+ },
+ {
+ id: "gsc",
+ label: "Connect Search Console",
+ detail: "Bring your real clicks and queries into view.",
+ icon: Search,
+ },
+ {
+ id: "team",
+ label: "Invite a teammate",
+ detail: "Share the work, or keep things solo for now.",
+ icon: Users,
+ },
];
-// A step is "done" when the underlying product state exists, regardless of
-// how it got there. The MCP hero step completes at authorization (the card
-// below owns the connected-but-no-call-yet coaching) or when the user said
-// "I already connected".
-export function isStepDone(
+export function getStepStatus(
activation: DashboardActivation,
- step: DashboardHeroStep,
-): boolean {
- switch (step) {
- case "domain":
- return activation.domain !== null;
- case "mcp":
- return (
- activation.mcp.authorizedAt !== null ||
- activation.mcp.cardDismissedAt !== null
- );
- case "gsc":
- return activation.gsc.connected;
- case "competitor":
- return activation.competitorClickedAt !== null;
- }
-}
-
-/** The single step the hero should coach next; null = coaching is over. */
-export function computeNextStep(
- activation: DashboardActivation,
-): DashboardHeroStep | null {
- for (const step of STEP_ORDER) {
- if (!isStepDone(activation, step)) return step;
- }
- return null;
+ step: DashboardSetupStep,
+): "done" | "skipped" | "todo" {
+ const completed: Record<DashboardSetupStep, boolean> = {
+ domain: activation.domain !== null,
+ project: activation.hasMultipleProjects,
+ competitor: activation.competitorClickedAt !== null,
+ mcp:
+ activation.mcp.authorizedAt !== null ||
+ activation.mcp.firstToolCallAt !== null,
+ gsc: activation.gsc.connected,
+ team: activation.hasTeammate,
+ };
+ if (completed[step]) return "done";
+ // Preserve previous MCP dismissals without treating them as authorization.
+ if (
+ activation.dismissedSteps.includes(step) ||
+ (step === "mcp" && activation.mcp.cardDismissedAt !== null)
+ )
+ return "skipped";
+ return "todo";
}
diff --git a/src/client/features/gsc/SearchConsoleConnectionCard.tsx b/src/client/features/gsc/SearchConsoleConnectionCard.tsx
index f1ecdcc1..57709a21 100644
--- a/src/client/features/gsc/SearchConsoleConnectionCard.tsx
+++ b/src/client/features/gsc/SearchConsoleConnectionCard.tsx
@@ -25,8 +25,10 @@ const GRANT_STATUS_KEY = ["gscGrantStatus"];
export function SearchConsoleConnectionCard({
projectId,
+ returnTo,
}: {
projectId: string;
+ returnTo?: string;
}) {
const hosted = isHostedClientAuthMode();
const queryClient = useQueryClient();
@@ -137,7 +139,8 @@ export function SearchConsoleConnectionCard({
onError: (error) => toast.error(getStandardErrorMessage(error)),
});
- const handleConnect = () => void startGoogleLink("gsc", window.location.href);
+ const handleConnect = () =>
+ void startGoogleLink("gsc", returnTo ?? window.location.href);
return (
<IntegrationConnectionCard
diff --git a/src/client/features/onboarding/CompactAgentPrompt.tsx b/src/client/features/onboarding/CompactAgentPrompt.tsx
new file mode 100644
index 00000000..281c6cbd
--- /dev/null
+++ b/src/client/features/onboarding/CompactAgentPrompt.tsx
@@ -0,0 +1,97 @@
+import { AgentSetupPanel } from "@/client/features/ai-mcp/AgentSetupPanel";
+import { ArrowLeft, ArrowRight, FileText } from "lucide-react";
+import { CopyButton } from "@/client/features/ai-mcp/SetupControls";
+import { getAgentSetupPrompt } from "@/client/features/ai-mcp/agentSetupPrompt";
+
+export type CompactTreatment = "panel" | "simple" | "preview";
+
+export function CompactAgentPrompt({
+ treatment,
+ onBack,
+ onFinish,
+}: {
+ treatment: CompactTreatment;
+ onBack: () => void;
+ onFinish: () => void;
+}) {
+ const prompt = getAgentSetupPrompt("https://app.openseo.so");
+ const copy = (
+ <div className="[&>button]:h-11 [&>button]:w-full [&>button]:gap-2 [&>button]:text-sm">
+ <CopyButton
+ primary
+ value={prompt}
+ label="Copy setup prompt"
+ successMessage="Setup prompt copied"
+ />
+ </div>
+ );
+ const manual = (
+ <a
+ href="https://openseo.so/docs/mcp"
+ target="_blank"
+ rel="noreferrer"
+ className="text-xs text-base-content/60 underline decoration-base-content/25 underline-offset-4 hover:text-base-content"
+ >
+ Manual setup
+ </a>
+ );
+
+ return (
+ <div>
+ {treatment === "panel" && <AgentSetupPanel prompt={prompt} />}
+ {treatment === "simple" && (
+ <>
+ <div className="mb-5 flex items-center justify-between gap-3">
+ <span className="text-sm font-medium">OpenSEO plugin</span>
+ <span className="rounded-md border border-base-300 px-2 py-1 text-xs text-base-content/60">
+ MCP + skills
+ </span>
+ </div>
+ {copy}
+ <div className="mt-4 text-center">{manual}</div>
+ </>
+ )}
+ {treatment === "preview" && (
+ <>
+ <div className="overflow-hidden rounded-xl border border-base-300">
+ <div className="flex items-center justify-between gap-3 border-b border-base-300 bg-base-200/40 px-5 py-3.5">
+ <span className="flex items-center gap-2 text-xs font-medium">
+ <FileText className="size-3.5 text-base-content/60" /> Setup
+ prompt
+ </span>
+ <span className="text-xs text-base-content/45">OpenSEO</span>
+ </div>
+ <div className="p-5">
+ <p className="text-sm font-medium">
+ Set up OpenSEO in this agent.
+ </p>
+ <p className="mt-2 text-xs leading-relaxed text-base-content/60">
+ Detect the agent. Install the plugin (MCP + skills).
+ <br className="hidden sm:block" /> Guide me through sign-in and
+ verify the connection.
+ </p>
+ </div>
+ <div className="border-t border-base-300 p-4">{copy}</div>
+ </div>
+ <div className="mt-4 text-center">{manual}</div>
+ </>
+ )}
+ <div className="mt-7 flex items-center justify-between gap-3 border-t border-base-300 pt-5">
+ <button
+ type="button"
+ className="flex min-h-10 items-center gap-1.5 text-xs text-base-content/60 hover:text-base-content"
+ onClick={onBack}
+ >
+ <ArrowLeft className="size-3.5" /> Back
+ </button>
+ <button
+ type="button"
+ className="btn btn-ghost btn-sm gap-2"
+ onClick={onFinish}
+ >
+ Go to dashboard <ArrowRight className="size-4" />
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/src/client/features/onboarding/OnboardingCard.tsx b/src/client/features/onboarding/OnboardingCard.tsx
new file mode 100644
index 00000000..6ca1a1f1
--- /dev/null
+++ b/src/client/features/onboarding/OnboardingCard.tsx
@@ -0,0 +1,39 @@
+import type { ReactNode } from "react";
+
+export function OnboardingCard({
+ step,
+ total,
+ children,
+}: {
+ step: number;
+ total: number;
+ children: ReactNode;
+}) {
+ return (
+ <div className="w-full max-w-xl py-8">
+ <div className="flex items-center justify-center gap-2 text-sm font-semibold">
+ <img src="/transparent-logo.png" alt="" className="size-7" />
+ OpenSEO
+ </div>
+ <main className="mt-8 rounded-2xl border border-base-300 bg-base-100 p-6 shadow-sm md:mt-12 md:p-10">
+ <div
+ className="mb-8 flex gap-2"
+ role="progressbar"
+ aria-label="Onboarding progress"
+ aria-valuemin={1}
+ aria-valuemax={total}
+ aria-valuenow={step}
+ aria-valuetext={`Step ${step} of ${total}`}
+ >
+ {Array.from({ length: total }, (_, index) => (
+ <span
+ key={index}
+ className={`h-1 flex-1 rounded-full ${index < step ? "bg-primary" : "bg-base-300"}`}
+ />
+ ))}
+ </div>
+ {children}
+ </main>
+ </div>
+ );
+}
diff --git a/src/client/features/onboarding/PostSignupOnboarding.tsx b/src/client/features/onboarding/PostSignupOnboarding.tsx
index a16e269e..9a01cc3a 100644
--- a/src/client/features/onboarding/PostSignupOnboarding.tsx
+++ b/src/client/features/onboarding/PostSignupOnboarding.tsx
@@ -1,4 +1,5 @@
-import { ArrowRight, Check } from "lucide-react";
+import { OnboardingCard } from "./OnboardingCard";
+import { ArrowLeft, ArrowRight, Check } from "lucide-react";
import type { ReactNode } from "react";
import { Fragment } from "react";
import {
@@ -6,32 +7,26 @@ import {
CLIENT_WORK_FOR,
INTEREST_OPTIONS,
ONBOARDING_LAST_STEP,
+ ONBOARDING_OPTION_LABELS,
type OnboardingAnswers,
SOURCE_OPTIONS,
- SOURCE_OPTIONS_HIDDEN_ON_MOBILE,
WORK_FOR_OPTIONS,
} from "@/client/features/onboarding/onboardingModel";
-import { SearchConsoleOnboardingStep } from "@/client/features/onboarding/SearchConsoleOnboardingStep";
+import { AgentSetup } from "@/client/features/ai-mcp/AgentSetup";
type PostSignupOnboardingProps = {
- firstName: string;
- title?: string;
- helperText?: string;
step: number;
answers: OnboardingAnswers;
onAnswersChange: (answers: OnboardingAnswers) => void;
onNext: () => void;
onBack: () => void;
onSkip: () => void;
- onFinish: () => void;
+ onFinish: (mcpSetupIntent?: "yes" | "no") => void;
isSaving: boolean;
accountMenu: ReactNode;
};
export function PostSignupOnboarding({
- firstName,
- title,
- helperText,
step,
answers,
onAnswersChange,
@@ -55,122 +50,111 @@ export function PostSignupOnboarding({
onAnswersChange({ ...answers, ...patch });
return (
- <div className="w-full max-w-md space-y-6">
+ <>
{accountMenu}
-
- <div className="text-center space-y-3">
- <img
- src="/transparent-logo.png"
- alt="OpenSEO"
- className="mx-auto size-10 rounded-lg"
- />
- <p className="text-xs font-medium uppercase tracking-wide text-base-content/50">
- Step {step + 1} of {ONBOARDING_LAST_STEP + 1}
- </p>
- <h1 className="text-xl font-semibold">
- {title ??
- (firstName
- ? `Welcome to OpenSEO, ${firstName}!`
- : "Welcome to OpenSEO!")}
- </h1>
- <p className="text-sm text-base-content/60">
- {helperText ?? "A few quick answers to set things up."}
- </p>
- </div>
-
- <div className="rounded-lg border border-base-300 bg-base-100 p-5 shadow-sm">
- {step === 0 ? (
- <OnboardingChoiceGroup
- title="What tasks matter to you most?"
- description="Pick up to 3."
- maxSelections={3}
- options={[...INTEREST_OPTIONS]}
- selectedValues={answers.selectedInterests}
- onToggle={(value) => {
- updateAnswers({
- selectedInterests: answers.selectedInterests.includes(value)
- ? answers.selectedInterests.filter((item) => item !== value)
- : [...answers.selectedInterests, value],
- });
- }}
- otherValue={answers.interestOther}
- onOtherChange={(interestOther) => updateAnswers({ interestOther })}
- multiple
- />
- ) : step === 1 ? (
- <OnboardingChoiceGroup
- title="Who are you doing SEO for?"
- options={[...WORK_FOR_OPTIONS]}
- selectedValues={answers.workFor ? [answers.workFor] : []}
- onToggle={(workFor) => updateAnswers({ workFor })}
- otherValue={answers.workForOther}
- onOtherChange={(workForOther) => updateAnswers({ workForOther })}
- followUp={{
- showForValue: CLIENT_WORK_FOR,
- label: "About how many client sites do you work on?",
- options: [...CLIENT_WEBSITE_COUNT_OPTIONS],
- value: answers.clientWebsiteCount,
- onChange: (clientWebsiteCount) =>
- updateAnswers({ clientWebsiteCount }),
- }}
- />
- ) : step === 2 ? (
- <OnboardingChoiceGroup
- title="How did you find OpenSEO?"
- options={[...SOURCE_OPTIONS]}
- selectedValues={answers.source ? [answers.source] : []}
- onToggle={(source) => updateAnswers({ source })}
- otherValue={answers.sourceOther}
- onOtherChange={(sourceOther) => updateAnswers({ sourceOther })}
- hiddenOnMobile={[...SOURCE_OPTIONS_HIDDEN_ON_MOBILE]}
- />
- ) : (
- <SearchConsoleOnboardingStep />
- )}
-
- <div className="mt-5 flex items-center justify-between gap-3">
- <button
- type="button"
- className="btn btn-ghost"
- disabled={step === 0 || isSaving}
- onClick={onBack}
- >
- Back
- </button>
- {step < ONBOARDING_LAST_STEP ? (
- <div className="flex items-center gap-2">
- <button
- type="button"
- className="btn btn-ghost btn-sm text-base-content/55"
- disabled={isSaving}
- onClick={onSkip}
- >
- Skip
- </button>
- <button
- type="button"
- className="btn btn-primary"
- disabled={!canContinue || isSaving}
- onClick={onNext}
- >
- Continue
- <ArrowRight className="size-4" />
- </button>
- </div>
+ <OnboardingCard step={step + 1} total={ONBOARDING_LAST_STEP + 1}>
+ <fieldset disabled={isSaving}>
+ {step === 0 ? (
+ <OnboardingChoiceGroup
+ title="What brings you here?"
+ description="Pick up to three things you want to work on."
+ maxSelections={3}
+ options={[...INTEREST_OPTIONS]}
+ selectedValues={answers.selectedInterests}
+ onToggle={(value) => {
+ updateAnswers({
+ selectedInterests: answers.selectedInterests.includes(value)
+ ? answers.selectedInterests.filter((item) => item !== value)
+ : [...answers.selectedInterests, value],
+ });
+ }}
+ otherValue={answers.interestOther}
+ onOtherChange={(interestOther) =>
+ updateAnswers({ interestOther })
+ }
+ multiple
+ />
+ ) : step === 1 ? (
+ <OnboardingChoiceGroup
+ title="Who are you doing SEO for?"
+ options={[...WORK_FOR_OPTIONS]}
+ selectedValues={answers.workFor ? [answers.workFor] : []}
+ onToggle={(workFor) => updateAnswers({ workFor })}
+ otherValue={answers.workForOther}
+ onOtherChange={(workForOther) => updateAnswers({ workForOther })}
+ followUp={{
+ showForValue: CLIENT_WORK_FOR,
+ label: "About how many client sites do you work on?",
+ options: [...CLIENT_WEBSITE_COUNT_OPTIONS],
+ value: answers.clientWebsiteCount,
+ onChange: (clientWebsiteCount) =>
+ updateAnswers({ clientWebsiteCount }),
+ }}
+ />
+ ) : step === 2 ? (
+ <OnboardingChoiceGroup
+ title="How did you find OpenSEO?"
+ options={[...SOURCE_OPTIONS]}
+ selectedValues={answers.source ? [answers.source] : []}
+ onToggle={(source) => updateAnswers({ source })}
+ otherValue={answers.sourceOther}
+ onOtherChange={(sourceOther) => updateAnswers({ sourceOther })}
+ />
) : (
- <button
- type="button"
- className="btn btn-primary"
+ <AgentSetup
+ initialIntent={answers.mcpSetupIntent}
+ onComplete={onFinish}
+ onBack={onBack}
disabled={isSaving}
- onClick={onFinish}
- >
- Finish
- <ArrowRight className="size-4" />
- </button>
+ onIntentChange={(mcpSetupIntent) =>
+ updateAnswers({ mcpSetupIntent })
+ }
+ />
)}
- </div>
- </div>
- </div>
+
+ {step < ONBOARDING_LAST_STEP && (
+ <div className="mt-8 flex items-center justify-between gap-3">
+ {step > 0 ? (
+ <button
+ type="button"
+ className="flex min-h-10 items-center gap-1.5 text-xs text-base-content/60 hover:text-base-content"
+ onClick={onBack}
+ >
+ <ArrowLeft className="size-3.5" /> Back
+ </button>
+ ) : (
+ <button
+ type="button"
+ className="btn btn-ghost"
+ onClick={onSkip}
+ >
+ Skip
+ </button>
+ )}
+ <div className="flex items-center gap-2">
+ {step > 0 && (
+ <button
+ type="button"
+ className="btn btn-ghost btn-sm text-base-content/55"
+ onClick={onSkip}
+ >
+ Skip
+ </button>
+ )}
+ <button
+ type="button"
+ className="btn btn-primary"
+ disabled={!canContinue || isSaving}
+ onClick={onNext}
+ >
+ Continue <ArrowRight className="size-4" />
+ </button>
+ </div>
+ </div>
+ )}
+ </fieldset>
+ </OnboardingCard>
+ </>
);
}
@@ -185,7 +169,6 @@ function OnboardingChoiceGroup({
multiple = false,
maxSelections,
followUp,
- hiddenOnMobile,
}: {
title: string;
description?: string;
@@ -196,7 +179,6 @@ function OnboardingChoiceGroup({
onOtherChange: (value: string) => void;
multiple?: boolean;
maxSelections?: number;
- hiddenOnMobile?: string[];
followUp?: {
showForValue: string;
label: string;
@@ -212,44 +194,44 @@ function OnboardingChoiceGroup({
maxSelections !== undefined && selectedValues.length >= maxSelections;
return (
- <div className="space-y-4">
- <div>
- <h2 className="text-lg font-semibold">{title}</h2>
+ <div>
+ <div className="mb-8">
+ <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
{description ? (
- <p className="mt-1 text-sm text-base-content/60">{description}</p>
+ <p className="mt-3 text-sm leading-relaxed text-base-content/60">
+ {description}
+ </p>
) : null}
</div>
- <div className="grid gap-2">
+ <div className="flex flex-wrap gap-2">
{options.map((option) => {
const selected = selectedValues.includes(option);
const disabled = atLimit && !selected;
const showFollowUpHere =
showFollowUp && followUp?.showForValue === option;
- // Selected options stay visible so a restored answer never vanishes.
- const mobileHidden = hiddenOnMobile?.includes(option) && !selected;
return (
<Fragment key={option}>
<button
type="button"
- className={`${mobileHidden ? "hidden sm:flex" : "flex"} min-h-11 items-center justify-between rounded-lg border px-3 py-2 text-left text-sm transition-colors ${
- selected
- ? "border-base-content bg-base-200 text-base-content"
- : disabled
- ? "border-base-300 text-base-content/35 cursor-not-allowed"
- : "border-base-300 text-base-content/75 hover:border-base-content/40 hover:bg-base-200/60"
- }`}
+ className={`flex min-h-11 items-center gap-3 rounded-full border px-4 py-2.5 text-left text-sm transition-colors focus-visible:outline-2 focus-visible:outline-primary ${selected ? "border-primary bg-primary/5 text-primary" : "border-base-300 hover:bg-base-200"} disabled:cursor-not-allowed disabled:opacity-35`}
aria-pressed={selected}
disabled={disabled}
onClick={() => onToggle(option)}
>
- <span>{option}</span>
- {selected ? <Check className="size-4 shrink-0" /> : null}
+ <span
+ className={`flex size-4 shrink-0 items-center justify-center border ${multiple ? "rounded" : "rounded-full"} ${selected ? "border-primary bg-primary text-primary-content" : "border-base-content/30"}`}
+ >
+ {selected && <Check className="size-3" />}
+ </span>
+ <span className="capitalize">
+ {ONBOARDING_OPTION_LABELS[option] ?? option}
+ </span>
</button>
{showFollowUpHere && followUp ? (
- <div className="rounded-lg border border-base-300 bg-base-200/40 px-3 py-2.5">
+ <div className="w-full rounded-lg border border-base-300 bg-base-200/40 p-4">
<p className="text-sm text-base-content/70">
{followUp.label}
</p>
@@ -289,7 +271,8 @@ function OnboardingChoiceGroup({
{isOtherSelected ? (
<input
type="text"
- className="input input-bordered w-full"
+ className="input input-bordered mt-4 w-full"
+ aria-label={multiple ? "Other tasks" : "Other answer"}
placeholder={multiple ? "Tell us what else..." : "Tell us more..."}
value={otherValue}
onChange={(event) => onOtherChange(event.target.value)}
diff --git a/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx b/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx
deleted file mode 100644
index 5a43fec6..00000000
--- a/src/client/features/onboarding/SearchConsoleOnboardingStep.tsx
+++ /dev/null
@@ -1,221 +0,0 @@
-import * as React from "react";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { Check } from "lucide-react";
-import { toast } from "sonner";
-import { GoogleGlyph } from "@/client/features/gsc/GoogleGlyph";
-import { GoogleLinkErrorAlert } from "@/client/features/integrations/GoogleLinkErrorAlert";
-import { SelfHostedSetupWarning } from "@/client/features/gsc/SelfHostedSetupWarning";
-import {
- SitePicker,
- type GscSiteSelection,
-} from "@/client/features/gsc/SitePicker";
-import { startGoogleLink } from "@/client/features/integrations/startGoogleLink";
-import { getStandardErrorMessage } from "@/client/lib/error-messages";
-import { captureClientEvent } from "@/client/lib/posthog";
-import { ProjectMarketFields } from "@/client/features/projects/ProjectMarketFields";
-import type { ProjectMarket } from "@/client/features/projects/types";
-import {
- getGscConnection,
- listGscSites,
- setGscSite,
-} from "@/serverFunctions/gsc";
-import { getProjects, setProjectMarket } from "@/serverFunctions/projects";
-
-const GRANT_STATUS_KEY = ["gscGrantStatus"];
-
-/**
- * Onboarding step for connecting Google Search Console: link the account-level
- * OAuth grant, then bind a verified property to the user's first project —
- * the same binding the project's Integrations page does — so it's done in one
- * place.
- */
-export function SearchConsoleOnboardingStep() {
- const projectsQuery = useQuery({
- queryKey: ["projects"],
- queryFn: () => getProjects(),
- });
- const project = projectsQuery.data?.[0];
-
- return (
- <div className="space-y-8">
- <div className="space-y-4">
- <h2 className="text-lg font-semibold">
- Connect with Google Search Console now?
- </h2>
-
- {project ? <GscConnect projectId={project.id} /> : <Checking />}
-
- <p className="hidden sm:block text-xs leading-relaxed text-base-content/55">
- For now, Search Console data flows through the OpenSEO MCP. We're
- building it into the OpenSEO app soon too.
- </p>
- </div>
-
- <div className="space-y-4">
- <h2 className="text-lg font-semibold">Choose country &amp; language</h2>
- {project ? <DefaultMarketPicker project={project} /> : <Checking />}
- </div>
- </div>
- );
-}
-
-/**
- * Sets the project's default market during onboarding, so keyword, SERP, and
- * domain data lands on the user's market from their first search instead of
- * defaulting to the US. Saves on change — the step's Continue button belongs
- * to the wizard, so a separate Save here would be easy to walk past.
- */
-function DefaultMarketPicker({
- project,
-}: {
- project: { id: string; locationCode: number; languageCode: string };
-}) {
- const queryClient = useQueryClient();
- const [market, setMarket] = React.useState<ProjectMarket>({
- locationCode: project.locationCode,
- languageCode: project.languageCode,
- });
-
- const saveMutation = useMutation({
- mutationFn: (next: ProjectMarket) =>
- setProjectMarket({ data: { projectId: project.id, ...next } }),
- onSuccess: () => queryClient.invalidateQueries({ queryKey: ["projects"] }),
- onError: (error) => toast.error(getStandardErrorMessage(error)),
- });
-
- const handleChange = (next: ProjectMarket) => {
- setMarket(next);
- saveMutation.mutate(next);
- };
-
- return (
- <div className="space-y-2">
- <ProjectMarketFields
- value={market}
- onChange={handleChange}
- hideLanguageOnMobile
- />
- <p className="hidden sm:block text-xs leading-relaxed text-base-content/55">
- We'll use this country and language for keyword, SERP, and domain data
- unless you pick a different one. You can change it in project settings.
- </p>
- </div>
- );
-}
-
-/** Connect + pick-a-property flow, scoped to a known project. */
-function GscConnect({ projectId }: { projectId: string }) {
- const queryClient = useQueryClient();
- const [selection, setSelection] = React.useState<GscSiteSelection | null>(
- null,
- );
-
- const connectionKey = ["gscConnection", projectId];
- const connectionQuery = useQuery({
- queryKey: connectionKey,
- queryFn: () => getGscConnection({ data: { projectId } }),
- });
- const connection = connectionQuery.data;
- const connected = Boolean(connection?.connected);
- const hasGrant = Boolean(connection?.currentUserHasGrant);
- const needsSetup =
- connectionQuery.isSuccess && !connection?.googleOAuthConfigured;
-
- const sitesQuery = useQuery({
- queryKey: ["gscSites", projectId],
- queryFn: () => listGscSites({ data: { projectId } }),
- enabled: hasGrant && !connected && !needsSetup,
- });
- const accounts = React.useMemo(
- () => sitesQuery.data?.accounts ?? [],
- [sitesQuery.data?.accounts],
- );
- const requiresReconnect = accounts.some(
- (account) => account.requiresReconnect,
- );
-
- React.useEffect(() => {
- if (!requiresReconnect) return;
-
- void queryClient.invalidateQueries({
- queryKey: ["gscConnection", projectId],
- });
- void queryClient.invalidateQueries({ queryKey: GRANT_STATUS_KEY });
- }, [requiresReconnect, queryClient, projectId]);
-
- const setSiteMutation = useMutation({
- mutationFn: (selected: GscSiteSelection) =>
- setGscSite({ data: { projectId, ...selected } }),
- onSuccess: () => {
- captureClientEvent("gsc:property_select");
- void queryClient.invalidateQueries({ queryKey: connectionKey });
- },
- onError: (error) => toast.error(getStandardErrorMessage(error)),
- });
-
- const handleConnect = () => {
- captureClientEvent("onboarding:gsc_connect_clicked");
- void startGoogleLink("gsc", window.location.href);
- };
-
- if (connectionQuery.isLoading) return <Checking />;
-
- if (needsSetup) {
- return <SelfHostedSetupWarning />;
- }
-
- if (connected) {
- return (
- <div className="flex items-center gap-3 rounded-lg border border-success/30 bg-success/10 p-3.5 text-sm">
- <span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-success/20 text-success">
- <Check className="size-3.5" />
- </span>
- <span className="text-base-content/80">
- Connected to <span className="font-mono">{connection?.siteUrl}</span>.
- </span>
- </div>
- );
- }
-
- if (hasGrant) {
- return (
- <div className="space-y-4">
- <GoogleLinkErrorAlert provider="gsc" />
- <SitePicker
- loading={sitesQuery.isLoading}
- error={sitesQuery.isError}
- accounts={accounts}
- selection={selection}
- onSelect={setSelection}
- onSave={() => selection && setSiteMutation.mutate(selection)}
- saving={setSiteMutation.isPending}
- onRetry={() => void sitesQuery.refetch()}
- onReconnect={handleConnect}
- />
- </div>
- );
- }
-
- return (
- <div className="space-y-4">
- <GoogleLinkErrorAlert provider="gsc" />
- <button
- type="button"
- onClick={handleConnect}
- className="inline-flex items-center gap-2.5 rounded-lg border border-base-300 bg-base-100 px-4 py-2.5 text-sm font-semibold text-base-content shadow-sm transition hover:bg-base-200 hover:shadow focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
- >
- <GoogleGlyph className="size-[18px]" />
- Connect with Google
- </button>
- </div>
- );
-}
-
-function Checking() {
- return (
- <div className="flex items-center gap-2 text-sm text-base-content/50">
- <span className="loading loading-spinner loading-sm" />
- Checking…
- </div>
- );
-}
diff --git a/src/client/features/onboarding/SignupPreview.tsx b/src/client/features/onboarding/SignupPreview.tsx
new file mode 100644
index 00000000..a759f169
--- /dev/null
+++ b/src/client/features/onboarding/SignupPreview.tsx
@@ -0,0 +1,327 @@
+import { AGENT_SETUP_DESCRIPTION } from "@/client/features/ai-mcp/AgentSetupPanel";
+import { useState } from "react";
+import { ArrowLeft, ArrowRight, Check, Moon, Sun } from "lucide-react";
+import { CopyButton } from "@/client/features/ai-mcp/SetupControls";
+import { getAgentSetupPrompt } from "@/client/features/ai-mcp/agentSetupPrompt";
+import { SignupPreviewLayout, type PreviewDesign } from "./SignupPreviewLayout";
+import { INTEREST_OPTIONS, ONBOARDING_OPTION_LABELS } from "./onboardingModel";
+import {
+ CompactAgentPrompt,
+ type CompactTreatment,
+} from "./CompactAgentPrompt";
+
+const DESIGNS = [
+ { id: "quiet", label: "01 Quiet" },
+ { id: "split", label: "02 Split" },
+ { id: "compact", label: "03 Compact" },
+ { id: "editorial", label: "04 Editorial" },
+ { id: "workspace", label: "05 Workspace" },
+] as const;
+
+type Screen = "goal" | "agent" | "prompt" | "done";
+type PreviewSearch = {
+ design: PreviewDesign;
+ screen: Screen;
+ treatment: CompactTreatment;
+};
+
+export function SignupPreview({
+ design,
+ screen,
+ treatment,
+ onChange,
+}: PreviewSearch & {
+ onChange: (search: PreviewSearch) => void;
+}) {
+ const [dark, setDark] = useState(true);
+ const [interests, setInterests] = useState<string[]>([]);
+ const [other, setOther] = useState("");
+ const go = (next: Screen) => onChange({ design, screen: next, treatment });
+ const step = screen === "goal" ? 1 : 2;
+ const title =
+ screen === "goal"
+ ? "What brings you here?"
+ : screen === "agent"
+ ? "Already use an AI agent?"
+ : screen === "prompt"
+ ? "Set up your agent"
+ : "You're ready to go.";
+ const subtitle =
+ screen === "goal"
+ ? "Pick up to three things you want to work on."
+ : screen === "agent"
+ ? "Like Claude, ChatGPT Desktop, or Grok Bot."
+ : screen === "prompt"
+ ? AGENT_SETUP_DESCRIPTION
+ : "Your dashboard is next. Finish your project setup there.";
+
+ const content = (
+ <div className="space-y-7">
+ {screen === "goal" && (
+ <>
+ <div
+ className={
+ design === "compact"
+ ? "flex flex-wrap gap-2"
+ : design === "split" || design === "workspace"
+ ? "grid gap-3 sm:grid-cols-2"
+ : "grid gap-0"
+ }
+ >
+ {INTEREST_OPTIONS.map((interest) => {
+ const selected = interests.includes(interest);
+ return (
+ <button
+ key={interest}
+ type="button"
+ aria-pressed={selected}
+ disabled={!selected && interests.length >= 3}
+ onClick={() =>
+ setInterests(
+ selected
+ ? interests.filter((value) => value !== interest)
+ : [...interests, interest],
+ )
+ }
+ className={`flex items-center gap-3 text-left text-sm transition-colors disabled:opacity-35 focus-visible:outline-2 focus-visible:outline-primary ${
+ design === "compact"
+ ? "rounded-full border px-4 py-2.5"
+ : design === "quiet" || design === "editorial"
+ ? "border-b border-base-300 py-4"
+ : "rounded-lg border p-4"
+ } ${selected ? "border-primary text-primary bg-primary/5" : "border-base-300 hover:bg-base-200"}`}
+ >
+ <span
+ className={`flex size-4 shrink-0 items-center justify-center rounded border ${selected ? "border-primary bg-primary text-primary-content" : "border-base-content/30"}`}
+ >
+ {selected && <Check className="size-3" />}
+ </span>
+ <span className="capitalize">
+ {ONBOARDING_OPTION_LABELS[interest] ?? interest}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ {interests.includes("Other") && (
+ <input
+ aria-label="What else would you like to work on?"
+ className="input input-bordered w-full"
+ placeholder="What else would you like to work on?"
+ value={other}
+ onChange={(event) => setOther(event.target.value)}
+ />
+ )}
+ <div className="flex items-center justify-between gap-4">
+ <button
+ type="button"
+ className="btn btn-ghost"
+ onClick={() => go("agent")}
+ >
+ Skip
+ </button>
+ <button
+ type="button"
+ className="btn btn-primary"
+ disabled={interests.length === 0}
+ onClick={() => go("agent")}
+ >
+ Continue <ArrowRight className="size-4" />
+ </button>
+ </div>
+ </>
+ )}
+ {screen === "agent" && (
+ <div className="flex items-center justify-between gap-3">
+ <button
+ type="button"
+ className="flex min-h-10 items-center gap-1.5 text-xs text-base-content/60 hover:text-base-content"
+ onClick={() => go("goal")}
+ >
+ <ArrowLeft className="size-3.5" /> Back
+ </button>
+ <div className="flex gap-3">
+ <button
+ type="button"
+ className="btn btn-outline min-w-16"
+ onClick={() => go("done")}
+ >
+ No
+ </button>
+ <button
+ type="button"
+ className="btn btn-primary min-w-24"
+ onClick={() => go("prompt")}
+ >
+ Yes <ArrowRight className="size-4" />
+ </button>
+ </div>
+ </div>
+ )}
+ {screen === "prompt" && design === "compact" && (
+ <CompactAgentPrompt
+ treatment={treatment}
+ onBack={() => go("agent")}
+ onFinish={() => go("done")}
+ />
+ )}
+ {screen === "prompt" && design !== "compact" && (
+ <>
+ <div
+ className={
+ design === "workspace" || design === "split"
+ ? "rounded-xl border border-base-300 bg-base-200/40 p-6"
+ : ""
+ }
+ >
+ <div className="mb-4 flex items-center gap-2 text-xs font-medium text-base-content/55">
+ <span>OpenSEO plugin</span>
+ <span aria-hidden="true">·</span>
+ <span>MCP + skills</span>
+ </div>
+ <CopyButton
+ primary
+ value={getAgentSetupPrompt("https://app.openseo.so")}
+ label="Copy setup prompt"
+ successMessage="Setup prompt copied"
+ />
+ </div>
+ <div className="flex flex-wrap items-center justify-between gap-4 border-t border-base-300 pt-6">
+ <a
+ href="https://openseo.so/docs/mcp"
+ target="_blank"
+ rel="noreferrer"
+ className="text-sm text-base-content/60 underline underline-offset-4 hover:text-base-content"
+ >
+ Manual setup
+ </a>
+ <button
+ type="button"
+ className="btn btn-ghost"
+ onClick={() => go("done")}
+ >
+ Go to dashboard <ArrowRight className="size-4" />
+ </button>
+ </div>
+ <button
+ type="button"
+ className="flex items-center gap-2 text-xs text-base-content/50 hover:text-base-content"
+ onClick={() => go("agent")}
+ >
+ <ArrowLeft className="size-3" /> Change answer
+ </button>
+ </>
+ )}
+ {screen === "done" && (
+ <div className="space-y-5">
+ <p className="rounded-lg bg-base-200 p-4 text-sm text-base-content/60">
+ Preview complete. No answers have been saved.
+ </p>
+ <button
+ type="button"
+ className="btn btn-primary"
+ onClick={() => {
+ setInterests([]);
+ setOther("");
+ go("goal");
+ }}
+ >
+ Restart preview <ArrowRight className="size-4" />
+ </button>
+ </div>
+ )}
+ </div>
+ );
+
+ return (
+ <div
+ data-theme={dark ? "openseo-dark" : "openseo"}
+ className="min-h-screen bg-base-100 text-base-content"
+ >
+ <nav
+ aria-label="Preview controls"
+ className="border-b border-base-300 bg-base-200 px-4 py-3"
+ >
+ <div className="mx-auto flex max-w-7xl flex-wrap items-center gap-2">
+ <span className="mr-3 text-xs font-semibold text-base-content/50">
+ ONBOARDING EXPLORATIONS
+ </span>
+ {DESIGNS.map((option) => (
+ <button
+ key={option.id}
+ type="button"
+ aria-pressed={design === option.id}
+ className={`btn btn-sm ${design === option.id ? "btn-neutral" : "btn-ghost"}`}
+ onClick={() => onChange({ design: option.id, screen, treatment })}
+ >
+ {option.label}
+ </button>
+ ))}
+ <button
+ type="button"
+ className="btn btn-square btn-ghost btn-sm ml-auto"
+ aria-label={dark ? "Light theme" : "Dark theme"}
+ onClick={() => setDark(!dark)}
+ >
+ {dark ? <Sun className="size-4" /> : <Moon className="size-4" />}
+ </button>
+ </div>
+ <div className="mx-auto mt-2 flex max-w-7xl flex-wrap items-center gap-2">
+ {(
+ [
+ ["goal", "Earlier question"],
+ ["agent", "Agent question"],
+ ["prompt", "Copy prompt"],
+ ] as const
+ ).map(([value, label]) => (
+ <button
+ key={value}
+ type="button"
+ aria-pressed={screen === value}
+ className={`rounded px-2 py-1 text-xs ${screen === value ? "bg-base-300 text-base-content" : "text-base-content/50 hover:text-base-content"}`}
+ onClick={() => go(value)}
+ >
+ {label}
+ </button>
+ ))}
+ <span className="ml-auto text-xs text-base-content/40">
+ Interactive preview · No answers saved
+ </span>
+ </div>
+ </nav>
+ {design === "compact" && (
+ <div
+ aria-label="Compact variations"
+ className="flex flex-wrap justify-center gap-2 border-b border-base-300 bg-base-200/50 px-4 py-3"
+ >
+ {(
+ [
+ ["panel", "A · Unified panel"],
+ ["simple", "B · Simple action"],
+ ["preview", "C · Prompt preview"],
+ ] as const
+ ).map(([value, label]) => (
+ <button
+ key={value}
+ type="button"
+ aria-pressed={treatment === value}
+ className={`btn btn-sm ${treatment === value ? "btn-neutral" : "btn-ghost"}`}
+ onClick={() => onChange({ design, screen, treatment: value })}
+ >
+ {label}
+ </button>
+ ))}
+ </div>
+ )}
+ <SignupPreviewLayout
+ design={design}
+ step={step}
+ title={title}
+ subtitle={subtitle}
+ go={go}
+ >
+ {content}
+ </SignupPreviewLayout>
+ </div>
+ );
+}
diff --git a/src/client/features/onboarding/SignupPreviewLayout.tsx b/src/client/features/onboarding/SignupPreviewLayout.tsx
new file mode 100644
index 00000000..944ab4ca
--- /dev/null
+++ b/src/client/features/onboarding/SignupPreviewLayout.tsx
@@ -0,0 +1,161 @@
+import { OnboardingCard } from "./OnboardingCard";
+import type { ReactNode } from "react";
+import { Check, ChevronRight } from "lucide-react";
+
+export type PreviewDesign =
+ | "quiet"
+ | "split"
+ | "compact"
+ | "editorial"
+ | "workspace";
+
+export function SignupPreviewLayout({
+ design,
+ step,
+ title,
+ subtitle,
+ go,
+ children,
+}: {
+ design: PreviewDesign;
+ step: number;
+ title: string;
+ subtitle: string;
+ go: (screen: "goal" | "agent") => void;
+ children: ReactNode;
+}) {
+ const heading = (
+ <div className="mb-8">
+ <h1
+ className={`font-semibold tracking-tight text-balance ${design === "editorial" ? "text-4xl leading-tight md:text-6xl" : design === "compact" ? "text-2xl" : "text-3xl leading-tight md:text-4xl"}`}
+ >
+ {title}
+ </h1>
+ <p className="mt-3 text-sm leading-relaxed text-base-content/60">
+ {subtitle}
+ </p>
+ </div>
+ );
+ const brand = (
+ <div className="flex items-center gap-2 text-sm font-semibold">
+ <img src="/transparent-logo.png" alt="" className="size-7" />
+ OpenSEO
+ </div>
+ );
+ const milestones = (
+ <div className="flex gap-2 md:block md:space-y-3">
+ {["Your goals", "Your agent"].map((label, index) => (
+ <button
+ key={label}
+ type="button"
+ onClick={() => go(index === 0 ? "goal" : "agent")}
+ className={`flex w-full items-center gap-3 rounded-lg px-3 py-3 text-left text-sm ${step === index + 1 ? "bg-primary/10 text-primary" : "text-base-content/45 hover:bg-base-200"}`}
+ >
+ <span className="flex size-6 items-center justify-center rounded-full border border-current text-xs">
+ {step > index + 1 ? <Check className="size-3" /> : index + 1}
+ </span>
+ {label}
+ </button>
+ ))}
+ </div>
+ );
+ switch (design) {
+ case "quiet":
+ return (
+ <div className="mx-auto max-w-6xl px-6 py-8 md:px-12">
+ {brand}
+ <main className="mx-auto max-w-lg pb-16 pt-16 md:pt-24">
+ <p className="mb-8 text-xs text-base-content/40">{step} / 2</p>
+ {heading}
+ {children}
+ </main>
+ </div>
+ );
+ case "split":
+ return (
+ <div className="grid min-h-[calc(100svh-110px)] md:grid-cols-[minmax(260px,0.8fr)_1.4fr]">
+ <aside className="flex flex-col border-b border-base-300 bg-base-200/60 p-8 md:border-b-0 md:border-r md:p-12">
+ {brand}
+ <div className="my-auto pt-5 md:max-w-xs md:py-10">
+ <p className="mb-8 hidden text-3xl font-semibold leading-tight tracking-tight md:block">
+ Good SEO starts
+ <br />
+ with your next step.
+ </p>
+ {milestones}
+ </div>
+ <p className="hidden text-xs text-base-content/40 md:block">
+ Your website setup comes next, on the dashboard.
+ </p>
+ </aside>
+ <main className="m-auto w-full max-w-xl px-6 py-12 md:px-12">
+ {heading}
+ {children}
+ </main>
+ </div>
+ );
+ case "compact":
+ return (
+ <div className="flex min-h-[calc(100svh-110px)] justify-center bg-base-200/50 px-5">
+ <OnboardingCard step={step} total={2}>
+ {heading}
+ {children}
+ </OnboardingCard>
+ </div>
+ );
+ case "editorial":
+ return (
+ <div className="mx-auto max-w-7xl px-6 py-8 md:px-16">
+ <div className="flex items-center justify-between border-b border-base-300 pb-6">
+ {brand}
+ <span className="text-xs uppercase tracking-widest text-base-content/40">
+ Make it yours
+ </span>
+ </div>
+ <main className="grid gap-10 py-12 md:grid-cols-2 md:gap-20 md:py-24">
+ <div>
+ <p className="mb-8 text-7xl font-light tracking-tighter text-primary/40 md:text-8xl">
+ 0{step}
+ <span className="text-xl text-base-content/30"> / 02</span>
+ </p>
+ {heading}
+ </div>
+ <div className="md:pt-8">{children}</div>
+ </main>
+ </div>
+ );
+ case "workspace":
+ return (
+ <div className="min-h-[calc(100svh-110px)] bg-base-200/40">
+ <header className="flex items-center justify-between border-b border-base-300 bg-base-100 px-6 py-4">
+ {brand}
+ <span className="text-xs text-base-content/45">
+ Workspace setup
+ </span>
+ </header>
+ <div className="mx-auto grid max-w-6xl md:grid-cols-[240px_1fr]">
+ <aside className="border-b border-base-300 p-5 md:min-h-[650px] md:border-b-0 md:border-r md:py-10">
+ <p className="mb-4 hidden px-3 text-xs font-medium text-base-content/40 md:block">
+ GET STARTED
+ </p>
+ {milestones}
+ <p className="mt-8 hidden px-3 text-xs leading-relaxed text-base-content/40 md:block">
+ Next: add your website, connect Search Console, and invite your
+ team.
+ </p>
+ </aside>
+ <main className="p-6 md:p-12">
+ <div className="mb-8 flex items-center gap-2 text-xs text-base-content/45">
+ Your workspace <ChevronRight className="size-3" />{" "}
+ {step === 1 ? "Your goals" : "Your agent"}
+ </div>
+ <div className="max-w-2xl rounded-xl border border-base-300 bg-base-100 p-6 md:p-8">
+ {heading}
+ {children}
+ </div>
+ </main>
+ </div>
+ </div>
+ );
+ }
+}
diff --git a/src/client/features/onboarding/onboardingModel.test.ts b/src/client/features/onboarding/onboardingModel.test.ts
new file mode 100644
index 00000000..d884cdad
--- /dev/null
+++ b/src/client/features/onboarding/onboardingModel.test.ts
@@ -0,0 +1,93 @@
+import { describe, expect, it, vi } from "vitest";
+import {
+ buildOnboardingPayload,
+ restoreOnboardingAnswers,
+} from "./onboardingModel";
+
+vi.mock("@/serverFunctions/onboarding", () => ({
+ getOnboardingAnswers: vi.fn(),
+}));
+const saved = {
+ interestedFeatures: ["Keyword research"],
+ workFor: "My own startup or business",
+ clientWebsiteCount: null,
+ foundVia: "Google",
+ mcpSetupIntent: null,
+};
+
+describe("historical onboarding values", () => {
+ it("keeps a previously saved Google source recognized", () => {
+ const answers = restoreOnboardingAnswers({ ...saved, foundVia: "Google" });
+ expect(answers.source).toBe("Google");
+ expect(answers.sourceOther).toBe("");
+ expect(buildOnboardingPayload(answers, 3).foundVia).toBe("Google");
+ });
+
+ it.each(["My own startup or business", "My employer's website"])(
+ "restores and saves the original work-for value: %s",
+ (workFor) => {
+ const answers = restoreOnboardingAnswers({ ...saved, workFor });
+ expect(answers.workFor).toBe(workFor);
+ expect(answers.workForOther).toBe("");
+ expect(buildOnboardingPayload(answers, 3).workFor).toBe(workFor);
+ },
+ );
+
+ it("keeps the original AI workflow value when restoring and saving", () => {
+ const interestedFeatures = ["AI workflows with Claude or Codex (MCP)"];
+ const answers = restoreOnboardingAnswers({ ...saved, interestedFeatures });
+ expect(answers.selectedInterests).toEqual(interestedFeatures);
+ expect(answers.interestOther).toBe("");
+ expect(buildOnboardingPayload(answers, 3).interestedFeatures).toEqual(
+ interestedFeatures,
+ );
+ });
+});
+
+describe("signup agent setup", () => {
+ it("saves the optional agent choice on the final step only", () => {
+ const answers = {
+ ...restoreOnboardingAnswers(saved),
+ mcpSetupIntent: "yes" as const,
+ };
+ expect(buildOnboardingPayload(answers, 2)).not.toHaveProperty(
+ "mcpSetupIntent",
+ );
+ expect(
+ buildOnboardingPayload(answers, 3, { completed: true }),
+ ).toMatchObject({ mcpSetupIntent: "yes", completed: true });
+ });
+ it("lets users finish without an agent or without making a choice", () => {
+ const answers = restoreOnboardingAnswers(saved);
+ expect(
+ buildOnboardingPayload(answers, 3, { completed: true }),
+ ).toMatchObject({ completed: true });
+ expect(
+ buildOnboardingPayload({ ...answers, mcpSetupIntent: "no" }, 3, {
+ completed: true,
+ }),
+ ).toMatchObject({ mcpSetupIntent: "no", completed: true });
+ });
+ it("saves No when finishing immediately, even before React updates the previous answer", () => {
+ const answers = {
+ ...restoreOnboardingAnswers(saved),
+ mcpSetupIntent: "yes" as const,
+ };
+ expect(
+ buildOnboardingPayload(answers, 3, {
+ completed: true,
+ mcpSetupIntent: "no",
+ }),
+ ).toMatchObject({ mcpSetupIntent: "no", completed: true });
+ });
+ it("restores a saved setup intent", () => {
+ expect(
+ restoreOnboardingAnswers({ ...saved, mcpSetupIntent: "yes" })
+ .mcpSetupIntent,
+ ).toBe("yes");
+ expect(
+ restoreOnboardingAnswers({ ...saved, mcpSetupIntent: "no" })
+ .mcpSetupIntent,
+ ).toBe("no");
+ });
+});
diff --git a/src/client/features/onboarding/onboardingModel.ts b/src/client/features/onboarding/onboardingModel.ts
index 7babe0cf..1250d1fa 100644
--- a/src/client/features/onboarding/onboardingModel.ts
+++ b/src/client/features/onboarding/onboardingModel.ts
@@ -3,6 +3,14 @@ import { getOnboardingAnswers } from "@/serverFunctions/onboarding";
export const ONBOARDING_LAST_STEP = 3;
+// Option values below are persisted and used by analytics. Change display copy
+// here instead of renaming those values, so historical answers stay comparable.
+export const ONBOARDING_OPTION_LABELS: Readonly<Record<string, string>> = {
+ "AI workflows with Claude or Codex (MCP)": "AI Workflows (MCP + Skills)",
+ "My own startup or business": "My Own Business",
+ "My employer's website": "My Company's Website",
+};
+
export const INTEREST_OPTIONS = [
"AI workflows with Claude or Codex (MCP)",
"Keyword research",
@@ -31,25 +39,19 @@ export const CLIENT_WEBSITE_COUNT_OPTIONS = [
"25+",
] as const;
-// Ordered by how often each source is actually reported (Aug 2026 answers).
+// Display order. Keep persisted values stable for attribution metrics.
export const SOURCE_OPTIONS = [
"Google",
- "GitHub",
- "Product Hunt",
- "Friend or colleague",
"X / Twitter",
+ "GitHub",
"Instagram",
+ "YouTube",
+ "Friend or colleague",
"AI (Claude, ChatGPT, etc)",
+ "Product Hunt",
"Other",
] as const;
-// Keep the mobile list short: these still count as known options, they just
-// aren't shown on small screens.
-export const SOURCE_OPTIONS_HIDDEN_ON_MOBILE = [
- "X / Twitter",
- "AI (Claude, ChatGPT, etc)",
-] as const;
-
/** In-progress form state. Step is tracked separately in the URL. */
export type OnboardingAnswers = {
selectedInterests: string[];
@@ -59,6 +61,7 @@ export type OnboardingAnswers = {
clientWebsiteCount: string;
source: string;
sourceOther: string;
+ mcpSetupIntent?: "yes" | "no" | "";
};
/** Answers as persisted in the DB (read back via getOnboardingAnswers). */
@@ -108,6 +111,10 @@ export function restoreOnboardingAnswers(
work.value === CLIENT_WORK_FOR ? (saved.clientWebsiteCount ?? "") : "",
source: found.value,
sourceOther: found.other,
+ mcpSetupIntent:
+ saved.mcpSetupIntent === "yes" || saved.mcpSetupIntent === "no"
+ ? saved.mcpSetupIntent
+ : "",
};
}
@@ -118,7 +125,7 @@ export function restoreOnboardingAnswers(
export function buildOnboardingPayload(
answers: OnboardingAnswers,
step: number,
- extra: { completed?: boolean } = {},
+ extra: { completed?: boolean; mcpSetupIntent?: "yes" | "no" } = {},
) {
const interestedFeatures = answers.selectedInterests.map((value) =>
value === "Other" && answers.interestOther.trim()
@@ -142,6 +149,9 @@ export function buildOnboardingPayload(
...(step >= 0 ? { interestedFeatures } : {}),
...(step >= 1 ? { workFor, clientWebsiteCount } : {}),
...(step >= 2 ? { foundVia } : {}),
+ ...(step >= 3 && answers.mcpSetupIntent
+ ? { mcpSetupIntent: answers.mcpSetupIntent }
+ : {}),
...extra,
};
}
diff --git a/src/client/features/projects/CreateProjectModal.tsx b/src/client/features/projects/CreateProjectModal.tsx
index 5be7166e..ee92c009 100644
--- a/src/client/features/projects/CreateProjectModal.tsx
+++ b/src/client/features/projects/CreateProjectModal.tsx
@@ -34,12 +34,14 @@ export function CreateProjectModal({ onClose }: { onClose: () => void }) {
onSuccess: async (created) => {
setLastProjectId(created.id);
await queryClient.invalidateQueries({ queryKey: ["projects"] });
+ await queryClient.invalidateQueries({
+ queryKey: ["dashboardActivation"],
+ });
onClose();
toast.success("Project created");
- // Land on the new project's integrations so they can connect Search
- // Console and finish setting up the workspace.
+ // Continue setup through the new project’s dashboard.
void navigate({
- to: "/p/$projectId/settings/integrations",
+ to: "/p/$projectId",
params: { projectId: created.id },
});
},
diff --git a/src/db/app.schema.ts b/src/db/app.schema.ts
index 45a1482e..03071002 100644
--- a/src/db/app.schema.ts
+++ b/src/db/app.schema.ts
@@ -4,6 +4,7 @@ import {
integer,
real,
uniqueIndex,
+ primaryKey,
index,
} from "drizzle-orm/sqlite-core";
import { sql } from "drizzle-orm";
@@ -427,3 +428,21 @@ export const backlinkSnapshots = sqliteTable(
),
],
);
+
+// Personal checklist preferences; completion remains derived from product state.
+export const dashboardStepDismissals = sqliteTable(
+ "dashboard_step_dismissals",
+ {
+ userId: text("user_id")
+ .notNull()
+ .references(() => user.id, { onDelete: "cascade" }),
+ projectId: text("project_id")
+ .notNull()
+ .references(() => projects.id, { onDelete: "cascade" }),
+ step: text("step").notNull(),
+ },
+ (table) => [
+ primaryKey({ columns: [table.userId, table.projectId, table.step] }),
+ index("dashboard_step_dismissals_project_idx").on(table.projectId),
+ ],
+);
diff --git a/src/db/pg/app.schema.ts b/src/db/pg/app.schema.ts
index 64a64622..89f66428 100644
--- a/src/db/pg/app.schema.ts
+++ b/src/db/pg/app.schema.ts
@@ -9,6 +9,7 @@ import {
serial,
text,
uniqueIndex,
+ primaryKey,
} from "drizzle-orm/pg-core";
import { organization, user } from "./better-auth-schema";
@@ -413,3 +414,21 @@ export const backlinkSnapshots = pgTable(
),
],
);
+
+// Personal checklist preferences; completion remains derived from product state.
+export const dashboardStepDismissals = pgTable(
+ "dashboard_step_dismissals",
+ {
+ userId: text("user_id")
+ .notNull()
+ .references(() => user.id, { onDelete: "cascade" }),
+ projectId: text("project_id")
+ .notNull()
+ .references(() => projects.id, { onDelete: "cascade" }),
+ step: text("step").notNull(),
+ },
+ (table) => [
+ primaryKey({ columns: [table.userId, table.projectId, table.step] }),
+ index("dashboard_step_dismissals_project_idx").on(table.projectId),
+ ],
+);
diff --git a/src/db/schema.ts b/src/db/schema.ts
index 90234df2..87107927 100644
--- a/src/db/schema.ts
+++ b/src/db/schema.ts
@@ -79,6 +79,7 @@ export const {
rankSnapshots,
organizationActivationState,
projectActivationState,
+ dashboardStepDismissals,
backlinkSnapshots,
projectContextSections,
projectCompetitors,
diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts
index 700c0181..7aeaa211 100644
--- a/src/routeTree.gen.ts
+++ b/src/routeTree.gen.ts
@@ -18,6 +18,7 @@ import { Route as AuthRouteImport } from './routes/_auth'
import { Route as ProjectRouteRouteImport } from './routes/_project/route'
import { Route as AppRouteRouteImport } from './routes/_app/route'
import { Route as AppIndexRouteImport } from './routes/_app/index'
+import { Route as MockupsSignupRouteImport } from './routes/mockups.signup'
import { Route as ApiHealthRouteImport } from './routes/api/health'
import { Route as AcceptInvitationIdRouteImport } from './routes/accept-invitation.$id'
import { Route as AuthenticatedSubscribeRouteImport } from './routes/_authenticated.subscribe'
@@ -102,6 +103,11 @@ const AppIndexRoute = AppIndexRouteImport.update({
path: '/',
getParentRoute: () => AppRouteRoute,
} as any)
+const MockupsSignupRoute = MockupsSignupRouteImport.update({
+ id: '/mockups/signup',
+ path: '/mockups/signup',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiHealthRoute = ApiHealthRouteImport.update({
id: '/api/health',
path: '/api/health',
@@ -349,6 +355,7 @@ export interface FileRoutesByFullPath {
'/subscribe': typeof AuthenticatedSubscribeRoute
'/accept-invitation/$id': typeof AcceptInvitationIdRoute
'/api/health': typeof ApiHealthRoute
+ '/mockups/signup': typeof MockupsSignupRoute
'/p/$projectId': typeof ProjectPProjectIdRouteRouteWithChildren
'/help/dataforseo-api-key': typeof AppHelpDataforseoApiKeyRoute
'/help/openrouter-api-key': typeof AppHelpOpenrouterApiKeyRoute
@@ -397,6 +404,7 @@ export interface FileRoutesByTo {
'/subscribe': typeof AuthenticatedSubscribeRoute
'/accept-invitation/$id': typeof AcceptInvitationIdRoute
'/api/health': typeof ApiHealthRoute
+ '/mockups/signup': typeof MockupsSignupRoute
'/help/dataforseo-api-key': typeof AppHelpDataforseoApiKeyRoute
'/help/openrouter-api-key': typeof AppHelpOpenrouterApiKeyRoute
'/settings/organization': typeof AppSettingsOrganizationRoute
@@ -446,6 +454,7 @@ export interface FileRoutesById {
'/_authenticated/subscribe': typeof AuthenticatedSubscribeRoute
'/accept-invitation/$id': typeof AcceptInvitationIdRoute
'/api/health': typeof ApiHealthRoute
+ '/mockups/signup': typeof MockupsSignupRoute
'/_app/': typeof AppIndexRoute
'/_project/p/$projectId': typeof ProjectPProjectIdRouteRouteWithChildren
'/_app/help/dataforseo-api-key': typeof AppHelpDataforseoApiKeyRoute
@@ -498,6 +507,7 @@ export interface FileRouteTypes {
| '/subscribe'
| '/accept-invitation/$id'
| '/api/health'
+ | '/mockups/signup'
| '/p/$projectId'
| '/help/dataforseo-api-key'
| '/help/openrouter-api-key'
@@ -546,6 +556,7 @@ export interface FileRouteTypes {
| '/subscribe'
| '/accept-invitation/$id'
| '/api/health'
+ | '/mockups/signup'
| '/help/dataforseo-api-key'
| '/help/openrouter-api-key'
| '/settings/organization'
@@ -594,6 +605,7 @@ export interface FileRouteTypes {
| '/_authenticated/subscribe'
| '/accept-invitation/$id'
| '/api/health'
+ | '/mockups/signup'
| '/_app/'
| '/_project/p/$projectId'
| '/_app/help/dataforseo-api-key'
@@ -638,6 +650,7 @@ export interface RootRouteChildren {
Char91DotwellKnownChar93OpenaiAppsChallengeRoute: typeof Char91DotwellKnownChar93OpenaiAppsChallengeRoute
AcceptInvitationIdRoute: typeof AcceptInvitationIdRoute
ApiHealthRoute: typeof ApiHealthRoute
+ MockupsSignupRoute: typeof MockupsSignupRoute
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
ApiAutumnSplatRoute: typeof ApiAutumnSplatRoute
ApiGa4OauthCallbackRoute: typeof ApiGa4OauthCallbackRoute
@@ -709,6 +722,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof AppIndexRouteImport
parentRoute: typeof AppRouteRoute
}
+ '/mockups/signup': {
+ id: '/mockups/signup'
+ path: '/mockups/signup'
+ fullPath: '/mockups/signup'
+ preLoaderRoute: typeof MockupsSignupRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/api/health': {
id: '/api/health'
path: '/api/health'
@@ -1194,6 +1214,7 @@ const rootRouteChildren: RootRouteChildren = {
Char91DotwellKnownChar93OpenaiAppsChallengeRoute,
AcceptInvitationIdRoute: AcceptInvitationIdRoute,
ApiHealthRoute: ApiHealthRoute,
+ MockupsSignupRoute: MockupsSignupRoute,
ApiAuthSplatRoute: ApiAuthSplatRoute,
ApiAutumnSplatRoute: ApiAutumnSplatRoute,
ApiGa4OauthCallbackRoute: ApiGa4OauthCallbackRoute,
diff --git a/src/routes/_app/ai.tsx b/src/routes/_app/ai.tsx
index 872b1763..a49824b9 100644
--- a/src/routes/_app/ai.tsx
+++ b/src/routes/_app/ai.tsx
@@ -1,3 +1,4 @@
+import { AgentSetup } from "@/client/features/ai-mcp/AgentSetup";
import { createFileRoute, Link } from "@tanstack/react-router";
import { ArrowUpRight, ShieldAlert } from "lucide-react";
import { getAuthMode, isHostedClientAuthMode } from "@/lib/auth-mode";
@@ -32,11 +33,11 @@ const SKILLS_MANUAL_INSTALL = `git clone https://github.com/every-app/open-seo.g
# Codex
mkdir -p ~/.codex/skills
-cp -R open-seo/.agents/skills/* ~/.codex/skills/
+cp -R open-seo/plugins/openseo/skills/* ~/.codex/skills/
# Claude Code
mkdir -p ~/.claude/skills
-cp -R open-seo/.agents/skills/* ~/.claude/skills/`;
+cp -R open-seo/plugins/openseo/skills/* ~/.claude/skills/`;
export const Route = createFileRoute("/_app/ai")({
component: AiPage,
@@ -57,6 +58,10 @@ function AiPage() {
domain lookups, and backlink reviews from your editor or chat.
</p>
+ <section className="mt-8 rounded-xl border border-base-300 p-5">
+ <AgentSetup />
+ </section>
+
{getAuthMode(import.meta.env.AUTH_MODE) === "cloudflare_access" ? (
<div className="alert alert-warning mt-6 text-sm" role="alert">
<ShieldAlert className="size-4 shrink-0" />
diff --git a/src/routes/_authenticated.onboarding.index.tsx b/src/routes/_authenticated.onboarding.index.tsx
index fff825b9..cdb82333 100644
--- a/src/routes/_authenticated.onboarding.index.tsx
+++ b/src/routes/_authenticated.onboarding.index.tsx
@@ -1,6 +1,8 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
import { useState } from "react";
+import { toast } from "sonner";
+import { getStandardErrorMessage } from "@/client/lib/error-messages";
import { OnboardingAccountMenu } from "@/client/features/onboarding/OnboardingAccountMenu";
import { PostSignupOnboarding } from "@/client/features/onboarding/PostSignupOnboarding";
import {
@@ -15,8 +17,6 @@ import { queryClient } from "@/client/tanstack-db";
import { useSession } from "@/lib/auth-client";
import { saveOnboardingAnswers } from "@/serverFunctions/onboarding";
-const ONBOARDING_EXISTING_USER_CUTOFF = "2026-05-27T00:00:00.000Z";
-
const clampStep = (step: number) =>
Math.min(Math.max(0, Math.trunc(step)), ONBOARDING_LAST_STEP);
@@ -52,17 +52,8 @@ function OnboardingPage() {
return null;
}
- const userCreatedAt = onboardingQuery.data.userCreatedAt
- ? Date.parse(onboardingQuery.data.userCreatedAt)
- : Date.now();
- const isExistingUser =
- userCreatedAt < Date.parse(ONBOARDING_EXISTING_USER_CUTOFF);
- const firstName = session?.user?.name?.split(" ")[0] || "";
-
return (
<OnboardingFlow
- firstName={firstName}
- isExistingUser={isExistingUser}
initialAnswers={restoreOnboardingAnswers(onboardingQuery.data.answers)}
email={session?.user?.email}
/>
@@ -70,13 +61,9 @@ function OnboardingPage() {
}
function OnboardingFlow({
- firstName,
- isExistingUser,
initialAnswers,
email,
}: {
- firstName: string;
- isExistingUser: boolean;
initialAnswers: OnboardingAnswers;
email: string | undefined;
}) {
@@ -85,12 +72,20 @@ function OnboardingFlow({
const [answers, setAnswers] = useState<OnboardingAnswers>(initialAnswers);
const saveMutation = useMutation({
- mutationFn: (extra: { completed?: boolean }) =>
+ mutationFn: (extra: {
+ completed?: boolean;
+ mcpSetupIntent?: "yes" | "no";
+ }) =>
saveOnboardingAnswers({
data: buildOnboardingPayload(answers, step, extra),
}),
onError: (error) => {
- console.error("Failed to save onboarding answers", error);
+ toast.error(
+ getStandardErrorMessage(
+ error,
+ "Couldn’t save your answers. Please try again.",
+ ),
+ );
},
});
@@ -114,14 +109,18 @@ function OnboardingFlow({
goToStep(step + 1);
};
- const handleFinish = async () => {
+ const handleFinish = async (mcpSetupIntent?: "yes" | "no") => {
try {
- await saveMutation.mutateAsync({ completed: true });
+ await saveMutation.mutateAsync({
+ completed: true,
+ ...(mcpSetupIntent ? { mcpSetupIntent } : {}),
+ });
// Refresh the shared cache so the destination's onboarding-redirect guard
// sees the completed state and doesn't bounce the user back here.
await queryClient.invalidateQueries({ queryKey: ["onboardingAnswers"] });
} catch {
- // Already logged by the mutation's onError; still navigate the user on.
+ // Keep the user here to retry; an unsaved completion would redirect back.
+ return;
}
captureClientEvent("onboarding:completed", {
interests: answers.selectedInterests,
@@ -134,13 +133,6 @@ function OnboardingFlow({
return (
<PostSignupOnboarding
- firstName={firstName}
- title={isExistingUser ? "Tell us about your work" : undefined}
- helperText={
- isExistingUser
- ? "A little context helps us decide where to focus. You can also reach me anytime at [email protected]."
- : undefined
- }
step={step}
answers={answers}
onAnswersChange={setAnswers}
diff --git a/src/routes/mockups.signup.tsx b/src/routes/mockups.signup.tsx
new file mode 100644
index 00000000..01e2ed6c
--- /dev/null
+++ b/src/routes/mockups.signup.tsx
@@ -0,0 +1,28 @@
+import { createFileRoute } from "@tanstack/react-router";
+import { z } from "zod";
+import { SignupPreview } from "@/client/features/onboarding/SignupPreview";
+
+export const Route = createFileRoute("/mockups/signup")({
+ ssr: false,
+ validateSearch: z.object({
+ design: z
+ .enum(["quiet", "split", "compact", "editorial", "workspace"])
+ .catch("quiet"),
+ screen: z.enum(["goal", "agent", "prompt", "done"]).catch("prompt"),
+ treatment: z.enum(["panel", "simple", "preview"]).catch("panel"),
+ }),
+ component: SignupPreviewRoute,
+});
+
+function SignupPreviewRoute() {
+ const { design, screen, treatment } = Route.useSearch();
+ const navigate = Route.useNavigate();
+ return (
+ <SignupPreview
+ design={design}
+ screen={screen}
+ treatment={treatment}
+ onChange={(search) => void navigate({ search })}
+ />
+ );
+}
diff --git a/src/server/features/activation/repositories/ActivationRepository.test.ts b/src/server/features/activation/repositories/ActivationRepository.test.ts
new file mode 100644
index 00000000..79f07bf4
--- /dev/null
+++ b/src/server/features/activation/repositories/ActivationRepository.test.ts
@@ -0,0 +1,134 @@
+import { DatabaseSync, type SQLInputValue } from "node:sqlite";
+import { readFileSync } from "node:fs";
+import { drizzle } from "drizzle-orm/sqlite-proxy";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { ActivationRepository } from "./ActivationRepository";
+
+const state = vi.hoisted(() => ({ database: null as DatabaseSync | null }));
+vi.mock("cloudflare:workers", () => ({ env: {} }));
+vi.mock("@/db", () => ({
+ db: drizzle(async (query, params, method) => {
+ if (!state.database) throw new Error("Database not initialized");
+ const statement = state.database.prepare(query);
+ const values = params.map((value: unknown): SQLInputValue => {
+ if (
+ value === null ||
+ typeof value === "string" ||
+ typeof value === "number" ||
+ typeof value === "bigint"
+ )
+ return value;
+ throw new Error("Unexpected SQL parameter");
+ });
+ if (method === "run") {
+ statement.run(...values);
+ return { rows: [] };
+ }
+ return { rows: statement.all(...values).map((row) => Object.values(row)) };
+ }),
+}));
+
+beforeEach(() => {
+ state.database?.close();
+ state.database = new DatabaseSync(":memory:");
+ state.database.exec(`
+ PRAGMA foreign_keys = ON;
+ CREATE TABLE user (id text PRIMARY KEY);
+ CREATE TABLE projects (id text PRIMARY KEY);
+ CREATE TABLE member (id text PRIMARY KEY, organization_id text NOT NULL);
+ CREATE TABLE invitation (id text PRIMARY KEY, organization_id text NOT NULL, status text NOT NULL, expires_at integer NOT NULL);
+ CREATE TABLE project_activation_state (project_id text PRIMARY KEY, mcp_card_dismissed_at text);
+ INSERT INTO user VALUES ('alice'), ('bob');
+ INSERT INTO projects VALUES ('project-a'), ('project-b');
+ INSERT INTO member VALUES ('member-a', 'org-a');
+ `);
+ state.database.exec(
+ readFileSync("drizzle/0046_plain_the_watchers.sql", "utf8"),
+ );
+});
+
+describe("checklist persistence", () => {
+ it("isolates preferences by person and project and makes dismissal idempotent", async () => {
+ await ActivationRepository.setStepDismissed(
+ "alice",
+ "project-a",
+ "project",
+ true,
+ );
+ await ActivationRepository.setStepDismissed(
+ "alice",
+ "project-a",
+ "project",
+ true,
+ );
+ expect(
+ await ActivationRepository.getDismissedSteps("alice", "project-a"),
+ ).toEqual([{ step: "project" }]);
+ expect(
+ await ActivationRepository.getDismissedSteps("bob", "project-a"),
+ ).toEqual([]);
+ expect(
+ await ActivationRepository.getDismissedSteps("alice", "project-b"),
+ ).toEqual([]);
+ await ActivationRepository.setStepDismissed(
+ "alice",
+ "project-a",
+ "project",
+ false,
+ );
+ expect(
+ await ActivationRepository.getDismissedSteps("alice", "project-a"),
+ ).toEqual([]);
+ });
+ it("restores legacy MCP dismissals without changing authorization milestones", async () => {
+ state.database!.exec(
+ "INSERT INTO project_activation_state VALUES ('project-a', '2026-09-05')",
+ );
+ await ActivationRepository.setStepDismissed(
+ "alice",
+ "project-a",
+ "mcp",
+ false,
+ );
+ expect(
+ state
+ .database!.prepare(
+ "SELECT mcp_card_dismissed_at FROM project_activation_state",
+ )
+ .get()?.mcp_card_dismissed_at,
+ ).toBeNull();
+ });
+ it("counts only teammates and unexpired pending invitations in this workspace", async () => {
+ expect(await ActivationRepository.hasTeammate("org-a")).toBe(false);
+ state.database!.exec("INSERT INTO member VALUES ('member-b', 'org-b')");
+ state
+ .database!.prepare("INSERT INTO invitation VALUES (?, ?, ?, ?)")
+ .run("expired", "org-a", "pending", Date.now() - 1000);
+ expect(await ActivationRepository.hasTeammate("org-a")).toBe(false);
+ state
+ .database!.prepare("INSERT INTO invitation VALUES (?, ?, ?, ?)")
+ .run("valid", "org-a", "pending", Date.now() + 100000);
+ expect(await ActivationRepository.hasTeammate("org-a")).toBe(true);
+ expect(await ActivationRepository.hasTeammate("org-b")).toBe(false);
+ });
+ it("removes preferences when their project or user is deleted", async () => {
+ await ActivationRepository.setStepDismissed(
+ "alice",
+ "project-a",
+ "team",
+ true,
+ );
+ await ActivationRepository.setStepDismissed(
+ "bob",
+ "project-b",
+ "domain",
+ true,
+ );
+ state.database!.exec(
+ "DELETE FROM user WHERE id = 'alice'; DELETE FROM projects WHERE id = 'project-b'",
+ );
+ expect(
+ state.database!.prepare("SELECT * FROM dashboard_step_dismissals").all(),
+ ).toEqual([]);
+ });
+});
diff --git a/src/server/features/activation/repositories/ActivationRepository.ts b/src/server/features/activation/repositories/ActivationRepository.ts
index 72fe5623..c4ccd598 100644
--- a/src/server/features/activation/repositories/ActivationRepository.ts
+++ b/src/server/features/activation/repositories/ActivationRepository.ts
@@ -1,10 +1,15 @@
-import { eq, sql } from "drizzle-orm";
+import { and, eq, gt, sql } from "drizzle-orm";
import { db } from "@/db";
import {
+ dashboardStepDismissals,
+ member,
+ invitation,
organizationActivationState,
projectActivationState,
} from "@/db/schema";
+import type { DashboardSetupStep } from "@/types/schemas/dashboard";
+
type OrganizationActivationState =
typeof organizationActivationState.$inferSelect;
type ProjectActivationState = typeof projectActivationState.$inferSelect;
@@ -75,20 +80,6 @@ async function markCompetitorStepClicked(projectId: string): Promise<void> {
});
}
-async function markMcpCardDismissed(projectId: string): Promise<void> {
- const now = new Date().toISOString();
- await db
- .insert(projectActivationState)
- .values({ projectId, mcpCardDismissedAt: now, updatedAt: now })
- .onConflictDoUpdate({
- target: projectActivationState.projectId,
- set: {
- mcpCardDismissedAt: sql`coalesce(${projectActivationState.mcpCardDismissedAt}, ${now})`,
- updatedAt: now,
- },
- });
-}
-
async function markGa4CardDismissed(projectId: string): Promise<void> {
const now = new Date().toISOString();
await db
@@ -103,12 +94,79 @@ async function markGa4CardDismissed(projectId: string): Promise<void> {
});
}
+async function getDismissedSteps(userId: string, projectId: string) {
+ return db
+ .select({ step: dashboardStepDismissals.step })
+ .from(dashboardStepDismissals)
+ .where(
+ and(
+ eq(dashboardStepDismissals.userId, userId),
+ eq(dashboardStepDismissals.projectId, projectId),
+ ),
+ );
+}
+
+async function setStepDismissed(
+ userId: string,
+ projectId: string,
+ step: DashboardSetupStep,
+ dismissed: boolean,
+) {
+ if (dismissed) {
+ await db
+ .insert(dashboardStepDismissals)
+ .values({ userId, projectId, step })
+ .onConflictDoNothing();
+ } else {
+ if (step === "mcp") {
+ await db
+ .update(projectActivationState)
+ .set({ mcpCardDismissedAt: null })
+ .where(eq(projectActivationState.projectId, projectId));
+ }
+ await db
+ .delete(dashboardStepDismissals)
+ .where(
+ and(
+ eq(dashboardStepDismissals.userId, userId),
+ eq(dashboardStepDismissals.projectId, projectId),
+ eq(dashboardStepDismissals.step, step),
+ ),
+ );
+ }
+}
+
+// Return only the milestone, never member or invitee details to the dashboard.
+async function hasTeammate(organizationId: string) {
+ const [members, pending] = await Promise.all([
+ db
+ .select({ id: member.id })
+ .from(member)
+ .where(eq(member.organizationId, organizationId))
+ .limit(2),
+ db
+ .select({ id: invitation.id })
+ .from(invitation)
+ .where(
+ and(
+ eq(invitation.organizationId, organizationId),
+ eq(invitation.status, "pending"),
+ gt(invitation.expiresAt, new Date()),
+ ),
+ )
+ .limit(1),
+ ]);
+ return members.length > 1 || pending.length > 0;
+}
+
export const ActivationRepository = {
+ getDismissedSteps,
+ setStepDismissed,
+ hasTeammate,
getOrganizationActivation,
getProjectActivation,
recordFirstMcpAuthorized,
recordFirstMcpToolCall,
markCompetitorStepClicked,
- markMcpCardDismissed,
markGa4CardDismissed,
};
diff --git a/src/server/features/dashboard/services/DashboardService.ts b/src/server/features/dashboard/services/DashboardService.ts
index 05ede7d5..27985185 100644
--- a/src/server/features/dashboard/services/DashboardService.ts
+++ b/src/server/features/dashboard/services/DashboardService.ts
@@ -1,3 +1,4 @@
+import { ProjectRepository } from "@/server/features/projects/repositories/ProjectRepository";
import { sort } from "remeda";
import type { BillingCustomerContext } from "@/server/billing/subscription";
import { ActivationRepository } from "@/server/features/activation/repositories/ActivationRepository";
@@ -36,6 +37,9 @@ export type DashboardActivation = {
cardDismissedAt: string | null;
};
competitorClickedAt: string | null;
+ hasMultipleProjects: boolean;
+ hasTeammate: boolean;
+ dismissedSteps: string[];
};
type DashboardRankSummary = {
@@ -79,19 +83,34 @@ type DashboardOverview = {
};
async function getActivation(input: {
+ userId: string;
projectId: string;
organizationId: string;
domain: string | null;
}): Promise<DashboardActivation> {
- const [ga4, gsc, orgActivation, projectActivation] = await Promise.all([
+ const [
+ ga4,
+ gsc,
+ orgActivation,
+ projectActivation,
+ projectCount,
+ hasTeammate,
+ dismissed,
+ ] = await Promise.all([
Ga4ConnectionRepository.getByProjectId(input.projectId),
GscConnectionRepository.getByProjectId(input.projectId),
ActivationRepository.getOrganizationActivation(input.organizationId),
ActivationRepository.getProjectActivation(input.projectId),
+ ProjectRepository.countProjects(input.organizationId),
+ ActivationRepository.hasTeammate(input.organizationId),
+ ActivationRepository.getDismissedSteps(input.userId, input.projectId),
]);
return {
domain: input.domain,
+ hasMultipleProjects: projectCount > 1,
+ hasTeammate,
+ dismissedSteps: dismissed.map((row) => row.step),
ga4: {
connected: ga4 !== null,
propertyDisplayName: ga4?.propertyDisplayName ?? null,
@@ -295,6 +314,7 @@ async function ensureBacklinkSnapshot(input: {
}
export const DashboardService = {
+ setStepDismissed: ActivationRepository.setStepDismissed,
getActivation,
getOverview,
ensureBacklinkSnapshot,
diff --git a/src/server/features/projects/repositories/ProjectRepository.ts b/src/server/features/projects/repositories/ProjectRepository.ts
index a9f18924..175c395d 100644
--- a/src/server/features/projects/repositories/ProjectRepository.ts
+++ b/src/server/features/projects/repositories/ProjectRepository.ts
@@ -101,42 +101,16 @@ async function updateProject(
return row;
}
-// Writes only the domain column, for the dashboard's inline domain input.
-async function updateProjectDomain(
+// Save website setup atomically without rewriting the project name.
+async function updateProjectWebsite(
projectId: string,
organizationId: string,
domain: string,
-) {
- const [row] = await db
- .update(projects)
- .set({ domain })
- .where(
- and(
- eq(projects.id, projectId),
- eq(projects.organizationId, organizationId),
- isNull(projects.archivedAt),
- ),
- )
- .returning();
-
- if (!row) {
- throw new AppError("NOT_FOUND");
- }
-
- return row;
-}
-
-// Writes only the market columns. Onboarding sets the project's market before
-// the user has named the project or picked a domain, so it must not go through
-// updateProject, whose `domain: input.domain ?? null` would clear the domain.
-async function updateProjectMarket(
- projectId: string,
- organizationId: string,
market: { locationCode: number; languageCode: string },
) {
const [row] = await db
.update(projects)
- .set(market)
+ .set({ domain, ...market })
.where(
and(
eq(projects.id, projectId),
@@ -222,8 +196,7 @@ export const ProjectRepository = {
getProjectById,
createProject,
updateProject,
- updateProjectDomain,
- updateProjectMarket,
+ updateProjectWebsite,
tryCreateDefaultProject,
archiveProject,
restoreProject,
diff --git a/src/server/features/projects/services/ProjectService.ts b/src/server/features/projects/services/ProjectService.ts
index 28619994..f3c228d6 100644
--- a/src/server/features/projects/services/ProjectService.ts
+++ b/src/server/features/projects/services/ProjectService.ts
@@ -7,8 +7,7 @@ import {
listProjects,
listProjectsEnsuringOne,
restoreProject,
- setProjectDomain,
- setProjectMarket,
+ setProjectWebsite,
updateProject,
} from "@/server/features/projects/services/projects";
@@ -17,8 +16,7 @@ export const ProjectService = {
listProjectsEnsuringOne,
createProject,
updateProject,
- setProjectDomain,
- setProjectMarket,
+ setProjectWebsite,
archiveProject,
restoreProject,
listArchivedProjects,
diff --git a/src/server/features/projects/services/projects.test.ts b/src/server/features/projects/services/projects.test.ts
index 745ce96f..00faff49 100644
--- a/src/server/features/projects/services/projects.test.ts
+++ b/src/server/features/projects/services/projects.test.ts
@@ -3,11 +3,10 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({
createProject: vi.fn(),
updateProject: vi.fn(),
- updateProjectDomain: vi.fn(),
+ updateProjectWebsite: vi.fn(),
archiveProject: vi.fn(),
restoreProject: vi.fn(),
countProjects: vi.fn(),
- updateProjectMarket: vi.fn(),
getProjectForOrganization: vi.fn(),
listProjects: vi.fn(),
listArchivedProjects: vi.fn(),
@@ -79,6 +78,50 @@ describe("project service", () => {
});
});
+ describe("setProjectWebsite", () => {
+ it("saves normalized domain and market in one write without changing the name", async () => {
+ mocks.updateProjectWebsite.mockResolvedValue(namedProject);
+ const { setProjectWebsite } = await import("./projects");
+ await setProjectWebsite("org_1", {
+ projectId: "project_acme",
+ domain: "https://www.acme.com/about",
+ locationCode: 2826,
+ languageCode: "en",
+ });
+ expect(mocks.updateProjectWebsite).toHaveBeenCalledWith(
+ "project_acme",
+ "org_1",
+ "acme.com",
+ { locationCode: 2826, languageCode: "en" },
+ );
+ expect(mocks.updateProject).not.toHaveBeenCalled();
+ });
+ it("rejects an invalid website before writing", async () => {
+ const { setProjectWebsite } = await import("./projects");
+ await expect(
+ setProjectWebsite("org_1", {
+ projectId: "project_acme",
+ domain: "not a domain",
+ locationCode: 2840,
+ languageCode: "en",
+ }),
+ ).rejects.toThrow();
+ expect(mocks.updateProjectWebsite).not.toHaveBeenCalled();
+ });
+ it("rejects a mismatched market before writing the website", async () => {
+ const { setProjectWebsite } = await import("./projects");
+ await expect(
+ setProjectWebsite("org_1", {
+ projectId: "project_acme",
+ domain: "acme.com",
+ locationCode: 2826,
+ languageCode: "fr",
+ }),
+ ).rejects.toThrow();
+ expect(mocks.updateProjectWebsite).not.toHaveBeenCalled();
+ });
+ });
+
describe("createProject", () => {
it("returns the full created project", async () => {
mocks.createProject.mockResolvedValue(namedProject);
@@ -209,36 +252,6 @@ describe("project service", () => {
});
});
- describe("setProjectDomain", () => {
- it("canonicalizes a pasted URL to the bare host before writing", async () => {
- mocks.updateProjectDomain.mockResolvedValue(namedProject);
- const { setProjectDomain } = await import("./projects");
-
- await setProjectDomain("org_1", {
- projectId: "project_acme",
- domain: "https://www.Acme.com/pricing?ref=x",
- });
-
- expect(mocks.updateProjectDomain).toHaveBeenCalledWith(
- "project_acme",
- "org_1",
- "acme.com",
- );
- });
-
- it("rejects junk that the backlink fetch would later refuse", async () => {
- const { setProjectDomain } = await import("./projects");
-
- await expect(
- setProjectDomain("org_1", {
- projectId: "project_acme",
- domain: "not a domain",
- }),
- ).rejects.toThrow("Enter a valid domain");
- expect(mocks.updateProjectDomain).not.toHaveBeenCalled();
- });
- });
-
describe("updateProject domain validation", () => {
it("rejects a junk domain instead of storing it", async () => {
const { updateProject } = await import("./projects");
@@ -254,45 +267,6 @@ describe("project service", () => {
});
});
- describe("setProjectMarket", () => {
- it("writes only the market columns, leaving name and domain untouched", async () => {
- // Onboarding sets the market before the project is named or given a
- // domain; going through updateProject would clear the domain.
- mocks.updateProjectMarket.mockResolvedValue({
- ...namedProject,
- locationCode: 2704,
- languageCode: "vi",
- });
- const { setProjectMarket } = await import("./projects");
-
- await setProjectMarket("org_1", {
- projectId: "project_acme",
- locationCode: 2704,
- languageCode: "vi",
- });
-
- expect(mocks.updateProjectMarket).toHaveBeenCalledWith(
- "project_acme",
- "org_1",
- { locationCode: 2704, languageCode: "vi" },
- );
- expect(mocks.updateProject).not.toHaveBeenCalled();
- });
-
- it("rejects a language the location does not serve before any write", async () => {
- const { setProjectMarket } = await import("./projects");
-
- await expect(
- setProjectMarket("org_1", {
- projectId: "project_acme",
- locationCode: 2840,
- languageCode: "vi",
- }),
- ).rejects.toMatchObject({ code: "VALIDATION_ERROR" });
- expect(mocks.updateProjectMarket).not.toHaveBeenCalled();
- });
- });
-
describe("archiveProject", () => {
it("refuses to archive the org's only project", async () => {
mocks.countProjects.mockResolvedValue(1);
diff --git a/src/server/features/projects/services/projects.ts b/src/server/features/projects/services/projects.ts
index 1c272bbf..27ba7961 100644
--- a/src/server/features/projects/services/projects.ts
+++ b/src/server/features/projects/services/projects.ts
@@ -2,8 +2,7 @@ import type {
ArchiveProjectInput,
CreateProjectInput,
RestoreProjectInput,
- SetProjectDomainInput,
- SetProjectMarketInput,
+ SetProjectWebsiteInput,
UpdateProjectInput,
} from "@/types/schemas/projects";
import { ProjectRepository } from "@/server/features/projects/repositories/ProjectRepository";
@@ -146,45 +145,6 @@ export async function updateProject(
}
}
-/**
- * Sets a project's domain on its own, for the dashboard hero's inline input.
- * Writing just this column keeps the write from echoing a name/market the
- * caller never edited.
- */
-export async function setProjectDomain(
- organizationId: string,
- input: SetProjectDomainInput,
-) {
- const domain = normalizeProjectDomain(input.domain);
- if (domain === undefined) {
- throw new AppError("VALIDATION_ERROR", "Enter a valid domain.");
- }
- const row = await ProjectRepository.updateProjectDomain(
- input.projectId,
- organizationId,
- domain,
- );
- return mapProject(row);
-}
-
-/**
- * Sets a project's default market on its own, for surfaces that only ask for
- * the market (onboarding). Writing just these two columns keeps the write from
- * echoing a name/domain the caller never edited.
- */
-export async function setProjectMarket(
- organizationId: string,
- input: SetProjectMarketInput,
-) {
- assertLanguageForLocation(input.locationCode, input.languageCode);
- const row = await ProjectRepository.updateProjectMarket(
- input.projectId,
- organizationId,
- { locationCode: input.locationCode, languageCode: input.languageCode },
- );
- return mapProject(row);
-}
-
export async function archiveProject(
organizationId: string,
input: ArchiveProjectInput,
@@ -256,3 +216,19 @@ export async function getProjectWithOrganization(projectId: string) {
project: mapProject(project),
};
}
+
+export async function setProjectWebsite(
+ organizationId: string,
+ input: SetProjectWebsiteInput,
+) {
+ const domain = normalizeProjectDomain(input.domain);
+ if (!domain) throw new AppError("VALIDATION_ERROR", "Enter a valid domain.");
+ assertLanguageForLocation(input.locationCode, input.languageCode);
+ const row = await ProjectRepository.updateProjectWebsite(
+ input.projectId,
+ organizationId,
+ domain,
+ { locationCode: input.locationCode, languageCode: input.languageCode },
+ );
+ return mapProject(row);
+}
diff --git a/src/serverFunctions/dashboard.ts b/src/serverFunctions/dashboard.ts
index fc8adecc..2af0dff7 100644
--- a/src/serverFunctions/dashboard.ts
+++ b/src/serverFunctions/dashboard.ts
@@ -2,13 +2,17 @@ import { createServerFn } from "@tanstack/react-start";
import { ActivationRepository } from "@/server/features/activation/repositories/ActivationRepository";
import { DashboardService } from "@/server/features/dashboard/services/DashboardService";
import { requireProjectContext } from "@/serverFunctions/middleware";
-import { dashboardProjectInputSchema } from "@/types/schemas/dashboard";
+import {
+ dashboardProjectInputSchema,
+ dashboardStepDismissalSchema,
+} from "@/types/schemas/dashboard";
export const getDashboardActivation = createServerFn({ method: "POST" })
.middleware(requireProjectContext)
.validator(dashboardProjectInputSchema)
.handler(({ context }) =>
DashboardService.getActivation({
+ userId: context.userId,
projectId: context.projectId,
organizationId: context.organizationId,
domain: context.project.domain,
@@ -51,17 +55,6 @@ export const markDashboardCompetitorClicked = createServerFn({
return { ok: true as const };
});
-// "I already connected" on the MCP card. Hides the card for this project;
-// the org-level milestone stays untouched and self-corrects on the next
-// real external tool call.
-export const dismissDashboardMcpCard = createServerFn({ method: "POST" })
- .middleware(requireProjectContext)
- .validator(dashboardProjectInputSchema)
- .handler(async ({ context }) => {
- await ActivationRepository.markMcpCardDismissed(context.projectId);
- return { ok: true as const };
- });
-
// Hides only the optional GA4 pitch on this project's dashboard. The
// integration remains available in Project Settings and a later connection
// makes the dashboard card visible again.
@@ -72,3 +65,16 @@ export const dismissDashboardGa4Card = createServerFn({ method: "POST" })
await ActivationRepository.markGa4CardDismissed(context.projectId);
return { ok: true as const };
});
+
+export const setDashboardStepDismissed = createServerFn({ method: "POST" })
+ .middleware(requireProjectContext)
+ .validator(dashboardStepDismissalSchema)
+ .handler(async ({ context, data }) => {
+ await DashboardService.setStepDismissed(
+ context.userId,
+ context.projectId,
+ data.step,
+ data.dismissed,
+ );
+ return { ok: true };
+ });
diff --git a/src/serverFunctions/projects.ts b/src/serverFunctions/projects.ts
index eab43516..b294855a 100644
--- a/src/serverFunctions/projects.ts
+++ b/src/serverFunctions/projects.ts
@@ -9,8 +9,7 @@ import {
archiveProjectSchema,
createProjectSchema,
restoreProjectSchema,
- setProjectDomainSchema,
- setProjectMarketSchema,
+ setProjectWebsiteSchema,
updateProjectSchema,
} from "@/types/schemas/projects";
import { z } from "zod";
@@ -38,20 +37,6 @@ export const updateProject = createServerFn({ method: "POST" })
ProjectService.updateProject(context.organizationId, data),
);
-export const setProjectDomain = createServerFn({ method: "POST" })
- .middleware(requireProjectContext)
- .validator(setProjectDomainSchema)
- .handler(async ({ data, context }) =>
- ProjectService.setProjectDomain(context.organizationId, data),
- );
-
-export const setProjectMarket = createServerFn({ method: "POST" })
- .middleware(requireProjectContext)
- .validator(setProjectMarketSchema)
- .handler(async ({ data, context }) =>
- ProjectService.setProjectMarket(context.organizationId, data),
- );
-
export const archiveProject = createServerFn({ method: "POST" })
.middleware(requireProjectContext)
.validator(archiveProjectSchema)
@@ -83,3 +68,10 @@ export const getProjectAccess = createServerFn({ method: "POST" })
data.projectId,
);
});
+
+export const setProjectWebsite = createServerFn({ method: "POST" })
+ .middleware(requireProjectContext)
+ .validator(setProjectWebsiteSchema)
+ .handler(({ data, context }) =>
+ ProjectService.setProjectWebsite(context.organizationId, data),
+ );
diff --git a/src/types/schemas/dashboard.ts b/src/types/schemas/dashboard.ts
index 29b7690b..0331d2a4 100644
--- a/src/types/schemas/dashboard.ts
+++ b/src/types/schemas/dashboard.ts
@@ -1,13 +1,19 @@
import { z } from "zod";
-export const dashboardHeroStepSchema = z.enum([
+export const dashboardProjectInputSchema = z.object({
+ projectId: z.string().min(1),
+});
+
+export const dashboardSetupStepSchema = z.enum([
"domain",
+ "project",
+ "competitor",
"mcp",
"gsc",
- "competitor",
+ "team",
]);
-export type DashboardHeroStep = z.infer<typeof dashboardHeroStepSchema>;
-
-export const dashboardProjectInputSchema = z.object({
- projectId: z.string().min(1),
+export type DashboardSetupStep = z.infer<typeof dashboardSetupStepSchema>;
+export const dashboardStepDismissalSchema = dashboardProjectInputSchema.extend({
+ step: dashboardSetupStepSchema,
+ dismissed: z.boolean(),
});
diff --git a/src/types/schemas/projects.ts b/src/types/schemas/projects.ts
index 31a29b86..b4ee4932 100644
--- a/src/types/schemas/projects.ts
+++ b/src/types/schemas/projects.ts
@@ -63,17 +63,9 @@ export const updateProjectSchema = z
})
.refine(hasLocationForLanguage, marketPairMessage);
-// Domain on its own, for the dashboard hero's inline input. Same loose shape
-// as updateProjectSchema's domain field, but required.
-export const setProjectDomainSchema = z.object({
+export const setProjectWebsiteSchema = z.object({
projectId: z.string().min(1),
domain: z.string().trim().min(1).max(255),
-});
-
-// Market-only update (onboarding). Both halves are required: the caller picks
-// them together, so the service can validate the pair without a stored row.
-export const setProjectMarketSchema = z.object({
- projectId: z.string().min(1),
locationCode: z
.number()
.int()
@@ -96,7 +88,7 @@ export const restoreProjectSchema = z.object({
export type CreateProjectInput = z.infer<typeof createProjectSchema>;
export type UpdateProjectInput = z.infer<typeof updateProjectSchema>;
-export type SetProjectDomainInput = z.infer<typeof setProjectDomainSchema>;
-export type SetProjectMarketInput = z.infer<typeof setProjectMarketSchema>;
export type ArchiveProjectInput = z.infer<typeof archiveProjectSchema>;
export type RestoreProjectInput = z.infer<typeof restoreProjectSchema>;
+
+export type SetProjectWebsiteInput = z.infer<typeof setProjectWebsiteSchema>;
diff --git a/web/content/docs/skills/setup.md b/web/content/docs/skills/setup.md
index e023bfb0..4797fbe8 100644
--- a/web/content/docs/skills/setup.md
+++ b/web/content/docs/skills/setup.md
@@ -56,11 +56,11 @@ git clone https://github.com/every-app/open-seo.git
# Codex
mkdir -p ~/.codex/skills
-cp -R open-seo/.agents/skills/* ~/.codex/skills/
+cp -R open-seo/plugins/openseo/skills/* ~/.codex/skills/
# Claude Code
mkdir -p ~/.claude/skills
-cp -R open-seo/.agents/skills/* ~/.claude/skills/
+cp -R open-seo/plugins/openseo/skills/* ~/.claude/skills/
```
You can also review the source skills on GitHub: