shsu 0.0.6 → 0.0.7
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/README.md +1 -0
- package/bin/shsu.mjs +92 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/bin/shsu.mjs
CHANGED
|
@@ -428,6 +428,11 @@ async function cmdMcp() {
|
|
|
428
428
|
description: 'Run SQL migrations on the database. Syncs migration files via rsync and executes them via psql.',
|
|
429
429
|
inputSchema: { type: 'object', properties: {} },
|
|
430
430
|
},
|
|
431
|
+
{
|
|
432
|
+
name: 'docs',
|
|
433
|
+
description: 'Get documentation on how to set up and use shsu for deploying Supabase Edge Functions.',
|
|
434
|
+
inputSchema: { type: 'object', properties: {} },
|
|
435
|
+
},
|
|
431
436
|
];
|
|
432
437
|
|
|
433
438
|
const serverInfo = {
|
|
@@ -588,6 +593,93 @@ async function cmdMcp() {
|
|
|
588
593
|
return { content: [{ type: 'text', text: output }] };
|
|
589
594
|
}
|
|
590
595
|
|
|
596
|
+
case 'docs': {
|
|
597
|
+
return {
|
|
598
|
+
content: [{
|
|
599
|
+
type: 'text',
|
|
600
|
+
text: `# shsu - Self-Hosted Supabase Utilities
|
|
601
|
+
|
|
602
|
+
Deploy and manage Supabase Edge Functions on Coolify-hosted Supabase.
|
|
603
|
+
|
|
604
|
+
## Project Setup
|
|
605
|
+
|
|
606
|
+
1. **Configure shsu** by adding to package.json:
|
|
607
|
+
\`\`\`json
|
|
608
|
+
{
|
|
609
|
+
"shsu": {
|
|
610
|
+
"server": "root@your-coolify-server",
|
|
611
|
+
"remotePath": "/data/coolify/services/YOUR_SERVICE_ID/volumes/functions",
|
|
612
|
+
"url": "https://your-supabase.example.com",
|
|
613
|
+
"edgeContainer": "edge",
|
|
614
|
+
"dbContainer": "postgres"
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
\`\`\`
|
|
618
|
+
|
|
619
|
+
Or run \`npx shsu init\` for interactive setup.
|
|
620
|
+
|
|
621
|
+
2. **Find configuration values** by SSH'ing to your server:
|
|
622
|
+
- Container names: \`docker ps\` (Coolify uses pattern \`<service>-<uuid>\`)
|
|
623
|
+
- Remote path: \`docker inspect $(docker ps -q --filter 'name=edge') | grep -A 5 "Mounts"\`
|
|
624
|
+
|
|
625
|
+
## Directory Structure
|
|
626
|
+
|
|
627
|
+
\`\`\`
|
|
628
|
+
your-project/
|
|
629
|
+
├── package.json # Contains shsu config
|
|
630
|
+
├── supabase/
|
|
631
|
+
│ ├── functions/ # Edge functions (default localPath)
|
|
632
|
+
│ │ ├── hello-world/
|
|
633
|
+
│ │ │ └── index.ts
|
|
634
|
+
│ │ └── another-func/
|
|
635
|
+
│ │ └── index.ts
|
|
636
|
+
│ └── migrations/ # SQL migrations (default migrationsPath)
|
|
637
|
+
│ ├── 001_create_users.sql
|
|
638
|
+
│ └── 002_add_indexes.sql
|
|
639
|
+
\`\`\`
|
|
640
|
+
|
|
641
|
+
## Configuration Options
|
|
642
|
+
|
|
643
|
+
| Key | Required | Default | Description |
|
|
644
|
+
|-----|----------|---------|-------------|
|
|
645
|
+
| server | Yes | - | SSH host (e.g., root@server.com) |
|
|
646
|
+
| remotePath | Yes | - | Remote path to functions directory |
|
|
647
|
+
| url | For invoke | - | Supabase URL |
|
|
648
|
+
| localPath | No | ./supabase/functions | Local functions path |
|
|
649
|
+
| migrationsPath | No | ./supabase/migrations | Local migrations path |
|
|
650
|
+
| edgeContainer | No | edge | Edge runtime container filter |
|
|
651
|
+
| dbContainer | No | postgres | Database container filter |
|
|
652
|
+
|
|
653
|
+
## Edge Function Template
|
|
654
|
+
|
|
655
|
+
Use \`new\` tool to create functions. Each function needs an index.ts:
|
|
656
|
+
|
|
657
|
+
\`\`\`typescript
|
|
658
|
+
Deno.serve(async (req) => {
|
|
659
|
+
const { name } = await req.json()
|
|
660
|
+
return new Response(
|
|
661
|
+
JSON.stringify({ message: \`Hello \${name}!\` }),
|
|
662
|
+
{ headers: { "Content-Type": "application/json" } }
|
|
663
|
+
)
|
|
664
|
+
})
|
|
665
|
+
\`\`\`
|
|
666
|
+
|
|
667
|
+
## Workflow
|
|
668
|
+
|
|
669
|
+
1. Create function: \`new\` tool with function name
|
|
670
|
+
2. Edit the function code in supabase/functions/<name>/index.ts
|
|
671
|
+
3. Deploy: \`deploy\` tool (syncs via rsync, restarts edge-runtime)
|
|
672
|
+
4. Test: \`invoke\` tool with JSON data
|
|
673
|
+
5. Debug: Check logs on the server
|
|
674
|
+
|
|
675
|
+
## Migrations
|
|
676
|
+
|
|
677
|
+
Place .sql files in supabase/migrations/. They execute alphabetically.
|
|
678
|
+
Use \`migrate\` tool to run all migrations via psql in the database container.`,
|
|
679
|
+
}],
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
|
|
591
683
|
default:
|
|
592
684
|
return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
|
|
593
685
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shsu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "CLI for deploying and managing Supabase Edge Functions on self-hosted Supabase (Coolify, Docker Compose). Sync functions via rsync, stream logs, and invoke endpoints.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|