One clear money plan, and paste the Supabase page address for the Project URL
- Money plan is one card: your AI's two-sentence summary, then numbered next steps, then context and chat - Removed the next-move card, plan summary, payoff chart, timeline and bills list from the page - Setup accepts the dashboard address or project ref and works out the Project URL Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f2d7f36017
commit
febd77e105
10 files changed
+78
-648
No files matched your search
@@ -41,3 +41,10 @@ assert.equal(updateEnvText("", { SUPABASE_DB_URL: "postgresql://u:p$ss#1@h:5432/
|
||||
assert.equal(parseEnv(updateEnvText("", { SUPABASE_DB_URL: "postgresql://u:p$ss#1@h:5432/db" })).SUPABASE_DB_URL, "postgresql://u:p$ss#1@h:5432/db");
|
||||
assert.ok(validate({ SUPABASE_DB_URL: 'postgresql://u:a"b@h/db' }).errors.SUPABASE_DB_URL);
|
||||
console.log("envfile: ok");
|
||||
|
||||
// The Project URL from the dashboard address, the bare ref, or the URL itself.
|
||||
const REF = "macoucuuhxtmvihabcde";
|
||||
assert.equal(validate({ NEXT_PUBLIC_SUPABASE_URL: `https://supabase.com/dashboard/project/${REF}/settings/api-keys` }).clean.NEXT_PUBLIC_SUPABASE_URL, `https://${REF}.supabase.co`);
|
||||
assert.equal(validate({ NEXT_PUBLIC_SUPABASE_URL: REF }).clean.NEXT_PUBLIC_SUPABASE_URL, `https://${REF}.supabase.co`);
|
||||
assert.equal(validate({ NEXT_PUBLIC_SUPABASE_URL: `https://${REF}.supabase.co/` }).clean.NEXT_PUBLIC_SUPABASE_URL, `https://${REF}.supabase.co`);
|
||||
assert.equal(validate({ NEXT_PUBLIC_SUPABASE_URL: "http://127.0.0.1:54321" }).clean.NEXT_PUBLIC_SUPABASE_URL, "http://127.0.0.1:54321");
|
||||
@@ -79,6 +79,13 @@ export function updateEnvText(text: string, updates: Record<string, string>): st
|
||||
const quote = (v: string) => (/[\s#$]/.test(v) ? `"${v.replace(/\$/g, "\\$")}"` : v);
|
||||
|
||||
// Every value is checked before anything touches the disk. Returns per-key errors.
|
||||
// The Project URL is https://<ref>.supabase.co, and the ref is also in the browser's address bar on any page of the
|
||||
// project in Supabase's dashboard. So that address, or the bare ref, is accepted and turned into the Project URL.
|
||||
export function supabaseUrl(v: string) {
|
||||
const ref = v.match(/supabase\.com\/dashboard\/project\/([a-z0-9]{20})\b/)?.[1] ?? v.match(/^([a-z0-9]{20})$/)?.[1];
|
||||
return ref ? `https://${ref}.supabase.co` : v.replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
export function validate(updates: Record<string, unknown>): { clean: Record<string, string>; errors: Record<string, string> } {
|
||||
const clean: Record<string, string> = {};
|
||||
const errors: Record<string, string> = {};
|
||||
@@ -89,6 +96,7 @@ export function validate(updates: Record<string, unknown>): { clean: Record<stri
|
||||
const v = raw.trim();
|
||||
if (/[\u0000-\u001f\u007f'"`\\]/.test(v)) { errors[k] = "Contains characters that aren't allowed (line breaks, quotes or backslashes)."; continue; } // no newline/quote injection
|
||||
if (v === "") { clean[k] = ""; continue; }
|
||||
if (k === "NEXT_PUBLIC_SUPABASE_URL") { const u = supabaseUrl(v); const err = spec.check(u); if (err) errors[k] = err; else clean[k] = u; continue; }
|
||||
const err = spec.check(v);
|
||||
if (err) errors[k] = err;
|
||||
else clean[k] = v;
|
||||
|
||||
+1
-1
@@ -730,5 +730,5 @@ Never recommend a new credit card, a sign-up bonus, a balance transfer card or a
|
||||
Never contradict a candidate's numbers: a rewrite may round a dollar figure the candidate has, never bring a new one. "once" means the value comes once, not every year; keep that wording.
|
||||
You get candidate moves already worked out in code. Every candidate in steps 1 to 6, and every one worth $100 a year or more, must stay as its own move with its own ref (improve its wording); you may merge or drop the smaller ones in step 7, improve the wording, steps and drafted messages, and add at most 3 more moves only when the facts clearly show them (for example a large charge that looks shared with a friend, so a message asking them to settle up). No generic tips.
|
||||
Reply with ONLY one JSON object, no prose, no code fence:
|
||||
{"summary": "one plain sentence naming the first thing to do", "moves": [{"ref": "the candidate's ref, or \\"other\\"", "kind": "cancel|negotiate|insurance|card|signup|message|earn|tax|budget|save", "section": "spending|debt|saving|tax|bills|cards", "title": "short imperative", "why": "one or two sentences citing their numbers, under 300 characters", "yearly_impact": number, "effort": "5 min|30 min|1 hour+", "steps": ["3 to 6 short imperative steps"], "message": {"to": "who", "channel": "email|sms|call", "subject": "optional", "body": "the drafted text"} or null, "links": [{"label": "...", "url": "only from allowed_urls"}], "confidence": "high|medium|low"}]}
|
||||
{"summary": "two short plain sentences: where the user stands now, then the first thing to do and why", "moves": [{"ref": "the candidate's ref, or \\"other\\"", "kind": "cancel|negotiate|insurance|card|signup|message|earn|tax|budget|save", "section": "spending|debt|saving|tax|bills|cards", "title": "short imperative", "why": "one or two sentences citing their numbers, under 300 characters", "yearly_impact": number, "effort": "5 min|30 min|1 hour+", "steps": ["3 to 6 short imperative steps"], "message": {"to": "who", "channel": "email|sms|call", "subject": "optional", "body": "the drafted text"} or null, "links": [{"label": "...", "url": "only from allowed_urls"}], "confidence": "high|medium|low"}]}
|
||||
yearly_impact is conservative, in the user's currency, never above the candidate's number. Plain short sentences, sentence case, no em dashes, no markdown.`;
|
||||
+3
-3
@@ -102,12 +102,12 @@ export async function setupStatus(signedIn: boolean): Promise<SetupStatus> {
|
||||
note: sb?.ok ? (ref ? `Project ${ref}` : sb.message) : sb?.message,
|
||||
steps: [
|
||||
["Make a free account and project at ", { href: "https://supabase.com/dashboard/new", label: "supabase.com" }, ". Any name works. Save the database password it gives you."],
|
||||
["Copy your Project URL from ", { href: dash("/settings/api"), label: "Project Settings → Data API" }, "."],
|
||||
["Copy the publishable and secret keys from ", { href: dash("/settings/api-keys"), label: "Project Settings → API Keys" }, "."],
|
||||
["Open ", { href: dash("/settings/api-keys"), label: "Project Settings → API Keys" }, " and copy the publishable and secret keys."],
|
||||
["For the Project URL, copy the address from your browser's address bar on that page. broke works out the rest."],
|
||||
["Paste all three below and press Save."],
|
||||
],
|
||||
fields: fields(env, ["NEXT_PUBLIC_SUPABASE_URL", "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY", "SUPABASE_SERVICE_ROLE_KEY"], {
|
||||
NEXT_PUBLIC_SUPABASE_URL: { placeholder: "https://xxxx.supabase.co" },
|
||||
NEXT_PUBLIC_SUPABASE_URL: { placeholder: "https://supabase.com/dashboard/project/… or https://xxxx.supabase.co" },
|
||||
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: { placeholder: "sb_publishable_…" },
|
||||
SUPABASE_SERVICE_ROLE_KEY: { placeholder: "sb_secret_…" },
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user