create-alta-app 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +21 -26
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { execSync } from 'node:child_process';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
|
-
import os from 'node:os';
|
|
6
5
|
import path from 'node:path';
|
|
7
6
|
import prompts from 'prompts';
|
|
8
7
|
import ora from 'ora';
|
|
@@ -431,32 +430,16 @@ async function main() {
|
|
|
431
430
|
credentials = null;
|
|
432
431
|
}
|
|
433
432
|
|
|
434
|
-
// ── Step 4:
|
|
435
|
-
const
|
|
436
|
-
const
|
|
437
|
-
SUPABASE_ACCESS_TOKEN: 'sbp_66e351be37d4e570fe4347ea7c78bbebc8988219',
|
|
438
|
-
};
|
|
439
|
-
|
|
433
|
+
// ── Step 4: Login to Supabase CLI ──
|
|
434
|
+
const SUPABASE_TOKEN = 'sbp_66e351be37d4e570fe4347ea7c78bbebc8988219';
|
|
435
|
+
const spinnerLogin = ora({ text: 'Logging in to Supabase CLI...', indent: 2 }).start();
|
|
440
436
|
try {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
const regex = new RegExp(`^export ${key}=.*$`, 'm');
|
|
445
|
-
const line = `export ${key}=${value}`;
|
|
446
|
-
|
|
447
|
-
if (regex.test(rcContent)) {
|
|
448
|
-
rcContent = rcContent.replace(regex, line);
|
|
449
|
-
} else {
|
|
450
|
-
rcContent += `\n# Alta\n${line}\n`;
|
|
451
|
-
}
|
|
452
|
-
process.env[key] = value;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
const spinnerShell = ora({ text: 'Setting up shell credentials...', indent: 2 }).start();
|
|
456
|
-
fs.writeFileSync(shellRc, rcContent);
|
|
457
|
-
spinnerShell.succeed(pc.green('Shell credentials configured'));
|
|
437
|
+
run(`npx supabase login --token ${SUPABASE_TOKEN}`, targetDir);
|
|
438
|
+
process.env.SUPABASE_ACCESS_TOKEN = SUPABASE_TOKEN;
|
|
439
|
+
spinnerLogin.succeed(pc.green('Supabase CLI authenticated'));
|
|
458
440
|
} catch {
|
|
459
|
-
|
|
441
|
+
spinnerLogin.warn(pc.yellow('Could not login to Supabase CLI'));
|
|
442
|
+
console.log(` ${pc.dim('Run manually: npx supabase login')}`);
|
|
460
443
|
}
|
|
461
444
|
|
|
462
445
|
// ── Step 5: Wait for Supabase project to provision & get anon key ──
|
|
@@ -539,6 +522,18 @@ async function main() {
|
|
|
539
522
|
}
|
|
540
523
|
|
|
541
524
|
|
|
525
|
+
// ── Step 6: Link Supabase project (uses SUPABASE_ACCESS_TOKEN from env) ──
|
|
526
|
+
if (credentials) {
|
|
527
|
+
const spinnerLink = ora({ text: 'Linking Supabase project...', indent: 2 }).start();
|
|
528
|
+
try {
|
|
529
|
+
run(`npx supabase link --project-ref ${credentials.supabaseProjectRef}`, targetDir);
|
|
530
|
+
spinnerLink.succeed(pc.green('Supabase project linked'));
|
|
531
|
+
} catch {
|
|
532
|
+
spinnerLink.warn(pc.yellow('Could not link Supabase project'));
|
|
533
|
+
console.log(` ${pc.dim(`Run manually: cd ${projectName} && npx supabase link --project-ref ${credentials.supabaseProjectRef}`)}`);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
542
537
|
// ── Step 7: Write project-specific MCP config ──
|
|
543
538
|
if (credentials) {
|
|
544
539
|
const spinnerMcp = ora({ text: 'Configuring Claude MCP...', indent: 2 }).start();
|
|
@@ -551,7 +546,7 @@ async function main() {
|
|
|
551
546
|
supabase: {
|
|
552
547
|
url: `https://mcp.supabase.com/mcp`,
|
|
553
548
|
headers: {
|
|
554
|
-
'x-supabase-access-token':
|
|
549
|
+
'x-supabase-access-token': SUPABASE_TOKEN,
|
|
555
550
|
'x-project-ref': credentials.supabaseProjectRef,
|
|
556
551
|
},
|
|
557
552
|
},
|