@mosaicsite/claude-skill 1.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/CLAUDE.md +286 -0
- package/README.md +98 -0
- package/bin/install.js +155 -0
- package/index.js +65 -0
- package/package.json +33 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Mosaic Platform Skill
|
|
2
|
+
|
|
3
|
+
**Mosaic is your full-stack app development co-platform** - Database, Vector, Auth, Storage, Git, and Compute in one API.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ⚡ The 5 Steps to Ship an App
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ 1. CREATE PROJECT → Get slug + git repo + database │
|
|
12
|
+
│ 2. BUILD CODE → Clone repo, add files, git push │
|
|
13
|
+
│ 3. REQUEST DEPLOY → POST /{slug}/deploy │
|
|
14
|
+
│ 4. CHECK STATUS → Poll until status = "running" │
|
|
15
|
+
│ 5. DONE! → Live at https://{slug}.mosaic.site │
|
|
16
|
+
└─────────────────────────────────────────────────────────────┘
|
|
17
|
+
|
|
18
|
+
Need help? → Submit a ticket: POST /tickets
|
|
19
|
+
Want a feature? → Request it: POST /tickets with "Feature Request:" prefix
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 🔑 Authentication
|
|
25
|
+
|
|
26
|
+
**Base URL**: `https://api.mosaic.site/v1/project`
|
|
27
|
+
|
|
28
|
+
**Every request needs**: `X-API-Key: mk_xxxxx` header
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 1: CREATE PROJECT
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
curl -X POST https://api.mosaic.site/v1/project/projects \
|
|
36
|
+
-H "X-API-Key: $MOSAIC_API_KEY" \
|
|
37
|
+
-H "Content-Type: application/json" \
|
|
38
|
+
-d '{"name": "My App"}'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Response** (save these!):
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"id": "uuid-here",
|
|
45
|
+
"name": "My App",
|
|
46
|
+
"slug": "myapp-x4k2", ← Use this for all API calls!
|
|
47
|
+
"database": {
|
|
48
|
+
"host": "10.0.50.3",
|
|
49
|
+
"port": 6432,
|
|
50
|
+
"user": "tenant_myapp_x4k2",
|
|
51
|
+
"password": "auto-generated"
|
|
52
|
+
},
|
|
53
|
+
"git_repo_url": "https://git.mosaic.site/user/myapp-x4k2.git" ← Clone this!
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Optional: Create database tables now**
|
|
58
|
+
```bash
|
|
59
|
+
curl -X POST https://api.mosaic.site/v1/project/{slug}/sql \
|
|
60
|
+
-H "X-API-Key: $MOSAIC_API_KEY" \
|
|
61
|
+
-H "Content-Type: application/json" \
|
|
62
|
+
-d '{"query": "CREATE TABLE users (id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), email TEXT UNIQUE, name TEXT)", "params": []}'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Step 2: BUILD CODE
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Clone your repo
|
|
71
|
+
git clone https://git.mosaic.site/{user}/{slug}.git
|
|
72
|
+
cd {slug}
|
|
73
|
+
|
|
74
|
+
# Add your files (see Stack Detection below)
|
|
75
|
+
# ... create index.html, package.json, etc ...
|
|
76
|
+
|
|
77
|
+
# Commit and push
|
|
78
|
+
git add .
|
|
79
|
+
git commit -m "My awesome app"
|
|
80
|
+
git push
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Stack Detection - What Files to Create
|
|
84
|
+
|
|
85
|
+
| If you create... | Mosaic runs... | Dependencies |
|
|
86
|
+
|------------------|----------------|--------------|
|
|
87
|
+
| `index.html` only | nginx (static) | None needed! |
|
|
88
|
+
| `package.json` | Node.js | `npm install` automatic! |
|
|
89
|
+
| `requirements.txt` | Python | `pip install` automatic! |
|
|
90
|
+
| `go.mod` | Go | `go build` automatic! |
|
|
91
|
+
| `Cargo.toml` | Rust | `cargo build` automatic! |
|
|
92
|
+
|
|
93
|
+
**You don't install dependencies** - Mosaic does it during deploy!
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Step 3: REQUEST DEPLOY
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
curl -X POST https://api.mosaic.site/v1/project/{slug}/deploy \
|
|
101
|
+
-H "X-API-Key: $MOSAIC_API_KEY" \
|
|
102
|
+
-H "Content-Type: application/json" \
|
|
103
|
+
-d '{"repo_url": "https://git.mosaic.site/{user}/{slug}.git", "branch": "main"}'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Response**:
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"deployment_id": "deploy-myapp-x4k2-20240101120000",
|
|
110
|
+
"status": "pending",
|
|
111
|
+
"message": "Deployment started",
|
|
112
|
+
"url": "https://myapp-x4k2.mosaic.site"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Step 4: CHECK STATUS
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
curl https://api.mosaic.site/v1/project/{slug}/deploy/status \
|
|
122
|
+
-H "X-API-Key: $MOSAIC_API_KEY"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Poll this until status = "running"** (usually 15-30 seconds)
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"status": "running", ← When you see this, you're live!
|
|
130
|
+
"container_name": "deploy-myapp-x4k2",
|
|
131
|
+
"url": "https://myapp-x4k2.mosaic.site"
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**If status = "failed"**, check logs:
|
|
136
|
+
```bash
|
|
137
|
+
curl https://api.mosaic.site/v1/project/{slug}/deploy/logs \
|
|
138
|
+
-H "X-API-Key: $MOSAIC_API_KEY"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Step 5: DONE! 🎉
|
|
144
|
+
|
|
145
|
+
**Your app is live at**: `https://{slug}.mosaic.site`
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## 🆘 Submit a Support Ticket
|
|
150
|
+
|
|
151
|
+
Something not working? Submit a ticket:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
curl -X POST https://api.mosaic.site/v1/project/tickets \
|
|
155
|
+
-H "X-API-Key: $MOSAIC_API_KEY" \
|
|
156
|
+
-H "Content-Type: application/json" \
|
|
157
|
+
-d '{
|
|
158
|
+
"subject": "Deploy failing for myapp-x4k2",
|
|
159
|
+
"message": "Getting error: container not starting. Logs show..."
|
|
160
|
+
}'
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 💡 Request a Feature
|
|
166
|
+
|
|
167
|
+
Want something new? Prefix with "Feature Request:":
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
curl -X POST https://api.mosaic.site/v1/project/tickets \
|
|
171
|
+
-H "X-API-Key: $MOSAIC_API_KEY" \
|
|
172
|
+
-H "Content-Type: application/json" \
|
|
173
|
+
-d '{
|
|
174
|
+
"subject": "Feature Request: Custom domain support",
|
|
175
|
+
"message": "Would love to use my own domain mydomain.com instead of slug.mosaic.site"
|
|
176
|
+
}'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 📚 Full API Reference
|
|
182
|
+
|
|
183
|
+
### Projects
|
|
184
|
+
```
|
|
185
|
+
GET /projects → List all your projects
|
|
186
|
+
POST /projects → Create: {"name": "..."}
|
|
187
|
+
GET /{slug}/info → Project details
|
|
188
|
+
GET /{slug}/credentials → Database connection info
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Database (PostgreSQL + pgvector)
|
|
192
|
+
```
|
|
193
|
+
POST /{slug}/sql → {"query": "...", "params": [...]}
|
|
194
|
+
```
|
|
195
|
+
Extensions: `pgvector`, `uuid-ossp`, `pgcrypto`
|
|
196
|
+
|
|
197
|
+
### Deployment
|
|
198
|
+
```
|
|
199
|
+
POST /{slug}/deploy → {"repo_url": "...", "branch": "main"}
|
|
200
|
+
GET /{slug}/deploy/status → Check if running
|
|
201
|
+
GET /{slug}/deploy/logs → Build + runtime logs
|
|
202
|
+
POST /{slug}/restart → Restart container
|
|
203
|
+
POST /{slug}/stop → Stop container
|
|
204
|
+
POST /{slug}/start → Start stopped container
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Storage (S3)
|
|
208
|
+
```
|
|
209
|
+
GET /{slug}/storage/files → List files
|
|
210
|
+
POST /{slug}/storage/upload → Get upload URL
|
|
211
|
+
GET /{slug}/storage/files/{name} → Download URL
|
|
212
|
+
DELETE /{slug}/storage/files/{name} → Delete file
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Authentication (Magic Links)
|
|
216
|
+
```
|
|
217
|
+
POST /{slug}/auth/send-magic-link → {"email": "...", "redirect_url": "..."}
|
|
218
|
+
GET /{slug}/auth/verify → Verify token
|
|
219
|
+
GET /{slug}/auth/users → List authenticated users
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Support
|
|
223
|
+
```
|
|
224
|
+
GET /tickets → List your tickets
|
|
225
|
+
POST /tickets → {"subject": "...", "message": "..."}
|
|
226
|
+
GET /tickets/{id} → Ticket details
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## 🏷️ Plan Limits
|
|
232
|
+
|
|
233
|
+
| Resource | Free | Starter | Pro | Enterprise |
|
|
234
|
+
|----------|------|---------|-----|------------|
|
|
235
|
+
| Database | 2 GB | 10 GB | 50 GB | 500 GB |
|
|
236
|
+
| Storage | 5 GB | 20 GB | 100 GB | 1 TB |
|
|
237
|
+
| SQL queries/hr | 1,000 | 10,000 | 100,000 | 1,000,000 |
|
|
238
|
+
| Magic links/day | 10 | 100 | 1,000 | 10,000 |
|
|
239
|
+
| Container RAM | 512 MB | 1 GB | 2 GB | 8 GB |
|
|
240
|
+
| Container CPU | 0.5 | 1 | 2 | 4 |
|
|
241
|
+
|
|
242
|
+
### Check Database Usage
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
curl https://api.mosaic.site/v1/project/{slug}/database/usage \
|
|
246
|
+
-H "X-API-Key: $MOSAIC_API_KEY"
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Returns: size, limit, usage_percent, remaining space
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 🔗 URLs
|
|
254
|
+
|
|
255
|
+
| Service | URL |
|
|
256
|
+
|---------|-----|
|
|
257
|
+
| Dashboard | https://mosaic.site/dashboard |
|
|
258
|
+
| API | https://api.mosaic.site |
|
|
259
|
+
| Git | https://git.mosaic.site |
|
|
260
|
+
| Your Sites | https://{slug}.mosaic.site |
|
|
261
|
+
| This Skill | https://api.mosaic.site/skill.md |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## 💡 Tips
|
|
266
|
+
|
|
267
|
+
1. **Save the slug!** You need it for every API call
|
|
268
|
+
2. **Don't install deps** - Mosaic does it automatically
|
|
269
|
+
3. **Use $1, $2 in SQL** - Never concatenate strings
|
|
270
|
+
4. **Poll deploy status** - Wait for "running"
|
|
271
|
+
5. **Check logs on failure** - Shows exactly what went wrong
|
|
272
|
+
6. **Submit tickets freely** - We're here to help!
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 🔄 Keep This Skill Updated
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
curl -s https://api.mosaic.site/skill.md > CLAUDE.md
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
New features are added regularly. Re-fetch to get the latest!
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
*Mosaic: Ship apps in minutes, not months. One API, infinite possibilities.*
|
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# @mosaicsite/claude-skill
|
|
2
|
+
|
|
3
|
+
**Mosaic: Your full-stack app development co-platform.**
|
|
4
|
+
|
|
5
|
+
Give your AI assistant the complete skill to build and deploy production apps - Database, Vector Store, Auth, Storage, Git, and Compute, all unified in one friendly API.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx @mosaicsite/claude-skill
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The installer auto-detects your AI tools and installs appropriately:
|
|
14
|
+
|
|
15
|
+
| Tool | Install Location |
|
|
16
|
+
|------|-----------------|
|
|
17
|
+
| Claude Code | `CLAUDE.md` or `~/.claude/skills/mosaic.md` |
|
|
18
|
+
| Cursor | `.cursorrules` or `.cursor/mosaic.md` |
|
|
19
|
+
| GitHub Copilot | `.github/copilot-instructions.md` |
|
|
20
|
+
| Gemini | `GEMINI.md` |
|
|
21
|
+
| Generic | `AI_INSTRUCTIONS.md` |
|
|
22
|
+
|
|
23
|
+
## What Your AI Learns
|
|
24
|
+
|
|
25
|
+
After installation, your AI assistant can:
|
|
26
|
+
|
|
27
|
+
1. **Create projects** with PostgreSQL + pgvector + Git repo
|
|
28
|
+
2. **Design schemas** and execute SQL with vector search
|
|
29
|
+
3. **Build apps** - Auto-detects Node.js, Python, Go, Rust, static
|
|
30
|
+
4. **Deploy** - Push to Git, trigger deploy, live in 30 seconds
|
|
31
|
+
5. **Manage auth** via magic links
|
|
32
|
+
6. **Upload files** to S3 storage
|
|
33
|
+
7. **Submit tickets** when help is needed
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
1. Get your API key from https://mosaic.site/dashboard
|
|
38
|
+
2. Tell your AI: *"Build me a todo app on Mosaic"*
|
|
39
|
+
3. Provide your API key when asked
|
|
40
|
+
4. AI handles: project creation → database → code → Git → deploy → live URL
|
|
41
|
+
|
|
42
|
+
## Example Conversation
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
You: Build me a blog on Mosaic. My API key is mk_xxxxx
|
|
46
|
+
|
|
47
|
+
AI: I'll build your blog on Mosaic...
|
|
48
|
+
|
|
49
|
+
1. Creating project "blog"...
|
|
50
|
+
→ Slug: blog-a1b2
|
|
51
|
+
→ Git: https://git.mosaic.site/you/blog-a1b2.git
|
|
52
|
+
|
|
53
|
+
2. Setting up database...
|
|
54
|
+
→ Created tables: posts, authors
|
|
55
|
+
|
|
56
|
+
3. Building the app...
|
|
57
|
+
→ Created: package.json, server.js, public/index.html
|
|
58
|
+
|
|
59
|
+
4. Pushing to Git...
|
|
60
|
+
→ Committed and pushed
|
|
61
|
+
|
|
62
|
+
5. Deploying...
|
|
63
|
+
→ Status: running
|
|
64
|
+
|
|
65
|
+
✅ Your blog is live at https://blog-a1b2.mosaic.site
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Manual Installation
|
|
69
|
+
|
|
70
|
+
If auto-detect doesn't work:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Fetch latest skill
|
|
74
|
+
curl -s https://api.mosaic.site/skill.md >> CLAUDE.md
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Or copy `CLAUDE.md` from this package to your project.
|
|
78
|
+
|
|
79
|
+
## Keep Updated
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Re-run installer to get latest
|
|
83
|
+
npx @mosaicsite/claude-skill
|
|
84
|
+
|
|
85
|
+
# Or fetch directly
|
|
86
|
+
curl -s https://api.mosaic.site/skill.md > CLAUDE.md
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Links
|
|
90
|
+
|
|
91
|
+
- **Dashboard**: https://mosaic.site/dashboard
|
|
92
|
+
- **API Docs**: https://api.mosaic.site
|
|
93
|
+
- **Full Skill**: https://api.mosaic.site/skill.md
|
|
94
|
+
- **Support**: https://mosaic.site/support
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const skillContent = fs.readFileSync(
|
|
8
|
+
path.join(__dirname, '..', 'CLAUDE.md'),
|
|
9
|
+
'utf8'
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
// Detect which AI tools are present and install appropriately
|
|
13
|
+
const tools = [];
|
|
14
|
+
|
|
15
|
+
// Check for Claude Code
|
|
16
|
+
const claudeDir = path.join(os.homedir(), '.claude');
|
|
17
|
+
if (fs.existsSync(claudeDir) || process.env.CLAUDE_CODE) {
|
|
18
|
+
tools.push({
|
|
19
|
+
name: 'Claude Code',
|
|
20
|
+
paths: [
|
|
21
|
+
path.join(process.cwd(), 'CLAUDE.md'),
|
|
22
|
+
path.join(os.homedir(), '.claude', 'skills', 'mosaic.md'),
|
|
23
|
+
],
|
|
24
|
+
append: true, // Append to existing CLAUDE.md
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Check for Cursor
|
|
29
|
+
const cursorRules = path.join(process.cwd(), '.cursorrules');
|
|
30
|
+
if (fs.existsSync(cursorRules) || fs.existsSync(path.join(os.homedir(), '.cursor'))) {
|
|
31
|
+
tools.push({
|
|
32
|
+
name: 'Cursor',
|
|
33
|
+
paths: [
|
|
34
|
+
path.join(process.cwd(), '.cursor', 'mosaic.md'),
|
|
35
|
+
cursorRules,
|
|
36
|
+
],
|
|
37
|
+
append: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Check for GitHub Copilot
|
|
42
|
+
const copilotDir = path.join(process.cwd(), '.github');
|
|
43
|
+
if (fs.existsSync(copilotDir)) {
|
|
44
|
+
tools.push({
|
|
45
|
+
name: 'GitHub Copilot',
|
|
46
|
+
paths: [
|
|
47
|
+
path.join(copilotDir, 'copilot-instructions.md'),
|
|
48
|
+
],
|
|
49
|
+
append: true,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Check for Gemini
|
|
54
|
+
if (process.env.GEMINI_API_KEY || fs.existsSync(path.join(os.homedir(), '.config', 'gemini'))) {
|
|
55
|
+
tools.push({
|
|
56
|
+
name: 'Gemini',
|
|
57
|
+
paths: [
|
|
58
|
+
path.join(process.cwd(), 'GEMINI.md'),
|
|
59
|
+
path.join(os.homedir(), '.config', 'gemini', 'mosaic.md'),
|
|
60
|
+
],
|
|
61
|
+
append: false,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Default: Create a generic AI context file if no specific tool detected
|
|
66
|
+
if (tools.length === 0) {
|
|
67
|
+
tools.push({
|
|
68
|
+
name: 'Generic AI',
|
|
69
|
+
paths: [
|
|
70
|
+
path.join(process.cwd(), 'AI_INSTRUCTIONS.md'),
|
|
71
|
+
path.join(process.cwd(), 'CLAUDE.md'),
|
|
72
|
+
],
|
|
73
|
+
append: false,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Header for appended content
|
|
78
|
+
const appendHeader = `
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
<!-- Mosaic Platform Skill - Added by @mosaic/claude-skill -->
|
|
83
|
+
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
let installed = [];
|
|
87
|
+
|
|
88
|
+
for (const tool of tools) {
|
|
89
|
+
for (const location of tool.paths) {
|
|
90
|
+
try {
|
|
91
|
+
const dir = path.dirname(location);
|
|
92
|
+
if (!fs.existsSync(dir)) {
|
|
93
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (tool.append && fs.existsSync(location)) {
|
|
97
|
+
// Check if already installed
|
|
98
|
+
const existing = fs.readFileSync(location, 'utf8');
|
|
99
|
+
if (existing.includes('Mosaic Platform')) {
|
|
100
|
+
console.log(`⏭️ ${tool.name}: Already has Mosaic skill`);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
// Append to existing file
|
|
104
|
+
fs.appendFileSync(location, appendHeader + skillContent);
|
|
105
|
+
installed.push({ tool: tool.name, path: location, mode: 'appended' });
|
|
106
|
+
} else {
|
|
107
|
+
// Create new file
|
|
108
|
+
fs.writeFileSync(location, skillContent);
|
|
109
|
+
installed.push({ tool: tool.name, path: location, mode: 'created' });
|
|
110
|
+
}
|
|
111
|
+
break; // Successfully installed for this tool
|
|
112
|
+
} catch (err) {
|
|
113
|
+
// Try next location
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Output results
|
|
120
|
+
console.log(`
|
|
121
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
122
|
+
║ 🚀 Mosaic Skill Installed ║
|
|
123
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
124
|
+
`);
|
|
125
|
+
|
|
126
|
+
if (installed.length > 0) {
|
|
127
|
+
console.log('Installed for:\n');
|
|
128
|
+
for (const i of installed) {
|
|
129
|
+
console.log(` ✅ ${i.tool}`);
|
|
130
|
+
console.log(` ${i.path} (${i.mode})\n`);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
console.log(' ⚠️ Could not auto-detect AI tools.');
|
|
134
|
+
console.log(' Copy the skill manually from:');
|
|
135
|
+
console.log(' https://api.mosaic.site/skill.md\n');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
console.log(`
|
|
139
|
+
Your AI assistant now knows how to:
|
|
140
|
+
• Create Mosaic projects with PostgreSQL + pgvector
|
|
141
|
+
• Design database schemas and execute SQL
|
|
142
|
+
• Build apps (Node.js, Python, Go, Rust, static, etc.)
|
|
143
|
+
• Push to Git and deploy to production
|
|
144
|
+
• Manage storage, auth, and support tickets
|
|
145
|
+
|
|
146
|
+
Get your API key: https://mosaic.site/dashboard
|
|
147
|
+
|
|
148
|
+
Usage: Tell your AI "build me an app on Mosaic" and provide your API key.
|
|
149
|
+
`);
|
|
150
|
+
|
|
151
|
+
// Also offer to fetch latest from URL
|
|
152
|
+
console.log(`
|
|
153
|
+
💡 Tip: Keep the skill updated with:
|
|
154
|
+
curl -s https://api.mosaic.site/skill.md > CLAUDE.md
|
|
155
|
+
`);
|
package/index.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the Mosaic skill content for AI assistants
|
|
6
|
+
*/
|
|
7
|
+
function getSkillContent() {
|
|
8
|
+
return fs.readFileSync(
|
|
9
|
+
path.join(__dirname, 'CLAUDE.md'),
|
|
10
|
+
'utf8'
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Mosaic API helper for programmatic use
|
|
16
|
+
*/
|
|
17
|
+
class MosaicClient {
|
|
18
|
+
constructor(apiKey) {
|
|
19
|
+
this.apiKey = apiKey;
|
|
20
|
+
this.baseUrl = 'https://api.mosaic.site/v1/project';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async request(method, endpoint, body = null) {
|
|
24
|
+
const fetch = (await import('node-fetch')).default;
|
|
25
|
+
const options = {
|
|
26
|
+
method,
|
|
27
|
+
headers: {
|
|
28
|
+
'X-API-Key': this.apiKey,
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
if (body) options.body = JSON.stringify(body);
|
|
33
|
+
|
|
34
|
+
const response = await fetch(`${this.baseUrl}${endpoint}`, options);
|
|
35
|
+
return response.json();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Projects
|
|
39
|
+
listProjects() { return this.request('GET', '/projects'); }
|
|
40
|
+
createProject(name) { return this.request('POST', '/projects', { name }); }
|
|
41
|
+
|
|
42
|
+
// SQL
|
|
43
|
+
executeSQL(slug, query, params = []) {
|
|
44
|
+
return this.request('POST', `/${slug}/sql`, { query, params });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Deploy
|
|
48
|
+
deploy(slug, repoUrl, branch = 'main') {
|
|
49
|
+
return this.request('POST', `/${slug}/deploy`, { repo_url: repoUrl, branch });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
deployStatus(slug) {
|
|
53
|
+
return this.request('GET', `/${slug}/deploy/status`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Tickets
|
|
57
|
+
createTicket(subject, message) {
|
|
58
|
+
return this.request('POST', '/tickets', { subject, message });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
module.exports = {
|
|
63
|
+
getSkillContent,
|
|
64
|
+
MosaicClient,
|
|
65
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mosaicsite/claude-skill",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Mosaic Platform skill for Claude Code - build and deploy apps instantly",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mosaic-skill": "./bin/install.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node bin/install.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mosaic",
|
|
14
|
+
"mosaicsite",
|
|
15
|
+
"claude",
|
|
16
|
+
"claude-code",
|
|
17
|
+
"skill",
|
|
18
|
+
"paas",
|
|
19
|
+
"deployment",
|
|
20
|
+
"supabase-alternative",
|
|
21
|
+
"ai-coding"
|
|
22
|
+
],
|
|
23
|
+
"author": "Mosaic Platform <support@mosaic.site>",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://git.mosaic.site/mosaic/claude-skill.git"
|
|
28
|
+
},
|
|
29
|
+
"homepage": "https://mosaic.site",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://mosaic.site/support"
|
|
32
|
+
}
|
|
33
|
+
}
|